@solarpunkltd/swarm-chat-js 6.1.7 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +4606 -35251
- package/dist/index.js +11 -67
- package/dist/interfaces/chat.d.ts +2 -3
- package/dist/interfaces/chat.d.ts.map +1 -1
- package/dist/lib/core.d.ts +5 -11
- package/dist/lib/core.d.ts.map +1 -1
- package/dist/swarm-chat-umd.js +11 -67
- package/dist/transports/MessageTransport.d.ts +7 -0
- package/dist/transports/MessageTransport.d.ts.map +1 -0
- package/dist/transports/PollingTransport.d.ts +20 -0
- package/dist/transports/PollingTransport.d.ts.map +1 -0
- package/package.json +1 -3
- package/dist/lib/waku.d.ts +0 -22
- package/dist/lib/waku.d.ts.map +0 -1
package/dist/swarm-chat-umd.js
CHANGED
|
@@ -1,67 +1,11 @@
|
|
|
1
|
-
(function(gr,ir){typeof exports=="object"&&typeof module<"u"?ir(exports,require("@ethersphere/bee-js")):typeof define=="function"&&define.amd?define(["exports","@ethersphere/bee-js"],ir):(gr=typeof globalThis<"u"?globalThis:gr||self,ir(gr.SwarmChatJs={},gr.BeeJs))})(this,function(exports,beeJs){"use strict";var Qp=Object.defineProperty;var Cl=gr=>{throw TypeError(gr)};var e1=(gr,ir,Yr)=>ir in gr?Qp(gr,ir,{enumerable:!0,configurable:!0,writable:!0,value:Yr}):gr[ir]=Yr;var Ke=(gr,ir,Yr)=>e1(gr,typeof ir!="symbol"?ir+"":ir,Yr),t1=(gr,ir,Yr)=>ir.has(gr)||Cl("Cannot "+Yr);var ki=(gr,ir,Yr)=>(t1(gr,ir,"read from private field"),Yr?Yr.call(gr):ir.get(gr)),Bl=(gr,ir,Yr)=>ir.has(gr)?Cl("Cannot add the same private member more than once"):ir instanceof WeakSet?ir.add(gr):ir.set(gr,Yr);var gr,ir,Yr,Hc;const byteToHex=[];for(let y=0;y<256;++y)byteToHex.push((y+256).toString(16).slice(1));function unsafeStringify(y,u=0){return(byteToHex[y[u+0]]+byteToHex[y[u+1]]+byteToHex[y[u+2]]+byteToHex[y[u+3]]+"-"+byteToHex[y[u+4]]+byteToHex[y[u+5]]+"-"+byteToHex[y[u+6]]+byteToHex[y[u+7]]+"-"+byteToHex[y[u+8]]+byteToHex[y[u+9]]+"-"+byteToHex[y[u+10]]+byteToHex[y[u+11]]+byteToHex[y[u+12]]+byteToHex[y[u+13]]+byteToHex[y[u+14]]+byteToHex[y[u+15]]).toLowerCase()}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");getRandomValues=crypto.getRandomValues.bind(crypto)}return getRandomValues(rnds8)}const randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID};function v4(y,u,h){if(native.randomUUID&&!u&&!y)return native.randomUUID();y=y||{};const v=y.random||(y.rng||rng)();return v[6]=v[6]&15|64,v[8]=v[8]&63|128,unsafeStringify(v)}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$1(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}var cafeUtility={};(function(y){var u;Object.defineProperty(y,"__esModule",{value:!0}),y.Vector=y.Cache=y.Assertions=y.Strings=y.Types=y.Objects=y.Dates=y.Promises=y.Numbers=y.System=y.Arrays=y.Random=y.Elliptic=y.Binary=y.AsyncQueue=y.PubSubChannel=y.FixedPointNumber=y.MerkleTree=y.Chunk=y.Uint8ArrayWriter=y.Uint8ArrayReader=y.AsyncLazy=y.Lazy=y.Optional=void 0;async function h(S){return new Promise((I,P)=>S.then(P,I))}async function v(S){return h(Promise.all(S.map(h)))}async function w(S,I=1){const P=mf(S,I),Z=[],ue=P.map(async Se=>{for(const ze of Se)Z.push(await ze())});return await Promise.all(ue),Z}async function b(S){return new Promise(I=>setTimeout(()=>{I(!0)},S))}function E(S,I=Math.random){for(let P=S.length-1;P>0;P--){const Z=Math.floor(I()*(P+1)),ue=S[P];S[P]=S[Z],S[Z]=ue}return S}function $(S){if(S.length===1)return S[0];throw Error(`Expected exactly one element, actual: ${S.length}`)}function M(S){return S.length===1?S[0]:null}function T(S){return S.length>0?S[0]:null}function C(S){if(!S.length)throw Error("Received empty array");return S[0]}function B(S,I){const P=[];for(let Z=0;Z<S;Z++)P.push(I(Z));return P}function N(S){const I=[];for(let P=0;P<S[0].length;P++){I.push([]);for(let Z=0;Z<S.length;Z++)I[P].push(S[Z][P])}return I}function H(S,I,P){const Z=[];for(let ue=0;ue<S;ue++){Z.push([]);for(let Se=0;Se<I;Se++)Z[ue].push(P)}return Z}function te(S,I,P,Z){if(P<0||Z<0||Z+I[0].length>S[0].length||P+I.length>S.length)return!1;for(let ue=0;ue<I.length;ue++)for(let Se=0;Se<I[ue].length;Se++)if(I[ue][Se]!==void 0&&S[P+ue][Z+Se]!==I[ue][Se])return!1;return!0}function fe(S,I,P=Math.random){return E(ti(0,S.length-1),P).slice(0,I)}function ce(S,I){return S.map(P=>P[I])}function le(S){let I=S,P=3405648695,Z=3735928559;return function(){return I+=P,P^=I<<7,I*=Z,Z^=I<<13,I^=P^Z,(I>>>0)/4294967296}}function ie(S,I,P=Math.random){return Math.floor(P()*(I-S+1))+S}function ge(S,I,P=Math.random){return P()*(I-S)+S}function pe(){return Math.random()*2-1}function Me(S,I,P){return I>=S.x&&I<S.x+S.width&&P>=S.y&&P<S.y+S.height}function $e(S,I,P,Z=Math.random){let ue,Se;do ue=ie(0,S-1,Z),Se=ie(0,I-1,Z);while(P&&Me(P,ue,Se));return[ue,Se]}function Pe(S,I=Math.random){const P=Math.floor(S),Z=S-P;return Be(Z,I)?P+1:P}function Be(S,I=Math.random){return I()<S}function Re(S,I=Math.random){return S[Math.floor(S.length*I())]}function je(S,I,P=Math.random){if(I>S.length)throw new Error(`Count (${I}) is greater than array length (${S.length})`);return fe(S,I,P).map(Z=>S[Z])}function we(S,I,P,Z=Math.random){if(I>S.length)throw new Error(`Count (${I}) is greater than array length (${S.length})`);const ue=[];for(;ue.length<I;){const Se=Re(S,Z);ue.some(ze=>P(ze,Se))||ue.push(Se)}return ue}function D(S,I,P,Z,ue,Se=Math.random){const ze=S.filter(Je=>Je!==I&&Je!==P),Xe=[];for(I!==null&&Xe.push(I);ze.length&&Xe.length<Z;){const Je=y.Random.intBetween(0,ze.length-1,Se);ue(ze[Je],Xe)&&Xe.push(ze[Je]),ze.splice(Je,1)}return E(Xe,Se),{values:Xe,indexOfGuaranteed:I!==null?Xe.indexOf(I):-1}}function q(S){if(!S.length)throw Error("Received empty array");return S[S.length-1]}function O(S,I,P){return P(I.reduce((Z,ue)=>ue(Z),S))}function L(S,I){return P=>O(P,S,I)}function X(S,I,P){if(P===void 0&&(P=Math.random()),S.length!==I.length)throw new Error("Array length mismatch");let Z=I.reduce((Se,ze)=>Se+ze,0);const ue=P*Z;for(let Se=0;Se<S.length-1;Se++)if(Z-=I[Se],ue>=Z)return S[Se];return q(S)}function j(S,I,P=Math.random){const Z=I.map(Se=>P()*Se),ue=[];for(let Se=0;Se<S.length;Se++)ue.push([S[Se],Z[Se]]);return ue.sort((Se,ze)=>ze[1]-Se[1]).map(Se=>Se[0])}function re(S,I){if(S==null)return null;const P=I.split(".");let Z=S;for(const ue of P){if(Z[ue]===null||Z[ue]===void 0)return null;Z=Z[ue]}return Z}function ee(S,I,P){const Z=I.split(/\.|\[/);let ue=S;for(let Se=0;Se<Z.length;Se++){const ze=Z[Se],Xe=Se<Z.length-1&&Z[Se+1].includes("]"),Je=ze.includes("]")?ze.replace(/\[|\]/g,""):ze;if(Se===Z.length-1)return ue[Je]=P,P;Fe(ue[Je])||(Xe?ue[Je]=[]:ue[Je]={}),ue=ue[Je]}return P}function F(S,I,P=1){const Z=re(S,I)||0;return ee(S,I,Z+P),Z}function Q(S,I,P){return re(S,I)||ee(S,I,P)}function U(S,I){const P=va(I,"."),Z=Lo(I,".");if(!P||!Z)return;const ue=re(S,P);delete ue[Z]}function he(S,I,P){const Z=re(S,I);if(!Z)throw new Error("Key '"+I+"' does not exist.");return ee(S,I,P),Z}function Oe(S,I,P){for(const Z of I){const ue=re(S,Z);if(ue)return ue}if(P){const Z=Object.values(S);if(Z.length)return Z[0]}return null}async function Ve(S,I,P){for(;;){try{await S()}catch(Z){P&&P("Error in forever",Z)}await b(I)}}function Ae(S,I){S();const P=setInterval(()=>{S()},I);return()=>clearInterval(P)}function oe(S){return S/1024/1024}function ye(S){return S>=1024*1024*1024*1024?(S/1024/1024/1024/1024).toFixed(3)+" TB":S>=1024*1024*1024?(S/1024/1024/1024).toFixed(3)+" GB":S>=1024*1024?(S/1024/1024).toFixed(3)+" MB":S>=1024?(S/1024).toFixed(3)+" KB":S+" B"}function Ce(S){const I=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(S.toLowerCase());if(!I)throw new Error("Invalid hex color: "+S);return[parseInt(I[1],16),parseInt(I[2],16),parseInt(I[3],16)]}function ae(S){return"#"+S.map(I=>I.toString(16).padStart(2,"0")).join("")}function de(S,I,P,Z){const ue=S*Math.PI/180,Se=P*Math.PI/180,ze=(P-S)*Math.PI/180,Xe=(Z-I)*Math.PI/180,Je=Math.sin(ze/2)*Math.sin(ze/2)+Math.cos(ue)*Math.cos(Se)*Math.sin(Xe/2)*Math.sin(Xe/2);return 6371e3*(2*Math.atan2(Math.sqrt(Je),Math.sqrt(1-Je)))}function ne(S,I){return Math.round(S/I)*I}function be(S){return S>1e3?(S/1e3).toFixed(0)+" km":S>=500?ne(S,100)+" m":S>=100?ne(S,50)+" m":ne(S,10)+" m"}function Ie(S){return S*(S+1)/2}function Le(S){const I=S.match(/-?\d+(\.\d+)?/);if(!I)throw Error("No float found in "+S);return parseFloat(I[0])}function Fe(S,I=!0){return!S||I&&!nt(S._readableState)||I&&S.constructor&&(S.constructor.isBuffer||S.constructor.name=="Uint8Array"||S.constructor.name==="ArrayBuffer"||S.constructor.name==="ReadableStream")?!1:typeof S=="object"}function He(S){return Fe(S)&&!Array.isArray(S)}function tt(S){return Array.isArray(S)&&S.length===0}function Ne(S){return He(S)&&Object.keys(S).length===0}function nt(S){return S===void 0}function it(S){return Object.prototype.toString.call(S)==="[object Function]"||Object.prototype.toString.call(S)==="[object AsyncFunction]"}function ot(S){return Object.prototype.toString.call(S)==="[object String]"}function ut(S){return typeof S=="number"&&isFinite(S)}function ht(S){return S===!0||S===!1}function St(S){return Object.prototype.toString.call(S)==="[object Date]"}function Rt(S){return!ot(S)||S.trim().length===0}function dt(S){return ut(S)&&Number.isInteger(S)&&S>=1}function Ct(S){return ot(S)&&S.match(/^-?\d+$/)!==null}function Dt(S){return ot(S)&&S.match(/^(0x)?[0-9a-f]+$/i)!==null}const yt="!@#$%^&*()_+-=[]{}|;:<>?,./",zt="!@#$%^&*()_+-=[]{}|;:<>?,./".split(""),Zt="abcdefghijklmnopqrstuvwxyz",bt="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Lt="1234567890",Nt=Zt+bt+Lt,_t=Nt+yt,Vt=["—","\\","東","京","都","𝖆","𝖇","𝖈","👾","🙇","💁","🙅","ᚠ","ᛇ","ᚻ","ᛦ"],Wt="0123456789abcdef";function $t(S,I=Math.random){let P="";for(let Z=0;Z<S;Z++)P+=Zt[Math.floor(I()*Zt.length)];return P}function Qt(S,I=Math.random){let P="";for(let Z=0;Z<S;Z++)P+=Nt[Math.floor(I()*Nt.length)];return P}function Gt(S,I=Math.random){let P="";for(let Z=0;Z<S;Z++)P+=_t[Math.floor(I()*_t.length)];return P}function vt(S,I=Math.random){let P="";for(let Z=0;Z<S;Z++)P+=Vt[Math.floor(I()*Vt.length)];return P}function kt(S,I){const P=new RegExp(`[0-9a-f]{${I}}`,"i"),Z=S.match(P);return Z?Z[0]:null}function Kt(S,I,P=zt){const Z=cr(S,P);for(const ue of Z)if(I(ue))return ue;return null}function At(S,I=Math.random){let P="";for(let Z=0;Z<S;Z++)P+=Wt[Math.floor(I()*Wt.length)];return P}function Ft(S,I){if(!Ct(S))throw new TypeError(`Expected integer string${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);const P=BigInt(S);if(I&&(I.min&&P<I.min||I.max&&P>I.max))throw RangeError(`Expected integer string${I!=null&&I.name?` for ${I.name}`:""} in range: ${I.min??"-inf"}..${I.max??"inf"}; got: `+P);return S}function Jt(S,I){if(Rt(S))throw new TypeError(`Expected string${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);if(I&&(I.min!==void 0&&S.length<I.min||I.max!==void 0&&S.length>I.max))throw RangeError(`Expected string${I!=null&&I.name?` for ${I.name}`:""} length in range: ${I.min??"-inf"}..${I.max??"inf"}; got: ${S.length}`);return S}function ve(S,I){if(!Dt(S))throw new TypeError(`Expected hex string${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);const P=S.replace(/^0x/,"");if(I&&I.byteLength&&P.length!==I.byteLength*2)throw RangeError(`Expected hex string${I!=null&&I.name?` for ${I.name}`:""} of byte length ${I.byteLength}; got: `+P);return P}function J(S,I){if(!Jt(S,I).split("").every(P=>P==="_"||ri(P)))throw new TypeError(`Expected safe string${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return S}function se(S,I){if(I.min!==void 0&&S<I.min||I.max!==void 0&&S>I.max)throw RangeError(`Expected value${I!=null&&I.name?` for ${I.name}`:""} in range: ${I.min??"-inf"}..${I.max??"inf"}; got: ${S}`)}function xe(S,I){if(!it(S))throw new TypeError(`Expected function${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return S}function ke(S,I){if(ut(S))return I&&se(S,I),S;if(!ot(S)||!S.match(/^-?\d+(\.\d+)?$/))throw new TypeError(`Expected number${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);const P=parseFloat(S);return I&&se(P,I),P}function qe(S,I){return ke(S,I)|0}function We(S,I){if(S==="true")return!0;if(S==="false")return!1;if(!ht(S))throw new TypeError(`Expected boolean${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return S}function ct(S,I){if(!St(S))throw new TypeError(`Expected date${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return S}function wt(S){return Rt(S)?null:S}function st(S,I){if(!ot(S))throw new TypeError(`Expected string${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return S}function xt(S,I){if(dt(S))return S;const P=parseInt(S,10);if(!dt(P))throw new TypeError(`Expected id${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return P}function mt(S,I){if(!ot(S))throw new TypeError(`Expected time${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);const P=S.split(":");if(P.length!==2)throw new TypeError(`Expected time${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);const Z=parseInt(P[0],10),ue=parseInt(P[1],10);if(!ut(Z)||!ut(ue)||Z<0||Z>23||ue<0||ue>59)throw new TypeError(`Expected time, got${I!=null&&I.name?` for ${I.name}`:""}: `+S);return`${String(Z).padStart(2,"0")}:${String(ue).padStart(2,"0")}`}function Mt(S,I){if(!Array.isArray(S))throw new TypeError(`Expected array${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return S}function Yt(S,I){if(!He(S))throw new TypeError(`Expected object${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return S}function er(S,I){return S===null?null:Yt(S,I)}function rr(S,I){const P=Yt(S,I);for(const Z of Object.keys(P))if(!ot(P[Z]))throw new TypeError(`Expected string map${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return P}function qr(S,I){const P=Yt(S),Z=Object.keys(P),ue=Object.values(P);if(!Z.every(ot)||!ue.every(ut))throw new TypeError(`Expected numeric dictionary${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return P}function Dr(S){return ot(S)&&S.match(/^https?:\/\/.+/)!==null}function Zr(S,I){if(!Dr(S))throw new TypeError(`Expected url${I!=null&&I.name?` for ${I.name}`:""}, got: `+S);return S}function Hr(S,I){return I==null?!0:S(I)}function Vr(S,I){return I==null?null:S(I)}function Tr(S,I){return I==null?void 0:S(I)}function Nr(S,I){for(const[P,Z]of Object.entries(I))if(!Z(S[P]))throw TypeError(`${P} in value does not exist or match shape`);for(const P of Object.keys(S))if(!I[P])throw TypeError(`${P} exists in value but not in shape`);return!0}function Cr(S,I){return S.every(P=>Nr(P,I))}function Ar(S,I="json",P=0){if(Fe(S,!1)){if(P>1)return"[object Object]";if(I==="json"){if(Array.isArray(S)){const ue=S.map(Se=>Ar(Se,"json",P+1));return P===0?JSON.stringify(ue):ue}const Z={};S.message&&(Z.message=Ar(S.message,"json",P+1));for(const[ue,Se]of Object.entries(S))Z[ue]=Ar(Se,"json",P+1);return P===0?JSON.stringify(Z):Z}else if(I==="key-value"){const Z=Object.keys(S);return S.message&&!Z.includes("message")&&Z.unshift("message"),Z.map(ue=>`${ue}=${JSON.stringify(Ar(S[ue],"json",P+1))}`).join(" ")}}return nt(S)&&(S="undefined"),P===0?JSON.stringify(S):S}function Wr(S,I){if(ot(S))return S;const P=Object.keys(S);S.message&&!P.includes("message")&&P.push("message");const Z=P.map(ue=>`${ue}: ${S[ue]}`).join("; ");return I&&S.stack?Z+`
|
|
2
|
-
`+
|
|
3
|
-
`).map(
|
|
4
|
-
`)}function
|
|
5
|
-
\r.,?!:;"'\`(){}[]~@#$%^&*-+=|<>/\\`.split("");function
|
|
6
|
-
`],
|
|
7
|
-
`],
|
|
8
|
-
`],
|
|
9
|
-
`],Z);if(ue===-1){Z>P&&I.push({string:S.slice(P,Z),symbol:null}),I.push({string:S.slice(Z),symbol:"http"});break}Z>P&&I.push({string:S.slice(P,Z),symbol:null}),I.push({string:S.slice(Z,ue),symbol:"http"}),P=ue}return I}const Ss="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ho="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function mu(S){return ni(S,Ss)}function gu(S){return Vo(S,Ss)}function zo(S){return ni(S,Ho)}function $s(S){return Vo(S,Ho)}function ni(S,I){const P="=",Z=I.length;let ue=0,Se=0;const ze=[];for(let Xe=0;Xe<S.length;Xe++){const Je=S[Xe];if(Je===P)break;const pt=I.indexOf(Je);if(pt===-1)throw new Error(`Invalid character: ${Je}`);Se=Se<<Math.log2(Z)|pt,ue+=Math.log2(Z),ue>=8&&(ue-=8,ze.push(Se>>ue&255))}return new Uint8Array(ze)}function Vo(S,I){const P=I.length;let Z=0,ue=0,Se="";for(let ze=0;ze<S.length;ze++)for(ue=ue<<8|S[ze],Z+=8;Z>=Math.log2(P);)Z-=Math.log2(P),Se+=I[ue>>Z&P-1];return Z>0&&(Se+=I[ue<<Math.log2(P)-Z&P-1]),Se.length%4!==0&&(Se+="=".repeat(4-Se.length%4)),Se}function Wo(S){S.startsWith("0x")&&(S=S.slice(2));const I=S.length/2,P=new Uint8Array(I);for(let Z=0;Z<I;Z++){const ue=parseInt(S.slice(Z*2,Z*2+2),16);P[Z]=ue}return P}function jo(S){return Array.from(S).map(I=>I.toString(16).padStart(2,"0")).join("")}function Ia(S,I){const P=S.split("/").filter(Se=>Se),Z=I.split("/").filter(Se=>Se);if(P.length!==Z.length)return null;const ue={};for(let Se=0;Se<P.length;Se++){const ze=P[Se];if(ze.startsWith(":"))ue[ze.slice(1)]=Z[Se];else if(ze!==Z[Se])return null}return ue}function Fi(S,I,P){const Z=[];for(const ue of P)ue!==I&&Z.push(S.replace(I,ue));return Z}function Go(S,I,P,Z=Math.random){const ue=y.Arrays.shuffle(I.map(ze=>({variants:y.Arrays.shuffle(ze.variants.map(Xe=>Xe),Z),avoid:ze.avoid})),Z),Se=[];for(const ze of ue){const Xe=ze.variants.filter(pt=>pt!==ze.avoid),Je=Xe.find(pt=>S.includes(pt));if(Je&&(Bn(Se,Fi(S,Je,Xe)),Se.length>=P))break}if(Se.length<P)for(const ze of ue){const Xe=ze.variants.find(Je=>S.includes(Je));if(Xe&&(Bn(Se,Fi(S,Xe,ze.variants)),Se.length>=P))break}return Se.slice(0,P)}function yu(S,I,P,Z=!1){const ue=new RegExp(Z?`(?<=\\s|^)${I}(?=\\s|$)`:`\\b${I}\\b`,"g");return S.replace(ue,P)}function Ta(S,I){const P=/\b[A-Z][a-zA-Z0-9]*\b/g;return S.replace(P,Z=>Z.toUpperCase()===Z?Z:I(Z))}function Ca(S){return S.replace(/<[^>]*>/g,"")}function Ko(S){const I=S.lastIndexOf(" ");if(I===-1)return{line:S,rest:""};const P=S.slice(0,I),Z=S.slice(I+1);return{line:P,rest:Z}}function Jo(S,I={}){return[...S].reduce((P,Z)=>P+(I[Z]||1),0)}function Gr(S,I,P={}){const Z=[];let ue="",Se=0;for(let ze=0;ze<S.length;ze++){const Xe=S[ze],Je=P[Xe]||1;if(ue+=Xe,Se+=Je,Se>I){const{line:pt,rest:ar}=Ko(ue);Z.push(pt),ue=ar,Se=ar.split("").map(yr=>P[yr]||1).reduce((yr,ln)=>yr+ln,0)}}return ue&&Z.push(ue),Z}function Ba(S,I){const P=[];for(let Z=0;Z<=S.length;Z++)P[Z]=[Z];for(let Z=0;Z<=I.length;Z++)P[0][Z]=Z;for(let Z=1;Z<=S.length;Z++)for(let ue=1;ue<=I.length;ue++){const Se=S[Z-1]===I[ue-1]?0:1;P[Z][ue]=Math.min(P[Z-1][ue]+1,P[Z][ue-1]+1,P[Z-1][ue-1]+Se)}return P[S.length][I.length]}function ii(S,I){return new RegExp(`\\b${I}\\b`).test(S)}function Yo(S,I,P){return P==="any"?I.some(Z=>ii(S,Z)):I.every(Z=>ii(S,Z))}function Xo(S){const I={},P=S.match(/([a-z\-]+)="([^"]+)"/g);if(P)for(const Z of P){const[ue,Se]=ur(Z,"=");I[ue]=Se.slice(1,Se.length-1)}return I}function As(S,I,P=[]){let Z="";for(;I<S.length&&(ri(S[I])||P.includes(S[I]));)Z+=S[I++];return Z}function vu(S,I,P="$",Z=":"){for(const ue in I)S=Qo(S,ue,I[ue],P,Z);return S=ef(S),S}function Qo(S,I,P,Z="$",ue=":"){if(P==="")return S;let Se=S.indexOf(`${Z}${I}`);for(;Se!==-1;){if(S[Se+I.length+1]===ue)if(S[Se+I.length+2]===ue)S=S.replace(`${Z}${I}${ue}${ue}`,P);else{const ze=As(S,Se+I.length+2,["_"]);S=S.replace(`${Z}${I}${ue}${ze}`,P)}else S=S.replace(`${Z}${I}`,P);Se=S.indexOf(`${Z}${I}`,Se+P.length)}return S}function ef(S,I="$",P=":"){let Z=S.indexOf(I);for(;Z!==-1;){const ue=As(S,Z+1);if(S[Z+ue.length+1]===P)if(S[Z+ue.length+2]===P)S=S.replace(`${I}${ue}${P}${P}`,"");else{const Se=As(S,Z+ue.length+2);S=S.replace(`${I}${ue}${P}${Se}`,Se)}Z=S.indexOf(I,Z+1)}return S}function bu(S,I){let P=S.indexOf("](");for(;P!==-1;){const Z=$a(S,"[",P),ue=S.indexOf(")",P);if(Z!==-1&&ue!==-1){const[Se,ze]=S.slice(Z+1,ue).split("]("),Xe=I(Se,ze);S=S.slice(0,Z)+Xe+S.slice(ue+1)}P=S.indexOf("](",P+1)}return S}function si(S,I=!0){const P=Object.entries(S).filter(([Z,ue])=>ue!=null).map(([Z,ue])=>`${Z}=${encodeURIComponent(ue)}`).join("&");return P?(I?"?":"")+P:""}function _u(S){const I={},P=S.split("&");for(const Z of P){const[ue,Se]=Z.split("=");ue&&Se&&(I[ue]=decodeURIComponent(Se))}return I}function wu(S,I){return Object.prototype.hasOwnProperty.call(S,I)}function Ra(S,I){let P=null,Z=-1/0;for(const[ue,Se]of Object.entries(S)){const ze=I(Se);ze>Z&&(Z=ze,P=ue)}return P?[P,S[P]]:null}function tf(S,I,P,Z){const ue=S.find(ze=>ze[I]===P),Se=S.find(ze=>ze[I]===P+Z);ue&&Se?(ue[I]=P+Z,Se[I]=P):ue&&(ue[I]=P+Z),S.sort((ze,Xe)=>ke(ze[I])-ke(Xe[I])),S.forEach((ze,Xe)=>ze[I]=Xe+1)}function Hn(S){const I=Object.keys(S);if(I.length===1)return S[I[0]];throw new Error("Expected object to have a single key")}function Ms(S,I=":"){return Object.fromEntries(S.map(P=>ur(P,I)).map(P=>P[0]&&P[1]?[Ni(P[0]),Ni(P[1])]:null).filter(P=>P))}function xu(S,I,P){return qi(S,I)+si(P||{})}function Eu(S,I=",",P='"'){const Z=[];let ue="",Se=!1;const ze=S.split("");for(const Xe of ze)Xe===I&&!Se?(Z.push(ue),ue=""):Xe===P&&(!ue&&!Se||Se)?Se=!Se:ue+=Xe;return Z.push(ue),Z}function Su(S){return`[${Math.floor(S.progress*100)}%] ${Ye(S.deltaMs)} out of ${Ye(S.totalTimeMs)} (${Ye(S.remainingTimeMs)} left) [${Math.round(S.baseTimeMs)} ms each]`}async function bi(S,I,P){for(let Z=0;Z<P;Z++){try{if(await S())return!0}catch{}Z<P-1&&await b(I)}return!1}function fn(S,I){const P=[];for(let Z=S.length-1;Z>=0;Z--)I(S[Z])&&P.push(S.splice(Z,1)[0]);return P}function rf(S){return JSON.parse(JSON.stringify(S))}function $u(S){return Math.ceil((S||Date.now())/1e3)}function Au(S){return(S||new Date).toISOString().slice(0,10)}function Mu(S){return(S||new Date).toISOString().slice(0,19).replace(/T|:/g,"-")}function Iu(S){const I=new Date(S);return new Date(I.getTime()-I.getTimezoneOffset()*6e4)}function Tu(S){return new Date(S)}function Fr(S){return String(Math.floor(S)).padStart(2,"0")}function Ue(S){let[I,P]=S.split(":");ut(parseInt(I,10))||(I="0"),ut(parseInt(P,10))||(P="0");let Z=fi(qe(I),0,23),ue=fi(qe(P),0,59);return`${Fr(Z)}:${Fr(ue)}`}function Ye(S){const I=Math.floor(S/36e5);S=S%36e5;const P=Math.floor(S/6e4);S=S%6e4;const Z=Math.floor(S/1e3);return I?`${Fr(I)}:${Fr(P)}:${Fr(Z)}`:`${Fr(P)}:${Fr(Z)}`}function Ge(S){return Math.floor((St(S)?S.getTime():S)/864e5)}const lt={today:(S,I)=>Fr(S)+":"+Fr(I),yesterday:()=>"Yesterday",monday:()=>"Mon",tuesday:()=>"Tue",wednesday:()=>"Wed",thursday:()=>"Thu",friday:()=>"Fri",saturday:()=>"Sat",sunday:()=>"Sun",weeks:S=>`${S}w`};function Bt(S,I){const P=new Date((I==null?void 0:I.now)||Date.now()),Z=(I==null?void 0:I.labels)||lt,ue=St(S)?S:new Date(S);if(Ge(P)===Ge(ue))return Z.today(ue.getUTCHours(),ue.getUTCMinutes(),ue.getUTCHours()>12);if(Ge(P)-Ge(ue)===1)return Z.yesterday();const Se=nr(ue);return Ge(P)-Ge(ue)<7?Z[Se.day]():Z.weeks(Math.round((P.getTime()-ue.getTime())/6048e5))}const tr={now:()=>"A few seconds",seconds:S=>`${S} seconds`,minutes:S=>`${S} minutes`,hours:S=>`${S} hours`,days:S=>`${S} days`,weeks:S=>`${S} weeks`};function _r(S,I){const P=(I==null?void 0:I.now)??Date.now(),Z=(I==null?void 0:I.labels)||tr,ue=y.Types.isDate(S)?S.getTime():S;let Se=(P-ue)/1e3;return Se<10?Z.now():Se<120?Z.seconds(Math.floor(Se)):(Se/=60,Se<120?Z.minutes(Math.floor(Se)):(Se/=60,Se<48?Z.hours(Math.floor(Se)):(Se/=24,Se<14?Z.days(Math.floor(Se)):(Se/=7,Z.weeks(Math.floor(Se))))))}function lr(S,I=tr){return _r(0,{now:S*1e3,labels:I})}function Oa(S,I,P){const Z=((P==null?void 0:P.now)??Date.now())-S,ue=Math.floor(Z/I),Se=I/((P==null?void 0:P.precision)??1)-Math.ceil(Z%I/((P==null?void 0:P.precision)??1));return{cycles:ue,remaining:Se}}const ka={};function en(S,I){return!ka[S]||Date.now()>ka[S]?(ka[S]=Date.now()+I,!0):!1}const Is={s:1e3,m:6e4,h:36e5,d:864e5};function Cu(S,I,P){return I=St(I)?I.getTime():I,P=P?St(P)?P.getTime():P:Date.now(),(P-I)/Is[S]}function _i(S,I,P,Z){Z||(Z=Date.now());const ue=I/P,Se=Z-S,ze=Se/I,Xe=ze*P,Je=Xe-Se;return{deltaMs:Se,progress:ue,baseTimeMs:ze,totalTimeMs:Xe,remainingTimeMs:Je}}const Ts={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"};function Ui(S){return{zeroBasedIndex:S,day:Ts[S]}}function nr(S){return Ui(S.getDay())}function Bu(S){return nr(new Date(S))}function nf(S){return S*1e3}function Cs(S){return S*6e4}function Ru(S){return S*36e5}function Ou(S){return S*864e5}const ku={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 Bs(S){const I=parseFloat(S);if(isNaN(I))throw Error("makeDate got NaN for input");const P=S.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),Z=ku[P];if(!Z)throw Error(`Unknown unit: "${P}"`);return I*Z}const zn={b:1,byte:1,bytes:1,kb:1024,kilobyte:1024,kilobytes:1024,mb:1024**2,megabyte:1024**2,megabytes:1024**2,gb:1024**3,gigabyte:1024**3,gigabytes:1024**3,tb:1024**4,terabyte:1024**4,terabytes:1024**4};function Rs(S){const I=parseFloat(S);if(isNaN(I))throw Error("makeDate got NaN for input");const P=S.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),Z=zn[P];if(!Z)throw Error(`Unknown unit: "${P}"`);return I*Z}function sf(S){return S.replace(/ +/g," ").replace(/^ /gm,"")}const wi={};async function af(S,I,P){const Z=Date.now(),ue=wi[S];if(ue&&ue.validUntil>Z)return ue.value;const Se=await P(),ze=Z+I;return wi[S]={value:Se,validUntil:ze},Se}function of(S){delete wi[S]}function qi(...S){return S.filter(I=>I).join("/").replace(new RegExp("(?<!:)\\/+","g"),"/")}function ff(S,I,P,Z,ue=!0){const Se=S.indexOf(I),ze=S.indexOf(P,Se+I.length);if(Se===-1||ze===-1)throw Error("Start or end not found");return ue?S.substring(0,Se+I.length)+Z+S.substring(ze):S.substring(0,Se)+Z+S.substring(ze+P.length)}function Zi(S){let I="p";S.startsWith("#")?(I="h1",S=S.slice(1).trim()):S.startsWith("-")&&(I="li",S=S.slice(1).trim());const P=S[0]===S[0].toUpperCase(),Z=/[.?!]$/.test(S),ue=/:$/.test(S);return{type:I,isCapitalized:P,hasPunctuation:Z,endsWithColon:ue}}function ai(S,I="(",P=")"){let Z=0,ue=0;for(;ue<S.length;)if(S.startsWith(I,ue)?(Z++,ue+=I.length):S.startsWith(P,ue)?(Z--,ue+=P.length):ue++,Z<0)return!1;return I===P?Z%2===0:Z===0}function Os(S){S=S.normalize("NFD").replace(/[\u0300-\u036f]/g,"");let I=S.length;for(;S=S.replace(/(\w+)[\s,']+\w+/g,"$1"),S.length!==I;)I=S.length;return S=S.replaceAll(/[A-Z][a-zA-Z0-9]*/g,"A"),S=S.replaceAll(/[a-z][a-zA-Z0-9]*/g,"a"),S=S.replaceAll(/[\u4E00-\u9FA5]+/g,"Z"),S}function uf(S){const I=Object.keys(S).sort((Z,ue)=>Z.localeCompare(ue)),P={};for(const Z of I)P[Z]=oi(S[Z]);return P}function cf(S){const I=[];return S.sort((P,Z)=>JSON.stringify(oi(P)).localeCompare(JSON.stringify(oi(Z)))).forEach(P=>I.push(oi(P))),I}function oi(S){return Array.isArray(S)?cf(S):Fe(S)?uf(S):S}function Hi(S,I){return JSON.stringify(oi(S))===JSON.stringify(oi(I))}function ks(...S){for(let I=1;I<S.length;I++)if(!Hi(S[I-1],S[I]))return!1;return!0}function Pa(S){try{return JSON.parse(S)}catch{return null}}function Pu(){let S=0;return{next:()=>S++}}function lf(S){let I=0;return{next:()=>S[I++%S.length]}}function Du(S){let I;return P=>{const Z=P===S&&I!==S;return I=P,Z}}function Nu(S,I,P,Z,ue){const Se={};for(const ze of Object.keys(I))Se[ze]=[];Se[Z]=[],ue&&(S=S.sort(ue));for(const ze of S){const Xe=ze[P],Je=I[Xe]?Xe:Z;Se[Je].length>=I[Je]?Se[Z].push(ze):Se[Je].push(ze)}return Se}function xr(S,I){const P=Object.keys(S),Z=Object.keys(I);return{uniqueToA:P.filter(ue=>!Z.includes(ue)),uniqueToB:Z.filter(ue=>!P.includes(ue))}}function Br(S){const I=Object.keys(S);return I[Math.floor(Math.random()*I.length)]}function Lu(S,I){const P=Br(S);return S[P]=I(S[P]),P}function Fu(S){return S=S.replace(/\r\n/g,`
|
|
10
|
-
`),S=S.replace(/(\w+)\((.+)\)/g,(I,P,Z)=>`${P}(${Z.replaceAll(",",",")})`),S=S.replace(/(,)(\s+})/g,"$2"),S=S.replace(/\.\.\..+?,/g,""),S=S.replace(/({\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',"),S=S.replace(/(,\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',"),S=S.replace(/:(.+)\?(.+):/g,(I,P,Z)=>`: (${P.trim()} && ${Z.trim()}) ||`),S=S.replace(/([a-zA-Z0-9]+)( ?: ?{)/g,'"$1"$2'),S=S.replace(/([a-zA-Z0-9]+) ?: ?(.+?)(,|\n|})/g,(I,P,Z,ue)=>`"${P}":"${Z.trim()}"${ue}`),S=S.replace(/("'|'")/g,'"'),S=S.replaceAll(",",","),JSON.parse(S)}const On=[1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24,1e27,1e30,1e9,1e16,1e18,1e18,1e18,1e33],Uu=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","gwei","bzz","btc","eth","dai","decillion"],Ps=["K","M","B","T","Qa","Qi","Sx","Sp","O","N","gwei","bzz","eth","btc","dai","D"];function zi(S,I,P){let Z=S.length-I;if(Z<=0)return"0."+"0".repeat(-Z)+S+(P?" "+P:"");let ue=S.substring(0,Z),Se=S.substring(Z);return ue===""&&(ue="0"),ue+"."+Se+(P?" "+P:"")}function Da(S,I){const P=(I==null?void 0:I.longForm)??!1,Z=I!=null&&I.unit?` ${I.unit}`:"",ue=P?Uu:Ps,Se=(I==null?void 0:I.precision)??1;if(S<On[0])return`${S}${Z}`;for(let ze=0;ze<On.length-1;ze++)if(S<On[ze+1])return`${(S/On[ze]).toFixed(Se)}${P?" ":""}${ue[ze]}${Z}`;return`${(S/On[On.length-1]).toFixed(Se)}${P?" ":""}${ue[On.length-1]}${Z}`}function Vn(S){const I=parseFloat(S);if(isNaN(I))throw Error("makeNumber got NaN for input");const P=S.replace(/^-?[0-9.]+/,"").trim(),Z=Ps.findIndex(ue=>ue.toLowerCase()===P.toLowerCase());return Z===-1?I:I*On[Z]}function fi(S,I,P){return S<I?I:S>P?P:S}function Vi(S,I,P){const Z=S+I;return Z>P?P:Z}function Ds(S,I,P){const Z=S-I;return Z<P?P:Z}function xi(S,I){return I(S),S}function qu(S,I){S&&I(S)}function Zu(S,I){const P=Object.keys(I);for(const Z of P)Array.isArray(I[Z])&&Array.isArray(S[Z])&&Bn(S[Z],I[Z])}function Hu(S){return S.splice(0,S.length),S}function zu(S){for(const I of Object.keys(S))(tt(S[I])||Array.isArray(S[I])&&S[I].every(P=>P==null))&&delete S[I];return S}function Vu(S){for(const I of Object.entries(S))(I[1]===null||I[1]===void 0||ot(I[1])&&Rt(I[1]))&&delete S[I[0]];return S}function Ns(S,I){const P={};for(const[Z,ue]of Object.entries(S))I(Z)&&(P[Z]=ue);return P}function Wi(S,I){const P={};for(const[Z,ue]of Object.entries(S))I(ue)&&(P[Z]=ue);return P}function df(S,I){const P={};for(const Z of Object.entries(S))P[Z[0]]=I(Z[1]);return P}function _e(S,I){const P=[];let Z=0;for(const ue of S)P.push(I(ue,Z++));return P}async function Ei(S,I){try{return await S()}catch{throw I}}function Ls(S,I,P){P!=null&&(S[I]=P)}function tn(S,I,P,Z){const ue=re(P,Z);ue!=null&&ee(S,I,ue)}function Ht(S){const I={};for(const[P,Z]of Object.entries(S))I[Z]=P;return I}function Wu(S){const I=Object.keys(S),P=I.map(Xe=>S[Xe].length),Z=P.reduce((Xe,Je)=>Xe*=Je);let ue=1;const Se=[1];for(let Xe=0;Xe<P.length-1;Xe++)ue*=P[Xe],Se.push(ue);const ze=[];for(let Xe=0;Xe<Z;Xe++){const Je={};for(let pt=0;pt<I.length;pt++){const ar=S[I[pt]],yr=Math.floor(Xe/Se[pt])%ar.length;Je[I[pt]]=ar[yr]}ze.push(Je)}return ze}function ju(S){return Object.values(S).filter(I=>I).length}function Gu(S,I,P){return S+(P?"["+I+"]":(S.length?".":"")+I)}function wn(S,I,P,Z,ue){if(!Fe(I))return I;for(const[Se,ze]of Object.entries(I)){const Xe=Gu(P,Se,Z);Array.isArray(ze)?ue?wn(S,ze,Xe,!0,ue):S[Xe]=ze.map(Je=>wn(Array.isArray(Je)?[]:{},Je,"",!1,ue)):Fe(ze)?wn(S,ze,Xe,!1,ue):S[Xe]=ze}return S}function Ku(S,I=!1,P){return wn({},S,P||"",!1,I)}function hf(S){if(!Fe(S))return S;const I=Array.isArray(S)?[]:{};for(const[P,Z]of Object.entries(S))Array.isArray(Z)?ee(I,P,Z.map(ue=>hf(ue))):ee(I,P,Z);return I}function Ju(S,I,P){return I[S]?I[S]:P}function pf(S,I){const P={};for(const Z of S){const ue=I(Z);P[ue]=Z}return P}function Yu(S,I){const P={};for(const Z of S){const ue=I(Z);P[ue]||(P[ue]=[]),P[ue].push(Z)}return P}function kn(S,I){const P=[];for(let Z=0;Z<S.length;Z+=I)P.push(S.slice(Z,Z+I));return P}function mf(S,I){const P=Math.ceil(S.length/I),Z=[];for(let ue=0;ue<S.length;ue+=P)Z.push(S.slice(ue,ue+P));return Z}function gf(S,I){const P=[],Z=Math.ceil(S.length/I);for(let ue=0;ue<Z;ue++)P.push(S.slice(ue*I,ue*I+I));return P}function Xu(S,I){const P=Math.ceil(S.length/I);return gf(S,P)}function Qu(S,I){return Object.values(pf(S,I))}function tc(S,I,P,Z,ue){const Se=I?S.map(I):S,ze={};for(const Je of Se)ze[Je]=(ze[Je]||0)+1;const Xe=Z?xn(ze,ue?(Je,pt)=>Je[1]-pt[1]:(Je,pt)=>pt[1]-Je[1]):ze;return P?Object.keys(Xe):Xe}function xn(S,I){return Object.fromEntries(Object.entries(S).sort(I))}function rc(S){const I=[],P=Object.keys(S),Z=S[P[0]].length;for(let ue=0;ue<Z;ue++){const Se={};for(const ze of P)Se[ze]=S[ze][ue];I.push(Se)}return I}function nc(S,I,P=1){for(const Z of S)Z[I]+=P}function ic(S,I,P){for(const Z of S)Z[I]=P}function Na(S,I){const P=[];let Z=[];return S.forEach((ue,Se)=>{(Se===0||!I(ue,S[Se-1]))&&(Z=[],P.push(Z)),Z.push(ue)}),P}function sc(){return{map:new Map,keys:[]}}function ui(){return{map:new Map,keys:[]}}function yf(S,I,P,Z=100){if(S.map.has(I)){const ue=S.keys.indexOf(I);S.keys.splice(ue,1)}if(S.map.set(I,P),S.keys.push(I),S.keys.length>Z){const ue=S.keys.shift();ue&&S.map.delete(ue)}}function ac(S,I,P,Z=100){if(S.map.has(I)){const ue=S.keys.indexOf(I);S.keys.splice(ue,1)}if(S.map.set(I,P),S.keys.unshift(I),S.keys.length>Z){const ue=S.keys.shift();ue&&S.map.delete(ue)}}function un(S,I,P,Z,ue=100){yf(S,I,{validUntil:Date.now()+Z,data:P},ue)}function oc(S,I){const P=S.map.get(I);return P&&P.validUntil>Date.now()?P.data:null}class Wn{constructor(I){this.value=I}static of(I){return new Wn(I)}static empty(){return new Wn(null)}map(I){return new Wn(this.value!==null&&this.value!==void 0?I(this.value):null)}mapAsync(I){return this.value!==null&&this.value!==void 0?I(this.value).then(P=>Wn.of(P)):Promise.resolve(Wn.empty())}ifPresent(I){return this.value!==null&&this.value!==void 0&&I(this.value),this}ifPresentAsync(I){return this.value!==null&&this.value!==void 0?I(this.value).then(()=>this):Promise.resolve(this)}ifAbsent(I){return(this.value===null||this.value===void 0)&&I(),this}ifAbsentAsync(I){return this.value===null||this.value===void 0?I().then(()=>this):Promise.resolve(this)}getOrFallback(I){return this.value??I()}getOrFallbackAsync(I){return this.value!==null&&this.value!==void 0?Promise.resolve(this.value):I()}getOrThrow(){if(this.value===null||this.value===void 0)throw Error("Optional.value is empty");return this.value}}y.Optional=Wn;class fc{constructor(I){this.supplier=I,this.value=null}get(){return this.value||(this.value=this.supplier()),this.value}}y.Lazy=fc;class uc{constructor(I){this.supplier=I,this.value=null}async get(){return this.value||(this.value=await this.supplier()),this.value}}y.AsyncLazy=uc;function cc(S){return()=>S.forEach(I=>I())}function vf(S,I){return S.reduce((P,Z)=>I(P)>I(Z)?P:Z)}function bf(S,I){const P=S.find(Z=>Z instanceof I);return Wn.of(P)}function lc(S,I){return S.filter(P=>P instanceof I)}function dc(S,I){const P=[],Z=Math.max(S.length,I.length);for(let ue=0;ue<Z;ue++)S[ue]&&P.push(S[ue]),I[ue]&&P.push(I[ue]);return P}function La(S,I){return S.includes(I)?S.filter(P=>P!==I):[...S,I]}class ji{constructor(I){this.value=I,this.children=[]}}function Fs(S,I,P,Z,ue=!1){const Se=new Map,ze=[];S.forEach(Je=>{const pt=new ji(Je);Se.set(Je[I],pt)}),S.forEach(Je=>{const pt=Se.get(Je[I]);if(!pt)return;const ar=Je[P];if(ar){const yr=Se.get(ar);yr&&yr.children.push(pt)}else ze.push(pt)});const Xe=Je=>{Je.children.sort((pt,ar)=>{const yr=pt.value[Z],ln=ar.value[Z];return ue?ln-yr:yr-ln}),Je.children.forEach(Xe)};return ze.forEach(Xe),ze}function _f(S,I){if(Math.log2(S.length)%1!==0)throw new Error("Array length must be a power of 2");let P=[...S];for(;P.length>1;){const Z=[];for(let ue=0;ue<P.length;ue+=2){const Se=P[ue+1];Z.push(I(P[ue],Se))}P=Z}return P[0]}function ci(...S){const I=S.reduce((ue,Se)=>ue+Se.length,0),P=new Uint8Array(I);let Z=0;return S.forEach(ue=>{P.set(ue,Z),Z+=ue.length}),P}function wf(S){return S[0]===137&&S[1]===80&&S[2]===78&&S[3]===71}function En(S){return S[0]===255&&S[1]===216}function Us(S){return S[8]===87&&S[9]===69&&S[10]===66&&S[11]===80}function li(S){return wf(S)||En(S)||Us(S)}function rn(S){return new Uint8Array([S])}function hc(S){return S[0]}function xf(S,I){const P=new ArrayBuffer(2);return new DataView(P).setUint16(0,S,I==="LE"),new Uint8Array(P)}function Ef(S,I){return new DataView(S.buffer).getUint16(S.byteOffset,I==="LE")}function Gi(S,I){const P=new ArrayBuffer(4);return new DataView(P).setUint32(0,S,I==="LE"),new Uint8Array(P)}function jn(S,I){return new DataView(S.buffer).getUint32(S.byteOffset,I==="LE")}function qs(S,I){const P=new ArrayBuffer(8);return new DataView(P).setBigUint64(0,BigInt(S),I==="LE"),new Uint8Array(P)}function pc(S,I){return new DataView(S.buffer).getBigUint64(S.byteOffset,I==="LE")}function Pn(S,I){const P=new Uint8Array(32);let Z=S;if(I==="LE"){for(let ue=0;ue<32;ue++)P[ue]=Number(Z&0xffn),Z>>=8n;return P}for(let ue=31;ue>=0;ue--)P[ue]=Number(Z&0xffn),Z>>=8n;return P}function Si(S,I){let P=0n;if(I==="LE"){for(let Z=31;Z>=0;Z--)P=P<<8n|BigInt(S[Z]);return P}for(let Z=0;Z<32;Z++)P=P<<8n|BigInt(S[Z]);return P}function Sf(S,I){const P=[];let Z=0;for(const ue of I)P.push(S.subarray(Z,Z+ue)),Z+=ue;return P}function Er(S,I){const P=[];for(let Z=0;Z<S.length;Z+=I)P.push(S.subarray(Z,Z+I));return P}const Zs=[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 $f(S){for(let I=0;I<24;I++){const P=S[0]^S[10]^S[20]^S[30]^S[40],Z=S[1]^S[11]^S[21]^S[31]^S[41],ue=S[2]^S[12]^S[22]^S[32]^S[42],Se=S[3]^S[13]^S[23]^S[33]^S[43],ze=S[4]^S[14]^S[24]^S[34]^S[44],Xe=S[5]^S[15]^S[25]^S[35]^S[45],Je=S[6]^S[16]^S[26]^S[36]^S[46],pt=S[7]^S[17]^S[27]^S[37]^S[47],ar=S[8]^S[18]^S[28]^S[38]^S[48],yr=S[9]^S[19]^S[29]^S[39]^S[49],ln=ue<<1|Se>>>31,Nf=Se<<1|ue>>>31,Mi=ar^ln,ss=yr^Nf,Lf=ze<<1|Xe>>>31,Ii=Xe<<1|ze>>>31,Nn=P^Lf,as=Z^Ii,Ff=Je<<1|pt>>>31,Uf=pt<<1|Je>>>31,Yn=ue^Ff,Ti=Se^Uf,Js=ar<<1|yr>>>31,to=yr<<1|ar>>>31,Xn=ze^Js,os=Xe^to,qf=P<<1|Z>>>31,Ys=Z<<1|P>>>31,Ci=Je^qf,hi=pt^Ys;S[0]^=Mi,S[1]^=ss,S[2]^=Nn,S[3]^=as,S[4]^=Yn,S[5]^=Ti,S[6]^=Xn,S[7]^=os,S[8]^=Ci,S[9]^=hi,S[10]^=Mi,S[11]^=ss,S[12]^=Nn,S[13]^=as,S[14]^=Yn,S[15]^=Ti,S[16]^=Xn,S[17]^=os,S[18]^=Ci,S[19]^=hi,S[20]^=Mi,S[21]^=ss,S[22]^=Nn,S[23]^=as,S[24]^=Yn,S[25]^=Ti,S[26]^=Xn,S[27]^=os,S[28]^=Ci,S[29]^=hi,S[30]^=Mi,S[31]^=ss,S[32]^=Nn,S[33]^=as,S[34]^=Yn,S[35]^=Ti,S[36]^=Xn,S[37]^=os,S[38]^=Ci,S[39]^=hi,S[40]^=Mi,S[41]^=ss,S[42]^=Nn,S[43]^=as,S[44]^=Yn,S[45]^=Ti,S[46]^=Xn,S[47]^=os,S[48]^=Ci,S[49]^=hi;const ro=S[0],Xs=S[1],dn=S[2]<<1|S[3]>>>31,Qs=S[3]<<1|S[2]>>>31,ea=S[5]<<30|S[4]>>>2,no=S[4]<<30|S[5]>>>2,ta=S[6]<<28|S[7]>>>4,io=S[7]<<28|S[6]>>>4,so=S[8]<<27|S[9]>>>5,hn=S[9]<<27|S[8]>>>5,us=S[11]<<4|S[10]>>>28,cs=S[10]<<4|S[11]>>>28,ls=S[13]<<12|S[12]>>>20,Bi=S[12]<<12|S[13]>>>20,Qn=S[14]<<6|S[15]>>>26,Et=S[15]<<6|S[14]>>>26,Ri=S[17]<<23|S[16]>>>9,ds=S[16]<<23|S[17]>>>9,Ln=S[18]<<20|S[19]>>>12,ao=S[19]<<20|S[18]>>>12,hs=S[20]<<3|S[21]>>>29,ra=S[21]<<3|S[20]>>>29,Ir=S[22]<<10|S[23]>>>22,oo=S[23]<<10|S[22]>>>22,fo=S[25]<<11|S[24]>>>21,na=S[24]<<11|S[25]>>>21,uo=S[26]<<25|S[27]>>>7,ia=S[27]<<25|S[26]>>>7,co=S[29]<<7|S[28]>>>25,lo=S[28]<<7|S[29]>>>25,ho=S[31]<<9|S[30]>>>23,pn=S[30]<<9|S[31]>>>23,Or=S[33]<<13|S[32]>>>19,ps=S[32]<<13|S[33]>>>19,po=S[34]<<15|S[35]>>>17,gs=S[35]<<15|S[34]>>>17,mo=S[36]<<21|S[37]>>>11,go=S[37]<<21|S[36]>>>11,pi=S[38]<<8|S[39]>>>24,sa=S[39]<<8|S[38]>>>24,aa=S[40]<<18|S[41]>>>14,yo=S[41]<<18|S[40]>>>14,vo=S[42]<<2|S[43]>>>30,bo=S[43]<<2|S[42]>>>30,_o=S[45]<<29|S[44]>>>3,oa=S[44]<<29|S[45]>>>3,fa=S[47]<<24|S[46]>>>8,wo=S[46]<<24|S[47]>>>8,ys=S[48]<<14|S[49]>>>18,ua=S[49]<<14|S[48]>>>18;S[0]=ro^~ls&fo,S[1]=Xs^~Bi&na,S[2]=ls^~fo&mo,S[3]=Bi^~na&go,S[4]=fo^~mo&ys,S[5]=na^~go&ua,S[6]=mo^~ys&ro,S[7]=go^~ua&Xs,S[8]=ys^~ro&ls,S[9]=ua^~Xs&Bi,S[10]=ta^~Ln&hs,S[11]=io^~ao&ra,S[12]=Ln^~hs&Or,S[13]=ao^~ra&ps,S[14]=hs^~Or&_o,S[15]=ra^~ps&oa,S[16]=Or^~_o&ta,S[17]=ps^~oa&io,S[18]=_o^~ta&Ln,S[19]=oa^~io&ao,S[20]=dn^~Qn&uo,S[21]=Qs^~Et&ia,S[22]=Qn^~uo&pi,S[23]=Et^~ia&sa,S[24]=uo^~pi&aa,S[25]=ia^~sa&yo,S[26]=pi^~aa&dn,S[27]=sa^~yo&Qs,S[28]=aa^~dn&Qn,S[29]=yo^~Qs&Et,S[30]=so^~us&Ir,S[31]=hn^~cs&oo,S[32]=us^~Ir&po,S[33]=cs^~oo&gs,S[34]=Ir^~po&fa,S[35]=oo^~gs&wo,S[36]=po^~fa&so,S[37]=gs^~wo&hn,S[38]=fa^~so&us,S[39]=wo^~hn&cs,S[40]=ea^~Ri&co,S[41]=no^~ds&lo,S[42]=Ri^~co&ho,S[43]=ds^~lo&pn,S[44]=co^~ho&vo,S[45]=lo^~pn&bo,S[46]=ho^~vo&ea,S[47]=pn^~bo&no,S[48]=vo^~ea&Ri,S[49]=bo^~no&ds,S[0]^=Zs[I*2],S[1]^=Zs[I*2+1]}}function cn(S){const I=[];for(let P=0;P<S.length;P+=4)I.push(S[P]|S[P+1]<<8|S[P+2]<<16|S[P+3]<<24);return I}function Hs(S,I){if(!S.length){const ue=new Uint8Array(136);return ue[0]=I,ue[135]=128,[cn(ue)]}const P=Er(S,136),Z=P[P.length-1];if(Z.length<136){const ue=new Uint8Array(136);ue.set(Z),ue[Z.length]=I,ue[135]|=128,P[P.length-1]=ue}if(Z.length===136){const ue=new Uint8Array(136);ue[0]=I,ue[135]=128,P.push(ue)}return P.map(cn)}function Ki(S,I){for(const P of I){for(let Z=0;Z<34;Z+=2)S[Z]^=P[Z+1],S[Z+1]^=P[Z];$f(S)}return S}function Gn(S){return new Uint8Array([S[1],S[1]>>-24,S[1]>>-16,S[1]>>-8,S[0],S[0]>>8,S[0]>>16,S[0]>>24,S[3],S[3]>>-24,S[3]>>-16,S[3]>>-8,S[2],S[2]>>8,S[2]>>16,S[2]>>24,S[5],S[5]>>-24,S[5]>>-16,S[5]>>-8,S[4],S[4]>>8,S[4]>>16,S[4]>>24,S[7],S[7]>>-24,S[7]>>-16,S[7]>>-8,S[6],S[6]>>8,S[6]>>16,S[6]>>24])}function Sn(S){return Gn(Ki(new Array(50).fill(0),Hs(S,1)))}function Ur(S){return Gn(Ki(new Array(50).fill(0),Hs(S,6)))}function Fa(S,I,P){const Z=Math.min(S.length,I.length,P/8+1);for(let ue=0;ue<Z;ue++){const Se=S[ue]^I[ue];for(let ze=0;ze<8;ze++)if(Se>>7-ze&1)return ue*8+ze}return P}function mc(S,I){const P=Math.min(S.length,I.length);for(let Z=0;Z<P;Z++)if(S[Z]!==I[Z])return S.subarray(0,Z);return S.subarray(0,P)}function gc(S,I,P,Z){const ue=Math.floor(I/8),Se=I%8;P===1?S[ue]|=1<<(Z==="BE"?7-Se:Se):S[ue]&=~(1<<(Z==="BE"?7-Se:Se))}function yc(S,I,P){const Z=Math.floor(I/8),ue=I%8;return S[Z]>>(P==="BE"?7-ue:ue)&1}function Ua(S,I,P=0){for(let Z=P;Z<S.length;Z++)for(let ue=0;ue<I.length&&S[Z+ue]===I[ue];ue++)if(ue===I.length-1)return Z;return-1}function Af(S,I,P=0){if(S.length>=I)return S;const Z=new Uint8Array(I);return Z.fill(P),Z.set(S,I-S.length),Z}function Ji(S,I,P=0){const Z=S.length%I;return Z===0?S:Af(S,S.length+I-Z,P)}function qa(S,I,P=0){if(S.length>=I)return S;const Z=new Uint8Array(I);return Z.fill(P),Z.set(S,0),Z}function vc(S,I,P=0){const Z=S.length%I;return Z===0?S:qa(S,S.length+I-Z,P)}function bc(S,I){const P=new Uint8Array(S.length);for(let Z=0;Z<S.length;Z++)P[Z]=S[Z]^I[Z%I.length];return P}function Yi(S,I){if(S.length!==I.length)return!1;for(let P=0;P<S.length;P++)if(S[P]!==I[P])return!1;return!0}function dr(S,I){return(S%I+I)%I}function Xi(S,I){S=dr(S,I);let[P,Z]=[0n,1n],[ue,Se]=[I,S];for(;Se!==0n;){const ze=ue/Se;[P,Z]=[Z,P-ze*Z],[ue,Se]=[Se,ue-ze*Se]}if(ue>1n)throw new Error("a is not invertible");return P<0n&&(P+=I),P}function Za(S,I,P){let Z=1n;for(S=dr(S,P);I>0;)I%2n===1n&&(Z=dr(Z*S,P)),S=dr(S*S,P),I=I/2n;return Z}function Ha(S,I){return dr(S,I)===0n?0n:I%4n===3n?Za(S,(I+1n)/4n,I):null}const kr=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,Mr=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,zs=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,Qi=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;function es(S,I,P){if(I===0n)return[0n,0n];const Z=dr(3n*S*S*Xi(2n*I,P),P),ue=dr(Z*Z-2n*S,P),Se=dr(Z*(S-ue)-I,P);return[ue,Se]}function Vs(S,I,P,Z,ue){if(S===0n&&I===0n)return[P,Z];if(P===0n&&Z===0n)return[S,I];if(S===P&&I===dr(-Z,ue))return[0n,0n];if(S===P&&I===Z)return es(S,I,ue);const Se=dr((Z-I)*Xi(P-S,ue),ue),ze=dr(Se*Se-S-P,ue),Xe=dr(Se*(S-ze)-I,ue);return[ze,Xe]}function za(S){if(S<=0n||S>=Mr)throw new Error("Invalid private key");return di(zs,Qi,S,kr)}function Mf(S){const I=S[1]%2n===0n?2:3;return new Uint8Array([I,...Pn(S[0],"BE")])}function If(S){if(S.length!==33||S[0]!==2&&S[0]!==3)throw new Error("Invalid compressed public key");const I=Si(S.slice(1),"BE"),P=Ha(dr(I**3n+7n,kr),kr);if(!P)throw Error("Invalid x: does not correspond to a valid curve point");const Z=dr(-P,kr),ue=P%2n===0n;return[I,S[0]===2?ue?P:Z:ue?Z:P]}function Tf(S){const I=new Uint8Array(20),P=Sn(ci(Pn(S[0],"BE"),Pn(S[1],"BE")));return I.set(P.subarray(12)),I}function Ws(S){const I=y.Binary.uint8ArrayToHex(S),P=y.Binary.uint8ArrayToHex(y.Binary.keccak256(new Uint8Array([...I].map(ue=>ue.charCodeAt(0)))));let Z="0x";for(let ue=0;ue<I.length;ue++)parseInt(P[ue],16)>7?Z+=I[ue].toUpperCase():Z+=I[ue];return Z}function di(S,I,P,Z){let ue=[0n,0n],Se=[S,I];const ze=P.toString(2);for(const Xe of ze)Xe==="0"?(Se=Vs(ue[0],ue[1],Se[0],Se[1],Z),ue=es(ue[0],ue[1],Z)):(ue=Vs(ue[0],ue[1],Se[0],Se[1],Z),Se=es(Se[0],Se[1],Z));return ue}function Cf(S,I,P){return Va(Si(Sn(S),"BE"),I,P)}function Va(S,I,P){if(I<=0n||I>=Mr)throw new Error("Invalid private key");if(P||(P=dr(Si(Sn(ci(Sn(Pn(I,"BE")),Pn(S,"BE"))),"BE"),Mr)),P<=0n||P>=Mr)throw new Error("Invalid nonce");const Z=dr(S,Mr),ue=di(zs,Qi,P,kr),Se=dr(ue[0],Mr);let ze=dr((Z+dr(Se,Mr)*I)*Xi(P,Mr),Mr);if(Se===0n||ze===0n)throw new Error("Invalid r or s value");let Xe=ue[1]%2n===0n?27n:28n;return ze>Mr/2n&&(ze=Mr-ze,Xe=Xe===27n?28n:27n),[Se,ze,Xe]}function _c(S,I,P,Z){const ue=Ha(dr(I**3n+7n,kr),kr);if(!ue)throw new Error("Invalid r: does not correspond to a valid curve point");const Se=Z===27n?0n:1n,ze=ue%2n===Se?ue:kr-ue,Xe=dr(Si(Sn(S),"BE"),Mr),Je=di(I,ze,P,kr),pt=di(zs,Qi,Xe,kr),ar=Vs(Je[0],Je[1],pt[0],dr(-pt[1],kr),kr);return di(ar[0],ar[1],Xi(I,Mr),kr)}function Bf(S,I,P,Z){const ue=dr(Si(Sn(S),"BE"),Mr),Se=Xi(Z,Mr),ze=dr(ue*Se,Mr),Xe=dr(P*Se,Mr),Je=di(zs,Qi,ze,kr),pt=di(I[0],I[1],Xe,kr),ar=Vs(Je[0],Je[1],pt[0],pt[1],kr);return P===dr(ar[0],Mr)}class Rf{constructor(I){this.cursor=0,this.buffer=I}read(I){const P=this.buffer.subarray(this.cursor,this.cursor+I);return this.cursor+=I,P}max(){return this.buffer.length-this.cursor}}y.Uint8ArrayReader=Rf;class js{constructor(I){this.buffer=I,this.cursor=0}write(I){const P=Math.min(this.max(),I.max());return this.buffer.set(I.read(P),this.cursor),this.cursor+=P,P}max(){return this.buffer.length-this.cursor}}y.Uint8ArrayWriter=js;class ts{constructor(I,P=0n){this.span=P,this.writer=new js(new Uint8Array(I))}build(){return ci(qs(this.span,"LE"),this.writer.buffer)}hash(){const I=_f(Er(this.writer.buffer,32),(P,Z)=>Sn(ci(P,Z)));return Sn(ci(qs(this.span,"LE"),I))}}y.Chunk=ts;class rs{constructor(I,P=4096){this.counters=[1],this.capacity=P,this.chunks=[new ts(P)],this.onChunk=I}static async root(I,P=4096){const Z=new u(u.NOOP,P);return await Z.append(I),Z.finalize()}async append(I,P=0,Z=0n){const ue=new Rf(I);for(;ue.max()>0;){this.chunks[P].writer.max()===0&&await this.elevate(P);const Se=this.chunks[P].writer.write(ue);Z?this.chunks[P].span+=Z:this.chunks[0].span+=BigInt(Se)}}async elevate(I){this.counters[I]=++this.counters[I]%(this.capacity/32),this.chunks[I+1]||(this.chunks.push(new ts(this.capacity)),this.counters.push(1)),await this.append(this.chunks[I].hash(),I+1,this.chunks[I].span),await this.onChunk(this.chunks[I]),this.chunks[I]=new ts(this.capacity)}async finalize(I=0){return this.chunks[I+1]?this.counters[I]===1?(await this.elevate(I+1),this.chunks[I+1]=this.chunks[I],this.finalize(I+1)):(await this.elevate(I),this.finalize(I+1)):(await this.onChunk(this.chunks[I]),this.chunks[I])}}y.MerkleTree=rs,u=rs,rs.NOOP=async S=>{};class $n{constructor(I,P){if(P<0)throw Error("Scale must be non-negative");this.value=BigInt(I),this.scale=P}static fromDecimalString(I,P){let[Z,ue]=I.split(".");return ue=(ue||"").padEnd(P,"0").slice(0,P),new $n(BigInt(Z+ue),P)}add(I){return this.assertSameScale(I),new $n(this.value+I.value,this.scale)}subtract(I){return this.assertSameScale(I),new $n(this.value-I.value,this.scale)}multiply(I){return new $n(this.value*I,this.scale)}divmod(I){if(I===0n)throw new Error("Division by zero is not allowed");const P=this.value/I,Z=this.value%I;return[new $n(P,this.scale),new $n(Z,this.scale)]}exchange(I,P,Z){if(I==="*"){const Se=this.value*P.value/10n**BigInt(this.scale);return new $n(Se,Z)}this.assertSameScale(P);const ue=this.value*10n**BigInt(Z)/P.value;return new $n(ue,Z)}compare(I){return this.assertSameScale(I),this.value>I.value?1:this.value<I.value?-1:0}toDecimalString(){if(this.scale===0)return this.value.toString();const I=this.value.toString(),P=I.slice(0,-this.scale)||"0",Z=I.slice(-this.scale).padStart(this.scale,"0");return`${P}.${Z}`}toString(){return this.value.toString()}toJSON(){return this.toString()}assertSameScale(I){if(this.scale!==I.scale)throw new Error(`Scale mismatch: expected ${this.scale}, but got ${I.scale}`)}}y.FixedPointNumber=$n;function Wa(S){if(S.length===0)return null;const I=S[0];return I.ttlMax?--I.ttl<=0&&S.shift():I.ttlMax=I.ttl,{progress:(I.ttlMax-I.ttl)/I.ttlMax,data:I.data}}function Ot(S,I,P,Z){const ue=S.findIndex(Xe=>Xe===`--${I}`||Xe.startsWith(`--${I}=`)),Se=S[ue];if(!Se)return(P||{})[Z||I||""]||null;if(Se.includes("="))return Se.split("=")[1];const ze=S[ue+1];return ze&&!ze.startsWith("-")?ze:(P||{})[Z||I||""]||null}function wc(S,I,P,Z){const ue=Ot(S,I,P,Z);if(!ue)return null;try{return Vn(ue)}catch{throw new Error(`Invalid number argument ${I}: ${ue}`)}}function xc(S,I,P,Z){const ue=S.some(Je=>Je.endsWith("-"+I)),Se=Ot(S,I,P,Z);if(!Se&&ue)return!0;if(!Se&&!ue)return null;const ze=["true","1","yes","y","on"],Xe=["false","0","no","n","off"];if(ze.includes(Se.toLowerCase()))return!0;if(Xe.includes(Se.toLowerCase()))return!1;throw Error(`Invalid boolean argument ${I}: ${Se}`)}function $i(S,I,P,Z){const ue=Ot(S,I,P,Z);if(!ue)throw new Error(`Missing argument ${I}`);return ue}function Of(S,I,P,Z){const ue=$i(S,I,P,Z);try{return Vn(ue)}catch{throw new Error(`Invalid argument ${I}: ${ue}`)}}function kf(S,I){const P=S[I];S.splice(I,1),S.unshift(P)}function Ec(S,I){const P=[...S];return kf(P,I),P}function Kr(S,I){return{x:S.x+I.x,y:S.y+I.y}}function Sc(S,I){return{x:S.x-I.x,y:S.y-I.y}}function Ai(S,I){return{x:S.x*I,y:S.y*I}}function ja(S){const I=Math.sqrt(S.x*S.x+S.y*S.y);return{x:S.x/I,y:S.y/I}}function Ga(S,I,P){return{x:S.x+Math.cos(I)*P,y:S.y+Math.sin(I)*P}}function Ka(S,I){return Math.sqrt((S.x-I.x)**2+(S.y-I.y)**2)}function Rr(S,I,P="row-first"){const Z=[];if(P==="column-first")for(let ue=0;ue<S.length;ue++)for(let Se=0;Se<S[0].length;Se++)I(ue,Se)&&Z.push({x:ue,y:Se});else for(let ue=0;ue<S[0].length;ue++)for(let Se=0;Se<S.length;Se++)I(Se,ue)&&Z.push({x:Se,y:ue});return Z}function Kn(S,I,P){var Z,ue;return((Z=S[I+1])==null?void 0:Z[P])&&((ue=S[I-1])==null?void 0:ue[P])&&!S[I][P-1]&&!S[I][P+1]}function Ja(S,I,P){var Z,ue;return S[I][P+1]&&S[I][P-1]&&!((Z=S[I-1])!=null&&Z[P])&&!((ue=S[I+1])!=null&&ue[P])}function Ya(S,I,P){var Z;return!((Z=S[I-1])!=null&&Z[P])}function ns(S,I,P){var Z;return!((Z=S[I+1])!=null&&Z[P])}function Xa(S,I,P){return!S[I][P-1]}function Gs(S,I,P){return!S[I][P+1]}function Pf(S,I,P){var ue,Se,ze,Xe,Je,pt,ar,yr;const Z=[];return S[I][P]?Kn(S,I,P)||Ja(S,I,P)?[]:(!((ue=S[I-1])!=null&&ue[P-1])&&Ya(S,I,P)&&Xa(S,I,P)&&Z.push({x:I,y:P}),!((Se=S[I+1])!=null&&Se[P-1])&&ns(S,I,P)&&Xa(S,I,P)&&Z.push({x:I+1,y:P}),!((ze=S[I-1])!=null&&ze[P+1])&&Ya(S,I,P)&&Gs(S,I,P)&&Z.push({x:I,y:P+1}),!((Xe=S[I+1])!=null&&Xe[P+1])&&ns(S,I,P)&&Gs(S,I,P)&&Z.push({x:I+1,y:P+1}),Z):((Je=S[I-1])!=null&&Je[P]&&S[I][P-1]&&Z.push({x:I,y:P}),(pt=S[I+1])!=null&&pt[P]&&S[I][P-1]&&Z.push({x:I+1,y:P}),(ar=S[I-1])!=null&&ar[P]&&S[I][P+1]&&Z.push({x:I,y:P+1}),(yr=S[I+1])!=null&&yr[P]&&S[I][P+1]&&Z.push({x:I+1,y:P+1}),Z)}function Qa(S,I,P,Z){const ue=[{x:0,y:0},{x:P,y:0},{x:0,y:Z},{x:P,y:Z}];for(let Se=0;Se<S.length;Se++)for(let ze=0;ze<S[0].length;ze++){const Xe=Pf(S,Se,ze);for(const Je of Xe)ue.some(pt=>pt.x===Je.x&&pt.y===Je.y)||ue.push(Je)}return ue.map(Se=>({x:Se.x*I,y:Se.y*I}))}function eo(S,I){const P=Rr(S,(Je,pt)=>S[Je][pt]===0&&S[Je][pt+1]!==0,"row-first").map(Je=>({...Je,dx:1,dy:0})),Z=Rr(S,(Je,pt)=>S[Je][pt]===0&&S[Je][pt-1]!==0,"row-first").map(Je=>({...Je,dx:1,dy:0})),ue=Rr(S,(Je,pt)=>{var ar;return S[Je][pt]===0&&((ar=S[Je-1])==null?void 0:ar[pt])!==0},"column-first").map(Je=>({...Je,dx:0,dy:1})),Se=Rr(S,(Je,pt)=>{var ar;return S[Je][pt]===0&&((ar=S[Je+1])==null?void 0:ar[pt])!==0},"column-first").map(Je=>({...Je,dx:0,dy:1}));P.forEach(Je=>Je.y++),Se.forEach(Je=>Je.x++);const ze=Na([...ue,...Se],(Je,pt)=>Je.x===pt.x&&Je.y-1===pt.y),Xe=Na([...Z,...P],(Je,pt)=>Je.y===pt.y&&Je.x-1===pt.x);return[...ze,...Xe].map(Je=>({start:Je[0],end:q(Je)})).map(Je=>({start:Ai(Je.start,I),end:Ai(Kr(Je.end,{x:Je.start.dx,y:Je.start.dy}),I)}))}function Jn(S,I){return Math.atan2(I.y-S.y,I.x-S.x)}function $c(S,I){return I.map(P=>Jn(S,P)).sort((P,Z)=>P-Z)}function Dn(S,I,P,Z){const ue=(Z.y-P.y)*(I.x-S.x)-(Z.x-P.x)*(I.y-S.y);if(ue===0)return null;let Se=S.y-P.y,ze=S.x-P.x;const Xe=(Z.x-P.x)*Se-(Z.y-P.y)*ze,Je=(I.x-S.x)*Se-(I.y-S.y)*ze;return Se=Xe/ue,ze=Je/ue,Se>0&&Se<1&&ze>0&&ze<1?{x:S.x+Se*(I.x-S.x),y:S.y+Se*(I.y-S.y)}:null}function Ks(S,I,P){const Z=[],ue=Ga(S,P,1e4);for(const Se of I){const ze=Dn(S,ue,Se.start,Se.end);ze&&Z.push(ze)}return Z.length?Z.reduce((Se,ze)=>{const Xe=Ka(S,ze),Je=Ka(S,Se);return Xe<Je?ze:Se}):null}function Df(S,I,P){const Z=$c(S,P),ue=[];for(const Se of Z){const ze=Ks(S,I,Se-.001),Xe=Ks(S,I,Se+.001);ze&&ue.push(ze),Xe&&ue.push(Xe)}return ue}class is{constructor(){this.subscribers=[]}subscribe(I){return this.subscribers.push(I),()=>{this.subscribers=this.subscribers.filter(P=>P!==I)}}publish(I){this.subscribers.forEach(P=>P(I))}clear(){this.subscribers=[]}getSubscriberCount(){return this.subscribers.length}}y.PubSubChannel=is;class Ac{constructor(I,P){this.queue=[],this.running=0,this.onProcessed=new is,this.onDrained=new is,this.concurrency=I,this.capacity=P}process(){if(this.running>=this.concurrency)return;const I=this.queue.shift();I&&(this.running++,I().finally(()=>{this.running--,this.process(),this.onProcessed.publish(),this.running===0&&this.onDrained.publish()}))}enqueue(I){if(this.queue.length<this.capacity)return this.queue.push(I),this.process(),Promise.resolve();if(this.onProcessed.getSubscriberCount())throw Error("Queue capacity is full");return new Promise(P=>{this.onProcessed.subscribe(()=>{this.queue.length<this.capacity&&(this.queue.push(I),this.process(),this.onProcessed.clear(),P())})})}drain(){if(this.running===0)return Promise.resolve();if(this.onDrained.getSubscriberCount())throw Error("Already draining");return new Promise(I=>{this.onDrained.subscribe(()=>{this.onDrained.clear(),I()})})}}y.AsyncQueue=Ac,y.Binary={hexToUint8Array:Wo,uint8ArrayToHex:jo,base64ToUint8Array:mu,uint8ArrayToBase64:gu,base32ToUint8Array:zo,uint8ArrayToBase32:$s,log2Reduce:_f,partition:Er,concatBytes:ci,numberToUint8:rn,uint8ToNumber:hc,numberToUint16:xf,uint16ToNumber:Ef,numberToUint32:Gi,uint32ToNumber:jn,numberToUint64:qs,uint64ToNumber:pc,numberToUint256:Pn,uint256ToNumber:Si,sliceBytes:Sf,keccak256:Sn,sha3_256:Ur,proximity:Fa,commonPrefix:mc,setBit:gc,getBit:yc,indexOf:Ua,equals:Yi,padStart:Af,padStartToMultiple:Ji,padEnd:qa,padEndToMultiple:vc,xorCypher:bc},y.Elliptic={privateKeyToPublicKey:za,compressPublicKey:Mf,publicKeyFromCompressed:If,publicKeyToAddress:Tf,signMessage:Cf,signHash:Va,verifySignature:Bf,recoverPublicKey:_c,checksumEncode:Ws},y.Random={intBetween:ie,floatBetween:ge,chance:Be,signed:pe,makeSeededRng:le,point:$e,procs:Pe},y.Arrays={countUnique:tc,makeUnique:Qu,splitBySize:kn,splitByCount:mf,index:pf,indexCollection:Yu,onlyOrThrow:$,onlyOrNull:M,firstOrThrow:C,firstOrNull:T,shuffle:E,initialize:B,initialize2D:H,rotate2D:N,containsShape:te,glue:da,pluck:ce,pick:Re,pickMany:je,pickManyUnique:we,pickWeighted:X,pickRandomIndices:fe,pickGuaranteed:D,last:q,pipe:O,makePipe:L,sortWeighted:j,pushAll:Bn,unshiftAll:$o,filterAndRemove:fn,merge:Zu,empty:Hu,pushToBucket:Tn,unshiftAndLimit:Cn,atRolling:Pi,group:Na,createOscillator:lf,organiseWithLimits:Nu,tickPlaybook:Wa,getArgument:Ot,getBooleanArgument:xc,getNumberArgument:wc,requireStringArgument:$i,requireNumberArgument:Of,bringToFront:Ec,bringToFrontInPlace:kf,findInstance:bf,filterInstances:lc,interleave:dc,toggle:La,createHierarchy:Fs,multicall:cc,maxBy:vf},y.System={sleepMillis:b,forever:Ve,scheduleMany:Co,waitFor:bi,expandError:Wr,runAndSetInterval:Ae},y.Numbers={make:Vn,sum:Qf,average:Bo,median:pa,getDistanceFromMidpoint:ma,clamp:fi,range:ti,interpolate:ha,createSequence:Pu,increment:Vi,decrement:Ds,format:Da,fromDecimals:zi,makeStorage:Rs,asMegabytes:oe,convertBytes:ye,hexToRgb:Ce,rgbToHex:ae,haversineDistanceToMeters:de,roundToNearest:ne,formatDistance:be,triangularNumber:Ie,searchFloat:Le},y.Promises={raceFulfilled:v,invert:h,runInParallelBatches:w},y.Dates={getTimestamp:Bt,getTimeDelta:_r,secondsToHumanTime:lr,countCycles:Oa,isoDate:Au,throttle:en,timeSince:Cu,dateTimeSlug:Mu,unixTimestamp:$u,fromUtcString:Iu,fromMillis:Tu,getProgress:_i,humanizeTime:Ye,humanizeProgress:Su,createTimeDigits:Fr,mapDayNumber:Ui,getDayInfoFromDate:nr,getDayInfoFromDateTimeString:Bu,seconds:nf,minutes:Cs,hours:Ru,days:Ou,make:Bs,normalizeTime:Ue,absoluteDays:Ge},y.Objects={safeParse:Pa,deleteDeep:U,getDeep:re,setDeep:ee,incrementDeep:F,ensureDeep:Q,replaceDeep:he,getFirstDeep:Oe,deepMergeInPlace:Lr,deepMerge2:vn,deepMerge3:_n,mapAllAsync:Ao,cloneWithJson:rf,sortObject:uf,sortArray:cf,sortAny:oi,deepEquals:Hi,deepEqualsEvery:ks,runOn:xi,ifPresent:qu,zip:on,zipSum:In,removeEmptyArrays:zu,removeEmptyValues:Vu,flatten:Ku,unflatten:hf,match:Ju,sort:xn,map:df,mapIterable:_e,filterKeys:Ns,filterValues:Wi,rethrow:Ei,setSomeOnObject:Ls,setSomeDeep:tn,flip:Ht,getAllPermutations:Wu,countTruthyValues:ju,transformToArray:rc,setMulti:ic,incrementMulti:nc,createBidirectionalMap:sc,createTemporalBidirectionalMap:ui,pushToBidirectionalMap:yf,unshiftToBidirectionalMap:ac,addToTemporalBidirectionalMap:un,getFromTemporalBidirectionalMap:oc,createStatefulToggle:Du,diffKeys:xr,pickRandomKey:Br,mapRandomKey:Lu,fromObjectString:Fu,toQueryString:si,parseQueryString:_u,hasKey:wu,selectMax:Ra,reposition:tf,unwrapSingleKey:Hn,parseKeyValues:Ms},y.Types={isFunction:it,isObject:Fe,isStrictlyObject:He,isEmptyArray:tt,isEmptyObject:Ne,isUndefined:nt,isString:ot,isNumber:ut,isBoolean:ht,isDate:St,isBlank:Rt,isId:dt,isIntegerString:Ct,isHexString:Dt,isUrl:Dr,isNullable:Hr,asString:Jt,asHexString:ve,asSafeString:J,asIntegerString:Ft,asNumber:ke,asFunction:xe,asInteger:qe,asBoolean:We,asDate:ct,asNullableString:wt,asEmptiableString:st,asId:xt,asTime:mt,asArray:Mt,asObject:Yt,asNullableObject:er,asStringMap:rr,asNumericDictionary:qr,asUrl:Zr,asNullable:Vr,asOptional:Tr,enforceObjectShape:Nr,enforceArrayShape:Cr,isPng:wf,isJpg:En,isWebp:Us,isImage:li},y.Strings={tokenizeByCount:Xu,tokenizeByLength:gf,searchHex:kt,searchSubstring:Kt,randomHex:At,randomLetter:$t,randomAlphanumeric:Qt,randomRichAscii:Gt,randomUnicode:vt,includesAny:Ro,slugify:ga,normalForm:ko,enumify:ru,escapeHtml:iu,decodeHtmlEntities:au,after:ya,afterLast:Lo,before:xs,beforeLast:va,betweenWide:ou,betweenNarrow:fu,getPreLine:sf,containsWord:ii,containsWords:Yo,joinUrl:qi,getFuzzyMatchScore:Di,sortByFuzzyScore:nu,splitOnce:ur,splitAll:cr,randomize:du,expand:wa,shrinkTrim:Ni,capitalize:br,decapitalize:Es,csvEscape:jr,parseCsv:Eu,surroundInOut:tu,getExtension:ba,getBasename:_a,normalizeEmail:uu,normalizeFilename:cu,parseFilename:lu,camelToTitle:Po,slugToTitle:Do,slugToCamel:No,joinHumanly:eu,findWeightedPair:Rn,extractBlock:Li,extractAllBlocks:Aa,replaceBlocks:pr,indexOfEarliest:vi,lastIndexOfBefore:$a,parseHtmlAttributes:Xo,readNextWord:As,resolveVariables:vu,resolveVariableWithDefaultSyntax:Qo,resolveRemainingVariablesWithDefaults:ef,isLetter:qn,isDigit:xa,isLetterOrDigit:ri,isValidObjectPathCharacter:Uo,insert:qo,indexOfRegex:Ea,lineMatches:Sa,linesMatchInOrder:Zo,represent:Ar,resolveMarkdownLinks:bu,buildUrl:xu,isChinese:Oo,replaceBetweenStrings:ff,describeMarkdown:Zi,isBalanced:ai,textToFormat:Os,splitFormatting:Zn,splitHashtags:Ma,splitUrls:pu,route:Ia,explodeReplace:Fi,generateVariants:Go,replaceWord:yu,replacePascalCaseWords:Ta,stripHtml:Ca,breakLine:Ko,measureTextWidth:Jo,toLines:Gr,levenshteinDistance:Ba},y.Assertions={asEqual:Yf,asTrue:Mo,asTruthy:ws,asFalse:Io,asFalsy:Xf,asEither:To},y.Cache={get:af,invalidate:of},y.Vector={addPoint:Kr,subtractPoint:Sc,multiplyPoint:Ai,normalizePoint:ja,pushPoint:Ga,filterCoordinates:Rr,findCorners:Qa,findLines:eo,raycast:Ks,raycastCircle:Df,getLineIntersectionPoint:Dn}})(cafeUtility);const utility=getDefaultExportFromCjs$1(cafeUtility);utility.Arrays,utility.Assertions;const Binary=utility.Binary;utility.Cache,utility.Dates,utility.Elliptic,utility.Numbers,utility.Objects,utility.Pagination,utility.Promises,utility.Random,utility.Strings,utility.System,utility.Types,utility.Optional,utility.Vector,utility.PubSubChannel,utility.Chunk;const MerkleTree=utility.MerkleTree;utility.FixedPointNumber,utility.Lazy,utility.AsyncLazy,utility.AsyncQueue,utility.Uint8ArrayReader,utility.Uint8ArrayWriter;const ENCODER=new TextEncoder,MIN_PAYLOAD_SIZE=1,MAX_PAYLOAD_SIZE=4096,MAX_CHUNK_PAYLOAD_SIZE=4096,SEGMENT_SIZE=32;function makeFeedIdentifier(y,u){return u=typeof u=="number"?beeJs.FeedIndex.fromBigInt(BigInt(u)):u,new beeJs.Identifier(Binary.keccak256(Binary.concatBytes(y.toUint8Array(),u.toUint8Array())))}function calculateChunkAddress(y){const u=y.slice(0,beeJs.Span.LENGTH),h=y.slice(beeJs.Span.LENGTH),v=calculateBmtRootHash(h),w=Binary.keccak256(Binary.concatBytes(u,v));return new beeJs.Reference(w)}function calculateBmtRootHash(y){if(y.length>MAX_CHUNK_PAYLOAD_SIZE)throw new beeJs.BeeArgumentError(`payload size ${y.length} exceeds maximum chunk payload size ${MAX_CHUNK_PAYLOAD_SIZE}`,y);const u=new Uint8Array(MAX_CHUNK_PAYLOAD_SIZE);return u.set(y),Binary.log2Reduce(Binary.partition(u,SEGMENT_SIZE),(h,v)=>Binary.keccak256(Binary.concatBytes(h,v)))}function makeContentAddressedChunk(y){if(y instanceof Uint8Array||(y=ENCODER.encode(y)),y.length<MIN_PAYLOAD_SIZE||y.length>MAX_PAYLOAD_SIZE)throw new RangeError(`payload size ${y.length} exceeds limits [${MIN_PAYLOAD_SIZE}, ${MAX_PAYLOAD_SIZE}]`);const u=beeJs.Span.fromBigInt(BigInt(y.length)),h=Binary.concatBytes(u.toUint8Array(),y);return{data:h,span:u,payload:beeJs.Bytes.fromSlice(h,beeJs.Span.LENGTH),address:calculateChunkAddress(h)}}function makeSOCAddress(y,u){return new beeJs.Reference(Binary.keccak256(Binary.concatBytes(y.toUint8Array(),u.toUint8Array())))}function makeSingleOwnerChunk(y,u,h){u=new beeJs.Identifier(u),h=new beeJs.PrivateKey(h);const v=makeSOCAddress(u,h.publicKey().address()),w=h.sign(Binary.concatBytes(u.toUint8Array(),y.address.toUint8Array())),b=Binary.concatBytes(u.toUint8Array(),w.toUint8Array(),y.data),E=beeJs.Span.fromSlice(y.data,0),$=beeJs.Bytes.fromSlice(y.data,beeJs.Span.LENGTH);return{data:b,identifier:u,signature:w,span:E,payload:$,address:v,owner:h.publicKey().address()}}let Logger$1=class So{constructor(){}static getInstance(){return So.instance||(So.instance=new So),So.instance}formatMessage(u,...h){return`[${new Date().toISOString()}] [${u.toUpperCase()}] - ${h.map(w=>typeof w=="object"?JSON.stringify(w):w).join(" ")}`}log(...u){console.log(this.formatMessage("log",...u))}info(...u){console.info(this.formatMessage("info",...u))}warn(...u){console.warn(this.formatMessage("warn",...u))}error(...u){console.error(this.formatMessage("error",...u))}debug(...u){console.debug(this.formatMessage("debug",...u))}};class ErrorHandler{constructor(){this.logger=Logger$1.getInstance()}static getInstance(){return ErrorHandler.instance||(ErrorHandler.instance=new ErrorHandler),ErrorHandler.instance}handleError(u,h){const v=u instanceof Error?u.message:"Unknown error occurred",w=u instanceof Error?u.stack:null;this.logger.error(`Error in ${h||"unknown context"}: ${v}`,{stack:w})}}const logger$1=Logger$1.getInstance(),errorHandler=ErrorHandler.getInstance();function sleep(y){return new Promise(u=>{setTimeout(u,y)})}function remove0x(y){return(y.startsWith("0x")?y.slice(2):y).toLowerCase()}async function retryAwaitableAsync(y,u=3,h=250){return new Promise((v,w)=>{y().then(v).catch(b=>{u>0?(logger$1.info(`Retrying... Attempts left: ${u}. Error: ${b.message}`),setTimeout(()=>{retryAwaitableAsync(y,u-1,h).then(v).catch(w)},h)):(errorHandler.handleError(b,"Utils.retryAwaitableAsync"),w(b))})})}let EventEmitter$2=class{constructor(){this.events={},this.on=this.on.bind(this),this.off=this.off.bind(this),this.cleanAll=this.cleanAll.bind(this),this.emit=this.emit.bind(this)}on(u,h){this.events[u]||(this.events[u]=[]),this.events[u].push(h)}off(u,h){if(!this.events[u])return;const v=this.events[u].indexOf(h);v>-1&&this.events[u].splice(v,1)}cleanAll(){this.events={}}emit(u,h){this.events[u]&&this.events[u].forEach(v=>v(h))}};var util$c;(function(y){y.assertEqual=w=>w;function u(w){}y.assertIs=u;function h(w){throw new Error}y.assertNever=h,y.arrayToEnum=w=>{const b={};for(const E of w)b[E]=E;return b},y.getValidEnumValues=w=>{const b=y.objectKeys(w).filter($=>typeof w[w[$]]!="number"),E={};for(const $ of b)E[$]=w[$];return y.objectValues(E)},y.objectValues=w=>y.objectKeys(w).map(function(b){return w[b]}),y.objectKeys=typeof Object.keys=="function"?w=>Object.keys(w):w=>{const b=[];for(const E in w)Object.prototype.hasOwnProperty.call(w,E)&&b.push(E);return b},y.find=(w,b)=>{for(const E of w)if(b(E))return E},y.isInteger=typeof Number.isInteger=="function"?w=>Number.isInteger(w):w=>typeof w=="number"&&isFinite(w)&&Math.floor(w)===w;function v(w,b=" | "){return w.map(E=>typeof E=="string"?`'${E}'`:E).join(b)}y.joinValues=v,y.jsonStringifyReplacer=(w,b)=>typeof b=="bigint"?b.toString():b})(util$c||(util$c={}));var objectUtil;(function(y){y.mergeShapes=(u,h)=>({...u,...h})})(objectUtil||(objectUtil={}));const ZodParsedType=util$c.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=y=>{switch(typeof y){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(y)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(y)?ZodParsedType.array:y===null?ZodParsedType.null:y.then&&typeof y.then=="function"&&y.catch&&typeof y.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&y instanceof Map?ZodParsedType.map:typeof Set<"u"&&y instanceof Set?ZodParsedType.set:typeof Date<"u"&&y instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$c.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=y=>JSON.stringify(y,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{get errors(){return this.issues}constructor(u){super(),this.issues=[],this.addIssue=v=>{this.issues=[...this.issues,v]},this.addIssues=(v=[])=>{this.issues=[...this.issues,...v]};const h=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,h):this.__proto__=h,this.name="ZodError",this.issues=u}format(u){const h=u||function(b){return b.message},v={_errors:[]},w=b=>{for(const E of b.issues)if(E.code==="invalid_union")E.unionErrors.map(w);else if(E.code==="invalid_return_type")w(E.returnTypeError);else if(E.code==="invalid_arguments")w(E.argumentsError);else if(E.path.length===0)v._errors.push(h(E));else{let $=v,M=0;for(;M<E.path.length;){const T=E.path[M];M===E.path.length-1?($[T]=$[T]||{_errors:[]},$[T]._errors.push(h(E))):$[T]=$[T]||{_errors:[]},$=$[T],M++}}};return w(this),v}static assert(u){if(!(u instanceof ZodError))throw new Error(`Not a ZodError: ${u}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$c.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(u=h=>h.message){const h={},v=[];for(const w of this.issues)w.path.length>0?(h[w.path[0]]=h[w.path[0]]||[],h[w.path[0]].push(u(w))):v.push(u(w));return{formErrors:v,fieldErrors:h}}get formErrors(){return this.flatten()}}ZodError.create=y=>new ZodError(y);const errorMap=(y,u)=>{let h;switch(y.code){case ZodIssueCode.invalid_type:y.received===ZodParsedType.undefined?h="Required":h=`Expected ${y.expected}, received ${y.received}`;break;case ZodIssueCode.invalid_literal:h=`Invalid literal value, expected ${JSON.stringify(y.expected,util$c.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:h=`Unrecognized key(s) in object: ${util$c.joinValues(y.keys,", ")}`;break;case ZodIssueCode.invalid_union:h="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:h=`Invalid discriminator value. Expected ${util$c.joinValues(y.options)}`;break;case ZodIssueCode.invalid_enum_value:h=`Invalid enum value. Expected ${util$c.joinValues(y.options)}, received '${y.received}'`;break;case ZodIssueCode.invalid_arguments:h="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:h="Invalid function return type";break;case ZodIssueCode.invalid_date:h="Invalid date";break;case ZodIssueCode.invalid_string:typeof y.validation=="object"?"includes"in y.validation?(h=`Invalid input: must include "${y.validation.includes}"`,typeof y.validation.position=="number"&&(h=`${h} at one or more positions greater than or equal to ${y.validation.position}`)):"startsWith"in y.validation?h=`Invalid input: must start with "${y.validation.startsWith}"`:"endsWith"in y.validation?h=`Invalid input: must end with "${y.validation.endsWith}"`:util$c.assertNever(y.validation):y.validation!=="regex"?h=`Invalid ${y.validation}`:h="Invalid";break;case ZodIssueCode.too_small:y.type==="array"?h=`Array must contain ${y.exact?"exactly":y.inclusive?"at least":"more than"} ${y.minimum} element(s)`:y.type==="string"?h=`String must contain ${y.exact?"exactly":y.inclusive?"at least":"over"} ${y.minimum} character(s)`:y.type==="number"?h=`Number must be ${y.exact?"exactly equal to ":y.inclusive?"greater than or equal to ":"greater than "}${y.minimum}`:y.type==="date"?h=`Date must be ${y.exact?"exactly equal to ":y.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(y.minimum))}`:h="Invalid input";break;case ZodIssueCode.too_big:y.type==="array"?h=`Array must contain ${y.exact?"exactly":y.inclusive?"at most":"less than"} ${y.maximum} element(s)`:y.type==="string"?h=`String must contain ${y.exact?"exactly":y.inclusive?"at most":"under"} ${y.maximum} character(s)`:y.type==="number"?h=`Number must be ${y.exact?"exactly":y.inclusive?"less than or equal to":"less than"} ${y.maximum}`:y.type==="bigint"?h=`BigInt must be ${y.exact?"exactly":y.inclusive?"less than or equal to":"less than"} ${y.maximum}`:y.type==="date"?h=`Date must be ${y.exact?"exactly":y.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(y.maximum))}`:h="Invalid input";break;case ZodIssueCode.custom:h="Invalid input";break;case ZodIssueCode.invalid_intersection_types:h="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:h=`Number must be a multiple of ${y.multipleOf}`;break;case ZodIssueCode.not_finite:h="Number must be finite";break;default:h=u.defaultError,util$c.assertNever(y)}return{message:h}};let overrideErrorMap=errorMap;function setErrorMap(y){overrideErrorMap=y}function getErrorMap(){return overrideErrorMap}const makeIssue=y=>{const{data:u,path:h,errorMaps:v,issueData:w}=y,b=[...h,...w.path||[]],E={...w,path:b};if(w.message!==void 0)return{...w,path:b,message:w.message};let $="";const M=v.filter(T=>!!T).slice().reverse();for(const T of M)$=T(E,{data:u,defaultError:$}).message;return{...w,path:b,message:$}},EMPTY_PATH=[];function addIssueToContext(y,u){const h=getErrorMap(),v=makeIssue({issueData:u,data:y.data,path:y.path,errorMaps:[y.common.contextualErrorMap,y.schemaErrorMap,h,h===errorMap?void 0:errorMap].filter(w=>!!w)});y.common.issues.push(v)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(u,h){const v=[];for(const w of h){if(w.status==="aborted")return INVALID;w.status==="dirty"&&u.dirty(),v.push(w.value)}return{status:u.value,value:v}}static async mergeObjectAsync(u,h){const v=[];for(const w of h){const b=await w.key,E=await w.value;v.push({key:b,value:E})}return ParseStatus.mergeObjectSync(u,v)}static mergeObjectSync(u,h){const v={};for(const w of h){const{key:b,value:E}=w;if(b.status==="aborted"||E.status==="aborted")return INVALID;b.status==="dirty"&&u.dirty(),E.status==="dirty"&&u.dirty(),b.value!=="__proto__"&&(typeof E.value<"u"||w.alwaysSet)&&(v[b.value]=E.value)}return{status:u.value,value:v}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=y=>({status:"dirty",value:y}),OK=y=>({status:"valid",value:y}),isAborted=y=>y.status==="aborted",isDirty=y=>y.status==="dirty",isValid=y=>y.status==="valid",isAsync=y=>typeof Promise<"u"&&y instanceof Promise;function __classPrivateFieldGet(y,u,h,v){if(typeof u=="function"?y!==u||!v:!u.has(y))throw new TypeError("Cannot read private member from an object whose class did not declare it");return u.get(y)}function __classPrivateFieldSet(y,u,h,v,w){if(typeof u=="function"?y!==u||!w:!u.has(y))throw new TypeError("Cannot write private member to an object whose class did not declare it");return u.set(y,h),h}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(y){y.errToObj=u=>typeof u=="string"?{message:u}:u||{},y.toString=u=>typeof u=="string"?u:u==null?void 0:u.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(u,h,v,w){this._cachedPath=[],this.parent=u,this.data=h,this._path=v,this._key=w}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(y,u)=>{if(isValid(u))return{success:!0,data:u.value};if(!y.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const h=new ZodError(y.common.issues);return this._error=h,this._error}}};function processCreateParams(y){if(!y)return{};const{errorMap:u,invalid_type_error:h,required_error:v,description:w}=y;if(u&&(h||v))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return u?{errorMap:u,description:w}:{errorMap:(E,$)=>{var M,T;const{message:C}=y;return E.code==="invalid_enum_value"?{message:C??$.defaultError}:typeof $.data>"u"?{message:(M=C??v)!==null&&M!==void 0?M:$.defaultError}:E.code!=="invalid_type"?{message:$.defaultError}:{message:(T=C??h)!==null&&T!==void 0?T:$.defaultError}},description:w}}class ZodType{get description(){return this._def.description}_getType(u){return getParsedType(u.data)}_getOrReturnCtx(u,h){return h||{common:u.parent.common,data:u.data,parsedType:getParsedType(u.data),schemaErrorMap:this._def.errorMap,path:u.path,parent:u.parent}}_processInputParams(u){return{status:new ParseStatus,ctx:{common:u.parent.common,data:u.data,parsedType:getParsedType(u.data),schemaErrorMap:this._def.errorMap,path:u.path,parent:u.parent}}}_parseSync(u){const h=this._parse(u);if(isAsync(h))throw new Error("Synchronous parse encountered promise.");return h}_parseAsync(u){const h=this._parse(u);return Promise.resolve(h)}parse(u,h){const v=this.safeParse(u,h);if(v.success)return v.data;throw v.error}safeParse(u,h){var v;const w={common:{issues:[],async:(v=h==null?void 0:h.async)!==null&&v!==void 0?v:!1,contextualErrorMap:h==null?void 0:h.errorMap},path:(h==null?void 0:h.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:getParsedType(u)},b=this._parseSync({data:u,path:w.path,parent:w});return handleResult(w,b)}"~validate"(u){var h,v;const w={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:getParsedType(u)};if(!this["~standard"].async)try{const b=this._parseSync({data:u,path:[],parent:w});return isValid(b)?{value:b.value}:{issues:w.common.issues}}catch(b){!((v=(h=b==null?void 0:b.message)===null||h===void 0?void 0:h.toLowerCase())===null||v===void 0)&&v.includes("encountered")&&(this["~standard"].async=!0),w.common={issues:[],async:!0}}return this._parseAsync({data:u,path:[],parent:w}).then(b=>isValid(b)?{value:b.value}:{issues:w.common.issues})}async parseAsync(u,h){const v=await this.safeParseAsync(u,h);if(v.success)return v.data;throw v.error}async safeParseAsync(u,h){const v={common:{issues:[],contextualErrorMap:h==null?void 0:h.errorMap,async:!0},path:(h==null?void 0:h.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:getParsedType(u)},w=this._parse({data:u,path:v.path,parent:v}),b=await(isAsync(w)?w:Promise.resolve(w));return handleResult(v,b)}refine(u,h){const v=w=>typeof h=="string"||typeof h>"u"?{message:h}:typeof h=="function"?h(w):h;return this._refinement((w,b)=>{const E=u(w),$=()=>b.addIssue({code:ZodIssueCode.custom,...v(w)});return typeof Promise<"u"&&E instanceof Promise?E.then(M=>M?!0:($(),!1)):E?!0:($(),!1)})}refinement(u,h){return this._refinement((v,w)=>u(v)?!0:(w.addIssue(typeof h=="function"?h(v,w):h),!1))}_refinement(u){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:u}})}superRefine(u){return this._refinement(u)}constructor(u){this.spa=this.safeParseAsync,this._def=u,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:h=>this["~validate"](h)}}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this)}promise(){return ZodPromise.create(this,this._def)}or(u){return ZodUnion.create([this,u],this._def)}and(u){return ZodIntersection.create(this,u,this._def)}transform(u){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:u}})}default(u){const h=typeof u=="function"?u:()=>u;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:h,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(u){const h=typeof u=="function"?u:()=>u;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:h,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(u){const h=this.constructor;return new h({...this._def,description:u})}pipe(u){return ZodPipeline.create(this,u)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,jwtRegex=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?: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])$/,ipv4CidrRegex=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6Regex=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ipv6CidrRegex=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64urlRegex=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dateRegexSource="((\\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])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(y){let u="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return y.precision?u=`${u}\\.\\d{${y.precision}}`:y.precision==null&&(u=`${u}(\\.\\d+)?`),u}function timeRegex(y){return new RegExp(`^${timeRegexSource(y)}$`)}function datetimeRegex(y){let u=`${dateRegexSource}T${timeRegexSource(y)}`;const h=[];return h.push(y.local?"Z?":"Z"),y.offset&&h.push("([+-]\\d{2}:?\\d{2})"),u=`${u}(${h.join("|")})`,new RegExp(`^${u}$`)}function isValidIP(y,u){return!!((u==="v4"||!u)&&ipv4Regex.test(y)||(u==="v6"||!u)&&ipv6Regex.test(y))}function isValidJWT(y,u){if(!jwtRegex.test(y))return!1;try{const[h]=y.split("."),v=h.replace(/-/g,"+").replace(/_/g,"/").padEnd(h.length+(4-h.length%4)%4,"="),w=JSON.parse(atob(v));return!(typeof w!="object"||w===null||!w.typ||!w.alg||u&&w.alg!==u)}catch{return!1}}function isValidCidr(y,u){return!!((u==="v4"||!u)&&ipv4CidrRegex.test(y)||(u==="v6"||!u)&&ipv6CidrRegex.test(y))}class ZodString extends ZodType{_parse(u){if(this._def.coerce&&(u.data=String(u.data)),this._getType(u)!==ZodParsedType.string){const b=this._getOrReturnCtx(u);return addIssueToContext(b,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:b.parsedType}),INVALID}const v=new ParseStatus;let w;for(const b of this._def.checks)if(b.kind==="min")u.data.length<b.value&&(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{code:ZodIssueCode.too_small,minimum:b.value,type:"string",inclusive:!0,exact:!1,message:b.message}),v.dirty());else if(b.kind==="max")u.data.length>b.value&&(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{code:ZodIssueCode.too_big,maximum:b.value,type:"string",inclusive:!0,exact:!1,message:b.message}),v.dirty());else if(b.kind==="length"){const E=u.data.length>b.value,$=u.data.length<b.value;(E||$)&&(w=this._getOrReturnCtx(u,w),E?addIssueToContext(w,{code:ZodIssueCode.too_big,maximum:b.value,type:"string",inclusive:!0,exact:!0,message:b.message}):$&&addIssueToContext(w,{code:ZodIssueCode.too_small,minimum:b.value,type:"string",inclusive:!0,exact:!0,message:b.message}),v.dirty())}else if(b.kind==="email")emailRegex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"email",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty());else if(b.kind==="emoji")emojiRegex||(emojiRegex=new RegExp(_emojiRegex,"u")),emojiRegex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"emoji",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty());else if(b.kind==="uuid")uuidRegex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"uuid",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty());else if(b.kind==="nanoid")nanoidRegex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty());else if(b.kind==="cuid")cuidRegex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"cuid",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty());else if(b.kind==="cuid2")cuid2Regex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty());else if(b.kind==="ulid")ulidRegex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"ulid",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty());else if(b.kind==="url")try{new URL(u.data)}catch{w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"url",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty()}else b.kind==="regex"?(b.regex.lastIndex=0,b.regex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"regex",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty())):b.kind==="trim"?u.data=u.data.trim():b.kind==="includes"?u.data.includes(b.value,b.position)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{code:ZodIssueCode.invalid_string,validation:{includes:b.value,position:b.position},message:b.message}),v.dirty()):b.kind==="toLowerCase"?u.data=u.data.toLowerCase():b.kind==="toUpperCase"?u.data=u.data.toUpperCase():b.kind==="startsWith"?u.data.startsWith(b.value)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{code:ZodIssueCode.invalid_string,validation:{startsWith:b.value},message:b.message}),v.dirty()):b.kind==="endsWith"?u.data.endsWith(b.value)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{code:ZodIssueCode.invalid_string,validation:{endsWith:b.value},message:b.message}),v.dirty()):b.kind==="datetime"?datetimeRegex(b).test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{code:ZodIssueCode.invalid_string,validation:"datetime",message:b.message}),v.dirty()):b.kind==="date"?dateRegex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{code:ZodIssueCode.invalid_string,validation:"date",message:b.message}),v.dirty()):b.kind==="time"?timeRegex(b).test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{code:ZodIssueCode.invalid_string,validation:"time",message:b.message}),v.dirty()):b.kind==="duration"?durationRegex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"duration",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty()):b.kind==="ip"?isValidIP(u.data,b.version)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"ip",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty()):b.kind==="jwt"?isValidJWT(u.data,b.alg)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"jwt",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty()):b.kind==="cidr"?isValidCidr(u.data,b.version)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"cidr",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty()):b.kind==="base64"?base64Regex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"base64",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty()):b.kind==="base64url"?base64urlRegex.test(u.data)||(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{validation:"base64url",code:ZodIssueCode.invalid_string,message:b.message}),v.dirty()):util$c.assertNever(b);return{status:v.value,value:u.data}}_regex(u,h,v){return this.refinement(w=>u.test(w),{validation:h,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(v)})}_addCheck(u){return new ZodString({...this._def,checks:[...this._def.checks,u]})}email(u){return this._addCheck({kind:"email",...errorUtil.errToObj(u)})}url(u){return this._addCheck({kind:"url",...errorUtil.errToObj(u)})}emoji(u){return this._addCheck({kind:"emoji",...errorUtil.errToObj(u)})}uuid(u){return this._addCheck({kind:"uuid",...errorUtil.errToObj(u)})}nanoid(u){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(u)})}cuid(u){return this._addCheck({kind:"cuid",...errorUtil.errToObj(u)})}cuid2(u){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(u)})}ulid(u){return this._addCheck({kind:"ulid",...errorUtil.errToObj(u)})}base64(u){return this._addCheck({kind:"base64",...errorUtil.errToObj(u)})}base64url(u){return this._addCheck({kind:"base64url",...errorUtil.errToObj(u)})}jwt(u){return this._addCheck({kind:"jwt",...errorUtil.errToObj(u)})}ip(u){return this._addCheck({kind:"ip",...errorUtil.errToObj(u)})}cidr(u){return this._addCheck({kind:"cidr",...errorUtil.errToObj(u)})}datetime(u){var h,v;return typeof u=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:u}):this._addCheck({kind:"datetime",precision:typeof(u==null?void 0:u.precision)>"u"?null:u==null?void 0:u.precision,offset:(h=u==null?void 0:u.offset)!==null&&h!==void 0?h:!1,local:(v=u==null?void 0:u.local)!==null&&v!==void 0?v:!1,...errorUtil.errToObj(u==null?void 0:u.message)})}date(u){return this._addCheck({kind:"date",message:u})}time(u){return typeof u=="string"?this._addCheck({kind:"time",precision:null,message:u}):this._addCheck({kind:"time",precision:typeof(u==null?void 0:u.precision)>"u"?null:u==null?void 0:u.precision,...errorUtil.errToObj(u==null?void 0:u.message)})}duration(u){return this._addCheck({kind:"duration",...errorUtil.errToObj(u)})}regex(u,h){return this._addCheck({kind:"regex",regex:u,...errorUtil.errToObj(h)})}includes(u,h){return this._addCheck({kind:"includes",value:u,position:h==null?void 0:h.position,...errorUtil.errToObj(h==null?void 0:h.message)})}startsWith(u,h){return this._addCheck({kind:"startsWith",value:u,...errorUtil.errToObj(h)})}endsWith(u,h){return this._addCheck({kind:"endsWith",value:u,...errorUtil.errToObj(h)})}min(u,h){return this._addCheck({kind:"min",value:u,...errorUtil.errToObj(h)})}max(u,h){return this._addCheck({kind:"max",value:u,...errorUtil.errToObj(h)})}length(u,h){return this._addCheck({kind:"length",value:u,...errorUtil.errToObj(h)})}nonempty(u){return this.min(1,errorUtil.errToObj(u))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(u=>u.kind==="datetime")}get isDate(){return!!this._def.checks.find(u=>u.kind==="date")}get isTime(){return!!this._def.checks.find(u=>u.kind==="time")}get isDuration(){return!!this._def.checks.find(u=>u.kind==="duration")}get isEmail(){return!!this._def.checks.find(u=>u.kind==="email")}get isURL(){return!!this._def.checks.find(u=>u.kind==="url")}get isEmoji(){return!!this._def.checks.find(u=>u.kind==="emoji")}get isUUID(){return!!this._def.checks.find(u=>u.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(u=>u.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(u=>u.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(u=>u.kind==="cuid2")}get isULID(){return!!this._def.checks.find(u=>u.kind==="ulid")}get isIP(){return!!this._def.checks.find(u=>u.kind==="ip")}get isCIDR(){return!!this._def.checks.find(u=>u.kind==="cidr")}get isBase64(){return!!this._def.checks.find(u=>u.kind==="base64")}get isBase64url(){return!!this._def.checks.find(u=>u.kind==="base64url")}get minLength(){let u=null;for(const h of this._def.checks)h.kind==="min"&&(u===null||h.value>u)&&(u=h.value);return u}get maxLength(){let u=null;for(const h of this._def.checks)h.kind==="max"&&(u===null||h.value<u)&&(u=h.value);return u}}ZodString.create=y=>{var u;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(u=y==null?void 0:y.coerce)!==null&&u!==void 0?u:!1,...processCreateParams(y)})};function floatSafeRemainder(y,u){const h=(y.toString().split(".")[1]||"").length,v=(u.toString().split(".")[1]||"").length,w=h>v?h:v,b=parseInt(y.toFixed(w).replace(".","")),E=parseInt(u.toFixed(w).replace(".",""));return b%E/Math.pow(10,w)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(u){if(this._def.coerce&&(u.data=Number(u.data)),this._getType(u)!==ZodParsedType.number){const b=this._getOrReturnCtx(u);return addIssueToContext(b,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:b.parsedType}),INVALID}let v;const w=new ParseStatus;for(const b of this._def.checks)b.kind==="int"?util$c.isInteger(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:b.message}),w.dirty()):b.kind==="min"?(b.inclusive?u.data<b.value:u.data<=b.value)&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_small,minimum:b.value,type:"number",inclusive:b.inclusive,exact:!1,message:b.message}),w.dirty()):b.kind==="max"?(b.inclusive?u.data>b.value:u.data>=b.value)&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_big,maximum:b.value,type:"number",inclusive:b.inclusive,exact:!1,message:b.message}),w.dirty()):b.kind==="multipleOf"?floatSafeRemainder(u.data,b.value)!==0&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.not_multiple_of,multipleOf:b.value,message:b.message}),w.dirty()):b.kind==="finite"?Number.isFinite(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.not_finite,message:b.message}),w.dirty()):util$c.assertNever(b);return{status:w.value,value:u.data}}gte(u,h){return this.setLimit("min",u,!0,errorUtil.toString(h))}gt(u,h){return this.setLimit("min",u,!1,errorUtil.toString(h))}lte(u,h){return this.setLimit("max",u,!0,errorUtil.toString(h))}lt(u,h){return this.setLimit("max",u,!1,errorUtil.toString(h))}setLimit(u,h,v,w){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:u,value:h,inclusive:v,message:errorUtil.toString(w)}]})}_addCheck(u){return new ZodNumber({...this._def,checks:[...this._def.checks,u]})}int(u){return this._addCheck({kind:"int",message:errorUtil.toString(u)})}positive(u){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(u)})}negative(u){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(u)})}nonpositive(u){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(u)})}nonnegative(u){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(u)})}multipleOf(u,h){return this._addCheck({kind:"multipleOf",value:u,message:errorUtil.toString(h)})}finite(u){return this._addCheck({kind:"finite",message:errorUtil.toString(u)})}safe(u){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(u)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(u)})}get minValue(){let u=null;for(const h of this._def.checks)h.kind==="min"&&(u===null||h.value>u)&&(u=h.value);return u}get maxValue(){let u=null;for(const h of this._def.checks)h.kind==="max"&&(u===null||h.value<u)&&(u=h.value);return u}get isInt(){return!!this._def.checks.find(u=>u.kind==="int"||u.kind==="multipleOf"&&util$c.isInteger(u.value))}get isFinite(){let u=null,h=null;for(const v of this._def.checks){if(v.kind==="finite"||v.kind==="int"||v.kind==="multipleOf")return!0;v.kind==="min"?(h===null||v.value>h)&&(h=v.value):v.kind==="max"&&(u===null||v.value<u)&&(u=v.value)}return Number.isFinite(h)&&Number.isFinite(u)}}ZodNumber.create=y=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(y==null?void 0:y.coerce)||!1,...processCreateParams(y)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(u){if(this._def.coerce)try{u.data=BigInt(u.data)}catch{return this._getInvalidInput(u)}if(this._getType(u)!==ZodParsedType.bigint)return this._getInvalidInput(u);let v;const w=new ParseStatus;for(const b of this._def.checks)b.kind==="min"?(b.inclusive?u.data<b.value:u.data<=b.value)&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_small,type:"bigint",minimum:b.value,inclusive:b.inclusive,message:b.message}),w.dirty()):b.kind==="max"?(b.inclusive?u.data>b.value:u.data>=b.value)&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_big,type:"bigint",maximum:b.value,inclusive:b.inclusive,message:b.message}),w.dirty()):b.kind==="multipleOf"?u.data%b.value!==BigInt(0)&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.not_multiple_of,multipleOf:b.value,message:b.message}),w.dirty()):util$c.assertNever(b);return{status:w.value,value:u.data}}_getInvalidInput(u){const h=this._getOrReturnCtx(u);return addIssueToContext(h,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:h.parsedType}),INVALID}gte(u,h){return this.setLimit("min",u,!0,errorUtil.toString(h))}gt(u,h){return this.setLimit("min",u,!1,errorUtil.toString(h))}lte(u,h){return this.setLimit("max",u,!0,errorUtil.toString(h))}lt(u,h){return this.setLimit("max",u,!1,errorUtil.toString(h))}setLimit(u,h,v,w){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:u,value:h,inclusive:v,message:errorUtil.toString(w)}]})}_addCheck(u){return new ZodBigInt({...this._def,checks:[...this._def.checks,u]})}positive(u){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(u)})}negative(u){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(u)})}nonpositive(u){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(u)})}nonnegative(u){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(u)})}multipleOf(u,h){return this._addCheck({kind:"multipleOf",value:u,message:errorUtil.toString(h)})}get minValue(){let u=null;for(const h of this._def.checks)h.kind==="min"&&(u===null||h.value>u)&&(u=h.value);return u}get maxValue(){let u=null;for(const h of this._def.checks)h.kind==="max"&&(u===null||h.value<u)&&(u=h.value);return u}}ZodBigInt.create=y=>{var u;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(u=y==null?void 0:y.coerce)!==null&&u!==void 0?u:!1,...processCreateParams(y)})};class ZodBoolean extends ZodType{_parse(u){if(this._def.coerce&&(u.data=!!u.data),this._getType(u)!==ZodParsedType.boolean){const v=this._getOrReturnCtx(u);return addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:v.parsedType}),INVALID}return OK(u.data)}}ZodBoolean.create=y=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(y==null?void 0:y.coerce)||!1,...processCreateParams(y)});class ZodDate extends ZodType{_parse(u){if(this._def.coerce&&(u.data=new Date(u.data)),this._getType(u)!==ZodParsedType.date){const b=this._getOrReturnCtx(u);return addIssueToContext(b,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:b.parsedType}),INVALID}if(isNaN(u.data.getTime())){const b=this._getOrReturnCtx(u);return addIssueToContext(b,{code:ZodIssueCode.invalid_date}),INVALID}const v=new ParseStatus;let w;for(const b of this._def.checks)b.kind==="min"?u.data.getTime()<b.value&&(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{code:ZodIssueCode.too_small,message:b.message,inclusive:!0,exact:!1,minimum:b.value,type:"date"}),v.dirty()):b.kind==="max"?u.data.getTime()>b.value&&(w=this._getOrReturnCtx(u,w),addIssueToContext(w,{code:ZodIssueCode.too_big,message:b.message,inclusive:!0,exact:!1,maximum:b.value,type:"date"}),v.dirty()):util$c.assertNever(b);return{status:v.value,value:new Date(u.data.getTime())}}_addCheck(u){return new ZodDate({...this._def,checks:[...this._def.checks,u]})}min(u,h){return this._addCheck({kind:"min",value:u.getTime(),message:errorUtil.toString(h)})}max(u,h){return this._addCheck({kind:"max",value:u.getTime(),message:errorUtil.toString(h)})}get minDate(){let u=null;for(const h of this._def.checks)h.kind==="min"&&(u===null||h.value>u)&&(u=h.value);return u!=null?new Date(u):null}get maxDate(){let u=null;for(const h of this._def.checks)h.kind==="max"&&(u===null||h.value<u)&&(u=h.value);return u!=null?new Date(u):null}}ZodDate.create=y=>new ZodDate({checks:[],coerce:(y==null?void 0:y.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(y)});class ZodSymbol extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.symbol){const v=this._getOrReturnCtx(u);return addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:v.parsedType}),INVALID}return OK(u.data)}}ZodSymbol.create=y=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(y)});class ZodUndefined extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.undefined){const v=this._getOrReturnCtx(u);return addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:v.parsedType}),INVALID}return OK(u.data)}}ZodUndefined.create=y=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(y)});class ZodNull extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.null){const v=this._getOrReturnCtx(u);return addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:v.parsedType}),INVALID}return OK(u.data)}}ZodNull.create=y=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(y)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(u){return OK(u.data)}}ZodAny.create=y=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(y)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(u){return OK(u.data)}}ZodUnknown.create=y=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(y)});class ZodNever extends ZodType{_parse(u){const h=this._getOrReturnCtx(u);return addIssueToContext(h,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:h.parsedType}),INVALID}}ZodNever.create=y=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(y)});class ZodVoid extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.undefined){const v=this._getOrReturnCtx(u);return addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:v.parsedType}),INVALID}return OK(u.data)}}ZodVoid.create=y=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(y)});class ZodArray extends ZodType{_parse(u){const{ctx:h,status:v}=this._processInputParams(u),w=this._def;if(h.parsedType!==ZodParsedType.array)return addIssueToContext(h,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:h.parsedType}),INVALID;if(w.exactLength!==null){const E=h.data.length>w.exactLength.value,$=h.data.length<w.exactLength.value;(E||$)&&(addIssueToContext(h,{code:E?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:$?w.exactLength.value:void 0,maximum:E?w.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:w.exactLength.message}),v.dirty())}if(w.minLength!==null&&h.data.length<w.minLength.value&&(addIssueToContext(h,{code:ZodIssueCode.too_small,minimum:w.minLength.value,type:"array",inclusive:!0,exact:!1,message:w.minLength.message}),v.dirty()),w.maxLength!==null&&h.data.length>w.maxLength.value&&(addIssueToContext(h,{code:ZodIssueCode.too_big,maximum:w.maxLength.value,type:"array",inclusive:!0,exact:!1,message:w.maxLength.message}),v.dirty()),h.common.async)return Promise.all([...h.data].map((E,$)=>w.type._parseAsync(new ParseInputLazyPath(h,E,h.path,$)))).then(E=>ParseStatus.mergeArray(v,E));const b=[...h.data].map((E,$)=>w.type._parseSync(new ParseInputLazyPath(h,E,h.path,$)));return ParseStatus.mergeArray(v,b)}get element(){return this._def.type}min(u,h){return new ZodArray({...this._def,minLength:{value:u,message:errorUtil.toString(h)}})}max(u,h){return new ZodArray({...this._def,maxLength:{value:u,message:errorUtil.toString(h)}})}length(u,h){return new ZodArray({...this._def,exactLength:{value:u,message:errorUtil.toString(h)}})}nonempty(u){return this.min(1,u)}}ZodArray.create=(y,u)=>new ZodArray({type:y,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(u)});function deepPartialify(y){if(y instanceof ZodObject){const u={};for(const h in y.shape){const v=y.shape[h];u[h]=ZodOptional.create(deepPartialify(v))}return new ZodObject({...y._def,shape:()=>u})}else return y instanceof ZodArray?new ZodArray({...y._def,type:deepPartialify(y.element)}):y instanceof ZodOptional?ZodOptional.create(deepPartialify(y.unwrap())):y instanceof ZodNullable?ZodNullable.create(deepPartialify(y.unwrap())):y instanceof ZodTuple?ZodTuple.create(y.items.map(u=>deepPartialify(u))):y}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const u=this._def.shape(),h=util$c.objectKeys(u);return this._cached={shape:u,keys:h}}_parse(u){if(this._getType(u)!==ZodParsedType.object){const T=this._getOrReturnCtx(u);return addIssueToContext(T,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:T.parsedType}),INVALID}const{status:v,ctx:w}=this._processInputParams(u),{shape:b,keys:E}=this._getCached(),$=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const T in w.data)E.includes(T)||$.push(T);const M=[];for(const T of E){const C=b[T],B=w.data[T];M.push({key:{status:"valid",value:T},value:C._parse(new ParseInputLazyPath(w,B,w.path,T)),alwaysSet:T in w.data})}if(this._def.catchall instanceof ZodNever){const T=this._def.unknownKeys;if(T==="passthrough")for(const C of $)M.push({key:{status:"valid",value:C},value:{status:"valid",value:w.data[C]}});else if(T==="strict")$.length>0&&(addIssueToContext(w,{code:ZodIssueCode.unrecognized_keys,keys:$}),v.dirty());else if(T!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const T=this._def.catchall;for(const C of $){const B=w.data[C];M.push({key:{status:"valid",value:C},value:T._parse(new ParseInputLazyPath(w,B,w.path,C)),alwaysSet:C in w.data})}}return w.common.async?Promise.resolve().then(async()=>{const T=[];for(const C of M){const B=await C.key,N=await C.value;T.push({key:B,value:N,alwaysSet:C.alwaysSet})}return T}).then(T=>ParseStatus.mergeObjectSync(v,T)):ParseStatus.mergeObjectSync(v,M)}get shape(){return this._def.shape()}strict(u){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...u!==void 0?{errorMap:(h,v)=>{var w,b,E,$;const M=(E=(b=(w=this._def).errorMap)===null||b===void 0?void 0:b.call(w,h,v).message)!==null&&E!==void 0?E:v.defaultError;return h.code==="unrecognized_keys"?{message:($=errorUtil.errToObj(u).message)!==null&&$!==void 0?$:M}:{message:M}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(u){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...u})})}merge(u){return new ZodObject({unknownKeys:u._def.unknownKeys,catchall:u._def.catchall,shape:()=>({...this._def.shape(),...u._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(u,h){return this.augment({[u]:h})}catchall(u){return new ZodObject({...this._def,catchall:u})}pick(u){const h={};return util$c.objectKeys(u).forEach(v=>{u[v]&&this.shape[v]&&(h[v]=this.shape[v])}),new ZodObject({...this._def,shape:()=>h})}omit(u){const h={};return util$c.objectKeys(this.shape).forEach(v=>{u[v]||(h[v]=this.shape[v])}),new ZodObject({...this._def,shape:()=>h})}deepPartial(){return deepPartialify(this)}partial(u){const h={};return util$c.objectKeys(this.shape).forEach(v=>{const w=this.shape[v];u&&!u[v]?h[v]=w:h[v]=w.optional()}),new ZodObject({...this._def,shape:()=>h})}required(u){const h={};return util$c.objectKeys(this.shape).forEach(v=>{if(u&&!u[v])h[v]=this.shape[v];else{let b=this.shape[v];for(;b instanceof ZodOptional;)b=b._def.innerType;h[v]=b}}),new ZodObject({...this._def,shape:()=>h})}keyof(){return createZodEnum(util$c.objectKeys(this.shape))}}ZodObject.create=(y,u)=>new ZodObject({shape:()=>y,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(u)}),ZodObject.strictCreate=(y,u)=>new ZodObject({shape:()=>y,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(u)}),ZodObject.lazycreate=(y,u)=>new ZodObject({shape:y,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(u)});class ZodUnion extends ZodType{_parse(u){const{ctx:h}=this._processInputParams(u),v=this._def.options;function w(b){for(const $ of b)if($.result.status==="valid")return $.result;for(const $ of b)if($.result.status==="dirty")return h.common.issues.push(...$.ctx.common.issues),$.result;const E=b.map($=>new ZodError($.ctx.common.issues));return addIssueToContext(h,{code:ZodIssueCode.invalid_union,unionErrors:E}),INVALID}if(h.common.async)return Promise.all(v.map(async b=>{const E={...h,common:{...h.common,issues:[]},parent:null};return{result:await b._parseAsync({data:h.data,path:h.path,parent:E}),ctx:E}})).then(w);{let b;const E=[];for(const M of v){const T={...h,common:{...h.common,issues:[]},parent:null},C=M._parseSync({data:h.data,path:h.path,parent:T});if(C.status==="valid")return C;C.status==="dirty"&&!b&&(b={result:C,ctx:T}),T.common.issues.length&&E.push(T.common.issues)}if(b)return h.common.issues.push(...b.ctx.common.issues),b.result;const $=E.map(M=>new ZodError(M));return addIssueToContext(h,{code:ZodIssueCode.invalid_union,unionErrors:$}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(y,u)=>new ZodUnion({options:y,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(u)});const getDiscriminator=y=>y instanceof ZodLazy?getDiscriminator(y.schema):y instanceof ZodEffects?getDiscriminator(y.innerType()):y instanceof ZodLiteral?[y.value]:y instanceof ZodEnum?y.options:y instanceof ZodNativeEnum?util$c.objectValues(y.enum):y instanceof ZodDefault?getDiscriminator(y._def.innerType):y instanceof ZodUndefined?[void 0]:y instanceof ZodNull?[null]:y instanceof ZodOptional?[void 0,...getDiscriminator(y.unwrap())]:y instanceof ZodNullable?[null,...getDiscriminator(y.unwrap())]:y instanceof ZodBranded||y instanceof ZodReadonly?getDiscriminator(y.unwrap()):y instanceof ZodCatch?getDiscriminator(y._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(u){const{ctx:h}=this._processInputParams(u);if(h.parsedType!==ZodParsedType.object)return addIssueToContext(h,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:h.parsedType}),INVALID;const v=this.discriminator,w=h.data[v],b=this.optionsMap.get(w);return b?h.common.async?b._parseAsync({data:h.data,path:h.path,parent:h}):b._parseSync({data:h.data,path:h.path,parent:h}):(addIssueToContext(h,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[v]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(u,h,v){const w=new Map;for(const b of h){const E=getDiscriminator(b.shape[u]);if(!E.length)throw new Error(`A discriminator value for key \`${u}\` could not be extracted from all schema options`);for(const $ of E){if(w.has($))throw new Error(`Discriminator property ${String(u)} has duplicate value ${String($)}`);w.set($,b)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:u,options:h,optionsMap:w,...processCreateParams(v)})}}function mergeValues(y,u){const h=getParsedType(y),v=getParsedType(u);if(y===u)return{valid:!0,data:y};if(h===ZodParsedType.object&&v===ZodParsedType.object){const w=util$c.objectKeys(u),b=util$c.objectKeys(y).filter($=>w.indexOf($)!==-1),E={...y,...u};for(const $ of b){const M=mergeValues(y[$],u[$]);if(!M.valid)return{valid:!1};E[$]=M.data}return{valid:!0,data:E}}else if(h===ZodParsedType.array&&v===ZodParsedType.array){if(y.length!==u.length)return{valid:!1};const w=[];for(let b=0;b<y.length;b++){const E=y[b],$=u[b],M=mergeValues(E,$);if(!M.valid)return{valid:!1};w.push(M.data)}return{valid:!0,data:w}}else return h===ZodParsedType.date&&v===ZodParsedType.date&&+y==+u?{valid:!0,data:y}:{valid:!1}}class ZodIntersection extends ZodType{_parse(u){const{status:h,ctx:v}=this._processInputParams(u),w=(b,E)=>{if(isAborted(b)||isAborted(E))return INVALID;const $=mergeValues(b.value,E.value);return $.valid?((isDirty(b)||isDirty(E))&&h.dirty(),{status:h.value,value:$.data}):(addIssueToContext(v,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return v.common.async?Promise.all([this._def.left._parseAsync({data:v.data,path:v.path,parent:v}),this._def.right._parseAsync({data:v.data,path:v.path,parent:v})]).then(([b,E])=>w(b,E)):w(this._def.left._parseSync({data:v.data,path:v.path,parent:v}),this._def.right._parseSync({data:v.data,path:v.path,parent:v}))}}ZodIntersection.create=(y,u,h)=>new ZodIntersection({left:y,right:u,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(h)});class ZodTuple extends ZodType{_parse(u){const{status:h,ctx:v}=this._processInputParams(u);if(v.parsedType!==ZodParsedType.array)return addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:v.parsedType}),INVALID;if(v.data.length<this._def.items.length)return addIssueToContext(v,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID;!this._def.rest&&v.data.length>this._def.items.length&&(addIssueToContext(v,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h.dirty());const b=[...v.data].map((E,$)=>{const M=this._def.items[$]||this._def.rest;return M?M._parse(new ParseInputLazyPath(v,E,v.path,$)):null}).filter(E=>!!E);return v.common.async?Promise.all(b).then(E=>ParseStatus.mergeArray(h,E)):ParseStatus.mergeArray(h,b)}get items(){return this._def.items}rest(u){return new ZodTuple({...this._def,rest:u})}}ZodTuple.create=(y,u)=>{if(!Array.isArray(y))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:y,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(u)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(u){const{status:h,ctx:v}=this._processInputParams(u);if(v.parsedType!==ZodParsedType.object)return addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:v.parsedType}),INVALID;const w=[],b=this._def.keyType,E=this._def.valueType;for(const $ in v.data)w.push({key:b._parse(new ParseInputLazyPath(v,$,v.path,$)),value:E._parse(new ParseInputLazyPath(v,v.data[$],v.path,$)),alwaysSet:$ in v.data});return v.common.async?ParseStatus.mergeObjectAsync(h,w):ParseStatus.mergeObjectSync(h,w)}get element(){return this._def.valueType}static create(u,h,v){return h instanceof ZodType?new ZodRecord({keyType:u,valueType:h,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(v)}):new ZodRecord({keyType:ZodString.create(),valueType:u,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(h)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(u){const{status:h,ctx:v}=this._processInputParams(u);if(v.parsedType!==ZodParsedType.map)return addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:v.parsedType}),INVALID;const w=this._def.keyType,b=this._def.valueType,E=[...v.data.entries()].map(([$,M],T)=>({key:w._parse(new ParseInputLazyPath(v,$,v.path,[T,"key"])),value:b._parse(new ParseInputLazyPath(v,M,v.path,[T,"value"]))}));if(v.common.async){const $=new Map;return Promise.resolve().then(async()=>{for(const M of E){const T=await M.key,C=await M.value;if(T.status==="aborted"||C.status==="aborted")return INVALID;(T.status==="dirty"||C.status==="dirty")&&h.dirty(),$.set(T.value,C.value)}return{status:h.value,value:$}})}else{const $=new Map;for(const M of E){const T=M.key,C=M.value;if(T.status==="aborted"||C.status==="aborted")return INVALID;(T.status==="dirty"||C.status==="dirty")&&h.dirty(),$.set(T.value,C.value)}return{status:h.value,value:$}}}}ZodMap.create=(y,u,h)=>new ZodMap({valueType:u,keyType:y,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(h)});class ZodSet extends ZodType{_parse(u){const{status:h,ctx:v}=this._processInputParams(u);if(v.parsedType!==ZodParsedType.set)return addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:v.parsedType}),INVALID;const w=this._def;w.minSize!==null&&v.data.size<w.minSize.value&&(addIssueToContext(v,{code:ZodIssueCode.too_small,minimum:w.minSize.value,type:"set",inclusive:!0,exact:!1,message:w.minSize.message}),h.dirty()),w.maxSize!==null&&v.data.size>w.maxSize.value&&(addIssueToContext(v,{code:ZodIssueCode.too_big,maximum:w.maxSize.value,type:"set",inclusive:!0,exact:!1,message:w.maxSize.message}),h.dirty());const b=this._def.valueType;function E(M){const T=new Set;for(const C of M){if(C.status==="aborted")return INVALID;C.status==="dirty"&&h.dirty(),T.add(C.value)}return{status:h.value,value:T}}const $=[...v.data.values()].map((M,T)=>b._parse(new ParseInputLazyPath(v,M,v.path,T)));return v.common.async?Promise.all($).then(M=>E(M)):E($)}min(u,h){return new ZodSet({...this._def,minSize:{value:u,message:errorUtil.toString(h)}})}max(u,h){return new ZodSet({...this._def,maxSize:{value:u,message:errorUtil.toString(h)}})}size(u,h){return this.min(u,h).max(u,h)}nonempty(u){return this.min(1,u)}}ZodSet.create=(y,u)=>new ZodSet({valueType:y,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(u)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(u){const{ctx:h}=this._processInputParams(u);if(h.parsedType!==ZodParsedType.function)return addIssueToContext(h,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:h.parsedType}),INVALID;function v($,M){return makeIssue({data:$,path:h.path,errorMaps:[h.common.contextualErrorMap,h.schemaErrorMap,getErrorMap(),errorMap].filter(T=>!!T),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:M}})}function w($,M){return makeIssue({data:$,path:h.path,errorMaps:[h.common.contextualErrorMap,h.schemaErrorMap,getErrorMap(),errorMap].filter(T=>!!T),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:M}})}const b={errorMap:h.common.contextualErrorMap},E=h.data;if(this._def.returns instanceof ZodPromise){const $=this;return OK(async function(...M){const T=new ZodError([]),C=await $._def.args.parseAsync(M,b).catch(H=>{throw T.addIssue(v(M,H)),T}),B=await Reflect.apply(E,this,C);return await $._def.returns._def.type.parseAsync(B,b).catch(H=>{throw T.addIssue(w(B,H)),T})})}else{const $=this;return OK(function(...M){const T=$._def.args.safeParse(M,b);if(!T.success)throw new ZodError([v(M,T.error)]);const C=Reflect.apply(E,this,T.data),B=$._def.returns.safeParse(C,b);if(!B.success)throw new ZodError([w(C,B.error)]);return B.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...u){return new ZodFunction({...this._def,args:ZodTuple.create(u).rest(ZodUnknown.create())})}returns(u){return new ZodFunction({...this._def,returns:u})}implement(u){return this.parse(u)}strictImplement(u){return this.parse(u)}static create(u,h,v){return new ZodFunction({args:u||ZodTuple.create([]).rest(ZodUnknown.create()),returns:h||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(v)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(u){const{ctx:h}=this._processInputParams(u);return this._def.getter()._parse({data:h.data,path:h.path,parent:h})}}ZodLazy.create=(y,u)=>new ZodLazy({getter:y,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(u)});class ZodLiteral extends ZodType{_parse(u){if(u.data!==this._def.value){const h=this._getOrReturnCtx(u);return addIssueToContext(h,{received:h.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:u.data}}get value(){return this._def.value}}ZodLiteral.create=(y,u)=>new ZodLiteral({value:y,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(u)});function createZodEnum(y,u){return new ZodEnum({values:y,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(u)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(u){if(typeof u.data!="string"){const h=this._getOrReturnCtx(u),v=this._def.values;return addIssueToContext(h,{expected:util$c.joinValues(v),received:h.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodEnum_cache)||__classPrivateFieldSet(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet(this,_ZodEnum_cache).has(u.data)){const h=this._getOrReturnCtx(u),v=this._def.values;return addIssueToContext(h,{received:h.data,code:ZodIssueCode.invalid_enum_value,options:v}),INVALID}return OK(u.data)}get options(){return this._def.values}get enum(){const u={};for(const h of this._def.values)u[h]=h;return u}get Values(){const u={};for(const h of this._def.values)u[h]=h;return u}get Enum(){const u={};for(const h of this._def.values)u[h]=h;return u}extract(u,h=this._def){return ZodEnum.create(u,{...this._def,...h})}exclude(u,h=this._def){return ZodEnum.create(this.options.filter(v=>!u.includes(v)),{...this._def,...h})}}_ZodEnum_cache=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(u){const h=util$c.getValidEnumValues(this._def.values),v=this._getOrReturnCtx(u);if(v.parsedType!==ZodParsedType.string&&v.parsedType!==ZodParsedType.number){const w=util$c.objectValues(h);return addIssueToContext(v,{expected:util$c.joinValues(w),received:v.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache)||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util$c.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,_ZodNativeEnum_cache).has(u.data)){const w=util$c.objectValues(h);return addIssueToContext(v,{received:v.data,code:ZodIssueCode.invalid_enum_value,options:w}),INVALID}return OK(u.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap,ZodNativeEnum.create=(y,u)=>new ZodNativeEnum({values:y,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(u)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(u){const{ctx:h}=this._processInputParams(u);if(h.parsedType!==ZodParsedType.promise&&h.common.async===!1)return addIssueToContext(h,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:h.parsedType}),INVALID;const v=h.parsedType===ZodParsedType.promise?h.data:Promise.resolve(h.data);return OK(v.then(w=>this._def.type.parseAsync(w,{path:h.path,errorMap:h.common.contextualErrorMap})))}}ZodPromise.create=(y,u)=>new ZodPromise({type:y,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(u)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(u){const{status:h,ctx:v}=this._processInputParams(u),w=this._def.effect||null,b={addIssue:E=>{addIssueToContext(v,E),E.fatal?h.abort():h.dirty()},get path(){return v.path}};if(b.addIssue=b.addIssue.bind(b),w.type==="preprocess"){const E=w.transform(v.data,b);if(v.common.async)return Promise.resolve(E).then(async $=>{if(h.value==="aborted")return INVALID;const M=await this._def.schema._parseAsync({data:$,path:v.path,parent:v});return M.status==="aborted"?INVALID:M.status==="dirty"||h.value==="dirty"?DIRTY(M.value):M});{if(h.value==="aborted")return INVALID;const $=this._def.schema._parseSync({data:E,path:v.path,parent:v});return $.status==="aborted"?INVALID:$.status==="dirty"||h.value==="dirty"?DIRTY($.value):$}}if(w.type==="refinement"){const E=$=>{const M=w.refinement($,b);if(v.common.async)return Promise.resolve(M);if(M instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return $};if(v.common.async===!1){const $=this._def.schema._parseSync({data:v.data,path:v.path,parent:v});return $.status==="aborted"?INVALID:($.status==="dirty"&&h.dirty(),E($.value),{status:h.value,value:$.value})}else return this._def.schema._parseAsync({data:v.data,path:v.path,parent:v}).then($=>$.status==="aborted"?INVALID:($.status==="dirty"&&h.dirty(),E($.value).then(()=>({status:h.value,value:$.value}))))}if(w.type==="transform")if(v.common.async===!1){const E=this._def.schema._parseSync({data:v.data,path:v.path,parent:v});if(!isValid(E))return E;const $=w.transform(E.value,b);if($ instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:h.value,value:$}}else return this._def.schema._parseAsync({data:v.data,path:v.path,parent:v}).then(E=>isValid(E)?Promise.resolve(w.transform(E.value,b)).then($=>({status:h.value,value:$})):E);util$c.assertNever(w)}}ZodEffects.create=(y,u,h)=>new ZodEffects({schema:y,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:u,...processCreateParams(h)}),ZodEffects.createWithPreprocess=(y,u,h)=>new ZodEffects({schema:u,effect:{type:"preprocess",transform:y},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(h)});class ZodOptional extends ZodType{_parse(u){return this._getType(u)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(u)}unwrap(){return this._def.innerType}}ZodOptional.create=(y,u)=>new ZodOptional({innerType:y,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(u)});class ZodNullable extends ZodType{_parse(u){return this._getType(u)===ZodParsedType.null?OK(null):this._def.innerType._parse(u)}unwrap(){return this._def.innerType}}ZodNullable.create=(y,u)=>new ZodNullable({innerType:y,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(u)});class ZodDefault extends ZodType{_parse(u){const{ctx:h}=this._processInputParams(u);let v=h.data;return h.parsedType===ZodParsedType.undefined&&(v=this._def.defaultValue()),this._def.innerType._parse({data:v,path:h.path,parent:h})}removeDefault(){return this._def.innerType}}ZodDefault.create=(y,u)=>new ZodDefault({innerType:y,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof u.default=="function"?u.default:()=>u.default,...processCreateParams(u)});class ZodCatch extends ZodType{_parse(u){const{ctx:h}=this._processInputParams(u),v={...h,common:{...h.common,issues:[]}},w=this._def.innerType._parse({data:v.data,path:v.path,parent:{...v}});return isAsync(w)?w.then(b=>({status:"valid",value:b.status==="valid"?b.value:this._def.catchValue({get error(){return new ZodError(v.common.issues)},input:v.data})})):{status:"valid",value:w.status==="valid"?w.value:this._def.catchValue({get error(){return new ZodError(v.common.issues)},input:v.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(y,u)=>new ZodCatch({innerType:y,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof u.catch=="function"?u.catch:()=>u.catch,...processCreateParams(u)});class ZodNaN extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.nan){const v=this._getOrReturnCtx(u);return addIssueToContext(v,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:v.parsedType}),INVALID}return{status:"valid",value:u.data}}}ZodNaN.create=y=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(y)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(u){const{ctx:h}=this._processInputParams(u),v=h.data;return this._def.type._parse({data:v,path:h.path,parent:h})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(u){const{status:h,ctx:v}=this._processInputParams(u);if(v.common.async)return(async()=>{const b=await this._def.in._parseAsync({data:v.data,path:v.path,parent:v});return b.status==="aborted"?INVALID:b.status==="dirty"?(h.dirty(),DIRTY(b.value)):this._def.out._parseAsync({data:b.value,path:v.path,parent:v})})();{const w=this._def.in._parseSync({data:v.data,path:v.path,parent:v});return w.status==="aborted"?INVALID:w.status==="dirty"?(h.dirty(),{status:"dirty",value:w.value}):this._def.out._parseSync({data:w.value,path:v.path,parent:v})}}static create(u,h){return new ZodPipeline({in:u,out:h,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(u){const h=this._def.innerType._parse(u),v=w=>(isValid(w)&&(w.value=Object.freeze(w.value)),w);return isAsync(h)?h.then(w=>v(w)):v(h)}unwrap(){return this._def.innerType}}ZodReadonly.create=(y,u)=>new ZodReadonly({innerType:y,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(u)});function custom(y,u={},h){return y?ZodAny.create().superRefine((v,w)=>{var b,E;if(!y(v)){const $=typeof u=="function"?u(v):typeof u=="string"?{message:u}:u,M=(E=(b=$.fatal)!==null&&b!==void 0?b:h)!==null&&E!==void 0?E:!0,T=typeof $=="string"?{message:$}:$;w.addIssue({code:"custom",...T,fatal:M})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(y){y.ZodString="ZodString",y.ZodNumber="ZodNumber",y.ZodNaN="ZodNaN",y.ZodBigInt="ZodBigInt",y.ZodBoolean="ZodBoolean",y.ZodDate="ZodDate",y.ZodSymbol="ZodSymbol",y.ZodUndefined="ZodUndefined",y.ZodNull="ZodNull",y.ZodAny="ZodAny",y.ZodUnknown="ZodUnknown",y.ZodNever="ZodNever",y.ZodVoid="ZodVoid",y.ZodArray="ZodArray",y.ZodObject="ZodObject",y.ZodUnion="ZodUnion",y.ZodDiscriminatedUnion="ZodDiscriminatedUnion",y.ZodIntersection="ZodIntersection",y.ZodTuple="ZodTuple",y.ZodRecord="ZodRecord",y.ZodMap="ZodMap",y.ZodSet="ZodSet",y.ZodFunction="ZodFunction",y.ZodLazy="ZodLazy",y.ZodLiteral="ZodLiteral",y.ZodEnum="ZodEnum",y.ZodEffects="ZodEffects",y.ZodNativeEnum="ZodNativeEnum",y.ZodOptional="ZodOptional",y.ZodNullable="ZodNullable",y.ZodDefault="ZodDefault",y.ZodCatch="ZodCatch",y.ZodPromise="ZodPromise",y.ZodBranded="ZodBranded",y.ZodPipeline="ZodPipeline",y.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(y,u={message:`Input not instance of ${y.name}`})=>custom(h=>h instanceof y,u),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce$1={string:y=>ZodString.create({...y,coerce:!0}),number:y=>ZodNumber.create({...y,coerce:!0}),boolean:y=>ZodBoolean.create({...y,coerce:!0}),bigint:y=>ZodBigInt.create({...y,coerce:!0}),date:y=>ZodDate.create({...y,coerce:!0})},NEVER=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID,DIRTY,OK,isAborted,isDirty,isValid,isAsync,get util(){return util$c},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,datetimeRegex,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce$1,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER,ZodIssueCode,quotelessJson,ZodError}),MessageType=(y=>(y.TEXT="text",y.THREAD="thread",y.REACTION="reaction",y))(MessageType||{});const logger=Logger$1.getInstance(),CORE_MESSAGE_PROPERTIES=["id","targetMessageId","type","message","username","address","timestamp","signature","index","chatTopic","userTopic","additionalProps"],MessageSchema=z.object({id:z.string(),targetMessageId:z.string().optional(),type:z.nativeEnum(MessageType),message:z.string(),username:z.string(),address:z.string(),timestamp:z.number(),signature:z.string(),index:z.number(),chatTopic:z.string(),userTopic:z.string(),additionalProps:z.record(z.any()).optional()}).refine(y=>!y.additionalProps||Object.keys(y.additionalProps).length===0?!0:validateAdditionalPropertiesInternal(y.additionalProps).isValid,{message:"Invalid additional properties in message"}),StateRefSchema=z.object({reference:z.string(),timestamp:z.number()}),StatefulMessageSchema=z.object({message:MessageSchema,messageStateRefs:z.array(StateRefSchema).nullable()});function validateGsocMessage(y){const u=StatefulMessageSchema.safeParse(y);return u.success?validateUserSignature(y.message)?!0:(logger.warn("Invalid main message signature"),!1):(logger.warn("GSOC message validation failed:",u.error.format()),!1)}function validateMessageState(y){if(!Array.isArray(y))return logger.warn("Message state must be an array"),!1;for(const u of y)if(!validateMessageData(u))return logger.warn("Invalid message in message state:",u.id),!1;return!0}function validateMessageData(y){const u=MessageSchema.safeParse(y);return u.success?validateUserSignature(y)?!0:(logger.warn("Invalid message signature"),!1):(logger.warn("Message data validation failed:",u.error.format()),!1)}function validateUserSignature(y){try{const u={username:y.username,address:y.address,timestamp:y.timestamp,message:y.message},h=new TextEncoder,v=Binary.concatBytes(h.encode(`Ethereum Signed Message:
|
|
11
|
-
32`),Binary.keccak256(h.encode(JSON.stringify(u))));if(new beeJs.Signature(y.signature).isValid(v,y.address))throw new Error("Signature verification failed!");return!0}catch(u){return logger.warn("Error in validateUserSignature",u),!1}}function validateAdditionalPropertiesInternal(y){const u=[];if(y==null)return{isValid:!0,errors:[]};if(typeof y!="object"||Array.isArray(y))return u.push("Additional properties must be a plain object"),{isValid:!1,errors:u};for(const M of Object.keys(y))CORE_MESSAGE_PROPERTIES.includes(M)&&u.push(`Property '${M}' is reserved and cannot be overridden`);const h=JSON.stringify(y),v=new TextEncoder().encode(h).length,w=1*1024;v>w&&u.push(`Additional properties too large: ${v} bytes (max: ${w} bytes)`);const b=5;function E(M,T=0){if(T>b)return!1;if(typeof M=="object"&&M!==null&&!Array.isArray(M)){for(const C of Object.values(M))if(!E(C,T+1))return!1}return!0}E(y)||u.push(`Additional properties nested too deeply (max depth: ${b})`);for(const[M,T]of Object.entries(y))if(M.length>100&&u.push(`Property key '${M}' too long (max: 100 characters)`),typeof T=="string"&&T.length>1e3&&u.push(`Property '${M}' value too long (max: 1000 characters)`),typeof T=="string"){const C=[/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,/javascript:/gi,/data:text\/html/gi,/vbscript:/gi,/on\w+\s*=/gi];for(const B of C)if(B.test(T)){u.push(`Property '${M}' contains potentially dangerous content`);break}}const $=20;return Object.keys(y).length>$&&u.push(`Too many additional properties: ${Object.keys(y).length} (max: ${$})`),{isValid:u.length===0,errors:u}}function validateMessageWithAdditionalProperties(y){const u=MessageSchema.safeParse(y);if(!u.success){const h=u.error.issues.map(v=>v.path.length>0?`${v.path.join(".")}: ${v.message}`:v.message);return logger.warn("Message validation failed:",u.error.format()),{isValid:!1,errors:h}}return{isValid:!0,errors:[]}}const EVENTS={LOADING_INIT:"loadingInit",LOADING_PREVIOUS_MESSAGES:"loadingPreviousMessages",MESSAGE_RECEIVED:"messageReceived",MESSAGE_REQUEST_INITIATED:"messageRequestInitiated",MESSAGE_REQUEST_UPLOADED:"messageRequestUploaded",MESSAGE_REQUEST_ERROR:"messageRequestError",CRITICAL_ERROR:"criticalError"};class SwarmHistory{constructor(u,h){this.utils=u,this.emitter=h,this.logger=Logger$1.getInstance(),this.errorHandler=ErrorHandler.getInstance(),this.processedRefs=new Set,this.refRetryCount=new Map,this.bannedRefs=new Set,this.latestStatefulMessage=null,this.MAX_RETRIES=3,this.RETRY_DELAY=1e3}async init(){try{const{data:u,index:h}=await this.utils.fetchLatestChatMessage();this.latestStatefulMessage=u;try{await this.initMessageState(u)}catch(v){this.errorHandler.handleError(v,"SwarmHistory.initMessageState")}return h}catch(u){return this.errorHandler.handleError(u,"SwarmHistory.init"),beeJs.FeedIndex.fromBigInt(0n)}}async initMessageState(u){try{if(!validateGsocMessage(u)){this.logger.warn("Invalid GSOC message during message state initialization");return}if(!u.messageStateRefs||u.messageStateRefs.length===0){this.logger.debug("No message state refs to initialize");return}const h=this.findLatestRef(u.messageStateRefs);if(!h){this.logger.warn("No valid latest reference found");return}this.logger.debug("Initializing message state with latest ref:",h.reference),await this.processMessageRefWithRetry(h.reference)}catch(h){if(this.utils.isNotFoundError(h)){this.logger.debug("No latest GSOC message found for message state initialization");return}this.errorHandler.handleError(h,"SwarmHistory.init")}}async fetchPreviousMessageState(){let u=this.latestStatefulMessage;if(!u){const{data:v}=await this.utils.fetchLatestChatMessage();u=v,this.latestStatefulMessage=v}if(!u.messageStateRefs||u.messageStateRefs.length===0){this.logger.debug("No message state refs to fetch");return}const h=[...u.messageStateRefs].sort((v,w)=>v.timestamp-w.timestamp);for(const v of h)!this.processedRefs.has(v.reference)&&!this.bannedRefs.has(v.reference)&&(this.logger.debug("Fetching previous message ref:",v.reference),await this.processMessageRefWithRetry(v.reference))}findLatestRef(u){return u.length===0?null:u.reduce((h,v)=>v.timestamp>h.timestamp?v:h)}async processMessageRefWithRetry(u){if(!(this.processedRefs.has(u)||this.bannedRefs.has(u)))try{await this.processMessageRef(u)}catch(h){await this.handleRefError(u,h)}}async processMessageRef(u){const h=await this.utils.downloadObjectFromBee(u);if(!validateMessageState(h))throw new Error(`Invalid message state for ref: ${u}`);this.processedRefs.add(u),this.refRetryCount.delete(u);for(const w of h)this.emitter.emit(EVENTS.MESSAGE_RECEIVED,w)}async handleRefError(u,h){const v=this.refRetryCount.get(u)||0,w=v+1;if(this.logger.warn(`Error processing ref ${u} (attempt ${w}/${this.MAX_RETRIES}):`,h),w>=this.MAX_RETRIES)this.bannedRefs.add(u),this.refRetryCount.delete(u),this.logger.error(`Ref ${u} has been banned after ${this.MAX_RETRIES} failed attempts`),this.errorHandler.handleError(h,"SwarmHistory.processMessageRef");else{this.refRetryCount.set(u,w);const b=this.RETRY_DELAY*Math.pow(2,v);this.logger.debug(`Retrying ref ${u} after ${b}ms delay`),await sleep(b),await this.processMessageRefWithRetry(u)}}hasPreviousMessages(){return!!this.latestStatefulMessage&&!!this.latestStatefulMessage.messageStateRefs&&this.latestStatefulMessage.messageStateRefs.length>1}cleanup(){this.processedRefs.clear(),this.refRetryCount.clear(),this.bannedRefs.clear(),this.latestStatefulMessage=null}}class SwarmChatUtils{constructor(u,h){this.userDetails=u,this.swarmSettings=h,this.depth=26,this.errorHandler=ErrorHandler.getInstance(),this.UPLOAD_GSOC_TIMEOUT=2e3}generateUserOwnedFeedId(u,h){return`${u}_EthercastChat_${h}`}isNotFoundError(u){return u.stack.includes("404")||u.message.includes("Not Found")||u.message.includes("404")||u.code===404}async writeOwnFeedDataByIndex(u,h){const{enveloped:v,stamp:w}=this.swarmSettings;if(!v)await this.writeOwnFeedDataByIndexOwned(u,h);else if(w)await this.writeOwnFeedDataByIndexEnvelope(u,h);else throw new Error("Enveloped mode is enabled, but stamp is not provided")}async writeOwnFeedDataByIndexOwned(u,h){const{bee:v,stamp:w,chatTopic:b}=this.swarmSettings,{privateKey:E,ownAddress:$}=this.userDetails,M=this.generateUserOwnedFeedId(b,$),T=beeJs.Topic.fromString(M);await v.makeFeedWriter(T,new beeJs.PrivateKey(E)).uploadPayload(w,JSON.stringify(h),{index:u})}async writeOwnFeedDataByIndexEnvelope(u,h){const{bee:v,stamp:w,chatTopic:b}=this.swarmSettings,{privateKey:E,ownAddress:$}=this.userDetails,M=new beeJs.PrivateKey(E),T=beeJs.Stamper.fromBlank(E,w,this.depth),C=this.generateUserOwnedFeedId(b,$),B=beeJs.Topic.fromString(C),N=makeFeedIdentifier(B,u),H=makeContentAddressedChunk(h),te=makeSingleOwnerChunk(H,N,M),fe={hash:()=>te.address.toUint8Array()},ce=T.stamp(fe),{upload:le}=v.makeSOCWriter(M),ie=beeJs.Bytes.fromUtf8(h);return(await le(ce,N,ie.toUint8Array())).reference.toHex()}orderMessages(u){return u.sort((h,v)=>h.timestamp-v.timestamp)}async downloadObjectFromBee(u){try{const{bee:h}=this.swarmSettings,v=await h.downloadData(u);return v?v.toJSON():null}catch(h){return this.errorHandler.handleError(h,"Utils.downloadObjectFromBee"),null}}async uploadObjectToBee(u){const{enveloped:h,stamp:v}=this.swarmSettings;if(h){if(v)return this.uploadObjectToBeeEnvelope(u);throw new Error("Enveloped mode is enabled, but stamp is not provided")}else return this.uploadObjectToBeeOwn(u)}async uploadObjectToBeeOwn(u){try{const{bee:h,stamp:v}=this.swarmSettings;return(await h.uploadData(v,JSON.stringify(u),{redundancyLevel:4})).reference.toString()}catch(h){return this.errorHandler.handleError(h,"Utils.uploadObjectToBee"),null}}async uploadObjectToBeeEnvelope(u){try{const{bee:h,stamp:v}=this.swarmSettings,{privateKey:w}=this.userDetails,b=beeJs.Stamper.fromBlank(w,v,this.depth),E=beeJs.Bytes.fromUtf8(JSON.stringify(u)),$=new MerkleTree(async T=>{await h.uploadChunk(b.stamp(T),T.build())});await $.append(E.toUint8Array());const M=await $.finalize();return Binary.uint8ArrayToHex(M.hash())}catch(h){return this.errorHandler.handleError(h,"Utils.uploadObjectToBee"),null}}async getOwnLatestFeedIndex(){try{const{bee:u,chatTopic:h}=this.swarmSettings,{ownAddress:v}=this.userDetails,w=this.generateUserOwnedFeedId(h,v),b=beeJs.Topic.fromString(w),$=await u.makeFeedReader(b,v).downloadPayload(),M=Number($.feedIndex.toBigInt()),T=M+1;return{latestIndex:M,nextIndex:T}}catch(u){if(this.isNotFoundError(u))return{latestIndex:-1,nextIndex:0};throw u}}async fetchLatestChatMessage(){const{bee:u,chatTopic:h,chatAddress:v}=this.swarmSettings,b=await u.makeFeedReader(beeJs.Topic.fromString(h),remove0x(v)).downloadPayload();return{data:b.payload.toJSON(),index:b.feedIndex}}async fetchChatMessage(u){const{bee:h,chatTopic:v,chatAddress:w}=this.swarmSettings;return(await h.makeFeedReader(beeJs.Topic.fromString(v),remove0x(w)).downloadPayload({index:u})).payload.toJSON()}async sendMessageToGsoc(u){const{enveloped:h,stamp:v}=this.swarmSettings;if(!h)await this.sendMessageToGsocOwn(u);else if(v)await this.sendMessageToGsocEnvelope(u);else throw new Error("Enveloped mode is enabled, but stamp is not provided")}async rawSocDownload(u,h){const{beeUrl:v}=this.swarmSettings,w=await fetch(`${v}/soc/${u}/${h}`,{headers:{"swarm-chunk-retrieval-timeout":"2000ms"}});if(!w.ok){const b=new Error(`Failed to fetch: ${u}/${h} [${w.status}]`);throw b.status=w.status,b}return w.text()}async sendMessageToGsocOwn(u){const{bee:h,stamp:v,gsocTopic:w,gsocResourceId:b}=this.swarmSettings,E=new beeJs.PrivateKey(b),$=beeJs.Identifier.fromString(w),M=beeJs.Bytes.fromUtf8(u),{upload:T}=h.makeSOCWriter(E,{timeout:this.UPLOAD_GSOC_TIMEOUT});await T(v,$,M.toUint8Array())}async sendMessageToGsocEnvelope(u){const{bee:h,stamp:v,gsocTopic:w,gsocResourceId:b}=this.swarmSettings,{privateKey:E}=this.userDetails,$=beeJs.Stamper.fromBlank(E,v,this.depth),M=new beeJs.PrivateKey(b),T=beeJs.Identifier.fromString(w),C=beeJs.Bytes.fromUtf8(u),B=makeContentAddressedChunk(C.toUint8Array()),N=makeSingleOwnerChunk(B,T,M),H={hash:()=>N.address.toUint8Array()},te=$.stamp(H),{upload:fe}=h.makeSOCWriter(M,{timeout:this.UPLOAD_GSOC_TIMEOUT});await fe(te,T,C.toUint8Array())}}function alloc$1(y=0){return new Uint8Array(y)}function allocUnsafe(y=0){return new Uint8Array(y)}const N1$1=Math.pow(2,7),N2$1=Math.pow(2,14),N3$1=Math.pow(2,21),N4$1=Math.pow(2,28),N5$1=Math.pow(2,35),N6$1=Math.pow(2,42),N7$1=Math.pow(2,49),MSB$2=128,REST$2=127;function encodingLength$1(y){if(y<N1$1)return 1;if(y<N2$1)return 2;if(y<N3$1)return 3;if(y<N4$1)return 4;if(y<N5$1)return 5;if(y<N6$1)return 6;if(y<N7$1)return 7;if(Number.MAX_SAFE_INTEGER!=null&&y>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function encodeUint8Array(y,u,h=0){switch(encodingLength$1(y)){case 8:u[h++]=y&255|MSB$2,y/=128;case 7:u[h++]=y&255|MSB$2,y/=128;case 6:u[h++]=y&255|MSB$2,y/=128;case 5:u[h++]=y&255|MSB$2,y/=128;case 4:u[h++]=y&255|MSB$2,y>>>=7;case 3:u[h++]=y&255|MSB$2,y>>>=7;case 2:u[h++]=y&255|MSB$2,y>>>=7;case 1:{u[h++]=y&255,y>>>=7;break}default:throw new Error("unreachable")}return u}function decodeUint8Array(y,u){let h=y[u],v=0;if(v+=h&REST$2,h<MSB$2||(h=y[u+1],v+=(h&REST$2)<<7,h<MSB$2)||(h=y[u+2],v+=(h&REST$2)<<14,h<MSB$2)||(h=y[u+3],v+=(h&REST$2)<<21,h<MSB$2)||(h=y[u+4],v+=(h&REST$2)*N4$1,h<MSB$2)||(h=y[u+5],v+=(h&REST$2)*N5$1,h<MSB$2)||(h=y[u+6],v+=(h&REST$2)*N6$1,h<MSB$2)||(h=y[u+7],v+=(h&REST$2)*N7$1,h<MSB$2))return v;throw new RangeError("Could not decode varint")}const f32=new Float32Array([-0]),f8b=new Uint8Array(f32.buffer);function writeFloatLE(y,u,h){f32[0]=y,u[h]=f8b[0],u[h+1]=f8b[1],u[h+2]=f8b[2],u[h+3]=f8b[3]}function readFloatLE(y,u){return f8b[0]=y[u],f8b[1]=y[u+1],f8b[2]=y[u+2],f8b[3]=y[u+3],f32[0]}const f64=new Float64Array([-0]),d8b=new Uint8Array(f64.buffer);function writeDoubleLE(y,u,h){f64[0]=y,u[h]=d8b[0],u[h+1]=d8b[1],u[h+2]=d8b[2],u[h+3]=d8b[3],u[h+4]=d8b[4],u[h+5]=d8b[5],u[h+6]=d8b[6],u[h+7]=d8b[7]}function readDoubleLE(y,u){return d8b[0]=y[u],d8b[1]=y[u+1],d8b[2]=y[u+2],d8b[3]=y[u+3],d8b[4]=y[u+4],d8b[5]=y[u+5],d8b[6]=y[u+6],d8b[7]=y[u+7],f64[0]}const MAX_SAFE_NUMBER_INTEGER=BigInt(Number.MAX_SAFE_INTEGER),MIN_SAFE_NUMBER_INTEGER=BigInt(Number.MIN_SAFE_INTEGER);let LongBits$2=class _s{constructor(u,h){Ke(this,"lo");Ke(this,"hi");this.lo=u|0,this.hi=h|0}toNumber(u=!1){if(!u&&this.hi>>>31>0){const h=~this.lo+1>>>0;let v=~this.hi>>>0;return h===0&&(v=v+1>>>0),-(h+v*4294967296)}return this.lo+this.hi*4294967296}toBigInt(u=!1){if(u)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){const h=~this.lo+1>>>0;let v=~this.hi>>>0;return h===0&&(v=v+1>>>0),-(BigInt(h)+(BigInt(v)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(u=!1){return this.toBigInt(u).toString()}zzEncode(){const u=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^u)>>>0,this.lo=(this.lo<<1^u)>>>0,this}zzDecode(){const u=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^u)>>>0,this.hi=(this.hi>>>1^u)>>>0,this}length(){const u=this.lo,h=(this.lo>>>28|this.hi<<4)>>>0,v=this.hi>>>24;return v===0?h===0?u<16384?u<128?1:2:u<2097152?3:4:h<16384?h<128?5:6:h<2097152?7:8:v<128?9:10}static fromBigInt(u){if(u===0n)return zero;if(u<MAX_SAFE_NUMBER_INTEGER&&u>MIN_SAFE_NUMBER_INTEGER)return this.fromNumber(Number(u));const h=u<0n;h&&(u=-u);let v=u>>32n,w=u-(v<<32n);return h&&(v=~v|0n,w=~w|0n,++w>TWO_32&&(w=0n,++v>TWO_32&&(v=0n))),new _s(Number(w),Number(v))}static fromNumber(u){if(u===0)return zero;const h=u<0;h&&(u=-u);let v=u>>>0,w=(u-v)/4294967296>>>0;return h&&(w=~w>>>0,v=~v>>>0,++v>4294967295&&(v=0,++w>4294967295&&(w=0))),new _s(v,w)}static from(u){return typeof u=="number"?_s.fromNumber(u):typeof u=="bigint"?_s.fromBigInt(u):typeof u=="string"?_s.fromBigInt(BigInt(u)):u.low!=null||u.high!=null?new _s(u.low>>>0,u.high>>>0):zero}};const zero=new LongBits$2(0,0);zero.toBigInt=function(){return 0n},zero.zzEncode=zero.zzDecode=function(){return this},zero.length=function(){return 1};const TWO_32=4294967296n;function length$1(y){let u=0,h=0;for(let v=0;v<y.length;++v)h=y.charCodeAt(v),h<128?u+=1:h<2048?u+=2:(h&64512)===55296&&(y.charCodeAt(v+1)&64512)===56320?(++v,u+=4):u+=3;return u}function read$1(y,u,h){if(h-u<1)return"";let w;const b=[];let E=0,$;for(;u<h;)$=y[u++],$<128?b[E++]=$:$>191&&$<224?b[E++]=($&31)<<6|y[u++]&63:$>239&&$<365?($=(($&7)<<18|(y[u++]&63)<<12|(y[u++]&63)<<6|y[u++]&63)-65536,b[E++]=55296+($>>10),b[E++]=56320+($&1023)):b[E++]=($&15)<<12|(y[u++]&63)<<6|y[u++]&63,E>8191&&((w??(w=[])).push(String.fromCharCode.apply(String,b)),E=0);return w!=null?(E>0&&w.push(String.fromCharCode.apply(String,b.slice(0,E))),w.join("")):String.fromCharCode.apply(String,b.slice(0,E))}function write(y,u,h){const v=h;let w,b;for(let E=0;E<y.length;++E)w=y.charCodeAt(E),w<128?u[h++]=w:w<2048?(u[h++]=w>>6|192,u[h++]=w&63|128):(w&64512)===55296&&((b=y.charCodeAt(E+1))&64512)===56320?(w=65536+((w&1023)<<10)+(b&1023),++E,u[h++]=w>>18|240,u[h++]=w>>12&63|128,u[h++]=w>>6&63|128,u[h++]=w&63|128):(u[h++]=w>>12|224,u[h++]=w>>6&63|128,u[h++]=w&63|128);return h-v}function indexOutOfRange$1(y,u){return RangeError(`index out of range: ${y.pos} + ${u??1} > ${y.len}`)}function readFixed32End(y,u){return(y[u-4]|y[u-3]<<8|y[u-2]<<16|y[u-1]<<24)>>>0}class Uint8ArrayReader{constructor(u){Ke(this,"buf");Ke(this,"pos");Ke(this,"len");Ke(this,"_slice",Uint8Array.prototype.subarray);this.buf=u,this.pos=0,this.len=u.length}uint32(){let u=4294967295;if(u=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(u=(u|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(u=(u|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(u=(u|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(u=(u|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return u;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange$1(this,10);return u}int32(){return this.uint32()|0}sint32(){const u=this.uint32();return u>>>1^-(u&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);return readFixed32End(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);return readFixed32End(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);const u=readFloatLE(this.buf,this.pos);return this.pos+=4,u}double(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,4);const u=readDoubleLE(this.buf,this.pos);return this.pos+=8,u}bytes(){const u=this.uint32(),h=this.pos,v=this.pos+u;if(v>this.len)throw indexOutOfRange$1(this,u);return this.pos+=u,h===v?new Uint8Array(0):this.buf.subarray(h,v)}string(){const u=this.bytes();return read$1(u,0,u.length)}skip(u){if(typeof u=="number"){if(this.pos+u>this.len)throw indexOutOfRange$1(this,u);this.pos+=u}else do if(this.pos>=this.len)throw indexOutOfRange$1(this);while(this.buf[this.pos++]&128);return this}skipType(u){switch(u){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(u=this.uint32()&7)!==4;)this.skipType(u);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${u} at offset ${this.pos}`)}return this}readLongVarint(){const u=new LongBits$2(0,0);let h=0;if(this.len-this.pos>4){for(;h<4;++h)if(u.lo=(u.lo|(this.buf[this.pos]&127)<<h*7)>>>0,this.buf[this.pos++]<128)return u;if(u.lo=(u.lo|(this.buf[this.pos]&127)<<28)>>>0,u.hi=(u.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return u;h=0}else{for(;h<3;++h){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(u.lo=(u.lo|(this.buf[this.pos]&127)<<h*7)>>>0,this.buf[this.pos++]<128)return u}return u.lo=(u.lo|(this.buf[this.pos++]&127)<<h*7)>>>0,u}if(this.len-this.pos>4){for(;h<5;++h)if(u.hi=(u.hi|(this.buf[this.pos]&127)<<h*7+3)>>>0,this.buf[this.pos++]<128)return u}else for(;h<5;++h){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(u.hi=(u.hi|(this.buf[this.pos]&127)<<h*7+3)>>>0,this.buf[this.pos++]<128)return u}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,8);const u=readFixed32End(this.buf,this.pos+=4),h=readFixed32End(this.buf,this.pos+=4);return new LongBits$2(u,h)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){const u=decodeUint8Array(this.buf,this.pos);return this.pos+=encodingLength$1(u),u}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}}function createReader(y){return new Uint8ArrayReader(y instanceof Uint8Array?y:y.subarray())}function decodeMessage(y,u,h){const v=createReader(y);return u.decode(v,void 0,h)}function equals$1(y,u){if(y===u)return!0;if(y.byteLength!==u.byteLength)return!1;for(let h=0;h<y.byteLength;h++)if(y[h]!==u[h])return!1;return!0}function coerce(y){if(y instanceof Uint8Array&&y.constructor.name==="Uint8Array")return y;if(y instanceof ArrayBuffer)return new Uint8Array(y);if(ArrayBuffer.isView(y))return new Uint8Array(y.buffer,y.byteOffset,y.byteLength);throw new Error("Unknown type, must be binary type")}function fromString$1(y){return new TextEncoder().encode(y)}function toString$2(y){return new TextDecoder().decode(y)}function base$2(y,u){if(y.length>=255)throw new TypeError("Alphabet too long");for(var h=new Uint8Array(256),v=0;v<h.length;v++)h[v]=255;for(var w=0;w<y.length;w++){var b=y.charAt(w),E=b.charCodeAt(0);if(h[E]!==255)throw new TypeError(b+" is ambiguous");h[E]=w}var $=y.length,M=y.charAt(0),T=Math.log($)/Math.log(256),C=Math.log(256)/Math.log($);function B(te){if(te instanceof Uint8Array||(ArrayBuffer.isView(te)?te=new Uint8Array(te.buffer,te.byteOffset,te.byteLength):Array.isArray(te)&&(te=Uint8Array.from(te))),!(te instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(te.length===0)return"";for(var fe=0,ce=0,le=0,ie=te.length;le!==ie&&te[le]===0;)le++,fe++;for(var ge=(ie-le)*C+1>>>0,pe=new Uint8Array(ge);le!==ie;){for(var Me=te[le],$e=0,Pe=ge-1;(Me!==0||$e<ce)&&Pe!==-1;Pe--,$e++)Me+=256*pe[Pe]>>>0,pe[Pe]=Me%$>>>0,Me=Me/$>>>0;if(Me!==0)throw new Error("Non-zero carry");ce=$e,le++}for(var Be=ge-ce;Be!==ge&&pe[Be]===0;)Be++;for(var Re=M.repeat(fe);Be<ge;++Be)Re+=y.charAt(pe[Be]);return Re}function N(te){if(typeof te!="string")throw new TypeError("Expected String");if(te.length===0)return new Uint8Array;var fe=0;if(te[fe]!==" "){for(var ce=0,le=0;te[fe]===M;)ce++,fe++;for(var ie=(te.length-fe)*T+1>>>0,ge=new Uint8Array(ie);te[fe];){var pe=h[te.charCodeAt(fe)];if(pe===255)return;for(var Me=0,$e=ie-1;(pe!==0||Me<le)&&$e!==-1;$e--,Me++)pe+=$*ge[$e]>>>0,ge[$e]=pe%256>>>0,pe=pe/256>>>0;if(pe!==0)throw new Error("Non-zero carry");le=Me,fe++}if(te[fe]!==" "){for(var Pe=ie-le;Pe!==ie&&ge[Pe]===0;)Pe++;for(var Be=new Uint8Array(ce+(ie-Pe)),Re=ce;Pe!==ie;)Be[Re++]=ge[Pe++];return Be}}}function H(te){var fe=N(te);if(fe)return fe;throw new Error(`Non-${u} character`)}return{encode:B,decodeUnsafe:N,decode:H}}var src$1=base$2,_brrp__multiformats_scope_baseX=src$1;class Encoder{constructor(u,h,v){Ke(this,"name");Ke(this,"prefix");Ke(this,"baseEncode");this.name=u,this.prefix=h,this.baseEncode=v}encode(u){if(u instanceof Uint8Array)return`${this.prefix}${this.baseEncode(u)}`;throw Error("Unknown type, must be binary type")}}class Decoder{constructor(u,h,v){Ke(this,"name");Ke(this,"prefix");Ke(this,"baseDecode");Ke(this,"prefixCodePoint");this.name=u,this.prefix=h;const w=h.codePointAt(0);if(w===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=w,this.baseDecode=v}decode(u){if(typeof u=="string"){if(u.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(u)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(u.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(u){return or(this,u)}}class ComposedDecoder{constructor(u){Ke(this,"decoders");this.decoders=u}or(u){return or(this,u)}decode(u){const h=u[0],v=this.decoders[h];if(v!=null)return v.decode(u);throw RangeError(`Unable to decode multibase string ${JSON.stringify(u)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}function or(y,u){return new ComposedDecoder({...y.decoders??{[y.prefix]:y},...u.decoders??{[u.prefix]:u}})}class Codec{constructor(u,h,v,w){Ke(this,"name");Ke(this,"prefix");Ke(this,"baseEncode");Ke(this,"baseDecode");Ke(this,"encoder");Ke(this,"decoder");this.name=u,this.prefix=h,this.baseEncode=v,this.baseDecode=w,this.encoder=new Encoder(u,h,v),this.decoder=new Decoder(u,h,w)}encode(u){return this.encoder.encode(u)}decode(u){return this.decoder.decode(u)}}function from({name:y,prefix:u,encode:h,decode:v}){return new Codec(y,u,h,v)}function baseX({name:y,prefix:u,alphabet:h}){const{encode:v,decode:w}=_brrp__multiformats_scope_baseX(h,y);return from({prefix:u,name:y,encode:v,decode:b=>coerce(w(b))})}function decode$4(y,u,h,v){let w=y.length;for(;y[w-1]==="=";)--w;const b=new Uint8Array(w*h/8|0);let E=0,$=0,M=0;for(let T=0;T<w;++T){const C=u[y[T]];if(C===void 0)throw new SyntaxError(`Non-${v} character`);$=$<<h|C,E+=h,E>=8&&(E-=8,b[M++]=255&$>>E)}if(E>=h||255&$<<8-E)throw new SyntaxError("Unexpected end of data");return b}function encode$2(y,u,h){const v=u[u.length-1]==="=",w=(1<<h)-1;let b="",E=0,$=0;for(let M=0;M<y.length;++M)for($=$<<8|y[M],E+=8;E>h;)E-=h,b+=u[w&$>>E];if(E!==0&&(b+=u[w&$<<h-E]),v)for(;b.length*h&7;)b+="=";return b}function createAlphabetIdx(y){const u={};for(let h=0;h<y.length;++h)u[y[h]]=h;return u}function rfc4648({name:y,prefix:u,bitsPerChar:h,alphabet:v}){const w=createAlphabetIdx(v);return from({prefix:u,name:y,encode(b){return encode$2(b,v,h)},decode(b){return decode$4(b,w,h,y)}})}const base10=baseX({prefix:"9",name:"base10",alphabet:"0123456789"}),base10$1=Object.freeze(Object.defineProperty({__proto__:null,base10},Symbol.toStringTag,{value:"Module"})),base16=rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base16$1=Object.freeze(Object.defineProperty({__proto__:null,base16,base16upper},Symbol.toStringTag,{value:"Module"})),base2=rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base2$1=Object.freeze(Object.defineProperty({__proto__:null,base2},Symbol.toStringTag,{value:"Module"})),alphabet=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),alphabetBytesToChars=alphabet.reduce((y,u,h)=>(y[h]=u,y),[]),alphabetCharsToBytes=alphabet.reduce((y,u,h)=>{const v=u.codePointAt(0);if(v==null)throw new Error(`Invalid character: ${u}`);return y[v]=h,y},[]);function encode$1(y){return y.reduce((u,h)=>(u+=alphabetBytesToChars[h],u),"")}function decode$3(y){const u=[];for(const h of y){const v=h.codePointAt(0);if(v==null)throw new Error(`Invalid character: ${h}`);const w=alphabetCharsToBytes[v];if(w==null)throw new Error(`Non-base256emoji character: ${h}`);u.push(w)}return new Uint8Array(u)}const base256emoji=from({prefix:"🚀",name:"base256emoji",encode:encode$1,decode:decode$3}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"})),base32$1=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$2=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$1,base32hex,base32hexpad,base32hexpadupper,base32hexupper,base32pad,base32padupper,base32upper,base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc,base58flickr},Symbol.toStringTag,{value:"Module"})),base64$2=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$3=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$2,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),identity=from({prefix:"\0",name:"identity",encode:y=>toString$2(y),decode:y=>fromString$1(y)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;var encode_1=encode,MSB=128,REST=127,MSBALL=~REST,INT=Math.pow(2,31);function encode(y,u,h){u=u||[],h=h||0;for(var v=h;y>=INT;)u[h++]=y&255|MSB,y/=128;for(;y&MSBALL;)u[h++]=y&255|MSB,y>>>=7;return u[h]=y|0,encode.bytes=h-v+1,u}var decode$2=read,MSB$1=128,REST$1=127;function read(y,v){var h=0,v=v||0,w=0,b=v,E,$=y.length;do{if(b>=$)throw read.bytes=0,new RangeError("Could not decode varint");E=y[b++],h+=w<28?(E&REST$1)<<w:(E&REST$1)*Math.pow(2,w),w+=7}while(E>=MSB$1);return read.bytes=b-v,h}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(y){return y<N1?1:y<N2?2:y<N3?3:y<N4?4:y<N5?5:y<N6?6:y<N7?7:y<N8?8:y<N9?9:10},varint={encode:encode_1,decode:decode$2,encodingLength:length},_brrp_varint=varint;function decode$1(y,u=0){return[_brrp_varint.decode(y,u),_brrp_varint.decode.bytes]}function encodeTo(y,u,h=0){return _brrp_varint.encode(y,u,h),u}function encodingLength(y){return _brrp_varint.encodingLength(y)}function create$2(y,u){const h=u.byteLength,v=encodingLength(y),w=v+encodingLength(h),b=new Uint8Array(w+h);return encodeTo(y,b,0),encodeTo(h,b,v),b.set(u,w),new Digest(y,h,u,b)}function decode(y){const u=coerce(y),[h,v]=decode$1(u),[w,b]=decode$1(u.subarray(v)),E=u.subarray(v+b);if(E.byteLength!==w)throw new Error("Incorrect length");return new Digest(h,w,E,u)}function equals(y,u){if(y===u)return!0;{const h=u;return y.code===h.code&&y.size===h.size&&h.bytes instanceof Uint8Array&&equals$1(y.bytes,h.bytes)}}class Digest{constructor(u,h,v,w){Ke(this,"code");Ke(this,"size");Ke(this,"digest");Ke(this,"bytes");this.code=u,this.size=h,this.digest=v,this.bytes=w}}function format(y,u){const{bytes:h,version:v}=y;switch(v){case 0:return toStringV0(h,baseCache(y),u??base58btc.encoder);default:return toStringV1(h,baseCache(y),u??base32$1.encoder)}}const cache$1=new WeakMap;function baseCache(y){const u=cache$1.get(y);if(u==null){const h=new Map;return cache$1.set(y,h),h}return u}class CID{constructor(u,h,v,w){Ke(this,"code");Ke(this,"version");Ke(this,"multihash");Ke(this,"bytes");Ke(this,"/");Ke(this,gr,"CID");this.code=h,this.version=u,this.multihash=v,this.bytes=w,this["/"]=w}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:u,multihash:h}=this;if(u!==DAG_PB_CODE)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(h.code!==SHA_256_CODE)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return CID.createV0(h)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{const{code:u,digest:h}=this.multihash,v=create$2(u,h);return CID.createV1(this.code,v)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(u){return CID.equals(this,u)}static equals(u,h){const v=h;return v!=null&&u.code===v.code&&u.version===v.version&&equals(u.multihash,v.multihash)}toString(u){return format(this,u)}toJSON(){return{"/":format(this)}}link(){return this}[(gr=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(u){if(u==null)return null;const h=u;if(h instanceof CID)return h;if(h["/"]!=null&&h["/"]===h.bytes||h.asCID===h){const{version:v,code:w,multihash:b,bytes:E}=h;return new CID(v,w,b,E??encodeCID(v,w,b.bytes))}else if(h[cidSymbol]===!0){const{version:v,multihash:w,code:b}=h,E=decode(w);return CID.create(v,b,E)}else return null}static create(u,h,v){if(typeof h!="number")throw new Error("String codecs are no longer supported");if(!(v.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(u){case 0:{if(h!==DAG_PB_CODE)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);return new CID(u,h,v,v.bytes)}case 1:{const w=encodeCID(u,h,v.bytes);return new CID(u,h,v,w)}default:throw new Error("Invalid version")}}static createV0(u){return CID.create(0,DAG_PB_CODE,u)}static createV1(u,h){return CID.create(1,u,h)}static decode(u){const[h,v]=CID.decodeFirst(u);if(v.length!==0)throw new Error("Incorrect length");return h}static decodeFirst(u){const h=CID.inspectBytes(u),v=h.size-h.multihashSize,w=coerce(u.subarray(v,v+h.multihashSize));if(w.byteLength!==h.multihashSize)throw new Error("Incorrect length");const b=w.subarray(h.multihashSize-h.digestSize),E=new Digest(h.multihashCode,h.digestSize,b,w);return[h.version===0?CID.createV0(E):CID.createV1(h.codec,E),u.subarray(h.size)]}static inspectBytes(u){let h=0;const v=()=>{const[B,N]=decode$1(u.subarray(h));return h+=N,B};let w=v(),b=DAG_PB_CODE;if(w===18?(w=0,h=0):b=v(),w!==0&&w!==1)throw new RangeError(`Invalid CID version ${w}`);const E=h,$=v(),M=v(),T=h+M,C=T-E;return{version:w,codec:b,multihashCode:$,digestSize:M,multihashSize:C,size:T}}static parse(u,h){const[v,w]=parseCIDtoBytes(u,h),b=CID.decode(w);if(b.version===0&&u[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache(b).set(v,u),b}}function parseCIDtoBytes(y,u){switch(y[0]){case"Q":{const h=u??base58btc;return[base58btc.prefix,h.decode(`${base58btc.prefix}${y}`)]}case base58btc.prefix:{const h=u??base58btc;return[base58btc.prefix,h.decode(y)]}case base32$1.prefix:{const h=u??base32$1;return[base32$1.prefix,h.decode(y)]}case base36.prefix:{const h=u??base36;return[base36.prefix,h.decode(y)]}default:{if(u==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[y[0],u.decode(y)]}}}function toStringV0(y,u,h){const{prefix:v}=h;if(v!==base58btc.prefix)throw Error(`Cannot string encode V0 in ${h.name} encoding`);const w=u.get(v);if(w==null){const b=h.encode(y).slice(1);return u.set(v,b),b}else return w}function toStringV1(y,u,h){const{prefix:v}=h,w=u.get(v);if(w==null){const b=h.encode(y);return u.set(v,b),b}else return w}const DAG_PB_CODE=112,SHA_256_CODE=18;function encodeCID(y,u,h){const v=encodingLength(y),w=v+encodingLength(u),b=new Uint8Array(w+h.byteLength);return encodeTo(y,b,0),encodeTo(u,b,v),b.set(h,w),b}const cidSymbol=Symbol.for("@ipld/js-cid/CID"),bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$2,...base36$1,...base58,...base64$3,...base256emoji$1};function createCodec$1(y,u,h,v){return{name:y,prefix:u,encoder:{name:y,prefix:u,encode:h},decoder:{decode:v}}}const string=createCodec$1("utf8","u",y=>"u"+new TextDecoder("utf8").decode(y),y=>new TextEncoder().encode(y.substring(1))),ascii=createCodec$1("ascii","a",y=>{let u="a";for(let h=0;h<y.length;h++)u+=String.fromCharCode(y[h]);return u},y=>{y=y.substring(1);const u=allocUnsafe(y.length);for(let h=0;h<y.length;h++)u[h]=y.charCodeAt(h);return u}),BASES={utf8:string,"utf-8":string,hex:bases.base16,latin1:ascii,ascii,binary:ascii,...bases};function fromString(y,u="utf8"){const h=BASES[u];if(h==null)throw new Error(`Unsupported encoding "${u}"`);return h.decoder.decode(`${h.prefix}${y}`)}function pool$1(y){let v,w=8192;return function(E){if(E<1||E>4096)return allocUnsafe(E);w+E>8192&&(v=allocUnsafe(8192),w=0);const $=v.subarray(w,w+=E);return w&7&&(w=(w|7)+1),$}}let Op$1=class{constructor(u,h,v){Ke(this,"fn");Ke(this,"len");Ke(this,"next");Ke(this,"val");this.fn=u,this.len=h,this.next=void 0,this.val=v}};function noop$4(){}let State$1=class{constructor(u){Ke(this,"head");Ke(this,"tail");Ke(this,"len");Ke(this,"next");this.head=u.head,this.tail=u.tail,this.len=u.len,this.next=u.states}};const bufferPool=pool$1();function alloc(y){return globalThis.Buffer!=null?allocUnsafe(y):bufferPool(y)}class Uint8ArrayWriter{constructor(){Ke(this,"len");Ke(this,"head");Ke(this,"tail");Ke(this,"states");this.len=0,this.head=new Op$1(noop$4,0,0),this.tail=this.head,this.states=null}_push(u,h,v){return this.tail=this.tail.next=new Op$1(u,h,v),this.len+=h,this}uint32(u){return this.len+=(this.tail=this.tail.next=new VarintOp$1((u=u>>>0)<128?1:u<16384?2:u<2097152?3:u<268435456?4:5,u)).len,this}int32(u){return u<0?this._push(writeVarint64$1,10,LongBits$2.fromNumber(u)):this.uint32(u)}sint32(u){return this.uint32((u<<1^u>>31)>>>0)}uint64(u){const h=LongBits$2.fromBigInt(u);return this._push(writeVarint64$1,h.length(),h)}uint64Number(u){return this._push(encodeUint8Array,encodingLength$1(u),u)}uint64String(u){return this.uint64(BigInt(u))}int64(u){return this.uint64(u)}int64Number(u){return this.uint64Number(u)}int64String(u){return this.uint64String(u)}sint64(u){const h=LongBits$2.fromBigInt(u).zzEncode();return this._push(writeVarint64$1,h.length(),h)}sint64Number(u){const h=LongBits$2.fromNumber(u).zzEncode();return this._push(writeVarint64$1,h.length(),h)}sint64String(u){return this.sint64(BigInt(u))}bool(u){return this._push(writeByte$1,1,u?1:0)}fixed32(u){return this._push(writeFixed32$1,4,u>>>0)}sfixed32(u){return this.fixed32(u)}fixed64(u){const h=LongBits$2.fromBigInt(u);return this._push(writeFixed32$1,4,h.lo)._push(writeFixed32$1,4,h.hi)}fixed64Number(u){const h=LongBits$2.fromNumber(u);return this._push(writeFixed32$1,4,h.lo)._push(writeFixed32$1,4,h.hi)}fixed64String(u){return this.fixed64(BigInt(u))}sfixed64(u){return this.fixed64(u)}sfixed64Number(u){return this.fixed64Number(u)}sfixed64String(u){return this.fixed64String(u)}float(u){return this._push(writeFloatLE,4,u)}double(u){return this._push(writeDoubleLE,8,u)}bytes(u){const h=u.length>>>0;return h===0?this._push(writeByte$1,1,0):this.uint32(h)._push(writeBytes$1,h,u)}string(u){const h=length$1(u);return h!==0?this.uint32(h)._push(write,h,u):this._push(writeByte$1,1,0)}fork(){return this.states=new State$1(this),this.head=this.tail=new Op$1(noop$4,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op$1(noop$4,0,0),this.len=0),this}ldelim(){const u=this.head,h=this.tail,v=this.len;return this.reset().uint32(v),v!==0&&(this.tail.next=u.next,this.tail=h,this.len+=v),this}finish(){let u=this.head.next;const h=alloc(this.len);let v=0;for(;u!=null;)u.fn(u.val,h,v),v+=u.len,u=u.next;return h}}function writeByte$1(y,u,h){u[h]=y&255}function writeVarint32$1(y,u,h){for(;y>127;)u[h++]=y&127|128,y>>>=7;u[h]=y}let VarintOp$1=class extends Op$1{constructor(h,v){super(writeVarint32$1,h,v);Ke(this,"next");this.next=void 0}};function writeVarint64$1(y,u,h){for(;y.hi!==0;)u[h++]=y.lo&127|128,y.lo=(y.lo>>>7|y.hi<<25)>>>0,y.hi>>>=7;for(;y.lo>127;)u[h++]=y.lo&127|128,y.lo=y.lo>>>7;u[h++]=y.lo}function writeFixed32$1(y,u,h){u[h]=y&255,u[h+1]=y>>>8&255,u[h+2]=y>>>16&255,u[h+3]=y>>>24}function writeBytes$1(y,u,h){u.set(y,h)}globalThis.Buffer!=null&&(Uint8ArrayWriter.prototype.bytes=function(y){const u=y.length>>>0;return this.uint32(u),u>0&&this._push(writeBytesBuffer,u,y),this},Uint8ArrayWriter.prototype.string=function(y){const u=globalThis.Buffer.byteLength(y);return this.uint32(u),u>0&&this._push(writeStringBuffer$1,u,y),this});function writeBytesBuffer(y,u,h){u.set(y,h)}function writeStringBuffer$1(y,u,h){y.length<40?write(y,u,h):u.utf8Write!=null?u.utf8Write(y,h):u.set(fromString(y),h)}function createWriter(){return new Uint8ArrayWriter}function encodeMessage(y,u){const h=createWriter();return u.encode(y,h,{lengthDelimited:!1}),h.finish()}var CODEC_TYPES;(function(y){y[y.VARINT=0]="VARINT",y[y.BIT64=1]="BIT64",y[y.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",y[y.START_GROUP=3]="START_GROUP",y[y.END_GROUP=4]="END_GROUP",y[y.BIT32=5]="BIT32"})(CODEC_TYPES||(CODEC_TYPES={}));function createCodec(y,u,h,v){return{name:y,type:u,encode:h,decode:v}}function enumeration(y){function u(w){if(y[w.toString()]==null)throw new Error("Invalid enum value");return y[w]}const h=function(b,E){const $=u(b);E.int32($)},v=function(b){const E=b.int32();return u(E)};return createCodec("enum",CODEC_TYPES.VARINT,h,v)}function message$1(y,u){return createCodec("message",CODEC_TYPES.LENGTH_DELIMITED,y,u)}class MaxLengthError extends Error{constructor(){super(...arguments);Ke(this,"code","ERR_MAX_LENGTH");Ke(this,"name","MaxLengthError")}}var RateLimitProof$4;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.proof!=null&&h.proof.byteLength>0&&(v.uint32(10),v.bytes(h.proof)),h.merkleRoot!=null&&h.merkleRoot.byteLength>0&&(v.uint32(18),v.bytes(h.merkleRoot)),h.epoch!=null&&h.epoch.byteLength>0&&(v.uint32(26),v.bytes(h.epoch)),h.shareX!=null&&h.shareX.byteLength>0&&(v.uint32(34),v.bytes(h.shareX)),h.shareY!=null&&h.shareY.byteLength>0&&(v.uint32(42),v.bytes(h.shareY)),h.nullifier!=null&&h.nullifier.byteLength>0&&(v.uint32(50),v.bytes(h.nullifier)),h.rlnIdentifier!=null&&h.rlnIdentifier.byteLength>0&&(v.uint32(58),v.bytes(h.rlnIdentifier)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={proof:alloc$1(0),merkleRoot:alloc$1(0),epoch:alloc$1(0),shareX:alloc$1(0),shareY:alloc$1(0),nullifier:alloc$1(0),rlnIdentifier:alloc$1(0)},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.proof=h.bytes();break}case 2:{b.merkleRoot=h.bytes();break}case 3:{b.epoch=h.bytes();break}case 4:{b.shareX=h.bytes();break}case 5:{b.shareY=h.bytes();break}case 6:{b.nullifier=h.bytes();break}case 7:{b.rlnIdentifier=h.bytes();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(RateLimitProof$4||(RateLimitProof$4={}));var WakuMessage$4;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.payload!=null&&h.payload.byteLength>0&&(v.uint32(10),v.bytes(h.payload)),h.contentTopic!=null&&h.contentTopic!==""&&(v.uint32(18),v.string(h.contentTopic)),h.version!=null&&(v.uint32(24),v.uint32(h.version)),h.timestamp!=null&&(v.uint32(80),v.sint64(h.timestamp)),h.meta!=null&&(v.uint32(90),v.bytes(h.meta)),h.rateLimitProof!=null&&(v.uint32(170),RateLimitProof$4.codec().encode(h.rateLimitProof,v)),h.ephemeral!=null&&(v.uint32(248),v.bool(h.ephemeral)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={payload:alloc$1(0),contentTopic:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.payload=h.bytes();break}case 2:{b.contentTopic=h.string();break}case 3:{b.version=h.uint32();break}case 10:{b.timestamp=h.sint64();break}case 11:{b.meta=h.bytes();break}case 21:{b.rateLimitProof=RateLimitProof$4.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.rateLimitProof});break}case 31:{b.ephemeral=h.bool();break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(WakuMessage$4||(WakuMessage$4={}));var FilterRequest;(function(y){(function(h){let v;h.codec=()=>(v==null&&(v=message$1((w,b,E={})=>{E.lengthDelimited!==!1&&b.fork(),w.contentTopic!=null&&w.contentTopic!==""&&(b.uint32(10),b.string(w.contentTopic)),E.lengthDelimited!==!1&&b.ldelim()},(w,b,E={})=>{const $={contentTopic:""},M=b==null?w.len:w.pos+b;for(;w.pos<M;){const T=w.uint32();switch(T>>>3){case 1:{$.contentTopic=w.string();break}default:{w.skipType(T&7);break}}}return $})),v),h.encode=w=>encodeMessage(w,h.codec()),h.decode=(w,b)=>decodeMessage(w,h.codec(),b)})(y.ContentFilter||(y.ContentFilter={}));let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{if(w.lengthDelimited!==!1&&v.fork(),h.subscribe!=null&&h.subscribe!==!1&&(v.uint32(8),v.bool(h.subscribe)),h.topic!=null&&h.topic!==""&&(v.uint32(18),v.string(h.topic)),h.contentFilters!=null)for(const b of h.contentFilters)v.uint32(26),y.ContentFilter.codec().encode(b,v);w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $,M;const b={subscribe:!1,topic:"",contentFilters:[]},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const T=h.uint32();switch(T>>>3){case 1:{b.subscribe=h.bool();break}case 2:{b.topic=h.string();break}case 3:{if((($=w.limits)==null?void 0:$.contentFilters)!=null&&b.contentFilters.length===w.limits.contentFilters)throw new MaxLengthError('Decode error - map field "contentFilters" had too many elements');b.contentFilters.push(y.ContentFilter.codec().decode(h,h.uint32(),{limits:(M=w.limits)==null?void 0:M.contentFilters$}));break}default:{h.skipType(T&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(FilterRequest||(FilterRequest={}));var MessagePush$1;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{if(w.lengthDelimited!==!1&&v.fork(),h.messages!=null)for(const b of h.messages)v.uint32(10),WakuMessage$3.codec().encode(b,v);w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $,M;const b={messages:[]},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const T=h.uint32();switch(T>>>3){case 1:{if((($=w.limits)==null?void 0:$.messages)!=null&&b.messages.length===w.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');b.messages.push(WakuMessage$3.codec().decode(h,h.uint32(),{limits:(M=w.limits)==null?void 0:M.messages$}));break}default:{h.skipType(T&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(MessagePush$1||(MessagePush$1={}));var FilterRpc;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.requestId!=null&&h.requestId!==""&&(v.uint32(10),v.string(h.requestId)),h.request!=null&&(v.uint32(18),FilterRequest.codec().encode(h.request,v)),h.push!=null&&(v.uint32(26),MessagePush$1.codec().encode(h.push,v)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $,M;const b={requestId:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const T=h.uint32();switch(T>>>3){case 1:{b.requestId=h.string();break}case 2:{b.request=FilterRequest.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.request});break}case 3:{b.push=MessagePush$1.codec().decode(h,h.uint32(),{limits:(M=w.limits)==null?void 0:M.push});break}default:{h.skipType(T&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(FilterRpc||(FilterRpc={}));var RateLimitProof$3;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.proof!=null&&h.proof.byteLength>0&&(v.uint32(10),v.bytes(h.proof)),h.merkleRoot!=null&&h.merkleRoot.byteLength>0&&(v.uint32(18),v.bytes(h.merkleRoot)),h.epoch!=null&&h.epoch.byteLength>0&&(v.uint32(26),v.bytes(h.epoch)),h.shareX!=null&&h.shareX.byteLength>0&&(v.uint32(34),v.bytes(h.shareX)),h.shareY!=null&&h.shareY.byteLength>0&&(v.uint32(42),v.bytes(h.shareY)),h.nullifier!=null&&h.nullifier.byteLength>0&&(v.uint32(50),v.bytes(h.nullifier)),h.rlnIdentifier!=null&&h.rlnIdentifier.byteLength>0&&(v.uint32(58),v.bytes(h.rlnIdentifier)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={proof:alloc$1(0),merkleRoot:alloc$1(0),epoch:alloc$1(0),shareX:alloc$1(0),shareY:alloc$1(0),nullifier:alloc$1(0),rlnIdentifier:alloc$1(0)},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.proof=h.bytes();break}case 2:{b.merkleRoot=h.bytes();break}case 3:{b.epoch=h.bytes();break}case 4:{b.shareX=h.bytes();break}case 5:{b.shareY=h.bytes();break}case 6:{b.nullifier=h.bytes();break}case 7:{b.rlnIdentifier=h.bytes();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(RateLimitProof$3||(RateLimitProof$3={}));var WakuMessage$3;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.payload!=null&&h.payload.byteLength>0&&(v.uint32(10),v.bytes(h.payload)),h.contentTopic!=null&&h.contentTopic!==""&&(v.uint32(18),v.string(h.contentTopic)),h.version!=null&&(v.uint32(24),v.uint32(h.version)),h.timestamp!=null&&(v.uint32(80),v.sint64(h.timestamp)),h.meta!=null&&(v.uint32(90),v.bytes(h.meta)),h.rateLimitProof!=null&&(v.uint32(170),RateLimitProof$3.codec().encode(h.rateLimitProof,v)),h.ephemeral!=null&&(v.uint32(248),v.bool(h.ephemeral)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={payload:alloc$1(0),contentTopic:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.payload=h.bytes();break}case 2:{b.contentTopic=h.string();break}case 3:{b.version=h.uint32();break}case 10:{b.timestamp=h.sint64();break}case 11:{b.meta=h.bytes();break}case 21:{b.rateLimitProof=RateLimitProof$3.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.rateLimitProof});break}case 31:{b.ephemeral=h.bool();break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(WakuMessage$3||(WakuMessage$3={}));var TopicOnlyMessage;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.contentTopic!=null&&h.contentTopic!==""&&(v.uint32(18),v.string(h.contentTopic)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={contentTopic:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 2:{b.contentTopic=h.string();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(TopicOnlyMessage||(TopicOnlyMessage={}));var FilterSubscribeRequest;(function(y){let u;(function(w){w.SUBSCRIBER_PING="SUBSCRIBER_PING",w.SUBSCRIBE="SUBSCRIBE",w.UNSUBSCRIBE="UNSUBSCRIBE",w.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL"})(u=y.FilterSubscribeType||(y.FilterSubscribeType={}));let h;(function(w){w[w.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",w[w.SUBSCRIBE=1]="SUBSCRIBE",w[w.UNSUBSCRIBE=2]="UNSUBSCRIBE",w[w.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL"})(h||(h={})),function(w){w.codec=()=>enumeration(h)}(u=y.FilterSubscribeType||(y.FilterSubscribeType={}));let v;y.codec=()=>(v==null&&(v=message$1((w,b,E={})=>{if(E.lengthDelimited!==!1&&b.fork(),w.requestId!=null&&w.requestId!==""&&(b.uint32(10),b.string(w.requestId)),w.filterSubscribeType!=null&&h[w.filterSubscribeType]!==0&&(b.uint32(16),y.FilterSubscribeType.codec().encode(w.filterSubscribeType,b)),w.pubsubTopic!=null&&(b.uint32(82),b.string(w.pubsubTopic)),w.contentTopics!=null)for(const $ of w.contentTopics)b.uint32(90),b.string($);E.lengthDelimited!==!1&&b.ldelim()},(w,b,E={})=>{var T;const $={requestId:"",filterSubscribeType:u.SUBSCRIBER_PING,contentTopics:[]},M=b==null?w.len:w.pos+b;for(;w.pos<M;){const C=w.uint32();switch(C>>>3){case 1:{$.requestId=w.string();break}case 2:{$.filterSubscribeType=y.FilterSubscribeType.codec().decode(w);break}case 10:{$.pubsubTopic=w.string();break}case 11:{if(((T=E.limits)==null?void 0:T.contentTopics)!=null&&$.contentTopics.length===E.limits.contentTopics)throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');$.contentTopics.push(w.string());break}default:{w.skipType(C&7);break}}}return $})),v),y.encode=w=>encodeMessage(w,y.codec()),y.decode=(w,b)=>decodeMessage(w,y.codec(),b)})(FilterSubscribeRequest||(FilterSubscribeRequest={}));var FilterSubscribeResponse$1;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.requestId!=null&&h.requestId!==""&&(v.uint32(10),v.string(h.requestId)),h.statusCode!=null&&h.statusCode!==0&&(v.uint32(80),v.uint32(h.statusCode)),h.statusDesc!=null&&(v.uint32(90),v.string(h.statusDesc)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={requestId:"",statusCode:0},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.requestId=h.string();break}case 10:{b.statusCode=h.uint32();break}case 11:{b.statusDesc=h.string();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(FilterSubscribeResponse$1||(FilterSubscribeResponse$1={}));var MessagePush;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.wakuMessage!=null&&(v.uint32(10),WakuMessage$2.codec().encode(h.wakuMessage,v)),h.pubsubTopic!=null&&(v.uint32(18),v.string(h.pubsubTopic)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.wakuMessage=WakuMessage$2.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.wakuMessage});break}case 2:{b.pubsubTopic=h.string();break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(MessagePush||(MessagePush={}));var RateLimitProof$2;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.proof!=null&&h.proof.byteLength>0&&(v.uint32(10),v.bytes(h.proof)),h.merkleRoot!=null&&h.merkleRoot.byteLength>0&&(v.uint32(18),v.bytes(h.merkleRoot)),h.epoch!=null&&h.epoch.byteLength>0&&(v.uint32(26),v.bytes(h.epoch)),h.shareX!=null&&h.shareX.byteLength>0&&(v.uint32(34),v.bytes(h.shareX)),h.shareY!=null&&h.shareY.byteLength>0&&(v.uint32(42),v.bytes(h.shareY)),h.nullifier!=null&&h.nullifier.byteLength>0&&(v.uint32(50),v.bytes(h.nullifier)),h.rlnIdentifier!=null&&h.rlnIdentifier.byteLength>0&&(v.uint32(58),v.bytes(h.rlnIdentifier)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={proof:alloc$1(0),merkleRoot:alloc$1(0),epoch:alloc$1(0),shareX:alloc$1(0),shareY:alloc$1(0),nullifier:alloc$1(0),rlnIdentifier:alloc$1(0)},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.proof=h.bytes();break}case 2:{b.merkleRoot=h.bytes();break}case 3:{b.epoch=h.bytes();break}case 4:{b.shareX=h.bytes();break}case 5:{b.shareY=h.bytes();break}case 6:{b.nullifier=h.bytes();break}case 7:{b.rlnIdentifier=h.bytes();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(RateLimitProof$2||(RateLimitProof$2={}));var WakuMessage$2;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.payload!=null&&h.payload.byteLength>0&&(v.uint32(10),v.bytes(h.payload)),h.contentTopic!=null&&h.contentTopic!==""&&(v.uint32(18),v.string(h.contentTopic)),h.version!=null&&(v.uint32(24),v.uint32(h.version)),h.timestamp!=null&&(v.uint32(80),v.sint64(h.timestamp)),h.meta!=null&&(v.uint32(90),v.bytes(h.meta)),h.rateLimitProof!=null&&(v.uint32(170),RateLimitProof$2.codec().encode(h.rateLimitProof,v)),h.ephemeral!=null&&(v.uint32(248),v.bool(h.ephemeral)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={payload:alloc$1(0),contentTopic:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.payload=h.bytes();break}case 2:{b.contentTopic=h.string();break}case 3:{b.version=h.uint32();break}case 10:{b.timestamp=h.sint64();break}case 11:{b.meta=h.bytes();break}case 21:{b.rateLimitProof=RateLimitProof$2.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.rateLimitProof});break}case 31:{b.ephemeral=h.bool();break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(WakuMessage$2||(WakuMessage$2={}));var PushRequest;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.pubsubTopic!=null&&h.pubsubTopic!==""&&(v.uint32(10),v.string(h.pubsubTopic)),h.message!=null&&(v.uint32(18),WakuMessage$1.codec().encode(h.message,v)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={pubsubTopic:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.pubsubTopic=h.string();break}case 2:{b.message=WakuMessage$1.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.message});break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(PushRequest||(PushRequest={}));var PushResponse;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.isSuccess!=null&&h.isSuccess!==!1&&(v.uint32(8),v.bool(h.isSuccess)),h.info!=null&&(v.uint32(18),v.string(h.info)),h.statusCode!=null&&(v.uint32(80),v.uint32(h.statusCode)),h.statusDesc!=null&&(v.uint32(90),v.string(h.statusDesc)),h.relayPeerCount!=null&&(v.uint32(96),v.uint32(h.relayPeerCount)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={isSuccess:!1},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.isSuccess=h.bool();break}case 2:{b.info=h.string();break}case 10:{b.statusCode=h.uint32();break}case 11:{b.statusDesc=h.string();break}case 12:{b.relayPeerCount=h.uint32();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(PushResponse||(PushResponse={}));var PushRpc;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.requestId!=null&&h.requestId!==""&&(v.uint32(10),v.string(h.requestId)),h.request!=null&&(v.uint32(18),PushRequest.codec().encode(h.request,v)),h.response!=null&&(v.uint32(26),PushResponse.codec().encode(h.response,v)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $,M;const b={requestId:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const T=h.uint32();switch(T>>>3){case 1:{b.requestId=h.string();break}case 2:{b.request=PushRequest.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.request});break}case 3:{b.response=PushResponse.codec().decode(h,h.uint32(),{limits:(M=w.limits)==null?void 0:M.response});break}default:{h.skipType(T&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(PushRpc||(PushRpc={}));var LightPushRequestV3;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.requestId!=null&&h.requestId!==""&&(v.uint32(10),v.string(h.requestId)),h.pubsubTopic!=null&&(v.uint32(162),v.string(h.pubsubTopic)),h.message!=null&&(v.uint32(170),WakuMessage$1.codec().encode(h.message,v)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={requestId:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.requestId=h.string();break}case 20:{b.pubsubTopic=h.string();break}case 21:{b.message=WakuMessage$1.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.message});break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(LightPushRequestV3||(LightPushRequestV3={}));var LightPushResponseV3;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.requestId!=null&&h.requestId!==""&&(v.uint32(10),v.string(h.requestId)),h.statusCode!=null&&h.statusCode!==0&&(v.uint32(80),v.uint32(h.statusCode)),h.statusDesc!=null&&(v.uint32(90),v.string(h.statusDesc)),h.relayPeerCount!=null&&(v.uint32(96),v.uint32(h.relayPeerCount)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={requestId:"",statusCode:0},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.requestId=h.string();break}case 10:{b.statusCode=h.uint32();break}case 11:{b.statusDesc=h.string();break}case 12:{b.relayPeerCount=h.uint32();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(LightPushResponseV3||(LightPushResponseV3={}));var RateLimitProof$1;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.proof!=null&&h.proof.byteLength>0&&(v.uint32(10),v.bytes(h.proof)),h.merkleRoot!=null&&h.merkleRoot.byteLength>0&&(v.uint32(18),v.bytes(h.merkleRoot)),h.epoch!=null&&h.epoch.byteLength>0&&(v.uint32(26),v.bytes(h.epoch)),h.shareX!=null&&h.shareX.byteLength>0&&(v.uint32(34),v.bytes(h.shareX)),h.shareY!=null&&h.shareY.byteLength>0&&(v.uint32(42),v.bytes(h.shareY)),h.nullifier!=null&&h.nullifier.byteLength>0&&(v.uint32(50),v.bytes(h.nullifier)),h.rlnIdentifier!=null&&h.rlnIdentifier.byteLength>0&&(v.uint32(58),v.bytes(h.rlnIdentifier)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={proof:alloc$1(0),merkleRoot:alloc$1(0),epoch:alloc$1(0),shareX:alloc$1(0),shareY:alloc$1(0),nullifier:alloc$1(0),rlnIdentifier:alloc$1(0)},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.proof=h.bytes();break}case 2:{b.merkleRoot=h.bytes();break}case 3:{b.epoch=h.bytes();break}case 4:{b.shareX=h.bytes();break}case 5:{b.shareY=h.bytes();break}case 6:{b.nullifier=h.bytes();break}case 7:{b.rlnIdentifier=h.bytes();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(RateLimitProof$1||(RateLimitProof$1={}));var WakuMessage$1;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.payload!=null&&h.payload.byteLength>0&&(v.uint32(10),v.bytes(h.payload)),h.contentTopic!=null&&h.contentTopic!==""&&(v.uint32(18),v.string(h.contentTopic)),h.version!=null&&(v.uint32(24),v.uint32(h.version)),h.timestamp!=null&&(v.uint32(80),v.sint64(h.timestamp)),h.meta!=null&&(v.uint32(90),v.bytes(h.meta)),h.rateLimitProof!=null&&(v.uint32(170),RateLimitProof$1.codec().encode(h.rateLimitProof,v)),h.ephemeral!=null&&(v.uint32(248),v.bool(h.ephemeral)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={payload:alloc$1(0),contentTopic:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.payload=h.bytes();break}case 2:{b.contentTopic=h.string();break}case 3:{b.version=h.uint32();break}case 10:{b.timestamp=h.sint64();break}case 11:{b.meta=h.bytes();break}case 21:{b.rateLimitProof=RateLimitProof$1.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.rateLimitProof});break}case 31:{b.ephemeral=h.bool();break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(WakuMessage$1||(WakuMessage$1={}));var WakuMessageKeyValue;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.messageHash!=null&&(v.uint32(10),v.bytes(h.messageHash)),h.message!=null&&(v.uint32(18),WakuMessage.codec().encode(h.message,v)),h.pubsubTopic!=null&&(v.uint32(26),v.string(h.pubsubTopic)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.messageHash=h.bytes();break}case 2:{b.message=WakuMessage.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.message});break}case 3:{b.pubsubTopic=h.string();break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(WakuMessageKeyValue||(WakuMessageKeyValue={}));var StoreQueryRequest$1;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{if(w.lengthDelimited!==!1&&v.fork(),h.requestId!=null&&h.requestId!==""&&(v.uint32(10),v.string(h.requestId)),h.includeData!=null&&h.includeData!==!1&&(v.uint32(16),v.bool(h.includeData)),h.pubsubTopic!=null&&(v.uint32(82),v.string(h.pubsubTopic)),h.contentTopics!=null)for(const b of h.contentTopics)v.uint32(90),v.string(b);if(h.timeStart!=null&&(v.uint32(96),v.sint64(h.timeStart)),h.timeEnd!=null&&(v.uint32(104),v.sint64(h.timeEnd)),h.messageHashes!=null)for(const b of h.messageHashes)v.uint32(162),v.bytes(b);h.paginationCursor!=null&&(v.uint32(410),v.bytes(h.paginationCursor)),h.paginationForward!=null&&h.paginationForward!==!1&&(v.uint32(416),v.bool(h.paginationForward)),h.paginationLimit!=null&&(v.uint32(424),v.uint64(h.paginationLimit)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $,M;const b={requestId:"",includeData:!1,contentTopics:[],messageHashes:[],paginationForward:!1},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const T=h.uint32();switch(T>>>3){case 1:{b.requestId=h.string();break}case 2:{b.includeData=h.bool();break}case 10:{b.pubsubTopic=h.string();break}case 11:{if((($=w.limits)==null?void 0:$.contentTopics)!=null&&b.contentTopics.length===w.limits.contentTopics)throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');b.contentTopics.push(h.string());break}case 12:{b.timeStart=h.sint64();break}case 13:{b.timeEnd=h.sint64();break}case 20:{if(((M=w.limits)==null?void 0:M.messageHashes)!=null&&b.messageHashes.length===w.limits.messageHashes)throw new MaxLengthError('Decode error - map field "messageHashes" had too many elements');b.messageHashes.push(h.bytes());break}case 51:{b.paginationCursor=h.bytes();break}case 52:{b.paginationForward=h.bool();break}case 53:{b.paginationLimit=h.uint64();break}default:{h.skipType(T&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(StoreQueryRequest$1||(StoreQueryRequest$1={}));var StoreQueryResponse$1;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{if(w.lengthDelimited!==!1&&v.fork(),h.requestId!=null&&h.requestId!==""&&(v.uint32(10),v.string(h.requestId)),h.statusCode!=null&&(v.uint32(80),v.uint32(h.statusCode)),h.statusDesc!=null&&(v.uint32(90),v.string(h.statusDesc)),h.messages!=null)for(const b of h.messages)v.uint32(162),WakuMessageKeyValue.codec().encode(b,v);h.paginationCursor!=null&&(v.uint32(410),v.bytes(h.paginationCursor)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $,M;const b={requestId:"",messages:[]},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const T=h.uint32();switch(T>>>3){case 1:{b.requestId=h.string();break}case 10:{b.statusCode=h.uint32();break}case 11:{b.statusDesc=h.string();break}case 20:{if((($=w.limits)==null?void 0:$.messages)!=null&&b.messages.length===w.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');b.messages.push(WakuMessageKeyValue.codec().decode(h,h.uint32(),{limits:(M=w.limits)==null?void 0:M.messages$}));break}case 51:{b.paginationCursor=h.bytes();break}default:{h.skipType(T&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(StoreQueryResponse$1||(StoreQueryResponse$1={}));var RateLimitProof;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.proof!=null&&h.proof.byteLength>0&&(v.uint32(10),v.bytes(h.proof)),h.merkleRoot!=null&&h.merkleRoot.byteLength>0&&(v.uint32(18),v.bytes(h.merkleRoot)),h.epoch!=null&&h.epoch.byteLength>0&&(v.uint32(26),v.bytes(h.epoch)),h.shareX!=null&&h.shareX.byteLength>0&&(v.uint32(34),v.bytes(h.shareX)),h.shareY!=null&&h.shareY.byteLength>0&&(v.uint32(42),v.bytes(h.shareY)),h.nullifier!=null&&h.nullifier.byteLength>0&&(v.uint32(50),v.bytes(h.nullifier)),h.rlnIdentifier!=null&&h.rlnIdentifier.byteLength>0&&(v.uint32(58),v.bytes(h.rlnIdentifier)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={proof:alloc$1(0),merkleRoot:alloc$1(0),epoch:alloc$1(0),shareX:alloc$1(0),shareY:alloc$1(0),nullifier:alloc$1(0),rlnIdentifier:alloc$1(0)},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.proof=h.bytes();break}case 2:{b.merkleRoot=h.bytes();break}case 3:{b.epoch=h.bytes();break}case 4:{b.shareX=h.bytes();break}case 5:{b.shareY=h.bytes();break}case 6:{b.nullifier=h.bytes();break}case 7:{b.rlnIdentifier=h.bytes();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(RateLimitProof||(RateLimitProof={}));var WakuMessage;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.payload!=null&&h.payload.byteLength>0&&(v.uint32(10),v.bytes(h.payload)),h.contentTopic!=null&&h.contentTopic!==""&&(v.uint32(18),v.string(h.contentTopic)),h.version!=null&&(v.uint32(24),v.uint32(h.version)),h.timestamp!=null&&(v.uint32(80),v.sint64(h.timestamp)),h.meta!=null&&(v.uint32(90),v.bytes(h.meta)),h.rateLimitProof!=null&&(v.uint32(170),RateLimitProof.codec().encode(h.rateLimitProof,v)),h.ephemeral!=null&&(v.uint32(248),v.bool(h.ephemeral)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={payload:alloc$1(0),contentTopic:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.payload=h.bytes();break}case 2:{b.contentTopic=h.string();break}case 3:{b.version=h.uint32();break}case 10:{b.timestamp=h.sint64();break}case 11:{b.meta=h.bytes();break}case 21:{b.rateLimitProof=RateLimitProof.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.rateLimitProof});break}case 31:{b.ephemeral=h.bool();break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(WakuMessage||(WakuMessage={}));var PeerInfo;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.enr!=null&&(v.uint32(10),v.bytes(h.enr)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.enr=h.bytes();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(PeerInfo||(PeerInfo={}));var PeerExchangeQuery;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.numPeers!=null&&(v.uint32(8),v.uint64(h.numPeers)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.numPeers=h.uint64();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(PeerExchangeQuery||(PeerExchangeQuery={}));var PeerExchangeResponse;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{if(w.lengthDelimited!==!1&&v.fork(),h.peerInfos!=null)for(const b of h.peerInfos)v.uint32(10),PeerInfo.codec().encode(b,v);w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $,M;const b={peerInfos:[]},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const T=h.uint32();switch(T>>>3){case 1:{if((($=w.limits)==null?void 0:$.peerInfos)!=null&&b.peerInfos.length===w.limits.peerInfos)throw new MaxLengthError('Decode error - map field "peerInfos" had too many elements');b.peerInfos.push(PeerInfo.codec().decode(h,h.uint32(),{limits:(M=w.limits)==null?void 0:M.peerInfos$}));break}default:{h.skipType(T&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(PeerExchangeResponse||(PeerExchangeResponse={}));var PeerExchangeRPC$1;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.query!=null&&(v.uint32(10),PeerExchangeQuery.codec().encode(h.query,v)),h.response!=null&&(v.uint32(18),PeerExchangeResponse.codec().encode(h.response,v)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $,M;const b={},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const T=h.uint32();switch(T>>>3){case 1:{b.query=PeerExchangeQuery.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.query});break}case 2:{b.response=PeerExchangeResponse.codec().decode(h,h.uint32(),{limits:(M=w.limits)==null?void 0:M.response});break}default:{h.skipType(T&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(PeerExchangeRPC$1||(PeerExchangeRPC$1={}));var WakuMetadataRequest;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{if(w.lengthDelimited!==!1&&v.fork(),h.clusterId!=null&&(v.uint32(8),v.uint32(h.clusterId)),h.shards!=null)for(const b of h.shards)v.uint32(16),v.uint32(b);w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={shards:[]},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.clusterId=h.uint32();break}case 2:{if((($=w.limits)==null?void 0:$.shards)!=null&&b.shards.length===w.limits.shards)throw new MaxLengthError('Decode error - map field "shards" had too many elements');b.shards.push(h.uint32());break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(WakuMetadataRequest||(WakuMetadataRequest={}));var WakuMetadataResponse;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{if(w.lengthDelimited!==!1&&v.fork(),h.clusterId!=null&&(v.uint32(8),v.uint32(h.clusterId)),h.shards!=null)for(const b of h.shards)v.uint32(16),v.uint32(b);w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={shards:[]},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.clusterId=h.uint32();break}case 2:{if((($=w.limits)==null?void 0:$.shards)!=null&&b.shards.length===w.limits.shards)throw new MaxLengthError('Decode error - map field "shards" had too many elements');b.shards.push(h.uint32());break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(WakuMetadataResponse||(WakuMetadataResponse={}));var HistoryEntry;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.messageId!=null&&h.messageId!==""&&(v.uint32(10),v.string(h.messageId)),h.retrievalHint!=null&&(v.uint32(18),v.bytes(h.retrievalHint)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{const b={messageId:""},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const $=h.uint32();switch($>>>3){case 1:{b.messageId=h.string();break}case 2:{b.retrievalHint=h.bytes();break}default:{h.skipType($&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(HistoryEntry||(HistoryEntry={}));var SdsMessage;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{if(w.lengthDelimited!==!1&&v.fork(),h.senderId!=null&&h.senderId!==""&&(v.uint32(10),v.string(h.senderId)),h.messageId!=null&&h.messageId!==""&&(v.uint32(18),v.string(h.messageId)),h.channelId!=null&&h.channelId!==""&&(v.uint32(26),v.string(h.channelId)),h.lamportTimestamp!=null&&(v.uint32(80),v.int32(h.lamportTimestamp)),h.causalHistory!=null)for(const b of h.causalHistory)v.uint32(90),HistoryEntry.codec().encode(b,v);h.bloomFilter!=null&&(v.uint32(98),v.bytes(h.bloomFilter)),h.content!=null&&(v.uint32(162),v.bytes(h.content)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $,M;const b={senderId:"",messageId:"",channelId:"",causalHistory:[]},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const T=h.uint32();switch(T>>>3){case 1:{b.senderId=h.string();break}case 2:{b.messageId=h.string();break}case 3:{b.channelId=h.string();break}case 10:{b.lamportTimestamp=h.int32();break}case 11:{if((($=w.limits)==null?void 0:$.causalHistory)!=null&&b.causalHistory.length===w.limits.causalHistory)throw new MaxLengthError('Decode error - map field "causalHistory" had too many elements');b.causalHistory.push(HistoryEntry.codec().decode(h,h.uint32(),{limits:(M=w.limits)==null?void 0:M.causalHistory$}));break}case 12:{b.bloomFilter=h.bytes();break}case 20:{b.content=h.bytes();break}default:{h.skipType(T&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(SdsMessage||(SdsMessage={}));function isDefined(y){return!!y}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes$1(y){return y instanceof Uint8Array||ArrayBuffer.isView(y)&&y.constructor.name==="Uint8Array"}function abytes$1(y,...u){if(!isBytes$1(y))throw new Error("Uint8Array expected");if(u.length>0&&!u.includes(y.length))throw new Error("Uint8Array expected of length "+u+", got length="+y.length)}function aexists(y,u=!0){if(y.destroyed)throw new Error("Hash instance has been destroyed");if(u&&y.finished)throw new Error("Hash#digest() has already been called")}function aoutput(y,u){abytes$1(y);const h=u.outputLen;if(y.length<h)throw new Error("digestInto() expects output buffer of length at least "+h)}function clean(...y){for(let u=0;u<y.length;u++)y[u].fill(0)}function createView(y){return new DataView(y.buffer,y.byteOffset,y.byteLength)}function rotr(y,u){return y<<32-u|y>>>u}const hasHexBuiltin=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",hexes$1=Array.from({length:256},(y,u)=>u.toString(16).padStart(2,"0"));function bytesToHex$1(y){if(abytes$1(y),hasHexBuiltin)return y.toHex();let u="";for(let h=0;h<y.length;h++)u+=hexes$1[y[h]];return u}function utf8ToBytes$1(y){if(typeof y!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(y))}function toBytes(y){return typeof y=="string"&&(y=utf8ToBytes$1(y)),abytes$1(y),y}let Hash$8=class{};function createHasher(y){const u=v=>y().update(toBytes(v)).digest(),h=y();return u.outputLen=h.outputLen,u.blockLen=h.blockLen,u.create=()=>y(),u}function setBigUint64(y,u,h,v){if(typeof y.setBigUint64=="function")return y.setBigUint64(u,h,v);const w=BigInt(32),b=BigInt(4294967295),E=Number(h>>w&b),$=Number(h&b),M=v?4:0,T=v?0:4;y.setUint32(u+M,E,v),y.setUint32(u+T,$,v)}function Chi(y,u,h){return y&u^~y&h}function Maj(y,u,h){return y&u^y&h^u&h}class HashMD extends Hash$8{constructor(u,h,v,w){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=u,this.outputLen=h,this.padOffset=v,this.isLE=w,this.buffer=new Uint8Array(u),this.view=createView(this.buffer)}update(u){aexists(this),u=toBytes(u),abytes$1(u);const{view:h,buffer:v,blockLen:w}=this,b=u.length;for(let E=0;E<b;){const $=Math.min(w-this.pos,b-E);if($===w){const M=createView(u);for(;w<=b-E;E+=w)this.process(M,E);continue}v.set(u.subarray(E,E+$),this.pos),this.pos+=$,E+=$,this.pos===w&&(this.process(h,0),this.pos=0)}return this.length+=u.length,this.roundClean(),this}digestInto(u){aexists(this),aoutput(u,this),this.finished=!0;const{buffer:h,view:v,blockLen:w,isLE:b}=this;let{pos:E}=this;h[E++]=128,clean(this.buffer.subarray(E)),this.padOffset>w-E&&(this.process(v,0),E=0);for(let B=E;B<w;B++)h[B]=0;setBigUint64(v,w-8,BigInt(this.length*8),b),this.process(v,0);const $=createView(u),M=this.outputLen;if(M%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const T=M/4,C=this.get();if(T>C.length)throw new Error("_sha2: outputLen bigger than state");for(let B=0;B<T;B++)$.setUint32(4*B,C[B],b)}digest(){const{buffer:u,outputLen:h}=this;this.digestInto(u);const v=u.slice(0,h);return this.destroy(),v}_cloneInto(u){u||(u=new this.constructor),u.set(...this.get());const{blockLen:h,buffer:v,length:w,finished:b,destroyed:E,pos:$}=this;return u.destroyed=E,u.finished=b,u.length=w,u.pos=$,w%h&&u.buffer.set(v),u}clone(){return this._cloneInto()}}const SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_K=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]),SHA256_W=new Uint32Array(64);let SHA256$2=class extends HashMD{constructor(u=32){super(64,u,8,!1),this.A=SHA256_IV[0]|0,this.B=SHA256_IV[1]|0,this.C=SHA256_IV[2]|0,this.D=SHA256_IV[3]|0,this.E=SHA256_IV[4]|0,this.F=SHA256_IV[5]|0,this.G=SHA256_IV[6]|0,this.H=SHA256_IV[7]|0}get(){const{A:u,B:h,C:v,D:w,E:b,F:E,G:$,H:M}=this;return[u,h,v,w,b,E,$,M]}set(u,h,v,w,b,E,$,M){this.A=u|0,this.B=h|0,this.C=v|0,this.D=w|0,this.E=b|0,this.F=E|0,this.G=$|0,this.H=M|0}process(u,h){for(let B=0;B<16;B++,h+=4)SHA256_W[B]=u.getUint32(h,!1);for(let B=16;B<64;B++){const N=SHA256_W[B-15],H=SHA256_W[B-2],te=rotr(N,7)^rotr(N,18)^N>>>3,fe=rotr(H,17)^rotr(H,19)^H>>>10;SHA256_W[B]=fe+SHA256_W[B-7]+te+SHA256_W[B-16]|0}let{A:v,B:w,C:b,D:E,E:$,F:M,G:T,H:C}=this;for(let B=0;B<64;B++){const N=rotr($,6)^rotr($,11)^rotr($,25),H=C+N+Chi($,M,T)+SHA256_K[B]+SHA256_W[B]|0,fe=(rotr(v,2)^rotr(v,13)^rotr(v,22))+Maj(v,w,b)|0;C=T,T=M,M=$,$=E+H|0,E=b,b=w,w=v,v=H+fe|0}v=v+this.A|0,w=w+this.B|0,b=b+this.C|0,E=E+this.D|0,$=$+this.E|0,M=M+this.F|0,T=T+this.G|0,C=C+this.H|0,this.set(v,w,b,E,$,M,T,C)}roundClean(){clean(SHA256_W)}destroy(){this.set(0,0,0,0,0,0,0,0),clean(this.buffer)}};const sha256$3=createHasher(()=>new SHA256$2),sha256$2=sha256$3;function toString$1(y,u="utf8"){const h=BASES[u];if(h==null)throw new Error(`Unsupported encoding "${u}"`);return h.encoder.encode(y).substring(1)}function numberToBytes(y){const u=new ArrayBuffer(8),h=new DataView(u);return typeof y=="number"?h.setFloat64(0,y,!1):h.setBigInt64(0,y,!1),new Uint8Array(u)}const utf8ToBytes=y=>fromString(y,"utf8");function concat$1(y,u){const h=y.reduce((b,E)=>b+E.length,0),v=new Uint8Array(h);let w=0;for(const b of y)v.set(b,w),w+=b.length;return v}class TypedEventEmitter extends EventTarget{constructor(){super();Bl(this,ir,new Map)}listenerCount(h){const v=ki(this,ir).get(h);return v==null?0:v.length}addEventListener(h,v,w){super.addEventListener(h,v,w);let b=ki(this,ir).get(h);b==null&&(b=[],ki(this,ir).set(h,b)),b.push({callback:v,once:(w!==!0&&w!==!1&&(w==null?void 0:w.once))??!1})}removeEventListener(h,v,w){super.removeEventListener(h.toString(),v??null,w);let b=ki(this,ir).get(h);b!=null&&(b=b.filter(({callback:E})=>E!==v),ki(this,ir).set(h,b))}dispatchEvent(h){const v=super.dispatchEvent(h);let w=ki(this,ir).get(h.type);return w==null||(w=w.filter(({once:b})=>!b),ki(this,ir).set(h.type,w)),v}safeDispatchEvent(h,v={}){return this.dispatchEvent(new CustomEvent(h,v))}}ir=new WeakMap;function getDefaultExportFromCjs(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}var browser$d={exports:{}},process=browser$d.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout=setTimeout:cachedSetTimeout=defaultSetTimout}catch{cachedSetTimeout=defaultSetTimout}try{typeof clearTimeout=="function"?cachedClearTimeout=clearTimeout:cachedClearTimeout=defaultClearTimeout}catch{cachedClearTimeout=defaultClearTimeout}})();function runTimeout(y){if(cachedSetTimeout===setTimeout)return setTimeout(y,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(y,0);try{return cachedSetTimeout(y,0)}catch{try{return cachedSetTimeout.call(null,y,0)}catch{return cachedSetTimeout.call(this,y,0)}}}function runClearTimeout(y){if(cachedClearTimeout===clearTimeout)return clearTimeout(y);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(y);try{return cachedClearTimeout(y)}catch{try{return cachedClearTimeout.call(null,y)}catch{return cachedClearTimeout.call(this,y)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var y=runTimeout(cleanUpNextTick);draining=!0;for(var u=queue.length;u;){for(currentQueue=queue,queue=[];++queueIndex<u;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,u=queue.length}currentQueue=null,draining=!1,runClearTimeout(y)}}process.nextTick=function(y){var u=new Array(arguments.length-1);if(arguments.length>1)for(var h=1;h<arguments.length;h++)u[h-1]=arguments[h];queue.push(new Item(y,u)),queue.length===1&&!draining&&runTimeout(drainQueue)};function Item(y,u){this.fun=y,this.array=u}Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={};function noop$3(){}process.on=noop$3,process.addListener=noop$3,process.once=noop$3,process.off=noop$3,process.removeListener=noop$3,process.removeAllListeners=noop$3,process.emit=noop$3,process.prependListener=noop$3,process.prependOnceListener=noop$3,process.listeners=function(y){return[]},process.binding=function(y){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(y){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};var browserExports$2=browser$d.exports;const process$1=getDefaultExportFromCjs(browserExports$2);var browser$c={exports:{}},ms,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms;hasRequiredMs=1;var y=1e3,u=y*60,h=u*60,v=h*24,w=v*7,b=v*365.25;ms=function(C,B){B=B||{};var N=typeof C;if(N==="string"&&C.length>0)return E(C);if(N==="number"&&isFinite(C))return B.long?M(C):$(C);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(C))};function E(C){if(C=String(C),!(C.length>100)){var B=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(C);if(B){var N=parseFloat(B[1]),H=(B[2]||"ms").toLowerCase();switch(H){case"years":case"year":case"yrs":case"yr":case"y":return N*b;case"weeks":case"week":case"w":return N*w;case"days":case"day":case"d":return N*v;case"hours":case"hour":case"hrs":case"hr":case"h":return N*h;case"minutes":case"minute":case"mins":case"min":case"m":return N*u;case"seconds":case"second":case"secs":case"sec":case"s":return N*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return N;default:return}}}}function $(C){var B=Math.abs(C);return B>=v?Math.round(C/v)+"d":B>=h?Math.round(C/h)+"h":B>=u?Math.round(C/u)+"m":B>=y?Math.round(C/y)+"s":C+"ms"}function M(C){var B=Math.abs(C);return B>=v?T(C,B,v,"day"):B>=h?T(C,B,h,"hour"):B>=u?T(C,B,u,"minute"):B>=y?T(C,B,y,"second"):C+" ms"}function T(C,B,N,H){var te=B>=N*1.5;return Math.round(C/N)+" "+H+(te?"s":"")}return ms}function setup$1(y){h.debug=h,h.default=h,h.coerce=M,h.disable=E,h.enable=w,h.enabled=$,h.humanize=requireMs(),h.destroy=T,Object.keys(y).forEach(C=>{h[C]=y[C]}),h.names=[],h.skips=[],h.formatters={};function u(C){let B=0;for(let N=0;N<C.length;N++)B=(B<<5)-B+C.charCodeAt(N),B|=0;return h.colors[Math.abs(B)%h.colors.length]}h.selectColor=u;function h(C){let B,N=null,H,te;function fe(...ce){if(!fe.enabled)return;const le=fe,ie=Number(new Date),ge=ie-(B||ie);le.diff=ge,le.prev=B,le.curr=ie,B=ie,ce[0]=h.coerce(ce[0]),typeof ce[0]!="string"&&ce.unshift("%O");let pe=0;ce[0]=ce[0].replace(/%([a-zA-Z%])/g,($e,Pe)=>{if($e==="%%")return"%";pe++;const Be=h.formatters[Pe];if(typeof Be=="function"){const Re=ce[pe];$e=Be.call(le,Re),ce.splice(pe,1),pe--}return $e}),h.formatArgs.call(le,ce),(le.log||h.log).apply(le,ce)}return fe.namespace=C,fe.useColors=h.useColors(),fe.color=h.selectColor(C),fe.extend=v,fe.destroy=h.destroy,Object.defineProperty(fe,"enabled",{enumerable:!0,configurable:!1,get:()=>N!==null?N:(H!==h.namespaces&&(H=h.namespaces,te=h.enabled(C)),te),set:ce=>{N=ce}}),typeof h.init=="function"&&h.init(fe),fe}function v(C,B){const N=h(this.namespace+(typeof B>"u"?":":B)+C);return N.log=this.log,N}function w(C){h.save(C),h.namespaces=C,h.names=[],h.skips=[];const B=(typeof C=="string"?C:"").trim().replace(" ",",").split(",").filter(Boolean);for(const N of B)N[0]==="-"?h.skips.push(N.slice(1)):h.names.push(N)}function b(C,B){let N=0,H=0,te=-1,fe=0;for(;N<C.length;)if(H<B.length&&(B[H]===C[N]||B[H]==="*"))B[H]==="*"?(te=H,fe=N,H++):(N++,H++);else if(te!==-1)H=te+1,fe++,N=fe;else return!1;for(;H<B.length&&B[H]==="*";)H++;return H===B.length}function E(){const C=[...h.names,...h.skips.map(B=>"-"+B)].join(",");return h.enable(""),C}function $(C){for(const B of h.skips)if(b(C,B))return!1;for(const B of h.names)if(b(C,B))return!0;return!1}function M(C){return C instanceof Error?C.stack||C.message:C}function T(){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 h.enable(h.load()),h}var common$7=setup$1;(function(y,u){u.formatArgs=v,u.save=w,u.load=b,u.useColors=h,u.storage=E(),u.destroy=(()=>{let M=!1;return()=>{M||(M=!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`."))}})(),u.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 h(){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 M;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&&(M=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(M[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function v(M){if(M[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+M[0]+(this.useColors?"%c ":" ")+"+"+y.exports.humanize(this.diff),!this.useColors)return;const T="color: "+this.color;M.splice(1,0,T,"color: inherit");let C=0,B=0;M[0].replace(/%[a-zA-Z%]/g,N=>{N!=="%%"&&(C++,N==="%c"&&(B=C))}),M.splice(B,0,T)}u.log=console.debug||console.log||(()=>{});function w(M){try{M?u.storage.setItem("debug",M):u.storage.removeItem("debug")}catch{}}function b(){let M;try{M=u.storage.getItem("debug")}catch{}return!M&&typeof process$1<"u"&&"env"in process$1&&(M=process$1.env.DEBUG),M}function E(){try{return localStorage}catch{}}y.exports=common$7(u);const{formatters:$}=y.exports;$.j=function(M){try{return JSON.stringify(M)}catch(T){return"[UnexpectedJSONParseError]: "+T.message}}})(browser$c,browser$c.exports);var browserExports$1=browser$c.exports;const debug=getDefaultExportFromCjs$1(browserExports$1),APP_NAME="waku";class Logger{constructor(u){Ke(this,"_info");Ke(this,"_warn");Ke(this,"_error");this._info=debug(Logger.createDebugNamespace("info",u)),this._warn=debug(Logger.createDebugNamespace("warn",u)),this._error=debug(Logger.createDebugNamespace("error",u))}static createDebugNamespace(u,h){return h?`${APP_NAME}:${h}:${u}`:`${APP_NAME}:${u}`}get info(){return this._info}get warn(){return this._warn}get error(){return this._error}log(u,...h){(this[u]||this.log)(...h)}}function messageHash(y,u){const h=utf8ToBytes(y),v=utf8ToBytes(u.contentTopic),w=tryConvertTimestampToBytes(u.timestamp),b=concat$1([h,u.payload,v,u.meta,w].filter(isDefined));return sha256$2(b)}function tryConvertTimestampToBytes(y){if(!y)return;let u;return typeof y=="bigint"?u=y:u=BigInt(y.valueOf())*1000000n,numberToBytes(u)}new Logger("message:version-0"),BigInt(1e6);var LightPushStatusCode;(function(y){y[y.SUCCESS=200]="SUCCESS",y[y.BAD_REQUEST=400]="BAD_REQUEST",y[y.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",y[y.INVALID_MESSAGE=420]="INVALID_MESSAGE",y[y.UNSUPPORTED_TOPIC=421]="UNSUPPORTED_TOPIC",y[y.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",y[y.INTERNAL_ERROR=500]="INTERNAL_ERROR",y[y.UNAVAILABLE=503]="UNAVAILABLE",y[y.NO_RLN_PROOF=504]="NO_RLN_PROOF",y[y.NO_PEERS=505]="NO_PEERS"})(LightPushStatusCode||(LightPushStatusCode={})),LightPushStatusCode.SUCCESS+"",LightPushStatusCode.BAD_REQUEST+"",LightPushStatusCode.PAYLOAD_TOO_LARGE+"",LightPushStatusCode.INVALID_MESSAGE+"",LightPushStatusCode.UNSUPPORTED_TOPIC+"",LightPushStatusCode.TOO_MANY_REQUESTS+"",LightPushStatusCode.INTERNAL_ERROR+"",LightPushStatusCode.UNAVAILABLE+"",LightPushStatusCode.NO_RLN_PROOF+"",LightPushStatusCode.NO_PEERS+"";var Protocols;(function(y){y.Relay="relay",y.Store="store",y.LightPush="lightpush",y.Filter="filter"})(Protocols||(Protocols={}));var LightPushError;(function(y){y.GENERIC_FAIL="Generic error",y.DECODE_FAILED="Failed to decode",y.NO_PEER_AVAILABLE="No peer available",y.NO_STREAM_AVAILABLE="No stream available",y.NO_RESPONSE="No response received",y.STREAM_ABORTED="Stream aborted",y.ENCODE_FAILED="Failed to encode",y.EMPTY_PAYLOAD="Payload is empty",y.SIZE_TOO_BIG="Size is too big",y.TOPIC_NOT_CONFIGURED="Topic not configured",y.RLN_PROOF_GENERATION="Proof generation failed",y.REMOTE_PEER_REJECTED="Remote peer rejected",y.BAD_REQUEST="Bad request format",y.PAYLOAD_TOO_LARGE="Message payload exceeds maximum size",y.INVALID_MESSAGE="Message validation failed",y.UNSUPPORTED_TOPIC="Unsupported pubsub topic",y.TOO_MANY_REQUESTS="Rate limit exceeded",y.INTERNAL_ERROR="Internal server error",y.UNAVAILABLE="Service temporarily unavailable",y.NO_RLN_PROOF="RLN proof generation failed",y.NO_PEERS="No relay peers available"})(LightPushError||(LightPushError={}));var FilterError;(function(y){y.GENERIC_FAIL="Generic error",y.DECODE_FAILED="Failed to decode",y.NO_PEER_AVAILABLE="No peer available",y.NO_STREAM_AVAILABLE="No stream available",y.NO_RESPONSE="No response received",y.STREAM_ABORTED="Stream aborted",y.REMOTE_PEER_REJECTED="Remote peer rejected",y.TOPIC_NOT_CONFIGURED="Topic not configured",y.SUBSCRIPTION_FAILED="Subscription failed",y.UNSUBSCRIBE_FAILED="Unsubscribe failed",y.PING_FAILED="Ping failed",y.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",y.INVALID_DECODER_TOPICS="Invalid decoder topics",y.SUBSCRIPTION_LIMIT_EXCEEDED="Subscription limit exceeded",y.INVALID_CONTENT_TOPIC="Invalid content topic",y.PUSH_MESSAGE_FAILED="Push message failed",y.EMPTY_MESSAGE="Empty message received",y.MISSING_PUBSUB_TOPIC="Pubsub topic missing from push message"})(FilterError||(FilterError={}));var ProtocolError;(function(y){y.GENERIC_FAIL="Generic error",y.REMOTE_PEER_REJECTED="Remote peer rejected",y.DECODE_FAILED="Failed to decode",y.NO_PEER_AVAILABLE="No peer available",y.NO_STREAM_AVAILABLE="No stream available",y.NO_RESPONSE="No response received",y.ENCODE_FAILED="Failed to encode",y.EMPTY_PAYLOAD="Payload is empty",y.SIZE_TOO_BIG="Size is too big",y.TOPIC_NOT_CONFIGURED="Topic not configured",y.STREAM_ABORTED="Stream aborted",y.RLN_PROOF_GENERATION="Proof generation failed",y.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",y.INVALID_DECODER_TOPICS="Invalid decoder topics"})(ProtocolError||(ProtocolError={}));var WakuEvent;(function(y){y.Connection="waku:connection",y.Health="waku:health"})(WakuEvent||(WakuEvent={}));var Tags;(function(y){y.BOOTSTRAP="bootstrap",y.PEER_EXCHANGE="peer-exchange",y.PEER_CACHE="peer-cache"})(Tags||(Tags={}));var HealthStatus;(function(y){y.Unhealthy="Unhealthy",y.MinimallyHealthy="MinimallyHealthy",y.SufficientlyHealthy="SufficientlyHealthy"})(HealthStatus||(HealthStatus={}));function asUint8Array(y){return y}function concat(y,u){u==null&&(u=y.reduce((w,b)=>w+b.length,0));const h=allocUnsafe(u);let v=0;for(const w of y)h.set(w,v),v+=w.length;return h}var ReadMode$1;(function(y){y[y.LENGTH=0]="LENGTH",y[y.DATA=1]="DATA"})(ReadMode$1||(ReadMode$1={})),new Logger("filter-core"),new Logger("light-push:protocol-handler"),new Logger("light-push"),new Logger("store");class InvalidMultiaddrError extends Error{constructor(){super(...arguments);Ke(this,"name","InvalidMultiaddrError")}}Ke(InvalidMultiaddrError,"name","InvalidMultiaddrError");class ValidationError extends Error{constructor(){super(...arguments);Ke(this,"name","ValidationError")}}Ke(ValidationError,"name","ValidationError");class UnknownProtocolError extends Error{constructor(){super(...arguments);Ke(this,"name","UnknownProtocolError")}}Ke(UnknownProtocolError,"name","UnknownProtocolError");class Parser{constructor(){Ke(this,"index",0);Ke(this,"input","")}new(u){return this.index=0,this.input=u,this}readAtomically(u){const h=this.index,v=u();return v===void 0&&(this.index=h),v}parseWith(u){const h=u();if(this.index===this.input.length)return h}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(u){return this.readAtomically(()=>{const h=this.readChar();if(h===u)return h})}readSeparator(u,h,v){return this.readAtomically(()=>{if(!(h>0&&this.readGivenChar(u)===void 0))return v()})}readNumber(u,h,v,w){return this.readAtomically(()=>{let b=0,E=0;const $=this.peekChar();if($===void 0)return;const M=$==="0",T=2**(8*w)-1;for(;;){const C=this.readAtomically(()=>{const B=this.readChar();if(B===void 0)return;const N=Number.parseInt(B,u);if(!Number.isNaN(N))return N});if(C===void 0)break;if(b*=u,b+=C,b>T||(E+=1,h!==void 0&&E>h))return}if(E!==0)return!v&&M&&E>1?void 0:b})}readIPv4Addr(){return this.readAtomically(()=>{const u=new Uint8Array(4);for(let h=0;h<u.length;h++){const v=this.readSeparator(".",h,()=>this.readNumber(10,3,!1,1));if(v===void 0)return;u[h]=v}return u})}readIPv6Addr(){const u=h=>{for(let v=0;v<h.length/2;v++){const w=v*2;if(v<h.length-3){const E=this.readSeparator(":",v,()=>this.readIPv4Addr());if(E!==void 0)return h[w]=E[0],h[w+1]=E[1],h[w+2]=E[2],h[w+3]=E[3],[w+4,!0]}const b=this.readSeparator(":",v,()=>this.readNumber(16,4,!0,2));if(b===void 0)return[w,!1];h[w]=b>>8,h[w+1]=b&255}return[h.length,!1]};return this.readAtomically(()=>{const h=new Uint8Array(16),[v,w]=u(h);if(v===16)return h;if(w||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;const b=new Uint8Array(14),E=16-(v+2),[$]=u(b.subarray(0,E));return h.set(b.subarray(0,$),16-$),h})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}}const MAX_IPV6_LENGTH=45,MAX_IPV4_LENGTH=15,parser=new Parser;function parseIPv4(y){if(!(y.length>MAX_IPV4_LENGTH))return parser.new(y).parseWith(()=>parser.readIPv4Addr())}function parseIPv6(y){if(y.includes("%")&&(y=y.split("%")[0]),!(y.length>MAX_IPV6_LENGTH))return parser.new(y).parseWith(()=>parser.readIPv6Addr())}function isIPv4(y){return!!parseIPv4(y)}function isIPv6(y){return!!parseIPv6(y)}const CODE_IP4=4,CODE_TCP=6,CODE_UDP=273,CODE_DCCP=33,CODE_IP6=41,CODE_IP6ZONE=42,CODE_IPCIDR=43,CODE_DNS=53,CODE_DNS4=54,CODE_DNS6=55,CODE_DNSADDR=56,CODE_SCTP=132,CODE_UDT=301,CODE_UTP=302,CODE_UNIX=400,CODE_P2P=421,CODE_ONION=444,CODE_ONION3=445,CODE_GARLIC64=446,CODE_GARLIC32=447,CODE_TLS=448,CODE_SNI=449,CODE_NOISE=454,CODE_QUIC=460,CODE_QUIC_V1=461,CODE_WEBTRANSPORT=465,CODE_CERTHASH=466,CODE_HTTP=480,CODE_HTTP_PATH=481,CODE_HTTPS=443,CODE_WS=477,CODE_WSS=478,CODE_P2P_WEBSOCKET_STAR=479,CODE_P2P_STARDUST=277,CODE_P2P_WEBRTC_STAR=275,CODE_P2P_WEBRTC_DIRECT=276,CODE_WEBRTC_DIRECT=280,CODE_WEBRTC=281,CODE_P2P_CIRCUIT=290,CODE_MEMORY=777;function bytesToString(y){return u=>toString$1(u,y)}function stringToBytes(y){return u=>fromString(u,y)}function bytes2port(y){return new DataView(y.buffer).getUint16(y.byteOffset).toString()}function port2bytes(y){const u=new ArrayBuffer(2);return new DataView(u).setUint16(0,typeof y=="string"?parseInt(y):y),new Uint8Array(u)}function onion2bytes(y){const u=y.split(":");if(u.length!==2)throw new Error(`failed to parse onion addr: ["'${u.join('", "')}'"]' does not contain a port number`);if(u[0].length!==16)throw new Error(`failed to parse onion addr: ${u[0]} not a Tor onion address.`);const h=fromString(u[0],"base32"),v=parseInt(u[1],10);if(v<1||v>65536)throw new Error("Port number is not in range(1, 65536)");const w=port2bytes(v);return concat([h,w],h.length+w.length)}function onion32bytes(y){const u=y.split(":");if(u.length!==2)throw new Error(`failed to parse onion addr: ["'${u.join('", "')}'"]' does not contain a port number`);if(u[0].length!==56)throw new Error(`failed to parse onion addr: ${u[0]} not a Tor onion3 address.`);const h=base32$1.decode(`b${u[0]}`),v=parseInt(u[1],10);if(v<1||v>65536)throw new Error("Port number is not in range(1, 65536)");const w=port2bytes(v);return concat([h,w],h.length+w.length)}function bytes2onion(y){const u=y.subarray(0,y.length-2),h=y.subarray(y.length-2),v=toString$1(u,"base32"),w=bytes2port(h);return`${v}:${w}`}const ip4ToBytes=function(y){y=y.toString().trim();const u=new Uint8Array(4);return y.split(/\./g).forEach((h,v)=>{const w=parseInt(h,10);if(isNaN(w)||w<0||w>255)throw new InvalidMultiaddrError("Invalid byte value in IP address");u[v]=w}),u},ip6ToBytes=function(y){let u=0;y=y.toString().trim();const h=y.split(":",8);let v;for(v=0;v<h.length;v++){const b=isIPv4(h[v]);let E;b&&(E=ip4ToBytes(h[v]),h[v]=toString$1(E.subarray(0,2),"base16")),E!=null&&++v<8&&h.splice(v,0,toString$1(E.subarray(2,4),"base16"))}if(h[0]==="")for(;h.length<8;)h.unshift("0");else if(h[h.length-1]==="")for(;h.length<8;)h.push("0");else if(h.length<8){for(v=0;v<h.length&&h[v]!=="";v++);const b=[v,1];for(v=9-h.length;v>0;v--)b.push("0");h.splice.apply(h,b)}const w=new Uint8Array(u+16);for(v=0;v<h.length;v++){h[v]===""&&(h[v]="0");const b=parseInt(h[v],16);if(isNaN(b)||b<0||b>65535)throw new InvalidMultiaddrError("Invalid byte value in IP address");w[u++]=b>>8&255,w[u++]=b&255}return w},ip4ToString=function(y){if(y.byteLength!==4)throw new InvalidMultiaddrError("IPv4 address was incorrect length");const u=[];for(let h=0;h<y.byteLength;h++)u.push(y[h]);return u.join(".")},ip6ToString=function(y){if(y.byteLength!==16)throw new InvalidMultiaddrError("IPv6 address was incorrect length");const u=[];for(let v=0;v<y.byteLength;v+=2){const w=y[v],b=y[v+1],E=`${w.toString(16).padStart(2,"0")}${b.toString(16).padStart(2,"0")}`;u.push(E)}const h=u.join(":");try{const v=new URL(`http://[${h}]`);return v.hostname.substring(1,v.hostname.length-1)}catch{throw new InvalidMultiaddrError(`Invalid IPv6 address "${h}"`)}};function ip6StringToValue(y){try{const u=new URL(`http://[${y}]`);return u.hostname.substring(1,u.hostname.length-1)}catch{throw new InvalidMultiaddrError(`Invalid IPv6 address "${y}"`)}}const decoders$1=Object.values(bases).map(y=>y.decoder),anybaseDecoder=function(){let y=decoders$1[0].or(decoders$1[1]);return decoders$1.slice(2).forEach(u=>y=y.or(u)),y}();function mb2bytes(y){return anybaseDecoder.decode(y)}function bytes2mb(y){return u=>y.encoder.encode(u)}function integer(y){if(parseInt(y).toString()!==y)throw new ValidationError("Value must be an integer")}function positive(y){if(y<0)throw new ValidationError("Value must be a positive integer, or zero")}function maxValue(y){return u=>{if(u>y)throw new ValidationError(`Value must be smaller than or equal to ${y}`)}}function validate(...y){return u=>{for(const h of y)h(u)}}const validatePort=validate(integer,positive,maxValue(65535)),V=-1;class Registry{constructor(){Ke(this,"protocolsByCode",new Map);Ke(this,"protocolsByName",new Map)}getProtocol(u){let h;if(typeof u=="string"?h=this.protocolsByName.get(u):h=this.protocolsByCode.get(u),h==null)throw new UnknownProtocolError(`Protocol ${u} was unknown`);return h}addProtocol(u){var h;this.protocolsByCode.set(u.code,u),this.protocolsByName.set(u.name,u),(h=u.aliases)==null||h.forEach(v=>{this.protocolsByName.set(v,u)})}removeProtocol(u){var v;const h=this.protocolsByCode.get(u);h!=null&&(this.protocolsByCode.delete(h.code),this.protocolsByName.delete(h.name),(v=h.aliases)==null||v.forEach(w=>{this.protocolsByName.delete(w)}))}}const registry=new Registry,codecs=[{code:CODE_IP4,name:"ip4",size:32,valueToBytes:ip4ToBytes,bytesToValue:ip4ToString,validate:y=>{if(!isIPv4(y))throw new ValidationError(`Invalid IPv4 address "${y}"`)}},{code:CODE_TCP,name:"tcp",size:16,valueToBytes:port2bytes,bytesToValue:bytes2port,validate:validatePort},{code:CODE_UDP,name:"udp",size:16,valueToBytes:port2bytes,bytesToValue:bytes2port,validate:validatePort},{code:CODE_DCCP,name:"dccp",size:16,valueToBytes:port2bytes,bytesToValue:bytes2port,validate:validatePort},{code:CODE_IP6,name:"ip6",size:128,valueToBytes:ip6ToBytes,bytesToValue:ip6ToString,stringToValue:ip6StringToValue,validate:y=>{if(!isIPv6(y))throw new ValidationError(`Invalid IPv6 address "${y}"`)}},{code:CODE_IP6ZONE,name:"ip6zone",size:V},{code:CODE_IPCIDR,name:"ipcidr",size:8,bytesToValue:bytesToString("base10"),valueToBytes:stringToBytes("base10")},{code:CODE_DNS,name:"dns",size:V,resolvable:!0},{code:CODE_DNS4,name:"dns4",size:V,resolvable:!0},{code:CODE_DNS6,name:"dns6",size:V,resolvable:!0},{code:CODE_DNSADDR,name:"dnsaddr",size:V,resolvable:!0},{code:CODE_SCTP,name:"sctp",size:16,valueToBytes:port2bytes,bytesToValue:bytes2port,validate:validatePort},{code:CODE_UDT,name:"udt"},{code:CODE_UTP,name:"utp"},{code:CODE_UNIX,name:"unix",size:V,path:!0,stringToValue:y=>decodeURIComponent(y),valueToString:y=>encodeURIComponent(y)},{code:CODE_P2P,name:"p2p",aliases:["ipfs"],size:V,bytesToValue:bytesToString("base58btc"),valueToBytes:y=>y.startsWith("Q")||y.startsWith("1")?stringToBytes("base58btc")(y):CID.parse(y).multihash.bytes},{code:CODE_ONION,name:"onion",size:96,bytesToValue:bytes2onion,valueToBytes:onion2bytes},{code:CODE_ONION3,name:"onion3",size:296,bytesToValue:bytes2onion,valueToBytes:onion32bytes},{code:CODE_GARLIC64,name:"garlic64",size:V},{code:CODE_GARLIC32,name:"garlic32",size:V},{code:CODE_TLS,name:"tls"},{code:CODE_SNI,name:"sni",size:V},{code:CODE_NOISE,name:"noise"},{code:CODE_QUIC,name:"quic"},{code:CODE_QUIC_V1,name:"quic-v1"},{code:CODE_WEBTRANSPORT,name:"webtransport"},{code:CODE_CERTHASH,name:"certhash",size:V,bytesToValue:bytes2mb(base64url),valueToBytes:mb2bytes},{code:CODE_HTTP,name:"http"},{code:CODE_HTTP_PATH,name:"http-path",size:V,stringToValue:y=>`/${decodeURIComponent(y)}`,valueToString:y=>encodeURIComponent(y.substring(1))},{code:CODE_HTTPS,name:"https"},{code:CODE_WS,name:"ws"},{code:CODE_WSS,name:"wss"},{code:CODE_P2P_WEBSOCKET_STAR,name:"p2p-websocket-star"},{code:CODE_P2P_STARDUST,name:"p2p-stardust"},{code:CODE_P2P_WEBRTC_STAR,name:"p2p-webrtc-star"},{code:CODE_P2P_WEBRTC_DIRECT,name:"p2p-webrtc-direct"},{code:CODE_WEBRTC_DIRECT,name:"webrtc-direct"},{code:CODE_WEBRTC,name:"webrtc"},{code:CODE_P2P_CIRCUIT,name:"p2p-circuit"},{code:CODE_MEMORY,name:"memory",size:V}];codecs.forEach(y=>{registry.addProtocol(y)}),new Logger("connection-limiter"),new Logger("dialer"),new Logger("discovery-dialer"),new Logger("keep-alive"),new Logger("shard-reader"),new Logger("connection-manager"),new Logger("metadata"),new Logger("peer-manager");var PeerManagerEventNames;(function(y){y.FilterConnect="filter:connect",y.FilterDisconnect="filter:disconnect",y.StoreConnect="store:connect"})(PeerManagerEventNames||(PeerManagerEventNames={})),new Logger("sdk:filter-subscription"),new Logger("sdk:filter");var freeGlobal=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;freeGlobal||freeSelf||Function("return this")(),new Logger("health-indicator"),new Logger("sdk:retry-manager"),new Logger("sdk:light-push"),new Logger("store-sdk"),new Logger("wait-for-remote-peer"),new Logger("sdk:waku");var ReadMode;(function(y){y[y.LENGTH=0]="LENGTH",y[y.DATA=1]="DATA"})(ReadMode||(ReadMode={})),(Hc=(Yr=globalThis.process)==null?void 0:Yr.env)!=null&&Hc.DUMP_SESSION_KEYS;var NoiseExtensions;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{if(w.lengthDelimited!==!1&&v.fork(),h.webtransportCerthashes!=null)for(const b of h.webtransportCerthashes)v.uint32(10),v.bytes(b);if(h.streamMuxers!=null)for(const b of h.streamMuxers)v.uint32(18),v.string(b);w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $,M;const b={webtransportCerthashes:[],streamMuxers:[]},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const T=h.uint32();switch(T>>>3){case 1:{if((($=w.limits)==null?void 0:$.webtransportCerthashes)!=null&&b.webtransportCerthashes.length===w.limits.webtransportCerthashes)throw new MaxLengthError('Decode error - map field "webtransportCerthashes" had too many elements');b.webtransportCerthashes.push(h.bytes());break}case 2:{if(((M=w.limits)==null?void 0:M.streamMuxers)!=null&&b.streamMuxers.length===w.limits.streamMuxers)throw new MaxLengthError('Decode error - map field "streamMuxers" had too many elements');b.streamMuxers.push(h.string());break}default:{h.skipType(T&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(NoiseExtensions||(NoiseExtensions={}));var NoiseHandshakePayload;(function(y){let u;y.codec=()=>(u==null&&(u=message$1((h,v,w={})=>{w.lengthDelimited!==!1&&v.fork(),h.identityKey!=null&&h.identityKey.byteLength>0&&(v.uint32(10),v.bytes(h.identityKey)),h.identitySig!=null&&h.identitySig.byteLength>0&&(v.uint32(18),v.bytes(h.identitySig)),h.extensions!=null&&(v.uint32(34),NoiseExtensions.codec().encode(h.extensions,v)),w.lengthDelimited!==!1&&v.ldelim()},(h,v,w={})=>{var $;const b={identityKey:alloc$1(0),identitySig:alloc$1(0)},E=v==null?h.len:h.pos+v;for(;h.pos<E;){const M=h.uint32();switch(M>>>3){case 1:{b.identityKey=h.bytes();break}case 2:{b.identitySig=h.bytes();break}case 4:{b.extensions=NoiseExtensions.codec().decode(h,h.uint32(),{limits:($=w.limits)==null?void 0:$.extensions});break}default:{h.skipType(M&7);break}}}return b})),u),y.encode=h=>encodeMessage(h,y.codec()),y.decode=(h,v)=>decodeMessage(h,y.codec(),v)})(NoiseHandshakePayload||(NoiseHandshakePayload={}));const e=1e3,t=e*60,n=t*60,r$1=n*24,i=r$1*7,a=r$1*365.25,o=a/12;function s$1(y,u){if(typeof y=="string")return l(y);if(typeof y=="number")return p(y,u);throw Error(`Value provided to ms() must be a string or number. value=${JSON.stringify(y)}`)}var c=s$1;function l(y){if(typeof y!="string"||y.length===0||y.length>100)throw Error(`Value provided to ms.parse() must be a string with length between 1 and 99. value=${JSON.stringify(y)}`);let u=/^(?<value>-?\d*\.?\d+) *(?<unit>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.exec(y);if(!(u!=null&&u.groups))return NaN;let{value:h,unit:v="ms"}=u.groups,w=parseFloat(h),b=v.toLowerCase();switch(b){case"years":case"year":case"yrs":case"yr":case"y":return w*a;case"months":case"month":case"mo":return w*o;case"weeks":case"week":case"w":return w*i;case"days":case"day":case"d":return w*r$1;case"hours":case"hour":case"hrs":case"hr":case"h":return w*n;case"minutes":case"minute":case"mins":case"min":case"m":return w*t;case"seconds":case"second":case"secs":case"sec":case"s":return w*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return w;default:throw Error(`Unknown unit "${b}" provided to ms.parse(). value=${JSON.stringify(y)}`)}}function d(y){let u=Math.abs(y);return u>=a?`${Math.round(y/a)}y`:u>=o?`${Math.round(y/o)}mo`:u>=i?`${Math.round(y/i)}w`:u>=r$1?`${Math.round(y/r$1)}d`:u>=n?`${Math.round(y/n)}h`:u>=t?`${Math.round(y/t)}m`:u>=e?`${Math.round(y/e)}s`:`${y}ms`}function f$1(y){let u=Math.abs(y);return u>=a?m(y,u,a,"year"):u>=o?m(y,u,o,"month"):u>=i?m(y,u,i,"week"):u>=r$1?m(y,u,r$1,"day"):u>=n?m(y,u,n,"hour"):u>=t?m(y,u,t,"minute"):u>=e?m(y,u,e,"second"):`${y} ms`}function p(y,u){if(typeof y!="number"||!Number.isFinite(y))throw Error("Value provided to ms.format() must be of type number.");return u!=null&&u.long?f$1(y):d(y)}function m(y,u,h,v){let w=u>=h*1.5;return`${Math.round(y/h)} ${v}${w?"s":""}`}function setup(y){h.debug=h,h.default=h,h.coerce=M,h.disable=b,h.enable=w,h.enabled=E,h.humanize=c,h.destroy=T,Object.keys(y).forEach(C=>{h[C]=y[C]}),h.names=[],h.skips=[],h.formatters={};function u(C){let B=0;for(let N=0;N<C.length;N++)B=(B<<5)-B+C.charCodeAt(N),B|=0;return h.colors[Math.abs(B)%h.colors.length]}h.selectColor=u;function h(C){let B,N=null,H,te;function fe(...ce){if(!fe.enabled)return;const le=fe,ie=Number(new Date),ge=ie-(B||ie);le.diff=ge,le.prev=B,le.curr=ie,B=ie,ce[0]=h.coerce(ce[0]),typeof ce[0]!="string"&&ce.unshift("%O");let pe=0;ce[0]=ce[0].replace(/%([a-zA-Z%])/g,($e,Pe)=>{if($e==="%%")return"%";pe++;const Be=h.formatters[Pe];if(typeof Be=="function"){const Re=ce[pe];$e=Be.call(le,Re),ce.splice(pe,1),pe--}return $e}),h.formatArgs.call(le,ce),(le.log||h.log).apply(le,ce)}return fe.namespace=C,fe.useColors=h.useColors(),fe.color=h.selectColor(C),fe.extend=v,fe.destroy=h.destroy,Object.defineProperty(fe,"enabled",{enumerable:!0,configurable:!1,get:()=>N!==null?N:(H!==h.namespaces&&(H=h.namespaces,te=h.enabled(C)),te),set:ce=>{N=ce}}),typeof h.init=="function"&&h.init(fe),fe}function v(C,B){const N=h(this.namespace+(typeof B>"u"?":":B)+C);return N.log=this.log,N}function w(C){h.save(C),h.namespaces=C,h.names=[],h.skips=[];let B;const N=(typeof C=="string"?C:"").split(/[\s,]+/),H=N.length;for(B=0;B<H;B++)N[B]&&(C=N[B].replace(/\*/g,".*?"),C[0]==="-"?h.skips.push(new RegExp("^"+C.substr(1)+"$")):h.names.push(new RegExp("^"+C+"$")))}function b(){const C=[...h.names.map($),...h.skips.map($).map(B=>"-"+B)].join(",");return h.enable(""),C}function E(C){if(C[C.length-1]==="*")return!0;let B,N;for(B=0,N=h.skips.length;B<N;B++)if(h.skips[B].test(C))return!1;for(B=0,N=h.names.length;B<N;B++)if(h.names[B].test(C))return!0;return!1}function $(C){return C.toString().substring(2,C.toString().length-2).replace(/\.\*\?$/,"*")}function M(C){return C instanceof Error?C.stack??C.message:C}function T(){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 h.setupFormatters(h.formatters),h.enable(h.load()),h}const storage=localstorage(),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 useColors(){var y,u,h,v,w;return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&((y=navigator.userAgent)==null?void 0:y.toLowerCase().match(/(edge|trident)\/(\d+)/))!=null?!1:typeof document<"u"&&((h=(u=document.documentElement)==null?void 0:u.style)==null?void 0:h.WebkitAppearance)||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&((v=navigator.userAgent)==null?void 0:v.toLowerCase().match(/firefox\/(\d+)/))!=null&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&((w=navigator.userAgent)==null?void 0:w.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(y){if(y[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+y[0]+(this.useColors?"%c ":" ")+"+"+c(this.diff),!this.useColors)return;const u="color: "+this.color;y.splice(1,0,u,"color: inherit");let h=0,v=0;y[0].replace(/%[a-zA-Z%]/g,w=>{w!=="%%"&&(h++,w==="%c"&&(v=h))}),y.splice(v,0,u)}const log$5=console.debug??console.log??(()=>{});function save(y){try{y?storage==null||storage.setItem("debug",y):storage==null||storage.removeItem("debug")}catch{}}function load$1(){let y;try{y=storage==null?void 0:storage.getItem("debug")}catch{}return!y&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(y=globalThis.process.env.DEBUG),y}function localstorage(){try{return localStorage}catch{}}function setupFormatters(y){y.j=function(u){try{return JSON.stringify(u)}catch(h){return"[UnexpectedJSONParseError]: "+h.message}}}const weald=setup({formatArgs,save,load:load$1,useColors,setupFormatters,colors,storage,log:log$5});Tags.BOOTSTRAP;var cryptoBrowserify={},browser$b={exports:{}},safeBuffer$2={exports:{}},dist={};(function(y){Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var u={},h={};h.byteLength=C,h.toByteArray=N,h.fromByteArray=fe;for(var v=[],w=[],b=typeof Uint8Array<"u"?Uint8Array:Array,E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$=0,M=E.length;$<M;++$)v[$]=E[$],w[E.charCodeAt($)]=$;w[45]=62,w[95]=63;function T(ie){var ge=ie.length;if(ge%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var pe=ie.indexOf("=");pe===-1&&(pe=ge);var Me=pe===ge?0:4-pe%4;return[pe,Me]}function C(ie){var ge=T(ie),pe=ge[0],Me=ge[1];return(pe+Me)*3/4-Me}function B(ie,ge,pe){return(ge+pe)*3/4-pe}function N(ie){var ge,pe=T(ie),Me=pe[0],$e=pe[1],Pe=new b(B(ie,Me,$e)),Be=0,Re=$e>0?Me-4:Me,je;for(je=0;je<Re;je+=4)ge=w[ie.charCodeAt(je)]<<18|w[ie.charCodeAt(je+1)]<<12|w[ie.charCodeAt(je+2)]<<6|w[ie.charCodeAt(je+3)],Pe[Be++]=ge>>16&255,Pe[Be++]=ge>>8&255,Pe[Be++]=ge&255;return $e===2&&(ge=w[ie.charCodeAt(je)]<<2|w[ie.charCodeAt(je+1)]>>4,Pe[Be++]=ge&255),$e===1&&(ge=w[ie.charCodeAt(je)]<<10|w[ie.charCodeAt(je+1)]<<4|w[ie.charCodeAt(je+2)]>>2,Pe[Be++]=ge>>8&255,Pe[Be++]=ge&255),Pe}function H(ie){return v[ie>>18&63]+v[ie>>12&63]+v[ie>>6&63]+v[ie&63]}function te(ie,ge,pe){for(var Me,$e=[],Pe=ge;Pe<pe;Pe+=3)Me=(ie[Pe]<<16&16711680)+(ie[Pe+1]<<8&65280)+(ie[Pe+2]&255),$e.push(H(Me));return $e.join("")}function fe(ie){for(var ge,pe=ie.length,Me=pe%3,$e=[],Pe=16383,Be=0,Re=pe-Me;Be<Re;Be+=Pe)$e.push(te(ie,Be,Be+Pe>Re?Re:Be+Pe));return Me===1?(ge=ie[pe-1],$e.push(v[ge>>2]+v[ge<<4&63]+"==")):Me===2&&(ge=(ie[pe-2]<<8)+ie[pe-1],$e.push(v[ge>>10]+v[ge>>4&63]+v[ge<<2&63]+"=")),$e.join("")}var ce={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ce.read=function(ie,ge,pe,Me,$e){var Pe,Be,Re=$e*8-Me-1,je=(1<<Re)-1,we=je>>1,D=-7,q=pe?$e-1:0,O=pe?-1:1,L=ie[ge+q];for(q+=O,Pe=L&(1<<-D)-1,L>>=-D,D+=Re;D>0;Pe=Pe*256+ie[ge+q],q+=O,D-=8);for(Be=Pe&(1<<-D)-1,Pe>>=-D,D+=Me;D>0;Be=Be*256+ie[ge+q],q+=O,D-=8);if(Pe===0)Pe=1-we;else{if(Pe===je)return Be?NaN:(L?-1:1)*(1/0);Be=Be+Math.pow(2,Me),Pe=Pe-we}return(L?-1:1)*Be*Math.pow(2,Pe-Me)},ce.write=function(ie,ge,pe,Me,$e,Pe){var Be,Re,je,we=Pe*8-$e-1,D=(1<<we)-1,q=D>>1,O=$e===23?Math.pow(2,-24)-Math.pow(2,-77):0,L=Me?0:Pe-1,X=Me?1:-1,j=ge<0||ge===0&&1/ge<0?1:0;for(ge=Math.abs(ge),isNaN(ge)||ge===1/0?(Re=isNaN(ge)?1:0,Be=D):(Be=Math.floor(Math.log(ge)/Math.LN2),ge*(je=Math.pow(2,-Be))<1&&(Be--,je*=2),Be+q>=1?ge+=O/je:ge+=O*Math.pow(2,1-q),ge*je>=2&&(Be++,je/=2),Be+q>=D?(Re=0,Be=D):Be+q>=1?(Re=(ge*je-1)*Math.pow(2,$e),Be=Be+q):(Re=ge*Math.pow(2,q-1)*Math.pow(2,$e),Be=0));$e>=8;ie[pe+L]=Re&255,L+=X,Re/=256,$e-=8);for(Be=Be<<$e|Re,we+=$e;we>0;ie[pe+L]=Be&255,L+=X,Be/=256,we-=8);ie[pe+L-X]|=j*128};/*!
|
|
12
|
-
* The buffer module from node.js, for the browser.
|
|
13
|
-
*
|
|
14
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
15
|
-
* @license MIT
|
|
16
|
-
*/(function(ie){const ge=h,pe=ce,Me=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ie.Buffer=D,ie.SlowBuffer=he,ie.INSPECT_MAX_BYTES=50;const $e=2147483647;ie.kMaxLength=$e;const{Uint8Array:Pe,ArrayBuffer:Be,SharedArrayBuffer:Re}=globalThis;D.TYPED_ARRAY_SUPPORT=je(),!D.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 je(){try{const ve=new Pe(1),J={foo:function(){return 42}};return Object.setPrototypeOf(J,Pe.prototype),Object.setPrototypeOf(ve,J),ve.foo()===42}catch{return!1}}Object.defineProperty(D.prototype,"parent",{enumerable:!0,get:function(){if(D.isBuffer(this))return this.buffer}}),Object.defineProperty(D.prototype,"offset",{enumerable:!0,get:function(){if(D.isBuffer(this))return this.byteOffset}});function we(ve){if(ve>$e)throw new RangeError('The value "'+ve+'" is invalid for option "size"');const J=new Pe(ve);return Object.setPrototypeOf(J,D.prototype),J}function D(ve,J,se){if(typeof ve=="number"){if(typeof J=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return X(ve)}return q(ve,J,se)}D.poolSize=8192;function q(ve,J,se){if(typeof ve=="string")return j(ve,J);if(Be.isView(ve))return ee(ve);if(ve==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof ve);if(kt(ve,Be)||ve&&kt(ve.buffer,Be)||typeof Re<"u"&&(kt(ve,Re)||ve&&kt(ve.buffer,Re)))return F(ve,J,se);if(typeof ve=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const xe=ve.valueOf&&ve.valueOf();if(xe!=null&&xe!==ve)return D.from(xe,J,se);const ke=Q(ve);if(ke)return ke;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof ve[Symbol.toPrimitive]=="function")return D.from(ve[Symbol.toPrimitive]("string"),J,se);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof ve)}D.from=function(ve,J,se){return q(ve,J,se)},Object.setPrototypeOf(D.prototype,Pe.prototype),Object.setPrototypeOf(D,Pe);function O(ve){if(typeof ve!="number")throw new TypeError('"size" argument must be of type number');if(ve<0)throw new RangeError('The value "'+ve+'" is invalid for option "size"')}function L(ve,J,se){return O(ve),ve<=0?we(ve):J!==void 0?typeof se=="string"?we(ve).fill(J,se):we(ve).fill(J):we(ve)}D.alloc=function(ve,J,se){return L(ve,J,se)};function X(ve){return O(ve),we(ve<0?0:U(ve)|0)}D.allocUnsafe=function(ve){return X(ve)},D.allocUnsafeSlow=function(ve){return X(ve)};function j(ve,J){if((typeof J!="string"||J==="")&&(J="utf8"),!D.isEncoding(J))throw new TypeError("Unknown encoding: "+J);const se=Oe(ve,J)|0;let xe=we(se);const ke=xe.write(ve,J);return ke!==se&&(xe=xe.slice(0,ke)),xe}function re(ve){const J=ve.length<0?0:U(ve.length)|0,se=we(J);for(let xe=0;xe<J;xe+=1)se[xe]=ve[xe]&255;return se}function ee(ve){if(kt(ve,Pe)){const J=new Pe(ve);return F(J.buffer,J.byteOffset,J.byteLength)}return re(ve)}function F(ve,J,se){if(J<0||ve.byteLength<J)throw new RangeError('"offset" is outside of buffer bounds');if(ve.byteLength<J+(se||0))throw new RangeError('"length" is outside of buffer bounds');let xe;return J===void 0&&se===void 0?xe=new Pe(ve):se===void 0?xe=new Pe(ve,J):xe=new Pe(ve,J,se),Object.setPrototypeOf(xe,D.prototype),xe}function Q(ve){if(D.isBuffer(ve)){const J=U(ve.length)|0,se=we(J);return se.length===0||ve.copy(se,0,0,J),se}if(ve.length!==void 0)return typeof ve.length!="number"||Kt(ve.length)?we(0):re(ve);if(ve.type==="Buffer"&&Array.isArray(ve.data))return re(ve.data)}function U(ve){if(ve>=$e)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+$e.toString(16)+" bytes");return ve|0}function he(ve){return+ve!=ve&&(ve=0),D.alloc(+ve)}D.isBuffer=function(J){return J!=null&&J._isBuffer===!0&&J!==D.prototype},D.compare=function(J,se){if(kt(J,Pe)&&(J=D.from(J,J.offset,J.byteLength)),kt(se,Pe)&&(se=D.from(se,se.offset,se.byteLength)),!D.isBuffer(J)||!D.isBuffer(se))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(J===se)return 0;let xe=J.length,ke=se.length;for(let qe=0,We=Math.min(xe,ke);qe<We;++qe)if(J[qe]!==se[qe]){xe=J[qe],ke=se[qe];break}return xe<ke?-1:ke<xe?1:0},D.isEncoding=function(J){switch(String(J).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}},D.concat=function(J,se){if(!Array.isArray(J))throw new TypeError('"list" argument must be an Array of Buffers');if(J.length===0)return D.alloc(0);let xe;if(se===void 0)for(se=0,xe=0;xe<J.length;++xe)se+=J[xe].length;const ke=D.allocUnsafe(se);let qe=0;for(xe=0;xe<J.length;++xe){let We=J[xe];if(kt(We,Pe))qe+We.length>ke.length?(D.isBuffer(We)||(We=D.from(We)),We.copy(ke,qe)):Pe.prototype.set.call(ke,We,qe);else if(D.isBuffer(We))We.copy(ke,qe);else throw new TypeError('"list" argument must be an Array of Buffers');qe+=We.length}return ke};function Oe(ve,J){if(D.isBuffer(ve))return ve.length;if(Be.isView(ve)||kt(ve,Be))return ve.byteLength;if(typeof ve!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof ve);const se=ve.length,xe=arguments.length>2&&arguments[2]===!0;if(!xe&&se===0)return 0;let ke=!1;for(;;)switch(J){case"ascii":case"latin1":case"binary":return se;case"utf8":case"utf-8":return Wt(ve).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return se*2;case"hex":return se>>>1;case"base64":return Gt(ve).length;default:if(ke)return xe?-1:Wt(ve).length;J=(""+J).toLowerCase(),ke=!0}}D.byteLength=Oe;function Ve(ve,J,se){let xe=!1;if((J===void 0||J<0)&&(J=0),J>this.length||((se===void 0||se>this.length)&&(se=this.length),se<=0)||(se>>>=0,J>>>=0,se<=J))return"";for(ve||(ve="utf8");;)switch(ve){case"hex":return nt(this,J,se);case"utf8":case"utf-8":return Le(this,J,se);case"ascii":return tt(this,J,se);case"latin1":case"binary":return Ne(this,J,se);case"base64":return Ie(this,J,se);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return it(this,J,se);default:if(xe)throw new TypeError("Unknown encoding: "+ve);ve=(ve+"").toLowerCase(),xe=!0}}D.prototype._isBuffer=!0;function Ae(ve,J,se){const xe=ve[J];ve[J]=ve[se],ve[se]=xe}D.prototype.swap16=function(){const J=this.length;if(J%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let se=0;se<J;se+=2)Ae(this,se,se+1);return this},D.prototype.swap32=function(){const J=this.length;if(J%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let se=0;se<J;se+=4)Ae(this,se,se+3),Ae(this,se+1,se+2);return this},D.prototype.swap64=function(){const J=this.length;if(J%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let se=0;se<J;se+=8)Ae(this,se,se+7),Ae(this,se+1,se+6),Ae(this,se+2,se+5),Ae(this,se+3,se+4);return this},D.prototype.toString=function(){const J=this.length;return J===0?"":arguments.length===0?Le(this,0,J):Ve.apply(this,arguments)},D.prototype.toLocaleString=D.prototype.toString,D.prototype.equals=function(J){if(!D.isBuffer(J))throw new TypeError("Argument must be a Buffer");return this===J?!0:D.compare(this,J)===0},D.prototype.inspect=function(){let J="";const se=ie.INSPECT_MAX_BYTES;return J=this.toString("hex",0,se).replace(/(.{2})/g,"$1 ").trim(),this.length>se&&(J+=" ... "),"<Buffer "+J+">"},Me&&(D.prototype[Me]=D.prototype.inspect),D.prototype.compare=function(J,se,xe,ke,qe){if(kt(J,Pe)&&(J=D.from(J,J.offset,J.byteLength)),!D.isBuffer(J))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof J);if(se===void 0&&(se=0),xe===void 0&&(xe=J?J.length:0),ke===void 0&&(ke=0),qe===void 0&&(qe=this.length),se<0||xe>J.length||ke<0||qe>this.length)throw new RangeError("out of range index");if(ke>=qe&&se>=xe)return 0;if(ke>=qe)return-1;if(se>=xe)return 1;if(se>>>=0,xe>>>=0,ke>>>=0,qe>>>=0,this===J)return 0;let We=qe-ke,ct=xe-se;const wt=Math.min(We,ct),st=this.slice(ke,qe),xt=J.slice(se,xe);for(let mt=0;mt<wt;++mt)if(st[mt]!==xt[mt]){We=st[mt],ct=xt[mt];break}return We<ct?-1:ct<We?1:0};function oe(ve,J,se,xe,ke){if(ve.length===0)return-1;if(typeof se=="string"?(xe=se,se=0):se>2147483647?se=2147483647:se<-2147483648&&(se=-2147483648),se=+se,Kt(se)&&(se=ke?0:ve.length-1),se<0&&(se=ve.length+se),se>=ve.length){if(ke)return-1;se=ve.length-1}else if(se<0)if(ke)se=0;else return-1;if(typeof J=="string"&&(J=D.from(J,xe)),D.isBuffer(J))return J.length===0?-1:ye(ve,J,se,xe,ke);if(typeof J=="number")return J=J&255,typeof Pe.prototype.indexOf=="function"?ke?Pe.prototype.indexOf.call(ve,J,se):Pe.prototype.lastIndexOf.call(ve,J,se):ye(ve,[J],se,xe,ke);throw new TypeError("val must be string, number or Buffer")}function ye(ve,J,se,xe,ke){let qe=1,We=ve.length,ct=J.length;if(xe!==void 0&&(xe=String(xe).toLowerCase(),xe==="ucs2"||xe==="ucs-2"||xe==="utf16le"||xe==="utf-16le")){if(ve.length<2||J.length<2)return-1;qe=2,We/=2,ct/=2,se/=2}function wt(xt,mt){return qe===1?xt[mt]:xt.readUInt16BE(mt*qe)}let st;if(ke){let xt=-1;for(st=se;st<We;st++)if(wt(ve,st)===wt(J,xt===-1?0:st-xt)){if(xt===-1&&(xt=st),st-xt+1===ct)return xt*qe}else xt!==-1&&(st-=st-xt),xt=-1}else for(se+ct>We&&(se=We-ct),st=se;st>=0;st--){let xt=!0;for(let mt=0;mt<ct;mt++)if(wt(ve,st+mt)!==wt(J,mt)){xt=!1;break}if(xt)return st}return-1}D.prototype.includes=function(J,se,xe){return this.indexOf(J,se,xe)!==-1},D.prototype.indexOf=function(J,se,xe){return oe(this,J,se,xe,!0)},D.prototype.lastIndexOf=function(J,se,xe){return oe(this,J,se,xe,!1)};function Ce(ve,J,se,xe){se=Number(se)||0;const ke=ve.length-se;xe?(xe=Number(xe),xe>ke&&(xe=ke)):xe=ke;const qe=J.length;xe>qe/2&&(xe=qe/2);let We;for(We=0;We<xe;++We){const ct=parseInt(J.substr(We*2,2),16);if(Kt(ct))return We;ve[se+We]=ct}return We}function ae(ve,J,se,xe){return vt(Wt(J,ve.length-se),ve,se,xe)}function de(ve,J,se,xe){return vt($t(J),ve,se,xe)}function ne(ve,J,se,xe){return vt(Gt(J),ve,se,xe)}function be(ve,J,se,xe){return vt(Qt(J,ve.length-se),ve,se,xe)}D.prototype.write=function(J,se,xe,ke){if(se===void 0)ke="utf8",xe=this.length,se=0;else if(xe===void 0&&typeof se=="string")ke=se,xe=this.length,se=0;else if(isFinite(se))se=se>>>0,isFinite(xe)?(xe=xe>>>0,ke===void 0&&(ke="utf8")):(ke=xe,xe=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const qe=this.length-se;if((xe===void 0||xe>qe)&&(xe=qe),J.length>0&&(xe<0||se<0)||se>this.length)throw new RangeError("Attempt to write outside buffer bounds");ke||(ke="utf8");let We=!1;for(;;)switch(ke){case"hex":return Ce(this,J,se,xe);case"utf8":case"utf-8":return ae(this,J,se,xe);case"ascii":case"latin1":case"binary":return de(this,J,se,xe);case"base64":return ne(this,J,se,xe);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return be(this,J,se,xe);default:if(We)throw new TypeError("Unknown encoding: "+ke);ke=(""+ke).toLowerCase(),We=!0}},D.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ie(ve,J,se){return J===0&&se===ve.length?ge.fromByteArray(ve):ge.fromByteArray(ve.slice(J,se))}function Le(ve,J,se){se=Math.min(ve.length,se);const xe=[];let ke=J;for(;ke<se;){const qe=ve[ke];let We=null,ct=qe>239?4:qe>223?3:qe>191?2:1;if(ke+ct<=se){let wt,st,xt,mt;switch(ct){case 1:qe<128&&(We=qe);break;case 2:wt=ve[ke+1],(wt&192)===128&&(mt=(qe&31)<<6|wt&63,mt>127&&(We=mt));break;case 3:wt=ve[ke+1],st=ve[ke+2],(wt&192)===128&&(st&192)===128&&(mt=(qe&15)<<12|(wt&63)<<6|st&63,mt>2047&&(mt<55296||mt>57343)&&(We=mt));break;case 4:wt=ve[ke+1],st=ve[ke+2],xt=ve[ke+3],(wt&192)===128&&(st&192)===128&&(xt&192)===128&&(mt=(qe&15)<<18|(wt&63)<<12|(st&63)<<6|xt&63,mt>65535&&mt<1114112&&(We=mt))}}We===null?(We=65533,ct=1):We>65535&&(We-=65536,xe.push(We>>>10&1023|55296),We=56320|We&1023),xe.push(We),ke+=ct}return He(xe)}const Fe=4096;function He(ve){const J=ve.length;if(J<=Fe)return String.fromCharCode.apply(String,ve);let se="",xe=0;for(;xe<J;)se+=String.fromCharCode.apply(String,ve.slice(xe,xe+=Fe));return se}function tt(ve,J,se){let xe="";se=Math.min(ve.length,se);for(let ke=J;ke<se;++ke)xe+=String.fromCharCode(ve[ke]&127);return xe}function Ne(ve,J,se){let xe="";se=Math.min(ve.length,se);for(let ke=J;ke<se;++ke)xe+=String.fromCharCode(ve[ke]);return xe}function nt(ve,J,se){const xe=ve.length;(!J||J<0)&&(J=0),(!se||se<0||se>xe)&&(se=xe);let ke="";for(let qe=J;qe<se;++qe)ke+=At[ve[qe]];return ke}function it(ve,J,se){const xe=ve.slice(J,se);let ke="";for(let qe=0;qe<xe.length-1;qe+=2)ke+=String.fromCharCode(xe[qe]+xe[qe+1]*256);return ke}D.prototype.slice=function(J,se){const xe=this.length;J=~~J,se=se===void 0?xe:~~se,J<0?(J+=xe,J<0&&(J=0)):J>xe&&(J=xe),se<0?(se+=xe,se<0&&(se=0)):se>xe&&(se=xe),se<J&&(se=J);const ke=this.subarray(J,se);return Object.setPrototypeOf(ke,D.prototype),ke};function ot(ve,J,se){if(ve%1!==0||ve<0)throw new RangeError("offset is not uint");if(ve+J>se)throw new RangeError("Trying to access beyond buffer length")}D.prototype.readUintLE=D.prototype.readUIntLE=function(J,se,xe){J=J>>>0,se=se>>>0,xe||ot(J,se,this.length);let ke=this[J],qe=1,We=0;for(;++We<se&&(qe*=256);)ke+=this[J+We]*qe;return ke},D.prototype.readUintBE=D.prototype.readUIntBE=function(J,se,xe){J=J>>>0,se=se>>>0,xe||ot(J,se,this.length);let ke=this[J+--se],qe=1;for(;se>0&&(qe*=256);)ke+=this[J+--se]*qe;return ke},D.prototype.readUint8=D.prototype.readUInt8=function(J,se){return J=J>>>0,se||ot(J,1,this.length),this[J]},D.prototype.readUint16LE=D.prototype.readUInt16LE=function(J,se){return J=J>>>0,se||ot(J,2,this.length),this[J]|this[J+1]<<8},D.prototype.readUint16BE=D.prototype.readUInt16BE=function(J,se){return J=J>>>0,se||ot(J,2,this.length),this[J]<<8|this[J+1]},D.prototype.readUint32LE=D.prototype.readUInt32LE=function(J,se){return J=J>>>0,se||ot(J,4,this.length),(this[J]|this[J+1]<<8|this[J+2]<<16)+this[J+3]*16777216},D.prototype.readUint32BE=D.prototype.readUInt32BE=function(J,se){return J=J>>>0,se||ot(J,4,this.length),this[J]*16777216+(this[J+1]<<16|this[J+2]<<8|this[J+3])},D.prototype.readBigUInt64LE=Ft(function(J){J=J>>>0,Lt(J,"offset");const se=this[J],xe=this[J+7];(se===void 0||xe===void 0)&&Nt(J,this.length-8);const ke=se+this[++J]*2**8+this[++J]*2**16+this[++J]*2**24,qe=this[++J]+this[++J]*2**8+this[++J]*2**16+xe*2**24;return BigInt(ke)+(BigInt(qe)<<BigInt(32))}),D.prototype.readBigUInt64BE=Ft(function(J){J=J>>>0,Lt(J,"offset");const se=this[J],xe=this[J+7];(se===void 0||xe===void 0)&&Nt(J,this.length-8);const ke=se*2**24+this[++J]*2**16+this[++J]*2**8+this[++J],qe=this[++J]*2**24+this[++J]*2**16+this[++J]*2**8+xe;return(BigInt(ke)<<BigInt(32))+BigInt(qe)}),D.prototype.readIntLE=function(J,se,xe){J=J>>>0,se=se>>>0,xe||ot(J,se,this.length);let ke=this[J],qe=1,We=0;for(;++We<se&&(qe*=256);)ke+=this[J+We]*qe;return qe*=128,ke>=qe&&(ke-=Math.pow(2,8*se)),ke},D.prototype.readIntBE=function(J,se,xe){J=J>>>0,se=se>>>0,xe||ot(J,se,this.length);let ke=se,qe=1,We=this[J+--ke];for(;ke>0&&(qe*=256);)We+=this[J+--ke]*qe;return qe*=128,We>=qe&&(We-=Math.pow(2,8*se)),We},D.prototype.readInt8=function(J,se){return J=J>>>0,se||ot(J,1,this.length),this[J]&128?(255-this[J]+1)*-1:this[J]},D.prototype.readInt16LE=function(J,se){J=J>>>0,se||ot(J,2,this.length);const xe=this[J]|this[J+1]<<8;return xe&32768?xe|4294901760:xe},D.prototype.readInt16BE=function(J,se){J=J>>>0,se||ot(J,2,this.length);const xe=this[J+1]|this[J]<<8;return xe&32768?xe|4294901760:xe},D.prototype.readInt32LE=function(J,se){return J=J>>>0,se||ot(J,4,this.length),this[J]|this[J+1]<<8|this[J+2]<<16|this[J+3]<<24},D.prototype.readInt32BE=function(J,se){return J=J>>>0,se||ot(J,4,this.length),this[J]<<24|this[J+1]<<16|this[J+2]<<8|this[J+3]},D.prototype.readBigInt64LE=Ft(function(J){J=J>>>0,Lt(J,"offset");const se=this[J],xe=this[J+7];(se===void 0||xe===void 0)&&Nt(J,this.length-8);const ke=this[J+4]+this[J+5]*2**8+this[J+6]*2**16+(xe<<24);return(BigInt(ke)<<BigInt(32))+BigInt(se+this[++J]*2**8+this[++J]*2**16+this[++J]*2**24)}),D.prototype.readBigInt64BE=Ft(function(J){J=J>>>0,Lt(J,"offset");const se=this[J],xe=this[J+7];(se===void 0||xe===void 0)&&Nt(J,this.length-8);const ke=(se<<24)+this[++J]*2**16+this[++J]*2**8+this[++J];return(BigInt(ke)<<BigInt(32))+BigInt(this[++J]*2**24+this[++J]*2**16+this[++J]*2**8+xe)}),D.prototype.readFloatLE=function(J,se){return J=J>>>0,se||ot(J,4,this.length),pe.read(this,J,!0,23,4)},D.prototype.readFloatBE=function(J,se){return J=J>>>0,se||ot(J,4,this.length),pe.read(this,J,!1,23,4)},D.prototype.readDoubleLE=function(J,se){return J=J>>>0,se||ot(J,8,this.length),pe.read(this,J,!0,52,8)},D.prototype.readDoubleBE=function(J,se){return J=J>>>0,se||ot(J,8,this.length),pe.read(this,J,!1,52,8)};function ut(ve,J,se,xe,ke,qe){if(!D.isBuffer(ve))throw new TypeError('"buffer" argument must be a Buffer instance');if(J>ke||J<qe)throw new RangeError('"value" argument is out of bounds');if(se+xe>ve.length)throw new RangeError("Index out of range")}D.prototype.writeUintLE=D.prototype.writeUIntLE=function(J,se,xe,ke){if(J=+J,se=se>>>0,xe=xe>>>0,!ke){const ct=Math.pow(2,8*xe)-1;ut(this,J,se,xe,ct,0)}let qe=1,We=0;for(this[se]=J&255;++We<xe&&(qe*=256);)this[se+We]=J/qe&255;return se+xe},D.prototype.writeUintBE=D.prototype.writeUIntBE=function(J,se,xe,ke){if(J=+J,se=se>>>0,xe=xe>>>0,!ke){const ct=Math.pow(2,8*xe)-1;ut(this,J,se,xe,ct,0)}let qe=xe-1,We=1;for(this[se+qe]=J&255;--qe>=0&&(We*=256);)this[se+qe]=J/We&255;return se+xe},D.prototype.writeUint8=D.prototype.writeUInt8=function(J,se,xe){return J=+J,se=se>>>0,xe||ut(this,J,se,1,255,0),this[se]=J&255,se+1},D.prototype.writeUint16LE=D.prototype.writeUInt16LE=function(J,se,xe){return J=+J,se=se>>>0,xe||ut(this,J,se,2,65535,0),this[se]=J&255,this[se+1]=J>>>8,se+2},D.prototype.writeUint16BE=D.prototype.writeUInt16BE=function(J,se,xe){return J=+J,se=se>>>0,xe||ut(this,J,se,2,65535,0),this[se]=J>>>8,this[se+1]=J&255,se+2},D.prototype.writeUint32LE=D.prototype.writeUInt32LE=function(J,se,xe){return J=+J,se=se>>>0,xe||ut(this,J,se,4,4294967295,0),this[se+3]=J>>>24,this[se+2]=J>>>16,this[se+1]=J>>>8,this[se]=J&255,se+4},D.prototype.writeUint32BE=D.prototype.writeUInt32BE=function(J,se,xe){return J=+J,se=se>>>0,xe||ut(this,J,se,4,4294967295,0),this[se]=J>>>24,this[se+1]=J>>>16,this[se+2]=J>>>8,this[se+3]=J&255,se+4};function ht(ve,J,se,xe,ke){bt(J,xe,ke,ve,se,7);let qe=Number(J&BigInt(4294967295));ve[se++]=qe,qe=qe>>8,ve[se++]=qe,qe=qe>>8,ve[se++]=qe,qe=qe>>8,ve[se++]=qe;let We=Number(J>>BigInt(32)&BigInt(4294967295));return ve[se++]=We,We=We>>8,ve[se++]=We,We=We>>8,ve[se++]=We,We=We>>8,ve[se++]=We,se}function St(ve,J,se,xe,ke){bt(J,xe,ke,ve,se,7);let qe=Number(J&BigInt(4294967295));ve[se+7]=qe,qe=qe>>8,ve[se+6]=qe,qe=qe>>8,ve[se+5]=qe,qe=qe>>8,ve[se+4]=qe;let We=Number(J>>BigInt(32)&BigInt(4294967295));return ve[se+3]=We,We=We>>8,ve[se+2]=We,We=We>>8,ve[se+1]=We,We=We>>8,ve[se]=We,se+8}D.prototype.writeBigUInt64LE=Ft(function(J,se=0){return ht(this,J,se,BigInt(0),BigInt("0xffffffffffffffff"))}),D.prototype.writeBigUInt64BE=Ft(function(J,se=0){return St(this,J,se,BigInt(0),BigInt("0xffffffffffffffff"))}),D.prototype.writeIntLE=function(J,se,xe,ke){if(J=+J,se=se>>>0,!ke){const wt=Math.pow(2,8*xe-1);ut(this,J,se,xe,wt-1,-wt)}let qe=0,We=1,ct=0;for(this[se]=J&255;++qe<xe&&(We*=256);)J<0&&ct===0&&this[se+qe-1]!==0&&(ct=1),this[se+qe]=(J/We>>0)-ct&255;return se+xe},D.prototype.writeIntBE=function(J,se,xe,ke){if(J=+J,se=se>>>0,!ke){const wt=Math.pow(2,8*xe-1);ut(this,J,se,xe,wt-1,-wt)}let qe=xe-1,We=1,ct=0;for(this[se+qe]=J&255;--qe>=0&&(We*=256);)J<0&&ct===0&&this[se+qe+1]!==0&&(ct=1),this[se+qe]=(J/We>>0)-ct&255;return se+xe},D.prototype.writeInt8=function(J,se,xe){return J=+J,se=se>>>0,xe||ut(this,J,se,1,127,-128),J<0&&(J=255+J+1),this[se]=J&255,se+1},D.prototype.writeInt16LE=function(J,se,xe){return J=+J,se=se>>>0,xe||ut(this,J,se,2,32767,-32768),this[se]=J&255,this[se+1]=J>>>8,se+2},D.prototype.writeInt16BE=function(J,se,xe){return J=+J,se=se>>>0,xe||ut(this,J,se,2,32767,-32768),this[se]=J>>>8,this[se+1]=J&255,se+2},D.prototype.writeInt32LE=function(J,se,xe){return J=+J,se=se>>>0,xe||ut(this,J,se,4,2147483647,-2147483648),this[se]=J&255,this[se+1]=J>>>8,this[se+2]=J>>>16,this[se+3]=J>>>24,se+4},D.prototype.writeInt32BE=function(J,se,xe){return J=+J,se=se>>>0,xe||ut(this,J,se,4,2147483647,-2147483648),J<0&&(J=4294967295+J+1),this[se]=J>>>24,this[se+1]=J>>>16,this[se+2]=J>>>8,this[se+3]=J&255,se+4},D.prototype.writeBigInt64LE=Ft(function(J,se=0){return ht(this,J,se,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),D.prototype.writeBigInt64BE=Ft(function(J,se=0){return St(this,J,se,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Rt(ve,J,se,xe,ke,qe){if(se+xe>ve.length)throw new RangeError("Index out of range");if(se<0)throw new RangeError("Index out of range")}function dt(ve,J,se,xe,ke){return J=+J,se=se>>>0,ke||Rt(ve,J,se,4),pe.write(ve,J,se,xe,23,4),se+4}D.prototype.writeFloatLE=function(J,se,xe){return dt(this,J,se,!0,xe)},D.prototype.writeFloatBE=function(J,se,xe){return dt(this,J,se,!1,xe)};function Ct(ve,J,se,xe,ke){return J=+J,se=se>>>0,ke||Rt(ve,J,se,8),pe.write(ve,J,se,xe,52,8),se+8}D.prototype.writeDoubleLE=function(J,se,xe){return Ct(this,J,se,!0,xe)},D.prototype.writeDoubleBE=function(J,se,xe){return Ct(this,J,se,!1,xe)},D.prototype.copy=function(J,se,xe,ke){if(!D.isBuffer(J))throw new TypeError("argument should be a Buffer");if(xe||(xe=0),!ke&&ke!==0&&(ke=this.length),se>=J.length&&(se=J.length),se||(se=0),ke>0&&ke<xe&&(ke=xe),ke===xe||J.length===0||this.length===0)return 0;if(se<0)throw new RangeError("targetStart out of bounds");if(xe<0||xe>=this.length)throw new RangeError("Index out of range");if(ke<0)throw new RangeError("sourceEnd out of bounds");ke>this.length&&(ke=this.length),J.length-se<ke-xe&&(ke=J.length-se+xe);const qe=ke-xe;return this===J&&typeof Pe.prototype.copyWithin=="function"?this.copyWithin(se,xe,ke):Pe.prototype.set.call(J,this.subarray(xe,ke),se),qe},D.prototype.fill=function(J,se,xe,ke){if(typeof J=="string"){if(typeof se=="string"?(ke=se,se=0,xe=this.length):typeof xe=="string"&&(ke=xe,xe=this.length),ke!==void 0&&typeof ke!="string")throw new TypeError("encoding must be a string");if(typeof ke=="string"&&!D.isEncoding(ke))throw new TypeError("Unknown encoding: "+ke);if(J.length===1){const We=J.charCodeAt(0);(ke==="utf8"&&We<128||ke==="latin1")&&(J=We)}}else typeof J=="number"?J=J&255:typeof J=="boolean"&&(J=Number(J));if(se<0||this.length<se||this.length<xe)throw new RangeError("Out of range index");if(xe<=se)return this;se=se>>>0,xe=xe===void 0?this.length:xe>>>0,J||(J=0);let qe;if(typeof J=="number")for(qe=se;qe<xe;++qe)this[qe]=J;else{const We=D.isBuffer(J)?J:D.from(J,ke),ct=We.length;if(ct===0)throw new TypeError('The value "'+J+'" is invalid for argument "value"');for(qe=0;qe<xe-se;++qe)this[qe+se]=We[qe%ct]}return this};const Dt={};function yt(ve,J,se){Dt[ve]=class extends se{constructor(){super(),Object.defineProperty(this,"message",{value:J.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${ve}]`,this.stack,delete this.name}get code(){return ve}set code(ke){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:ke,writable:!0})}toString(){return`${this.name} [${ve}]: ${this.message}`}}}yt("ERR_BUFFER_OUT_OF_BOUNDS",function(ve){return ve?`${ve} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),yt("ERR_INVALID_ARG_TYPE",function(ve,J){return`The "${ve}" argument must be of type number. Received type ${typeof J}`},TypeError),yt("ERR_OUT_OF_RANGE",function(ve,J,se){let xe=`The value of "${ve}" is out of range.`,ke=se;return Number.isInteger(se)&&Math.abs(se)>2**32?ke=zt(String(se)):typeof se=="bigint"&&(ke=String(se),(se>BigInt(2)**BigInt(32)||se<-(BigInt(2)**BigInt(32)))&&(ke=zt(ke)),ke+="n"),xe+=` It must be ${J}. Received ${ke}`,xe},RangeError);function zt(ve){let J="",se=ve.length;const xe=ve[0]==="-"?1:0;for(;se>=xe+4;se-=3)J=`_${ve.slice(se-3,se)}${J}`;return`${ve.slice(0,se)}${J}`}function Zt(ve,J,se){Lt(J,"offset"),(ve[J]===void 0||ve[J+se]===void 0)&&Nt(J,ve.length-(se+1))}function bt(ve,J,se,xe,ke,qe){if(ve>se||ve<J){const We=typeof J=="bigint"?"n":"";let ct;throw J===0||J===BigInt(0)?ct=`>= 0${We} and < 2${We} ** ${(qe+1)*8}${We}`:ct=`>= -(2${We} ** ${(qe+1)*8-1}${We}) and < 2 ** ${(qe+1)*8-1}${We}`,new Dt.ERR_OUT_OF_RANGE("value",ct,ve)}Zt(xe,ke,qe)}function Lt(ve,J){if(typeof ve!="number")throw new Dt.ERR_INVALID_ARG_TYPE(J,"number",ve)}function Nt(ve,J,se){throw Math.floor(ve)!==ve?(Lt(ve,se),new Dt.ERR_OUT_OF_RANGE("offset","an integer",ve)):J<0?new Dt.ERR_BUFFER_OUT_OF_BOUNDS:new Dt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${J}`,ve)}const _t=/[^+/0-9A-Za-z-_]/g;function Vt(ve){if(ve=ve.split("=")[0],ve=ve.trim().replace(_t,""),ve.length<2)return"";for(;ve.length%4!==0;)ve=ve+"=";return ve}function Wt(ve,J){J=J||1/0;let se;const xe=ve.length;let ke=null;const qe=[];for(let We=0;We<xe;++We){if(se=ve.charCodeAt(We),se>55295&&se<57344){if(!ke){if(se>56319){(J-=3)>-1&&qe.push(239,191,189);continue}else if(We+1===xe){(J-=3)>-1&&qe.push(239,191,189);continue}ke=se;continue}if(se<56320){(J-=3)>-1&&qe.push(239,191,189),ke=se;continue}se=(ke-55296<<10|se-56320)+65536}else ke&&(J-=3)>-1&&qe.push(239,191,189);if(ke=null,se<128){if((J-=1)<0)break;qe.push(se)}else if(se<2048){if((J-=2)<0)break;qe.push(se>>6|192,se&63|128)}else if(se<65536){if((J-=3)<0)break;qe.push(se>>12|224,se>>6&63|128,se&63|128)}else if(se<1114112){if((J-=4)<0)break;qe.push(se>>18|240,se>>12&63|128,se>>6&63|128,se&63|128)}else throw new Error("Invalid code point")}return qe}function $t(ve){const J=[];for(let se=0;se<ve.length;++se)J.push(ve.charCodeAt(se)&255);return J}function Qt(ve,J){let se,xe,ke;const qe=[];for(let We=0;We<ve.length&&!((J-=2)<0);++We)se=ve.charCodeAt(We),xe=se>>8,ke=se%256,qe.push(ke),qe.push(xe);return qe}function Gt(ve){return ge.toByteArray(Vt(ve))}function vt(ve,J,se,xe){let ke;for(ke=0;ke<xe&&!(ke+se>=J.length||ke>=ve.length);++ke)J[ke+se]=ve[ke];return ke}function kt(ve,J){return ve instanceof J||ve!=null&&ve.constructor!=null&&ve.constructor.name!=null&&ve.constructor.name===J.name}function Kt(ve){return ve!==ve}const At=function(){const ve="0123456789abcdef",J=new Array(256);for(let se=0;se<16;++se){const xe=se*16;for(let ke=0;ke<16;++ke)J[xe+ke]=ve[se]+ve[ke]}return J}();function Ft(ve){return typeof BigInt>"u"?Jt:ve}function Jt(){throw new Error("BigInt not supported")}})(u);const le=u.Buffer;y.Buffer=u.Buffer,y.default=le})(dist);const Buffer$C=getDefaultExportFromCjs$1(dist);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(y,u){var h=dist,v=h.Buffer;function w(E,$){for(var M in E)$[M]=E[M]}v.from&&v.alloc&&v.allocUnsafe&&v.allocUnsafeSlow?y.exports=h:(w(h,u),u.Buffer=b);function b(E,$,M){return v(E,$,M)}b.prototype=Object.create(v.prototype),w(v,b),b.from=function(E,$,M){if(typeof E=="number")throw new TypeError("Argument must not be a number");return v(E,$,M)},b.alloc=function(E,$,M){if(typeof E!="number")throw new TypeError("Argument must be a number");var T=v(E);return $!==void 0?typeof M=="string"?T.fill($,M):T.fill($):T.fill(0),T},b.allocUnsafe=function(E){if(typeof E!="number")throw new TypeError("Argument must be a number");return v(E)},b.allocUnsafeSlow=function(E){if(typeof E!="number")throw new TypeError("Argument must be a number");return h.SlowBuffer(E)}})(safeBuffer$2,safeBuffer$2.exports);var safeBufferExports$1=safeBuffer$2.exports,MAX_BYTES=65536,MAX_UINT32=4294967295;function oldBrowser$1(){throw new Error(`Secure random number generation is not supported by this browser.
|
|
17
|
-
Use Chrome, Firefox or Internet Explorer 11`)}var Buffer$B=safeBufferExports$1.Buffer,crypto$3=commonjsGlobal.crypto||commonjsGlobal.msCrypto;crypto$3&&crypto$3.getRandomValues?browser$b.exports=randomBytes$2:browser$b.exports=oldBrowser$1;function randomBytes$2(y,u){if(y>MAX_UINT32)throw new RangeError("requested too many random bytes");var h=Buffer$B.allocUnsafe(y);if(y>0)if(y>MAX_BYTES)for(var v=0;v<y;v+=MAX_BYTES)crypto$3.getRandomValues(h.slice(v,v+MAX_BYTES));else crypto$3.getRandomValues(h);return typeof u=="function"?process$1.nextTick(function(){u(null,h)}):h}var browserExports=browser$b.exports,inherits_browser={exports:{}};typeof Object.create=="function"?inherits_browser.exports=function(u,h){h&&(u.super_=h,u.prototype=Object.create(h.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(u,h){if(h){u.super_=h;var v=function(){};v.prototype=h.prototype,u.prototype=new v,u.prototype.constructor=u}};var inherits_browserExports=inherits_browser.exports,readableBrowser$1={exports:{}},events={exports:{}},R=typeof Reflect=="object"?Reflect:null,ReflectApply=R&&typeof R.apply=="function"?R.apply:function(u,h,v){return Function.prototype.apply.call(u,h,v)},ReflectOwnKeys;R&&typeof R.ownKeys=="function"?ReflectOwnKeys=R.ownKeys:Object.getOwnPropertySymbols?ReflectOwnKeys=function(u){return Object.getOwnPropertyNames(u).concat(Object.getOwnPropertySymbols(u))}:ReflectOwnKeys=function(u){return Object.getOwnPropertyNames(u)};function ProcessEmitWarning(y){console&&console.warn&&console.warn(y)}var NumberIsNaN=Number.isNaN||function(u){return u!==u};function EventEmitter$1(){EventEmitter$1.init.call(this)}events.exports=EventEmitter$1,events.exports.once=once$2,EventEmitter$1.EventEmitter=EventEmitter$1,EventEmitter$1.prototype._events=void 0,EventEmitter$1.prototype._eventsCount=0,EventEmitter$1.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(y){if(typeof y!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof y)}Object.defineProperty(EventEmitter$1,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(y){if(typeof y!="number"||y<0||NumberIsNaN(y))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+y+".");defaultMaxListeners=y}}),EventEmitter$1.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},EventEmitter$1.prototype.setMaxListeners=function(u){if(typeof u!="number"||u<0||NumberIsNaN(u))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+u+".");return this._maxListeners=u,this};function _getMaxListeners(y){return y._maxListeners===void 0?EventEmitter$1.defaultMaxListeners:y._maxListeners}EventEmitter$1.prototype.getMaxListeners=function(){return _getMaxListeners(this)},EventEmitter$1.prototype.emit=function(u){for(var h=[],v=1;v<arguments.length;v++)h.push(arguments[v]);var w=u==="error",b=this._events;if(b!==void 0)w=w&&b.error===void 0;else if(!w)return!1;if(w){var E;if(h.length>0&&(E=h[0]),E instanceof Error)throw E;var $=new Error("Unhandled error."+(E?" ("+E.message+")":""));throw $.context=E,$}var M=b[u];if(M===void 0)return!1;if(typeof M=="function")ReflectApply(M,this,h);else for(var T=M.length,C=arrayClone(M,T),v=0;v<T;++v)ReflectApply(C[v],this,h);return!0};function _addListener(y,u,h,v){var w,b,E;if(checkListener(h),b=y._events,b===void 0?(b=y._events=Object.create(null),y._eventsCount=0):(b.newListener!==void 0&&(y.emit("newListener",u,h.listener?h.listener:h),b=y._events),E=b[u]),E===void 0)E=b[u]=h,++y._eventsCount;else if(typeof E=="function"?E=b[u]=v?[h,E]:[E,h]:v?E.unshift(h):E.push(h),w=_getMaxListeners(y),w>0&&E.length>w&&!E.warned){E.warned=!0;var $=new Error("Possible EventEmitter memory leak detected. "+E.length+" "+String(u)+" listeners added. Use emitter.setMaxListeners() to increase limit");$.name="MaxListenersExceededWarning",$.emitter=y,$.type=u,$.count=E.length,ProcessEmitWarning($)}return y}EventEmitter$1.prototype.addListener=function(u,h){return _addListener(this,u,h,!1)},EventEmitter$1.prototype.on=EventEmitter$1.prototype.addListener,EventEmitter$1.prototype.prependListener=function(u,h){return _addListener(this,u,h,!0)};function onceWrapper(){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 _onceWrap(y,u,h){var v={fired:!1,wrapFn:void 0,target:y,type:u,listener:h},w=onceWrapper.bind(v);return w.listener=h,v.wrapFn=w,w}EventEmitter$1.prototype.once=function(u,h){return checkListener(h),this.on(u,_onceWrap(this,u,h)),this},EventEmitter$1.prototype.prependOnceListener=function(u,h){return checkListener(h),this.prependListener(u,_onceWrap(this,u,h)),this},EventEmitter$1.prototype.removeListener=function(u,h){var v,w,b,E,$;if(checkListener(h),w=this._events,w===void 0)return this;if(v=w[u],v===void 0)return this;if(v===h||v.listener===h)--this._eventsCount===0?this._events=Object.create(null):(delete w[u],w.removeListener&&this.emit("removeListener",u,v.listener||h));else if(typeof v!="function"){for(b=-1,E=v.length-1;E>=0;E--)if(v[E]===h||v[E].listener===h){$=v[E].listener,b=E;break}if(b<0)return this;b===0?v.shift():spliceOne(v,b),v.length===1&&(w[u]=v[0]),w.removeListener!==void 0&&this.emit("removeListener",u,$||h)}return this},EventEmitter$1.prototype.off=EventEmitter$1.prototype.removeListener,EventEmitter$1.prototype.removeAllListeners=function(u){var h,v,w;if(v=this._events,v===void 0)return this;if(v.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):v[u]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete v[u]),this;if(arguments.length===0){var b=Object.keys(v),E;for(w=0;w<b.length;++w)E=b[w],E!=="removeListener"&&this.removeAllListeners(E);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(h=v[u],typeof h=="function")this.removeListener(u,h);else if(h!==void 0)for(w=h.length-1;w>=0;w--)this.removeListener(u,h[w]);return this};function _listeners(y,u,h){var v=y._events;if(v===void 0)return[];var w=v[u];return w===void 0?[]:typeof w=="function"?h?[w.listener||w]:[w]:h?unwrapListeners(w):arrayClone(w,w.length)}EventEmitter$1.prototype.listeners=function(u){return _listeners(this,u,!0)},EventEmitter$1.prototype.rawListeners=function(u){return _listeners(this,u,!1)},EventEmitter$1.listenerCount=function(y,u){return typeof y.listenerCount=="function"?y.listenerCount(u):listenerCount.call(y,u)},EventEmitter$1.prototype.listenerCount=listenerCount;function listenerCount(y){var u=this._events;if(u!==void 0){var h=u[y];if(typeof h=="function")return 1;if(h!==void 0)return h.length}return 0}EventEmitter$1.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(y,u){for(var h=new Array(u),v=0;v<u;++v)h[v]=y[v];return h}function spliceOne(y,u){for(;u+1<y.length;u++)y[u]=y[u+1];y.pop()}function unwrapListeners(y){for(var u=new Array(y.length),h=0;h<u.length;++h)u[h]=y[h].listener||y[h];return u}function once$2(y,u){return new Promise(function(h,v){function w(E){y.removeListener(u,b),v(E)}function b(){typeof y.removeListener=="function"&&y.removeListener("error",w),h([].slice.call(arguments))}eventTargetAgnosticAddListener(y,u,b,{once:!0}),u!=="error"&&addErrorHandlerIfEventEmitter(y,w,{once:!0})})}function addErrorHandlerIfEventEmitter(y,u,h){typeof y.on=="function"&&eventTargetAgnosticAddListener(y,"error",u,h)}function eventTargetAgnosticAddListener(y,u,h,v){if(typeof y.on=="function")v.once?y.once(u,h):y.on(u,h);else if(typeof y.addEventListener=="function")y.addEventListener(u,function w(b){v.once&&y.removeEventListener(u,w),h(b)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof y)}var eventsExports=events.exports,streamBrowser$1=eventsExports.EventEmitter,util$b={},types$2={},shams$1=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var u={},h=Symbol("test"),v=Object(h);if(typeof h=="string"||Object.prototype.toString.call(h)!=="[object Symbol]"||Object.prototype.toString.call(v)!=="[object Symbol]")return!1;var w=42;u[h]=w;for(h in u)return!1;if(typeof Object.keys=="function"&&Object.keys(u).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(u).length!==0)return!1;var b=Object.getOwnPropertySymbols(u);if(b.length!==1||b[0]!==h||!Object.prototype.propertyIsEnumerable.call(u,h))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var E=Object.getOwnPropertyDescriptor(u,h);if(E.value!==w||E.enumerable!==!0)return!1}return!0},hasSymbols$2=shams$1,shams=function(){return hasSymbols$2()&&!!Symbol.toStringTag},esErrors=Error,_eval=EvalError,range=RangeError,ref=ReferenceError,syntax=SyntaxError,type$1=TypeError,uri=URIError,origSymbol=typeof Symbol<"u"&&Symbol,hasSymbolSham=shams$1,hasSymbols$1=function(){return typeof origSymbol!="function"||typeof Symbol!="function"||typeof origSymbol("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:hasSymbolSham()},test={__proto__:null,foo:{}},$Object=Object,hasProto$1=function(){return{__proto__:test}.foo===test.foo&&!(test instanceof $Object)},ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr$3=Object.prototype.toString,max=Math.max,funcType="[object Function]",concatty=function(u,h){for(var v=[],w=0;w<u.length;w+=1)v[w]=u[w];for(var b=0;b<h.length;b+=1)v[b+u.length]=h[b];return v},slicy=function(u,h){for(var v=[],w=h,b=0;w<u.length;w+=1,b+=1)v[b]=u[w];return v},joiny=function(y,u){for(var h="",v=0;v<y.length;v+=1)h+=y[v],v+1<y.length&&(h+=u);return h},implementation$1=function(u){var h=this;if(typeof h!="function"||toStr$3.apply(h)!==funcType)throw new TypeError(ERROR_MESSAGE+h);for(var v=slicy(arguments,1),w,b=function(){if(this instanceof w){var C=h.apply(this,concatty(v,arguments));return Object(C)===C?C:this}return h.apply(u,concatty(v,arguments))},E=max(0,h.length-v.length),$=[],M=0;M<E;M++)$[M]="$"+M;if(w=Function("binder","return function ("+joiny($,",")+"){ return binder.apply(this,arguments); }")(b),h.prototype){var T=function(){};T.prototype=h.prototype,w.prototype=new T,T.prototype=null}return w},implementation=implementation$1,functionBind=Function.prototype.bind||implementation,call$1=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind$1=functionBind,hasown=bind$1.call(call$1,$hasOwn),undefined$1,$Error=esErrors,$EvalError=_eval,$RangeError=range,$ReferenceError=ref,$SyntaxError$1=syntax,$TypeError$2=type$1,$URIError=uri,$Function=Function,getEvalledConstructor=function(y){try{return $Function('"use strict"; return ('+y+").constructor;")()}catch{}},$gOPD$1=Object.getOwnPropertyDescriptor;if($gOPD$1)try{$gOPD$1({},"")}catch{$gOPD$1=null}var throwTypeError=function(){throw new $TypeError$2},ThrowTypeError=$gOPD$1?function(){try{return arguments.callee,throwTypeError}catch{try{return $gOPD$1(arguments,"callee").get}catch{return throwTypeError}}}():throwTypeError,hasSymbols=hasSymbols$1(),hasProto=hasProto$1(),getProto$1=Object.getPrototypeOf||(hasProto?function(y){return y.__proto__}:null),needsEval={},TypedArray=typeof Uint8Array>"u"||!getProto$1?undefined$1:getProto$1(Uint8Array),INTRINSICS={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?undefined$1:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$1:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto$1?getProto$1([][Symbol.iterator]()):undefined$1,"%AsyncFromSyncIteratorPrototype%":undefined$1,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":typeof Atomics>"u"?undefined$1:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$1:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$1:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$1:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$1:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$Error,"%eval%":eval,"%EvalError%":$EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$1:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$1:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$1:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":typeof Int8Array>"u"?undefined$1:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$1:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$1:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto$1?getProto$1(getProto$1([][Symbol.iterator]())):undefined$1,"%JSON%":typeof JSON=="object"?JSON:undefined$1,"%Map%":typeof Map>"u"?undefined$1:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols||!getProto$1?undefined$1:getProto$1(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$1:Promise,"%Proxy%":typeof Proxy>"u"?undefined$1:Proxy,"%RangeError%":$RangeError,"%ReferenceError%":$ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$1:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$1:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols||!getProto$1?undefined$1:getProto$1(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$1:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto$1?getProto$1(""[Symbol.iterator]()):undefined$1,"%Symbol%":hasSymbols?Symbol:undefined$1,"%SyntaxError%":$SyntaxError$1,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError$2,"%Uint8Array%":typeof Uint8Array>"u"?undefined$1:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$1:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$1:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$1:Uint32Array,"%URIError%":$URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$1:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$1:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$1:WeakSet};if(getProto$1)try{null.error}catch(y){var errorProto=getProto$1(getProto$1(y));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function y(u){var h;if(u==="%AsyncFunction%")h=getEvalledConstructor("async function () {}");else if(u==="%GeneratorFunction%")h=getEvalledConstructor("function* () {}");else if(u==="%AsyncGeneratorFunction%")h=getEvalledConstructor("async function* () {}");else if(u==="%AsyncGenerator%"){var v=y("%AsyncGeneratorFunction%");v&&(h=v.prototype)}else if(u==="%AsyncIteratorPrototype%"){var w=y("%AsyncGenerator%");w&&getProto$1&&(h=getProto$1(w.prototype))}return INTRINSICS[u]=h,h},LEGACY_ALIASES={__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"]},bind=functionBind,hasOwn=hasown,$concat=bind.call(Function.call,Array.prototype.concat),$spliceApply=bind.call(Function.apply,Array.prototype.splice),$replace=bind.call(Function.call,String.prototype.replace),$strSlice=bind.call(Function.call,String.prototype.slice),$exec=bind.call(Function.call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function(u){var h=$strSlice(u,0,1),v=$strSlice(u,-1);if(h==="%"&&v!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected closing `%`");if(v==="%"&&h!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected opening `%`");var w=[];return $replace(u,rePropName,function(b,E,$,M){w[w.length]=$?$replace(M,reEscapeChar,"$1"):E||b}),w},getBaseIntrinsic=function(u,h){var v=u,w;if(hasOwn(LEGACY_ALIASES,v)&&(w=LEGACY_ALIASES[v],v="%"+w[0]+"%"),hasOwn(INTRINSICS,v)){var b=INTRINSICS[v];if(b===needsEval&&(b=doEval(v)),typeof b>"u"&&!h)throw new $TypeError$2("intrinsic "+u+" exists, but is not available. Please file an issue!");return{alias:w,name:v,value:b}}throw new $SyntaxError$1("intrinsic "+u+" does not exist!")},getIntrinsic=function(u,h){if(typeof u!="string"||u.length===0)throw new $TypeError$2("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof h!="boolean")throw new $TypeError$2('"allowMissing" argument must be a boolean');if($exec(/^%?[^%]*%?$/,u)===null)throw new $SyntaxError$1("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var v=stringToPath(u),w=v.length>0?v[0]:"",b=getBaseIntrinsic("%"+w+"%",h),E=b.name,$=b.value,M=!1,T=b.alias;T&&(w=T[0],$spliceApply(v,$concat([0,1],T)));for(var C=1,B=!0;C<v.length;C+=1){var N=v[C],H=$strSlice(N,0,1),te=$strSlice(N,-1);if((H==='"'||H==="'"||H==="`"||te==='"'||te==="'"||te==="`")&&H!==te)throw new $SyntaxError$1("property names with quotes must have matching quotes");if((N==="constructor"||!B)&&(M=!0),w+="."+N,E="%"+w+"%",hasOwn(INTRINSICS,E))$=INTRINSICS[E];else if($!=null){if(!(N in $)){if(!h)throw new $TypeError$2("base intrinsic for "+u+" exists, but the property is not available.");return}if($gOPD$1&&C+1>=v.length){var fe=$gOPD$1($,N);B=!!fe,B&&"get"in fe&&!("originalValue"in fe.get)?$=fe.get:$=$[N]}else B=hasOwn($,N),$=$[N];B&&!M&&(INTRINSICS[E]=$)}}return $},callBind$2={exports:{}},esDefineProperty,hasRequiredEsDefineProperty;function requireEsDefineProperty(){if(hasRequiredEsDefineProperty)return esDefineProperty;hasRequiredEsDefineProperty=1;var y=getIntrinsic,u=y("%Object.defineProperty%",!0)||!1;if(u)try{u({},"a",{value:1})}catch{u=!1}return esDefineProperty=u,esDefineProperty}var GetIntrinsic$2=getIntrinsic,$gOPD=GetIntrinsic$2("%Object.getOwnPropertyDescriptor%",!0);if($gOPD)try{$gOPD([],"length")}catch{$gOPD=null}var gopd$1=$gOPD,$defineProperty$1=requireEsDefineProperty(),$SyntaxError=syntax,$TypeError$1=type$1,gopd=gopd$1,defineDataProperty=function(u,h,v){if(!u||typeof u!="object"&&typeof u!="function")throw new $TypeError$1("`obj` must be an object or a function`");if(typeof h!="string"&&typeof h!="symbol")throw new $TypeError$1("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new $TypeError$1("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new $TypeError$1("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new $TypeError$1("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new $TypeError$1("`loose`, if provided, must be a boolean");var w=arguments.length>3?arguments[3]:null,b=arguments.length>4?arguments[4]:null,E=arguments.length>5?arguments[5]:null,$=arguments.length>6?arguments[6]:!1,M=!!gopd&&gopd(u,h);if($defineProperty$1)$defineProperty$1(u,h,{configurable:E===null&&M?M.configurable:!E,enumerable:w===null&&M?M.enumerable:!w,value:v,writable:b===null&&M?M.writable:!b});else if($||!w&&!b&&!E)u[h]=v;else throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},$defineProperty=requireEsDefineProperty(),hasPropertyDescriptors=function(){return!!$defineProperty};hasPropertyDescriptors.hasArrayLengthDefineBug=function(){if(!$defineProperty)return null;try{return $defineProperty([],"length",{value:1}).length!==1}catch{return!0}};var hasPropertyDescriptors_1=hasPropertyDescriptors,GetIntrinsic$1=getIntrinsic,define=defineDataProperty,hasDescriptors=hasPropertyDescriptors_1(),gOPD$1=gopd$1,$TypeError=type$1,$floor=GetIntrinsic$1("%Math.floor%"),setFunctionLength=function(u,h){if(typeof u!="function")throw new $TypeError("`fn` is not a function");if(typeof h!="number"||h<0||h>4294967295||$floor(h)!==h)throw new $TypeError("`length` must be a positive 32-bit integer");var v=arguments.length>2&&!!arguments[2],w=!0,b=!0;if("length"in u&&gOPD$1){var E=gOPD$1(u,"length");E&&!E.configurable&&(w=!1),E&&!E.writable&&(b=!1)}return(w||b||!v)&&(hasDescriptors?define(u,"length",h,!0,!0):define(u,"length",h)),u};(function(y){var u=functionBind,h=getIntrinsic,v=setFunctionLength,w=type$1,b=h("%Function.prototype.apply%"),E=h("%Function.prototype.call%"),$=h("%Reflect.apply%",!0)||u.call(E,b),M=requireEsDefineProperty(),T=h("%Math.max%");y.exports=function(N){if(typeof N!="function")throw new w("a function is required");var H=$(u,E,arguments);return v(H,1+T(0,N.length-(arguments.length-1)),!0)};var C=function(){return $(u,b,arguments)};M?M(y.exports,"apply",{value:C}):y.exports.apply=C})(callBind$2);var callBindExports=callBind$2.exports,GetIntrinsic=getIntrinsic,callBind$1=callBindExports,$indexOf$1=callBind$1(GetIntrinsic("String.prototype.indexOf")),callBound$2=function(u,h){var v=GetIntrinsic(u,!!h);return typeof v=="function"&&$indexOf$1(u,".prototype.")>-1?callBind$1(v):v},hasToStringTag$3=shams(),callBound$1=callBound$2,$toString$1=callBound$1("Object.prototype.toString"),isStandardArguments=function(u){return hasToStringTag$3&&u&&typeof u=="object"&&Symbol.toStringTag in u?!1:$toString$1(u)==="[object Arguments]"},isLegacyArguments=function(u){return isStandardArguments(u)?!0:u!==null&&typeof u=="object"&&typeof u.length=="number"&&u.length>=0&&$toString$1(u)!=="[object Array]"&&$toString$1(u.callee)==="[object Function]"},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments;var isArguments=supportsStandardArguments?isStandardArguments:isLegacyArguments,toStr$2=Object.prototype.toString,fnToStr$1=Function.prototype.toString,isFnRegex=/^\s*(?:function)?\*/,hasToStringTag$2=shams(),getProto=Object.getPrototypeOf,getGeneratorFunc=function(){if(!hasToStringTag$2)return!1;try{return Function("return function*() {}")()}catch{}},GeneratorFunction,isGeneratorFunction=function(u){if(typeof u!="function")return!1;if(isFnRegex.test(fnToStr$1.call(u)))return!0;if(!hasToStringTag$2){var h=toStr$2.call(u);return h==="[object GeneratorFunction]"}if(!getProto)return!1;if(typeof GeneratorFunction>"u"){var v=getGeneratorFunc();GeneratorFunction=v?getProto(v):!1}return getProto(u)===GeneratorFunction},fnToStr=Function.prototype.toString,reflectApply=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,badArrayLike,isCallableMarker;if(typeof reflectApply=="function"&&typeof Object.defineProperty=="function")try{badArrayLike=Object.defineProperty({},"length",{get:function(){throw isCallableMarker}}),isCallableMarker={},reflectApply(function(){throw 42},null,badArrayLike)}catch(y){y!==isCallableMarker&&(reflectApply=null)}else reflectApply=null;var constructorRegex=/^\s*class\b/,isES6ClassFn=function(u){try{var h=fnToStr.call(u);return constructorRegex.test(h)}catch{return!1}},tryFunctionObject=function(u){try{return isES6ClassFn(u)?!1:(fnToStr.call(u),!0)}catch{return!1}},toStr$1=Object.prototype.toString,objectClass="[object Object]",fnClass="[object Function]",genClass="[object GeneratorFunction]",ddaClass="[object HTMLAllCollection]",ddaClass2="[object HTML document.all class]",ddaClass3="[object HTMLCollection]",hasToStringTag$1=typeof Symbol=="function"&&!!Symbol.toStringTag,isIE68=!(0 in[,]),isDDA=function(){return!1};if(typeof document=="object"){var all=document.all;toStr$1.call(all)===toStr$1.call(document.all)&&(isDDA=function(u){if((isIE68||!u)&&(typeof u>"u"||typeof u=="object"))try{var h=toStr$1.call(u);return(h===ddaClass||h===ddaClass2||h===ddaClass3||h===objectClass)&&u("")==null}catch{}return!1})}var isCallable$1=reflectApply?function(u){if(isDDA(u))return!0;if(!u||typeof u!="function"&&typeof u!="object")return!1;try{reflectApply(u,null,badArrayLike)}catch(h){if(h!==isCallableMarker)return!1}return!isES6ClassFn(u)&&tryFunctionObject(u)}:function(u){if(isDDA(u))return!0;if(!u||typeof u!="function"&&typeof u!="object")return!1;if(hasToStringTag$1)return tryFunctionObject(u);if(isES6ClassFn(u))return!1;var h=toStr$1.call(u);return h!==fnClass&&h!==genClass&&!/^\[object HTML/.test(h)?!1:tryFunctionObject(u)},isCallable=isCallable$1,toStr=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,forEachArray=function(u,h,v){for(var w=0,b=u.length;w<b;w++)hasOwnProperty.call(u,w)&&(v==null?h(u[w],w,u):h.call(v,u[w],w,u))},forEachString=function(u,h,v){for(var w=0,b=u.length;w<b;w++)v==null?h(u.charAt(w),w,u):h.call(v,u.charAt(w),w,u)},forEachObject=function(u,h,v){for(var w in u)hasOwnProperty.call(u,w)&&(v==null?h(u[w],w,u):h.call(v,u[w],w,u))},forEach$1=function(u,h,v){if(!isCallable(h))throw new TypeError("iterator must be a function");var w;arguments.length>=3&&(w=v),toStr.call(u)==="[object Array]"?forEachArray(u,h,w):typeof u=="string"?forEachString(u,h,w):forEachObject(u,h,w)},forEach_1=forEach$1,possibleTypedArrayNames=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],possibleNames=possibleTypedArrayNames,g$1=typeof globalThis>"u"?commonjsGlobal:globalThis,availableTypedArrays$1=function(){for(var u=[],h=0;h<possibleNames.length;h++)typeof g$1[possibleNames[h]]=="function"&&(u[u.length]=possibleNames[h]);return u},forEach=forEach_1,availableTypedArrays=availableTypedArrays$1,callBind=callBindExports,callBound=callBound$2,gOPD=gopd$1,$toString=callBound("Object.prototype.toString"),hasToStringTag=shams(),g=typeof globalThis>"u"?commonjsGlobal:globalThis,typedArrays=availableTypedArrays(),$slice=callBound("String.prototype.slice"),getPrototypeOf=Object.getPrototypeOf,$indexOf=callBound("Array.prototype.indexOf",!0)||function(u,h){for(var v=0;v<u.length;v+=1)if(u[v]===h)return v;return-1},cache={__proto__:null};hasToStringTag&&gOPD&&getPrototypeOf?forEach(typedArrays,function(y){var u=new g[y];if(Symbol.toStringTag in u){var h=getPrototypeOf(u),v=gOPD(h,Symbol.toStringTag);if(!v){var w=getPrototypeOf(h);v=gOPD(w,Symbol.toStringTag)}cache["$"+y]=callBind(v.get)}}):forEach(typedArrays,function(y){var u=new g[y],h=u.slice||u.set;h&&(cache["$"+y]=callBind(h))});var tryTypedArrays=function(u){var h=!1;return forEach(cache,function(v,w){if(!h)try{"$"+v(u)===w&&(h=$slice(w,1))}catch{}}),h},trySlices=function(u){var h=!1;return forEach(cache,function(v,w){if(!h)try{v(u),h=$slice(w,1)}catch{}}),h},whichTypedArray$1=function(u){if(!u||typeof u!="object")return!1;if(!hasToStringTag){var h=$slice($toString(u),8,-1);return $indexOf(typedArrays,h)>-1?h:h!=="Object"?!1:trySlices(u)}return gOPD?tryTypedArrays(u):null},whichTypedArray=whichTypedArray$1,isTypedArray=function(u){return!!whichTypedArray(u)};(function(y){var u=isArguments,h=isGeneratorFunction,v=whichTypedArray$1,w=isTypedArray;function b(Ne){return Ne.call.bind(Ne)}var E=typeof BigInt<"u",$=typeof Symbol<"u",M=b(Object.prototype.toString),T=b(Number.prototype.valueOf),C=b(String.prototype.valueOf),B=b(Boolean.prototype.valueOf);if(E)var N=b(BigInt.prototype.valueOf);if($)var H=b(Symbol.prototype.valueOf);function te(Ne,nt){if(typeof Ne!="object")return!1;try{return nt(Ne),!0}catch{return!1}}y.isArgumentsObject=u,y.isGeneratorFunction=h,y.isTypedArray=w;function fe(Ne){return typeof Promise<"u"&&Ne instanceof Promise||Ne!==null&&typeof Ne=="object"&&typeof Ne.then=="function"&&typeof Ne.catch=="function"}y.isPromise=fe;function ce(Ne){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(Ne):w(Ne)||he(Ne)}y.isArrayBufferView=ce;function le(Ne){return v(Ne)==="Uint8Array"}y.isUint8Array=le;function ie(Ne){return v(Ne)==="Uint8ClampedArray"}y.isUint8ClampedArray=ie;function ge(Ne){return v(Ne)==="Uint16Array"}y.isUint16Array=ge;function pe(Ne){return v(Ne)==="Uint32Array"}y.isUint32Array=pe;function Me(Ne){return v(Ne)==="Int8Array"}y.isInt8Array=Me;function $e(Ne){return v(Ne)==="Int16Array"}y.isInt16Array=$e;function Pe(Ne){return v(Ne)==="Int32Array"}y.isInt32Array=Pe;function Be(Ne){return v(Ne)==="Float32Array"}y.isFloat32Array=Be;function Re(Ne){return v(Ne)==="Float64Array"}y.isFloat64Array=Re;function je(Ne){return v(Ne)==="BigInt64Array"}y.isBigInt64Array=je;function we(Ne){return v(Ne)==="BigUint64Array"}y.isBigUint64Array=we;function D(Ne){return M(Ne)==="[object Map]"}D.working=typeof Map<"u"&&D(new Map);function q(Ne){return typeof Map>"u"?!1:D.working?D(Ne):Ne instanceof Map}y.isMap=q;function O(Ne){return M(Ne)==="[object Set]"}O.working=typeof Set<"u"&&O(new Set);function L(Ne){return typeof Set>"u"?!1:O.working?O(Ne):Ne instanceof Set}y.isSet=L;function X(Ne){return M(Ne)==="[object WeakMap]"}X.working=typeof WeakMap<"u"&&X(new WeakMap);function j(Ne){return typeof WeakMap>"u"?!1:X.working?X(Ne):Ne instanceof WeakMap}y.isWeakMap=j;function re(Ne){return M(Ne)==="[object WeakSet]"}re.working=typeof WeakSet<"u"&&re(new WeakSet);function ee(Ne){return re(Ne)}y.isWeakSet=ee;function F(Ne){return M(Ne)==="[object ArrayBuffer]"}F.working=typeof ArrayBuffer<"u"&&F(new ArrayBuffer);function Q(Ne){return typeof ArrayBuffer>"u"?!1:F.working?F(Ne):Ne instanceof ArrayBuffer}y.isArrayBuffer=Q;function U(Ne){return M(Ne)==="[object DataView]"}U.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&U(new DataView(new ArrayBuffer(1),0,1));function he(Ne){return typeof DataView>"u"?!1:U.working?U(Ne):Ne instanceof DataView}y.isDataView=he;var Oe=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Ve(Ne){return M(Ne)==="[object SharedArrayBuffer]"}function Ae(Ne){return typeof Oe>"u"?!1:(typeof Ve.working>"u"&&(Ve.working=Ve(new Oe)),Ve.working?Ve(Ne):Ne instanceof Oe)}y.isSharedArrayBuffer=Ae;function oe(Ne){return M(Ne)==="[object AsyncFunction]"}y.isAsyncFunction=oe;function ye(Ne){return M(Ne)==="[object Map Iterator]"}y.isMapIterator=ye;function Ce(Ne){return M(Ne)==="[object Set Iterator]"}y.isSetIterator=Ce;function ae(Ne){return M(Ne)==="[object Generator]"}y.isGeneratorObject=ae;function de(Ne){return M(Ne)==="[object WebAssembly.Module]"}y.isWebAssemblyCompiledModule=de;function ne(Ne){return te(Ne,T)}y.isNumberObject=ne;function be(Ne){return te(Ne,C)}y.isStringObject=be;function Ie(Ne){return te(Ne,B)}y.isBooleanObject=Ie;function Le(Ne){return E&&te(Ne,N)}y.isBigIntObject=Le;function Fe(Ne){return $&&te(Ne,H)}y.isSymbolObject=Fe;function He(Ne){return ne(Ne)||be(Ne)||Ie(Ne)||Le(Ne)||Fe(Ne)}y.isBoxedPrimitive=He;function tt(Ne){return typeof Uint8Array<"u"&&(Q(Ne)||Ae(Ne))}y.isAnyArrayBuffer=tt,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(Ne){Object.defineProperty(y,Ne,{enumerable:!1,value:function(){throw new Error(Ne+" is not supported in userland")}})})})(types$2);var isBufferBrowser=function(u){return u&&typeof u=="object"&&typeof u.copy=="function"&&typeof u.fill=="function"&&typeof u.readUInt8=="function"};(function(y){var u=Object.getOwnPropertyDescriptors||function(he){for(var Oe=Object.keys(he),Ve={},Ae=0;Ae<Oe.length;Ae++)Ve[Oe[Ae]]=Object.getOwnPropertyDescriptor(he,Oe[Ae]);return Ve},h=/%[sdj%]/g;y.format=function(U){if(!Me(U)){for(var he=[],Oe=0;Oe<arguments.length;Oe++)he.push(E(arguments[Oe]));return he.join(" ")}for(var Oe=1,Ve=arguments,Ae=Ve.length,oe=String(U).replace(h,function(Ce){if(Ce==="%%")return"%";if(Oe>=Ae)return Ce;switch(Ce){case"%s":return String(Ve[Oe++]);case"%d":return Number(Ve[Oe++]);case"%j":try{return JSON.stringify(Ve[Oe++])}catch{return"[Circular]"}default:return Ce}}),ye=Ve[Oe];Oe<Ae;ye=Ve[++Oe])ie(ye)||!Re(ye)?oe+=" "+ye:oe+=" "+E(ye);return oe},y.deprecate=function(U,he){if(typeof process$1<"u"&&process$1.noDeprecation===!0)return U;if(typeof process$1>"u")return function(){return y.deprecate(U,he).apply(this,arguments)};var Oe=!1;function Ve(){if(!Oe){if(process$1.throwDeprecation)throw new Error(he);process$1.traceDeprecation?console.trace(he):console.error(he),Oe=!0}return U.apply(this,arguments)}return Ve};var v={},w=/^$/;if(process$1.env.NODE_DEBUG){var b=process$1.env.NODE_DEBUG;b=b.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),w=new RegExp("^"+b+"$","i")}y.debuglog=function(U){if(U=U.toUpperCase(),!v[U])if(w.test(U)){var he=process$1.pid;v[U]=function(){var Oe=y.format.apply(y,arguments);console.error("%s %d: %s",U,he,Oe)}}else v[U]=function(){};return v[U]};function E(U,he){var Oe={seen:[],stylize:M};return arguments.length>=3&&(Oe.depth=arguments[2]),arguments.length>=4&&(Oe.colors=arguments[3]),le(he)?Oe.showHidden=he:he&&y._extend(Oe,he),Pe(Oe.showHidden)&&(Oe.showHidden=!1),Pe(Oe.depth)&&(Oe.depth=2),Pe(Oe.colors)&&(Oe.colors=!1),Pe(Oe.customInspect)&&(Oe.customInspect=!0),Oe.colors&&(Oe.stylize=$),C(Oe,U,Oe.depth)}y.inspect=E,E.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]},E.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function $(U,he){var Oe=E.styles[he];return Oe?"\x1B["+E.colors[Oe][0]+"m"+U+"\x1B["+E.colors[Oe][1]+"m":U}function M(U,he){return U}function T(U){var he={};return U.forEach(function(Oe,Ve){he[Oe]=!0}),he}function C(U,he,Oe){if(U.customInspect&&he&&D(he.inspect)&&he.inspect!==y.inspect&&!(he.constructor&&he.constructor.prototype===he)){var Ve=he.inspect(Oe,U);return Me(Ve)||(Ve=C(U,Ve,Oe)),Ve}var Ae=B(U,he);if(Ae)return Ae;var oe=Object.keys(he),ye=T(oe);if(U.showHidden&&(oe=Object.getOwnPropertyNames(he)),we(he)&&(oe.indexOf("message")>=0||oe.indexOf("description")>=0))return N(he);if(oe.length===0){if(D(he)){var Ce=he.name?": "+he.name:"";return U.stylize("[Function"+Ce+"]","special")}if(Be(he))return U.stylize(RegExp.prototype.toString.call(he),"regexp");if(je(he))return U.stylize(Date.prototype.toString.call(he),"date");if(we(he))return N(he)}var ae="",de=!1,ne=["{","}"];if(ce(he)&&(de=!0,ne=["[","]"]),D(he)){var be=he.name?": "+he.name:"";ae=" [Function"+be+"]"}if(Be(he)&&(ae=" "+RegExp.prototype.toString.call(he)),je(he)&&(ae=" "+Date.prototype.toUTCString.call(he)),we(he)&&(ae=" "+N(he)),oe.length===0&&(!de||he.length==0))return ne[0]+ae+ne[1];if(Oe<0)return Be(he)?U.stylize(RegExp.prototype.toString.call(he),"regexp"):U.stylize("[Object]","special");U.seen.push(he);var Ie;return de?Ie=H(U,he,Oe,ye,oe):Ie=oe.map(function(Le){return te(U,he,Oe,ye,Le,de)}),U.seen.pop(),fe(Ie,ae,ne)}function B(U,he){if(Pe(he))return U.stylize("undefined","undefined");if(Me(he)){var Oe="'"+JSON.stringify(he).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return U.stylize(Oe,"string")}if(pe(he))return U.stylize(""+he,"number");if(le(he))return U.stylize(""+he,"boolean");if(ie(he))return U.stylize("null","null")}function N(U){return"["+Error.prototype.toString.call(U)+"]"}function H(U,he,Oe,Ve,Ae){for(var oe=[],ye=0,Ce=he.length;ye<Ce;++ye)re(he,String(ye))?oe.push(te(U,he,Oe,Ve,String(ye),!0)):oe.push("");return Ae.forEach(function(ae){ae.match(/^\d+$/)||oe.push(te(U,he,Oe,Ve,ae,!0))}),oe}function te(U,he,Oe,Ve,Ae,oe){var ye,Ce,ae;if(ae=Object.getOwnPropertyDescriptor(he,Ae)||{value:he[Ae]},ae.get?ae.set?Ce=U.stylize("[Getter/Setter]","special"):Ce=U.stylize("[Getter]","special"):ae.set&&(Ce=U.stylize("[Setter]","special")),re(Ve,Ae)||(ye="["+Ae+"]"),Ce||(U.seen.indexOf(ae.value)<0?(ie(Oe)?Ce=C(U,ae.value,null):Ce=C(U,ae.value,Oe-1),Ce.indexOf(`
|
|
18
|
-
`)>-1&&(oe?Ce=Ce.split(`
|
|
19
|
-
`).map(function(de){return" "+de}).join(`
|
|
20
|
-
`).slice(2):Ce=`
|
|
21
|
-
`+Ce.split(`
|
|
22
|
-
`).map(function(de){return" "+de}).join(`
|
|
23
|
-
`))):Ce=U.stylize("[Circular]","special")),Pe(ye)){if(oe&&Ae.match(/^\d+$/))return Ce;ye=JSON.stringify(""+Ae),ye.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(ye=ye.slice(1,-1),ye=U.stylize(ye,"name")):(ye=ye.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),ye=U.stylize(ye,"string"))}return ye+": "+Ce}function fe(U,he,Oe){var Ve=U.reduce(function(Ae,oe){return oe.indexOf(`
|
|
24
|
-
`)>=0,Ae+oe.replace(/\u001b\[\d\d?m/g,"").length+1},0);return Ve>60?Oe[0]+(he===""?"":he+`
|
|
25
|
-
`)+" "+U.join(`,
|
|
26
|
-
`)+" "+Oe[1]:Oe[0]+he+" "+U.join(", ")+" "+Oe[1]}y.types=types$2;function ce(U){return Array.isArray(U)}y.isArray=ce;function le(U){return typeof U=="boolean"}y.isBoolean=le;function ie(U){return U===null}y.isNull=ie;function ge(U){return U==null}y.isNullOrUndefined=ge;function pe(U){return typeof U=="number"}y.isNumber=pe;function Me(U){return typeof U=="string"}y.isString=Me;function $e(U){return typeof U=="symbol"}y.isSymbol=$e;function Pe(U){return U===void 0}y.isUndefined=Pe;function Be(U){return Re(U)&&O(U)==="[object RegExp]"}y.isRegExp=Be,y.types.isRegExp=Be;function Re(U){return typeof U=="object"&&U!==null}y.isObject=Re;function je(U){return Re(U)&&O(U)==="[object Date]"}y.isDate=je,y.types.isDate=je;function we(U){return Re(U)&&(O(U)==="[object Error]"||U instanceof Error)}y.isError=we,y.types.isNativeError=we;function D(U){return typeof U=="function"}y.isFunction=D;function q(U){return U===null||typeof U=="boolean"||typeof U=="number"||typeof U=="string"||typeof U=="symbol"||typeof U>"u"}y.isPrimitive=q,y.isBuffer=isBufferBrowser;function O(U){return Object.prototype.toString.call(U)}function L(U){return U<10?"0"+U.toString(10):U.toString(10)}var X=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function j(){var U=new Date,he=[L(U.getHours()),L(U.getMinutes()),L(U.getSeconds())].join(":");return[U.getDate(),X[U.getMonth()],he].join(" ")}y.log=function(){console.log("%s - %s",j(),y.format.apply(y,arguments))},y.inherits=inherits_browserExports,y._extend=function(U,he){if(!he||!Re(he))return U;for(var Oe=Object.keys(he),Ve=Oe.length;Ve--;)U[Oe[Ve]]=he[Oe[Ve]];return U};function re(U,he){return Object.prototype.hasOwnProperty.call(U,he)}var ee=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;y.promisify=function(he){if(typeof he!="function")throw new TypeError('The "original" argument must be of type Function');if(ee&&he[ee]){var Oe=he[ee];if(typeof Oe!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(Oe,ee,{value:Oe,enumerable:!1,writable:!1,configurable:!0}),Oe}function Oe(){for(var Ve,Ae,oe=new Promise(function(ae,de){Ve=ae,Ae=de}),ye=[],Ce=0;Ce<arguments.length;Ce++)ye.push(arguments[Ce]);ye.push(function(ae,de){ae?Ae(ae):Ve(de)});try{he.apply(this,ye)}catch(ae){Ae(ae)}return oe}return Object.setPrototypeOf(Oe,Object.getPrototypeOf(he)),ee&&Object.defineProperty(Oe,ee,{value:Oe,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(Oe,u(he))},y.promisify.custom=ee;function F(U,he){if(!U){var Oe=new Error("Promise was rejected with a falsy value");Oe.reason=U,U=Oe}return he(U)}function Q(U){if(typeof U!="function")throw new TypeError('The "original" argument must be of type Function');function he(){for(var Oe=[],Ve=0;Ve<arguments.length;Ve++)Oe.push(arguments[Ve]);var Ae=Oe.pop();if(typeof Ae!="function")throw new TypeError("The last argument must be of type Function");var oe=this,ye=function(){return Ae.apply(oe,arguments)};U.apply(this,Oe).then(function(Ce){process$1.nextTick(ye.bind(null,null,Ce))},function(Ce){process$1.nextTick(F.bind(null,Ce,ye))})}return Object.setPrototypeOf(he,Object.getPrototypeOf(U)),Object.defineProperties(he,u(U)),he}y.callbackify=Q})(util$b);var buffer_list,hasRequiredBuffer_list;function requireBuffer_list(){if(hasRequiredBuffer_list)return buffer_list;hasRequiredBuffer_list=1;function y(te,fe){var ce=Object.keys(te);if(Object.getOwnPropertySymbols){var le=Object.getOwnPropertySymbols(te);fe&&(le=le.filter(function(ie){return Object.getOwnPropertyDescriptor(te,ie).enumerable})),ce.push.apply(ce,le)}return ce}function u(te){for(var fe=1;fe<arguments.length;fe++){var ce=arguments[fe]!=null?arguments[fe]:{};fe%2?y(Object(ce),!0).forEach(function(le){h(te,le,ce[le])}):Object.getOwnPropertyDescriptors?Object.defineProperties(te,Object.getOwnPropertyDescriptors(ce)):y(Object(ce)).forEach(function(le){Object.defineProperty(te,le,Object.getOwnPropertyDescriptor(ce,le))})}return te}function h(te,fe,ce){return fe=E(fe),fe in te?Object.defineProperty(te,fe,{value:ce,enumerable:!0,configurable:!0,writable:!0}):te[fe]=ce,te}function v(te,fe){if(!(te instanceof fe))throw new TypeError("Cannot call a class as a function")}function w(te,fe){for(var ce=0;ce<fe.length;ce++){var le=fe[ce];le.enumerable=le.enumerable||!1,le.configurable=!0,"value"in le&&(le.writable=!0),Object.defineProperty(te,E(le.key),le)}}function b(te,fe,ce){return fe&&w(te.prototype,fe),Object.defineProperty(te,"prototype",{writable:!1}),te}function E(te){var fe=$(te,"string");return typeof fe=="symbol"?fe:String(fe)}function $(te,fe){if(typeof te!="object"||te===null)return te;var ce=te[Symbol.toPrimitive];if(ce!==void 0){var le=ce.call(te,fe||"default");if(typeof le!="object")return le;throw new TypeError("@@toPrimitive must return a primitive value.")}return(fe==="string"?String:Number)(te)}var M=dist,T=M.Buffer,C=util$b,B=C.inspect,N=B&&B.custom||"inspect";function H(te,fe,ce){T.prototype.copy.call(te,fe,ce)}return buffer_list=function(){function te(){v(this,te),this.head=null,this.tail=null,this.length=0}return b(te,[{key:"push",value:function(ce){var le={data:ce,next:null};this.length>0?this.tail.next=le:this.head=le,this.tail=le,++this.length}},{key:"unshift",value:function(ce){var le={data:ce,next:this.head};this.length===0&&(this.tail=le),this.head=le,++this.length}},{key:"shift",value:function(){if(this.length!==0){var ce=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,ce}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(ce){if(this.length===0)return"";for(var le=this.head,ie=""+le.data;le=le.next;)ie+=ce+le.data;return ie}},{key:"concat",value:function(ce){if(this.length===0)return T.alloc(0);for(var le=T.allocUnsafe(ce>>>0),ie=this.head,ge=0;ie;)H(ie.data,le,ge),ge+=ie.data.length,ie=ie.next;return le}},{key:"consume",value:function(ce,le){var ie;return ce<this.head.data.length?(ie=this.head.data.slice(0,ce),this.head.data=this.head.data.slice(ce)):ce===this.head.data.length?ie=this.shift():ie=le?this._getString(ce):this._getBuffer(ce),ie}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(ce){var le=this.head,ie=1,ge=le.data;for(ce-=ge.length;le=le.next;){var pe=le.data,Me=ce>pe.length?pe.length:ce;if(Me===pe.length?ge+=pe:ge+=pe.slice(0,ce),ce-=Me,ce===0){Me===pe.length?(++ie,le.next?this.head=le.next:this.head=this.tail=null):(this.head=le,le.data=pe.slice(Me));break}++ie}return this.length-=ie,ge}},{key:"_getBuffer",value:function(ce){var le=T.allocUnsafe(ce),ie=this.head,ge=1;for(ie.data.copy(le),ce-=ie.data.length;ie=ie.next;){var pe=ie.data,Me=ce>pe.length?pe.length:ce;if(pe.copy(le,le.length-ce,0,Me),ce-=Me,ce===0){Me===pe.length?(++ge,ie.next?this.head=ie.next:this.head=this.tail=null):(this.head=ie,ie.data=pe.slice(Me));break}++ge}return this.length-=ge,le}},{key:N,value:function(ce,le){return B(this,u(u({},le),{},{depth:0,customInspect:!1}))}}]),te}(),buffer_list}function destroy$1(y,u){var h=this,v=this._readableState&&this._readableState.destroyed,w=this._writableState&&this._writableState.destroyed;return v||w?(u?u(y):y&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1.nextTick(emitErrorNT$1,this,y)):process$1.nextTick(emitErrorNT$1,this,y)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(y||null,function(b){!u&&b?h._writableState?h._writableState.errorEmitted?process$1.nextTick(emitCloseNT,h):(h._writableState.errorEmitted=!0,process$1.nextTick(emitErrorAndCloseNT,h,b)):process$1.nextTick(emitErrorAndCloseNT,h,b):u?(process$1.nextTick(emitCloseNT,h),u(b)):process$1.nextTick(emitCloseNT,h)}),this)}function emitErrorAndCloseNT(y,u){emitErrorNT$1(y,u),emitCloseNT(y)}function emitCloseNT(y){y._writableState&&!y._writableState.emitClose||y._readableState&&!y._readableState.emitClose||y.emit("close")}function undestroy$1(){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 emitErrorNT$1(y,u){y.emit("error",u)}function errorOrDestroy(y,u){var h=y._readableState,v=y._writableState;h&&h.autoDestroy||v&&v.autoDestroy?y.destroy(u):y.emit("error",u)}var destroy_1$1={destroy:destroy$1,undestroy:undestroy$1,errorOrDestroy},errorsBrowser={};function _inheritsLoose(y,u){y.prototype=Object.create(u.prototype),y.prototype.constructor=y,y.__proto__=u}var codes={};function createErrorType(y,u,h){h||(h=Error);function v(b,E,$){return typeof u=="string"?u:u(b,E,$)}var w=function(b){_inheritsLoose(E,b);function E($,M,T){return b.call(this,v($,M,T))||this}return E}(h);w.prototype.name=h.name,w.prototype.code=y,codes[y]=w}function oneOf(y,u){if(Array.isArray(y)){var h=y.length;return y=y.map(function(v){return String(v)}),h>2?"one of ".concat(u," ").concat(y.slice(0,h-1).join(", "),", or ")+y[h-1]:h===2?"one of ".concat(u," ").concat(y[0]," or ").concat(y[1]):"of ".concat(u," ").concat(y[0])}else return"of ".concat(u," ").concat(String(y))}function startsWith(y,u,h){return y.substr(0,u.length)===u}function endsWith(y,u,h){return(h===void 0||h>y.length)&&(h=y.length),y.substring(h-u.length,h)===u}function includes(y,u,h){return typeof h!="number"&&(h=0),h+u.length>y.length?!1:y.indexOf(u,h)!==-1}createErrorType("ERR_INVALID_OPT_VALUE",function(y,u){return'The value "'+u+'" is invalid for option "'+y+'"'},TypeError),createErrorType("ERR_INVALID_ARG_TYPE",function(y,u,h){var v;typeof u=="string"&&startsWith(u,"not ")?(v="must not be",u=u.replace(/^not /,"")):v="must be";var w;if(endsWith(y," argument"))w="The ".concat(y," ").concat(v," ").concat(oneOf(u,"type"));else{var b=includes(y,".")?"property":"argument";w='The "'.concat(y,'" ').concat(b," ").concat(v," ").concat(oneOf(u,"type"))}return w+=". Received type ".concat(typeof h),w},TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(y){return"The "+y+" method is not implemented"}),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",function(y){return"Cannot call "+y+" after a stream was destroyed"}),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",function(y){return"Unknown encoding: "+y},TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=codes;var ERR_INVALID_OPT_VALUE=errorsBrowser.codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(y,u,h){return y.highWaterMark!=null?y.highWaterMark:u?y[h]:null}function getHighWaterMark(y,u,h,v){var w=highWaterMarkFrom(u,v,h);if(w!=null){if(!(isFinite(w)&&Math.floor(w)===w)||w<0){var b=v?h:"highWaterMark";throw new ERR_INVALID_OPT_VALUE(b,w)}return Math.floor(w)}return y.objectMode?16:16*1024}var state={getHighWaterMark},browser$a=deprecate;function deprecate(y,u){if(config("noDeprecation"))return y;var h=!1;function v(){if(!h){if(config("throwDeprecation"))throw new Error(u);config("traceDeprecation")?console.trace(u):console.warn(u),h=!0}return y.apply(this,arguments)}return v}function config(y){try{if(!commonjsGlobal.localStorage)return!1}catch{return!1}var u=commonjsGlobal.localStorage[y];return u==null?!1:String(u).toLowerCase()==="true"}var _stream_writable$1,hasRequired_stream_writable$1;function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;hasRequired_stream_writable$1=1,_stream_writable$1=Be;function y(Ae){var oe=this;this.next=null,this.entry=null,this.finish=function(){Ve(oe,Ae)}}var u;Be.WritableState=$e;var h={deprecate:browser$a},v=streamBrowser$1,w=dist.Buffer,b=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function E(Ae){return w.from(Ae)}function $(Ae){return w.isBuffer(Ae)||Ae instanceof b}var M=destroy_1$1,T=state,C=T.getHighWaterMark,B=errorsBrowser.codes,N=B.ERR_INVALID_ARG_TYPE,H=B.ERR_METHOD_NOT_IMPLEMENTED,te=B.ERR_MULTIPLE_CALLBACK,fe=B.ERR_STREAM_CANNOT_PIPE,ce=B.ERR_STREAM_DESTROYED,le=B.ERR_STREAM_NULL_VALUES,ie=B.ERR_STREAM_WRITE_AFTER_END,ge=B.ERR_UNKNOWN_ENCODING,pe=M.errorOrDestroy;inherits_browserExports(Be,v);function Me(){}function $e(Ae,oe,ye){u=u||require_stream_duplex$1(),Ae=Ae||{},typeof ye!="boolean"&&(ye=oe instanceof u),this.objectMode=!!Ae.objectMode,ye&&(this.objectMode=this.objectMode||!!Ae.writableObjectMode),this.highWaterMark=C(this,Ae,"writableHighWaterMark",ye),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Ce=Ae.decodeStrings===!1;this.decodeStrings=!Ce,this.defaultEncoding=Ae.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ae){X(oe,ae)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Ae.emitClose!==!1,this.autoDestroy=!!Ae.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new y(this)}$e.prototype.getBuffer=function(){for(var oe=this.bufferedRequest,ye=[];oe;)ye.push(oe),oe=oe.next;return ye},function(){try{Object.defineProperty($e.prototype,"buffer",{get:h.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var Pe;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Pe=Function.prototype[Symbol.hasInstance],Object.defineProperty(Be,Symbol.hasInstance,{value:function(oe){return Pe.call(this,oe)?!0:this!==Be?!1:oe&&oe._writableState instanceof $e}})):Pe=function(oe){return oe instanceof this};function Be(Ae){u=u||require_stream_duplex$1();var oe=this instanceof u;if(!oe&&!Pe.call(Be,this))return new Be(Ae);this._writableState=new $e(Ae,this,oe),this.writable=!0,Ae&&(typeof Ae.write=="function"&&(this._write=Ae.write),typeof Ae.writev=="function"&&(this._writev=Ae.writev),typeof Ae.destroy=="function"&&(this._destroy=Ae.destroy),typeof Ae.final=="function"&&(this._final=Ae.final)),v.call(this)}Be.prototype.pipe=function(){pe(this,new fe)};function Re(Ae,oe){var ye=new ie;pe(Ae,ye),process$1.nextTick(oe,ye)}function je(Ae,oe,ye,Ce){var ae;return ye===null?ae=new le:typeof ye!="string"&&!oe.objectMode&&(ae=new N("chunk",["string","Buffer"],ye)),ae?(pe(Ae,ae),process$1.nextTick(Ce,ae),!1):!0}Be.prototype.write=function(Ae,oe,ye){var Ce=this._writableState,ae=!1,de=!Ce.objectMode&&$(Ae);return de&&!w.isBuffer(Ae)&&(Ae=E(Ae)),typeof oe=="function"&&(ye=oe,oe=null),de?oe="buffer":oe||(oe=Ce.defaultEncoding),typeof ye!="function"&&(ye=Me),Ce.ending?Re(this,ye):(de||je(this,Ce,Ae,ye))&&(Ce.pendingcb++,ae=D(this,Ce,de,Ae,oe,ye)),ae},Be.prototype.cork=function(){this._writableState.corked++},Be.prototype.uncork=function(){var Ae=this._writableState;Ae.corked&&(Ae.corked--,!Ae.writing&&!Ae.corked&&!Ae.bufferProcessing&&Ae.bufferedRequest&&ee(this,Ae))},Be.prototype.setDefaultEncoding=function(oe){if(typeof oe=="string"&&(oe=oe.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((oe+"").toLowerCase())>-1))throw new ge(oe);return this._writableState.defaultEncoding=oe,this},Object.defineProperty(Be.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function we(Ae,oe,ye){return!Ae.objectMode&&Ae.decodeStrings!==!1&&typeof oe=="string"&&(oe=w.from(oe,ye)),oe}Object.defineProperty(Be.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function D(Ae,oe,ye,Ce,ae,de){if(!ye){var ne=we(oe,Ce,ae);Ce!==ne&&(ye=!0,ae="buffer",Ce=ne)}var be=oe.objectMode?1:Ce.length;oe.length+=be;var Ie=oe.length<oe.highWaterMark;if(Ie||(oe.needDrain=!0),oe.writing||oe.corked){var Le=oe.lastBufferedRequest;oe.lastBufferedRequest={chunk:Ce,encoding:ae,isBuf:ye,callback:de,next:null},Le?Le.next=oe.lastBufferedRequest:oe.bufferedRequest=oe.lastBufferedRequest,oe.bufferedRequestCount+=1}else q(Ae,oe,!1,be,Ce,ae,de);return Ie}function q(Ae,oe,ye,Ce,ae,de,ne){oe.writelen=Ce,oe.writecb=ne,oe.writing=!0,oe.sync=!0,oe.destroyed?oe.onwrite(new ce("write")):ye?Ae._writev(ae,oe.onwrite):Ae._write(ae,de,oe.onwrite),oe.sync=!1}function O(Ae,oe,ye,Ce,ae){--oe.pendingcb,ye?(process$1.nextTick(ae,Ce),process$1.nextTick(he,Ae,oe),Ae._writableState.errorEmitted=!0,pe(Ae,Ce)):(ae(Ce),Ae._writableState.errorEmitted=!0,pe(Ae,Ce),he(Ae,oe))}function L(Ae){Ae.writing=!1,Ae.writecb=null,Ae.length-=Ae.writelen,Ae.writelen=0}function X(Ae,oe){var ye=Ae._writableState,Ce=ye.sync,ae=ye.writecb;if(typeof ae!="function")throw new te;if(L(ye),oe)O(Ae,ye,Ce,oe,ae);else{var de=F(ye)||Ae.destroyed;!de&&!ye.corked&&!ye.bufferProcessing&&ye.bufferedRequest&&ee(Ae,ye),Ce?process$1.nextTick(j,Ae,ye,de,ae):j(Ae,ye,de,ae)}}function j(Ae,oe,ye,Ce){ye||re(Ae,oe),oe.pendingcb--,Ce(),he(Ae,oe)}function re(Ae,oe){oe.length===0&&oe.needDrain&&(oe.needDrain=!1,Ae.emit("drain"))}function ee(Ae,oe){oe.bufferProcessing=!0;var ye=oe.bufferedRequest;if(Ae._writev&&ye&&ye.next){var Ce=oe.bufferedRequestCount,ae=new Array(Ce),de=oe.corkedRequestsFree;de.entry=ye;for(var ne=0,be=!0;ye;)ae[ne]=ye,ye.isBuf||(be=!1),ye=ye.next,ne+=1;ae.allBuffers=be,q(Ae,oe,!0,oe.length,ae,"",de.finish),oe.pendingcb++,oe.lastBufferedRequest=null,de.next?(oe.corkedRequestsFree=de.next,de.next=null):oe.corkedRequestsFree=new y(oe),oe.bufferedRequestCount=0}else{for(;ye;){var Ie=ye.chunk,Le=ye.encoding,Fe=ye.callback,He=oe.objectMode?1:Ie.length;if(q(Ae,oe,!1,He,Ie,Le,Fe),ye=ye.next,oe.bufferedRequestCount--,oe.writing)break}ye===null&&(oe.lastBufferedRequest=null)}oe.bufferedRequest=ye,oe.bufferProcessing=!1}Be.prototype._write=function(Ae,oe,ye){ye(new H("_write()"))},Be.prototype._writev=null,Be.prototype.end=function(Ae,oe,ye){var Ce=this._writableState;return typeof Ae=="function"?(ye=Ae,Ae=null,oe=null):typeof oe=="function"&&(ye=oe,oe=null),Ae!=null&&this.write(Ae,oe),Ce.corked&&(Ce.corked=1,this.uncork()),Ce.ending||Oe(this,Ce,ye),this},Object.defineProperty(Be.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function F(Ae){return Ae.ending&&Ae.length===0&&Ae.bufferedRequest===null&&!Ae.finished&&!Ae.writing}function Q(Ae,oe){Ae._final(function(ye){oe.pendingcb--,ye&&pe(Ae,ye),oe.prefinished=!0,Ae.emit("prefinish"),he(Ae,oe)})}function U(Ae,oe){!oe.prefinished&&!oe.finalCalled&&(typeof Ae._final=="function"&&!oe.destroyed?(oe.pendingcb++,oe.finalCalled=!0,process$1.nextTick(Q,Ae,oe)):(oe.prefinished=!0,Ae.emit("prefinish")))}function he(Ae,oe){var ye=F(oe);if(ye&&(U(Ae,oe),oe.pendingcb===0&&(oe.finished=!0,Ae.emit("finish"),oe.autoDestroy))){var Ce=Ae._readableState;(!Ce||Ce.autoDestroy&&Ce.endEmitted)&&Ae.destroy()}return ye}function Oe(Ae,oe,ye){oe.ending=!0,he(Ae,oe),ye&&(oe.finished?process$1.nextTick(ye):Ae.once("finish",ye)),oe.ended=!0,Ae.writable=!1}function Ve(Ae,oe,ye){var Ce=Ae.entry;for(Ae.entry=null;Ce;){var ae=Ce.callback;oe.pendingcb--,ae(ye),Ce=Ce.next}oe.corkedRequestsFree.next=Ae}return Object.defineProperty(Be.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(oe){this._writableState&&(this._writableState.destroyed=oe)}}),Be.prototype.destroy=M.destroy,Be.prototype._undestroy=M.undestroy,Be.prototype._destroy=function(Ae,oe){oe(Ae)},_stream_writable$1}var _stream_duplex$1,hasRequired_stream_duplex$1;function require_stream_duplex$1(){if(hasRequired_stream_duplex$1)return _stream_duplex$1;hasRequired_stream_duplex$1=1;var y=Object.keys||function(T){var C=[];for(var B in T)C.push(B);return C};_stream_duplex$1=E;var u=require_stream_readable$1(),h=require_stream_writable$1();inherits_browserExports(E,u);for(var v=y(h.prototype),w=0;w<v.length;w++){var b=v[w];E.prototype[b]||(E.prototype[b]=h.prototype[b])}function E(T){if(!(this instanceof E))return new E(T);u.call(this,T),h.call(this,T),this.allowHalfOpen=!0,T&&(T.readable===!1&&(this.readable=!1),T.writable===!1&&(this.writable=!1),T.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",$)))}Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function $(){this._writableState.ended||process$1.nextTick(M,this)}function M(T){T.end()}return Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(C){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=C,this._writableState.destroyed=C)}}),_stream_duplex$1}var string_decoder={},Buffer$A=safeBufferExports$1.Buffer,isEncoding=Buffer$A.isEncoding||function(y){switch(y=""+y,y&&y.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 _normalizeEncoding(y){if(!y)return"utf8";for(var u;;)switch(y){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 y;default:if(u)return;y=(""+y).toLowerCase(),u=!0}}function normalizeEncoding(y){var u=_normalizeEncoding(y);if(typeof u!="string"&&(Buffer$A.isEncoding===isEncoding||!isEncoding(y)))throw new Error("Unknown encoding: "+y);return u||y}string_decoder.StringDecoder=StringDecoder$1;function StringDecoder$1(y){this.encoding=normalizeEncoding(y);var u;switch(this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,u=4;break;case"utf8":this.fillLast=utf8FillLast,u=4;break;case"base64":this.text=base64Text,this.end=base64End,u=3;break;default:this.write=simpleWrite,this.end=simpleEnd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer$A.allocUnsafe(u)}StringDecoder$1.prototype.write=function(y){if(y.length===0)return"";var u,h;if(this.lastNeed){if(u=this.fillLast(y),u===void 0)return"";h=this.lastNeed,this.lastNeed=0}else h=0;return h<y.length?u?u+this.text(y,h):this.text(y,h):u||""},StringDecoder$1.prototype.end=utf8End,StringDecoder$1.prototype.text=utf8Text,StringDecoder$1.prototype.fillLast=function(y){if(this.lastNeed<=y.length)return y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,y.length),this.lastNeed-=y.length};function utf8CheckByte(y){return y<=127?0:y>>5===6?2:y>>4===14?3:y>>3===30?4:y>>6===2?-1:-2}function utf8CheckIncomplete(y,u,h){var v=u.length-1;if(v<h)return 0;var w=utf8CheckByte(u[v]);return w>=0?(w>0&&(y.lastNeed=w-1),w):--v<h||w===-2?0:(w=utf8CheckByte(u[v]),w>=0?(w>0&&(y.lastNeed=w-2),w):--v<h||w===-2?0:(w=utf8CheckByte(u[v]),w>=0?(w>0&&(w===2?w=0:y.lastNeed=w-3),w):0))}function utf8CheckExtraBytes(y,u,h){if((u[0]&192)!==128)return y.lastNeed=0,"�";if(y.lastNeed>1&&u.length>1){if((u[1]&192)!==128)return y.lastNeed=1,"�";if(y.lastNeed>2&&u.length>2&&(u[2]&192)!==128)return y.lastNeed=2,"�"}}function utf8FillLast(y){var u=this.lastTotal-this.lastNeed,h=utf8CheckExtraBytes(this,y);if(h!==void 0)return h;if(this.lastNeed<=y.length)return y.copy(this.lastChar,u,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,u,0,y.length),this.lastNeed-=y.length}function utf8Text(y,u){var h=utf8CheckIncomplete(this,y,u);if(!this.lastNeed)return y.toString("utf8",u);this.lastTotal=h;var v=y.length-(h-this.lastNeed);return y.copy(this.lastChar,0,v),y.toString("utf8",u,v)}function utf8End(y){var u=y&&y.length?this.write(y):"";return this.lastNeed?u+"�":u}function utf16Text(y,u){if((y.length-u)%2===0){var h=y.toString("utf16le",u);if(h){var v=h.charCodeAt(h.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1],h.slice(0,-1)}return h}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=y[y.length-1],y.toString("utf16le",u,y.length-1)}function utf16End(y){var u=y&&y.length?this.write(y):"";if(this.lastNeed){var h=this.lastTotal-this.lastNeed;return u+this.lastChar.toString("utf16le",0,h)}return u}function base64Text(y,u){var h=(y.length-u)%3;return h===0?y.toString("base64",u):(this.lastNeed=3-h,this.lastTotal=3,h===1?this.lastChar[0]=y[y.length-1]:(this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1]),y.toString("base64",u,y.length-h))}function base64End(y){var u=y&&y.length?this.write(y):"";return this.lastNeed?u+this.lastChar.toString("base64",0,3-this.lastNeed):u}function simpleWrite(y){return y.toString(this.encoding)}function simpleEnd(y){return y&&y.length?this.write(y):""}var ERR_STREAM_PREMATURE_CLOSE=errorsBrowser.codes.ERR_STREAM_PREMATURE_CLOSE;function once$1(y){var u=!1;return function(){if(!u){u=!0;for(var h=arguments.length,v=new Array(h),w=0;w<h;w++)v[w]=arguments[w];y.apply(this,v)}}}function noop$2(){}function isRequest$1(y){return y.setHeader&&typeof y.abort=="function"}function eos$1(y,u,h){if(typeof u=="function")return eos$1(y,null,u);u||(u={}),h=once$1(h||noop$2);var v=u.readable||u.readable!==!1&&y.readable,w=u.writable||u.writable!==!1&&y.writable,b=function(){y.writable||$()},E=y._writableState&&y._writableState.finished,$=function(){w=!1,E=!0,v||h.call(y)},M=y._readableState&&y._readableState.endEmitted,T=function(){v=!1,M=!0,w||h.call(y)},C=function(te){h.call(y,te)},B=function(){var te;if(v&&!M)return(!y._readableState||!y._readableState.ended)&&(te=new ERR_STREAM_PREMATURE_CLOSE),h.call(y,te);if(w&&!E)return(!y._writableState||!y._writableState.ended)&&(te=new ERR_STREAM_PREMATURE_CLOSE),h.call(y,te)},N=function(){y.req.on("finish",$)};return isRequest$1(y)?(y.on("complete",$),y.on("abort",B),y.req?N():y.on("request",N)):w&&!y._writableState&&(y.on("end",b),y.on("close",b)),y.on("end",T),y.on("finish",$),u.error!==!1&&y.on("error",C),y.on("close",B),function(){y.removeListener("complete",$),y.removeListener("abort",B),y.removeListener("request",N),y.req&&y.req.removeListener("finish",$),y.removeListener("end",b),y.removeListener("close",b),y.removeListener("finish",$),y.removeListener("end",T),y.removeListener("error",C),y.removeListener("close",B)}}var endOfStream=eos$1,async_iterator,hasRequiredAsync_iterator;function requireAsync_iterator(){if(hasRequiredAsync_iterator)return async_iterator;hasRequiredAsync_iterator=1;var y;function u(ge,pe,Me){return pe=h(pe),pe in ge?Object.defineProperty(ge,pe,{value:Me,enumerable:!0,configurable:!0,writable:!0}):ge[pe]=Me,ge}function h(ge){var pe=v(ge,"string");return typeof pe=="symbol"?pe:String(pe)}function v(ge,pe){if(typeof ge!="object"||ge===null)return ge;var Me=ge[Symbol.toPrimitive];if(Me!==void 0){var $e=Me.call(ge,pe||"default");if(typeof $e!="object")return $e;throw new TypeError("@@toPrimitive must return a primitive value.")}return(pe==="string"?String:Number)(ge)}var w=endOfStream,b=Symbol("lastResolve"),E=Symbol("lastReject"),$=Symbol("error"),M=Symbol("ended"),T=Symbol("lastPromise"),C=Symbol("handlePromise"),B=Symbol("stream");function N(ge,pe){return{value:ge,done:pe}}function H(ge){var pe=ge[b];if(pe!==null){var Me=ge[B].read();Me!==null&&(ge[T]=null,ge[b]=null,ge[E]=null,pe(N(Me,!1)))}}function te(ge){process$1.nextTick(H,ge)}function fe(ge,pe){return function(Me,$e){ge.then(function(){if(pe[M]){Me(N(void 0,!0));return}pe[C](Me,$e)},$e)}}var ce=Object.getPrototypeOf(function(){}),le=Object.setPrototypeOf((y={get stream(){return this[B]},next:function(){var pe=this,Me=this[$];if(Me!==null)return Promise.reject(Me);if(this[M])return Promise.resolve(N(void 0,!0));if(this[B].destroyed)return new Promise(function(Re,je){process$1.nextTick(function(){pe[$]?je(pe[$]):Re(N(void 0,!0))})});var $e=this[T],Pe;if($e)Pe=new Promise(fe($e,this));else{var Be=this[B].read();if(Be!==null)return Promise.resolve(N(Be,!1));Pe=new Promise(this[C])}return this[T]=Pe,Pe}},u(y,Symbol.asyncIterator,function(){return this}),u(y,"return",function(){var pe=this;return new Promise(function(Me,$e){pe[B].destroy(null,function(Pe){if(Pe){$e(Pe);return}Me(N(void 0,!0))})})}),y),ce),ie=function(pe){var Me,$e=Object.create(le,(Me={},u(Me,B,{value:pe,writable:!0}),u(Me,b,{value:null,writable:!0}),u(Me,E,{value:null,writable:!0}),u(Me,$,{value:null,writable:!0}),u(Me,M,{value:pe._readableState.endEmitted,writable:!0}),u(Me,C,{value:function(Be,Re){var je=$e[B].read();je?($e[T]=null,$e[b]=null,$e[E]=null,Be(N(je,!1))):($e[b]=Be,$e[E]=Re)},writable:!0}),Me));return $e[T]=null,w(pe,function(Pe){if(Pe&&Pe.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Be=$e[E];Be!==null&&($e[T]=null,$e[b]=null,$e[E]=null,Be(Pe)),$e[$]=Pe;return}var Re=$e[b];Re!==null&&($e[T]=null,$e[b]=null,$e[E]=null,Re(N(void 0,!0))),$e[M]=!0}),pe.on("readable",te.bind(null,$e)),$e};return async_iterator=ie,async_iterator}var fromBrowser,hasRequiredFromBrowser;function requireFromBrowser(){return hasRequiredFromBrowser||(hasRequiredFromBrowser=1,fromBrowser=function(){throw new Error("Readable.from is not available in the browser")}),fromBrowser}var _stream_readable$1,hasRequired_stream_readable$1;function require_stream_readable$1(){if(hasRequired_stream_readable$1)return _stream_readable$1;hasRequired_stream_readable$1=1,_stream_readable$1=Re;var y;Re.ReadableState=Be,eventsExports.EventEmitter;var u=function(ne,be){return ne.listeners(be).length},h=streamBrowser$1,v=dist.Buffer,w=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function b(de){return v.from(de)}function E(de){return v.isBuffer(de)||de instanceof w}var $=util$b,M;$&&$.debuglog?M=$.debuglog("stream"):M=function(){};var T=requireBuffer_list(),C=destroy_1$1,B=state,N=B.getHighWaterMark,H=errorsBrowser.codes,te=H.ERR_INVALID_ARG_TYPE,fe=H.ERR_STREAM_PUSH_AFTER_EOF,ce=H.ERR_METHOD_NOT_IMPLEMENTED,le=H.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,ie,ge,pe;inherits_browserExports(Re,h);var Me=C.errorOrDestroy,$e=["error","close","destroy","pause","resume"];function Pe(de,ne,be){if(typeof de.prependListener=="function")return de.prependListener(ne,be);!de._events||!de._events[ne]?de.on(ne,be):Array.isArray(de._events[ne])?de._events[ne].unshift(be):de._events[ne]=[be,de._events[ne]]}function Be(de,ne,be){y=y||require_stream_duplex$1(),de=de||{},typeof be!="boolean"&&(be=ne instanceof y),this.objectMode=!!de.objectMode,be&&(this.objectMode=this.objectMode||!!de.readableObjectMode),this.highWaterMark=N(this,de,"readableHighWaterMark",be),this.buffer=new T,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=de.emitClose!==!1,this.autoDestroy=!!de.autoDestroy,this.destroyed=!1,this.defaultEncoding=de.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,de.encoding&&(ie||(ie=string_decoder.StringDecoder),this.decoder=new ie(de.encoding),this.encoding=de.encoding)}function Re(de){if(y=y||require_stream_duplex$1(),!(this instanceof Re))return new Re(de);var ne=this instanceof y;this._readableState=new Be(de,this,ne),this.readable=!0,de&&(typeof de.read=="function"&&(this._read=de.read),typeof de.destroy=="function"&&(this._destroy=de.destroy)),h.call(this)}Object.defineProperty(Re.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(ne){this._readableState&&(this._readableState.destroyed=ne)}}),Re.prototype.destroy=C.destroy,Re.prototype._undestroy=C.undestroy,Re.prototype._destroy=function(de,ne){ne(de)},Re.prototype.push=function(de,ne){var be=this._readableState,Ie;return be.objectMode?Ie=!0:typeof de=="string"&&(ne=ne||be.defaultEncoding,ne!==be.encoding&&(de=v.from(de,ne),ne=""),Ie=!0),je(this,de,ne,!1,Ie)},Re.prototype.unshift=function(de){return je(this,de,null,!0,!1)};function je(de,ne,be,Ie,Le){M("readableAddChunk",ne);var Fe=de._readableState;if(ne===null)Fe.reading=!1,X(de,Fe);else{var He;if(Le||(He=D(Fe,ne)),He)Me(de,He);else if(Fe.objectMode||ne&&ne.length>0)if(typeof ne!="string"&&!Fe.objectMode&&Object.getPrototypeOf(ne)!==v.prototype&&(ne=b(ne)),Ie)Fe.endEmitted?Me(de,new le):we(de,Fe,ne,!0);else if(Fe.ended)Me(de,new fe);else{if(Fe.destroyed)return!1;Fe.reading=!1,Fe.decoder&&!be?(ne=Fe.decoder.write(ne),Fe.objectMode||ne.length!==0?we(de,Fe,ne,!1):ee(de,Fe)):we(de,Fe,ne,!1)}else Ie||(Fe.reading=!1,ee(de,Fe))}return!Fe.ended&&(Fe.length<Fe.highWaterMark||Fe.length===0)}function we(de,ne,be,Ie){ne.flowing&&ne.length===0&&!ne.sync?(ne.awaitDrain=0,de.emit("data",be)):(ne.length+=ne.objectMode?1:be.length,Ie?ne.buffer.unshift(be):ne.buffer.push(be),ne.needReadable&&j(de)),ee(de,ne)}function D(de,ne){var be;return!E(ne)&&typeof ne!="string"&&ne!==void 0&&!de.objectMode&&(be=new te("chunk",["string","Buffer","Uint8Array"],ne)),be}Re.prototype.isPaused=function(){return this._readableState.flowing===!1},Re.prototype.setEncoding=function(de){ie||(ie=string_decoder.StringDecoder);var ne=new ie(de);this._readableState.decoder=ne,this._readableState.encoding=this._readableState.decoder.encoding;for(var be=this._readableState.buffer.head,Ie="";be!==null;)Ie+=ne.write(be.data),be=be.next;return this._readableState.buffer.clear(),Ie!==""&&this._readableState.buffer.push(Ie),this._readableState.length=Ie.length,this};var q=1073741824;function O(de){return de>=q?de=q:(de--,de|=de>>>1,de|=de>>>2,de|=de>>>4,de|=de>>>8,de|=de>>>16,de++),de}function L(de,ne){return de<=0||ne.length===0&&ne.ended?0:ne.objectMode?1:de!==de?ne.flowing&&ne.length?ne.buffer.head.data.length:ne.length:(de>ne.highWaterMark&&(ne.highWaterMark=O(de)),de<=ne.length?de:ne.ended?ne.length:(ne.needReadable=!0,0))}Re.prototype.read=function(de){M("read",de),de=parseInt(de,10);var ne=this._readableState,be=de;if(de!==0&&(ne.emittedReadable=!1),de===0&&ne.needReadable&&((ne.highWaterMark!==0?ne.length>=ne.highWaterMark:ne.length>0)||ne.ended))return M("read: emitReadable",ne.length,ne.ended),ne.length===0&&ne.ended?ye(this):j(this),null;if(de=L(de,ne),de===0&&ne.ended)return ne.length===0&&ye(this),null;var Ie=ne.needReadable;M("need readable",Ie),(ne.length===0||ne.length-de<ne.highWaterMark)&&(Ie=!0,M("length less than watermark",Ie)),ne.ended||ne.reading?(Ie=!1,M("reading or ended",Ie)):Ie&&(M("do read"),ne.reading=!0,ne.sync=!0,ne.length===0&&(ne.needReadable=!0),this._read(ne.highWaterMark),ne.sync=!1,ne.reading||(de=L(be,ne)));var Le;return de>0?Le=oe(de,ne):Le=null,Le===null?(ne.needReadable=ne.length<=ne.highWaterMark,de=0):(ne.length-=de,ne.awaitDrain=0),ne.length===0&&(ne.ended||(ne.needReadable=!0),be!==de&&ne.ended&&ye(this)),Le!==null&&this.emit("data",Le),Le};function X(de,ne){if(M("onEofChunk"),!ne.ended){if(ne.decoder){var be=ne.decoder.end();be&&be.length&&(ne.buffer.push(be),ne.length+=ne.objectMode?1:be.length)}ne.ended=!0,ne.sync?j(de):(ne.needReadable=!1,ne.emittedReadable||(ne.emittedReadable=!0,re(de)))}}function j(de){var ne=de._readableState;M("emitReadable",ne.needReadable,ne.emittedReadable),ne.needReadable=!1,ne.emittedReadable||(M("emitReadable",ne.flowing),ne.emittedReadable=!0,process$1.nextTick(re,de))}function re(de){var ne=de._readableState;M("emitReadable_",ne.destroyed,ne.length,ne.ended),!ne.destroyed&&(ne.length||ne.ended)&&(de.emit("readable"),ne.emittedReadable=!1),ne.needReadable=!ne.flowing&&!ne.ended&&ne.length<=ne.highWaterMark,Ae(de)}function ee(de,ne){ne.readingMore||(ne.readingMore=!0,process$1.nextTick(F,de,ne))}function F(de,ne){for(;!ne.reading&&!ne.ended&&(ne.length<ne.highWaterMark||ne.flowing&&ne.length===0);){var be=ne.length;if(M("maybeReadMore read 0"),de.read(0),be===ne.length)break}ne.readingMore=!1}Re.prototype._read=function(de){Me(this,new ce("_read()"))},Re.prototype.pipe=function(de,ne){var be=this,Ie=this._readableState;switch(Ie.pipesCount){case 0:Ie.pipes=de;break;case 1:Ie.pipes=[Ie.pipes,de];break;default:Ie.pipes.push(de);break}Ie.pipesCount+=1,M("pipe count=%d opts=%j",Ie.pipesCount,ne);var Le=(!ne||ne.end!==!1)&&de!==process$1.stdout&&de!==process$1.stderr,Fe=Le?tt:Rt;Ie.endEmitted?process$1.nextTick(Fe):be.once("end",Fe),de.on("unpipe",He);function He(dt,Ct){M("onunpipe"),dt===be&&Ct&&Ct.hasUnpiped===!1&&(Ct.hasUnpiped=!0,it())}function tt(){M("onend"),de.end()}var Ne=Q(be);de.on("drain",Ne);var nt=!1;function it(){M("cleanup"),de.removeListener("close",ht),de.removeListener("finish",St),de.removeListener("drain",Ne),de.removeListener("error",ut),de.removeListener("unpipe",He),be.removeListener("end",tt),be.removeListener("end",Rt),be.removeListener("data",ot),nt=!0,Ie.awaitDrain&&(!de._writableState||de._writableState.needDrain)&&Ne()}be.on("data",ot);function ot(dt){M("ondata");var Ct=de.write(dt);M("dest.write",Ct),Ct===!1&&((Ie.pipesCount===1&&Ie.pipes===de||Ie.pipesCount>1&&ae(Ie.pipes,de)!==-1)&&!nt&&(M("false write response, pause",Ie.awaitDrain),Ie.awaitDrain++),be.pause())}function ut(dt){M("onerror",dt),Rt(),de.removeListener("error",ut),u(de,"error")===0&&Me(de,dt)}Pe(de,"error",ut);function ht(){de.removeListener("finish",St),Rt()}de.once("close",ht);function St(){M("onfinish"),de.removeListener("close",ht),Rt()}de.once("finish",St);function Rt(){M("unpipe"),be.unpipe(de)}return de.emit("pipe",be),Ie.flowing||(M("pipe resume"),be.resume()),de};function Q(de){return function(){var be=de._readableState;M("pipeOnDrain",be.awaitDrain),be.awaitDrain&&be.awaitDrain--,be.awaitDrain===0&&u(de,"data")&&(be.flowing=!0,Ae(de))}}Re.prototype.unpipe=function(de){var ne=this._readableState,be={hasUnpiped:!1};if(ne.pipesCount===0)return this;if(ne.pipesCount===1)return de&&de!==ne.pipes?this:(de||(de=ne.pipes),ne.pipes=null,ne.pipesCount=0,ne.flowing=!1,de&&de.emit("unpipe",this,be),this);if(!de){var Ie=ne.pipes,Le=ne.pipesCount;ne.pipes=null,ne.pipesCount=0,ne.flowing=!1;for(var Fe=0;Fe<Le;Fe++)Ie[Fe].emit("unpipe",this,{hasUnpiped:!1});return this}var He=ae(ne.pipes,de);return He===-1?this:(ne.pipes.splice(He,1),ne.pipesCount-=1,ne.pipesCount===1&&(ne.pipes=ne.pipes[0]),de.emit("unpipe",this,be),this)},Re.prototype.on=function(de,ne){var be=h.prototype.on.call(this,de,ne),Ie=this._readableState;return de==="data"?(Ie.readableListening=this.listenerCount("readable")>0,Ie.flowing!==!1&&this.resume()):de==="readable"&&!Ie.endEmitted&&!Ie.readableListening&&(Ie.readableListening=Ie.needReadable=!0,Ie.flowing=!1,Ie.emittedReadable=!1,M("on readable",Ie.length,Ie.reading),Ie.length?j(this):Ie.reading||process$1.nextTick(he,this)),be},Re.prototype.addListener=Re.prototype.on,Re.prototype.removeListener=function(de,ne){var be=h.prototype.removeListener.call(this,de,ne);return de==="readable"&&process$1.nextTick(U,this),be},Re.prototype.removeAllListeners=function(de){var ne=h.prototype.removeAllListeners.apply(this,arguments);return(de==="readable"||de===void 0)&&process$1.nextTick(U,this),ne};function U(de){var ne=de._readableState;ne.readableListening=de.listenerCount("readable")>0,ne.resumeScheduled&&!ne.paused?ne.flowing=!0:de.listenerCount("data")>0&&de.resume()}function he(de){M("readable nexttick read 0"),de.read(0)}Re.prototype.resume=function(){var de=this._readableState;return de.flowing||(M("resume"),de.flowing=!de.readableListening,Oe(this,de)),de.paused=!1,this};function Oe(de,ne){ne.resumeScheduled||(ne.resumeScheduled=!0,process$1.nextTick(Ve,de,ne))}function Ve(de,ne){M("resume",ne.reading),ne.reading||de.read(0),ne.resumeScheduled=!1,de.emit("resume"),Ae(de),ne.flowing&&!ne.reading&&de.read(0)}Re.prototype.pause=function(){return M("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(M("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Ae(de){var ne=de._readableState;for(M("flow",ne.flowing);ne.flowing&&de.read()!==null;);}Re.prototype.wrap=function(de){var ne=this,be=this._readableState,Ie=!1;de.on("end",function(){if(M("wrapped end"),be.decoder&&!be.ended){var He=be.decoder.end();He&&He.length&&ne.push(He)}ne.push(null)}),de.on("data",function(He){if(M("wrapped data"),be.decoder&&(He=be.decoder.write(He)),!(be.objectMode&&He==null)&&!(!be.objectMode&&(!He||!He.length))){var tt=ne.push(He);tt||(Ie=!0,de.pause())}});for(var Le in de)this[Le]===void 0&&typeof de[Le]=="function"&&(this[Le]=function(tt){return function(){return de[tt].apply(de,arguments)}}(Le));for(var Fe=0;Fe<$e.length;Fe++)de.on($e[Fe],this.emit.bind(this,$e[Fe]));return this._read=function(He){M("wrapped _read",He),Ie&&(Ie=!1,de.resume())},this},typeof Symbol=="function"&&(Re.prototype[Symbol.asyncIterator]=function(){return ge===void 0&&(ge=requireAsync_iterator()),ge(this)}),Object.defineProperty(Re.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Re.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Re.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(ne){this._readableState&&(this._readableState.flowing=ne)}}),Re._fromList=oe,Object.defineProperty(Re.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function oe(de,ne){if(ne.length===0)return null;var be;return ne.objectMode?be=ne.buffer.shift():!de||de>=ne.length?(ne.decoder?be=ne.buffer.join(""):ne.buffer.length===1?be=ne.buffer.first():be=ne.buffer.concat(ne.length),ne.buffer.clear()):be=ne.buffer.consume(de,ne.decoder),be}function ye(de){var ne=de._readableState;M("endReadable",ne.endEmitted),ne.endEmitted||(ne.ended=!0,process$1.nextTick(Ce,ne,de))}function Ce(de,ne){if(M("endReadableNT",de.endEmitted,de.length),!de.endEmitted&&de.length===0&&(de.endEmitted=!0,ne.readable=!1,ne.emit("end"),de.autoDestroy)){var be=ne._writableState;(!be||be.autoDestroy&&be.finished)&&ne.destroy()}}typeof Symbol=="function"&&(Re.from=function(de,ne){return pe===void 0&&(pe=requireFromBrowser()),pe(Re,de,ne)});function ae(de,ne){for(var be=0,Ie=de.length;be<Ie;be++)if(de[be]===ne)return be;return-1}return _stream_readable$1}var _stream_transform$1=Transform$9,_require$codes$1=errorsBrowser.codes,ERR_METHOD_NOT_IMPLEMENTED=_require$codes$1.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes$1.ERR_MULTIPLE_CALLBACK,ERR_TRANSFORM_ALREADY_TRANSFORMING=_require$codes$1.ERR_TRANSFORM_ALREADY_TRANSFORMING,ERR_TRANSFORM_WITH_LENGTH_0=_require$codes$1.ERR_TRANSFORM_WITH_LENGTH_0,Duplex$1=require_stream_duplex$1();inherits_browserExports(Transform$9,Duplex$1);function afterTransform$1(y,u){var h=this._transformState;h.transforming=!1;var v=h.writecb;if(v===null)return this.emit("error",new ERR_MULTIPLE_CALLBACK);h.writechunk=null,h.writecb=null,u!=null&&this.push(u),v(y);var w=this._readableState;w.reading=!1,(w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}function Transform$9(y){if(!(this instanceof Transform$9))return new Transform$9(y);Duplex$1.call(this,y),this._transformState={afterTransform:afterTransform$1.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,y&&(typeof y.transform=="function"&&(this._transform=y.transform),typeof y.flush=="function"&&(this._flush=y.flush)),this.on("prefinish",prefinish$1)}function prefinish$1(){var y=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(u,h){done$1(y,u,h)}):done$1(this,null,null)}Transform$9.prototype.push=function(y,u){return this._transformState.needTransform=!1,Duplex$1.prototype.push.call(this,y,u)},Transform$9.prototype._transform=function(y,u,h){h(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"))},Transform$9.prototype._write=function(y,u,h){var v=this._transformState;if(v.writecb=h,v.writechunk=y,v.writeencoding=u,!v.transforming){var w=this._readableState;(v.needTransform||w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}},Transform$9.prototype._read=function(y){var u=this._transformState;u.writechunk!==null&&!u.transforming?(u.transforming=!0,this._transform(u.writechunk,u.writeencoding,u.afterTransform)):u.needTransform=!0},Transform$9.prototype._destroy=function(y,u){Duplex$1.prototype._destroy.call(this,y,function(h){u(h)})};function done$1(y,u,h){if(u)return y.emit("error",u);if(h!=null&&y.push(h),y._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0;if(y._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING;return y.push(null)}var _stream_passthrough$1=PassThrough$1,Transform$8=_stream_transform$1;inherits_browserExports(PassThrough$1,Transform$8);function PassThrough$1(y){if(!(this instanceof PassThrough$1))return new PassThrough$1(y);Transform$8.call(this,y)}PassThrough$1.prototype._transform=function(y,u,h){h(null,y)};var eos;function once(y){var u=!1;return function(){u||(u=!0,y.apply(void 0,arguments))}}var _require$codes=errorsBrowser.codes,ERR_MISSING_ARGS=_require$codes.ERR_MISSING_ARGS,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED;function noop$1(y){if(y)throw y}function isRequest(y){return y.setHeader&&typeof y.abort=="function"}function destroyer(y,u,h,v){v=once(v);var w=!1;y.on("close",function(){w=!0}),eos===void 0&&(eos=endOfStream),eos(y,{readable:u,writable:h},function(E){if(E)return v(E);w=!0,v()});var b=!1;return function(E){if(!w&&!b){if(b=!0,isRequest(y))return y.abort();if(typeof y.destroy=="function")return y.destroy();v(E||new ERR_STREAM_DESTROYED("pipe"))}}}function call(y){y()}function pipe(y,u){return y.pipe(u)}function popCallback(y){return!y.length||typeof y[y.length-1]!="function"?noop$1:y.pop()}function pipeline(){for(var y=arguments.length,u=new Array(y),h=0;h<y;h++)u[h]=arguments[h];var v=popCallback(u);if(Array.isArray(u[0])&&(u=u[0]),u.length<2)throw new ERR_MISSING_ARGS("streams");var w,b=u.map(function(E,$){var M=$<u.length-1,T=$>0;return destroyer(E,M,T,function(C){w||(w=C),C&&b.forEach(call),!M&&(b.forEach(call),v(w))})});return u.reduce(pipe)}var pipeline_1=pipeline;(function(y,u){u=y.exports=require_stream_readable$1(),u.Stream=u,u.Readable=u,u.Writable=require_stream_writable$1(),u.Duplex=require_stream_duplex$1(),u.Transform=_stream_transform$1,u.PassThrough=_stream_passthrough$1,u.finished=endOfStream,u.pipeline=pipeline_1})(readableBrowser$1,readableBrowser$1.exports);var readableBrowserExports$1=readableBrowser$1.exports,Buffer$z=safeBufferExports$1.Buffer,Transform$7=readableBrowserExports$1.Transform,inherits$q=inherits_browserExports;function throwIfNotStringOrBuffer(y,u){if(!Buffer$z.isBuffer(y)&&typeof y!="string")throw new TypeError(u+" must be a string or a buffer")}function HashBase$2(y){Transform$7.call(this),this._block=Buffer$z.allocUnsafe(y),this._blockSize=y,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}inherits$q(HashBase$2,Transform$7),HashBase$2.prototype._transform=function(y,u,h){var v=null;try{this.update(y,u)}catch(w){v=w}h(v)},HashBase$2.prototype._flush=function(y){var u=null;try{this.push(this.digest())}catch(h){u=h}y(u)},HashBase$2.prototype.update=function(y,u){if(throwIfNotStringOrBuffer(y,"Data"),this._finalized)throw new Error("Digest already called");Buffer$z.isBuffer(y)||(y=Buffer$z.from(y,u));for(var h=this._block,v=0;this._blockOffset+y.length-v>=this._blockSize;){for(var w=this._blockOffset;w<this._blockSize;)h[w++]=y[v++];this._update(),this._blockOffset=0}for(;v<y.length;)h[this._blockOffset++]=y[v++];for(var b=0,E=y.length*8;E>0;++b)this._length[b]+=E,E=this._length[b]/4294967296|0,E>0&&(this._length[b]-=4294967296*E);return this},HashBase$2.prototype._update=function(){throw new Error("_update is not implemented")},HashBase$2.prototype.digest=function(y){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var u=this._digest();y!==void 0&&(u=u.toString(y)),this._block.fill(0),this._blockOffset=0;for(var h=0;h<4;++h)this._length[h]=0;return u},HashBase$2.prototype._digest=function(){throw new Error("_digest is not implemented")};var hashBase=HashBase$2,inherits$p=inherits_browserExports,HashBase$1=hashBase,Buffer$y=safeBufferExports$1.Buffer,ARRAY16$1=new Array(16);function MD5$3(){HashBase$1.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}inherits$p(MD5$3,HashBase$1),MD5$3.prototype._update=function(){for(var y=ARRAY16$1,u=0;u<16;++u)y[u]=this._block.readInt32LE(u*4);var h=this._a,v=this._b,w=this._c,b=this._d;h=fnF(h,v,w,b,y[0],3614090360,7),b=fnF(b,h,v,w,y[1],3905402710,12),w=fnF(w,b,h,v,y[2],606105819,17),v=fnF(v,w,b,h,y[3],3250441966,22),h=fnF(h,v,w,b,y[4],4118548399,7),b=fnF(b,h,v,w,y[5],1200080426,12),w=fnF(w,b,h,v,y[6],2821735955,17),v=fnF(v,w,b,h,y[7],4249261313,22),h=fnF(h,v,w,b,y[8],1770035416,7),b=fnF(b,h,v,w,y[9],2336552879,12),w=fnF(w,b,h,v,y[10],4294925233,17),v=fnF(v,w,b,h,y[11],2304563134,22),h=fnF(h,v,w,b,y[12],1804603682,7),b=fnF(b,h,v,w,y[13],4254626195,12),w=fnF(w,b,h,v,y[14],2792965006,17),v=fnF(v,w,b,h,y[15],1236535329,22),h=fnG(h,v,w,b,y[1],4129170786,5),b=fnG(b,h,v,w,y[6],3225465664,9),w=fnG(w,b,h,v,y[11],643717713,14),v=fnG(v,w,b,h,y[0],3921069994,20),h=fnG(h,v,w,b,y[5],3593408605,5),b=fnG(b,h,v,w,y[10],38016083,9),w=fnG(w,b,h,v,y[15],3634488961,14),v=fnG(v,w,b,h,y[4],3889429448,20),h=fnG(h,v,w,b,y[9],568446438,5),b=fnG(b,h,v,w,y[14],3275163606,9),w=fnG(w,b,h,v,y[3],4107603335,14),v=fnG(v,w,b,h,y[8],1163531501,20),h=fnG(h,v,w,b,y[13],2850285829,5),b=fnG(b,h,v,w,y[2],4243563512,9),w=fnG(w,b,h,v,y[7],1735328473,14),v=fnG(v,w,b,h,y[12],2368359562,20),h=fnH(h,v,w,b,y[5],4294588738,4),b=fnH(b,h,v,w,y[8],2272392833,11),w=fnH(w,b,h,v,y[11],1839030562,16),v=fnH(v,w,b,h,y[14],4259657740,23),h=fnH(h,v,w,b,y[1],2763975236,4),b=fnH(b,h,v,w,y[4],1272893353,11),w=fnH(w,b,h,v,y[7],4139469664,16),v=fnH(v,w,b,h,y[10],3200236656,23),h=fnH(h,v,w,b,y[13],681279174,4),b=fnH(b,h,v,w,y[0],3936430074,11),w=fnH(w,b,h,v,y[3],3572445317,16),v=fnH(v,w,b,h,y[6],76029189,23),h=fnH(h,v,w,b,y[9],3654602809,4),b=fnH(b,h,v,w,y[12],3873151461,11),w=fnH(w,b,h,v,y[15],530742520,16),v=fnH(v,w,b,h,y[2],3299628645,23),h=fnI(h,v,w,b,y[0],4096336452,6),b=fnI(b,h,v,w,y[7],1126891415,10),w=fnI(w,b,h,v,y[14],2878612391,15),v=fnI(v,w,b,h,y[5],4237533241,21),h=fnI(h,v,w,b,y[12],1700485571,6),b=fnI(b,h,v,w,y[3],2399980690,10),w=fnI(w,b,h,v,y[10],4293915773,15),v=fnI(v,w,b,h,y[1],2240044497,21),h=fnI(h,v,w,b,y[8],1873313359,6),b=fnI(b,h,v,w,y[15],4264355552,10),w=fnI(w,b,h,v,y[6],2734768916,15),v=fnI(v,w,b,h,y[13],1309151649,21),h=fnI(h,v,w,b,y[4],4149444226,6),b=fnI(b,h,v,w,y[11],3174756917,10),w=fnI(w,b,h,v,y[2],718787259,15),v=fnI(v,w,b,h,y[9],3951481745,21),this._a=this._a+h|0,this._b=this._b+v|0,this._c=this._c+w|0,this._d=this._d+b|0},MD5$3.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var y=Buffer$y.allocUnsafe(16);return y.writeInt32LE(this._a,0),y.writeInt32LE(this._b,4),y.writeInt32LE(this._c,8),y.writeInt32LE(this._d,12),y};function rotl$1(y,u){return y<<u|y>>>32-u}function fnF(y,u,h,v,w,b,E){return rotl$1(y+(u&h|~u&v)+w+b|0,E)+u|0}function fnG(y,u,h,v,w,b,E){return rotl$1(y+(u&v|h&~v)+w+b|0,E)+u|0}function fnH(y,u,h,v,w,b,E){return rotl$1(y+(u^h^v)+w+b|0,E)+u|0}function fnI(y,u,h,v,w,b,E){return rotl$1(y+(h^(u|~v))+w+b|0,E)+u|0}var md5_js=MD5$3,Buffer$x=dist.Buffer,inherits$o=inherits_browserExports,HashBase=hashBase,ARRAY16=new Array(16),zl=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zr=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],sl=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sr=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160$4(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}inherits$o(RIPEMD160$4,HashBase),RIPEMD160$4.prototype._update=function(){for(var y=ARRAY16,u=0;u<16;++u)y[u]=this._block.readInt32LE(u*4);for(var h=this._a|0,v=this._b|0,w=this._c|0,b=this._d|0,E=this._e|0,$=this._a|0,M=this._b|0,T=this._c|0,C=this._d|0,B=this._e|0,N=0;N<80;N+=1){var H,te;N<16?(H=fn1(h,v,w,b,E,y[zl[N]],hl[0],sl[N]),te=fn5($,M,T,C,B,y[zr[N]],hr[0],sr[N])):N<32?(H=fn2(h,v,w,b,E,y[zl[N]],hl[1],sl[N]),te=fn4($,M,T,C,B,y[zr[N]],hr[1],sr[N])):N<48?(H=fn3(h,v,w,b,E,y[zl[N]],hl[2],sl[N]),te=fn3($,M,T,C,B,y[zr[N]],hr[2],sr[N])):N<64?(H=fn4(h,v,w,b,E,y[zl[N]],hl[3],sl[N]),te=fn2($,M,T,C,B,y[zr[N]],hr[3],sr[N])):(H=fn5(h,v,w,b,E,y[zl[N]],hl[4],sl[N]),te=fn1($,M,T,C,B,y[zr[N]],hr[4],sr[N])),h=E,E=b,b=rotl(w,10),w=v,v=H,$=B,B=C,C=rotl(T,10),T=M,M=te}var fe=this._b+w+C|0;this._b=this._c+b+B|0,this._c=this._d+E+$|0,this._d=this._e+h+M|0,this._e=this._a+v+T|0,this._a=fe},RIPEMD160$4.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var y=Buffer$x.alloc?Buffer$x.alloc(20):new Buffer$x(20);return y.writeInt32LE(this._a,0),y.writeInt32LE(this._b,4),y.writeInt32LE(this._c,8),y.writeInt32LE(this._d,12),y.writeInt32LE(this._e,16),y};function rotl(y,u){return y<<u|y>>>32-u}function fn1(y,u,h,v,w,b,E,$){return rotl(y+(u^h^v)+b+E|0,$)+w|0}function fn2(y,u,h,v,w,b,E,$){return rotl(y+(u&h|~u&v)+b+E|0,$)+w|0}function fn3(y,u,h,v,w,b,E,$){return rotl(y+((u|~h)^v)+b+E|0,$)+w|0}function fn4(y,u,h,v,w,b,E,$){return rotl(y+(u&v|h&~v)+b+E|0,$)+w|0}function fn5(y,u,h,v,w,b,E,$){return rotl(y+(u^(h|~v))+b+E|0,$)+w|0}var ripemd160=RIPEMD160$4,sha_js={exports:{}},Buffer$w=safeBufferExports$1.Buffer;function Hash$7(y,u){this._block=Buffer$w.alloc(y),this._finalSize=u,this._blockSize=y,this._len=0}Hash$7.prototype.update=function(y,u){typeof y=="string"&&(u=u||"utf8",y=Buffer$w.from(y,u));for(var h=this._block,v=this._blockSize,w=y.length,b=this._len,E=0;E<w;){for(var $=b%v,M=Math.min(w-E,v-$),T=0;T<M;T++)h[$+T]=y[E+T];b+=M,E+=M,b%v===0&&this._update(h)}return this._len+=w,this},Hash$7.prototype.digest=function(y){var u=this._len%this._blockSize;this._block[u]=128,this._block.fill(0,u+1),u>=this._finalSize&&(this._update(this._block),this._block.fill(0));var h=this._len*8;if(h<=4294967295)this._block.writeUInt32BE(h,this._blockSize-4);else{var v=(h&4294967295)>>>0,w=(h-v)/4294967296;this._block.writeUInt32BE(w,this._blockSize-8),this._block.writeUInt32BE(v,this._blockSize-4)}this._update(this._block);var b=this._hash();return y?b.toString(y):b},Hash$7.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var hash$3=Hash$7,inherits$n=inherits_browserExports,Hash$6=hash$3,Buffer$v=safeBufferExports$1.Buffer,K$4=[1518500249,1859775393,-1894007588,-899497514],W$5=new Array(80);function Sha(){this.init(),this._w=W$5,Hash$6.call(this,64,56)}inherits$n(Sha,Hash$6),Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl5$1(y){return y<<5|y>>>27}function rotl30$1(y){return y<<30|y>>>2}function ft$1(y,u,h,v){return y===0?u&h|~u&v:y===2?u&h|u&v|h&v:u^h^v}Sha.prototype._update=function(y){for(var u=this._w,h=this._a|0,v=this._b|0,w=this._c|0,b=this._d|0,E=this._e|0,$=0;$<16;++$)u[$]=y.readInt32BE($*4);for(;$<80;++$)u[$]=u[$-3]^u[$-8]^u[$-14]^u[$-16];for(var M=0;M<80;++M){var T=~~(M/20),C=rotl5$1(h)+ft$1(T,v,w,b)+E+u[M]+K$4[T]|0;E=b,b=w,w=rotl30$1(v),v=h,h=C}this._a=h+this._a|0,this._b=v+this._b|0,this._c=w+this._c|0,this._d=b+this._d|0,this._e=E+this._e|0},Sha.prototype._hash=function(){var y=Buffer$v.allocUnsafe(20);return y.writeInt32BE(this._a|0,0),y.writeInt32BE(this._b|0,4),y.writeInt32BE(this._c|0,8),y.writeInt32BE(this._d|0,12),y.writeInt32BE(this._e|0,16),y};var sha$4=Sha,inherits$m=inherits_browserExports,Hash$5=hash$3,Buffer$u=safeBufferExports$1.Buffer,K$3=[1518500249,1859775393,-1894007588,-899497514],W$4=new Array(80);function Sha1(){this.init(),this._w=W$4,Hash$5.call(this,64,56)}inherits$m(Sha1,Hash$5),Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl1(y){return y<<1|y>>>31}function rotl5(y){return y<<5|y>>>27}function rotl30(y){return y<<30|y>>>2}function ft(y,u,h,v){return y===0?u&h|~u&v:y===2?u&h|u&v|h&v:u^h^v}Sha1.prototype._update=function(y){for(var u=this._w,h=this._a|0,v=this._b|0,w=this._c|0,b=this._d|0,E=this._e|0,$=0;$<16;++$)u[$]=y.readInt32BE($*4);for(;$<80;++$)u[$]=rotl1(u[$-3]^u[$-8]^u[$-14]^u[$-16]);for(var M=0;M<80;++M){var T=~~(M/20),C=rotl5(h)+ft(T,v,w,b)+E+u[M]+K$3[T]|0;E=b,b=w,w=rotl30(v),v=h,h=C}this._a=h+this._a|0,this._b=v+this._b|0,this._c=w+this._c|0,this._d=b+this._d|0,this._e=E+this._e|0},Sha1.prototype._hash=function(){var y=Buffer$u.allocUnsafe(20);return y.writeInt32BE(this._a|0,0),y.writeInt32BE(this._b|0,4),y.writeInt32BE(this._c|0,8),y.writeInt32BE(this._d|0,12),y.writeInt32BE(this._e|0,16),y};var sha1=Sha1,inherits$l=inherits_browserExports,Hash$4=hash$3,Buffer$t=safeBufferExports$1.Buffer,K$2=[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],W$3=new Array(64);function Sha256$1(){this.init(),this._w=W$3,Hash$4.call(this,64,56)}inherits$l(Sha256$1,Hash$4),Sha256$1.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function ch(y,u,h){return h^y&(u^h)}function maj$1(y,u,h){return y&u|h&(y|u)}function sigma0$1(y){return(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10)}function sigma1$1(y){return(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7)}function gamma0(y){return(y>>>7|y<<25)^(y>>>18|y<<14)^y>>>3}function gamma1(y){return(y>>>17|y<<15)^(y>>>19|y<<13)^y>>>10}Sha256$1.prototype._update=function(y){for(var u=this._w,h=this._a|0,v=this._b|0,w=this._c|0,b=this._d|0,E=this._e|0,$=this._f|0,M=this._g|0,T=this._h|0,C=0;C<16;++C)u[C]=y.readInt32BE(C*4);for(;C<64;++C)u[C]=gamma1(u[C-2])+u[C-7]+gamma0(u[C-15])+u[C-16]|0;for(var B=0;B<64;++B){var N=T+sigma1$1(E)+ch(E,$,M)+K$2[B]+u[B]|0,H=sigma0$1(h)+maj$1(h,v,w)|0;T=M,M=$,$=E,E=b+N|0,b=w,w=v,v=h,h=N+H|0}this._a=h+this._a|0,this._b=v+this._b|0,this._c=w+this._c|0,this._d=b+this._d|0,this._e=E+this._e|0,this._f=$+this._f|0,this._g=M+this._g|0,this._h=T+this._h|0},Sha256$1.prototype._hash=function(){var y=Buffer$t.allocUnsafe(32);return y.writeInt32BE(this._a,0),y.writeInt32BE(this._b,4),y.writeInt32BE(this._c,8),y.writeInt32BE(this._d,12),y.writeInt32BE(this._e,16),y.writeInt32BE(this._f,20),y.writeInt32BE(this._g,24),y.writeInt32BE(this._h,28),y};var sha256$1=Sha256$1,inherits$k=inherits_browserExports,Sha256=sha256$1,Hash$3=hash$3,Buffer$s=safeBufferExports$1.Buffer,W$2=new Array(64);function Sha224(){this.init(),this._w=W$2,Hash$3.call(this,64,56)}inherits$k(Sha224,Sha256),Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},Sha224.prototype._hash=function(){var y=Buffer$s.allocUnsafe(28);return y.writeInt32BE(this._a,0),y.writeInt32BE(this._b,4),y.writeInt32BE(this._c,8),y.writeInt32BE(this._d,12),y.writeInt32BE(this._e,16),y.writeInt32BE(this._f,20),y.writeInt32BE(this._g,24),y};var sha224$1=Sha224,inherits$j=inherits_browserExports,Hash$2=hash$3,Buffer$r=safeBufferExports$1.Buffer,K$1=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],W$1=new Array(160);function Sha512(){this.init(),this._w=W$1,Hash$2.call(this,128,112)}inherits$j(Sha512,Hash$2),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ch(y,u,h){return h^y&(u^h)}function maj(y,u,h){return y&u|h&(y|u)}function sigma0(y,u){return(y>>>28|u<<4)^(u>>>2|y<<30)^(u>>>7|y<<25)}function sigma1(y,u){return(y>>>14|u<<18)^(y>>>18|u<<14)^(u>>>9|y<<23)}function Gamma0(y,u){return(y>>>1|u<<31)^(y>>>8|u<<24)^y>>>7}function Gamma0l(y,u){return(y>>>1|u<<31)^(y>>>8|u<<24)^(y>>>7|u<<25)}function Gamma1(y,u){return(y>>>19|u<<13)^(u>>>29|y<<3)^y>>>6}function Gamma1l(y,u){return(y>>>19|u<<13)^(u>>>29|y<<3)^(y>>>6|u<<26)}function getCarry(y,u){return y>>>0<u>>>0?1:0}Sha512.prototype._update=function(y){for(var u=this._w,h=this._ah|0,v=this._bh|0,w=this._ch|0,b=this._dh|0,E=this._eh|0,$=this._fh|0,M=this._gh|0,T=this._hh|0,C=this._al|0,B=this._bl|0,N=this._cl|0,H=this._dl|0,te=this._el|0,fe=this._fl|0,ce=this._gl|0,le=this._hl|0,ie=0;ie<32;ie+=2)u[ie]=y.readInt32BE(ie*4),u[ie+1]=y.readInt32BE(ie*4+4);for(;ie<160;ie+=2){var ge=u[ie-30],pe=u[ie-15*2+1],Me=Gamma0(ge,pe),$e=Gamma0l(pe,ge);ge=u[ie-2*2],pe=u[ie-2*2+1];var Pe=Gamma1(ge,pe),Be=Gamma1l(pe,ge),Re=u[ie-7*2],je=u[ie-7*2+1],we=u[ie-16*2],D=u[ie-16*2+1],q=$e+je|0,O=Me+Re+getCarry(q,$e)|0;q=q+Be|0,O=O+Pe+getCarry(q,Be)|0,q=q+D|0,O=O+we+getCarry(q,D)|0,u[ie]=O,u[ie+1]=q}for(var L=0;L<160;L+=2){O=u[L],q=u[L+1];var X=maj(h,v,w),j=maj(C,B,N),re=sigma0(h,C),ee=sigma0(C,h),F=sigma1(E,te),Q=sigma1(te,E),U=K$1[L],he=K$1[L+1],Oe=Ch(E,$,M),Ve=Ch(te,fe,ce),Ae=le+Q|0,oe=T+F+getCarry(Ae,le)|0;Ae=Ae+Ve|0,oe=oe+Oe+getCarry(Ae,Ve)|0,Ae=Ae+he|0,oe=oe+U+getCarry(Ae,he)|0,Ae=Ae+q|0,oe=oe+O+getCarry(Ae,q)|0;var ye=ee+j|0,Ce=re+X+getCarry(ye,ee)|0;T=M,le=ce,M=$,ce=fe,$=E,fe=te,te=H+Ae|0,E=b+oe+getCarry(te,H)|0,b=w,H=N,w=v,N=B,v=h,B=C,C=Ae+ye|0,h=oe+Ce+getCarry(C,Ae)|0}this._al=this._al+C|0,this._bl=this._bl+B|0,this._cl=this._cl+N|0,this._dl=this._dl+H|0,this._el=this._el+te|0,this._fl=this._fl+fe|0,this._gl=this._gl+ce|0,this._hl=this._hl+le|0,this._ah=this._ah+h+getCarry(this._al,C)|0,this._bh=this._bh+v+getCarry(this._bl,B)|0,this._ch=this._ch+w+getCarry(this._cl,N)|0,this._dh=this._dh+b+getCarry(this._dl,H)|0,this._eh=this._eh+E+getCarry(this._el,te)|0,this._fh=this._fh+$+getCarry(this._fl,fe)|0,this._gh=this._gh+M+getCarry(this._gl,ce)|0,this._hh=this._hh+T+getCarry(this._hl,le)|0},Sha512.prototype._hash=function(){var y=Buffer$r.allocUnsafe(64);function u(h,v,w){y.writeInt32BE(h,w),y.writeInt32BE(v,w+4)}return u(this._ah,this._al,0),u(this._bh,this._bl,8),u(this._ch,this._cl,16),u(this._dh,this._dl,24),u(this._eh,this._el,32),u(this._fh,this._fl,40),u(this._gh,this._gl,48),u(this._hh,this._hl,56),y};var sha512$1=Sha512,inherits$i=inherits_browserExports,SHA512$2=sha512$1,Hash$1=hash$3,Buffer$q=safeBufferExports$1.Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash$1.call(this,128,112)}inherits$i(Sha384,SHA512$2),Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},Sha384.prototype._hash=function(){var y=Buffer$q.allocUnsafe(48);function u(h,v,w){y.writeInt32BE(h,w),y.writeInt32BE(v,w+4)}return u(this._ah,this._al,0),u(this._bh,this._bl,8),u(this._ch,this._cl,16),u(this._dh,this._dl,24),u(this._eh,this._el,32),u(this._fh,this._fl,40),y};var sha384$1=Sha384,exports$1=sha_js.exports=function(u){u=u.toLowerCase();var h=exports$1[u];if(!h)throw new Error(u+" is not supported (we accept pull requests)");return new h};exports$1.sha=sha$4,exports$1.sha1=sha1,exports$1.sha224=sha224$1,exports$1.sha256=sha256$1,exports$1.sha384=sha384$1,exports$1.sha512=sha512$1;var sha_jsExports=sha_js.exports,streamBrowserify=Stream,EE=eventsExports.EventEmitter,inherits$h=inherits_browserExports;inherits$h(Stream,EE),Stream.Readable=require_stream_readable$1(),Stream.Writable=require_stream_writable$1(),Stream.Duplex=require_stream_duplex$1(),Stream.Transform=_stream_transform$1,Stream.PassThrough=_stream_passthrough$1,Stream.finished=endOfStream,Stream.pipeline=pipeline_1,Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(y,u){var h=this;function v(C){y.writable&&y.write(C)===!1&&h.pause&&h.pause()}h.on("data",v);function w(){h.readable&&h.resume&&h.resume()}y.on("drain",w),!y._isStdio&&(!u||u.end!==!1)&&(h.on("end",E),h.on("close",$));var b=!1;function E(){b||(b=!0,y.end())}function $(){b||(b=!0,typeof y.destroy=="function"&&y.destroy())}function M(C){if(T(),EE.listenerCount(this,"error")===0)throw C}h.on("error",M),y.on("error",M);function T(){h.removeListener("data",v),y.removeListener("drain",w),h.removeListener("end",E),h.removeListener("close",$),h.removeListener("error",M),y.removeListener("error",M),h.removeListener("end",T),h.removeListener("close",T),y.removeListener("close",T)}return h.on("end",T),h.on("close",T),y.on("close",T),y.emit("pipe",h),y};var Buffer$p=safeBufferExports$1.Buffer,Transform$6=streamBrowserify.Transform,StringDecoder=string_decoder.StringDecoder,inherits$g=inherits_browserExports;function CipherBase$1(y){Transform$6.call(this),this.hashMode=typeof y=="string",this.hashMode?this[y]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}inherits$g(CipherBase$1,Transform$6),CipherBase$1.prototype.update=function(y,u,h){typeof y=="string"&&(y=Buffer$p.from(y,u));var v=this._update(y);return this.hashMode?this:(h&&(v=this._toString(v,h)),v)},CipherBase$1.prototype.setAutoPadding=function(){},CipherBase$1.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},CipherBase$1.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},CipherBase$1.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},CipherBase$1.prototype._transform=function(y,u,h){var v;try{this.hashMode?this._update(y):this.push(this._update(y))}catch(w){v=w}finally{h(v)}},CipherBase$1.prototype._flush=function(y){var u;try{this.push(this.__final())}catch(h){u=h}y(u)},CipherBase$1.prototype._finalOrDigest=function(y){var u=this.__final()||Buffer$p.alloc(0);return y&&(u=this._toString(u,y,!0)),u},CipherBase$1.prototype._toString=function(y,u,h){if(this._decoder||(this._decoder=new StringDecoder(u),this._encoding=u),this._encoding!==u)throw new Error("can't switch encodings");var v=this._decoder.write(y);return h&&(v+=this._decoder.end()),v};var cipherBase=CipherBase$1,inherits$f=inherits_browserExports,MD5$2=md5_js,RIPEMD160$3=ripemd160,sha$3=sha_jsExports,Base$5=cipherBase;function Hash(y){Base$5.call(this,"digest"),this._hash=y}inherits$f(Hash,Base$5),Hash.prototype._update=function(y){this._hash.update(y)},Hash.prototype._final=function(){return this._hash.digest()};var browser$9=function(u){return u=u.toLowerCase(),u==="md5"?new MD5$2:u==="rmd160"||u==="ripemd160"?new RIPEMD160$3:new Hash(sha$3(u))},inherits$e=inherits_browserExports,Buffer$o=safeBufferExports$1.Buffer,Base$4=cipherBase,ZEROS$2=Buffer$o.alloc(128),blocksize=64;function Hmac$3(y,u){Base$4.call(this,"digest"),typeof u=="string"&&(u=Buffer$o.from(u)),this._alg=y,this._key=u,u.length>blocksize?u=y(u):u.length<blocksize&&(u=Buffer$o.concat([u,ZEROS$2],blocksize));for(var h=this._ipad=Buffer$o.allocUnsafe(blocksize),v=this._opad=Buffer$o.allocUnsafe(blocksize),w=0;w<blocksize;w++)h[w]=u[w]^54,v[w]=u[w]^92;this._hash=[h]}inherits$e(Hmac$3,Base$4),Hmac$3.prototype._update=function(y){this._hash.push(y)},Hmac$3.prototype._final=function(){var y=this._alg(Buffer$o.concat(this._hash));return this._alg(Buffer$o.concat([this._opad,y]))};var legacy=Hmac$3,MD5$1=md5_js,md5$2=function(y){return new MD5$1().update(y).digest()},inherits$d=inherits_browserExports,Legacy=legacy,Base$3=cipherBase,Buffer$n=safeBufferExports$1.Buffer,md5$1=md5$2,RIPEMD160$2=ripemd160,sha$2=sha_jsExports,ZEROS$1=Buffer$n.alloc(128);function Hmac$2(y,u){Base$3.call(this,"digest"),typeof u=="string"&&(u=Buffer$n.from(u));var h=y==="sha512"||y==="sha384"?128:64;if(this._alg=y,this._key=u,u.length>h){var v=y==="rmd160"?new RIPEMD160$2:sha$2(y);u=v.update(u).digest()}else u.length<h&&(u=Buffer$n.concat([u,ZEROS$1],h));for(var w=this._ipad=Buffer$n.allocUnsafe(h),b=this._opad=Buffer$n.allocUnsafe(h),E=0;E<h;E++)w[E]=u[E]^54,b[E]=u[E]^92;this._hash=y==="rmd160"?new RIPEMD160$2:sha$2(y),this._hash.update(w)}inherits$d(Hmac$2,Base$3),Hmac$2.prototype._update=function(y){this._hash.update(y)},Hmac$2.prototype._final=function(){var y=this._hash.digest(),u=this._alg==="rmd160"?new RIPEMD160$2:sha$2(this._alg);return u.update(this._opad).update(y).digest()};var browser$8=function(u,h){return u=u.toLowerCase(),u==="rmd160"||u==="ripemd160"?new Hmac$2("rmd160",h):u==="md5"?new Legacy(md5$1,h):new Hmac$2(u,h)};const sha224WithRSAEncryption={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},sha256={sign:"ecdsa",hash:"sha256",id:""},sha224={sign:"ecdsa",hash:"sha224",id:""},sha384={sign:"ecdsa",hash:"sha384",id:""},sha512={sign:"ecdsa",hash:"sha512",id:""},DSA={sign:"dsa",hash:"sha1",id:""},ripemd160WithRSA={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},require$$6={sha224WithRSAEncryption,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption,"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256,sha224,sha384,sha512,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA,"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var algos=require$$6,browser$7={},MAX_ALLOC=Math.pow(2,30)-1,precondition=function(y,u){if(typeof y!="number")throw new TypeError("Iterations not a number");if(y<0)throw new TypeError("Bad iterations");if(typeof u!="number")throw new TypeError("Key length not a number");if(u<0||u>MAX_ALLOC||u!==u)throw new TypeError("Bad key length")},defaultEncoding$2;if(commonjsGlobal.process&&commonjsGlobal.process.browser)defaultEncoding$2="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){var pVersionMajor=parseInt(process$1.version.split(".")[0].slice(1),10);defaultEncoding$2=pVersionMajor>=6?"utf-8":"binary"}else defaultEncoding$2="utf-8";var defaultEncoding_1=defaultEncoding$2,Buffer$m=safeBufferExports$1.Buffer,toBuffer$2=function(y,u,h){if(Buffer$m.isBuffer(y))return y;if(typeof y=="string")return Buffer$m.from(y,u);if(ArrayBuffer.isView(y))return Buffer$m.from(y.buffer);throw new TypeError(h+" must be a string, a Buffer, a typed array or a DataView")},md5=md5$2,RIPEMD160$1=ripemd160,sha$1=sha_jsExports,Buffer$l=safeBufferExports$1.Buffer,checkParameters$1=precondition,defaultEncoding$1=defaultEncoding_1,toBuffer$1=toBuffer$2,ZEROS=Buffer$l.alloc(128),sizes={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac$1(y,u,h){var v=getDigest(y),w=y==="sha512"||y==="sha384"?128:64;u.length>w?u=v(u):u.length<w&&(u=Buffer$l.concat([u,ZEROS],w));for(var b=Buffer$l.allocUnsafe(w+sizes[y]),E=Buffer$l.allocUnsafe(w+sizes[y]),$=0;$<w;$++)b[$]=u[$]^54,E[$]=u[$]^92;var M=Buffer$l.allocUnsafe(w+h+4);b.copy(M,0,0,w),this.ipad1=M,this.ipad2=b,this.opad=E,this.alg=y,this.blocksize=w,this.hash=v,this.size=sizes[y]}Hmac$1.prototype.run=function(y,u){y.copy(u,this.blocksize);var h=this.hash(u);return h.copy(this.opad,this.blocksize),this.hash(this.opad)};function getDigest(y){function u(v){return sha$1(y).update(v).digest()}function h(v){return new RIPEMD160$1().update(v).digest()}return y==="rmd160"||y==="ripemd160"?h:y==="md5"?md5:u}function pbkdf2(y,u,h,v,w){checkParameters$1(h,v),y=toBuffer$1(y,defaultEncoding$1,"Password"),u=toBuffer$1(u,defaultEncoding$1,"Salt"),w=w||"sha1";var b=new Hmac$1(w,y,u.length),E=Buffer$l.allocUnsafe(v),$=Buffer$l.allocUnsafe(u.length+4);u.copy($,0,0,u.length);for(var M=0,T=sizes[w],C=Math.ceil(v/T),B=1;B<=C;B++){$.writeUInt32BE(B,u.length);for(var N=b.run($,b.ipad1),H=N,te=1;te<h;te++){H=b.run(H,b.ipad2);for(var fe=0;fe<T;fe++)N[fe]^=H[fe]}N.copy(E,M),M+=T}return E}var syncBrowser=pbkdf2,Buffer$k=safeBufferExports$1.Buffer,checkParameters=precondition,defaultEncoding=defaultEncoding_1,sync=syncBrowser,toBuffer=toBuffer$2,ZERO_BUF,subtle=commonjsGlobal.crypto&&commonjsGlobal.crypto.subtle,toBrowser={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},checks=[];function checkNative(y){if(commonjsGlobal.process&&!commonjsGlobal.process.browser||!subtle||!subtle.importKey||!subtle.deriveBits)return Promise.resolve(!1);if(checks[y]!==void 0)return checks[y];ZERO_BUF=ZERO_BUF||Buffer$k.alloc(8);var u=browserPbkdf2(ZERO_BUF,ZERO_BUF,10,128,y).then(function(){return!0}).catch(function(){return!1});return checks[y]=u,u}var nextTick$1;function getNextTick(){return nextTick$1||(commonjsGlobal.process&&commonjsGlobal.process.nextTick?nextTick$1=commonjsGlobal.process.nextTick:commonjsGlobal.queueMicrotask?nextTick$1=commonjsGlobal.queueMicrotask:commonjsGlobal.setImmediate?nextTick$1=commonjsGlobal.setImmediate:nextTick$1=commonjsGlobal.setTimeout,nextTick$1)}function browserPbkdf2(y,u,h,v,w){return subtle.importKey("raw",y,{name:"PBKDF2"},!1,["deriveBits"]).then(function(b){return subtle.deriveBits({name:"PBKDF2",salt:u,iterations:h,hash:{name:w}},b,v<<3)}).then(function(b){return Buffer$k.from(b)})}function resolvePromise(y,u){y.then(function(h){getNextTick()(function(){u(null,h)})},function(h){getNextTick()(function(){u(h)})})}var async=function(y,u,h,v,w,b){typeof w=="function"&&(b=w,w=void 0),w=w||"sha1";var E=toBrowser[w.toLowerCase()];if(!E||typeof commonjsGlobal.Promise!="function"){getNextTick()(function(){var $;try{$=sync(y,u,h,v,w)}catch(M){return b(M)}b(null,$)});return}if(checkParameters(h,v),y=toBuffer(y,defaultEncoding,"Password"),u=toBuffer(u,defaultEncoding,"Salt"),typeof b!="function")throw new Error("No callback provided to pbkdf2");resolvePromise(checkNative(E).then(function($){return $?browserPbkdf2(y,u,h,v,E):sync(y,u,h,v,w)}),b)};browser$7.pbkdf2=async,browser$7.pbkdf2Sync=syncBrowser;var browser$6={},des$2={},utils$n={};utils$n.readUInt32BE=function(u,h){var v=u[0+h]<<24|u[1+h]<<16|u[2+h]<<8|u[3+h];return v>>>0},utils$n.writeUInt32BE=function(u,h,v){u[0+v]=h>>>24,u[1+v]=h>>>16&255,u[2+v]=h>>>8&255,u[3+v]=h&255},utils$n.ip=function(u,h,v,w){for(var b=0,E=0,$=6;$>=0;$-=2){for(var M=0;M<=24;M+=8)b<<=1,b|=h>>>M+$&1;for(var M=0;M<=24;M+=8)b<<=1,b|=u>>>M+$&1}for(var $=6;$>=0;$-=2){for(var M=1;M<=25;M+=8)E<<=1,E|=h>>>M+$&1;for(var M=1;M<=25;M+=8)E<<=1,E|=u>>>M+$&1}v[w+0]=b>>>0,v[w+1]=E>>>0},utils$n.rip=function(u,h,v,w){for(var b=0,E=0,$=0;$<4;$++)for(var M=24;M>=0;M-=8)b<<=1,b|=h>>>M+$&1,b<<=1,b|=u>>>M+$&1;for(var $=4;$<8;$++)for(var M=24;M>=0;M-=8)E<<=1,E|=h>>>M+$&1,E<<=1,E|=u>>>M+$&1;v[w+0]=b>>>0,v[w+1]=E>>>0},utils$n.pc1=function(u,h,v,w){for(var b=0,E=0,$=7;$>=5;$--){for(var M=0;M<=24;M+=8)b<<=1,b|=h>>M+$&1;for(var M=0;M<=24;M+=8)b<<=1,b|=u>>M+$&1}for(var M=0;M<=24;M+=8)b<<=1,b|=h>>M+$&1;for(var $=1;$<=3;$++){for(var M=0;M<=24;M+=8)E<<=1,E|=h>>M+$&1;for(var M=0;M<=24;M+=8)E<<=1,E|=u>>M+$&1}for(var M=0;M<=24;M+=8)E<<=1,E|=u>>M+$&1;v[w+0]=b>>>0,v[w+1]=E>>>0},utils$n.r28shl=function(u,h){return u<<h&268435455|u>>>28-h};var pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$n.pc2=function(u,h,v,w){for(var b=0,E=0,$=pc2table.length>>>1,M=0;M<$;M++)b<<=1,b|=u>>>pc2table[M]&1;for(var M=$;M<pc2table.length;M++)E<<=1,E|=h>>>pc2table[M]&1;v[w+0]=b>>>0,v[w+1]=E>>>0},utils$n.expand=function(u,h,v){var w=0,b=0;w=(u&1)<<5|u>>>27;for(var E=23;E>=15;E-=4)w<<=6,w|=u>>>E&63;for(var E=11;E>=3;E-=4)b|=u>>>E&63,b<<=6;b|=(u&31)<<1|u>>>31,h[v+0]=w>>>0,h[v+1]=b>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$n.substitute=function(u,h){for(var v=0,w=0;w<4;w++){var b=u>>>18-w*6&63,E=sTable[w*64+b];v<<=4,v|=E}for(var w=0;w<4;w++){var b=h>>>18-w*6&63,E=sTable[4*64+w*64+b];v<<=4,v|=E}return v>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];utils$n.permute=function(u){for(var h=0,v=0;v<permuteTable.length;v++)h<<=1,h|=u>>>permuteTable[v]&1;return h>>>0},utils$n.padSplit=function(u,h,v){for(var w=u.toString(2);w.length<h;)w="0"+w;for(var b=[],E=0;E<h;E+=v)b.push(w.slice(E,E+v));return b.join(" ")};var minimalisticAssert=assert$i;function assert$i(y,u){if(!y)throw new Error(u||"Assertion failed")}assert$i.equal=function(u,h,v){if(u!=h)throw new Error(v||"Assertion failed: "+u+" != "+h)};var assert$h=minimalisticAssert;function Cipher$3(y){this.options=y,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=y.padding!==!1}var cipher=Cipher$3;Cipher$3.prototype._init=function(){},Cipher$3.prototype.update=function(u){return u.length===0?[]:this.type==="decrypt"?this._updateDecrypt(u):this._updateEncrypt(u)},Cipher$3.prototype._buffer=function(u,h){for(var v=Math.min(this.buffer.length-this.bufferOff,u.length-h),w=0;w<v;w++)this.buffer[this.bufferOff+w]=u[h+w];return this.bufferOff+=v,v},Cipher$3.prototype._flushBuffer=function(u,h){return this._update(this.buffer,0,u,h),this.bufferOff=0,this.blockSize},Cipher$3.prototype._updateEncrypt=function(u){var h=0,v=0,w=(this.bufferOff+u.length)/this.blockSize|0,b=new Array(w*this.blockSize);this.bufferOff!==0&&(h+=this._buffer(u,h),this.bufferOff===this.buffer.length&&(v+=this._flushBuffer(b,v)));for(var E=u.length-(u.length-h)%this.blockSize;h<E;h+=this.blockSize)this._update(u,h,b,v),v+=this.blockSize;for(;h<u.length;h++,this.bufferOff++)this.buffer[this.bufferOff]=u[h];return b},Cipher$3.prototype._updateDecrypt=function(u){for(var h=0,v=0,w=Math.ceil((this.bufferOff+u.length)/this.blockSize)-1,b=new Array(w*this.blockSize);w>0;w--)h+=this._buffer(u,h),v+=this._flushBuffer(b,v);return h+=this._buffer(u,h),b},Cipher$3.prototype.final=function(u){var h;u&&(h=this.update(u));var v;return this.type==="encrypt"?v=this._finalEncrypt():v=this._finalDecrypt(),h?h.concat(v):v},Cipher$3.prototype._pad=function(u,h){if(h===0)return!1;for(;h<u.length;)u[h++]=0;return!0},Cipher$3.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var u=new Array(this.blockSize);return this._update(this.buffer,0,u,0),u},Cipher$3.prototype._unpad=function(u){return u},Cipher$3.prototype._finalDecrypt=function(){assert$h.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var u=new Array(this.blockSize);return this._flushBuffer(u,0),this._unpad(u)};var assert$g=minimalisticAssert,inherits$c=inherits_browserExports,utils$m=utils$n,Cipher$2=cipher;function DESState(){this.tmp=new Array(2),this.keys=null}function DES$3(y){Cipher$2.call(this,y);var u=new DESState;this._desState=u,this.deriveKeys(u,y.key)}inherits$c(DES$3,Cipher$2);var des$1=DES$3;DES$3.create=function(u){return new DES$3(u)};var shiftTable=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];DES$3.prototype.deriveKeys=function(u,h){u.keys=new Array(16*2),assert$g.equal(h.length,this.blockSize,"Invalid key length");var v=utils$m.readUInt32BE(h,0),w=utils$m.readUInt32BE(h,4);utils$m.pc1(v,w,u.tmp,0),v=u.tmp[0],w=u.tmp[1];for(var b=0;b<u.keys.length;b+=2){var E=shiftTable[b>>>1];v=utils$m.r28shl(v,E),w=utils$m.r28shl(w,E),utils$m.pc2(v,w,u.keys,b)}},DES$3.prototype._update=function(u,h,v,w){var b=this._desState,E=utils$m.readUInt32BE(u,h),$=utils$m.readUInt32BE(u,h+4);utils$m.ip(E,$,b.tmp,0),E=b.tmp[0],$=b.tmp[1],this.type==="encrypt"?this._encrypt(b,E,$,b.tmp,0):this._decrypt(b,E,$,b.tmp,0),E=b.tmp[0],$=b.tmp[1],utils$m.writeUInt32BE(v,E,w),utils$m.writeUInt32BE(v,$,w+4)},DES$3.prototype._pad=function(u,h){if(this.padding===!1)return!1;for(var v=u.length-h,w=h;w<u.length;w++)u[w]=v;return!0},DES$3.prototype._unpad=function(u){if(this.padding===!1)return u;for(var h=u[u.length-1],v=u.length-h;v<u.length;v++)assert$g.equal(u[v],h);return u.slice(0,u.length-h)},DES$3.prototype._encrypt=function(u,h,v,w,b){for(var E=h,$=v,M=0;M<u.keys.length;M+=2){var T=u.keys[M],C=u.keys[M+1];utils$m.expand($,u.tmp,0),T^=u.tmp[0],C^=u.tmp[1];var B=utils$m.substitute(T,C),N=utils$m.permute(B),H=$;$=(E^N)>>>0,E=H}utils$m.rip($,E,w,b)},DES$3.prototype._decrypt=function(u,h,v,w,b){for(var E=v,$=h,M=u.keys.length-2;M>=0;M-=2){var T=u.keys[M],C=u.keys[M+1];utils$m.expand(E,u.tmp,0),T^=u.tmp[0],C^=u.tmp[1];var B=utils$m.substitute(T,C),N=utils$m.permute(B),H=E;E=($^N)>>>0,$=H}utils$m.rip(E,$,w,b)};var cbc$1={},assert$f=minimalisticAssert,inherits$b=inherits_browserExports,proto={};function CBCState(y){assert$f.equal(y.length,8,"Invalid IV length"),this.iv=new Array(8);for(var u=0;u<this.iv.length;u++)this.iv[u]=y[u]}function instantiate(y){function u(b){y.call(this,b),this._cbcInit()}inherits$b(u,y);for(var h=Object.keys(proto),v=0;v<h.length;v++){var w=h[v];u.prototype[w]=proto[w]}return u.create=function(E){return new u(E)},u}cbc$1.instantiate=instantiate,proto._cbcInit=function(){var u=new CBCState(this.options.iv);this._cbcState=u},proto._update=function(u,h,v,w){var b=this._cbcState,E=this.constructor.super_.prototype,$=b.iv;if(this.type==="encrypt"){for(var M=0;M<this.blockSize;M++)$[M]^=u[h+M];E._update.call(this,$,0,v,w);for(var M=0;M<this.blockSize;M++)$[M]=v[w+M]}else{E._update.call(this,u,h,v,w);for(var M=0;M<this.blockSize;M++)v[w+M]^=$[M];for(var M=0;M<this.blockSize;M++)$[M]=u[h+M]}};var assert$e=minimalisticAssert,inherits$a=inherits_browserExports,Cipher$1=cipher,DES$2=des$1;function EDEState(y,u){assert$e.equal(u.length,24,"Invalid key length");var h=u.slice(0,8),v=u.slice(8,16),w=u.slice(16,24);y==="encrypt"?this.ciphers=[DES$2.create({type:"encrypt",key:h}),DES$2.create({type:"decrypt",key:v}),DES$2.create({type:"encrypt",key:w})]:this.ciphers=[DES$2.create({type:"decrypt",key:w}),DES$2.create({type:"encrypt",key:v}),DES$2.create({type:"decrypt",key:h})]}function EDE(y){Cipher$1.call(this,y);var u=new EDEState(this.type,this.options.key);this._edeState=u}inherits$a(EDE,Cipher$1);var ede=EDE;EDE.create=function(u){return new EDE(u)},EDE.prototype._update=function(u,h,v,w){var b=this._edeState;b.ciphers[0]._update(u,h,v,w),b.ciphers[1]._update(v,w,v,w),b.ciphers[2]._update(v,w,v,w)},EDE.prototype._pad=DES$2.prototype._pad,EDE.prototype._unpad=DES$2.prototype._unpad,des$2.utils=utils$n,des$2.Cipher=cipher,des$2.DES=des$1,des$2.CBC=cbc$1,des$2.EDE=ede;var CipherBase=cipherBase,des=des$2,inherits$9=inherits_browserExports,Buffer$j=safeBufferExports$1.Buffer,modes$3={"des-ede3-cbc":des.CBC.instantiate(des.EDE),"des-ede3":des.EDE,"des-ede-cbc":des.CBC.instantiate(des.EDE),"des-ede":des.EDE,"des-cbc":des.CBC.instantiate(des.DES),"des-ecb":des.DES};modes$3.des=modes$3["des-cbc"],modes$3.des3=modes$3["des-ede3-cbc"];var browserifyDes=DES$1;inherits$9(DES$1,CipherBase);function DES$1(y){CipherBase.call(this);var u=y.mode.toLowerCase(),h=modes$3[u],v;y.decrypt?v="decrypt":v="encrypt";var w=y.key;Buffer$j.isBuffer(w)||(w=Buffer$j.from(w)),(u==="des-ede"||u==="des-ede-cbc")&&(w=Buffer$j.concat([w,w.slice(0,8)]));var b=y.iv;Buffer$j.isBuffer(b)||(b=Buffer$j.from(b)),this._des=h.create({key:w,iv:b,type:v})}DES$1.prototype._update=function(y){return Buffer$j.from(this._des.update(y))},DES$1.prototype._final=function(){return Buffer$j.from(this._des.final())};var browser$5={},encrypter={},ecb={};ecb.encrypt=function(y,u){return y._cipher.encryptBlock(u)},ecb.decrypt=function(y,u){return y._cipher.decryptBlock(u)};var cbc={},bufferXor=function(u,h){for(var v=Math.min(u.length,h.length),w=new Buffer$C(v),b=0;b<v;++b)w[b]=u[b]^h[b];return w},xor$7=bufferXor;cbc.encrypt=function(y,u){var h=xor$7(u,y._prev);return y._prev=y._cipher.encryptBlock(h),y._prev},cbc.decrypt=function(y,u){var h=y._prev;y._prev=u;var v=y._cipher.decryptBlock(u);return xor$7(v,h)};var cfb={},Buffer$i=safeBufferExports$1.Buffer,xor$6=bufferXor;function encryptStart(y,u,h){var v=u.length,w=xor$6(u,y._cache);return y._cache=y._cache.slice(v),y._prev=Buffer$i.concat([y._prev,h?u:w]),w}cfb.encrypt=function(y,u,h){for(var v=Buffer$i.allocUnsafe(0),w;u.length;)if(y._cache.length===0&&(y._cache=y._cipher.encryptBlock(y._prev),y._prev=Buffer$i.allocUnsafe(0)),y._cache.length<=u.length)w=y._cache.length,v=Buffer$i.concat([v,encryptStart(y,u.slice(0,w),h)]),u=u.slice(w);else{v=Buffer$i.concat([v,encryptStart(y,u,h)]);break}return v};var cfb8={},Buffer$h=safeBufferExports$1.Buffer;function encryptByte$1(y,u,h){var v=y._cipher.encryptBlock(y._prev),w=v[0]^u;return y._prev=Buffer$h.concat([y._prev.slice(1),Buffer$h.from([h?u:w])]),w}cfb8.encrypt=function(y,u,h){for(var v=u.length,w=Buffer$h.allocUnsafe(v),b=-1;++b<v;)w[b]=encryptByte$1(y,u[b],h);return w};var cfb1={},Buffer$g=safeBufferExports$1.Buffer;function encryptByte(y,u,h){for(var v,w=-1,b=8,E=0,$,M;++w<b;)v=y._cipher.encryptBlock(y._prev),$=u&1<<7-w?128:0,M=v[0]^$,E+=(M&128)>>w%8,y._prev=shiftIn(y._prev,h?$:M);return E}function shiftIn(y,u){var h=y.length,v=-1,w=Buffer$g.allocUnsafe(y.length);for(y=Buffer$g.concat([y,Buffer$g.from([u])]);++v<h;)w[v]=y[v]<<1|y[v+1]>>7;return w}cfb1.encrypt=function(y,u,h){for(var v=u.length,w=Buffer$g.allocUnsafe(v),b=-1;++b<v;)w[b]=encryptByte(y,u[b],h);return w};var ofb={},xor$5=bufferXor;function getBlock$1(y){return y._prev=y._cipher.encryptBlock(y._prev),y._prev}ofb.encrypt=function(y,u){for(;y._cache.length<u.length;)y._cache=Buffer$C.concat([y._cache,getBlock$1(y)]);var h=y._cache.slice(0,u.length);return y._cache=y._cache.slice(u.length),xor$5(u,h)};var ctr={};function incr32$2(y){for(var u=y.length,h;u--;)if(h=y.readUInt8(u),h===255)y.writeUInt8(0,u);else{h++,y.writeUInt8(h,u);break}}var incr32_1=incr32$2,xor$4=bufferXor,Buffer$f=safeBufferExports$1.Buffer,incr32$1=incr32_1;function getBlock(y){var u=y._cipher.encryptBlockRaw(y._prev);return incr32$1(y._prev),u}var blockSize=16;ctr.encrypt=function(y,u){var h=Math.ceil(u.length/blockSize),v=y._cache.length;y._cache=Buffer$f.concat([y._cache,Buffer$f.allocUnsafe(h*blockSize)]);for(var w=0;w<h;w++){var b=getBlock(y),E=v+w*blockSize;y._cache.writeUInt32BE(b[0],E+0),y._cache.writeUInt32BE(b[1],E+4),y._cache.writeUInt32BE(b[2],E+8),y._cache.writeUInt32BE(b[3],E+12)}var $=y._cache.slice(0,u.length);return y._cache=y._cache.slice(u.length),xor$4(u,$)};const aes128={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},require$$2={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128,aes192,aes256,"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}};var modeModules={ECB:ecb,CBC:cbc,CFB:cfb,CFB8:cfb8,CFB1:cfb1,OFB:ofb,CTR:ctr,GCM:ctr},modes$2=require$$2;for(var key$2 in modes$2)modes$2[key$2].module=modeModules[modes$2[key$2].mode];var modes_1=modes$2,aes$5={},Buffer$e=safeBufferExports$1.Buffer;function asUInt32Array(y){Buffer$e.isBuffer(y)||(y=Buffer$e.from(y));for(var u=y.length/4|0,h=new Array(u),v=0;v<u;v++)h[v]=y.readUInt32BE(v*4);return h}function scrubVec(y){for(var u=0;u<y.length;y++)y[u]=0}function cryptBlock(y,u,h,v,w){for(var b=h[0],E=h[1],$=h[2],M=h[3],T=y[0]^u[0],C=y[1]^u[1],B=y[2]^u[2],N=y[3]^u[3],H,te,fe,ce,le=4,ie=1;ie<w;ie++)H=b[T>>>24]^E[C>>>16&255]^$[B>>>8&255]^M[N&255]^u[le++],te=b[C>>>24]^E[B>>>16&255]^$[N>>>8&255]^M[T&255]^u[le++],fe=b[B>>>24]^E[N>>>16&255]^$[T>>>8&255]^M[C&255]^u[le++],ce=b[N>>>24]^E[T>>>16&255]^$[C>>>8&255]^M[B&255]^u[le++],T=H,C=te,B=fe,N=ce;return H=(v[T>>>24]<<24|v[C>>>16&255]<<16|v[B>>>8&255]<<8|v[N&255])^u[le++],te=(v[C>>>24]<<24|v[B>>>16&255]<<16|v[N>>>8&255]<<8|v[T&255])^u[le++],fe=(v[B>>>24]<<24|v[N>>>16&255]<<16|v[T>>>8&255]<<8|v[C&255])^u[le++],ce=(v[N>>>24]<<24|v[T>>>16&255]<<16|v[C>>>8&255]<<8|v[B&255])^u[le++],H=H>>>0,te=te>>>0,fe=fe>>>0,ce=ce>>>0,[H,te,fe,ce]}var RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var y=new Array(256),u=0;u<256;u++)u<128?y[u]=u<<1:y[u]=u<<1^283;for(var h=[],v=[],w=[[],[],[],[]],b=[[],[],[],[]],E=0,$=0,M=0;M<256;++M){var T=$^$<<1^$<<2^$<<3^$<<4;T=T>>>8^T&255^99,h[E]=T,v[T]=E;var C=y[E],B=y[C],N=y[B],H=y[T]*257^T*16843008;w[0][E]=H<<24|H>>>8,w[1][E]=H<<16|H>>>16,w[2][E]=H<<8|H>>>24,w[3][E]=H,H=N*16843009^B*65537^C*257^E*16843008,b[0][T]=H<<24|H>>>8,b[1][T]=H<<16|H>>>16,b[2][T]=H<<8|H>>>24,b[3][T]=H,E===0?E=$=1:(E=C^y[y[y[N^C]]],$^=y[y[$]])}return{SBOX:h,INV_SBOX:v,SUB_MIX:w,INV_SUB_MIX:b}}();function AES(y){this._key=asUInt32Array(y),this._reset()}AES.blockSize=4*4,AES.keySize=256/8,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var y=this._key,u=y.length,h=u+6,v=(h+1)*4,w=[],b=0;b<u;b++)w[b]=y[b];for(b=u;b<v;b++){var E=w[b-1];b%u===0?(E=E<<8|E>>>24,E=G.SBOX[E>>>24]<<24|G.SBOX[E>>>16&255]<<16|G.SBOX[E>>>8&255]<<8|G.SBOX[E&255],E^=RCON[b/u|0]<<24):u>6&&b%u===4&&(E=G.SBOX[E>>>24]<<24|G.SBOX[E>>>16&255]<<16|G.SBOX[E>>>8&255]<<8|G.SBOX[E&255]),w[b]=w[b-u]^E}for(var $=[],M=0;M<v;M++){var T=v-M,C=w[T-(M%4?0:4)];M<4||T<=4?$[M]=C:$[M]=G.INV_SUB_MIX[0][G.SBOX[C>>>24]]^G.INV_SUB_MIX[1][G.SBOX[C>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[C>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[C&255]]}this._nRounds=h,this._keySchedule=w,this._invKeySchedule=$},AES.prototype.encryptBlockRaw=function(y){return y=asUInt32Array(y),cryptBlock(y,this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(y){var u=this.encryptBlockRaw(y),h=Buffer$e.allocUnsafe(16);return h.writeUInt32BE(u[0],0),h.writeUInt32BE(u[1],4),h.writeUInt32BE(u[2],8),h.writeUInt32BE(u[3],12),h},AES.prototype.decryptBlock=function(y){y=asUInt32Array(y);var u=y[1];y[1]=y[3],y[3]=u;var h=cryptBlock(y,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),v=Buffer$e.allocUnsafe(16);return v.writeUInt32BE(h[0],0),v.writeUInt32BE(h[3],4),v.writeUInt32BE(h[2],8),v.writeUInt32BE(h[1],12),v},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},aes$5.AES=AES;var Buffer$d=safeBufferExports$1.Buffer,ZEROES=Buffer$d.alloc(16,0);function toArray$1(y){return[y.readUInt32BE(0),y.readUInt32BE(4),y.readUInt32BE(8),y.readUInt32BE(12)]}function fromArray(y){var u=Buffer$d.allocUnsafe(16);return u.writeUInt32BE(y[0]>>>0,0),u.writeUInt32BE(y[1]>>>0,4),u.writeUInt32BE(y[2]>>>0,8),u.writeUInt32BE(y[3]>>>0,12),u}function GHASH$1(y){this.h=y,this.state=Buffer$d.alloc(16,0),this.cache=Buffer$d.allocUnsafe(0)}GHASH$1.prototype.ghash=function(y){for(var u=-1;++u<y.length;)this.state[u]^=y[u];this._multiply()},GHASH$1.prototype._multiply=function(){for(var y=toArray$1(this.h),u=[0,0,0,0],h,v,w,b=-1;++b<128;){for(v=(this.state[~~(b/8)]&1<<7-b%8)!==0,v&&(u[0]^=y[0],u[1]^=y[1],u[2]^=y[2],u[3]^=y[3]),w=(y[3]&1)!==0,h=3;h>0;h--)y[h]=y[h]>>>1|(y[h-1]&1)<<31;y[0]=y[0]>>>1,w&&(y[0]=y[0]^225<<24)}this.state=fromArray(u)},GHASH$1.prototype.update=function(y){this.cache=Buffer$d.concat([this.cache,y]);for(var u;this.cache.length>=16;)u=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(u)},GHASH$1.prototype.final=function(y,u){return this.cache.length&&this.ghash(Buffer$d.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,y,0,u])),this.state};var ghash=GHASH$1,aes$4=aes$5,Buffer$c=safeBufferExports$1.Buffer,Transform$5=cipherBase,inherits$8=inherits_browserExports,GHASH=ghash,xor$3=bufferXor,incr32=incr32_1;function xorTest(y,u){var h=0;y.length!==u.length&&h++;for(var v=Math.min(y.length,u.length),w=0;w<v;++w)h+=y[w]^u[w];return h}function calcIv(y,u,h){if(u.length===12)return y._finID=Buffer$c.concat([u,Buffer$c.from([0,0,0,1])]),Buffer$c.concat([u,Buffer$c.from([0,0,0,2])]);var v=new GHASH(h),w=u.length,b=w%16;v.update(u),b&&(b=16-b,v.update(Buffer$c.alloc(b,0))),v.update(Buffer$c.alloc(8,0));var E=w*8,$=Buffer$c.alloc(8);$.writeUIntBE(E,0,8),v.update($),y._finID=v.state;var M=Buffer$c.from(y._finID);return incr32(M),M}function StreamCipher$3(y,u,h,v){Transform$5.call(this);var w=Buffer$c.alloc(4,0);this._cipher=new aes$4.AES(u);var b=this._cipher.encryptBlock(w);this._ghash=new GHASH(b),h=calcIv(this,h,b),this._prev=Buffer$c.from(h),this._cache=Buffer$c.allocUnsafe(0),this._secCache=Buffer$c.allocUnsafe(0),this._decrypt=v,this._alen=0,this._len=0,this._mode=y,this._authTag=null,this._called=!1}inherits$8(StreamCipher$3,Transform$5),StreamCipher$3.prototype._update=function(y){if(!this._called&&this._alen){var u=16-this._alen%16;u<16&&(u=Buffer$c.alloc(u,0),this._ghash.update(u))}this._called=!0;var h=this._mode.encrypt(this,y);return this._decrypt?this._ghash.update(y):this._ghash.update(h),this._len+=y.length,h},StreamCipher$3.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var y=xor$3(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&xorTest(y,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=y,this._cipher.scrub()},StreamCipher$3.prototype.getAuthTag=function(){if(this._decrypt||!Buffer$c.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},StreamCipher$3.prototype.setAuthTag=function(u){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=u},StreamCipher$3.prototype.setAAD=function(u){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(u),this._alen+=u.length};var authCipher=StreamCipher$3,aes$3=aes$5,Buffer$b=safeBufferExports$1.Buffer,Transform$4=cipherBase,inherits$7=inherits_browserExports;function StreamCipher$2(y,u,h,v){Transform$4.call(this),this._cipher=new aes$3.AES(u),this._prev=Buffer$b.from(h),this._cache=Buffer$b.allocUnsafe(0),this._secCache=Buffer$b.allocUnsafe(0),this._decrypt=v,this._mode=y}inherits$7(StreamCipher$2,Transform$4),StreamCipher$2.prototype._update=function(y){return this._mode.encrypt(this,y,this._decrypt)},StreamCipher$2.prototype._final=function(){this._cipher.scrub()};var streamCipher=StreamCipher$2,Buffer$a=safeBufferExports$1.Buffer,MD5=md5_js;function EVP_BytesToKey(y,u,h,v){if(Buffer$a.isBuffer(y)||(y=Buffer$a.from(y,"binary")),u&&(Buffer$a.isBuffer(u)||(u=Buffer$a.from(u,"binary")),u.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var w=h/8,b=Buffer$a.alloc(w),E=Buffer$a.alloc(v||0),$=Buffer$a.alloc(0);w>0||v>0;){var M=new MD5;M.update($),M.update(y),u&&M.update(u),$=M.digest();var T=0;if(w>0){var C=b.length-w;T=Math.min(w,$.length),$.copy(b,C,0,T),w-=T}if(T<$.length&&v>0){var B=E.length-v,N=Math.min(v,$.length-T);$.copy(E,B,T,T+N),v-=N}}return $.fill(0),{key:b,iv:E}}var evp_bytestokey=EVP_BytesToKey,MODES$1=modes_1,AuthCipher$1=authCipher,Buffer$9=safeBufferExports$1.Buffer,StreamCipher$1=streamCipher,Transform$3=cipherBase,aes$2=aes$5,ebtk$2=evp_bytestokey,inherits$6=inherits_browserExports;function Cipher(y,u,h){Transform$3.call(this),this._cache=new Splitter$1,this._cipher=new aes$2.AES(u),this._prev=Buffer$9.from(h),this._mode=y,this._autopadding=!0}inherits$6(Cipher,Transform$3),Cipher.prototype._update=function(y){this._cache.add(y);for(var u,h,v=[];u=this._cache.get();)h=this._mode.encrypt(this,u),v.push(h);return Buffer$9.concat(v)};var PADDING=Buffer$9.alloc(16,16);Cipher.prototype._final=function(){var y=this._cache.flush();if(this._autopadding)return y=this._mode.encrypt(this,y),this._cipher.scrub(),y;if(!y.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")},Cipher.prototype.setAutoPadding=function(y){return this._autopadding=!!y,this};function Splitter$1(){this.cache=Buffer$9.allocUnsafe(0)}Splitter$1.prototype.add=function(y){this.cache=Buffer$9.concat([this.cache,y])},Splitter$1.prototype.get=function(){if(this.cache.length>15){var y=this.cache.slice(0,16);return this.cache=this.cache.slice(16),y}return null},Splitter$1.prototype.flush=function(){for(var y=16-this.cache.length,u=Buffer$9.allocUnsafe(y),h=-1;++h<y;)u.writeUInt8(y,h);return Buffer$9.concat([this.cache,u])};function createCipheriv$1(y,u,h){var v=MODES$1[y.toLowerCase()];if(!v)throw new TypeError("invalid suite type");if(typeof u=="string"&&(u=Buffer$9.from(u)),u.length!==v.key/8)throw new TypeError("invalid key length "+u.length);if(typeof h=="string"&&(h=Buffer$9.from(h)),v.mode!=="GCM"&&h.length!==v.iv)throw new TypeError("invalid iv length "+h.length);return v.type==="stream"?new StreamCipher$1(v.module,u,h):v.type==="auth"?new AuthCipher$1(v.module,u,h):new Cipher(v.module,u,h)}function createCipher$1(y,u){var h=MODES$1[y.toLowerCase()];if(!h)throw new TypeError("invalid suite type");var v=ebtk$2(u,!1,h.key,h.iv);return createCipheriv$1(y,v.key,v.iv)}encrypter.createCipheriv=createCipheriv$1,encrypter.createCipher=createCipher$1;var decrypter={},AuthCipher=authCipher,Buffer$8=safeBufferExports$1.Buffer,MODES=modes_1,StreamCipher=streamCipher,Transform$2=cipherBase,aes$1=aes$5,ebtk$1=evp_bytestokey,inherits$5=inherits_browserExports;function Decipher(y,u,h){Transform$2.call(this),this._cache=new Splitter,this._last=void 0,this._cipher=new aes$1.AES(u),this._prev=Buffer$8.from(h),this._mode=y,this._autopadding=!0}inherits$5(Decipher,Transform$2),Decipher.prototype._update=function(y){this._cache.add(y);for(var u,h,v=[];u=this._cache.get(this._autopadding);)h=this._mode.decrypt(this,u),v.push(h);return Buffer$8.concat(v)},Decipher.prototype._final=function(){var y=this._cache.flush();if(this._autopadding)return unpad(this._mode.decrypt(this,y));if(y)throw new Error("data not multiple of block length")},Decipher.prototype.setAutoPadding=function(y){return this._autopadding=!!y,this};function Splitter(){this.cache=Buffer$8.allocUnsafe(0)}Splitter.prototype.add=function(y){this.cache=Buffer$8.concat([this.cache,y])},Splitter.prototype.get=function(y){var u;if(y){if(this.cache.length>16)return u=this.cache.slice(0,16),this.cache=this.cache.slice(16),u}else if(this.cache.length>=16)return u=this.cache.slice(0,16),this.cache=this.cache.slice(16),u;return null},Splitter.prototype.flush=function(){if(this.cache.length)return this.cache};function unpad(y){var u=y[15];if(u<1||u>16)throw new Error("unable to decrypt data");for(var h=-1;++h<u;)if(y[h+(16-u)]!==u)throw new Error("unable to decrypt data");if(u!==16)return y.slice(0,16-u)}function createDecipheriv$1(y,u,h){var v=MODES[y.toLowerCase()];if(!v)throw new TypeError("invalid suite type");if(typeof h=="string"&&(h=Buffer$8.from(h)),v.mode!=="GCM"&&h.length!==v.iv)throw new TypeError("invalid iv length "+h.length);if(typeof u=="string"&&(u=Buffer$8.from(u)),u.length!==v.key/8)throw new TypeError("invalid key length "+u.length);return v.type==="stream"?new StreamCipher(v.module,u,h,!0):v.type==="auth"?new AuthCipher(v.module,u,h,!0):new Decipher(v.module,u,h)}function createDecipher$1(y,u){var h=MODES[y.toLowerCase()];if(!h)throw new TypeError("invalid suite type");var v=ebtk$1(u,!1,h.key,h.iv);return createDecipheriv$1(y,v.key,v.iv)}decrypter.createDecipher=createDecipher$1,decrypter.createDecipheriv=createDecipheriv$1;var ciphers$2=encrypter,deciphers=decrypter,modes$1=require$$2;function getCiphers$1(){return Object.keys(modes$1)}browser$5.createCipher=browser$5.Cipher=ciphers$2.createCipher,browser$5.createCipheriv=browser$5.Cipheriv=ciphers$2.createCipheriv,browser$5.createDecipher=browser$5.Decipher=deciphers.createDecipher,browser$5.createDecipheriv=browser$5.Decipheriv=deciphers.createDecipheriv,browser$5.listCiphers=browser$5.getCiphers=getCiphers$1;var modes={};(function(y){y["des-ecb"]={key:8,iv:0},y["des-cbc"]=y.des={key:8,iv:8},y["des-ede3-cbc"]=y.des3={key:24,iv:8},y["des-ede3"]={key:24,iv:0},y["des-ede-cbc"]={key:16,iv:8},y["des-ede"]={key:16,iv:0}})(modes);var DES=browserifyDes,aes=browser$5,aesModes=modes_1,desModes=modes,ebtk=evp_bytestokey;function createCipher(y,u){y=y.toLowerCase();var h,v;if(aesModes[y])h=aesModes[y].key,v=aesModes[y].iv;else if(desModes[y])h=desModes[y].key*8,v=desModes[y].iv;else throw new TypeError("invalid suite type");var w=ebtk(u,!1,h,v);return createCipheriv(y,w.key,w.iv)}function createDecipher(y,u){y=y.toLowerCase();var h,v;if(aesModes[y])h=aesModes[y].key,v=aesModes[y].iv;else if(desModes[y])h=desModes[y].key*8,v=desModes[y].iv;else throw new TypeError("invalid suite type");var w=ebtk(u,!1,h,v);return createDecipheriv(y,w.key,w.iv)}function createCipheriv(y,u,h){if(y=y.toLowerCase(),aesModes[y])return aes.createCipheriv(y,u,h);if(desModes[y])return new DES({key:u,iv:h,mode:y});throw new TypeError("invalid suite type")}function createDecipheriv(y,u,h){if(y=y.toLowerCase(),aesModes[y])return aes.createDecipheriv(y,u,h);if(desModes[y])return new DES({key:u,iv:h,mode:y,decrypt:!0});throw new TypeError("invalid suite type")}function getCiphers(){return Object.keys(desModes).concat(aes.getCiphers())}browser$6.createCipher=browser$6.Cipher=createCipher,browser$6.createCipheriv=browser$6.Cipheriv=createCipheriv,browser$6.createDecipher=browser$6.Decipher=createDecipher,browser$6.createDecipheriv=browser$6.Decipheriv=createDecipheriv,browser$6.listCiphers=browser$6.getCiphers=getCiphers;var browser$4={},bn$1={exports:{}};bn$1.exports,function(y){(function(u,h){function v(we,D){if(!we)throw new Error(D||"Assertion failed")}function w(we,D){we.super_=D;var q=function(){};q.prototype=D.prototype,we.prototype=new q,we.prototype.constructor=we}function b(we,D,q){if(b.isBN(we))return we;this.negative=0,this.words=null,this.length=0,this.red=null,we!==null&&((D==="le"||D==="be")&&(q=D,D=10),this._init(we||0,D||10,q||"be"))}typeof u=="object"?u.exports=b:h.BN=b,b.BN=b,b.wordSize=26;var E;try{typeof window<"u"&&typeof window.Buffer<"u"?E=window.Buffer:E=dist.Buffer}catch{}b.isBN=function(D){return D instanceof b?!0:D!==null&&typeof D=="object"&&D.constructor.wordSize===b.wordSize&&Array.isArray(D.words)},b.max=function(D,q){return D.cmp(q)>0?D:q},b.min=function(D,q){return D.cmp(q)<0?D:q},b.prototype._init=function(D,q,O){if(typeof D=="number")return this._initNumber(D,q,O);if(typeof D=="object")return this._initArray(D,q,O);q==="hex"&&(q=16),v(q===(q|0)&&q>=2&&q<=36),D=D.toString().replace(/\s+/g,"");var L=0;D[0]==="-"&&(L++,this.negative=1),L<D.length&&(q===16?this._parseHex(D,L,O):(this._parseBase(D,q,L),O==="le"&&this._initArray(this.toArray(),q,O)))},b.prototype._initNumber=function(D,q,O){D<0&&(this.negative=1,D=-D),D<67108864?(this.words=[D&67108863],this.length=1):D<4503599627370496?(this.words=[D&67108863,D/67108864&67108863],this.length=2):(v(D<9007199254740992),this.words=[D&67108863,D/67108864&67108863,1],this.length=3),O==="le"&&this._initArray(this.toArray(),q,O)},b.prototype._initArray=function(D,q,O){if(v(typeof D.length=="number"),D.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(D.length/3),this.words=new Array(this.length);for(var L=0;L<this.length;L++)this.words[L]=0;var X,j,re=0;if(O==="be")for(L=D.length-1,X=0;L>=0;L-=3)j=D[L]|D[L-1]<<8|D[L-2]<<16,this.words[X]|=j<<re&67108863,this.words[X+1]=j>>>26-re&67108863,re+=24,re>=26&&(re-=26,X++);else if(O==="le")for(L=0,X=0;L<D.length;L+=3)j=D[L]|D[L+1]<<8|D[L+2]<<16,this.words[X]|=j<<re&67108863,this.words[X+1]=j>>>26-re&67108863,re+=24,re>=26&&(re-=26,X++);return this.strip()};function $(we,D){var q=we.charCodeAt(D);return q>=65&&q<=70?q-55:q>=97&&q<=102?q-87:q-48&15}function M(we,D,q){var O=$(we,q);return q-1>=D&&(O|=$(we,q-1)<<4),O}b.prototype._parseHex=function(D,q,O){this.length=Math.ceil((D.length-q)/6),this.words=new Array(this.length);for(var L=0;L<this.length;L++)this.words[L]=0;var X=0,j=0,re;if(O==="be")for(L=D.length-1;L>=q;L-=2)re=M(D,q,L)<<X,this.words[j]|=re&67108863,X>=18?(X-=18,j+=1,this.words[j]|=re>>>26):X+=8;else{var ee=D.length-q;for(L=ee%2===0?q+1:q;L<D.length;L+=2)re=M(D,q,L)<<X,this.words[j]|=re&67108863,X>=18?(X-=18,j+=1,this.words[j]|=re>>>26):X+=8}this.strip()};function T(we,D,q,O){for(var L=0,X=Math.min(we.length,q),j=D;j<X;j++){var re=we.charCodeAt(j)-48;L*=O,re>=49?L+=re-49+10:re>=17?L+=re-17+10:L+=re}return L}b.prototype._parseBase=function(D,q,O){this.words=[0],this.length=1;for(var L=0,X=1;X<=67108863;X*=q)L++;L--,X=X/q|0;for(var j=D.length-O,re=j%L,ee=Math.min(j,j-re)+O,F=0,Q=O;Q<ee;Q+=L)F=T(D,Q,Q+L,q),this.imuln(X),this.words[0]+F<67108864?this.words[0]+=F:this._iaddn(F);if(re!==0){var U=1;for(F=T(D,Q,D.length,q),Q=0;Q<re;Q++)U*=q;this.imuln(U),this.words[0]+F<67108864?this.words[0]+=F:this._iaddn(F)}this.strip()},b.prototype.copy=function(D){D.words=new Array(this.length);for(var q=0;q<this.length;q++)D.words[q]=this.words[q];D.length=this.length,D.negative=this.negative,D.red=this.red},b.prototype.clone=function(){var D=new b(null);return this.copy(D),D},b.prototype._expand=function(D){for(;this.length<D;)this.words[this.length++]=0;return this},b.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},b.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},b.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var C=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],B=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],N=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];b.prototype.toString=function(D,q){D=D||10,q=q|0||1;var O;if(D===16||D==="hex"){O="";for(var L=0,X=0,j=0;j<this.length;j++){var re=this.words[j],ee=((re<<L|X)&16777215).toString(16);X=re>>>24-L&16777215,X!==0||j!==this.length-1?O=C[6-ee.length]+ee+O:O=ee+O,L+=2,L>=26&&(L-=26,j--)}for(X!==0&&(O=X.toString(16)+O);O.length%q!==0;)O="0"+O;return this.negative!==0&&(O="-"+O),O}if(D===(D|0)&&D>=2&&D<=36){var F=B[D],Q=N[D];O="";var U=this.clone();for(U.negative=0;!U.isZero();){var he=U.modn(Q).toString(D);U=U.idivn(Q),U.isZero()?O=he+O:O=C[F-he.length]+he+O}for(this.isZero()&&(O="0"+O);O.length%q!==0;)O="0"+O;return this.negative!==0&&(O="-"+O),O}v(!1,"Base should be between 2 and 36")},b.prototype.toNumber=function(){var D=this.words[0];return this.length===2?D+=this.words[1]*67108864:this.length===3&&this.words[2]===1?D+=4503599627370496+this.words[1]*67108864:this.length>2&&v(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-D:D},b.prototype.toJSON=function(){return this.toString(16)},b.prototype.toBuffer=function(D,q){return v(typeof E<"u"),this.toArrayLike(E,D,q)},b.prototype.toArray=function(D,q){return this.toArrayLike(Array,D,q)},b.prototype.toArrayLike=function(D,q,O){var L=this.byteLength(),X=O||Math.max(1,L);v(L<=X,"byte array longer than desired length"),v(X>0,"Requested array length <= 0"),this.strip();var j=q==="le",re=new D(X),ee,F,Q=this.clone();if(j){for(F=0;!Q.isZero();F++)ee=Q.andln(255),Q.iushrn(8),re[F]=ee;for(;F<X;F++)re[F]=0}else{for(F=0;F<X-L;F++)re[F]=0;for(F=0;!Q.isZero();F++)ee=Q.andln(255),Q.iushrn(8),re[X-F-1]=ee}return re},Math.clz32?b.prototype._countBits=function(D){return 32-Math.clz32(D)}:b.prototype._countBits=function(D){var q=D,O=0;return q>=4096&&(O+=13,q>>>=13),q>=64&&(O+=7,q>>>=7),q>=8&&(O+=4,q>>>=4),q>=2&&(O+=2,q>>>=2),O+q},b.prototype._zeroBits=function(D){if(D===0)return 26;var q=D,O=0;return q&8191||(O+=13,q>>>=13),q&127||(O+=7,q>>>=7),q&15||(O+=4,q>>>=4),q&3||(O+=2,q>>>=2),q&1||O++,O},b.prototype.bitLength=function(){var D=this.words[this.length-1],q=this._countBits(D);return(this.length-1)*26+q};function H(we){for(var D=new Array(we.bitLength()),q=0;q<D.length;q++){var O=q/26|0,L=q%26;D[q]=(we.words[O]&1<<L)>>>L}return D}b.prototype.zeroBits=function(){if(this.isZero())return 0;for(var D=0,q=0;q<this.length;q++){var O=this._zeroBits(this.words[q]);if(D+=O,O!==26)break}return D},b.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},b.prototype.toTwos=function(D){return this.negative!==0?this.abs().inotn(D).iaddn(1):this.clone()},b.prototype.fromTwos=function(D){return this.testn(D-1)?this.notn(D).iaddn(1).ineg():this.clone()},b.prototype.isNeg=function(){return this.negative!==0},b.prototype.neg=function(){return this.clone().ineg()},b.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},b.prototype.iuor=function(D){for(;this.length<D.length;)this.words[this.length++]=0;for(var q=0;q<D.length;q++)this.words[q]=this.words[q]|D.words[q];return this.strip()},b.prototype.ior=function(D){return v((this.negative|D.negative)===0),this.iuor(D)},b.prototype.or=function(D){return this.length>D.length?this.clone().ior(D):D.clone().ior(this)},b.prototype.uor=function(D){return this.length>D.length?this.clone().iuor(D):D.clone().iuor(this)},b.prototype.iuand=function(D){var q;this.length>D.length?q=D:q=this;for(var O=0;O<q.length;O++)this.words[O]=this.words[O]&D.words[O];return this.length=q.length,this.strip()},b.prototype.iand=function(D){return v((this.negative|D.negative)===0),this.iuand(D)},b.prototype.and=function(D){return this.length>D.length?this.clone().iand(D):D.clone().iand(this)},b.prototype.uand=function(D){return this.length>D.length?this.clone().iuand(D):D.clone().iuand(this)},b.prototype.iuxor=function(D){var q,O;this.length>D.length?(q=this,O=D):(q=D,O=this);for(var L=0;L<O.length;L++)this.words[L]=q.words[L]^O.words[L];if(this!==q)for(;L<q.length;L++)this.words[L]=q.words[L];return this.length=q.length,this.strip()},b.prototype.ixor=function(D){return v((this.negative|D.negative)===0),this.iuxor(D)},b.prototype.xor=function(D){return this.length>D.length?this.clone().ixor(D):D.clone().ixor(this)},b.prototype.uxor=function(D){return this.length>D.length?this.clone().iuxor(D):D.clone().iuxor(this)},b.prototype.inotn=function(D){v(typeof D=="number"&&D>=0);var q=Math.ceil(D/26)|0,O=D%26;this._expand(q),O>0&&q--;for(var L=0;L<q;L++)this.words[L]=~this.words[L]&67108863;return O>0&&(this.words[L]=~this.words[L]&67108863>>26-O),this.strip()},b.prototype.notn=function(D){return this.clone().inotn(D)},b.prototype.setn=function(D,q){v(typeof D=="number"&&D>=0);var O=D/26|0,L=D%26;return this._expand(O+1),q?this.words[O]=this.words[O]|1<<L:this.words[O]=this.words[O]&~(1<<L),this.strip()},b.prototype.iadd=function(D){var q;if(this.negative!==0&&D.negative===0)return this.negative=0,q=this.isub(D),this.negative^=1,this._normSign();if(this.negative===0&&D.negative!==0)return D.negative=0,q=this.isub(D),D.negative=1,q._normSign();var O,L;this.length>D.length?(O=this,L=D):(O=D,L=this);for(var X=0,j=0;j<L.length;j++)q=(O.words[j]|0)+(L.words[j]|0)+X,this.words[j]=q&67108863,X=q>>>26;for(;X!==0&&j<O.length;j++)q=(O.words[j]|0)+X,this.words[j]=q&67108863,X=q>>>26;if(this.length=O.length,X!==0)this.words[this.length]=X,this.length++;else if(O!==this)for(;j<O.length;j++)this.words[j]=O.words[j];return this},b.prototype.add=function(D){var q;return D.negative!==0&&this.negative===0?(D.negative=0,q=this.sub(D),D.negative^=1,q):D.negative===0&&this.negative!==0?(this.negative=0,q=D.sub(this),this.negative=1,q):this.length>D.length?this.clone().iadd(D):D.clone().iadd(this)},b.prototype.isub=function(D){if(D.negative!==0){D.negative=0;var q=this.iadd(D);return D.negative=1,q._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(D),this.negative=1,this._normSign();var O=this.cmp(D);if(O===0)return this.negative=0,this.length=1,this.words[0]=0,this;var L,X;O>0?(L=this,X=D):(L=D,X=this);for(var j=0,re=0;re<X.length;re++)q=(L.words[re]|0)-(X.words[re]|0)+j,j=q>>26,this.words[re]=q&67108863;for(;j!==0&&re<L.length;re++)q=(L.words[re]|0)+j,j=q>>26,this.words[re]=q&67108863;if(j===0&&re<L.length&&L!==this)for(;re<L.length;re++)this.words[re]=L.words[re];return this.length=Math.max(this.length,re),L!==this&&(this.negative=1),this.strip()},b.prototype.sub=function(D){return this.clone().isub(D)};function te(we,D,q){q.negative=D.negative^we.negative;var O=we.length+D.length|0;q.length=O,O=O-1|0;var L=we.words[0]|0,X=D.words[0]|0,j=L*X,re=j&67108863,ee=j/67108864|0;q.words[0]=re;for(var F=1;F<O;F++){for(var Q=ee>>>26,U=ee&67108863,he=Math.min(F,D.length-1),Oe=Math.max(0,F-we.length+1);Oe<=he;Oe++){var Ve=F-Oe|0;L=we.words[Ve]|0,X=D.words[Oe]|0,j=L*X+U,Q+=j/67108864|0,U=j&67108863}q.words[F]=U|0,ee=Q|0}return ee!==0?q.words[F]=ee|0:q.length--,q.strip()}var fe=function(D,q,O){var L=D.words,X=q.words,j=O.words,re=0,ee,F,Q,U=L[0]|0,he=U&8191,Oe=U>>>13,Ve=L[1]|0,Ae=Ve&8191,oe=Ve>>>13,ye=L[2]|0,Ce=ye&8191,ae=ye>>>13,de=L[3]|0,ne=de&8191,be=de>>>13,Ie=L[4]|0,Le=Ie&8191,Fe=Ie>>>13,He=L[5]|0,tt=He&8191,Ne=He>>>13,nt=L[6]|0,it=nt&8191,ot=nt>>>13,ut=L[7]|0,ht=ut&8191,St=ut>>>13,Rt=L[8]|0,dt=Rt&8191,Ct=Rt>>>13,Dt=L[9]|0,yt=Dt&8191,zt=Dt>>>13,Zt=X[0]|0,bt=Zt&8191,Lt=Zt>>>13,Nt=X[1]|0,_t=Nt&8191,Vt=Nt>>>13,Wt=X[2]|0,$t=Wt&8191,Qt=Wt>>>13,Gt=X[3]|0,vt=Gt&8191,kt=Gt>>>13,Kt=X[4]|0,At=Kt&8191,Ft=Kt>>>13,Jt=X[5]|0,ve=Jt&8191,J=Jt>>>13,se=X[6]|0,xe=se&8191,ke=se>>>13,qe=X[7]|0,We=qe&8191,ct=qe>>>13,wt=X[8]|0,st=wt&8191,xt=wt>>>13,mt=X[9]|0,Mt=mt&8191,Yt=mt>>>13;O.negative=D.negative^q.negative,O.length=19,ee=Math.imul(he,bt),F=Math.imul(he,Lt),F=F+Math.imul(Oe,bt)|0,Q=Math.imul(Oe,Lt);var er=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(er>>>26)|0,er&=67108863,ee=Math.imul(Ae,bt),F=Math.imul(Ae,Lt),F=F+Math.imul(oe,bt)|0,Q=Math.imul(oe,Lt),ee=ee+Math.imul(he,_t)|0,F=F+Math.imul(he,Vt)|0,F=F+Math.imul(Oe,_t)|0,Q=Q+Math.imul(Oe,Vt)|0;var rr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(rr>>>26)|0,rr&=67108863,ee=Math.imul(Ce,bt),F=Math.imul(Ce,Lt),F=F+Math.imul(ae,bt)|0,Q=Math.imul(ae,Lt),ee=ee+Math.imul(Ae,_t)|0,F=F+Math.imul(Ae,Vt)|0,F=F+Math.imul(oe,_t)|0,Q=Q+Math.imul(oe,Vt)|0,ee=ee+Math.imul(he,$t)|0,F=F+Math.imul(he,Qt)|0,F=F+Math.imul(Oe,$t)|0,Q=Q+Math.imul(Oe,Qt)|0;var qr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(qr>>>26)|0,qr&=67108863,ee=Math.imul(ne,bt),F=Math.imul(ne,Lt),F=F+Math.imul(be,bt)|0,Q=Math.imul(be,Lt),ee=ee+Math.imul(Ce,_t)|0,F=F+Math.imul(Ce,Vt)|0,F=F+Math.imul(ae,_t)|0,Q=Q+Math.imul(ae,Vt)|0,ee=ee+Math.imul(Ae,$t)|0,F=F+Math.imul(Ae,Qt)|0,F=F+Math.imul(oe,$t)|0,Q=Q+Math.imul(oe,Qt)|0,ee=ee+Math.imul(he,vt)|0,F=F+Math.imul(he,kt)|0,F=F+Math.imul(Oe,vt)|0,Q=Q+Math.imul(Oe,kt)|0;var Dr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,ee=Math.imul(Le,bt),F=Math.imul(Le,Lt),F=F+Math.imul(Fe,bt)|0,Q=Math.imul(Fe,Lt),ee=ee+Math.imul(ne,_t)|0,F=F+Math.imul(ne,Vt)|0,F=F+Math.imul(be,_t)|0,Q=Q+Math.imul(be,Vt)|0,ee=ee+Math.imul(Ce,$t)|0,F=F+Math.imul(Ce,Qt)|0,F=F+Math.imul(ae,$t)|0,Q=Q+Math.imul(ae,Qt)|0,ee=ee+Math.imul(Ae,vt)|0,F=F+Math.imul(Ae,kt)|0,F=F+Math.imul(oe,vt)|0,Q=Q+Math.imul(oe,kt)|0,ee=ee+Math.imul(he,At)|0,F=F+Math.imul(he,Ft)|0,F=F+Math.imul(Oe,At)|0,Q=Q+Math.imul(Oe,Ft)|0;var Zr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,ee=Math.imul(tt,bt),F=Math.imul(tt,Lt),F=F+Math.imul(Ne,bt)|0,Q=Math.imul(Ne,Lt),ee=ee+Math.imul(Le,_t)|0,F=F+Math.imul(Le,Vt)|0,F=F+Math.imul(Fe,_t)|0,Q=Q+Math.imul(Fe,Vt)|0,ee=ee+Math.imul(ne,$t)|0,F=F+Math.imul(ne,Qt)|0,F=F+Math.imul(be,$t)|0,Q=Q+Math.imul(be,Qt)|0,ee=ee+Math.imul(Ce,vt)|0,F=F+Math.imul(Ce,kt)|0,F=F+Math.imul(ae,vt)|0,Q=Q+Math.imul(ae,kt)|0,ee=ee+Math.imul(Ae,At)|0,F=F+Math.imul(Ae,Ft)|0,F=F+Math.imul(oe,At)|0,Q=Q+Math.imul(oe,Ft)|0,ee=ee+Math.imul(he,ve)|0,F=F+Math.imul(he,J)|0,F=F+Math.imul(Oe,ve)|0,Q=Q+Math.imul(Oe,J)|0;var Hr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,ee=Math.imul(it,bt),F=Math.imul(it,Lt),F=F+Math.imul(ot,bt)|0,Q=Math.imul(ot,Lt),ee=ee+Math.imul(tt,_t)|0,F=F+Math.imul(tt,Vt)|0,F=F+Math.imul(Ne,_t)|0,Q=Q+Math.imul(Ne,Vt)|0,ee=ee+Math.imul(Le,$t)|0,F=F+Math.imul(Le,Qt)|0,F=F+Math.imul(Fe,$t)|0,Q=Q+Math.imul(Fe,Qt)|0,ee=ee+Math.imul(ne,vt)|0,F=F+Math.imul(ne,kt)|0,F=F+Math.imul(be,vt)|0,Q=Q+Math.imul(be,kt)|0,ee=ee+Math.imul(Ce,At)|0,F=F+Math.imul(Ce,Ft)|0,F=F+Math.imul(ae,At)|0,Q=Q+Math.imul(ae,Ft)|0,ee=ee+Math.imul(Ae,ve)|0,F=F+Math.imul(Ae,J)|0,F=F+Math.imul(oe,ve)|0,Q=Q+Math.imul(oe,J)|0,ee=ee+Math.imul(he,xe)|0,F=F+Math.imul(he,ke)|0,F=F+Math.imul(Oe,xe)|0,Q=Q+Math.imul(Oe,ke)|0;var Vr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,ee=Math.imul(ht,bt),F=Math.imul(ht,Lt),F=F+Math.imul(St,bt)|0,Q=Math.imul(St,Lt),ee=ee+Math.imul(it,_t)|0,F=F+Math.imul(it,Vt)|0,F=F+Math.imul(ot,_t)|0,Q=Q+Math.imul(ot,Vt)|0,ee=ee+Math.imul(tt,$t)|0,F=F+Math.imul(tt,Qt)|0,F=F+Math.imul(Ne,$t)|0,Q=Q+Math.imul(Ne,Qt)|0,ee=ee+Math.imul(Le,vt)|0,F=F+Math.imul(Le,kt)|0,F=F+Math.imul(Fe,vt)|0,Q=Q+Math.imul(Fe,kt)|0,ee=ee+Math.imul(ne,At)|0,F=F+Math.imul(ne,Ft)|0,F=F+Math.imul(be,At)|0,Q=Q+Math.imul(be,Ft)|0,ee=ee+Math.imul(Ce,ve)|0,F=F+Math.imul(Ce,J)|0,F=F+Math.imul(ae,ve)|0,Q=Q+Math.imul(ae,J)|0,ee=ee+Math.imul(Ae,xe)|0,F=F+Math.imul(Ae,ke)|0,F=F+Math.imul(oe,xe)|0,Q=Q+Math.imul(oe,ke)|0,ee=ee+Math.imul(he,We)|0,F=F+Math.imul(he,ct)|0,F=F+Math.imul(Oe,We)|0,Q=Q+Math.imul(Oe,ct)|0;var Tr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,ee=Math.imul(dt,bt),F=Math.imul(dt,Lt),F=F+Math.imul(Ct,bt)|0,Q=Math.imul(Ct,Lt),ee=ee+Math.imul(ht,_t)|0,F=F+Math.imul(ht,Vt)|0,F=F+Math.imul(St,_t)|0,Q=Q+Math.imul(St,Vt)|0,ee=ee+Math.imul(it,$t)|0,F=F+Math.imul(it,Qt)|0,F=F+Math.imul(ot,$t)|0,Q=Q+Math.imul(ot,Qt)|0,ee=ee+Math.imul(tt,vt)|0,F=F+Math.imul(tt,kt)|0,F=F+Math.imul(Ne,vt)|0,Q=Q+Math.imul(Ne,kt)|0,ee=ee+Math.imul(Le,At)|0,F=F+Math.imul(Le,Ft)|0,F=F+Math.imul(Fe,At)|0,Q=Q+Math.imul(Fe,Ft)|0,ee=ee+Math.imul(ne,ve)|0,F=F+Math.imul(ne,J)|0,F=F+Math.imul(be,ve)|0,Q=Q+Math.imul(be,J)|0,ee=ee+Math.imul(Ce,xe)|0,F=F+Math.imul(Ce,ke)|0,F=F+Math.imul(ae,xe)|0,Q=Q+Math.imul(ae,ke)|0,ee=ee+Math.imul(Ae,We)|0,F=F+Math.imul(Ae,ct)|0,F=F+Math.imul(oe,We)|0,Q=Q+Math.imul(oe,ct)|0,ee=ee+Math.imul(he,st)|0,F=F+Math.imul(he,xt)|0,F=F+Math.imul(Oe,st)|0,Q=Q+Math.imul(Oe,xt)|0;var Nr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,ee=Math.imul(yt,bt),F=Math.imul(yt,Lt),F=F+Math.imul(zt,bt)|0,Q=Math.imul(zt,Lt),ee=ee+Math.imul(dt,_t)|0,F=F+Math.imul(dt,Vt)|0,F=F+Math.imul(Ct,_t)|0,Q=Q+Math.imul(Ct,Vt)|0,ee=ee+Math.imul(ht,$t)|0,F=F+Math.imul(ht,Qt)|0,F=F+Math.imul(St,$t)|0,Q=Q+Math.imul(St,Qt)|0,ee=ee+Math.imul(it,vt)|0,F=F+Math.imul(it,kt)|0,F=F+Math.imul(ot,vt)|0,Q=Q+Math.imul(ot,kt)|0,ee=ee+Math.imul(tt,At)|0,F=F+Math.imul(tt,Ft)|0,F=F+Math.imul(Ne,At)|0,Q=Q+Math.imul(Ne,Ft)|0,ee=ee+Math.imul(Le,ve)|0,F=F+Math.imul(Le,J)|0,F=F+Math.imul(Fe,ve)|0,Q=Q+Math.imul(Fe,J)|0,ee=ee+Math.imul(ne,xe)|0,F=F+Math.imul(ne,ke)|0,F=F+Math.imul(be,xe)|0,Q=Q+Math.imul(be,ke)|0,ee=ee+Math.imul(Ce,We)|0,F=F+Math.imul(Ce,ct)|0,F=F+Math.imul(ae,We)|0,Q=Q+Math.imul(ae,ct)|0,ee=ee+Math.imul(Ae,st)|0,F=F+Math.imul(Ae,xt)|0,F=F+Math.imul(oe,st)|0,Q=Q+Math.imul(oe,xt)|0,ee=ee+Math.imul(he,Mt)|0,F=F+Math.imul(he,Yt)|0,F=F+Math.imul(Oe,Mt)|0,Q=Q+Math.imul(Oe,Yt)|0;var Cr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,ee=Math.imul(yt,_t),F=Math.imul(yt,Vt),F=F+Math.imul(zt,_t)|0,Q=Math.imul(zt,Vt),ee=ee+Math.imul(dt,$t)|0,F=F+Math.imul(dt,Qt)|0,F=F+Math.imul(Ct,$t)|0,Q=Q+Math.imul(Ct,Qt)|0,ee=ee+Math.imul(ht,vt)|0,F=F+Math.imul(ht,kt)|0,F=F+Math.imul(St,vt)|0,Q=Q+Math.imul(St,kt)|0,ee=ee+Math.imul(it,At)|0,F=F+Math.imul(it,Ft)|0,F=F+Math.imul(ot,At)|0,Q=Q+Math.imul(ot,Ft)|0,ee=ee+Math.imul(tt,ve)|0,F=F+Math.imul(tt,J)|0,F=F+Math.imul(Ne,ve)|0,Q=Q+Math.imul(Ne,J)|0,ee=ee+Math.imul(Le,xe)|0,F=F+Math.imul(Le,ke)|0,F=F+Math.imul(Fe,xe)|0,Q=Q+Math.imul(Fe,ke)|0,ee=ee+Math.imul(ne,We)|0,F=F+Math.imul(ne,ct)|0,F=F+Math.imul(be,We)|0,Q=Q+Math.imul(be,ct)|0,ee=ee+Math.imul(Ce,st)|0,F=F+Math.imul(Ce,xt)|0,F=F+Math.imul(ae,st)|0,Q=Q+Math.imul(ae,xt)|0,ee=ee+Math.imul(Ae,Mt)|0,F=F+Math.imul(Ae,Yt)|0,F=F+Math.imul(oe,Mt)|0,Q=Q+Math.imul(oe,Yt)|0;var Ar=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Ar>>>26)|0,Ar&=67108863,ee=Math.imul(yt,$t),F=Math.imul(yt,Qt),F=F+Math.imul(zt,$t)|0,Q=Math.imul(zt,Qt),ee=ee+Math.imul(dt,vt)|0,F=F+Math.imul(dt,kt)|0,F=F+Math.imul(Ct,vt)|0,Q=Q+Math.imul(Ct,kt)|0,ee=ee+Math.imul(ht,At)|0,F=F+Math.imul(ht,Ft)|0,F=F+Math.imul(St,At)|0,Q=Q+Math.imul(St,Ft)|0,ee=ee+Math.imul(it,ve)|0,F=F+Math.imul(it,J)|0,F=F+Math.imul(ot,ve)|0,Q=Q+Math.imul(ot,J)|0,ee=ee+Math.imul(tt,xe)|0,F=F+Math.imul(tt,ke)|0,F=F+Math.imul(Ne,xe)|0,Q=Q+Math.imul(Ne,ke)|0,ee=ee+Math.imul(Le,We)|0,F=F+Math.imul(Le,ct)|0,F=F+Math.imul(Fe,We)|0,Q=Q+Math.imul(Fe,ct)|0,ee=ee+Math.imul(ne,st)|0,F=F+Math.imul(ne,xt)|0,F=F+Math.imul(be,st)|0,Q=Q+Math.imul(be,xt)|0,ee=ee+Math.imul(Ce,Mt)|0,F=F+Math.imul(Ce,Yt)|0,F=F+Math.imul(ae,Mt)|0,Q=Q+Math.imul(ae,Yt)|0;var Wr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,ee=Math.imul(yt,vt),F=Math.imul(yt,kt),F=F+Math.imul(zt,vt)|0,Q=Math.imul(zt,kt),ee=ee+Math.imul(dt,At)|0,F=F+Math.imul(dt,Ft)|0,F=F+Math.imul(Ct,At)|0,Q=Q+Math.imul(Ct,Ft)|0,ee=ee+Math.imul(ht,ve)|0,F=F+Math.imul(ht,J)|0,F=F+Math.imul(St,ve)|0,Q=Q+Math.imul(St,J)|0,ee=ee+Math.imul(it,xe)|0,F=F+Math.imul(it,ke)|0,F=F+Math.imul(ot,xe)|0,Q=Q+Math.imul(ot,ke)|0,ee=ee+Math.imul(tt,We)|0,F=F+Math.imul(tt,ct)|0,F=F+Math.imul(Ne,We)|0,Q=Q+Math.imul(Ne,ct)|0,ee=ee+Math.imul(Le,st)|0,F=F+Math.imul(Le,xt)|0,F=F+Math.imul(Fe,st)|0,Q=Q+Math.imul(Fe,xt)|0,ee=ee+Math.imul(ne,Mt)|0,F=F+Math.imul(ne,Yt)|0,F=F+Math.imul(be,Mt)|0,Q=Q+Math.imul(be,Yt)|0;var Lr=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,ee=Math.imul(yt,At),F=Math.imul(yt,Ft),F=F+Math.imul(zt,At)|0,Q=Math.imul(zt,Ft),ee=ee+Math.imul(dt,ve)|0,F=F+Math.imul(dt,J)|0,F=F+Math.imul(Ct,ve)|0,Q=Q+Math.imul(Ct,J)|0,ee=ee+Math.imul(ht,xe)|0,F=F+Math.imul(ht,ke)|0,F=F+Math.imul(St,xe)|0,Q=Q+Math.imul(St,ke)|0,ee=ee+Math.imul(it,We)|0,F=F+Math.imul(it,ct)|0,F=F+Math.imul(ot,We)|0,Q=Q+Math.imul(ot,ct)|0,ee=ee+Math.imul(tt,st)|0,F=F+Math.imul(tt,xt)|0,F=F+Math.imul(Ne,st)|0,Q=Q+Math.imul(Ne,xt)|0,ee=ee+Math.imul(Le,Mt)|0,F=F+Math.imul(Le,Yt)|0,F=F+Math.imul(Fe,Mt)|0,Q=Q+Math.imul(Fe,Yt)|0;var vn=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(vn>>>26)|0,vn&=67108863,ee=Math.imul(yt,ve),F=Math.imul(yt,J),F=F+Math.imul(zt,ve)|0,Q=Math.imul(zt,J),ee=ee+Math.imul(dt,xe)|0,F=F+Math.imul(dt,ke)|0,F=F+Math.imul(Ct,xe)|0,Q=Q+Math.imul(Ct,ke)|0,ee=ee+Math.imul(ht,We)|0,F=F+Math.imul(ht,ct)|0,F=F+Math.imul(St,We)|0,Q=Q+Math.imul(St,ct)|0,ee=ee+Math.imul(it,st)|0,F=F+Math.imul(it,xt)|0,F=F+Math.imul(ot,st)|0,Q=Q+Math.imul(ot,xt)|0,ee=ee+Math.imul(tt,Mt)|0,F=F+Math.imul(tt,Yt)|0,F=F+Math.imul(Ne,Mt)|0,Q=Q+Math.imul(Ne,Yt)|0;var _n=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(_n>>>26)|0,_n&=67108863,ee=Math.imul(yt,xe),F=Math.imul(yt,ke),F=F+Math.imul(zt,xe)|0,Q=Math.imul(zt,ke),ee=ee+Math.imul(dt,We)|0,F=F+Math.imul(dt,ct)|0,F=F+Math.imul(Ct,We)|0,Q=Q+Math.imul(Ct,ct)|0,ee=ee+Math.imul(ht,st)|0,F=F+Math.imul(ht,xt)|0,F=F+Math.imul(St,st)|0,Q=Q+Math.imul(St,xt)|0,ee=ee+Math.imul(it,Mt)|0,F=F+Math.imul(it,Yt)|0,F=F+Math.imul(ot,Mt)|0,Q=Q+Math.imul(ot,Yt)|0;var on=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(on>>>26)|0,on&=67108863,ee=Math.imul(yt,We),F=Math.imul(yt,ct),F=F+Math.imul(zt,We)|0,Q=Math.imul(zt,ct),ee=ee+Math.imul(dt,st)|0,F=F+Math.imul(dt,xt)|0,F=F+Math.imul(Ct,st)|0,Q=Q+Math.imul(Ct,xt)|0,ee=ee+Math.imul(ht,Mt)|0,F=F+Math.imul(ht,Yt)|0,F=F+Math.imul(St,Mt)|0,Q=Q+Math.imul(St,Yt)|0;var In=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(In>>>26)|0,In&=67108863,ee=Math.imul(yt,st),F=Math.imul(yt,xt),F=F+Math.imul(zt,st)|0,Q=Math.imul(zt,xt),ee=ee+Math.imul(dt,Mt)|0,F=F+Math.imul(dt,Yt)|0,F=F+Math.imul(Ct,Mt)|0,Q=Q+Math.imul(Ct,Yt)|0;var Tn=(re+ee|0)+((F&8191)<<13)|0;re=(Q+(F>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,ee=Math.imul(yt,Mt),F=Math.imul(yt,Yt),F=F+Math.imul(zt,Mt)|0,Q=Math.imul(zt,Yt);var Cn=(re+ee|0)+((F&8191)<<13)|0;return re=(Q+(F>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,j[0]=er,j[1]=rr,j[2]=qr,j[3]=Dr,j[4]=Zr,j[5]=Hr,j[6]=Vr,j[7]=Tr,j[8]=Nr,j[9]=Cr,j[10]=Ar,j[11]=Wr,j[12]=Lr,j[13]=vn,j[14]=_n,j[15]=on,j[16]=In,j[17]=Tn,j[18]=Cn,re!==0&&(j[19]=re,O.length++),O};Math.imul||(fe=te);function ce(we,D,q){q.negative=D.negative^we.negative,q.length=we.length+D.length;for(var O=0,L=0,X=0;X<q.length-1;X++){var j=L;L=0;for(var re=O&67108863,ee=Math.min(X,D.length-1),F=Math.max(0,X-we.length+1);F<=ee;F++){var Q=X-F,U=we.words[Q]|0,he=D.words[F]|0,Oe=U*he,Ve=Oe&67108863;j=j+(Oe/67108864|0)|0,Ve=Ve+re|0,re=Ve&67108863,j=j+(Ve>>>26)|0,L+=j>>>26,j&=67108863}q.words[X]=re,O=j,j=L}return O!==0?q.words[X]=O:q.length--,q.strip()}function le(we,D,q){var O=new ie;return O.mulp(we,D,q)}b.prototype.mulTo=function(D,q){var O,L=this.length+D.length;return this.length===10&&D.length===10?O=fe(this,D,q):L<63?O=te(this,D,q):L<1024?O=ce(this,D,q):O=le(this,D,q),O};function ie(we,D){this.x=we,this.y=D}ie.prototype.makeRBT=function(D){for(var q=new Array(D),O=b.prototype._countBits(D)-1,L=0;L<D;L++)q[L]=this.revBin(L,O,D);return q},ie.prototype.revBin=function(D,q,O){if(D===0||D===O-1)return D;for(var L=0,X=0;X<q;X++)L|=(D&1)<<q-X-1,D>>=1;return L},ie.prototype.permute=function(D,q,O,L,X,j){for(var re=0;re<j;re++)L[re]=q[D[re]],X[re]=O[D[re]]},ie.prototype.transform=function(D,q,O,L,X,j){this.permute(j,D,q,O,L,X);for(var re=1;re<X;re<<=1)for(var ee=re<<1,F=Math.cos(2*Math.PI/ee),Q=Math.sin(2*Math.PI/ee),U=0;U<X;U+=ee)for(var he=F,Oe=Q,Ve=0;Ve<re;Ve++){var Ae=O[U+Ve],oe=L[U+Ve],ye=O[U+Ve+re],Ce=L[U+Ve+re],ae=he*ye-Oe*Ce;Ce=he*Ce+Oe*ye,ye=ae,O[U+Ve]=Ae+ye,L[U+Ve]=oe+Ce,O[U+Ve+re]=Ae-ye,L[U+Ve+re]=oe-Ce,Ve!==ee&&(ae=F*he-Q*Oe,Oe=F*Oe+Q*he,he=ae)}},ie.prototype.guessLen13b=function(D,q){var O=Math.max(q,D)|1,L=O&1,X=0;for(O=O/2|0;O;O=O>>>1)X++;return 1<<X+1+L},ie.prototype.conjugate=function(D,q,O){if(!(O<=1))for(var L=0;L<O/2;L++){var X=D[L];D[L]=D[O-L-1],D[O-L-1]=X,X=q[L],q[L]=-q[O-L-1],q[O-L-1]=-X}},ie.prototype.normalize13b=function(D,q){for(var O=0,L=0;L<q/2;L++){var X=Math.round(D[2*L+1]/q)*8192+Math.round(D[2*L]/q)+O;D[L]=X&67108863,X<67108864?O=0:O=X/67108864|0}return D},ie.prototype.convert13b=function(D,q,O,L){for(var X=0,j=0;j<q;j++)X=X+(D[j]|0),O[2*j]=X&8191,X=X>>>13,O[2*j+1]=X&8191,X=X>>>13;for(j=2*q;j<L;++j)O[j]=0;v(X===0),v((X&-8192)===0)},ie.prototype.stub=function(D){for(var q=new Array(D),O=0;O<D;O++)q[O]=0;return q},ie.prototype.mulp=function(D,q,O){var L=2*this.guessLen13b(D.length,q.length),X=this.makeRBT(L),j=this.stub(L),re=new Array(L),ee=new Array(L),F=new Array(L),Q=new Array(L),U=new Array(L),he=new Array(L),Oe=O.words;Oe.length=L,this.convert13b(D.words,D.length,re,L),this.convert13b(q.words,q.length,Q,L),this.transform(re,j,ee,F,L,X),this.transform(Q,j,U,he,L,X);for(var Ve=0;Ve<L;Ve++){var Ae=ee[Ve]*U[Ve]-F[Ve]*he[Ve];F[Ve]=ee[Ve]*he[Ve]+F[Ve]*U[Ve],ee[Ve]=Ae}return this.conjugate(ee,F,L),this.transform(ee,F,Oe,j,L,X),this.conjugate(Oe,j,L),this.normalize13b(Oe,L),O.negative=D.negative^q.negative,O.length=D.length+q.length,O.strip()},b.prototype.mul=function(D){var q=new b(null);return q.words=new Array(this.length+D.length),this.mulTo(D,q)},b.prototype.mulf=function(D){var q=new b(null);return q.words=new Array(this.length+D.length),le(this,D,q)},b.prototype.imul=function(D){return this.clone().mulTo(D,this)},b.prototype.imuln=function(D){v(typeof D=="number"),v(D<67108864);for(var q=0,O=0;O<this.length;O++){var L=(this.words[O]|0)*D,X=(L&67108863)+(q&67108863);q>>=26,q+=L/67108864|0,q+=X>>>26,this.words[O]=X&67108863}return q!==0&&(this.words[O]=q,this.length++),this},b.prototype.muln=function(D){return this.clone().imuln(D)},b.prototype.sqr=function(){return this.mul(this)},b.prototype.isqr=function(){return this.imul(this.clone())},b.prototype.pow=function(D){var q=H(D);if(q.length===0)return new b(1);for(var O=this,L=0;L<q.length&&q[L]===0;L++,O=O.sqr());if(++L<q.length)for(var X=O.sqr();L<q.length;L++,X=X.sqr())q[L]!==0&&(O=O.mul(X));return O},b.prototype.iushln=function(D){v(typeof D=="number"&&D>=0);var q=D%26,O=(D-q)/26,L=67108863>>>26-q<<26-q,X;if(q!==0){var j=0;for(X=0;X<this.length;X++){var re=this.words[X]&L,ee=(this.words[X]|0)-re<<q;this.words[X]=ee|j,j=re>>>26-q}j&&(this.words[X]=j,this.length++)}if(O!==0){for(X=this.length-1;X>=0;X--)this.words[X+O]=this.words[X];for(X=0;X<O;X++)this.words[X]=0;this.length+=O}return this.strip()},b.prototype.ishln=function(D){return v(this.negative===0),this.iushln(D)},b.prototype.iushrn=function(D,q,O){v(typeof D=="number"&&D>=0);var L;q?L=(q-q%26)/26:L=0;var X=D%26,j=Math.min((D-X)/26,this.length),re=67108863^67108863>>>X<<X,ee=O;if(L-=j,L=Math.max(0,L),ee){for(var F=0;F<j;F++)ee.words[F]=this.words[F];ee.length=j}if(j!==0)if(this.length>j)for(this.length-=j,F=0;F<this.length;F++)this.words[F]=this.words[F+j];else this.words[0]=0,this.length=1;var Q=0;for(F=this.length-1;F>=0&&(Q!==0||F>=L);F--){var U=this.words[F]|0;this.words[F]=Q<<26-X|U>>>X,Q=U&re}return ee&&Q!==0&&(ee.words[ee.length++]=Q),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},b.prototype.ishrn=function(D,q,O){return v(this.negative===0),this.iushrn(D,q,O)},b.prototype.shln=function(D){return this.clone().ishln(D)},b.prototype.ushln=function(D){return this.clone().iushln(D)},b.prototype.shrn=function(D){return this.clone().ishrn(D)},b.prototype.ushrn=function(D){return this.clone().iushrn(D)},b.prototype.testn=function(D){v(typeof D=="number"&&D>=0);var q=D%26,O=(D-q)/26,L=1<<q;if(this.length<=O)return!1;var X=this.words[O];return!!(X&L)},b.prototype.imaskn=function(D){v(typeof D=="number"&&D>=0);var q=D%26,O=(D-q)/26;if(v(this.negative===0,"imaskn works only with positive numbers"),this.length<=O)return this;if(q!==0&&O++,this.length=Math.min(O,this.length),q!==0){var L=67108863^67108863>>>q<<q;this.words[this.length-1]&=L}return this.strip()},b.prototype.maskn=function(D){return this.clone().imaskn(D)},b.prototype.iaddn=function(D){return v(typeof D=="number"),v(D<67108864),D<0?this.isubn(-D):this.negative!==0?this.length===1&&(this.words[0]|0)<D?(this.words[0]=D-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(D),this.negative=1,this):this._iaddn(D)},b.prototype._iaddn=function(D){this.words[0]+=D;for(var q=0;q<this.length&&this.words[q]>=67108864;q++)this.words[q]-=67108864,q===this.length-1?this.words[q+1]=1:this.words[q+1]++;return this.length=Math.max(this.length,q+1),this},b.prototype.isubn=function(D){if(v(typeof D=="number"),v(D<67108864),D<0)return this.iaddn(-D);if(this.negative!==0)return this.negative=0,this.iaddn(D),this.negative=1,this;if(this.words[0]-=D,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var q=0;q<this.length&&this.words[q]<0;q++)this.words[q]+=67108864,this.words[q+1]-=1;return this.strip()},b.prototype.addn=function(D){return this.clone().iaddn(D)},b.prototype.subn=function(D){return this.clone().isubn(D)},b.prototype.iabs=function(){return this.negative=0,this},b.prototype.abs=function(){return this.clone().iabs()},b.prototype._ishlnsubmul=function(D,q,O){var L=D.length+O,X;this._expand(L);var j,re=0;for(X=0;X<D.length;X++){j=(this.words[X+O]|0)+re;var ee=(D.words[X]|0)*q;j-=ee&67108863,re=(j>>26)-(ee/67108864|0),this.words[X+O]=j&67108863}for(;X<this.length-O;X++)j=(this.words[X+O]|0)+re,re=j>>26,this.words[X+O]=j&67108863;if(re===0)return this.strip();for(v(re===-1),re=0,X=0;X<this.length;X++)j=-(this.words[X]|0)+re,re=j>>26,this.words[X]=j&67108863;return this.negative=1,this.strip()},b.prototype._wordDiv=function(D,q){var O=this.length-D.length,L=this.clone(),X=D,j=X.words[X.length-1]|0,re=this._countBits(j);O=26-re,O!==0&&(X=X.ushln(O),L.iushln(O),j=X.words[X.length-1]|0);var ee=L.length-X.length,F;if(q!=="mod"){F=new b(null),F.length=ee+1,F.words=new Array(F.length);for(var Q=0;Q<F.length;Q++)F.words[Q]=0}var U=L.clone()._ishlnsubmul(X,1,ee);U.negative===0&&(L=U,F&&(F.words[ee]=1));for(var he=ee-1;he>=0;he--){var Oe=(L.words[X.length+he]|0)*67108864+(L.words[X.length+he-1]|0);for(Oe=Math.min(Oe/j|0,67108863),L._ishlnsubmul(X,Oe,he);L.negative!==0;)Oe--,L.negative=0,L._ishlnsubmul(X,1,he),L.isZero()||(L.negative^=1);F&&(F.words[he]=Oe)}return F&&F.strip(),L.strip(),q!=="div"&&O!==0&&L.iushrn(O),{div:F||null,mod:L}},b.prototype.divmod=function(D,q,O){if(v(!D.isZero()),this.isZero())return{div:new b(0),mod:new b(0)};var L,X,j;return this.negative!==0&&D.negative===0?(j=this.neg().divmod(D,q),q!=="mod"&&(L=j.div.neg()),q!=="div"&&(X=j.mod.neg(),O&&X.negative!==0&&X.iadd(D)),{div:L,mod:X}):this.negative===0&&D.negative!==0?(j=this.divmod(D.neg(),q),q!=="mod"&&(L=j.div.neg()),{div:L,mod:j.mod}):this.negative&D.negative?(j=this.neg().divmod(D.neg(),q),q!=="div"&&(X=j.mod.neg(),O&&X.negative!==0&&X.isub(D)),{div:j.div,mod:X}):D.length>this.length||this.cmp(D)<0?{div:new b(0),mod:this}:D.length===1?q==="div"?{div:this.divn(D.words[0]),mod:null}:q==="mod"?{div:null,mod:new b(this.modn(D.words[0]))}:{div:this.divn(D.words[0]),mod:new b(this.modn(D.words[0]))}:this._wordDiv(D,q)},b.prototype.div=function(D){return this.divmod(D,"div",!1).div},b.prototype.mod=function(D){return this.divmod(D,"mod",!1).mod},b.prototype.umod=function(D){return this.divmod(D,"mod",!0).mod},b.prototype.divRound=function(D){var q=this.divmod(D);if(q.mod.isZero())return q.div;var O=q.div.negative!==0?q.mod.isub(D):q.mod,L=D.ushrn(1),X=D.andln(1),j=O.cmp(L);return j<0||X===1&&j===0?q.div:q.div.negative!==0?q.div.isubn(1):q.div.iaddn(1)},b.prototype.modn=function(D){v(D<=67108863);for(var q=(1<<26)%D,O=0,L=this.length-1;L>=0;L--)O=(q*O+(this.words[L]|0))%D;return O},b.prototype.idivn=function(D){v(D<=67108863);for(var q=0,O=this.length-1;O>=0;O--){var L=(this.words[O]|0)+q*67108864;this.words[O]=L/D|0,q=L%D}return this.strip()},b.prototype.divn=function(D){return this.clone().idivn(D)},b.prototype.egcd=function(D){v(D.negative===0),v(!D.isZero());var q=this,O=D.clone();q.negative!==0?q=q.umod(D):q=q.clone();for(var L=new b(1),X=new b(0),j=new b(0),re=new b(1),ee=0;q.isEven()&&O.isEven();)q.iushrn(1),O.iushrn(1),++ee;for(var F=O.clone(),Q=q.clone();!q.isZero();){for(var U=0,he=1;!(q.words[0]&he)&&U<26;++U,he<<=1);if(U>0)for(q.iushrn(U);U-- >0;)(L.isOdd()||X.isOdd())&&(L.iadd(F),X.isub(Q)),L.iushrn(1),X.iushrn(1);for(var Oe=0,Ve=1;!(O.words[0]&Ve)&&Oe<26;++Oe,Ve<<=1);if(Oe>0)for(O.iushrn(Oe);Oe-- >0;)(j.isOdd()||re.isOdd())&&(j.iadd(F),re.isub(Q)),j.iushrn(1),re.iushrn(1);q.cmp(O)>=0?(q.isub(O),L.isub(j),X.isub(re)):(O.isub(q),j.isub(L),re.isub(X))}return{a:j,b:re,gcd:O.iushln(ee)}},b.prototype._invmp=function(D){v(D.negative===0),v(!D.isZero());var q=this,O=D.clone();q.negative!==0?q=q.umod(D):q=q.clone();for(var L=new b(1),X=new b(0),j=O.clone();q.cmpn(1)>0&&O.cmpn(1)>0;){for(var re=0,ee=1;!(q.words[0]&ee)&&re<26;++re,ee<<=1);if(re>0)for(q.iushrn(re);re-- >0;)L.isOdd()&&L.iadd(j),L.iushrn(1);for(var F=0,Q=1;!(O.words[0]&Q)&&F<26;++F,Q<<=1);if(F>0)for(O.iushrn(F);F-- >0;)X.isOdd()&&X.iadd(j),X.iushrn(1);q.cmp(O)>=0?(q.isub(O),L.isub(X)):(O.isub(q),X.isub(L))}var U;return q.cmpn(1)===0?U=L:U=X,U.cmpn(0)<0&&U.iadd(D),U},b.prototype.gcd=function(D){if(this.isZero())return D.abs();if(D.isZero())return this.abs();var q=this.clone(),O=D.clone();q.negative=0,O.negative=0;for(var L=0;q.isEven()&&O.isEven();L++)q.iushrn(1),O.iushrn(1);do{for(;q.isEven();)q.iushrn(1);for(;O.isEven();)O.iushrn(1);var X=q.cmp(O);if(X<0){var j=q;q=O,O=j}else if(X===0||O.cmpn(1)===0)break;q.isub(O)}while(!0);return O.iushln(L)},b.prototype.invm=function(D){return this.egcd(D).a.umod(D)},b.prototype.isEven=function(){return(this.words[0]&1)===0},b.prototype.isOdd=function(){return(this.words[0]&1)===1},b.prototype.andln=function(D){return this.words[0]&D},b.prototype.bincn=function(D){v(typeof D=="number");var q=D%26,O=(D-q)/26,L=1<<q;if(this.length<=O)return this._expand(O+1),this.words[O]|=L,this;for(var X=L,j=O;X!==0&&j<this.length;j++){var re=this.words[j]|0;re+=X,X=re>>>26,re&=67108863,this.words[j]=re}return X!==0&&(this.words[j]=X,this.length++),this},b.prototype.isZero=function(){return this.length===1&&this.words[0]===0},b.prototype.cmpn=function(D){var q=D<0;if(this.negative!==0&&!q)return-1;if(this.negative===0&&q)return 1;this.strip();var O;if(this.length>1)O=1;else{q&&(D=-D),v(D<=67108863,"Number is too big");var L=this.words[0]|0;O=L===D?0:L<D?-1:1}return this.negative!==0?-O|0:O},b.prototype.cmp=function(D){if(this.negative!==0&&D.negative===0)return-1;if(this.negative===0&&D.negative!==0)return 1;var q=this.ucmp(D);return this.negative!==0?-q|0:q},b.prototype.ucmp=function(D){if(this.length>D.length)return 1;if(this.length<D.length)return-1;for(var q=0,O=this.length-1;O>=0;O--){var L=this.words[O]|0,X=D.words[O]|0;if(L!==X){L<X?q=-1:L>X&&(q=1);break}}return q},b.prototype.gtn=function(D){return this.cmpn(D)===1},b.prototype.gt=function(D){return this.cmp(D)===1},b.prototype.gten=function(D){return this.cmpn(D)>=0},b.prototype.gte=function(D){return this.cmp(D)>=0},b.prototype.ltn=function(D){return this.cmpn(D)===-1},b.prototype.lt=function(D){return this.cmp(D)===-1},b.prototype.lten=function(D){return this.cmpn(D)<=0},b.prototype.lte=function(D){return this.cmp(D)<=0},b.prototype.eqn=function(D){return this.cmpn(D)===0},b.prototype.eq=function(D){return this.cmp(D)===0},b.red=function(D){return new Re(D)},b.prototype.toRed=function(D){return v(!this.red,"Already a number in reduction context"),v(this.negative===0,"red works only with positives"),D.convertTo(this)._forceRed(D)},b.prototype.fromRed=function(){return v(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},b.prototype._forceRed=function(D){return this.red=D,this},b.prototype.forceRed=function(D){return v(!this.red,"Already a number in reduction context"),this._forceRed(D)},b.prototype.redAdd=function(D){return v(this.red,"redAdd works only with red numbers"),this.red.add(this,D)},b.prototype.redIAdd=function(D){return v(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,D)},b.prototype.redSub=function(D){return v(this.red,"redSub works only with red numbers"),this.red.sub(this,D)},b.prototype.redISub=function(D){return v(this.red,"redISub works only with red numbers"),this.red.isub(this,D)},b.prototype.redShl=function(D){return v(this.red,"redShl works only with red numbers"),this.red.shl(this,D)},b.prototype.redMul=function(D){return v(this.red,"redMul works only with red numbers"),this.red._verify2(this,D),this.red.mul(this,D)},b.prototype.redIMul=function(D){return v(this.red,"redMul works only with red numbers"),this.red._verify2(this,D),this.red.imul(this,D)},b.prototype.redSqr=function(){return v(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},b.prototype.redISqr=function(){return v(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},b.prototype.redSqrt=function(){return v(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},b.prototype.redInvm=function(){return v(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},b.prototype.redNeg=function(){return v(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},b.prototype.redPow=function(D){return v(this.red&&!D.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,D)};var ge={k256:null,p224:null,p192:null,p25519:null};function pe(we,D){this.name=we,this.p=new b(D,16),this.n=this.p.bitLength(),this.k=new b(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}pe.prototype._tmp=function(){var D=new b(null);return D.words=new Array(Math.ceil(this.n/13)),D},pe.prototype.ireduce=function(D){var q=D,O;do this.split(q,this.tmp),q=this.imulK(q),q=q.iadd(this.tmp),O=q.bitLength();while(O>this.n);var L=O<this.n?-1:q.ucmp(this.p);return L===0?(q.words[0]=0,q.length=1):L>0?q.isub(this.p):q.strip!==void 0?q.strip():q._strip(),q},pe.prototype.split=function(D,q){D.iushrn(this.n,0,q)},pe.prototype.imulK=function(D){return D.imul(this.k)};function Me(){pe.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}w(Me,pe),Me.prototype.split=function(D,q){for(var O=4194303,L=Math.min(D.length,9),X=0;X<L;X++)q.words[X]=D.words[X];if(q.length=L,D.length<=9){D.words[0]=0,D.length=1;return}var j=D.words[9];for(q.words[q.length++]=j&O,X=10;X<D.length;X++){var re=D.words[X]|0;D.words[X-10]=(re&O)<<4|j>>>22,j=re}j>>>=22,D.words[X-10]=j,j===0&&D.length>10?D.length-=10:D.length-=9},Me.prototype.imulK=function(D){D.words[D.length]=0,D.words[D.length+1]=0,D.length+=2;for(var q=0,O=0;O<D.length;O++){var L=D.words[O]|0;q+=L*977,D.words[O]=q&67108863,q=L*64+(q/67108864|0)}return D.words[D.length-1]===0&&(D.length--,D.words[D.length-1]===0&&D.length--),D};function $e(){pe.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}w($e,pe);function Pe(){pe.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}w(Pe,pe);function Be(){pe.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}w(Be,pe),Be.prototype.imulK=function(D){for(var q=0,O=0;O<D.length;O++){var L=(D.words[O]|0)*19+q,X=L&67108863;L>>>=26,D.words[O]=X,q=L}return q!==0&&(D.words[D.length++]=q),D},b._prime=function(D){if(ge[D])return ge[D];var q;if(D==="k256")q=new Me;else if(D==="p224")q=new $e;else if(D==="p192")q=new Pe;else if(D==="p25519")q=new Be;else throw new Error("Unknown prime "+D);return ge[D]=q,q};function Re(we){if(typeof we=="string"){var D=b._prime(we);this.m=D.p,this.prime=D}else v(we.gtn(1),"modulus must be greater than 1"),this.m=we,this.prime=null}Re.prototype._verify1=function(D){v(D.negative===0,"red works only with positives"),v(D.red,"red works only with red numbers")},Re.prototype._verify2=function(D,q){v((D.negative|q.negative)===0,"red works only with positives"),v(D.red&&D.red===q.red,"red works only with red numbers")},Re.prototype.imod=function(D){return this.prime?this.prime.ireduce(D)._forceRed(this):D.umod(this.m)._forceRed(this)},Re.prototype.neg=function(D){return D.isZero()?D.clone():this.m.sub(D)._forceRed(this)},Re.prototype.add=function(D,q){this._verify2(D,q);var O=D.add(q);return O.cmp(this.m)>=0&&O.isub(this.m),O._forceRed(this)},Re.prototype.iadd=function(D,q){this._verify2(D,q);var O=D.iadd(q);return O.cmp(this.m)>=0&&O.isub(this.m),O},Re.prototype.sub=function(D,q){this._verify2(D,q);var O=D.sub(q);return O.cmpn(0)<0&&O.iadd(this.m),O._forceRed(this)},Re.prototype.isub=function(D,q){this._verify2(D,q);var O=D.isub(q);return O.cmpn(0)<0&&O.iadd(this.m),O},Re.prototype.shl=function(D,q){return this._verify1(D),this.imod(D.ushln(q))},Re.prototype.imul=function(D,q){return this._verify2(D,q),this.imod(D.imul(q))},Re.prototype.mul=function(D,q){return this._verify2(D,q),this.imod(D.mul(q))},Re.prototype.isqr=function(D){return this.imul(D,D.clone())},Re.prototype.sqr=function(D){return this.mul(D,D)},Re.prototype.sqrt=function(D){if(D.isZero())return D.clone();var q=this.m.andln(3);if(v(q%2===1),q===3){var O=this.m.add(new b(1)).iushrn(2);return this.pow(D,O)}for(var L=this.m.subn(1),X=0;!L.isZero()&&L.andln(1)===0;)X++,L.iushrn(1);v(!L.isZero());var j=new b(1).toRed(this),re=j.redNeg(),ee=this.m.subn(1).iushrn(1),F=this.m.bitLength();for(F=new b(2*F*F).toRed(this);this.pow(F,ee).cmp(re)!==0;)F.redIAdd(re);for(var Q=this.pow(F,L),U=this.pow(D,L.addn(1).iushrn(1)),he=this.pow(D,L),Oe=X;he.cmp(j)!==0;){for(var Ve=he,Ae=0;Ve.cmp(j)!==0;Ae++)Ve=Ve.redSqr();v(Ae<Oe);var oe=this.pow(Q,new b(1).iushln(Oe-Ae-1));U=U.redMul(oe),Q=oe.redSqr(),he=he.redMul(Q),Oe=Ae}return U},Re.prototype.invm=function(D){var q=D._invmp(this.m);return q.negative!==0?(q.negative=0,this.imod(q).redNeg()):this.imod(q)},Re.prototype.pow=function(D,q){if(q.isZero())return new b(1).toRed(this);if(q.cmpn(1)===0)return D.clone();var O=4,L=new Array(1<<O);L[0]=new b(1).toRed(this),L[1]=D;for(var X=2;X<L.length;X++)L[X]=this.mul(L[X-1],D);var j=L[0],re=0,ee=0,F=q.bitLength()%26;for(F===0&&(F=26),X=q.length-1;X>=0;X--){for(var Q=q.words[X],U=F-1;U>=0;U--){var he=Q>>U&1;if(j!==L[0]&&(j=this.sqr(j)),he===0&&re===0){ee=0;continue}re<<=1,re|=he,ee++,!(ee!==O&&(X!==0||U!==0))&&(j=this.mul(j,L[re]),ee=0,re=0)}F=26}return j},Re.prototype.convertTo=function(D){var q=D.umod(this.m);return q===D?q.clone():q},Re.prototype.convertFrom=function(D){var q=D.clone();return q.red=null,q},b.mont=function(D){return new je(D)};function je(we){Re.call(this,we),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new b(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w(je,Re),je.prototype.convertTo=function(D){return this.imod(D.ushln(this.shift))},je.prototype.convertFrom=function(D){var q=this.imod(D.mul(this.rinv));return q.red=null,q},je.prototype.imul=function(D,q){if(D.isZero()||q.isZero())return D.words[0]=0,D.length=1,D;var O=D.imul(q),L=O.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),X=O.isub(L).iushrn(this.shift),j=X;return X.cmp(this.m)>=0?j=X.isub(this.m):X.cmpn(0)<0&&(j=X.iadd(this.m)),j._forceRed(this)},je.prototype.mul=function(D,q){if(D.isZero()||q.isZero())return new b(0)._forceRed(this);var O=D.mul(q),L=O.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),X=O.isub(L).iushrn(this.shift),j=X;return X.cmp(this.m)>=0?j=X.isub(this.m):X.cmpn(0)<0&&(j=X.iadd(this.m)),j._forceRed(this)},je.prototype.invm=function(D){var q=this.imod(D._invmp(this.m).mul(this.r2));return q._forceRed(this)}})(y,commonjsGlobal)}(bn$1);var bnExports$1=bn$1.exports,brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var y;brorand.exports=function(w){return y||(y=new u(null)),y.generate(w)};function u(v){this.rand=v}if(brorand.exports.Rand=u,u.prototype.generate=function(w){return this._rand(w)},u.prototype._rand=function(w){if(this.rand.getBytes)return this.rand.getBytes(w);for(var b=new Uint8Array(w),E=0;E<b.length;E++)b[E]=this.rand.getByte();return b},typeof self=="object")self.crypto&&self.crypto.getRandomValues?u.prototype._rand=function(w){var b=new Uint8Array(w);return self.crypto.getRandomValues(b),b}:self.msCrypto&&self.msCrypto.getRandomValues?u.prototype._rand=function(w){var b=new Uint8Array(w);return self.msCrypto.getRandomValues(b),b}:typeof window=="object"&&(u.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var h=requireCryptoBrowserify();if(typeof h.randomBytes!="function")throw new Error("Not supported");u.prototype._rand=function(w){return h.randomBytes(w)}}catch{}return brorand.exports}var mr,hasRequiredMr;function requireMr(){if(hasRequiredMr)return mr;hasRequiredMr=1;var y=bnExports$1,u=requireBrorand();function h(v){this.rand=v||new u.Rand}return mr=h,h.create=function(w){return new h(w)},h.prototype._randbelow=function(w){var b=w.bitLength(),E=Math.ceil(b/8);do var $=new y(this.rand.generate(E));while($.cmp(w)>=0);return $},h.prototype._randrange=function(w,b){var E=b.sub(w);return w.add(this._randbelow(E))},h.prototype.test=function(w,b,E){var $=w.bitLength(),M=y.mont(w),T=new y(1).toRed(M);b||(b=Math.max(1,$/48|0));for(var C=w.subn(1),B=0;!C.testn(B);B++);for(var N=w.shrn(B),H=C.toRed(M),te=!0;b>0;b--){var fe=this._randrange(new y(2),C);E&&E(fe);var ce=fe.toRed(M).redPow(N);if(!(ce.cmp(T)===0||ce.cmp(H)===0)){for(var le=1;le<B;le++){if(ce=ce.redSqr(),ce.cmp(T)===0)return!1;if(ce.cmp(H)===0)break}if(le===B)return!1}}return te},h.prototype.getDivisor=function(w,b){var E=w.bitLength(),$=y.mont(w),M=new y(1).toRed($);b||(b=Math.max(1,E/48|0));for(var T=w.subn(1),C=0;!T.testn(C);C++);for(var B=w.shrn(C),N=T.toRed($);b>0;b--){var H=this._randrange(new y(2),T),te=w.gcd(H);if(te.cmpn(1)!==0)return te;var fe=H.toRed($).redPow(B);if(!(fe.cmp(M)===0||fe.cmp(N)===0)){for(var ce=1;ce<C;ce++){if(fe=fe.redSqr(),fe.cmp(M)===0)return fe.fromRed().subn(1).gcd(w);if(fe.cmp(N)===0)break}if(ce===C)return fe=fe.redSqr(),fe.fromRed().subn(1).gcd(w)}}return!1},mr}var generatePrime,hasRequiredGeneratePrime;function requireGeneratePrime(){if(hasRequiredGeneratePrime)return generatePrime;hasRequiredGeneratePrime=1;var y=browserExports;generatePrime=ce,ce.simpleSieve=te,ce.fermatTest=fe;var u=bnExports$1,h=new u(24),v=requireMr(),w=new v,b=new u(1),E=new u(2),$=new u(5);new u(16),new u(8);var M=new u(10),T=new u(3);new u(7);var C=new u(11),B=new u(4);new u(12);var N=null;function H(){if(N!==null)return N;var le=1048576,ie=[];ie[0]=2;for(var ge=1,pe=3;pe<le;pe+=2){for(var Me=Math.ceil(Math.sqrt(pe)),$e=0;$e<ge&&ie[$e]<=Me&&pe%ie[$e]!==0;$e++);ge!==$e&&ie[$e]<=Me||(ie[ge++]=pe)}return N=ie,ie}function te(le){for(var ie=H(),ge=0;ge<ie.length;ge++)if(le.modn(ie[ge])===0)return le.cmpn(ie[ge])===0;return!0}function fe(le){var ie=u.mont(le);return E.toRed(ie).redPow(le.subn(1)).fromRed().cmpn(1)===0}function ce(le,ie){if(le<16)return ie===2||ie===5?new u([140,123]):new u([140,39]);ie=new u(ie);for(var ge,pe;;){for(ge=new u(y(Math.ceil(le/8)));ge.bitLength()>le;)ge.ishrn(1);if(ge.isEven()&&ge.iadd(b),ge.testn(1)||ge.iadd(E),ie.cmp(E)){if(!ie.cmp($))for(;ge.mod(M).cmp(T);)ge.iadd(B)}else for(;ge.mod(h).cmp(C);)ge.iadd(B);if(pe=ge.shrn(1),te(pe)&&te(ge)&&fe(pe)&&fe(ge)&&w.test(pe)&&w.test(ge))return ge}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$1={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var y=bnExports$1,u=requireMr(),h=new u,v=new y(24),w=new y(11),b=new y(10),E=new y(3),$=new y(7),M=requireGeneratePrime(),T=browserExports;dh=te;function C(ce,le){return le=le||"utf8",Buffer$C.isBuffer(ce)||(ce=new Buffer$C(ce,le)),this._pub=new y(ce),this}function B(ce,le){return le=le||"utf8",Buffer$C.isBuffer(ce)||(ce=new Buffer$C(ce,le)),this._priv=new y(ce),this}var N={};function H(ce,le){var ie=le.toString("hex"),ge=[ie,ce.toString(16)].join("_");if(ge in N)return N[ge];var pe=0;if(ce.isEven()||!M.simpleSieve||!M.fermatTest(ce)||!h.test(ce))return pe+=1,ie==="02"||ie==="05"?pe+=8:pe+=4,N[ge]=pe,pe;h.test(ce.shrn(1))||(pe+=2);var Me;switch(ie){case"02":ce.mod(v).cmp(w)&&(pe+=8);break;case"05":Me=ce.mod(b),Me.cmp(E)&&Me.cmp($)&&(pe+=8);break;default:pe+=4}return N[ge]=pe,pe}function te(ce,le,ie){this.setGenerator(le),this.__prime=new y(ce),this._prime=y.mont(this.__prime),this._primeLen=ce.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,ie?(this.setPublicKey=C,this.setPrivateKey=B):this._primeCode=8}Object.defineProperty(te.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=H(this.__prime,this.__gen)),this._primeCode}}),te.prototype.generateKeys=function(){return this._priv||(this._priv=new y(T(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},te.prototype.computeSecret=function(ce){ce=new y(ce),ce=ce.toRed(this._prime);var le=ce.redPow(this._priv).fromRed(),ie=new Buffer$C(le.toArray()),ge=this.getPrime();if(ie.length<ge.length){var pe=new Buffer$C(ge.length-ie.length);pe.fill(0),ie=Buffer$C.concat([pe,ie])}return ie},te.prototype.getPublicKey=function(le){return fe(this._pub,le)},te.prototype.getPrivateKey=function(le){return fe(this._priv,le)},te.prototype.getPrime=function(ce){return fe(this.__prime,ce)},te.prototype.getGenerator=function(ce){return fe(this._gen,ce)},te.prototype.setGenerator=function(ce,le){return le=le||"utf8",Buffer$C.isBuffer(ce)||(ce=new Buffer$C(ce,le)),this.__gen=ce,this._gen=new y(ce),this};function fe(ce,le){var ie=new Buffer$C(ce.toArray());return le?ie.toString(le):ie}return dh}var hasRequiredBrowser$2;function requireBrowser$2(){if(hasRequiredBrowser$2)return browser$4;hasRequiredBrowser$2=1;var y=requireGeneratePrime(),u=require$$1$1,h=requireDh();function v(E){var $=new Buffer$C(u[E].prime,"hex"),M=new Buffer$C(u[E].gen,"hex");return new h($,M)}var w={binary:!0,hex:!0,base64:!0};function b(E,$,M,T){return Buffer$C.isBuffer($)||w[$]===void 0?b(E,"binary",$,M):($=$||"binary",T=T||"binary",M=M||new Buffer$C([2]),Buffer$C.isBuffer(M)||(M=new Buffer$C(M,T)),typeof E=="number"?new h(y(E,M),M,!0):(Buffer$C.isBuffer(E)||(E=new Buffer$C(E,$)),new h(E,M,!0)))}return browser$4.DiffieHellmanGroup=browser$4.createDiffieHellmanGroup=browser$4.getDiffieHellman=v,browser$4.createDiffieHellman=browser$4.DiffieHellman=b,browser$4}var readableBrowser={exports:{}},processNextickArgs={exports:{}};typeof process$1>"u"||!process$1.version||process$1.version.indexOf("v0.")===0||process$1.version.indexOf("v1.")===0&&process$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick}:processNextickArgs.exports=process$1;function nextTick(y,u,h,v){if(typeof y!="function")throw new TypeError('"callback" argument must be a function');var w=arguments.length,b,E;switch(w){case 0:case 1:return process$1.nextTick(y);case 2:return process$1.nextTick(function(){y.call(null,u)});case 3:return process$1.nextTick(function(){y.call(null,u,h)});case 4:return process$1.nextTick(function(){y.call(null,u,h,v)});default:for(b=new Array(w-1),E=0;E<b.length;)b[E++]=arguments[E];return process$1.nextTick(function(){y.apply(null,b)})}}var processNextickArgsExports=processNextickArgs.exports,toString={}.toString,isarray=Array.isArray||function(y){return toString.call(y)=="[object Array]"},streamBrowser=eventsExports.EventEmitter,safeBuffer$1={exports:{}};(function(y,u){var h=dist,v=h.Buffer;function w(E,$){for(var M in E)$[M]=E[M]}v.from&&v.alloc&&v.allocUnsafe&&v.allocUnsafeSlow?y.exports=h:(w(h,u),u.Buffer=b);function b(E,$,M){return v(E,$,M)}w(v,b),b.from=function(E,$,M){if(typeof E=="number")throw new TypeError("Argument must not be a number");return v(E,$,M)},b.alloc=function(E,$,M){if(typeof E!="number")throw new TypeError("Argument must be a number");var T=v(E);return $!==void 0?typeof M=="string"?T.fill($,M):T.fill($):T.fill(0),T},b.allocUnsafe=function(E){if(typeof E!="number")throw new TypeError("Argument must be a number");return v(E)},b.allocUnsafeSlow=function(E){if(typeof E!="number")throw new TypeError("Argument must be a number");return h.SlowBuffer(E)}})(safeBuffer$1,safeBuffer$1.exports);var safeBufferExports=safeBuffer$1.exports,util$a={};function isArray(y){return Array.isArray?Array.isArray(y):objectToString(y)==="[object Array]"}util$a.isArray=isArray;function isBoolean(y){return typeof y=="boolean"}util$a.isBoolean=isBoolean;function isNull(y){return y===null}util$a.isNull=isNull;function isNullOrUndefined(y){return y==null}util$a.isNullOrUndefined=isNullOrUndefined;function isNumber(y){return typeof y=="number"}util$a.isNumber=isNumber;function isString(y){return typeof y=="string"}util$a.isString=isString;function isSymbol(y){return typeof y=="symbol"}util$a.isSymbol=isSymbol;function isUndefined(y){return y===void 0}util$a.isUndefined=isUndefined;function isRegExp(y){return objectToString(y)==="[object RegExp]"}util$a.isRegExp=isRegExp;function isObject(y){return typeof y=="object"&&y!==null}util$a.isObject=isObject;function isDate(y){return objectToString(y)==="[object Date]"}util$a.isDate=isDate;function isError(y){return objectToString(y)==="[object Error]"||y instanceof Error}util$a.isError=isError;function isFunction(y){return typeof y=="function"}util$a.isFunction=isFunction;function isPrimitive(y){return y===null||typeof y=="boolean"||typeof y=="number"||typeof y=="string"||typeof y=="symbol"||typeof y>"u"}util$a.isPrimitive=isPrimitive,util$a.isBuffer=dist.Buffer.isBuffer;function objectToString(y){return Object.prototype.toString.call(y)}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(y){function u(b,E){if(!(b instanceof E))throw new TypeError("Cannot call a class as a function")}var h=safeBufferExports.Buffer,v=util$b;function w(b,E,$){b.copy(E,$)}y.exports=function(){function b(){u(this,b),this.head=null,this.tail=null,this.length=0}return b.prototype.push=function($){var M={data:$,next:null};this.length>0?this.tail.next=M:this.head=M,this.tail=M,++this.length},b.prototype.unshift=function($){var M={data:$,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length},b.prototype.shift=function(){if(this.length!==0){var $=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,$}},b.prototype.clear=function(){this.head=this.tail=null,this.length=0},b.prototype.join=function($){if(this.length===0)return"";for(var M=this.head,T=""+M.data;M=M.next;)T+=$+M.data;return T},b.prototype.concat=function($){if(this.length===0)return h.alloc(0);for(var M=h.allocUnsafe($>>>0),T=this.head,C=0;T;)w(T.data,M,C),C+=T.data.length,T=T.next;return M},b}(),v&&v.inspect&&v.inspect.custom&&(y.exports.prototype[v.inspect.custom]=function(){var b=v.inspect({length:this.length});return this.constructor.name+" "+b})}(BufferList)),BufferList.exports}var pna=processNextickArgsExports;function destroy(y,u){var h=this,v=this._readableState&&this._readableState.destroyed,w=this._writableState&&this._writableState.destroyed;return v||w?(u?u(y):y&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,pna.nextTick(emitErrorNT,this,y)):pna.nextTick(emitErrorNT,this,y)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(y||null,function(b){!u&&b?h._writableState?h._writableState.errorEmitted||(h._writableState.errorEmitted=!0,pna.nextTick(emitErrorNT,h,b)):pna.nextTick(emitErrorNT,h,b):u&&u(b)}),this)}function undestroy(){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 emitErrorNT(y,u){y.emit("error",u)}var destroy_1={destroy,undestroy},_stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var y=processNextickArgsExports;_stream_writable=fe;function u(j){var re=this;this.next=null,this.entry=null,this.finish=function(){X(re,j)}}var h=!process$1.browser&&["v0.10","v0.9."].indexOf(process$1.version.slice(0,5))>-1?setImmediate:y.nextTick,v;fe.WritableState=H;var w=Object.create(util$a);w.inherits=inherits_browserExports;var b={deprecate:browser$a},E=streamBrowser,$=safeBufferExports.Buffer,M=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function T(j){return $.from(j)}function C(j){return $.isBuffer(j)||j instanceof M}var B=destroy_1;w.inherits(fe,E);function N(){}function H(j,re){v=v||require_stream_duplex(),j=j||{};var ee=re instanceof v;this.objectMode=!!j.objectMode,ee&&(this.objectMode=this.objectMode||!!j.writableObjectMode);var F=j.highWaterMark,Q=j.writableHighWaterMark,U=this.objectMode?16:16*1024;F||F===0?this.highWaterMark=F:ee&&(Q||Q===0)?this.highWaterMark=Q:this.highWaterMark=U,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var he=j.decodeStrings===!1;this.decodeStrings=!he,this.defaultEncoding=j.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Oe){Pe(re,Oe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new u(this)}H.prototype.getBuffer=function(){for(var re=this.bufferedRequest,ee=[];re;)ee.push(re),re=re.next;return ee},function(){try{Object.defineProperty(H.prototype,"buffer",{get:b.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var te;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(te=Function.prototype[Symbol.hasInstance],Object.defineProperty(fe,Symbol.hasInstance,{value:function(j){return te.call(this,j)?!0:this!==fe?!1:j&&j._writableState instanceof H}})):te=function(j){return j instanceof this};function fe(j){if(v=v||require_stream_duplex(),!te.call(fe,this)&&!(this instanceof v))return new fe(j);this._writableState=new H(j,this),this.writable=!0,j&&(typeof j.write=="function"&&(this._write=j.write),typeof j.writev=="function"&&(this._writev=j.writev),typeof j.destroy=="function"&&(this._destroy=j.destroy),typeof j.final=="function"&&(this._final=j.final)),E.call(this)}fe.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function ce(j,re){var ee=new Error("write after end");j.emit("error",ee),y.nextTick(re,ee)}function le(j,re,ee,F){var Q=!0,U=!1;return ee===null?U=new TypeError("May not write null values to stream"):typeof ee!="string"&&ee!==void 0&&!re.objectMode&&(U=new TypeError("Invalid non-string/buffer chunk")),U&&(j.emit("error",U),y.nextTick(F,U),Q=!1),Q}fe.prototype.write=function(j,re,ee){var F=this._writableState,Q=!1,U=!F.objectMode&&C(j);return U&&!$.isBuffer(j)&&(j=T(j)),typeof re=="function"&&(ee=re,re=null),U?re="buffer":re||(re=F.defaultEncoding),typeof ee!="function"&&(ee=N),F.ended?ce(this,ee):(U||le(this,F,j,ee))&&(F.pendingcb++,Q=ge(this,F,U,j,re,ee)),Q},fe.prototype.cork=function(){var j=this._writableState;j.corked++},fe.prototype.uncork=function(){var j=this._writableState;j.corked&&(j.corked--,!j.writing&&!j.corked&&!j.bufferProcessing&&j.bufferedRequest&&je(this,j))},fe.prototype.setDefaultEncoding=function(re){if(typeof re=="string"&&(re=re.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((re+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+re);return this._writableState.defaultEncoding=re,this};function ie(j,re,ee){return!j.objectMode&&j.decodeStrings!==!1&&typeof re=="string"&&(re=$.from(re,ee)),re}Object.defineProperty(fe.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function ge(j,re,ee,F,Q,U){if(!ee){var he=ie(re,F,Q);F!==he&&(ee=!0,Q="buffer",F=he)}var Oe=re.objectMode?1:F.length;re.length+=Oe;var Ve=re.length<re.highWaterMark;if(Ve||(re.needDrain=!0),re.writing||re.corked){var Ae=re.lastBufferedRequest;re.lastBufferedRequest={chunk:F,encoding:Q,isBuf:ee,callback:U,next:null},Ae?Ae.next=re.lastBufferedRequest:re.bufferedRequest=re.lastBufferedRequest,re.bufferedRequestCount+=1}else pe(j,re,!1,Oe,F,Q,U);return Ve}function pe(j,re,ee,F,Q,U,he){re.writelen=F,re.writecb=he,re.writing=!0,re.sync=!0,ee?j._writev(Q,re.onwrite):j._write(Q,U,re.onwrite),re.sync=!1}function Me(j,re,ee,F,Q){--re.pendingcb,ee?(y.nextTick(Q,F),y.nextTick(O,j,re),j._writableState.errorEmitted=!0,j.emit("error",F)):(Q(F),j._writableState.errorEmitted=!0,j.emit("error",F),O(j,re))}function $e(j){j.writing=!1,j.writecb=null,j.length-=j.writelen,j.writelen=0}function Pe(j,re){var ee=j._writableState,F=ee.sync,Q=ee.writecb;if($e(ee),re)Me(j,ee,F,re,Q);else{var U=we(ee);!U&&!ee.corked&&!ee.bufferProcessing&&ee.bufferedRequest&&je(j,ee),F?h(Be,j,ee,U,Q):Be(j,ee,U,Q)}}function Be(j,re,ee,F){ee||Re(j,re),re.pendingcb--,F(),O(j,re)}function Re(j,re){re.length===0&&re.needDrain&&(re.needDrain=!1,j.emit("drain"))}function je(j,re){re.bufferProcessing=!0;var ee=re.bufferedRequest;if(j._writev&&ee&&ee.next){var F=re.bufferedRequestCount,Q=new Array(F),U=re.corkedRequestsFree;U.entry=ee;for(var he=0,Oe=!0;ee;)Q[he]=ee,ee.isBuf||(Oe=!1),ee=ee.next,he+=1;Q.allBuffers=Oe,pe(j,re,!0,re.length,Q,"",U.finish),re.pendingcb++,re.lastBufferedRequest=null,U.next?(re.corkedRequestsFree=U.next,U.next=null):re.corkedRequestsFree=new u(re),re.bufferedRequestCount=0}else{for(;ee;){var Ve=ee.chunk,Ae=ee.encoding,oe=ee.callback,ye=re.objectMode?1:Ve.length;if(pe(j,re,!1,ye,Ve,Ae,oe),ee=ee.next,re.bufferedRequestCount--,re.writing)break}ee===null&&(re.lastBufferedRequest=null)}re.bufferedRequest=ee,re.bufferProcessing=!1}fe.prototype._write=function(j,re,ee){ee(new Error("_write() is not implemented"))},fe.prototype._writev=null,fe.prototype.end=function(j,re,ee){var F=this._writableState;typeof j=="function"?(ee=j,j=null,re=null):typeof re=="function"&&(ee=re,re=null),j!=null&&this.write(j,re),F.corked&&(F.corked=1,this.uncork()),F.ending||L(this,F,ee)};function we(j){return j.ending&&j.length===0&&j.bufferedRequest===null&&!j.finished&&!j.writing}function D(j,re){j._final(function(ee){re.pendingcb--,ee&&j.emit("error",ee),re.prefinished=!0,j.emit("prefinish"),O(j,re)})}function q(j,re){!re.prefinished&&!re.finalCalled&&(typeof j._final=="function"?(re.pendingcb++,re.finalCalled=!0,y.nextTick(D,j,re)):(re.prefinished=!0,j.emit("prefinish")))}function O(j,re){var ee=we(re);return ee&&(q(j,re),re.pendingcb===0&&(re.finished=!0,j.emit("finish"))),ee}function L(j,re,ee){re.ending=!0,O(j,re),ee&&(re.finished?y.nextTick(ee):j.once("finish",ee)),re.ended=!0,j.writable=!1}function X(j,re,ee){var F=j.entry;for(j.entry=null;F;){var Q=F.callback;re.pendingcb--,Q(ee),F=F.next}re.corkedRequestsFree.next=j}return Object.defineProperty(fe.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(j){this._writableState&&(this._writableState.destroyed=j)}}),fe.prototype.destroy=B.destroy,fe.prototype._undestroy=B.undestroy,fe.prototype._destroy=function(j,re){this.end(),re(j)},_stream_writable}var _stream_duplex,hasRequired_stream_duplex;function require_stream_duplex(){if(hasRequired_stream_duplex)return _stream_duplex;hasRequired_stream_duplex=1;var y=processNextickArgsExports,u=Object.keys||function(B){var N=[];for(var H in B)N.push(H);return N};_stream_duplex=M;var h=Object.create(util$a);h.inherits=inherits_browserExports;var v=require_stream_readable(),w=require_stream_writable();h.inherits(M,v);for(var b=u(w.prototype),E=0;E<b.length;E++){var $=b[E];M.prototype[$]||(M.prototype[$]=w.prototype[$])}function M(B){if(!(this instanceof M))return new M(B);v.call(this,B),w.call(this,B),B&&B.readable===!1&&(this.readable=!1),B&&B.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,B&&B.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",T)}Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function T(){this.allowHalfOpen||this._writableState.ended||y.nextTick(C,this)}function C(B){B.end()}return Object.defineProperty(M.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(B){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=B,this._writableState.destroyed=B)}}),M.prototype._destroy=function(B,N){this.push(null),this.end(),y.nextTick(N,B)},_stream_duplex}var _stream_readable,hasRequired_stream_readable;function require_stream_readable(){if(hasRequired_stream_readable)return _stream_readable;hasRequired_stream_readable=1;var y=processNextickArgsExports;_stream_readable=ie;var u=isarray,h;ie.ReadableState=le,eventsExports.EventEmitter;var v=function(oe,ye){return oe.listeners(ye).length},w=streamBrowser,b=safeBufferExports.Buffer,E=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function $(oe){return b.from(oe)}function M(oe){return b.isBuffer(oe)||oe instanceof E}var T=Object.create(util$a);T.inherits=inherits_browserExports;var C=util$b,B=void 0;C&&C.debuglog?B=C.debuglog("stream"):B=function(){};var N=requireBufferList(),H=destroy_1,te;T.inherits(ie,w);var fe=["error","close","destroy","pause","resume"];function ce(oe,ye,Ce){if(typeof oe.prependListener=="function")return oe.prependListener(ye,Ce);!oe._events||!oe._events[ye]?oe.on(ye,Ce):u(oe._events[ye])?oe._events[ye].unshift(Ce):oe._events[ye]=[Ce,oe._events[ye]]}function le(oe,ye){h=h||require_stream_duplex(),oe=oe||{};var Ce=ye instanceof h;this.objectMode=!!oe.objectMode,Ce&&(this.objectMode=this.objectMode||!!oe.readableObjectMode);var ae=oe.highWaterMark,de=oe.readableHighWaterMark,ne=this.objectMode?16:16*1024;ae||ae===0?this.highWaterMark=ae:Ce&&(de||de===0)?this.highWaterMark=de:this.highWaterMark=ne,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new N,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.destroyed=!1,this.defaultEncoding=oe.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,oe.encoding&&(te||(te=string_decoder.StringDecoder),this.decoder=new te(oe.encoding),this.encoding=oe.encoding)}function ie(oe){if(h=h||require_stream_duplex(),!(this instanceof ie))return new ie(oe);this._readableState=new le(oe,this),this.readable=!0,oe&&(typeof oe.read=="function"&&(this._read=oe.read),typeof oe.destroy=="function"&&(this._destroy=oe.destroy)),w.call(this)}Object.defineProperty(ie.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(oe){this._readableState&&(this._readableState.destroyed=oe)}}),ie.prototype.destroy=H.destroy,ie.prototype._undestroy=H.undestroy,ie.prototype._destroy=function(oe,ye){this.push(null),ye(oe)},ie.prototype.push=function(oe,ye){var Ce=this._readableState,ae;return Ce.objectMode?ae=!0:typeof oe=="string"&&(ye=ye||Ce.defaultEncoding,ye!==Ce.encoding&&(oe=b.from(oe,ye),ye=""),ae=!0),ge(this,oe,ye,!1,ae)},ie.prototype.unshift=function(oe){return ge(this,oe,null,!0,!1)};function ge(oe,ye,Ce,ae,de){var ne=oe._readableState;if(ye===null)ne.reading=!1,je(oe,ne);else{var be;de||(be=Me(ne,ye)),be?oe.emit("error",be):ne.objectMode||ye&&ye.length>0?(typeof ye!="string"&&!ne.objectMode&&Object.getPrototypeOf(ye)!==b.prototype&&(ye=$(ye)),ae?ne.endEmitted?oe.emit("error",new Error("stream.unshift() after end event")):pe(oe,ne,ye,!0):ne.ended?oe.emit("error",new Error("stream.push() after EOF")):(ne.reading=!1,ne.decoder&&!Ce?(ye=ne.decoder.write(ye),ne.objectMode||ye.length!==0?pe(oe,ne,ye,!1):q(oe,ne)):pe(oe,ne,ye,!1))):ae||(ne.reading=!1)}return $e(ne)}function pe(oe,ye,Ce,ae){ye.flowing&&ye.length===0&&!ye.sync?(oe.emit("data",Ce),oe.read(0)):(ye.length+=ye.objectMode?1:Ce.length,ae?ye.buffer.unshift(Ce):ye.buffer.push(Ce),ye.needReadable&&we(oe)),q(oe,ye)}function Me(oe,ye){var Ce;return!M(ye)&&typeof ye!="string"&&ye!==void 0&&!oe.objectMode&&(Ce=new TypeError("Invalid non-string/buffer chunk")),Ce}function $e(oe){return!oe.ended&&(oe.needReadable||oe.length<oe.highWaterMark||oe.length===0)}ie.prototype.isPaused=function(){return this._readableState.flowing===!1},ie.prototype.setEncoding=function(oe){return te||(te=string_decoder.StringDecoder),this._readableState.decoder=new te(oe),this._readableState.encoding=oe,this};var Pe=8388608;function Be(oe){return oe>=Pe?oe=Pe:(oe--,oe|=oe>>>1,oe|=oe>>>2,oe|=oe>>>4,oe|=oe>>>8,oe|=oe>>>16,oe++),oe}function Re(oe,ye){return oe<=0||ye.length===0&&ye.ended?0:ye.objectMode?1:oe!==oe?ye.flowing&&ye.length?ye.buffer.head.data.length:ye.length:(oe>ye.highWaterMark&&(ye.highWaterMark=Be(oe)),oe<=ye.length?oe:ye.ended?ye.length:(ye.needReadable=!0,0))}ie.prototype.read=function(oe){B("read",oe),oe=parseInt(oe,10);var ye=this._readableState,Ce=oe;if(oe!==0&&(ye.emittedReadable=!1),oe===0&&ye.needReadable&&(ye.length>=ye.highWaterMark||ye.ended))return B("read: emitReadable",ye.length,ye.ended),ye.length===0&&ye.ended?Oe(this):we(this),null;if(oe=Re(oe,ye),oe===0&&ye.ended)return ye.length===0&&Oe(this),null;var ae=ye.needReadable;B("need readable",ae),(ye.length===0||ye.length-oe<ye.highWaterMark)&&(ae=!0,B("length less than watermark",ae)),ye.ended||ye.reading?(ae=!1,B("reading or ended",ae)):ae&&(B("do read"),ye.reading=!0,ye.sync=!0,ye.length===0&&(ye.needReadable=!0),this._read(ye.highWaterMark),ye.sync=!1,ye.reading||(oe=Re(Ce,ye)));var de;return oe>0?de=F(oe,ye):de=null,de===null?(ye.needReadable=!0,oe=0):ye.length-=oe,ye.length===0&&(ye.ended||(ye.needReadable=!0),Ce!==oe&&ye.ended&&Oe(this)),de!==null&&this.emit("data",de),de};function je(oe,ye){if(!ye.ended){if(ye.decoder){var Ce=ye.decoder.end();Ce&&Ce.length&&(ye.buffer.push(Ce),ye.length+=ye.objectMode?1:Ce.length)}ye.ended=!0,we(oe)}}function we(oe){var ye=oe._readableState;ye.needReadable=!1,ye.emittedReadable||(B("emitReadable",ye.flowing),ye.emittedReadable=!0,ye.sync?y.nextTick(D,oe):D(oe))}function D(oe){B("emit readable"),oe.emit("readable"),ee(oe)}function q(oe,ye){ye.readingMore||(ye.readingMore=!0,y.nextTick(O,oe,ye))}function O(oe,ye){for(var Ce=ye.length;!ye.reading&&!ye.flowing&&!ye.ended&&ye.length<ye.highWaterMark&&(B("maybeReadMore read 0"),oe.read(0),Ce!==ye.length);)Ce=ye.length;ye.readingMore=!1}ie.prototype._read=function(oe){this.emit("error",new Error("_read() is not implemented"))},ie.prototype.pipe=function(oe,ye){var Ce=this,ae=this._readableState;switch(ae.pipesCount){case 0:ae.pipes=oe;break;case 1:ae.pipes=[ae.pipes,oe];break;default:ae.pipes.push(oe);break}ae.pipesCount+=1,B("pipe count=%d opts=%j",ae.pipesCount,ye);var de=(!ye||ye.end!==!1)&&oe!==process$1.stdout&&oe!==process$1.stderr,ne=de?Ie:ut;ae.endEmitted?y.nextTick(ne):Ce.once("end",ne),oe.on("unpipe",be);function be(ht,St){B("onunpipe"),ht===Ce&&St&&St.hasUnpiped===!1&&(St.hasUnpiped=!0,He())}function Ie(){B("onend"),oe.end()}var Le=L(Ce);oe.on("drain",Le);var Fe=!1;function He(){B("cleanup"),oe.removeListener("close",it),oe.removeListener("finish",ot),oe.removeListener("drain",Le),oe.removeListener("error",nt),oe.removeListener("unpipe",be),Ce.removeListener("end",Ie),Ce.removeListener("end",ut),Ce.removeListener("data",Ne),Fe=!0,ae.awaitDrain&&(!oe._writableState||oe._writableState.needDrain)&&Le()}var tt=!1;Ce.on("data",Ne);function Ne(ht){B("ondata"),tt=!1;var St=oe.write(ht);St===!1&&!tt&&((ae.pipesCount===1&&ae.pipes===oe||ae.pipesCount>1&&Ae(ae.pipes,oe)!==-1)&&!Fe&&(B("false write response, pause",ae.awaitDrain),ae.awaitDrain++,tt=!0),Ce.pause())}function nt(ht){B("onerror",ht),ut(),oe.removeListener("error",nt),v(oe,"error")===0&&oe.emit("error",ht)}ce(oe,"error",nt);function it(){oe.removeListener("finish",ot),ut()}oe.once("close",it);function ot(){B("onfinish"),oe.removeListener("close",it),ut()}oe.once("finish",ot);function ut(){B("unpipe"),Ce.unpipe(oe)}return oe.emit("pipe",Ce),ae.flowing||(B("pipe resume"),Ce.resume()),oe};function L(oe){return function(){var ye=oe._readableState;B("pipeOnDrain",ye.awaitDrain),ye.awaitDrain&&ye.awaitDrain--,ye.awaitDrain===0&&v(oe,"data")&&(ye.flowing=!0,ee(oe))}}ie.prototype.unpipe=function(oe){var ye=this._readableState,Ce={hasUnpiped:!1};if(ye.pipesCount===0)return this;if(ye.pipesCount===1)return oe&&oe!==ye.pipes?this:(oe||(oe=ye.pipes),ye.pipes=null,ye.pipesCount=0,ye.flowing=!1,oe&&oe.emit("unpipe",this,Ce),this);if(!oe){var ae=ye.pipes,de=ye.pipesCount;ye.pipes=null,ye.pipesCount=0,ye.flowing=!1;for(var ne=0;ne<de;ne++)ae[ne].emit("unpipe",this,{hasUnpiped:!1});return this}var be=Ae(ye.pipes,oe);return be===-1?this:(ye.pipes.splice(be,1),ye.pipesCount-=1,ye.pipesCount===1&&(ye.pipes=ye.pipes[0]),oe.emit("unpipe",this,Ce),this)},ie.prototype.on=function(oe,ye){var Ce=w.prototype.on.call(this,oe,ye);if(oe==="data")this._readableState.flowing!==!1&&this.resume();else if(oe==="readable"){var ae=this._readableState;!ae.endEmitted&&!ae.readableListening&&(ae.readableListening=ae.needReadable=!0,ae.emittedReadable=!1,ae.reading?ae.length&&we(this):y.nextTick(X,this))}return Ce},ie.prototype.addListener=ie.prototype.on;function X(oe){B("readable nexttick read 0"),oe.read(0)}ie.prototype.resume=function(){var oe=this._readableState;return oe.flowing||(B("resume"),oe.flowing=!0,j(this,oe)),this};function j(oe,ye){ye.resumeScheduled||(ye.resumeScheduled=!0,y.nextTick(re,oe,ye))}function re(oe,ye){ye.reading||(B("resume read 0"),oe.read(0)),ye.resumeScheduled=!1,ye.awaitDrain=0,oe.emit("resume"),ee(oe),ye.flowing&&!ye.reading&&oe.read(0)}ie.prototype.pause=function(){return B("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(B("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function ee(oe){var ye=oe._readableState;for(B("flow",ye.flowing);ye.flowing&&oe.read()!==null;);}ie.prototype.wrap=function(oe){var ye=this,Ce=this._readableState,ae=!1;oe.on("end",function(){if(B("wrapped end"),Ce.decoder&&!Ce.ended){var be=Ce.decoder.end();be&&be.length&&ye.push(be)}ye.push(null)}),oe.on("data",function(be){if(B("wrapped data"),Ce.decoder&&(be=Ce.decoder.write(be)),!(Ce.objectMode&&be==null)&&!(!Ce.objectMode&&(!be||!be.length))){var Ie=ye.push(be);Ie||(ae=!0,oe.pause())}});for(var de in oe)this[de]===void 0&&typeof oe[de]=="function"&&(this[de]=function(be){return function(){return oe[be].apply(oe,arguments)}}(de));for(var ne=0;ne<fe.length;ne++)oe.on(fe[ne],this.emit.bind(this,fe[ne]));return this._read=function(be){B("wrapped _read",be),ae&&(ae=!1,oe.resume())},this},Object.defineProperty(ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),ie._fromList=F;function F(oe,ye){if(ye.length===0)return null;var Ce;return ye.objectMode?Ce=ye.buffer.shift():!oe||oe>=ye.length?(ye.decoder?Ce=ye.buffer.join(""):ye.buffer.length===1?Ce=ye.buffer.head.data:Ce=ye.buffer.concat(ye.length),ye.buffer.clear()):Ce=Q(oe,ye.buffer,ye.decoder),Ce}function Q(oe,ye,Ce){var ae;return oe<ye.head.data.length?(ae=ye.head.data.slice(0,oe),ye.head.data=ye.head.data.slice(oe)):oe===ye.head.data.length?ae=ye.shift():ae=Ce?U(oe,ye):he(oe,ye),ae}function U(oe,ye){var Ce=ye.head,ae=1,de=Ce.data;for(oe-=de.length;Ce=Ce.next;){var ne=Ce.data,be=oe>ne.length?ne.length:oe;if(be===ne.length?de+=ne:de+=ne.slice(0,oe),oe-=be,oe===0){be===ne.length?(++ae,Ce.next?ye.head=Ce.next:ye.head=ye.tail=null):(ye.head=Ce,Ce.data=ne.slice(be));break}++ae}return ye.length-=ae,de}function he(oe,ye){var Ce=b.allocUnsafe(oe),ae=ye.head,de=1;for(ae.data.copy(Ce),oe-=ae.data.length;ae=ae.next;){var ne=ae.data,be=oe>ne.length?ne.length:oe;if(ne.copy(Ce,Ce.length-oe,0,be),oe-=be,oe===0){be===ne.length?(++de,ae.next?ye.head=ae.next:ye.head=ye.tail=null):(ye.head=ae,ae.data=ne.slice(be));break}++de}return ye.length-=de,Ce}function Oe(oe){var ye=oe._readableState;if(ye.length>0)throw new Error('"endReadable()" called on non-empty stream');ye.endEmitted||(ye.ended=!0,y.nextTick(Ve,ye,oe))}function Ve(oe,ye){!oe.endEmitted&&oe.length===0&&(oe.endEmitted=!0,ye.readable=!1,ye.emit("end"))}function Ae(oe,ye){for(var Ce=0,ae=oe.length;Ce<ae;Ce++)if(oe[Ce]===ye)return Ce;return-1}return _stream_readable}var _stream_transform=Transform$1,Duplex=require_stream_duplex(),util$9=Object.create(util$a);util$9.inherits=inherits_browserExports,util$9.inherits(Transform$1,Duplex);function afterTransform(y,u){var h=this._transformState;h.transforming=!1;var v=h.writecb;if(!v)return this.emit("error",new Error("write callback called multiple times"));h.writechunk=null,h.writecb=null,u!=null&&this.push(u),v(y);var w=this._readableState;w.reading=!1,(w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}function Transform$1(y){if(!(this instanceof Transform$1))return new Transform$1(y);Duplex.call(this,y),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,y&&(typeof y.transform=="function"&&(this._transform=y.transform),typeof y.flush=="function"&&(this._flush=y.flush)),this.on("prefinish",prefinish)}function prefinish(){var y=this;typeof this._flush=="function"?this._flush(function(u,h){done(y,u,h)}):done(this,null,null)}Transform$1.prototype.push=function(y,u){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,y,u)},Transform$1.prototype._transform=function(y,u,h){throw new Error("_transform() is not implemented")},Transform$1.prototype._write=function(y,u,h){var v=this._transformState;if(v.writecb=h,v.writechunk=y,v.writeencoding=u,!v.transforming){var w=this._readableState;(v.needTransform||w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}},Transform$1.prototype._read=function(y){var u=this._transformState;u.writechunk!==null&&u.writecb&&!u.transforming?(u.transforming=!0,this._transform(u.writechunk,u.writeencoding,u.afterTransform)):u.needTransform=!0},Transform$1.prototype._destroy=function(y,u){var h=this;Duplex.prototype._destroy.call(this,y,function(v){u(v),h.emit("close")})};function done(y,u,h){if(u)return y.emit("error",u);if(h!=null&&y.push(h),y._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(y._transformState.transforming)throw new Error("Calling transform done when still transforming");return y.push(null)}var _stream_passthrough=PassThrough,Transform=_stream_transform,util$8=Object.create(util$a);util$8.inherits=inherits_browserExports,util$8.inherits(PassThrough,Transform);function PassThrough(y){if(!(this instanceof PassThrough))return new PassThrough(y);Transform.call(this,y)}PassThrough.prototype._transform=function(y,u,h){h(null,y)},function(y,u){u=y.exports=require_stream_readable(),u.Stream=u,u.Readable=u,u.Writable=require_stream_writable(),u.Duplex=require_stream_duplex(),u.Transform=_stream_transform,u.PassThrough=_stream_passthrough}(readableBrowser,readableBrowser.exports);var readableBrowserExports=readableBrowser.exports,sign={exports:{}},bn={exports:{}};bn.exports,function(y){(function(u,h){function v(q,O){if(!q)throw new Error(O||"Assertion failed")}function w(q,O){q.super_=O;var L=function(){};L.prototype=O.prototype,q.prototype=new L,q.prototype.constructor=q}function b(q,O,L){if(b.isBN(q))return q;this.negative=0,this.words=null,this.length=0,this.red=null,q!==null&&((O==="le"||O==="be")&&(L=O,O=10),this._init(q||0,O||10,L||"be"))}typeof u=="object"?u.exports=b:h.BN=b,b.BN=b,b.wordSize=26;var E;try{typeof window<"u"&&typeof window.Buffer<"u"?E=window.Buffer:E=dist.Buffer}catch{}b.isBN=function(O){return O instanceof b?!0:O!==null&&typeof O=="object"&&O.constructor.wordSize===b.wordSize&&Array.isArray(O.words)},b.max=function(O,L){return O.cmp(L)>0?O:L},b.min=function(O,L){return O.cmp(L)<0?O:L},b.prototype._init=function(O,L,X){if(typeof O=="number")return this._initNumber(O,L,X);if(typeof O=="object")return this._initArray(O,L,X);L==="hex"&&(L=16),v(L===(L|0)&&L>=2&&L<=36),O=O.toString().replace(/\s+/g,"");var j=0;O[0]==="-"&&(j++,this.negative=1),j<O.length&&(L===16?this._parseHex(O,j,X):(this._parseBase(O,L,j),X==="le"&&this._initArray(this.toArray(),L,X)))},b.prototype._initNumber=function(O,L,X){O<0&&(this.negative=1,O=-O),O<67108864?(this.words=[O&67108863],this.length=1):O<4503599627370496?(this.words=[O&67108863,O/67108864&67108863],this.length=2):(v(O<9007199254740992),this.words=[O&67108863,O/67108864&67108863,1],this.length=3),X==="le"&&this._initArray(this.toArray(),L,X)},b.prototype._initArray=function(O,L,X){if(v(typeof O.length=="number"),O.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(O.length/3),this.words=new Array(this.length);for(var j=0;j<this.length;j++)this.words[j]=0;var re,ee,F=0;if(X==="be")for(j=O.length-1,re=0;j>=0;j-=3)ee=O[j]|O[j-1]<<8|O[j-2]<<16,this.words[re]|=ee<<F&67108863,this.words[re+1]=ee>>>26-F&67108863,F+=24,F>=26&&(F-=26,re++);else if(X==="le")for(j=0,re=0;j<O.length;j+=3)ee=O[j]|O[j+1]<<8|O[j+2]<<16,this.words[re]|=ee<<F&67108863,this.words[re+1]=ee>>>26-F&67108863,F+=24,F>=26&&(F-=26,re++);return this._strip()};function $(q,O){var L=q.charCodeAt(O);if(L>=48&&L<=57)return L-48;if(L>=65&&L<=70)return L-55;if(L>=97&&L<=102)return L-87;v(!1,"Invalid character in "+q)}function M(q,O,L){var X=$(q,L);return L-1>=O&&(X|=$(q,L-1)<<4),X}b.prototype._parseHex=function(O,L,X){this.length=Math.ceil((O.length-L)/6),this.words=new Array(this.length);for(var j=0;j<this.length;j++)this.words[j]=0;var re=0,ee=0,F;if(X==="be")for(j=O.length-1;j>=L;j-=2)F=M(O,L,j)<<re,this.words[ee]|=F&67108863,re>=18?(re-=18,ee+=1,this.words[ee]|=F>>>26):re+=8;else{var Q=O.length-L;for(j=Q%2===0?L+1:L;j<O.length;j+=2)F=M(O,L,j)<<re,this.words[ee]|=F&67108863,re>=18?(re-=18,ee+=1,this.words[ee]|=F>>>26):re+=8}this._strip()};function T(q,O,L,X){for(var j=0,re=0,ee=Math.min(q.length,L),F=O;F<ee;F++){var Q=q.charCodeAt(F)-48;j*=X,Q>=49?re=Q-49+10:Q>=17?re=Q-17+10:re=Q,v(Q>=0&&re<X,"Invalid character"),j+=re}return j}b.prototype._parseBase=function(O,L,X){this.words=[0],this.length=1;for(var j=0,re=1;re<=67108863;re*=L)j++;j--,re=re/L|0;for(var ee=O.length-X,F=ee%j,Q=Math.min(ee,ee-F)+X,U=0,he=X;he<Q;he+=j)U=T(O,he,he+j,L),this.imuln(re),this.words[0]+U<67108864?this.words[0]+=U:this._iaddn(U);if(F!==0){var Oe=1;for(U=T(O,he,O.length,L),he=0;he<F;he++)Oe*=L;this.imuln(Oe),this.words[0]+U<67108864?this.words[0]+=U:this._iaddn(U)}this._strip()},b.prototype.copy=function(O){O.words=new Array(this.length);for(var L=0;L<this.length;L++)O.words[L]=this.words[L];O.length=this.length,O.negative=this.negative,O.red=this.red};function C(q,O){q.words=O.words,q.length=O.length,q.negative=O.negative,q.red=O.red}if(b.prototype._move=function(O){C(O,this)},b.prototype.clone=function(){var O=new b(null);return this.copy(O),O},b.prototype._expand=function(O){for(;this.length<O;)this.words[this.length++]=0;return this},b.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},b.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{b.prototype[Symbol.for("nodejs.util.inspect.custom")]=B}catch{b.prototype.inspect=B}else b.prototype.inspect=B;function B(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var N=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],H=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],te=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];b.prototype.toString=function(O,L){O=O||10,L=L|0||1;var X;if(O===16||O==="hex"){X="";for(var j=0,re=0,ee=0;ee<this.length;ee++){var F=this.words[ee],Q=((F<<j|re)&16777215).toString(16);re=F>>>24-j&16777215,j+=2,j>=26&&(j-=26,ee--),re!==0||ee!==this.length-1?X=N[6-Q.length]+Q+X:X=Q+X}for(re!==0&&(X=re.toString(16)+X);X.length%L!==0;)X="0"+X;return this.negative!==0&&(X="-"+X),X}if(O===(O|0)&&O>=2&&O<=36){var U=H[O],he=te[O];X="";var Oe=this.clone();for(Oe.negative=0;!Oe.isZero();){var Ve=Oe.modrn(he).toString(O);Oe=Oe.idivn(he),Oe.isZero()?X=Ve+X:X=N[U-Ve.length]+Ve+X}for(this.isZero()&&(X="0"+X);X.length%L!==0;)X="0"+X;return this.negative!==0&&(X="-"+X),X}v(!1,"Base should be between 2 and 36")},b.prototype.toNumber=function(){var O=this.words[0];return this.length===2?O+=this.words[1]*67108864:this.length===3&&this.words[2]===1?O+=4503599627370496+this.words[1]*67108864:this.length>2&&v(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-O:O},b.prototype.toJSON=function(){return this.toString(16,2)},E&&(b.prototype.toBuffer=function(O,L){return this.toArrayLike(E,O,L)}),b.prototype.toArray=function(O,L){return this.toArrayLike(Array,O,L)};var fe=function(O,L){return O.allocUnsafe?O.allocUnsafe(L):new O(L)};b.prototype.toArrayLike=function(O,L,X){this._strip();var j=this.byteLength(),re=X||Math.max(1,j);v(j<=re,"byte array longer than desired length"),v(re>0,"Requested array length <= 0");var ee=fe(O,re),F=L==="le"?"LE":"BE";return this["_toArrayLike"+F](ee,j),ee},b.prototype._toArrayLikeLE=function(O,L){for(var X=0,j=0,re=0,ee=0;re<this.length;re++){var F=this.words[re]<<ee|j;O[X++]=F&255,X<O.length&&(O[X++]=F>>8&255),X<O.length&&(O[X++]=F>>16&255),ee===6?(X<O.length&&(O[X++]=F>>24&255),j=0,ee=0):(j=F>>>24,ee+=2)}if(X<O.length)for(O[X++]=j;X<O.length;)O[X++]=0},b.prototype._toArrayLikeBE=function(O,L){for(var X=O.length-1,j=0,re=0,ee=0;re<this.length;re++){var F=this.words[re]<<ee|j;O[X--]=F&255,X>=0&&(O[X--]=F>>8&255),X>=0&&(O[X--]=F>>16&255),ee===6?(X>=0&&(O[X--]=F>>24&255),j=0,ee=0):(j=F>>>24,ee+=2)}if(X>=0)for(O[X--]=j;X>=0;)O[X--]=0},Math.clz32?b.prototype._countBits=function(O){return 32-Math.clz32(O)}:b.prototype._countBits=function(O){var L=O,X=0;return L>=4096&&(X+=13,L>>>=13),L>=64&&(X+=7,L>>>=7),L>=8&&(X+=4,L>>>=4),L>=2&&(X+=2,L>>>=2),X+L},b.prototype._zeroBits=function(O){if(O===0)return 26;var L=O,X=0;return L&8191||(X+=13,L>>>=13),L&127||(X+=7,L>>>=7),L&15||(X+=4,L>>>=4),L&3||(X+=2,L>>>=2),L&1||X++,X},b.prototype.bitLength=function(){var O=this.words[this.length-1],L=this._countBits(O);return(this.length-1)*26+L};function ce(q){for(var O=new Array(q.bitLength()),L=0;L<O.length;L++){var X=L/26|0,j=L%26;O[L]=q.words[X]>>>j&1}return O}b.prototype.zeroBits=function(){if(this.isZero())return 0;for(var O=0,L=0;L<this.length;L++){var X=this._zeroBits(this.words[L]);if(O+=X,X!==26)break}return O},b.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},b.prototype.toTwos=function(O){return this.negative!==0?this.abs().inotn(O).iaddn(1):this.clone()},b.prototype.fromTwos=function(O){return this.testn(O-1)?this.notn(O).iaddn(1).ineg():this.clone()},b.prototype.isNeg=function(){return this.negative!==0},b.prototype.neg=function(){return this.clone().ineg()},b.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},b.prototype.iuor=function(O){for(;this.length<O.length;)this.words[this.length++]=0;for(var L=0;L<O.length;L++)this.words[L]=this.words[L]|O.words[L];return this._strip()},b.prototype.ior=function(O){return v((this.negative|O.negative)===0),this.iuor(O)},b.prototype.or=function(O){return this.length>O.length?this.clone().ior(O):O.clone().ior(this)},b.prototype.uor=function(O){return this.length>O.length?this.clone().iuor(O):O.clone().iuor(this)},b.prototype.iuand=function(O){var L;this.length>O.length?L=O:L=this;for(var X=0;X<L.length;X++)this.words[X]=this.words[X]&O.words[X];return this.length=L.length,this._strip()},b.prototype.iand=function(O){return v((this.negative|O.negative)===0),this.iuand(O)},b.prototype.and=function(O){return this.length>O.length?this.clone().iand(O):O.clone().iand(this)},b.prototype.uand=function(O){return this.length>O.length?this.clone().iuand(O):O.clone().iuand(this)},b.prototype.iuxor=function(O){var L,X;this.length>O.length?(L=this,X=O):(L=O,X=this);for(var j=0;j<X.length;j++)this.words[j]=L.words[j]^X.words[j];if(this!==L)for(;j<L.length;j++)this.words[j]=L.words[j];return this.length=L.length,this._strip()},b.prototype.ixor=function(O){return v((this.negative|O.negative)===0),this.iuxor(O)},b.prototype.xor=function(O){return this.length>O.length?this.clone().ixor(O):O.clone().ixor(this)},b.prototype.uxor=function(O){return this.length>O.length?this.clone().iuxor(O):O.clone().iuxor(this)},b.prototype.inotn=function(O){v(typeof O=="number"&&O>=0);var L=Math.ceil(O/26)|0,X=O%26;this._expand(L),X>0&&L--;for(var j=0;j<L;j++)this.words[j]=~this.words[j]&67108863;return X>0&&(this.words[j]=~this.words[j]&67108863>>26-X),this._strip()},b.prototype.notn=function(O){return this.clone().inotn(O)},b.prototype.setn=function(O,L){v(typeof O=="number"&&O>=0);var X=O/26|0,j=O%26;return this._expand(X+1),L?this.words[X]=this.words[X]|1<<j:this.words[X]=this.words[X]&~(1<<j),this._strip()},b.prototype.iadd=function(O){var L;if(this.negative!==0&&O.negative===0)return this.negative=0,L=this.isub(O),this.negative^=1,this._normSign();if(this.negative===0&&O.negative!==0)return O.negative=0,L=this.isub(O),O.negative=1,L._normSign();var X,j;this.length>O.length?(X=this,j=O):(X=O,j=this);for(var re=0,ee=0;ee<j.length;ee++)L=(X.words[ee]|0)+(j.words[ee]|0)+re,this.words[ee]=L&67108863,re=L>>>26;for(;re!==0&&ee<X.length;ee++)L=(X.words[ee]|0)+re,this.words[ee]=L&67108863,re=L>>>26;if(this.length=X.length,re!==0)this.words[this.length]=re,this.length++;else if(X!==this)for(;ee<X.length;ee++)this.words[ee]=X.words[ee];return this},b.prototype.add=function(O){var L;return O.negative!==0&&this.negative===0?(O.negative=0,L=this.sub(O),O.negative^=1,L):O.negative===0&&this.negative!==0?(this.negative=0,L=O.sub(this),this.negative=1,L):this.length>O.length?this.clone().iadd(O):O.clone().iadd(this)},b.prototype.isub=function(O){if(O.negative!==0){O.negative=0;var L=this.iadd(O);return O.negative=1,L._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(O),this.negative=1,this._normSign();var X=this.cmp(O);if(X===0)return this.negative=0,this.length=1,this.words[0]=0,this;var j,re;X>0?(j=this,re=O):(j=O,re=this);for(var ee=0,F=0;F<re.length;F++)L=(j.words[F]|0)-(re.words[F]|0)+ee,ee=L>>26,this.words[F]=L&67108863;for(;ee!==0&&F<j.length;F++)L=(j.words[F]|0)+ee,ee=L>>26,this.words[F]=L&67108863;if(ee===0&&F<j.length&&j!==this)for(;F<j.length;F++)this.words[F]=j.words[F];return this.length=Math.max(this.length,F),j!==this&&(this.negative=1),this._strip()},b.prototype.sub=function(O){return this.clone().isub(O)};function le(q,O,L){L.negative=O.negative^q.negative;var X=q.length+O.length|0;L.length=X,X=X-1|0;var j=q.words[0]|0,re=O.words[0]|0,ee=j*re,F=ee&67108863,Q=ee/67108864|0;L.words[0]=F;for(var U=1;U<X;U++){for(var he=Q>>>26,Oe=Q&67108863,Ve=Math.min(U,O.length-1),Ae=Math.max(0,U-q.length+1);Ae<=Ve;Ae++){var oe=U-Ae|0;j=q.words[oe]|0,re=O.words[Ae]|0,ee=j*re+Oe,he+=ee/67108864|0,Oe=ee&67108863}L.words[U]=Oe|0,Q=he|0}return Q!==0?L.words[U]=Q|0:L.length--,L._strip()}var ie=function(O,L,X){var j=O.words,re=L.words,ee=X.words,F=0,Q,U,he,Oe=j[0]|0,Ve=Oe&8191,Ae=Oe>>>13,oe=j[1]|0,ye=oe&8191,Ce=oe>>>13,ae=j[2]|0,de=ae&8191,ne=ae>>>13,be=j[3]|0,Ie=be&8191,Le=be>>>13,Fe=j[4]|0,He=Fe&8191,tt=Fe>>>13,Ne=j[5]|0,nt=Ne&8191,it=Ne>>>13,ot=j[6]|0,ut=ot&8191,ht=ot>>>13,St=j[7]|0,Rt=St&8191,dt=St>>>13,Ct=j[8]|0,Dt=Ct&8191,yt=Ct>>>13,zt=j[9]|0,Zt=zt&8191,bt=zt>>>13,Lt=re[0]|0,Nt=Lt&8191,_t=Lt>>>13,Vt=re[1]|0,Wt=Vt&8191,$t=Vt>>>13,Qt=re[2]|0,Gt=Qt&8191,vt=Qt>>>13,kt=re[3]|0,Kt=kt&8191,At=kt>>>13,Ft=re[4]|0,Jt=Ft&8191,ve=Ft>>>13,J=re[5]|0,se=J&8191,xe=J>>>13,ke=re[6]|0,qe=ke&8191,We=ke>>>13,ct=re[7]|0,wt=ct&8191,st=ct>>>13,xt=re[8]|0,mt=xt&8191,Mt=xt>>>13,Yt=re[9]|0,er=Yt&8191,rr=Yt>>>13;X.negative=O.negative^L.negative,X.length=19,Q=Math.imul(Ve,Nt),U=Math.imul(Ve,_t),U=U+Math.imul(Ae,Nt)|0,he=Math.imul(Ae,_t);var qr=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(qr>>>26)|0,qr&=67108863,Q=Math.imul(ye,Nt),U=Math.imul(ye,_t),U=U+Math.imul(Ce,Nt)|0,he=Math.imul(Ce,_t),Q=Q+Math.imul(Ve,Wt)|0,U=U+Math.imul(Ve,$t)|0,U=U+Math.imul(Ae,Wt)|0,he=he+Math.imul(Ae,$t)|0;var Dr=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,Q=Math.imul(de,Nt),U=Math.imul(de,_t),U=U+Math.imul(ne,Nt)|0,he=Math.imul(ne,_t),Q=Q+Math.imul(ye,Wt)|0,U=U+Math.imul(ye,$t)|0,U=U+Math.imul(Ce,Wt)|0,he=he+Math.imul(Ce,$t)|0,Q=Q+Math.imul(Ve,Gt)|0,U=U+Math.imul(Ve,vt)|0,U=U+Math.imul(Ae,Gt)|0,he=he+Math.imul(Ae,vt)|0;var Zr=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,Q=Math.imul(Ie,Nt),U=Math.imul(Ie,_t),U=U+Math.imul(Le,Nt)|0,he=Math.imul(Le,_t),Q=Q+Math.imul(de,Wt)|0,U=U+Math.imul(de,$t)|0,U=U+Math.imul(ne,Wt)|0,he=he+Math.imul(ne,$t)|0,Q=Q+Math.imul(ye,Gt)|0,U=U+Math.imul(ye,vt)|0,U=U+Math.imul(Ce,Gt)|0,he=he+Math.imul(Ce,vt)|0,Q=Q+Math.imul(Ve,Kt)|0,U=U+Math.imul(Ve,At)|0,U=U+Math.imul(Ae,Kt)|0,he=he+Math.imul(Ae,At)|0;var Hr=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,Q=Math.imul(He,Nt),U=Math.imul(He,_t),U=U+Math.imul(tt,Nt)|0,he=Math.imul(tt,_t),Q=Q+Math.imul(Ie,Wt)|0,U=U+Math.imul(Ie,$t)|0,U=U+Math.imul(Le,Wt)|0,he=he+Math.imul(Le,$t)|0,Q=Q+Math.imul(de,Gt)|0,U=U+Math.imul(de,vt)|0,U=U+Math.imul(ne,Gt)|0,he=he+Math.imul(ne,vt)|0,Q=Q+Math.imul(ye,Kt)|0,U=U+Math.imul(ye,At)|0,U=U+Math.imul(Ce,Kt)|0,he=he+Math.imul(Ce,At)|0,Q=Q+Math.imul(Ve,Jt)|0,U=U+Math.imul(Ve,ve)|0,U=U+Math.imul(Ae,Jt)|0,he=he+Math.imul(Ae,ve)|0;var Vr=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,Q=Math.imul(nt,Nt),U=Math.imul(nt,_t),U=U+Math.imul(it,Nt)|0,he=Math.imul(it,_t),Q=Q+Math.imul(He,Wt)|0,U=U+Math.imul(He,$t)|0,U=U+Math.imul(tt,Wt)|0,he=he+Math.imul(tt,$t)|0,Q=Q+Math.imul(Ie,Gt)|0,U=U+Math.imul(Ie,vt)|0,U=U+Math.imul(Le,Gt)|0,he=he+Math.imul(Le,vt)|0,Q=Q+Math.imul(de,Kt)|0,U=U+Math.imul(de,At)|0,U=U+Math.imul(ne,Kt)|0,he=he+Math.imul(ne,At)|0,Q=Q+Math.imul(ye,Jt)|0,U=U+Math.imul(ye,ve)|0,U=U+Math.imul(Ce,Jt)|0,he=he+Math.imul(Ce,ve)|0,Q=Q+Math.imul(Ve,se)|0,U=U+Math.imul(Ve,xe)|0,U=U+Math.imul(Ae,se)|0,he=he+Math.imul(Ae,xe)|0;var Tr=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,Q=Math.imul(ut,Nt),U=Math.imul(ut,_t),U=U+Math.imul(ht,Nt)|0,he=Math.imul(ht,_t),Q=Q+Math.imul(nt,Wt)|0,U=U+Math.imul(nt,$t)|0,U=U+Math.imul(it,Wt)|0,he=he+Math.imul(it,$t)|0,Q=Q+Math.imul(He,Gt)|0,U=U+Math.imul(He,vt)|0,U=U+Math.imul(tt,Gt)|0,he=he+Math.imul(tt,vt)|0,Q=Q+Math.imul(Ie,Kt)|0,U=U+Math.imul(Ie,At)|0,U=U+Math.imul(Le,Kt)|0,he=he+Math.imul(Le,At)|0,Q=Q+Math.imul(de,Jt)|0,U=U+Math.imul(de,ve)|0,U=U+Math.imul(ne,Jt)|0,he=he+Math.imul(ne,ve)|0,Q=Q+Math.imul(ye,se)|0,U=U+Math.imul(ye,xe)|0,U=U+Math.imul(Ce,se)|0,he=he+Math.imul(Ce,xe)|0,Q=Q+Math.imul(Ve,qe)|0,U=U+Math.imul(Ve,We)|0,U=U+Math.imul(Ae,qe)|0,he=he+Math.imul(Ae,We)|0;var Nr=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,Q=Math.imul(Rt,Nt),U=Math.imul(Rt,_t),U=U+Math.imul(dt,Nt)|0,he=Math.imul(dt,_t),Q=Q+Math.imul(ut,Wt)|0,U=U+Math.imul(ut,$t)|0,U=U+Math.imul(ht,Wt)|0,he=he+Math.imul(ht,$t)|0,Q=Q+Math.imul(nt,Gt)|0,U=U+Math.imul(nt,vt)|0,U=U+Math.imul(it,Gt)|0,he=he+Math.imul(it,vt)|0,Q=Q+Math.imul(He,Kt)|0,U=U+Math.imul(He,At)|0,U=U+Math.imul(tt,Kt)|0,he=he+Math.imul(tt,At)|0,Q=Q+Math.imul(Ie,Jt)|0,U=U+Math.imul(Ie,ve)|0,U=U+Math.imul(Le,Jt)|0,he=he+Math.imul(Le,ve)|0,Q=Q+Math.imul(de,se)|0,U=U+Math.imul(de,xe)|0,U=U+Math.imul(ne,se)|0,he=he+Math.imul(ne,xe)|0,Q=Q+Math.imul(ye,qe)|0,U=U+Math.imul(ye,We)|0,U=U+Math.imul(Ce,qe)|0,he=he+Math.imul(Ce,We)|0,Q=Q+Math.imul(Ve,wt)|0,U=U+Math.imul(Ve,st)|0,U=U+Math.imul(Ae,wt)|0,he=he+Math.imul(Ae,st)|0;var Cr=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,Q=Math.imul(Dt,Nt),U=Math.imul(Dt,_t),U=U+Math.imul(yt,Nt)|0,he=Math.imul(yt,_t),Q=Q+Math.imul(Rt,Wt)|0,U=U+Math.imul(Rt,$t)|0,U=U+Math.imul(dt,Wt)|0,he=he+Math.imul(dt,$t)|0,Q=Q+Math.imul(ut,Gt)|0,U=U+Math.imul(ut,vt)|0,U=U+Math.imul(ht,Gt)|0,he=he+Math.imul(ht,vt)|0,Q=Q+Math.imul(nt,Kt)|0,U=U+Math.imul(nt,At)|0,U=U+Math.imul(it,Kt)|0,he=he+Math.imul(it,At)|0,Q=Q+Math.imul(He,Jt)|0,U=U+Math.imul(He,ve)|0,U=U+Math.imul(tt,Jt)|0,he=he+Math.imul(tt,ve)|0,Q=Q+Math.imul(Ie,se)|0,U=U+Math.imul(Ie,xe)|0,U=U+Math.imul(Le,se)|0,he=he+Math.imul(Le,xe)|0,Q=Q+Math.imul(de,qe)|0,U=U+Math.imul(de,We)|0,U=U+Math.imul(ne,qe)|0,he=he+Math.imul(ne,We)|0,Q=Q+Math.imul(ye,wt)|0,U=U+Math.imul(ye,st)|0,U=U+Math.imul(Ce,wt)|0,he=he+Math.imul(Ce,st)|0,Q=Q+Math.imul(Ve,mt)|0,U=U+Math.imul(Ve,Mt)|0,U=U+Math.imul(Ae,mt)|0,he=he+Math.imul(Ae,Mt)|0;var Ar=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Ar>>>26)|0,Ar&=67108863,Q=Math.imul(Zt,Nt),U=Math.imul(Zt,_t),U=U+Math.imul(bt,Nt)|0,he=Math.imul(bt,_t),Q=Q+Math.imul(Dt,Wt)|0,U=U+Math.imul(Dt,$t)|0,U=U+Math.imul(yt,Wt)|0,he=he+Math.imul(yt,$t)|0,Q=Q+Math.imul(Rt,Gt)|0,U=U+Math.imul(Rt,vt)|0,U=U+Math.imul(dt,Gt)|0,he=he+Math.imul(dt,vt)|0,Q=Q+Math.imul(ut,Kt)|0,U=U+Math.imul(ut,At)|0,U=U+Math.imul(ht,Kt)|0,he=he+Math.imul(ht,At)|0,Q=Q+Math.imul(nt,Jt)|0,U=U+Math.imul(nt,ve)|0,U=U+Math.imul(it,Jt)|0,he=he+Math.imul(it,ve)|0,Q=Q+Math.imul(He,se)|0,U=U+Math.imul(He,xe)|0,U=U+Math.imul(tt,se)|0,he=he+Math.imul(tt,xe)|0,Q=Q+Math.imul(Ie,qe)|0,U=U+Math.imul(Ie,We)|0,U=U+Math.imul(Le,qe)|0,he=he+Math.imul(Le,We)|0,Q=Q+Math.imul(de,wt)|0,U=U+Math.imul(de,st)|0,U=U+Math.imul(ne,wt)|0,he=he+Math.imul(ne,st)|0,Q=Q+Math.imul(ye,mt)|0,U=U+Math.imul(ye,Mt)|0,U=U+Math.imul(Ce,mt)|0,he=he+Math.imul(Ce,Mt)|0,Q=Q+Math.imul(Ve,er)|0,U=U+Math.imul(Ve,rr)|0,U=U+Math.imul(Ae,er)|0,he=he+Math.imul(Ae,rr)|0;var Wr=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,Q=Math.imul(Zt,Wt),U=Math.imul(Zt,$t),U=U+Math.imul(bt,Wt)|0,he=Math.imul(bt,$t),Q=Q+Math.imul(Dt,Gt)|0,U=U+Math.imul(Dt,vt)|0,U=U+Math.imul(yt,Gt)|0,he=he+Math.imul(yt,vt)|0,Q=Q+Math.imul(Rt,Kt)|0,U=U+Math.imul(Rt,At)|0,U=U+Math.imul(dt,Kt)|0,he=he+Math.imul(dt,At)|0,Q=Q+Math.imul(ut,Jt)|0,U=U+Math.imul(ut,ve)|0,U=U+Math.imul(ht,Jt)|0,he=he+Math.imul(ht,ve)|0,Q=Q+Math.imul(nt,se)|0,U=U+Math.imul(nt,xe)|0,U=U+Math.imul(it,se)|0,he=he+Math.imul(it,xe)|0,Q=Q+Math.imul(He,qe)|0,U=U+Math.imul(He,We)|0,U=U+Math.imul(tt,qe)|0,he=he+Math.imul(tt,We)|0,Q=Q+Math.imul(Ie,wt)|0,U=U+Math.imul(Ie,st)|0,U=U+Math.imul(Le,wt)|0,he=he+Math.imul(Le,st)|0,Q=Q+Math.imul(de,mt)|0,U=U+Math.imul(de,Mt)|0,U=U+Math.imul(ne,mt)|0,he=he+Math.imul(ne,Mt)|0,Q=Q+Math.imul(ye,er)|0,U=U+Math.imul(ye,rr)|0,U=U+Math.imul(Ce,er)|0,he=he+Math.imul(Ce,rr)|0;var Lr=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,Q=Math.imul(Zt,Gt),U=Math.imul(Zt,vt),U=U+Math.imul(bt,Gt)|0,he=Math.imul(bt,vt),Q=Q+Math.imul(Dt,Kt)|0,U=U+Math.imul(Dt,At)|0,U=U+Math.imul(yt,Kt)|0,he=he+Math.imul(yt,At)|0,Q=Q+Math.imul(Rt,Jt)|0,U=U+Math.imul(Rt,ve)|0,U=U+Math.imul(dt,Jt)|0,he=he+Math.imul(dt,ve)|0,Q=Q+Math.imul(ut,se)|0,U=U+Math.imul(ut,xe)|0,U=U+Math.imul(ht,se)|0,he=he+Math.imul(ht,xe)|0,Q=Q+Math.imul(nt,qe)|0,U=U+Math.imul(nt,We)|0,U=U+Math.imul(it,qe)|0,he=he+Math.imul(it,We)|0,Q=Q+Math.imul(He,wt)|0,U=U+Math.imul(He,st)|0,U=U+Math.imul(tt,wt)|0,he=he+Math.imul(tt,st)|0,Q=Q+Math.imul(Ie,mt)|0,U=U+Math.imul(Ie,Mt)|0,U=U+Math.imul(Le,mt)|0,he=he+Math.imul(Le,Mt)|0,Q=Q+Math.imul(de,er)|0,U=U+Math.imul(de,rr)|0,U=U+Math.imul(ne,er)|0,he=he+Math.imul(ne,rr)|0;var vn=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(vn>>>26)|0,vn&=67108863,Q=Math.imul(Zt,Kt),U=Math.imul(Zt,At),U=U+Math.imul(bt,Kt)|0,he=Math.imul(bt,At),Q=Q+Math.imul(Dt,Jt)|0,U=U+Math.imul(Dt,ve)|0,U=U+Math.imul(yt,Jt)|0,he=he+Math.imul(yt,ve)|0,Q=Q+Math.imul(Rt,se)|0,U=U+Math.imul(Rt,xe)|0,U=U+Math.imul(dt,se)|0,he=he+Math.imul(dt,xe)|0,Q=Q+Math.imul(ut,qe)|0,U=U+Math.imul(ut,We)|0,U=U+Math.imul(ht,qe)|0,he=he+Math.imul(ht,We)|0,Q=Q+Math.imul(nt,wt)|0,U=U+Math.imul(nt,st)|0,U=U+Math.imul(it,wt)|0,he=he+Math.imul(it,st)|0,Q=Q+Math.imul(He,mt)|0,U=U+Math.imul(He,Mt)|0,U=U+Math.imul(tt,mt)|0,he=he+Math.imul(tt,Mt)|0,Q=Q+Math.imul(Ie,er)|0,U=U+Math.imul(Ie,rr)|0,U=U+Math.imul(Le,er)|0,he=he+Math.imul(Le,rr)|0;var _n=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(_n>>>26)|0,_n&=67108863,Q=Math.imul(Zt,Jt),U=Math.imul(Zt,ve),U=U+Math.imul(bt,Jt)|0,he=Math.imul(bt,ve),Q=Q+Math.imul(Dt,se)|0,U=U+Math.imul(Dt,xe)|0,U=U+Math.imul(yt,se)|0,he=he+Math.imul(yt,xe)|0,Q=Q+Math.imul(Rt,qe)|0,U=U+Math.imul(Rt,We)|0,U=U+Math.imul(dt,qe)|0,he=he+Math.imul(dt,We)|0,Q=Q+Math.imul(ut,wt)|0,U=U+Math.imul(ut,st)|0,U=U+Math.imul(ht,wt)|0,he=he+Math.imul(ht,st)|0,Q=Q+Math.imul(nt,mt)|0,U=U+Math.imul(nt,Mt)|0,U=U+Math.imul(it,mt)|0,he=he+Math.imul(it,Mt)|0,Q=Q+Math.imul(He,er)|0,U=U+Math.imul(He,rr)|0,U=U+Math.imul(tt,er)|0,he=he+Math.imul(tt,rr)|0;var on=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(on>>>26)|0,on&=67108863,Q=Math.imul(Zt,se),U=Math.imul(Zt,xe),U=U+Math.imul(bt,se)|0,he=Math.imul(bt,xe),Q=Q+Math.imul(Dt,qe)|0,U=U+Math.imul(Dt,We)|0,U=U+Math.imul(yt,qe)|0,he=he+Math.imul(yt,We)|0,Q=Q+Math.imul(Rt,wt)|0,U=U+Math.imul(Rt,st)|0,U=U+Math.imul(dt,wt)|0,he=he+Math.imul(dt,st)|0,Q=Q+Math.imul(ut,mt)|0,U=U+Math.imul(ut,Mt)|0,U=U+Math.imul(ht,mt)|0,he=he+Math.imul(ht,Mt)|0,Q=Q+Math.imul(nt,er)|0,U=U+Math.imul(nt,rr)|0,U=U+Math.imul(it,er)|0,he=he+Math.imul(it,rr)|0;var In=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(In>>>26)|0,In&=67108863,Q=Math.imul(Zt,qe),U=Math.imul(Zt,We),U=U+Math.imul(bt,qe)|0,he=Math.imul(bt,We),Q=Q+Math.imul(Dt,wt)|0,U=U+Math.imul(Dt,st)|0,U=U+Math.imul(yt,wt)|0,he=he+Math.imul(yt,st)|0,Q=Q+Math.imul(Rt,mt)|0,U=U+Math.imul(Rt,Mt)|0,U=U+Math.imul(dt,mt)|0,he=he+Math.imul(dt,Mt)|0,Q=Q+Math.imul(ut,er)|0,U=U+Math.imul(ut,rr)|0,U=U+Math.imul(ht,er)|0,he=he+Math.imul(ht,rr)|0;var Tn=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,Q=Math.imul(Zt,wt),U=Math.imul(Zt,st),U=U+Math.imul(bt,wt)|0,he=Math.imul(bt,st),Q=Q+Math.imul(Dt,mt)|0,U=U+Math.imul(Dt,Mt)|0,U=U+Math.imul(yt,mt)|0,he=he+Math.imul(yt,Mt)|0,Q=Q+Math.imul(Rt,er)|0,U=U+Math.imul(Rt,rr)|0,U=U+Math.imul(dt,er)|0,he=he+Math.imul(dt,rr)|0;var Cn=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,Q=Math.imul(Zt,mt),U=Math.imul(Zt,Mt),U=U+Math.imul(bt,mt)|0,he=Math.imul(bt,Mt),Q=Q+Math.imul(Dt,er)|0,U=U+Math.imul(Dt,rr)|0,U=U+Math.imul(yt,er)|0,he=he+Math.imul(yt,rr)|0;var Pi=(F+Q|0)+((U&8191)<<13)|0;F=(he+(U>>>13)|0)+(Pi>>>26)|0,Pi&=67108863,Q=Math.imul(Zt,er),U=Math.imul(Zt,rr),U=U+Math.imul(bt,er)|0,he=Math.imul(bt,rr);var Bn=(F+Q|0)+((U&8191)<<13)|0;return F=(he+(U>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,ee[0]=qr,ee[1]=Dr,ee[2]=Zr,ee[3]=Hr,ee[4]=Vr,ee[5]=Tr,ee[6]=Nr,ee[7]=Cr,ee[8]=Ar,ee[9]=Wr,ee[10]=Lr,ee[11]=vn,ee[12]=_n,ee[13]=on,ee[14]=In,ee[15]=Tn,ee[16]=Cn,ee[17]=Pi,ee[18]=Bn,F!==0&&(ee[19]=F,X.length++),X};Math.imul||(ie=le);function ge(q,O,L){L.negative=O.negative^q.negative,L.length=q.length+O.length;for(var X=0,j=0,re=0;re<L.length-1;re++){var ee=j;j=0;for(var F=X&67108863,Q=Math.min(re,O.length-1),U=Math.max(0,re-q.length+1);U<=Q;U++){var he=re-U,Oe=q.words[he]|0,Ve=O.words[U]|0,Ae=Oe*Ve,oe=Ae&67108863;ee=ee+(Ae/67108864|0)|0,oe=oe+F|0,F=oe&67108863,ee=ee+(oe>>>26)|0,j+=ee>>>26,ee&=67108863}L.words[re]=F,X=ee,ee=j}return X!==0?L.words[re]=X:L.length--,L._strip()}function pe(q,O,L){return ge(q,O,L)}b.prototype.mulTo=function(O,L){var X,j=this.length+O.length;return this.length===10&&O.length===10?X=ie(this,O,L):j<63?X=le(this,O,L):j<1024?X=ge(this,O,L):X=pe(this,O,L),X},b.prototype.mul=function(O){var L=new b(null);return L.words=new Array(this.length+O.length),this.mulTo(O,L)},b.prototype.mulf=function(O){var L=new b(null);return L.words=new Array(this.length+O.length),pe(this,O,L)},b.prototype.imul=function(O){return this.clone().mulTo(O,this)},b.prototype.imuln=function(O){var L=O<0;L&&(O=-O),v(typeof O=="number"),v(O<67108864);for(var X=0,j=0;j<this.length;j++){var re=(this.words[j]|0)*O,ee=(re&67108863)+(X&67108863);X>>=26,X+=re/67108864|0,X+=ee>>>26,this.words[j]=ee&67108863}return X!==0&&(this.words[j]=X,this.length++),L?this.ineg():this},b.prototype.muln=function(O){return this.clone().imuln(O)},b.prototype.sqr=function(){return this.mul(this)},b.prototype.isqr=function(){return this.imul(this.clone())},b.prototype.pow=function(O){var L=ce(O);if(L.length===0)return new b(1);for(var X=this,j=0;j<L.length&&L[j]===0;j++,X=X.sqr());if(++j<L.length)for(var re=X.sqr();j<L.length;j++,re=re.sqr())L[j]!==0&&(X=X.mul(re));return X},b.prototype.iushln=function(O){v(typeof O=="number"&&O>=0);var L=O%26,X=(O-L)/26,j=67108863>>>26-L<<26-L,re;if(L!==0){var ee=0;for(re=0;re<this.length;re++){var F=this.words[re]&j,Q=(this.words[re]|0)-F<<L;this.words[re]=Q|ee,ee=F>>>26-L}ee&&(this.words[re]=ee,this.length++)}if(X!==0){for(re=this.length-1;re>=0;re--)this.words[re+X]=this.words[re];for(re=0;re<X;re++)this.words[re]=0;this.length+=X}return this._strip()},b.prototype.ishln=function(O){return v(this.negative===0),this.iushln(O)},b.prototype.iushrn=function(O,L,X){v(typeof O=="number"&&O>=0);var j;L?j=(L-L%26)/26:j=0;var re=O%26,ee=Math.min((O-re)/26,this.length),F=67108863^67108863>>>re<<re,Q=X;if(j-=ee,j=Math.max(0,j),Q){for(var U=0;U<ee;U++)Q.words[U]=this.words[U];Q.length=ee}if(ee!==0)if(this.length>ee)for(this.length-=ee,U=0;U<this.length;U++)this.words[U]=this.words[U+ee];else this.words[0]=0,this.length=1;var he=0;for(U=this.length-1;U>=0&&(he!==0||U>=j);U--){var Oe=this.words[U]|0;this.words[U]=he<<26-re|Oe>>>re,he=Oe&F}return Q&&he!==0&&(Q.words[Q.length++]=he),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},b.prototype.ishrn=function(O,L,X){return v(this.negative===0),this.iushrn(O,L,X)},b.prototype.shln=function(O){return this.clone().ishln(O)},b.prototype.ushln=function(O){return this.clone().iushln(O)},b.prototype.shrn=function(O){return this.clone().ishrn(O)},b.prototype.ushrn=function(O){return this.clone().iushrn(O)},b.prototype.testn=function(O){v(typeof O=="number"&&O>=0);var L=O%26,X=(O-L)/26,j=1<<L;if(this.length<=X)return!1;var re=this.words[X];return!!(re&j)},b.prototype.imaskn=function(O){v(typeof O=="number"&&O>=0);var L=O%26,X=(O-L)/26;if(v(this.negative===0,"imaskn works only with positive numbers"),this.length<=X)return this;if(L!==0&&X++,this.length=Math.min(X,this.length),L!==0){var j=67108863^67108863>>>L<<L;this.words[this.length-1]&=j}return this._strip()},b.prototype.maskn=function(O){return this.clone().imaskn(O)},b.prototype.iaddn=function(O){return v(typeof O=="number"),v(O<67108864),O<0?this.isubn(-O):this.negative!==0?this.length===1&&(this.words[0]|0)<=O?(this.words[0]=O-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(O),this.negative=1,this):this._iaddn(O)},b.prototype._iaddn=function(O){this.words[0]+=O;for(var L=0;L<this.length&&this.words[L]>=67108864;L++)this.words[L]-=67108864,L===this.length-1?this.words[L+1]=1:this.words[L+1]++;return this.length=Math.max(this.length,L+1),this},b.prototype.isubn=function(O){if(v(typeof O=="number"),v(O<67108864),O<0)return this.iaddn(-O);if(this.negative!==0)return this.negative=0,this.iaddn(O),this.negative=1,this;if(this.words[0]-=O,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var L=0;L<this.length&&this.words[L]<0;L++)this.words[L]+=67108864,this.words[L+1]-=1;return this._strip()},b.prototype.addn=function(O){return this.clone().iaddn(O)},b.prototype.subn=function(O){return this.clone().isubn(O)},b.prototype.iabs=function(){return this.negative=0,this},b.prototype.abs=function(){return this.clone().iabs()},b.prototype._ishlnsubmul=function(O,L,X){var j=O.length+X,re;this._expand(j);var ee,F=0;for(re=0;re<O.length;re++){ee=(this.words[re+X]|0)+F;var Q=(O.words[re]|0)*L;ee-=Q&67108863,F=(ee>>26)-(Q/67108864|0),this.words[re+X]=ee&67108863}for(;re<this.length-X;re++)ee=(this.words[re+X]|0)+F,F=ee>>26,this.words[re+X]=ee&67108863;if(F===0)return this._strip();for(v(F===-1),F=0,re=0;re<this.length;re++)ee=-(this.words[re]|0)+F,F=ee>>26,this.words[re]=ee&67108863;return this.negative=1,this._strip()},b.prototype._wordDiv=function(O,L){var X=this.length-O.length,j=this.clone(),re=O,ee=re.words[re.length-1]|0,F=this._countBits(ee);X=26-F,X!==0&&(re=re.ushln(X),j.iushln(X),ee=re.words[re.length-1]|0);var Q=j.length-re.length,U;if(L!=="mod"){U=new b(null),U.length=Q+1,U.words=new Array(U.length);for(var he=0;he<U.length;he++)U.words[he]=0}var Oe=j.clone()._ishlnsubmul(re,1,Q);Oe.negative===0&&(j=Oe,U&&(U.words[Q]=1));for(var Ve=Q-1;Ve>=0;Ve--){var Ae=(j.words[re.length+Ve]|0)*67108864+(j.words[re.length+Ve-1]|0);for(Ae=Math.min(Ae/ee|0,67108863),j._ishlnsubmul(re,Ae,Ve);j.negative!==0;)Ae--,j.negative=0,j._ishlnsubmul(re,1,Ve),j.isZero()||(j.negative^=1);U&&(U.words[Ve]=Ae)}return U&&U._strip(),j._strip(),L!=="div"&&X!==0&&j.iushrn(X),{div:U||null,mod:j}},b.prototype.divmod=function(O,L,X){if(v(!O.isZero()),this.isZero())return{div:new b(0),mod:new b(0)};var j,re,ee;return this.negative!==0&&O.negative===0?(ee=this.neg().divmod(O,L),L!=="mod"&&(j=ee.div.neg()),L!=="div"&&(re=ee.mod.neg(),X&&re.negative!==0&&re.iadd(O)),{div:j,mod:re}):this.negative===0&&O.negative!==0?(ee=this.divmod(O.neg(),L),L!=="mod"&&(j=ee.div.neg()),{div:j,mod:ee.mod}):this.negative&O.negative?(ee=this.neg().divmod(O.neg(),L),L!=="div"&&(re=ee.mod.neg(),X&&re.negative!==0&&re.isub(O)),{div:ee.div,mod:re}):O.length>this.length||this.cmp(O)<0?{div:new b(0),mod:this}:O.length===1?L==="div"?{div:this.divn(O.words[0]),mod:null}:L==="mod"?{div:null,mod:new b(this.modrn(O.words[0]))}:{div:this.divn(O.words[0]),mod:new b(this.modrn(O.words[0]))}:this._wordDiv(O,L)},b.prototype.div=function(O){return this.divmod(O,"div",!1).div},b.prototype.mod=function(O){return this.divmod(O,"mod",!1).mod},b.prototype.umod=function(O){return this.divmod(O,"mod",!0).mod},b.prototype.divRound=function(O){var L=this.divmod(O);if(L.mod.isZero())return L.div;var X=L.div.negative!==0?L.mod.isub(O):L.mod,j=O.ushrn(1),re=O.andln(1),ee=X.cmp(j);return ee<0||re===1&&ee===0?L.div:L.div.negative!==0?L.div.isubn(1):L.div.iaddn(1)},b.prototype.modrn=function(O){var L=O<0;L&&(O=-O),v(O<=67108863);for(var X=(1<<26)%O,j=0,re=this.length-1;re>=0;re--)j=(X*j+(this.words[re]|0))%O;return L?-j:j},b.prototype.modn=function(O){return this.modrn(O)},b.prototype.idivn=function(O){var L=O<0;L&&(O=-O),v(O<=67108863);for(var X=0,j=this.length-1;j>=0;j--){var re=(this.words[j]|0)+X*67108864;this.words[j]=re/O|0,X=re%O}return this._strip(),L?this.ineg():this},b.prototype.divn=function(O){return this.clone().idivn(O)},b.prototype.egcd=function(O){v(O.negative===0),v(!O.isZero());var L=this,X=O.clone();L.negative!==0?L=L.umod(O):L=L.clone();for(var j=new b(1),re=new b(0),ee=new b(0),F=new b(1),Q=0;L.isEven()&&X.isEven();)L.iushrn(1),X.iushrn(1),++Q;for(var U=X.clone(),he=L.clone();!L.isZero();){for(var Oe=0,Ve=1;!(L.words[0]&Ve)&&Oe<26;++Oe,Ve<<=1);if(Oe>0)for(L.iushrn(Oe);Oe-- >0;)(j.isOdd()||re.isOdd())&&(j.iadd(U),re.isub(he)),j.iushrn(1),re.iushrn(1);for(var Ae=0,oe=1;!(X.words[0]&oe)&&Ae<26;++Ae,oe<<=1);if(Ae>0)for(X.iushrn(Ae);Ae-- >0;)(ee.isOdd()||F.isOdd())&&(ee.iadd(U),F.isub(he)),ee.iushrn(1),F.iushrn(1);L.cmp(X)>=0?(L.isub(X),j.isub(ee),re.isub(F)):(X.isub(L),ee.isub(j),F.isub(re))}return{a:ee,b:F,gcd:X.iushln(Q)}},b.prototype._invmp=function(O){v(O.negative===0),v(!O.isZero());var L=this,X=O.clone();L.negative!==0?L=L.umod(O):L=L.clone();for(var j=new b(1),re=new b(0),ee=X.clone();L.cmpn(1)>0&&X.cmpn(1)>0;){for(var F=0,Q=1;!(L.words[0]&Q)&&F<26;++F,Q<<=1);if(F>0)for(L.iushrn(F);F-- >0;)j.isOdd()&&j.iadd(ee),j.iushrn(1);for(var U=0,he=1;!(X.words[0]&he)&&U<26;++U,he<<=1);if(U>0)for(X.iushrn(U);U-- >0;)re.isOdd()&&re.iadd(ee),re.iushrn(1);L.cmp(X)>=0?(L.isub(X),j.isub(re)):(X.isub(L),re.isub(j))}var Oe;return L.cmpn(1)===0?Oe=j:Oe=re,Oe.cmpn(0)<0&&Oe.iadd(O),Oe},b.prototype.gcd=function(O){if(this.isZero())return O.abs();if(O.isZero())return this.abs();var L=this.clone(),X=O.clone();L.negative=0,X.negative=0;for(var j=0;L.isEven()&&X.isEven();j++)L.iushrn(1),X.iushrn(1);do{for(;L.isEven();)L.iushrn(1);for(;X.isEven();)X.iushrn(1);var re=L.cmp(X);if(re<0){var ee=L;L=X,X=ee}else if(re===0||X.cmpn(1)===0)break;L.isub(X)}while(!0);return X.iushln(j)},b.prototype.invm=function(O){return this.egcd(O).a.umod(O)},b.prototype.isEven=function(){return(this.words[0]&1)===0},b.prototype.isOdd=function(){return(this.words[0]&1)===1},b.prototype.andln=function(O){return this.words[0]&O},b.prototype.bincn=function(O){v(typeof O=="number");var L=O%26,X=(O-L)/26,j=1<<L;if(this.length<=X)return this._expand(X+1),this.words[X]|=j,this;for(var re=j,ee=X;re!==0&&ee<this.length;ee++){var F=this.words[ee]|0;F+=re,re=F>>>26,F&=67108863,this.words[ee]=F}return re!==0&&(this.words[ee]=re,this.length++),this},b.prototype.isZero=function(){return this.length===1&&this.words[0]===0},b.prototype.cmpn=function(O){var L=O<0;if(this.negative!==0&&!L)return-1;if(this.negative===0&&L)return 1;this._strip();var X;if(this.length>1)X=1;else{L&&(O=-O),v(O<=67108863,"Number is too big");var j=this.words[0]|0;X=j===O?0:j<O?-1:1}return this.negative!==0?-X|0:X},b.prototype.cmp=function(O){if(this.negative!==0&&O.negative===0)return-1;if(this.negative===0&&O.negative!==0)return 1;var L=this.ucmp(O);return this.negative!==0?-L|0:L},b.prototype.ucmp=function(O){if(this.length>O.length)return 1;if(this.length<O.length)return-1;for(var L=0,X=this.length-1;X>=0;X--){var j=this.words[X]|0,re=O.words[X]|0;if(j!==re){j<re?L=-1:j>re&&(L=1);break}}return L},b.prototype.gtn=function(O){return this.cmpn(O)===1},b.prototype.gt=function(O){return this.cmp(O)===1},b.prototype.gten=function(O){return this.cmpn(O)>=0},b.prototype.gte=function(O){return this.cmp(O)>=0},b.prototype.ltn=function(O){return this.cmpn(O)===-1},b.prototype.lt=function(O){return this.cmp(O)===-1},b.prototype.lten=function(O){return this.cmpn(O)<=0},b.prototype.lte=function(O){return this.cmp(O)<=0},b.prototype.eqn=function(O){return this.cmpn(O)===0},b.prototype.eq=function(O){return this.cmp(O)===0},b.red=function(O){return new we(O)},b.prototype.toRed=function(O){return v(!this.red,"Already a number in reduction context"),v(this.negative===0,"red works only with positives"),O.convertTo(this)._forceRed(O)},b.prototype.fromRed=function(){return v(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},b.prototype._forceRed=function(O){return this.red=O,this},b.prototype.forceRed=function(O){return v(!this.red,"Already a number in reduction context"),this._forceRed(O)},b.prototype.redAdd=function(O){return v(this.red,"redAdd works only with red numbers"),this.red.add(this,O)},b.prototype.redIAdd=function(O){return v(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,O)},b.prototype.redSub=function(O){return v(this.red,"redSub works only with red numbers"),this.red.sub(this,O)},b.prototype.redISub=function(O){return v(this.red,"redISub works only with red numbers"),this.red.isub(this,O)},b.prototype.redShl=function(O){return v(this.red,"redShl works only with red numbers"),this.red.shl(this,O)},b.prototype.redMul=function(O){return v(this.red,"redMul works only with red numbers"),this.red._verify2(this,O),this.red.mul(this,O)},b.prototype.redIMul=function(O){return v(this.red,"redMul works only with red numbers"),this.red._verify2(this,O),this.red.imul(this,O)},b.prototype.redSqr=function(){return v(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},b.prototype.redISqr=function(){return v(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},b.prototype.redSqrt=function(){return v(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},b.prototype.redInvm=function(){return v(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},b.prototype.redNeg=function(){return v(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},b.prototype.redPow=function(O){return v(this.red&&!O.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,O)};var Me={k256:null,p224:null,p192:null,p25519:null};function $e(q,O){this.name=q,this.p=new b(O,16),this.n=this.p.bitLength(),this.k=new b(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$e.prototype._tmp=function(){var O=new b(null);return O.words=new Array(Math.ceil(this.n/13)),O},$e.prototype.ireduce=function(O){var L=O,X;do this.split(L,this.tmp),L=this.imulK(L),L=L.iadd(this.tmp),X=L.bitLength();while(X>this.n);var j=X<this.n?-1:L.ucmp(this.p);return j===0?(L.words[0]=0,L.length=1):j>0?L.isub(this.p):L.strip!==void 0?L.strip():L._strip(),L},$e.prototype.split=function(O,L){O.iushrn(this.n,0,L)},$e.prototype.imulK=function(O){return O.imul(this.k)};function Pe(){$e.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}w(Pe,$e),Pe.prototype.split=function(O,L){for(var X=4194303,j=Math.min(O.length,9),re=0;re<j;re++)L.words[re]=O.words[re];if(L.length=j,O.length<=9){O.words[0]=0,O.length=1;return}var ee=O.words[9];for(L.words[L.length++]=ee&X,re=10;re<O.length;re++){var F=O.words[re]|0;O.words[re-10]=(F&X)<<4|ee>>>22,ee=F}ee>>>=22,O.words[re-10]=ee,ee===0&&O.length>10?O.length-=10:O.length-=9},Pe.prototype.imulK=function(O){O.words[O.length]=0,O.words[O.length+1]=0,O.length+=2;for(var L=0,X=0;X<O.length;X++){var j=O.words[X]|0;L+=j*977,O.words[X]=L&67108863,L=j*64+(L/67108864|0)}return O.words[O.length-1]===0&&(O.length--,O.words[O.length-1]===0&&O.length--),O};function Be(){$e.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}w(Be,$e);function Re(){$e.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}w(Re,$e);function je(){$e.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}w(je,$e),je.prototype.imulK=function(O){for(var L=0,X=0;X<O.length;X++){var j=(O.words[X]|0)*19+L,re=j&67108863;j>>>=26,O.words[X]=re,L=j}return L!==0&&(O.words[O.length++]=L),O},b._prime=function(O){if(Me[O])return Me[O];var L;if(O==="k256")L=new Pe;else if(O==="p224")L=new Be;else if(O==="p192")L=new Re;else if(O==="p25519")L=new je;else throw new Error("Unknown prime "+O);return Me[O]=L,L};function we(q){if(typeof q=="string"){var O=b._prime(q);this.m=O.p,this.prime=O}else v(q.gtn(1),"modulus must be greater than 1"),this.m=q,this.prime=null}we.prototype._verify1=function(O){v(O.negative===0,"red works only with positives"),v(O.red,"red works only with red numbers")},we.prototype._verify2=function(O,L){v((O.negative|L.negative)===0,"red works only with positives"),v(O.red&&O.red===L.red,"red works only with red numbers")},we.prototype.imod=function(O){return this.prime?this.prime.ireduce(O)._forceRed(this):(C(O,O.umod(this.m)._forceRed(this)),O)},we.prototype.neg=function(O){return O.isZero()?O.clone():this.m.sub(O)._forceRed(this)},we.prototype.add=function(O,L){this._verify2(O,L);var X=O.add(L);return X.cmp(this.m)>=0&&X.isub(this.m),X._forceRed(this)},we.prototype.iadd=function(O,L){this._verify2(O,L);var X=O.iadd(L);return X.cmp(this.m)>=0&&X.isub(this.m),X},we.prototype.sub=function(O,L){this._verify2(O,L);var X=O.sub(L);return X.cmpn(0)<0&&X.iadd(this.m),X._forceRed(this)},we.prototype.isub=function(O,L){this._verify2(O,L);var X=O.isub(L);return X.cmpn(0)<0&&X.iadd(this.m),X},we.prototype.shl=function(O,L){return this._verify1(O),this.imod(O.ushln(L))},we.prototype.imul=function(O,L){return this._verify2(O,L),this.imod(O.imul(L))},we.prototype.mul=function(O,L){return this._verify2(O,L),this.imod(O.mul(L))},we.prototype.isqr=function(O){return this.imul(O,O.clone())},we.prototype.sqr=function(O){return this.mul(O,O)},we.prototype.sqrt=function(O){if(O.isZero())return O.clone();var L=this.m.andln(3);if(v(L%2===1),L===3){var X=this.m.add(new b(1)).iushrn(2);return this.pow(O,X)}for(var j=this.m.subn(1),re=0;!j.isZero()&&j.andln(1)===0;)re++,j.iushrn(1);v(!j.isZero());var ee=new b(1).toRed(this),F=ee.redNeg(),Q=this.m.subn(1).iushrn(1),U=this.m.bitLength();for(U=new b(2*U*U).toRed(this);this.pow(U,Q).cmp(F)!==0;)U.redIAdd(F);for(var he=this.pow(U,j),Oe=this.pow(O,j.addn(1).iushrn(1)),Ve=this.pow(O,j),Ae=re;Ve.cmp(ee)!==0;){for(var oe=Ve,ye=0;oe.cmp(ee)!==0;ye++)oe=oe.redSqr();v(ye<Ae);var Ce=this.pow(he,new b(1).iushln(Ae-ye-1));Oe=Oe.redMul(Ce),he=Ce.redSqr(),Ve=Ve.redMul(he),Ae=ye}return Oe},we.prototype.invm=function(O){var L=O._invmp(this.m);return L.negative!==0?(L.negative=0,this.imod(L).redNeg()):this.imod(L)},we.prototype.pow=function(O,L){if(L.isZero())return new b(1).toRed(this);if(L.cmpn(1)===0)return O.clone();var X=4,j=new Array(1<<X);j[0]=new b(1).toRed(this),j[1]=O;for(var re=2;re<j.length;re++)j[re]=this.mul(j[re-1],O);var ee=j[0],F=0,Q=0,U=L.bitLength()%26;for(U===0&&(U=26),re=L.length-1;re>=0;re--){for(var he=L.words[re],Oe=U-1;Oe>=0;Oe--){var Ve=he>>Oe&1;if(ee!==j[0]&&(ee=this.sqr(ee)),Ve===0&&F===0){Q=0;continue}F<<=1,F|=Ve,Q++,!(Q!==X&&(re!==0||Oe!==0))&&(ee=this.mul(ee,j[F]),Q=0,F=0)}U=26}return ee},we.prototype.convertTo=function(O){var L=O.umod(this.m);return L===O?L.clone():L},we.prototype.convertFrom=function(O){var L=O.clone();return L.red=null,L},b.mont=function(O){return new D(O)};function D(q){we.call(this,q),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new b(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w(D,we),D.prototype.convertTo=function(O){return this.imod(O.ushln(this.shift))},D.prototype.convertFrom=function(O){var L=this.imod(O.mul(this.rinv));return L.red=null,L},D.prototype.imul=function(O,L){if(O.isZero()||L.isZero())return O.words[0]=0,O.length=1,O;var X=O.imul(L),j=X.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),re=X.isub(j).iushrn(this.shift),ee=re;return re.cmp(this.m)>=0?ee=re.isub(this.m):re.cmpn(0)<0&&(ee=re.iadd(this.m)),ee._forceRed(this)},D.prototype.mul=function(O,L){if(O.isZero()||L.isZero())return new b(0)._forceRed(this);var X=O.mul(L),j=X.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),re=X.isub(j).iushrn(this.shift),ee=re;return re.cmp(this.m)>=0?ee=re.isub(this.m):re.cmpn(0)<0&&(ee=re.iadd(this.m)),ee._forceRed(this)},D.prototype.invm=function(O){var L=this.imod(O._invmp(this.m).mul(this.r2));return L._forceRed(this)}})(y,commonjsGlobal)}(bn);var bnExports=bn.exports,BN$a=bnExports,randomBytes$1=browserExports,Buffer$7=safeBufferExports$1.Buffer;function getr(y){var u=y.modulus.byteLength(),h;do h=new BN$a(randomBytes$1(u));while(h.cmp(y.modulus)>=0||!h.umod(y.prime1)||!h.umod(y.prime2));return h}function blind(y){var u=getr(y),h=u.toRed(BN$a.mont(y.modulus)).redPow(new BN$a(y.publicExponent)).fromRed();return{blinder:h,unblinder:u.invm(y.modulus)}}function crt$2(y,u){var h=blind(u),v=u.modulus.byteLength(),w=new BN$a(y).mul(h.blinder).umod(u.modulus),b=w.toRed(BN$a.mont(u.prime1)),E=w.toRed(BN$a.mont(u.prime2)),$=u.coefficient,M=u.prime1,T=u.prime2,C=b.redPow(u.exponent1).fromRed(),B=E.redPow(u.exponent2).fromRed(),N=C.isub(B).imul($).umod(M).imul(T);return B.iadd(N).imul(h.unblinder).umod(u.modulus).toArrayLike(Buffer$7,"be",v)}crt$2.getr=getr;var browserifyRsa=crt$2,elliptic={};const name="elliptic",version="6.5.7",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny <fedor@indutny.com>",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0={name,version,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies};var utils$l={},utils$k={};(function(y){var u=y;function h(b,E){if(Array.isArray(b))return b.slice();if(!b)return[];var $=[];if(typeof b!="string"){for(var M=0;M<b.length;M++)$[M]=b[M]|0;return $}if(E==="hex"){b=b.replace(/[^a-z0-9]+/ig,""),b.length%2!==0&&(b="0"+b);for(var M=0;M<b.length;M+=2)$.push(parseInt(b[M]+b[M+1],16))}else for(var M=0;M<b.length;M++){var T=b.charCodeAt(M),C=T>>8,B=T&255;C?$.push(C,B):$.push(B)}return $}u.toArray=h;function v(b){return b.length===1?"0"+b:b}u.zero2=v;function w(b){for(var E="",$=0;$<b.length;$++)E+=v(b[$].toString(16));return E}u.toHex=w,u.encode=function(E,$){return $==="hex"?w(E):E}})(utils$k),function(y){var u=y,h=bnExports$1,v=minimalisticAssert,w=utils$k;u.assert=v,u.toArray=w.toArray,u.zero2=w.zero2,u.toHex=w.toHex,u.encode=w.encode;function b(C,B,N){var H=new Array(Math.max(C.bitLength(),N)+1),te;for(te=0;te<H.length;te+=1)H[te]=0;var fe=1<<B+1,ce=C.clone();for(te=0;te<H.length;te++){var le,ie=ce.andln(fe-1);ce.isOdd()?(ie>(fe>>1)-1?le=(fe>>1)-ie:le=ie,ce.isubn(le)):le=0,H[te]=le,ce.iushrn(1)}return H}u.getNAF=b;function E(C,B){var N=[[],[]];C=C.clone(),B=B.clone();for(var H=0,te=0,fe;C.cmpn(-H)>0||B.cmpn(-te)>0;){var ce=C.andln(3)+H&3,le=B.andln(3)+te&3;ce===3&&(ce=-1),le===3&&(le=-1);var ie;ce&1?(fe=C.andln(7)+H&7,(fe===3||fe===5)&&le===2?ie=-ce:ie=ce):ie=0,N[0].push(ie);var ge;le&1?(fe=B.andln(7)+te&7,(fe===3||fe===5)&&ce===2?ge=-le:ge=le):ge=0,N[1].push(ge),2*H===ie+1&&(H=1-H),2*te===ge+1&&(te=1-te),C.iushrn(1),B.iushrn(1)}return N}u.getJSF=E;function $(C,B,N){var H="_"+B;C.prototype[B]=function(){return this[H]!==void 0?this[H]:this[H]=N.call(this)}}u.cachedProperty=$;function M(C){return typeof C=="string"?u.toArray(C,"hex"):C}u.parseBytes=M;function T(C){return new h(C,"hex","le")}u.intFromLE=T}(utils$l);var curve={},BN$9=bnExports$1,utils$j=utils$l,getNAF=utils$j.getNAF,getJSF=utils$j.getJSF,assert$d=utils$j.assert;function BaseCurve(y,u){this.type=y,this.p=new BN$9(u.p,16),this.red=u.prime?BN$9.red(u.prime):BN$9.mont(this.p),this.zero=new BN$9(0).toRed(this.red),this.one=new BN$9(1).toRed(this.red),this.two=new BN$9(2).toRed(this.red),this.n=u.n&&new BN$9(u.n,16),this.g=u.g&&this.pointFromJSON(u.g,u.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var h=this.n&&this.p.div(this.n);!h||h.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$1=BaseCurve;BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(u,h){assert$d(u.precomputed);var v=u._getDoubles(),w=getNAF(h,1,this._bitLength),b=(1<<v.step+1)-(v.step%2===0?2:1);b/=3;var E=[],$,M;for($=0;$<w.length;$+=v.step){M=0;for(var T=$+v.step-1;T>=$;T--)M=(M<<1)+w[T];E.push(M)}for(var C=this.jpoint(null,null,null),B=this.jpoint(null,null,null),N=b;N>0;N--){for($=0;$<E.length;$++)M=E[$],M===N?B=B.mixedAdd(v.points[$]):M===-N&&(B=B.mixedAdd(v.points[$].neg()));C=C.add(B)}return C.toP()},BaseCurve.prototype._wnafMul=function(u,h){var v=4,w=u._getNAFPoints(v);v=w.wnd;for(var b=w.points,E=getNAF(h,v,this._bitLength),$=this.jpoint(null,null,null),M=E.length-1;M>=0;M--){for(var T=0;M>=0&&E[M]===0;M--)T++;if(M>=0&&T++,$=$.dblp(T),M<0)break;var C=E[M];assert$d(C!==0),u.type==="affine"?C>0?$=$.mixedAdd(b[C-1>>1]):$=$.mixedAdd(b[-C-1>>1].neg()):C>0?$=$.add(b[C-1>>1]):$=$.add(b[-C-1>>1].neg())}return u.type==="affine"?$.toP():$},BaseCurve.prototype._wnafMulAdd=function(u,h,v,w,b){var E=this._wnafT1,$=this._wnafT2,M=this._wnafT3,T=0,C,B,N;for(C=0;C<w;C++){N=h[C];var H=N._getNAFPoints(u);E[C]=H.wnd,$[C]=H.points}for(C=w-1;C>=1;C-=2){var te=C-1,fe=C;if(E[te]!==1||E[fe]!==1){M[te]=getNAF(v[te],E[te],this._bitLength),M[fe]=getNAF(v[fe],E[fe],this._bitLength),T=Math.max(M[te].length,T),T=Math.max(M[fe].length,T);continue}var ce=[h[te],null,null,h[fe]];h[te].y.cmp(h[fe].y)===0?(ce[1]=h[te].add(h[fe]),ce[2]=h[te].toJ().mixedAdd(h[fe].neg())):h[te].y.cmp(h[fe].y.redNeg())===0?(ce[1]=h[te].toJ().mixedAdd(h[fe]),ce[2]=h[te].add(h[fe].neg())):(ce[1]=h[te].toJ().mixedAdd(h[fe]),ce[2]=h[te].toJ().mixedAdd(h[fe].neg()));var le=[-3,-1,-5,-7,0,7,5,1,3],ie=getJSF(v[te],v[fe]);for(T=Math.max(ie[0].length,T),M[te]=new Array(T),M[fe]=new Array(T),B=0;B<T;B++){var ge=ie[0][B]|0,pe=ie[1][B]|0;M[te][B]=le[(ge+1)*3+(pe+1)],M[fe][B]=0,$[te]=ce}}var Me=this.jpoint(null,null,null),$e=this._wnafT4;for(C=T;C>=0;C--){for(var Pe=0;C>=0;){var Be=!0;for(B=0;B<w;B++)$e[B]=M[B][C]|0,$e[B]!==0&&(Be=!1);if(!Be)break;Pe++,C--}if(C>=0&&Pe++,Me=Me.dblp(Pe),C<0)break;for(B=0;B<w;B++){var Re=$e[B];Re!==0&&(Re>0?N=$[B][Re-1>>1]:Re<0&&(N=$[B][-Re-1>>1].neg()),N.type==="affine"?Me=Me.mixedAdd(N):Me=Me.add(N))}}for(C=0;C<w;C++)$[C]=null;return b?Me:Me.toP()};function BasePoint(y,u){this.curve=y,this.type=u,this.precomputed=null}BaseCurve.BasePoint=BasePoint,BasePoint.prototype.eq=function(){throw new Error("Not implemented")},BasePoint.prototype.validate=function(){return this.curve.validate(this)},BaseCurve.prototype.decodePoint=function(u,h){u=utils$j.toArray(u,h);var v=this.p.byteLength();if((u[0]===4||u[0]===6||u[0]===7)&&u.length-1===2*v){u[0]===6?assert$d(u[u.length-1]%2===0):u[0]===7&&assert$d(u[u.length-1]%2===1);var w=this.point(u.slice(1,1+v),u.slice(1+v,1+2*v));return w}else if((u[0]===2||u[0]===3)&&u.length-1===v)return this.pointFromX(u.slice(1,1+v),u[0]===3);throw new Error("Unknown point format")},BasePoint.prototype.encodeCompressed=function(u){return this.encode(u,!0)},BasePoint.prototype._encode=function(u){var h=this.curve.p.byteLength(),v=this.getX().toArray("be",h);return u?[this.getY().isEven()?2:3].concat(v):[4].concat(v,this.getY().toArray("be",h))},BasePoint.prototype.encode=function(u,h){return utils$j.encode(this._encode(h),u)},BasePoint.prototype.precompute=function(u){if(this.precomputed)return this;var h={doubles:null,naf:null,beta:null};return h.naf=this._getNAFPoints(8),h.doubles=this._getDoubles(4,u),h.beta=this._getBeta(),this.precomputed=h,this},BasePoint.prototype._hasDoubles=function(u){if(!this.precomputed)return!1;var h=this.precomputed.doubles;return h?h.points.length>=Math.ceil((u.bitLength()+1)/h.step):!1},BasePoint.prototype._getDoubles=function(u,h){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var v=[this],w=this,b=0;b<h;b+=u){for(var E=0;E<u;E++)w=w.dbl();v.push(w)}return{step:u,points:v}},BasePoint.prototype._getNAFPoints=function(u){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var h=[this],v=(1<<u)-1,w=v===1?null:this.dbl(),b=1;b<v;b++)h[b]=h[b-1].add(w);return{wnd:u,points:h}},BasePoint.prototype._getBeta=function(){return null},BasePoint.prototype.dblp=function(u){for(var h=this,v=0;v<u;v++)h=h.dbl();return h};var utils$i=utils$l,BN$8=bnExports$1,inherits$4=inherits_browserExports,Base$2=base$1,assert$c=utils$i.assert;function ShortCurve(y){Base$2.call(this,"short",y),this.a=new BN$8(y.a,16).toRed(this.red),this.b=new BN$8(y.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(y),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits$4(ShortCurve,Base$2);var short=ShortCurve;ShortCurve.prototype._getEndomorphism=function(u){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var h,v;if(u.beta)h=new BN$8(u.beta,16).toRed(this.red);else{var w=this._getEndoRoots(this.p);h=w[0].cmp(w[1])<0?w[0]:w[1],h=h.toRed(this.red)}if(u.lambda)v=new BN$8(u.lambda,16);else{var b=this._getEndoRoots(this.n);this.g.mul(b[0]).x.cmp(this.g.x.redMul(h))===0?v=b[0]:(v=b[1],assert$c(this.g.mul(v).x.cmp(this.g.x.redMul(h))===0))}var E;return u.basis?E=u.basis.map(function($){return{a:new BN$8($.a,16),b:new BN$8($.b,16)}}):E=this._getEndoBasis(v),{beta:h,lambda:v,basis:E}}},ShortCurve.prototype._getEndoRoots=function(u){var h=u===this.p?this.red:BN$8.mont(u),v=new BN$8(2).toRed(h).redInvm(),w=v.redNeg(),b=new BN$8(3).toRed(h).redNeg().redSqrt().redMul(v),E=w.redAdd(b).fromRed(),$=w.redSub(b).fromRed();return[E,$]},ShortCurve.prototype._getEndoBasis=function(u){for(var h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),v=u,w=this.n.clone(),b=new BN$8(1),E=new BN$8(0),$=new BN$8(0),M=new BN$8(1),T,C,B,N,H,te,fe,ce=0,le,ie;v.cmpn(0)!==0;){var ge=w.div(v);le=w.sub(ge.mul(v)),ie=$.sub(ge.mul(b));var pe=M.sub(ge.mul(E));if(!B&&le.cmp(h)<0)T=fe.neg(),C=b,B=le.neg(),N=ie;else if(B&&++ce===2)break;fe=le,w=v,v=le,$=b,b=ie,M=E,E=pe}H=le.neg(),te=ie;var Me=B.sqr().add(N.sqr()),$e=H.sqr().add(te.sqr());return $e.cmp(Me)>=0&&(H=T,te=C),B.negative&&(B=B.neg(),N=N.neg()),H.negative&&(H=H.neg(),te=te.neg()),[{a:B,b:N},{a:H,b:te}]},ShortCurve.prototype._endoSplit=function(u){var h=this.endo.basis,v=h[0],w=h[1],b=w.b.mul(u).divRound(this.n),E=v.b.neg().mul(u).divRound(this.n),$=b.mul(v.a),M=E.mul(w.a),T=b.mul(v.b),C=E.mul(w.b),B=u.sub($).sub(M),N=T.add(C).neg();return{k1:B,k2:N}},ShortCurve.prototype.pointFromX=function(u,h){u=new BN$8(u,16),u.red||(u=u.toRed(this.red));var v=u.redSqr().redMul(u).redIAdd(u.redMul(this.a)).redIAdd(this.b),w=v.redSqrt();if(w.redSqr().redSub(v).cmp(this.zero)!==0)throw new Error("invalid point");var b=w.fromRed().isOdd();return(h&&!b||!h&&b)&&(w=w.redNeg()),this.point(u,w)},ShortCurve.prototype.validate=function(u){if(u.inf)return!0;var h=u.x,v=u.y,w=this.a.redMul(h),b=h.redSqr().redMul(h).redIAdd(w).redIAdd(this.b);return v.redSqr().redISub(b).cmpn(0)===0},ShortCurve.prototype._endoWnafMulAdd=function(u,h,v){for(var w=this._endoWnafT1,b=this._endoWnafT2,E=0;E<u.length;E++){var $=this._endoSplit(h[E]),M=u[E],T=M._getBeta();$.k1.negative&&($.k1.ineg(),M=M.neg(!0)),$.k2.negative&&($.k2.ineg(),T=T.neg(!0)),w[E*2]=M,w[E*2+1]=T,b[E*2]=$.k1,b[E*2+1]=$.k2}for(var C=this._wnafMulAdd(1,w,b,E*2,v),B=0;B<E*2;B++)w[B]=null,b[B]=null;return C};function Point$3(y,u,h,v){Base$2.BasePoint.call(this,y,"affine"),u===null&&h===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$8(u,16),this.y=new BN$8(h,16),v&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}inherits$4(Point$3,Base$2.BasePoint),ShortCurve.prototype.point=function(u,h,v){return new Point$3(this,u,h,v)},ShortCurve.prototype.pointFromJSON=function(u,h){return Point$3.fromJSON(this,u,h)},Point$3.prototype._getBeta=function(){if(this.curve.endo){var u=this.precomputed;if(u&&u.beta)return u.beta;var h=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(u){var v=this.curve,w=function(b){return v.point(b.x.redMul(v.endo.beta),b.y)};u.beta=h,h.precomputed={beta:null,naf:u.naf&&{wnd:u.naf.wnd,points:u.naf.points.map(w)},doubles:u.doubles&&{step:u.doubles.step,points:u.doubles.points.map(w)}}}return h}},Point$3.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Point$3.fromJSON=function(u,h,v){typeof h=="string"&&(h=JSON.parse(h));var w=u.point(h[0],h[1],v);if(!h[2])return w;function b($){return u.point($[0],$[1],v)}var E=h[2];return w.precomputed={beta:null,doubles:E.doubles&&{step:E.doubles.step,points:[w].concat(E.doubles.points.map(b))},naf:E.naf&&{wnd:E.naf.wnd,points:[w].concat(E.naf.points.map(b))}},w},Point$3.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Point$3.prototype.isInfinity=function(){return this.inf},Point$3.prototype.add=function(u){if(this.inf)return u;if(u.inf)return this;if(this.eq(u))return this.dbl();if(this.neg().eq(u))return this.curve.point(null,null);if(this.x.cmp(u.x)===0)return this.curve.point(null,null);var h=this.y.redSub(u.y);h.cmpn(0)!==0&&(h=h.redMul(this.x.redSub(u.x).redInvm()));var v=h.redSqr().redISub(this.x).redISub(u.x),w=h.redMul(this.x.redSub(v)).redISub(this.y);return this.curve.point(v,w)},Point$3.prototype.dbl=function(){if(this.inf)return this;var u=this.y.redAdd(this.y);if(u.cmpn(0)===0)return this.curve.point(null,null);var h=this.curve.a,v=this.x.redSqr(),w=u.redInvm(),b=v.redAdd(v).redIAdd(v).redIAdd(h).redMul(w),E=b.redSqr().redISub(this.x.redAdd(this.x)),$=b.redMul(this.x.redSub(E)).redISub(this.y);return this.curve.point(E,$)},Point$3.prototype.getX=function(){return this.x.fromRed()},Point$3.prototype.getY=function(){return this.y.fromRed()},Point$3.prototype.mul=function(u){return u=new BN$8(u,16),this.isInfinity()?this:this._hasDoubles(u)?this.curve._fixedNafMul(this,u):this.curve.endo?this.curve._endoWnafMulAdd([this],[u]):this.curve._wnafMul(this,u)},Point$3.prototype.mulAdd=function(u,h,v){var w=[this,h],b=[u,v];return this.curve.endo?this.curve._endoWnafMulAdd(w,b):this.curve._wnafMulAdd(1,w,b,2)},Point$3.prototype.jmulAdd=function(u,h,v){var w=[this,h],b=[u,v];return this.curve.endo?this.curve._endoWnafMulAdd(w,b,!0):this.curve._wnafMulAdd(1,w,b,2,!0)},Point$3.prototype.eq=function(u){return this===u||this.inf===u.inf&&(this.inf||this.x.cmp(u.x)===0&&this.y.cmp(u.y)===0)},Point$3.prototype.neg=function(u){if(this.inf)return this;var h=this.curve.point(this.x,this.y.redNeg());if(u&&this.precomputed){var v=this.precomputed,w=function(b){return b.neg()};h.precomputed={naf:v.naf&&{wnd:v.naf.wnd,points:v.naf.points.map(w)},doubles:v.doubles&&{step:v.doubles.step,points:v.doubles.points.map(w)}}}return h},Point$3.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var u=this.curve.jpoint(this.x,this.y,this.curve.one);return u};function JPoint(y,u,h,v){Base$2.BasePoint.call(this,y,"jacobian"),u===null&&h===null&&v===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$8(0)):(this.x=new BN$8(u,16),this.y=new BN$8(h,16),this.z=new BN$8(v,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits$4(JPoint,Base$2.BasePoint),ShortCurve.prototype.jpoint=function(u,h,v){return new JPoint(this,u,h,v)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var u=this.z.redInvm(),h=u.redSqr(),v=this.x.redMul(h),w=this.y.redMul(h).redMul(u);return this.curve.point(v,w)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(u){if(this.isInfinity())return u;if(u.isInfinity())return this;var h=u.z.redSqr(),v=this.z.redSqr(),w=this.x.redMul(h),b=u.x.redMul(v),E=this.y.redMul(h.redMul(u.z)),$=u.y.redMul(v.redMul(this.z)),M=w.redSub(b),T=E.redSub($);if(M.cmpn(0)===0)return T.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var C=M.redSqr(),B=C.redMul(M),N=w.redMul(C),H=T.redSqr().redIAdd(B).redISub(N).redISub(N),te=T.redMul(N.redISub(H)).redISub(E.redMul(B)),fe=this.z.redMul(u.z).redMul(M);return this.curve.jpoint(H,te,fe)},JPoint.prototype.mixedAdd=function(u){if(this.isInfinity())return u.toJ();if(u.isInfinity())return this;var h=this.z.redSqr(),v=this.x,w=u.x.redMul(h),b=this.y,E=u.y.redMul(h).redMul(this.z),$=v.redSub(w),M=b.redSub(E);if($.cmpn(0)===0)return M.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var T=$.redSqr(),C=T.redMul($),B=v.redMul(T),N=M.redSqr().redIAdd(C).redISub(B).redISub(B),H=M.redMul(B.redISub(N)).redISub(b.redMul(C)),te=this.z.redMul($);return this.curve.jpoint(N,H,te)},JPoint.prototype.dblp=function(u){if(u===0)return this;if(this.isInfinity())return this;if(!u)return this.dbl();var h;if(this.curve.zeroA||this.curve.threeA){var v=this;for(h=0;h<u;h++)v=v.dbl();return v}var w=this.curve.a,b=this.curve.tinv,E=this.x,$=this.y,M=this.z,T=M.redSqr().redSqr(),C=$.redAdd($);for(h=0;h<u;h++){var B=E.redSqr(),N=C.redSqr(),H=N.redSqr(),te=B.redAdd(B).redIAdd(B).redIAdd(w.redMul(T)),fe=E.redMul(N),ce=te.redSqr().redISub(fe.redAdd(fe)),le=fe.redISub(ce),ie=te.redMul(le);ie=ie.redIAdd(ie).redISub(H);var ge=C.redMul(M);h+1<u&&(T=T.redMul(H)),E=ce,M=ge,C=ie}return this.curve.jpoint(E,C.redMul(b),M)},JPoint.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},JPoint.prototype._zeroDbl=function(){var u,h,v;if(this.zOne){var w=this.x.redSqr(),b=this.y.redSqr(),E=b.redSqr(),$=this.x.redAdd(b).redSqr().redISub(w).redISub(E);$=$.redIAdd($);var M=w.redAdd(w).redIAdd(w),T=M.redSqr().redISub($).redISub($),C=E.redIAdd(E);C=C.redIAdd(C),C=C.redIAdd(C),u=T,h=M.redMul($.redISub(T)).redISub(C),v=this.y.redAdd(this.y)}else{var B=this.x.redSqr(),N=this.y.redSqr(),H=N.redSqr(),te=this.x.redAdd(N).redSqr().redISub(B).redISub(H);te=te.redIAdd(te);var fe=B.redAdd(B).redIAdd(B),ce=fe.redSqr(),le=H.redIAdd(H);le=le.redIAdd(le),le=le.redIAdd(le),u=ce.redISub(te).redISub(te),h=fe.redMul(te.redISub(u)).redISub(le),v=this.y.redMul(this.z),v=v.redIAdd(v)}return this.curve.jpoint(u,h,v)},JPoint.prototype._threeDbl=function(){var u,h,v;if(this.zOne){var w=this.x.redSqr(),b=this.y.redSqr(),E=b.redSqr(),$=this.x.redAdd(b).redSqr().redISub(w).redISub(E);$=$.redIAdd($);var M=w.redAdd(w).redIAdd(w).redIAdd(this.curve.a),T=M.redSqr().redISub($).redISub($);u=T;var C=E.redIAdd(E);C=C.redIAdd(C),C=C.redIAdd(C),h=M.redMul($.redISub(T)).redISub(C),v=this.y.redAdd(this.y)}else{var B=this.z.redSqr(),N=this.y.redSqr(),H=this.x.redMul(N),te=this.x.redSub(B).redMul(this.x.redAdd(B));te=te.redAdd(te).redIAdd(te);var fe=H.redIAdd(H);fe=fe.redIAdd(fe);var ce=fe.redAdd(fe);u=te.redSqr().redISub(ce),v=this.y.redAdd(this.z).redSqr().redISub(N).redISub(B);var le=N.redSqr();le=le.redIAdd(le),le=le.redIAdd(le),le=le.redIAdd(le),h=te.redMul(fe.redISub(u)).redISub(le)}return this.curve.jpoint(u,h,v)},JPoint.prototype._dbl=function(){var u=this.curve.a,h=this.x,v=this.y,w=this.z,b=w.redSqr().redSqr(),E=h.redSqr(),$=v.redSqr(),M=E.redAdd(E).redIAdd(E).redIAdd(u.redMul(b)),T=h.redAdd(h);T=T.redIAdd(T);var C=T.redMul($),B=M.redSqr().redISub(C.redAdd(C)),N=C.redISub(B),H=$.redSqr();H=H.redIAdd(H),H=H.redIAdd(H),H=H.redIAdd(H);var te=M.redMul(N).redISub(H),fe=v.redAdd(v).redMul(w);return this.curve.jpoint(B,te,fe)},JPoint.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var u=this.x.redSqr(),h=this.y.redSqr(),v=this.z.redSqr(),w=h.redSqr(),b=u.redAdd(u).redIAdd(u),E=b.redSqr(),$=this.x.redAdd(h).redSqr().redISub(u).redISub(w);$=$.redIAdd($),$=$.redAdd($).redIAdd($),$=$.redISub(E);var M=$.redSqr(),T=w.redIAdd(w);T=T.redIAdd(T),T=T.redIAdd(T),T=T.redIAdd(T);var C=b.redIAdd($).redSqr().redISub(E).redISub(M).redISub(T),B=h.redMul(C);B=B.redIAdd(B),B=B.redIAdd(B);var N=this.x.redMul(M).redISub(B);N=N.redIAdd(N),N=N.redIAdd(N);var H=this.y.redMul(C.redMul(T.redISub(C)).redISub($.redMul(M)));H=H.redIAdd(H),H=H.redIAdd(H),H=H.redIAdd(H);var te=this.z.redAdd($).redSqr().redISub(v).redISub(M);return this.curve.jpoint(N,H,te)},JPoint.prototype.mul=function(u,h){return u=new BN$8(u,h),this.curve._wnafMul(this,u)},JPoint.prototype.eq=function(u){if(u.type==="affine")return this.eq(u.toJ());if(this===u)return!0;var h=this.z.redSqr(),v=u.z.redSqr();if(this.x.redMul(v).redISub(u.x.redMul(h)).cmpn(0)!==0)return!1;var w=h.redMul(this.z),b=v.redMul(u.z);return this.y.redMul(b).redISub(u.y.redMul(w)).cmpn(0)===0},JPoint.prototype.eqXToP=function(u){var h=this.z.redSqr(),v=u.toRed(this.curve.red).redMul(h);if(this.x.cmp(v)===0)return!0;for(var w=u.clone(),b=this.curve.redN.redMul(h);;){if(w.iadd(this.curve.n),w.cmp(this.curve.p)>=0)return!1;if(v.redIAdd(b),this.x.cmp(v)===0)return!0}},JPoint.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},JPoint.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var BN$7=bnExports$1,inherits$3=inherits_browserExports,Base$1=base$1,utils$h=utils$l;function MontCurve(y){Base$1.call(this,"mont",y),this.a=new BN$7(y.a,16).toRed(this.red),this.b=new BN$7(y.b,16).toRed(this.red),this.i4=new BN$7(4).toRed(this.red).redInvm(),this.two=new BN$7(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$3(MontCurve,Base$1);var mont=MontCurve;MontCurve.prototype.validate=function(u){var h=u.normalize().x,v=h.redSqr(),w=v.redMul(h).redAdd(v.redMul(this.a)).redAdd(h),b=w.redSqrt();return b.redSqr().cmp(w)===0};function Point$2(y,u,h){Base$1.BasePoint.call(this,y,"projective"),u===null&&h===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$7(u,16),this.z=new BN$7(h,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$3(Point$2,Base$1.BasePoint),MontCurve.prototype.decodePoint=function(u,h){return this.point(utils$h.toArray(u,h),1)},MontCurve.prototype.point=function(u,h){return new Point$2(this,u,h)},MontCurve.prototype.pointFromJSON=function(u){return Point$2.fromJSON(this,u)},Point$2.prototype.precompute=function(){},Point$2.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point$2.fromJSON=function(u,h){return new Point$2(u,h[0],h[1]||u.one)},Point$2.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point$2.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Point$2.prototype.dbl=function(){var u=this.x.redAdd(this.z),h=u.redSqr(),v=this.x.redSub(this.z),w=v.redSqr(),b=h.redSub(w),E=h.redMul(w),$=b.redMul(w.redAdd(this.curve.a24.redMul(b)));return this.curve.point(E,$)},Point$2.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point$2.prototype.diffAdd=function(u,h){var v=this.x.redAdd(this.z),w=this.x.redSub(this.z),b=u.x.redAdd(u.z),E=u.x.redSub(u.z),$=E.redMul(v),M=b.redMul(w),T=h.z.redMul($.redAdd(M).redSqr()),C=h.x.redMul($.redISub(M).redSqr());return this.curve.point(T,C)},Point$2.prototype.mul=function(u){for(var h=u.clone(),v=this,w=this.curve.point(null,null),b=this,E=[];h.cmpn(0)!==0;h.iushrn(1))E.push(h.andln(1));for(var $=E.length-1;$>=0;$--)E[$]===0?(v=v.diffAdd(w,b),w=w.dbl()):(w=v.diffAdd(w,b),v=v.dbl());return w},Point$2.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$2.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$2.prototype.eq=function(u){return this.getX().cmp(u.getX())===0},Point$2.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point$2.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var utils$g=utils$l,BN$6=bnExports$1,inherits$2=inherits_browserExports,Base=base$1,assert$b=utils$g.assert;function EdwardsCurve(y){this.twisted=(y.a|0)!==1,this.mOneA=this.twisted&&(y.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",y),this.a=new BN$6(y.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$6(y.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$6(y.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$b(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(y.c|0)===1}inherits$2(EdwardsCurve,Base);var edwards=EdwardsCurve;EdwardsCurve.prototype._mulA=function(u){return this.mOneA?u.redNeg():this.a.redMul(u)},EdwardsCurve.prototype._mulC=function(u){return this.oneC?u:this.c.redMul(u)},EdwardsCurve.prototype.jpoint=function(u,h,v,w){return this.point(u,h,v,w)},EdwardsCurve.prototype.pointFromX=function(u,h){u=new BN$6(u,16),u.red||(u=u.toRed(this.red));var v=u.redSqr(),w=this.c2.redSub(this.a.redMul(v)),b=this.one.redSub(this.c2.redMul(this.d).redMul(v)),E=w.redMul(b.redInvm()),$=E.redSqrt();if($.redSqr().redSub(E).cmp(this.zero)!==0)throw new Error("invalid point");var M=$.fromRed().isOdd();return(h&&!M||!h&&M)&&($=$.redNeg()),this.point(u,$)},EdwardsCurve.prototype.pointFromY=function(u,h){u=new BN$6(u,16),u.red||(u=u.toRed(this.red));var v=u.redSqr(),w=v.redSub(this.c2),b=v.redMul(this.d).redMul(this.c2).redSub(this.a),E=w.redMul(b.redInvm());if(E.cmp(this.zero)===0){if(h)throw new Error("invalid point");return this.point(this.zero,u)}var $=E.redSqrt();if($.redSqr().redSub(E).cmp(this.zero)!==0)throw new Error("invalid point");return $.fromRed().isOdd()!==h&&($=$.redNeg()),this.point($,u)},EdwardsCurve.prototype.validate=function(u){if(u.isInfinity())return!0;u.normalize();var h=u.x.redSqr(),v=u.y.redSqr(),w=h.redMul(this.a).redAdd(v),b=this.c2.redMul(this.one.redAdd(this.d.redMul(h).redMul(v)));return w.cmp(b)===0};function Point$1(y,u,h,v,w){Base.BasePoint.call(this,y,"projective"),u===null&&h===null&&v===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$6(u,16),this.y=new BN$6(h,16),this.z=v?new BN$6(v,16):this.curve.one,this.t=w&&new BN$6(w,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}inherits$2(Point$1,Base.BasePoint),EdwardsCurve.prototype.pointFromJSON=function(u){return Point$1.fromJSON(this,u)},EdwardsCurve.prototype.point=function(u,h,v,w){return new Point$1(this,u,h,v,w)},Point$1.fromJSON=function(u,h){return new Point$1(u,h[0],h[1],h[2])},Point$1.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point$1.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Point$1.prototype._extDbl=function(){var u=this.x.redSqr(),h=this.y.redSqr(),v=this.z.redSqr();v=v.redIAdd(v);var w=this.curve._mulA(u),b=this.x.redAdd(this.y).redSqr().redISub(u).redISub(h),E=w.redAdd(h),$=E.redSub(v),M=w.redSub(h),T=b.redMul($),C=E.redMul(M),B=b.redMul(M),N=$.redMul(E);return this.curve.point(T,C,N,B)},Point$1.prototype._projDbl=function(){var u=this.x.redAdd(this.y).redSqr(),h=this.x.redSqr(),v=this.y.redSqr(),w,b,E,$,M,T;if(this.curve.twisted){$=this.curve._mulA(h);var C=$.redAdd(v);this.zOne?(w=u.redSub(h).redSub(v).redMul(C.redSub(this.curve.two)),b=C.redMul($.redSub(v)),E=C.redSqr().redSub(C).redSub(C)):(M=this.z.redSqr(),T=C.redSub(M).redISub(M),w=u.redSub(h).redISub(v).redMul(T),b=C.redMul($.redSub(v)),E=C.redMul(T))}else $=h.redAdd(v),M=this.curve._mulC(this.z).redSqr(),T=$.redSub(M).redSub(M),w=this.curve._mulC(u.redISub($)).redMul(T),b=this.curve._mulC($).redMul(h.redISub(v)),E=$.redMul(T);return this.curve.point(w,b,E)},Point$1.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point$1.prototype._extAdd=function(u){var h=this.y.redSub(this.x).redMul(u.y.redSub(u.x)),v=this.y.redAdd(this.x).redMul(u.y.redAdd(u.x)),w=this.t.redMul(this.curve.dd).redMul(u.t),b=this.z.redMul(u.z.redAdd(u.z)),E=v.redSub(h),$=b.redSub(w),M=b.redAdd(w),T=v.redAdd(h),C=E.redMul($),B=M.redMul(T),N=E.redMul(T),H=$.redMul(M);return this.curve.point(C,B,H,N)},Point$1.prototype._projAdd=function(u){var h=this.z.redMul(u.z),v=h.redSqr(),w=this.x.redMul(u.x),b=this.y.redMul(u.y),E=this.curve.d.redMul(w).redMul(b),$=v.redSub(E),M=v.redAdd(E),T=this.x.redAdd(this.y).redMul(u.x.redAdd(u.y)).redISub(w).redISub(b),C=h.redMul($).redMul(T),B,N;return this.curve.twisted?(B=h.redMul(M).redMul(b.redSub(this.curve._mulA(w))),N=$.redMul(M)):(B=h.redMul(M).redMul(b.redSub(w)),N=this.curve._mulC($).redMul(M)),this.curve.point(C,B,N)},Point$1.prototype.add=function(u){return this.isInfinity()?u:u.isInfinity()?this:this.curve.extended?this._extAdd(u):this._projAdd(u)},Point$1.prototype.mul=function(u){return this._hasDoubles(u)?this.curve._fixedNafMul(this,u):this.curve._wnafMul(this,u)},Point$1.prototype.mulAdd=function(u,h,v){return this.curve._wnafMulAdd(1,[this,h],[u,v],2,!1)},Point$1.prototype.jmulAdd=function(u,h,v){return this.curve._wnafMulAdd(1,[this,h],[u,v],2,!0)},Point$1.prototype.normalize=function(){if(this.zOne)return this;var u=this.z.redInvm();return this.x=this.x.redMul(u),this.y=this.y.redMul(u),this.t&&(this.t=this.t.redMul(u)),this.z=this.curve.one,this.zOne=!0,this},Point$1.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point$1.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point$1.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point$1.prototype.eq=function(u){return this===u||this.getX().cmp(u.getX())===0&&this.getY().cmp(u.getY())===0},Point$1.prototype.eqXToP=function(u){var h=u.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(h)===0)return!0;for(var v=u.clone(),w=this.curve.redN.redMul(this.z);;){if(v.iadd(this.curve.n),v.cmp(this.curve.p)>=0)return!1;if(h.redIAdd(w),this.x.cmp(h)===0)return!0}},Point$1.prototype.toP=Point$1.prototype.normalize,Point$1.prototype.mixedAdd=Point$1.prototype.add,function(y){var u=y;u.base=base$1,u.short=short,u.mont=mont,u.edwards=edwards}(curve);var curves$1={},hash$2={},utils$f={},assert$a=minimalisticAssert,inherits$1=inherits_browserExports;utils$f.inherits=inherits$1;function isSurrogatePair(y,u){return(y.charCodeAt(u)&64512)!==55296||u<0||u+1>=y.length?!1:(y.charCodeAt(u+1)&64512)===56320}function toArray(y,u){if(Array.isArray(y))return y.slice();if(!y)return[];var h=[];if(typeof y=="string")if(u){if(u==="hex")for(y=y.replace(/[^a-z0-9]+/ig,""),y.length%2!==0&&(y="0"+y),w=0;w<y.length;w+=2)h.push(parseInt(y[w]+y[w+1],16))}else for(var v=0,w=0;w<y.length;w++){var b=y.charCodeAt(w);b<128?h[v++]=b:b<2048?(h[v++]=b>>6|192,h[v++]=b&63|128):isSurrogatePair(y,w)?(b=65536+((b&1023)<<10)+(y.charCodeAt(++w)&1023),h[v++]=b>>18|240,h[v++]=b>>12&63|128,h[v++]=b>>6&63|128,h[v++]=b&63|128):(h[v++]=b>>12|224,h[v++]=b>>6&63|128,h[v++]=b&63|128)}else for(w=0;w<y.length;w++)h[w]=y[w]|0;return h}utils$f.toArray=toArray;function toHex(y){for(var u="",h=0;h<y.length;h++)u+=zero2(y[h].toString(16));return u}utils$f.toHex=toHex;function htonl(y){var u=y>>>24|y>>>8&65280|y<<8&16711680|(y&255)<<24;return u>>>0}utils$f.htonl=htonl;function toHex32(y,u){for(var h="",v=0;v<y.length;v++){var w=y[v];u==="little"&&(w=htonl(w)),h+=zero8(w.toString(16))}return h}utils$f.toHex32=toHex32;function zero2(y){return y.length===1?"0"+y:y}utils$f.zero2=zero2;function zero8(y){return y.length===7?"0"+y:y.length===6?"00"+y:y.length===5?"000"+y:y.length===4?"0000"+y:y.length===3?"00000"+y:y.length===2?"000000"+y:y.length===1?"0000000"+y:y}utils$f.zero8=zero8;function join32(y,u,h,v){var w=h-u;assert$a(w%4===0);for(var b=new Array(w/4),E=0,$=u;E<b.length;E++,$+=4){var M;v==="big"?M=y[$]<<24|y[$+1]<<16|y[$+2]<<8|y[$+3]:M=y[$+3]<<24|y[$+2]<<16|y[$+1]<<8|y[$],b[E]=M>>>0}return b}utils$f.join32=join32;function split32(y,u){for(var h=new Array(y.length*4),v=0,w=0;v<y.length;v++,w+=4){var b=y[v];u==="big"?(h[w]=b>>>24,h[w+1]=b>>>16&255,h[w+2]=b>>>8&255,h[w+3]=b&255):(h[w+3]=b>>>24,h[w+2]=b>>>16&255,h[w+1]=b>>>8&255,h[w]=b&255)}return h}utils$f.split32=split32;function rotr32$1(y,u){return y>>>u|y<<32-u}utils$f.rotr32=rotr32$1;function rotl32$2(y,u){return y<<u|y>>>32-u}utils$f.rotl32=rotl32$2;function sum32$3(y,u){return y+u>>>0}utils$f.sum32=sum32$3;function sum32_3$1(y,u,h){return y+u+h>>>0}utils$f.sum32_3=sum32_3$1;function sum32_4$2(y,u,h,v){return y+u+h+v>>>0}utils$f.sum32_4=sum32_4$2;function sum32_5$2(y,u,h,v,w){return y+u+h+v+w>>>0}utils$f.sum32_5=sum32_5$2;function sum64$1(y,u,h,v){var w=y[u],b=y[u+1],E=v+b>>>0,$=(E<v?1:0)+h+w;y[u]=$>>>0,y[u+1]=E}utils$f.sum64=sum64$1;function sum64_hi$1(y,u,h,v){var w=u+v>>>0,b=(w<u?1:0)+y+h;return b>>>0}utils$f.sum64_hi=sum64_hi$1;function sum64_lo$1(y,u,h,v){var w=u+v;return w>>>0}utils$f.sum64_lo=sum64_lo$1;function sum64_4_hi$1(y,u,h,v,w,b,E,$){var M=0,T=u;T=T+v>>>0,M+=T<u?1:0,T=T+b>>>0,M+=T<b?1:0,T=T+$>>>0,M+=T<$?1:0;var C=y+h+w+E+M;return C>>>0}utils$f.sum64_4_hi=sum64_4_hi$1;function sum64_4_lo$1(y,u,h,v,w,b,E,$){var M=u+v+b+$;return M>>>0}utils$f.sum64_4_lo=sum64_4_lo$1;function sum64_5_hi$1(y,u,h,v,w,b,E,$,M,T){var C=0,B=u;B=B+v>>>0,C+=B<u?1:0,B=B+b>>>0,C+=B<b?1:0,B=B+$>>>0,C+=B<$?1:0,B=B+T>>>0,C+=B<T?1:0;var N=y+h+w+E+M+C;return N>>>0}utils$f.sum64_5_hi=sum64_5_hi$1;function sum64_5_lo$1(y,u,h,v,w,b,E,$,M,T){var C=u+v+b+$+T;return C>>>0}utils$f.sum64_5_lo=sum64_5_lo$1;function rotr64_hi$1(y,u,h){var v=u<<32-h|y>>>h;return v>>>0}utils$f.rotr64_hi=rotr64_hi$1;function rotr64_lo$1(y,u,h){var v=y<<32-h|u>>>h;return v>>>0}utils$f.rotr64_lo=rotr64_lo$1;function shr64_hi$1(y,u,h){return y>>>h}utils$f.shr64_hi=shr64_hi$1;function shr64_lo$1(y,u,h){var v=y<<32-h|u>>>h;return v>>>0}utils$f.shr64_lo=shr64_lo$1;var common$6={},utils$e=utils$f,assert$9=minimalisticAssert;function BlockHash$4(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}common$6.BlockHash=BlockHash$4,BlockHash$4.prototype.update=function(u,h){if(u=utils$e.toArray(u,h),this.pending?this.pending=this.pending.concat(u):this.pending=u,this.pendingTotal+=u.length,this.pending.length>=this._delta8){u=this.pending;var v=u.length%this._delta8;this.pending=u.slice(u.length-v,u.length),this.pending.length===0&&(this.pending=null),u=utils$e.join32(u,0,u.length-v,this.endian);for(var w=0;w<u.length;w+=this._delta32)this._update(u,w,w+this._delta32)}return this},BlockHash$4.prototype.digest=function(u){return this.update(this._pad()),assert$9(this.pending===null),this._digest(u)},BlockHash$4.prototype._pad=function(){var u=this.pendingTotal,h=this._delta8,v=h-(u+this.padLength)%h,w=new Array(v+this.padLength);w[0]=128;for(var b=1;b<v;b++)w[b]=0;if(u<<=3,this.endian==="big"){for(var E=8;E<this.padLength;E++)w[b++]=0;w[b++]=0,w[b++]=0,w[b++]=0,w[b++]=0,w[b++]=u>>>24&255,w[b++]=u>>>16&255,w[b++]=u>>>8&255,w[b++]=u&255}else for(w[b++]=u&255,w[b++]=u>>>8&255,w[b++]=u>>>16&255,w[b++]=u>>>24&255,w[b++]=0,w[b++]=0,w[b++]=0,w[b++]=0,E=8;E<this.padLength;E++)w[b++]=0;return w};var sha={},common$5={},utils$d=utils$f,rotr32=utils$d.rotr32;function ft_1$1(y,u,h,v){if(y===0)return ch32$1(u,h,v);if(y===1||y===3)return p32(u,h,v);if(y===2)return maj32$1(u,h,v)}common$5.ft_1=ft_1$1;function ch32$1(y,u,h){return y&u^~y&h}common$5.ch32=ch32$1;function maj32$1(y,u,h){return y&u^y&h^u&h}common$5.maj32=maj32$1;function p32(y,u,h){return y^u^h}common$5.p32=p32;function s0_256$1(y){return rotr32(y,2)^rotr32(y,13)^rotr32(y,22)}common$5.s0_256=s0_256$1;function s1_256$1(y){return rotr32(y,6)^rotr32(y,11)^rotr32(y,25)}common$5.s1_256=s1_256$1;function g0_256$1(y){return rotr32(y,7)^rotr32(y,18)^y>>>3}common$5.g0_256=g0_256$1;function g1_256$1(y){return rotr32(y,17)^rotr32(y,19)^y>>>10}common$5.g1_256=g1_256$1;var utils$c=utils$f,common$4=common$6,shaCommon$1=common$5,rotl32$1=utils$c.rotl32,sum32$2=utils$c.sum32,sum32_5$1=utils$c.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$4.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$c.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512,SHA1.outSize=160,SHA1.hmacStrength=80,SHA1.padLength=64,SHA1.prototype._update=function(u,h){for(var v=this.W,w=0;w<16;w++)v[w]=u[h+w];for(;w<v.length;w++)v[w]=rotl32$1(v[w-3]^v[w-8]^v[w-14]^v[w-16],1);var b=this.h[0],E=this.h[1],$=this.h[2],M=this.h[3],T=this.h[4];for(w=0;w<v.length;w++){var C=~~(w/20),B=sum32_5$1(rotl32$1(b,5),ft_1(C,E,$,M),T,v[w],sha1_K[C]);T=M,M=$,$=rotl32$1(E,30),E=b,b=B}this.h[0]=sum32$2(this.h[0],b),this.h[1]=sum32$2(this.h[1],E),this.h[2]=sum32$2(this.h[2],$),this.h[3]=sum32$2(this.h[3],M),this.h[4]=sum32$2(this.h[4],T)},SHA1.prototype._digest=function(u){return u==="hex"?utils$c.toHex32(this.h,"big"):utils$c.split32(this.h,"big")};var utils$b=utils$f,common$3=common$6,shaCommon=common$5,assert$8=minimalisticAssert,sum32$1=utils$b.sum32,sum32_4$1=utils$b.sum32_4,sum32_5=utils$b.sum32_5,ch32=shaCommon.ch32,maj32=shaCommon.maj32,s0_256=shaCommon.s0_256,s1_256=shaCommon.s1_256,g0_256=shaCommon.g0_256,g1_256=shaCommon.g1_256,BlockHash$2=common$3.BlockHash,sha256_K=[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];function SHA256$1(){if(!(this instanceof SHA256$1))return new SHA256$1;BlockHash$2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=sha256_K,this.W=new Array(64)}utils$b.inherits(SHA256$1,BlockHash$2);var _256=SHA256$1;SHA256$1.blockSize=512,SHA256$1.outSize=256,SHA256$1.hmacStrength=192,SHA256$1.padLength=64,SHA256$1.prototype._update=function(u,h){for(var v=this.W,w=0;w<16;w++)v[w]=u[h+w];for(;w<v.length;w++)v[w]=sum32_4$1(g1_256(v[w-2]),v[w-7],g0_256(v[w-15]),v[w-16]);var b=this.h[0],E=this.h[1],$=this.h[2],M=this.h[3],T=this.h[4],C=this.h[5],B=this.h[6],N=this.h[7];for(assert$8(this.k.length===v.length),w=0;w<v.length;w++){var H=sum32_5(N,s1_256(T),ch32(T,C,B),this.k[w],v[w]),te=sum32$1(s0_256(b),maj32(b,E,$));N=B,B=C,C=T,T=sum32$1(M,H),M=$,$=E,E=b,b=sum32$1(H,te)}this.h[0]=sum32$1(this.h[0],b),this.h[1]=sum32$1(this.h[1],E),this.h[2]=sum32$1(this.h[2],$),this.h[3]=sum32$1(this.h[3],M),this.h[4]=sum32$1(this.h[4],T),this.h[5]=sum32$1(this.h[5],C),this.h[6]=sum32$1(this.h[6],B),this.h[7]=sum32$1(this.h[7],N)},SHA256$1.prototype._digest=function(u){return u==="hex"?utils$b.toHex32(this.h,"big"):utils$b.split32(this.h,"big")};var utils$a=utils$f,SHA256=_256;function SHA224(){if(!(this instanceof SHA224))return new SHA224;SHA256.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}utils$a.inherits(SHA224,SHA256);var _224=SHA224;SHA224.blockSize=512,SHA224.outSize=224,SHA224.hmacStrength=192,SHA224.padLength=64,SHA224.prototype._digest=function(u){return u==="hex"?utils$a.toHex32(this.h.slice(0,7),"big"):utils$a.split32(this.h.slice(0,7),"big")};var utils$9=utils$f,common$2=common$6,assert$7=minimalisticAssert,rotr64_hi=utils$9.rotr64_hi,rotr64_lo=utils$9.rotr64_lo,shr64_hi=utils$9.shr64_hi,shr64_lo=utils$9.shr64_lo,sum64=utils$9.sum64,sum64_hi=utils$9.sum64_hi,sum64_lo=utils$9.sum64_lo,sum64_4_hi=utils$9.sum64_4_hi,sum64_4_lo=utils$9.sum64_4_lo,sum64_5_hi=utils$9.sum64_5_hi,sum64_5_lo=utils$9.sum64_5_lo,BlockHash$1=common$2.BlockHash,sha512_K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512$1(){if(!(this instanceof SHA512$1))return new SHA512$1;BlockHash$1.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=sha512_K,this.W=new Array(160)}utils$9.inherits(SHA512$1,BlockHash$1);var _512=SHA512$1;SHA512$1.blockSize=1024,SHA512$1.outSize=512,SHA512$1.hmacStrength=192,SHA512$1.padLength=128,SHA512$1.prototype._prepareBlock=function(u,h){for(var v=this.W,w=0;w<32;w++)v[w]=u[h+w];for(;w<v.length;w+=2){var b=g1_512_hi(v[w-4],v[w-3]),E=g1_512_lo(v[w-4],v[w-3]),$=v[w-14],M=v[w-13],T=g0_512_hi(v[w-30],v[w-29]),C=g0_512_lo(v[w-30],v[w-29]),B=v[w-32],N=v[w-31];v[w]=sum64_4_hi(b,E,$,M,T,C,B,N),v[w+1]=sum64_4_lo(b,E,$,M,T,C,B,N)}},SHA512$1.prototype._update=function(u,h){this._prepareBlock(u,h);var v=this.W,w=this.h[0],b=this.h[1],E=this.h[2],$=this.h[3],M=this.h[4],T=this.h[5],C=this.h[6],B=this.h[7],N=this.h[8],H=this.h[9],te=this.h[10],fe=this.h[11],ce=this.h[12],le=this.h[13],ie=this.h[14],ge=this.h[15];assert$7(this.k.length===v.length);for(var pe=0;pe<v.length;pe+=2){var Me=ie,$e=ge,Pe=s1_512_hi(N,H),Be=s1_512_lo(N,H),Re=ch64_hi(N,H,te,fe,ce),je=ch64_lo(N,H,te,fe,ce,le),we=this.k[pe],D=this.k[pe+1],q=v[pe],O=v[pe+1],L=sum64_5_hi(Me,$e,Pe,Be,Re,je,we,D,q,O),X=sum64_5_lo(Me,$e,Pe,Be,Re,je,we,D,q,O);Me=s0_512_hi(w,b),$e=s0_512_lo(w,b),Pe=maj64_hi(w,b,E,$,M),Be=maj64_lo(w,b,E,$,M,T);var j=sum64_hi(Me,$e,Pe,Be),re=sum64_lo(Me,$e,Pe,Be);ie=ce,ge=le,ce=te,le=fe,te=N,fe=H,N=sum64_hi(C,B,L,X),H=sum64_lo(B,B,L,X),C=M,B=T,M=E,T=$,E=w,$=b,w=sum64_hi(L,X,j,re),b=sum64_lo(L,X,j,re)}sum64(this.h,0,w,b),sum64(this.h,2,E,$),sum64(this.h,4,M,T),sum64(this.h,6,C,B),sum64(this.h,8,N,H),sum64(this.h,10,te,fe),sum64(this.h,12,ce,le),sum64(this.h,14,ie,ge)},SHA512$1.prototype._digest=function(u){return u==="hex"?utils$9.toHex32(this.h,"big"):utils$9.split32(this.h,"big")};function ch64_hi(y,u,h,v,w){var b=y&h^~y&w;return b<0&&(b+=4294967296),b}function ch64_lo(y,u,h,v,w,b){var E=u&v^~u&b;return E<0&&(E+=4294967296),E}function maj64_hi(y,u,h,v,w){var b=y&h^y&w^h&w;return b<0&&(b+=4294967296),b}function maj64_lo(y,u,h,v,w,b){var E=u&v^u&b^v&b;return E<0&&(E+=4294967296),E}function s0_512_hi(y,u){var h=rotr64_hi(y,u,28),v=rotr64_hi(u,y,2),w=rotr64_hi(u,y,7),b=h^v^w;return b<0&&(b+=4294967296),b}function s0_512_lo(y,u){var h=rotr64_lo(y,u,28),v=rotr64_lo(u,y,2),w=rotr64_lo(u,y,7),b=h^v^w;return b<0&&(b+=4294967296),b}function s1_512_hi(y,u){var h=rotr64_hi(y,u,14),v=rotr64_hi(y,u,18),w=rotr64_hi(u,y,9),b=h^v^w;return b<0&&(b+=4294967296),b}function s1_512_lo(y,u){var h=rotr64_lo(y,u,14),v=rotr64_lo(y,u,18),w=rotr64_lo(u,y,9),b=h^v^w;return b<0&&(b+=4294967296),b}function g0_512_hi(y,u){var h=rotr64_hi(y,u,1),v=rotr64_hi(y,u,8),w=shr64_hi(y,u,7),b=h^v^w;return b<0&&(b+=4294967296),b}function g0_512_lo(y,u){var h=rotr64_lo(y,u,1),v=rotr64_lo(y,u,8),w=shr64_lo(y,u,7),b=h^v^w;return b<0&&(b+=4294967296),b}function g1_512_hi(y,u){var h=rotr64_hi(y,u,19),v=rotr64_hi(u,y,29),w=shr64_hi(y,u,6),b=h^v^w;return b<0&&(b+=4294967296),b}function g1_512_lo(y,u){var h=rotr64_lo(y,u,19),v=rotr64_lo(u,y,29),w=shr64_lo(y,u,6),b=h^v^w;return b<0&&(b+=4294967296),b}var utils$8=utils$f,SHA512=_512;function SHA384(){if(!(this instanceof SHA384))return new SHA384;SHA512.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}utils$8.inherits(SHA384,SHA512);var _384=SHA384;SHA384.blockSize=1024,SHA384.outSize=384,SHA384.hmacStrength=192,SHA384.padLength=128,SHA384.prototype._digest=function(u){return u==="hex"?utils$8.toHex32(this.h.slice(0,12),"big"):utils$8.split32(this.h.slice(0,12),"big")},sha.sha1=_1,sha.sha224=_224,sha.sha256=_256,sha.sha384=_384,sha.sha512=_512;var ripemd={},utils$7=utils$f,common$1=common$6,rotl32=utils$7.rotl32,sum32=utils$7.sum32,sum32_3=utils$7.sum32_3,sum32_4=utils$7.sum32_4,BlockHash=common$1.BlockHash;function RIPEMD160(){if(!(this instanceof RIPEMD160))return new RIPEMD160;BlockHash.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}utils$7.inherits(RIPEMD160,BlockHash),ripemd.ripemd160=RIPEMD160,RIPEMD160.blockSize=512,RIPEMD160.outSize=160,RIPEMD160.hmacStrength=192,RIPEMD160.padLength=64,RIPEMD160.prototype._update=function(u,h){for(var v=this.h[0],w=this.h[1],b=this.h[2],E=this.h[3],$=this.h[4],M=v,T=w,C=b,B=E,N=$,H=0;H<80;H++){var te=sum32(rotl32(sum32_4(v,f(H,w,b,E),u[r[H]+h],K(H)),s[H]),$);v=$,$=E,E=rotl32(b,10),b=w,w=te,te=sum32(rotl32(sum32_4(M,f(79-H,T,C,B),u[rh[H]+h],Kh(H)),sh[H]),N),M=N,N=B,B=rotl32(C,10),C=T,T=te}te=sum32_3(this.h[1],b,B),this.h[1]=sum32_3(this.h[2],E,N),this.h[2]=sum32_3(this.h[3],$,M),this.h[3]=sum32_3(this.h[4],v,T),this.h[4]=sum32_3(this.h[0],w,C),this.h[0]=te},RIPEMD160.prototype._digest=function(u){return u==="hex"?utils$7.toHex32(this.h,"little"):utils$7.split32(this.h,"little")};function f(y,u,h,v){return y<=15?u^h^v:y<=31?u&h|~u&v:y<=47?(u|~h)^v:y<=63?u&v|h&~v:u^(h|~v)}function K(y){return y<=15?0:y<=31?1518500249:y<=47?1859775393:y<=63?2400959708:2840853838}function Kh(y){return y<=15?1352829926:y<=31?1548603684:y<=47?1836072691:y<=63?2053994217:0}var r=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],rh=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sh=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],utils$6=utils$f,assert$6=minimalisticAssert;function Hmac(y,u,h){if(!(this instanceof Hmac))return new Hmac(y,u,h);this.Hash=y,this.blockSize=y.blockSize/8,this.outSize=y.outSize/8,this.inner=null,this.outer=null,this._init(utils$6.toArray(u,h))}var hmac=Hmac;Hmac.prototype._init=function(u){u.length>this.blockSize&&(u=new this.Hash().update(u).digest()),assert$6(u.length<=this.blockSize);for(var h=u.length;h<this.blockSize;h++)u.push(0);for(h=0;h<u.length;h++)u[h]^=54;for(this.inner=new this.Hash().update(u),h=0;h<u.length;h++)u[h]^=106;this.outer=new this.Hash().update(u)},Hmac.prototype.update=function(u,h){return this.inner.update(u,h),this},Hmac.prototype.digest=function(u){return this.outer.update(this.inner.digest()),this.outer.digest(u)},function(y){var u=y;u.utils=utils$f,u.common=common$6,u.sha=sha,u.ripemd=ripemd,u.hmac=hmac,u.sha1=u.sha.sha1,u.sha256=u.sha.sha256,u.sha224=u.sha.sha224,u.sha384=u.sha.sha384,u.sha512=u.sha.sha512,u.ripemd160=u.ripemd.ripemd160}(hash$2);var secp256k1,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1||(hasRequiredSecp256k1=1,secp256k1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1}(function(y){var u=y,h=hash$2,v=curve,w=utils$l,b=w.assert;function E(T){T.type==="short"?this.curve=new v.short(T):T.type==="edwards"?this.curve=new v.edwards(T):this.curve=new v.mont(T),this.g=this.curve.g,this.n=this.curve.n,this.hash=T.hash,b(this.g.validate(),"Invalid curve"),b(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}u.PresetCurve=E;function $(T,C){Object.defineProperty(u,T,{configurable:!0,enumerable:!0,get:function(){var B=new E(C);return Object.defineProperty(u,T,{configurable:!0,enumerable:!0,value:B}),B}})}$("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:h.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),$("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:h.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),$("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:h.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),$("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:h.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),$("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:h.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),$("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:h.sha256,gRed:!1,g:["9"]}),$("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:h.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var M;try{M=requireSecp256k1()}catch{M=void 0}$("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:h.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",M]})})(curves$1);var hash$1=hash$2,utils$5=utils$k,assert$5=minimalisticAssert;function HmacDRBG(y){if(!(this instanceof HmacDRBG))return new HmacDRBG(y);this.hash=y.hash,this.predResist=!!y.predResist,this.outLen=this.hash.outSize,this.minEntropy=y.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var u=utils$5.toArray(y.entropy,y.entropyEnc||"hex"),h=utils$5.toArray(y.nonce,y.nonceEnc||"hex"),v=utils$5.toArray(y.pers,y.persEnc||"hex");assert$5(u.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(u,h,v)}var hmacDrbg=HmacDRBG;HmacDRBG.prototype._init=function(u,h,v){var w=u.concat(h).concat(v);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var b=0;b<this.V.length;b++)this.K[b]=0,this.V[b]=1;this._update(w),this._reseed=1,this.reseedInterval=281474976710656},HmacDRBG.prototype._hmac=function(){return new hash$1.hmac(this.hash,this.K)},HmacDRBG.prototype._update=function(u){var h=this._hmac().update(this.V).update([0]);u&&(h=h.update(u)),this.K=h.digest(),this.V=this._hmac().update(this.V).digest(),u&&(this.K=this._hmac().update(this.V).update([1]).update(u).digest(),this.V=this._hmac().update(this.V).digest())},HmacDRBG.prototype.reseed=function(u,h,v,w){typeof h!="string"&&(w=v,v=h,h=null),u=utils$5.toArray(u,h),v=utils$5.toArray(v,w),assert$5(u.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(u.concat(v||[])),this._reseed=1},HmacDRBG.prototype.generate=function(u,h,v,w){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof h!="string"&&(w=v,v=h,h=null),v&&(v=utils$5.toArray(v,w||"hex"),this._update(v));for(var b=[];b.length<u;)this.V=this._hmac().update(this.V).digest(),b=b.concat(this.V);var E=b.slice(0,u);return this._update(v),this._reseed++,utils$5.encode(E,h)};var BN$5=bnExports$1,utils$4=utils$l,assert$4=utils$4.assert;function KeyPair$2(y,u){this.ec=y,this.priv=null,this.pub=null,u.priv&&this._importPrivate(u.priv,u.privEnc),u.pub&&this._importPublic(u.pub,u.pubEnc)}var key$1=KeyPair$2;KeyPair$2.fromPublic=function(u,h,v){return h instanceof KeyPair$2?h:new KeyPair$2(u,{pub:h,pubEnc:v})},KeyPair$2.fromPrivate=function(u,h,v){return h instanceof KeyPair$2?h:new KeyPair$2(u,{priv:h,privEnc:v})},KeyPair$2.prototype.validate=function(){var u=this.getPublic();return u.isInfinity()?{result:!1,reason:"Invalid public key"}:u.validate()?u.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair$2.prototype.getPublic=function(u,h){return typeof u=="string"&&(h=u,u=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),h?this.pub.encode(h,u):this.pub},KeyPair$2.prototype.getPrivate=function(u){return u==="hex"?this.priv.toString(16,2):this.priv},KeyPair$2.prototype._importPrivate=function(u,h){this.priv=new BN$5(u,h||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair$2.prototype._importPublic=function(u,h){if(u.x||u.y){this.ec.curve.type==="mont"?assert$4(u.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$4(u.x&&u.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(u.x,u.y);return}this.pub=this.ec.curve.decodePoint(u,h)},KeyPair$2.prototype.derive=function(u){return u.validate()||assert$4(u.validate(),"public point not validated"),u.mul(this.priv).getX()},KeyPair$2.prototype.sign=function(u,h,v){return this.ec.sign(u,this,h,v)},KeyPair$2.prototype.verify=function(u,h){return this.ec.verify(u,h,this)},KeyPair$2.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$4=bnExports$1,utils$3=utils$l,assert$3=utils$3.assert;function Signature$3(y,u){if(y instanceof Signature$3)return y;this._importDER(y,u)||(assert$3(y.r&&y.s,"Signature without r or s"),this.r=new BN$4(y.r,16),this.s=new BN$4(y.s,16),y.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=y.recoveryParam)}var signature$1=Signature$3;function Position(){this.place=0}function getLength(y,u){var h=y[u.place++];if(!(h&128))return h;var v=h&15;if(v===0||v>4||y[u.place]===0)return!1;for(var w=0,b=0,E=u.place;b<v;b++,E++)w<<=8,w|=y[E],w>>>=0;return w<=127?!1:(u.place=E,w)}function rmPadding(y){for(var u=0,h=y.length-1;!y[u]&&!(y[u+1]&128)&&u<h;)u++;return u===0?y:y.slice(u)}Signature$3.prototype._importDER=function(u,h){u=utils$3.toArray(u,h);var v=new Position;if(u[v.place++]!==48)return!1;var w=getLength(u,v);if(w===!1||w+v.place!==u.length||u[v.place++]!==2)return!1;var b=getLength(u,v);if(b===!1||u[v.place]&128)return!1;var E=u.slice(v.place,b+v.place);if(v.place+=b,u[v.place++]!==2)return!1;var $=getLength(u,v);if($===!1||u.length!==$+v.place||u[v.place]&128)return!1;var M=u.slice(v.place,$+v.place);if(E[0]===0)if(E[1]&128)E=E.slice(1);else return!1;if(M[0]===0)if(M[1]&128)M=M.slice(1);else return!1;return this.r=new BN$4(E),this.s=new BN$4(M),this.recoveryParam=null,!0};function constructLength(y,u){if(u<128){y.push(u);return}var h=1+(Math.log(u)/Math.LN2>>>3);for(y.push(h|128);--h;)y.push(u>>>(h<<3)&255);y.push(u)}Signature$3.prototype.toDER=function(u){var h=this.r.toArray(),v=this.s.toArray();for(h[0]&128&&(h=[0].concat(h)),v[0]&128&&(v=[0].concat(v)),h=rmPadding(h),v=rmPadding(v);!v[0]&&!(v[1]&128);)v=v.slice(1);var w=[2];constructLength(w,h.length),w=w.concat(h),w.push(2),constructLength(w,v.length);var b=w.concat(v),E=[48];return constructLength(E,b.length),E=E.concat(b),utils$3.encode(E,u)};var ec,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec;hasRequiredEc=1;var y=bnExports$1,u=hmacDrbg,h=utils$l,v=curves$1,w=requireBrorand(),b=h.assert,E=key$1,$=signature$1;function M(T){if(!(this instanceof M))return new M(T);typeof T=="string"&&(b(Object.prototype.hasOwnProperty.call(v,T),"Unknown curve "+T),T=v[T]),T instanceof v.PresetCurve&&(T={curve:T}),this.curve=T.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=T.curve.g,this.g.precompute(T.curve.n.bitLength()+1),this.hash=T.hash||T.curve.hash}return ec=M,M.prototype.keyPair=function(C){return new E(this,C)},M.prototype.keyFromPrivate=function(C,B){return E.fromPrivate(this,C,B)},M.prototype.keyFromPublic=function(C,B){return E.fromPublic(this,C,B)},M.prototype.genKeyPair=function(C){C||(C={});for(var B=new u({hash:this.hash,pers:C.pers,persEnc:C.persEnc||"utf8",entropy:C.entropy||w(this.hash.hmacStrength),entropyEnc:C.entropy&&C.entropyEnc||"utf8",nonce:this.n.toArray()}),N=this.n.byteLength(),H=this.n.sub(new y(2));;){var te=new y(B.generate(N));if(!(te.cmp(H)>0))return te.iaddn(1),this.keyFromPrivate(te)}},M.prototype._truncateToN=function(C,B){var N=C.byteLength()*8-this.n.bitLength();return N>0&&(C=C.ushrn(N)),!B&&C.cmp(this.n)>=0?C.sub(this.n):C},M.prototype.sign=function(C,B,N,H){typeof N=="object"&&(H=N,N=null),H||(H={}),B=this.keyFromPrivate(B,N),C=this._truncateToN(new y(C,16));for(var te=this.n.byteLength(),fe=B.getPrivate().toArray("be",te),ce=C.toArray("be",te),le=new u({hash:this.hash,entropy:fe,nonce:ce,pers:H.pers,persEnc:H.persEnc||"utf8"}),ie=this.n.sub(new y(1)),ge=0;;ge++){var pe=H.k?H.k(ge):new y(le.generate(this.n.byteLength()));if(pe=this._truncateToN(pe,!0),!(pe.cmpn(1)<=0||pe.cmp(ie)>=0)){var Me=this.g.mul(pe);if(!Me.isInfinity()){var $e=Me.getX(),Pe=$e.umod(this.n);if(Pe.cmpn(0)!==0){var Be=pe.invm(this.n).mul(Pe.mul(B.getPrivate()).iadd(C));if(Be=Be.umod(this.n),Be.cmpn(0)!==0){var Re=(Me.getY().isOdd()?1:0)|($e.cmp(Pe)!==0?2:0);return H.canonical&&Be.cmp(this.nh)>0&&(Be=this.n.sub(Be),Re^=1),new $({r:Pe,s:Be,recoveryParam:Re})}}}}}},M.prototype.verify=function(C,B,N,H){C=this._truncateToN(new y(C,16)),N=this.keyFromPublic(N,H),B=new $(B,"hex");var te=B.r,fe=B.s;if(te.cmpn(1)<0||te.cmp(this.n)>=0||fe.cmpn(1)<0||fe.cmp(this.n)>=0)return!1;var ce=fe.invm(this.n),le=ce.mul(C).umod(this.n),ie=ce.mul(te).umod(this.n),ge;return this.curve._maxwellTrick?(ge=this.g.jmulAdd(le,N.getPublic(),ie),ge.isInfinity()?!1:ge.eqXToP(te)):(ge=this.g.mulAdd(le,N.getPublic(),ie),ge.isInfinity()?!1:ge.getX().umod(this.n).cmp(te)===0)},M.prototype.recoverPubKey=function(T,C,B,N){b((3&B)===B,"The recovery param is more than two bits"),C=new $(C,N);var H=this.n,te=new y(T),fe=C.r,ce=C.s,le=B&1,ie=B>>1;if(fe.cmp(this.curve.p.umod(this.curve.n))>=0&&ie)throw new Error("Unable to find sencond key candinate");ie?fe=this.curve.pointFromX(fe.add(this.curve.n),le):fe=this.curve.pointFromX(fe,le);var ge=C.r.invm(H),pe=H.sub(te).mul(ge).umod(H),Me=ce.mul(ge).umod(H);return this.g.mulAdd(pe,fe,Me)},M.prototype.getKeyRecoveryParam=function(T,C,B,N){if(C=new $(C,N),C.recoveryParam!==null)return C.recoveryParam;for(var H=0;H<4;H++){var te;try{te=this.recoverPubKey(T,C,H)}catch{continue}if(te.eq(B))return H}throw new Error("Unable to find valid recovery factor")},ec}var utils$2=utils$l,assert$2=utils$2.assert,parseBytes$2=utils$2.parseBytes,cachedProperty$1=utils$2.cachedProperty;function KeyPair$1(y,u){this.eddsa=y,this._secret=parseBytes$2(u.secret),y.isPoint(u.pub)?this._pub=u.pub:this._pubBytes=parseBytes$2(u.pub)}KeyPair$1.fromPublic=function(u,h){return h instanceof KeyPair$1?h:new KeyPair$1(u,{pub:h})},KeyPair$1.fromSecret=function(u,h){return h instanceof KeyPair$1?h:new KeyPair$1(u,{secret:h})},KeyPair$1.prototype.secret=function(){return this._secret},cachedProperty$1(KeyPair$1,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),cachedProperty$1(KeyPair$1,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),cachedProperty$1(KeyPair$1,"privBytes",function(){var u=this.eddsa,h=this.hash(),v=u.encodingLength-1,w=h.slice(0,u.encodingLength);return w[0]&=248,w[v]&=127,w[v]|=64,w}),cachedProperty$1(KeyPair$1,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),cachedProperty$1(KeyPair$1,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),cachedProperty$1(KeyPair$1,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),KeyPair$1.prototype.sign=function(u){return assert$2(this._secret,"KeyPair can only verify"),this.eddsa.sign(u,this)},KeyPair$1.prototype.verify=function(u,h){return this.eddsa.verify(u,h,this)},KeyPair$1.prototype.getSecret=function(u){return assert$2(this._secret,"KeyPair is public only"),utils$2.encode(this.secret(),u)},KeyPair$1.prototype.getPublic=function(u){return utils$2.encode(this.pubBytes(),u)};var key=KeyPair$1,BN$3=bnExports$1,utils$1=utils$l,assert$1=utils$1.assert,cachedProperty=utils$1.cachedProperty,parseBytes$1=utils$1.parseBytes;function Signature$2(y,u){this.eddsa=y,typeof u!="object"&&(u=parseBytes$1(u)),Array.isArray(u)&&(assert$1(u.length===y.encodingLength*2,"Signature has invalid size"),u={R:u.slice(0,y.encodingLength),S:u.slice(y.encodingLength)}),assert$1(u.R&&u.S,"Signature without R or S"),y.isPoint(u.R)&&(this._R=u.R),u.S instanceof BN$3&&(this._S=u.S),this._Rencoded=Array.isArray(u.R)?u.R:u.Rencoded,this._Sencoded=Array.isArray(u.S)?u.S:u.Sencoded}cachedProperty(Signature$2,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),cachedProperty(Signature$2,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),cachedProperty(Signature$2,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),cachedProperty(Signature$2,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Signature$2.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Signature$2.prototype.toHex=function(){return utils$1.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$2,hash=hash$2,curves=curves$1,utils=utils$l,assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=key,Signature$1=signature;function EDDSA(y){if(assert(y==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(y);y=curves[y].curve,this.curve=y,this.g=y.g,this.g.precompute(y.n.bitLength()+1),this.pointClass=y.point().constructor,this.encodingLength=Math.ceil(y.n.bitLength()/8),this.hash=hash.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function(u,h){u=parseBytes(u);var v=this.keyFromSecret(h),w=this.hashInt(v.messagePrefix(),u),b=this.g.mul(w),E=this.encodePoint(b),$=this.hashInt(E,v.pubBytes(),u).mul(v.priv()),M=w.add($).umod(this.curve.n);return this.makeSignature({R:b,S:M,Rencoded:E})},EDDSA.prototype.verify=function(u,h,v){if(u=parseBytes(u),h=this.makeSignature(h),h.S().gte(h.eddsa.curve.n)||h.S().isNeg())return!1;var w=this.keyFromPublic(v),b=this.hashInt(h.Rencoded(),w.pubBytes(),u),E=this.g.mul(h.S()),$=h.R().add(w.pub().mul(b));return $.eq(E)},EDDSA.prototype.hashInt=function(){for(var u=this.hash(),h=0;h<arguments.length;h++)u.update(arguments[h]);return utils.intFromLE(u.digest()).umod(this.curve.n)},EDDSA.prototype.keyFromPublic=function(u){return KeyPair.fromPublic(this,u)},EDDSA.prototype.keyFromSecret=function(u){return KeyPair.fromSecret(this,u)},EDDSA.prototype.makeSignature=function(u){return u instanceof Signature$1?u:new Signature$1(this,u)},EDDSA.prototype.encodePoint=function(u){var h=u.getY().toArray("le",this.encodingLength);return h[this.encodingLength-1]|=u.getX().isOdd()?128:0,h},EDDSA.prototype.decodePoint=function(u){u=utils.parseBytes(u);var h=u.length-1,v=u.slice(0,h).concat(u[h]&-129),w=(u[h]&128)!==0,b=utils.intFromLE(v);return this.curve.pointFromY(b,w)},EDDSA.prototype.encodeInt=function(u){return u.toArray("le",this.encodingLength)},EDDSA.prototype.decodeInt=function(u){return utils.intFromLE(u)},EDDSA.prototype.isPoint=function(u){return u instanceof this.pointClass};var hasRequiredElliptic;function requireElliptic(){return hasRequiredElliptic||(hasRequiredElliptic=1,function(y){var u=y;u.version=require$$0.version,u.utils=utils$l,u.rand=requireBrorand(),u.curve=curve,u.curves=curves$1,u.ec=requireEc(),u.eddsa=eddsa}(elliptic)),elliptic}var asn1$3={},asn1$2={},api={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(y,u){if(y.indexOf)return y.indexOf(u);for(var h=0;h<y.length;h++)if(y[h]===u)return h;return-1},Object_keys=function(y){if(Object.keys)return Object.keys(y);var u=[];for(var h in y)u.push(h);return u},forEach=function(y,u){if(y.forEach)return y.forEach(u);for(var h=0;h<y.length;h++)u(y[h],h,y)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(y,u,h){Object.defineProperty(y,u,{writable:!0,enumerable:!1,configurable:!0,value:h})}}catch{return function(u,h,v){u[h]=v}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(u){if(!(this instanceof Script))return new Script(u);this.code=u};Script.prototype.runInContext=function(y){if(!(y instanceof Context))throw new TypeError("needs a 'context' argument.");var u=document.createElement("iframe");u.style||(u.style={}),u.style.display="none",document.body.appendChild(u);var h=u.contentWindow,v=h.eval,w=h.execScript;!v&&w&&(w.call(h,"null"),v=h.eval),forEach(Object_keys(y),function($){h[$]=y[$]}),forEach(globals,function($){y[$]&&(h[$]=y[$])});var b=Object_keys(h),E=v.call(h,this.code);return forEach(Object_keys(h),function($){($ in y||indexOf(b,$)===-1)&&(y[$]=h[$])}),forEach(globals,function($){$ in y||defineProp(y,$,h[$])}),document.body.removeChild(u),E},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(y){var u=Script.createContext(y),h=this.runInContext(u);return y&&forEach(Object_keys(u),function(v){y[v]=u[v]}),h},forEach(Object_keys(Script.prototype),function(y){exports[y]=Script[y]=function(u){var h=Script(u);return h[y].apply(h,[].slice.call(arguments,1))}}),exports.isContext=function(y){return y instanceof Context},exports.createScript=function(y){return exports.Script(y)},exports.createContext=Script.createContext=function(y){var u=new Context;return typeof y=="object"&&forEach(Object_keys(y),function(h){u[h]=y[h]}),u}}(vmBrowserify)),vmBrowserify}var hasRequiredApi;function requireApi(){return hasRequiredApi||(hasRequiredApi=1,function(y){var u=requireAsn1(),h=inherits_browserExports,v=y;v.define=function(E,$){return new w(E,$)};function w(b,E){this.name=b,this.body=E,this.decoders={},this.encoders={}}w.prototype._createNamed=function(E){var $;try{$=requireVmBrowserify().runInThisContext("(function "+this.name+`(entity) {
|
|
27
|
-
this._initNamed(entity);
|
|
28
|
-
})`)}catch{$=function(T){this._initNamed(T)}}return h($,E),$.prototype._initNamed=function(T){E.call(this,T)},new $(this)},w.prototype._getDecoder=function(E){return E=E||"der",this.decoders.hasOwnProperty(E)||(this.decoders[E]=this._createNamed(u.decoders[E])),this.decoders[E]},w.prototype.decode=function(E,$,M){return this._getDecoder($).decode(E,M)},w.prototype._getEncoder=function(E){return E=E||"der",this.encoders.hasOwnProperty(E)||(this.encoders[E]=this._createNamed(u.encoders[E])),this.encoders[E]},w.prototype.encode=function(E,$,M){return this._getEncoder($).encode(E,M)}}(api)),api}var base={},reporter={},inherits=inherits_browserExports;function Reporter(y){this._reporterState={obj:null,path:[],options:y||{},errors:[]}}reporter.Reporter=Reporter,Reporter.prototype.isError=function y(u){return u instanceof ReporterError},Reporter.prototype.save=function y(){var u=this._reporterState;return{obj:u.obj,pathLen:u.path.length}},Reporter.prototype.restore=function y(u){var h=this._reporterState;h.obj=u.obj,h.path=h.path.slice(0,u.pathLen)},Reporter.prototype.enterKey=function y(u){return this._reporterState.path.push(u)},Reporter.prototype.exitKey=function y(u){var h=this._reporterState;h.path=h.path.slice(0,u-1)},Reporter.prototype.leaveKey=function y(u,h,v){var w=this._reporterState;this.exitKey(u),w.obj!==null&&(w.obj[h]=v)},Reporter.prototype.path=function y(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function y(){var u=this._reporterState,h=u.obj;return u.obj={},h},Reporter.prototype.leaveObject=function y(u){var h=this._reporterState,v=h.obj;return h.obj=u,v},Reporter.prototype.error=function y(u){var h,v=this._reporterState,w=u instanceof ReporterError;if(w?h=u:h=new ReporterError(v.path.map(function(b){return"["+JSON.stringify(b)+"]"}).join(""),u.message||u,u.stack),!v.options.partial)throw h;return w||v.errors.push(h),h},Reporter.prototype.wrapResult=function y(u){var h=this._reporterState;return h.options.partial?{result:this.isError(u)?null:u,errors:h.errors}:u};function ReporterError(y,u){this.path=y,this.rethrow(u)}inherits(ReporterError,Error),ReporterError.prototype.rethrow=function y(u){if(this.message=u+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(h){this.stack=h.stack}return this};var buffer={},hasRequiredBuffer;function requireBuffer(){if(hasRequiredBuffer)return buffer;hasRequiredBuffer=1;var y=inherits_browserExports,u=requireBase().Reporter,h=dist.Buffer;function v(b,E){if(u.call(this,E),!h.isBuffer(b)){this.error("Input not Buffer");return}this.base=b,this.offset=0,this.length=b.length}y(v,u),buffer.DecoderBuffer=v,v.prototype.save=function(){return{offset:this.offset,reporter:u.prototype.save.call(this)}},v.prototype.restore=function(E){var $=new v(this.base);return $.offset=E.offset,$.length=this.offset,this.offset=E.offset,u.prototype.restore.call(this,E.reporter),$},v.prototype.isEmpty=function(){return this.offset===this.length},v.prototype.readUInt8=function(E){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(E||"DecoderBuffer overrun")},v.prototype.skip=function(E,$){if(!(this.offset+E<=this.length))return this.error($||"DecoderBuffer overrun");var M=new v(this.base);return M._reporterState=this._reporterState,M.offset=this.offset,M.length=this.offset+E,this.offset+=E,M},v.prototype.raw=function(E){return this.base.slice(E?E.offset:this.offset,this.length)};function w(b,E){if(Array.isArray(b))this.length=0,this.value=b.map(function($){return $ instanceof w||($=new w($,E)),this.length+=$.length,$},this);else if(typeof b=="number"){if(!(0<=b&&b<=255))return E.error("non-byte EncoderBuffer value");this.value=b,this.length=1}else if(typeof b=="string")this.value=b,this.length=h.byteLength(b);else if(h.isBuffer(b))this.value=b,this.length=b.length;else return E.error("Unsupported type: "+typeof b)}return buffer.EncoderBuffer=w,w.prototype.join=function(E,$){return E||(E=new h(this.length)),$||($=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(M){M.join(E,$),$+=M.length}):(typeof this.value=="number"?E[$]=this.value:typeof this.value=="string"?E.write(this.value,$):h.isBuffer(this.value)&&this.value.copy(E,$),$+=this.length)),E},buffer}var node,hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;var y=requireBase().Reporter,u=requireBase().EncoderBuffer,h=requireBase().DecoderBuffer,v=minimalisticAssert,w=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],b=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(w),E=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function $(T,C){var B={};this._baseState=B,B.enc=T,B.parent=C||null,B.children=null,B.tag=null,B.args=null,B.reverseArgs=null,B.choice=null,B.optional=!1,B.any=!1,B.obj=!1,B.use=null,B.useDecoder=null,B.key=null,B.default=null,B.explicit=null,B.implicit=null,B.contains=null,B.parent||(B.children=[],this._wrap())}node=$;var M=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return $.prototype.clone=function(){var C=this._baseState,B={};M.forEach(function(H){B[H]=C[H]});var N=new this.constructor(B.parent);return N._baseState=B,N},$.prototype._wrap=function(){var C=this._baseState;b.forEach(function(B){this[B]=function(){var H=new this.constructor(this);return C.children.push(H),H[B].apply(H,arguments)}},this)},$.prototype._init=function(C){var B=this._baseState;v(B.parent===null),C.call(this),B.children=B.children.filter(function(N){return N._baseState.parent===this},this),v.equal(B.children.length,1,"Root node can have only one child")},$.prototype._useArgs=function(C){var B=this._baseState,N=C.filter(function(H){return H instanceof this.constructor},this);C=C.filter(function(H){return!(H instanceof this.constructor)},this),N.length!==0&&(v(B.children===null),B.children=N,N.forEach(function(H){H._baseState.parent=this},this)),C.length!==0&&(v(B.args===null),B.args=C,B.reverseArgs=C.map(function(H){if(typeof H!="object"||H.constructor!==Object)return H;var te={};return Object.keys(H).forEach(function(fe){fe==(fe|0)&&(fe|=0);var ce=H[fe];te[ce]=fe}),te}))},E.forEach(function(T){$.prototype[T]=function(){var B=this._baseState;throw new Error(T+" not implemented for encoding: "+B.enc)}}),w.forEach(function(T){$.prototype[T]=function(){var B=this._baseState,N=Array.prototype.slice.call(arguments);return v(B.tag===null),B.tag=T,this._useArgs(N),this}}),$.prototype.use=function(C){v(C);var B=this._baseState;return v(B.use===null),B.use=C,this},$.prototype.optional=function(){var C=this._baseState;return C.optional=!0,this},$.prototype.def=function(C){var B=this._baseState;return v(B.default===null),B.default=C,B.optional=!0,this},$.prototype.explicit=function(C){var B=this._baseState;return v(B.explicit===null&&B.implicit===null),B.explicit=C,this},$.prototype.implicit=function(C){var B=this._baseState;return v(B.explicit===null&&B.implicit===null),B.implicit=C,this},$.prototype.obj=function(){var C=this._baseState,B=Array.prototype.slice.call(arguments);return C.obj=!0,B.length!==0&&this._useArgs(B),this},$.prototype.key=function(C){var B=this._baseState;return v(B.key===null),B.key=C,this},$.prototype.any=function(){var C=this._baseState;return C.any=!0,this},$.prototype.choice=function(C){var B=this._baseState;return v(B.choice===null),B.choice=C,this._useArgs(Object.keys(C).map(function(N){return C[N]})),this},$.prototype.contains=function(C){var B=this._baseState;return v(B.use===null),B.contains=C,this},$.prototype._decode=function(C,B){var N=this._baseState;if(N.parent===null)return C.wrapResult(N.children[0]._decode(C,B));var H=N.default,te=!0,fe=null;if(N.key!==null&&(fe=C.enterKey(N.key)),N.optional){var ce=null;if(N.explicit!==null?ce=N.explicit:N.implicit!==null?ce=N.implicit:N.tag!==null&&(ce=N.tag),ce===null&&!N.any){var le=C.save();try{N.choice===null?this._decodeGeneric(N.tag,C,B):this._decodeChoice(C,B),te=!0}catch{te=!1}C.restore(le)}else if(te=this._peekTag(C,ce,N.any),C.isError(te))return te}var ie;if(N.obj&&te&&(ie=C.enterObject()),te){if(N.explicit!==null){var ge=this._decodeTag(C,N.explicit);if(C.isError(ge))return ge;C=ge}var pe=C.offset;if(N.use===null&&N.choice===null){if(N.any)var le=C.save();var Me=this._decodeTag(C,N.implicit!==null?N.implicit:N.tag,N.any);if(C.isError(Me))return Me;N.any?H=C.raw(le):C=Me}if(B&&B.track&&N.tag!==null&&B.track(C.path(),pe,C.length,"tagged"),B&&B.track&&N.tag!==null&&B.track(C.path(),C.offset,C.length,"content"),N.any?H=H:N.choice===null?H=this._decodeGeneric(N.tag,C,B):H=this._decodeChoice(C,B),C.isError(H))return H;if(!N.any&&N.choice===null&&N.children!==null&&N.children.forEach(function(Be){Be._decode(C,B)}),N.contains&&(N.tag==="octstr"||N.tag==="bitstr")){var $e=new h(H);H=this._getUse(N.contains,C._reporterState.obj)._decode($e,B)}}return N.obj&&te&&(H=C.leaveObject(ie)),N.key!==null&&(H!==null||te===!0)?C.leaveKey(fe,N.key,H):fe!==null&&C.exitKey(fe),H},$.prototype._decodeGeneric=function(C,B,N){var H=this._baseState;return C==="seq"||C==="set"?null:C==="seqof"||C==="setof"?this._decodeList(B,C,H.args[0],N):/str$/.test(C)?this._decodeStr(B,C,N):C==="objid"&&H.args?this._decodeObjid(B,H.args[0],H.args[1],N):C==="objid"?this._decodeObjid(B,null,null,N):C==="gentime"||C==="utctime"?this._decodeTime(B,C,N):C==="null_"?this._decodeNull(B,N):C==="bool"?this._decodeBool(B,N):C==="objDesc"?this._decodeStr(B,C,N):C==="int"||C==="enum"?this._decodeInt(B,H.args&&H.args[0],N):H.use!==null?this._getUse(H.use,B._reporterState.obj)._decode(B,N):B.error("unknown tag: "+C)},$.prototype._getUse=function(C,B){var N=this._baseState;return N.useDecoder=this._use(C,B),v(N.useDecoder._baseState.parent===null),N.useDecoder=N.useDecoder._baseState.children[0],N.implicit!==N.useDecoder._baseState.implicit&&(N.useDecoder=N.useDecoder.clone(),N.useDecoder._baseState.implicit=N.implicit),N.useDecoder},$.prototype._decodeChoice=function(C,B){var N=this._baseState,H=null,te=!1;return Object.keys(N.choice).some(function(fe){var ce=C.save(),le=N.choice[fe];try{var ie=le._decode(C,B);if(C.isError(ie))return!1;H={type:fe,value:ie},te=!0}catch{return C.restore(ce),!1}return!0},this),te?H:C.error("Choice not matched")},$.prototype._createEncoderBuffer=function(C){return new u(C,this.reporter)},$.prototype._encode=function(C,B,N){var H=this._baseState;if(!(H.default!==null&&H.default===C)){var te=this._encodeValue(C,B,N);if(te!==void 0&&!this._skipDefault(te,B,N))return te}},$.prototype._encodeValue=function(C,B,N){var H=this._baseState;if(H.parent===null)return H.children[0]._encode(C,B||new y);var le=null;if(this.reporter=B,H.optional&&C===void 0)if(H.default!==null)C=H.default;else return;var te=null,fe=!1;if(H.any)le=this._createEncoderBuffer(C);else if(H.choice)le=this._encodeChoice(C,B);else if(H.contains)te=this._getUse(H.contains,N)._encode(C,B),fe=!0;else if(H.children)te=H.children.map(function(pe){if(pe._baseState.tag==="null_")return pe._encode(null,B,C);if(pe._baseState.key===null)return B.error("Child should have a key");var Me=B.enterKey(pe._baseState.key);if(typeof C!="object")return B.error("Child expected, but input is not object");var $e=pe._encode(C[pe._baseState.key],B,C);return B.leaveKey(Me),$e},this).filter(function(pe){return pe}),te=this._createEncoderBuffer(te);else if(H.tag==="seqof"||H.tag==="setof"){if(!(H.args&&H.args.length===1))return B.error("Too many args for : "+H.tag);if(!Array.isArray(C))return B.error("seqof/setof, but data is not Array");var ce=this.clone();ce._baseState.implicit=null,te=this._createEncoderBuffer(C.map(function(pe){var Me=this._baseState;return this._getUse(Me.args[0],C)._encode(pe,B)},ce))}else H.use!==null?le=this._getUse(H.use,N)._encode(C,B):(te=this._encodePrimitive(H.tag,C),fe=!0);var le;if(!H.any&&H.choice===null){var ie=H.implicit!==null?H.implicit:H.tag,ge=H.implicit===null?"universal":"context";ie===null?H.use===null&&B.error("Tag could be omitted only for .use()"):H.use===null&&(le=this._encodeComposite(ie,fe,ge,te))}return H.explicit!==null&&(le=this._encodeComposite(H.explicit,!1,"context",le)),le},$.prototype._encodeChoice=function(C,B){var N=this._baseState,H=N.choice[C.type];return H||v(!1,C.type+" not found in "+JSON.stringify(Object.keys(N.choice))),H._encode(C.value,B)},$.prototype._encodePrimitive=function(C,B){var N=this._baseState;if(/str$/.test(C))return this._encodeStr(B,C);if(C==="objid"&&N.args)return this._encodeObjid(B,N.reverseArgs[0],N.args[1]);if(C==="objid")return this._encodeObjid(B,null,null);if(C==="gentime"||C==="utctime")return this._encodeTime(B,C);if(C==="null_")return this._encodeNull();if(C==="int"||C==="enum")return this._encodeInt(B,N.args&&N.reverseArgs[0]);if(C==="bool")return this._encodeBool(B);if(C==="objDesc")return this._encodeStr(B,C);throw new Error("Unsupported tag: "+C)},$.prototype._isNumstr=function(C){return/^[0-9 ]*$/.test(C)},$.prototype._isPrintstr=function(C){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(C)},node}var hasRequiredBase;function requireBase(){return hasRequiredBase||(hasRequiredBase=1,function(y){var u=y;u.Reporter=reporter.Reporter,u.DecoderBuffer=requireBuffer().DecoderBuffer,u.EncoderBuffer=requireBuffer().EncoderBuffer,u.Node=requireNode()}(base)),base}var constants={},der={},hasRequiredDer$2;function requireDer$2(){return hasRequiredDer$2||(hasRequiredDer$2=1,function(y){var u=requireConstants();y.tagClass={0:"universal",1:"application",2:"context",3:"private"},y.tagClassByName=u._reverse(y.tagClass),y.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},y.tagByName=u._reverse(y.tag)}(der)),der}var hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(y){var u=y;u._reverse=function(v){var w={};return Object.keys(v).forEach(function(b){(b|0)==b&&(b=b|0);var E=v[b];w[E]=b}),w},u.der=requireDer$2()}(constants)),constants}var decoders={},der_1$1,hasRequiredDer$1;function requireDer$1(){if(hasRequiredDer$1)return der_1$1;hasRequiredDer$1=1;var y=inherits_browserExports,u=requireAsn1(),h=u.base,v=u.bignum,w=u.constants.der;function b(T){this.enc="der",this.name=T.name,this.entity=T,this.tree=new E,this.tree._init(T.body)}der_1$1=b,b.prototype.decode=function(C,B){return C instanceof h.DecoderBuffer||(C=new h.DecoderBuffer(C,B)),this.tree._decode(C,B)};function E(T){h.Node.call(this,"der",T)}y(E,h.Node),E.prototype._peekTag=function(C,B,N){if(C.isEmpty())return!1;var H=C.save(),te=$(C,'Failed to peek tag: "'+B+'"');return C.isError(te)?te:(C.restore(H),te.tag===B||te.tagStr===B||te.tagStr+"of"===B||N)},E.prototype._decodeTag=function(C,B,N){var H=$(C,'Failed to decode tag of "'+B+'"');if(C.isError(H))return H;var te=M(C,H.primitive,'Failed to get length of "'+B+'"');if(C.isError(te))return te;if(!N&&H.tag!==B&&H.tagStr!==B&&H.tagStr+"of"!==B)return C.error('Failed to match tag: "'+B+'"');if(H.primitive||te!==null)return C.skip(te,'Failed to match body of: "'+B+'"');var fe=C.save(),ce=this._skipUntilEnd(C,'Failed to skip indefinite length body: "'+this.tag+'"');return C.isError(ce)?ce:(te=C.offset-fe.offset,C.restore(fe),C.skip(te,'Failed to match body of: "'+B+'"'))},E.prototype._skipUntilEnd=function(C,B){for(;;){var N=$(C,B);if(C.isError(N))return N;var H=M(C,N.primitive,B);if(C.isError(H))return H;var te;if(N.primitive||H!==null?te=C.skip(H):te=this._skipUntilEnd(C,B),C.isError(te))return te;if(N.tagStr==="end")break}},E.prototype._decodeList=function(C,B,N,H){for(var te=[];!C.isEmpty();){var fe=this._peekTag(C,"end");if(C.isError(fe))return fe;var ce=N.decode(C,"der",H);if(C.isError(ce)&&fe)break;te.push(ce)}return te},E.prototype._decodeStr=function(C,B){if(B==="bitstr"){var N=C.readUInt8();return C.isError(N)?N:{unused:N,data:C.raw()}}else if(B==="bmpstr"){var H=C.raw();if(H.length%2===1)return C.error("Decoding of string type: bmpstr length mismatch");for(var te="",fe=0;fe<H.length/2;fe++)te+=String.fromCharCode(H.readUInt16BE(fe*2));return te}else if(B==="numstr"){var ce=C.raw().toString("ascii");return this._isNumstr(ce)?ce:C.error("Decoding of string type: numstr unsupported characters")}else{if(B==="octstr")return C.raw();if(B==="objDesc")return C.raw();if(B==="printstr"){var le=C.raw().toString("ascii");return this._isPrintstr(le)?le:C.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(B)?C.raw().toString():C.error("Decoding of string type: "+B+" unsupported")}},E.prototype._decodeObjid=function(C,B,N){for(var H,te=[],fe=0;!C.isEmpty();){var ce=C.readUInt8();fe<<=7,fe|=ce&127,ce&128||(te.push(fe),fe=0)}ce&128&&te.push(fe);var le=te[0]/40|0,ie=te[0]%40;if(N?H=te:H=[le,ie].concat(te.slice(1)),B){var ge=B[H.join(" ")];ge===void 0&&(ge=B[H.join(".")]),ge!==void 0&&(H=ge)}return H},E.prototype._decodeTime=function(C,B){var N=C.raw().toString();if(B==="gentime")var H=N.slice(0,4)|0,te=N.slice(4,6)|0,fe=N.slice(6,8)|0,ce=N.slice(8,10)|0,le=N.slice(10,12)|0,ie=N.slice(12,14)|0;else if(B==="utctime"){var H=N.slice(0,2)|0,te=N.slice(2,4)|0,fe=N.slice(4,6)|0,ce=N.slice(6,8)|0,le=N.slice(8,10)|0,ie=N.slice(10,12)|0;H<70?H=2e3+H:H=1900+H}else return C.error("Decoding "+B+" time is not supported yet");return Date.UTC(H,te-1,fe,ce,le,ie,0)},E.prototype._decodeNull=function(C){return null},E.prototype._decodeBool=function(C){var B=C.readUInt8();return C.isError(B)?B:B!==0},E.prototype._decodeInt=function(C,B){var N=C.raw(),H=new v(N);return B&&(H=B[H.toString(10)]||H),H},E.prototype._use=function(C,B){return typeof C=="function"&&(C=C(B)),C._getDecoder("der").tree};function $(T,C){var B=T.readUInt8(C);if(T.isError(B))return B;var N=w.tagClass[B>>6],H=(B&32)===0;if((B&31)===31){var te=B;for(B=0;(te&128)===128;){if(te=T.readUInt8(C),T.isError(te))return te;B<<=7,B|=te&127}}else B&=31;var fe=w.tag[B];return{cls:N,primitive:H,tag:B,tagStr:fe}}function M(T,C,B){var N=T.readUInt8(B);if(T.isError(N))return N;if(!C&&N===128)return null;if(!(N&128))return N;var H=N&127;if(H>4)return T.error("length octect is too long");N=0;for(var te=0;te<H;te++){N<<=8;var fe=T.readUInt8(B);if(T.isError(fe))return fe;N|=fe}return N}return der_1$1}var pem$1,hasRequiredPem$1;function requirePem$1(){if(hasRequiredPem$1)return pem$1;hasRequiredPem$1=1;var y=inherits_browserExports,u=dist.Buffer,h=requireDer$1();function v(w){h.call(this,w),this.enc="pem"}return y(v,h),pem$1=v,v.prototype.decode=function(b,E){for(var $=b.toString().split(/[\r\n]+/g),M=E.label.toUpperCase(),T=/^-----(BEGIN|END) ([^-]+)-----$/,C=-1,B=-1,N=0;N<$.length;N++){var H=$[N].match(T);if(H!==null&&H[2]===M)if(C===-1){if(H[1]!=="BEGIN")break;C=N}else{if(H[1]!=="END")break;B=N;break}}if(C===-1||B===-1)throw new Error("PEM section not found for: "+M);var te=$.slice(C+1,B).join("");te.replace(/[^a-z0-9\+\/=]+/gi,"");var fe=new u(te,"base64");return h.prototype.decode.call(this,fe,E)},pem$1}var hasRequiredDecoders;function requireDecoders(){return hasRequiredDecoders||(hasRequiredDecoders=1,function(y){var u=y;u.der=requireDer$1(),u.pem=requirePem$1()}(decoders)),decoders}var encoders={},der_1,hasRequiredDer;function requireDer(){if(hasRequiredDer)return der_1;hasRequiredDer=1;var y=inherits_browserExports,u=dist.Buffer,h=requireAsn1(),v=h.base,w=h.constants.der;function b(T){this.enc="der",this.name=T.name,this.entity=T,this.tree=new E,this.tree._init(T.body)}der_1=b,b.prototype.encode=function(C,B){return this.tree._encode(C,B).join()};function E(T){v.Node.call(this,"der",T)}y(E,v.Node),E.prototype._encodeComposite=function(C,B,N,H){var te=M(C,B,N,this.reporter);if(H.length<128){var le=new u(2);return le[0]=te,le[1]=H.length,this._createEncoderBuffer([le,H])}for(var fe=1,ce=H.length;ce>=256;ce>>=8)fe++;var le=new u(2+fe);le[0]=te,le[1]=128|fe;for(var ce=1+fe,ie=H.length;ie>0;ce--,ie>>=8)le[ce]=ie&255;return this._createEncoderBuffer([le,H])},E.prototype._encodeStr=function(C,B){if(B==="bitstr")return this._createEncoderBuffer([C.unused|0,C.data]);if(B==="bmpstr"){for(var N=new u(C.length*2),H=0;H<C.length;H++)N.writeUInt16BE(C.charCodeAt(H),H*2);return this._createEncoderBuffer(N)}else return B==="numstr"?this._isNumstr(C)?this._createEncoderBuffer(C):this.reporter.error("Encoding of string type: numstr supports only digits and space"):B==="printstr"?this._isPrintstr(C)?this._createEncoderBuffer(C):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(B)?this._createEncoderBuffer(C):B==="objDesc"?this._createEncoderBuffer(C):this.reporter.error("Encoding of string type: "+B+" unsupported")},E.prototype._encodeObjid=function(C,B,N){if(typeof C=="string"){if(!B)return this.reporter.error("string objid given, but no values map found");if(!B.hasOwnProperty(C))return this.reporter.error("objid not found in values map");C=B[C].split(/[\s\.]+/g);for(var H=0;H<C.length;H++)C[H]|=0}else if(Array.isArray(C)){C=C.slice();for(var H=0;H<C.length;H++)C[H]|=0}if(!Array.isArray(C))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(C));if(!N){if(C[1]>=40)return this.reporter.error("Second objid identifier OOB");C.splice(0,2,C[0]*40+C[1])}for(var te=0,H=0;H<C.length;H++){var fe=C[H];for(te++;fe>=128;fe>>=7)te++}for(var ce=new u(te),le=ce.length-1,H=C.length-1;H>=0;H--){var fe=C[H];for(ce[le--]=fe&127;(fe>>=7)>0;)ce[le--]=128|fe&127}return this._createEncoderBuffer(ce)};function $(T){return T<10?"0"+T:T}E.prototype._encodeTime=function(C,B){var N,H=new Date(C);return B==="gentime"?N=[$(H.getFullYear()),$(H.getUTCMonth()+1),$(H.getUTCDate()),$(H.getUTCHours()),$(H.getUTCMinutes()),$(H.getUTCSeconds()),"Z"].join(""):B==="utctime"?N=[$(H.getFullYear()%100),$(H.getUTCMonth()+1),$(H.getUTCDate()),$(H.getUTCHours()),$(H.getUTCMinutes()),$(H.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+B+" time is not supported yet"),this._encodeStr(N,"octstr")},E.prototype._encodeNull=function(){return this._createEncoderBuffer("")},E.prototype._encodeInt=function(C,B){if(typeof C=="string"){if(!B)return this.reporter.error("String int or enum given, but no values map");if(!B.hasOwnProperty(C))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(C));C=B[C]}if(typeof C!="number"&&!u.isBuffer(C)){var N=C.toArray();!C.sign&&N[0]&128&&N.unshift(0),C=new u(N)}if(u.isBuffer(C)){var H=C.length;C.length===0&&H++;var fe=new u(H);return C.copy(fe),C.length===0&&(fe[0]=0),this._createEncoderBuffer(fe)}if(C<128)return this._createEncoderBuffer(C);if(C<256)return this._createEncoderBuffer([0,C]);for(var H=1,te=C;te>=256;te>>=8)H++;for(var fe=new Array(H),te=fe.length-1;te>=0;te--)fe[te]=C&255,C>>=8;return fe[0]&128&&fe.unshift(0),this._createEncoderBuffer(new u(fe))},E.prototype._encodeBool=function(C){return this._createEncoderBuffer(C?255:0)},E.prototype._use=function(C,B){return typeof C=="function"&&(C=C(B)),C._getEncoder("der").tree},E.prototype._skipDefault=function(C,B,N){var H=this._baseState,te;if(H.default===null)return!1;var fe=C.join();if(H.defaultBuffer===void 0&&(H.defaultBuffer=this._encodeValue(H.default,B,N).join()),fe.length!==H.defaultBuffer.length)return!1;for(te=0;te<fe.length;te++)if(fe[te]!==H.defaultBuffer[te])return!1;return!0};function M(T,C,B,N){var H;if(T==="seqof"?T="seq":T==="setof"&&(T="set"),w.tagByName.hasOwnProperty(T))H=w.tagByName[T];else if(typeof T=="number"&&(T|0)===T)H=T;else return N.error("Unknown tag: "+T);return H>=31?N.error("Multi-octet tag encoding unsupported"):(C||(H|=32),H|=w.tagClassByName[B||"universal"]<<6,H)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var y=inherits_browserExports,u=requireDer();function h(v){u.call(this,v),this.enc="pem"}return y(h,u),pem=h,h.prototype.encode=function(w,b){for(var E=u.prototype.encode.call(this,w),$=E.toString("base64"),M=["-----BEGIN "+b.label+"-----"],T=0;T<$.length;T+=64)M.push($.slice(T,T+64));return M.push("-----END "+b.label+"-----"),M.join(`
|
|
29
|
-
`)},pem}var hasRequiredEncoders;function requireEncoders(){return hasRequiredEncoders||(hasRequiredEncoders=1,function(y){var u=y;u.der=requireDer(),u.pem=requirePem()}(encoders)),encoders}var hasRequiredAsn1;function requireAsn1(){return hasRequiredAsn1||(hasRequiredAsn1=1,function(y){var u=y;u.bignum=bnExports$1,u.define=requireApi().define,u.base=requireBase(),u.constants=requireConstants(),u.decoders=requireDecoders(),u.encoders=requireEncoders()}(asn1$2)),asn1$2}var asn=requireAsn1(),Time=asn.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),AttributeTypeValue=asn.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),AlgorithmIdentifier$1=asn.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),SubjectPublicKeyInfo=asn.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier$1),this.key("subjectPublicKey").bitstr())}),RelativeDistinguishedName=asn.define("RelativeDistinguishedName",function(){this.setof(AttributeTypeValue)}),RDNSequence=asn.define("RDNSequence",function(){this.seqof(RelativeDistinguishedName)}),Name=asn.define("Name",function(){this.choice({rdnSequence:this.use(RDNSequence)})}),Validity=asn.define("Validity",function(){this.seq().obj(this.key("notBefore").use(Time),this.key("notAfter").use(Time))}),Extension=asn.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),TBSCertificate=asn.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(AlgorithmIdentifier$1),this.key("issuer").use(Name),this.key("validity").use(Validity),this.key("subject").use(Name),this.key("subjectPublicKeyInfo").use(SubjectPublicKeyInfo),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Extension).optional())}),X509Certificate=asn.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(TBSCertificate),this.key("signatureAlgorithm").use(AlgorithmIdentifier$1),this.key("signatureValue").bitstr())}),certificate=X509Certificate,asn1$1=requireAsn1();asn1$3.certificate=certificate;var RSAPrivateKey=asn1$1.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});asn1$3.RSAPrivateKey=RSAPrivateKey;var RSAPublicKey=asn1$1.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});asn1$3.RSAPublicKey=RSAPublicKey;var AlgorithmIdentifier=asn1$1.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),PublicKey=asn1$1.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPublicKey").bitstr())});asn1$3.PublicKey=PublicKey;var PrivateKeyInfo=asn1$1.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPrivateKey").octstr())});asn1$3.PrivateKey=PrivateKeyInfo;var EncryptedPrivateKeyInfo=asn1$1.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});asn1$3.EncryptedPrivateKey=EncryptedPrivateKeyInfo;var DSAPrivateKey=asn1$1.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});asn1$3.DSAPrivateKey=DSAPrivateKey,asn1$3.DSAparam=asn1$1.define("DSAparam",function(){this.int()});var ECParameters=asn1$1.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),ECPrivateKey=asn1$1.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(ECParameters),this.key("publicKey").optional().explicit(1).bitstr())});asn1$3.ECPrivateKey=ECPrivateKey,asn1$3.signature=asn1$1.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())});const require$$1={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"};var findProc=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,startRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,fullRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,evp=evp_bytestokey,ciphers$1=browser$5,Buffer$6=safeBufferExports$1.Buffer,fixProc$1=function(y,u){var h=y.toString(),v=h.match(findProc),w;if(v){var E="aes"+v[1],$=Buffer$6.from(v[2],"hex"),M=Buffer$6.from(v[3].replace(/[\r\n]/g,""),"base64"),T=evp(u,$.slice(0,8),parseInt(v[1],10)).key,C=[],B=ciphers$1.createDecipheriv(E,T,$);C.push(B.update(M)),C.push(B.final()),w=Buffer$6.concat(C)}else{var b=h.match(fullRegex);w=Buffer$6.from(b[2].replace(/[\r\n]/g,""),"base64")}var N=h.match(startRegex)[1];return{tag:N,data:w}},asn1=asn1$3,aesid=require$$1,fixProc=fixProc$1,ciphers=browser$5,compat=browser$7,Buffer$5=safeBufferExports$1.Buffer;function decrypt(y,u){var h=y.algorithm.decrypt.kde.kdeparams.salt,v=parseInt(y.algorithm.decrypt.kde.kdeparams.iters.toString(),10),w=aesid[y.algorithm.decrypt.cipher.algo.join(".")],b=y.algorithm.decrypt.cipher.iv,E=y.subjectPrivateKey,$=parseInt(w.split("-")[1],10)/8,M=compat.pbkdf2Sync(u,h,v,$,"sha1"),T=ciphers.createDecipheriv(w,M,b),C=[];return C.push(T.update(E)),C.push(T.final()),Buffer$5.concat(C)}function parseKeys$2(y){var u;typeof y=="object"&&!Buffer$5.isBuffer(y)&&(u=y.passphrase,y=y.key),typeof y=="string"&&(y=Buffer$5.from(y));var h=fixProc(y,u),v=h.tag,w=h.data,b,E;switch(v){case"CERTIFICATE":E=asn1.certificate.decode(w,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(E||(E=asn1.PublicKey.decode(w,"der")),b=E.algorithm.algorithm.join("."),b){case"1.2.840.113549.1.1.1":return asn1.RSAPublicKey.decode(E.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return E.subjectPrivateKey=E.subjectPublicKey,{type:"ec",data:E};case"1.2.840.10040.4.1":return E.algorithm.params.pub_key=asn1.DSAparam.decode(E.subjectPublicKey.data,"der"),{type:"dsa",data:E.algorithm.params};default:throw new Error("unknown key id "+b)}case"ENCRYPTED PRIVATE KEY":w=asn1.EncryptedPrivateKey.decode(w,"der"),w=decrypt(w,u);case"PRIVATE KEY":switch(E=asn1.PrivateKey.decode(w,"der"),b=E.algorithm.algorithm.join("."),b){case"1.2.840.113549.1.1.1":return asn1.RSAPrivateKey.decode(E.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:E.algorithm.curve,privateKey:asn1.ECPrivateKey.decode(E.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return E.algorithm.params.priv_key=asn1.DSAparam.decode(E.subjectPrivateKey,"der"),{type:"dsa",params:E.algorithm.params};default:throw new Error("unknown key id "+b)}case"RSA PUBLIC KEY":return asn1.RSAPublicKey.decode(w,"der");case"RSA PRIVATE KEY":return asn1.RSAPrivateKey.decode(w,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:asn1.DSAPrivateKey.decode(w,"der")};case"EC PRIVATE KEY":return w=asn1.ECPrivateKey.decode(w,"der"),{curve:w.parameters.value,privateKey:w.privateKey};default:throw new Error("unknown key type "+v)}}parseKeys$2.signature=asn1.signature;var parseAsn1=parseKeys$2;const require$$4={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"};var hasRequiredSign;function requireSign(){if(hasRequiredSign)return sign.exports;hasRequiredSign=1;var y=safeBufferExports$1.Buffer,u=browser$8,h=browserifyRsa,v=requireElliptic().ec,w=bnExports,b=parseAsn1,E=require$$4,$=1;function M(le,ie,ge,pe,Me){var $e=b(ie);if($e.curve){if(pe!=="ecdsa"&&pe!=="ecdsa/rsa")throw new Error("wrong private key type");return T(le,$e)}else if($e.type==="dsa"){if(pe!=="dsa")throw new Error("wrong private key type");return C(le,$e,ge)}if(pe!=="rsa"&&pe!=="ecdsa/rsa")throw new Error("wrong private key type");if(ie.padding!==void 0&&ie.padding!==$)throw new Error("illegal or unsupported padding mode");le=y.concat([Me,le]);for(var Pe=$e.modulus.byteLength(),Be=[0,1];le.length+Be.length+1<Pe;)Be.push(255);Be.push(0);for(var Re=-1;++Re<le.length;)Be.push(le[Re]);var je=h(Be,$e);return je}function T(le,ie){var ge=E[ie.curve.join(".")];if(!ge)throw new Error("unknown curve "+ie.curve.join("."));var pe=new v(ge),Me=pe.keyFromPrivate(ie.privateKey),$e=Me.sign(le);return y.from($e.toDER())}function C(le,ie,ge){for(var pe=ie.params.priv_key,Me=ie.params.p,$e=ie.params.q,Pe=ie.params.g,Be=new w(0),Re,je=H(le,$e).mod($e),we=!1,D=N(pe,$e,le,ge);we===!1;)Re=fe($e,D,ge),Be=ce(Pe,Re,Me,$e),we=Re.invm($e).imul(je.add(pe.mul(Be))).mod($e),we.cmpn(0)===0&&(we=!1,Be=new w(0));return B(Be,we)}function B(le,ie){le=le.toArray(),ie=ie.toArray(),le[0]&128&&(le=[0].concat(le)),ie[0]&128&&(ie=[0].concat(ie));var ge=le.length+ie.length+4,pe=[48,ge,2,le.length];return pe=pe.concat(le,[2,ie.length],ie),y.from(pe)}function N(le,ie,ge,pe){if(le=y.from(le.toArray()),le.length<ie.byteLength()){var Me=y.alloc(ie.byteLength()-le.length);le=y.concat([Me,le])}var $e=ge.length,Pe=te(ge,ie),Be=y.alloc($e);Be.fill(1);var Re=y.alloc($e);return Re=u(pe,Re).update(Be).update(y.from([0])).update(le).update(Pe).digest(),Be=u(pe,Re).update(Be).digest(),Re=u(pe,Re).update(Be).update(y.from([1])).update(le).update(Pe).digest(),Be=u(pe,Re).update(Be).digest(),{k:Re,v:Be}}function H(le,ie){var ge=new w(le),pe=(le.length<<3)-ie.bitLength();return pe>0&&ge.ishrn(pe),ge}function te(le,ie){le=H(le,ie),le=le.mod(ie);var ge=y.from(le.toArray());if(ge.length<ie.byteLength()){var pe=y.alloc(ie.byteLength()-ge.length);ge=y.concat([pe,ge])}return ge}function fe(le,ie,ge){var pe,Me;do{for(pe=y.alloc(0);pe.length*8<le.bitLength();)ie.v=u(ge,ie.k).update(ie.v).digest(),pe=y.concat([pe,ie.v]);Me=H(pe,le),ie.k=u(ge,ie.k).update(ie.v).update(y.from([0])).digest(),ie.v=u(ge,ie.k).update(ie.v).digest()}while(Me.cmp(le)!==-1);return Me}function ce(le,ie,ge,pe){return le.toRed(w.mont(ge)).redPow(ie).fromRed().mod(pe)}return sign.exports=M,sign.exports.getKey=N,sign.exports.makeKey=fe,sign.exports}var verify_1,hasRequiredVerify;function requireVerify(){if(hasRequiredVerify)return verify_1;hasRequiredVerify=1;var y=safeBufferExports$1.Buffer,u=bnExports,h=requireElliptic().ec,v=parseAsn1,w=require$$4;function b(T,C,B,N,H){var te=v(B);if(te.type==="ec"){if(N!=="ecdsa"&&N!=="ecdsa/rsa")throw new Error("wrong public key type");return E(T,C,te)}else if(te.type==="dsa"){if(N!=="dsa")throw new Error("wrong public key type");return $(T,C,te)}if(N!=="rsa"&&N!=="ecdsa/rsa")throw new Error("wrong public key type");C=y.concat([H,C]);for(var fe=te.modulus.byteLength(),ce=[1],le=0;C.length+ce.length+2<fe;)ce.push(255),le+=1;ce.push(0);for(var ie=-1;++ie<C.length;)ce.push(C[ie]);ce=y.from(ce);var ge=u.mont(te.modulus);T=new u(T).toRed(ge),T=T.redPow(new u(te.publicExponent)),T=y.from(T.fromRed().toArray());var pe=le<8?1:0;for(fe=Math.min(T.length,ce.length),T.length!==ce.length&&(pe=1),ie=-1;++ie<fe;)pe|=T[ie]^ce[ie];return pe===0}function E(T,C,B){var N=w[B.data.algorithm.curve.join(".")];if(!N)throw new Error("unknown curve "+B.data.algorithm.curve.join("."));var H=new h(N),te=B.data.subjectPrivateKey.data;return H.verify(C,T,te)}function $(T,C,B){var N=B.data.p,H=B.data.q,te=B.data.g,fe=B.data.pub_key,ce=v.signature.decode(T,"der"),le=ce.s,ie=ce.r;M(le,H),M(ie,H);var ge=u.mont(N),pe=le.invm(H),Me=te.toRed(ge).redPow(new u(C).mul(pe).mod(H)).fromRed().mul(fe.toRed(ge).redPow(ie.mul(pe).mod(H)).fromRed()).mod(N).mod(H);return Me.cmp(ie)===0}function M(T,C){if(T.cmpn(0)<=0)throw new Error("invalid sig");if(T.cmp(C)>=0)throw new Error("invalid sig")}return verify_1=b,verify_1}var browser$3,hasRequiredBrowser$1;function requireBrowser$1(){if(hasRequiredBrowser$1)return browser$3;hasRequiredBrowser$1=1;var y=safeBufferExports$1.Buffer,u=browser$9,h=readableBrowserExports,v=inherits_browserExports,w=requireSign(),b=requireVerify(),E=require$$6;Object.keys(E).forEach(function(B){E[B].id=y.from(E[B].id,"hex"),E[B.toLowerCase()]=E[B]});function $(B){h.Writable.call(this);var N=E[B];if(!N)throw new Error("Unknown message digest");this._hashType=N.hash,this._hash=u(N.hash),this._tag=N.id,this._signType=N.sign}v($,h.Writable),$.prototype._write=function(N,H,te){this._hash.update(N),te()},$.prototype.update=function(N,H){return this._hash.update(typeof N=="string"?y.from(N,H):N),this},$.prototype.sign=function(N,H){this.end();var te=this._hash.digest(),fe=w(te,N,this._hashType,this._signType,this._tag);return H?fe.toString(H):fe};function M(B){h.Writable.call(this);var N=E[B];if(!N)throw new Error("Unknown message digest");this._hash=u(N.hash),this._tag=N.id,this._signType=N.sign}v(M,h.Writable),M.prototype._write=function(N,H,te){this._hash.update(N),te()},M.prototype.update=function(N,H){return this._hash.update(typeof N=="string"?y.from(N,H):N),this},M.prototype.verify=function(N,H,te){var fe=typeof H=="string"?y.from(H,te):H;this.end();var ce=this._hash.digest();return b(fe,ce,N,this._signType,this._tag)};function T(B){return new $(B)}function C(B){return new M(B)}return browser$3={Sign:T,Verify:C,createSign:T,createVerify:C},browser$3}var browser$2,hasRequiredBrowser;function requireBrowser(){if(hasRequiredBrowser)return browser$2;hasRequiredBrowser=1;var y=requireElliptic(),u=bnExports$1;browser$2=function(E){return new v(E)};var h={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};h.p224=h.secp224r1,h.p256=h.secp256r1=h.prime256v1,h.p192=h.secp192r1=h.prime192v1,h.p384=h.secp384r1,h.p521=h.secp521r1;function v(b){this.curveType=h[b],this.curveType||(this.curveType={name:b}),this.curve=new y.ec(this.curveType.name),this.keys=void 0}v.prototype.generateKeys=function(b,E){return this.keys=this.curve.genKeyPair(),this.getPublicKey(b,E)},v.prototype.computeSecret=function(b,E,$){E=E||"utf8",Buffer$C.isBuffer(b)||(b=new Buffer$C(b,E));var M=this.curve.keyFromPublic(b).getPublic(),T=M.mul(this.keys.getPrivate()).getX();return w(T,$,this.curveType.byteLength)},v.prototype.getPublicKey=function(b,E){var $=this.keys.getPublic(E==="compressed",!0);return E==="hybrid"&&($[$.length-1]%2?$[0]=7:$[0]=6),w($,b)},v.prototype.getPrivateKey=function(b){return w(this.keys.getPrivate(),b)},v.prototype.setPublicKey=function(b,E){return E=E||"utf8",Buffer$C.isBuffer(b)||(b=new Buffer$C(b,E)),this.keys._importPublic(b),this},v.prototype.setPrivateKey=function(b,E){E=E||"utf8",Buffer$C.isBuffer(b)||(b=new Buffer$C(b,E));var $=new u(b);return $=$.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate($),this};function w(b,E,$){Array.isArray(b)||(b=b.toArray());var M=new Buffer$C(b);if($&&M.length<$){var T=new Buffer$C($-M.length);T.fill(0),M=Buffer$C.concat([T,M])}return E?M.toString(E):M}return browser$2}var browser$1={},createHash$2=browser$9,Buffer$4=safeBufferExports$1.Buffer,mgf$2=function(y,u){for(var h=Buffer$4.alloc(0),v=0,w;h.length<u;)w=i2ops(v++),h=Buffer$4.concat([h,createHash$2("sha1").update(y).update(w).digest()]);return h.slice(0,u)};function i2ops(y){var u=Buffer$4.allocUnsafe(4);return u.writeUInt32BE(y,0),u}var xor$2=function y(u,h){for(var v=u.length,w=-1;++w<v;)u[w]^=h[w];return u},BN$2=bnExports$1,Buffer$3=safeBufferExports$1.Buffer;function withPublic$2(y,u){return Buffer$3.from(y.toRed(BN$2.mont(u.modulus)).redPow(new BN$2(u.publicExponent)).fromRed().toArray())}var withPublic_1=withPublic$2,parseKeys$1=parseAsn1,randomBytes=browserExports,createHash$1=browser$9,mgf$1=mgf$2,xor$1=xor$2,BN$1=bnExports$1,withPublic$1=withPublic_1,crt$1=browserifyRsa,Buffer$2=safeBufferExports$1.Buffer,publicEncrypt=function y(u,h,v){var w;u.padding?w=u.padding:v?w=1:w=4;var b=parseKeys$1(u),E;if(w===4)E=oaep$1(b,h);else if(w===1)E=pkcs1$1(b,h,v);else if(w===3){if(E=new BN$1(h),E.cmp(b.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return v?crt$1(E,b):withPublic$1(E,b)};function oaep$1(y,u){var h=y.modulus.byteLength(),v=u.length,w=createHash$1("sha1").update(Buffer$2.alloc(0)).digest(),b=w.length,E=2*b;if(v>h-E-2)throw new Error("message too long");var $=Buffer$2.alloc(h-v-E-2),M=h-b-1,T=randomBytes(b),C=xor$1(Buffer$2.concat([w,$,Buffer$2.alloc(1,1),u],M),mgf$1(T,M)),B=xor$1(T,mgf$1(C,b));return new BN$1(Buffer$2.concat([Buffer$2.alloc(1),B,C],h))}function pkcs1$1(y,u,h){var v=u.length,w=y.modulus.byteLength();if(v>w-11)throw new Error("message too long");var b;return h?b=Buffer$2.alloc(w-v-3,255):b=nonZero(w-v-3),new BN$1(Buffer$2.concat([Buffer$2.from([0,h?1:2]),b,Buffer$2.alloc(1),u],w))}function nonZero(y){for(var u=Buffer$2.allocUnsafe(y),h=0,v=randomBytes(y*2),w=0,b;h<y;)w===v.length&&(v=randomBytes(y*2),w=0),b=v[w++],b&&(u[h++]=b);return u}var parseKeys=parseAsn1,mgf=mgf$2,xor=xor$2,BN=bnExports$1,crt=browserifyRsa,createHash=browser$9,withPublic=withPublic_1,Buffer$1=safeBufferExports$1.Buffer,privateDecrypt=function y(u,h,v){var w;u.padding?w=u.padding:v?w=1:w=4;var b=parseKeys(u),E=b.modulus.byteLength();if(h.length>E||new BN(h).cmp(b.modulus)>=0)throw new Error("decryption error");var $;v?$=withPublic(new BN(h),b):$=crt(h,b);var M=Buffer$1.alloc(E-$.length);if($=Buffer$1.concat([M,$],E),w===4)return oaep(b,$);if(w===1)return pkcs1(b,$,v);if(w===3)return $;throw new Error("unknown padding")};function oaep(y,u){var h=y.modulus.byteLength(),v=createHash("sha1").update(Buffer$1.alloc(0)).digest(),w=v.length;if(u[0]!==0)throw new Error("decryption error");var b=u.slice(1,w+1),E=u.slice(w+1),$=xor(b,mgf(E,w)),M=xor(E,mgf($,h-w-1));if(compare(v,M.slice(0,w)))throw new Error("decryption error");for(var T=w;M[T]===0;)T++;if(M[T++]!==1)throw new Error("decryption error");return M.slice(T)}function pkcs1(y,u,h){for(var v=u.slice(0,2),w=2,b=0;u[w++]!==0;)if(w>=u.length){b++;break}var E=u.slice(2,w-1);if((v.toString("hex")!=="0002"&&!h||v.toString("hex")!=="0001"&&h)&&b++,E.length<8&&b++,b)throw new Error("decryption error");return u.slice(w)}function compare(y,u){y=Buffer$1.from(y),u=Buffer$1.from(u);var h=0,v=y.length;y.length!==u.length&&(h++,v=Math.min(y.length,u.length));for(var w=-1;++w<v;)h+=y[w]^u[w];return h}(function(y){y.publicEncrypt=publicEncrypt,y.privateDecrypt=privateDecrypt,y.privateEncrypt=function(h,v){return y.publicEncrypt(h,v,!0)},y.publicDecrypt=function(h,v){return y.privateDecrypt(h,v,!0)}})(browser$1);var browser={};function oldBrowser(){throw new Error(`secure random number generation not supported by this browser
|
|
30
|
-
use chrome, FireFox or Internet Explorer 11`)}var safeBuffer=safeBufferExports$1,randombytes=browserExports,Buffer=safeBuffer.Buffer,kBufferMaxLength=safeBuffer.kMaxLength,crypto$2=commonjsGlobal.crypto||commonjsGlobal.msCrypto,kMaxUint32=Math.pow(2,32)-1;function assertOffset(y,u){if(typeof y!="number"||y!==y)throw new TypeError("offset must be a number");if(y>kMaxUint32||y<0)throw new TypeError("offset must be a uint32");if(y>kBufferMaxLength||y>u)throw new RangeError("offset out of range")}function assertSize(y,u,h){if(typeof y!="number"||y!==y)throw new TypeError("size must be a number");if(y>kMaxUint32||y<0)throw new TypeError("size must be a uint32");if(y+u>h||y>kBufferMaxLength)throw new RangeError("buffer too small")}crypto$2&&crypto$2.getRandomValues||!process$1.browser?(browser.randomFill=randomFill,browser.randomFillSync=randomFillSync):(browser.randomFill=oldBrowser,browser.randomFillSync=oldBrowser);function randomFill(y,u,h,v){if(!Buffer.isBuffer(y)&&!(y instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof u=="function")v=u,u=0,h=y.length;else if(typeof h=="function")v=h,h=y.length-u;else if(typeof v!="function")throw new TypeError('"cb" argument must be a function');return assertOffset(u,y.length),assertSize(h,u,y.length),actualFill(y,u,h,v)}function actualFill(y,u,h,v){if(process$1.browser){var w=y.buffer,b=new Uint8Array(w,u,h);if(crypto$2.getRandomValues(b),v){process$1.nextTick(function(){v(null,y)});return}return y}if(v){randombytes(h,function($,M){if($)return v($);M.copy(y,u),v(null,y)});return}var E=randombytes(h);return E.copy(y,u),y}function randomFillSync(y,u,h){if(typeof u>"u"&&(u=0),!Buffer.isBuffer(y)&&!(y instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return assertOffset(u,y.length),h===void 0&&(h=y.length-u),assertSize(h,u,y.length),actualFill(y,u,h)}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=browserExports,cryptoBrowserify.createHash=cryptoBrowserify.Hash=browser$9,cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=browser$8;var y=algos,u=Object.keys(y),h=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(u);cryptoBrowserify.getHashes=function(){return h};var v=browser$7;cryptoBrowserify.pbkdf2=v.pbkdf2,cryptoBrowserify.pbkdf2Sync=v.pbkdf2Sync;var w=browser$6;cryptoBrowserify.Cipher=w.Cipher,cryptoBrowserify.createCipher=w.createCipher,cryptoBrowserify.Cipheriv=w.Cipheriv,cryptoBrowserify.createCipheriv=w.createCipheriv,cryptoBrowserify.Decipher=w.Decipher,cryptoBrowserify.createDecipher=w.createDecipher,cryptoBrowserify.Decipheriv=w.Decipheriv,cryptoBrowserify.createDecipheriv=w.createDecipheriv,cryptoBrowserify.getCiphers=w.getCiphers,cryptoBrowserify.listCiphers=w.listCiphers;var b=requireBrowser$2();cryptoBrowserify.DiffieHellmanGroup=b.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=b.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=b.getDiffieHellman,cryptoBrowserify.createDiffieHellman=b.createDiffieHellman,cryptoBrowserify.DiffieHellman=b.DiffieHellman;var E=requireBrowser$1();cryptoBrowserify.createSign=E.createSign,cryptoBrowserify.Sign=E.Sign,cryptoBrowserify.createVerify=E.createVerify,cryptoBrowserify.Verify=E.Verify,cryptoBrowserify.createECDH=requireBrowser();var $=browser$1;cryptoBrowserify.publicEncrypt=$.publicEncrypt,cryptoBrowserify.privateEncrypt=$.privateEncrypt,cryptoBrowserify.publicDecrypt=$.publicDecrypt,cryptoBrowserify.privateDecrypt=$.privateDecrypt;var M=browser;return cryptoBrowserify.randomFill=M.randomFill,cryptoBrowserify.randomFillSync=M.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(`
|
|
31
|
-
`))},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}var cryptoBrowserifyExports=requireCryptoBrowserify();const crypto$1=getDefaultExportFromCjs$1(cryptoBrowserifyExports);/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */const _0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_3n=BigInt(3),_8n=BigInt(8),CURVE=Object.freeze({a:_0n,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:_1n,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),divNearest=(y,u)=>(y+u/_2n)/u,endo={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(y){const{n:u}=CURVE,h=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),v=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),w=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),b=h,E=BigInt("0x100000000000000000000000000000000"),$=divNearest(b*y,u),M=divNearest(-v*y,u);let T=mod(y-$*h-M*w,u),C=mod(-$*v-M*b,u);const B=T>E,N=C>E;if(B&&(T=u-T),N&&(C=u-C),T>E||C>E)throw new Error("splitScalarEndo: Endomorphism failed, k="+y);return{k1neg:B,k1:T,k2neg:N,k2:C}}},fieldLen=32,groupLen=32,compressedLen=fieldLen+1,uncompressedLen=2*fieldLen+1;function weierstrass(y){const{a:u,b:h}=CURVE,v=mod(y*y),w=mod(v*y);return mod(w+u*y+h)}const USE_ENDOMORPHISM=CURVE.a===_0n;function assertJacPoint(y){if(!(y instanceof JacobianPoint))throw new TypeError("JacobianPoint expected")}class JacobianPoint{constructor(u,h,v){this.x=u,this.y=h,this.z=v}static fromAffine(u){if(!(u instanceof Point))throw new TypeError("JacobianPoint#fromAffine: expected Point");return u.equals(Point.ZERO)?JacobianPoint.ZERO:new JacobianPoint(u.x,u.y,_1n)}static toAffineBatch(u){const h=invertBatch(u.map(v=>v.z));return u.map((v,w)=>v.toAffine(h[w]))}static normalizeZ(u){return JacobianPoint.toAffineBatch(u).map(JacobianPoint.fromAffine)}equals(u){assertJacPoint(u);const{x:h,y:v,z:w}=this,{x:b,y:E,z:$}=u,M=mod(w*w),T=mod($*$),C=mod(h*T),B=mod(b*M),N=mod(mod(v*$)*T),H=mod(mod(E*w)*M);return C===B&&N===H}negate(){return new JacobianPoint(this.x,mod(-this.y),this.z)}double(){const{x:u,y:h,z:v}=this,w=mod(u*u),b=mod(h*h),E=mod(b*b),$=u+b,M=mod(_2n*(mod($*$)-w-E)),T=mod(_3n*w),C=mod(T*T),B=mod(C-_2n*M),N=mod(T*(M-B)-_8n*E),H=mod(_2n*h*v);return new JacobianPoint(B,N,H)}add(u){assertJacPoint(u);const{x:h,y:v,z:w}=this,{x:b,y:E,z:$}=u;if(b===_0n||E===_0n)return this;if(h===_0n||v===_0n)return u;const M=mod(w*w),T=mod($*$),C=mod(h*T),B=mod(b*M),N=mod(mod(v*$)*T),H=mod(mod(E*w)*M),te=mod(B-C),fe=mod(H-N);if(te===_0n)return fe===_0n?this.double():JacobianPoint.ZERO;const ce=mod(te*te),le=mod(te*ce),ie=mod(C*ce),ge=mod(fe*fe-le-_2n*ie),pe=mod(fe*(ie-ge)-N*le),Me=mod(w*$*te);return new JacobianPoint(ge,pe,Me)}subtract(u){return this.add(u.negate())}multiplyUnsafe(u){const h=JacobianPoint.ZERO;if(typeof u=="bigint"&&u===_0n)return h;let v=normalizeScalar(u);if(v===_1n)return this;if(!USE_ENDOMORPHISM){let B=h,N=this;for(;v>_0n;)v&_1n&&(B=B.add(N)),N=N.double(),v>>=_1n;return B}let{k1neg:w,k1:b,k2neg:E,k2:$}=endo.splitScalar(v),M=h,T=h,C=this;for(;b>_0n||$>_0n;)b&_1n&&(M=M.add(C)),$&_1n&&(T=T.add(C)),C=C.double(),b>>=_1n,$>>=_1n;return w&&(M=M.negate()),E&&(T=T.negate()),T=new JacobianPoint(mod(T.x*endo.beta),T.y,T.z),M.add(T)}precomputeWindow(u){const h=USE_ENDOMORPHISM?128/u+1:256/u+1,v=[];let w=this,b=w;for(let E=0;E<h;E++){b=w,v.push(b);for(let $=1;$<2**(u-1);$++)b=b.add(w),v.push(b);w=b.double()}return v}wNAF(u,h){!h&&this.equals(JacobianPoint.BASE)&&(h=Point.BASE);const v=h&&h._WINDOW_SIZE||1;if(256%v)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let w=h&&pointPrecomputes.get(h);w||(w=this.precomputeWindow(v),h&&v!==1&&(w=JacobianPoint.normalizeZ(w),pointPrecomputes.set(h,w)));let b=JacobianPoint.ZERO,E=JacobianPoint.BASE;const $=1+(USE_ENDOMORPHISM?128/v:256/v),M=2**(v-1),T=BigInt(2**v-1),C=2**v,B=BigInt(v);for(let N=0;N<$;N++){const H=N*M;let te=Number(u&T);u>>=B,te>M&&(te-=C,u+=_1n);const fe=H,ce=H+Math.abs(te)-1,le=N%2!==0,ie=te<0;te===0?E=E.add(constTimeNegate(le,w[fe])):b=b.add(constTimeNegate(ie,w[ce]))}return{p:b,f:E}}multiply(u,h){let v=normalizeScalar(u),w,b;if(USE_ENDOMORPHISM){const{k1neg:E,k1:$,k2neg:M,k2:T}=endo.splitScalar(v);let{p:C,f:B}=this.wNAF($,h),{p:N,f:H}=this.wNAF(T,h);C=constTimeNegate(E,C),N=constTimeNegate(M,N),N=new JacobianPoint(mod(N.x*endo.beta),N.y,N.z),w=C.add(N),b=B.add(H)}else{const{p:E,f:$}=this.wNAF(v,h);w=E,b=$}return JacobianPoint.normalizeZ([w,b])[0]}toAffine(u){const{x:h,y:v,z:w}=this,b=this.equals(JacobianPoint.ZERO);u==null&&(u=b?_8n:invert(w));const E=u,$=mod(E*E),M=mod($*E),T=mod(h*$),C=mod(v*M),B=mod(w*E);if(b)return Point.ZERO;if(B!==_1n)throw new Error("invZ was invalid");return new Point(T,C)}}JacobianPoint.BASE=new JacobianPoint(CURVE.Gx,CURVE.Gy,_1n),JacobianPoint.ZERO=new JacobianPoint(_0n,_1n,_0n);function constTimeNegate(y,u){const h=u.negate();return y?h:u}const pointPrecomputes=new WeakMap;class Point{constructor(u,h){this.x=u,this.y=h}_setWindowSize(u){this._WINDOW_SIZE=u,pointPrecomputes.delete(this)}hasEvenY(){return this.y%_2n===_0n}static fromCompressedHex(u){const h=u.length===32,v=bytesToNumber(h?u:u.subarray(1));if(!isValidFieldElement(v))throw new Error("Point is not on curve");const w=weierstrass(v);let b=sqrtMod(w);const E=(b&_1n)===_1n;h?E&&(b=mod(-b)):(u[0]&1)===1!==E&&(b=mod(-b));const $=new Point(v,b);return $.assertValidity(),$}static fromUncompressedHex(u){const h=bytesToNumber(u.subarray(1,fieldLen+1)),v=bytesToNumber(u.subarray(fieldLen+1,fieldLen*2+1)),w=new Point(h,v);return w.assertValidity(),w}static fromHex(u){const h=ensureBytes(u),v=h.length,w=h[0];if(v===fieldLen)return this.fromCompressedHex(h);if(v===compressedLen&&(w===2||w===3))return this.fromCompressedHex(h);if(v===uncompressedLen&&w===4)return this.fromUncompressedHex(h);throw new Error(`Point.fromHex: received invalid point. Expected 32-${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes, not ${v}`)}static fromPrivateKey(u){return Point.BASE.multiply(normalizePrivateKey(u))}static fromSignature(u,h,v){const{r:w,s:b}=normalizeSignature(h);if(![0,1,2,3].includes(v))throw new Error("Cannot recover: invalid recovery bit");const E=truncateHash(ensureBytes(u)),{n:$}=CURVE,M=v===2||v===3?w+$:w,T=invert(M,$),C=mod(-E*T,$),B=mod(b*T,$),N=v&1?"03":"02",H=Point.fromHex(N+numTo32bStr(M)),te=Point.BASE.multiplyAndAddUnsafe(H,C,B);if(!te)throw new Error("Cannot recover signature: point at infinify");return te.assertValidity(),te}toRawBytes(u=!1){return hexToBytes(this.toHex(u))}toHex(u=!1){const h=numTo32bStr(this.x);return u?`${this.hasEvenY()?"02":"03"}${h}`:`04${h}${numTo32bStr(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const u="Point is not on elliptic curve",{x:h,y:v}=this;if(!isValidFieldElement(h)||!isValidFieldElement(v))throw new Error(u);const w=mod(v*v),b=weierstrass(h);if(mod(w-b)!==_0n)throw new Error(u)}equals(u){return this.x===u.x&&this.y===u.y}negate(){return new Point(this.x,mod(-this.y))}double(){return JacobianPoint.fromAffine(this).double().toAffine()}add(u){return JacobianPoint.fromAffine(this).add(JacobianPoint.fromAffine(u)).toAffine()}subtract(u){return this.add(u.negate())}multiply(u){return JacobianPoint.fromAffine(this).multiply(u,this).toAffine()}multiplyAndAddUnsafe(u,h,v){const w=JacobianPoint.fromAffine(this),b=h===_0n||h===_1n||this!==Point.BASE?w.multiplyUnsafe(h):w.multiply(h),E=JacobianPoint.fromAffine(u).multiplyUnsafe(v),$=b.add(E);return $.equals(JacobianPoint.ZERO)?void 0:$.toAffine()}}Point.BASE=new Point(CURVE.Gx,CURVE.Gy),Point.ZERO=new Point(_0n,_0n);function sliceDER(y){return Number.parseInt(y[0],16)>=8?"00"+y:y}function parseDERInt(y){if(y.length<2||y[0]!==2)throw new Error(`Invalid signature integer tag: ${bytesToHex(y)}`);const u=y[1],h=y.subarray(2,u+2);if(!u||h.length!==u)throw new Error("Invalid signature integer: wrong length");if(h[0]===0&&h[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:bytesToNumber(h),left:y.subarray(u+2)}}function parseDERSignature(y){if(y.length<2||y[0]!=48)throw new Error(`Invalid signature tag: ${bytesToHex(y)}`);if(y[1]!==y.length-2)throw new Error("Invalid signature: incorrect length");const{data:u,left:h}=parseDERInt(y.subarray(2)),{data:v,left:w}=parseDERInt(h);if(w.length)throw new Error(`Invalid signature: left bytes after parsing: ${bytesToHex(w)}`);return{r:u,s:v}}class Signature{constructor(u,h){this.r=u,this.s=h,this.assertValidity()}static fromCompact(u){const h=isBytes(u),v="Signature.fromCompact";if(typeof u!="string"&&!h)throw new TypeError(`${v}: Expected string or Uint8Array`);const w=h?bytesToHex(u):u;if(w.length!==128)throw new Error(`${v}: Expected 64-byte hex`);return new Signature(hexToNumber(w.slice(0,64)),hexToNumber(w.slice(64,128)))}static fromDER(u){const h=isBytes(u);if(typeof u!="string"&&!h)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:v,s:w}=parseDERSignature(h?u:hexToBytes(u));return new Signature(v,w)}static fromHex(u){return this.fromDER(u)}assertValidity(){const{r:u,s:h}=this;if(!isWithinCurveOrder(u))throw new Error("Invalid Signature: r must be 0 < r < n");if(!isWithinCurveOrder(h))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const u=CURVE.n>>_1n;return this.s>u}normalizeS(){return this.hasHighS()?new Signature(this.r,mod(-this.s,CURVE.n)):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){const u=sliceDER(numberToHexUnpadded(this.s)),h=sliceDER(numberToHexUnpadded(this.r)),v=u.length/2,w=h.length/2,b=numberToHexUnpadded(v),E=numberToHexUnpadded(w);return`30${numberToHexUnpadded(w+v+4)}02${E}${h}02${b}${u}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return numTo32bStr(this.r)+numTo32bStr(this.s)}}function isBytes(y){return y instanceof Uint8Array||ArrayBuffer.isView(y)&&y.constructor.name==="Uint8Array"}function abytes(y){if(!isBytes(y))throw new Error("Uint8Array expected")}const hexes=Array.from({length:256},(y,u)=>u.toString(16).padStart(2,"0"));function bytesToHex(y){abytes(y);let u="";for(let h=0;h<y.length;h++)u+=hexes[y[h]];return u}const asciis={_0:48,_9:57,A:65,F:70,a:97,f:102};function asciiToBase16(y){if(y>=asciis._0&&y<=asciis._9)return y-asciis._0;if(y>=asciis.A&&y<=asciis.F)return y-(asciis.A-10);if(y>=asciis.a&&y<=asciis.f)return y-(asciis.a-10)}function hexToBytes(y){if(typeof y!="string")throw new Error("hex string expected, got "+typeof y);const u=y.length,h=u/2;if(u%2)throw new Error("hex string expected, got unpadded hex of length "+u);const v=new Uint8Array(h);for(let w=0,b=0;w<h;w++,b+=2){const E=asciiToBase16(y.charCodeAt(b)),$=asciiToBase16(y.charCodeAt(b+1));if(E===void 0||$===void 0){const M=y[b]+y[b+1];throw new Error('hex string expected, got non-hex character "'+M+'" at index '+b)}v[w]=E*16+$}return v}const POW_2_256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function numTo32bStr(y){if(typeof y!="bigint")throw new Error("Expected bigint");if(!(_0n<=y&&y<POW_2_256))throw new Error("Expected number 0 <= n < 2^256");return y.toString(16).padStart(64,"0")}function numberToHexUnpadded(y){const u=y.toString(16);return u.length&1?`0${u}`:u}function hexToNumber(y){if(typeof y!="string")throw new TypeError("hexToNumber: expected string, got "+typeof y);return BigInt(`0x${y}`)}function bytesToNumber(y){return hexToNumber(bytesToHex(y))}function ensureBytes(y){return isBytes(y)?Uint8Array.from(y):hexToBytes(y)}function normalizeScalar(y){if(typeof y=="number"&&Number.isSafeInteger(y)&&y>0)return BigInt(y);if(typeof y=="bigint"&&isWithinCurveOrder(y))return y;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function mod(y,u=CURVE.P){const h=y%u;return h>=_0n?h:u+h}function pow2(y,u){const{P:h}=CURVE;let v=y;for(;u-- >_0n;)v*=v,v%=h;return v}function sqrtMod(y){const{P:u}=CURVE,h=BigInt(6),v=BigInt(11),w=BigInt(22),b=BigInt(23),E=BigInt(44),$=BigInt(88),M=y*y*y%u,T=M*M*y%u,C=pow2(T,_3n)*T%u,B=pow2(C,_3n)*T%u,N=pow2(B,_2n)*M%u,H=pow2(N,v)*N%u,te=pow2(H,w)*H%u,fe=pow2(te,E)*te%u,ce=pow2(fe,$)*fe%u,le=pow2(ce,E)*te%u,ie=pow2(le,_3n)*T%u,ge=pow2(ie,b)*H%u,pe=pow2(ge,h)*M%u,Me=pow2(pe,_2n);if(Me*Me%u!==y)throw new Error("Cannot find square root");return Me}function invert(y,u=CURVE.P){if(y===_0n||u<=_0n)throw new Error(`invert: expected positive integers, got n=${y} mod=${u}`);let h=mod(y,u),v=u,w=_0n,b=_1n;for(;h!==_0n;){const $=v/h,M=v%h,T=w-b*$;v=h,h=M,w=b,b=T}if(v!==_1n)throw new Error("invert: does not exist");return mod(w,u)}function invertBatch(y,u=CURVE.P){const h=new Array(y.length),v=y.reduce((b,E,$)=>E===_0n?b:(h[$]=b,mod(b*E,u)),_1n),w=invert(v,u);return y.reduceRight((b,E,$)=>E===_0n?b:(h[$]=mod(b*h[$],u),mod(b*E,u)),w),h}function bits2int_2(y){const u=y.length*8-groupLen*8,h=bytesToNumber(y);return u>0?h>>BigInt(u):h}function truncateHash(y,u=!1){const h=bits2int_2(y);if(u)return h;const{n:v}=CURVE;return h>=v?h-v:h}function isWithinCurveOrder(y){return _0n<y&&y<CURVE.n}function isValidFieldElement(y){return _0n<y&&y<CURVE.P}function normalizePrivateKey(y){let u;if(typeof y=="bigint")u=y;else if(typeof y=="number"&&Number.isSafeInteger(y)&&y>0)u=BigInt(y);else if(typeof y=="string"){if(y.length!==2*groupLen)throw new Error("Expected 32 bytes of private key");u=hexToNumber(y)}else if(isBytes(y)){if(y.length!==groupLen)throw new Error("Expected 32 bytes of private key");u=bytesToNumber(y)}else throw new TypeError("Expected valid private key");if(!isWithinCurveOrder(u))throw new Error("Expected private key: 0 < key < n");return u}function normalizeSignature(y){if(y instanceof Signature)return y.assertValidity(),y;try{return Signature.fromDER(y)}catch{return Signature.fromCompact(y)}}Point.BASE._setWindowSize(8);var sha3={exports:{}};(function(y){(function(){var u="input is invalid type",h="finalize already called",v=typeof window=="object",w=v?window:{};w.JS_SHA3_NO_WINDOW&&(v=!1);var b=!v&&typeof self=="object",E=!w.JS_SHA3_NO_NODE_JS&&typeof process$1=="object"&&process$1.versions&&process$1.versions.node;E?w=commonjsGlobal:b&&(w=self);for(var $=!w.JS_SHA3_NO_COMMON_JS&&!0&&y.exports,M=!w.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",T="0123456789abcdef".split(""),C=[31,7936,2031616,520093696],B=[4,1024,262144,67108864],N=[1,256,65536,16777216],H=[6,1536,393216,100663296],te=[0,8,16,24],fe=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],ce=[224,256,384,512],le=[128,256],ie=["hex","buffer","arrayBuffer","array","digest"],ge={128:168,256:136},pe=w.JS_SHA3_NO_NODE_JS||!Array.isArray?function(ae){return Object.prototype.toString.call(ae)==="[object Array]"}:Array.isArray,Me=M&&(w.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(ae){return typeof ae=="object"&&ae.buffer&&ae.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,$e=function(ae){var de=typeof ae;if(de==="string")return[ae,!0];if(de!=="object"||ae===null)throw new Error(u);if(M&&ae.constructor===ArrayBuffer)return[new Uint8Array(ae),!1];if(!pe(ae)&&!Me(ae))throw new Error(u);return[ae,!1]},Pe=function(ae){return $e(ae)[0].length===0},Be=function(ae){for(var de=[],ne=0;ne<ae.length;++ne)de[ne]=ae[ne];return de},Re=function(ae,de,ne){return function(be){return new oe(ae,de,ae).update(be)[ne]()}},je=function(ae,de,ne){return function(be,Ie){return new oe(ae,de,Ie).update(be)[ne]()}},we=function(ae,de,ne){return function(be,Ie,Le,Fe){return ee["cshake"+ae].update(be,Ie,Le,Fe)[ne]()}},D=function(ae,de,ne){return function(be,Ie,Le,Fe){return ee["kmac"+ae].update(be,Ie,Le,Fe)[ne]()}},q=function(ae,de,ne,be){for(var Ie=0;Ie<ie.length;++Ie){var Le=ie[Ie];ae[Le]=de(ne,be,Le)}return ae},O=function(ae,de){var ne=Re(ae,de,"hex");return ne.create=function(){return new oe(ae,de,ae)},ne.update=function(be){return ne.create().update(be)},q(ne,Re,ae,de)},L=function(ae,de){var ne=je(ae,de,"hex");return ne.create=function(be){return new oe(ae,de,be)},ne.update=function(be,Ie){return ne.create(Ie).update(be)},q(ne,je,ae,de)},X=function(ae,de){var ne=ge[ae],be=we(ae,de,"hex");return be.create=function(Ie,Le,Fe){return Pe(Le)&&Pe(Fe)?ee["shake"+ae].create(Ie):new oe(ae,de,Ie).bytepad([Le,Fe],ne)},be.update=function(Ie,Le,Fe,He){return be.create(Le,Fe,He).update(Ie)},q(be,we,ae,de)},j=function(ae,de){var ne=ge[ae],be=D(ae,de,"hex");return be.create=function(Ie,Le,Fe){return new ye(ae,de,Le).bytepad(["KMAC",Fe],ne).bytepad([Ie],ne)},be.update=function(Ie,Le,Fe,He){return be.create(Ie,Fe,He).update(Le)},q(be,D,ae,de)},re=[{name:"keccak",padding:N,bits:ce,createMethod:O},{name:"sha3",padding:H,bits:ce,createMethod:O},{name:"shake",padding:C,bits:le,createMethod:L},{name:"cshake",padding:B,bits:le,createMethod:X},{name:"kmac",padding:B,bits:le,createMethod:j}],ee={},F=[],Q=0;Q<re.length;++Q)for(var U=re[Q],he=U.bits,Oe=0;Oe<he.length;++Oe){var Ve=U.name+"_"+he[Oe];if(F.push(Ve),ee[Ve]=U.createMethod(he[Oe],U.padding),U.name!=="sha3"){var Ae=U.name+he[Oe];F.push(Ae),ee[Ae]=ee[Ve]}}function oe(ae,de,ne){this.blocks=[],this.s=[],this.padding=de,this.outputBits=ne,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(ae<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ne>>5,this.extraBytes=(ne&31)>>3;for(var be=0;be<50;++be)this.s[be]=0}oe.prototype.update=function(ae){if(this.finalized)throw new Error(h);var de=$e(ae);ae=de[0];for(var ne=de[1],be=this.blocks,Ie=this.byteCount,Le=ae.length,Fe=this.blockCount,He=0,tt=this.s,Ne,nt;He<Le;){if(this.reset)for(this.reset=!1,be[0]=this.block,Ne=1;Ne<Fe+1;++Ne)be[Ne]=0;if(ne)for(Ne=this.start;He<Le&&Ne<Ie;++He)nt=ae.charCodeAt(He),nt<128?be[Ne>>2]|=nt<<te[Ne++&3]:nt<2048?(be[Ne>>2]|=(192|nt>>6)<<te[Ne++&3],be[Ne>>2]|=(128|nt&63)<<te[Ne++&3]):nt<55296||nt>=57344?(be[Ne>>2]|=(224|nt>>12)<<te[Ne++&3],be[Ne>>2]|=(128|nt>>6&63)<<te[Ne++&3],be[Ne>>2]|=(128|nt&63)<<te[Ne++&3]):(nt=65536+((nt&1023)<<10|ae.charCodeAt(++He)&1023),be[Ne>>2]|=(240|nt>>18)<<te[Ne++&3],be[Ne>>2]|=(128|nt>>12&63)<<te[Ne++&3],be[Ne>>2]|=(128|nt>>6&63)<<te[Ne++&3],be[Ne>>2]|=(128|nt&63)<<te[Ne++&3]);else for(Ne=this.start;He<Le&&Ne<Ie;++He)be[Ne>>2]|=ae[He]<<te[Ne++&3];if(this.lastByteIndex=Ne,Ne>=Ie){for(this.start=Ne-Ie,this.block=be[Fe],Ne=0;Ne<Fe;++Ne)tt[Ne]^=be[Ne];Ce(tt),this.reset=!0}else this.start=Ne}return this},oe.prototype.encode=function(ae,de){var ne=ae&255,be=1,Ie=[ne];for(ae=ae>>8,ne=ae&255;ne>0;)Ie.unshift(ne),ae=ae>>8,ne=ae&255,++be;return de?Ie.push(be):Ie.unshift(be),this.update(Ie),Ie.length},oe.prototype.encodeString=function(ae){var de=$e(ae);ae=de[0];var ne=de[1],be=0,Ie=ae.length;if(ne)for(var Le=0;Le<ae.length;++Le){var Fe=ae.charCodeAt(Le);Fe<128?be+=1:Fe<2048?be+=2:Fe<55296||Fe>=57344?be+=3:(Fe=65536+((Fe&1023)<<10|ae.charCodeAt(++Le)&1023),be+=4)}else be=Ie;return be+=this.encode(be*8),this.update(ae),be},oe.prototype.bytepad=function(ae,de){for(var ne=this.encode(de),be=0;be<ae.length;++be)ne+=this.encodeString(ae[be]);var Ie=(de-ne%de)%de,Le=[];return Le.length=Ie,this.update(Le),this},oe.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var ae=this.blocks,de=this.lastByteIndex,ne=this.blockCount,be=this.s;if(ae[de>>2]|=this.padding[de&3],this.lastByteIndex===this.byteCount)for(ae[0]=ae[ne],de=1;de<ne+1;++de)ae[de]=0;for(ae[ne-1]|=2147483648,de=0;de<ne;++de)be[de]^=ae[de];Ce(be)}},oe.prototype.toString=oe.prototype.hex=function(){this.finalize();for(var ae=this.blockCount,de=this.s,ne=this.outputBlocks,be=this.extraBytes,Ie=0,Le=0,Fe="",He;Le<ne;){for(Ie=0;Ie<ae&&Le<ne;++Ie,++Le)He=de[Ie],Fe+=T[He>>4&15]+T[He&15]+T[He>>12&15]+T[He>>8&15]+T[He>>20&15]+T[He>>16&15]+T[He>>28&15]+T[He>>24&15];Le%ae===0&&(de=Be(de),Ce(de),Ie=0)}return be&&(He=de[Ie],Fe+=T[He>>4&15]+T[He&15],be>1&&(Fe+=T[He>>12&15]+T[He>>8&15]),be>2&&(Fe+=T[He>>20&15]+T[He>>16&15])),Fe},oe.prototype.arrayBuffer=function(){this.finalize();var ae=this.blockCount,de=this.s,ne=this.outputBlocks,be=this.extraBytes,Ie=0,Le=0,Fe=this.outputBits>>3,He;be?He=new ArrayBuffer(ne+1<<2):He=new ArrayBuffer(Fe);for(var tt=new Uint32Array(He);Le<ne;){for(Ie=0;Ie<ae&&Le<ne;++Ie,++Le)tt[Le]=de[Ie];Le%ae===0&&(de=Be(de),Ce(de))}return be&&(tt[Le]=de[Ie],He=He.slice(0,Fe)),He},oe.prototype.buffer=oe.prototype.arrayBuffer,oe.prototype.digest=oe.prototype.array=function(){this.finalize();for(var ae=this.blockCount,de=this.s,ne=this.outputBlocks,be=this.extraBytes,Ie=0,Le=0,Fe=[],He,tt;Le<ne;){for(Ie=0;Ie<ae&&Le<ne;++Ie,++Le)He=Le<<2,tt=de[Ie],Fe[He]=tt&255,Fe[He+1]=tt>>8&255,Fe[He+2]=tt>>16&255,Fe[He+3]=tt>>24&255;Le%ae===0&&(de=Be(de),Ce(de))}return be&&(He=Le<<2,tt=de[Ie],Fe[He]=tt&255,be>1&&(Fe[He+1]=tt>>8&255),be>2&&(Fe[He+2]=tt>>16&255)),Fe};function ye(ae,de,ne){oe.call(this,ae,de,ne)}ye.prototype=new oe,ye.prototype.finalize=function(){return this.encode(this.outputBits,!0),oe.prototype.finalize.call(this)};var Ce=function(ae){var de,ne,be,Ie,Le,Fe,He,tt,Ne,nt,it,ot,ut,ht,St,Rt,dt,Ct,Dt,yt,zt,Zt,bt,Lt,Nt,_t,Vt,Wt,$t,Qt,Gt,vt,kt,Kt,At,Ft,Jt,ve,J,se,xe,ke,qe,We,ct,wt,st,xt,mt,Mt,Yt,er,rr,qr,Dr,Zr,Hr,Vr,Tr,Nr,Cr,Ar,Wr;for(be=0;be<48;be+=2)Ie=ae[0]^ae[10]^ae[20]^ae[30]^ae[40],Le=ae[1]^ae[11]^ae[21]^ae[31]^ae[41],Fe=ae[2]^ae[12]^ae[22]^ae[32]^ae[42],He=ae[3]^ae[13]^ae[23]^ae[33]^ae[43],tt=ae[4]^ae[14]^ae[24]^ae[34]^ae[44],Ne=ae[5]^ae[15]^ae[25]^ae[35]^ae[45],nt=ae[6]^ae[16]^ae[26]^ae[36]^ae[46],it=ae[7]^ae[17]^ae[27]^ae[37]^ae[47],ot=ae[8]^ae[18]^ae[28]^ae[38]^ae[48],ut=ae[9]^ae[19]^ae[29]^ae[39]^ae[49],de=ot^(Fe<<1|He>>>31),ne=ut^(He<<1|Fe>>>31),ae[0]^=de,ae[1]^=ne,ae[10]^=de,ae[11]^=ne,ae[20]^=de,ae[21]^=ne,ae[30]^=de,ae[31]^=ne,ae[40]^=de,ae[41]^=ne,de=Ie^(tt<<1|Ne>>>31),ne=Le^(Ne<<1|tt>>>31),ae[2]^=de,ae[3]^=ne,ae[12]^=de,ae[13]^=ne,ae[22]^=de,ae[23]^=ne,ae[32]^=de,ae[33]^=ne,ae[42]^=de,ae[43]^=ne,de=Fe^(nt<<1|it>>>31),ne=He^(it<<1|nt>>>31),ae[4]^=de,ae[5]^=ne,ae[14]^=de,ae[15]^=ne,ae[24]^=de,ae[25]^=ne,ae[34]^=de,ae[35]^=ne,ae[44]^=de,ae[45]^=ne,de=tt^(ot<<1|ut>>>31),ne=Ne^(ut<<1|ot>>>31),ae[6]^=de,ae[7]^=ne,ae[16]^=de,ae[17]^=ne,ae[26]^=de,ae[27]^=ne,ae[36]^=de,ae[37]^=ne,ae[46]^=de,ae[47]^=ne,de=nt^(Ie<<1|Le>>>31),ne=it^(Le<<1|Ie>>>31),ae[8]^=de,ae[9]^=ne,ae[18]^=de,ae[19]^=ne,ae[28]^=de,ae[29]^=ne,ae[38]^=de,ae[39]^=ne,ae[48]^=de,ae[49]^=ne,ht=ae[0],St=ae[1],wt=ae[11]<<4|ae[10]>>>28,st=ae[10]<<4|ae[11]>>>28,Wt=ae[20]<<3|ae[21]>>>29,$t=ae[21]<<3|ae[20]>>>29,Nr=ae[31]<<9|ae[30]>>>23,Cr=ae[30]<<9|ae[31]>>>23,ke=ae[40]<<18|ae[41]>>>14,qe=ae[41]<<18|ae[40]>>>14,Kt=ae[2]<<1|ae[3]>>>31,At=ae[3]<<1|ae[2]>>>31,Rt=ae[13]<<12|ae[12]>>>20,dt=ae[12]<<12|ae[13]>>>20,xt=ae[22]<<10|ae[23]>>>22,mt=ae[23]<<10|ae[22]>>>22,Qt=ae[33]<<13|ae[32]>>>19,Gt=ae[32]<<13|ae[33]>>>19,Ar=ae[42]<<2|ae[43]>>>30,Wr=ae[43]<<2|ae[42]>>>30,qr=ae[5]<<30|ae[4]>>>2,Dr=ae[4]<<30|ae[5]>>>2,Ft=ae[14]<<6|ae[15]>>>26,Jt=ae[15]<<6|ae[14]>>>26,Ct=ae[25]<<11|ae[24]>>>21,Dt=ae[24]<<11|ae[25]>>>21,Mt=ae[34]<<15|ae[35]>>>17,Yt=ae[35]<<15|ae[34]>>>17,vt=ae[45]<<29|ae[44]>>>3,kt=ae[44]<<29|ae[45]>>>3,Lt=ae[6]<<28|ae[7]>>>4,Nt=ae[7]<<28|ae[6]>>>4,Zr=ae[17]<<23|ae[16]>>>9,Hr=ae[16]<<23|ae[17]>>>9,ve=ae[26]<<25|ae[27]>>>7,J=ae[27]<<25|ae[26]>>>7,yt=ae[36]<<21|ae[37]>>>11,zt=ae[37]<<21|ae[36]>>>11,er=ae[47]<<24|ae[46]>>>8,rr=ae[46]<<24|ae[47]>>>8,We=ae[8]<<27|ae[9]>>>5,ct=ae[9]<<27|ae[8]>>>5,_t=ae[18]<<20|ae[19]>>>12,Vt=ae[19]<<20|ae[18]>>>12,Vr=ae[29]<<7|ae[28]>>>25,Tr=ae[28]<<7|ae[29]>>>25,se=ae[38]<<8|ae[39]>>>24,xe=ae[39]<<8|ae[38]>>>24,Zt=ae[48]<<14|ae[49]>>>18,bt=ae[49]<<14|ae[48]>>>18,ae[0]=ht^~Rt&Ct,ae[1]=St^~dt&Dt,ae[10]=Lt^~_t&Wt,ae[11]=Nt^~Vt&$t,ae[20]=Kt^~Ft&ve,ae[21]=At^~Jt&J,ae[30]=We^~wt&xt,ae[31]=ct^~st&mt,ae[40]=qr^~Zr&Vr,ae[41]=Dr^~Hr&Tr,ae[2]=Rt^~Ct&yt,ae[3]=dt^~Dt&zt,ae[12]=_t^~Wt&Qt,ae[13]=Vt^~$t&Gt,ae[22]=Ft^~ve&se,ae[23]=Jt^~J&xe,ae[32]=wt^~xt&Mt,ae[33]=st^~mt&Yt,ae[42]=Zr^~Vr&Nr,ae[43]=Hr^~Tr&Cr,ae[4]=Ct^~yt&Zt,ae[5]=Dt^~zt&bt,ae[14]=Wt^~Qt&vt,ae[15]=$t^~Gt&kt,ae[24]=ve^~se&ke,ae[25]=J^~xe&qe,ae[34]=xt^~Mt&er,ae[35]=mt^~Yt&rr,ae[44]=Vr^~Nr&Ar,ae[45]=Tr^~Cr&Wr,ae[6]=yt^~Zt&ht,ae[7]=zt^~bt&St,ae[16]=Qt^~vt&Lt,ae[17]=Gt^~kt&Nt,ae[26]=se^~ke&Kt,ae[27]=xe^~qe&At,ae[36]=Mt^~er&We,ae[37]=Yt^~rr&ct,ae[46]=Nr^~Ar&qr,ae[47]=Cr^~Wr&Dr,ae[8]=Zt^~ht&Rt,ae[9]=bt^~St&dt,ae[18]=vt^~Lt&_t,ae[19]=kt^~Nt&Vt,ae[28]=ke^~Kt&Ft,ae[29]=qe^~At&Jt,ae[38]=er^~We&wt,ae[39]=rr^~ct&st,ae[48]=Ar^~qr&Zr,ae[49]=Wr^~Dr&Hr,ae[0]^=fe[be],ae[1]^=fe[be+1]};if($)y.exports=ee;else for(Q=0;Q<F.length;++Q)w[F[Q]]=ee[F[Q]]})()})(sha3),new Logger("enr");var TransportProtocol;(function(y){y.TCP="tcp",y.UDP="udp"})(TransportProtocol||(TransportProtocol={}));var TransportProtocolPerIpVersion;(function(y){y.TCP4="tcp4",y.UDP4="udp4",y.TCP6="tcp6",y.UDP6="udp6"})(TransportProtocolPerIpVersion||(TransportProtocolPerIpVersion={})),new Logger("enr:decoder"),Object.assign(weald("dns-over-http-resolver"),{error:weald("dns-over-http-resolver:error")}),new Logger("dns-over-https");var base32={exports:{}};(function(y){(function(){var u=typeof window=="object"?window:{},h=!u.HI_BASE32_NO_NODE_JS&&typeof process$1=="object"&&process$1.versions&&process$1.versions.node;h&&(u=commonjsGlobal);var v=!u.HI_BASE32_NO_COMMON_JS&&!0&&y.exports,w="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),b={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},E=[0,0,0,0,0,0,0,0],$=function(ce,le){le.length>10&&(le="..."+le.substr(-10));var ie=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+ce+" bytes: "+le+" <-");throw ie.position=ce,ie},M=function(ce){for(var le="",ie=ce.length,ge=0,pe=0,Me,$e;ge<ie;){if(Me=ce[ge++],Me<=127){le+=String.fromCharCode(Me);continue}else Me>191&&Me<=223?($e=Me&31,pe=1):Me<=239?($e=Me&15,pe=2):Me<=247?($e=Me&7,pe=3):$(ge,le);for(var Pe=0;Pe<pe;++Pe)Me=ce[ge++],(Me<128||Me>191)&&$(ge,le),$e<<=6,$e+=Me&63;$e>=55296&&$e<=57343&&$(ge,le),$e>1114111&&$(ge,le),$e<=65535?le+=String.fromCharCode($e):($e-=65536,le+=String.fromCharCode(($e>>10)+55296),le+=String.fromCharCode(($e&1023)+56320))}return le},T=function(ce){if(ce==="")return[];if(!/^[A-Z2-7=]+$/.test(ce))throw new Error("Invalid base32 characters");ce=ce.replace(/=/g,"");for(var le,ie,ge,pe,Me,$e,Pe,Be,Re=[],je=0,we=ce.length,D=0,q=we>>3<<3;D<q;)le=b[ce.charAt(D++)],ie=b[ce.charAt(D++)],ge=b[ce.charAt(D++)],pe=b[ce.charAt(D++)],Me=b[ce.charAt(D++)],$e=b[ce.charAt(D++)],Pe=b[ce.charAt(D++)],Be=b[ce.charAt(D++)],Re[je++]=(le<<3|ie>>>2)&255,Re[je++]=(ie<<6|ge<<1|pe>>>4)&255,Re[je++]=(pe<<4|Me>>>1)&255,Re[je++]=(Me<<7|$e<<2|Pe>>>3)&255,Re[je++]=(Pe<<5|Be)&255;var O=we-q;return O===2?(le=b[ce.charAt(D++)],ie=b[ce.charAt(D++)],Re[je++]=(le<<3|ie>>>2)&255):O===4?(le=b[ce.charAt(D++)],ie=b[ce.charAt(D++)],ge=b[ce.charAt(D++)],pe=b[ce.charAt(D++)],Re[je++]=(le<<3|ie>>>2)&255,Re[je++]=(ie<<6|ge<<1|pe>>>4)&255):O===5?(le=b[ce.charAt(D++)],ie=b[ce.charAt(D++)],ge=b[ce.charAt(D++)],pe=b[ce.charAt(D++)],Me=b[ce.charAt(D++)],Re[je++]=(le<<3|ie>>>2)&255,Re[je++]=(ie<<6|ge<<1|pe>>>4)&255,Re[je++]=(pe<<4|Me>>>1)&255):O===7&&(le=b[ce.charAt(D++)],ie=b[ce.charAt(D++)],ge=b[ce.charAt(D++)],pe=b[ce.charAt(D++)],Me=b[ce.charAt(D++)],$e=b[ce.charAt(D++)],Pe=b[ce.charAt(D++)],Re[je++]=(le<<3|ie>>>2)&255,Re[je++]=(ie<<6|ge<<1|pe>>>4)&255,Re[je++]=(pe<<4|Me>>>1)&255,Re[je++]=(Me<<7|$e<<2|Pe>>>3)&255),Re},C=function(ce){for(var le,ie,ge,pe,Me,$e="",Pe=ce.length,Be=0,Re=parseInt(Pe/5)*5;Be<Re;)le=ce.charCodeAt(Be++),ie=ce.charCodeAt(Be++),ge=ce.charCodeAt(Be++),pe=ce.charCodeAt(Be++),Me=ce.charCodeAt(Be++),$e+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[(ie<<4|ge>>>4)&31]+w[(ge<<1|pe>>>7)&31]+w[pe>>>2&31]+w[(pe<<3|Me>>>5)&31]+w[Me&31];var je=Pe-Re;return je===1?(le=ce.charCodeAt(Be),$e+=w[le>>>3]+w[le<<2&31]+"======"):je===2?(le=ce.charCodeAt(Be++),ie=ce.charCodeAt(Be),$e+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[ie<<4&31]+"===="):je===3?(le=ce.charCodeAt(Be++),ie=ce.charCodeAt(Be++),ge=ce.charCodeAt(Be),$e+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[(ie<<4|ge>>>4)&31]+w[ge<<1&31]+"==="):je===4&&(le=ce.charCodeAt(Be++),ie=ce.charCodeAt(Be++),ge=ce.charCodeAt(Be++),pe=ce.charCodeAt(Be),$e+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[(ie<<4|ge>>>4)&31]+w[(ge<<1|pe>>>7)&31]+w[pe>>>2&31]+w[pe<<3&31]+"="),$e},B=function(ce){var le,ie,ge,pe,Me,$e,Pe=!1,Be="",Re=0,je,we=0,D=ce.length;if(ce==="")return Be;do{for(E[0]=E[5],E[1]=E[6],E[2]=E[7],je=we;Re<D&&je<5;++Re)$e=ce.charCodeAt(Re),$e<128?E[je++]=$e:$e<2048?(E[je++]=192|$e>>6,E[je++]=128|$e&63):$e<55296||$e>=57344?(E[je++]=224|$e>>12,E[je++]=128|$e>>6&63,E[je++]=128|$e&63):($e=65536+(($e&1023)<<10|ce.charCodeAt(++Re)&1023),E[je++]=240|$e>>18,E[je++]=128|$e>>12&63,E[je++]=128|$e>>6&63,E[je++]=128|$e&63);we=je-5,Re===D&&++Re,Re>D&&je<6&&(Pe=!0),le=E[0],je>4?(ie=E[1],ge=E[2],pe=E[3],Me=E[4],Be+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[(ie<<4|ge>>>4)&31]+w[(ge<<1|pe>>>7)&31]+w[pe>>>2&31]+w[(pe<<3|Me>>>5)&31]+w[Me&31]):je===1?Be+=w[le>>>3]+w[le<<2&31]+"======":je===2?(ie=E[1],Be+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[ie<<4&31]+"===="):je===3?(ie=E[1],ge=E[2],Be+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[(ie<<4|ge>>>4)&31]+w[ge<<1&31]+"==="):(ie=E[1],ge=E[2],pe=E[3],Be+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[(ie<<4|ge>>>4)&31]+w[(ge<<1|pe>>>7)&31]+w[pe>>>2&31]+w[pe<<3&31]+"=")}while(!Pe);return Be},N=function(ce){for(var le,ie,ge,pe,Me,$e="",Pe=ce.length,Be=0,Re=parseInt(Pe/5)*5;Be<Re;)le=ce[Be++],ie=ce[Be++],ge=ce[Be++],pe=ce[Be++],Me=ce[Be++],$e+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[(ie<<4|ge>>>4)&31]+w[(ge<<1|pe>>>7)&31]+w[pe>>>2&31]+w[(pe<<3|Me>>>5)&31]+w[Me&31];var je=Pe-Re;return je===1?(le=ce[Be],$e+=w[le>>>3]+w[le<<2&31]+"======"):je===2?(le=ce[Be++],ie=ce[Be],$e+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[ie<<4&31]+"===="):je===3?(le=ce[Be++],ie=ce[Be++],ge=ce[Be],$e+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[(ie<<4|ge>>>4)&31]+w[ge<<1&31]+"==="):je===4&&(le=ce[Be++],ie=ce[Be++],ge=ce[Be++],pe=ce[Be],$e+=w[le>>>3]+w[(le<<2|ie>>>6)&31]+w[ie>>>1&31]+w[(ie<<4|ge>>>4)&31]+w[(ge<<1|pe>>>7)&31]+w[pe>>>2&31]+w[pe<<3&31]+"="),$e},H=function(ce,le){var ie=typeof ce!="string";return ie&&ce.constructor===ArrayBuffer&&(ce=new Uint8Array(ce)),ie?N(ce):le?C(ce):B(ce)},te=function(ce,le){if(!le)return M(T(ce));if(ce==="")return"";if(!/^[A-Z2-7=]+$/.test(ce))throw new Error("Invalid base32 characters");var ie,ge,pe,Me,$e,Pe,Be,Re,je="",we=ce.indexOf("=");we===-1&&(we=ce.length);for(var D=0,q=we>>3<<3;D<q;)ie=b[ce.charAt(D++)],ge=b[ce.charAt(D++)],pe=b[ce.charAt(D++)],Me=b[ce.charAt(D++)],$e=b[ce.charAt(D++)],Pe=b[ce.charAt(D++)],Be=b[ce.charAt(D++)],Re=b[ce.charAt(D++)],je+=String.fromCharCode((ie<<3|ge>>>2)&255)+String.fromCharCode((ge<<6|pe<<1|Me>>>4)&255)+String.fromCharCode((Me<<4|$e>>>1)&255)+String.fromCharCode(($e<<7|Pe<<2|Be>>>3)&255)+String.fromCharCode((Be<<5|Re)&255);var O=we-q;return O===2?(ie=b[ce.charAt(D++)],ge=b[ce.charAt(D++)],je+=String.fromCharCode((ie<<3|ge>>>2)&255)):O===4?(ie=b[ce.charAt(D++)],ge=b[ce.charAt(D++)],pe=b[ce.charAt(D++)],Me=b[ce.charAt(D++)],je+=String.fromCharCode((ie<<3|ge>>>2)&255)+String.fromCharCode((ge<<6|pe<<1|Me>>>4)&255)):O===5?(ie=b[ce.charAt(D++)],ge=b[ce.charAt(D++)],pe=b[ce.charAt(D++)],Me=b[ce.charAt(D++)],$e=b[ce.charAt(D++)],je+=String.fromCharCode((ie<<3|ge>>>2)&255)+String.fromCharCode((ge<<6|pe<<1|Me>>>4)&255)+String.fromCharCode((Me<<4|$e>>>1)&255)):O===7&&(ie=b[ce.charAt(D++)],ge=b[ce.charAt(D++)],pe=b[ce.charAt(D++)],Me=b[ce.charAt(D++)],$e=b[ce.charAt(D++)],Pe=b[ce.charAt(D++)],Be=b[ce.charAt(D++)],je+=String.fromCharCode((ie<<3|ge>>>2)&255)+String.fromCharCode((ge<<6|pe<<1|Me>>>4)&255)+String.fromCharCode((Me<<4|$e>>>1)&255)+String.fromCharCode(($e<<7|Pe<<2|Be>>>3)&255)),je},fe={encode:H,decode:te};te.asBytes=T,v?y.exports=fe:u.base32=fe})()})(base32),new Logger("discovery:fetch_nodes"),new Logger("discovery:dns"),new Logger("peer-discovery-dns"),Tags.PEER_EXCHANGE,new Logger("peer-exchange"),new Logger("peer-exchange-discovery"),Tags.PEER_CACHE,new Logger("peer-cache"),new Logger("sdk:create");var excHandler=0,NTI134217745={size:0,kind:17,base:null,node:null,finalizer:null},NTI134217749={size:0,kind:17,base:null,node:null,finalizer:null},NTI134217751={size:0,kind:17,base:null,node:null,finalizer:null},NTI134217743={size:0,kind:17,base:null,node:null,finalizer:null},NTI33555167={size:0,kind:17,base:null,node:null,finalizer:null},NTI33555175={size:0,kind:22,base:null,node:null,finalizer:null},NTI33554449={size:0,kind:28,base:null,node:null,finalizer:null},NTI33554450={size:0,kind:29,base:null,node:null,finalizer:null},NTI33555174={size:0,kind:22,base:null,node:null,finalizer:null},NTI33555171={size:0,kind:17,base:null,node:null,finalizer:null},NTI33555172={size:0,kind:17,base:null,node:null,finalizer:null},NTI134217741={size:0,kind:17,base:null,node:null,finalizer:null},NTI134217742={size:0,kind:17,base:null,node:null,finalizer:null},NNI134217742={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI134217742.node=NNI134217742;var NNI134217741={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI134217741.node=NNI134217741;var NNI33555172={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI33555172.node=NNI33555172,NTI33555174.base=NTI33555171,NTI33555175.base=NTI33555171;var NNI33555171={kind:2,len:5,offset:0,typ:null,name:null,sons:[{kind:1,offset:"parent",len:0,typ:NTI33555174,name:"parent",sons:null},{kind:1,offset:"name",len:0,typ:NTI33554450,name:"name",sons:null},{kind:1,offset:"message",len:0,typ:NTI33554449,name:"msg",sons:null},{kind:1,offset:"trace",len:0,typ:NTI33554449,name:"trace",sons:null},{kind:1,offset:"up",len:0,typ:NTI33555175,name:"up",sons:null}]};NTI33555171.node=NNI33555171;var NNI33555167={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI33555167.node=NNI33555167,NTI33555171.base=NTI33555167,NTI33555172.base=NTI33555171,NTI134217741.base=NTI33555172,NTI134217742.base=NTI134217741;var NNI134217743={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI134217743.node=NNI134217743,NTI134217743.base=NTI134217741;var NNI134217751={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI134217751.node=NNI134217751,NTI134217751.base=NTI33555172;var NNI134217749={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI134217749.node=NNI134217749,NTI134217749.base=NTI33555172;var NNI134217745={kind:2,len:0,offset:0,typ:null,name:null,sons:[]};NTI134217745.node=NNI134217745,NTI134217745.base=NTI33555172;function toJSStr(y){var u=null,h=newSeq__system_u2508(y.length),v=0,w=0;e:for(;;){if(!(v<y.length))break e;var b=y[v];if(b<128)h[w]=String.fromCharCode(b),v+=1;else{var E=newSeq__system_u2508(0);t:for(;;){var $=b.toString(16);if(($==null?0:$.length)==1?E.push("%0"):E.push("%"),E.push($),v+=1,y.length<=v||y[v]<128)break t;b=y[v]}++excHandler;try{h[w]=decodeURIComponent(E.join("")),--excHandler}catch{--excHandler,h[w]=E.join("")}finally{}}w+=1}if(h.length<w)for(var M=h.length;M<w;++M)h.push(null);else h.length=w;return u=h.join(""),u}function raiseException(y,u){throw y.name=u,excHandler==0&&unhandledException(y),y}function modInt(y,u){return u==0&&raiseDivByZero(),u==-1&&y==2147483647&&raiseOverflow(),Math.trunc(y%u)}function absInt(y){var u,h=0;return y<0?u=y*-1:u=y,h=u,h}function divInt(y,u){return u==0&&raiseDivByZero(),u==-1&&y==2147483647&&raiseOverflow(),Math.trunc(y/u)}function mulInt(y,u){var h=y*u;return checkOverflowInt(h),h}function subInt(y,u){var h=y-u;return checkOverflowInt(h),h}function addInt(y,u){var h=y+u;return checkOverflowInt(h),h}function chckRange(y,u,h){var v=0;e:if(u<=y&&y<=h){v=y;break e}else raiseRangeError();return v}function setConstr(){for(var y={},u=0;u<arguments.length;++u){var h=arguments[u];if(typeof h=="object")for(var v=h[0];v<=h[1];++v)y[v]=!0;else y[h]=!0}return y}var ConstSet1=setConstr(17,16,4,18,27,19,23,22,21);function nimCopy(y,u,h){var v=null;switch(h.kind){case 21:case 22:case 23:case 5:isFatPointer__system_u2866(h)?v=[u[0],u[1]]:v=u;break;case 19:if(y==null)y={};else for(var w in y)delete y[w];for(var w in u)y[w]=u[w];v=y;break;case 18:case 17:h.base!=null?v=nimCopy(y,u,h.base):h.kind==17?v=y??{m_type:h}:v=y??{},nimCopyAux(v,u,h.node);break;case 4:case 16:if(ArrayBuffer.isView(u))y==null||y.length!=u.length?y=new u.constructor(u):y.set(u,0),v=y;else if(u===null)v=null;else{(y==null||y.length!=u.length)&&(y=new Array(u.length)),v=y;for(var b=0;b<u.length;++b)v[b]=nimCopy(v[b],u[b],h.base)}break;case 24:case 27:if(u===null)v=null;else{(y==null||y.length!=u.length)&&(y=new Array(u.length)),v=y;for(var b=0;b<u.length;++b)v[b]=nimCopy(v[b],u[b],h.base)}break;case 28:u!==null&&(v=u.slice(0));break;default:v=u;break}return v}function chckIndx(y,u,h){var v=0;e:if(u<=y&&y<=h){v=y;break e}else raiseIndexError(y,u,h);return v}function add__system_u1943(y,u,h){y[u]===null&&(y[u]=[]);var v=y[u].length;y[u].length+=h.length;for(var w=0;w<h.length;++w)y[u][v+w]=h.charCodeAt(w)}function newSeq__system_u2508(y){var u=[];u=new Array(y);for(var h=0;h<y;++h)u[h]=null;return u}function unhandledException(y){var u=[[]];y.message.length!=0?(u[0].push.apply(u[0],[69,114,114,111,114,58,32,117,110,104,97,110,100,108,101,100,32,101,120,99,101,112,116,105,111,110,58,32]),u[0].push.apply(u[0],y.message)):u[0].push.apply(u[0],[69,114,114,111,114,58,32,117,110,104,97,110,100,108,101,100,32,101,120,99,101,112,116,105,111,110]),u[0].push.apply(u[0],[32,91]),add__system_u1943(u,0,y.name),u[0].push.apply(u[0],[93,10]);var h=toJSStr(u[0]);throw typeof Error<"u"?new Error(h):h}function raiseDivByZero(){raiseException({message:[100,105,118,105,115,105,111,110,32,98,121,32,122,101,114,111],parent:null,m_type:NTI134217742,name:null,trace:[],up:null},"DivByZeroDefect")}function raiseOverflow(){raiseException({message:[111,118,101,114,45,32,111,114,32,117,110,100,101,114,102,108,111,119],parent:null,m_type:NTI134217743,name:null,trace:[],up:null},"OverflowDefect")}function checkOverflowInt(y){(y>2147483647||y<-2147483648)&&raiseOverflow()}function raiseRangeError(){raiseException({message:[118,97,108,117,101,32,111,117,116,32,111,102,32,114,97,110,103,101],parent:null,m_type:NTI134217751,name:null,trace:[],up:null},"RangeDefect")}function addChars__stdZprivateZdigitsutils_u202(y,u,h,v,w){var b,E=y[u].length;if(y[u].length<(b=chckRange(addInt(E,w),0,2147483647),b))for(var $=y[u].length;$<b;++$)y[u].push(0);else y[u].length=b;{var M=0,T=0;e:for(;;){if(!(T<w))break e;M=T,y[u][chckIndx(addInt(E,M),0,y[u].length-1)]=h.charCodeAt(chckIndx(addInt(v,M),0,h.length-1)),T=addInt(T,1)}}}function addChars__stdZprivateZdigitsutils_u198(y,u,h){addChars__stdZprivateZdigitsutils_u202(y,u,h,0,h==null?0:h.length)}function addInt__stdZprivateZdigitsutils_u223(y,u,h){addChars__stdZprivateZdigitsutils_u198(y,u,h+"")}function addInt__stdZprivateZdigitsutils_u241(y,u,h){addInt__stdZprivateZdigitsutils_u223(y,u,h)}function HEX24__systemZdollars_u8(y){var u=[[]];return addInt__stdZprivateZdigitsutils_u241(u,0,y),u[0]}function isFatPointer__system_u2866(y){var u=!1;e:{u=ConstSet1[y.base.kind]==null;break e}return u}function nimCopyAux(y,u,h){switch(h.kind){case 0:break;case 1:y[h.offset]=nimCopy(y[h.offset],u[h.offset],h.typ);break;case 2:for(var v=0;v<h.sons.length;v++)nimCopyAux(y,u,h.sons[v]);break;case 3:y[h.offset]=nimCopy(y[h.offset],u[h.offset],h.typ);for(var v=0;v<h.sons.length;++v)nimCopyAux(y,u,h.sons[v][1]);break}}function raiseIndexError(y,u,h){var v;h<u?v=[105,110,100,101,120,32,111,117,116,32,111,102,32,98,111,117,110,100,115,44,32,116,104,101,32,99,111,110,116,97,105,110,101,114,32,105,115,32,101,109,112,116,121]:v=[105,110,100,101,120,32].concat(HEX24__systemZdollars_u8(y),[32,110,111,116,32,105,110,32],HEX24__systemZdollars_u8(u),[32,46,46,32],HEX24__systemZdollars_u8(h)),raiseException({message:nimCopy(null,v,NTI33554449),parent:null,m_type:NTI134217749,name:null,trace:[],up:null},"IndexDefect")}function imul__pureZhashes_u340(y,u){var h=0,v=65535,w=(y>>>16&v)>>>0,b=(y&v)>>>0,E=(u>>>16&v)>>>0,$=(u&v)>>>0;return h=(b*$>>>0)+((w*$>>>0)+(b*E>>>0)>>>0<<16>>>0)>>>0,h}function rotl32__pureZhashes_u361(y,u){var h=0;return h=(y<<u>>>0|y>>>subInt(32,u))>>>0,h}function murmurHash__pureZhashes_u373(y){var u=0;e:{var h=y.length,v=4,w=divInt(h,v),b=0,E=0;t:for(;;){if(!(E<mulInt(w,v)))break t;var $=0,M=v;r:for(;;){if(!(0<M))break r;M=subInt(M,1),$=($<<8>>>0|Number(BigInt.asUintN(32,BigInt(y[chckIndx(addInt(E,M),0,y.length-1)]))))>>>0}E=addInt(E,v),$=imul__pureZhashes_u340($,3432918353),$=rotl32__pureZhashes_u361($,15),$=imul__pureZhashes_u340($,461845907),b=(b^$)>>>0,b=rotl32__pureZhashes_u361(b,13),b=(b*5>>>0)+3864292196>>>0}var T=0,C=modInt(h,v);t:for(;;){if(!(0<C))break t;C=subInt(C,1),T=(T<<8>>>0|Number(BigInt.asUintN(32,BigInt(y[chckIndx(addInt(E,C),0,y.length-1)]))))>>>0}T=imul__pureZhashes_u340(T,3432918353),T=rotl32__pureZhashes_u361(T,15),T=imul__pureZhashes_u340(T,461845907),b=(b^T)>>>0,b=(b^Number(BigInt.asUintN(32,BigInt(h))))>>>0,b=(b^b>>>16)>>>0,b=imul__pureZhashes_u340(b,2246822507),b=(b^b>>>13)>>>0,b=imul__pureZhashes_u340(b,3266489909),b=(b^b>>>16)>>>0,u=Number(BigInt.asIntN(32,BigInt(b)));break e}return u}function hash__pureZhashes_u782(y){var u=0;return u=murmurHash__pureZhashes_u373(y.slice(0,y.length-1+1)),u}function hashN__nim95hash_u2(y,u,h){var v=0,w=modInt(absInt(hash__pureZhashes_u782(y)),h),b=modInt(absInt(hash__pureZhashes_u782(y.concat([32,98]))),h);return v=modInt(absInt(addInt(w,mulInt(u,b))),h),v}function sysFatal__stdZassertions_u45(y){raiseException({message:nimCopy(null,y,NTI33554449),m_type:NTI134217745,parent:null,name:null,trace:[],up:null},"AssertionDefect")}function raiseAssert__stdZassertions_u43(y){sysFatal__stdZassertions_u45(y)}function failedAssertImpl__stdZassertions_u85(y){raiseAssert__stdZassertions_u43(y)}hashN__nim95hash_u2([100,117,109,109,121],0,1)!=0&&failedAssertImpl__stdZassertions_u85([110,105,109,95,104,97,115,104,46,110,105,109,40,50,54,44,32,51,41,32,96,104,97,115,104,78,40,34,100,117,109,109,121,34,44,32,48,44,32,49,41,32,61,61,32,48,96,32]);function hashN(y,u,h){const v=Array.from(y).map(w=>w.charCodeAt(0));return hashN__nim95hash_u2(v,u,h)}const kErrors=[new Float32Array([1]),new Float32Array([1,1,.393,.283,.221,.181,.154,.133,.118,.105,.0952,.0869,.08,.074,.0689,.0645,.0606,.0571,.054,.0513,.0488,.0465,.0444,.0425,.0408,.0392,.0377,.0364,.0351,.0339,.0328,.0317,.0308]),new Float32Array([1,1,.4,.237,.155,.109,.0804,.0618,.0489,.0397,.0329,.0276,.0236,.0203,.0177,.0156,.0138,.0123,.0111,.00998,.00906,.00825,.00755,.00694,.00639,.00591,.00548,.0051,.00475,.00444,.00416,.0039,.00367]),new Float32Array([1,1,1,.253,.147,.092,.0609,.0423,.0306,.0228,.0174,.0136,.0108,.00875,.00718,.00596,.0108,.00875,.00718,.00596,.005,.00423,.00362,.00312,.0027,.00236,.00207,.00183,.00162,.00145,.00129,.00116,.00105,949e-6,862e-6,785e-6,717e-6]),new Float32Array([1,1,1,1,.16,.092,.0561,.0359,.024,.0166,.0118,.00864,.00646,.00492,.00381,.003,.00239,.00193,.00158,.0013,.00108,905e-6,764e-6,649e-6,555e-6,478e-6,413e-6,359e-6,314e-6,276e-6,243e-6,215e-6,191e-6]),new Float32Array([1,1,1,1,1,.101,.0578,.0347,.0217,.0141,.00943,.0065,.00459,.00332,.00244,.00183,.00139,.00107,839e-6,663e-6,53e-5,427e-6,347e-6,285e-6,235e-6,196e-6,164e-6,138e-6,117e-6,996e-7,853e-7,733e-7,633e-7]),new Float32Array([1,1,1,1,1,1,.0638,.0364,.0216,.0133,.00844,.00552,.00371,.00255,.00179,.00128,935e-6,692e-6,519e-6,394e-6,303e-6,236e-6,185e-6,147e-6,117e-6,944e-7,766e-7,626e-7,515e-7,426e-7,355e-7,297e-7,25e-6]),new Float32Array([1,1,1,1,1,1,1,1,.0229,.0135,.00819,.00513,.00329,.00217,.00146,.001,702e-6,499e-6,36e-5,264e-6,196e-6,147e-6,112e-6,856e-7,663e-7,518e-7,408e-7,324e-7,259e-7,209e-7,169e-7,138e-7,113e-7]),new Float32Array([1,1,1,1,1,1,1,1,1,.0145,.00846,.00509,.00314,.00199,.00129,852e-6,574e-6,394e-6,275e-6,194e-6,14e-5,101e-6,746e-7,555e-7,417e-7,316e-7,242e-7,187e-7,146e-7,114e-7,901e-8,716e-8,573e-8]),new Float32Array([1,1,1,1,1,1,1,1,1,1,1,.00531,.00317,.00194,.00121,775e-6,505e-6,335e-6,226e-6,155e-6,108e-6,759e-7,542e-7,392e-7,286e-7,211e-7,157e-7,118e-7,896e-8,685e-8,528e-8,41e-7,32e-7]),new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,.00334,.00198,.0012,744e-6,47e-5,302e-6,198e-6,132e-6,889e-7,609e-7,423e-7,297e-7,211e-7,152e-7,11e-6,807e-8,597e-8,445e-8,335e-8,254e-8,194e-8]),new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,.0021,.00124,747e-6,459e-6,287e-6,183e-6,118e-6,777e-7,518e-7,35e-6,24e-6,166e-7,116e-7,823e-8,589e-8,425e-8,31e-7,228e-8,169e-8,126e-8]),new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,778e-6,466e-6,284e-6,176e-6,111e-6,712e-7,463e-7,305e-7,204e-7,138e-7,942e-8,652e-8,456e-8,322e-8,229e-8,165e-8,12e-7,874e-9])],KTooLargeError="K must be <= 12",NoSuitableRatioError="Specified value of k and error rate not achievable using less than 4 bytes / element.";function getMOverNBitsForK(y,u,h=kErrors){if(y<0||y>12)throw new Error(KTooLargeError);for(let v=2;v<h[y].length;v++)if(h[y][v]<u)return v;throw new Error(NoSuitableRatioError)}const sizeOfInt=8;class BloomFilter{constructor(u,h){Ke(this,"totalBits");Ke(this,"data",[]);Ke(this,"kHashes");Ke(this,"errorRate");Ke(this,"options");Ke(this,"hashN");this.options=u;let v,w=u.kHashes??0;const b=u.forceNBitsPerElem??0;if(w<1){const M=Math.ceil(-1*(Math.log(u.errorRate)/Math.pow(Math.log(2),2)));w=Math.round(Math.log(2)*M),v=Math.round(M)}else b<1?v=getMOverNBitsForK(w,u.errorRate):v=b;const E=u.capacity*v,$=1+Math.floor(E/(sizeOfInt*8));this.totalBits=E,this.data=new Array($),this.data.fill(BigInt(0)),this.kHashes=w,this.hashN=h,this.errorRate=u.errorRate}computeHashes(u){const h=new Array(this.kHashes);for(let v=0;v<this.kHashes;v++)h[v]=this.hashN(u,v,this.totalBits);return h}insert(u){const h=this.computeHashes(u);for(const v of h){const w=Math.floor(v/(sizeOfInt*8)),b=v%(sizeOfInt*8);this.data[w]=this.data[w]|BigInt(1)<<BigInt(b)}}lookup(u){const h=this.computeHashes(u);for(const v of h){const w=Math.floor(v/(sizeOfInt*8)),b=v%(sizeOfInt*8),E=this.data[w];if(E!=(E|BigInt(1)<<BigInt(b)))return!1}return!0}toBytes(){const u=new ArrayBuffer(this.data.length*8),h=new DataView(u);for(let v=0;v<this.data.length;v++)h.setBigInt64(v*8,this.data[v]);return new Uint8Array(u)}static fromBytes(u,h,v){const w=new BloomFilter(h,v),b=new DataView(u.buffer,u.byteOffset,u.byteLength);for(let E=0;E<w.data.length;E++)w.data[E]=b.getBigUint64(E*8,!1);return w}}class DefaultBloomFilter extends BloomFilter{constructor(u){super(u,hashN)}static fromBytes(u,h){return BloomFilter.fromBytes(u,h,hashN)}}var Command;(function(y){y.Send="send",y.Receive="receive",y.SendEphemeral="sendEphemeral"})(Command||(Command={}));var MessageChannelEvent;(function(y){y.OutMessageSent="sds:out:message-sent",y.InMessageDelivered="sds:in:message-delivered",y.InMessageReceived="sds:in:message-received",y.OutMessageAcknowledged="sds:out:message-acknowledged",y.OutMessagePossiblyAcknowledged="sds:out:message-possibly-acknowledged",y.InMessageMissing="sds:in:message-missing",y.OutSyncSent="sds:out:sync-sent",y.InSyncReceived="sds:in:sync-received",y.InMessageLost="sds:in:message-irretrievably-lost",y.ErrorTask="sds:error-task"})(MessageChannelEvent||(MessageChannelEvent={}));var lodash={exports:{}};/**
|
|
32
|
-
* @license
|
|
33
|
-
* Lodash <https://lodash.com/>
|
|
34
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
35
|
-
* Released under MIT license <https://lodash.com/license>
|
|
36
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
37
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
38
|
-
*/lodash.exports,function(y,u){(function(){var h,v="4.17.21",w=200,b="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",E="Expected a function",$="Invalid `variable` option passed into `_.template`",M="__lodash_hash_undefined__",T=500,C="__lodash_placeholder__",B=1,N=2,H=4,te=1,fe=2,ce=1,le=2,ie=4,ge=8,pe=16,Me=32,$e=64,Pe=128,Be=256,Re=512,je=30,we="...",D=800,q=16,O=1,L=2,X=3,j=1/0,re=9007199254740991,ee=17976931348623157e292,F=NaN,Q=4294967295,U=Q-1,he=Q>>>1,Oe=[["ary",Pe],["bind",ce],["bindKey",le],["curry",ge],["curryRight",pe],["flip",Re],["partial",Me],["partialRight",$e],["rearg",Be]],Ve="[object Arguments]",Ae="[object Array]",oe="[object AsyncFunction]",ye="[object Boolean]",Ce="[object Date]",ae="[object DOMException]",de="[object Error]",ne="[object Function]",be="[object GeneratorFunction]",Ie="[object Map]",Le="[object Number]",Fe="[object Null]",He="[object Object]",tt="[object Promise]",Ne="[object Proxy]",nt="[object RegExp]",it="[object Set]",ot="[object String]",ut="[object Symbol]",ht="[object Undefined]",St="[object WeakMap]",Rt="[object WeakSet]",dt="[object ArrayBuffer]",Ct="[object DataView]",Dt="[object Float32Array]",yt="[object Float64Array]",zt="[object Int8Array]",Zt="[object Int16Array]",bt="[object Int32Array]",Lt="[object Uint8Array]",Nt="[object Uint8ClampedArray]",_t="[object Uint16Array]",Vt="[object Uint32Array]",Wt=/\b__p \+= '';/g,$t=/\b(__p \+=) '' \+/g,Qt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Gt=/&(?:amp|lt|gt|quot|#39);/g,vt=/[&<>"']/g,kt=RegExp(Gt.source),Kt=RegExp(vt.source),At=/<%-([\s\S]+?)%>/g,Ft=/<%([\s\S]+?)%>/g,Jt=/<%=([\s\S]+?)%>/g,ve=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,se=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xe=/[\\^$.*+?()[\]{}|]/g,ke=RegExp(xe.source),qe=/^\s+/,We=/\s/,ct=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,wt=/\{\n\/\* \[wrapped with (.+)\] \*/,st=/,? & /,xt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,mt=/[()=,{}\[\]\/\s]/,Mt=/\\(\\)?/g,Yt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,er=/\w*$/,rr=/^[-+]0x[0-9a-f]+$/i,qr=/^0b[01]+$/i,Dr=/^\[object .+?Constructor\]$/,Zr=/^0o[0-7]+$/i,Hr=/^(?:0|[1-9]\d*)$/,Vr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Tr=/($^)/,Nr=/['\n\r\u2028\u2029\\]/g,Cr="\\ud800-\\udfff",Ar="\\u0300-\\u036f",Wr="\\ufe20-\\ufe2f",Lr="\\u20d0-\\u20ff",vn=Ar+Wr+Lr,_n="\\u2700-\\u27bf",on="a-z\\xdf-\\xf6\\xf8-\\xff",In="\\xac\\xb1\\xd7\\xf7",Tn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Cn="\\u2000-\\u206f",Pi=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Bn="A-Z\\xc0-\\xd6\\xd8-\\xde",$o="\\ufe0e\\ufe0f",Ao=In+Tn+Cn+Pi,da="['’]",Yf="["+Cr+"]",Mo="["+Ao+"]",ws="["+vn+"]",Io="\\d+",Xf="["+_n+"]",To="["+on+"]",Co="[^"+Cr+Ao+Io+_n+on+Bn+"]",ha="\\ud83c[\\udffb-\\udfff]",Qf="(?:"+ws+"|"+ha+")",Bo="[^"+Cr+"]",pa="(?:\\ud83c[\\udde6-\\uddff]){2}",ma="[\\ud800-\\udbff][\\udc00-\\udfff]",ti="["+Bn+"]",Ro="\\u200d",Oo="(?:"+To+"|"+Co+")",ga="(?:"+ti+"|"+Co+")",ko="(?:"+da+"(?:d|ll|m|re|s|t|ve))?",Po="(?:"+da+"(?:D|LL|M|RE|S|T|VE))?",Do=Qf+"?",No="["+$o+"]?",eu="(?:"+Ro+"(?:"+[Bo,pa,ma].join("|")+")"+No+Do+")*",tu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ru="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Di=No+Do+eu,nu="(?:"+[Xf,pa,ma].join("|")+")"+Di,iu="(?:"+[Bo+ws+"?",ws,pa,ma,Yf].join("|")+")",su=RegExp(da,"g"),au=RegExp(ws,"g"),xs=RegExp(ha+"(?="+ha+")|"+iu+Di,"g"),ya=RegExp([ti+"?"+To+"+"+ko+"(?="+[Mo,ti,"$"].join("|")+")",ga+"+"+Po+"(?="+[Mo,ti+Oo,"$"].join("|")+")",ti+"?"+Oo+"+"+ko,ti+"+"+Po,ru,tu,Io,nu].join("|"),"g"),va=RegExp("["+Ro+Cr+vn+$o+"]"),Lo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ou=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],fu=-1,ur={};ur[Dt]=ur[yt]=ur[zt]=ur[Zt]=ur[bt]=ur[Lt]=ur[Nt]=ur[_t]=ur[Vt]=!0,ur[Ve]=ur[Ae]=ur[dt]=ur[ye]=ur[Ct]=ur[Ce]=ur[de]=ur[ne]=ur[Ie]=ur[Le]=ur[He]=ur[nt]=ur[it]=ur[ot]=ur[St]=!1;var cr={};cr[Ve]=cr[Ae]=cr[dt]=cr[Ct]=cr[ye]=cr[Ce]=cr[Dt]=cr[yt]=cr[zt]=cr[Zt]=cr[bt]=cr[Ie]=cr[Le]=cr[He]=cr[nt]=cr[it]=cr[ot]=cr[ut]=cr[Lt]=cr[Nt]=cr[_t]=cr[Vt]=!0,cr[de]=cr[ne]=cr[St]=!1;var ba={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},_a={"&":"&","<":"<",">":">",'"':""","'":"'"},uu={"&":"&","<":"<",">":">",""":'"',"'":"'"},cu={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lu=parseFloat,du=parseInt,wa=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Ni=typeof self=="object"&&self&&self.Object===Object&&self,br=wa||Ni||Function("return this")(),Es=u&&!u.nodeType&&u,qn=Es&&!0&&y&&!y.nodeType&&y,xa=qn&&qn.exports===Es,ri=xa&&wa.process,Xr=function(){try{var Ue=qn&&qn.require&&qn.require("util").types;return Ue||ri&&ri.binding&&ri.binding("util")}catch{}}(),Fo=Xr&&Xr.isArrayBuffer,Uo=Xr&&Xr.isDate,qo=Xr&&Xr.isMap,Ea=Xr&&Xr.isRegExp,Sa=Xr&&Xr.isSet,Zo=Xr&&Xr.isTypedArray;function jr(Ue,Ye,Ge){switch(Ge.length){case 0:return Ue.call(Ye);case 1:return Ue.call(Ye,Ge[0]);case 2:return Ue.call(Ye,Ge[0],Ge[1]);case 3:return Ue.call(Ye,Ge[0],Ge[1],Ge[2])}return Ue.apply(Ye,Ge)}function vi(Ue,Ye,Ge,lt){for(var Bt=-1,tr=Ue==null?0:Ue.length;++Bt<tr;){var _r=Ue[Bt];Ye(lt,_r,Ge(_r),Ue)}return lt}function Qr(Ue,Ye){for(var Ge=-1,lt=Ue==null?0:Ue.length;++Ge<lt&&Ye(Ue[Ge],Ge,Ue)!==!1;);return Ue}function hu(Ue,Ye){for(var Ge=Ue==null?0:Ue.length;Ge--&&Ye(Ue[Ge],Ge,Ue)!==!1;);return Ue}function $a(Ue,Ye){for(var Ge=-1,lt=Ue==null?0:Ue.length;++Ge<lt;)if(!Ye(Ue[Ge],Ge,Ue))return!1;return!0}function Rn(Ue,Ye){for(var Ge=-1,lt=Ue==null?0:Ue.length,Bt=0,tr=[];++Ge<lt;){var _r=Ue[Ge];Ye(_r,Ge,Ue)&&(tr[Bt++]=_r)}return tr}function Li(Ue,Ye){var Ge=Ue==null?0:Ue.length;return!!Ge&&ni(Ue,Ye,0)>-1}function Aa(Ue,Ye,Ge){for(var lt=-1,Bt=Ue==null?0:Ue.length;++lt<Bt;)if(Ge(Ye,Ue[lt]))return!0;return!1}function pr(Ue,Ye){for(var Ge=-1,lt=Ue==null?0:Ue.length,Bt=Array(lt);++Ge<lt;)Bt[Ge]=Ye(Ue[Ge],Ge,Ue);return Bt}function Zn(Ue,Ye){for(var Ge=-1,lt=Ye.length,Bt=Ue.length;++Ge<lt;)Ue[Bt+Ge]=Ye[Ge];return Ue}function Ma(Ue,Ye,Ge,lt){var Bt=-1,tr=Ue==null?0:Ue.length;for(lt&&tr&&(Ge=Ue[++Bt]);++Bt<tr;)Ge=Ye(Ge,Ue[Bt],Bt,Ue);return Ge}function pu(Ue,Ye,Ge,lt){var Bt=Ue==null?0:Ue.length;for(lt&&Bt&&(Ge=Ue[--Bt]);Bt--;)Ge=Ye(Ge,Ue[Bt],Bt,Ue);return Ge}function Ss(Ue,Ye){for(var Ge=-1,lt=Ue==null?0:Ue.length;++Ge<lt;)if(Ye(Ue[Ge],Ge,Ue))return!0;return!1}var Ho=Ia("length");function mu(Ue){return Ue.split("")}function gu(Ue){return Ue.match(xt)||[]}function zo(Ue,Ye,Ge){var lt;return Ge(Ue,function(Bt,tr,_r){if(Ye(Bt,tr,_r))return lt=tr,!1}),lt}function $s(Ue,Ye,Ge,lt){for(var Bt=Ue.length,tr=Ge+(lt?1:-1);lt?tr--:++tr<Bt;)if(Ye(Ue[tr],tr,Ue))return tr;return-1}function ni(Ue,Ye,Ge){return Ye===Ye?Eu(Ue,Ye,Ge):$s(Ue,Wo,Ge)}function Vo(Ue,Ye,Ge,lt){for(var Bt=Ge-1,tr=Ue.length;++Bt<tr;)if(lt(Ue[Bt],Ye))return Bt;return-1}function Wo(Ue){return Ue!==Ue}function jo(Ue,Ye){var Ge=Ue==null?0:Ue.length;return Ge?Ta(Ue,Ye)/Ge:F}function Ia(Ue){return function(Ye){return Ye==null?h:Ye[Ue]}}function Fi(Ue){return function(Ye){return Ue==null?h:Ue[Ye]}}function Go(Ue,Ye,Ge,lt,Bt){return Bt(Ue,function(tr,_r,lr){Ge=lt?(lt=!1,tr):Ye(Ge,tr,_r,lr)}),Ge}function yu(Ue,Ye){var Ge=Ue.length;for(Ue.sort(Ye);Ge--;)Ue[Ge]=Ue[Ge].value;return Ue}function Ta(Ue,Ye){for(var Ge,lt=-1,Bt=Ue.length;++lt<Bt;){var tr=Ye(Ue[lt]);tr!==h&&(Ge=Ge===h?tr:Ge+tr)}return Ge}function Ca(Ue,Ye){for(var Ge=-1,lt=Array(Ue);++Ge<Ue;)lt[Ge]=Ye(Ge);return lt}function Ko(Ue,Ye){return pr(Ye,function(Ge){return[Ge,Ue[Ge]]})}function Jo(Ue){return Ue&&Ue.slice(0,rf(Ue)+1).replace(qe,"")}function Gr(Ue){return function(Ye){return Ue(Ye)}}function Ba(Ue,Ye){return pr(Ye,function(Ge){return Ue[Ge]})}function ii(Ue,Ye){return Ue.has(Ye)}function Yo(Ue,Ye){for(var Ge=-1,lt=Ue.length;++Ge<lt&&ni(Ye,Ue[Ge],0)>-1;);return Ge}function Xo(Ue,Ye){for(var Ge=Ue.length;Ge--&&ni(Ye,Ue[Ge],0)>-1;);return Ge}function As(Ue,Ye){for(var Ge=Ue.length,lt=0;Ge--;)Ue[Ge]===Ye&&++lt;return lt}var vu=Fi(ba),Qo=Fi(_a);function ef(Ue){return"\\"+cu[Ue]}function bu(Ue,Ye){return Ue==null?h:Ue[Ye]}function si(Ue){return va.test(Ue)}function _u(Ue){return Lo.test(Ue)}function wu(Ue){for(var Ye,Ge=[];!(Ye=Ue.next()).done;)Ge.push(Ye.value);return Ge}function Ra(Ue){var Ye=-1,Ge=Array(Ue.size);return Ue.forEach(function(lt,Bt){Ge[++Ye]=[Bt,lt]}),Ge}function tf(Ue,Ye){return function(Ge){return Ue(Ye(Ge))}}function Hn(Ue,Ye){for(var Ge=-1,lt=Ue.length,Bt=0,tr=[];++Ge<lt;){var _r=Ue[Ge];(_r===Ye||_r===C)&&(Ue[Ge]=C,tr[Bt++]=Ge)}return tr}function Ms(Ue){var Ye=-1,Ge=Array(Ue.size);return Ue.forEach(function(lt){Ge[++Ye]=lt}),Ge}function xu(Ue){var Ye=-1,Ge=Array(Ue.size);return Ue.forEach(function(lt){Ge[++Ye]=[lt,lt]}),Ge}function Eu(Ue,Ye,Ge){for(var lt=Ge-1,Bt=Ue.length;++lt<Bt;)if(Ue[lt]===Ye)return lt;return-1}function Su(Ue,Ye,Ge){for(var lt=Ge+1;lt--;)if(Ue[lt]===Ye)return lt;return lt}function bi(Ue){return si(Ue)?Au(Ue):Ho(Ue)}function fn(Ue){return si(Ue)?Mu(Ue):mu(Ue)}function rf(Ue){for(var Ye=Ue.length;Ye--&&We.test(Ue.charAt(Ye)););return Ye}var $u=Fi(uu);function Au(Ue){for(var Ye=xs.lastIndex=0;xs.test(Ue);)++Ye;return Ye}function Mu(Ue){return Ue.match(xs)||[]}function Iu(Ue){return Ue.match(ya)||[]}var Tu=function Ue(Ye){Ye=Ye==null?br:Fr.defaults(br.Object(),Ye,Fr.pick(br,ou));var Ge=Ye.Array,lt=Ye.Date,Bt=Ye.Error,tr=Ye.Function,_r=Ye.Math,lr=Ye.Object,Oa=Ye.RegExp,ka=Ye.String,en=Ye.TypeError,Is=Ge.prototype,Cu=tr.prototype,_i=lr.prototype,Ts=Ye["__core-js_shared__"],Ui=Cu.toString,nr=_i.hasOwnProperty,Bu=0,nf=function(){var x=/[^.]+$/.exec(Ts&&Ts.keys&&Ts.keys.IE_PROTO||"");return x?"Symbol(src)_1."+x:""}(),Cs=_i.toString,Ru=Ui.call(lr),Ou=br._,ku=Oa("^"+Ui.call(nr).replace(xe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bs=xa?Ye.Buffer:h,zn=Ye.Symbol,Rs=Ye.Uint8Array,sf=Bs?Bs.allocUnsafe:h,wi=tf(lr.getPrototypeOf,lr),af=lr.create,of=_i.propertyIsEnumerable,qi=Is.splice,ff=zn?zn.isConcatSpreadable:h,Zi=zn?zn.iterator:h,ai=zn?zn.toStringTag:h,Os=function(){try{var x=Ln(lr,"defineProperty");return x({},"",{}),x}catch{}}(),uf=Ye.clearTimeout!==br.clearTimeout&&Ye.clearTimeout,cf=lt&<.now!==br.Date.now&<.now,oi=Ye.setTimeout!==br.setTimeout&&Ye.setTimeout,Hi=_r.ceil,ks=_r.floor,Pa=lr.getOwnPropertySymbols,Pu=Bs?Bs.isBuffer:h,lf=Ye.isFinite,Du=Is.join,Nu=tf(lr.keys,lr),xr=_r.max,Br=_r.min,Lu=lt.now,Fu=Ye.parseInt,On=_r.random,Uu=Is.reverse,Ps=Ln(Ye,"DataView"),zi=Ln(Ye,"Map"),Da=Ln(Ye,"Promise"),Vn=Ln(Ye,"Set"),fi=Ln(Ye,"WeakMap"),Vi=Ln(lr,"create"),Ds=fi&&new fi,xi={},qu=vs(Ps),Zu=vs(zi),Hu=vs(Da),zu=vs(Vn),Vu=vs(fi),Ns=zn?zn.prototype:h,Wi=Ns?Ns.valueOf:h,df=Ns?Ns.toString:h;function _e(x){if(wr(x)&&!Pt(x)&&!(x instanceof Ht)){if(x instanceof tn)return x;if(nr.call(x,"__wrapped__"))return jc(x)}return new tn(x)}var Ei=function(){function x(){}return function(A){if(!vr(A))return{};if(af)return af(A);x.prototype=A;var k=new x;return x.prototype=h,k}}();function Ls(){}function tn(x,A){this.__wrapped__=x,this.__actions__=[],this.__chain__=!!A,this.__index__=0,this.__values__=h}_e.templateSettings={escape:At,evaluate:Ft,interpolate:Jt,variable:"",imports:{_:_e}},_e.prototype=Ls.prototype,_e.prototype.constructor=_e,tn.prototype=Ei(Ls.prototype),tn.prototype.constructor=tn;function Ht(x){this.__wrapped__=x,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Q,this.__views__=[]}function Wu(){var x=new Ht(this.__wrapped__);return x.__actions__=Xe(this.__actions__),x.__dir__=this.__dir__,x.__filtered__=this.__filtered__,x.__iteratees__=Xe(this.__iteratees__),x.__takeCount__=this.__takeCount__,x.__views__=Xe(this.__views__),x}function ju(){if(this.__filtered__){var x=new Ht(this);x.__dir__=-1,x.__filtered__=!0}else x=this.clone(),x.__dir__*=-1;return x}function Gu(){var x=this.__wrapped__.value(),A=this.__dir__,k=Pt(x),Y=A<0,me=k?x.length:0,Ee=oo(0,me,this.__views__),Te=Ee.start,De=Ee.end,Ze=De-Te,Qe=Y?De:Te-1,et=this.__iteratees__,rt=et.length,at=0,gt=Br(Ze,this.__takeCount__);if(!k||!Y&&me==Ze&>==Ze)return Xa(x,this.__actions__);var It=[];e:for(;Ze--&&at<gt;){Qe+=A;for(var qt=-1,Tt=x[Qe];++qt<rt;){var jt=et[qt],Xt=jt.iteratee,gn=jt.type,Jr=Xt(Tt);if(gn==L)Tt=Jr;else if(!Jr){if(gn==O)continue e;break e}}It[at++]=Tt}return It}Ht.prototype=Ei(Ls.prototype),Ht.prototype.constructor=Ht;function wn(x){var A=-1,k=x==null?0:x.length;for(this.clear();++A<k;){var Y=x[A];this.set(Y[0],Y[1])}}function Ku(){this.__data__=Vi?Vi(null):{},this.size=0}function hf(x){var A=this.has(x)&&delete this.__data__[x];return this.size-=A?1:0,A}function Ju(x){var A=this.__data__;if(Vi){var k=A[x];return k===M?h:k}return nr.call(A,x)?A[x]:h}function pf(x){var A=this.__data__;return Vi?A[x]!==h:nr.call(A,x)}function Yu(x,A){var k=this.__data__;return this.size+=this.has(x)?0:1,k[x]=Vi&&A===h?M:A,this}wn.prototype.clear=Ku,wn.prototype.delete=hf,wn.prototype.get=Ju,wn.prototype.has=pf,wn.prototype.set=Yu;function kn(x){var A=-1,k=x==null?0:x.length;for(this.clear();++A<k;){var Y=x[A];this.set(Y[0],Y[1])}}function mf(){this.__data__=[],this.size=0}function gf(x){var A=this.__data__,k=Fs(A,x);if(k<0)return!1;var Y=A.length-1;return k==Y?A.pop():qi.call(A,k,1),--this.size,!0}function Xu(x){var A=this.__data__,k=Fs(A,x);return k<0?h:A[k][1]}function Qu(x){return Fs(this.__data__,x)>-1}function tc(x,A){var k=this.__data__,Y=Fs(k,x);return Y<0?(++this.size,k.push([x,A])):k[Y][1]=A,this}kn.prototype.clear=mf,kn.prototype.delete=gf,kn.prototype.get=Xu,kn.prototype.has=Qu,kn.prototype.set=tc;function xn(x){var A=-1,k=x==null?0:x.length;for(this.clear();++A<k;){var Y=x[A];this.set(Y[0],Y[1])}}function rc(){this.size=0,this.__data__={hash:new wn,map:new(zi||kn),string:new wn}}function nc(x){var A=Ri(this,x).delete(x);return this.size-=A?1:0,A}function ic(x){return Ri(this,x).get(x)}function Na(x){return Ri(this,x).has(x)}function sc(x,A){var k=Ri(this,x),Y=k.size;return k.set(x,A),this.size+=k.size==Y?0:1,this}xn.prototype.clear=rc,xn.prototype.delete=nc,xn.prototype.get=ic,xn.prototype.has=Na,xn.prototype.set=sc;function ui(x){var A=-1,k=x==null?0:x.length;for(this.__data__=new xn;++A<k;)this.add(x[A])}function yf(x){return this.__data__.set(x,M),this}function ac(x){return this.__data__.has(x)}ui.prototype.add=ui.prototype.push=yf,ui.prototype.has=ac;function un(x){var A=this.__data__=new kn(x);this.size=A.size}function oc(){this.__data__=new kn,this.size=0}function Wn(x){var A=this.__data__,k=A.delete(x);return this.size=A.size,k}function fc(x){return this.__data__.get(x)}function uc(x){return this.__data__.has(x)}function cc(x,A){var k=this.__data__;if(k instanceof kn){var Y=k.__data__;if(!zi||Y.length<w-1)return Y.push([x,A]),this.size=++k.size,this;k=this.__data__=new xn(Y)}return k.set(x,A),this.size=k.size,this}un.prototype.clear=oc,un.prototype.delete=Wn,un.prototype.get=fc,un.prototype.has=uc,un.prototype.set=cc;function vf(x,A){var k=Pt(x),Y=!k&&bs(x),me=!k&&!Y&&Oi(x),Ee=!k&&!Y&&!me&&ca(x),Te=k||Y||me||Ee,De=Te?Ca(x.length,ka):[],Ze=De.length;for(var Qe in x)(A||nr.call(x,Qe))&&!(Te&&(Qe=="length"||me&&(Qe=="offset"||Qe=="parent")||Ee&&(Qe=="buffer"||Qe=="byteLength"||Qe=="byteOffset")||pn(Qe,Ze)))&&De.push(Qe);return De}function bf(x){var A=x.length;return A?x[rs(0,A-1)]:h}function lc(x,A){return Zf(Xe(x),li(A,0,x.length))}function dc(x){return Zf(Xe(x))}function La(x,A,k){(k!==h&&!Fn(x[A],k)||k===h&&!(A in x))&&En(x,A,k)}function ji(x,A,k){var Y=x[A];(!(nr.call(x,A)&&Fn(Y,k))||k===h&&!(A in x))&&En(x,A,k)}function Fs(x,A){for(var k=x.length;k--;)if(Fn(x[k][0],A))return k;return-1}function _f(x,A,k,Y){return jn(x,function(me,Ee,Te){A(Y,me,k(me),Te)}),Y}function ci(x,A){return x&&Je(A,Pr(A),x)}function wf(x,A){return x&&Je(A,sn(A),x)}function En(x,A,k){A=="__proto__"&&Os?Os(x,A,{configurable:!0,enumerable:!0,value:k,writable:!0}):x[A]=k}function Us(x,A){for(var k=-1,Y=A.length,me=Ge(Y),Ee=x==null;++k<Y;)me[k]=Ee?h:kc(x,A[k]);return me}function li(x,A,k){return x===x&&(k!==h&&(x=x<=k?x:k),A!==h&&(x=x>=A?x:A)),x}function rn(x,A,k,Y,me,Ee){var Te,De=A&B,Ze=A&N,Qe=A&H;if(k&&(Te=me?k(x,Y,me,Ee):k(x)),Te!==h)return Te;if(!vr(x))return x;var et=Pt(x);if(et){if(Te=uo(x),!De)return Xe(x,Te)}else{var rt=Ir(x),at=rt==ne||rt==be;if(Oi(x))return Df(x,De);if(rt==He||rt==Ve||at&&!me){if(Te=Ze||at?{}:ia(x),!De)return Ze?ar(x,wf(Te,x)):pt(x,ci(Te,x))}else{if(!cr[rt])return me?x:{};Te=co(x,rt,De)}}Ee||(Ee=new un);var gt=Ee.get(x);if(gt)return gt;Ee.set(x,Te),ml(x)?x.forEach(function(Tt){Te.add(rn(Tt,A,k,Tt,x,Ee))}):dl(x)&&x.forEach(function(Tt,jt){Te.set(jt,rn(Tt,A,k,jt,x,Ee))});var It=Qe?Ze?cs:us:Ze?sn:Pr,qt=et?h:It(x);return Qr(qt||x,function(Tt,jt){qt&&(jt=Tt,Tt=x[jt]),ji(Te,jt,rn(Tt,A,k,jt,x,Ee))}),Te}function hc(x){var A=Pr(x);return function(k){return xf(k,x,A)}}function xf(x,A,k){var Y=k.length;if(x==null)return!Y;for(x=lr(x);Y--;){var me=k[Y],Ee=A[me],Te=x[me];if(Te===h&&!(me in x)||!Ee(Te))return!1}return!0}function Ef(x,A,k){if(typeof x!="function")throw new en(E);return xo(function(){x.apply(h,k)},A)}function Gi(x,A,k,Y){var me=-1,Ee=Li,Te=!0,De=x.length,Ze=[],Qe=A.length;if(!De)return Ze;k&&(A=pr(A,Gr(k))),Y?(Ee=Aa,Te=!1):A.length>=w&&(Ee=ii,Te=!1,A=new ui(A));e:for(;++me<De;){var et=x[me],rt=k==null?et:k(et);if(et=Y||et!==0?et:0,Te&&rt===rt){for(var at=Qe;at--;)if(A[at]===rt)continue e;Ze.push(et)}else Ee(A,rt,Y)||Ze.push(et)}return Ze}var jn=Nf(cn),qs=Nf(Hs,!0);function pc(x,A){var k=!0;return jn(x,function(Y,me,Ee){return k=!!A(Y,me,Ee),k}),k}function Pn(x,A,k){for(var Y=-1,me=x.length;++Y<me;){var Ee=x[Y],Te=A(Ee);if(Te!=null&&(De===h?Te===Te&&!mn(Te):k(Te,De)))var De=Te,Ze=Ee}return Ze}function Si(x,A,k,Y){var me=x.length;for(k=Ut(k),k<0&&(k=-k>me?0:me+k),Y=Y===h||Y>me?me:Ut(Y),Y<0&&(Y+=me),Y=k>Y?0:yl(Y);k<Y;)x[k++]=A;return x}function Sf(x,A){var k=[];return jn(x,function(Y,me,Ee){A(Y,me,Ee)&&k.push(Y)}),k}function Er(x,A,k,Y,me){var Ee=-1,Te=x.length;for(k||(k=ho),me||(me=[]);++Ee<Te;){var De=x[Ee];A>0&&k(De)?A>1?Er(De,A-1,k,Y,me):Zn(me,De):Y||(me[me.length]=De)}return me}var Zs=Mi(),$f=Mi(!0);function cn(x,A){return x&&Zs(x,A,Pr)}function Hs(x,A){return x&&$f(x,A,Pr)}function Ki(x,A){return Rn(A,function(k){return mi(x[k])})}function Gn(x,A){A=Jn(A,x);for(var k=0,Y=A.length;x!=null&&k<Y;)x=x[ei(A[k++])];return k&&k==Y?x:h}function Sn(x,A,k){var Y=A(x);return Pt(x)?Y:Zn(Y,k(x))}function Ur(x){return x==null?x===h?ht:Fe:ai&&ai in lr(x)?ao(x):_o(x)}function Fa(x,A){return x>A}function mc(x,A){return x!=null&&nr.call(x,A)}function gc(x,A){return x!=null&&A in lr(x)}function yc(x,A,k){return x>=Br(A,k)&&x<xr(A,k)}function Ua(x,A,k){for(var Y=k?Aa:Li,me=x[0].length,Ee=x.length,Te=Ee,De=Ge(Ee),Ze=1/0,Qe=[];Te--;){var et=x[Te];Te&&A&&(et=pr(et,Gr(A))),Ze=Br(et.length,Ze),De[Te]=!k&&(A||me>=120&&et.length>=120)?new ui(Te&&et):h}et=x[0];var rt=-1,at=De[0];e:for(;++rt<me&&Qe.length<Ze;){var gt=et[rt],It=A?A(gt):gt;if(gt=k||gt!==0?gt:0,!(at?ii(at,It):Y(Qe,It,k))){for(Te=Ee;--Te;){var qt=De[Te];if(!(qt?ii(qt,It):Y(x[Te],It,k)))continue e}at&&at.push(It),Qe.push(gt)}}return Qe}function Af(x,A,k,Y){return cn(x,function(me,Ee,Te){A(Y,k(me),Ee,Te)}),Y}function Ji(x,A,k){A=Jn(A,x),x=fa(x,A);var Y=x==null?x:x[ei(An(A))];return Y==null?h:jr(Y,x,k)}function qa(x){return wr(x)&&Ur(x)==Ve}function vc(x){return wr(x)&&Ur(x)==dt}function bc(x){return wr(x)&&Ur(x)==Ce}function Yi(x,A,k,Y,me){return x===A?!0:x==null||A==null||!wr(x)&&!wr(A)?x!==x&&A!==A:dr(x,A,k,Y,Yi,me)}function dr(x,A,k,Y,me,Ee){var Te=Pt(x),De=Pt(A),Ze=Te?Ae:Ir(x),Qe=De?Ae:Ir(A);Ze=Ze==Ve?He:Ze,Qe=Qe==Ve?He:Qe;var et=Ze==He,rt=Qe==He,at=Ze==Qe;if(at&&Oi(x)){if(!Oi(A))return!1;Te=!0,et=!1}if(at&&!et)return Ee||(Ee=new un),Te||ca(x)?ta(x,A,k,Y,me,Ee):io(x,A,Ze,k,Y,me,Ee);if(!(k&te)){var gt=et&&nr.call(x,"__wrapped__"),It=rt&&nr.call(A,"__wrapped__");if(gt||It){var qt=gt?x.value():x,Tt=It?A.value():A;return Ee||(Ee=new un),me(qt,Tt,k,Y,Ee)}}return at?(Ee||(Ee=new un),so(x,A,k,Y,me,Ee)):!1}function Xi(x){return wr(x)&&Ir(x)==Ie}function Za(x,A,k,Y){var me=k.length,Ee=me,Te=!Y;if(x==null)return!Ee;for(x=lr(x);me--;){var De=k[me];if(Te&&De[2]?De[1]!==x[De[0]]:!(De[0]in x))return!1}for(;++me<Ee;){De=k[me];var Ze=De[0],Qe=x[Ze],et=De[1];if(Te&&De[2]){if(Qe===h&&!(Ze in x))return!1}else{var rt=new un;if(Y)var at=Y(Qe,et,Ze,x,A,rt);if(!(at===h?Yi(et,Qe,te|fe,Y,rt):at))return!1}}return!0}function Ha(x){if(!vr(x)||mo(x))return!1;var A=mi(x)?ku:Dr;return A.test(vs(x))}function kr(x){return wr(x)&&Ur(x)==nt}function Mr(x){return wr(x)&&Ir(x)==it}function zs(x){return wr(x)&&Gf(x.length)&&!!ur[Ur(x)]}function Qi(x){return typeof x=="function"?x:x==null?an:typeof x=="object"?Pt(x)?Tf(x[0],x[1]):If(x):Il(x)}function es(x){if(!pi(x))return Nu(x);var A=[];for(var k in lr(x))nr.call(x,k)&&k!="constructor"&&A.push(k);return A}function Vs(x){if(!vr(x))return bo(x);var A=pi(x),k=[];for(var Y in x)Y=="constructor"&&(A||!nr.call(x,Y))||k.push(Y);return k}function za(x,A){return x<A}function Mf(x,A){var k=-1,Y=nn(x)?Ge(x.length):[];return jn(x,function(me,Ee,Te){Y[++k]=A(me,Ee,Te)}),Y}function If(x){var A=ds(x);return A.length==1&&A[0][2]?aa(A[0][0],A[0][1]):function(k){return k===x||Za(k,x,A)}}function Tf(x,A){return ps(x)&&sa(A)?aa(ei(x),A):function(k){var Y=kc(k,x);return Y===h&&Y===A?Pc(k,x):Yi(A,Y,te|fe)}}function Ws(x,A,k,Y,me){x!==A&&Zs(A,function(Ee,Te){if(me||(me=new un),vr(Ee))di(x,A,Te,k,Ws,Y,me);else{var De=Y?Y(ys(x,Te),Ee,Te+"",x,A,me):h;De===h&&(De=Ee),La(x,Te,De)}},sn)}function di(x,A,k,Y,me,Ee,Te){var De=ys(x,k),Ze=ys(A,k),Qe=Te.get(Ze);if(Qe){La(x,k,Qe);return}var et=Ee?Ee(De,Ze,k+"",x,A,Te):h,rt=et===h;if(rt){var at=Pt(Ze),gt=!at&&Oi(Ze),It=!at&&!gt&&ca(Ze);et=Ze,at||gt||It?Pt(De)?et=De:Sr(De)?et=Xe(De):gt?(rt=!1,et=Df(Ze,!0)):It?(rt=!1,et=P(Ze,!0)):et=[]:Eo(Ze)||bs(Ze)?(et=De,bs(De)?et=vl(De):(!vr(De)||mi(De))&&(et=ia(Ze))):rt=!1}rt&&(Te.set(Ze,et),me(et,Ze,Y,Ee,Te),Te.delete(Ze)),La(x,k,et)}function Cf(x,A){var k=x.length;if(k)return A+=A<0?k:0,pn(A,k)?x[A]:h}function Va(x,A,k){A.length?A=pr(A,function(Ee){return Pt(Ee)?function(Te){return Gn(Te,Ee.length===1?Ee[0]:Ee)}:Ee}):A=[an];var Y=-1;A=pr(A,Gr(Et()));var me=Mf(x,function(Ee,Te,De){var Ze=pr(A,function(Qe){return Qe(Ee)});return{criteria:Ze,index:++Y,value:Ee}});return yu(me,function(Ee,Te){return ue(Ee,Te,k)})}function _c(x,A){return Bf(x,A,function(k,Y){return Pc(x,Y)})}function Bf(x,A,k){for(var Y=-1,me=A.length,Ee={};++Y<me;){var Te=A[Y],De=Gn(x,Te);k(De,Te)&&$i(Ee,Jn(Te,x),De)}return Ee}function Rf(x){return function(A){return Gn(A,x)}}function js(x,A,k,Y){var me=Y?Vo:ni,Ee=-1,Te=A.length,De=x;for(x===A&&(A=Xe(A)),k&&(De=pr(x,Gr(k)));++Ee<Te;)for(var Ze=0,Qe=A[Ee],et=k?k(Qe):Qe;(Ze=me(De,et,Ze,Y))>-1;)De!==x&&qi.call(De,Ze,1),qi.call(x,Ze,1);return x}function ts(x,A){for(var k=x?A.length:0,Y=k-1;k--;){var me=A[k];if(k==Y||me!==Ee){var Ee=me;pn(me)?qi.call(x,me,1):Ja(x,me)}}return x}function rs(x,A){return x+ks(On()*(A-x+1))}function $n(x,A,k,Y){for(var me=-1,Ee=xr(Hi((A-x)/(k||1)),0),Te=Ge(Ee);Ee--;)Te[Y?Ee:++me]=x,x+=k;return Te}function Wa(x,A){var k="";if(!x||A<1||A>re)return k;do A%2&&(k+=x),A=ks(A/2),A&&(x+=x);while(A);return k}function Ot(x,A){return Mc(oa(x,A,an),x+"")}function wc(x){return bf(la(x))}function xc(x,A){var k=la(x);return Zf(k,li(A,0,k.length))}function $i(x,A,k,Y){if(!vr(x))return x;A=Jn(A,x);for(var me=-1,Ee=A.length,Te=Ee-1,De=x;De!=null&&++me<Ee;){var Ze=ei(A[me]),Qe=k;if(Ze==="__proto__"||Ze==="constructor"||Ze==="prototype")return x;if(me!=Te){var et=De[Ze];Qe=Y?Y(et,Ze,De):h,Qe===h&&(Qe=vr(et)?et:pn(A[me+1])?[]:{})}ji(De,Ze,Qe),De=De[Ze]}return x}var Of=Ds?function(x,A){return Ds.set(x,A),x}:an,kf=Os?function(x,A){return Os(x,"toString",{configurable:!0,enumerable:!1,value:Nc(A),writable:!0})}:an;function Ec(x){return Zf(la(x))}function Kr(x,A,k){var Y=-1,me=x.length;A<0&&(A=-A>me?0:me+A),k=k>me?me:k,k<0&&(k+=me),me=A>k?0:k-A>>>0,A>>>=0;for(var Ee=Ge(me);++Y<me;)Ee[Y]=x[Y+A];return Ee}function Sc(x,A){var k;return jn(x,function(Y,me,Ee){return k=A(Y,me,Ee),!k}),!!k}function Ai(x,A,k){var Y=0,me=x==null?Y:x.length;if(typeof A=="number"&&A===A&&me<=he){for(;Y<me;){var Ee=Y+me>>>1,Te=x[Ee];Te!==null&&!mn(Te)&&(k?Te<=A:Te<A)?Y=Ee+1:me=Ee}return me}return ja(x,A,an,k)}function ja(x,A,k,Y){var me=0,Ee=x==null?0:x.length;if(Ee===0)return 0;A=k(A);for(var Te=A!==A,De=A===null,Ze=mn(A),Qe=A===h;me<Ee;){var et=ks((me+Ee)/2),rt=k(x[et]),at=rt!==h,gt=rt===null,It=rt===rt,qt=mn(rt);if(Te)var Tt=Y||It;else Qe?Tt=It&&(Y||at):De?Tt=It&&at&&(Y||!gt):Ze?Tt=It&&at&&!gt&&(Y||!qt):gt||qt?Tt=!1:Tt=Y?rt<=A:rt<A;Tt?me=et+1:Ee=et}return Br(Ee,U)}function Ga(x,A){for(var k=-1,Y=x.length,me=0,Ee=[];++k<Y;){var Te=x[k],De=A?A(Te):Te;if(!k||!Fn(De,Ze)){var Ze=De;Ee[me++]=Te===0?0:Te}}return Ee}function Ka(x){return typeof x=="number"?x:mn(x)?F:+x}function Rr(x){if(typeof x=="string")return x;if(Pt(x))return pr(x,Rr)+"";if(mn(x))return df?df.call(x):"";var A=x+"";return A=="0"&&1/x==-j?"-0":A}function Kn(x,A,k){var Y=-1,me=Li,Ee=x.length,Te=!0,De=[],Ze=De;if(k)Te=!1,me=Aa;else if(Ee>=w){var Qe=A?null:ro(x);if(Qe)return Ms(Qe);Te=!1,me=ii,Ze=new ui}else Ze=A?[]:De;e:for(;++Y<Ee;){var et=x[Y],rt=A?A(et):et;if(et=k||et!==0?et:0,Te&&rt===rt){for(var at=Ze.length;at--;)if(Ze[at]===rt)continue e;A&&Ze.push(rt),De.push(et)}else me(Ze,rt,k)||(Ze!==De&&Ze.push(rt),De.push(et))}return De}function Ja(x,A){return A=Jn(A,x),x=fa(x,A),x==null||delete x[ei(An(A))]}function Ya(x,A,k,Y){return $i(x,A,k(Gn(x,A)),Y)}function ns(x,A,k,Y){for(var me=x.length,Ee=Y?me:-1;(Y?Ee--:++Ee<me)&&A(x[Ee],Ee,x););return k?Kr(x,Y?0:Ee,Y?Ee+1:me):Kr(x,Y?Ee+1:0,Y?me:Ee)}function Xa(x,A){var k=x;return k instanceof Ht&&(k=k.value()),Ma(A,function(Y,me){return me.func.apply(me.thisArg,Zn([Y],me.args))},k)}function Gs(x,A,k){var Y=x.length;if(Y<2)return Y?Kn(x[0]):[];for(var me=-1,Ee=Ge(Y);++me<Y;)for(var Te=x[me],De=-1;++De<Y;)De!=me&&(Ee[me]=Gi(Ee[me]||Te,x[De],A,k));return Kn(Er(Ee,1),A,k)}function Pf(x,A,k){for(var Y=-1,me=x.length,Ee=A.length,Te={};++Y<me;){var De=Y<Ee?A[Y]:h;k(Te,x[Y],De)}return Te}function Qa(x){return Sr(x)?x:[]}function eo(x){return typeof x=="function"?x:an}function Jn(x,A){return Pt(x)?x:ps(x,A)?[x]:Wc(fr(x))}var $c=Ot;function Dn(x,A,k){var Y=x.length;return k=k===h?Y:k,!A&&k>=Y?x:Kr(x,A,k)}var Ks=uf||function(x){return br.clearTimeout(x)};function Df(x,A){if(A)return x.slice();var k=x.length,Y=sf?sf(k):new x.constructor(k);return x.copy(Y),Y}function is(x){var A=new x.constructor(x.byteLength);return new Rs(A).set(new Rs(x)),A}function Ac(x,A){var k=A?is(x.buffer):x.buffer;return new x.constructor(k,x.byteOffset,x.byteLength)}function S(x){var A=new x.constructor(x.source,er.exec(x));return A.lastIndex=x.lastIndex,A}function I(x){return Wi?lr(Wi.call(x)):{}}function P(x,A){var k=A?is(x.buffer):x.buffer;return new x.constructor(k,x.byteOffset,x.length)}function Z(x,A){if(x!==A){var k=x!==h,Y=x===null,me=x===x,Ee=mn(x),Te=A!==h,De=A===null,Ze=A===A,Qe=mn(A);if(!De&&!Qe&&!Ee&&x>A||Ee&&Te&&Ze&&!De&&!Qe||Y&&Te&&Ze||!k&&Ze||!me)return 1;if(!Y&&!Ee&&!Qe&&x<A||Qe&&k&&me&&!Y&&!Ee||De&&k&&me||!Te&&me||!Ze)return-1}return 0}function ue(x,A,k){for(var Y=-1,me=x.criteria,Ee=A.criteria,Te=me.length,De=k.length;++Y<Te;){var Ze=Z(me[Y],Ee[Y]);if(Ze){if(Y>=De)return Ze;var Qe=k[Y];return Ze*(Qe=="desc"?-1:1)}}return x.index-A.index}function Se(x,A,k,Y){for(var me=-1,Ee=x.length,Te=k.length,De=-1,Ze=A.length,Qe=xr(Ee-Te,0),et=Ge(Ze+Qe),rt=!Y;++De<Ze;)et[De]=A[De];for(;++me<Te;)(rt||me<Ee)&&(et[k[me]]=x[me]);for(;Qe--;)et[De++]=x[me++];return et}function ze(x,A,k,Y){for(var me=-1,Ee=x.length,Te=-1,De=k.length,Ze=-1,Qe=A.length,et=xr(Ee-De,0),rt=Ge(et+Qe),at=!Y;++me<et;)rt[me]=x[me];for(var gt=me;++Ze<Qe;)rt[gt+Ze]=A[Ze];for(;++Te<De;)(at||me<Ee)&&(rt[gt+k[Te]]=x[me++]);return rt}function Xe(x,A){var k=-1,Y=x.length;for(A||(A=Ge(Y));++k<Y;)A[k]=x[k];return A}function Je(x,A,k,Y){var me=!k;k||(k={});for(var Ee=-1,Te=A.length;++Ee<Te;){var De=A[Ee],Ze=Y?Y(k[De],x[De],De,k,x):h;Ze===h&&(Ze=x[De]),me?En(k,De,Ze):ji(k,De,Ze)}return k}function pt(x,A){return Je(x,hs(x),A)}function ar(x,A){return Je(x,ra(x),A)}function yr(x,A){return function(k,Y){var me=Pt(k)?vi:_f,Ee=A?A():{};return me(k,x,Et(Y,2),Ee)}}function ln(x){return Ot(function(A,k){var Y=-1,me=k.length,Ee=me>1?k[me-1]:h,Te=me>2?k[2]:h;for(Ee=x.length>3&&typeof Ee=="function"?(me--,Ee):h,Te&&Or(k[0],k[1],Te)&&(Ee=me<3?h:Ee,me=1),A=lr(A);++Y<me;){var De=k[Y];De&&x(A,De,Y,Ee)}return A})}function Nf(x,A){return function(k,Y){if(k==null)return k;if(!nn(k))return x(k,Y);for(var me=k.length,Ee=A?me:-1,Te=lr(k);(A?Ee--:++Ee<me)&&Y(Te[Ee],Ee,Te)!==!1;);return k}}function Mi(x){return function(A,k,Y){for(var me=-1,Ee=lr(A),Te=Y(A),De=Te.length;De--;){var Ze=Te[x?De:++me];if(k(Ee[Ze],Ze,Ee)===!1)break}return A}}function ss(x,A,k){var Y=A&ce,me=Nn(x);function Ee(){var Te=this&&this!==br&&this instanceof Ee?me:x;return Te.apply(Y?k:this,arguments)}return Ee}function Lf(x){return function(A){A=fr(A);var k=si(A)?fn(A):h,Y=k?k[0]:A.charAt(0),me=k?Dn(k,1).join(""):A.slice(1);return Y[x]()+me}}function Ii(x){return function(A){return Ma(Al($l(A).replace(su,"")),x,"")}}function Nn(x){return function(){var A=arguments;switch(A.length){case 0:return new x;case 1:return new x(A[0]);case 2:return new x(A[0],A[1]);case 3:return new x(A[0],A[1],A[2]);case 4:return new x(A[0],A[1],A[2],A[3]);case 5:return new x(A[0],A[1],A[2],A[3],A[4]);case 6:return new x(A[0],A[1],A[2],A[3],A[4],A[5]);case 7:return new x(A[0],A[1],A[2],A[3],A[4],A[5],A[6])}var k=Ei(x.prototype),Y=x.apply(k,A);return vr(Y)?Y:k}}function as(x,A,k){var Y=Nn(x);function me(){for(var Ee=arguments.length,Te=Ge(Ee),De=Ee,Ze=Qn(me);De--;)Te[De]=arguments[De];var Qe=Ee<3&&Te[0]!==Ze&&Te[Ee-1]!==Ze?[]:Hn(Te,Ze);if(Ee-=Qe.length,Ee<k)return Ci(x,A,Yn,me.placeholder,h,Te,Qe,h,h,k-Ee);var et=this&&this!==br&&this instanceof me?Y:x;return jr(et,this,Te)}return me}function Ff(x){return function(A,k,Y){var me=lr(A);if(!nn(A)){var Ee=Et(k,3);A=Pr(A),k=function(De){return Ee(me[De],De,me)}}var Te=x(A,k,Y);return Te>-1?me[Ee?A[Te]:Te]:h}}function Uf(x){return hn(function(A){var k=A.length,Y=k,me=tn.prototype.thru;for(x&&A.reverse();Y--;){var Ee=A[Y];if(typeof Ee!="function")throw new en(E);if(me&&!Te&&Bi(Ee)=="wrapper")var Te=new tn([],!0)}for(Y=Te?Y:k;++Y<k;){Ee=A[Y];var De=Bi(Ee),Ze=De=="wrapper"?ls(Ee):h;Ze&&gs(Ze[0])&&Ze[1]==(Pe|ge|Me|Be)&&!Ze[4].length&&Ze[9]==1?Te=Te[Bi(Ze[0])].apply(Te,Ze[3]):Te=Ee.length==1&&gs(Ee)?Te[De]():Te.thru(Ee)}return function(){var Qe=arguments,et=Qe[0];if(Te&&Qe.length==1&&Pt(et))return Te.plant(et).value();for(var rt=0,at=k?A[rt].apply(this,Qe):et;++rt<k;)at=A[rt].call(this,at);return at}})}function Yn(x,A,k,Y,me,Ee,Te,De,Ze,Qe){var et=A&Pe,rt=A&ce,at=A&le,gt=A&(ge|pe),It=A&Re,qt=at?h:Nn(x);function Tt(){for(var jt=arguments.length,Xt=Ge(jt),gn=jt;gn--;)Xt[gn]=arguments[gn];if(gt)var Jr=Qn(Tt),yn=As(Xt,Jr);if(Y&&(Xt=Se(Xt,Y,me,gt)),Ee&&(Xt=ze(Xt,Ee,Te,gt)),jt-=yn,gt&&jt<Qe){var $r=Hn(Xt,Jr);return Ci(x,A,Yn,Tt.placeholder,k,Xt,$r,De,Ze,Qe-jt)}var Un=rt?k:this,yi=at?Un[x]:x;return jt=Xt.length,De?Xt=wo(Xt,De):It&&jt>1&&Xt.reverse(),et&&Ze<jt&&(Xt.length=Ze),this&&this!==br&&this instanceof Tt&&(yi=qt||Nn(yi)),yi.apply(Un,Xt)}return Tt}function Ti(x,A){return function(k,Y){return Af(k,x,A(Y),{})}}function Js(x,A){return function(k,Y){var me;if(k===h&&Y===h)return A;if(k!==h&&(me=k),Y!==h){if(me===h)return Y;typeof k=="string"||typeof Y=="string"?(k=Rr(k),Y=Rr(Y)):(k=Ka(k),Y=Ka(Y)),me=x(k,Y)}return me}}function to(x){return hn(function(A){return A=pr(A,Gr(Et())),Ot(function(k){var Y=this;return x(A,function(me){return jr(me,Y,k)})})})}function Xn(x,A){A=A===h?" ":Rr(A);var k=A.length;if(k<2)return k?Wa(A,x):A;var Y=Wa(A,Hi(x/bi(A)));return si(A)?Dn(fn(Y),0,x).join(""):Y.slice(0,x)}function os(x,A,k,Y){var me=A&ce,Ee=Nn(x);function Te(){for(var De=-1,Ze=arguments.length,Qe=-1,et=Y.length,rt=Ge(et+Ze),at=this&&this!==br&&this instanceof Te?Ee:x;++Qe<et;)rt[Qe]=Y[Qe];for(;Ze--;)rt[Qe++]=arguments[++De];return jr(at,me?k:this,rt)}return Te}function qf(x){return function(A,k,Y){return Y&&typeof Y!="number"&&Or(A,k,Y)&&(k=Y=h),A=gi(A),k===h?(k=A,A=0):k=gi(k),Y=Y===h?A<k?1:-1:gi(Y),$n(A,k,Y,x)}}function Ys(x){return function(A,k){return typeof A=="string"&&typeof k=="string"||(A=Mn(A),k=Mn(k)),x(A,k)}}function Ci(x,A,k,Y,me,Ee,Te,De,Ze,Qe){var et=A&ge,rt=et?Te:h,at=et?h:Te,gt=et?Ee:h,It=et?h:Ee;A|=et?Me:$e,A&=~(et?$e:Me),A&ie||(A&=~(ce|le));var qt=[x,A,me,gt,rt,It,at,De,Ze,Qe],Tt=k.apply(h,qt);return gs(x)&&ua(Tt,qt),Tt.placeholder=Y,zc(Tt,x,A)}function hi(x){var A=_r[x];return function(k,Y){if(k=Mn(k),Y=Y==null?0:Br(Ut(Y),292),Y&&lf(k)){var me=(fr(k)+"e").split("e"),Ee=A(me[0]+"e"+(+me[1]+Y));return me=(fr(Ee)+"e").split("e"),+(me[0]+"e"+(+me[1]-Y))}return A(k)}}var ro=Vn&&1/Ms(new Vn([,-0]))[1]==j?function(x){return new Vn(x)}:Uc;function Xs(x){return function(A){var k=Ir(A);return k==Ie?Ra(A):k==it?xu(A):Ko(A,x(A))}}function dn(x,A,k,Y,me,Ee,Te,De){var Ze=A≤if(!Ze&&typeof x!="function")throw new en(E);var Qe=Y?Y.length:0;if(Qe||(A&=~(Me|$e),Y=me=h),Te=Te===h?Te:xr(Ut(Te),0),De=De===h?De:Ut(De),Qe-=me?me.length:0,A&$e){var et=Y,rt=me;Y=me=h}var at=Ze?h:ls(x),gt=[x,A,k,Y,me,et,rt,Ee,Te,De];if(at&&vo(gt,at),x=gt[0],A=gt[1],k=gt[2],Y=gt[3],me=gt[4],De=gt[9]=gt[9]===h?Ze?0:x.length:xr(gt[9]-Qe,0),!De&&A&(ge|pe)&&(A&=~(ge|pe)),!A||A==ce)var It=ss(x,A,k);else A==ge||A==pe?It=as(x,A,De):(A==Me||A==(ce|Me))&&!me.length?It=os(x,A,k,Y):It=Yn.apply(h,gt);var qt=at?Of:ua;return zc(qt(It,gt),x,A)}function Qs(x,A,k,Y){return x===h||Fn(x,_i[k])&&!nr.call(Y,k)?A:x}function ea(x,A,k,Y,me,Ee){return vr(x)&&vr(A)&&(Ee.set(A,x),Ws(x,A,h,ea,Ee),Ee.delete(A)),x}function no(x){return Eo(x)?h:x}function ta(x,A,k,Y,me,Ee){var Te=k&te,De=x.length,Ze=A.length;if(De!=Ze&&!(Te&&Ze>De))return!1;var Qe=Ee.get(x),et=Ee.get(A);if(Qe&&et)return Qe==A&&et==x;var rt=-1,at=!0,gt=k&fe?new ui:h;for(Ee.set(x,A),Ee.set(A,x);++rt<De;){var It=x[rt],qt=A[rt];if(Y)var Tt=Te?Y(qt,It,rt,A,x,Ee):Y(It,qt,rt,x,A,Ee);if(Tt!==h){if(Tt)continue;at=!1;break}if(gt){if(!Ss(A,function(jt,Xt){if(!ii(gt,Xt)&&(It===jt||me(It,jt,k,Y,Ee)))return gt.push(Xt)})){at=!1;break}}else if(!(It===qt||me(It,qt,k,Y,Ee))){at=!1;break}}return Ee.delete(x),Ee.delete(A),at}function io(x,A,k,Y,me,Ee,Te){switch(k){case Ct:if(x.byteLength!=A.byteLength||x.byteOffset!=A.byteOffset)return!1;x=x.buffer,A=A.buffer;case dt:return!(x.byteLength!=A.byteLength||!Ee(new Rs(x),new Rs(A)));case ye:case Ce:case Le:return Fn(+x,+A);case de:return x.name==A.name&&x.message==A.message;case nt:case ot:return x==A+"";case Ie:var De=Ra;case it:var Ze=Y&te;if(De||(De=Ms),x.size!=A.size&&!Ze)return!1;var Qe=Te.get(x);if(Qe)return Qe==A;Y|=fe,Te.set(x,A);var et=ta(De(x),De(A),Y,me,Ee,Te);return Te.delete(x),et;case ut:if(Wi)return Wi.call(x)==Wi.call(A)}return!1}function so(x,A,k,Y,me,Ee){var Te=k&te,De=us(x),Ze=De.length,Qe=us(A),et=Qe.length;if(Ze!=et&&!Te)return!1;for(var rt=Ze;rt--;){var at=De[rt];if(!(Te?at in A:nr.call(A,at)))return!1}var gt=Ee.get(x),It=Ee.get(A);if(gt&&It)return gt==A&&It==x;var qt=!0;Ee.set(x,A),Ee.set(A,x);for(var Tt=Te;++rt<Ze;){at=De[rt];var jt=x[at],Xt=A[at];if(Y)var gn=Te?Y(Xt,jt,at,A,x,Ee):Y(jt,Xt,at,x,A,Ee);if(!(gn===h?jt===Xt||me(jt,Xt,k,Y,Ee):gn)){qt=!1;break}Tt||(Tt=at=="constructor")}if(qt&&!Tt){var Jr=x.constructor,yn=A.constructor;Jr!=yn&&"constructor"in x&&"constructor"in A&&!(typeof Jr=="function"&&Jr instanceof Jr&&typeof yn=="function"&&yn instanceof yn)&&(qt=!1)}return Ee.delete(x),Ee.delete(A),qt}function hn(x){return Mc(oa(x,h,Jc),x+"")}function us(x){return Sn(x,Pr,hs)}function cs(x){return Sn(x,sn,ra)}var ls=Ds?function(x){return Ds.get(x)}:Uc;function Bi(x){for(var A=x.name+"",k=xi[A],Y=nr.call(xi,A)?k.length:0;Y--;){var me=k[Y],Ee=me.func;if(Ee==null||Ee==x)return me.name}return A}function Qn(x){var A=nr.call(_e,"placeholder")?_e:x;return A.placeholder}function Et(){var x=_e.iteratee||Lc;return x=x===Lc?Qi:x,arguments.length?x(arguments[0],arguments[1]):x}function Ri(x,A){var k=x.__data__;return po(A)?k[typeof A=="string"?"string":"hash"]:k.map}function ds(x){for(var A=Pr(x),k=A.length;k--;){var Y=A[k],me=x[Y];A[k]=[Y,me,sa(me)]}return A}function Ln(x,A){var k=bu(x,A);return Ha(k)?k:h}function ao(x){var A=nr.call(x,ai),k=x[ai];try{x[ai]=h;var Y=!0}catch{}var me=Cs.call(x);return Y&&(A?x[ai]=k:delete x[ai]),me}var hs=Pa?function(x){return x==null?[]:(x=lr(x),Rn(Pa(x),function(A){return of.call(x,A)}))}:qc,ra=Pa?function(x){for(var A=[];x;)Zn(A,hs(x)),x=wi(x);return A}:qc,Ir=Ur;(Ps&&Ir(new Ps(new ArrayBuffer(1)))!=Ct||zi&&Ir(new zi)!=Ie||Da&&Ir(Da.resolve())!=tt||Vn&&Ir(new Vn)!=it||fi&&Ir(new fi)!=St)&&(Ir=function(x){var A=Ur(x),k=A==He?x.constructor:h,Y=k?vs(k):"";if(Y)switch(Y){case qu:return Ct;case Zu:return Ie;case Hu:return tt;case zu:return it;case Vu:return St}return A});function oo(x,A,k){for(var Y=-1,me=k.length;++Y<me;){var Ee=k[Y],Te=Ee.size;switch(Ee.type){case"drop":x+=Te;break;case"dropRight":A-=Te;break;case"take":A=Br(A,x+Te);break;case"takeRight":x=xr(x,A-Te);break}}return{start:x,end:A}}function fo(x){var A=x.match(wt);return A?A[1].split(st):[]}function na(x,A,k){A=Jn(A,x);for(var Y=-1,me=A.length,Ee=!1;++Y<me;){var Te=ei(A[Y]);if(!(Ee=x!=null&&k(x,Te)))break;x=x[Te]}return Ee||++Y!=me?Ee:(me=x==null?0:x.length,!!me&&Gf(me)&&pn(Te,me)&&(Pt(x)||bs(x)))}function uo(x){var A=x.length,k=new x.constructor(A);return A&&typeof x[0]=="string"&&nr.call(x,"index")&&(k.index=x.index,k.input=x.input),k}function ia(x){return typeof x.constructor=="function"&&!pi(x)?Ei(wi(x)):{}}function co(x,A,k){var Y=x.constructor;switch(A){case dt:return is(x);case ye:case Ce:return new Y(+x);case Ct:return Ac(x,k);case Dt:case yt:case zt:case Zt:case bt:case Lt:case Nt:case _t:case Vt:return P(x,k);case Ie:return new Y;case Le:case ot:return new Y(x);case nt:return S(x);case it:return new Y;case ut:return I(x)}}function lo(x,A){var k=A.length;if(!k)return x;var Y=k-1;return A[Y]=(k>1?"& ":"")+A[Y],A=A.join(k>2?", ":" "),x.replace(ct,`{
|
|
39
|
-
/* [wrapped with `+A+`] */
|
|
40
|
-
`)}function ho(x){return Pt(x)||bs(x)||!!(ff&&x&&x[ff])}function pn(x,A){var k=typeof x;return A=A??re,!!A&&(k=="number"||k!="symbol"&&Hr.test(x))&&x>-1&&x%1==0&&x<A}function Or(x,A,k){if(!vr(k))return!1;var Y=typeof A;return(Y=="number"?nn(k)&&pn(A,k.length):Y=="string"&&A in k)?Fn(k[A],x):!1}function ps(x,A){if(Pt(x))return!1;var k=typeof x;return k=="number"||k=="symbol"||k=="boolean"||x==null||mn(x)?!0:J.test(x)||!ve.test(x)||A!=null&&x in lr(A)}function po(x){var A=typeof x;return A=="string"||A=="number"||A=="symbol"||A=="boolean"?x!=="__proto__":x===null}function gs(x){var A=Bi(x),k=_e[A];if(typeof k!="function"||!(A in Ht.prototype))return!1;if(x===k)return!0;var Y=ls(k);return!!Y&&x===Y[0]}function mo(x){return!!nf&&nf in x}var go=Ts?mi:Zc;function pi(x){var A=x&&x.constructor,k=typeof A=="function"&&A.prototype||_i;return x===k}function sa(x){return x===x&&!vr(x)}function aa(x,A){return function(k){return k==null?!1:k[x]===A&&(A!==h||x in lr(k))}}function yo(x){var A=Wf(x,function(Y){return k.size===T&&k.clear(),Y}),k=A.cache;return A}function vo(x,A){var k=x[1],Y=A[1],me=k|Y,Ee=me<(ce|le|Pe),Te=Y==Pe&&k==ge||Y==Pe&&k==Be&&x[7].length<=A[8]||Y==(Pe|Be)&&A[7].length<=A[8]&&k==ge;if(!(Ee||Te))return x;Y&ce&&(x[2]=A[2],me|=k&ce?0:ie);var De=A[3];if(De){var Ze=x[3];x[3]=Ze?Se(Ze,De,A[4]):De,x[4]=Ze?Hn(x[3],C):A[4]}return De=A[5],De&&(Ze=x[5],x[5]=Ze?ze(Ze,De,A[6]):De,x[6]=Ze?Hn(x[5],C):A[6]),De=A[7],De&&(x[7]=De),Y&Pe&&(x[8]=x[8]==null?A[8]:Br(x[8],A[8])),x[9]==null&&(x[9]=A[9]),x[0]=A[0],x[1]=me,x}function bo(x){var A=[];if(x!=null)for(var k in lr(x))A.push(k);return A}function _o(x){return Cs.call(x)}function oa(x,A,k){return A=xr(A===h?x.length-1:A,0),function(){for(var Y=arguments,me=-1,Ee=xr(Y.length-A,0),Te=Ge(Ee);++me<Ee;)Te[me]=Y[A+me];me=-1;for(var De=Ge(A+1);++me<A;)De[me]=Y[me];return De[A]=k(Te),jr(x,this,De)}}function fa(x,A){return A.length<2?x:Gn(x,Kr(A,0,-1))}function wo(x,A){for(var k=x.length,Y=Br(A.length,k),me=Xe(x);Y--;){var Ee=A[Y];x[Y]=pn(Ee,k)?me[Ee]:h}return x}function ys(x,A){if(!(A==="constructor"&&typeof x[A]=="function")&&A!="__proto__")return x[A]}var ua=Vc(Of),xo=oi||function(x,A){return br.setTimeout(x,A)},Mc=Vc(kf);function zc(x,A,k){var Y=A+"";return Mc(x,lo(Y,Rl(fo(Y),k)))}function Vc(x){var A=0,k=0;return function(){var Y=Lu(),me=q-(Y-k);if(k=Y,me>0){if(++A>=D)return arguments[0]}else A=0;return x.apply(h,arguments)}}function Zf(x,A){var k=-1,Y=x.length,me=Y-1;for(A=A===h?Y:A;++k<A;){var Ee=rs(k,me),Te=x[Ee];x[Ee]=x[k],x[k]=Te}return x.length=A,x}var Wc=yo(function(x){var A=[];return x.charCodeAt(0)===46&&A.push(""),x.replace(se,function(k,Y,me,Ee){A.push(me?Ee.replace(Mt,"$1"):Y||k)}),A});function ei(x){if(typeof x=="string"||mn(x))return x;var A=x+"";return A=="0"&&1/x==-j?"-0":A}function vs(x){if(x!=null){try{return Ui.call(x)}catch{}try{return x+""}catch{}}return""}function Rl(x,A){return Qr(Oe,function(k){var Y="_."+k[0];A&k[1]&&!Li(x,Y)&&x.push(Y)}),x.sort()}function jc(x){if(x instanceof Ht)return x.clone();var A=new tn(x.__wrapped__,x.__chain__);return A.__actions__=Xe(x.__actions__),A.__index__=x.__index__,A.__values__=x.__values__,A}function Ol(x,A,k){(k?Or(x,A,k):A===h)?A=1:A=xr(Ut(A),0);var Y=x==null?0:x.length;if(!Y||A<1)return[];for(var me=0,Ee=0,Te=Ge(Hi(Y/A));me<Y;)Te[Ee++]=Kr(x,me,me+=A);return Te}function kl(x){for(var A=-1,k=x==null?0:x.length,Y=0,me=[];++A<k;){var Ee=x[A];Ee&&(me[Y++]=Ee)}return me}function Pl(){var x=arguments.length;if(!x)return[];for(var A=Ge(x-1),k=arguments[0],Y=x;Y--;)A[Y-1]=arguments[Y];return Zn(Pt(k)?Xe(k):[k],Er(A,1))}var Dl=Ot(function(x,A){return Sr(x)?Gi(x,Er(A,1,Sr,!0)):[]}),Nl=Ot(function(x,A){var k=An(A);return Sr(k)&&(k=h),Sr(x)?Gi(x,Er(A,1,Sr,!0),Et(k,2)):[]}),Ll=Ot(function(x,A){var k=An(A);return Sr(k)&&(k=h),Sr(x)?Gi(x,Er(A,1,Sr,!0),h,k):[]});function Fl(x,A,k){var Y=x==null?0:x.length;return Y?(A=k||A===h?1:Ut(A),Kr(x,A<0?0:A,Y)):[]}function Ul(x,A,k){var Y=x==null?0:x.length;return Y?(A=k||A===h?1:Ut(A),A=Y-A,Kr(x,0,A<0?0:A)):[]}function ql(x,A){return x&&x.length?ns(x,Et(A,3),!0,!0):[]}function Zl(x,A){return x&&x.length?ns(x,Et(A,3),!0):[]}function Hl(x,A,k,Y){var me=x==null?0:x.length;return me?(k&&typeof k!="number"&&Or(x,A,k)&&(k=0,Y=me),Si(x,A,k,Y)):[]}function Gc(x,A,k){var Y=x==null?0:x.length;if(!Y)return-1;var me=k==null?0:Ut(k);return me<0&&(me=xr(Y+me,0)),$s(x,Et(A,3),me)}function Kc(x,A,k){var Y=x==null?0:x.length;if(!Y)return-1;var me=Y-1;return k!==h&&(me=Ut(k),me=k<0?xr(Y+me,0):Br(me,Y-1)),$s(x,Et(A,3),me,!0)}function Jc(x){var A=x==null?0:x.length;return A?Er(x,1):[]}function Vl(x){var A=x==null?0:x.length;return A?Er(x,j):[]}function Wl(x,A){var k=x==null?0:x.length;return k?(A=A===h?1:Ut(A),Er(x,A)):[]}function jl(x){for(var A=-1,k=x==null?0:x.length,Y={};++A<k;){var me=x[A];Y[me[0]]=me[1]}return Y}function Yc(x){return x&&x.length?x[0]:h}function Gl(x,A,k){var Y=x==null?0:x.length;if(!Y)return-1;var me=k==null?0:Ut(k);return me<0&&(me=xr(Y+me,0)),ni(x,A,me)}function Kl(x){var A=x==null?0:x.length;return A?Kr(x,0,-1):[]}var Jl=Ot(function(x){var A=pr(x,Qa);return A.length&&A[0]===x[0]?Ua(A):[]}),Yl=Ot(function(x){var A=An(x),k=pr(x,Qa);return A===An(k)?A=h:k.pop(),k.length&&k[0]===x[0]?Ua(k,Et(A,2)):[]}),Xl=Ot(function(x){var A=An(x),k=pr(x,Qa);return A=typeof A=="function"?A:h,A&&k.pop(),k.length&&k[0]===x[0]?Ua(k,h,A):[]});function Ql(x,A){return x==null?"":Du.call(x,A)}function An(x){var A=x==null?0:x.length;return A?x[A-1]:h}function ed(x,A,k){var Y=x==null?0:x.length;if(!Y)return-1;var me=Y;return k!==h&&(me=Ut(k),me=me<0?xr(Y+me,0):Br(me,Y-1)),A===A?Su(x,A,me):$s(x,Wo,me,!0)}function td(x,A){return x&&x.length?Cf(x,Ut(A)):h}var rd=Ot(Xc);function Xc(x,A){return x&&x.length&&A&&A.length?js(x,A):x}function nd(x,A,k){return x&&x.length&&A&&A.length?js(x,A,Et(k,2)):x}function id(x,A,k){return x&&x.length&&A&&A.length?js(x,A,h,k):x}var sd=hn(function(x,A){var k=x==null?0:x.length,Y=Us(x,A);return ts(x,pr(A,function(me){return pn(me,k)?+me:me}).sort(Z)),Y});function ad(x,A){var k=[];if(!(x&&x.length))return k;var Y=-1,me=[],Ee=x.length;for(A=Et(A,3);++Y<Ee;){var Te=x[Y];A(Te,Y,x)&&(k.push(Te),me.push(Y))}return ts(x,me),k}function Ic(x){return x==null?x:Uu.call(x)}function od(x,A,k){var Y=x==null?0:x.length;return Y?(k&&typeof k!="number"&&Or(x,A,k)?(A=0,k=Y):(A=A==null?0:Ut(A),k=k===h?Y:Ut(k)),Kr(x,A,k)):[]}function fd(x,A){return Ai(x,A)}function ud(x,A,k){return ja(x,A,Et(k,2))}function cd(x,A){var k=x==null?0:x.length;if(k){var Y=Ai(x,A);if(Y<k&&Fn(x[Y],A))return Y}return-1}function ld(x,A){return Ai(x,A,!0)}function dd(x,A,k){return ja(x,A,Et(k,2),!0)}function hd(x,A){var k=x==null?0:x.length;if(k){var Y=Ai(x,A,!0)-1;if(Fn(x[Y],A))return Y}return-1}function pd(x){return x&&x.length?Ga(x):[]}function md(x,A){return x&&x.length?Ga(x,Et(A,2)):[]}function gd(x){var A=x==null?0:x.length;return A?Kr(x,1,A):[]}function yd(x,A,k){return x&&x.length?(A=k||A===h?1:Ut(A),Kr(x,0,A<0?0:A)):[]}function vd(x,A,k){var Y=x==null?0:x.length;return Y?(A=k||A===h?1:Ut(A),A=Y-A,Kr(x,A<0?0:A,Y)):[]}function bd(x,A){return x&&x.length?ns(x,Et(A,3),!1,!0):[]}function _d(x,A){return x&&x.length?ns(x,Et(A,3)):[]}var wd=Ot(function(x){return Kn(Er(x,1,Sr,!0))}),xd=Ot(function(x){var A=An(x);return Sr(A)&&(A=h),Kn(Er(x,1,Sr,!0),Et(A,2))}),Ed=Ot(function(x){var A=An(x);return A=typeof A=="function"?A:h,Kn(Er(x,1,Sr,!0),h,A)});function Sd(x){return x&&x.length?Kn(x):[]}function $d(x,A){return x&&x.length?Kn(x,Et(A,2)):[]}function Ad(x,A){return A=typeof A=="function"?A:h,x&&x.length?Kn(x,h,A):[]}function Tc(x){if(!(x&&x.length))return[];var A=0;return x=Rn(x,function(k){if(Sr(k))return A=xr(k.length,A),!0}),Ca(A,function(k){return pr(x,Ia(k))})}function Qc(x,A){if(!(x&&x.length))return[];var k=Tc(x);return A==null?k:pr(k,function(Y){return jr(A,h,Y)})}var Md=Ot(function(x,A){return Sr(x)?Gi(x,A):[]}),Id=Ot(function(x){return Gs(Rn(x,Sr))}),Td=Ot(function(x){var A=An(x);return Sr(A)&&(A=h),Gs(Rn(x,Sr),Et(A,2))}),Cd=Ot(function(x){var A=An(x);return A=typeof A=="function"?A:h,Gs(Rn(x,Sr),h,A)}),Bd=Ot(Tc);function Rd(x,A){return Pf(x||[],A||[],ji)}function Od(x,A){return Pf(x||[],A||[],$i)}var kd=Ot(function(x){var A=x.length,k=A>1?x[A-1]:h;return k=typeof k=="function"?(x.pop(),k):h,Qc(x,k)});function el(x){var A=_e(x);return A.__chain__=!0,A}function Pd(x,A){return A(x),x}function Hf(x,A){return A(x)}var Dd=hn(function(x){var A=x.length,k=A?x[0]:0,Y=this.__wrapped__,me=function(Ee){return Us(Ee,x)};return A>1||this.__actions__.length||!(Y instanceof Ht)||!pn(k)?this.thru(me):(Y=Y.slice(k,+k+(A?1:0)),Y.__actions__.push({func:Hf,args:[me],thisArg:h}),new tn(Y,this.__chain__).thru(function(Ee){return A&&!Ee.length&&Ee.push(h),Ee}))});function Nd(){return el(this)}function Ld(){return new tn(this.value(),this.__chain__)}function Fd(){this.__values__===h&&(this.__values__=gl(this.value()));var x=this.__index__>=this.__values__.length,A=x?h:this.__values__[this.__index__++];return{done:x,value:A}}function Ud(){return this}function qd(x){for(var A,k=this;k instanceof Ls;){var Y=jc(k);Y.__index__=0,Y.__values__=h,A?me.__wrapped__=Y:A=Y;var me=Y;k=k.__wrapped__}return me.__wrapped__=x,A}function Zd(){var x=this.__wrapped__;if(x instanceof Ht){var A=x;return this.__actions__.length&&(A=new Ht(this)),A=A.reverse(),A.__actions__.push({func:Hf,args:[Ic],thisArg:h}),new tn(A,this.__chain__)}return this.thru(Ic)}function Hd(){return Xa(this.__wrapped__,this.__actions__)}var zd=yr(function(x,A,k){nr.call(x,k)?++x[k]:En(x,k,1)});function Vd(x,A,k){var Y=Pt(x)?$a:pc;return k&&Or(x,A,k)&&(A=h),Y(x,Et(A,3))}function Wd(x,A){var k=Pt(x)?Rn:Sf;return k(x,Et(A,3))}var jd=Ff(Gc),Gd=Ff(Kc);function Kd(x,A){return Er(zf(x,A),1)}function Jd(x,A){return Er(zf(x,A),j)}function Yd(x,A,k){return k=k===h?1:Ut(k),Er(zf(x,A),k)}function tl(x,A){var k=Pt(x)?Qr:jn;return k(x,Et(A,3))}function rl(x,A){var k=Pt(x)?hu:qs;return k(x,Et(A,3))}var Xd=yr(function(x,A,k){nr.call(x,k)?x[k].push(A):En(x,k,[A])});function Qd(x,A,k,Y){x=nn(x)?x:la(x),k=k&&!Y?Ut(k):0;var me=x.length;return k<0&&(k=xr(me+k,0)),Kf(x)?k<=me&&x.indexOf(A,k)>-1:!!me&&ni(x,A,k)>-1}var eh=Ot(function(x,A,k){var Y=-1,me=typeof A=="function",Ee=nn(x)?Ge(x.length):[];return jn(x,function(Te){Ee[++Y]=me?jr(A,Te,k):Ji(Te,A,k)}),Ee}),th=yr(function(x,A,k){En(x,k,A)});function zf(x,A){var k=Pt(x)?pr:Mf;return k(x,Et(A,3))}function nh(x,A,k,Y){return x==null?[]:(Pt(A)||(A=A==null?[]:[A]),k=Y?h:k,Pt(k)||(k=k==null?[]:[k]),Va(x,A,k))}var ih=yr(function(x,A,k){x[k?0:1].push(A)},function(){return[[],[]]});function ah(x,A,k){var Y=Pt(x)?Ma:Go,me=arguments.length<3;return Y(x,Et(A,4),k,me,jn)}function oh(x,A,k){var Y=Pt(x)?pu:Go,me=arguments.length<3;return Y(x,Et(A,4),k,me,qs)}function fh(x,A){var k=Pt(x)?Rn:Sf;return k(x,jf(Et(A,3)))}function uh(x){var A=Pt(x)?bf:wc;return A(x)}function lh(x,A,k){(k?Or(x,A,k):A===h)?A=1:A=Ut(A);var Y=Pt(x)?lc:xc;return Y(x,A)}function hh(x){var A=Pt(x)?dc:Ec;return A(x)}function ph(x){if(x==null)return 0;if(nn(x))return Kf(x)?bi(x):x.length;var A=Ir(x);return A==Ie||A==it?x.size:es(x).length}function mh(x,A,k){var Y=Pt(x)?Ss:Sc;return k&&Or(x,A,k)&&(A=h),Y(x,Et(A,3))}var gh=Ot(function(x,A){if(x==null)return[];var k=A.length;return k>1&&Or(x,A[0],A[1])?A=[]:k>2&&Or(A[0],A[1],A[2])&&(A=[A[0]]),Va(x,Er(A,1),[])}),Vf=cf||function(){return br.Date.now()};function yh(x,A){if(typeof A!="function")throw new en(E);return x=Ut(x),function(){if(--x<1)return A.apply(this,arguments)}}function nl(x,A,k){return A=k?h:A,A=x&&A==null?x.length:A,dn(x,Pe,h,h,h,h,A)}function il(x,A){var k;if(typeof A!="function")throw new en(E);return x=Ut(x),function(){return--x>0&&(k=A.apply(this,arguments)),x<=1&&(A=h),k}}var Cc=Ot(function(x,A,k){var Y=ce;if(k.length){var me=Hn(k,Qn(Cc));Y|=Me}return dn(x,Y,A,k,me)}),al=Ot(function(x,A,k){var Y=ce|le;if(k.length){var me=Hn(k,Qn(al));Y|=Me}return dn(A,Y,x,k,me)});function ol(x,A,k){A=k?h:A;var Y=dn(x,ge,h,h,h,h,h,A);return Y.placeholder=ol.placeholder,Y}function fl(x,A,k){A=k?h:A;var Y=dn(x,pe,h,h,h,h,h,A);return Y.placeholder=fl.placeholder,Y}function ul(x,A,k){var Y,me,Ee,Te,De,Ze,Qe=0,et=!1,rt=!1,at=!0;if(typeof x!="function")throw new en(E);A=Mn(A)||0,vr(k)&&(et=!!k.leading,rt="maxWait"in k,Ee=rt?xr(Mn(k.maxWait)||0,A):Ee,at="trailing"in k?!!k.trailing:at);function gt($r){var Un=Y,yi=me;return Y=me=h,Qe=$r,Te=x.apply(yi,Un),Te}function It($r){return Qe=$r,De=xo(jt,A),et?gt($r):Te}function qt($r){var Un=$r-Ze,yi=$r-Qe,Tl=A-Un;return rt?Br(Tl,Ee-yi):Tl}function Tt($r){var Un=$r-Ze,yi=$r-Qe;return Ze===h||Un>=A||Un<0||rt&&yi>=Ee}function jt(){var $r=Vf();if(Tt($r))return Xt($r);De=xo(jt,qt($r))}function Xt($r){return De=h,at&&Y?gt($r):(Y=me=h,Te)}function gn(){De!==h&&Ks(De),Qe=0,Y=Ze=me=De=h}function Jr(){return De===h?Te:Xt(Vf())}function yn(){var $r=Vf(),Un=Tt($r);if(Y=arguments,me=this,Ze=$r,Un){if(De===h)return It(Ze);if(rt)return Ks(De),De=xo(jt,A),gt(Ze)}return De===h&&(De=xo(jt,A)),Te}return yn.cancel=gn,yn.flush=Jr,yn}var vh=Ot(function(x,A){return Ef(x,1,A)}),bh=Ot(function(x,A,k){return Ef(x,Mn(A)||0,k)});function _h(x){return dn(x,Re)}function Wf(x,A){if(typeof x!="function"||A!=null&&typeof A!="function")throw new en(E);var k=function(){var Y=arguments,me=A?A.apply(this,Y):Y[0],Ee=k.cache;if(Ee.has(me))return Ee.get(me);var Te=x.apply(this,Y);return k.cache=Ee.set(me,Te)||Ee,Te};return k.cache=new(Wf.Cache||xn),k}Wf.Cache=xn;function jf(x){if(typeof x!="function")throw new en(E);return function(){var A=arguments;switch(A.length){case 0:return!x.call(this);case 1:return!x.call(this,A[0]);case 2:return!x.call(this,A[0],A[1]);case 3:return!x.call(this,A[0],A[1],A[2])}return!x.apply(this,A)}}function wh(x){return il(2,x)}var xh=$c(function(x,A){A=A.length==1&&Pt(A[0])?pr(A[0],Gr(Et())):pr(Er(A,1),Gr(Et()));var k=A.length;return Ot(function(Y){for(var me=-1,Ee=Br(Y.length,k);++me<Ee;)Y[me]=A[me].call(this,Y[me]);return jr(x,this,Y)})}),Bc=Ot(function(x,A){var k=Hn(A,Qn(Bc));return dn(x,Me,h,A,k)}),cl=Ot(function(x,A){var k=Hn(A,Qn(cl));return dn(x,$e,h,A,k)}),Eh=hn(function(x,A){return dn(x,Be,h,h,h,A)});function Sh(x,A){if(typeof x!="function")throw new en(E);return A=A===h?A:Ut(A),Ot(x,A)}function $h(x,A){if(typeof x!="function")throw new en(E);return A=A==null?0:xr(Ut(A),0),Ot(function(k){var Y=k[A],me=Dn(k,0,A);return Y&&Zn(me,Y),jr(x,this,me)})}function Ah(x,A,k){var Y=!0,me=!0;if(typeof x!="function")throw new en(E);return vr(k)&&(Y="leading"in k?!!k.leading:Y,me="trailing"in k?!!k.trailing:me),ul(x,A,{leading:Y,maxWait:A,trailing:me})}function Mh(x){return nl(x,1)}function Ih(x,A){return Bc(eo(A),x)}function Th(){if(!arguments.length)return[];var x=arguments[0];return Pt(x)?x:[x]}function Bh(x){return rn(x,H)}function Rh(x,A){return A=typeof A=="function"?A:h,rn(x,H,A)}function Oh(x){return rn(x,B|H)}function kh(x,A){return A=typeof A=="function"?A:h,rn(x,B|H,A)}function Ph(x,A){return A==null||xf(x,A,Pr(A))}function Fn(x,A){return x===A||x!==x&&A!==A}var Dh=Ys(Fa),Nh=Ys(function(x,A){return x>=A}),bs=qa(function(){return arguments}())?qa:function(x){return wr(x)&&nr.call(x,"callee")&&!of.call(x,"callee")},Pt=Ge.isArray,Lh=Fo?Gr(Fo):vc;function nn(x){return x!=null&&Gf(x.length)&&!mi(x)}function Sr(x){return wr(x)&&nn(x)}function Fh(x){return x===!0||x===!1||wr(x)&&Ur(x)==ye}var Oi=Pu||Zc,Uh=Uo?Gr(Uo):bc;function qh(x){return wr(x)&&x.nodeType===1&&!Eo(x)}function Zh(x){if(x==null)return!0;if(nn(x)&&(Pt(x)||typeof x=="string"||typeof x.splice=="function"||Oi(x)||ca(x)||bs(x)))return!x.length;var A=Ir(x);if(A==Ie||A==it)return!x.size;if(pi(x))return!es(x).length;for(var k in x)if(nr.call(x,k))return!1;return!0}function Hh(x,A){return Yi(x,A)}function zh(x,A,k){k=typeof k=="function"?k:h;var Y=k?k(x,A):h;return Y===h?Yi(x,A,h,k):!!Y}function Rc(x){if(!wr(x))return!1;var A=Ur(x);return A==de||A==ae||typeof x.message=="string"&&typeof x.name=="string"&&!Eo(x)}function Vh(x){return typeof x=="number"&&lf(x)}function mi(x){if(!vr(x))return!1;var A=Ur(x);return A==ne||A==be||A==oe||A==Ne}function ll(x){return typeof x=="number"&&x==Ut(x)}function Gf(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=re}function vr(x){var A=typeof x;return x!=null&&(A=="object"||A=="function")}function wr(x){return x!=null&&typeof x=="object"}var dl=qo?Gr(qo):Xi;function Wh(x,A){return x===A||Za(x,A,ds(A))}function jh(x,A,k){return k=typeof k=="function"?k:h,Za(x,A,ds(A),k)}function Gh(x){return pl(x)&&x!=+x}function Jh(x){if(go(x))throw new Bt(b);return Ha(x)}function Yh(x){return x===null}function Xh(x){return x==null}function pl(x){return typeof x=="number"||wr(x)&&Ur(x)==Le}function Eo(x){if(!wr(x)||Ur(x)!=He)return!1;var A=wi(x);if(A===null)return!0;var k=nr.call(A,"constructor")&&A.constructor;return typeof k=="function"&&k instanceof k&&Ui.call(k)==Ru}var Oc=Ea?Gr(Ea):kr;function Qh(x){return ll(x)&&x>=-re&&x<=re}var ml=Sa?Gr(Sa):Mr;function Kf(x){return typeof x=="string"||!Pt(x)&&wr(x)&&Ur(x)==ot}function mn(x){return typeof x=="symbol"||wr(x)&&Ur(x)==ut}var ca=Zo?Gr(Zo):zs;function e0(x){return x===h}function t0(x){return wr(x)&&Ir(x)==St}function r0(x){return wr(x)&&Ur(x)==Rt}var n0=Ys(za),i0=Ys(function(x,A){return x<=A});function gl(x){if(!x)return[];if(nn(x))return Kf(x)?fn(x):Xe(x);if(Zi&&x[Zi])return wu(x[Zi]());var A=Ir(x),k=A==Ie?Ra:A==it?Ms:la;return k(x)}function gi(x){if(!x)return x===0?x:0;if(x=Mn(x),x===j||x===-j){var A=x<0?-1:1;return A*ee}return x===x?x:0}function Ut(x){var A=gi(x),k=A%1;return A===A?k?A-k:A:0}function yl(x){return x?li(Ut(x),0,Q):0}function Mn(x){if(typeof x=="number")return x;if(mn(x))return F;if(vr(x)){var A=typeof x.valueOf=="function"?x.valueOf():x;x=vr(A)?A+"":A}if(typeof x!="string")return x===0?x:+x;x=Jo(x);var k=qr.test(x);return k||Zr.test(x)?du(x.slice(2),k?2:8):rr.test(x)?F:+x}function vl(x){return Je(x,sn(x))}function s0(x){return x?li(Ut(x),-re,re):x===0?x:0}function fr(x){return x==null?"":Rr(x)}var a0=ln(function(x,A){if(pi(A)||nn(A)){Je(A,Pr(A),x);return}for(var k in A)nr.call(A,k)&&ji(x,k,A[k])}),bl=ln(function(x,A){Je(A,sn(A),x)}),Jf=ln(function(x,A,k,Y){Je(A,sn(A),x,Y)}),o0=ln(function(x,A,k,Y){Je(A,Pr(A),x,Y)}),f0=hn(Us);function u0(x,A){var k=Ei(x);return A==null?k:ci(k,A)}var c0=Ot(function(x,A){x=lr(x);var k=-1,Y=A.length,me=Y>2?A[2]:h;for(me&&Or(A[0],A[1],me)&&(Y=1);++k<Y;)for(var Ee=A[k],Te=sn(Ee),De=-1,Ze=Te.length;++De<Ze;){var Qe=Te[De],et=x[Qe];(et===h||Fn(et,_i[Qe])&&!nr.call(x,Qe))&&(x[Qe]=Ee[Qe])}return x}),l0=Ot(function(x){return x.push(h,ea),jr(_l,h,x)});function d0(x,A){return zo(x,Et(A,3),cn)}function h0(x,A){return zo(x,Et(A,3),Hs)}function p0(x,A){return x==null?x:Zs(x,Et(A,3),sn)}function m0(x,A){return x==null?x:$f(x,Et(A,3),sn)}function g0(x,A){return x&&cn(x,Et(A,3))}function y0(x,A){return x&&Hs(x,Et(A,3))}function v0(x){return x==null?[]:Ki(x,Pr(x))}function b0(x){return x==null?[]:Ki(x,sn(x))}function kc(x,A,k){var Y=x==null?h:Gn(x,A);return Y===h?k:Y}function _0(x,A){return x!=null&&na(x,A,mc)}function Pc(x,A){return x!=null&&na(x,A,gc)}var w0=Ti(function(x,A,k){A!=null&&typeof A.toString!="function"&&(A=Cs.call(A)),x[A]=k},Nc(an)),x0=Ti(function(x,A,k){A!=null&&typeof A.toString!="function"&&(A=Cs.call(A)),nr.call(x,A)?x[A].push(k):x[A]=[k]},Et),E0=Ot(Ji);function Pr(x){return nn(x)?vf(x):es(x)}function sn(x){return nn(x)?vf(x,!0):Vs(x)}function S0(x,A){var k={};return A=Et(A,3),cn(x,function(Y,me,Ee){En(k,A(Y,me,Ee),Y)}),k}function $0(x,A){var k={};return A=Et(A,3),cn(x,function(Y,me,Ee){En(k,me,A(Y,me,Ee))}),k}var A0=ln(function(x,A,k){Ws(x,A,k)}),_l=ln(function(x,A,k,Y){Ws(x,A,k,Y)}),M0=hn(function(x,A){var k={};if(x==null)return k;var Y=!1;A=pr(A,function(Ee){return Ee=Jn(Ee,x),Y||(Y=Ee.length>1),Ee}),Je(x,cs(x),k),Y&&(k=rn(k,B|N|H,no));for(var me=A.length;me--;)Ja(k,A[me]);return k});function I0(x,A){return wl(x,jf(Et(A)))}var T0=hn(function(x,A){return x==null?{}:_c(x,A)});function wl(x,A){if(x==null)return{};var k=pr(cs(x),function(Y){return[Y]});return A=Et(A),Bf(x,k,function(Y,me){return A(Y,me[0])})}function C0(x,A,k){A=Jn(A,x);var Y=-1,me=A.length;for(me||(me=1,x=h);++Y<me;){var Ee=x==null?h:x[ei(A[Y])];Ee===h&&(Y=me,Ee=k),x=mi(Ee)?Ee.call(x):Ee}return x}function B0(x,A,k){return x==null?x:$i(x,A,k)}function R0(x,A,k,Y){return Y=typeof Y=="function"?Y:h,x==null?x:$i(x,A,k,Y)}var xl=Xs(Pr),El=Xs(sn);function O0(x,A,k){var Y=Pt(x),me=Y||Oi(x)||ca(x);if(A=Et(A,4),k==null){var Ee=x&&x.constructor;me?k=Y?new Ee:[]:vr(x)?k=mi(Ee)?Ei(wi(x)):{}:k={}}return(me?Qr:cn)(x,function(Te,De,Ze){return A(k,Te,De,Ze)}),k}function k0(x,A){return x==null?!0:Ja(x,A)}function P0(x,A,k){return x==null?x:Ya(x,A,eo(k))}function D0(x,A,k,Y){return Y=typeof Y=="function"?Y:h,x==null?x:Ya(x,A,eo(k),Y)}function la(x){return x==null?[]:Ba(x,Pr(x))}function N0(x){return x==null?[]:Ba(x,sn(x))}function L0(x,A,k){return k===h&&(k=A,A=h),k!==h&&(k=Mn(k),k=k===k?k:0),A!==h&&(A=Mn(A),A=A===A?A:0),li(Mn(x),A,k)}function F0(x,A,k){return A=gi(A),k===h?(k=A,A=0):k=gi(k),x=Mn(x),yc(x,A,k)}function U0(x,A,k){if(k&&typeof k!="boolean"&&Or(x,A,k)&&(A=k=h),k===h&&(typeof A=="boolean"?(k=A,A=h):typeof x=="boolean"&&(k=x,x=h)),x===h&&A===h?(x=0,A=1):(x=gi(x),A===h?(A=x,x=0):A=gi(A)),x>A){var Y=x;x=A,A=Y}if(k||x%1||A%1){var me=On();return Br(x+me*(A-x+lu("1e-"+((me+"").length-1))),A)}return rs(x,A)}var q0=Ii(function(x,A,k){return A=A.toLowerCase(),x+(k?Sl(A):A)});function Sl(x){return Dc(fr(x).toLowerCase())}function $l(x){return x=fr(x),x&&x.replace(Vr,vu).replace(au,"")}function Z0(x,A,k){x=fr(x),A=Rr(A);var Y=x.length;k=k===h?Y:li(Ut(k),0,Y);var me=k;return k-=A.length,k>=0&&x.slice(k,me)==A}function H0(x){return x=fr(x),x&&Kt.test(x)?x.replace(vt,Qo):x}function z0(x){return x=fr(x),x&&ke.test(x)?x.replace(xe,"\\$&"):x}var V0=Ii(function(x,A,k){return x+(k?"-":"")+A.toLowerCase()}),W0=Ii(function(x,A,k){return x+(k?" ":"")+A.toLowerCase()}),j0=Lf("toLowerCase");function G0(x,A,k){x=fr(x),A=Ut(A);var Y=A?bi(x):0;if(!A||Y>=A)return x;var me=(A-Y)/2;return Xn(ks(me),k)+x+Xn(Hi(me),k)}function K0(x,A,k){x=fr(x),A=Ut(A);var Y=A?bi(x):0;return A&&Y<A?x+Xn(A-Y,k):x}function J0(x,A,k){x=fr(x),A=Ut(A);var Y=A?bi(x):0;return A&&Y<A?Xn(A-Y,k)+x:x}function Y0(x,A,k){return k||A==null?A=0:A&&(A=+A),Fu(fr(x).replace(qe,""),A||0)}function X0(x,A,k){return(k?Or(x,A,k):A===h)?A=1:A=Ut(A),Wa(fr(x),A)}function Q0(){var x=arguments,A=fr(x[0]);return x.length<3?A:A.replace(x[1],x[2])}var ep=Ii(function(x,A,k){return x+(k?"_":"")+A.toLowerCase()});function tp(x,A,k){return k&&typeof k!="number"&&Or(x,A,k)&&(A=k=h),k=k===h?Q:k>>>0,k?(x=fr(x),x&&(typeof A=="string"||A!=null&&!Oc(A))&&(A=Rr(A),!A&&si(x))?Dn(fn(x),0,k):x.split(A,k)):[]}var rp=Ii(function(x,A,k){return x+(k?" ":"")+Dc(A)});function np(x,A,k){return x=fr(x),k=k==null?0:li(Ut(k),0,x.length),A=Rr(A),x.slice(k,k+A.length)==A}function ip(x,A,k){var Y=_e.templateSettings;k&&Or(x,A,k)&&(A=h),x=fr(x),A=Jf({},A,Y,Qs);var me=Jf({},A.imports,Y.imports,Qs),Ee=Pr(me),Te=Ba(me,Ee),De,Ze,Qe=0,et=A.interpolate||Tr,rt="__p += '",at=Oa((A.escape||Tr).source+"|"+et.source+"|"+(et===Jt?Yt:Tr).source+"|"+(A.evaluate||Tr).source+"|$","g"),gt="//# sourceURL="+(nr.call(A,"sourceURL")?(A.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++fu+"]")+`
|
|
41
|
-
`;x.replace(at,function(Tt,jt,Xt,gn,Jr,yn){return Xt||(Xt=gn),rt+=x.slice(Qe,yn).replace(Nr,ef),jt&&(De=!0,rt+=`' +
|
|
42
|
-
__e(`+jt+`) +
|
|
43
|
-
'`),Jr&&(Ze=!0,rt+=`';
|
|
44
|
-
`+Jr+`;
|
|
45
|
-
__p += '`),Xt&&(rt+=`' +
|
|
46
|
-
((__t = (`+Xt+`)) == null ? '' : __t) +
|
|
47
|
-
'`),Qe=yn+Tt.length,Tt}),rt+=`';
|
|
48
|
-
`;var It=nr.call(A,"variable")&&A.variable;if(!It)rt=`with (obj) {
|
|
49
|
-
`+rt+`
|
|
50
|
-
}
|
|
51
|
-
`;else if(mt.test(It))throw new Bt($);rt=(Ze?rt.replace(Wt,""):rt).replace($t,"$1").replace(Qt,"$1;"),rt="function("+(It||"obj")+`) {
|
|
52
|
-
`+(It?"":`obj || (obj = {});
|
|
53
|
-
`)+"var __t, __p = ''"+(De?", __e = _.escape":"")+(Ze?`, __j = Array.prototype.join;
|
|
54
|
-
function print() { __p += __j.call(arguments, '') }
|
|
55
|
-
`:`;
|
|
56
|
-
`)+rt+`return __p
|
|
57
|
-
}`;var qt=Ml(function(){return tr(Ee,gt+"return "+rt).apply(h,Te)});if(qt.source=rt,Rc(qt))throw qt;return qt}function sp(x){return fr(x).toLowerCase()}function ap(x){return fr(x).toUpperCase()}function op(x,A,k){if(x=fr(x),x&&(k||A===h))return Jo(x);if(!x||!(A=Rr(A)))return x;var Y=fn(x),me=fn(A),Ee=Yo(Y,me),Te=Xo(Y,me)+1;return Dn(Y,Ee,Te).join("")}function fp(x,A,k){if(x=fr(x),x&&(k||A===h))return x.slice(0,rf(x)+1);if(!x||!(A=Rr(A)))return x;var Y=fn(x),me=Xo(Y,fn(A))+1;return Dn(Y,0,me).join("")}function up(x,A,k){if(x=fr(x),x&&(k||A===h))return x.replace(qe,"");if(!x||!(A=Rr(A)))return x;var Y=fn(x),me=Yo(Y,fn(A));return Dn(Y,me).join("")}function cp(x,A){var k=je,Y=we;if(vr(A)){var me="separator"in A?A.separator:me;k="length"in A?Ut(A.length):k,Y="omission"in A?Rr(A.omission):Y}x=fr(x);var Ee=x.length;if(si(x)){var Te=fn(x);Ee=Te.length}if(k>=Ee)return x;var De=k-bi(Y);if(De<1)return Y;var Ze=Te?Dn(Te,0,De).join(""):x.slice(0,De);if(me===h)return Ze+Y;if(Te&&(De+=Ze.length-De),Oc(me)){if(x.slice(De).search(me)){var Qe,et=Ze;for(me.global||(me=Oa(me.source,fr(er.exec(me))+"g")),me.lastIndex=0;Qe=me.exec(et);)var rt=Qe.index;Ze=Ze.slice(0,rt===h?De:rt)}}else if(x.indexOf(Rr(me),De)!=De){var at=Ze.lastIndexOf(me);at>-1&&(Ze=Ze.slice(0,at))}return Ze+Y}function lp(x){return x=fr(x),x&&kt.test(x)?x.replace(Gt,$u):x}var dp=Ii(function(x,A,k){return x+(k?" ":"")+A.toUpperCase()}),Dc=Lf("toUpperCase");function Al(x,A,k){return x=fr(x),A=k?h:A,A===h?_u(x)?Iu(x):gu(x):x.match(A)||[]}var Ml=Ot(function(x,A){try{return jr(x,h,A)}catch(k){return Rc(k)?k:new Bt(k)}}),hp=hn(function(x,A){return Qr(A,function(k){k=ei(k),En(x,k,Cc(x[k],x))}),x});function pp(x){var A=x==null?0:x.length,k=Et();return x=A?pr(x,function(Y){if(typeof Y[1]!="function")throw new en(E);return[k(Y[0]),Y[1]]}):[],Ot(function(Y){for(var me=-1;++me<A;){var Ee=x[me];if(jr(Ee[0],this,Y))return jr(Ee[1],this,Y)}})}function mp(x){return hc(rn(x,B))}function Nc(x){return function(){return x}}function gp(x,A){return x==null||x!==x?A:x}var yp=Uf(),vp=Uf(!0);function an(x){return x}function Lc(x){return Qi(typeof x=="function"?x:rn(x,B))}function bp(x){return If(rn(x,B))}function _p(x,A){return Tf(x,rn(A,B))}var wp=Ot(function(x,A){return function(k){return Ji(k,x,A)}}),xp=Ot(function(x,A){return function(k){return Ji(x,k,A)}});function Fc(x,A,k){var Y=Pr(A),me=Ki(A,Y);k==null&&!(vr(A)&&(me.length||!Y.length))&&(k=A,A=x,x=this,me=Ki(A,Pr(A)));var Ee=!(vr(k)&&"chain"in k)||!!k.chain,Te=mi(x);return Qr(me,function(De){var Ze=A[De];x[De]=Ze,Te&&(x.prototype[De]=function(){var Qe=this.__chain__;if(Ee||Qe){var et=x(this.__wrapped__),rt=et.__actions__=Xe(this.__actions__);return rt.push({func:Ze,args:arguments,thisArg:x}),et.__chain__=Qe,et}return Ze.apply(x,Zn([this.value()],arguments))})}),x}function Ep(){return br._===this&&(br._=Ou),this}function Uc(){}function Sp(x){return x=Ut(x),Ot(function(A){return Cf(A,x)})}var $p=to(pr),Ap=to($a),Mp=to(Ss);function Il(x){return ps(x)?Ia(ei(x)):Rf(x)}function Ip(x){return function(A){return x==null?h:Gn(x,A)}}var Tp=qf(),Cp=qf(!0);function qc(){return[]}function Zc(){return!1}function Bp(){return{}}function Rp(){return""}function kp(){return!0}function Pp(x,A){if(x=Ut(x),x<1||x>re)return[];var k=Q,Y=Br(x,Q);A=Et(A),x-=Q;for(var me=Ca(Y,A);++k<x;)A(k);return me}function Dp(x){return Pt(x)?pr(x,ei):mn(x)?[x]:Xe(Wc(fr(x)))}function Np(x){var A=++Bu;return fr(x)+A}var Lp=Js(function(x,A){return x+A},0),Fp=hi("ceil"),Up=Js(function(x,A){return x/A},1),qp=hi("floor");function Zp(x){return x&&x.length?Pn(x,an,Fa):h}function Hp(x,A){return x&&x.length?Pn(x,Et(A,2),Fa):h}function zp(x){return jo(x,an)}function Vp(x,A){return jo(x,Et(A,2))}function Wp(x){return x&&x.length?Pn(x,an,za):h}function jp(x,A){return x&&x.length?Pn(x,Et(A,2),za):h}var Gp=Js(function(x,A){return x*A},1),Kp=hi("round"),Jp=Js(function(x,A){return x-A},0);function Yp(x){return x&&x.length?Ta(x,an):0}function Xp(x,A){return x&&x.length?Ta(x,Et(A,2)):0}return _e.after=yh,_e.ary=nl,_e.assign=a0,_e.assignIn=bl,_e.assignInWith=Jf,_e.assignWith=o0,_e.at=f0,_e.before=il,_e.bind=Cc,_e.bindAll=hp,_e.bindKey=al,_e.castArray=Th,_e.chain=el,_e.chunk=Ol,_e.compact=kl,_e.concat=Pl,_e.cond=pp,_e.conforms=mp,_e.constant=Nc,_e.countBy=zd,_e.create=u0,_e.curry=ol,_e.curryRight=fl,_e.debounce=ul,_e.defaults=c0,_e.defaultsDeep=l0,_e.defer=vh,_e.delay=bh,_e.difference=Dl,_e.differenceBy=Nl,_e.differenceWith=Ll,_e.drop=Fl,_e.dropRight=Ul,_e.dropRightWhile=ql,_e.dropWhile=Zl,_e.fill=Hl,_e.filter=Wd,_e.flatMap=Kd,_e.flatMapDeep=Jd,_e.flatMapDepth=Yd,_e.flatten=Jc,_e.flattenDeep=Vl,_e.flattenDepth=Wl,_e.flip=_h,_e.flow=yp,_e.flowRight=vp,_e.fromPairs=jl,_e.functions=v0,_e.functionsIn=b0,_e.groupBy=Xd,_e.initial=Kl,_e.intersection=Jl,_e.intersectionBy=Yl,_e.intersectionWith=Xl,_e.invert=w0,_e.invertBy=x0,_e.invokeMap=eh,_e.iteratee=Lc,_e.keyBy=th,_e.keys=Pr,_e.keysIn=sn,_e.map=zf,_e.mapKeys=S0,_e.mapValues=$0,_e.matches=bp,_e.matchesProperty=_p,_e.memoize=Wf,_e.merge=A0,_e.mergeWith=_l,_e.method=wp,_e.methodOf=xp,_e.mixin=Fc,_e.negate=jf,_e.nthArg=Sp,_e.omit=M0,_e.omitBy=I0,_e.once=wh,_e.orderBy=nh,_e.over=$p,_e.overArgs=xh,_e.overEvery=Ap,_e.overSome=Mp,_e.partial=Bc,_e.partialRight=cl,_e.partition=ih,_e.pick=T0,_e.pickBy=wl,_e.property=Il,_e.propertyOf=Ip,_e.pull=rd,_e.pullAll=Xc,_e.pullAllBy=nd,_e.pullAllWith=id,_e.pullAt=sd,_e.range=Tp,_e.rangeRight=Cp,_e.rearg=Eh,_e.reject=fh,_e.remove=ad,_e.rest=Sh,_e.reverse=Ic,_e.sampleSize=lh,_e.set=B0,_e.setWith=R0,_e.shuffle=hh,_e.slice=od,_e.sortBy=gh,_e.sortedUniq=pd,_e.sortedUniqBy=md,_e.split=tp,_e.spread=$h,_e.tail=gd,_e.take=yd,_e.takeRight=vd,_e.takeRightWhile=bd,_e.takeWhile=_d,_e.tap=Pd,_e.throttle=Ah,_e.thru=Hf,_e.toArray=gl,_e.toPairs=xl,_e.toPairsIn=El,_e.toPath=Dp,_e.toPlainObject=vl,_e.transform=O0,_e.unary=Mh,_e.union=wd,_e.unionBy=xd,_e.unionWith=Ed,_e.uniq=Sd,_e.uniqBy=$d,_e.uniqWith=Ad,_e.unset=k0,_e.unzip=Tc,_e.unzipWith=Qc,_e.update=P0,_e.updateWith=D0,_e.values=la,_e.valuesIn=N0,_e.without=Md,_e.words=Al,_e.wrap=Ih,_e.xor=Id,_e.xorBy=Td,_e.xorWith=Cd,_e.zip=Bd,_e.zipObject=Rd,_e.zipObjectDeep=Od,_e.zipWith=kd,_e.entries=xl,_e.entriesIn=El,_e.extend=bl,_e.extendWith=Jf,Fc(_e,_e),_e.add=Lp,_e.attempt=Ml,_e.camelCase=q0,_e.capitalize=Sl,_e.ceil=Fp,_e.clamp=L0,_e.clone=Bh,_e.cloneDeep=Oh,_e.cloneDeepWith=kh,_e.cloneWith=Rh,_e.conformsTo=Ph,_e.deburr=$l,_e.defaultTo=gp,_e.divide=Up,_e.endsWith=Z0,_e.eq=Fn,_e.escape=H0,_e.escapeRegExp=z0,_e.every=Vd,_e.find=jd,_e.findIndex=Gc,_e.findKey=d0,_e.findLast=Gd,_e.findLastIndex=Kc,_e.findLastKey=h0,_e.floor=qp,_e.forEach=tl,_e.forEachRight=rl,_e.forIn=p0,_e.forInRight=m0,_e.forOwn=g0,_e.forOwnRight=y0,_e.get=kc,_e.gt=Dh,_e.gte=Nh,_e.has=_0,_e.hasIn=Pc,_e.head=Yc,_e.identity=an,_e.includes=Qd,_e.indexOf=Gl,_e.inRange=F0,_e.invoke=E0,_e.isArguments=bs,_e.isArray=Pt,_e.isArrayBuffer=Lh,_e.isArrayLike=nn,_e.isArrayLikeObject=Sr,_e.isBoolean=Fh,_e.isBuffer=Oi,_e.isDate=Uh,_e.isElement=qh,_e.isEmpty=Zh,_e.isEqual=Hh,_e.isEqualWith=zh,_e.isError=Rc,_e.isFinite=Vh,_e.isFunction=mi,_e.isInteger=ll,_e.isLength=Gf,_e.isMap=dl,_e.isMatch=Wh,_e.isMatchWith=jh,_e.isNaN=Gh,_e.isNative=Jh,_e.isNil=Xh,_e.isNull=Yh,_e.isNumber=pl,_e.isObject=vr,_e.isObjectLike=wr,_e.isPlainObject=Eo,_e.isRegExp=Oc,_e.isSafeInteger=Qh,_e.isSet=ml,_e.isString=Kf,_e.isSymbol=mn,_e.isTypedArray=ca,_e.isUndefined=e0,_e.isWeakMap=t0,_e.isWeakSet=r0,_e.join=Ql,_e.kebabCase=V0,_e.last=An,_e.lastIndexOf=ed,_e.lowerCase=W0,_e.lowerFirst=j0,_e.lt=n0,_e.lte=i0,_e.max=Zp,_e.maxBy=Hp,_e.mean=zp,_e.meanBy=Vp,_e.min=Wp,_e.minBy=jp,_e.stubArray=qc,_e.stubFalse=Zc,_e.stubObject=Bp,_e.stubString=Rp,_e.stubTrue=kp,_e.multiply=Gp,_e.nth=td,_e.noConflict=Ep,_e.noop=Uc,_e.now=Vf,_e.pad=G0,_e.padEnd=K0,_e.padStart=J0,_e.parseInt=Y0,_e.random=U0,_e.reduce=ah,_e.reduceRight=oh,_e.repeat=X0,_e.replace=Q0,_e.result=C0,_e.round=Kp,_e.runInContext=Ue,_e.sample=uh,_e.size=ph,_e.snakeCase=ep,_e.some=mh,_e.sortedIndex=fd,_e.sortedIndexBy=ud,_e.sortedIndexOf=cd,_e.sortedLastIndex=ld,_e.sortedLastIndexBy=dd,_e.sortedLastIndexOf=hd,_e.startCase=rp,_e.startsWith=np,_e.subtract=Jp,_e.sum=Yp,_e.sumBy=Xp,_e.template=ip,_e.times=Pp,_e.toFinite=gi,_e.toInteger=Ut,_e.toLength=yl,_e.toLower=sp,_e.toNumber=Mn,_e.toSafeInteger=s0,_e.toString=fr,_e.toUpper=ap,_e.trim=op,_e.trimEnd=fp,_e.trimStart=up,_e.truncate=cp,_e.unescape=lp,_e.uniqueId=Np,_e.upperCase=dp,_e.upperFirst=Dc,_e.each=tl,_e.eachRight=rl,_e.first=Yc,Fc(_e,function(){var x={};return cn(_e,function(A,k){nr.call(_e.prototype,k)||(x[k]=A)}),x}(),{chain:!1}),_e.VERSION=v,Qr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(x){_e[x].placeholder=_e}),Qr(["drop","take"],function(x,A){Ht.prototype[x]=function(k){k=k===h?1:xr(Ut(k),0);var Y=this.__filtered__&&!A?new Ht(this):this.clone();return Y.__filtered__?Y.__takeCount__=Br(k,Y.__takeCount__):Y.__views__.push({size:Br(k,Q),type:x+(Y.__dir__<0?"Right":"")}),Y},Ht.prototype[x+"Right"]=function(k){return this.reverse()[x](k).reverse()}}),Qr(["filter","map","takeWhile"],function(x,A){var k=A+1,Y=k==O||k==X;Ht.prototype[x]=function(me){var Ee=this.clone();return Ee.__iteratees__.push({iteratee:Et(me,3),type:k}),Ee.__filtered__=Ee.__filtered__||Y,Ee}}),Qr(["head","last"],function(x,A){var k="take"+(A?"Right":"");Ht.prototype[x]=function(){return this[k](1).value()[0]}}),Qr(["initial","tail"],function(x,A){var k="drop"+(A?"":"Right");Ht.prototype[x]=function(){return this.__filtered__?new Ht(this):this[k](1)}}),Ht.prototype.compact=function(){return this.filter(an)},Ht.prototype.find=function(x){return this.filter(x).head()},Ht.prototype.findLast=function(x){return this.reverse().find(x)},Ht.prototype.invokeMap=Ot(function(x,A){return typeof x=="function"?new Ht(this):this.map(function(k){return Ji(k,x,A)})}),Ht.prototype.reject=function(x){return this.filter(jf(Et(x)))},Ht.prototype.slice=function(x,A){x=Ut(x);var k=this;return k.__filtered__&&(x>0||A<0)?new Ht(k):(x<0?k=k.takeRight(-x):x&&(k=k.drop(x)),A!==h&&(A=Ut(A),k=A<0?k.dropRight(-A):k.take(A-x)),k)},Ht.prototype.takeRightWhile=function(x){return this.reverse().takeWhile(x).reverse()},Ht.prototype.toArray=function(){return this.take(Q)},cn(Ht.prototype,function(x,A){var k=/^(?:filter|find|map|reject)|While$/.test(A),Y=/^(?:head|last)$/.test(A),me=_e[Y?"take"+(A=="last"?"Right":""):A],Ee=Y||/^find/.test(A);me&&(_e.prototype[A]=function(){var Te=this.__wrapped__,De=Y?[1]:arguments,Ze=Te instanceof Ht,Qe=De[0],et=Ze||Pt(Te),rt=function(jt){var Xt=me.apply(_e,Zn([jt],De));return Y&&at?Xt[0]:Xt};et&&k&&typeof Qe=="function"&&Qe.length!=1&&(Ze=et=!1);var at=this.__chain__,gt=!!this.__actions__.length,It=Ee&&!at,qt=Ze&&!gt;if(!Ee&&et){Te=qt?Te:new Ht(this);var Tt=x.apply(Te,De);return Tt.__actions__.push({func:Hf,args:[rt],thisArg:h}),new tn(Tt,at)}return It&&qt?x.apply(this,De):(Tt=this.thru(rt),It?Y?Tt.value()[0]:Tt.value():Tt)})}),Qr(["pop","push","shift","sort","splice","unshift"],function(x){var A=Is[x],k=/^(?:push|sort|unshift)$/.test(x)?"tap":"thru",Y=/^(?:pop|shift)$/.test(x);_e.prototype[x]=function(){var me=arguments;if(Y&&!this.__chain__){var Ee=this.value();return A.apply(Pt(Ee)?Ee:[],me)}return this[k](function(Te){return A.apply(Pt(Te)?Te:[],me)})}}),cn(Ht.prototype,function(x,A){var k=_e[A];if(k){var Y=k.name+"";nr.call(xi,Y)||(xi[Y]=[]),xi[Y].push({name:A,func:k})}}),xi[Yn(h,le).name]=[{name:"wrapper",func:h}],Ht.prototype.clone=Wu,Ht.prototype.reverse=ju,Ht.prototype.value=Gu,_e.prototype.at=Dd,_e.prototype.chain=Nd,_e.prototype.commit=Ld,_e.prototype.next=Fd,_e.prototype.plant=qd,_e.prototype.reverse=Zd,_e.prototype.toJSON=_e.prototype.valueOf=_e.prototype.value=Hd,_e.prototype.first=_e.prototype.head,Zi&&(_e.prototype[Zi]=Ud),_e},Fr=Tu();qn?((qn.exports=Fr)._=Fr,Es._=Fr):br._=Fr}).call(commonjsGlobal)}(lodash,lodash.exports);var lodashExports=lodash.exports;const _=getDefaultExportFromCjs$1(lodashExports),log$4=new Logger("sds:message");let Message$1=class{constructor(u,h,v,w,b,E,$,M){Ke(this,"messageId");Ke(this,"channelId");Ke(this,"senderId");Ke(this,"causalHistory");Ke(this,"lamportTimestamp");Ke(this,"bloomFilter");Ke(this,"content");Ke(this,"retrievalHint");this.messageId=u,this.channelId=h,this.senderId=v,this.causalHistory=w,this.lamportTimestamp=b,this.bloomFilter=E,this.content=$,this.retrievalHint=M}encode(){return SdsMessage.encode(this)}static decode(u){const{messageId:h,channelId:v,senderId:w,causalHistory:b,lamportTimestamp:E,bloomFilter:$,content:M}=SdsMessage.decode(u);if(testContentMessage({lamportTimestamp:E,content:M}))return new ContentMessage(h,v,w,b,E,$,M);if(testEphemeralMessage({lamportTimestamp:E,content:M}))return new EphemeralMessage(h,v,w,b,void 0,$,M);if(testSyncMessage({lamportTimestamp:E,content:M}))return new SyncMessage(h,v,w,b,E,$,void 0);log$4.error("message received was of unknown type",E,M)}};class SyncMessage extends Message$1{constructor(h,v,w,b,E,$,M,T){super(h,v,w,b,E,$,M,T);Ke(this,"messageId");Ke(this,"channelId");Ke(this,"senderId");Ke(this,"causalHistory");Ke(this,"lamportTimestamp");Ke(this,"bloomFilter");Ke(this,"content");Ke(this,"retrievalHint");this.messageId=h,this.channelId=v,this.senderId=w,this.causalHistory=b,this.lamportTimestamp=E,this.bloomFilter=$,this.content=M,this.retrievalHint=T}}function testSyncMessage(y){return"lamportTimestamp"in y&&typeof y.lamportTimestamp=="number"&&(y.content===void 0||y.content.length===0)}function isSyncMessage(y){return testSyncMessage(y)}class EphemeralMessage extends Message$1{constructor(h,v,w,b,E,$,M,T){if(!M||!M.length)throw Error("Ephemeral Message must have content");super(h,v,w,b,E,$,M,T);Ke(this,"messageId");Ke(this,"channelId");Ke(this,"senderId");Ke(this,"causalHistory");Ke(this,"lamportTimestamp");Ke(this,"bloomFilter");Ke(this,"content");Ke(this,"retrievalHint");this.messageId=h,this.channelId=v,this.senderId=w,this.causalHistory=b,this.lamportTimestamp=E,this.bloomFilter=$,this.content=M,this.retrievalHint=T}}function isEphemeralMessage(y){return testEphemeralMessage(y)}function testEphemeralMessage(y){return!!(y.lamportTimestamp===void 0&&"content"in y&&y.content&&y.content.length)}class ContentMessage extends Message$1{constructor(h,v,w,b,E,$,M,T){if(!M.length)throw Error("Content Message must have content");super(h,v,w,b,E,$,M,T);Ke(this,"messageId");Ke(this,"channelId");Ke(this,"senderId");Ke(this,"causalHistory");Ke(this,"lamportTimestamp");Ke(this,"bloomFilter");Ke(this,"content");Ke(this,"retrievalHint");this.messageId=h,this.channelId=v,this.senderId=w,this.causalHistory=b,this.lamportTimestamp=E,this.bloomFilter=$,this.content=M,this.retrievalHint=T}valueOf(){return`${this.lamportTimestamp.toString().padStart(16,"0")}_${this.messageId}`}}function isContentMessage(y){return testContentMessage(y)}function testContentMessage(y){return!!("lamportTimestamp"in y&&typeof y.lamportTimestamp=="number"&&y.content&&y.content.length)}class MemLocalHistory{constructor(){Ke(this,"items",[])}get length(){return this.items.length}push(...u){for(const v of u)this.validateMessage(v);const h=[...this.items,...u];return h.sort((v,w)=>v.valueOf().localeCompare(w.valueOf())),this.items=_.uniqBy(h,"messageId"),this.items.length}some(u,h){return this.items.some(u,h)}slice(u,h){return this.items.slice(u,h)}find(u,h){return this.items.find(u,h)}findIndex(u,h){return this.items.findIndex(u,h)}validateMessage(u){if(!isContentMessage(u))throw new Error("Message must have lamportTimestamp and content defined, sync and ephemeral messages cannot be stored")}}const DEFAULT_BLOOM_FILTER_OPTIONS={capacity:1e4,errorRate:.001},DEFAULT_CAUSAL_HISTORY_SIZE=200,DEFAULT_POSSIBLE_ACKS_THRESHOLD=2,log$3=new Logger("sds:message-channel");class MessageChannel extends TypedEventEmitter{constructor(h,v,w={},b=new MemLocalHistory){super();Ke(this,"channelId");Ke(this,"senderId");Ke(this,"lamportTimestamp");Ke(this,"filter");Ke(this,"outgoingBuffer");Ke(this,"possibleAcks");Ke(this,"incomingBuffer");Ke(this,"localHistory");Ke(this,"timeReceived");Ke(this,"causalHistorySize");Ke(this,"possibleAcksThreshold");Ke(this,"timeoutForLostMessagesMs");Ke(this,"tasks",[]);Ke(this,"handlers",{[Command.Send]:async h=>{await this._pushOutgoingMessage(h.payload,h.callback)},[Command.Receive]:async h=>{this._pushIncomingMessage(h.message)},[Command.SendEphemeral]:async h=>{await this._pushOutgoingEphemeralMessage(h.payload,h.callback)}});this.channelId=h,this.senderId=v,this.lamportTimestamp=Date.now(),this.filter=new DefaultBloomFilter(DEFAULT_BLOOM_FILTER_OPTIONS),this.outgoingBuffer=[],this.possibleAcks=new Map,this.incomingBuffer=[],this.localHistory=b,this.causalHistorySize=w.causalHistorySize??DEFAULT_CAUSAL_HISTORY_SIZE,this.possibleAcksThreshold=w.possibleAcksThreshold??DEFAULT_POSSIBLE_ACKS_THRESHOLD,this.timeReceived=new Map,this.timeoutForLostMessagesMs=w.timeoutForLostMessagesMs}static getMessageId(h){return bytesToHex$1(sha256$3(h))}async processTasks(){for(;this.tasks.length>0;){const h=this.tasks.shift();h&&await this.executeTask(h)}}pushOutgoingMessage(h,v){if(!h||!h.length)throw Error("Only messages with valid payloads are allowed");this.tasks.push({command:Command.Send,params:{payload:h,callback:v}})}async pushOutgoingEphemeralMessage(h,v){this.tasks.push({command:Command.SendEphemeral,params:{payload:h,callback:v}})}pushIncomingMessage(h,v){h.retrievalHint=v,this.tasks.push({command:Command.Receive,params:{message:h}})}sweepIncomingBuffer(){const{buffer:h,missing:v}=this.incomingBuffer.reduce(({buffer:w,missing:b},E)=>{log$3.info(this.senderId,"sweeping incoming buffer",E.messageId,E.causalHistory.map(M=>M.messageId));const $=E.causalHistory.filter(M=>!this.localHistory.some(({messageId:T})=>T===M.messageId));if($.length===0)return isContentMessage(E)&&this.deliverMessage(E)&&this.safeSendEvent(MessageChannelEvent.InMessageDelivered,{detail:E.messageId}),{buffer:w,missing:b};if(log$3.info(this.senderId,"message from incoming buffer",E.messageId,"is missing dependencies",$.map(({messageId:M,retrievalHint:T})=>({messageId:M,retrievalHint:T}))),this.timeoutForLostMessagesMs){const M=this.timeReceived.get(E.messageId);if(M&&Date.now()-M>this.timeoutForLostMessagesMs)return this.safeSendEvent(MessageChannelEvent.InMessageLost,{detail:Array.from($)}),{buffer:w,missing:b}}return $.forEach(M=>{b.add(M)}),{buffer:w.concat(E),missing:b}},{buffer:new Array,missing:new Set});return this.incomingBuffer=h,this.safeSendEvent(MessageChannelEvent.InMessageMissing,{detail:Array.from(v)}),Array.from(v)}sweepOutgoingBuffer(){return this.outgoingBuffer.reduce(({unacknowledged:h,possiblyAcknowledged:v},w)=>this.possibleAcks.has(w.messageId)?{unacknowledged:h,possiblyAcknowledged:v.concat(w)}:{unacknowledged:h.concat(w),possiblyAcknowledged:v},{unacknowledged:new Array,possiblyAcknowledged:new Array})}async pushOutgoingSyncMessage(h){this.lamportTimestamp++;const v=new SyncMessage(`sync-${Math.random().toString(36).substring(2)}`,this.channelId,this.senderId,this.localHistory.slice(-this.causalHistorySize).map(({messageId:w,retrievalHint:b})=>({messageId:w,retrievalHint:b})),this.lamportTimestamp,this.filter.toBytes(),void 0);if(h)try{return await h(v),log$3.info(this.senderId,"sync message sent",v.messageId),this.safeSendEvent(MessageChannelEvent.OutSyncSent,{detail:v}),!0}catch(w){throw log$3.error("Callback execution failed in pushOutgoingSyncMessage:",w),w}return!1}_pushIncomingMessage(h){if(h.channelId!==this.channelId){log$3.warn("dropping message on different channel",h.channelId);return}if(log$3.info(`${this.senderId} incoming message ${h.messageId}`,`retrieval hint: ${bytesToHex$1(h.retrievalHint??new Uint8Array)}`),h.content&&h.content.length>0&&this.timeReceived.has(h.messageId)){log$3.info(this.senderId,"dropping dupe incoming message",h.messageId);return}if(this.senderId===h.senderId){log$3.info(this.senderId,"ignoring own incoming message");return}if(isEphemeralMessage(h)){log$3.info(this.senderId,"delivering ephemeral message");return}if(!isSyncMessage(h)&&!isContentMessage(h)){log$3.error(this.senderId,"internal error, a message is neither sync nor ephemeral nor content, ignoring it",h);return}isSyncMessage(h)?this.safeSendEvent(MessageChannelEvent.InSyncReceived,{detail:h}):this.safeSendEvent(MessageChannelEvent.InMessageReceived,{detail:h}),this.reviewAckStatus(h),isContentMessage(h)&&this.filter.insert(h.messageId);const b=h.causalHistory.filter(E=>!this.localHistory.some(({messageId:$})=>$===E.messageId));b.length>0?(this.incomingBuffer.push(h),this.timeReceived.set(h.messageId,Date.now()),log$3.info(this.senderId,"new incoming message",h.messageId,"is missing dependencies",b.map(E=>E.messageId)),this.safeSendEvent(MessageChannelEvent.InMessageMissing,{detail:Array.from(b)})):isContentMessage(h)&&this.deliverMessage(h)&&this.safeSendEvent(MessageChannelEvent.InMessageDelivered,{detail:h.messageId})}async executeTask(h){try{const v=this.handlers[h.command];await v(h.params)}catch(v){log$3.error(`Task execution failed for command ${h.command}:`,v),this.dispatchEvent(new CustomEvent("taskError",{detail:{command:h.command,error:v,params:h.params}})),this.safeSendEvent(MessageChannelEvent.ErrorTask,{detail:{command:h.command,error:v,params:h.params}})}}safeSendEvent(h,v){try{this.dispatchEvent(new CustomEvent(h,v))}catch(w){log$3.error(`Failed to dispatch event ${h}:`,w)}}async _pushOutgoingMessage(h,v){this.lamportTimestamp++;const w=MessageChannel.getMessageId(h);let b=this.outgoingBuffer.find(E=>E.messageId===w);if(b?log$3.info(this.senderId,"resending message",w):(log$3.info(this.senderId,"sending new message",w),b=new ContentMessage(w,this.channelId,this.senderId,this.localHistory.slice(-this.causalHistorySize).map(({messageId:E,retrievalHint:$})=>({messageId:E,retrievalHint:$})),this.lamportTimestamp,this.filter.toBytes(),h),this.outgoingBuffer.push(b)),v)try{const{success:E,retrievalHint:$}=await v(b);E&&isContentMessage(b)&&(b.retrievalHint=$,this.filter.insert(w),this.localHistory.push(b),this.timeReceived.set(w,Date.now()),this.safeSendEvent(MessageChannelEvent.OutMessageSent,{detail:b}))}catch(E){throw log$3.error("Callback execution failed in _pushOutgoingMessage:",E),E}}async _pushOutgoingEphemeralMessage(h,v){const w=new EphemeralMessage(MessageChannel.getMessageId(h),this.channelId,this.senderId,[],void 0,void 0,h);if(v)try{await v(w)}catch(b){throw log$3.error("Callback execution failed in _pushOutgoingEphemeralMessage:",b),b}}deliverMessage(h){return isContentMessage(h)?(log$3.info(this.senderId,"delivering message",h.messageId,h.retrievalHint),h.lamportTimestamp>this.lamportTimestamp&&(this.lamportTimestamp=h.lamportTimestamp),this.localHistory.find(({messageId:w})=>w===h.messageId)||(h.retrievalHint||log$3.warn("message delivered without a retrieval hint",h.messageId),this.localHistory.push(h)),!0):!1}reviewAckStatus(h){if(log$3.info(this.senderId,"reviewing ack status using causal history:",h.causalHistory.map(w=>w.messageId)),log$3.info(this.senderId,"current outgoing buffer:",this.outgoingBuffer.map(w=>w.messageId)),h.causalHistory.forEach(({messageId:w})=>{this.outgoingBuffer=this.outgoingBuffer.filter(({messageId:b})=>b!==w?!0:(log$3.info(this.senderId,"message acknowledged",w),this.safeSendEvent(MessageChannelEvent.OutMessageAcknowledged,{detail:w}),!1))}),!h.bloomFilter)return;const v=DefaultBloomFilter.fromBytes(h.bloomFilter,this.filter.options);this.outgoingBuffer=this.outgoingBuffer.filter(w=>{if(!v.lookup(w.messageId))return!0;const b=(this.possibleAcks.get(w.messageId)??0)+1;return b<this.possibleAcksThreshold?(this.possibleAcks.set(w.messageId,b),log$3.info(this.senderId,"message possibly acknowledged",w.messageId,b),this.safeSendEvent(MessageChannelEvent.OutMessagePossiblyAcknowledged,{detail:{messageId:w.messageId,count:b}}),!0):(this.possibleAcks.delete(w.messageId),log$3.info(this.senderId,"message acknowledged",w.messageId,b),this.safeSendEvent(MessageChannelEvent.OutMessageAcknowledged,{detail:w.messageId}),!1)})}}const log$2=new Logger("sdk:query-on-connect"),DEFAULT_FORCE_QUERY_THRESHOLD_MS=5*60*1e3,MAX_TIME_RANGE_QUERY_MS=30*24*60*60*1e3;var QueryOnConnectEvent;(function(y){y.MessagesRetrieved="messages:retrieved"})(QueryOnConnectEvent||(QueryOnConnectEvent={}));class QueryOnConnect extends TypedEventEmitter{constructor(h,v,w,b,E,$){super();Ke(this,"decoders");Ke(this,"stopIfTrue");Ke(this,"peerManagerEventEmitter");Ke(this,"wakuEventEmitter");Ke(this,"_queryGenerator");Ke(this,"lastSuccessfulQuery");Ke(this,"lastTimeOffline");Ke(this,"forceQueryThresholdMs");this.decoders=h,this.stopIfTrue=v,this.peerManagerEventEmitter=w,this.wakuEventEmitter=b,this._queryGenerator=E,this.lastSuccessfulQuery=0,this.lastTimeOffline=0,this.forceQueryThresholdMs=($==null?void 0:$.forceQueryThresholdMs)??DEFAULT_FORCE_QUERY_THRESHOLD_MS}start(){log$2.info("starting query-on-connect service"),this.setupEventListeners()}stop(){this.unsetEventListeners()}async maybeQuery(h){const v=Date.now()-this.lastSuccessfulQuery;log$2.info(`maybe do store query to ${h.toString()}`,this.lastSuccessfulQuery,this.lastTimeOffline,v,this.forceQueryThresholdMs),this.lastSuccessfulQuery===0||this.lastTimeOffline>this.lastSuccessfulQuery||v>this.forceQueryThresholdMs?await this.query(h):log$2.info("no querying")}async query(h){log$2.info(`perform store query to ${h.toString()}`);const{timeStart:v,timeEnd:w}=this.queryTimeRange();try{for await(const b of this._queryGenerator(this.decoders,{timeStart:v,timeEnd:w,peerId:h})){const E=(await Promise.all(b)).filter(M=>M!==void 0),$=E.some(M=>this.stopIfTrue(M));if(this.dispatchMessages(E),$)break}this.lastSuccessfulQuery=Date.now()}catch(b){log$2.warn(`store query to ${h.toString()} failed`,b)}}queryTimeRange(){return calculateTimeRange(Date.now(),this.lastSuccessfulQuery,MAX_TIME_RANGE_QUERY_MS)}dispatchMessages(h){log$2.info("dispatching messages",h.map(v=>v.hashStr)),this.dispatchEvent(new CustomEvent(QueryOnConnectEvent.MessagesRetrieved,{detail:h}))}setupEventListeners(){this.peerManagerEventEmitter.addEventListener(PeerManagerEventNames.StoreConnect,h=>void this.maybeQuery(h.detail).catch(v=>log$2.error("query-on-connect error",v))),this.wakuEventEmitter.addEventListener(WakuEvent.Health,this.updateLastOfflineDate.bind(this))}unsetEventListeners(){this.peerManagerEventEmitter.removeEventListener(PeerManagerEventNames.StoreConnect,h=>void this.maybeQuery(h.detail).catch(v=>log$2.error("query-on-connect error",v))),this.wakuEventEmitter.removeEventListener(WakuEvent.Health,this.updateLastOfflineDate.bind(this))}updateLastOfflineDate(h){h.detail===HealthStatus.Unhealthy&&(this.lastTimeOffline=Date.now())}}function calculateTimeRange(y,u,h){const v=Math.min(y-u,h),w=new Date(y-v),b=new Date(y);return{timeStart:w,timeEnd:b}}const log$1=new Logger("sdk:missing-message-retriever"),DEFAULT_RETRIEVE_FREQUENCY_MS=10*1e3;class MissingMessageRetriever{constructor(u,h=DEFAULT_RETRIEVE_FREQUENCY_MS,v,w){Ke(this,"decoder");Ke(this,"retrieveFrequencyMs");Ke(this,"_retrieve");Ke(this,"onMessageRetrieved");Ke(this,"retrieveInterval");Ke(this,"missingMessages");this.decoder=u,this.retrieveFrequencyMs=h,this._retrieve=v,this.onMessageRetrieved=w,this.missingMessages=new Map}start(){this.retrieveInterval&&(clearInterval(this.retrieveInterval),this.retrieveInterval=void 0),this.retrieveFrequencyMs!==0&&(log$1.info(`start retrieve loop every ${this.retrieveFrequencyMs}ms`),this.retrieveInterval=setInterval(()=>{this.retrieveMissingMessage()},this.retrieveFrequencyMs))}stop(){this.retrieveInterval&&(clearInterval(this.retrieveInterval),this.retrieveInterval=void 0),this.missingMessages.clear()}addMissingMessage(u,h){this.missingMessages.has(u)||(log$1.info("missing message notice",u,h),this.missingMessages.set(u,h))}removeMissingMessage(u){this.missingMessages.has(u)&&this.missingMessages.delete(u)}async retrieveMissingMessage(){if(this.missingMessages.size){const u=Array.from(this.missingMessages.values());log$1.info("attempting to retrieve missing message",u.length);for await(const h of this._retrieve([this.decoder],{messageHashes:u}))for await(const v of h)v&&this.onMessageRetrieved&&await this.onMessageRetrieved(v)}}}class RetryManager{constructor(u,h){Ke(this,"retryIntervalMs");Ke(this,"maxRetryNumber");Ke(this,"timeouts");if(this.retryIntervalMs=u,this.maxRetryNumber=h,this.timeouts=new Map,!u||u<=0||!h||h<=0)throw Error(`Invalid retryIntervalMs ${u} or maxRetryNumber ${h} values`)}stopRetries(u){const h=this.timeouts.get(u);h&&(clearTimeout(h),this.timeouts.delete(u))}stopAllRetries(){for(const[u,h]of this.timeouts.entries())clearTimeout(h);this.timeouts.clear()}startRetries(u,h){this.retry(u,h,0)}retry(u,h,v){if(this.stopRetries(u),v<this.maxRetryNumber){const w=setTimeout(()=>{h(),this.retry(u,h,++v)},this.retryIntervalMs);this.timeouts.set(u,w)}}}const log=new Logger("sdk:reliable-channel"),DEFAULT_SYNC_MIN_INTERVAL_MS=30*1e3,DEFAULT_RETRY_INTERVAL_MS=30*1e3,DEFAULT_MAX_RETRY_ATTEMPTS=10,DEFAULT_SWEEP_IN_BUF_INTERVAL_MS=5*1e3,DEFAULT_PROCESS_TASK_MIN_ELAPSE_MS=1e3,IRRECOVERABLE_SENDING_ERRORS=[LightPushError.ENCODE_FAILED,LightPushError.EMPTY_PAYLOAD,LightPushError.SIZE_TOO_BIG,LightPushError.RLN_PROOF_GENERATION];class ReliableChannel extends TypedEventEmitter{constructor(h,v,w,b,E){var T;super();Ke(this,"node");Ke(this,"messageChannel");Ke(this,"encoder");Ke(this,"decoder");Ke(this,"_send");Ke(this,"_subscribe");Ke(this,"_unsubscribe");Ke(this,"_retrieve");Ke(this,"eventListenerCleanups",[]);Ke(this,"syncMinIntervalMs");Ke(this,"syncTimeout");Ke(this,"sweepInBufInterval");Ke(this,"sweepInBufIntervalMs");Ke(this,"processTaskTimeout");Ke(this,"retryManager");Ke(this,"missingMessageRetriever");Ke(this,"queryOnConnect");Ke(this,"processTaskMinElapseMs");Ke(this,"_started");if(this.node=h,this.messageChannel=v,this.encoder=w,this.decoder=b,h.lightPush)this._send=h.lightPush.send.bind(h.lightPush);else if(h.relay)this._send=h.relay.send.bind(h.relay);else throw"No protocol available to send messages";if(h.filter)this._subscribe=h.filter.subscribe.bind(h.filter),this._unsubscribe=h.filter.unsubscribe.bind(h.filter);else throw h.relay?"Not implemented":"No protocol available to receive messages";if(h.store){this._retrieve=h.store.queryGenerator.bind(h.store);const C=(T=h==null?void 0:h.peerManager)==null?void 0:T.events;C!==void 0&&((E==null?void 0:E.queryOnConnect)??!0)&&(this.queryOnConnect=new QueryOnConnect([this.decoder],this.isChannelMessageWithCausalHistory.bind(this),C,h.events,this._retrieve.bind(this)))}this.syncMinIntervalMs=(E==null?void 0:E.syncMinIntervalMs)??DEFAULT_SYNC_MIN_INTERVAL_MS,this.sweepInBufIntervalMs=(E==null?void 0:E.sweepInBufIntervalMs)??DEFAULT_SWEEP_IN_BUF_INTERVAL_MS;const $=(E==null?void 0:E.retryIntervalMs)??DEFAULT_RETRY_INTERVAL_MS,M=(E==null?void 0:E.maxRetryAttempts)??DEFAULT_MAX_RETRY_ATTEMPTS;$&&M&&(this.retryManager=new RetryManager($,M)),this.processTaskMinElapseMs=(E==null?void 0:E.processTaskMinElapseMs)??DEFAULT_PROCESS_TASK_MIN_ELAPSE_MS,this._retrieve&&(this.missingMessageRetriever=new MissingMessageRetriever(this.decoder,E==null?void 0:E.retrieveFrequencyMs,this._retrieve,async C=>{await this.processIncomingMessage(C)})),this._started=!1}get isStarted(){return this._started}static getMessageId(h){return MessageChannel.getMessageId(h)}static async create(h,v,w,b,E,$){const M=new MessageChannel(v,w,$),T=new ReliableChannel(h,M,b,E,$);return(($==null?void 0:$.autoStart)??!0)&&await T.start(),T}send(h){var b;const v=ReliableChannel.getMessageId(h);this._started||this.safeSendEvent("sending-message-irrecoverable-error",{detail:{messageId:v,error:"channel is not started"}});const w=this._wrapAndSend.bind(this,h);return(b=this.retryManager)==null||b.startRetries(v,w),w(),v}_wrapAndSend(h){this.messageChannel.pushOutgoingMessage(h,async v=>{const b={payload:v.encode()},E=ReliableChannel.getMessageId(h),$=await this.encoder.toProtoObj(b);if(!$)return this.safeSendEvent("sending-message-irrecoverable-error",{detail:{messageId:E,error:"could not encode message"}}),{success:!1};const M=messageHash(this.encoder.pubsubTopic,$);this.safeSendEvent("sending-message",{detail:E});const T=await this._send(this.encoder,b);for(const{error:C}of T.failures)if(IRRECOVERABLE_SENDING_ERRORS.includes(C))return log.error("Irrecoverable error, cannot send message: ",C),this.safeSendEvent("sending-message-irrecoverable-error",{detail:{messageId:E,error:C}}),{success:!1,retrievalHint:M};return{success:!0,retrievalHint:M}}),this.messageChannel.processTasks().then(()=>{this.messageChannel.sweepOutgoingBuffer()}).catch(v=>{log.error("error encountered when processing sds tasks",v)})}async subscribe(){return this.assertStarted(),this._subscribe(this.decoder,async h=>{await this.processIncomingMessage(h)})}async unsubscribe(){if(!this._unsubscribe)throw Error("No unsubscribe method available");return await this._unsubscribe(this.decoder)}async processIncomingMessage(h){var b;const v=Message$1.decode(h.payload);if(!v){log.error("could not SDS decode message",h);return}if(v.channelId!==this.messageChannel.channelId){log.warn("ignoring message with different channel id",v.channelId);return}const w=h.hash;if(log.info(`processing message ${v.messageId}:${h.hashStr}`),this.messageChannel.pushIncomingMessage(v,w),(b=this.missingMessageRetriever)==null||b.removeMissingMessage(v.messageId),v.content&&v.content.length>0){const{payload:E,...$}=h,M=Object.assign($,{payload:v.content,hash:h.hash,hashStr:h.hashStr,version:h.version,contentTopic:h.contentTopic,pubsubTopic:h.pubsubTopic,timestamp:h.timestamp,rateLimitProof:h.rateLimitProof,ephemeral:h.ephemeral,meta:h.meta});this.safeSendEvent("message-received",{detail:M})}this.queueProcessTasks()}async processIncomingMessages(h){for(const v of h)await this.processIncomingMessage(v)}queueProcessTasks(){this.processTaskTimeout===void 0&&(this.processTaskTimeout=setTimeout(()=>{this.messageChannel.processTasks().catch(h=>{log.error("error encountered when processing sds tasks",h)}),clearTimeout(this.processTaskTimeout),this.processTaskTimeout=void 0},this.processTaskMinElapseMs))}async start(){var h,v;return this._started?!0:(this._started=!0,this.setupEventListeners(),this.restartSync(),this.startSweepIncomingBufferLoop(),this._retrieve&&((h=this.missingMessageRetriever)==null||h.start(),(v=this.queryOnConnect)==null||v.start()),this.subscribe())}async stop(){var h,v,w;this._started&&(this._started=!1,this.stopSync(),this.stopSweepIncomingBufferLoop(),this.processTaskTimeout&&(clearTimeout(this.processTaskTimeout),this.processTaskTimeout=void 0),(h=this.missingMessageRetriever)==null||h.stop(),(v=this.queryOnConnect)==null||v.stop(),(w=this.retryManager)==null||w.stopAllRetries(),await this.unsubscribe(),this.removeAllEventListeners())}assertStarted(){if(!this._started)throw Error("Message Channel must be started")}startSweepIncomingBufferLoop(){this.stopSweepIncomingBufferLoop(),this.sweepInBufInterval=setInterval(()=>{log.info("sweep incoming buffer"),this.messageChannel.sweepIncomingBuffer()},this.sweepInBufIntervalMs)}stopSweepIncomingBufferLoop(){this.sweepInBufInterval&&(clearInterval(this.sweepInBufInterval),this.sweepInBufInterval=void 0)}restartSync(h=1){if(this.syncTimeout&&(clearTimeout(this.syncTimeout),this.syncTimeout=void 0),this.syncMinIntervalMs){const v=this.random()*this.syncMinIntervalMs*h;this.syncTimeout=setTimeout(()=>{this.sendSyncMessage(),this.restartSync(2)},v)}}stopSync(){this.syncTimeout&&(clearTimeout(this.syncTimeout),this.syncTimeout=void 0)}random(){return Math.random()}safeSendEvent(h,v){try{this.dispatchEvent(new CustomEvent(h,v))}catch(w){log.error(`Failed to dispatch event ${h}:`,w)}}async sendSyncMessage(){this.assertStarted(),await this.messageChannel.pushOutgoingSyncMessage(async h=>{const w={payload:h.encode()},b=await this._send(this.encoder,w);return b.failures.length>0?(log.error("Error sending sync message: ",b),!1):!0}),await this.messageChannel.processTasks(),this.messageChannel.sweepOutgoingBuffer()}isChannelMessageWithCausalHistory(h){const v=Message$1.decode(h.payload);return!v||v.channelId!==this.messageChannel.channelId?!1:v.causalHistory&&v.causalHistory.length>0}addTrackedEventListener(h,v){this.messageChannel.addEventListener(h,v),this.eventListenerCleanups.push(()=>{this.messageChannel.removeEventListener(h,v)})}setupEventListeners(){if(this.addTrackedEventListener(MessageChannelEvent.OutMessageSent,h=>{if(h.detail.content){const v=ReliableChannel.getMessageId(h.detail.content);this.safeSendEvent("message-sent",{detail:v})}}),this.addTrackedEventListener(MessageChannelEvent.OutMessageAcknowledged,h=>{var v;h.detail&&(this.safeSendEvent("message-acknowledged",{detail:h.detail}),(v=this.retryManager)==null||v.stopRetries(h.detail))}),this.addTrackedEventListener(MessageChannelEvent.OutMessagePossiblyAcknowledged,h=>{h.detail&&this.safeSendEvent("message-possibly-acknowledged",{detail:{messageId:h.detail.messageId,possibleAckCount:h.detail.count}})}),this.addTrackedEventListener(MessageChannelEvent.InSyncReceived,h=>{this.restartSync()}),this.addTrackedEventListener(MessageChannelEvent.InMessageReceived,h=>{isContentMessage(h.detail)&&this.restartSync(.5)}),this.addTrackedEventListener(MessageChannelEvent.OutMessageSent,h=>{isContentMessage(h.detail)&&this.restartSync()}),this.addTrackedEventListener(MessageChannelEvent.InMessageMissing,h=>{for(const{messageId:v,retrievalHint:w}of h.detail)w&&this.missingMessageRetriever&&this.missingMessageRetriever.addMissingMessage(v,w)}),this.queryOnConnect){const h=v=>{this.processIncomingMessages(v.detail)};this.queryOnConnect.addEventListener(QueryOnConnectEvent.MessagesRetrieved,h),this.eventListenerCleanups.push(()=>{var v;(v=this.queryOnConnect)==null||v.removeEventListener(QueryOnConnectEvent.MessagesRetrieved,h)})}}removeAllEventListeners(){for(const h of this.eventListenerCleanups)try{h()}catch(v){log.error("error removing event listener:",v)}this.eventListenerCleanups=[]}}var src={exports:{}},indexLight={exports:{}},indexMinimal={},minimal={},aspromise=asPromise$1;function asPromise$1(y,u){for(var h=new Array(arguments.length-1),v=0,w=2,b=!0;w<arguments.length;)h[v++]=arguments[w++];return new Promise(function($,M){h[v]=function(C){if(b)if(b=!1,C)M(C);else{for(var B=new Array(arguments.length-1),N=0;N<B.length;)B[N++]=arguments[N];$.apply(null,B)}};try{y.apply(u||null,h)}catch(T){b&&(b=!1,M(T))}})}var base64$1={};(function(y){var u=y;u.length=function($){var M=$.length;if(!M)return 0;for(var T=0;--M%4>1&&$.charAt(M)==="=";)++T;return Math.ceil($.length*3)/4-T};for(var h=new Array(64),v=new Array(123),w=0;w<64;)v[h[w]=w<26?w+65:w<52?w+71:w<62?w-4:w-59|43]=w++;u.encode=function($,M,T){for(var C=null,B=[],N=0,H=0,te;M<T;){var fe=$[M++];switch(H){case 0:B[N++]=h[fe>>2],te=(fe&3)<<4,H=1;break;case 1:B[N++]=h[te|fe>>4],te=(fe&15)<<2,H=2;break;case 2:B[N++]=h[te|fe>>6],B[N++]=h[fe&63],H=0;break}N>8191&&((C||(C=[])).push(String.fromCharCode.apply(String,B)),N=0)}return H&&(B[N++]=h[te],B[N++]=61,H===1&&(B[N++]=61)),C?(N&&C.push(String.fromCharCode.apply(String,B.slice(0,N))),C.join("")):String.fromCharCode.apply(String,B.slice(0,N))};var b="invalid encoding";u.decode=function($,M,T){for(var C=T,B=0,N,H=0;H<$.length;){var te=$.charCodeAt(H++);if(te===61&&B>1)break;if((te=v[te])===void 0)throw Error(b);switch(B){case 0:N=te,B=1;break;case 1:M[T++]=N<<2|(te&48)>>4,N=te,B=2;break;case 2:M[T++]=(N&15)<<4|(te&60)>>2,N=te,B=3;break;case 3:M[T++]=(N&3)<<6|te,B=0;break}}if(B===1)throw Error(b);return T-C},u.test=function($){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test($)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function y(u,h,v){return(this._listeners[u]||(this._listeners[u]=[])).push({fn:h,ctx:v||this}),this},EventEmitter.prototype.off=function y(u,h){if(u===void 0)this._listeners={};else if(h===void 0)this._listeners[u]=[];else for(var v=this._listeners[u],w=0;w<v.length;)v[w].fn===h?v.splice(w,1):++w;return this},EventEmitter.prototype.emit=function y(u){var h=this._listeners[u];if(h){for(var v=[],w=1;w<arguments.length;)v.push(arguments[w++]);for(w=0;w<h.length;)h[w].fn.apply(h[w++].ctx,v)}return this};var float=factory(factory);function factory(y){return typeof Float32Array<"u"?function(){var u=new Float32Array([-0]),h=new Uint8Array(u.buffer),v=h[3]===128;function w(M,T,C){u[0]=M,T[C]=h[0],T[C+1]=h[1],T[C+2]=h[2],T[C+3]=h[3]}function b(M,T,C){u[0]=M,T[C]=h[3],T[C+1]=h[2],T[C+2]=h[1],T[C+3]=h[0]}y.writeFloatLE=v?w:b,y.writeFloatBE=v?b:w;function E(M,T){return h[0]=M[T],h[1]=M[T+1],h[2]=M[T+2],h[3]=M[T+3],u[0]}function $(M,T){return h[3]=M[T],h[2]=M[T+1],h[1]=M[T+2],h[0]=M[T+3],u[0]}y.readFloatLE=v?E:$,y.readFloatBE=v?$:E}():function(){function u(v,w,b,E){var $=w<0?1:0;if($&&(w=-w),w===0)v(1/w>0?0:2147483648,b,E);else if(isNaN(w))v(2143289344,b,E);else if(w>34028234663852886e22)v(($<<31|2139095040)>>>0,b,E);else if(w<11754943508222875e-54)v(($<<31|Math.round(w/1401298464324817e-60))>>>0,b,E);else{var M=Math.floor(Math.log(w)/Math.LN2),T=Math.round(w*Math.pow(2,-M)*8388608)&8388607;v(($<<31|M+127<<23|T)>>>0,b,E)}}y.writeFloatLE=u.bind(null,writeUintLE),y.writeFloatBE=u.bind(null,writeUintBE);function h(v,w,b){var E=v(w,b),$=(E>>31)*2+1,M=E>>>23&255,T=E&8388607;return M===255?T?NaN:$*(1/0):M===0?$*1401298464324817e-60*T:$*Math.pow(2,M-150)*(T+8388608)}y.readFloatLE=h.bind(null,readUintLE),y.readFloatBE=h.bind(null,readUintBE)}(),typeof Float64Array<"u"?function(){var u=new Float64Array([-0]),h=new Uint8Array(u.buffer),v=h[7]===128;function w(M,T,C){u[0]=M,T[C]=h[0],T[C+1]=h[1],T[C+2]=h[2],T[C+3]=h[3],T[C+4]=h[4],T[C+5]=h[5],T[C+6]=h[6],T[C+7]=h[7]}function b(M,T,C){u[0]=M,T[C]=h[7],T[C+1]=h[6],T[C+2]=h[5],T[C+3]=h[4],T[C+4]=h[3],T[C+5]=h[2],T[C+6]=h[1],T[C+7]=h[0]}y.writeDoubleLE=v?w:b,y.writeDoubleBE=v?b:w;function E(M,T){return h[0]=M[T],h[1]=M[T+1],h[2]=M[T+2],h[3]=M[T+3],h[4]=M[T+4],h[5]=M[T+5],h[6]=M[T+6],h[7]=M[T+7],u[0]}function $(M,T){return h[7]=M[T],h[6]=M[T+1],h[5]=M[T+2],h[4]=M[T+3],h[3]=M[T+4],h[2]=M[T+5],h[1]=M[T+6],h[0]=M[T+7],u[0]}y.readDoubleLE=v?E:$,y.readDoubleBE=v?$:E}():function(){function u(v,w,b,E,$,M){var T=E<0?1:0;if(T&&(E=-E),E===0)v(0,$,M+w),v(1/E>0?0:2147483648,$,M+b);else if(isNaN(E))v(0,$,M+w),v(2146959360,$,M+b);else if(E>17976931348623157e292)v(0,$,M+w),v((T<<31|2146435072)>>>0,$,M+b);else{var C;if(E<22250738585072014e-324)C=E/5e-324,v(C>>>0,$,M+w),v((T<<31|C/4294967296)>>>0,$,M+b);else{var B=Math.floor(Math.log(E)/Math.LN2);B===1024&&(B=1023),C=E*Math.pow(2,-B),v(C*4503599627370496>>>0,$,M+w),v((T<<31|B+1023<<20|C*1048576&1048575)>>>0,$,M+b)}}}y.writeDoubleLE=u.bind(null,writeUintLE,0,4),y.writeDoubleBE=u.bind(null,writeUintBE,4,0);function h(v,w,b,E,$){var M=v(E,$+w),T=v(E,$+b),C=(T>>31)*2+1,B=T>>>20&2047,N=4294967296*(T&1048575)+M;return B===2047?N?NaN:C*(1/0):B===0?C*5e-324*N:C*Math.pow(2,B-1075)*(N+4503599627370496)}y.readDoubleLE=h.bind(null,readUintLE,0,4),y.readDoubleBE=h.bind(null,readUintBE,4,0)}(),y}function writeUintLE(y,u,h){u[h]=y&255,u[h+1]=y>>>8&255,u[h+2]=y>>>16&255,u[h+3]=y>>>24}function writeUintBE(y,u,h){u[h]=y>>>24,u[h+1]=y>>>16&255,u[h+2]=y>>>8&255,u[h+3]=y&255}function readUintLE(y,u){return(y[u]|y[u+1]<<8|y[u+2]<<16|y[u+3]<<24)>>>0}function readUintBE(y,u){return(y[u]<<24|y[u+1]<<16|y[u+2]<<8|y[u+3])>>>0}var inquire_1=inquire$1;function inquire$1(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(y){}return null}var utf8$2={};(function(y){var u=y;u.length=function(v){for(var w=0,b=0,E=0;E<v.length;++E)b=v.charCodeAt(E),b<128?w+=1:b<2048?w+=2:(b&64512)===55296&&(v.charCodeAt(E+1)&64512)===56320?(++E,w+=4):w+=3;return w},u.read=function(v,w,b){var E=b-w;if(E<1)return"";for(var $=null,M=[],T=0,C;w<b;)C=v[w++],C<128?M[T++]=C:C>191&&C<224?M[T++]=(C&31)<<6|v[w++]&63:C>239&&C<365?(C=((C&7)<<18|(v[w++]&63)<<12|(v[w++]&63)<<6|v[w++]&63)-65536,M[T++]=55296+(C>>10),M[T++]=56320+(C&1023)):M[T++]=(C&15)<<12|(v[w++]&63)<<6|v[w++]&63,T>8191&&(($||($=[])).push(String.fromCharCode.apply(String,M)),T=0);return $?(T&&$.push(String.fromCharCode.apply(String,M.slice(0,T))),$.join("")):String.fromCharCode.apply(String,M.slice(0,T))},u.write=function(v,w,b){for(var E=b,$,M,T=0;T<v.length;++T)$=v.charCodeAt(T),$<128?w[b++]=$:$<2048?(w[b++]=$>>6|192,w[b++]=$&63|128):($&64512)===55296&&((M=v.charCodeAt(T+1))&64512)===56320?($=65536+(($&1023)<<10)+(M&1023),++T,w[b++]=$>>18|240,w[b++]=$>>12&63|128,w[b++]=$>>6&63|128,w[b++]=$&63|128):(w[b++]=$>>12|224,w[b++]=$>>6&63|128,w[b++]=$&63|128);return b-E}})(utf8$2);var pool_1=pool;function pool(y,u,h){var v=h||8192,w=v>>>1,b=null,E=v;return function(M){if(M<1||M>w)return y(M);E+M>v&&(b=y(v),E=0);var T=u.call(b,E,E+=M);return E&7&&(E=(E|7)+1),T}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=u;var y=requireMinimal();function u(b,E){this.lo=b>>>0,this.hi=E>>>0}var h=u.zero=new u(0,0);h.toNumber=function(){return 0},h.zzEncode=h.zzDecode=function(){return this},h.length=function(){return 1};var v=u.zeroHash="\0\0\0\0\0\0\0\0";u.fromNumber=function(E){if(E===0)return h;var $=E<0;$&&(E=-E);var M=E>>>0,T=(E-M)/4294967296>>>0;return $&&(T=~T>>>0,M=~M>>>0,++M>4294967295&&(M=0,++T>4294967295&&(T=0))),new u(M,T)},u.from=function(E){if(typeof E=="number")return u.fromNumber(E);if(y.isString(E))if(y.Long)E=y.Long.fromString(E);else return u.fromNumber(parseInt(E,10));return E.low||E.high?new u(E.low>>>0,E.high>>>0):h},u.prototype.toNumber=function(E){if(!E&&this.hi>>>31){var $=~this.lo+1>>>0,M=~this.hi>>>0;return $||(M=M+1>>>0),-($+M*4294967296)}return this.lo+this.hi*4294967296},u.prototype.toLong=function(E){return y.Long?new y.Long(this.lo|0,this.hi|0,!!E):{low:this.lo|0,high:this.hi|0,unsigned:!!E}};var w=String.prototype.charCodeAt;return u.fromHash=function(E){return E===v?h:new u((w.call(E,0)|w.call(E,1)<<8|w.call(E,2)<<16|w.call(E,3)<<24)>>>0,(w.call(E,4)|w.call(E,5)<<8|w.call(E,6)<<16|w.call(E,7)<<24)>>>0)},u.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},u.prototype.zzEncode=function(){var E=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^E)>>>0,this.lo=(this.lo<<1^E)>>>0,this},u.prototype.zzDecode=function(){var E=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^E)>>>0,this.hi=(this.hi>>>1^E)>>>0,this},u.prototype.length=function(){var E=this.lo,$=(this.lo>>>28|this.hi<<4)>>>0,M=this.hi>>>24;return M===0?$===0?E<16384?E<128?1:2:E<2097152?3:4:$<16384?$<128?5:6:$<2097152?7:8:M<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(y){var u=y;u.asPromise=aspromise,u.base64=base64$1,u.EventEmitter=eventemitter,u.float=float,u.inquire=inquire_1,u.utf8=utf8$2,u.pool=pool_1,u.LongBits=requireLongbits(),u.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),u.global=u.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||commonjsGlobal,u.emptyArray=Object.freeze?Object.freeze([]):[],u.emptyObject=Object.freeze?Object.freeze({}):{},u.isInteger=Number.isInteger||function(b){return typeof b=="number"&&isFinite(b)&&Math.floor(b)===b},u.isString=function(b){return typeof b=="string"||b instanceof String},u.isObject=function(b){return b&&typeof b=="object"},u.isset=u.isSet=function(b,E){var $=b[E];return $!=null&&b.hasOwnProperty(E)?typeof $!="object"||(Array.isArray($)?$.length:Object.keys($).length)>0:!1},u.Buffer=function(){try{var w=u.inquire("buffer").Buffer;return w.prototype.utf8Write?w:null}catch{return null}}(),u._Buffer_from=null,u._Buffer_allocUnsafe=null,u.newBuffer=function(b){return typeof b=="number"?u.Buffer?u._Buffer_allocUnsafe(b):new u.Array(b):u.Buffer?u._Buffer_from(b):typeof Uint8Array>"u"?b:new Uint8Array(b)},u.Array=typeof Uint8Array<"u"?Uint8Array:Array,u.Long=u.global.dcodeIO&&u.global.dcodeIO.Long||u.global.Long||u.inquire("long"),u.key2Re=/^true|false|0|1$/,u.key32Re=/^-?(?:0|[1-9][0-9]*)$/,u.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,u.longToHash=function(b){return b?u.LongBits.from(b).toHash():u.LongBits.zeroHash},u.longFromHash=function(b,E){var $=u.LongBits.fromHash(b);return u.Long?u.Long.fromBits($.lo,$.hi,E):$.toNumber(!!E)};function h(w,b,E){for(var $=Object.keys(b),M=0;M<$.length;++M)(w[$[M]]===void 0||!E)&&(w[$[M]]=b[$[M]]);return w}u.merge=h,u.lcFirst=function(b){return b.charAt(0).toLowerCase()+b.substring(1)};function v(w){function b(E,$){if(!(this instanceof b))return new b(E,$);Object.defineProperty(this,"message",{get:function(){return E}}),Error.captureStackTrace?Error.captureStackTrace(this,b):Object.defineProperty(this,"stack",{value:new Error().stack||""}),$&&h(this,$)}return b.prototype=Object.create(Error.prototype,{constructor:{value:b,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return w},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),b}u.newError=v,u.ProtocolError=v("ProtocolError"),u.oneOfGetter=function(b){for(var E={},$=0;$<b.length;++$)E[b[$]]=1;return function(){for(var M=Object.keys(this),T=M.length-1;T>-1;--T)if(E[M[T]]===1&&this[M[T]]!==void 0&&this[M[T]]!==null)return M[T]}},u.oneOfSetter=function(b){return function(E){for(var $=0;$<b.length;++$)b[$]!==E&&delete this[b[$]]}},u.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},u._configure=function(){var w=u.Buffer;if(!w){u._Buffer_from=u._Buffer_allocUnsafe=null;return}u._Buffer_from=w.from!==Uint8Array.from&&w.from||function(E,$){return new w(E,$)},u._Buffer_allocUnsafe=w.allocUnsafe||function(E){return new w(E)}}}(minimal)),minimal}var writer=Writer$1,util$7=requireMinimal(),BufferWriter$1,LongBits$1=util$7.LongBits,base64=util$7.base64,utf8$1=util$7.utf8;function Op(y,u,h){this.fn=y,this.len=u,this.next=void 0,this.val=h}function noop(){}function State(y){this.head=y.head,this.tail=y.tail,this.len=y.len,this.next=y.states}function Writer$1(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}var create$1=function y(){return util$7.Buffer?function(){return(Writer$1.create=function(){return new BufferWriter$1})()}:function(){return new Writer$1}};Writer$1.create=create$1(),Writer$1.alloc=function y(u){return new util$7.Array(u)},util$7.Array!==Array&&(Writer$1.alloc=util$7.pool(Writer$1.alloc,util$7.Array.prototype.subarray)),Writer$1.prototype._push=function y(u,h,v){return this.tail=this.tail.next=new Op(u,h,v),this.len+=h,this};function writeByte(y,u,h){u[h]=y&255}function writeVarint32(y,u,h){for(;y>127;)u[h++]=y&127|128,y>>>=7;u[h]=y}function VarintOp(y,u){this.len=y,this.next=void 0,this.val=u}VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer$1.prototype.uint32=function y(u){return this.len+=(this.tail=this.tail.next=new VarintOp((u=u>>>0)<128?1:u<16384?2:u<2097152?3:u<268435456?4:5,u)).len,this},Writer$1.prototype.int32=function y(u){return u<0?this._push(writeVarint64,10,LongBits$1.fromNumber(u)):this.uint32(u)},Writer$1.prototype.sint32=function y(u){return this.uint32((u<<1^u>>31)>>>0)};function writeVarint64(y,u,h){for(;y.hi;)u[h++]=y.lo&127|128,y.lo=(y.lo>>>7|y.hi<<25)>>>0,y.hi>>>=7;for(;y.lo>127;)u[h++]=y.lo&127|128,y.lo=y.lo>>>7;u[h++]=y.lo}Writer$1.prototype.uint64=function y(u){var h=LongBits$1.from(u);return this._push(writeVarint64,h.length(),h)},Writer$1.prototype.int64=Writer$1.prototype.uint64,Writer$1.prototype.sint64=function y(u){var h=LongBits$1.from(u).zzEncode();return this._push(writeVarint64,h.length(),h)},Writer$1.prototype.bool=function y(u){return this._push(writeByte,1,u?1:0)};function writeFixed32(y,u,h){u[h]=y&255,u[h+1]=y>>>8&255,u[h+2]=y>>>16&255,u[h+3]=y>>>24}Writer$1.prototype.fixed32=function y(u){return this._push(writeFixed32,4,u>>>0)},Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32,Writer$1.prototype.fixed64=function y(u){var h=LongBits$1.from(u);return this._push(writeFixed32,4,h.lo)._push(writeFixed32,4,h.hi)},Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64,Writer$1.prototype.float=function y(u){return this._push(util$7.float.writeFloatLE,4,u)},Writer$1.prototype.double=function y(u){return this._push(util$7.float.writeDoubleLE,8,u)};var writeBytes=util$7.Array.prototype.set?function y(u,h,v){h.set(u,v)}:function y(u,h,v){for(var w=0;w<u.length;++w)h[v+w]=u[w]};Writer$1.prototype.bytes=function y(u){var h=u.length>>>0;if(!h)return this._push(writeByte,1,0);if(util$7.isString(u)){var v=Writer$1.alloc(h=base64.length(u));base64.decode(u,v,0),u=v}return this.uint32(h)._push(writeBytes,h,u)},Writer$1.prototype.string=function y(u){var h=utf8$1.length(u);return h?this.uint32(h)._push(utf8$1.write,h,u):this._push(writeByte,1,0)},Writer$1.prototype.fork=function y(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer$1.prototype.reset=function y(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer$1.prototype.ldelim=function y(){var u=this.head,h=this.tail,v=this.len;return this.reset().uint32(v),v&&(this.tail.next=u.next,this.tail=h,this.len+=v),this},Writer$1.prototype.finish=function y(){for(var u=this.head.next,h=this.constructor.alloc(this.len),v=0;u;)u.fn(u.val,h,v),v+=u.len,u=u.next;return h},Writer$1._configure=function(y){BufferWriter$1=y,Writer$1.create=create$1(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$6=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$6._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$6.Buffer&&util$6.Buffer.prototype instanceof Uint8Array&&util$6.Buffer.prototype.set.name==="set"?function(u,h,v){h.set(u,v)}:function(u,h,v){if(u.copy)u.copy(h,v,0,u.length);else for(var w=0;w<u.length;)h[v++]=u[w++]}},BufferWriter.prototype.bytes=function y(u){util$6.isString(u)&&(u=util$6._Buffer_from(u,"base64"));var h=u.length>>>0;return this.uint32(h),h&&this._push(BufferWriter.writeBytesBuffer,h,u),this};function writeStringBuffer(y,u,h){y.length<40?util$6.utf8.write(y,u,h):u.utf8Write?u.utf8Write(y,h):u.write(y,h)}BufferWriter.prototype.string=function y(u){var h=util$6.Buffer.byteLength(u);return this.uint32(h),h&&this._push(writeStringBuffer,h,u),this},BufferWriter._configure();var reader=Reader$1,util$5=requireMinimal(),BufferReader$1,LongBits=util$5.LongBits,utf8=util$5.utf8;function indexOutOfRange(y,u){return RangeError("index out of range: "+y.pos+" + "+(u||1)+" > "+y.len)}function Reader$1(y){this.buf=y,this.pos=0,this.len=y.length}var create_array=typeof Uint8Array<"u"?function y(u){if(u instanceof Uint8Array||Array.isArray(u))return new Reader$1(u);throw Error("illegal buffer")}:function y(u){if(Array.isArray(u))return new Reader$1(u);throw Error("illegal buffer")},create=function y(){return util$5.Buffer?function(h){return(Reader$1.create=function(w){return util$5.Buffer.isBuffer(w)?new BufferReader$1(w):create_array(w)})(h)}:create_array};Reader$1.create=create(),Reader$1.prototype._slice=util$5.Array.prototype.subarray||util$5.Array.prototype.slice,Reader$1.prototype.uint32=function y(){var u=4294967295;return function(){if(u=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(u=(u|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(u=(u|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(u=(u|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(u=(u|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return u;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return u}}(),Reader$1.prototype.int32=function y(){return this.uint32()|0},Reader$1.prototype.sint32=function y(){var u=this.uint32();return u>>>1^-(u&1)|0};function readLongVarint(){var y=new LongBits(0,0),u=0;if(this.len-this.pos>4){for(;u<4;++u)if(y.lo=(y.lo|(this.buf[this.pos]&127)<<u*7)>>>0,this.buf[this.pos++]<128)return y;if(y.lo=(y.lo|(this.buf[this.pos]&127)<<28)>>>0,y.hi=(y.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return y;u=0}else{for(;u<3;++u){if(this.pos>=this.len)throw indexOutOfRange(this);if(y.lo=(y.lo|(this.buf[this.pos]&127)<<u*7)>>>0,this.buf[this.pos++]<128)return y}return y.lo=(y.lo|(this.buf[this.pos++]&127)<<u*7)>>>0,y}if(this.len-this.pos>4){for(;u<5;++u)if(y.hi=(y.hi|(this.buf[this.pos]&127)<<u*7+3)>>>0,this.buf[this.pos++]<128)return y}else for(;u<5;++u){if(this.pos>=this.len)throw indexOutOfRange(this);if(y.hi=(y.hi|(this.buf[this.pos]&127)<<u*7+3)>>>0,this.buf[this.pos++]<128)return y}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function y(){return this.uint32()!==0};function readFixed32_end(y,u){return(y[u-4]|y[u-3]<<8|y[u-2]<<16|y[u-1]<<24)>>>0}Reader$1.prototype.fixed32=function y(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader$1.prototype.sfixed32=function y(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function y(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var u=util$5.float.readFloatLE(this.buf,this.pos);return this.pos+=4,u},Reader$1.prototype.double=function y(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var u=util$5.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,u},Reader$1.prototype.bytes=function y(){var u=this.uint32(),h=this.pos,v=this.pos+u;if(v>this.len)throw indexOutOfRange(this,u);if(this.pos+=u,Array.isArray(this.buf))return this.buf.slice(h,v);if(h===v){var w=util$5.Buffer;return w?w.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,h,v)},Reader$1.prototype.string=function y(){var u=this.bytes();return utf8.read(u,0,u.length)},Reader$1.prototype.skip=function y(u){if(typeof u=="number"){if(this.pos+u>this.len)throw indexOutOfRange(this,u);this.pos+=u}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this},Reader$1.prototype.skipType=function(y){switch(y){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(y=this.uint32()&7)!==4;)this.skipType(y);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+y+" at offset "+this.pos)}return this},Reader$1._configure=function(y){BufferReader$1=y,Reader$1.create=create(),BufferReader$1._configure();var u=util$5.Long?"toLong":"toNumber";util$5.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[u](!1)},uint64:function(){return readLongVarint.call(this)[u](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[u](!1)},fixed64:function(){return readFixed64.call(this)[u](!0)},sfixed64:function(){return readFixed64.call(this)[u](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$4=requireMinimal();function BufferReader(y){Reader.call(this,y)}BufferReader._configure=function(){util$4.Buffer&&(BufferReader.prototype._slice=util$4.Buffer.prototype.slice)},BufferReader.prototype.string=function y(){var u=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+u,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+u,this.len))},BufferReader._configure();var rpc={},service$1=Service$1,util$3=requireMinimal();(Service$1.prototype=Object.create(util$3.EventEmitter.prototype)).constructor=Service$1;function Service$1(y,u,h){if(typeof y!="function")throw TypeError("rpcImpl must be a function");util$3.EventEmitter.call(this),this.rpcImpl=y,this.requestDelimited=!!u,this.responseDelimited=!!h}Service$1.prototype.rpcCall=function y(u,h,v,w,b){if(!w)throw TypeError("request must be specified");var E=this;if(!b)return util$3.asPromise(y,E,u,h,v,w);if(!E.rpcImpl){setTimeout(function(){b(Error("already ended"))},0);return}try{return E.rpcImpl(u,h[E.requestDelimited?"encodeDelimited":"encode"](w).finish(),function(M,T){if(M)return E.emit("error",M,u),b(M);if(T===null){E.end(!0);return}if(!(T instanceof v))try{T=v[E.responseDelimited?"decodeDelimited":"decode"](T)}catch(C){return E.emit("error",C,u),b(C)}return E.emit("data",T,u),b(null,T)})}catch($){E.emit("error",$,u),setTimeout(function(){b($)},0);return}},Service$1.prototype.end=function y(u){return this.rpcImpl&&(u||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},function(y){var u=y;u.Service=service$1}(rpc);var roots={};(function(y){var u=y;u.build="minimal",u.Writer=writer,u.BufferWriter=writer_buffer,u.Reader=reader,u.BufferReader=reader_buffer,u.util=requireMinimal(),u.rpc=rpc,u.roots=roots,u.configure=h;function h(){u.util._configure(),u.Writer._configure(u.BufferWriter),u.Reader._configure(u.BufferReader)}h()})(indexMinimal);var types$1={},util$2={exports:{}},codegen_1=codegen;function codegen(y,u){typeof y=="string"&&(u=y,y=void 0);var h=[];function v(b){if(typeof b!="string"){var E=w();if(codegen.verbose&&console.log("codegen: "+E),E="return "+E,b){for(var $=Object.keys(b),M=new Array($.length+1),T=new Array($.length),C=0;C<$.length;)M[C]=$[C],T[C]=b[$[C++]];return M[C]=E,Function.apply(null,M).apply(null,T)}return Function(E)()}for(var B=new Array(arguments.length-1),N=0;N<B.length;)B[N]=arguments[++N];if(N=0,b=b.replace(/%([%dfijs])/g,function(te,fe){var ce=B[N++];switch(fe){case"d":case"f":return String(Number(ce));case"i":return String(Math.floor(ce));case"j":return JSON.stringify(ce);case"s":return String(ce)}return"%"}),N!==B.length)throw Error("parameter count mismatch");return h.push(b),v}function w(b){return"function "+(b||u||"")+"("+(y&&y.join(",")||"")+`){
|
|
58
|
-
`+h.join(`
|
|
59
|
-
`)+`
|
|
60
|
-
}`}return v.toString=w,v}codegen.verbose=!1;var fetch_1=fetch$1,asPromise=aspromise,inquire=inquire_1,fs=inquire("fs");function fetch$1(y,u,h){return typeof u=="function"?(h=u,u={}):u||(u={}),h?!u.xhr&&fs&&fs.readFile?fs.readFile(y,function(w,b){return w&&typeof XMLHttpRequest<"u"?fetch$1.xhr(y,u,h):w?h(w):h(null,u.binary?b:b.toString("utf8"))}):fetch$1.xhr(y,u,h):asPromise(fetch$1,this,y,u)}fetch$1.xhr=function y(u,h,v){var w=new XMLHttpRequest;w.onreadystatechange=function(){if(w.readyState===4){if(w.status!==0&&w.status!==200)return v(Error("status "+w.status));if(h.binary){var E=w.response;if(!E){E=[];for(var $=0;$<w.responseText.length;++$)E.push(w.responseText.charCodeAt($)&255)}return v(null,typeof Uint8Array<"u"?new Uint8Array(E):E)}return v(null,w.responseText)}},h.binary&&("overrideMimeType"in w&&w.overrideMimeType("text/plain; charset=x-user-defined"),w.responseType="arraybuffer"),w.open("GET",u),w.send()};var path={};(function(y){var u=y,h=u.isAbsolute=function(b){return/^(?:\/|\w+:)/.test(b)},v=u.normalize=function(b){b=b.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var E=b.split("/"),$=h(b),M="";$&&(M=E.shift()+"/");for(var T=0;T<E.length;)E[T]===".."?T>0&&E[T-1]!==".."?E.splice(--T,2):$?E.splice(T,1):++T:E[T]==="."?E.splice(T,1):++T;return M+E.join("/")};u.resolve=function(b,E,$){return $||(E=v(E)),h(E)?E:($||(b=v(b)),(b=b.replace(/(?:\/|^)[^/]+$/,"")).length?v(b+"/"+E):E)}})(path);var namespace,hasRequiredNamespace;function requireNamespace(){if(hasRequiredNamespace)return namespace;hasRequiredNamespace=1,namespace=M;var y=requireObject();((M.prototype=Object.create(y.prototype)).constructor=M).className="Namespace";var u=requireField(),h=requireUtil(),v=requireOneof(),w,b,E;M.fromJSON=function(B,N){return new M(B,N.options).addJSON(N.nested)};function $(C,B){if(C&&C.length){for(var N={},H=0;H<C.length;++H)N[C[H].name]=C[H].toJSON(B);return N}}M.arrayToJSON=$,M.isReservedId=function(B,N){if(B){for(var H=0;H<B.length;++H)if(typeof B[H]!="string"&&B[H][0]<=N&&B[H][1]>N)return!0}return!1},M.isReservedName=function(B,N){if(B){for(var H=0;H<B.length;++H)if(B[H]===N)return!0}return!1};function M(C,B){y.call(this,C,B),this.nested=void 0,this._nestedArray=null,this._lookupCache={},this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function T(C){C._nestedArray=null,C._lookupCache={};for(var B=C;B=B.parent;)B._lookupCache={};return C}return Object.defineProperty(M.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=h.toArray(this.nested))}}),M.prototype.toJSON=function(B){return h.toObject(["options",this.options,"nested",$(this.nestedArray,B)])},M.prototype.addJSON=function(B){var N=this;if(B)for(var H=Object.keys(B),te=0,fe;te<H.length;++te)fe=B[H[te]],N.add((fe.fields!==void 0?w.fromJSON:fe.values!==void 0?E.fromJSON:fe.methods!==void 0?b.fromJSON:fe.id!==void 0?u.fromJSON:M.fromJSON)(H[te],fe));return this},M.prototype.get=function(B){return this.nested&&this.nested[B]||null},M.prototype.getEnum=function(B){if(this.nested&&this.nested[B]instanceof E)return this.nested[B].values;throw Error("no such enum: "+B)},M.prototype.add=function(B){if(!(B instanceof u&&B.extend!==void 0||B instanceof w||B instanceof v||B instanceof E||B instanceof b||B instanceof M))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var N=this.get(B.name);if(N)if(N instanceof M&&B instanceof M&&!(N instanceof w||N instanceof b)){for(var H=N.nestedArray,te=0;te<H.length;++te)B.add(H[te]);this.remove(N),this.nested||(this.nested={}),B.setOptions(N.options,!0)}else throw Error("duplicate name '"+B.name+"' in "+this)}this.nested[B.name]=B,this instanceof w||this instanceof b||this instanceof E||this instanceof u||B._edition||(B._edition=B._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var fe=this;fe=fe.parent;)fe._needsRecursiveFeatureResolution=!0,fe._needsRecursiveResolve=!0;return B.onAdd(this),T(this)},M.prototype.remove=function(B){if(!(B instanceof y))throw TypeError("object must be a ReflectionObject");if(B.parent!==this)throw Error(B+" is not a member of "+this);return delete this.nested[B.name],Object.keys(this.nested).length||(this.nested=void 0),B.onRemove(this),T(this)},M.prototype.define=function(B,N){if(h.isString(B))B=B.split(".");else if(!Array.isArray(B))throw TypeError("illegal path");if(B&&B.length&&B[0]==="")throw Error("path must be relative");for(var H=this;B.length>0;){var te=B.shift();if(H.nested&&H.nested[te]){if(H=H.nested[te],!(H instanceof M))throw Error("path conflicts with non-namespace objects")}else H.add(H=new M(te))}return N&&H.addJSON(N),H},M.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var B=this.nestedArray,N=0;for(this.resolve();N<B.length;)B[N]instanceof M?B[N++].resolveAll():B[N++].resolve();return this._needsRecursiveResolve=!1,this},M.prototype._resolveFeaturesRecursive=function(B){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,B=this._edition||B,y.prototype._resolveFeaturesRecursive.call(this,B),this.nestedArray.forEach(N=>{N._resolveFeaturesRecursive(B)}),this):this},M.prototype.lookup=function(B,N,H){if(typeof N=="boolean"?(H=N,N=void 0):N&&!Array.isArray(N)&&(N=[N]),h.isString(B)&&B.length){if(B===".")return this.root;B=B.split(".")}else if(!B.length)return this;var te=B.join(".");if(B[0]==="")return this.root.lookup(B.slice(1),N);var fe=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+te];if(fe&&(!N||N.indexOf(fe.constructor)>-1)||(fe=this._lookupImpl(B,te),fe&&(!N||N.indexOf(fe.constructor)>-1)))return fe;if(H)return null;for(var ce=this;ce.parent;){if(fe=ce.parent._lookupImpl(B,te),fe&&(!N||N.indexOf(fe.constructor)>-1))return fe;ce=ce.parent}return null},M.prototype._lookupImpl=function(B,N){if(Object.prototype.hasOwnProperty.call(this._lookupCache,N))return this._lookupCache[N];var H=this.get(B[0]),te=null;if(H)B.length===1?te=H:H instanceof M&&(B=B.slice(1),te=H._lookupImpl(B,B.join(".")));else for(var fe=0;fe<this.nestedArray.length;++fe)this._nestedArray[fe]instanceof M&&(H=this._nestedArray[fe]._lookupImpl(B,N))&&(te=H);return this._lookupCache[N]=te,te},M.prototype.lookupType=function(B){var N=this.lookup(B,[w]);if(!N)throw Error("no such type: "+B);return N},M.prototype.lookupEnum=function(B){var N=this.lookup(B,[E]);if(!N)throw Error("no such Enum '"+B+"' in "+this);return N},M.prototype.lookupTypeOrEnum=function(B){var N=this.lookup(B,[w,E]);if(!N)throw Error("no such Type or Enum '"+B+"' in "+this);return N},M.prototype.lookupService=function(B){var N=this.lookup(B,[b]);if(!N)throw Error("no such Service '"+B+"' in "+this);return N},M._configure=function(C,B,N){w=C,b=B,E=N},namespace}var mapfield,hasRequiredMapfield;function requireMapfield(){if(hasRequiredMapfield)return mapfield;hasRequiredMapfield=1,mapfield=v;var y=requireField();((v.prototype=Object.create(y.prototype)).constructor=v).className="MapField";var u=requireTypes(),h=requireUtil();function v(w,b,E,$,M,T){if(y.call(this,w,b,$,void 0,void 0,M,T),!h.isString(E))throw TypeError("keyType must be a string");this.keyType=E,this.resolvedKeyType=null,this.map=!0}return v.fromJSON=function(b,E){return new v(b,E.id,E.keyType,E.type,E.options,E.comment)},v.prototype.toJSON=function(b){var E=b?!!b.keepComments:!1;return h.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",E?this.comment:void 0])},v.prototype.resolve=function(){if(this.resolved)return this;if(u.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return y.prototype.resolve.call(this)},v.d=function(b,E,$){return typeof $=="function"?$=h.decorateType($).name:$&&typeof $=="object"&&($=h.decorateEnum($).name),function(T,C){h.decorateType(T.constructor).add(new v(C,b,E,$))}},mapfield}var method,hasRequiredMethod;function requireMethod(){if(hasRequiredMethod)return method;hasRequiredMethod=1,method=h;var y=requireObject();((h.prototype=Object.create(y.prototype)).constructor=h).className="Method";var u=requireUtil();function h(v,w,b,E,$,M,T,C,B){if(u.isObject($)?(T=$,$=M=void 0):u.isObject(M)&&(T=M,M=void 0),!(w===void 0||u.isString(w)))throw TypeError("type must be a string");if(!u.isString(b))throw TypeError("requestType must be a string");if(!u.isString(E))throw TypeError("responseType must be a string");y.call(this,v,T),this.type=w||"rpc",this.requestType=b,this.requestStream=$?!0:void 0,this.responseType=E,this.responseStream=M?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=C,this.parsedOptions=B}return h.fromJSON=function(w,b){return new h(w,b.type,b.requestType,b.responseType,b.requestStream,b.responseStream,b.options,b.comment,b.parsedOptions)},h.prototype.toJSON=function(w){var b=w?!!w.keepComments:!1;return u.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",b?this.comment:void 0,"parsedOptions",this.parsedOptions])},h.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),y.prototype.resolve.call(this))},method}var service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=w;var y=requireNamespace();((w.prototype=Object.create(y.prototype)).constructor=w).className="Service";var u=requireMethod(),h=requireUtil(),v=rpc;function w(E,$){y.call(this,E,$),this.methods={},this._methodsArray=null}w.fromJSON=function($,M){var T=new w($,M.options);if(M.methods)for(var C=Object.keys(M.methods),B=0;B<C.length;++B)T.add(u.fromJSON(C[B],M.methods[C[B]]));return M.nested&&T.addJSON(M.nested),M.edition&&(T._edition=M.edition),T.comment=M.comment,T._defaultEdition="proto3",T},w.prototype.toJSON=function($){var M=y.prototype.toJSON.call(this,$),T=$?!!$.keepComments:!1;return h.toObject(["edition",this._editionToJSON(),"options",M&&M.options||void 0,"methods",y.arrayToJSON(this.methodsArray,$)||{},"nested",M&&M.nested||void 0,"comment",T?this.comment:void 0])},Object.defineProperty(w.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=h.toArray(this.methods))}});function b(E){return E._methodsArray=null,E}return w.prototype.get=function($){return this.methods[$]||y.prototype.get.call(this,$)},w.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;y.prototype.resolve.call(this);for(var $=this.methodsArray,M=0;M<$.length;++M)$[M].resolve();return this},w.prototype._resolveFeaturesRecursive=function($){return this._needsRecursiveFeatureResolution?($=this._edition||$,y.prototype._resolveFeaturesRecursive.call(this,$),this.methodsArray.forEach(M=>{M._resolveFeaturesRecursive($)}),this):this},w.prototype.add=function($){if(this.get($.name))throw Error("duplicate name '"+$.name+"' in "+this);return $ instanceof u?(this.methods[$.name]=$,$.parent=this,b(this)):y.prototype.add.call(this,$)},w.prototype.remove=function($){if($ instanceof u){if(this.methods[$.name]!==$)throw Error($+" is not a member of "+this);return delete this.methods[$.name],$.parent=null,b(this)}return y.prototype.remove.call(this,$)},w.prototype.create=function($,M,T){for(var C=new v.Service($,M,T),B=0,N;B<this.methodsArray.length;++B){var H=h.lcFirst((N=this._methodsArray[B]).resolve().name).replace(/[^$\w_]/g,"");C[H]=h.codegen(["r","c"],h.isReserved(H)?H+"_":H)("return this.rpcCall(m,q,s,r,c)")({m:N,q:N.resolvedRequestType.ctor,s:N.resolvedResponseType.ctor})}return C},service}var message=Message,util$1=requireMinimal();function Message(y){if(y)for(var u=Object.keys(y),h=0;h<u.length;++h)this[u[h]]=y[u[h]]}Message.create=function y(u){return this.$type.create(u)},Message.encode=function y(u,h){return this.$type.encode(u,h)},Message.encodeDelimited=function y(u,h){return this.$type.encodeDelimited(u,h)},Message.decode=function y(u){return this.$type.decode(u)},Message.decodeDelimited=function y(u){return this.$type.decodeDelimited(u)},Message.verify=function y(u){return this.$type.verify(u)},Message.fromObject=function y(u){return this.$type.fromObject(u)},Message.toObject=function y(u,h){return this.$type.toObject(u,h)},Message.prototype.toJSON=function y(){return this.$type.toObject(this,util$1.toJSONOptions)};var decoder_1,hasRequiredDecoder;function requireDecoder(){if(hasRequiredDecoder)return decoder_1;hasRequiredDecoder=1,decoder_1=w;var y=require_enum(),u=requireTypes(),h=requireUtil();function v(b){return"missing required '"+b.name+"'"}function w(b){for(var E=h.codegen(["r","l","e"],b.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(b.fieldsArray.filter(function(N){return N.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),$=0;$<b.fieldsArray.length;++$){var M=b._fieldsArray[$].resolve(),T=M.resolvedType instanceof y?"int32":M.type,C="m"+h.safeProp(M.name);E("case %i: {",M.id),M.map?(E("if(%s===util.emptyObject)",C)("%s={}",C)("var c2 = r.uint32()+r.pos"),u.defaults[M.keyType]!==void 0?E("k=%j",u.defaults[M.keyType]):E("k=null"),u.defaults[T]!==void 0?E("value=%j",u.defaults[T]):E("value=null"),E("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",M.keyType)("case 2:"),u.basic[T]===void 0?E("value=types[%i].decode(r,r.uint32())",$):E("value=r.%s()",T),E("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),u.long[M.keyType]!==void 0?E('%s[typeof k==="object"?util.longToHash(k):k]=value',C):E("%s[k]=value",C)):M.repeated?(E("if(!(%s&&%s.length))",C,C)("%s=[]",C),u.packed[T]!==void 0&&E("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",C,T)("}else"),u.basic[T]===void 0?E(M.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4)))":"%s.push(types[%i].decode(r,r.uint32()))",C,$):E("%s.push(r.%s())",C,T)):u.basic[T]===void 0?E(M.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4))":"%s=types[%i].decode(r,r.uint32())",C,$):E("%s=r.%s()",C,T),E("break")("}")}for(E("default:")("r.skipType(t&7)")("break")("}")("}"),$=0;$<b._fieldsArray.length;++$){var B=b._fieldsArray[$];B.required&&E("if(!m.hasOwnProperty(%j))",B.name)("throw util.ProtocolError(%j,{instance:m})",v(B))}return E("return m")}return decoder_1}var verifier_1,hasRequiredVerifier;function requireVerifier(){if(hasRequiredVerifier)return verifier_1;hasRequiredVerifier=1,verifier_1=b;var y=require_enum(),u=requireUtil();function h(E,$){return E.name+": "+$+(E.repeated&&$!=="array"?"[]":E.map&&$!=="object"?"{k:"+E.keyType+"}":"")+" expected"}function v(E,$,M,T){if($.resolvedType)if($.resolvedType instanceof y){E("switch(%s){",T)("default:")("return%j",h($,"enum value"));for(var C=Object.keys($.resolvedType.values),B=0;B<C.length;++B)E("case %i:",$.resolvedType.values[C[B]]);E("break")("}")}else E("{")("var e=types[%i].verify(%s);",M,T)("if(e)")("return%j+e",$.name+".")("}");else switch($.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":E("if(!util.isInteger(%s))",T)("return%j",h($,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":E("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",T,T,T,T)("return%j",h($,"integer|Long"));break;case"float":case"double":E('if(typeof %s!=="number")',T)("return%j",h($,"number"));break;case"bool":E('if(typeof %s!=="boolean")',T)("return%j",h($,"boolean"));break;case"string":E("if(!util.isString(%s))",T)("return%j",h($,"string"));break;case"bytes":E('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',T,T,T)("return%j",h($,"buffer"));break}return E}function w(E,$,M){switch($.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":E("if(!util.key32Re.test(%s))",M)("return%j",h($,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":E("if(!util.key64Re.test(%s))",M)("return%j",h($,"integer|Long key"));break;case"bool":E("if(!util.key2Re.test(%s))",M)("return%j",h($,"boolean key"));break}return E}function b(E){var $=u.codegen(["m"],E.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),M=E.oneofsArray,T={};M.length&&$("var p={}");for(var C=0;C<E.fieldsArray.length;++C){var B=E._fieldsArray[C].resolve(),N="m"+u.safeProp(B.name);if(B.optional&&$("if(%s!=null&&m.hasOwnProperty(%j)){",N,B.name),B.map)$("if(!util.isObject(%s))",N)("return%j",h(B,"object"))("var k=Object.keys(%s)",N)("for(var i=0;i<k.length;++i){"),w($,B,"k[i]"),v($,B,C,N+"[k[i]]")("}");else if(B.repeated)$("if(!Array.isArray(%s))",N)("return%j",h(B,"array"))("for(var i=0;i<%s.length;++i){",N),v($,B,C,N+"[i]")("}");else{if(B.partOf){var H=u.safeProp(B.partOf.name);T[B.partOf.name]===1&&$("if(p%s===1)",H)("return%j",B.partOf.name+": multiple values"),T[B.partOf.name]=1,$("p%s=1",H)}v($,B,C,N)}B.optional&&$("}")}return $("return null")}return verifier_1}var converter={},hasRequiredConverter;function requireConverter(){return hasRequiredConverter||(hasRequiredConverter=1,function(y){var u=y,h=require_enum(),v=requireUtil();function w(E,$,M,T){var C=!1;if($.resolvedType)if($.resolvedType instanceof h){E("switch(d%s){",T);for(var B=$.resolvedType.values,N=Object.keys(B),H=0;H<N.length;++H)B[N[H]]===$.typeDefault&&!C&&(E("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',T,T,T),$.repeated||E("break"),C=!0),E("case%j:",N[H])("case %i:",B[N[H]])("m%s=%j",T,B[N[H]])("break");E("}")}else E('if(typeof d%s!=="object")',T)("throw TypeError(%j)",$.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",T,M,T);else{var te=!1;switch($.type){case"double":case"float":E("m%s=Number(d%s)",T,T);break;case"uint32":case"fixed32":E("m%s=d%s>>>0",T,T);break;case"int32":case"sint32":case"sfixed32":E("m%s=d%s|0",T,T);break;case"uint64":te=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":E("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",T,T,te)('else if(typeof d%s==="string")',T)("m%s=parseInt(d%s,10)",T,T)('else if(typeof d%s==="number")',T)("m%s=d%s",T,T)('else if(typeof d%s==="object")',T)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",T,T,T,te?"true":"");break;case"bytes":E('if(typeof d%s==="string")',T)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",T,T,T)("else if(d%s.length >= 0)",T)("m%s=d%s",T,T);break;case"string":E("m%s=String(d%s)",T,T);break;case"bool":E("m%s=Boolean(d%s)",T,T);break}}return E}u.fromObject=function($){var M=$.fieldsArray,T=v.codegen(["d"],$.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!M.length)return T("return new this.ctor");T("var m=new this.ctor");for(var C=0;C<M.length;++C){var B=M[C].resolve(),N=v.safeProp(B.name);B.map?(T("if(d%s){",N)('if(typeof d%s!=="object")',N)("throw TypeError(%j)",B.fullName+": object expected")("m%s={}",N)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",N),w(T,B,C,N+"[ks[i]]")("}")("}")):B.repeated?(T("if(d%s){",N)("if(!Array.isArray(d%s))",N)("throw TypeError(%j)",B.fullName+": array expected")("m%s=[]",N)("for(var i=0;i<d%s.length;++i){",N),w(T,B,C,N+"[i]")("}")("}")):(B.resolvedType instanceof h||T("if(d%s!=null){",N),w(T,B,C,N),B.resolvedType instanceof h||T("}"))}return T("return m")};function b(E,$,M,T){if($.resolvedType)$.resolvedType instanceof h?E("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",T,M,T,T,M,T,T):E("d%s=types[%i].toObject(m%s,o)",T,M,T);else{var C=!1;switch($.type){case"double":case"float":E("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",T,T,T,T);break;case"uint64":C=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":E('if(typeof m%s==="number")',T)("d%s=o.longs===String?String(m%s):m%s",T,T,T)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",T,T,T,T,C?"true":"",T);break;case"bytes":E("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",T,T,T,T,T);break;default:E("d%s=m%s",T,T);break}}return E}u.toObject=function($){var M=$.fieldsArray.slice().sort(v.compareFieldsById);if(!M.length)return v.codegen()("return {}");for(var T=v.codegen(["m","o"],$.name+"$toObject")("if(!o)")("o={}")("var d={}"),C=[],B=[],N=[],H=0;H<M.length;++H)M[H].partOf||(M[H].resolve().repeated?C:M[H].map?B:N).push(M[H]);if(C.length){for(T("if(o.arrays||o.defaults){"),H=0;H<C.length;++H)T("d%s=[]",v.safeProp(C[H].name));T("}")}if(B.length){for(T("if(o.objects||o.defaults){"),H=0;H<B.length;++H)T("d%s={}",v.safeProp(B[H].name));T("}")}if(N.length){for(T("if(o.defaults){"),H=0;H<N.length;++H){var te=N[H],fe=v.safeProp(te.name);if(te.resolvedType instanceof h)T("d%s=o.enums===String?%j:%j",fe,te.resolvedType.valuesById[te.typeDefault],te.typeDefault);else if(te.long)T("if(util.Long){")("var n=new util.Long(%i,%i,%j)",te.typeDefault.low,te.typeDefault.high,te.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",fe)("}else")("d%s=o.longs===String?%j:%i",fe,te.typeDefault.toString(),te.typeDefault.toNumber());else if(te.bytes){var ce="["+Array.prototype.slice.call(te.typeDefault).join(",")+"]";T("if(o.bytes===String)d%s=%j",fe,String.fromCharCode.apply(String,te.typeDefault))("else{")("d%s=%s",fe,ce)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",fe,fe)("}")}else T("d%s=%j",fe,te.typeDefault)}T("}")}var le=!1;for(H=0;H<M.length;++H){var te=M[H],ie=$._fieldsArray.indexOf(te),fe=v.safeProp(te.name);te.map?(le||(le=!0,T("var ks2")),T("if(m%s&&(ks2=Object.keys(m%s)).length){",fe,fe)("d%s={}",fe)("for(var j=0;j<ks2.length;++j){"),b(T,te,ie,fe+"[ks2[j]]")("}")):te.repeated?(T("if(m%s&&m%s.length){",fe,fe)("d%s=[]",fe)("for(var j=0;j<m%s.length;++j){",fe),b(T,te,ie,fe+"[j]")("}")):(T("if(m%s!=null&&m.hasOwnProperty(%j)){",fe,te.name),b(T,te,ie,fe),te.partOf&&T("if(o.oneofs)")("d%s=%j",v.safeProp(te.partOf.name),te.name)),T("}")}return T("return d")}}(converter)),converter}var wrappers={};(function(y){var u=y,h=message;u[".google.protobuf.Any"]={fromObject:function(v){if(v&&v["@type"]){var w=v["@type"].substring(v["@type"].lastIndexOf("/")+1),b=this.lookup(w);if(b){var E=v["@type"].charAt(0)==="."?v["@type"].slice(1):v["@type"];return E.indexOf("/")===-1&&(E="/"+E),this.create({type_url:E,value:b.encode(b.fromObject(v)).finish()})}}return this.fromObject(v)},toObject:function(v,w){var b="type.googleapis.com/",E="",$="";if(w&&w.json&&v.type_url&&v.value){$=v.type_url.substring(v.type_url.lastIndexOf("/")+1),E=v.type_url.substring(0,v.type_url.lastIndexOf("/")+1);var M=this.lookup($);M&&(v=M.decode(v.value))}if(!(v instanceof this.ctor)&&v instanceof h){var T=v.$type.toObject(v,w),C=v.$type.fullName[0]==="."?v.$type.fullName.slice(1):v.$type.fullName;return E===""&&(E=b),$=E+C,T["@type"]=$,T}return this.toObject(v,w)}}})(wrappers);var type,hasRequiredType;function requireType(){if(hasRequiredType)return type;hasRequiredType=1,type=fe;var y=requireNamespace();((fe.prototype=Object.create(y.prototype)).constructor=fe).className="Type";var u=require_enum(),h=requireOneof(),v=requireField(),w=requireMapfield(),b=requireService(),E=message,$=reader,M=writer,T=requireUtil(),C=requireEncoder(),B=requireDecoder(),N=requireVerifier(),H=requireConverter(),te=wrappers;function fe(le,ie){y.call(this,le,ie),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(fe.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var le=Object.keys(this.fields),ie=0;ie<le.length;++ie){var ge=this.fields[le[ie]],pe=ge.id;if(this._fieldsById[pe])throw Error("duplicate id "+pe+" in "+this);this._fieldsById[pe]=ge}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=T.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=T.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=fe.generateConstructor(this)())},set:function(le){var ie=le.prototype;ie instanceof E||((le.prototype=new E).constructor=le,T.merge(le.prototype,ie)),le.$type=le.prototype.$type=this,T.merge(le,E,!0),this._ctor=le;for(var ge=0;ge<this.fieldsArray.length;++ge)this._fieldsArray[ge].resolve();var pe={};for(ge=0;ge<this.oneofsArray.length;++ge)pe[this._oneofsArray[ge].resolve().name]={get:T.oneOfGetter(this._oneofsArray[ge].oneof),set:T.oneOfSetter(this._oneofsArray[ge].oneof)};ge&&Object.defineProperties(le.prototype,pe)}}}),fe.generateConstructor=function(ie){for(var ge=T.codegen(["p"],ie.name),pe=0,Me;pe<ie.fieldsArray.length;++pe)(Me=ie._fieldsArray[pe]).map?ge("this%s={}",T.safeProp(Me.name)):Me.repeated&&ge("this%s=[]",T.safeProp(Me.name));return ge("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")};function ce(le){return le._fieldsById=le._fieldsArray=le._oneofsArray=null,delete le.encode,delete le.decode,delete le.verify,le}return fe.fromJSON=function(ie,ge){var pe=new fe(ie,ge.options);pe.extensions=ge.extensions,pe.reserved=ge.reserved;for(var Me=Object.keys(ge.fields),$e=0;$e<Me.length;++$e)pe.add((typeof ge.fields[Me[$e]].keyType<"u"?w.fromJSON:v.fromJSON)(Me[$e],ge.fields[Me[$e]]));if(ge.oneofs)for(Me=Object.keys(ge.oneofs),$e=0;$e<Me.length;++$e)pe.add(h.fromJSON(Me[$e],ge.oneofs[Me[$e]]));if(ge.nested)for(Me=Object.keys(ge.nested),$e=0;$e<Me.length;++$e){var Pe=ge.nested[Me[$e]];pe.add((Pe.id!==void 0?v.fromJSON:Pe.fields!==void 0?fe.fromJSON:Pe.values!==void 0?u.fromJSON:Pe.methods!==void 0?b.fromJSON:y.fromJSON)(Me[$e],Pe))}return ge.extensions&&ge.extensions.length&&(pe.extensions=ge.extensions),ge.reserved&&ge.reserved.length&&(pe.reserved=ge.reserved),ge.group&&(pe.group=!0),ge.comment&&(pe.comment=ge.comment),ge.edition&&(pe._edition=ge.edition),pe._defaultEdition="proto3",pe},fe.prototype.toJSON=function(ie){var ge=y.prototype.toJSON.call(this,ie),pe=ie?!!ie.keepComments:!1;return T.toObject(["edition",this._editionToJSON(),"options",ge&&ge.options||void 0,"oneofs",y.arrayToJSON(this.oneofsArray,ie),"fields",y.arrayToJSON(this.fieldsArray.filter(function(Me){return!Me.declaringField}),ie)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",ge&&ge.nested||void 0,"comment",pe?this.comment:void 0])},fe.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;y.prototype.resolveAll.call(this);var ie=this.oneofsArray;for(pe=0;pe<ie.length;)ie[pe++].resolve();for(var ge=this.fieldsArray,pe=0;pe<ge.length;)ge[pe++].resolve();return this},fe.prototype._resolveFeaturesRecursive=function(ie){return this._needsRecursiveFeatureResolution?(ie=this._edition||ie,y.prototype._resolveFeaturesRecursive.call(this,ie),this.oneofsArray.forEach(ge=>{ge._resolveFeatures(ie)}),this.fieldsArray.forEach(ge=>{ge._resolveFeatures(ie)}),this):this},fe.prototype.get=function(ie){return this.fields[ie]||this.oneofs&&this.oneofs[ie]||this.nested&&this.nested[ie]||null},fe.prototype.add=function(ie){if(this.get(ie.name))throw Error("duplicate name '"+ie.name+"' in "+this);if(ie instanceof v&&ie.extend===void 0){if(this._fieldsById?this._fieldsById[ie.id]:this.fieldsById[ie.id])throw Error("duplicate id "+ie.id+" in "+this);if(this.isReservedId(ie.id))throw Error("id "+ie.id+" is reserved in "+this);if(this.isReservedName(ie.name))throw Error("name '"+ie.name+"' is reserved in "+this);return ie.parent&&ie.parent.remove(ie),this.fields[ie.name]=ie,ie.message=this,ie.onAdd(this),ce(this)}return ie instanceof h?(this.oneofs||(this.oneofs={}),this.oneofs[ie.name]=ie,ie.onAdd(this),ce(this)):y.prototype.add.call(this,ie)},fe.prototype.remove=function(ie){if(ie instanceof v&&ie.extend===void 0){if(!this.fields||this.fields[ie.name]!==ie)throw Error(ie+" is not a member of "+this);return delete this.fields[ie.name],ie.parent=null,ie.onRemove(this),ce(this)}if(ie instanceof h){if(!this.oneofs||this.oneofs[ie.name]!==ie)throw Error(ie+" is not a member of "+this);return delete this.oneofs[ie.name],ie.parent=null,ie.onRemove(this),ce(this)}return y.prototype.remove.call(this,ie)},fe.prototype.isReservedId=function(ie){return y.isReservedId(this.reserved,ie)},fe.prototype.isReservedName=function(ie){return y.isReservedName(this.reserved,ie)},fe.prototype.create=function(ie){return new this.ctor(ie)},fe.prototype.setup=function(){for(var ie=this.fullName,ge=[],pe=0;pe<this.fieldsArray.length;++pe)ge.push(this._fieldsArray[pe].resolve().resolvedType);this.encode=C(this)({Writer:M,types:ge,util:T}),this.decode=B(this)({Reader:$,types:ge,util:T}),this.verify=N(this)({types:ge,util:T}),this.fromObject=H.fromObject(this)({types:ge,util:T}),this.toObject=H.toObject(this)({types:ge,util:T});var Me=te[ie];if(Me){var $e=Object.create(this);$e.fromObject=this.fromObject,this.fromObject=Me.fromObject.bind($e),$e.toObject=this.toObject,this.toObject=Me.toObject.bind($e)}return this},fe.prototype.encode=function(ie,ge){return this.setup().encode(ie,ge)},fe.prototype.encodeDelimited=function(ie,ge){return this.encode(ie,ge&&ge.len?ge.fork():ge).ldelim()},fe.prototype.decode=function(ie,ge){return this.setup().decode(ie,ge)},fe.prototype.decodeDelimited=function(ie){return ie instanceof $||(ie=$.create(ie)),this.decode(ie,ie.uint32())},fe.prototype.verify=function(ie){return this.setup().verify(ie)},fe.prototype.fromObject=function(ie){return this.setup().fromObject(ie)},fe.prototype.toObject=function(ie,ge){return this.setup().toObject(ie,ge)},fe.d=function(ie){return function(pe){T.decorateType(pe,ie)}},type}var root,hasRequiredRoot;function requireRoot(){if(hasRequiredRoot)return root;hasRequiredRoot=1,root=M;var y=requireNamespace();((M.prototype=Object.create(y.prototype)).constructor=M).className="Root";var u=requireField(),h=require_enum(),v=requireOneof(),w=requireUtil(),b,E,$;function M(N){y.call(this,"",N),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}M.fromJSON=function(H,te){return te||(te=new M),H.options&&te.setOptions(H.options),te.addJSON(H.nested).resolveAll()},M.prototype.resolvePath=w.path.resolve,M.prototype.fetch=w.fetch;function T(){}M.prototype.load=function N(H,te,fe){typeof te=="function"&&(fe=te,te=void 0);var ce=this;if(!fe)return w.asPromise(N,ce,H,te);var le=fe===T;function ie(Re,je){if(fe){if(le)throw Re;je&&je.resolveAll();var we=fe;fe=null,we(Re,je)}}function ge(Re){var je=Re.lastIndexOf("google/protobuf/");if(je>-1){var we=Re.substring(je);if(we in $)return we}return null}function pe(Re,je){try{if(w.isString(je)&&je.charAt(0)==="{"&&(je=JSON.parse(je)),!w.isString(je))ce.setOptions(je.options).addJSON(je.nested);else{E.filename=Re;var we=E(je,ce,te),D,q=0;if(we.imports)for(;q<we.imports.length;++q)(D=ge(we.imports[q])||ce.resolvePath(Re,we.imports[q]))&&Me(D);if(we.weakImports)for(q=0;q<we.weakImports.length;++q)(D=ge(we.weakImports[q])||ce.resolvePath(Re,we.weakImports[q]))&&Me(D,!0)}}catch(O){ie(O)}!le&&!$e&&ie(null,ce)}function Me(Re,je){if(Re=ge(Re)||Re,!(ce.files.indexOf(Re)>-1)){if(ce.files.push(Re),Re in $){le?pe(Re,$[Re]):(++$e,setTimeout(function(){--$e,pe(Re,$[Re])}));return}if(le){var we;try{we=w.fs.readFileSync(Re).toString("utf8")}catch(D){je||ie(D);return}pe(Re,we)}else++$e,ce.fetch(Re,function(D,q){if(--$e,!!fe){if(D){je?$e||ie(null,ce):ie(D);return}pe(Re,q)}})}}var $e=0;w.isString(H)&&(H=[H]);for(var Pe=0,Be;Pe<H.length;++Pe)(Be=ce.resolvePath("",H[Pe]))&&Me(Be);return le?(ce.resolveAll(),ce):($e||ie(null,ce),ce)},M.prototype.loadSync=function(H,te){if(!w.isNode)throw Error("not supported");return this.load(H,te,T)},M.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(H){return"'extend "+H.extend+"' in "+H.parent.fullName}).join(", "));return y.prototype.resolveAll.call(this)};var C=/^[A-Z]/;function B(N,H){var te=H.parent.lookup(H.extend);if(te){var fe=new u(H.fullName,H.id,H.type,H.rule,void 0,H.options);return te.get(fe.name)||(fe.declaringField=H,H.extensionField=fe,te.add(fe)),!0}return!1}return M.prototype._handleAdd=function(H){if(H instanceof u)H.extend!==void 0&&!H.extensionField&&(B(this,H)||this.deferred.push(H));else if(H instanceof h)C.test(H.name)&&(H.parent[H.name]=H.values);else if(!(H instanceof v)){if(H instanceof b)for(var te=0;te<this.deferred.length;)B(this,this.deferred[te])?this.deferred.splice(te,1):++te;for(var fe=0;fe<H.nestedArray.length;++fe)this._handleAdd(H._nestedArray[fe]);C.test(H.name)&&(H.parent[H.name]=H)}(H instanceof b||H instanceof h||H instanceof u)&&(this._fullyQualifiedObjects[H.fullName]=H)},M.prototype._handleRemove=function(H){if(H instanceof u){if(H.extend!==void 0)if(H.extensionField)H.extensionField.parent.remove(H.extensionField),H.extensionField=null;else{var te=this.deferred.indexOf(H);te>-1&&this.deferred.splice(te,1)}}else if(H instanceof h)C.test(H.name)&&delete H.parent[H.name];else if(H instanceof y){for(var fe=0;fe<H.nestedArray.length;++fe)this._handleRemove(H._nestedArray[fe]);C.test(H.name)&&delete H.parent[H.name]}delete this._fullyQualifiedObjects[H.fullName]},M._configure=function(N,H,te){b=N,E=H,$=te},root}var hasRequiredUtil;function requireUtil(){if(hasRequiredUtil)return util$2.exports;hasRequiredUtil=1;var y=util$2.exports=requireMinimal(),u=roots,h,v;y.codegen=codegen_1,y.fetch=fetch_1,y.path=path,y.fs=y.inquire("fs"),y.toArray=function(T){if(T){for(var C=Object.keys(T),B=new Array(C.length),N=0;N<C.length;)B[N]=T[C[N++]];return B}return[]},y.toObject=function(T){for(var C={},B=0;B<T.length;){var N=T[B++],H=T[B++];H!==void 0&&(C[N]=H)}return C};var w=/\\/g,b=/"/g;y.isReserved=function(T){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(T)},y.safeProp=function(T){return!/^[$\w_]+$/.test(T)||y.isReserved(T)?'["'+T.replace(w,"\\\\").replace(b,'\\"')+'"]':"."+T},y.ucFirst=function(T){return T.charAt(0).toUpperCase()+T.substring(1)};var E=/_([a-z])/g;y.camelCase=function(T){return T.substring(0,1)+T.substring(1).replace(E,function(C,B){return B.toUpperCase()})},y.compareFieldsById=function(T,C){return T.id-C.id},y.decorateType=function(T,C){if(T.$type)return C&&T.$type.name!==C&&(y.decorateRoot.remove(T.$type),T.$type.name=C,y.decorateRoot.add(T.$type)),T.$type;h||(h=requireType());var B=new h(C||T.name);return y.decorateRoot.add(B),B.ctor=T,Object.defineProperty(T,"$type",{value:B,enumerable:!1}),Object.defineProperty(T.prototype,"$type",{value:B,enumerable:!1}),B};var $=0;return y.decorateEnum=function(T){if(T.$type)return T.$type;v||(v=require_enum());var C=new v("Enum"+$++,T);return y.decorateRoot.add(C),Object.defineProperty(T,"$type",{value:C,enumerable:!1}),C},y.setProperty=function(T,C,B,N){function H(te,fe,ce){var le=fe.shift();if(le==="__proto__"||le==="prototype")return te;if(fe.length>0)te[le]=H(te[le]||{},fe,ce);else{var ie=te[le];if(ie&&N)return te;ie&&(ce=[].concat(ie).concat(ce)),te[le]=ce}return te}if(typeof T!="object")throw TypeError("dst must be an object");if(!C)throw TypeError("path must be specified");return C=C.split("."),H(T,C,B)},Object.defineProperty(y,"decorateRoot",{get:function(){return u.decorated||(u.decorated=new(requireRoot()))}}),util$2.exports}var hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(y){var u=y,h=requireUtil(),v=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function w(b,E){var $=0,M={};for(E|=0;$<b.length;)M[v[$+E]]=b[$++];return M}u.basic=w([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),u.defaults=w([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",h.emptyArray,null]),u.long=w([0,0,0,1,1],7),u.mapKey=w([0,0,0,5,5,0,0,0,1,1,0,2],2),u.packed=w([1,5,0,0,0,5,5,0,0,0,1,1,0])}(types$1)),types$1}var field,hasRequiredField;function requireField(){if(hasRequiredField)return field;hasRequiredField=1,field=E;var y=requireObject();((E.prototype=Object.create(y.prototype)).constructor=E).className="Field";var u=require_enum(),h=requireTypes(),v=requireUtil(),w,b=/^required|optional|repeated$/;E.fromJSON=function(M,T){var C=new E(M,T.id,T.type,T.rule,T.extend,T.options,T.comment);return T.edition&&(C._edition=T.edition),C._defaultEdition="proto3",C};function E($,M,T,C,B,N,H){if(v.isObject(C)?(H=B,N=C,C=B=void 0):v.isObject(B)&&(H=N,N=B,B=void 0),y.call(this,$,N),!v.isInteger(M)||M<0)throw TypeError("id must be a non-negative integer");if(!v.isString(T))throw TypeError("type must be a string");if(C!==void 0&&!b.test(C=C.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(B!==void 0&&!v.isString(B))throw TypeError("extend must be a string");C==="proto3_optional"&&(C="optional"),this.rule=C&&C!=="optional"?C:void 0,this.type=T,this.id=M,this.extend=B||void 0,this.repeated=C==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=v.Long?h.long[T]!==void 0:!1,this.bytes=T==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=H}return Object.defineProperty(E.prototype,"required",{get:function(){return this._features.field_presence==="LEGACY_REQUIRED"}}),Object.defineProperty(E.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(E.prototype,"delimited",{get:function(){return this.resolvedType instanceof w&&this._features.message_encoding==="DELIMITED"}}),Object.defineProperty(E.prototype,"packed",{get:function(){return this._features.repeated_field_encoding==="PACKED"}}),Object.defineProperty(E.prototype,"hasPresence",{get:function(){return this.repeated||this.map?!1:this.partOf||this.declaringField||this.extensionField||this._features.field_presence!=="IMPLICIT"}}),E.prototype.setOption=function(M,T,C){return y.prototype.setOption.call(this,M,T,C)},E.prototype.toJSON=function(M){var T=M?!!M.keepComments:!1;return v.toObject(["edition",this._editionToJSON(),"rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",T?this.comment:void 0])},E.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=h.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof w?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof u&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof u)&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=v.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var M;v.base64.test(this.typeDefault)?v.base64.decode(this.typeDefault,M=v.newBuffer(v.base64.length(this.typeDefault)),0):v.utf8.write(this.typeDefault,M=v.newBuffer(v.utf8.length(this.typeDefault)),0),this.typeDefault=M}return this.map?this.defaultValue=v.emptyObject:this.repeated?this.defaultValue=v.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof w&&(this.parent.ctor.prototype[this.name]=this.defaultValue),y.prototype.resolve.call(this)},E.prototype._inferLegacyProtoFeatures=function(M){if(M!=="proto2"&&M!=="proto3")return{};var T={};if(this.rule==="required"&&(T.field_presence="LEGACY_REQUIRED"),this.parent&&h.defaults[this.type]===void 0){var C=this.parent.get(this.type.split(".").pop());C&&C instanceof w&&C.group&&(T.message_encoding="DELIMITED")}return this.getOption("packed")===!0?T.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(T.repeated_field_encoding="EXPANDED"),T},E.prototype._resolveFeatures=function(M){return y.prototype._resolveFeatures.call(this,this._edition||M)},E.d=function(M,T,C,B){return typeof T=="function"?T=v.decorateType(T).name:T&&typeof T=="object"&&(T=v.decorateEnum(T).name),function(H,te){v.decorateType(H.constructor).add(new E(te,M,T,C,{default:B}))}},E._configure=function(M){w=M},field}var oneof,hasRequiredOneof;function requireOneof(){if(hasRequiredOneof)return oneof;hasRequiredOneof=1,oneof=v;var y=requireObject();((v.prototype=Object.create(y.prototype)).constructor=v).className="OneOf";var u=requireField(),h=requireUtil();function v(b,E,$,M){if(Array.isArray(E)||($=E,E=void 0),y.call(this,b,$),!(E===void 0||Array.isArray(E)))throw TypeError("fieldNames must be an Array");this.oneof=E||[],this.fieldsArray=[],this.comment=M}v.fromJSON=function(E,$){return new v(E,$.oneof,$.options,$.comment)},v.prototype.toJSON=function(E){var $=E?!!E.keepComments:!1;return h.toObject(["options",this.options,"oneof",this.oneof,"comment",$?this.comment:void 0])};function w(b){if(b.parent)for(var E=0;E<b.fieldsArray.length;++E)b.fieldsArray[E].parent||b.parent.add(b.fieldsArray[E])}return v.prototype.add=function(E){if(!(E instanceof u))throw TypeError("field must be a Field");return E.parent&&E.parent!==this.parent&&E.parent.remove(E),this.oneof.push(E.name),this.fieldsArray.push(E),E.partOf=this,w(this),this},v.prototype.remove=function(E){if(!(E instanceof u))throw TypeError("field must be a Field");var $=this.fieldsArray.indexOf(E);if($<0)throw Error(E+" is not a member of "+this);return this.fieldsArray.splice($,1),$=this.oneof.indexOf(E.name),$>-1&&this.oneof.splice($,1),E.partOf=null,this},v.prototype.onAdd=function(E){y.prototype.onAdd.call(this,E);for(var $=this,M=0;M<this.oneof.length;++M){var T=E.get(this.oneof[M]);T&&!T.partOf&&(T.partOf=$,$.fieldsArray.push(T))}w(this)},v.prototype.onRemove=function(E){for(var $=0,M;$<this.fieldsArray.length;++$)(M=this.fieldsArray[$]).parent&&M.parent.remove(M);y.prototype.onRemove.call(this,E)},Object.defineProperty(v.prototype,"isProto3Optional",{get:function(){if(this.fieldsArray==null||this.fieldsArray.length!==1)return!1;var b=this.fieldsArray[0];return b.options!=null&&b.options.proto3_optional===!0}}),v.d=function(){for(var E=new Array(arguments.length),$=0;$<arguments.length;)E[$]=arguments[$++];return function(T,C){h.decorateType(T.constructor).add(new v(C,E)),Object.defineProperty(T,C,{get:h.oneOfGetter(E),set:h.oneOfSetter(E)})}},oneof}var object,hasRequiredObject;function requireObject(){if(hasRequiredObject)return object;hasRequiredObject=1,object=E,E.className="ReflectionObject";const y=requireOneof();var u=requireUtil(),h,v={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},w={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},b={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function E($,M){if(!u.isString($))throw TypeError("name must be a string");if(M&&!u.isObject(M))throw TypeError("options must be an object");this.options=M,this.parsedOptions=null,this.name=$,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(E.prototype,{root:{get:function(){for(var $=this;$.parent!==null;)$=$.parent;return $}},fullName:{get:function(){for(var $=[this.name],M=this.parent;M;)$.unshift(M.name),M=M.parent;return $.join(".")}}}),E.prototype.toJSON=function(){throw Error()},E.prototype.onAdd=function(M){this.parent&&this.parent!==M&&this.parent.remove(this),this.parent=M,this.resolved=!1;var T=M.root;T instanceof h&&T._handleAdd(this)},E.prototype.onRemove=function(M){var T=M.root;T instanceof h&&T._handleRemove(this),this.parent=null,this.resolved=!1},E.prototype.resolve=function(){return this.resolved?this:(this.root instanceof h&&(this.resolved=!0),this)},E.prototype._resolveFeaturesRecursive=function(M){return this._resolveFeatures(this._edition||M)},E.prototype._resolveFeatures=function(M){if(!this._featuresResolved){var T={};if(!M)throw new Error("Unknown edition for "+this.fullName);var C=Object.assign(this.options?Object.assign({},this.options.features):{},this._inferLegacyProtoFeatures(M));if(this._edition){if(M==="proto2")T=Object.assign({},w);else if(M==="proto3")T=Object.assign({},b);else if(M==="2023")T=Object.assign({},v);else throw new Error("Unknown edition: "+M);this._features=Object.assign(T,C||{}),this._featuresResolved=!0;return}if(this.partOf instanceof y){var B=Object.assign({},this.partOf._features);this._features=Object.assign(B,C||{})}else if(!this.declaringField)if(this.parent){var N=Object.assign({},this.parent._features);this._features=Object.assign(N,C||{})}else throw new Error("Unable to find a parent for "+this.fullName);this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}},E.prototype._inferLegacyProtoFeatures=function(){return{}},E.prototype.getOption=function(M){if(this.options)return this.options[M]},E.prototype.setOption=function(M,T,C){return this.options||(this.options={}),/^features\./.test(M)?u.setProperty(this.options,M,T,C):(!C||this.options[M]===void 0)&&(this.getOption(M)!==T&&(this.resolved=!1),this.options[M]=T),this},E.prototype.setParsedOption=function(M,T,C){this.parsedOptions||(this.parsedOptions=[]);var B=this.parsedOptions;if(C){var N=B.find(function(fe){return Object.prototype.hasOwnProperty.call(fe,M)});if(N){var H=N[M];u.setProperty(H,C,T)}else N={},N[M]=u.setProperty({},C,T),B.push(N)}else{var te={};te[M]=T,B.push(te)}return this},E.prototype.setOptions=function(M,T){if(M)for(var C=Object.keys(M),B=0;B<C.length;++B)this.setOption(C[B],M[C[B]],T);return this},E.prototype.toString=function(){var M=this.constructor.className,T=this.fullName;return T.length?M+" "+T:M},E.prototype._editionToJSON=function(){if(!(!this._edition||this._edition==="proto3"))return this._edition},E._configure=function($){h=$},object}var _enum,hasRequired_enum;function require_enum(){if(hasRequired_enum)return _enum;hasRequired_enum=1,_enum=v;var y=requireObject();((v.prototype=Object.create(y.prototype)).constructor=v).className="Enum";var u=requireNamespace(),h=requireUtil();function v(w,b,E,$,M,T){if(y.call(this,w,E),b&&typeof b!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=$,this.comments=M||{},this.valuesOptions=T,this._valuesFeatures={},this.reserved=void 0,b)for(var C=Object.keys(b),B=0;B<C.length;++B)typeof b[C[B]]=="number"&&(this.valuesById[this.values[C[B]]=b[C[B]]]=C[B])}return v.prototype._resolveFeatures=function(b){return b=this._edition||b,y.prototype._resolveFeatures.call(this,b),Object.keys(this.values).forEach(E=>{var $=Object.assign({},this._features);this._valuesFeatures[E]=Object.assign($,this.valuesOptions&&this.valuesOptions[E]&&this.valuesOptions[E].features)}),this},v.fromJSON=function(b,E){var $=new v(b,E.values,E.options,E.comment,E.comments);return $.reserved=E.reserved,E.edition&&($._edition=E.edition),$._defaultEdition="proto3",$},v.prototype.toJSON=function(b){var E=b?!!b.keepComments:!1;return h.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",E?this.comment:void 0,"comments",E?this.comments:void 0])},v.prototype.add=function(b,E,$,M){if(!h.isString(b))throw TypeError("name must be a string");if(!h.isInteger(E))throw TypeError("id must be an integer");if(this.values[b]!==void 0)throw Error("duplicate name '"+b+"' in "+this);if(this.isReservedId(E))throw Error("id "+E+" is reserved in "+this);if(this.isReservedName(b))throw Error("name '"+b+"' is reserved in "+this);if(this.valuesById[E]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+E+" in "+this);this.values[b]=E}else this.valuesById[this.values[b]=E]=b;return M&&(this.valuesOptions===void 0&&(this.valuesOptions={}),this.valuesOptions[b]=M||null),this.comments[b]=$||null,this},v.prototype.remove=function(b){if(!h.isString(b))throw TypeError("name must be a string");var E=this.values[b];if(E==null)throw Error("name '"+b+"' does not exist in "+this);return delete this.valuesById[E],delete this.values[b],delete this.comments[b],this.valuesOptions&&delete this.valuesOptions[b],this},v.prototype.isReservedId=function(b){return u.isReservedId(this.reserved,b)},v.prototype.isReservedName=function(b){return u.isReservedName(this.reserved,b)},_enum}var encoder_1,hasRequiredEncoder;function requireEncoder(){if(hasRequiredEncoder)return encoder_1;hasRequiredEncoder=1,encoder_1=w;var y=require_enum(),u=requireTypes(),h=requireUtil();function v(b,E,$,M){return E.delimited?b("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",$,M,(E.id<<3|3)>>>0,(E.id<<3|4)>>>0):b("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",$,M,(E.id<<3|2)>>>0)}function w(b){for(var E=h.codegen(["m","w"],b.name+"$encode")("if(!w)")("w=Writer.create()"),$,M,T=b.fieldsArray.slice().sort(h.compareFieldsById),$=0;$<T.length;++$){var C=T[$].resolve(),B=b._fieldsArray.indexOf(C),N=C.resolvedType instanceof y?"int32":C.type,H=u.basic[N];M="m"+h.safeProp(C.name),C.map?(E("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",M,C.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",M)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(C.id<<3|2)>>>0,8|u.mapKey[C.keyType],C.keyType),H===void 0?E("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",B,M):E(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|H,N,M),E("}")("}")):C.repeated?(E("if(%s!=null&&%s.length){",M,M),C.packed&&u.packed[N]!==void 0?E("w.uint32(%i).fork()",(C.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",M)("w.%s(%s[i])",N,M)("w.ldelim()"):(E("for(var i=0;i<%s.length;++i)",M),H===void 0?v(E,C,B,M+"[i]"):E("w.uint32(%i).%s(%s[i])",(C.id<<3|H)>>>0,N,M)),E("}")):(C.optional&&E("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",M,C.name),H===void 0?v(E,C,B,M):E("w.uint32(%i).%s(%s)",(C.id<<3|H)>>>0,N,M))}return E("return w")}return encoder_1}var protobuf$2=indexLight.exports=indexMinimal;protobuf$2.build="light";function load(y,u,h){return typeof u=="function"?(h=u,u=new protobuf$2.Root):u||(u=new protobuf$2.Root),u.load(y,h)}protobuf$2.load=load;function loadSync(y,u){return u||(u=new protobuf$2.Root),u.loadSync(y)}protobuf$2.loadSync=loadSync,protobuf$2.encoder=requireEncoder(),protobuf$2.decoder=requireDecoder(),protobuf$2.verifier=requireVerifier(),protobuf$2.converter=requireConverter(),protobuf$2.ReflectionObject=requireObject(),protobuf$2.Namespace=requireNamespace(),protobuf$2.Root=requireRoot(),protobuf$2.Enum=require_enum(),protobuf$2.Type=requireType(),protobuf$2.Field=requireField(),protobuf$2.OneOf=requireOneof(),protobuf$2.MapField=requireMapfield(),protobuf$2.Service=requireService(),protobuf$2.Method=requireMethod(),protobuf$2.Message=message,protobuf$2.wrappers=wrappers,protobuf$2.types=requireTypes(),protobuf$2.util=requireUtil(),protobuf$2.ReflectionObject._configure(protobuf$2.Root),protobuf$2.Namespace._configure(protobuf$2.Type,protobuf$2.Service,protobuf$2.Enum),protobuf$2.Root._configure(protobuf$2.Type),protobuf$2.Field._configure(protobuf$2.Type);var indexLightExports=indexLight.exports,tokenize_1=tokenize$1,delimRe=/[\s{}=;:[\],'"()<>]/g,stringDoubleRe=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,stringSingleRe=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,setCommentRe=/^ *[*/]+ */,setCommentAltRe=/^\s*\*?\/*/,setCommentSplitRe=/\n/g,whitespaceRe=/\s/,unescapeRe=/\\(.?)/g,unescapeMap={0:"\0",r:"\r",n:`
|
|
61
|
-
`,t:" "};function unescape(y){return y.replace(unescapeRe,function(u,h){switch(h){case"\\":case"":return h;default:return unescapeMap[h]||""}})}tokenize$1.unescape=unescape;function tokenize$1(y,u){y=y.toString();var h=0,v=y.length,w=1,b=0,E={},$=[],M=null;function T(pe){return Error("illegal "+pe+" (line "+w+")")}function C(){var pe=M==="'"?stringSingleRe:stringDoubleRe;pe.lastIndex=h-1;var Me=pe.exec(y);if(!Me)throw T("string");return h=pe.lastIndex,ce(M),M=null,unescape(Me[1])}function B(pe){return y.charAt(pe)}function N(pe,Me,$e){var Pe={type:y.charAt(pe++),lineEmpty:!1,leading:$e},Be;u?Be=2:Be=3;var Re=pe-Be,je;do if(--Re<0||(je=y.charAt(Re))===`
|
|
62
|
-
`){Pe.lineEmpty=!0;break}while(je===" "||je===" ");for(var we=y.substring(pe,Me).split(setCommentSplitRe),D=0;D<we.length;++D)we[D]=we[D].replace(u?setCommentAltRe:setCommentRe,"").trim();Pe.text=we.join(`
|
|
63
|
-
`).trim(),E[w]=Pe,b=w}function H(pe){var Me=te(pe),$e=y.substring(pe,Me),Pe=/^\s*\/\//.test($e);return Pe}function te(pe){for(var Me=pe;Me<v&&B(Me)!==`
|
|
64
|
-
`;)Me++;return Me}function fe(){if($.length>0)return $.shift();if(M)return C();var pe,Me,$e,Pe,Be,Re=h===0;do{if(h===v)return null;for(pe=!1;whitespaceRe.test($e=B(h));)if($e===`
|
|
65
|
-
`&&(Re=!0,++w),++h===v)return null;if(B(h)==="/"){if(++h===v)throw T("comment");if(B(h)==="/")if(u){if(Pe=h,Be=!1,H(h-1)){Be=!0;do if(h=te(h),h===v||(h++,!Re))break;while(H(h))}else h=Math.min(v,te(h)+1);Be&&(N(Pe,h,Re),Re=!0),w++,pe=!0}else{for(Be=B(Pe=h+1)==="/";B(++h)!==`
|
|
66
|
-
`;)if(h===v)return null;++h,Be&&(N(Pe,h-1,Re),Re=!0),++w,pe=!0}else if(($e=B(h))==="*"){Pe=h+1,Be=u||B(Pe)==="*";do{if($e===`
|
|
67
|
-
`&&++w,++h===v)throw T("comment");Me=$e,$e=B(h)}while(Me!=="*"||$e!=="/");++h,Be&&(N(Pe,h-2,Re),Re=!0),pe=!0}else return"/"}}while(pe);var je=h;delimRe.lastIndex=0;var we=delimRe.test(B(je++));if(!we)for(;je<v&&!delimRe.test(B(je));)++je;var D=y.substring(h,h=je);return(D==='"'||D==="'")&&(M=D),D}function ce(pe){$.push(pe)}function le(){if(!$.length){var pe=fe();if(pe===null)return null;ce(pe)}return $[0]}function ie(pe,Me){var $e=le(),Pe=$e===pe;if(Pe)return fe(),!0;if(!Me)throw T("token '"+$e+"', '"+pe+"' expected");return!1}function ge(pe){var Me=null,$e;return pe===void 0?($e=E[w-1],delete E[w-1],$e&&(u||$e.type==="*"||$e.lineEmpty)&&(Me=$e.leading?$e.text:null)):(b<pe&&le(),$e=E[pe],delete E[pe],$e&&!$e.lineEmpty&&(u||$e.type==="/")&&(Me=$e.leading?null:$e.text)),Me}return Object.defineProperty({next:fe,peek:le,push:ce,skip:ie,cmnt:ge},"line",{get:function(){return w}})}var parse_1=parse;parse.filename=null,parse.defaults={keepCase:!1};var tokenize=tokenize_1,Root=requireRoot(),Type=requireType(),Field=requireField(),MapField=requireMapfield(),OneOf=requireOneof(),Enum=require_enum(),Service=requireService(),Method=requireMethod(),ReflectionObject=requireObject(),types=requireTypes(),util=requireUtil(),base10Re=/^[1-9][0-9]*$/,base10NegRe=/^-?[1-9][0-9]*$/,base16Re=/^0[x][0-9a-fA-F]+$/,base16NegRe=/^-?0[x][0-9a-fA-F]+$/,base8Re=/^0[0-7]+$/,base8NegRe=/^-?0[0-7]+$/,numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,nameRe=/^[a-zA-Z_][a-zA-Z_0-9]*$/,typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;function parse(y,u,h){u instanceof Root||(h=u,u=new Root),h||(h=parse.defaults);var v=h.preferTrailingComment||!1,w=tokenize(y,h.alternateCommentMode||!1),b=w.next,E=w.push,$=w.peek,M=w.skip,T=w.cmnt,C=!0,B,N,H,te="proto2",fe=u,ce=[],le={},ie=h.keepCase?function(ne){return ne}:util.camelCase;function ge(){ce.forEach(ne=>{ne._edition=te,Object.keys(le).forEach(be=>{ne.getOption(be)===void 0&&ne.setOption(be,le[be],!0)})})}function pe(ne,be,Ie){var Le=parse.filename;return Ie||(parse.filename=null),Error("illegal "+(be||"token")+" '"+ne+"' ("+(Le?Le+", ":"")+"line "+w.line+")")}function Me(){var ne=[],be;do{if((be=b())!=='"'&&be!=="'")throw pe(be);ne.push(b()),M(be),be=$()}while(be==='"'||be==="'");return ne.join("")}function $e(ne){var be=b();switch(be){case"'":case'"':return E(be),Me();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return Be(be,!0)}catch{if(typeRefRe.test(be))return be;throw pe(be,"value")}}function Pe(ne,be){var Ie,Le;do if(be&&((Ie=$())==='"'||Ie==="'")){var Fe=Me();if(ne.push(Fe),te>=2023)throw pe(Fe,"id")}else try{ne.push([Le=Re(b()),M("to",!0)?Re(b()):Le])}catch(tt){if(be&&typeRefRe.test(Ie)&&te>=2023)ne.push(Ie);else throw tt}while(M(",",!0));var He={options:void 0};He.setOption=function(tt,Ne){this.options===void 0&&(this.options={}),this.options[tt]=Ne},L(He,function(Ne){if(Ne==="option")he(He,Ne),M(";");else throw pe(Ne)},function(){oe(He)})}function Be(ne,be){var Ie=1;switch(ne.charAt(0)==="-"&&(Ie=-1,ne=ne.substring(1)),ne){case"inf":case"INF":case"Inf":return Ie*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(base10Re.test(ne))return Ie*parseInt(ne,10);if(base16Re.test(ne))return Ie*parseInt(ne,16);if(base8Re.test(ne))return Ie*parseInt(ne,8);if(numberRe.test(ne))return Ie*parseFloat(ne);throw pe(ne,"number",be)}function Re(ne,be){switch(ne){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!be&&ne.charAt(0)==="-")throw pe(ne,"id");if(base10NegRe.test(ne))return parseInt(ne,10);if(base16NegRe.test(ne))return parseInt(ne,16);if(base8NegRe.test(ne))return parseInt(ne,8);throw pe(ne,"id")}function je(){if(B!==void 0)throw pe("package");if(B=b(),!typeRefRe.test(B))throw pe(B,"name");fe=fe.define(B),M(";")}function we(){var ne=$(),be;switch(ne){case"weak":be=H||(H=[]),b();break;case"public":b();default:be=N||(N=[]);break}ne=Me(),M(";"),be.push(ne)}function D(){if(M("="),te=Me(),te<2023)throw pe(te,"syntax");M(";")}function q(){if(M("="),te=Me(),!["2023"].includes(te))throw pe(te,"edition");M(";")}function O(ne,be){switch(be){case"option":return he(ne,be),M(";"),!0;case"message":return X(ne,be),!0;case"enum":return Q(ne,be),!0;case"service":return ye(ne,be),!0;case"extend":return ae(ne,be),!0}return!1}function L(ne,be,Ie){var Le=w.line;if(ne&&(typeof ne.comment!="string"&&(ne.comment=T()),ne.filename=parse.filename),M("{",!0)){for(var Fe;(Fe=b())!=="}";)be(Fe);M(";",!0)}else Ie&&Ie(),M(";"),ne&&(typeof ne.comment!="string"||v)&&(ne.comment=T(Le)||ne.comment)}function X(ne,be){if(!nameRe.test(be=b()))throw pe(be,"type name");var Ie=new Type(be);L(Ie,function(Fe){if(!O(Ie,Fe))switch(Fe){case"map":ee(Ie);break;case"required":if(te!=="proto2")throw pe(Fe);case"repeated":j(Ie,Fe);break;case"optional":if(te==="proto3")j(Ie,"proto3_optional");else{if(te!=="proto2")throw pe(Fe);j(Ie,"optional")}break;case"oneof":F(Ie,Fe);break;case"extensions":Pe(Ie.extensions||(Ie.extensions=[]));break;case"reserved":Pe(Ie.reserved||(Ie.reserved=[]),!0);break;default:if(te==="proto2"||!typeRefRe.test(Fe))throw pe(Fe);E(Fe),j(Ie,"optional");break}}),ne.add(Ie),ne===fe&&ce.push(Ie)}function j(ne,be,Ie){var Le=b();if(Le==="group"){re(ne,be);return}for(;Le.endsWith(".")||$().startsWith(".");)Le+=b();if(!typeRefRe.test(Le))throw pe(Le,"type");var Fe=b();if(!nameRe.test(Fe))throw pe(Fe,"name");Fe=ie(Fe),M("=");var He=new Field(Fe,Re(b()),Le,be,Ie);if(L(He,function(nt){if(nt==="option")he(He,nt),M(";");else throw pe(nt)},function(){oe(He)}),be==="proto3_optional"){var tt=new OneOf("_"+Fe);He.setOption("proto3_optional",!0),tt.add(He),ne.add(tt)}else ne.add(He);ne===fe&&ce.push(He)}function re(ne,be){if(te>=2023)throw pe("group");var Ie=b();if(!nameRe.test(Ie))throw pe(Ie,"name");var Le=util.lcFirst(Ie);Ie===Le&&(Ie=util.ucFirst(Ie)),M("=");var Fe=Re(b()),He=new Type(Ie);He.group=!0;var tt=new Field(Le,Fe,Ie,be);tt.filename=parse.filename,L(He,function(nt){switch(nt){case"option":he(He,nt),M(";");break;case"required":case"repeated":j(He,nt);break;case"optional":te==="proto3"?j(He,"proto3_optional"):j(He,"optional");break;case"message":X(He,nt);break;case"enum":Q(He,nt);break;case"reserved":Pe(He.reserved||(He.reserved=[]),!0);break;default:throw pe(nt)}}),ne.add(He).add(tt)}function ee(ne){M("<");var be=b();if(types.mapKey[be]===void 0)throw pe(be,"type");M(",");var Ie=b();if(!typeRefRe.test(Ie))throw pe(Ie,"type");M(">");var Le=b();if(!nameRe.test(Le))throw pe(Le,"name");M("=");var Fe=new MapField(ie(Le),Re(b()),be,Ie);L(Fe,function(tt){if(tt==="option")he(Fe,tt),M(";");else throw pe(tt)},function(){oe(Fe)}),ne.add(Fe)}function F(ne,be){if(!nameRe.test(be=b()))throw pe(be,"name");var Ie=new OneOf(ie(be));L(Ie,function(Fe){Fe==="option"?(he(Ie,Fe),M(";")):(E(Fe),j(Ie,"optional"))}),ne.add(Ie)}function Q(ne,be){if(!nameRe.test(be=b()))throw pe(be,"name");var Ie=new Enum(be);L(Ie,function(Fe){switch(Fe){case"option":he(Ie,Fe),M(";");break;case"reserved":Pe(Ie.reserved||(Ie.reserved=[]),!0),Ie.reserved===void 0&&(Ie.reserved=[]);break;default:U(Ie,Fe)}}),ne.add(Ie),ne===fe&&ce.push(Ie)}function U(ne,be){if(!nameRe.test(be))throw pe(be,"name");M("=");var Ie=Re(b(),!0),Le={options:void 0};Le.getOption=function(Fe){return this.options[Fe]},Le.setOption=function(Fe,He){ReflectionObject.prototype.setOption.call(Le,Fe,He)},Le.setParsedOption=function(){},L(Le,function(He){if(He==="option")he(Le,He),M(";");else throw pe(He)},function(){oe(Le)}),ne.add(be,Ie,Le.comment,Le.parsedOptions||Le.options)}function he(ne,be){var Ie,Le,Fe=!0;for(be==="option"&&(be=b());be!=="=";){if(be==="("){var He=b();M(")"),be="("+He+")"}if(Fe){if(Fe=!1,be.includes(".")&&!be.includes("(")){var tt=be.split(".");Ie=tt[0]+".",be=tt[1];continue}Ie=be}else Le=Le?Le+=be:be;be=b()}var Ne=Le?Ie.concat(Le):Ie,nt=Oe(ne,Ne);Le=Le&&Le[0]==="."?Le.slice(1):Le,Ie=Ie&&Ie[Ie.length-1]==="."?Ie.slice(0,-1):Ie,Ae(ne,Ie,nt,Le)}function Oe(ne,be){if(M("{",!0)){for(var Ie={};!M("}",!0);){if(!nameRe.test(de=b()))throw pe(de,"name");if(de===null)throw pe(de,"end of input");var Le,Fe=de;if(M(":",!0),$()==="{")Le=Oe(ne,be+"."+de);else if($()==="["){Le=[];var He;if(M("[",!0)){do He=$e(),Le.push(He);while(M(",",!0));M("]"),typeof He<"u"&&Ve(ne,be+"."+de,He)}}else Le=$e(),Ve(ne,be+"."+de,Le);var tt=Ie[Fe];tt&&(Le=[].concat(tt).concat(Le)),Ie[Fe]=Le,M(",",!0),M(";",!0)}return Ie}var Ne=$e();return Ve(ne,be,Ne),Ne}function Ve(ne,be,Ie){if(fe===ne&&/^features\./.test(be)){le[be]=Ie;return}ne.setOption&&ne.setOption(be,Ie)}function Ae(ne,be,Ie,Le){ne.setParsedOption&&ne.setParsedOption(be,Ie,Le)}function oe(ne){if(M("[",!0)){do he(ne,"option");while(M(",",!0));M("]")}return ne}function ye(ne,be){if(!nameRe.test(be=b()))throw pe(be,"service name");var Ie=new Service(be);L(Ie,function(Fe){if(!O(Ie,Fe))if(Fe==="rpc")Ce(Ie,Fe);else throw pe(Fe)}),ne.add(Ie),ne===fe&&ce.push(Ie)}function Ce(ne,be){var Ie=T(),Le=be;if(!nameRe.test(be=b()))throw pe(be,"name");var Fe=be,He,tt,Ne,nt;if(M("("),M("stream",!0)&&(tt=!0),!typeRefRe.test(be=b())||(He=be,M(")"),M("returns"),M("("),M("stream",!0)&&(nt=!0),!typeRefRe.test(be=b())))throw pe(be);Ne=be,M(")");var it=new Method(Fe,Le,He,Ne,tt,nt);it.comment=Ie,L(it,function(ut){if(ut==="option")he(it,ut),M(";");else throw pe(ut)}),ne.add(it)}function ae(ne,be){if(!typeRefRe.test(be=b()))throw pe(be,"reference");var Ie=be;L(null,function(Fe){switch(Fe){case"required":case"repeated":j(ne,Fe,Ie);break;case"optional":te==="proto3"?j(ne,"proto3_optional",Ie):j(ne,"optional",Ie);break;default:if(te==="proto2"||!typeRefRe.test(Fe))throw pe(Fe);E(Fe),j(ne,"optional",Ie);break}})}for(var de;(de=b())!==null;)switch(de){case"package":if(!C)throw pe(de);je();break;case"import":if(!C)throw pe(de);we();break;case"syntax":if(!C)throw pe(de);D();break;case"edition":if(!C)throw pe(de);q();break;case"option":he(fe,de),M(";",!0);break;default:if(O(fe,de)){C=!1;continue}throw pe(de)}return ge(),parse.filename=null,{package:B,imports:N,weakImports:H,root:u}}var common_1=common,commonRe=/\/|\./;function common(y,u){commonRe.test(y)||(y="google/protobuf/"+y+".proto",u={nested:{google:{nested:{protobuf:{nested:u}}}}}),common[y]=u}common("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var timeType;common("duration",{Duration:timeType={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),common("timestamp",{Timestamp:timeType}),common("empty",{Empty:{fields:{}}}),common("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),common("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),common("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),common.get=function y(u){return common[u]||null};var protobuf$1=src.exports=indexLightExports;protobuf$1.build="full",protobuf$1.tokenize=tokenize_1,protobuf$1.parse=parse_1,protobuf$1.common=common_1,protobuf$1.Root._configure(protobuf$1.Type,protobuf$1.parse,protobuf$1.common);var srcExports=src.exports,protobufjs=srcExports;const protobuf=getDefaultExportFromCjs$1(protobufjs);class Waku{constructor(u,h,v){this.node=u,this.chatTopic=h,this.onMessage=v,this.logger=Logger$1.getInstance(),this.errorHandler=ErrorHandler.getInstance(),this.reliableChannel=null,this.decoder=null,this.messagePayloadType=null,this.messageReceivedListener=null,this.senderId=crypto$1.randomBytes(8).toString("hex"),this.handleMessageReceived=async({payload:w})=>{try{if(!w){this.logger.warn("Received Waku message without payload");return}if(!this.messagePayloadType)throw new Error("Protobuf schema not initialized");const b=this.messagePayloadType.decode(w),E=this.messagePayloadType.toObject(b,{longs:String,enums:String,defaults:!0});if(!E.message){this.logger.warn("Decoded object has no message field");return}let $=E.message.additionalProps;if($&&typeof $=="string")try{$=JSON.parse($)}catch{this.logger.warn("Failed to parse additionalProps as JSON:",$)}const M={...E.message,timestamp:Number(E.message.timestamp),additionalProps:$};if(!(M!=null&&M.id)){this.logger.warn("Received invalid message structure via Waku");return}this.onMessage(M)}catch(b){this.errorHandler.handleError(b,"Waku2.handleMessageReceived")}}}async start(){this.createProtobufSchema(),await this.createChannel()}createProtobufSchema(){const u=new protobuf.Type("MessageData").add(new protobuf.Field("id",1,"string")).add(new protobuf.Field("targetMessageId",2,"string","optional")).add(new protobuf.Field("type",3,"string")).add(new protobuf.Field("message",4,"string")).add(new protobuf.Field("username",5,"string")).add(new protobuf.Field("address",6,"string")).add(new protobuf.Field("timestamp",7,"uint64")).add(new protobuf.Field("signature",8,"string")).add(new protobuf.Field("index",9,"uint32")).add(new protobuf.Field("chatTopic",10,"string")).add(new protobuf.Field("userTopic",11,"string")).add(new protobuf.Field("additionalProps",12,"string","optional")),h=new protobuf.Type("MessageStateRef").add(new protobuf.Field("reference",1,"string")).add(new protobuf.Field("timestamp",2,"uint64"));this.messagePayloadType=new protobuf.Type("MessagePayload").add(u).add(h).add(new protobuf.Field("message",1,"MessageData")).add(new protobuf.Field("messageStateRefs",2,"MessageStateRef","repeated")),this.logger.info("Protobuf schema created for chat messages")}async createChannel(){if(!this.node)throw new Error("Waku node not initialized");const u=`/solarpunk-msrs-chat/1/${this.chatTopic}/proto`,h=`chat-channel-${this.chatTopic}`,v=this.node.createEncoder({contentTopic:u}),w=this.decoder=this.node.createDecoder({contentTopic:u});this.reliableChannel=await ReliableChannel.create(this.node,h,this.senderId,v,w,{retrieveFrequencyMs:3e3,queryOnConnect:!1}),this.setupChannelEventListeners(this.reliableChannel),this.logger.info(`Created reliable channel for topic: ${this.chatTopic}`)}setupChannelEventListeners(u){this.messageReceivedListener=h=>{this.handleMessageReceived(h.detail)},u.addEventListener("message-received",this.messageReceivedListener)}async stop(){this.reliableChannel&&this.messageReceivedListener&&this.decoder&&(this.reliableChannel.removeEventListener("message-received",this.messageReceivedListener),this.messageReceivedListener=null,await this.reliableChannel.stop(),this.logger.info("Waku reliable channel stopped"))}}class SwarmChat{constructor(u){this.waku=null,this.isStarted=!1,this.startPromise=null,this.logger=Logger$1.getInstance(),this.errorHandler=ErrorHandler.getInstance(),this.gsocIndex=null,this.fetchProcessRunning=!1,this.stopFetch=!1;const h=new beeJs.PrivateKey(remove0x(u.user.privateKey));this.userDetails={privateKey:u.user.privateKey,ownAddress:h.publicKey().address().toString(),nickname:u.user.nickname,ownIndex:-1},this.swarmSettings={bee:new beeJs.Bee(u.infra.beeUrl),beeUrl:u.infra.beeUrl,stamp:u.infra.stamp||"0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",enveloped:u.infra.enveloped,gsocTopic:u.infra.gsocTopic,gsocResourceId:u.infra.gsocResourceId,chatTopic:u.infra.chatTopic,chatAddress:u.infra.chatAddress,wakuNode:u.infra.wakuNode},this.emitter=new EventEmitter$2,this.utils=new SwarmChatUtils(this.userDetails,this.swarmSettings),this.history=new SwarmHistory(this.utils,this.emitter)}async start(){await this.init(),await this.startMessageFetchProcess()}async startMessageFetchProcess(){const{wakuNode:u}=this.swarmSettings;u?await this.startWakuMessageFetch(u):await this.startPollingMessageFetch()}async stop(){this.emitter.cleanAll(),this.stopPollingMessageFetch(),this.history.cleanup(),this.waku&&(await this.waku.stop(),this.waku=null)}async startWakuMessageFetch(u){this.logger.info("Waku is enabled");const h=this.swarmSettings.chatTopic;this.waku=new Waku(u,h,v=>{this.emitter.emit(EVENTS.MESSAGE_RECEIVED,v)}),await this.waku.start()}getEmitter(){return this.emitter}orderMessages(u){return this.utils.orderMessages(u)}async sendMessage(u,h,v,w,b){const E=this.userDetails.ownIndex===-1?0:this.userDetails.ownIndex+1,$={id:w||v4(),username:this.userDetails.nickname,address:this.userDetails.ownAddress,chatTopic:this.swarmSettings.chatTopic,userTopic:this.utils.generateUserOwnedFeedId(this.swarmSettings.chatTopic,this.userDetails.ownAddress),signature:this.getSignature(u),timestamp:Date.now(),index:E,type:h,targetMessageId:v,message:u,additionalProps:b},M=validateMessageWithAdditionalProperties($);if(!M.isValid){const T=`Invalid message: ${M.errors.join(", ")}`;throw this.logger.error(T),new Error(T)}try{this.emitter.emit(EVENTS.MESSAGE_REQUEST_INITIATED,$),await this.utils.writeOwnFeedDataByIndex(E,JSON.stringify($)),this.userDetails.ownIndex=E,this.emitter.emit(EVENTS.MESSAGE_REQUEST_UPLOADED,$),await this.broadcastUserMessage($)}catch(T){this.emitter.emit(EVENTS.MESSAGE_REQUEST_ERROR,$),this.errorHandler.handleError(T,"Chat.sendMessage")}}async fetchPreviousMessages(){try{return this.emitter.emit(EVENTS.LOADING_PREVIOUS_MESSAGES,!0),await this.history.fetchPreviousMessageState()}finally{this.emitter.emit(EVENTS.LOADING_PREVIOUS_MESSAGES,!1)}}hasPreviousMessages(){return this.history.hasPreviousMessages()}async retrySendMessage(u){this.sendMessage(u.message,u.type,u.targetMessageId,u.id,u.additionalProps)}async retryBroadcastUserMessage(u){await this.broadcastUserMessage(u)}async init(){try{this.emitter.emit(EVENTS.LOADING_INIT,!0);const[u,h]=await Promise.allSettled([this.initOwnIndex(),this.history.init()]);if(u.status==="rejected")throw u.reason;h.status==="fulfilled"&&(this.gsocIndex=h.value),this.emitter.emit(EVENTS.LOADING_INIT,!1)}catch(u){this.errorHandler.handleError(u,"Chat.initSelfState"),this.emitter.emit(EVENTS.CRITICAL_ERROR,u)}}async initOwnIndex(){const{latestIndex:v}=await retryAwaitableAsync(()=>this.utils.getOwnLatestFeedIndex(),10,1e3);this.userDetails.ownIndex=v}async fetchLatestMessage(){try{if(!this.gsocIndex)return;const u=beeJs.Topic.fromString(this.swarmSettings.chatTopic),h=makeFeedIdentifier(u,this.gsocIndex),v=await this.utils.rawSocDownload(this.swarmSettings.chatAddress,h.toString()),w=JSON.parse(v);if(!validateGsocMessage(w)){this.logger.warn("Invalid GSOC message during fetching");return}this.emitter.emit(EVENTS.MESSAGE_RECEIVED,w.message),this.gsocIndex=this.gsocIndex.next()}catch(u){if(this.utils.isNotFoundError(u))return;this.errorHandler.handleError(u,"Chat.fetchLatestMessage")}}async broadcastUserMessage(u){try{return retryAwaitableAsync(()=>this.utils.sendMessageToGsoc(JSON.stringify(u)))}catch(h){this.errorHandler.handleError(h,"Chat.broadcastUserMessage")}}getSignature(u){const{ownAddress:h,privateKey:v,nickname:w}=this.userDetails,b=new beeJs.EthAddress(h).toString(),E=new beeJs.PrivateKey(v);if(E.publicKey().address().toString()!==b)throw new Error("The provided address does not match the address derived from the private key");const M=Date.now();return E.sign(JSON.stringify({username:w,address:b,message:u,timestamp:M})).toHex()}async startPollingMessageFetch(){if(this.fetchProcessRunning)return;this.fetchProcessRunning=!0,this.stopFetch=!1;const u=async()=>{if(this.stopFetch){this.fetchProcessRunning=!1;return}await this.fetchLatestMessage(),setTimeout(u,200)};u()}stopPollingMessageFetch(){this.stopFetch=!0}}exports.EVENTS=EVENTS,exports.MessageType=MessageType,exports.SwarmChat=SwarmChat,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(Q,A){typeof exports=="object"&&typeof module<"u"?A(exports,require("@ethersphere/bee-js")):typeof define=="function"&&define.amd?define(["exports","@ethersphere/bee-js"],A):(Q=typeof globalThis<"u"?globalThis:Q||self,A(Q.SwarmChatJs={},Q.BeeJs))})(this,function(Q,A){"use strict";const Z=[];for(let a=0;a<256;++a)Z.push((a+256).toString(16).slice(1));function _i(a,r=0){return(Z[a[r+0]]+Z[a[r+1]]+Z[a[r+2]]+Z[a[r+3]]+"-"+Z[a[r+4]]+Z[a[r+5]]+"-"+Z[a[r+6]]+Z[a[r+7]]+"-"+Z[a[r+8]]+Z[a[r+9]]+"-"+Z[a[r+10]]+Z[a[r+11]]+Z[a[r+12]]+Z[a[r+13]]+Z[a[r+14]]+Z[a[r+15]]).toLowerCase()}let Ht;const xi=new Uint8Array(16);function ki(){if(!Ht){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ht=crypto.getRandomValues.bind(crypto)}return Ht(xi)}const $n={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ei(a,r,i){if($n.randomUUID&&!r&&!a)return $n.randomUUID();a=a||{};const c=a.random||(a.rng||ki)();return c[6]=c[6]&15|64,c[8]=c[8]&63|128,_i(c)}class q{constructor(){}static getInstance(){return q.instance||(q.instance=new q),q.instance}formatMessage(r,...i){return`[${new Date().toISOString()}] [${r.toUpperCase()}] - ${i.map(u=>typeof u=="object"?JSON.stringify(u):u).join(" ")}`}log(...r){console.log(this.formatMessage("log",...r))}info(...r){console.info(this.formatMessage("info",...r))}warn(...r){console.warn(this.formatMessage("warn",...r))}error(...r){console.error(this.formatMessage("error",...r))}debug(...r){console.debug(this.formatMessage("debug",...r))}}class X{constructor(){this.logger=q.getInstance()}static getInstance(){return X.instance||(X.instance=new X),X.instance}handleError(r,i){const c=r instanceof Error?r.message:"Unknown error occurred",u=r instanceof Error?r.stack:null;this.logger.error(`Error in ${i||"unknown context"}: ${c}`,{stack:u})}}class Rn{constructor(r){this.config=r,this.logger=q.getInstance(),this.errorHandler=X.getInstance(),this.isRunning=!1,this.stopRequested=!1,this.messageCallback=null}onMessage(r){this.messageCallback=r}async start(){if(this.isRunning){this.logger.warn("Polling transport already running");return}this.isRunning=!0,this.stopRequested=!1,this.logger.info("Starting polling transport"),await this.poll()}async stop(){this.logger.info("Stopping polling transport"),this.stopRequested=!0,this.isRunning=!1}async poll(){if(this.stopRequested){this.isRunning=!1;return}try{const i=await this.config.fetchMessage();i&&this.messageCallback&&this.messageCallback(i)}catch(i){this.errorHandler.handleError(i,"PollingTransport.poll")}const r=this.config.pollingInterval||1e3;setTimeout(()=>this.poll(),r)}}function Si(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Cn={};(function(a){var r;Object.defineProperty(a,"__esModule",{value:!0}),a.Vector=a.Cache=a.Assertions=a.Strings=a.Types=a.Objects=a.Dates=a.Promises=a.Numbers=a.System=a.Arrays=a.Random=a.Elliptic=a.Binary=a.AsyncQueue=a.PubSubChannel=a.FixedPointNumber=a.MerkleTree=a.Chunk=a.Uint8ArrayWriter=a.Uint8ArrayReader=a.AsyncLazy=a.Lazy=a.Optional=void 0;async function i(e){return new Promise((t,n)=>e.then(n,t))}async function c(e){return i(Promise.all(e.map(i)))}async function u(e,t=1){const n=Hs(e,t),s=[],o=n.map(async d=>{for(const f of d)s.push(await f())});return await Promise.all(o),s}async function l(e){return new Promise(t=>setTimeout(()=>{t(!0)},e))}function h(e,t=Math.random){for(let n=e.length-1;n>0;n--){const s=Math.floor(t()*(n+1)),o=e[n];e[n]=e[s],e[s]=o}return e}function p(e){if(e.length===1)return e[0];throw Error(`Expected exactly one element, actual: ${e.length}`)}function g(e){return e.length===1?e[0]:null}function y(e){return e.length>0?e[0]:null}function E(e){if(!e.length)throw Error("Received empty array");return e[0]}function j(e,t){const n=[];for(let s=0;s<e;s++)n.push(t(s));return n}function oe(e){const t=[];for(let n=0;n<e[0].length;n++){t.push([]);for(let s=0;s<e.length;s++)t[n].push(e[s][n])}return t}function ce(e,t,n){const s=[];for(let o=0;o<e;o++){s.push([]);for(let d=0;d<t;d++)s[o].push(n)}return s}function it(e,t,n,s){if(n<0||s<0||s+t[0].length>e[0].length||n+t.length>e.length)return!1;for(let o=0;o<t.length;o++)for(let d=0;d<t[o].length;d++)if(t[o][d]!==void 0&&e[n+o][s+d]!==t[o][d])return!1;return!0}function je(e,t,n=Math.random){return h(ps(0,e.length-1),n).slice(0,t)}function sr(e,t){return e.map(n=>n[t])}function ir(e){let t=e,n=3405648695,s=3735928559;return function(){return t+=n,n^=t<<7,t*=s,s^=t<<13,t^=n^s,(t>>>0)/4294967296}}function at(e,t,n=Math.random){return Math.floor(n()*(t-e+1))+e}function Jn(e,t,n=Math.random){return n()*(t-e)+e}function Ka(){return Math.random()*2-1}function Ya(e,t,n){return t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height}function Qa(e,t,n,s=Math.random){let o,d;do o=at(0,e-1,s),d=at(0,t-1,s);while(n&&Ya(n,o,d));return[o,d]}function Xa(e,t=Math.random){const n=Math.floor(e),s=e-n;return es(s,t)?n+1:n}function es(e,t=Math.random){return t()<e}function ar(e,t=Math.random){return e[Math.floor(e.length*t())]}function Ja(e,t,n=Math.random){if(t>e.length)throw new Error(`Count (${t}) is greater than array length (${e.length})`);return je(e,t,n).map(s=>e[s])}function eo(e,t,n,s=Math.random){if(t>e.length)throw new Error(`Count (${t}) is greater than array length (${e.length})`);const o=[];for(;o.length<t;){const d=ar(e,s);o.some(f=>n(f,d))||o.push(d)}return o}function to(e,t,n,s,o,d=Math.random){const f=e.filter(m=>m!==t&&m!==n),v=[];for(t!==null&&v.push(t);f.length&&v.length<s;){const m=a.Random.intBetween(0,f.length-1,d);o(f[m],v)&&v.push(f[m]),f.splice(m,1)}return h(v,d),{values:v,indexOfGuaranteed:t!==null?v.indexOf(t):-1}}function ot(e){if(!e.length)throw Error("Received empty array");return e[e.length-1]}function ts(e,t,n){return n(t.reduce((s,o)=>o(s),e))}function ro(e,t){return n=>ts(n,e,t)}function no(e,t,n){if(n===void 0&&(n=Math.random()),e.length!==t.length)throw new Error("Array length mismatch");let s=t.reduce((d,f)=>d+f,0);const o=n*s;for(let d=0;d<e.length-1;d++)if(s-=t[d],o>=s)return e[d];return ot(e)}function so(e,t,n=Math.random){const s=t.map(d=>n()*d),o=[];for(let d=0;d<e.length;d++)o.push([e[d],s[d]]);return o.sort((d,f)=>f[1]-d[1]).map(d=>d[0])}function ke(e,t){if(e==null)return null;const n=t.split(".");let s=e;for(const o of n){if(s[o]===null||s[o]===void 0)return null;s=s[o]}return s}function Ee(e,t,n){const s=t.split(/\.|\[/);let o=e;for(let d=0;d<s.length;d++){const f=s[d],v=d<s.length-1&&s[d+1].includes("]"),m=f.includes("]")?f.replace(/\[|\]/g,""):f;if(d===s.length-1)return o[m]=n,n;me(o[m])||(v?o[m]=[]:o[m]={}),o=o[m]}return n}function io(e,t,n=1){const s=ke(e,t)||0;return Ee(e,t,s+n),s}function ao(e,t,n){return ke(e,t)||Ee(e,t,n)}function oo(e,t){const n=mr(t,"."),s=gs(t,".");if(!n||!s)return;const o=ke(e,n);delete o[s]}function co(e,t,n){const s=ke(e,t);if(!s)throw new Error("Key '"+t+"' does not exist.");return Ee(e,t,n),s}function uo(e,t,n){for(const s of t){const o=ke(e,s);if(o)return o}if(n){const s=Object.values(e);if(s.length)return s[0]}return null}async function lo(e,t,n){for(;;){try{await e()}catch(s){n&&n("Error in forever",s)}await l(t)}}function fo(e,t){e();const n=setInterval(()=>{e()},t);return()=>clearInterval(n)}function ho(e){return e/1024/1024}function po(e){return e>=1024*1024*1024*1024?(e/1024/1024/1024/1024).toFixed(3)+" TB":e>=1024*1024*1024?(e/1024/1024/1024).toFixed(3)+" GB":e>=1024*1024?(e/1024/1024).toFixed(3)+" MB":e>=1024?(e/1024).toFixed(3)+" KB":e+" B"}function mo(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e.toLowerCase());if(!t)throw new Error("Invalid hex color: "+e);return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}function go(e){return"#"+e.map(t=>t.toString(16).padStart(2,"0")).join("")}function yo(e,t,n,s){const o=e*Math.PI/180,d=n*Math.PI/180,f=(n-e)*Math.PI/180,v=(s-t)*Math.PI/180,m=Math.sin(f/2)*Math.sin(f/2)+Math.cos(o)*Math.cos(d)*Math.sin(v/2)*Math.sin(v/2);return 6371e3*(2*Math.atan2(Math.sqrt(m),Math.sqrt(1-m)))}function $t(e,t){return Math.round(e/t)*t}function vo(e){return e>1e3?(e/1e3).toFixed(0)+" km":e>=500?$t(e,100)+" m":e>=100?$t(e,50)+" m":$t(e,10)+" m"}function wo(e){return e*(e+1)/2}function bo(e){const t=e.match(/-?\d+(\.\d+)?/);if(!t)throw Error("No float found in "+e);return parseFloat(t[0])}function me(e,t=!0){return!e||t&&!or(e._readableState)||t&&e.constructor&&(e.constructor.isBuffer||e.constructor.name=="Uint8Array"||e.constructor.name==="ArrayBuffer"||e.constructor.name==="ReadableStream")?!1:typeof e=="object"}function De(e){return me(e)&&!Array.isArray(e)}function rs(e){return Array.isArray(e)&&e.length===0}function _o(e){return De(e)&&Object.keys(e).length===0}function or(e){return e===void 0}function cr(e){return Object.prototype.toString.call(e)==="[object Function]"||Object.prototype.toString.call(e)==="[object AsyncFunction]"}function H(e){return Object.prototype.toString.call(e)==="[object String]"}function ge(e){return typeof e=="number"&&isFinite(e)}function ns(e){return e===!0||e===!1}function Pe(e){return Object.prototype.toString.call(e)==="[object Date]"}function Rt(e){return!H(e)||e.trim().length===0}function ur(e){return ge(e)&&Number.isInteger(e)&&e>=1}function ss(e){return H(e)&&e.match(/^-?\d+$/)!==null}function is(e){return H(e)&&e.match(/^(0x)?[0-9a-f]+$/i)!==null}const xo="!@#$%^&*()_+-=[]{}|;:<>?,./",ko="!@#$%^&*()_+-=[]{}|;:<>?,./".split(""),lr="abcdefghijklmnopqrstuvwxyz",Eo="ABCDEFGHIJKLMNOPQRSTUVWXYZ",So="1234567890",dr=lr+Eo+So,as=dr+xo,os=["—","\\","東","京","都","𝖆","𝖇","𝖈","👾","🙇","💁","🙅","ᚠ","ᛇ","ᚻ","ᛦ"],cs="0123456789abcdef";function To(e,t=Math.random){let n="";for(let s=0;s<e;s++)n+=lr[Math.floor(t()*lr.length)];return n}function Ao(e,t=Math.random){let n="";for(let s=0;s<e;s++)n+=dr[Math.floor(t()*dr.length)];return n}function Oo(e,t=Math.random){let n="";for(let s=0;s<e;s++)n+=as[Math.floor(t()*as.length)];return n}function Io(e,t=Math.random){let n="";for(let s=0;s<e;s++)n+=os[Math.floor(t()*os.length)];return n}function Mo(e,t){const n=new RegExp(`[0-9a-f]{${t}}`,"i"),s=e.match(n);return s?s[0]:null}function $o(e,t,n=ko){const s=ys(e,n);for(const o of s)if(t(o))return o;return null}function Ro(e,t=Math.random){let n="";for(let s=0;s<e;s++)n+=cs[Math.floor(t()*cs.length)];return n}function Co(e,t){if(!ss(e))throw new TypeError(`Expected integer string${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);const n=BigInt(e);if(t&&(t.min&&n<t.min||t.max&&n>t.max))throw RangeError(`Expected integer string${t!=null&&t.name?` for ${t.name}`:""} in range: ${t.min??"-inf"}..${t.max??"inf"}; got: `+n);return e}function us(e,t){if(Rt(e))throw new TypeError(`Expected string${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);if(t&&(t.min!==void 0&&e.length<t.min||t.max!==void 0&&e.length>t.max))throw RangeError(`Expected string${t!=null&&t.name?` for ${t.name}`:""} length in range: ${t.min??"-inf"}..${t.max??"inf"}; got: ${e.length}`);return e}function No(e,t){if(!is(e))throw new TypeError(`Expected hex string${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);const n=e.replace(/^0x/,"");if(t&&t.byteLength&&n.length!==t.byteLength*2)throw RangeError(`Expected hex string${t!=null&&t.name?` for ${t.name}`:""} of byte length ${t.byteLength}; got: `+n);return n}function jo(e,t){if(!us(e,t).split("").every(n=>n==="_"||lt(n)))throw new TypeError(`Expected safe string${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return e}function ls(e,t){if(t.min!==void 0&&e<t.min||t.max!==void 0&&e>t.max)throw RangeError(`Expected value${t!=null&&t.name?` for ${t.name}`:""} in range: ${t.min??"-inf"}..${t.max??"inf"}; got: ${e}`)}function Do(e,t){if(!cr(e))throw new TypeError(`Expected function${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return e}function Ct(e,t){if(ge(e))return t&&ls(e,t),e;if(!H(e)||!e.match(/^-?\d+(\.\d+)?$/))throw new TypeError(`Expected number${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);const n=parseFloat(e);return t&&ls(n,t),n}function fr(e,t){return Ct(e,t)|0}function Po(e,t){if(e==="true")return!0;if(e==="false")return!1;if(!ns(e))throw new TypeError(`Expected boolean${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return e}function Uo(e,t){if(!Pe(e))throw new TypeError(`Expected date${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return e}function Zo(e){return Rt(e)?null:e}function Bo(e,t){if(!H(e))throw new TypeError(`Expected string${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return e}function Lo(e,t){if(ur(e))return e;const n=parseInt(e,10);if(!ur(n))throw new TypeError(`Expected id${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return n}function zo(e,t){if(!H(e))throw new TypeError(`Expected time${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);const n=e.split(":");if(n.length!==2)throw new TypeError(`Expected time${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);const s=parseInt(n[0],10),o=parseInt(n[1],10);if(!ge(s)||!ge(o)||s<0||s>23||o<0||o>59)throw new TypeError(`Expected time, got${t!=null&&t.name?` for ${t.name}`:""}: `+e);return`${String(s).padStart(2,"0")}:${String(o).padStart(2,"0")}`}function Vo(e,t){if(!Array.isArray(e))throw new TypeError(`Expected array${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return e}function Nt(e,t){if(!De(e))throw new TypeError(`Expected object${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return e}function Fo(e,t){return e===null?null:Nt(e,t)}function Wo(e,t){const n=Nt(e,t);for(const s of Object.keys(n))if(!H(n[s]))throw new TypeError(`Expected string map${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return n}function Ho(e,t){const n=Nt(e),s=Object.keys(n),o=Object.values(n);if(!s.every(H)||!o.every(ge))throw new TypeError(`Expected numeric dictionary${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return n}function ds(e){return H(e)&&e.match(/^https?:\/\/.+/)!==null}function qo(e,t){if(!ds(e))throw new TypeError(`Expected url${t!=null&&t.name?` for ${t.name}`:""}, got: `+e);return e}function Go(e,t){return t==null?!0:e(t)}function Ko(e,t){return t==null?null:e(t)}function Yo(e,t){return t==null?void 0:e(t)}function fs(e,t){for(const[n,s]of Object.entries(t))if(!s(e[n]))throw TypeError(`${n} in value does not exist or match shape`);for(const n of Object.keys(e))if(!t[n])throw TypeError(`${n} exists in value but not in shape`);return!0}function Qo(e,t){return e.every(n=>fs(n,t))}function ct(e,t="json",n=0){if(me(e,!1)){if(n>1)return"[object Object]";if(t==="json"){if(Array.isArray(e)){const o=e.map(d=>ct(d,"json",n+1));return n===0?JSON.stringify(o):o}const s={};e.message&&(s.message=ct(e.message,"json",n+1));for(const[o,d]of Object.entries(e))s[o]=ct(d,"json",n+1);return n===0?JSON.stringify(s):s}else if(t==="key-value"){const s=Object.keys(e);return e.message&&!s.includes("message")&&s.unshift("message"),s.map(o=>`${o}=${JSON.stringify(ct(e[o],"json",n+1))}`).join(" ")}}return or(e)&&(e="undefined"),n===0?JSON.stringify(e):e}function Xo(e,t){if(H(e))return e;const n=Object.keys(e);e.message&&!n.includes("message")&&n.push("message");const s=n.map(o=>`${o}: ${e[o]}`).join("; ");return t&&e.stack?s+`
|
|
2
|
+
`+e.stack:s}function Se(e,t){if(De(e)&&De(t))for(const n in t)De(t[n])?(e[n]||(e[n]={}),Se(e[n],t[n])):Array.isArray(t[n])?e[n]=[...t[n]]:(t[n]!==null&&t[n]!==void 0||e[n]===null||e[n]===void 0)&&(e[n]=t[n]);return e}function Jo(e,t){const n={};return Se(n,e),Se(n,t),n}function ec(e,t,n){const s={};return Se(s,e),Se(s,t),Se(s,n),s}function hs(e,t){const n={};for(const s of e)for(const o of Object.keys(s))n[o]?n[o]=t(n[o],s[o]):n[o]=s[o];return n}function tc(e){return hs(e,(t,n)=>t+n)}function rc(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function nc(e,t,n){for(e.unshift(t);e.length>n;)e.pop()}function sc(e,t){let n=t%e.length;return n<0&&(n+=e.length),e[n]}function jt(e,t){Array.prototype.push.apply(e,t)}function ic(e,t){Array.prototype.unshift.apply(e,t)}async function ac(e,t){const n=[];for(const s of e)n.push(await t(s));return n}function oc(e,t){const n=[];for(let s=0;s<e.length;s++)n.push(e[s]),s<e.length-1&&(cr(t)?n.push(t()):n.push(t));return n}function cc(e,t){if(e!==t)throw Error(`Expected [${e}] to equal [${t}]`);return[e,t]}function uc(e){if(e!==!0)throw Error(`Expected [true], got: [${e}]`);return e}function lc(e){if(!e)throw Error(`Expected truthy value, got: [${e}]`);return e}function dc(e){if(e!==!1)throw Error(`Expected [false], got: [${e}]`);return e}function fc(e){if(e)throw Error(`Expected falsy value, got: [${e}]`);return e}function hc(e,t){if(!t.includes(e))throw Error(`Expected any of [${t.join(", ")}], got: [${e}]`);return e}function pc(e,t){for(let n=0;n<e.length;n++){const s=e[n],o=t[n],d=Math.max(0,o.getTime()-Date.now());setTimeout(s,d)}}function mc(e,t,n){return e+(t-e)*n}function gc(e){return e.reduce((t,n)=>t+n,0)}function yc(e){return e.reduce((t,n)=>t+n,0)/e.length}function vc(e){const t=[...e].sort((s,o)=>s-o),n=Math.floor(t.length/2);return t.length%2===0?(t[n]+t[n-1])/2:t[n]}function wc(e,t){return e-(t-1)/2}function ps(e,t){const n=[];for(let s=e;s<=t;s++)n.push(s);return n}function bc(e,t){return t.some(n=>e.includes(n))}function _c(e){return/^[\u4E00-\u9FA5]+$/.test(e)}function hr(e,t=()=>!1){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").split("").map(n=>/[a-z0-9]/.test(n)||t(n)?n:"-").join("").replace(/-+/g,"-").replace(/^-|-$/g,"")}function xc(e){return hr(e).replaceAll("-","")}function kc(e){return Pt(e.replace(/([A-Z])/g," $1"))}function Ec(e){return e.split("-").map(Pt).join(" ")}function Sc(e){return ws(e.split("-").map(Pt).join(""))}function Tc(e,t=", ",n=" and "){return!e||!e.length?"":e.length===1?e[0]:e.length===2?`${e[0]}${n}${e[1]}`:`${e.slice(0,e.length-1).join(t)}${n}${e[e.length-1]}`}function Ac(e,t){return t+e.split("").join(t)+t}function Oc(e){return hr(e).replace(/-/g,"_").toUpperCase()}function Dt(e,t){if(t.length===0)return 0;const n=e.toLowerCase(),s=t.toLowerCase();return e===t?1e4:n.startsWith(s)?1e4-e.length:n.includes(s)?5e3-e.length:new RegExp(".*"+s.split("").join(".*")+".*").test(n)?1e3-e.length:0}function Ic(e,t){return e.filter(n=>Dt(n,t)).sort((n,s)=>Dt(s,t)-Dt(n,t))}function Mc(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const $c={"&":"&",""":'"',"'":"'",">":">","<":"<"};function Rc(e){let t=e.replace(/&#(\d+);/g,(n,s)=>String.fromCharCode(s)).replace(/&#x(\d+);/g,(n,s)=>String.fromCharCode(parseInt(s,16)));for(const[n,s]of Object.entries($c))t=t.replaceAll(n,s);return t}function ms(e,t){const n=e.indexOf(t);return n===-1?null:e.slice(0,n)}function pr(e,t){const n=e.indexOf(t);return n===-1?null:e.slice(n+t.length)}function mr(e,t){const n=e.lastIndexOf(t);return n===-1?null:e.slice(0,n)}function gs(e,t){const n=e.lastIndexOf(t);return n===-1?null:e.slice(n+t.length)}function Cc(e,t,n){const s=mr(e,n);return s?pr(s,t):null}function Nc(e,t,n){const s=pr(e,t);return s?ms(s,n):null}function gr(e,t,n=!1){const s=n?e.lastIndexOf(t):e.indexOf(t);return s===-1?n?[null,e]:[e,null]:[e.slice(0,s),e.slice(s+t.length)]}function ys(e,t){let n=[e];for(const s of t)n=n.flatMap(o=>o.split(s));return n.filter(s=>s)}function yr(e){const t=ot(e.split(/\\|\//g)),n=t.lastIndexOf(".",t.length-1);return n<=0?"":t.slice(n+1)}function vr(e){const t=ot(e.split(/\\|\//g)),n=t.lastIndexOf(".",t.length-1);return n<=0?t:t.slice(0,n)}function jc(e){let[t,n]=e.split("@");t=ut(t.replaceAll(".","").toLowerCase()).replaceAll(" ","");const[s]=t.split("+");if(!s||!n||n.indexOf(".")===-1||n.indexOf(".")===n.length-1)throw new Error("Invalid email");return n=ut(n.toLowerCase()).replaceAll(" ",""),`${s}@${n}`}function Dc(e){const t=vr(e),n=yr(e);return n?`${t}.${n}`:t}function Pc(e){const t=vr(e),n=yr(e);return{basename:t,extension:n,filename:n?`${t}.${n}`:t}}function Uc(e,t=Math.random){return e.replace(/\{(.+?)\}/g,(n,s)=>ar(s.split("|"),t))}function vs(e){const t=/\{(.+?)\}/,n=e.match(t);if(!n||!n.index)return[e];const s=n[1].split(","),o=e.slice(0,n.index),d=e.slice(n.index+n[0].length);let f=[];for(const v of s){const m=vs(o+v+d);f=f.concat(m)}return f}function ut(e){return e.split(`
|
|
3
|
+
`).map(t=>t.trim().replace(/\s+/g," ")).filter(t=>t.length>0).join(`
|
|
4
|
+
`)}function Pt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ws(e){return e.charAt(0).toLowerCase()+e.slice(1)}function bs(e){if(!e)return!1;const t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122}function _s(e){if(!e)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}function lt(e){return bs(e)||_s(e)}const Zc=`
|
|
5
|
+
\r.,?!:;"'\`(){}[]~@#$%^&*-+=|<>/\\`.split("");function Bc(e){return Zc.includes(e)}function Lc(e){return lt(e)||e==="."||e==="["||e==="]"||e==="_"}function zc(e,t,n,s,o){return e.slice(0,t)+s+e.slice(t,t+n)+o+e.slice(t+n)}function xs(e,t,n=0){const s=t.exec(e.slice(n));return s?{index:s.index,match:s[0]}:null}function ks(e,t,n=!0){if(!n)return t.every(o=>o instanceof RegExp?o.test(e):e.indexOf(o,0)!==-1);let s=0;for(const o of t)if(o instanceof RegExp){const d=xs(e,o,s);if(!d)return!1;s=d.index+d.match.length}else{const d=e.indexOf(o,s);if(d===-1)return!1;s=d+o.length}return!0}function Vc(e,t,n=!0){let s=0;for(const o of t){let d=!1;for(;!d&&s<e.length;)ks(e[s],o,n)&&(d=!0),s++;if(!d)return!1}return!0}function Fc(e){return e.match(/"|,/)?`"${e.replace(/"/g,'""')}"`:e}function Ue(e,t,n=0){let s=-1;for(const o of t){const d=e.indexOf(o,n);d!==-1&&(s===-1||d<s)&&(s=d)}return s}function Wc(e,t=0){for(let n=t;n<e.length;n++)if(Bc(e[n]))return n;return-1}function Hc(e,t=0){for(let n=t;n<e.length;n++)if(e[n]==="#"&<(e[n+1]))return n;return-1}function Es(e,t,n=0){return e.slice(0,n).lastIndexOf(t)}function Ss(e,t=0,n="{",s="}"){let o=1;for(let d=t;d<e.length;d++)if(e.slice(d,d+s.length)===s){if(--o===0)return d}else e.slice(d,d+n.length)===n&&o++;return-1}function Ts(e,t){const n=t.wordBoundary?Ue(e,[`${t.opening} `,`${t.opening}
|
|
6
|
+
`],t.start||0):e.indexOf(t.opening,t.start||0);if(n===-1)return null;const s=Ss(e,n+t.opening.length,t.opening,t.closing);return s===-1?null:t.exclusive?e.slice(n+t.opening.length,s):e.slice(n,s+t.closing.length)}function qc(e,t){const n=[];let s=t.wordBoundary?Ue(e,[`${t.opening} `,`${t.opening}
|
|
7
|
+
`],t.start||0):e.indexOf(t.opening,t.start||0);for(;;){if(s===-1)return n;const o=Ts(e,{...t,start:s});if(!o)return n;n.push(o),s=t.wordBoundary?Ue(e,[`${t.opening} `,`${t.opening}
|
|
8
|
+
`],s+o.length):e.indexOf(t.opening,s+o.length)}}function Gc(e,t,n){let s=0;for(;;){const o=a.Strings.extractBlock(e,{...n,start:s});if(!o)return e;const d=t(o);s=e.indexOf(o,s)+d.length,e=e.replace(o,d)}}function Kc(e,t){const n=[];let s=0;for(;s<e.length;){const o=e.indexOf(t,s);if(o===-1){n.push({string:e.slice(s),symbol:null});break}const d=e.indexOf(t,o+t.length);if(o>s&&d!==-1&&n.push({string:e.slice(s,o),symbol:null}),d===-1){n.push({string:e.slice(s),symbol:null});break}n.push({string:e.slice(o+t.length,d),symbol:t}),s=d+t.length}return n}function Yc(e){const t=[];let n=0;for(;n<e.length;){const s=Hc(e,n);if(s===-1){t.push({string:e.slice(n),symbol:null});break}const o=Wc(e,s+1);if(o===-1){t.push({string:e.slice(n,s),symbol:null}),t.push({string:e.slice(s+1),symbol:"#"});break}s>n&&t.push({string:e.slice(n,s),symbol:null}),t.push({string:e.slice(s+1,o),symbol:"#"}),n=o}return t}function Qc(e){const t=[];let n=0;for(;n<e.length;){const s=Ue(e,["http://","https://"],n);if(s===-1){t.push({string:e.slice(n),symbol:null});break}const o=Ue(e,[" ",`
|
|
9
|
+
`],s);if(o===-1){s>n&&t.push({string:e.slice(n,s),symbol:null}),t.push({string:e.slice(s),symbol:"http"});break}s>n&&t.push({string:e.slice(n,s),symbol:null}),t.push({string:e.slice(s,o),symbol:"http"}),n=o}return t}const As="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Os="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function Xc(e){return Is(e,As)}function Jc(e){return Ms(e,As)}function eu(e){return Is(e,Os)}function tu(e){return Ms(e,Os)}function Is(e,t){const n="=",s=t.length;let o=0,d=0;const f=[];for(let v=0;v<e.length;v++){const m=e[v];if(m===n)break;const k=t.indexOf(m);if(k===-1)throw new Error(`Invalid character: ${m}`);d=d<<Math.log2(s)|k,o+=Math.log2(s),o>=8&&(o-=8,f.push(d>>o&255))}return new Uint8Array(f)}function Ms(e,t){const n=t.length;let s=0,o=0,d="";for(let f=0;f<e.length;f++)for(o=o<<8|e[f],s+=8;s>=Math.log2(n);)s-=Math.log2(n),d+=t[o>>s&n-1];return s>0&&(d+=t[o<<Math.log2(n)-s&n-1]),d.length%4!==0&&(d+="=".repeat(4-d.length%4)),d}function ru(e){e.startsWith("0x")&&(e=e.slice(2));const t=e.length/2,n=new Uint8Array(t);for(let s=0;s<t;s++){const o=parseInt(e.slice(s*2,s*2+2),16);n[s]=o}return n}function nu(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function su(e,t){const n=e.split("/").filter(d=>d),s=t.split("/").filter(d=>d);if(n.length!==s.length)return null;const o={};for(let d=0;d<n.length;d++){const f=n[d];if(f.startsWith(":"))o[f.slice(1)]=s[d];else if(f!==s[d])return null}return o}function wr(e,t,n){const s=[];for(const o of n)o!==t&&s.push(e.replace(t,o));return s}function iu(e,t,n,s=Math.random){const o=a.Arrays.shuffle(t.map(f=>({variants:a.Arrays.shuffle(f.variants.map(v=>v),s),avoid:f.avoid})),s),d=[];for(const f of o){const v=f.variants.filter(k=>k!==f.avoid),m=v.find(k=>e.includes(k));if(m&&(jt(d,wr(e,m,v)),d.length>=n))break}if(d.length<n)for(const f of o){const v=f.variants.find(m=>e.includes(m));if(v&&(jt(d,wr(e,v,f.variants)),d.length>=n))break}return d.slice(0,n)}function au(e,t,n,s=!1){const o=new RegExp(s?`(?<=\\s|^)${t}(?=\\s|$)`:`\\b${t}\\b`,"g");return e.replace(o,n)}function ou(e,t){const n=/\b[A-Z][a-zA-Z0-9]*\b/g;return e.replace(n,s=>s.toUpperCase()===s?s:t(s))}function cu(e){return e.replace(/<[^>]*>/g,"")}function $s(e){const t=e.lastIndexOf(" ");if(t===-1)return{line:e,rest:""};const n=e.slice(0,t),s=e.slice(t+1);return{line:n,rest:s}}function uu(e,t={}){return[...e].reduce((n,s)=>n+(t[s]||1),0)}function lu(e,t,n={}){const s=[];let o="",d=0;for(let f=0;f<e.length;f++){const v=e[f],m=n[v]||1;if(o+=v,d+=m,d>t){const{line:k,rest:$}=$s(o);s.push(k),o=$,d=$.split("").map(U=>n[U]||1).reduce((U,ze)=>U+ze,0)}}return o&&s.push(o),s}function du(e,t){const n=[];for(let s=0;s<=e.length;s++)n[s]=[s];for(let s=0;s<=t.length;s++)n[0][s]=s;for(let s=1;s<=e.length;s++)for(let o=1;o<=t.length;o++){const d=e[s-1]===t[o-1]?0:1;n[s][o]=Math.min(n[s-1][o]+1,n[s][o-1]+1,n[s-1][o-1]+d)}return n[e.length][t.length]}function br(e,t){return new RegExp(`\\b${t}\\b`).test(e)}function fu(e,t,n){return n==="any"?t.some(s=>br(e,s)):t.every(s=>br(e,s))}function hu(e){const t={},n=e.match(/([a-z\-]+)="([^"]+)"/g);if(n)for(const s of n){const[o,d]=gr(s,"=");t[o]=d.slice(1,d.length-1)}return t}function Ut(e,t,n=[]){let s="";for(;t<e.length&&(lt(e[t])||n.includes(e[t]));)s+=e[t++];return s}function pu(e,t,n="$",s=":"){for(const o in t)e=Rs(e,o,t[o],n,s);return e=Cs(e),e}function Rs(e,t,n,s="$",o=":"){if(n==="")return e;let d=e.indexOf(`${s}${t}`);for(;d!==-1;){if(e[d+t.length+1]===o)if(e[d+t.length+2]===o)e=e.replace(`${s}${t}${o}${o}`,n);else{const f=Ut(e,d+t.length+2,["_"]);e=e.replace(`${s}${t}${o}${f}`,n)}else e=e.replace(`${s}${t}`,n);d=e.indexOf(`${s}${t}`,d+n.length)}return e}function Cs(e,t="$",n=":"){let s=e.indexOf(t);for(;s!==-1;){const o=Ut(e,s+1);if(e[s+o.length+1]===n)if(e[s+o.length+2]===n)e=e.replace(`${t}${o}${n}${n}`,"");else{const d=Ut(e,s+o.length+2);e=e.replace(`${t}${o}${n}${d}`,d)}s=e.indexOf(t,s+1)}return e}function mu(e,t){let n=e.indexOf("](");for(;n!==-1;){const s=Es(e,"[",n),o=e.indexOf(")",n);if(s!==-1&&o!==-1){const[d,f]=e.slice(s+1,o).split("]("),v=t(d,f);e=e.slice(0,s)+v+e.slice(o+1)}n=e.indexOf("](",n+1)}return e}function Ns(e,t=!0){const n=Object.entries(e).filter(([s,o])=>o!=null).map(([s,o])=>`${s}=${encodeURIComponent(o)}`).join("&");return n?(t?"?":"")+n:""}function gu(e){const t={},n=e.split("&");for(const s of n){const[o,d]=s.split("=");o&&d&&(t[o]=decodeURIComponent(d))}return t}function yu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vu(e,t){let n=null,s=-1/0;for(const[o,d]of Object.entries(e)){const f=t(d);f>s&&(s=f,n=o)}return n?[n,e[n]]:null}function wu(e,t,n,s){const o=e.find(f=>f[t]===n),d=e.find(f=>f[t]===n+s);o&&d?(o[t]=n+s,d[t]=n):o&&(o[t]=n+s),e.sort((f,v)=>Ct(f[t])-Ct(v[t])),e.forEach((f,v)=>f[t]=v+1)}function bu(e){const t=Object.keys(e);if(t.length===1)return e[t[0]];throw new Error("Expected object to have a single key")}function _u(e,t=":"){return Object.fromEntries(e.map(n=>gr(n,t)).map(n=>n[0]&&n[1]?[ut(n[0]),ut(n[1])]:null).filter(n=>n))}function xu(e,t,n){return Us(e,t)+Ns(n||{})}function ku(e,t=",",n='"'){const s=[];let o="",d=!1;const f=e.split("");for(const v of f)v===t&&!d?(s.push(o),o=""):v===n&&(!o&&!d||d)?d=!d:o+=v;return s.push(o),s}function Eu(e){return`[${Math.floor(e.progress*100)}%] ${Zt(e.deltaMs)} out of ${Zt(e.totalTimeMs)} (${Zt(e.remainingTimeMs)} left) [${Math.round(e.baseTimeMs)} ms each]`}async function Su(e,t,n){for(let s=0;s<n;s++){try{if(await e())return!0}catch{}s<n-1&&await l(t)}return!1}function Tu(e,t){const n=[];for(let s=e.length-1;s>=0;s--)t(e[s])&&n.push(e.splice(s,1)[0]);return n}function Au(e){return JSON.parse(JSON.stringify(e))}function Ou(e){return Math.ceil((e||Date.now())/1e3)}function Iu(e){return(e||new Date).toISOString().slice(0,10)}function Mu(e){return(e||new Date).toISOString().slice(0,19).replace(/T|:/g,"-")}function $u(e){const t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4)}function Ru(e){return new Date(e)}function re(e){return String(Math.floor(e)).padStart(2,"0")}function Cu(e){let[t,n]=e.split(":");ge(parseInt(t,10))||(t="0"),ge(parseInt(n,10))||(n="0");let s=Sr(fr(t),0,23),o=Sr(fr(n),0,59);return`${re(s)}:${re(o)}`}function Zt(e){const t=Math.floor(e/36e5);e=e%36e5;const n=Math.floor(e/6e4);e=e%6e4;const s=Math.floor(e/1e3);return t?`${re(t)}:${re(n)}:${re(s)}`:`${re(n)}:${re(s)}`}function Te(e){return Math.floor((Pe(e)?e.getTime():e)/864e5)}const Nu={today:(e,t)=>re(e)+":"+re(t),yesterday:()=>"Yesterday",monday:()=>"Mon",tuesday:()=>"Tue",wednesday:()=>"Wed",thursday:()=>"Thu",friday:()=>"Fri",saturday:()=>"Sat",sunday:()=>"Sun",weeks:e=>`${e}w`};function ju(e,t){const n=new Date((t==null?void 0:t.now)||Date.now()),s=(t==null?void 0:t.labels)||Nu,o=Pe(e)?e:new Date(e);if(Te(n)===Te(o))return s.today(o.getUTCHours(),o.getUTCMinutes(),o.getUTCHours()>12);if(Te(n)-Te(o)===1)return s.yesterday();const d=xr(o);return Te(n)-Te(o)<7?s[d.day]():s.weeks(Math.round((n.getTime()-o.getTime())/6048e5))}const js={now:()=>"A few seconds",seconds:e=>`${e} seconds`,minutes:e=>`${e} minutes`,hours:e=>`${e} hours`,days:e=>`${e} days`,weeks:e=>`${e} weeks`};function Ds(e,t){const n=(t==null?void 0:t.now)??Date.now(),s=(t==null?void 0:t.labels)||js,o=a.Types.isDate(e)?e.getTime():e;let d=(n-o)/1e3;return d<10?s.now():d<120?s.seconds(Math.floor(d)):(d/=60,d<120?s.minutes(Math.floor(d)):(d/=60,d<48?s.hours(Math.floor(d)):(d/=24,d<14?s.days(Math.floor(d)):(d/=7,s.weeks(Math.floor(d))))))}function Du(e,t=js){return Ds(0,{now:e*1e3,labels:t})}function Pu(e,t,n){const s=((n==null?void 0:n.now)??Date.now())-e,o=Math.floor(s/t),d=t/((n==null?void 0:n.precision)??1)-Math.ceil(s%t/((n==null?void 0:n.precision)??1));return{cycles:o,remaining:d}}const _r={};function Uu(e,t){return!_r[e]||Date.now()>_r[e]?(_r[e]=Date.now()+t,!0):!1}const Zu={s:1e3,m:6e4,h:36e5,d:864e5};function Bu(e,t,n){return t=Pe(t)?t.getTime():t,n=n?Pe(n)?n.getTime():n:Date.now(),(n-t)/Zu[e]}function Lu(e,t,n,s){s||(s=Date.now());const o=t/n,d=s-e,f=d/t,v=f*n,m=v-d;return{deltaMs:d,progress:o,baseTimeMs:f,totalTimeMs:v,remainingTimeMs:m}}const zu={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"};function Ps(e){return{zeroBasedIndex:e,day:zu[e]}}function xr(e){return Ps(e.getDay())}function Vu(e){return xr(new Date(e))}function Fu(e){return e*1e3}function Wu(e){return e*6e4}function Hu(e){return e*36e5}function qu(e){return e*864e5}const Gu={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 Ku(e){const t=parseFloat(e);if(isNaN(t))throw Error("makeDate got NaN for input");const n=e.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),s=Gu[n];if(!s)throw Error(`Unknown unit: "${n}"`);return t*s}const Yu={b:1,byte:1,bytes:1,kb:1024,kilobyte:1024,kilobytes:1024,mb:1024**2,megabyte:1024**2,megabytes:1024**2,gb:1024**3,gigabyte:1024**3,gigabytes:1024**3,tb:1024**4,terabyte:1024**4,terabytes:1024**4};function Qu(e){const t=parseFloat(e);if(isNaN(t))throw Error("makeDate got NaN for input");const n=e.replace(/^-?[0-9.]+/,"").trim().toLowerCase(),s=Yu[n];if(!s)throw Error(`Unknown unit: "${n}"`);return t*s}function Xu(e){return e.replace(/ +/g," ").replace(/^ /gm,"")}const kr={};async function Ju(e,t,n){const s=Date.now(),o=kr[e];if(o&&o.validUntil>s)return o.value;const d=await n(),f=s+t;return kr[e]={value:d,validUntil:f},d}function el(e){delete kr[e]}function Us(...e){return e.filter(t=>t).join("/").replace(new RegExp("(?<!:)\\/+","g"),"/")}function tl(e,t,n,s,o=!0){const d=e.indexOf(t),f=e.indexOf(n,d+t.length);if(d===-1||f===-1)throw Error("Start or end not found");return o?e.substring(0,d+t.length)+s+e.substring(f):e.substring(0,d)+s+e.substring(f+n.length)}function rl(e){let t="p";e.startsWith("#")?(t="h1",e=e.slice(1).trim()):e.startsWith("-")&&(t="li",e=e.slice(1).trim());const n=e[0]===e[0].toUpperCase(),s=/[.?!]$/.test(e),o=/:$/.test(e);return{type:t,isCapitalized:n,hasPunctuation:s,endsWithColon:o}}function nl(e,t="(",n=")"){let s=0,o=0;for(;o<e.length;)if(e.startsWith(t,o)?(s++,o+=t.length):e.startsWith(n,o)?(s--,o+=n.length):o++,s<0)return!1;return t===n?s%2===0:s===0}function sl(e){e=e.normalize("NFD").replace(/[\u0300-\u036f]/g,"");let t=e.length;for(;e=e.replace(/(\w+)[\s,']+\w+/g,"$1"),e.length!==t;)t=e.length;return e=e.replaceAll(/[A-Z][a-zA-Z0-9]*/g,"A"),e=e.replaceAll(/[a-z][a-zA-Z0-9]*/g,"a"),e=e.replaceAll(/[\u4E00-\u9FA5]+/g,"Z"),e}function Zs(e){const t=Object.keys(e).sort((s,o)=>s.localeCompare(o)),n={};for(const s of t)n[s]=Ae(e[s]);return n}function Bs(e){const t=[];return e.sort((n,s)=>JSON.stringify(Ae(n)).localeCompare(JSON.stringify(Ae(s)))).forEach(n=>t.push(Ae(n))),t}function Ae(e){return Array.isArray(e)?Bs(e):me(e)?Zs(e):e}function Ls(e,t){return JSON.stringify(Ae(e))===JSON.stringify(Ae(t))}function il(...e){for(let t=1;t<e.length;t++)if(!Ls(e[t-1],e[t]))return!1;return!0}function al(e){try{return JSON.parse(e)}catch{return null}}function ol(){let e=0;return{next:()=>e++}}function cl(e){let t=0;return{next:()=>e[t++%e.length]}}function ul(e){let t;return n=>{const s=n===e&&t!==e;return t=n,s}}function ll(e,t,n,s,o){const d={};for(const f of Object.keys(t))d[f]=[];d[s]=[],o&&(e=e.sort(o));for(const f of e){const v=f[n],m=t[v]?v:s;d[m].length>=t[m]?d[s].push(f):d[m].push(f)}return d}function dl(e,t){const n=Object.keys(e),s=Object.keys(t);return{uniqueToA:n.filter(o=>!s.includes(o)),uniqueToB:s.filter(o=>!n.includes(o))}}function zs(e){const t=Object.keys(e);return t[Math.floor(Math.random()*t.length)]}function fl(e,t){const n=zs(e);return e[n]=t(e[n]),n}function hl(e){return e=e.replace(/\r\n/g,`
|
|
10
|
+
`),e=e.replace(/(\w+)\((.+)\)/g,(t,n,s)=>`${n}(${s.replaceAll(",",",")})`),e=e.replace(/(,)(\s+})/g,"$2"),e=e.replace(/\.\.\..+?,/g,""),e=e.replace(/({\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',"),e=e.replace(/(,\s+)([a-zA-Z]\w+),/g,"$1$2: '$2',"),e=e.replace(/:(.+)\?(.+):/g,(t,n,s)=>`: (${n.trim()} && ${s.trim()}) ||`),e=e.replace(/([a-zA-Z0-9]+)( ?: ?{)/g,'"$1"$2'),e=e.replace(/([a-zA-Z0-9]+) ?: ?(.+?)(,|\n|})/g,(t,n,s,o)=>`"${n}":"${s.trim()}"${o}`),e=e.replace(/("'|'")/g,'"'),e=e.replaceAll(",",","),JSON.parse(e)}const ye=[1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24,1e27,1e30,1e9,1e16,1e18,1e18,1e18,1e33],pl=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","gwei","bzz","btc","eth","dai","decillion"],Vs=["K","M","B","T","Qa","Qi","Sx","Sp","O","N","gwei","bzz","eth","btc","dai","D"];function ml(e,t,n){let s=e.length-t;if(s<=0)return"0."+"0".repeat(-s)+e+(n?" "+n:"");let o=e.substring(0,s),d=e.substring(s);return o===""&&(o="0"),o+"."+d+(n?" "+n:"")}function gl(e,t){const n=(t==null?void 0:t.longForm)??!1,s=t!=null&&t.unit?` ${t.unit}`:"",o=n?pl:Vs,d=(t==null?void 0:t.precision)??1;if(e<ye[0])return`${e}${s}`;for(let f=0;f<ye.length-1;f++)if(e<ye[f+1])return`${(e/ye[f]).toFixed(d)}${n?" ":""}${o[f]}${s}`;return`${(e/ye[ye.length-1]).toFixed(d)}${n?" ":""}${o[ye.length-1]}${s}`}function Er(e){const t=parseFloat(e);if(isNaN(t))throw Error("makeNumber got NaN for input");const n=e.replace(/^-?[0-9.]+/,"").trim(),s=Vs.findIndex(o=>o.toLowerCase()===n.toLowerCase());return s===-1?t:t*ye[s]}function Sr(e,t,n){return e<t?t:e>n?n:e}function yl(e,t,n){const s=e+t;return s>n?n:s}function vl(e,t,n){const s=e-t;return s<n?n:s}function wl(e,t){return t(e),e}function bl(e,t){e&&t(e)}function _l(e,t){const n=Object.keys(t);for(const s of n)Array.isArray(t[s])&&Array.isArray(e[s])&&jt(e[s],t[s])}function xl(e){return e.splice(0,e.length),e}function kl(e){for(const t of Object.keys(e))(rs(e[t])||Array.isArray(e[t])&&e[t].every(n=>n==null))&&delete e[t];return e}function El(e){for(const t of Object.entries(e))(t[1]===null||t[1]===void 0||H(t[1])&&Rt(t[1]))&&delete e[t[0]];return e}function Sl(e,t){const n={};for(const[s,o]of Object.entries(e))t(s)&&(n[s]=o);return n}function Tl(e,t){const n={};for(const[s,o]of Object.entries(e))t(o)&&(n[s]=o);return n}function Al(e,t){const n={};for(const s of Object.entries(e))n[s[0]]=t(s[1]);return n}function Ol(e,t){const n=[];let s=0;for(const o of e)n.push(t(o,s++));return n}async function Il(e,t){try{return await e()}catch{throw t}}function Ml(e,t,n){n!=null&&(e[t]=n)}function $l(e,t,n,s){const o=ke(n,s);o!=null&&Ee(e,t,o)}function Rl(e){const t={};for(const[n,s]of Object.entries(e))t[s]=n;return t}function Cl(e){const t=Object.keys(e),n=t.map(v=>e[v].length),s=n.reduce((v,m)=>v*=m);let o=1;const d=[1];for(let v=0;v<n.length-1;v++)o*=n[v],d.push(o);const f=[];for(let v=0;v<s;v++){const m={};for(let k=0;k<t.length;k++){const $=e[t[k]],U=Math.floor(v/d[k])%$.length;m[t[k]]=$[U]}f.push(m)}return f}function Nl(e){return Object.values(e).filter(t=>t).length}function jl(e,t,n){return e+(n?"["+t+"]":(e.length?".":"")+t)}function Bt(e,t,n,s,o){if(!me(t))return t;for(const[d,f]of Object.entries(t)){const v=jl(n,d,s);Array.isArray(f)?o?Bt(e,f,v,!0,o):e[v]=f.map(m=>Bt(Array.isArray(m)?[]:{},m,"",!1,o)):me(f)?Bt(e,f,v,!1,o):e[v]=f}return e}function Dl(e,t=!1,n){return Bt({},e,n||"",!1,t)}function Fs(e){if(!me(e))return e;const t=Array.isArray(e)?[]:{};for(const[n,s]of Object.entries(e))Array.isArray(s)?Ee(t,n,s.map(o=>Fs(o))):Ee(t,n,s);return t}function Pl(e,t,n){return t[e]?t[e]:n}function Ws(e,t){const n={};for(const s of e){const o=t(s);n[o]=s}return n}function Ul(e,t){const n={};for(const s of e){const o=t(s);n[o]||(n[o]=[]),n[o].push(s)}return n}function Zl(e,t){const n=[];for(let s=0;s<e.length;s+=t)n.push(e.slice(s,s+t));return n}function Hs(e,t){const n=Math.ceil(e.length/t),s=[];for(let o=0;o<e.length;o+=n)s.push(e.slice(o,o+n));return s}function qs(e,t){const n=[],s=Math.ceil(e.length/t);for(let o=0;o<s;o++)n.push(e.slice(o*t,o*t+t));return n}function Bl(e,t){const n=Math.ceil(e.length/t);return qs(e,n)}function Ll(e,t){return Object.values(Ws(e,t))}function zl(e,t,n,s,o){const d=t?e.map(t):e,f={};for(const m of d)f[m]=(f[m]||0)+1;const v=s?Gs(f,o?(m,k)=>m[1]-k[1]:(m,k)=>k[1]-m[1]):f;return n?Object.keys(v):v}function Gs(e,t){return Object.fromEntries(Object.entries(e).sort(t))}function Vl(e){const t=[],n=Object.keys(e),s=e[n[0]].length;for(let o=0;o<s;o++){const d={};for(const f of n)d[f]=e[f][o];t.push(d)}return t}function Fl(e,t,n=1){for(const s of e)s[t]+=n}function Wl(e,t,n){for(const s of e)s[t]=n}function Tr(e,t){const n=[];let s=[];return e.forEach((o,d)=>{(d===0||!t(o,e[d-1]))&&(s=[],n.push(s)),s.push(o)}),n}function Hl(){return{map:new Map,keys:[]}}function ql(){return{map:new Map,keys:[]}}function Ks(e,t,n,s=100){if(e.map.has(t)){const o=e.keys.indexOf(t);e.keys.splice(o,1)}if(e.map.set(t,n),e.keys.push(t),e.keys.length>s){const o=e.keys.shift();o&&e.map.delete(o)}}function Gl(e,t,n,s=100){if(e.map.has(t)){const o=e.keys.indexOf(t);e.keys.splice(o,1)}if(e.map.set(t,n),e.keys.unshift(t),e.keys.length>s){const o=e.keys.shift();o&&e.map.delete(o)}}function Kl(e,t,n,s,o=100){Ks(e,t,{validUntil:Date.now()+s,data:n},o)}function Yl(e,t){const n=e.map.get(t);return n&&n.validUntil>Date.now()?n.data:null}class ve{constructor(t){this.value=t}static of(t){return new ve(t)}static empty(){return new ve(null)}map(t){return new ve(this.value!==null&&this.value!==void 0?t(this.value):null)}mapAsync(t){return this.value!==null&&this.value!==void 0?t(this.value).then(n=>ve.of(n)):Promise.resolve(ve.empty())}ifPresent(t){return this.value!==null&&this.value!==void 0&&t(this.value),this}ifPresentAsync(t){return this.value!==null&&this.value!==void 0?t(this.value).then(()=>this):Promise.resolve(this)}ifAbsent(t){return(this.value===null||this.value===void 0)&&t(),this}ifAbsentAsync(t){return this.value===null||this.value===void 0?t().then(()=>this):Promise.resolve(this)}getOrFallback(t){return this.value??t()}getOrFallbackAsync(t){return this.value!==null&&this.value!==void 0?Promise.resolve(this.value):t()}getOrThrow(){if(this.value===null||this.value===void 0)throw Error("Optional.value is empty");return this.value}}a.Optional=ve;class Ql{constructor(t){this.supplier=t,this.value=null}get(){return this.value||(this.value=this.supplier()),this.value}}a.Lazy=Ql;class Xl{constructor(t){this.supplier=t,this.value=null}async get(){return this.value||(this.value=await this.supplier()),this.value}}a.AsyncLazy=Xl;function Jl(e){return()=>e.forEach(t=>t())}function ed(e,t){return e.reduce((n,s)=>t(n)>t(s)?n:s)}function td(e,t){const n=e.find(s=>s instanceof t);return ve.of(n)}function rd(e,t){return e.filter(n=>n instanceof t)}function nd(e,t){const n=[],s=Math.max(e.length,t.length);for(let o=0;o<s;o++)e[o]&&n.push(e[o]),t[o]&&n.push(t[o]);return n}function sd(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}class id{constructor(t){this.value=t,this.children=[]}}function ad(e,t,n,s,o=!1){const d=new Map,f=[];e.forEach(m=>{const k=new id(m);d.set(m[t],k)}),e.forEach(m=>{const k=d.get(m[t]);if(!k)return;const $=m[n];if($){const U=d.get($);U&&U.children.push(k)}else f.push(k)});const v=m=>{m.children.sort((k,$)=>{const U=k.value[s],ze=$.value[s];return o?ze-U:U-ze}),m.children.forEach(v)};return f.forEach(v),f}function Ys(e,t){if(Math.log2(e.length)%1!==0)throw new Error("Array length must be a power of 2");let n=[...e];for(;n.length>1;){const s=[];for(let o=0;o<n.length;o+=2){const d=n[o+1];s.push(t(n[o],d))}n=s}return n[0]}function Ze(...e){const t=e.reduce((o,d)=>o+d.length,0),n=new Uint8Array(t);let s=0;return e.forEach(o=>{n.set(o,s),s+=o.length}),n}function Qs(e){return e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71}function Xs(e){return e[0]===255&&e[1]===216}function Js(e){return e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80}function od(e){return Qs(e)||Xs(e)||Js(e)}function cd(e){return new Uint8Array([e])}function ud(e){return e[0]}function ld(e,t){const n=new ArrayBuffer(2);return new DataView(n).setUint16(0,e,t==="LE"),new Uint8Array(n)}function dd(e,t){return new DataView(e.buffer).getUint16(e.byteOffset,t==="LE")}function fd(e,t){const n=new ArrayBuffer(4);return new DataView(n).setUint32(0,e,t==="LE"),new Uint8Array(n)}function hd(e,t){return new DataView(e.buffer).getUint32(e.byteOffset,t==="LE")}function Ar(e,t){const n=new ArrayBuffer(8);return new DataView(n).setBigUint64(0,BigInt(e),t==="LE"),new Uint8Array(n)}function pd(e,t){return new DataView(e.buffer).getBigUint64(e.byteOffset,t==="LE")}function Be(e,t){const n=new Uint8Array(32);let s=e;if(t==="LE"){for(let o=0;o<32;o++)n[o]=Number(s&0xffn),s>>=8n;return n}for(let o=31;o>=0;o--)n[o]=Number(s&0xffn),s>>=8n;return n}function Le(e,t){let n=0n;if(t==="LE"){for(let s=31;s>=0;s--)n=n<<8n|BigInt(e[s]);return n}for(let s=0;s<32;s++)n=n<<8n|BigInt(e[s]);return n}function md(e,t){const n=[];let s=0;for(const o of t)n.push(e.subarray(s,s+o)),s+=o;return n}function Or(e,t){const n=[];for(let s=0;s<e.length;s+=t)n.push(e.subarray(s,s+t));return n}const ei=[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 gd(e){for(let t=0;t<24;t++){const n=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],d=e[3]^e[13]^e[23]^e[33]^e[43],f=e[4]^e[14]^e[24]^e[34]^e[44],v=e[5]^e[15]^e[25]^e[35]^e[45],m=e[6]^e[16]^e[26]^e[36]^e[46],k=e[7]^e[17]^e[27]^e[37]^e[47],$=e[8]^e[18]^e[28]^e[38]^e[48],U=e[9]^e[19]^e[29]^e[39]^e[49],ze=o<<1|d>>>31,Xd=d<<1|o>>>31,ht=$^ze,pt=U^Xd,Jd=f<<1|v>>>31,ef=v<<1|f>>>31,mt=n^Jd,gt=s^ef,tf=m<<1|k>>>31,rf=k<<1|m>>>31,yt=o^tf,vt=d^rf,nf=$<<1|U>>>31,sf=U<<1|$>>>31,wt=f^nf,bt=v^sf,af=n<<1|s>>>31,of=s<<1|n>>>31,_t=m^af,xt=k^of;e[0]^=ht,e[1]^=pt,e[2]^=mt,e[3]^=gt,e[4]^=yt,e[5]^=vt,e[6]^=wt,e[7]^=bt,e[8]^=_t,e[9]^=xt,e[10]^=ht,e[11]^=pt,e[12]^=mt,e[13]^=gt,e[14]^=yt,e[15]^=vt,e[16]^=wt,e[17]^=bt,e[18]^=_t,e[19]^=xt,e[20]^=ht,e[21]^=pt,e[22]^=mt,e[23]^=gt,e[24]^=yt,e[25]^=vt,e[26]^=wt,e[27]^=bt,e[28]^=_t,e[29]^=xt,e[30]^=ht,e[31]^=pt,e[32]^=mt,e[33]^=gt,e[34]^=yt,e[35]^=vt,e[36]^=wt,e[37]^=bt,e[38]^=_t,e[39]^=xt,e[40]^=ht,e[41]^=pt,e[42]^=mt,e[43]^=gt,e[44]^=yt,e[45]^=vt,e[46]^=wt,e[47]^=bt,e[48]^=_t,e[49]^=xt;const Nr=e[0],jr=e[1],Dr=e[2]<<1|e[3]>>>31,Pr=e[3]<<1|e[2]>>>31,Ur=e[5]<<30|e[4]>>>2,Zr=e[4]<<30|e[5]>>>2,Br=e[6]<<28|e[7]>>>4,Lr=e[7]<<28|e[6]>>>4,zr=e[8]<<27|e[9]>>>5,Vr=e[9]<<27|e[8]>>>5,Fr=e[11]<<4|e[10]>>>28,Wr=e[10]<<4|e[11]>>>28,Hr=e[13]<<12|e[12]>>>20,qr=e[12]<<12|e[13]>>>20,Gr=e[14]<<6|e[15]>>>26,Kr=e[15]<<6|e[14]>>>26,Yr=e[17]<<23|e[16]>>>9,Qr=e[16]<<23|e[17]>>>9,Xr=e[18]<<20|e[19]>>>12,Jr=e[19]<<20|e[18]>>>12,en=e[20]<<3|e[21]>>>29,tn=e[21]<<3|e[20]>>>29,rn=e[22]<<10|e[23]>>>22,nn=e[23]<<10|e[22]>>>22,sn=e[25]<<11|e[24]>>>21,an=e[24]<<11|e[25]>>>21,on=e[26]<<25|e[27]>>>7,cn=e[27]<<25|e[26]>>>7,un=e[29]<<7|e[28]>>>25,ln=e[28]<<7|e[29]>>>25,dn=e[31]<<9|e[30]>>>23,fn=e[30]<<9|e[31]>>>23,hn=e[33]<<13|e[32]>>>19,pn=e[32]<<13|e[33]>>>19,mn=e[34]<<15|e[35]>>>17,gn=e[35]<<15|e[34]>>>17,yn=e[36]<<21|e[37]>>>11,vn=e[37]<<21|e[36]>>>11,wn=e[38]<<8|e[39]>>>24,bn=e[39]<<8|e[38]>>>24,_n=e[40]<<18|e[41]>>>14,xn=e[41]<<18|e[40]>>>14,kn=e[42]<<2|e[43]>>>30,En=e[43]<<2|e[42]>>>30,Sn=e[45]<<29|e[44]>>>3,Tn=e[44]<<29|e[45]>>>3,An=e[47]<<24|e[46]>>>8,On=e[46]<<24|e[47]>>>8,In=e[48]<<14|e[49]>>>18,Mn=e[49]<<14|e[48]>>>18;e[0]=Nr^~Hr&sn,e[1]=jr^~qr&an,e[2]=Hr^~sn&yn,e[3]=qr^~an&vn,e[4]=sn^~yn&In,e[5]=an^~vn&Mn,e[6]=yn^~In&Nr,e[7]=vn^~Mn&jr,e[8]=In^~Nr&Hr,e[9]=Mn^~jr&qr,e[10]=Br^~Xr&en,e[11]=Lr^~Jr&tn,e[12]=Xr^~en&hn,e[13]=Jr^~tn&pn,e[14]=en^~hn&Sn,e[15]=tn^~pn&Tn,e[16]=hn^~Sn&Br,e[17]=pn^~Tn&Lr,e[18]=Sn^~Br&Xr,e[19]=Tn^~Lr&Jr,e[20]=Dr^~Gr&on,e[21]=Pr^~Kr&cn,e[22]=Gr^~on&wn,e[23]=Kr^~cn&bn,e[24]=on^~wn&_n,e[25]=cn^~bn&xn,e[26]=wn^~_n&Dr,e[27]=bn^~xn&Pr,e[28]=_n^~Dr&Gr,e[29]=xn^~Pr&Kr,e[30]=zr^~Fr&rn,e[31]=Vr^~Wr&nn,e[32]=Fr^~rn&mn,e[33]=Wr^~nn&gn,e[34]=rn^~mn&An,e[35]=nn^~gn&On,e[36]=mn^~An&zr,e[37]=gn^~On&Vr,e[38]=An^~zr&Fr,e[39]=On^~Vr&Wr,e[40]=Ur^~Yr&un,e[41]=Zr^~Qr&ln,e[42]=Yr^~un&dn,e[43]=Qr^~ln&fn,e[44]=un^~dn&kn,e[45]=ln^~fn&En,e[46]=dn^~kn&Ur,e[47]=fn^~En&Zr,e[48]=kn^~Ur&Yr,e[49]=En^~Zr&Qr,e[0]^=ei[t*2],e[1]^=ei[t*2+1]}}function ti(e){const t=[];for(let n=0;n<e.length;n+=4)t.push(e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24);return t}function ri(e,t){if(!e.length){const o=new Uint8Array(136);return o[0]=t,o[135]=128,[ti(o)]}const n=Or(e,136),s=n[n.length-1];if(s.length<136){const o=new Uint8Array(136);o.set(s),o[s.length]=t,o[135]|=128,n[n.length-1]=o}if(s.length===136){const o=new Uint8Array(136);o[0]=t,o[135]=128,n.push(o)}return n.map(ti)}function ni(e,t){for(const n of t){for(let s=0;s<34;s+=2)e[s]^=n[s+1],e[s+1]^=n[s];gd(e)}return e}function si(e){return new Uint8Array([e[1],e[1]>>-24,e[1]>>-16,e[1]>>-8,e[0],e[0]>>8,e[0]>>16,e[0]>>24,e[3],e[3]>>-24,e[3]>>-16,e[3]>>-8,e[2],e[2]>>8,e[2]>>16,e[2]>>24,e[5],e[5]>>-24,e[5]>>-16,e[5]>>-8,e[4],e[4]>>8,e[4]>>16,e[4]>>24,e[7],e[7]>>-24,e[7]>>-16,e[7]>>-8,e[6],e[6]>>8,e[6]>>16,e[6]>>24])}function ue(e){return si(ni(new Array(50).fill(0),ri(e,1)))}function yd(e){return si(ni(new Array(50).fill(0),ri(e,6)))}function vd(e,t,n){const s=Math.min(e.length,t.length,n/8+1);for(let o=0;o<s;o++){const d=e[o]^t[o];for(let f=0;f<8;f++)if(d>>7-f&1)return o*8+f}return n}function wd(e,t){const n=Math.min(e.length,t.length);for(let s=0;s<n;s++)if(e[s]!==t[s])return e.subarray(0,s);return e.subarray(0,n)}function bd(e,t,n,s){const o=Math.floor(t/8),d=t%8;n===1?e[o]|=1<<(s==="BE"?7-d:d):e[o]&=~(1<<(s==="BE"?7-d:d))}function _d(e,t,n){const s=Math.floor(t/8),o=t%8;return e[s]>>(n==="BE"?7-o:o)&1}function xd(e,t,n=0){for(let s=n;s<e.length;s++)for(let o=0;o<t.length&&e[s+o]===t[o];o++)if(o===t.length-1)return s;return-1}function ii(e,t,n=0){if(e.length>=t)return e;const s=new Uint8Array(t);return s.fill(n),s.set(e,t-e.length),s}function kd(e,t,n=0){const s=e.length%t;return s===0?e:ii(e,e.length+t-s,n)}function ai(e,t,n=0){if(e.length>=t)return e;const s=new Uint8Array(t);return s.fill(n),s.set(e,0),s}function Ed(e,t,n=0){const s=e.length%t;return s===0?e:ai(e,e.length+t-s,n)}function Sd(e,t){const n=new Uint8Array(e.length);for(let s=0;s<e.length;s++)n[s]=e[s]^t[s%t.length];return n}function Td(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function R(e,t){return(e%t+t)%t}function dt(e,t){e=R(e,t);let[n,s]=[0n,1n],[o,d]=[t,e];for(;d!==0n;){const f=o/d;[n,s]=[s,n-f*s],[o,d]=[d,o-f*d]}if(o>1n)throw new Error("a is not invertible");return n<0n&&(n+=t),n}function Ad(e,t,n){let s=1n;for(e=R(e,n);t>0;)t%2n===1n&&(s=R(s*e,n)),e=R(e*e,n),t=t/2n;return s}function oi(e,t){return R(e,t)===0n?0n:t%4n===3n?Ad(e,(t+1n)/4n,t):null}const z=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,P=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,Lt=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,zt=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;function Ir(e,t,n){if(t===0n)return[0n,0n];const s=R(3n*e*e*dt(2n*t,n),n),o=R(s*s-2n*e,n),d=R(s*(e-o)-t,n);return[o,d]}function Vt(e,t,n,s,o){if(e===0n&&t===0n)return[n,s];if(n===0n&&s===0n)return[e,t];if(e===n&&t===R(-s,o))return[0n,0n];if(e===n&&t===s)return Ir(e,t,o);const d=R((s-t)*dt(n-e,o),o),f=R(d*d-e-n,o),v=R(d*(e-f)-t,o);return[f,v]}function Od(e){if(e<=0n||e>=P)throw new Error("Invalid private key");return Oe(Lt,zt,e,z)}function Id(e){const t=e[1]%2n===0n?2:3;return new Uint8Array([t,...Be(e[0],"BE")])}function Md(e){if(e.length!==33||e[0]!==2&&e[0]!==3)throw new Error("Invalid compressed public key");const t=Le(e.slice(1),"BE"),n=oi(R(t**3n+7n,z),z);if(!n)throw Error("Invalid x: does not correspond to a valid curve point");const s=R(-n,z),o=n%2n===0n;return[t,e[0]===2?o?n:s:o?s:n]}function $d(e){const t=new Uint8Array(20),n=ue(Ze(Be(e[0],"BE"),Be(e[1],"BE")));return t.set(n.subarray(12)),t}function Rd(e){const t=a.Binary.uint8ArrayToHex(e),n=a.Binary.uint8ArrayToHex(a.Binary.keccak256(new Uint8Array([...t].map(o=>o.charCodeAt(0)))));let s="0x";for(let o=0;o<t.length;o++)parseInt(n[o],16)>7?s+=t[o].toUpperCase():s+=t[o];return s}function Oe(e,t,n,s){let o=[0n,0n],d=[e,t];const f=n.toString(2);for(const v of f)v==="0"?(d=Vt(o[0],o[1],d[0],d[1],s),o=Ir(o[0],o[1],s)):(o=Vt(o[0],o[1],d[0],d[1],s),d=Ir(d[0],d[1],s));return o}function Cd(e,t,n){return ci(Le(ue(e),"BE"),t,n)}function ci(e,t,n){if(t<=0n||t>=P)throw new Error("Invalid private key");if(n||(n=R(Le(ue(Ze(ue(Be(t,"BE")),Be(e,"BE"))),"BE"),P)),n<=0n||n>=P)throw new Error("Invalid nonce");const s=R(e,P),o=Oe(Lt,zt,n,z),d=R(o[0],P);let f=R((s+R(d,P)*t)*dt(n,P),P);if(d===0n||f===0n)throw new Error("Invalid r or s value");let v=o[1]%2n===0n?27n:28n;return f>P/2n&&(f=P-f,v=v===27n?28n:27n),[d,f,v]}function Nd(e,t,n,s){const o=oi(R(t**3n+7n,z),z);if(!o)throw new Error("Invalid r: does not correspond to a valid curve point");const d=s===27n?0n:1n,f=o%2n===d?o:z-o,v=R(Le(ue(e),"BE"),P),m=Oe(t,f,n,z),k=Oe(Lt,zt,v,z),$=Vt(m[0],m[1],k[0],R(-k[1],z),z);return Oe($[0],$[1],dt(t,P),z)}function jd(e,t,n,s){const o=R(Le(ue(e),"BE"),P),d=dt(s,P),f=R(o*d,P),v=R(n*d,P),m=Oe(Lt,zt,f,z),k=Oe(t[0],t[1],v,z),$=Vt(m[0],m[1],k[0],k[1],z);return n===R($[0],P)}class ui{constructor(t){this.cursor=0,this.buffer=t}read(t){const n=this.buffer.subarray(this.cursor,this.cursor+t);return this.cursor+=t,n}max(){return this.buffer.length-this.cursor}}a.Uint8ArrayReader=ui;class li{constructor(t){this.buffer=t,this.cursor=0}write(t){const n=Math.min(this.max(),t.max());return this.buffer.set(t.read(n),this.cursor),this.cursor+=n,n}max(){return this.buffer.length-this.cursor}}a.Uint8ArrayWriter=li;class Ft{constructor(t,n=0n){this.span=n,this.writer=new li(new Uint8Array(t))}build(){return Ze(Ar(this.span,"LE"),this.writer.buffer)}hash(){const t=Ys(Or(this.writer.buffer,32),(n,s)=>ue(Ze(n,s)));return ue(Ze(Ar(this.span,"LE"),t))}}a.Chunk=Ft;class Mr{constructor(t,n=4096){this.counters=[1],this.capacity=n,this.chunks=[new Ft(n)],this.onChunk=t}static async root(t,n=4096){const s=new r(r.NOOP,n);return await s.append(t),s.finalize()}async append(t,n=0,s=0n){const o=new ui(t);for(;o.max()>0;){this.chunks[n].writer.max()===0&&await this.elevate(n);const d=this.chunks[n].writer.write(o);s?this.chunks[n].span+=s:this.chunks[0].span+=BigInt(d)}}async elevate(t){this.counters[t]=++this.counters[t]%(this.capacity/32),this.chunks[t+1]||(this.chunks.push(new Ft(this.capacity)),this.counters.push(1)),await this.append(this.chunks[t].hash(),t+1,this.chunks[t].span),await this.onChunk(this.chunks[t]),this.chunks[t]=new Ft(this.capacity)}async finalize(t=0){return this.chunks[t+1]?this.counters[t]===1?(await this.elevate(t+1),this.chunks[t+1]=this.chunks[t],this.finalize(t+1)):(await this.elevate(t),this.finalize(t+1)):(await this.onChunk(this.chunks[t]),this.chunks[t])}}a.MerkleTree=Mr,r=Mr,Mr.NOOP=async e=>{};class ne{constructor(t,n){if(n<0)throw Error("Scale must be non-negative");this.value=BigInt(t),this.scale=n}static fromDecimalString(t,n){let[s,o]=t.split(".");return o=(o||"").padEnd(n,"0").slice(0,n),new ne(BigInt(s+o),n)}add(t){return this.assertSameScale(t),new ne(this.value+t.value,this.scale)}subtract(t){return this.assertSameScale(t),new ne(this.value-t.value,this.scale)}multiply(t){return new ne(this.value*t,this.scale)}divmod(t){if(t===0n)throw new Error("Division by zero is not allowed");const n=this.value/t,s=this.value%t;return[new ne(n,this.scale),new ne(s,this.scale)]}exchange(t,n,s){if(t==="*"){const d=this.value*n.value/10n**BigInt(this.scale);return new ne(d,s)}this.assertSameScale(n);const o=this.value*10n**BigInt(s)/n.value;return new ne(o,s)}compare(t){return this.assertSameScale(t),this.value>t.value?1:this.value<t.value?-1:0}toDecimalString(){if(this.scale===0)return this.value.toString();const t=this.value.toString(),n=t.slice(0,-this.scale)||"0",s=t.slice(-this.scale).padStart(this.scale,"0");return`${n}.${s}`}toString(){return this.value.toString()}toJSON(){return this.toString()}assertSameScale(t){if(this.scale!==t.scale)throw new Error(`Scale mismatch: expected ${this.scale}, but got ${t.scale}`)}}a.FixedPointNumber=ne;function Dd(e){if(e.length===0)return null;const t=e[0];return t.ttlMax?--t.ttl<=0&&e.shift():t.ttlMax=t.ttl,{progress:(t.ttlMax-t.ttl)/t.ttlMax,data:t.data}}function Wt(e,t,n,s){const o=e.findIndex(v=>v===`--${t}`||v.startsWith(`--${t}=`)),d=e[o];if(!d)return(n||{})[s||t||""]||null;if(d.includes("="))return d.split("=")[1];const f=e[o+1];return f&&!f.startsWith("-")?f:(n||{})[s||t||""]||null}function Pd(e,t,n,s){const o=Wt(e,t,n,s);if(!o)return null;try{return Er(o)}catch{throw new Error(`Invalid number argument ${t}: ${o}`)}}function Ud(e,t,n,s){const o=e.some(m=>m.endsWith("-"+t)),d=Wt(e,t,n,s);if(!d&&o)return!0;if(!d&&!o)return null;const f=["true","1","yes","y","on"],v=["false","0","no","n","off"];if(f.includes(d.toLowerCase()))return!0;if(v.includes(d.toLowerCase()))return!1;throw Error(`Invalid boolean argument ${t}: ${d}`)}function di(e,t,n,s){const o=Wt(e,t,n,s);if(!o)throw new Error(`Missing argument ${t}`);return o}function Zd(e,t,n,s){const o=di(e,t,n,s);try{return Er(o)}catch{throw new Error(`Invalid argument ${t}: ${o}`)}}function fi(e,t){const n=e[t];e.splice(t,1),e.unshift(n)}function Bd(e,t){const n=[...e];return fi(n,t),n}function hi(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Ld(e,t){return{x:e.x-t.x,y:e.y-t.y}}function $r(e,t){return{x:e.x*t,y:e.y*t}}function zd(e){const t=Math.sqrt(e.x*e.x+e.y*e.y);return{x:e.x/t,y:e.y/t}}function pi(e,t,n){return{x:e.x+Math.cos(t)*n,y:e.y+Math.sin(t)*n}}function mi(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ft(e,t,n="row-first"){const s=[];if(n==="column-first")for(let o=0;o<e.length;o++)for(let d=0;d<e[0].length;d++)t(o,d)&&s.push({x:o,y:d});else for(let o=0;o<e[0].length;o++)for(let d=0;d<e.length;d++)t(d,o)&&s.push({x:d,y:o});return s}function Vd(e,t,n){var s,o;return((s=e[t+1])==null?void 0:s[n])&&((o=e[t-1])==null?void 0:o[n])&&!e[t][n-1]&&!e[t][n+1]}function Fd(e,t,n){var s,o;return e[t][n+1]&&e[t][n-1]&&!((s=e[t-1])!=null&&s[n])&&!((o=e[t+1])!=null&&o[n])}function gi(e,t,n){var s;return!((s=e[t-1])!=null&&s[n])}function yi(e,t,n){var s;return!((s=e[t+1])!=null&&s[n])}function vi(e,t,n){return!e[t][n-1]}function wi(e,t,n){return!e[t][n+1]}function Wd(e,t,n){var o,d,f,v,m,k,$,U;const s=[];return e[t][n]?Vd(e,t,n)||Fd(e,t,n)?[]:(!((o=e[t-1])!=null&&o[n-1])&&gi(e,t,n)&&vi(e,t,n)&&s.push({x:t,y:n}),!((d=e[t+1])!=null&&d[n-1])&&yi(e,t,n)&&vi(e,t,n)&&s.push({x:t+1,y:n}),!((f=e[t-1])!=null&&f[n+1])&&gi(e,t,n)&&wi(e,t,n)&&s.push({x:t,y:n+1}),!((v=e[t+1])!=null&&v[n+1])&&yi(e,t,n)&&wi(e,t,n)&&s.push({x:t+1,y:n+1}),s):((m=e[t-1])!=null&&m[n]&&e[t][n-1]&&s.push({x:t,y:n}),(k=e[t+1])!=null&&k[n]&&e[t][n-1]&&s.push({x:t+1,y:n}),($=e[t-1])!=null&&$[n]&&e[t][n+1]&&s.push({x:t,y:n+1}),(U=e[t+1])!=null&&U[n]&&e[t][n+1]&&s.push({x:t+1,y:n+1}),s)}function Hd(e,t,n,s){const o=[{x:0,y:0},{x:n,y:0},{x:0,y:s},{x:n,y:s}];for(let d=0;d<e.length;d++)for(let f=0;f<e[0].length;f++){const v=Wd(e,d,f);for(const m of v)o.some(k=>k.x===m.x&&k.y===m.y)||o.push(m)}return o.map(d=>({x:d.x*t,y:d.y*t}))}function qd(e,t){const n=ft(e,(m,k)=>e[m][k]===0&&e[m][k+1]!==0,"row-first").map(m=>({...m,dx:1,dy:0})),s=ft(e,(m,k)=>e[m][k]===0&&e[m][k-1]!==0,"row-first").map(m=>({...m,dx:1,dy:0})),o=ft(e,(m,k)=>{var $;return e[m][k]===0&&(($=e[m-1])==null?void 0:$[k])!==0},"column-first").map(m=>({...m,dx:0,dy:1})),d=ft(e,(m,k)=>{var $;return e[m][k]===0&&(($=e[m+1])==null?void 0:$[k])!==0},"column-first").map(m=>({...m,dx:0,dy:1}));n.forEach(m=>m.y++),d.forEach(m=>m.x++);const f=Tr([...o,...d],(m,k)=>m.x===k.x&&m.y-1===k.y),v=Tr([...s,...n],(m,k)=>m.y===k.y&&m.x-1===k.x);return[...f,...v].map(m=>({start:m[0],end:ot(m)})).map(m=>({start:$r(m.start,t),end:$r(hi(m.end,{x:m.start.dx,y:m.start.dy}),t)}))}function Gd(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Kd(e,t){return t.map(n=>Gd(e,n)).sort((n,s)=>n-s)}function bi(e,t,n,s){const o=(s.y-n.y)*(t.x-e.x)-(s.x-n.x)*(t.y-e.y);if(o===0)return null;let d=e.y-n.y,f=e.x-n.x;const v=(s.x-n.x)*d-(s.y-n.y)*f,m=(t.x-e.x)*d-(t.y-e.y)*f;return d=v/o,f=m/o,d>0&&d<1&&f>0&&f<1?{x:e.x+d*(t.x-e.x),y:e.y+d*(t.y-e.y)}:null}function Rr(e,t,n){const s=[],o=pi(e,n,1e4);for(const d of t){const f=bi(e,o,d.start,d.end);f&&s.push(f)}return s.length?s.reduce((d,f)=>{const v=mi(e,f),m=mi(e,d);return v<m?f:d}):null}function Yd(e,t,n){const s=Kd(e,n),o=[];for(const d of s){const f=Rr(e,t,d-.001),v=Rr(e,t,d+.001);f&&o.push(f),v&&o.push(v)}return o}class Cr{constructor(){this.subscribers=[]}subscribe(t){return this.subscribers.push(t),()=>{this.subscribers=this.subscribers.filter(n=>n!==t)}}publish(t){this.subscribers.forEach(n=>n(t))}clear(){this.subscribers=[]}getSubscriberCount(){return this.subscribers.length}}a.PubSubChannel=Cr;class Qd{constructor(t,n){this.queue=[],this.running=0,this.onProcessed=new Cr,this.onDrained=new Cr,this.concurrency=t,this.capacity=n}process(){if(this.running>=this.concurrency)return;const t=this.queue.shift();t&&(this.running++,t().finally(()=>{this.running--,this.process(),this.onProcessed.publish(),this.running===0&&this.onDrained.publish()}))}enqueue(t){if(this.queue.length<this.capacity)return this.queue.push(t),this.process(),Promise.resolve();if(this.onProcessed.getSubscriberCount())throw Error("Queue capacity is full");return new Promise(n=>{this.onProcessed.subscribe(()=>{this.queue.length<this.capacity&&(this.queue.push(t),this.process(),this.onProcessed.clear(),n())})})}drain(){if(this.running===0)return Promise.resolve();if(this.onDrained.getSubscriberCount())throw Error("Already draining");return new Promise(t=>{this.onDrained.subscribe(()=>{this.onDrained.clear(),t()})})}}a.AsyncQueue=Qd,a.Binary={hexToUint8Array:ru,uint8ArrayToHex:nu,base64ToUint8Array:Xc,uint8ArrayToBase64:Jc,base32ToUint8Array:eu,uint8ArrayToBase32:tu,log2Reduce:Ys,partition:Or,concatBytes:Ze,numberToUint8:cd,uint8ToNumber:ud,numberToUint16:ld,uint16ToNumber:dd,numberToUint32:fd,uint32ToNumber:hd,numberToUint64:Ar,uint64ToNumber:pd,numberToUint256:Be,uint256ToNumber:Le,sliceBytes:md,keccak256:ue,sha3_256:yd,proximity:vd,commonPrefix:wd,setBit:bd,getBit:_d,indexOf:xd,equals:Td,padStart:ii,padStartToMultiple:kd,padEnd:ai,padEndToMultiple:Ed,xorCypher:Sd},a.Elliptic={privateKeyToPublicKey:Od,compressPublicKey:Id,publicKeyFromCompressed:Md,publicKeyToAddress:$d,signMessage:Cd,signHash:ci,verifySignature:jd,recoverPublicKey:Nd,checksumEncode:Rd},a.Random={intBetween:at,floatBetween:Jn,chance:es,signed:Ka,makeSeededRng:ir,point:Qa,procs:Xa},a.Arrays={countUnique:zl,makeUnique:Ll,splitBySize:Zl,splitByCount:Hs,index:Ws,indexCollection:Ul,onlyOrThrow:p,onlyOrNull:g,firstOrThrow:E,firstOrNull:y,shuffle:h,initialize:j,initialize2D:ce,rotate2D:oe,containsShape:it,glue:oc,pluck:sr,pick:ar,pickMany:Ja,pickManyUnique:eo,pickWeighted:no,pickRandomIndices:je,pickGuaranteed:to,last:ot,pipe:ts,makePipe:ro,sortWeighted:so,pushAll:jt,unshiftAll:ic,filterAndRemove:Tu,merge:_l,empty:xl,pushToBucket:rc,unshiftAndLimit:nc,atRolling:sc,group:Tr,createOscillator:cl,organiseWithLimits:ll,tickPlaybook:Dd,getArgument:Wt,getBooleanArgument:Ud,getNumberArgument:Pd,requireStringArgument:di,requireNumberArgument:Zd,bringToFront:Bd,bringToFrontInPlace:fi,findInstance:td,filterInstances:rd,interleave:nd,toggle:sd,createHierarchy:ad,multicall:Jl,maxBy:ed},a.System={sleepMillis:l,forever:lo,scheduleMany:pc,waitFor:Su,expandError:Xo,runAndSetInterval:fo},a.Numbers={make:Er,sum:gc,average:yc,median:vc,getDistanceFromMidpoint:wc,clamp:Sr,range:ps,interpolate:mc,createSequence:ol,increment:yl,decrement:vl,format:gl,fromDecimals:ml,makeStorage:Qu,asMegabytes:ho,convertBytes:po,hexToRgb:mo,rgbToHex:go,haversineDistanceToMeters:yo,roundToNearest:$t,formatDistance:vo,triangularNumber:wo,searchFloat:bo},a.Promises={raceFulfilled:c,invert:i,runInParallelBatches:u},a.Dates={getTimestamp:ju,getTimeDelta:Ds,secondsToHumanTime:Du,countCycles:Pu,isoDate:Iu,throttle:Uu,timeSince:Bu,dateTimeSlug:Mu,unixTimestamp:Ou,fromUtcString:$u,fromMillis:Ru,getProgress:Lu,humanizeTime:Zt,humanizeProgress:Eu,createTimeDigits:re,mapDayNumber:Ps,getDayInfoFromDate:xr,getDayInfoFromDateTimeString:Vu,seconds:Fu,minutes:Wu,hours:Hu,days:qu,make:Ku,normalizeTime:Cu,absoluteDays:Te},a.Objects={safeParse:al,deleteDeep:oo,getDeep:ke,setDeep:Ee,incrementDeep:io,ensureDeep:ao,replaceDeep:co,getFirstDeep:uo,deepMergeInPlace:Se,deepMerge2:Jo,deepMerge3:ec,mapAllAsync:ac,cloneWithJson:Au,sortObject:Zs,sortArray:Bs,sortAny:Ae,deepEquals:Ls,deepEqualsEvery:il,runOn:wl,ifPresent:bl,zip:hs,zipSum:tc,removeEmptyArrays:kl,removeEmptyValues:El,flatten:Dl,unflatten:Fs,match:Pl,sort:Gs,map:Al,mapIterable:Ol,filterKeys:Sl,filterValues:Tl,rethrow:Il,setSomeOnObject:Ml,setSomeDeep:$l,flip:Rl,getAllPermutations:Cl,countTruthyValues:Nl,transformToArray:Vl,setMulti:Wl,incrementMulti:Fl,createBidirectionalMap:Hl,createTemporalBidirectionalMap:ql,pushToBidirectionalMap:Ks,unshiftToBidirectionalMap:Gl,addToTemporalBidirectionalMap:Kl,getFromTemporalBidirectionalMap:Yl,createStatefulToggle:ul,diffKeys:dl,pickRandomKey:zs,mapRandomKey:fl,fromObjectString:hl,toQueryString:Ns,parseQueryString:gu,hasKey:yu,selectMax:vu,reposition:wu,unwrapSingleKey:bu,parseKeyValues:_u},a.Types={isFunction:cr,isObject:me,isStrictlyObject:De,isEmptyArray:rs,isEmptyObject:_o,isUndefined:or,isString:H,isNumber:ge,isBoolean:ns,isDate:Pe,isBlank:Rt,isId:ur,isIntegerString:ss,isHexString:is,isUrl:ds,isNullable:Go,asString:us,asHexString:No,asSafeString:jo,asIntegerString:Co,asNumber:Ct,asFunction:Do,asInteger:fr,asBoolean:Po,asDate:Uo,asNullableString:Zo,asEmptiableString:Bo,asId:Lo,asTime:zo,asArray:Vo,asObject:Nt,asNullableObject:Fo,asStringMap:Wo,asNumericDictionary:Ho,asUrl:qo,asNullable:Ko,asOptional:Yo,enforceObjectShape:fs,enforceArrayShape:Qo,isPng:Qs,isJpg:Xs,isWebp:Js,isImage:od},a.Strings={tokenizeByCount:Bl,tokenizeByLength:qs,searchHex:Mo,searchSubstring:$o,randomHex:Ro,randomLetter:To,randomAlphanumeric:Ao,randomRichAscii:Oo,randomUnicode:Io,includesAny:bc,slugify:hr,normalForm:xc,enumify:Oc,escapeHtml:Mc,decodeHtmlEntities:Rc,after:pr,afterLast:gs,before:ms,beforeLast:mr,betweenWide:Cc,betweenNarrow:Nc,getPreLine:Xu,containsWord:br,containsWords:fu,joinUrl:Us,getFuzzyMatchScore:Dt,sortByFuzzyScore:Ic,splitOnce:gr,splitAll:ys,randomize:Uc,expand:vs,shrinkTrim:ut,capitalize:Pt,decapitalize:ws,csvEscape:Fc,parseCsv:ku,surroundInOut:Ac,getExtension:yr,getBasename:vr,normalizeEmail:jc,normalizeFilename:Dc,parseFilename:Pc,camelToTitle:kc,slugToTitle:Ec,slugToCamel:Sc,joinHumanly:Tc,findWeightedPair:Ss,extractBlock:Ts,extractAllBlocks:qc,replaceBlocks:Gc,indexOfEarliest:Ue,lastIndexOfBefore:Es,parseHtmlAttributes:hu,readNextWord:Ut,resolveVariables:pu,resolveVariableWithDefaultSyntax:Rs,resolveRemainingVariablesWithDefaults:Cs,isLetter:bs,isDigit:_s,isLetterOrDigit:lt,isValidObjectPathCharacter:Lc,insert:zc,indexOfRegex:xs,lineMatches:ks,linesMatchInOrder:Vc,represent:ct,resolveMarkdownLinks:mu,buildUrl:xu,isChinese:_c,replaceBetweenStrings:tl,describeMarkdown:rl,isBalanced:nl,textToFormat:sl,splitFormatting:Kc,splitHashtags:Yc,splitUrls:Qc,route:su,explodeReplace:wr,generateVariants:iu,replaceWord:au,replacePascalCaseWords:ou,stripHtml:cu,breakLine:$s,measureTextWidth:uu,toLines:lu,levenshteinDistance:du},a.Assertions={asEqual:cc,asTrue:uc,asTruthy:lc,asFalse:dc,asFalsy:fc,asEither:hc},a.Cache={get:Ju,invalidate:el},a.Vector={addPoint:hi,subtractPoint:Ld,multiplyPoint:$r,normalizePoint:zd,pushPoint:pi,filterCoordinates:ft,findCorners:Hd,findLines:qd,raycast:Rr,raycastCircle:Yd,getLineIntersectionPoint:bi}})(Cn);const C=Si(Cn);C.Arrays,C.Assertions;const B=C.Binary;C.Cache,C.Dates,C.Elliptic,C.Numbers,C.Objects,C.Pagination,C.Promises,C.Random,C.Strings,C.System,C.Types,C.Optional,C.Vector,C.PubSubChannel,C.Chunk;const Ti=C.MerkleTree;C.FixedPointNumber,C.Lazy,C.AsyncLazy,C.AsyncQueue,C.Uint8ArrayReader,C.Uint8ArrayWriter;const Ai=new TextEncoder,Nn=1,jn=4096,qt=4096,Oi=32;function Dn(a,r){return r=typeof r=="number"?A.FeedIndex.fromBigInt(BigInt(r)):r,new A.Identifier(B.keccak256(B.concatBytes(a.toUint8Array(),r.toUint8Array())))}function Ii(a){const r=a.slice(0,A.Span.LENGTH),i=a.slice(A.Span.LENGTH),c=Mi(i),u=B.keccak256(B.concatBytes(r,c));return new A.Reference(u)}function Mi(a){if(a.length>qt)throw new A.BeeArgumentError(`payload size ${a.length} exceeds maximum chunk payload size ${qt}`,a);const r=new Uint8Array(qt);return r.set(a),B.log2Reduce(B.partition(r,Oi),(i,c)=>B.keccak256(B.concatBytes(i,c)))}function Pn(a){if(a instanceof Uint8Array||(a=Ai.encode(a)),a.length<Nn||a.length>jn)throw new RangeError(`payload size ${a.length} exceeds limits [${Nn}, ${jn}]`);const r=A.Span.fromBigInt(BigInt(a.length)),i=B.concatBytes(r.toUint8Array(),a);return{data:i,span:r,payload:A.Bytes.fromSlice(i,A.Span.LENGTH),address:Ii(i)}}function $i(a,r){return new A.Reference(B.keccak256(B.concatBytes(a.toUint8Array(),r.toUint8Array())))}function Un(a,r,i){r=new A.Identifier(r),i=new A.PrivateKey(i);const c=$i(r,i.publicKey().address()),u=i.sign(B.concatBytes(r.toUint8Array(),a.address.toUint8Array())),l=B.concatBytes(r.toUint8Array(),u.toUint8Array(),a.data),h=A.Span.fromSlice(a.data,0),p=A.Bytes.fromSlice(a.data,A.Span.LENGTH);return{data:l,identifier:r,signature:u,span:h,payload:p,address:c,owner:i.publicKey().address()}}const Ri=q.getInstance(),Ci=X.getInstance();function Ni(a){return new Promise(r=>{setTimeout(r,a)})}function Gt(a){return(a.startsWith("0x")?a.slice(2):a).toLowerCase()}async function Kt(a,r=3,i=250){return new Promise((c,u)=>{a().then(c).catch(l=>{r>0?(Ri.info(`Retrying... Attempts left: ${r}. Error: ${l.message}`),setTimeout(()=>{Kt(a,r-1,i).then(c).catch(u)},i)):(Ci.handleError(l,"Utils.retryAwaitableAsync"),u(l))})})}class ji{constructor(){this.events={},this.on=this.on.bind(this),this.off=this.off.bind(this),this.cleanAll=this.cleanAll.bind(this),this.emit=this.emit.bind(this)}on(r,i){this.events[r]||(this.events[r]=[]),this.events[r].push(i)}off(r,i){if(!this.events[r])return;const c=this.events[r].indexOf(i);c>-1&&this.events[r].splice(c,1)}cleanAll(){this.events={}}emit(r,i){this.events[r]&&this.events[r].forEach(c=>c(i))}}var M;(function(a){a.assertEqual=u=>u;function r(u){}a.assertIs=r;function i(u){throw new Error}a.assertNever=i,a.arrayToEnum=u=>{const l={};for(const h of u)l[h]=h;return l},a.getValidEnumValues=u=>{const l=a.objectKeys(u).filter(p=>typeof u[u[p]]!="number"),h={};for(const p of l)h[p]=u[p];return a.objectValues(h)},a.objectValues=u=>a.objectKeys(u).map(function(l){return u[l]}),a.objectKeys=typeof Object.keys=="function"?u=>Object.keys(u):u=>{const l=[];for(const h in u)Object.prototype.hasOwnProperty.call(u,h)&&l.push(h);return l},a.find=(u,l)=>{for(const h of u)if(l(h))return h},a.isInteger=typeof Number.isInteger=="function"?u=>Number.isInteger(u):u=>typeof u=="number"&&isFinite(u)&&Math.floor(u)===u;function c(u,l=" | "){return u.map(h=>typeof h=="string"?`'${h}'`:h).join(l)}a.joinValues=c,a.jsonStringifyReplacer=(u,l)=>typeof l=="bigint"?l.toString():l})(M||(M={}));var Yt;(function(a){a.mergeShapes=(r,i)=>({...r,...i})})(Yt||(Yt={}));const _=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),se=a=>{switch(typeof a){case"undefined":return _.undefined;case"string":return _.string;case"number":return isNaN(a)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(a)?_.array:a===null?_.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?_.promise:typeof Map<"u"&&a instanceof Map?_.map:typeof Set<"u"&&a instanceof Set?_.set:typeof Date<"u"&&a instanceof Date?_.date:_.object;default:return _.unknown}},w=M.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Di=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:");class F extends Error{get errors(){return this.issues}constructor(r){super(),this.issues=[],this.addIssue=c=>{this.issues=[...this.issues,c]},this.addIssues=(c=[])=>{this.issues=[...this.issues,...c]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=r}format(r){const i=r||function(l){return l.message},c={_errors:[]},u=l=>{for(const h of l.issues)if(h.code==="invalid_union")h.unionErrors.map(u);else if(h.code==="invalid_return_type")u(h.returnTypeError);else if(h.code==="invalid_arguments")u(h.argumentsError);else if(h.path.length===0)c._errors.push(i(h));else{let p=c,g=0;for(;g<h.path.length;){const y=h.path[g];g===h.path.length-1?(p[y]=p[y]||{_errors:[]},p[y]._errors.push(i(h))):p[y]=p[y]||{_errors:[]},p=p[y],g++}}};return u(this),c}static assert(r){if(!(r instanceof F))throw new Error(`Not a ZodError: ${r}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(r=i=>i.message){const i={},c=[];for(const u of this.issues)u.path.length>0?(i[u.path[0]]=i[u.path[0]]||[],i[u.path[0]].push(r(u))):c.push(r(u));return{formErrors:c,fieldErrors:i}}get formErrors(){return this.flatten()}}F.create=a=>new F(a);const Ie=(a,r)=>{let i;switch(a.code){case w.invalid_type:a.received===_.undefined?i="Required":i=`Expected ${a.expected}, received ${a.received}`;break;case w.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(a.expected,M.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:i=`Unrecognized key(s) in object: ${M.joinValues(a.keys,", ")}`;break;case w.invalid_union:i="Invalid input";break;case w.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${M.joinValues(a.options)}`;break;case w.invalid_enum_value:i=`Invalid enum value. Expected ${M.joinValues(a.options)}, received '${a.received}'`;break;case w.invalid_arguments:i="Invalid function arguments";break;case w.invalid_return_type:i="Invalid function return type";break;case w.invalid_date:i="Invalid date";break;case w.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(i=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?i=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?i=`Invalid input: must end with "${a.validation.endsWith}"`:M.assertNever(a.validation):a.validation!=="regex"?i=`Invalid ${a.validation}`:i="Invalid";break;case w.too_small:a.type==="array"?i=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?i=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?i=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?i=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:i="Invalid input";break;case w.too_big:a.type==="array"?i=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?i=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?i=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?i=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?i=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:i="Invalid input";break;case w.custom:i="Invalid input";break;case w.invalid_intersection_types:i="Intersection results could not be merged";break;case w.not_multiple_of:i=`Number must be a multiple of ${a.multipleOf}`;break;case w.not_finite:i="Number must be finite";break;default:i=r.defaultError,M.assertNever(a)}return{message:i}};let Zn=Ie;function Pi(a){Zn=a}function kt(){return Zn}const Et=a=>{const{data:r,path:i,errorMaps:c,issueData:u}=a,l=[...i,...u.path||[]],h={...u,path:l};if(u.message!==void 0)return{...u,path:l,message:u.message};let p="";const g=c.filter(y=>!!y).slice().reverse();for(const y of g)p=y(h,{data:r,defaultError:p}).message;return{...u,path:l,message:p}},Ui=[];function b(a,r){const i=kt(),c=Et({issueData:r,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,i,i===Ie?void 0:Ie].filter(u=>!!u)});a.common.issues.push(c)}class L{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(r,i){const c=[];for(const u of i){if(u.status==="aborted")return T;u.status==="dirty"&&r.dirty(),c.push(u.value)}return{status:r.value,value:c}}static async mergeObjectAsync(r,i){const c=[];for(const u of i){const l=await u.key,h=await u.value;c.push({key:l,value:h})}return L.mergeObjectSync(r,c)}static mergeObjectSync(r,i){const c={};for(const u of i){const{key:l,value:h}=u;if(l.status==="aborted"||h.status==="aborted")return T;l.status==="dirty"&&r.dirty(),h.status==="dirty"&&r.dirty(),l.value!=="__proto__"&&(typeof h.value<"u"||u.alwaysSet)&&(c[l.value]=h.value)}return{status:r.value,value:c}}}const T=Object.freeze({status:"aborted"}),Me=a=>({status:"dirty",value:a}),V=a=>({status:"valid",value:a}),Qt=a=>a.status==="aborted",Xt=a=>a.status==="dirty",we=a=>a.status==="valid",Ve=a=>typeof Promise<"u"&&a instanceof Promise;function St(a,r,i,c){if(typeof r=="function"?a!==r||!c:!r.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r.get(a)}function Bn(a,r,i,c,u){if(typeof r=="function"?a!==r||!u:!r.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r.set(a,i),i}typeof SuppressedError=="function"&&SuppressedError;var x;(function(a){a.errToObj=r=>typeof r=="string"?{message:r}:r||{},a.toString=r=>typeof r=="string"?r:r==null?void 0:r.message})(x||(x={}));var Fe,We;class J{constructor(r,i,c,u){this._cachedPath=[],this.parent=r,this.data=i,this._path=c,this._key=u}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ln=(a,r)=>{if(we(r))return{success:!0,data:r.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new F(a.common.issues);return this._error=i,this._error}}};function O(a){if(!a)return{};const{errorMap:r,invalid_type_error:i,required_error:c,description:u}=a;if(r&&(i||c))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return r?{errorMap:r,description:u}:{errorMap:(h,p)=>{var g,y;const{message:E}=a;return h.code==="invalid_enum_value"?{message:E??p.defaultError}:typeof p.data>"u"?{message:(g=E??c)!==null&&g!==void 0?g:p.defaultError}:h.code!=="invalid_type"?{message:p.defaultError}:{message:(y=E??i)!==null&&y!==void 0?y:p.defaultError}},description:u}}class I{get description(){return this._def.description}_getType(r){return se(r.data)}_getOrReturnCtx(r,i){return i||{common:r.parent.common,data:r.data,parsedType:se(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}_processInputParams(r){return{status:new L,ctx:{common:r.parent.common,data:r.data,parsedType:se(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}}_parseSync(r){const i=this._parse(r);if(Ve(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(r){const i=this._parse(r);return Promise.resolve(i)}parse(r,i){const c=this.safeParse(r,i);if(c.success)return c.data;throw c.error}safeParse(r,i){var c;const u={common:{issues:[],async:(c=i==null?void 0:i.async)!==null&&c!==void 0?c:!1,contextualErrorMap:i==null?void 0:i.errorMap},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:se(r)},l=this._parseSync({data:r,path:u.path,parent:u});return Ln(u,l)}"~validate"(r){var i,c;const u={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:se(r)};if(!this["~standard"].async)try{const l=this._parseSync({data:r,path:[],parent:u});return we(l)?{value:l.value}:{issues:u.common.issues}}catch(l){!((c=(i=l==null?void 0:l.message)===null||i===void 0?void 0:i.toLowerCase())===null||c===void 0)&&c.includes("encountered")&&(this["~standard"].async=!0),u.common={issues:[],async:!0}}return this._parseAsync({data:r,path:[],parent:u}).then(l=>we(l)?{value:l.value}:{issues:u.common.issues})}async parseAsync(r,i){const c=await this.safeParseAsync(r,i);if(c.success)return c.data;throw c.error}async safeParseAsync(r,i){const c={common:{issues:[],contextualErrorMap:i==null?void 0:i.errorMap,async:!0},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:se(r)},u=this._parse({data:r,path:c.path,parent:c}),l=await(Ve(u)?u:Promise.resolve(u));return Ln(c,l)}refine(r,i){const c=u=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(u):i;return this._refinement((u,l)=>{const h=r(u),p=()=>l.addIssue({code:w.custom,...c(u)});return typeof Promise<"u"&&h instanceof Promise?h.then(g=>g?!0:(p(),!1)):h?!0:(p(),!1)})}refinement(r,i){return this._refinement((c,u)=>r(c)?!0:(u.addIssue(typeof i=="function"?i(c,u):i),!1))}_refinement(r){return new Y({schema:this,typeName:S.ZodEffects,effect:{type:"refinement",refinement:r}})}superRefine(r){return this._refinement(r)}constructor(r){this.spa=this.safeParseAsync,this._def=r,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:i=>this["~validate"](i)}}optional(){return te.create(this,this._def)}nullable(){return he.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return K.create(this)}promise(){return Ne.create(this,this._def)}or(r){return Ke.create([this,r],this._def)}and(r){return Ye.create(this,r,this._def)}transform(r){return new Y({...O(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:r}})}default(r){const i=typeof r=="function"?r:()=>r;return new tt({...O(this._def),innerType:this,defaultValue:i,typeName:S.ZodDefault})}brand(){return new tr({typeName:S.ZodBranded,type:this,...O(this._def)})}catch(r){const i=typeof r=="function"?r:()=>r;return new rt({...O(this._def),innerType:this,catchValue:i,typeName:S.ZodCatch})}describe(r){const i=this.constructor;return new i({...this._def,description:r})}pipe(r){return nt.create(this,r)}readonly(){return st.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Zi=/^c[^\s-]{8,}$/i,Bi=/^[0-9a-z]+$/,Li=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zi=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Vi=/^[a-z0-9_-]{21}$/i,Fi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Wi=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Hi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Jt;const Gi=/^(?:(?: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])$/,Ki=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Yi=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Qi=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ji=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zn="((\\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])))",ea=new RegExp(`^${zn}$`);function Vn(a){let r="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return a.precision?r=`${r}\\.\\d{${a.precision}}`:a.precision==null&&(r=`${r}(\\.\\d+)?`),r}function ta(a){return new RegExp(`^${Vn(a)}$`)}function Fn(a){let r=`${zn}T${Vn(a)}`;const i=[];return i.push(a.local?"Z?":"Z"),a.offset&&i.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${i.join("|")})`,new RegExp(`^${r}$`)}function ra(a,r){return!!((r==="v4"||!r)&&Gi.test(a)||(r==="v6"||!r)&&Yi.test(a))}function na(a,r){if(!Fi.test(a))return!1;try{const[i]=a.split("."),c=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),u=JSON.parse(atob(c));return!(typeof u!="object"||u===null||!u.typ||!u.alg||r&&u.alg!==r)}catch{return!1}}function sa(a,r){return!!((r==="v4"||!r)&&Ki.test(a)||(r==="v6"||!r)&&Qi.test(a))}class G extends I{_parse(r){if(this._def.coerce&&(r.data=String(r.data)),this._getType(r)!==_.string){const l=this._getOrReturnCtx(r);return b(l,{code:w.invalid_type,expected:_.string,received:l.parsedType}),T}const c=new L;let u;for(const l of this._def.checks)if(l.kind==="min")r.data.length<l.value&&(u=this._getOrReturnCtx(r,u),b(u,{code:w.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),c.dirty());else if(l.kind==="max")r.data.length>l.value&&(u=this._getOrReturnCtx(r,u),b(u,{code:w.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),c.dirty());else if(l.kind==="length"){const h=r.data.length>l.value,p=r.data.length<l.value;(h||p)&&(u=this._getOrReturnCtx(r,u),h?b(u,{code:w.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):p&&b(u,{code:w.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),c.dirty())}else if(l.kind==="email")Hi.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"email",code:w.invalid_string,message:l.message}),c.dirty());else if(l.kind==="emoji")Jt||(Jt=new RegExp(qi,"u")),Jt.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"emoji",code:w.invalid_string,message:l.message}),c.dirty());else if(l.kind==="uuid")zi.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"uuid",code:w.invalid_string,message:l.message}),c.dirty());else if(l.kind==="nanoid")Vi.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"nanoid",code:w.invalid_string,message:l.message}),c.dirty());else if(l.kind==="cuid")Zi.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"cuid",code:w.invalid_string,message:l.message}),c.dirty());else if(l.kind==="cuid2")Bi.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"cuid2",code:w.invalid_string,message:l.message}),c.dirty());else if(l.kind==="ulid")Li.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"ulid",code:w.invalid_string,message:l.message}),c.dirty());else if(l.kind==="url")try{new URL(r.data)}catch{u=this._getOrReturnCtx(r,u),b(u,{validation:"url",code:w.invalid_string,message:l.message}),c.dirty()}else l.kind==="regex"?(l.regex.lastIndex=0,l.regex.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"regex",code:w.invalid_string,message:l.message}),c.dirty())):l.kind==="trim"?r.data=r.data.trim():l.kind==="includes"?r.data.includes(l.value,l.position)||(u=this._getOrReturnCtx(r,u),b(u,{code:w.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),c.dirty()):l.kind==="toLowerCase"?r.data=r.data.toLowerCase():l.kind==="toUpperCase"?r.data=r.data.toUpperCase():l.kind==="startsWith"?r.data.startsWith(l.value)||(u=this._getOrReturnCtx(r,u),b(u,{code:w.invalid_string,validation:{startsWith:l.value},message:l.message}),c.dirty()):l.kind==="endsWith"?r.data.endsWith(l.value)||(u=this._getOrReturnCtx(r,u),b(u,{code:w.invalid_string,validation:{endsWith:l.value},message:l.message}),c.dirty()):l.kind==="datetime"?Fn(l).test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{code:w.invalid_string,validation:"datetime",message:l.message}),c.dirty()):l.kind==="date"?ea.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{code:w.invalid_string,validation:"date",message:l.message}),c.dirty()):l.kind==="time"?ta(l).test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{code:w.invalid_string,validation:"time",message:l.message}),c.dirty()):l.kind==="duration"?Wi.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"duration",code:w.invalid_string,message:l.message}),c.dirty()):l.kind==="ip"?ra(r.data,l.version)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"ip",code:w.invalid_string,message:l.message}),c.dirty()):l.kind==="jwt"?na(r.data,l.alg)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"jwt",code:w.invalid_string,message:l.message}),c.dirty()):l.kind==="cidr"?sa(r.data,l.version)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"cidr",code:w.invalid_string,message:l.message}),c.dirty()):l.kind==="base64"?Xi.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"base64",code:w.invalid_string,message:l.message}),c.dirty()):l.kind==="base64url"?Ji.test(r.data)||(u=this._getOrReturnCtx(r,u),b(u,{validation:"base64url",code:w.invalid_string,message:l.message}),c.dirty()):M.assertNever(l);return{status:c.value,value:r.data}}_regex(r,i,c){return this.refinement(u=>r.test(u),{validation:i,code:w.invalid_string,...x.errToObj(c)})}_addCheck(r){return new G({...this._def,checks:[...this._def.checks,r]})}email(r){return this._addCheck({kind:"email",...x.errToObj(r)})}url(r){return this._addCheck({kind:"url",...x.errToObj(r)})}emoji(r){return this._addCheck({kind:"emoji",...x.errToObj(r)})}uuid(r){return this._addCheck({kind:"uuid",...x.errToObj(r)})}nanoid(r){return this._addCheck({kind:"nanoid",...x.errToObj(r)})}cuid(r){return this._addCheck({kind:"cuid",...x.errToObj(r)})}cuid2(r){return this._addCheck({kind:"cuid2",...x.errToObj(r)})}ulid(r){return this._addCheck({kind:"ulid",...x.errToObj(r)})}base64(r){return this._addCheck({kind:"base64",...x.errToObj(r)})}base64url(r){return this._addCheck({kind:"base64url",...x.errToObj(r)})}jwt(r){return this._addCheck({kind:"jwt",...x.errToObj(r)})}ip(r){return this._addCheck({kind:"ip",...x.errToObj(r)})}cidr(r){return this._addCheck({kind:"cidr",...x.errToObj(r)})}datetime(r){var i,c;return typeof r=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:r}):this._addCheck({kind:"datetime",precision:typeof(r==null?void 0:r.precision)>"u"?null:r==null?void 0:r.precision,offset:(i=r==null?void 0:r.offset)!==null&&i!==void 0?i:!1,local:(c=r==null?void 0:r.local)!==null&&c!==void 0?c:!1,...x.errToObj(r==null?void 0:r.message)})}date(r){return this._addCheck({kind:"date",message:r})}time(r){return typeof r=="string"?this._addCheck({kind:"time",precision:null,message:r}):this._addCheck({kind:"time",precision:typeof(r==null?void 0:r.precision)>"u"?null:r==null?void 0:r.precision,...x.errToObj(r==null?void 0:r.message)})}duration(r){return this._addCheck({kind:"duration",...x.errToObj(r)})}regex(r,i){return this._addCheck({kind:"regex",regex:r,...x.errToObj(i)})}includes(r,i){return this._addCheck({kind:"includes",value:r,position:i==null?void 0:i.position,...x.errToObj(i==null?void 0:i.message)})}startsWith(r,i){return this._addCheck({kind:"startsWith",value:r,...x.errToObj(i)})}endsWith(r,i){return this._addCheck({kind:"endsWith",value:r,...x.errToObj(i)})}min(r,i){return this._addCheck({kind:"min",value:r,...x.errToObj(i)})}max(r,i){return this._addCheck({kind:"max",value:r,...x.errToObj(i)})}length(r,i){return this._addCheck({kind:"length",value:r,...x.errToObj(i)})}nonempty(r){return this.min(1,x.errToObj(r))}trim(){return new G({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new G({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new G({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(r=>r.kind==="datetime")}get isDate(){return!!this._def.checks.find(r=>r.kind==="date")}get isTime(){return!!this._def.checks.find(r=>r.kind==="time")}get isDuration(){return!!this._def.checks.find(r=>r.kind==="duration")}get isEmail(){return!!this._def.checks.find(r=>r.kind==="email")}get isURL(){return!!this._def.checks.find(r=>r.kind==="url")}get isEmoji(){return!!this._def.checks.find(r=>r.kind==="emoji")}get isUUID(){return!!this._def.checks.find(r=>r.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(r=>r.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(r=>r.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(r=>r.kind==="cuid2")}get isULID(){return!!this._def.checks.find(r=>r.kind==="ulid")}get isIP(){return!!this._def.checks.find(r=>r.kind==="ip")}get isCIDR(){return!!this._def.checks.find(r=>r.kind==="cidr")}get isBase64(){return!!this._def.checks.find(r=>r.kind==="base64")}get isBase64url(){return!!this._def.checks.find(r=>r.kind==="base64url")}get minLength(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r}get maxLength(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r}}G.create=a=>{var r;return new G({checks:[],typeName:S.ZodString,coerce:(r=a==null?void 0:a.coerce)!==null&&r!==void 0?r:!1,...O(a)})};function ia(a,r){const i=(a.toString().split(".")[1]||"").length,c=(r.toString().split(".")[1]||"").length,u=i>c?i:c,l=parseInt(a.toFixed(u).replace(".","")),h=parseInt(r.toFixed(u).replace(".",""));return l%h/Math.pow(10,u)}class le extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(r){if(this._def.coerce&&(r.data=Number(r.data)),this._getType(r)!==_.number){const l=this._getOrReturnCtx(r);return b(l,{code:w.invalid_type,expected:_.number,received:l.parsedType}),T}let c;const u=new L;for(const l of this._def.checks)l.kind==="int"?M.isInteger(r.data)||(c=this._getOrReturnCtx(r,c),b(c,{code:w.invalid_type,expected:"integer",received:"float",message:l.message}),u.dirty()):l.kind==="min"?(l.inclusive?r.data<l.value:r.data<=l.value)&&(c=this._getOrReturnCtx(r,c),b(c,{code:w.too_small,minimum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),u.dirty()):l.kind==="max"?(l.inclusive?r.data>l.value:r.data>=l.value)&&(c=this._getOrReturnCtx(r,c),b(c,{code:w.too_big,maximum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),u.dirty()):l.kind==="multipleOf"?ia(r.data,l.value)!==0&&(c=this._getOrReturnCtx(r,c),b(c,{code:w.not_multiple_of,multipleOf:l.value,message:l.message}),u.dirty()):l.kind==="finite"?Number.isFinite(r.data)||(c=this._getOrReturnCtx(r,c),b(c,{code:w.not_finite,message:l.message}),u.dirty()):M.assertNever(l);return{status:u.value,value:r.data}}gte(r,i){return this.setLimit("min",r,!0,x.toString(i))}gt(r,i){return this.setLimit("min",r,!1,x.toString(i))}lte(r,i){return this.setLimit("max",r,!0,x.toString(i))}lt(r,i){return this.setLimit("max",r,!1,x.toString(i))}setLimit(r,i,c,u){return new le({...this._def,checks:[...this._def.checks,{kind:r,value:i,inclusive:c,message:x.toString(u)}]})}_addCheck(r){return new le({...this._def,checks:[...this._def.checks,r]})}int(r){return this._addCheck({kind:"int",message:x.toString(r)})}positive(r){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(r)})}negative(r){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(r)})}multipleOf(r,i){return this._addCheck({kind:"multipleOf",value:r,message:x.toString(i)})}finite(r){return this._addCheck({kind:"finite",message:x.toString(r)})}safe(r){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(r)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(r)})}get minValue(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r}get maxValue(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r}get isInt(){return!!this._def.checks.find(r=>r.kind==="int"||r.kind==="multipleOf"&&M.isInteger(r.value))}get isFinite(){let r=null,i=null;for(const c of this._def.checks){if(c.kind==="finite"||c.kind==="int"||c.kind==="multipleOf")return!0;c.kind==="min"?(i===null||c.value>i)&&(i=c.value):c.kind==="max"&&(r===null||c.value<r)&&(r=c.value)}return Number.isFinite(i)&&Number.isFinite(r)}}le.create=a=>new le({checks:[],typeName:S.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...O(a)});class de extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(r){if(this._def.coerce)try{r.data=BigInt(r.data)}catch{return this._getInvalidInput(r)}if(this._getType(r)!==_.bigint)return this._getInvalidInput(r);let c;const u=new L;for(const l of this._def.checks)l.kind==="min"?(l.inclusive?r.data<l.value:r.data<=l.value)&&(c=this._getOrReturnCtx(r,c),b(c,{code:w.too_small,type:"bigint",minimum:l.value,inclusive:l.inclusive,message:l.message}),u.dirty()):l.kind==="max"?(l.inclusive?r.data>l.value:r.data>=l.value)&&(c=this._getOrReturnCtx(r,c),b(c,{code:w.too_big,type:"bigint",maximum:l.value,inclusive:l.inclusive,message:l.message}),u.dirty()):l.kind==="multipleOf"?r.data%l.value!==BigInt(0)&&(c=this._getOrReturnCtx(r,c),b(c,{code:w.not_multiple_of,multipleOf:l.value,message:l.message}),u.dirty()):M.assertNever(l);return{status:u.value,value:r.data}}_getInvalidInput(r){const i=this._getOrReturnCtx(r);return b(i,{code:w.invalid_type,expected:_.bigint,received:i.parsedType}),T}gte(r,i){return this.setLimit("min",r,!0,x.toString(i))}gt(r,i){return this.setLimit("min",r,!1,x.toString(i))}lte(r,i){return this.setLimit("max",r,!0,x.toString(i))}lt(r,i){return this.setLimit("max",r,!1,x.toString(i))}setLimit(r,i,c,u){return new de({...this._def,checks:[...this._def.checks,{kind:r,value:i,inclusive:c,message:x.toString(u)}]})}_addCheck(r){return new de({...this._def,checks:[...this._def.checks,r]})}positive(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(r)})}negative(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(r)})}multipleOf(r,i){return this._addCheck({kind:"multipleOf",value:r,message:x.toString(i)})}get minValue(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r}get maxValue(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r}}de.create=a=>{var r;return new de({checks:[],typeName:S.ZodBigInt,coerce:(r=a==null?void 0:a.coerce)!==null&&r!==void 0?r:!1,...O(a)})};class He extends I{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==_.boolean){const c=this._getOrReturnCtx(r);return b(c,{code:w.invalid_type,expected:_.boolean,received:c.parsedType}),T}return V(r.data)}}He.create=a=>new He({typeName:S.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...O(a)});class be extends I{_parse(r){if(this._def.coerce&&(r.data=new Date(r.data)),this._getType(r)!==_.date){const l=this._getOrReturnCtx(r);return b(l,{code:w.invalid_type,expected:_.date,received:l.parsedType}),T}if(isNaN(r.data.getTime())){const l=this._getOrReturnCtx(r);return b(l,{code:w.invalid_date}),T}const c=new L;let u;for(const l of this._def.checks)l.kind==="min"?r.data.getTime()<l.value&&(u=this._getOrReturnCtx(r,u),b(u,{code:w.too_small,message:l.message,inclusive:!0,exact:!1,minimum:l.value,type:"date"}),c.dirty()):l.kind==="max"?r.data.getTime()>l.value&&(u=this._getOrReturnCtx(r,u),b(u,{code:w.too_big,message:l.message,inclusive:!0,exact:!1,maximum:l.value,type:"date"}),c.dirty()):M.assertNever(l);return{status:c.value,value:new Date(r.data.getTime())}}_addCheck(r){return new be({...this._def,checks:[...this._def.checks,r]})}min(r,i){return this._addCheck({kind:"min",value:r.getTime(),message:x.toString(i)})}max(r,i){return this._addCheck({kind:"max",value:r.getTime(),message:x.toString(i)})}get minDate(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r!=null?new Date(r):null}get maxDate(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r!=null?new Date(r):null}}be.create=a=>new be({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:S.ZodDate,...O(a)});class Tt extends I{_parse(r){if(this._getType(r)!==_.symbol){const c=this._getOrReturnCtx(r);return b(c,{code:w.invalid_type,expected:_.symbol,received:c.parsedType}),T}return V(r.data)}}Tt.create=a=>new Tt({typeName:S.ZodSymbol,...O(a)});class qe extends I{_parse(r){if(this._getType(r)!==_.undefined){const c=this._getOrReturnCtx(r);return b(c,{code:w.invalid_type,expected:_.undefined,received:c.parsedType}),T}return V(r.data)}}qe.create=a=>new qe({typeName:S.ZodUndefined,...O(a)});class Ge extends I{_parse(r){if(this._getType(r)!==_.null){const c=this._getOrReturnCtx(r);return b(c,{code:w.invalid_type,expected:_.null,received:c.parsedType}),T}return V(r.data)}}Ge.create=a=>new Ge({typeName:S.ZodNull,...O(a)});class $e extends I{constructor(){super(...arguments),this._any=!0}_parse(r){return V(r.data)}}$e.create=a=>new $e({typeName:S.ZodAny,...O(a)});class _e extends I{constructor(){super(...arguments),this._unknown=!0}_parse(r){return V(r.data)}}_e.create=a=>new _e({typeName:S.ZodUnknown,...O(a)});class ie extends I{_parse(r){const i=this._getOrReturnCtx(r);return b(i,{code:w.invalid_type,expected:_.never,received:i.parsedType}),T}}ie.create=a=>new ie({typeName:S.ZodNever,...O(a)});class At extends I{_parse(r){if(this._getType(r)!==_.undefined){const c=this._getOrReturnCtx(r);return b(c,{code:w.invalid_type,expected:_.void,received:c.parsedType}),T}return V(r.data)}}At.create=a=>new At({typeName:S.ZodVoid,...O(a)});class K extends I{_parse(r){const{ctx:i,status:c}=this._processInputParams(r),u=this._def;if(i.parsedType!==_.array)return b(i,{code:w.invalid_type,expected:_.array,received:i.parsedType}),T;if(u.exactLength!==null){const h=i.data.length>u.exactLength.value,p=i.data.length<u.exactLength.value;(h||p)&&(b(i,{code:h?w.too_big:w.too_small,minimum:p?u.exactLength.value:void 0,maximum:h?u.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:u.exactLength.message}),c.dirty())}if(u.minLength!==null&&i.data.length<u.minLength.value&&(b(i,{code:w.too_small,minimum:u.minLength.value,type:"array",inclusive:!0,exact:!1,message:u.minLength.message}),c.dirty()),u.maxLength!==null&&i.data.length>u.maxLength.value&&(b(i,{code:w.too_big,maximum:u.maxLength.value,type:"array",inclusive:!0,exact:!1,message:u.maxLength.message}),c.dirty()),i.common.async)return Promise.all([...i.data].map((h,p)=>u.type._parseAsync(new J(i,h,i.path,p)))).then(h=>L.mergeArray(c,h));const l=[...i.data].map((h,p)=>u.type._parseSync(new J(i,h,i.path,p)));return L.mergeArray(c,l)}get element(){return this._def.type}min(r,i){return new K({...this._def,minLength:{value:r,message:x.toString(i)}})}max(r,i){return new K({...this._def,maxLength:{value:r,message:x.toString(i)}})}length(r,i){return new K({...this._def,exactLength:{value:r,message:x.toString(i)}})}nonempty(r){return this.min(1,r)}}K.create=(a,r)=>new K({type:a,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...O(r)});function Re(a){if(a instanceof N){const r={};for(const i in a.shape){const c=a.shape[i];r[i]=te.create(Re(c))}return new N({...a._def,shape:()=>r})}else return a instanceof K?new K({...a._def,type:Re(a.element)}):a instanceof te?te.create(Re(a.unwrap())):a instanceof he?he.create(Re(a.unwrap())):a instanceof ee?ee.create(a.items.map(r=>Re(r))):a}class N extends I{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const r=this._def.shape(),i=M.objectKeys(r);return this._cached={shape:r,keys:i}}_parse(r){if(this._getType(r)!==_.object){const y=this._getOrReturnCtx(r);return b(y,{code:w.invalid_type,expected:_.object,received:y.parsedType}),T}const{status:c,ctx:u}=this._processInputParams(r),{shape:l,keys:h}=this._getCached(),p=[];if(!(this._def.catchall instanceof ie&&this._def.unknownKeys==="strip"))for(const y in u.data)h.includes(y)||p.push(y);const g=[];for(const y of h){const E=l[y],j=u.data[y];g.push({key:{status:"valid",value:y},value:E._parse(new J(u,j,u.path,y)),alwaysSet:y in u.data})}if(this._def.catchall instanceof ie){const y=this._def.unknownKeys;if(y==="passthrough")for(const E of p)g.push({key:{status:"valid",value:E},value:{status:"valid",value:u.data[E]}});else if(y==="strict")p.length>0&&(b(u,{code:w.unrecognized_keys,keys:p}),c.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const y=this._def.catchall;for(const E of p){const j=u.data[E];g.push({key:{status:"valid",value:E},value:y._parse(new J(u,j,u.path,E)),alwaysSet:E in u.data})}}return u.common.async?Promise.resolve().then(async()=>{const y=[];for(const E of g){const j=await E.key,oe=await E.value;y.push({key:j,value:oe,alwaysSet:E.alwaysSet})}return y}).then(y=>L.mergeObjectSync(c,y)):L.mergeObjectSync(c,g)}get shape(){return this._def.shape()}strict(r){return x.errToObj,new N({...this._def,unknownKeys:"strict",...r!==void 0?{errorMap:(i,c)=>{var u,l,h,p;const g=(h=(l=(u=this._def).errorMap)===null||l===void 0?void 0:l.call(u,i,c).message)!==null&&h!==void 0?h:c.defaultError;return i.code==="unrecognized_keys"?{message:(p=x.errToObj(r).message)!==null&&p!==void 0?p:g}:{message:g}}}:{}})}strip(){return new N({...this._def,unknownKeys:"strip"})}passthrough(){return new N({...this._def,unknownKeys:"passthrough"})}extend(r){return new N({...this._def,shape:()=>({...this._def.shape(),...r})})}merge(r){return new N({unknownKeys:r._def.unknownKeys,catchall:r._def.catchall,shape:()=>({...this._def.shape(),...r._def.shape()}),typeName:S.ZodObject})}setKey(r,i){return this.augment({[r]:i})}catchall(r){return new N({...this._def,catchall:r})}pick(r){const i={};return M.objectKeys(r).forEach(c=>{r[c]&&this.shape[c]&&(i[c]=this.shape[c])}),new N({...this._def,shape:()=>i})}omit(r){const i={};return M.objectKeys(this.shape).forEach(c=>{r[c]||(i[c]=this.shape[c])}),new N({...this._def,shape:()=>i})}deepPartial(){return Re(this)}partial(r){const i={};return M.objectKeys(this.shape).forEach(c=>{const u=this.shape[c];r&&!r[c]?i[c]=u:i[c]=u.optional()}),new N({...this._def,shape:()=>i})}required(r){const i={};return M.objectKeys(this.shape).forEach(c=>{if(r&&!r[c])i[c]=this.shape[c];else{let l=this.shape[c];for(;l instanceof te;)l=l._def.innerType;i[c]=l}}),new N({...this._def,shape:()=>i})}keyof(){return Wn(M.objectKeys(this.shape))}}N.create=(a,r)=>new N({shape:()=>a,unknownKeys:"strip",catchall:ie.create(),typeName:S.ZodObject,...O(r)}),N.strictCreate=(a,r)=>new N({shape:()=>a,unknownKeys:"strict",catchall:ie.create(),typeName:S.ZodObject,...O(r)}),N.lazycreate=(a,r)=>new N({shape:a,unknownKeys:"strip",catchall:ie.create(),typeName:S.ZodObject,...O(r)});class Ke extends I{_parse(r){const{ctx:i}=this._processInputParams(r),c=this._def.options;function u(l){for(const p of l)if(p.result.status==="valid")return p.result;for(const p of l)if(p.result.status==="dirty")return i.common.issues.push(...p.ctx.common.issues),p.result;const h=l.map(p=>new F(p.ctx.common.issues));return b(i,{code:w.invalid_union,unionErrors:h}),T}if(i.common.async)return Promise.all(c.map(async l=>{const h={...i,common:{...i.common,issues:[]},parent:null};return{result:await l._parseAsync({data:i.data,path:i.path,parent:h}),ctx:h}})).then(u);{let l;const h=[];for(const g of c){const y={...i,common:{...i.common,issues:[]},parent:null},E=g._parseSync({data:i.data,path:i.path,parent:y});if(E.status==="valid")return E;E.status==="dirty"&&!l&&(l={result:E,ctx:y}),y.common.issues.length&&h.push(y.common.issues)}if(l)return i.common.issues.push(...l.ctx.common.issues),l.result;const p=h.map(g=>new F(g));return b(i,{code:w.invalid_union,unionErrors:p}),T}}get options(){return this._def.options}}Ke.create=(a,r)=>new Ke({options:a,typeName:S.ZodUnion,...O(r)});const ae=a=>a instanceof Xe?ae(a.schema):a instanceof Y?ae(a.innerType()):a instanceof Je?[a.value]:a instanceof fe?a.options:a instanceof et?M.objectValues(a.enum):a instanceof tt?ae(a._def.innerType):a instanceof qe?[void 0]:a instanceof Ge?[null]:a instanceof te?[void 0,...ae(a.unwrap())]:a instanceof he?[null,...ae(a.unwrap())]:a instanceof tr||a instanceof st?ae(a.unwrap()):a instanceof rt?ae(a._def.innerType):[];class Ot extends I{_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==_.object)return b(i,{code:w.invalid_type,expected:_.object,received:i.parsedType}),T;const c=this.discriminator,u=i.data[c],l=this.optionsMap.get(u);return l?i.common.async?l._parseAsync({data:i.data,path:i.path,parent:i}):l._parseSync({data:i.data,path:i.path,parent:i}):(b(i,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[c]}),T)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(r,i,c){const u=new Map;for(const l of i){const h=ae(l.shape[r]);if(!h.length)throw new Error(`A discriminator value for key \`${r}\` could not be extracted from all schema options`);for(const p of h){if(u.has(p))throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(p)}`);u.set(p,l)}}return new Ot({typeName:S.ZodDiscriminatedUnion,discriminator:r,options:i,optionsMap:u,...O(c)})}}function er(a,r){const i=se(a),c=se(r);if(a===r)return{valid:!0,data:a};if(i===_.object&&c===_.object){const u=M.objectKeys(r),l=M.objectKeys(a).filter(p=>u.indexOf(p)!==-1),h={...a,...r};for(const p of l){const g=er(a[p],r[p]);if(!g.valid)return{valid:!1};h[p]=g.data}return{valid:!0,data:h}}else if(i===_.array&&c===_.array){if(a.length!==r.length)return{valid:!1};const u=[];for(let l=0;l<a.length;l++){const h=a[l],p=r[l],g=er(h,p);if(!g.valid)return{valid:!1};u.push(g.data)}return{valid:!0,data:u}}else return i===_.date&&c===_.date&&+a==+r?{valid:!0,data:a}:{valid:!1}}class Ye extends I{_parse(r){const{status:i,ctx:c}=this._processInputParams(r),u=(l,h)=>{if(Qt(l)||Qt(h))return T;const p=er(l.value,h.value);return p.valid?((Xt(l)||Xt(h))&&i.dirty(),{status:i.value,value:p.data}):(b(c,{code:w.invalid_intersection_types}),T)};return c.common.async?Promise.all([this._def.left._parseAsync({data:c.data,path:c.path,parent:c}),this._def.right._parseAsync({data:c.data,path:c.path,parent:c})]).then(([l,h])=>u(l,h)):u(this._def.left._parseSync({data:c.data,path:c.path,parent:c}),this._def.right._parseSync({data:c.data,path:c.path,parent:c}))}}Ye.create=(a,r,i)=>new Ye({left:a,right:r,typeName:S.ZodIntersection,...O(i)});class ee extends I{_parse(r){const{status:i,ctx:c}=this._processInputParams(r);if(c.parsedType!==_.array)return b(c,{code:w.invalid_type,expected:_.array,received:c.parsedType}),T;if(c.data.length<this._def.items.length)return b(c,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),T;!this._def.rest&&c.data.length>this._def.items.length&&(b(c,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const l=[...c.data].map((h,p)=>{const g=this._def.items[p]||this._def.rest;return g?g._parse(new J(c,h,c.path,p)):null}).filter(h=>!!h);return c.common.async?Promise.all(l).then(h=>L.mergeArray(i,h)):L.mergeArray(i,l)}get items(){return this._def.items}rest(r){return new ee({...this._def,rest:r})}}ee.create=(a,r)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ee({items:a,typeName:S.ZodTuple,rest:null,...O(r)})};class Qe extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:i,ctx:c}=this._processInputParams(r);if(c.parsedType!==_.object)return b(c,{code:w.invalid_type,expected:_.object,received:c.parsedType}),T;const u=[],l=this._def.keyType,h=this._def.valueType;for(const p in c.data)u.push({key:l._parse(new J(c,p,c.path,p)),value:h._parse(new J(c,c.data[p],c.path,p)),alwaysSet:p in c.data});return c.common.async?L.mergeObjectAsync(i,u):L.mergeObjectSync(i,u)}get element(){return this._def.valueType}static create(r,i,c){return i instanceof I?new Qe({keyType:r,valueType:i,typeName:S.ZodRecord,...O(c)}):new Qe({keyType:G.create(),valueType:r,typeName:S.ZodRecord,...O(i)})}}class It extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:i,ctx:c}=this._processInputParams(r);if(c.parsedType!==_.map)return b(c,{code:w.invalid_type,expected:_.map,received:c.parsedType}),T;const u=this._def.keyType,l=this._def.valueType,h=[...c.data.entries()].map(([p,g],y)=>({key:u._parse(new J(c,p,c.path,[y,"key"])),value:l._parse(new J(c,g,c.path,[y,"value"]))}));if(c.common.async){const p=new Map;return Promise.resolve().then(async()=>{for(const g of h){const y=await g.key,E=await g.value;if(y.status==="aborted"||E.status==="aborted")return T;(y.status==="dirty"||E.status==="dirty")&&i.dirty(),p.set(y.value,E.value)}return{status:i.value,value:p}})}else{const p=new Map;for(const g of h){const y=g.key,E=g.value;if(y.status==="aborted"||E.status==="aborted")return T;(y.status==="dirty"||E.status==="dirty")&&i.dirty(),p.set(y.value,E.value)}return{status:i.value,value:p}}}}It.create=(a,r,i)=>new It({valueType:r,keyType:a,typeName:S.ZodMap,...O(i)});class xe extends I{_parse(r){const{status:i,ctx:c}=this._processInputParams(r);if(c.parsedType!==_.set)return b(c,{code:w.invalid_type,expected:_.set,received:c.parsedType}),T;const u=this._def;u.minSize!==null&&c.data.size<u.minSize.value&&(b(c,{code:w.too_small,minimum:u.minSize.value,type:"set",inclusive:!0,exact:!1,message:u.minSize.message}),i.dirty()),u.maxSize!==null&&c.data.size>u.maxSize.value&&(b(c,{code:w.too_big,maximum:u.maxSize.value,type:"set",inclusive:!0,exact:!1,message:u.maxSize.message}),i.dirty());const l=this._def.valueType;function h(g){const y=new Set;for(const E of g){if(E.status==="aborted")return T;E.status==="dirty"&&i.dirty(),y.add(E.value)}return{status:i.value,value:y}}const p=[...c.data.values()].map((g,y)=>l._parse(new J(c,g,c.path,y)));return c.common.async?Promise.all(p).then(g=>h(g)):h(p)}min(r,i){return new xe({...this._def,minSize:{value:r,message:x.toString(i)}})}max(r,i){return new xe({...this._def,maxSize:{value:r,message:x.toString(i)}})}size(r,i){return this.min(r,i).max(r,i)}nonempty(r){return this.min(1,r)}}xe.create=(a,r)=>new xe({valueType:a,minSize:null,maxSize:null,typeName:S.ZodSet,...O(r)});class Ce extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==_.function)return b(i,{code:w.invalid_type,expected:_.function,received:i.parsedType}),T;function c(p,g){return Et({data:p,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,kt(),Ie].filter(y=>!!y),issueData:{code:w.invalid_arguments,argumentsError:g}})}function u(p,g){return Et({data:p,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,kt(),Ie].filter(y=>!!y),issueData:{code:w.invalid_return_type,returnTypeError:g}})}const l={errorMap:i.common.contextualErrorMap},h=i.data;if(this._def.returns instanceof Ne){const p=this;return V(async function(...g){const y=new F([]),E=await p._def.args.parseAsync(g,l).catch(ce=>{throw y.addIssue(c(g,ce)),y}),j=await Reflect.apply(h,this,E);return await p._def.returns._def.type.parseAsync(j,l).catch(ce=>{throw y.addIssue(u(j,ce)),y})})}else{const p=this;return V(function(...g){const y=p._def.args.safeParse(g,l);if(!y.success)throw new F([c(g,y.error)]);const E=Reflect.apply(h,this,y.data),j=p._def.returns.safeParse(E,l);if(!j.success)throw new F([u(E,j.error)]);return j.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...r){return new Ce({...this._def,args:ee.create(r).rest(_e.create())})}returns(r){return new Ce({...this._def,returns:r})}implement(r){return this.parse(r)}strictImplement(r){return this.parse(r)}static create(r,i,c){return new Ce({args:r||ee.create([]).rest(_e.create()),returns:i||_e.create(),typeName:S.ZodFunction,...O(c)})}}class Xe extends I{get schema(){return this._def.getter()}_parse(r){const{ctx:i}=this._processInputParams(r);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}Xe.create=(a,r)=>new Xe({getter:a,typeName:S.ZodLazy,...O(r)});class Je extends I{_parse(r){if(r.data!==this._def.value){const i=this._getOrReturnCtx(r);return b(i,{received:i.data,code:w.invalid_literal,expected:this._def.value}),T}return{status:"valid",value:r.data}}get value(){return this._def.value}}Je.create=(a,r)=>new Je({value:a,typeName:S.ZodLiteral,...O(r)});function Wn(a,r){return new fe({values:a,typeName:S.ZodEnum,...O(r)})}class fe extends I{constructor(){super(...arguments),Fe.set(this,void 0)}_parse(r){if(typeof r.data!="string"){const i=this._getOrReturnCtx(r),c=this._def.values;return b(i,{expected:M.joinValues(c),received:i.parsedType,code:w.invalid_type}),T}if(St(this,Fe)||Bn(this,Fe,new Set(this._def.values)),!St(this,Fe).has(r.data)){const i=this._getOrReturnCtx(r),c=this._def.values;return b(i,{received:i.data,code:w.invalid_enum_value,options:c}),T}return V(r.data)}get options(){return this._def.values}get enum(){const r={};for(const i of this._def.values)r[i]=i;return r}get Values(){const r={};for(const i of this._def.values)r[i]=i;return r}get Enum(){const r={};for(const i of this._def.values)r[i]=i;return r}extract(r,i=this._def){return fe.create(r,{...this._def,...i})}exclude(r,i=this._def){return fe.create(this.options.filter(c=>!r.includes(c)),{...this._def,...i})}}Fe=new WeakMap,fe.create=Wn;class et extends I{constructor(){super(...arguments),We.set(this,void 0)}_parse(r){const i=M.getValidEnumValues(this._def.values),c=this._getOrReturnCtx(r);if(c.parsedType!==_.string&&c.parsedType!==_.number){const u=M.objectValues(i);return b(c,{expected:M.joinValues(u),received:c.parsedType,code:w.invalid_type}),T}if(St(this,We)||Bn(this,We,new Set(M.getValidEnumValues(this._def.values))),!St(this,We).has(r.data)){const u=M.objectValues(i);return b(c,{received:c.data,code:w.invalid_enum_value,options:u}),T}return V(r.data)}get enum(){return this._def.values}}We=new WeakMap,et.create=(a,r)=>new et({values:a,typeName:S.ZodNativeEnum,...O(r)});class Ne extends I{unwrap(){return this._def.type}_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==_.promise&&i.common.async===!1)return b(i,{code:w.invalid_type,expected:_.promise,received:i.parsedType}),T;const c=i.parsedType===_.promise?i.data:Promise.resolve(i.data);return V(c.then(u=>this._def.type.parseAsync(u,{path:i.path,errorMap:i.common.contextualErrorMap})))}}Ne.create=(a,r)=>new Ne({type:a,typeName:S.ZodPromise,...O(r)});class Y extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){const{status:i,ctx:c}=this._processInputParams(r),u=this._def.effect||null,l={addIssue:h=>{b(c,h),h.fatal?i.abort():i.dirty()},get path(){return c.path}};if(l.addIssue=l.addIssue.bind(l),u.type==="preprocess"){const h=u.transform(c.data,l);if(c.common.async)return Promise.resolve(h).then(async p=>{if(i.value==="aborted")return T;const g=await this._def.schema._parseAsync({data:p,path:c.path,parent:c});return g.status==="aborted"?T:g.status==="dirty"||i.value==="dirty"?Me(g.value):g});{if(i.value==="aborted")return T;const p=this._def.schema._parseSync({data:h,path:c.path,parent:c});return p.status==="aborted"?T:p.status==="dirty"||i.value==="dirty"?Me(p.value):p}}if(u.type==="refinement"){const h=p=>{const g=u.refinement(p,l);if(c.common.async)return Promise.resolve(g);if(g instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(c.common.async===!1){const p=this._def.schema._parseSync({data:c.data,path:c.path,parent:c});return p.status==="aborted"?T:(p.status==="dirty"&&i.dirty(),h(p.value),{status:i.value,value:p.value})}else return this._def.schema._parseAsync({data:c.data,path:c.path,parent:c}).then(p=>p.status==="aborted"?T:(p.status==="dirty"&&i.dirty(),h(p.value).then(()=>({status:i.value,value:p.value}))))}if(u.type==="transform")if(c.common.async===!1){const h=this._def.schema._parseSync({data:c.data,path:c.path,parent:c});if(!we(h))return h;const p=u.transform(h.value,l);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:p}}else return this._def.schema._parseAsync({data:c.data,path:c.path,parent:c}).then(h=>we(h)?Promise.resolve(u.transform(h.value,l)).then(p=>({status:i.value,value:p})):h);M.assertNever(u)}}Y.create=(a,r,i)=>new Y({schema:a,typeName:S.ZodEffects,effect:r,...O(i)}),Y.createWithPreprocess=(a,r,i)=>new Y({schema:r,effect:{type:"preprocess",transform:a},typeName:S.ZodEffects,...O(i)});class te extends I{_parse(r){return this._getType(r)===_.undefined?V(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}te.create=(a,r)=>new te({innerType:a,typeName:S.ZodOptional,...O(r)});class he extends I{_parse(r){return this._getType(r)===_.null?V(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}he.create=(a,r)=>new he({innerType:a,typeName:S.ZodNullable,...O(r)});class tt extends I{_parse(r){const{ctx:i}=this._processInputParams(r);let c=i.data;return i.parsedType===_.undefined&&(c=this._def.defaultValue()),this._def.innerType._parse({data:c,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}tt.create=(a,r)=>new tt({innerType:a,typeName:S.ZodDefault,defaultValue:typeof r.default=="function"?r.default:()=>r.default,...O(r)});class rt extends I{_parse(r){const{ctx:i}=this._processInputParams(r),c={...i,common:{...i.common,issues:[]}},u=this._def.innerType._parse({data:c.data,path:c.path,parent:{...c}});return Ve(u)?u.then(l=>({status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new F(c.common.issues)},input:c.data})})):{status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new F(c.common.issues)},input:c.data})}}removeCatch(){return this._def.innerType}}rt.create=(a,r)=>new rt({innerType:a,typeName:S.ZodCatch,catchValue:typeof r.catch=="function"?r.catch:()=>r.catch,...O(r)});class Mt extends I{_parse(r){if(this._getType(r)!==_.nan){const c=this._getOrReturnCtx(r);return b(c,{code:w.invalid_type,expected:_.nan,received:c.parsedType}),T}return{status:"valid",value:r.data}}}Mt.create=a=>new Mt({typeName:S.ZodNaN,...O(a)});const aa=Symbol("zod_brand");class tr extends I{_parse(r){const{ctx:i}=this._processInputParams(r),c=i.data;return this._def.type._parse({data:c,path:i.path,parent:i})}unwrap(){return this._def.type}}class nt extends I{_parse(r){const{status:i,ctx:c}=this._processInputParams(r);if(c.common.async)return(async()=>{const l=await this._def.in._parseAsync({data:c.data,path:c.path,parent:c});return l.status==="aborted"?T:l.status==="dirty"?(i.dirty(),Me(l.value)):this._def.out._parseAsync({data:l.value,path:c.path,parent:c})})();{const u=this._def.in._parseSync({data:c.data,path:c.path,parent:c});return u.status==="aborted"?T:u.status==="dirty"?(i.dirty(),{status:"dirty",value:u.value}):this._def.out._parseSync({data:u.value,path:c.path,parent:c})}}static create(r,i){return new nt({in:r,out:i,typeName:S.ZodPipeline})}}class st extends I{_parse(r){const i=this._def.innerType._parse(r),c=u=>(we(u)&&(u.value=Object.freeze(u.value)),u);return Ve(i)?i.then(u=>c(u)):c(i)}unwrap(){return this._def.innerType}}st.create=(a,r)=>new st({innerType:a,typeName:S.ZodReadonly,...O(r)});function Hn(a,r={},i){return a?$e.create().superRefine((c,u)=>{var l,h;if(!a(c)){const p=typeof r=="function"?r(c):typeof r=="string"?{message:r}:r,g=(h=(l=p.fatal)!==null&&l!==void 0?l:i)!==null&&h!==void 0?h:!0,y=typeof p=="string"?{message:p}:p;u.addIssue({code:"custom",...y,fatal:g})}}):$e.create()}const oa={object:N.lazycreate};var S;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(S||(S={}));const ca=(a,r={message:`Input not instance of ${a.name}`})=>Hn(i=>i instanceof a,r),qn=G.create,Gn=le.create,ua=Mt.create,la=de.create,Kn=He.create,da=be.create,fa=Tt.create,ha=qe.create,pa=Ge.create,ma=$e.create,ga=_e.create,ya=ie.create,va=At.create,wa=K.create,ba=N.create,_a=N.strictCreate,xa=Ke.create,ka=Ot.create,Ea=Ye.create,Sa=ee.create,Ta=Qe.create,Aa=It.create,Oa=xe.create,Ia=Ce.create,Ma=Xe.create,$a=Je.create,Ra=fe.create,Ca=et.create,Na=Ne.create,Yn=Y.create,ja=te.create,Da=he.create,Pa=Y.createWithPreprocess,Ua=nt.create;var D=Object.freeze({__proto__:null,defaultErrorMap:Ie,setErrorMap:Pi,getErrorMap:kt,makeIssue:Et,EMPTY_PATH:Ui,addIssueToContext:b,ParseStatus:L,INVALID:T,DIRTY:Me,OK:V,isAborted:Qt,isDirty:Xt,isValid:we,isAsync:Ve,get util(){return M},get objectUtil(){return Yt},ZodParsedType:_,getParsedType:se,ZodType:I,datetimeRegex:Fn,ZodString:G,ZodNumber:le,ZodBigInt:de,ZodBoolean:He,ZodDate:be,ZodSymbol:Tt,ZodUndefined:qe,ZodNull:Ge,ZodAny:$e,ZodUnknown:_e,ZodNever:ie,ZodVoid:At,ZodArray:K,ZodObject:N,ZodUnion:Ke,ZodDiscriminatedUnion:Ot,ZodIntersection:Ye,ZodTuple:ee,ZodRecord:Qe,ZodMap:It,ZodSet:xe,ZodFunction:Ce,ZodLazy:Xe,ZodLiteral:Je,ZodEnum:fe,ZodNativeEnum:et,ZodPromise:Ne,ZodEffects:Y,ZodTransformer:Y,ZodOptional:te,ZodNullable:he,ZodDefault:tt,ZodCatch:rt,ZodNaN:Mt,BRAND:aa,ZodBranded:tr,ZodPipeline:nt,ZodReadonly:st,custom:Hn,Schema:I,ZodSchema:I,late:oa,get ZodFirstPartyTypeKind(){return S},coerce:{string:a=>G.create({...a,coerce:!0}),number:a=>le.create({...a,coerce:!0}),boolean:a=>He.create({...a,coerce:!0}),bigint:a=>de.create({...a,coerce:!0}),date:a=>be.create({...a,coerce:!0})},any:ma,array:wa,bigint:la,boolean:Kn,date:da,discriminatedUnion:ka,effect:Yn,enum:Ra,function:Ia,instanceof:ca,intersection:Ea,lazy:Ma,literal:$a,map:Aa,nan:ua,nativeEnum:Ca,never:ya,null:pa,nullable:Da,number:Gn,object:ba,oboolean:()=>Kn().optional(),onumber:()=>Gn().optional(),optional:ja,ostring:()=>qn().optional(),pipeline:Ua,preprocess:Pa,promise:Na,record:Ta,set:Oa,strictObject:_a,string:qn,symbol:fa,transformer:Yn,tuple:Sa,undefined:ha,union:xa,unknown:ga,void:va,NEVER:T,ZodIssueCode:w,quotelessJson:Di,ZodError:F}),rr=(a=>(a.TEXT="text",a.THREAD="thread",a.REACTION="reaction",a))(rr||{});const pe=q.getInstance(),Za=["id","targetMessageId","type","message","username","address","timestamp","signature","index","chatTopic","userTopic","additionalProps"],nr=D.object({id:D.string(),targetMessageId:D.string().optional(),type:D.nativeEnum(rr),message:D.string(),username:D.string(),address:D.string(),timestamp:D.number(),signature:D.string(),index:D.number(),chatTopic:D.string(),userTopic:D.string(),additionalProps:D.record(D.any()).optional()}).refine(a=>!a.additionalProps||Object.keys(a.additionalProps).length===0?!0:Fa(a.additionalProps).isValid,{message:"Invalid additional properties in message"}),Ba=D.object({reference:D.string(),timestamp:D.number()}),La=D.object({message:nr,messageStateRefs:D.array(Ba).nullable()});function Qn(a){const r=La.safeParse(a);return r.success?Xn(a.message)?!0:(pe.warn("Invalid main message signature"),!1):(pe.warn("GSOC message validation failed:",r.error.format()),!1)}function za(a){if(!Array.isArray(a))return pe.warn("Message state must be an array"),!1;for(const r of a)if(!Va(r))return pe.warn("Invalid message in message state:",r.id),!1;return!0}function Va(a){const r=nr.safeParse(a);return r.success?Xn(a)?!0:(pe.warn("Invalid message signature"),!1):(pe.warn("Message data validation failed:",r.error.format()),!1)}function Xn(a){try{const r={username:a.username,address:a.address,timestamp:a.timestamp,message:a.message},i=new TextEncoder,c=B.concatBytes(i.encode(`Ethereum Signed Message:
|
|
11
|
+
32`),B.keccak256(i.encode(JSON.stringify(r))));if(new A.Signature(a.signature).isValid(c,a.address))throw new Error("Signature verification failed!");return!0}catch(r){return pe.warn("Error in validateUserSignature",r),!1}}function Fa(a){const r=[];if(a==null)return{isValid:!0,errors:[]};if(typeof a!="object"||Array.isArray(a))return r.push("Additional properties must be a plain object"),{isValid:!1,errors:r};for(const g of Object.keys(a))Za.includes(g)&&r.push(`Property '${g}' is reserved and cannot be overridden`);const i=JSON.stringify(a),c=new TextEncoder().encode(i).length,u=1*1024;c>u&&r.push(`Additional properties too large: ${c} bytes (max: ${u} bytes)`);const l=5;function h(g,y=0){if(y>l)return!1;if(typeof g=="object"&&g!==null&&!Array.isArray(g)){for(const E of Object.values(g))if(!h(E,y+1))return!1}return!0}h(a)||r.push(`Additional properties nested too deeply (max depth: ${l})`);for(const[g,y]of Object.entries(a))if(g.length>100&&r.push(`Property key '${g}' too long (max: 100 characters)`),typeof y=="string"&&y.length>1e3&&r.push(`Property '${g}' value too long (max: 1000 characters)`),typeof y=="string"){const E=[/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,/javascript:/gi,/data:text\/html/gi,/vbscript:/gi,/on\w+\s*=/gi];for(const j of E)if(j.test(y)){r.push(`Property '${g}' contains potentially dangerous content`);break}}const p=20;return Object.keys(a).length>p&&r.push(`Too many additional properties: ${Object.keys(a).length} (max: ${p})`),{isValid:r.length===0,errors:r}}function Wa(a){const r=nr.safeParse(a);if(!r.success){const i=r.error.issues.map(c=>c.path.length>0?`${c.path.join(".")}: ${c.message}`:c.message);return pe.warn("Message validation failed:",r.error.format()),{isValid:!1,errors:i}}return{isValid:!0,errors:[]}}const W={LOADING_INIT:"loadingInit",LOADING_PREVIOUS_MESSAGES:"loadingPreviousMessages",MESSAGE_RECEIVED:"messageReceived",MESSAGE_REQUEST_INITIATED:"messageRequestInitiated",MESSAGE_REQUEST_UPLOADED:"messageRequestUploaded",MESSAGE_REQUEST_ERROR:"messageRequestError",CRITICAL_ERROR:"criticalError"};class Ha{constructor(r,i){this.utils=r,this.emitter=i,this.logger=q.getInstance(),this.errorHandler=X.getInstance(),this.processedRefs=new Set,this.refRetryCount=new Map,this.bannedRefs=new Set,this.latestStatefulMessage=null,this.MAX_RETRIES=3,this.RETRY_DELAY=1e3}async init(){try{const{data:r,index:i}=await this.utils.fetchLatestChatMessage();this.latestStatefulMessage=r;try{await this.initMessageState(r)}catch(c){this.errorHandler.handleError(c,"SwarmHistory.initMessageState")}return i}catch(r){return this.errorHandler.handleError(r,"SwarmHistory.init"),A.FeedIndex.fromBigInt(0n)}}async initMessageState(r){try{if(!Qn(r)){this.logger.warn("Invalid GSOC message during message state initialization");return}if(!r.messageStateRefs||r.messageStateRefs.length===0){this.logger.debug("No message state refs to initialize");return}const i=this.findLatestRef(r.messageStateRefs);if(!i){this.logger.warn("No valid latest reference found");return}this.logger.debug("Initializing message state with latest ref:",i.reference),await this.processMessageRefWithRetry(i.reference)}catch(i){if(this.utils.isNotFoundError(i)){this.logger.debug("No latest GSOC message found for message state initialization");return}this.errorHandler.handleError(i,"SwarmHistory.init")}}async fetchPreviousMessageState(){let r=this.latestStatefulMessage;if(!r){const{data:c}=await this.utils.fetchLatestChatMessage();r=c,this.latestStatefulMessage=c}if(!r.messageStateRefs||r.messageStateRefs.length===0){this.logger.debug("No message state refs to fetch");return}const i=[...r.messageStateRefs].sort((c,u)=>c.timestamp-u.timestamp);for(const c of i)!this.processedRefs.has(c.reference)&&!this.bannedRefs.has(c.reference)&&(this.logger.debug("Fetching previous message ref:",c.reference),await this.processMessageRefWithRetry(c.reference))}findLatestRef(r){return r.length===0?null:r.reduce((i,c)=>c.timestamp>i.timestamp?c:i)}async processMessageRefWithRetry(r){if(!(this.processedRefs.has(r)||this.bannedRefs.has(r)))try{await this.processMessageRef(r)}catch(i){await this.handleRefError(r,i)}}async processMessageRef(r){const i=await this.utils.downloadObjectFromBee(r);if(!za(i))throw new Error(`Invalid message state for ref: ${r}`);this.processedRefs.add(r),this.refRetryCount.delete(r);for(const u of i)this.emitter.emit(W.MESSAGE_RECEIVED,u)}async handleRefError(r,i){const c=this.refRetryCount.get(r)||0,u=c+1;if(this.logger.warn(`Error processing ref ${r} (attempt ${u}/${this.MAX_RETRIES}):`,i),u>=this.MAX_RETRIES)this.bannedRefs.add(r),this.refRetryCount.delete(r),this.logger.error(`Ref ${r} has been banned after ${this.MAX_RETRIES} failed attempts`),this.errorHandler.handleError(i,"SwarmHistory.processMessageRef");else{this.refRetryCount.set(r,u);const l=this.RETRY_DELAY*Math.pow(2,c);this.logger.debug(`Retrying ref ${r} after ${l}ms delay`),await Ni(l),await this.processMessageRefWithRetry(r)}}hasPreviousMessages(){return!!this.latestStatefulMessage&&!!this.latestStatefulMessage.messageStateRefs&&this.latestStatefulMessage.messageStateRefs.length>1}cleanup(){this.processedRefs.clear(),this.refRetryCount.clear(),this.bannedRefs.clear(),this.latestStatefulMessage=null}}class qa{constructor(r,i){this.userDetails=r,this.swarmSettings=i,this.depth=26,this.errorHandler=X.getInstance(),this.UPLOAD_GSOC_TIMEOUT=2e3}generateUserOwnedFeedId(r,i){return`${r}_EthercastChat_${i}`}isNotFoundError(r){return r.stack.includes("404")||r.message.includes("Not Found")||r.message.includes("404")||r.code===404}async writeOwnFeedDataByIndex(r,i){const{enveloped:c,stamp:u}=this.swarmSettings;if(!c)await this.writeOwnFeedDataByIndexOwned(r,i);else if(u)await this.writeOwnFeedDataByIndexEnvelope(r,i);else throw new Error("Enveloped mode is enabled, but stamp is not provided")}async writeOwnFeedDataByIndexOwned(r,i){const{bee:c,stamp:u,chatTopic:l}=this.swarmSettings,{privateKey:h,ownAddress:p}=this.userDetails,g=this.generateUserOwnedFeedId(l,p),y=A.Topic.fromString(g);await c.makeFeedWriter(y,new A.PrivateKey(h)).uploadPayload(u,JSON.stringify(i),{index:r})}async writeOwnFeedDataByIndexEnvelope(r,i){const{bee:c,stamp:u,chatTopic:l}=this.swarmSettings,{privateKey:h,ownAddress:p}=this.userDetails,g=new A.PrivateKey(h),y=A.Stamper.fromBlank(h,u,this.depth),E=this.generateUserOwnedFeedId(l,p),j=A.Topic.fromString(E),oe=Dn(j,r),ce=Pn(i),it=Un(ce,oe,g),je={hash:()=>it.address.toUint8Array()},sr=y.stamp(je),{upload:ir}=c.makeSOCWriter(g),at=A.Bytes.fromUtf8(i);return(await ir(sr,oe,at.toUint8Array())).reference.toHex()}orderMessages(r){return r.sort((i,c)=>i.timestamp-c.timestamp)}async downloadObjectFromBee(r){try{const{bee:i}=this.swarmSettings,c=await i.downloadData(r);return c?c.toJSON():null}catch(i){return this.errorHandler.handleError(i,"Utils.downloadObjectFromBee"),null}}async uploadObjectToBee(r){const{enveloped:i,stamp:c}=this.swarmSettings;if(i){if(c)return this.uploadObjectToBeeEnvelope(r);throw new Error("Enveloped mode is enabled, but stamp is not provided")}else return this.uploadObjectToBeeOwn(r)}async uploadObjectToBeeOwn(r){try{const{bee:i,stamp:c}=this.swarmSettings;return(await i.uploadData(c,JSON.stringify(r),{redundancyLevel:4})).reference.toString()}catch(i){return this.errorHandler.handleError(i,"Utils.uploadObjectToBee"),null}}async uploadObjectToBeeEnvelope(r){try{const{bee:i,stamp:c}=this.swarmSettings,{privateKey:u}=this.userDetails,l=A.Stamper.fromBlank(u,c,this.depth),h=A.Bytes.fromUtf8(JSON.stringify(r)),p=new Ti(async y=>{await i.uploadChunk(l.stamp(y),y.build())});await p.append(h.toUint8Array());const g=await p.finalize();return B.uint8ArrayToHex(g.hash())}catch(i){return this.errorHandler.handleError(i,"Utils.uploadObjectToBee"),null}}async getOwnLatestFeedIndex(){try{const{bee:r,chatTopic:i}=this.swarmSettings,{ownAddress:c}=this.userDetails,u=this.generateUserOwnedFeedId(i,c),l=A.Topic.fromString(u),p=await r.makeFeedReader(l,c).downloadPayload(),g=Number(p.feedIndex.toBigInt()),y=g+1;return{latestIndex:g,nextIndex:y}}catch(r){if(this.isNotFoundError(r))return{latestIndex:-1,nextIndex:0};throw r}}async fetchLatestChatMessage(){const{bee:r,chatTopic:i,chatAddress:c}=this.swarmSettings,l=await r.makeFeedReader(A.Topic.fromString(i),Gt(c)).downloadPayload();return{data:l.payload.toJSON(),index:l.feedIndex}}async fetchChatMessage(r){const{bee:i,chatTopic:c,chatAddress:u}=this.swarmSettings;return(await i.makeFeedReader(A.Topic.fromString(c),Gt(u)).downloadPayload({index:r})).payload.toJSON()}async sendMessageToGsoc(r){const{enveloped:i,stamp:c}=this.swarmSettings;if(!i)await this.sendMessageToGsocOwn(r);else if(c)await this.sendMessageToGsocEnvelope(r);else throw new Error("Enveloped mode is enabled, but stamp is not provided")}async rawSocDownload(r,i){const{beeUrl:c}=this.swarmSettings,u=await fetch(`${c}/soc/${r}/${i}`,{headers:{"swarm-chunk-retrieval-timeout":"2000ms"}});if(!u.ok){const l=new Error(`Failed to fetch: ${r}/${i} [${u.status}]`);throw l.status=u.status,l}return u.text()}async sendMessageToGsocOwn(r){const{bee:i,stamp:c,gsocTopic:u,gsocResourceId:l}=this.swarmSettings,h=new A.PrivateKey(l),p=A.Identifier.fromString(u),g=A.Bytes.fromUtf8(r),{upload:y}=i.makeSOCWriter(h,{timeout:this.UPLOAD_GSOC_TIMEOUT});await y(c,p,g.toUint8Array())}async sendMessageToGsocEnvelope(r){const{bee:i,stamp:c,gsocTopic:u,gsocResourceId:l}=this.swarmSettings,{privateKey:h}=this.userDetails,p=A.Stamper.fromBlank(h,c,this.depth),g=new A.PrivateKey(l),y=A.Identifier.fromString(u),E=A.Bytes.fromUtf8(r),j=Pn(E.toUint8Array()),oe=Un(j,y,g),ce={hash:()=>oe.address.toUint8Array()},it=p.stamp(ce),{upload:je}=i.makeSOCWriter(g,{timeout:this.UPLOAD_GSOC_TIMEOUT});await je(it,y,E.toUint8Array())}}class Ga{constructor(r,i){this.fallbackTransport=null,this.logger=q.getInstance(),this.errorHandler=X.getInstance(),this.gsocIndex=null;const c=new A.PrivateKey(Gt(r.user.privateKey));if(this.userDetails={privateKey:r.user.privateKey,ownAddress:c.publicKey().address().toString(),nickname:r.user.nickname,ownIndex:-1},this.swarmSettings={bee:new A.Bee(r.infra.beeUrl),beeUrl:r.infra.beeUrl,stamp:r.infra.stamp||"0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",enveloped:r.infra.enveloped,gsocTopic:r.infra.gsocTopic,gsocResourceId:r.infra.gsocResourceId,chatTopic:r.infra.chatTopic,chatAddress:r.infra.chatAddress},this.emitter=new ji,this.utils=new qa(this.userDetails,this.swarmSettings),this.history=new Ha(this.utils,this.emitter),i){if(this.transport=i,r.infra.enableFallbackPolling){const u=r.infra.fallbackPollingInterval||4e3;this.logger.info(`Fallback polling enabled with interval: ${u}ms`),this.fallbackTransport=this.createDefaultPollingTransport(u),this.fallbackTransport.onMessage(l=>{this.emitter.emit(W.MESSAGE_RECEIVED,l)})}}else this.transport=this.createDefaultPollingTransport();this.transport.onMessage(u=>{this.emitter.emit(W.MESSAGE_RECEIVED,u)})}createDefaultPollingTransport(r){return new Rn({fetchMessage:async()=>{try{if(!this.gsocIndex)return null;const i=A.Topic.fromString(this.swarmSettings.chatTopic),c=Dn(i,this.gsocIndex),u=await this.utils.rawSocDownload(this.swarmSettings.chatAddress,c.toString()),l=JSON.parse(u);return Qn(l)?(this.gsocIndex=this.gsocIndex.next(),l.message):(this.logger.warn("Invalid GSOC message during fetching"),null)}catch(i){if(this.utils.isNotFoundError(i))return null;throw i}},pollingInterval:r||1e3})}async start(){await this.init(),await this.transport.start(),this.fallbackTransport&&await this.fallbackTransport.start()}async stop(){this.emitter.cleanAll(),this.history.cleanup(),await this.transport.stop(),this.fallbackTransport&&await this.fallbackTransport.stop()}getEmitter(){return this.emitter}orderMessages(r){return this.utils.orderMessages(r)}async sendMessage(r,i,c,u,l){const h=this.userDetails.ownIndex===-1?0:this.userDetails.ownIndex+1,p={id:u||Ei(),username:this.userDetails.nickname,address:this.userDetails.ownAddress,chatTopic:this.swarmSettings.chatTopic,userTopic:this.utils.generateUserOwnedFeedId(this.swarmSettings.chatTopic,this.userDetails.ownAddress),signature:this.getSignature(r),timestamp:Date.now(),index:h,type:i,targetMessageId:c,message:r,additionalProps:l},g=Wa(p);if(!g.isValid){const y=`Invalid message: ${g.errors.join(", ")}`;throw this.logger.error(y),new Error(y)}try{this.emitter.emit(W.MESSAGE_REQUEST_INITIATED,p),await this.utils.writeOwnFeedDataByIndex(h,JSON.stringify(p)),this.userDetails.ownIndex=h,this.emitter.emit(W.MESSAGE_REQUEST_UPLOADED,p),await this.broadcastUserMessage(p)}catch(y){this.emitter.emit(W.MESSAGE_REQUEST_ERROR,p),this.errorHandler.handleError(y,"Chat.sendMessage")}}async fetchPreviousMessages(){try{return this.emitter.emit(W.LOADING_PREVIOUS_MESSAGES,!0),await this.history.fetchPreviousMessageState()}finally{this.emitter.emit(W.LOADING_PREVIOUS_MESSAGES,!1)}}hasPreviousMessages(){return this.history.hasPreviousMessages()}async retrySendMessage(r){this.sendMessage(r.message,r.type,r.targetMessageId,r.id,r.additionalProps)}async retryBroadcastUserMessage(r){await this.broadcastUserMessage(r)}async init(){try{this.emitter.emit(W.LOADING_INIT,!0);const[r,i]=await Promise.allSettled([this.initOwnIndex(),this.history.init()]);if(r.status==="rejected")throw r.reason;i.status==="fulfilled"&&(this.gsocIndex=i.value),this.emitter.emit(W.LOADING_INIT,!1)}catch(r){this.errorHandler.handleError(r,"Chat.initSelfState"),this.emitter.emit(W.CRITICAL_ERROR,r)}}async initOwnIndex(){const{latestIndex:c}=await Kt(()=>this.utils.getOwnLatestFeedIndex(),10,1e3);this.userDetails.ownIndex=c}async broadcastUserMessage(r){try{return Kt(()=>this.utils.sendMessageToGsoc(JSON.stringify(r)))}catch(i){this.errorHandler.handleError(i,"Chat.broadcastUserMessage")}}getSignature(r){const{ownAddress:i,privateKey:c,nickname:u}=this.userDetails,l=new A.EthAddress(i).toString(),h=new A.PrivateKey(c);if(h.publicKey().address().toString()!==l)throw new Error("The provided address does not match the address derived from the private key");const g=Date.now();return h.sign(JSON.stringify({username:u,address:l,message:r,timestamp:g})).toHex()}}Q.EVENTS=W,Q.MessageType=rr,Q.PollingTransport=Rn,Q.SwarmChat=Ga,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
|