shalomail 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -4
- package/dist/index.d.ts +82 -0
- package/dist/index.mjs +64 -0
- package/dist/shalom.mjs +64 -58
- package/package.json +35 -7
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var tt=BigInt(4294967295),Mr=BigInt(32);function go(t,e=!1){return e?{h:Number(t&tt),l:Number(t>>Mr&tt)}:{h:Number(t>>Mr&tt)|0,l:Number(t&tt)|0}}function Hr(t,e=!1){let r=t.length,n=new Uint32Array(r),s=new Uint32Array(r);for(let i=0;i<r;i++){let{h:o,l:u}=go(t[i],e);[n[i],s[i]]=[o,u]}return[n,s]}var xo=t=>t/2**32|0,yo=t=>t>>>0;function $r(t,e,r,n){let s=xo(r),i=yo(r);t.setUint32(e,n?i:s,n),t.setUint32(e+4,n?s:i,n)}var Mt=(t,e,r)=>t>>>r,Ht=(t,e,r)=>t<<32-r|e>>>r,me=(t,e,r)=>t>>>r|e<<32-r,ge=(t,e,r)=>t<<32-r|e>>>r,_e=(t,e,r)=>t<<64-r|e>>>r-32,Ne=(t,e,r)=>t>>>r-32|e<<64-r;function J(t,e,r,n){let s=(e>>>0)+(n>>>0);return{h:t+r+(s/2**32|0)|0,l:s|0}}var jr=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),zr=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Kr=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),Gr=(t,e,r,n,s)=>e+r+n+s+(t/2**32|0)|0,Vr=(t,e,r,n,s)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(s>>>0),Wr=(t,e,r,n,s,i)=>e+r+n+s+i+(t/2**32|0)|0;function rt(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}var $t=t=>t?`"${t}" `:"";function Ie(t,e=""){if(typeof t!="number")throw new TypeError($t(e)+"expected number, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError($t(e)+"expected integer >= 0, got "+t);return t}function ee(t,e,r=""){if(rt(t)&&(e===void 0||t.length===e))return t;e!==void 0&&Ie(e,"length");let n=rt(t),s=e!==void 0?` of length ${e}`:"",i=n?`length=${t.length}`:`type=${typeof t}`,o=$t(r)+"expected Uint8Array"+s+", got "+i;throw n?new RangeError(o):new TypeError(o)}var Ao=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError((e==="object"?"":`"${e}" `)+"expected object, got type="+typeof t)},Zr=(t,e)=>{Ao(t,e);let r=Object.getPrototypeOf(t);if(r!==Object.prototype&&r!==null)throw new TypeError(`"${e}" expected plain object`);if(Object.hasOwn(t,"__proto__"))throw new TypeError(`"${e}.__proto__" is not allowed`)};function jt(t,e=!0){if(t.destroyed)throw new Error("hash was destroyed");if(e&&t.finished)throw new Error("digest() was already called")}function Xr(t,e){ee(t,void 0,"output");let r=e.outputLen;if(!(t.length>=r))throw new RangeError('"output" expected length >= '+r)}function zt(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function nt(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}var Qr=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",wo=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function st(t){if(ee(t),Qr)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=wo[t[r]];return e}function Yr(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void 0}function ot(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);if(Qr)try{return Uint8Array.fromHex(t)}catch(s){throw s instanceof SyntaxError?new RangeError(s.message):s}let e=t.length,r=e/2;if(e%2)throw new RangeError("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let s=0,i=0;s<r;s++,i+=2){let o=Yr(t.charCodeAt(i)),u=Yr(t.charCodeAt(i+1));if(o===void 0||u===void 0){let a=t[i]+t[i+1];throw new RangeError('hex string expected, got non-hex character "'+a+'" at index '+i)}n[s]=o*16+u}return n}function Kt(...t){let e=0;for(let n=0;n<t.length;n++){let s=t[n];ee(s),e+=s.length}let r=new Uint8Array(e);for(let n=0,s=0;n<t.length;n++){let i=t[n];r.set(i,s),s+=i.length}return r}function Do(t,e,r="opts"){return Zr(t,"defaults"),e!==void 0&&Zr(e,r),Object.assign(Object.create(null),t,e)}function Jr(t,e={}){if(typeof t!="function")throw new TypeError('"hashCons" expected function, got type='+typeof t);e=Do({},e,"info");let r=(s,i)=>t(i).update(s).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=s=>t(s),Object.assign(r,e),Object.freeze(r)}function en(t=32){Ie(t,"bytesLength");let e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return e.getRandomValues(new Uint8Array(t))}var tn=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});var it=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,r,n,s){this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=s,this.buffer=new Uint8Array(e),this.view=nt(this.buffer)}update(e){jt(this),ee(e);let{view:r,buffer:n,blockLen:s}=this,i=e.length,o=!1;for(let u=0;u<i;){let a=Math.min(s-this.pos,i-u);if(a===s){let c=nt(e);for(;s<=i-u;u+=s)this.process(c,u);o=!0;continue}n.set(u===0&&a===i?e:e.subarray(u,u+a),this.pos),this.pos+=a,u+=a,this.pos===s&&(this.process(r,0),this.pos=0,o=!0)}return this.length+=e.length,o&&this.roundClean(),this}digestInto(e){jt(this),Xr(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:s,isLE:i}=this,{pos:o}=this;r[o++]=128,r.fill(0,o),this.padOffset>s-o&&(this.process(n,0),r.fill(0)),$r(n,s-8,this.length*8,i),this.process(n,0),this.roundClean();let u=e===r?n:nt(e),a=this.outputLen,c=a/4,l=this.get();if(a%4||c>l.length)throw new Error("invalid outputLen");for(let f=0;f<c;f++)u.setUint32(4*f,l[f],i)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneIntoMeta(e){let{buffer:r,length:n,finished:s,destroyed:i,pos:o}=this;return e.destroyed=i,e.finished=s,e.length=n,e.pos=o,o&&e.buffer.set(r),e}clone(){return this._cloneInto()}};var rn=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var nn=Hr(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Eo=nn[0],Bo=nn[1],ce=new Uint32Array(80),le=new Uint32Array(80),Gt=class extends it{Ah=0;Al=0;Bh=0;Bl=0;Ch=0;Cl=0;Dh=0;Dl=0;Eh=0;El=0;Fh=0;Fl=0;Gh=0;Gl=0;Hh=0;Hl=0;constructor(e,r){super(128,e,16,!1),this.Ah=r[0]|0,this.Al=r[1]|0,this.Bh=r[2]|0,this.Bl=r[3]|0,this.Ch=r[4]|0,this.Cl=r[5]|0,this.Dh=r[6]|0,this.Dl=r[7]|0,this.Eh=r[8]|0,this.El=r[9]|0,this.Fh=r[10]|0,this.Fl=r[11]|0,this.Gh=r[12]|0,this.Gl=r[13]|0,this.Hh=r[14]|0,this.Hl=r[15]|0}get(){let{Ah:e,Al:r,Bh:n,Bl:s,Ch:i,Cl:o,Dh:u,Dl:a,Eh:c,El:l,Fh:f,Fl:h,Gh:d,Gl:g,Hh:m,Hl:A}=this;return[e,r,n,s,i,o,u,a,c,l,f,h,d,g,m,A]}set(e,r,n,s,i,o,u,a,c,l,f,h,d,g,m,A){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=u|0,this.Dl=a|0,this.Eh=c|0,this.El=l|0,this.Fh=f|0,this.Fl=h|0,this.Gh=d|0,this.Gl=g|0,this.Hh=m|0,this.Hl=A|0}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,r){for(let p=0;p<16;p++,r+=4)ce[p]=e.getUint32(r),le[p]=e.getUint32(r+=4);for(let p=16;p<80;p++){let w=ce[p-15]|0,E=le[p-15]|0,S=me(w,E,1)^me(w,E,8)^Mt(w,E,7),q=ge(w,E,1)^ge(w,E,8)^Ht(w,E,7),v=ce[p-2]|0,B=le[p-2]|0,k=me(v,B,19)^_e(v,B,61)^Mt(v,B,6),N=ge(v,B,19)^Ne(v,B,61)^Ht(v,B,6),O=Kr(q,N,le[p-7],le[p-16]),_=Gr(O,S,k,ce[p-7],ce[p-16]);ce[p]=_|0,le[p]=O|0}let{Ah:n,Al:s,Bh:i,Bl:o,Ch:u,Cl:a,Dh:c,Dl:l,Eh:f,El:h,Fh:d,Fl:g,Gh:m,Gl:A,Hh:D,Hl:x}=this;for(let p=0;p<80;p++){let w=me(f,h,14)^me(f,h,18)^_e(f,h,41),E=ge(f,h,14)^ge(f,h,18)^Ne(f,h,41),S=f&d^~f&m,q=h&g^~h&A,v=Vr(x,E,q,Bo[p],le[p]),B=Wr(v,D,w,S,Eo[p],ce[p]),k=v|0,N=me(n,s,28)^_e(n,s,34)^_e(n,s,39),O=ge(n,s,28)^Ne(n,s,34)^Ne(n,s,39),_=n&i^n&u^i&u,y=s&o^s&a^o&a;D=m|0,x=A|0,m=d|0,A=g|0,d=f|0,g=h|0,{h:f,l:h}=J(c|0,l|0,B|0,k|0),c=u|0,l=a|0,u=i|0,a=o|0,i=n|0,o=s|0;let C=jr(k,O,y);n=zr(C,B,N,_),s=C|0}({h:n,l:s}=J(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:o}=J(this.Bh|0,this.Bl|0,i|0,o|0),{h:u,l:a}=J(this.Ch|0,this.Cl|0,u|0,a|0),{h:c,l}=J(this.Dh|0,this.Dl|0,c|0,l|0),{h:f,l:h}=J(this.Eh|0,this.El|0,f|0,h|0),{h:d,l:g}=J(this.Fh|0,this.Fl|0,d|0,g|0),{h:m,l:A}=J(this.Gh|0,this.Gl|0,m|0,A|0),{h:D,l:x}=J(this.Hh|0,this.Hl|0,D|0,x|0),this.set(n,s,i,o,u,a,c,l,f,h,d,g,m,A,D,x)}roundClean(){zt(ce,le)}destroy(){this.destroyed=!0,zt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Vt=class extends Gt{constructor(){super(64,rn)}};var Wt=Jr(()=>new Vt,tn(3));function at(t,e,r=()=>{}){if(!Array.isArray(t))throw new TypeError(`"${e}" expected array, got type=${typeof t}`);for(let n=0;n<t.length;n++)r(t[n],`${e}[${n}]`);return t}var M=(t,e,r)=>ee(t,e,r),Zt=Ie;function fe(t,e="object"){if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(e==="object"?"expected valid options object":`"${e}" expected object, got type=${typeof t}`);return t}function xe(t,e){if(typeof t!="function")throw new TypeError(`"${e}" is invalid: expected function, got ${typeof t}`);return t}var on=st,Yt=(...t)=>Kt(...t),un=t=>ot(t),Ue=rt,Pe=t=>en(t),ut=BigInt(0),sn=BigInt(1),Co=t=>t?`"${t}" `:"";function ie(t,e=""){if(typeof t!="boolean")throw new TypeError(Co(e)+"expected boolean, got type="+typeof t);return t}function vo(t){if(typeof t=="bigint"){if(!de(t))throw new RangeError("positive bigint expected, got "+t)}else Zt(t);return t}function Ce(t,e=""){if(typeof t!="number"){let r=e&&`"${e}" `;throw new TypeError(r+"expected number, got type="+typeof t)}if(!Number.isSafeInteger(t)){let r=e&&`"${e}" `;throw new RangeError(r+"expected safe integer, got "+t)}}function an(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);return t===""?ut:BigInt("0x"+t)}function ct(t){return an(st(t))}function ue(t){return an(st(he(ee(t)).reverse()))}function Xt(t,e){if(Ie(e),e===0)throw new Error("zero output length is invalid");t=vo(t);let r=e*2,n=t.toString(16);if(n.length>r)throw new RangeError("number is too large");return ot(n.padStart(r,"0"))}function lt(t,e){return Xt(t,e).reverse()}function he(t){return Uint8Array.from(M(t))}function de(t){return typeof t=="bigint"&&ut<=t}function Qt(t,e,r){return de(t)&&de(e)&&de(r)&&e<=t&&t<r}function ye(t,e,r,n){if(!Qt(e,r,n))throw new RangeError("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Jt(t){if(t<ut)throw new Error("expected non-negative bigint, got "+t);return t===ut?0:t.toString(2).length}var cn=t=>(Ce(t,"n"),(sn<<BigInt(t))-sn);function te(t,e={},r={},n="object"){fe(t,n),fe(e,"fields"),fe(r,"optFields");function s(o,u,a){let c=n==="object"?`param "${String(o)}"`:`"${n}.${String(o)}"`,l=t[o];if(!Object.hasOwn(t,o)&&(a?l!==void 0:u!=="function"))throw new TypeError(`${c} is invalid: expected own property`);if(a&&l===void 0)return;let f=typeof l;if(f!==u||l===null)throw new TypeError(`${c} is invalid: expected ${u}, got ${f}`)}let i=(o,u)=>Object.entries(o).forEach(([a,c])=>s(a,c,u));i(e,!1),i(r,!0)}var H=BigInt(0),L=BigInt(1),be=BigInt(2),dn=BigInt(3),er=BigInt(4),hn=BigInt(5),To=BigInt(7),pn=BigInt(8),So=BigInt(9),Fo=BigInt(15),mn=BigInt(16),ko=BigInt("0x10000000000000000");function R(t,e){if(e<=H)throw new Error("mod: expected positive modulus, got "+e);let r=t%e;return r>=H?r:e+r}function Ro(t,e,r){if(r<=L)throw new Error("pow: expected modulus > 1, got "+r);if(typeof e!="bigint")throw new TypeError("invalid exponent: expected bigint, got "+typeof e);if(e<H)throw new Error("invalid exponent, negatives unsupported");if(e===H)return L;if(e===L)return t;let n=t%r;if(n<H&&(n+=r),e<ko){let u=L;for(;e>H;)e&L&&(u=u*n%r),n=n*n%r,e>>=L;return u}let s=[];for(;e>H;)s.push(Number(e&Fo)),e>>=er;let i=new Array(16);i[0]=L,i[1]=n;for(let u=2;u<16;u++)i[u]=i[u-1]*n%r;let o=i[s[s.length-1]];for(let u=s.length-2;u>=0;u--){o=o*o%r,o=o*o%r,o=o*o%r,o=o*o%r;let a=s[u];a!==0&&(o=o*i[a]%r)}return o}function V(t,e,r){if(r<=L)throw new Error("pow2: expected modulus > 1, got "+r);if(e<H)throw new Error("pow2: expected non-negative exponent, got "+e);let n=t;for(;e-- >H;)n*=n,n%=r;return n}function ln(t,e){if(t===H)throw new Error("invert: expected non-zero number");if(e<=L)throw new Error("invert: expected modulus > 1, got "+e);let r=R(t,e),n=e,s=H,i=L;for(;r!==H;){let u=n/r,a=n-r*u,c=s-i*u;n=r,r=a,s=i,i=c}if(n!==L)throw new Error("invert: does not exist");return R(s,e)}function tr(t,e,r){let n=t;if(!n.eql(n.sqr(e),r))throw new Error("Cannot find square root")}function rr(t,e){if((t&L)===H)throw new Error(e+": expected odd modulus, got "+t)}function gn(t,e){let r=t,n=(r.ORDER+L)/er,s=r.pow(e,n);return tr(r,s,e),s}function Oo(t,e){let r=t,n=(r.ORDER-hn)/pn,s=r.mul(e,be),i=r.pow(s,n),o=r.mul(e,i),u=r.mul(r.mul(o,be),i),a=r.mul(o,r.sub(u,r.ONE));return tr(r,a,e),a}function Lo(t){let e=ht(t),r=xn(t),n=r(e,e.neg(e.ONE)),s=r(e,n),i=r(e,e.neg(n)),o=(t+To)/mn;return((u,a)=>{let c=u,l=c.pow(a,o),f=c.mul(l,n),h=c.mul(l,s),d=c.mul(l,i),g=c.eql(c.sqr(f),a),m=c.eql(c.sqr(h),a);l=c.cmov(l,f,g),f=c.cmov(d,h,m);let A=c.eql(c.sqr(f),a),D=c.cmov(l,f,A);return tr(c,D,a),D})}function xn(t){if(t<dn)throw new Error("sqrt is not defined for small field");rr(t,"tonelliShanks");let e=t-L,r=0;for(;e%be===H;)e/=be,r++;let n=be,s=ht(t);for(;Me(s,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return gn;let i=s.pow(n,e),o=(e+L)/be;return function(a,c){let l=a;if(l.is0(c))return c;if(Me(l,c)!==1)throw new Error("Cannot find square root");let f=r,h=l.mul(l.ONE,i),d=l.pow(c,e),g=l.pow(c,o);for(;!l.eql(d,l.ONE);){if(l.is0(d))throw new Error("Cannot find square root: probably non-prime P");let m=1,A=l.sqr(d);for(;!l.eql(A,l.ONE);)if(m++,A=l.sqr(A),m===f)throw new Error("Cannot find square root");let D=L<<BigInt(f-m-1),x=l.pow(h,D);f=m,h=l.sqr(x),d=l.mul(d,h),g=l.mul(g,x)}return g}}function qo(t){return rr(t,"Fp.sqrt"),t%er===dn?gn:t%pn===hn?Oo:t%mn===So?Lo(t):xn(t)}var yn=(t,e)=>(R(t,e)&L)===L,_o=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ve(t){if(fe(t,"field"),typeof t.ORDER!="bigint")throw new TypeError('param "ORDER" is invalid: expected bigint, got '+typeof t.ORDER);Ce(t.BYTES,"BYTES"),Ce(t.BITS,"BITS");for(let e of _o)xe(t[e],"field."+e);if(t.BYTES<1||t.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(t.ORDER<=L)throw new Error("invalid field: expected ORDER > 1, got "+t.ORDER);return t}function dt(t,e,r=!1){ve(t),at(e,"nums"),ie(r,"passZero");let n=t,s=new Array(e.length).fill(r?n.ZERO:void 0),i=e.reduce((u,a,c)=>n.is0(a)?u:(s[c]=u,n.mul(u,a)),n.ONE),o=n.inv(i);return e.reduceRight((u,a,c)=>n.is0(a)?u:(s[c]=n.mul(u,s[c]),n.mul(u,a)),o),s}function Me(t,e){ve(t);let r=t;rr(r.ORDER,"FpLegendre");let n=(r.ORDER-L)/be,s=r.pow(e,n),i=r.eql(s,r.ONE),o=r.eql(s,r.ZERO),u=r.eql(s,r.neg(r.ONE));if(!i&&!o&&!u)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function No(t,e){if(e!==void 0&&Zt(e),t<=H)throw new Error("invalid n length: expected positive n, got "+t);if(e!==void 0&&e<1)throw new Error("invalid n length: expected positive bit length, got "+e);let r=Jt(t);if(e!==void 0&&e<r)throw new Error(`invalid n length: expected nBitLength (${e}) >= bitLen(n) (${r})`);let n=e!==void 0?e:r,s=Math.ceil(n/8);return{nBitLength:n,nByteLength:s}}var fn=new WeakMap,ft=class{ORDER;BITS;BYTES;isLE;ZERO=H;ONE=L;_lengths;_mod;constructor(e,r={}){if(e<=L)throw new Error("invalid field: expected ORDER > 1, got "+e);let n;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(n=r.BITS),typeof r.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:r.sqrt,enumerable:!0}),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=Object.freeze(r.allowedLengths.slice())),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:s,nByteLength:i}=No(e,n);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=s,this.BYTES=i,Object.freeze(this)}create(e){return R(e,this.ORDER)}isValid(e){if(typeof e!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof e);return H<=e&&e<this.ORDER}is0(e){return e===H}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&L)===L}neg(e){return R(-e,this.ORDER)}eql(e,r){return e===r}sqr(e){return R(e*e,this.ORDER)}add(e,r){return R(e+r,this.ORDER)}sub(e,r){return R(e-r,this.ORDER)}mul(e,r){return R(e*r,this.ORDER)}pow(e,r){return Ro(e,r,this.ORDER)}div(e,r){return R(e*ln(r,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,r){return e+r}subN(e,r){return e-r}mulN(e,r){return e*r}inv(e){return ln(e,this.ORDER)}sqrt(e){let r=fn.get(this);return r||fn.set(this,r=qo(this.ORDER)),r(this,e)}toBytes(e){return this.isLE?lt(e,this.BYTES):Xt(e,this.BYTES)}fromBytes(e,r=!1){M(e);let{_lengths:n,BYTES:s,isLE:i,ORDER:o,_mod:u}=this;if(n){if(e.length<1||!n.includes(e.length)||e.length>s)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+e.length);let c=new Uint8Array(s);c.set(e,i?0:c.length-e.length),e=c}if(e.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+e.length);let a=i?ue(e):ct(e);if(u&&(a=R(a,o)),!r&&!this.isValid(a))throw new Error("invalid field element: outside of range 0..ORDER");return a}invertBatch(e){return dt(this,e,!0)}cmov(e,r,n){return ie(n,"condition"),n?r:e}};function ht(t,e={}){return Object.freeze(ft.prototype),new ft(t,e)}var or=BigInt(0),He=BigInt(1),Io=BigInt(4),nr=16,bn=128,Uo=5,An=2**31;function $e(t){let e=t;if(typeof e!="function")throw new TypeError('"Point" expected constructor, got type='+typeof t);xe(e.fromAffine,"Point.fromAffine"),xe(e.fromBytes,"Point.fromBytes"),xe(e.fromHex,"Point.fromHex"),fe(e.BASE,"Point.BASE"),fe(e.ZERO,"Point.ZERO"),ve(e.Fp),ve(e.Fn)}function Dn(t,e){$e(t),En(e,t);let r=dt(t.Fp,e.map(n=>n.Z));return e.map((n,s)=>t.fromAffine(n.toAffine(r[s])))}function Po(t,e,r=1){if(!Number.isSafeInteger(t)||t<r||t>e)throw new Error("invalid window size, expected ["+r+".."+e+"], got W="+t)}function Mo(t,e){let r=t*(4*e+128);if(r>An)throw new Error("invalid window size: table would need ~"+Math.ceil(r/2**20)+" MiB, max "+An/2**20+" MiB")}function Ho(t,e){if(t!==void 0){xe(t,"randomBytes");try{let r=t(e);if(!Ue(r)||r.length!==e)return}catch{return}return t}}function En(t,e){at(t,"points"),t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function $o(t,e,r){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((n,s)=>{if(!(r===void 0?e.isValid(n):de(n)&&n<r))throw new Error("invalid scalar at index "+s)})}var Bn=new WeakMap;function sr(t){return Bn.get(t)||1}function jo(t,e){let r=t.double(),n=[t];for(let s=1;s<e;s++)n.push(n[s-1].add(r));return n}function zo(t,e){let r=2**e,n=r/2,s=BigInt(r-1),i=[];for(;t>or;){let o=0;t&He&&(o=Number(t&s),o>=n&&(o-=r),t-=BigInt(o)),i.push(o),t>>=He}return i}function Ko(t,e,r){let n=2**e,s=n/2,i=BigInt(n-1),o=BigInt(e),u=[];for(let a=0;a<r;a++){let c=Number(t&i);t>>=o,c>s&&(c-=n,t+=He),u.push(c)}if(t!==or)throw new Error("invalid wnaf");return u}function Go(t,e,r){let n=0;for(let i of r)n=Math.max(n,i.length);let s=t;for(let i=n-1;i>=0;i--){i!==n-1&&(s=s.double());for(let o=0;o<r.length;o++){let u=r[o][i];if(u){let a=e[o][Math.abs(u)-1>>1];s=s.add(u<0?a.negate():a)}}}return s}var pt=class{Point;BASE;ZERO;randomBytes;wnafPrecomputes=new WeakMap;baseCanBeBlinded;bits;constructor(e,r){$e(e),this.randomBytes=Ho(r,nr),this.Point=e,this.BASE=e.BASE,this.ZERO=e.ZERO,this.bits=e.Fn.BITS}buildWnafTable(e,r,n){let s=Math.ceil(n/r)+1,i=2**(r-1),o=[],u=e;for(let a=0;a<s;a++){let c=u;for(let l=0;l<i;l++)o.push(c),c=c.add(u);u=o[o.length-1].double()}return{W:r,bits:n,windows:s,comp:o}}wnafCachedCT(e,r){let{W:n,windows:s,comp:i}=e,o=2**(n-1),u=Ko(r,n,s),a=this.ZERO,c=this.BASE;for(let l=0;l<s;l++){let f=u[l],h=l*o,d=Math.abs(f)-1,g=i[h];for(let A=1;A<o;A++)g=A===d?i[h+A]:g;let m=g.negate();f===0?c=c.add(i[h]):a=a.add(f<0?m:g)}return{p:a,f:c}}getWnafPrecomputes(e,r,n,s){let i=this.wnafPrecomputes.get(r),o=i?.find(u=>u.W===e&&u.bits===n);return o||(o=this.buildWnafTable(r,e,n),typeof s=="function"&&(o={...o,comp:s(o.comp)}),i||(i=[],this.wnafPrecomputes.set(r,i)),i.push(o)),o}assertPoint(e){if(!(e instanceof this.Point))throw new TypeError('"point" expected Point instance, got type='+typeof e)}validateMulInput(e,r){if(this.assertPoint(e),!Qt(r,He,this.Point.Fn.ORDER))throw new Error("invalid scalar")}runCT(e,r,n,s){let i=sr(e);return i===1?this.fixedWindowCT(e,r,n):this.wnafCachedCT(this.getWnafPrecomputes(i,e,n,s),r)}mulCT(e,r,n){return this.validateMulInput(e,r),this.runCT(e,r,this.bits,n)}mulCTBlinded(e,r,n){if(this.validateMulInput(e,r),this.randomBytes===void 0)throw new Error("randomBytes is required for scalar blinding");let s=this.Point.Fn.BITS+bn,i=this.randomBytes(nr);if(!Ue(i)||i.length!==nr)throw new Error("randomBytes returned invalid byte array");i[0]=i[0]&63|128;let o=r+ct(i)*this.Point.Fn.ORDER;return this.runCT(e,o,s,n)}fixedWindowCT(e,r,n){let s=Uo,i=1<<s,o=cn(s),u=new Array(i);u[0]=this.ZERO;for(let l=1;l<i;l++)u[l]=u[l-1].add(e);let a=Math.ceil(n/s),c=this.ZERO;for(let l=a-1;l>=0;l--){if(l!==a-1)for(let d=0;d<s;d++)c=c.double();let f=Number(r>>BigInt(l*s)&o),h=u[0];for(let d=1;d<i;d++)h=d===f?u[d]:h;c=c.add(h)}return{p:c,f:c}}shouldBlind(e,r){return this.randomBytes===void 0?!1:r===He?!0:e!==this.BASE?!1:(this.baseCanBeBlinded===void 0&&(this.baseCanBeBlinded=this.mulUnsafe(this.BASE,this.Point.Fn.ORDER).is0()),this.baseCanBeBlinded)}mulSecret(e,r,n,s){return this.shouldBlind(e,n)?this.mulCTBlinded(e,r,s):this.mulCT(e,r,s)}mulUnsafe(e,r,n){if(this.assertPoint(e),!de(r))throw new Error("invalid scalar");let s=sr(e);if(s===1||r>=this.Point.Fn.ORDER)return Vo(this.Point,[e],[r],!0);let i=this.getWnafPrecomputes(s,e,this.bits,n);return this.wnafCachedCT(i,r).p}setWindowSize(e,r){this.assertPoint(e),Po(r,this.bits);let n=Math.ceil((this.bits+bn)/r)+1;Mo(n*2**(r-1),this.Point.Fp.BYTES),Bn.set(e,r),this.wnafPrecomputes.delete(e)}hasWindowSize(e){return sr(e)!==1}};function Vo(t,e,r,n=!1){if($e(t),En(e,t),ie(n,"allowOversized"),$o(r,t.Fn,n?t.Fn.ORDER**Io:void 0),e.length!==r.length)throw new Error("arrays of points and scalars must have equal length");let s=e.map(o=>jo(o,4)),i=r.map(o=>zo(o,4));return Go(t.ZERO,s,i)}function wn(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return ve(e),e}else return ht(t,{isLE:r})}function Cn(t,e,r={},n){if(t!=="weierstrass"&&t!=="edwards")throw new Error('expected curve type "weierstrass" or "edwards"');if(n===void 0&&(n=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);te(r);for(let a of["p","n","h"]){let c=e[a];if(!(de(c)&&c!==or))throw new Error(`CURVE.${a} must be positive bigint`)}let s=wn(e.p,r.Fp,n),i=wn(e.n,r.Fn,n),u=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(let a of u)if(!s.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:s,Fn:i}}function mt(t,e){return function(n){let s=t(n);return{secretKey:s,publicKey:e(s)}}}var gt=BigInt(0),xt=BigInt(1),yt=BigInt(2),Wo=BigInt(4),vn=BigInt(8);function Zo(t,e,r,n){let s=t.sqr(r),i=t.sqr(n),o=t.add(t.mul(e.a,s),i),u=t.add(t.ONE,t.mul(e.d,t.mul(s,i)));return t.eql(o,u)}function Tn(t,e={}){te(e,{},{},"extraOpts");let r=e,n=Cn("edwards",t,r,r.FpFnLE),{Fp:s,Fn:i}=n,o=n.CURVE,{h:u}=o;if(Me(s,o.a)!==1)throw new Error("edwards: CURVE.a must be a square in Fp for complete addition formulas");if(Me(s,o.d)!==-1)throw new Error("edwards: CURVE.d must be a non-square in Fp for complete addition formulas");te(r,{},{uvRatio:"function",randomBytes:"function"});let a=r.randomBytes===void 0?Pe:r.randomBytes,c=yt<<BigInt(s.BYTES*8)-xt;function l(x){if(!s.isOdd)throw new Error("Field does not have .isOdd()");return s.isOdd(x)}let f=r.uvRatio===void 0?(x,p)=>{try{return{isValid:!0,value:s.sqrt(s.div(x,p))}}catch{return{isValid:!1,value:gt}}}:r.uvRatio;if(!Zo(s,o,o.Gx,o.Gy))throw new Error("bad curve params: generator point");let h=s.eql(o.a,s.neg(s.ONE))?x=>s.neg(x):s.eql(o.a,s.ONE)?x=>x:x=>s.mul(o.a,x);function d(x,p,w=!1){let E=w?xt:gt;return ye("coordinate "+x,p,E,c),p}function g(x){if(!(x instanceof m))throw new Error("EdwardsPoint expected")}class m{static BASE=new m(o.Gx,o.Gy,s.ONE,s.mul(o.Gx,o.Gy));static ZERO=new m(s.ZERO,s.ONE,s.ONE,s.ZERO);static Fp=s;static Fn=i;X;Y;Z;T;constructor(p,w,E,S){this.X=d("x",p),this.Y=d("y",w),this.Z=d("z",E,!0),this.T=d("t",S),Object.freeze(this)}static CURVE(){return o}static fromAffine(p){if(p instanceof m)throw new Error("extended point not allowed");let{x:w,y:E}=p||{};return d("x",w),d("y",E),new m(w,E,s.ONE,s.mul(w,E))}static fromBytes(p,w=!1){let E=s.BYTES,{a:S,d:q}=o;p=he(M(p,E,"point")),ie(w,"zip215");let v=he(p),B=p[E-1];v[E-1]=B&-129;let k=ue(v),N=w?c:s.ORDER;ye("point.y",k,gt,N);let O=s.sqr(k),_=s.sub(O,s.ONE),y=s.sub(s.mulN(q,O),S),{isValid:C,value:b}=f(_,y);if(!C)throw new Error("bad point: invalid y coordinate");let T=l(b),F=(B&128)!==0;if(!w&&s.is0(b)&&F)throw new Error("bad point: x=0 and x_0=1");return F!==T&&(b=s.neg(b)),m.fromAffine({x:b,y:k})}static fromHex(p,w=!1){return m.fromBytes(un(p),w)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(p=6,w=!0){return D.setWindowSize(this,p),w||this.multiply(yt),this}assertValidity(){let p=this,{a:w,d:E}=o;if(p.is0())throw new Error("bad point: ZERO");let{X:S,Y:q,Z:v,T:B}=p,k=s.sqr(S),N=s.sqr(q),O=s.sqr(v),_=s.sqr(O),y=s.mul(k,w),C=s.mul(s.add(y,N),O),b=s.add(_,s.mul(E,s.mul(k,N)));if(!s.eql(C,b))throw new Error("bad point: equation left != right (1)");let T=s.mul(S,q),F=s.mul(v,B);if(!s.eql(T,F))throw new Error("bad point: equation left != right (2)")}equals(p){g(p);let{X:w,Y:E,Z:S}=this,{X:q,Y:v,Z:B}=p,k=s.mul(w,B),N=s.mul(q,S),O=s.mul(E,B),_=s.mul(v,S);return s.eql(k,N)&&s.eql(O,_)}is0(){return this.equals(m.ZERO)}negate(){return new m(s.neg(this.X),this.Y,this.Z,s.neg(this.T))}double(){let{X:p,Y:w,Z:E}=this,S=s.sqr(p),q=s.sqr(w),v=s.mul(s.sqr(E),yt),B=h(S),k=s.addN(p,w),N=s.sub(s.subN(s.sqr(k),S),q),O=s.addN(B,q),_=s.subN(O,v),y=s.subN(B,q),C=s.mul(N,_),b=s.mul(O,y),T=s.mul(N,y),F=s.mul(_,O);return new m(C,b,F,T)}add(p){g(p);let{d:w}=o,{X:E,Y:S,Z:q,T:v}=this,{X:B,Y:k,Z:N,T:O}=p,_=s.mul(E,B),y=s.mul(S,k),C=s.mul(s.mulN(v,w),O),b=s.mul(q,N),T=s.sub(s.subN(s.mulN(s.addN(E,S),s.addN(B,k)),_),y),F=s.subN(b,C),I=s.addN(b,C),P=s.sub(y,h(_)),$=s.mul(T,F),j=s.mul(I,P),z=s.mul(T,P),oe=s.mul(F,I);return new m($,j,oe,z)}subtract(p){return g(p),this.add(p.negate())}multiply(p){if(!i.isValidNot0(p))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");let{p:w,f:E}=D.mulSecret(this,p,u,A);return A([w,E])[0]}multiplyUnsafe(p){if(!i.isValid(p))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return p===gt?m.ZERO:this.is0()||p===xt?this:D.mulUnsafe(this,p,A)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return D.mulUnsafe(this,o.n).is0()}toAffine(p){let w=this,E=p;if(E!=null&&typeof E!="bigint")throw new TypeError('"invertedZ" expected bigint, got type='+typeof E);let{X:S,Y:q,Z:v}=w,B=w.is0();E==null&&(E=B?s.create(vn):s.inv(v));let k=s.mul(S,E),N=s.mul(q,E),O=s.mul(v,E);if(B)return{x:s.ZERO,y:s.ONE};if(!s.eql(O,s.ONE))throw new Error("invZ was invalid");return{x:k,y:N}}clearCofactor(){return u===xt?this:u===yt?this.double():u===Wo?this.double().double():u===vn?this.double().double().double():this.multiplyUnsafe(u)}toBytes(){let{x:p,y:w}=this.toAffine(),E=s.toBytes(w);return E[E.length-1]|=l(p)?128:0,E}toHex(){return on(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let A=x=>Dn(m,x),D=new pt(m,a);return D.bits>=6&&m.BASE.precompute(6),Object.freeze(m.prototype),Object.freeze(m),m}function Sn(t,e,r={}){if($e(t),typeof e!="function")throw new Error('"hash" function param is required');let n=e,s=r;te(s,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",zip215:"boolean",mapToCurve:"function",toMontgomery:"function",toMontgomerySecret:"function"});let{prehash:i}=s,{BASE:o,Fp:u,Fn:a}=t,c=n.outputLen,l=2*u.BYTES;if(c!==void 0&&(Ce(c,"hash.outputLen"),c!==l))throw new Error(`hash.outputLen must be ${l}, got ${c}`);let f=s.randomBytes===void 0?Pe:s.randomBytes,h=s.toMontgomery,d=s.toMontgomerySecret,g=s.adjustScalarBytes===void 0?y=>y:s.adjustScalarBytes,m=s.domain===void 0?(y,C,b)=>{if(ie(b,"phflag"),C.length||b)throw new Error("Contexts/pre-hash are not supported");return y}:s.domain;function A(y){return a.create(ue(y))}function D(y){let C=B.secretKey;M(y,B.secretKey,"secretKey");let b=M(n(y),2*C,"hashedSecretKey"),T=g(b.slice(0,C)),F=b.slice(C,2*C),I=A(T);return{head:T,prefix:F,scalar:I}}function x(y){let{head:C,prefix:b,scalar:T}=D(y),F=o.multiply(T),I=F.toBytes();return{head:C,prefix:b,scalar:T,point:F,pointBytes:I}}function p(y){return x(y).pointBytes}function w(y=Uint8Array.of(),...C){let b=Yt(...C);return A(n(m(b,M(y,void 0,"context"),!!i)))}function E(y,C,b={}){te(b,{},{},"options"),y=he(M(y,void 0,"message")),i&&(y=i(y));let{prefix:T,scalar:F,pointBytes:I}=x(C),P=w(b.context,T,y),$=o.multiply(P).toBytes(),j=w(b.context,$,I,y),z=a.create(P+j*F);if(!a.isValid(z))throw new Error("sign failed: invalid s");let oe=Yt($,a.toBytes(z));return M(oe,B.signature,"result")}let S={zip215:s.zip215};function q(y,C,b,T=S){te(T);let{context:F}=T,I=T.zip215===void 0?!!S.zip215:T.zip215,P=B.signature;y=M(y,P,"signature"),C=M(C,void 0,"message"),b=M(b,B.publicKey,"publicKey"),I!==void 0&&ie(I,"zip215"),i&&(C=i(C));let $=P/2,j=y.subarray(0,$),z=ue(y.subarray($,P)),oe,Le,Je;try{oe=t.fromBytes(b,I),Le=t.fromBytes(j,I),Je=o.multiplyUnsafe(z)}catch{return!1}if(!I&&oe.isSmallOrder())return!1;let qe=w(F,j,b,C);return Le.add(oe.multiplyUnsafe(qe)).subtract(Je).clearCofactor().is0()}let v=u.BYTES,B={secretKey:v,publicKey:v,signature:2*v,seed:v};function k(y){return y=y===void 0?f(B.seed):y,M(y,B.seed,"seed")}function N(y){return Ue(y)&&y.length===B.secretKey}function O(y,C){try{return!!t.fromBytes(y,C===void 0?S.zip215:C)}catch{return!1}}let _={getExtendedPublicKey:x,randomSecretKey:k,isValidSecretKey:N,isValidPublicKey:O,toMontgomery(y){if(h===void 0)throw new Error("Montgomery conversion is not supported for this curve");return h(t.fromBytes(y))},toMontgomerySecret(y){if(d===void 0)throw new Error("Montgomery conversion is not supported for this curve");return d(y)}};return Object.freeze(B),Object.freeze(_),Object.freeze({keygen:mt(k,p),getPublicKey:p,sign:E,verify:q,utils:_,Point:t,lengths:B})}var Ae=BigInt(0),W=BigInt(1),bt=BigInt(2);function Fn(t,e){return t+e-(e>>W<<W)}function Yo(t){let e=BigInt(6)*t;return(r,n,s)=>{let i=n+s,u=((e+s-n)*r+n)%t;return{x_2:u,x_3:i-u}}}function Xo(t){return te(t,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function",scalarMultBase:"function"}),Object.freeze({...t})}function kn(t){let e=Xo(t),{P:r,type:n,adjustScalarBytes:s,powPminus2:i,randomBytes:o}=e,u=e.scalarMultBase,a=n==="x25519";if(!a&&n!=="x448")throw new Error("invalid type");let c=o===void 0?Pe:o,l=a?255:448,f=Yo(r),h=a?32:56,d=BigInt(a?9:5),g=BigInt(a?121665:39081),m=a?bt**BigInt(254):bt**BigInt(447),A=a?BigInt(8)*(bt**BigInt(251)-W):BigInt(4)*(bt**BigInt(445)-W),D=m+A+W,x=b=>R(b,r),p=w(d);function w(b){return lt(x(b),h)}function E(b){let T=he(M(b,h,"uCoordinate"));return a&&(T[31]&=127),x(ue(T))}function S(b){return ue(s(he(M(b,h,"scalar"))))}let q=new Set(a?[Ae,W,r-W,BigInt("325606250916557431795983626356110631294008115727848805560023387167927233504"),BigInt("39382357235489614581723060781553021112529911719440698176882885853963445705823")]:[Ae,W,r-W]);function v(b,T){let F=E(T);if(q.has(F))throw new Error("invalid private or public key received");let I=O(F,S(b));if(I===Ae)throw new Error("invalid private or public key received");return w(I)}function B(b){if(u===void 0)return v(b,p);let T=S(b);ye("scalar",T,m,D);let F=x(u(T));if(F===Ae)throw new Error("invalid private or public key received");return w(F)}let k=B,N=v;function O(b,T){ye("u",b,Ae,r),ye("scalar",T,m,D);let F=T,I=b,P=W,$=Ae,j=b,z=W,oe=F^F>>W;for(let qe=BigInt(l-1);qe>=Ae;qe--){let It=Fn(r,oe>>qe);({x_2:P,x_3:j}=f(It,P,j)),{x_2:$,x_3:z}=f(It,$,z);let et=P+$,Ut=x(et*et),Pt=P-$,qr=x(Pt*Pt),_r=Ut-qr,po=j+z,mo=j-z,Nr=x(mo*et),Ir=x(po*Pt),Ur=Nr+Ir,Pr=Nr-Ir;j=x(Ur*Ur),z=x(I*x(Pr*Pr)),P=x(Ut*qr),$=x(_r*(Ut+x(g*_r)))}let Le=Fn(r,F);({x_2:P,x_3:j}=f(Le,P,j)),{x_2:$,x_3:z}=f(Le,$,z);let Je=i($);return x(P*Je)}let _={secretKey:h,publicKey:h,seed:h},y=b=>(b=b===void 0?c(h):b,M(b,_.seed,"seed"),b),C={randomSecretKey:y};return Object.freeze(_),Object.freeze(C),Object.freeze({keygen:mt(y,k),getSharedSecret:N,getPublicKey:k,scalarMult:v,scalarMultBase:B,utils:C,GuBytes:p.slice(),lengths:_})}var Rn=BigInt(0),ir=BigInt(1),On=BigInt(2),Qo=BigInt(3),Jo=BigInt(5),ei=BigInt(8),At=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),ti={p:At,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:ei,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function _n(t){let e=BigInt(10),r=BigInt(20),n=BigInt(40),s=BigInt(80),i=At,u=t*t%i*t%i,a=V(u,On,i)*u%i,c=V(a,ir,i)*t%i,l=V(c,Jo,i)*c%i,f=V(l,e,i)*l%i,h=V(f,r,i)*f%i,d=V(h,n,i)*h%i,g=V(d,s,i)*d%i,m=V(g,s,i)*d%i,A=V(m,e,i)*l%i;return{pow_p_5_8:V(A,On,i)*t%i,b2:u}}function ur(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}var Ln=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function ri(t,e){let r=At,n=R(e*e*e,r),s=R(n*n*e,r),i=_n(t*s).pow_p_5_8,o=R(t*n*i,r),u=R(e*o*o,r),a=o,c=R(o*Ln,r),l=u===t,f=u===R(-t,r),h=u===R(-t*Ln,r);return l&&(o=a),(f||h)&&(o=c),yn(o,r)&&(o=R(-o,r)),{isValid:l||f,value:o}}var je=Tn(ti,{uvRatio:ri}),qn=je.Fp;function ni(t){let{y:e}=t;return qn.toBytes(qn.div(ir+e,ir-e))}function si(t){let e=je.Fp.BYTES;return ee(t,e),ur(Wt(t.subarray(0,e))).subarray(0,e)}function oi(t){return Sn(je,Wt,Object.assign({adjustScalarBytes:ur,toMontgomery:ni,toMontgomerySecret:si,zip215:!0},t))}var Nn=oi({});var K=(()=>{let t=At,e=r=>{let{pow_p_5_8:n,b2:s}=_n(r);return R(V(n,Qo,t)*s,t)};return kn({P:t,type:"x25519",powPminus2:e,adjustScalarBytes:ur,scalarMultBase:r=>{let n=R(r,je.Fn.ORDER);if(n===Rn)return Rn;let s=je.BASE.multiply(n);return R((s.Z+s.Y)*e(R(s.Z-s.Y,t)),t)}})})();var In=1,Dt=new TextEncoder;function ar(t){return Z(Dt.encode(`shalom/v1/${t}`))}function Te(t){return t.buffer instanceof ArrayBuffer?t:new Uint8Array(t)}function Z(...t){let e=new Uint8Array(t.reduce((n,s)=>n+s.length,0)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e}async function Un(t,e,r,n){let s=await crypto.subtle.importKey("raw",Z(t),"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:Z(e,r),info:ar(n)},s,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}function Pn(){let{secretKey:t,publicKey:e}=K.keygen();return{secretKey:t,publicKey:e}}function Mn(t){return K.getPublicKey(t)}async function Hn(t,e,r){let n=K.keygen(),s=K.getSharedSecret(n.secretKey,t),i=await Un(s,n.publicKey,t,r),o=crypto.getRandomValues(new Uint8Array(12)),u=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:ar(r)},i,Te(e)));return Z(new Uint8Array([In]),n.publicKey,o,u)}async function ze(t,e,r){if(e.length<61||e[0]!==In)throw new Error("lacre inv\xE1lido");let n=e.subarray(1,33),s=e.subarray(33,45),i=e.subarray(45),o=K.getPublicKey(t),u=K.getSharedSecret(t,n),a=await Un(u,n,o,r);return new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:Te(s),additionalData:ar(r)},a,Te(i)))}async function $n(t,e){return JSON.parse(new TextDecoder().decode(await ze(t,e,"head")))}function re(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)}function Y(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}var wt=2;async function jn(t,e,r,n,s,i){let o=await crypto.subtle.importKey("raw",Z(t,e),"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:Z(r,n,s),info:Z(Dt.encode(`shalom/v2/${i}`))},o,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function zn(t,e,r,n){let s=K.keygen(),i=K.getPublicKey(e),o=await jn(K.getSharedSecret(s.secretKey,t),K.getSharedSecret(e,t),s.publicKey,i,t,n),u=crypto.getRandomValues(new Uint8Array(12)),a=Z(new Uint8Array([wt]),Dt.encode(`shalom/v2/${n}`)),c=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:u,additionalData:a},o,Te(r)));return Z(new Uint8Array([wt]),s.publicKey,u,c)}async function Kn(t,e,r,n){if(r.length<61||r[0]!==wt)throw new Error("lacre inv\xE1lido");let s=r.subarray(1,33),i=r.subarray(33,45),o=K.getPublicKey(t),u=await jn(K.getSharedSecret(t,s),K.getSharedSecret(t,e),s,e,o,n),a=Z(new Uint8Array([wt]),Dt.encode(`shalom/v2/${n}`));return new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:Te(i),additionalData:a},u,Te(r.subarray(45))))}var ne=new TextEncoder,ae=t=>t===32||t===9,Gn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ke=new Uint8Array(256);for(let t=0;t<Gn.length;t++)Ke[Gn.charCodeAt(t)]=t;function lr(t){let e=t.length;for(;e>0&&t.charAt(e-1)==="=";)e--;e%4===1&&e--;let r=e%4,n=Math.floor(e/4)*3+(r?r-1:0),s=new ArrayBuffer(n),i=new Uint8Array(s),o=0;for(let u=0;u<e;u+=4){let a=Ke[t.charCodeAt(u)],c=Ke[t.charCodeAt(u+1)],l=Ke[t.charCodeAt(u+2)],f=Ke[t.charCodeAt(u+3)];i[o++]=a<<2|c>>4,o<n&&(i[o++]=(c&15)<<4|l>>2),o<n&&(i[o++]=(l&3)<<6|f&63)}return s}var ii=new Map([["iso88598i","iso-8859-8"],["iso88598e","iso-8859-8"],["shiftjis","shift_jis"],["windows31j","shift_jis"],["mskanji","shift_jis"],["eucjp","euc-jp"],["iso2022jp","iso-2022-jp"],["iso2022jp1","iso-2022-jp"],["iso2022jp2","iso-2022-jp"],["junet","iso-2022-jp"],["euckr","euc-kr"],["uhc","euc-kr"],["tis620","windows-874"]]),ui=new Map([["932","shift_jis"],["936","gbk"],["949","euc-kr"],["950","big5"],["874","windows-874"],["51932","euc-jp"],["50220","iso-2022-jp"],["50221","iso-2022-jp"],["50222","iso-2022-jp"]]),ai=/^(?:cp|windows|ms|ibm)(\d+)$/;function ci(t){return t.replace(/^(?:x-ms-|x-|cs)/,"").replace(/[\s._-]+/g,"")}var Vn=new Set(["unicode-1-1-utf-8 unicode11utf8 unicode20utf8 utf-8 utf8 x-unicode20utf8","866 cp866 csibm866 ibm866","csisolatin2 iso-8859-2 iso-ir-101 iso8859-2 iso88592 iso_8859-2 iso_8859-2:1987 l2 latin2","csisolatin3 iso-8859-3 iso-ir-109 iso8859-3 iso88593 iso_8859-3 iso_8859-3:1988 l3 latin3","csisolatin4 iso-8859-4 iso-ir-110 iso8859-4 iso88594 iso_8859-4 iso_8859-4:1988 l4 latin4","csisolatincyrillic cyrillic iso-8859-5 iso-ir-144 iso8859-5 iso88595 iso_8859-5 iso_8859-5:1988","arabic asmo-708 csiso88596e csiso88596i csisolatinarabic ecma-114 iso-8859-6 iso-8859-6-e","iso-8859-6-i iso-ir-127 iso8859-6 iso88596 iso_8859-6 iso_8859-6:1987","csisolatingreek ecma-118 elot_928 greek greek8 iso-8859-7 iso-ir-126 iso8859-7 iso88597 iso_8859-7","iso_8859-7:1987 sun_eu_greek","csiso88598e csisolatinhebrew hebrew iso-8859-8 iso-8859-8-e iso-ir-138 iso8859-8 iso88598 iso_8859-8","iso_8859-8:1988 visual","csiso88598i iso-8859-8-i logical","csisolatin6 iso-8859-10 iso-ir-157 iso8859-10 iso885910 l6 latin6","iso-8859-13 iso8859-13 iso885913","iso-8859-14 iso8859-14 iso885914","csisolatin9 iso-8859-15 iso8859-15 iso885915 iso_8859-15 l9","iso-8859-16","cskoi8r koi koi8 koi8-r koi8_r","koi8-ru koi8-u","csmacintosh mac macintosh x-mac-roman","dos-874 iso-8859-11 iso8859-11 iso885911 tis-620 windows-874","cp1250 windows-1250 x-cp1250","cp1251 windows-1251 x-cp1251","ansi_x3.4-1968 ascii cp1252 cp819 csisolatin1 ibm819 iso-8859-1 iso-ir-100 iso8859-1 iso88591","iso_8859-1 iso_8859-1:1987 l1 latin1 us-ascii windows-1252 x-cp1252","cp1253 windows-1253 x-cp1253","cp1254 csisolatin5 iso-8859-9 iso-ir-148 iso8859-9 iso88599 iso_8859-9 iso_8859-9:1989 l5 latin5","windows-1254 x-cp1254","cp1255 windows-1255 x-cp1255","cp1256 windows-1256 x-cp1256","cp1257 windows-1257 x-cp1257","cp1258 windows-1258 x-cp1258","x-mac-cyrillic x-mac-ukrainian","chinese csgb2312 csiso58gb231280 gb2312 gb_2312 gb_2312-80 gbk iso-ir-58 x-gbk","gb18030","big5 big5-hkscs cn-big5 csbig5 x-x-big5","cseucpkdfmtjapanese euc-jp x-euc-jp","csiso2022jp iso-2022-jp","csshiftjis ms932 ms_kanji shift-jis shift_jis sjis windows-31j x-sjis","cseuckr csksc56011987 euc-kr iso-ir-149 korean ks_c_5601-1987 ks_c_5601-1989 ksc5601 ksc_5601","windows-949","csiso2022kr hz-gb-2312 iso-2022-cn iso-2022-cn-ext iso-2022-kr replacement","x-user-defined"].join(" ").split(" ")),li=new Set(["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr","replacement"]),fi={encoding:"replacement",decode:t=>t&&t.byteLength?"\uFFFD":""},di=new Map([["utf-16","utf-16"],["utf16","utf-16"],["utf_16","utf-16"],["utf-16le","utf-16le"],["utf-16be","utf-16be"]]);function Qn(t){if(t=(t||"utf8").trim().toLowerCase(),Vn.has(t))return t;let e=di.get(t);if(e)return e;let r=ci(t),n=r.match(ai),s=n&&ui.get(n[1])||ii.get(r)||r;return Vn.has(s)?s:null}var Wn=new Map;function Et(t){if(li.has(t))return fi;let e=Wn.get(t);if(e===void 0){e=null;try{e=new TextDecoder(t)}catch{}Wn.set(t,e)}return e}var fr=new TextDecoder;function Jn(t){let e=Qn(t);return e?Et(e):null}function es(t){return Jn(t)||Et("windows-1252")||fr}var hi=new Set(["utf-16le","utf-16be"]),pi=new Set(["utf-16"]);function mi(t){return t[0]===254&&t[1]===255?"utf-16be":t[0]===255&&t[1]===254?"utf-16le":null}function gi(t){for(let e=0;e<t.length;){let r=t[e];if(r<128){e++;continue}let n;if(r>=194&&r<=223)n=1;else if(r>=224&&r<=239)n=2;else if(r>=240&&r<=244)n=3;else return!1;if(e+n>=t.length)return!1;let s=t[e+1],i=r===224?160:r===240?144:128,o=r===237?159:r===244?143:191;if(s<i||s>o)return!1;for(let u=2;u<=n;u++)if((t[e+u]&192)!==128)return!1;e+=n+1}return!0}function Bt(t,e=fr){let r=t instanceof Uint8Array?t:new Uint8Array(t);return gi(r)?e.decode(r):es("windows-1252").decode(r)}function dr(t,e){let r=t instanceof Uint8Array?t:new Uint8Array(t),n=Qn(e),s=n?Et(n):null;if(n&&pi.has(n)){let i=mi(r);s=i&&Et(i)||s}return s?s.decode(r):Bt(r)}var xi=1024,yi=/charset\s*=\s*["']?\s*([^\s"';>]+)/;function bi(t){let e=fr.decode(t.subarray(0,xi)).toLowerCase(),r=0;for(;(r=e.indexOf("<meta",r))>=0;){let n=e.indexOf(">",r);n<0&&(n=e.length);let s=yi.exec(e.slice(r,n));if(s)return s[1];r=n}return null}function ts(t,e,r){let n=new Uint8Array(t);if(e)return dr(n,e);let s=r?bi(n):null,i=s?Jn(s):null;return!i||hi.has(i.encoding)?Bt(n):(i.encoding==="x-user-defined"?es("windows-1252"):i).decode(n)}async function Se(t){if("arrayBuffer"in t)return await t.arrayBuffer();let e=new FileReader;return new Promise((r,n)=>{e.onload=()=>{r(e.result)},e.onerror=()=>{n(e.error)},e.readAsArrayBuffer(t)})}function we(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-97+10:t>=65&&t<=70?t-65+10:-1}function Ge(t){return t.replace(/[\r\n]+/g," ")}function cr(t,e,r){let n=t.indexOf("*");n>=0&&(t=t.slice(0,n)),e=e.toUpperCase();let s;if(e==="Q"){r=r.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let i=ne.encode(r),o=[];for(let a=0,c=i.length;a<c;a++){let l=i[a];if(a<=c-2&&l===61){let f=we(i[a+1]),h=we(i[a+2]);if(f>=0&&h>=0){o.push(f<<4|h),a+=2;continue}}o.push(l)}s=new ArrayBuffer(o.length);let u=new DataView(s);for(let a=0,c=o.length;a<c;a++)u.setUint8(a,o[a])}else e==="B"?s=lr(r.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=ne.encode(r);return Ge(dr(s,t))}var rs="=\\?([^?\\s]+)\\?([QqBb])\\?([^?]*)\\?=",Zn=new RegExp(rs,"g"),Ai=/^[ \t\r\n]+$/,wi=new RegExp(`^(?:${rs}\\s*)+$`);function ns(t){return wi.test(t)}function Di(t){let e=[];Zn.lastIndex=0;let r=0,n;for(;n=Zn.exec(t);)n.index>r&&e.push({text:t.substring(r,n.index)}),e.push({charset:n[1],encoding:n[2],encodedText:n[3]}),r=n.index+n[0].length;return r<t.length&&e.push({text:t.substring(r)}),e}function Ei(t,e){let r=t.encoding.toUpperCase();return t.charset!==e.charset||r!==e.encoding.toUpperCase()?!1:r==="B"?t.encodedText.length%4===0&&!t.padded:!0}function Yn(t,e){let r="",n=null;for(let s=0;s<t.length;s++){let i=t[s];if(i.text!==void 0){let o=t[s+1];if(n&&o&&o.text===void 0&&Ai.test(i.text))continue;n&&(r+=cr(n.charset,n.encoding,n.encodedText),n=null),r+=i.text;continue}if(n&&e&&Ei(n,i)){n.encodedText+=i.encodedText,n.padded=i.encodedText.endsWith("=");continue}n&&(r+=cr(n.charset,n.encoding,n.encodedText)),n={charset:i.charset,encoding:i.encoding,encodedText:i.encodedText,padded:i.encodedText.endsWith("=")}}return n&&(r+=cr(n.charset,n.encoding,n.encodedText)),r}function pe(t){let e=Di((t||"").toString()),r=Yn(e,!0);return r.indexOf("\uFFFD")<0?r:Yn(e,!1)}function Xn(t,e){e=e||"utf-8";let r=[];for(let i=0;i<t.length;i++){let o=t.charAt(i),u=o==="%"?we(t.charCodeAt(i+1)):-1,a=u>=0?we(t.charCodeAt(i+2)):-1;if(a>=0)r.push(u<<4|a),i+=2;else if(o.charCodeAt(0)>126){let c=ne.encode(o);for(let l=0;l<c.length;l++)r.push(c[l])}else r.push(o.charCodeAt(0))}let n=new ArrayBuffer(r.length),s=new DataView(n);for(let i=0,o=r.length;i<o;i++)s.setUint8(i,r[i]);return dr(n,e)}function ss(t){let e=new Map;Object.keys(t.params).forEach(r=>{let n=r.match(/\*((\d+)\*?)?$/);if(!n)return;let s=r.slice(0,n.index).toLowerCase(),i=Number(n[2])||0,o=e.get(s);o||(o={charset:null,values:[]},e.set(s,o));let u=t.params[r],a=n[0].charAt(n[0].length-1)==="*";i===0&&a&&(n=u.match(/^([^']*)'[^']*'(.*)$/))&&(o.charset=n[1]||"utf-8",u=n[2]),o.values.push({nr:i,value:u,encoded:a}),delete t.params[r]}),e.forEach((r,n)=>{if(Object.prototype.hasOwnProperty.call(t.params,n))return;let s="",i="";for(let o of r.values.sort((u,a)=>u.nr-a.nr)){if(o.encoded){i+=o.value;continue}i&&(s+=Xn(i,r.charset),i=""),s+=o.value}i&&(s+=Xn(i,r.charset)),t.params[n]=s})}var Ve=class{constructor(){this.chunks=[],this.runBuffer=null,this.runStart=0,this.runEnd=0,this.pendingLineBreak=null}continuesRun(e){return e.buffer===this.runBuffer&&e.byteOffset===this.runEnd}flushRun(){this.runBuffer&&this.runEnd>this.runStart&&this.chunks.push(new Uint8Array(this.runBuffer,this.runStart,this.runEnd-this.runStart)),this.runBuffer=null}update(e,r){let n=this.pendingLineBreak;n&&this.continuesRun(n)&&e.buffer===this.runBuffer&&e.byteOffset===this.runEnd+n.byteLength?this.runEnd=e.byteOffset+e.byteLength:(this.flushRun(),n&&this.chunks.push(n),this.runBuffer=e.buffer,this.runStart=e.byteOffset,this.runEnd=e.byteOffset+e.byteLength),this.pendingLineBreak=r}finalize(e=!1){let r=this.pendingLineBreak;return!e&&r&&(this.continuesRun(r)?this.runEnd+=r.byteLength:(this.flushRun(),this.chunks.push(r))),this.flushRun(),Se(new Blob(this.chunks,{type:"application/octet-stream"}))}};var De=class{constructor(e=100*1024){this.maxChunkSize=e,this.buffer=null,this.bufferPos=0,this.chunks=[]}writeByte(e){(!this.buffer||this.bufferPos>=this.buffer.length)&&(this.flush(),this.buffer??=new Uint8Array(this.maxChunkSize)),this.buffer[this.bufferPos++]=e}writeBytes(e,r=0,n=e.length){for(;r<n;){(!this.buffer||this.bufferPos>=this.buffer.length)&&(this.flush(),this.buffer??=new Uint8Array(this.maxChunkSize));let s=Math.min(n-r,this.buffer.length-this.bufferPos);this.buffer.set(e.subarray(r,r+s),this.bufferPos),this.bufferPos+=s,r+=s}}append(e){e.length>=this.maxChunkSize/2?(this.flush(),this.chunks.push(e)):this.writeBytes(e)}flush(){this.buffer&&this.bufferPos&&(this.chunks.push(this.buffer.slice(0,this.bufferPos)),this.bufferPos=0)}finalize(){return this.flush(),Se(new Blob(this.chunks,{type:"application/octet-stream"}))}};var We=class{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.output=new De,this.remainder=""}pushChunk(e){e.length&&this.output.append(new Uint8Array(lr(e)))}flushRemainder(){this.pushChunk(this.remainder),this.remainder=""}update(e){let r=this.decoder.decode(e).replace(/[^a-zA-Z0-9+/=]+/g,""),n=0,s;for(;(s=r.indexOf("=",n))>=0;)this.remainder+=r.substring(n,s),this.flushRemainder(),n=s+1;if(this.remainder+=r.substring(n),this.remainder.length>=this.maxChunkSize){let i=Math.floor(this.remainder.length/4)*4;this.pushChunk(this.remainder.substring(0,i)),this.remainder=this.remainder.substring(i)}}finalize(){return this.flushRemainder(),this.output.finalize()}};var os=61,Ze=class{constructor(){this.output=new De,this.pendingLineBreak=null}writeLineBreak(){this.pendingLineBreak&&this.output.writeBytes(this.pendingLineBreak)}update(e,r){this.writeLineBreak();let n=e.length;for(;n>0&&ae(e[n-1]);)n--;let s=n>0&&e[n-1]===os;s&&n--;let i=0;for(let o=0;o<n;o++){if(e[o]!==os||o+2>=n)continue;let u=we(e[o+1]),a=we(e[o+2]);u<0||a<0||(this.output.writeBytes(e,i,o),this.output.writeByte(u<<4|a),o+=2,i=o+1)}this.output.writeBytes(e,i,n),this.pendingLineBreak=s?null:r}finalize(e=!1){return e||this.writeLineBreak(),this.output.finalize()}};var Bi={EINVALIDOPTION:TypeError,EINVALIDINPUT:TypeError,EPARSERREUSED:Error,EMAXNESTINGDEPTH:Error,EMAXHEADERSIZE:Error,EMAXPARTCOUNT:Error,EMAXFORWARDEDADDRESSES:Error};function X(t,e){let r=new Bi[t](e);return r.code=t,r}var Ci=new TextDecoder("utf-8",{ignoreBOM:!0}),vi=4096,Ti=64,Si=t=>{let e=0,r=t.length;for(;e<r&&ae(t.charCodeAt(e));)e++;for(;r>e&&ae(t.charCodeAt(r-1));)r--;return t.slice(e,r)},Fi=/^(?:From |[!-9;-~]*[ \t]*:)/,ki=new Set(["content-type","content-transfer-encoding","content-disposition","content-id","content-description"]),Fe=class{constructor(e){this.options=e,this.postalMime=e.postalMime;let r=this.postalMime.limits;if(this.postalMime.counters.partCount++,this.postalMime.counters.partCount>r.maxPartCount)throw X("EMAXPARTCOUNT",`Maximum MIME part count of ${r.maxPartCount} parts exceeded`);if(this.childNodes=[],this.finalizedChildCount=0,e.parentNode){if(this.parentNode=e.parentNode,this.depth=this.parentNode.depth+1,this.depth>r.maxNestingDepth)throw X("EMAXNESTINGDEPTH",`Maximum MIME nesting depth of ${r.maxNestingDepth} levels exceeded`);e.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[];let s=(e.parentMultipartType||null)==="digest"?"message/rfc822":"text/plain";this.contentType={value:s,parsed:{value:s,params:{}},multipart:!1},this.contentTransferEncoding={value:"8bit",encoding:""},this.contentDisposition={value:"",parsed:{value:"",params:{}}},this.headers=[],this.rawHeaderLines=[],this.contentDecoder=null,this.content=null}setupContentDecoder(e){e==="base64"?this.contentDecoder=new We:e==="quoted-printable"?this.contentDecoder=new Ze:this.contentDecoder=new Ve}async finalize(e=!1){if(this.state==="finished")return;this.state==="header"&&this.endHeaders();let r=this.postalMime.boundaries;for(let n=r.length-1;n>=0;n--)if(r[n].node===this){r.splice(n,1);break}await this.finalizeChildNodes(e),this.content=this.contentDecoder?await this.contentDecoder.finalize(e):null,this.contentDecoder=null,this.state="finished"}async finalizeChildNodes(e=!1){for(;this.finalizedChildCount<this.childNodes.length;)await this.childNodes[this.finalizedChildCount++].finalize(e)}stripComments(e){let r="",n=0,s=!1,i=!1,o=-1,u=!1,a=0,c=g=>{r+=e.slice(a,g),a=g+1},l=!1,f=!1,h=g=>{l=!0,f=ae(e.charCodeAt(g))},d=()=>!u||!l||f;for(let g=0;g<e.length;g++){let m=e.charAt(g);if(s)s=!1;else if(m==="\\")s=!0;else if(m==='"'&&n===0)i=!i;else if(!i){if(m==="("&&d()){n===0&&(o=g),n++,c(g);continue}if(m===")"&&n>0){n--,c(g);continue}n===0&&(m==="="?u=!0:m===";"&&(u=!1))}n===0?h(g):c(g)}return n===0||e.indexOf(";",o)<0?r+e.slice(a):e}parseStructuredHeader(e){e=this.stripComments(e);let r={value:"",params:{}},n=!1,s="",i="value",o="",u=!1,a=!1,c=!1,l,f=()=>{s.length&&(s+=o),o=""},h=-1,d=p=>{h>=0&&(s+=e.slice(h,p),h=-1)},g=p=>{h<0&&(f(),h=p)},m=()=>{let p=s;return s="",o="",u=!1,p},A=(p,w)=>{p&&!Object.prototype.hasOwnProperty.call(r.params,p)&&(r.params[p]=w)},D=()=>{let p=m();n===!1?r.value=p:A(n,p)},x=()=>{A(m().trim().toLowerCase(),"")};for(let p=0,w=e.length;p<w;p++)switch(l=e.charAt(p),i){case"key":if(l==="="){d(p),n=m().trim().toLowerCase(),i="value";break}if(l===";"){d(p),x();break}h<0&&(h=p);break;case"value":if(u&&l!==";"){c=!1;break}if(c)g(p);else if(a&&l==="\\"){d(p),c=!0;continue}else a&&l===a?(d(p),a=!1,u=!0):!a&&l==='"'?(d(p),a=l,f()):!a&&l===";"?(d(p),D(),i="key"):!a&&(l===" "||l===" ")?(d(p),o+=l):g(p);c=!1;break}return d(e.length),i==="value"?D():x(),r.value&&(r.value=r.value.toLowerCase()),ss(r),r}decodeFlowedText(e,r){let n=[],s=[],i=!1,o=0;for(let u=0;u<=e.length;){let a=e.indexOf(`
|
|
2
|
+
`,u);a<0&&(a=e.length);let c=e.slice(u,a),l=0;for(;c.charCodeAt(l)===62;)l++;let f=c.charCodeAt(l)===32?l+1:l,h=c.slice(f),d=h==="-- ";if(i&&l===o&&!d){if(r){let g=s[s.length-1];s[s.length-1]=g.slice(0,-1)}s.push(h)}else u&&s.push(`
|
|
3
|
+
`),s.push(l?c:h);if(i=!d&&h.endsWith(" "),o=l,s.length>=vi){let g=s.pop();n.push(s.join("")),s=[g]}u=a+1}return n.push(s.join("")),n.join("")}getTextContent(){if(!this.content)return"";let e=ts(this.content,this.contentType.parsed.params.charset,this.contentType.parsed.value==="text/html").replace(/\r\n/g,`
|
|
4
|
+
`);return this.contentType.parsed.value==="text/plain"&&/^flowed$/i.test(this.contentType.parsed.params.format)&&(e=this.decodeFlowedText(e,/^yes$/i.test(this.contentType.parsed.params.delsp))),e}processHeaders(){let e=[];for(let o of this.headerLines)e.length&&/^[ \t]/.test(o)?e[e.length-1].push(o):e.push([o]);let r=new Set;for(let o of e){let u=o.join(`
|
|
5
|
+
`),a=u.indexOf(":"),c=a<0?u:u.slice(0,a);this.rawHeaderLines.push({key:c.toLowerCase(),line:u});let l=o.join("");a=l.indexOf(":");let f=a<0?l:l.slice(0,a),h=a<0?"":Si(Ge(l.slice(a+1)));this.headers.push({key:f.toLowerCase(),originalKey:f,value:h});let d=f.toLowerCase();if(ki.has(d)&&!r.has(d))switch(r.add(d),d){case"content-type":this.contentType.value=h;break;case"content-transfer-encoding":this.contentTransferEncoding.value=h;break;case"content-disposition":this.contentDisposition.value=h;break;case"content-id":this.contentId=h;break;case"content-description":this.contentDescription=h;break}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.slice(this.contentType.parsed.value.indexOf("/")+1):!1;let n=this.contentType.multipart?(this.contentType.parsed.params.boundary||"").trimEnd():"";/[^\x00-\x7f]/.test(n)&&(n=""),this.contentType.multipart&&!n&&(this.contentType.parsed.value="text/plain",this.contentType.multipart=!1),this.contentType.multipart&&this.postalMime.boundaries.push({value:ne.encode(n),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value);let s=this.contentDisposition.parsed.value,i=s.search(/[ \t]/);i>=0&&(this.contentDisposition.parsed.value=s.slice(0,i)),this.contentTransferEncoding.encoding=(this.stripComments(this.contentTransferEncoding.value).toLowerCase().match(/^[ \t]*([\w-]+)/)||["",""])[1],this.setupContentDecoder(this.contentTransferEncoding.encoding),this.headerLines=[]}endHeaders(){this.state="body",this.processHeaders()}feed(e,r){switch(this.state){case"header":{if(!e.length)return this.endHeaders(),!1;this.postalMime.counters.headerSize+=Math.max(e.length,Ti);let n=this.postalMime.limits.maxHeadersSize;if(this.postalMime.counters.headerSize>n)throw X("EMAXHEADERSIZE",`Maximum header size of ${n} bytes exceeded`);let s=Bt(e,Ci);if(!ae(e[0])&&!Fi.test(s))return this.endHeaders(),!0;this.headerLines.push(s);break}case"body":this.contentDecoder&&this.contentDecoder.update(e,r);break}return!1}};var hr={"Æ":"\xC6","Æ":"\xC6","&":"&","&":"&","Á":"\xC1","Á":"\xC1","Ă":"\u0102","Â":"\xC2","Â":"\xC2","А":"\u0410","𝔄":"\u{1D504}","À":"\xC0","À":"\xC0","Α":"\u0391","Ā":"\u0100","⩓":"\u2A53","Ą":"\u0104","𝔸":"\u{1D538}","⁡":"\u2061","Å":"\xC5","Å":"\xC5","𝒜":"\u{1D49C}","≔":"\u2254","Ã":"\xC3","Ã":"\xC3","Ä":"\xC4","Ä":"\xC4","∖":"\u2216","⫧":"\u2AE7","⌆":"\u2306","Б":"\u0411","∵":"\u2235","ℬ":"\u212C","Β":"\u0392","𝔅":"\u{1D505}","𝔹":"\u{1D539}","˘":"\u02D8","ℬ":"\u212C","≎":"\u224E","Ч":"\u0427","©":"\xA9","©":"\xA9","Ć":"\u0106","⋒":"\u22D2","ⅅ":"\u2145","ℭ":"\u212D","Č":"\u010C","Ç":"\xC7","Ç":"\xC7","Ĉ":"\u0108","∰":"\u2230","Ċ":"\u010A","¸":"\xB8","·":"\xB7","ℭ":"\u212D","Χ":"\u03A7","⊙":"\u2299","⊖":"\u2296","⊕":"\u2295","⊗":"\u2297","∲":"\u2232","”":"\u201D","’":"\u2019","∷":"\u2237","⩴":"\u2A74","≡":"\u2261","∯":"\u222F","∮":"\u222E","ℂ":"\u2102","∐":"\u2210","∳":"\u2233","⨯":"\u2A2F","𝒞":"\u{1D49E}","⋓":"\u22D3","≍":"\u224D","ⅅ":"\u2145","⤑":"\u2911","Ђ":"\u0402","Ѕ":"\u0405","Џ":"\u040F","‡":"\u2021","↡":"\u21A1","⫤":"\u2AE4","Ď":"\u010E","Д":"\u0414","∇":"\u2207","Δ":"\u0394","𝔇":"\u{1D507}","´":"\xB4","˙":"\u02D9","˝":"\u02DD","`":"`","˜":"\u02DC","⋄":"\u22C4","ⅆ":"\u2146","𝔻":"\u{1D53B}","¨":"\xA8","⃜":"\u20DC","≐":"\u2250","∯":"\u222F","¨":"\xA8","⇓":"\u21D3","⇐":"\u21D0","⇔":"\u21D4","⫤":"\u2AE4","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","⇒":"\u21D2","⊨":"\u22A8","⇑":"\u21D1","⇕":"\u21D5","∥":"\u2225","↓":"\u2193","⤓":"\u2913","⇵":"\u21F5","̑":"\u0311","⥐":"\u2950","⥞":"\u295E","↽":"\u21BD","⥖":"\u2956","⥟":"\u295F","⇁":"\u21C1","⥗":"\u2957","⊤":"\u22A4","↧":"\u21A7","⇓":"\u21D3","𝒟":"\u{1D49F}","Đ":"\u0110","Ŋ":"\u014A","Ð":"\xD0","Ð":"\xD0","É":"\xC9","É":"\xC9","Ě":"\u011A","Ê":"\xCA","Ê":"\xCA","Э":"\u042D","Ė":"\u0116","𝔈":"\u{1D508}","È":"\xC8","È":"\xC8","∈":"\u2208","Ē":"\u0112","◻":"\u25FB","▫":"\u25AB","Ę":"\u0118","𝔼":"\u{1D53C}","Ε":"\u0395","⩵":"\u2A75","≂":"\u2242","⇌":"\u21CC","ℰ":"\u2130","⩳":"\u2A73","Η":"\u0397","Ë":"\xCB","Ë":"\xCB","∃":"\u2203","ⅇ":"\u2147","Ф":"\u0424","𝔉":"\u{1D509}","◼":"\u25FC","▪":"\u25AA","𝔽":"\u{1D53D}","∀":"\u2200","ℱ":"\u2131","ℱ":"\u2131","Ѓ":"\u0403",">":">",">":">","Γ":"\u0393","Ϝ":"\u03DC","Ğ":"\u011E","Ģ":"\u0122","Ĝ":"\u011C","Г":"\u0413","Ġ":"\u0120","𝔊":"\u{1D50A}","⋙":"\u22D9","𝔾":"\u{1D53E}","≥":"\u2265","⋛":"\u22DB","≧":"\u2267","⪢":"\u2AA2","≷":"\u2277","⩾":"\u2A7E","≳":"\u2273","𝒢":"\u{1D4A2}","≫":"\u226B","Ъ":"\u042A","ˇ":"\u02C7","^":"^","Ĥ":"\u0124","ℌ":"\u210C","ℋ":"\u210B","ℍ":"\u210D","─":"\u2500","ℋ":"\u210B","Ħ":"\u0126","≎":"\u224E","≏":"\u224F","Е":"\u0415","IJ":"\u0132","Ё":"\u0401","Í":"\xCD","Í":"\xCD","Î":"\xCE","Î":"\xCE","И":"\u0418","İ":"\u0130","ℑ":"\u2111","Ì":"\xCC","Ì":"\xCC","ℑ":"\u2111","Ī":"\u012A","ⅈ":"\u2148","⇒":"\u21D2","∬":"\u222C","∫":"\u222B","⋂":"\u22C2","⁣":"\u2063","⁢":"\u2062","Į":"\u012E","𝕀":"\u{1D540}","Ι":"\u0399","ℐ":"\u2110","Ĩ":"\u0128","І":"\u0406","Ï":"\xCF","Ï":"\xCF","Ĵ":"\u0134","Й":"\u0419","𝔍":"\u{1D50D}","𝕁":"\u{1D541}","𝒥":"\u{1D4A5}","Ј":"\u0408","Є":"\u0404","Х":"\u0425","Ќ":"\u040C","Κ":"\u039A","Ķ":"\u0136","К":"\u041A","𝔎":"\u{1D50E}","𝕂":"\u{1D542}","𝒦":"\u{1D4A6}","Љ":"\u0409","<":"<","<":"<","Ĺ":"\u0139","Λ":"\u039B","⟪":"\u27EA","ℒ":"\u2112","↞":"\u219E","Ľ":"\u013D","Ļ":"\u013B","Л":"\u041B","⟨":"\u27E8","←":"\u2190","⇤":"\u21E4","⇆":"\u21C6","⌈":"\u2308","⟦":"\u27E6","⥡":"\u2961","⇃":"\u21C3","⥙":"\u2959","⌊":"\u230A","↔":"\u2194","⥎":"\u294E","⊣":"\u22A3","↤":"\u21A4","⥚":"\u295A","⊲":"\u22B2","⧏":"\u29CF","⊴":"\u22B4","⥑":"\u2951","⥠":"\u2960","↿":"\u21BF","⥘":"\u2958","↼":"\u21BC","⥒":"\u2952","⇐":"\u21D0","⇔":"\u21D4","⋚":"\u22DA","≦":"\u2266","≶":"\u2276","⪡":"\u2AA1","⩽":"\u2A7D","≲":"\u2272","𝔏":"\u{1D50F}","⋘":"\u22D8","⇚":"\u21DA","Ŀ":"\u013F","⟵":"\u27F5","⟷":"\u27F7","⟶":"\u27F6","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","𝕃":"\u{1D543}","↙":"\u2199","↘":"\u2198","ℒ":"\u2112","↰":"\u21B0","Ł":"\u0141","≪":"\u226A","⤅":"\u2905","М":"\u041C"," ":"\u205F","ℳ":"\u2133","𝔐":"\u{1D510}","∓":"\u2213","𝕄":"\u{1D544}","ℳ":"\u2133","Μ":"\u039C","Њ":"\u040A","Ń":"\u0143","Ň":"\u0147","Ņ":"\u0145","Н":"\u041D","​":"\u200B","​":"\u200B","​":"\u200B","​":"\u200B","≫":"\u226B","≪":"\u226A","
":`
|
|
6
|
+
`,"𝔑":"\u{1D511}","⁠":"\u2060"," ":"\xA0","ℕ":"\u2115","⫬":"\u2AEC","≢":"\u2262","≭":"\u226D","∦":"\u2226","∉":"\u2209","≠":"\u2260","≂̸":"\u2242\u0338","∄":"\u2204","≯":"\u226F","≱":"\u2271","≧̸":"\u2267\u0338","≫̸":"\u226B\u0338","≹":"\u2279","⩾̸":"\u2A7E\u0338","≵":"\u2275","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⋪":"\u22EA","⧏̸":"\u29CF\u0338","⋬":"\u22EC","≮":"\u226E","≰":"\u2270","≸":"\u2278","≪̸":"\u226A\u0338","⩽̸":"\u2A7D\u0338","≴":"\u2274","⪢̸":"\u2AA2\u0338","⪡̸":"\u2AA1\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⋠":"\u22E0","∌":"\u220C","⋫":"\u22EB","⧐̸":"\u29D0\u0338","⋭":"\u22ED","⊏̸":"\u228F\u0338","⋢":"\u22E2","⊐̸":"\u2290\u0338","⋣":"\u22E3","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⋡":"\u22E1","≿̸":"\u227F\u0338","⊃⃒":"\u2283\u20D2","⊉":"\u2289","≁":"\u2241","≄":"\u2244","≇":"\u2247","≉":"\u2249","∤":"\u2224","𝒩":"\u{1D4A9}","Ñ":"\xD1","Ñ":"\xD1","Ν":"\u039D","Œ":"\u0152","Ó":"\xD3","Ó":"\xD3","Ô":"\xD4","Ô":"\xD4","О":"\u041E","Ő":"\u0150","𝔒":"\u{1D512}","Ò":"\xD2","Ò":"\xD2","Ō":"\u014C","Ω":"\u03A9","Ο":"\u039F","𝕆":"\u{1D546}","“":"\u201C","‘":"\u2018","⩔":"\u2A54","𝒪":"\u{1D4AA}","Ø":"\xD8","Ø":"\xD8","Õ":"\xD5","Õ":"\xD5","⨷":"\u2A37","Ö":"\xD6","Ö":"\xD6","‾":"\u203E","⏞":"\u23DE","⎴":"\u23B4","⏜":"\u23DC","∂":"\u2202","П":"\u041F","𝔓":"\u{1D513}","Φ":"\u03A6","Π":"\u03A0","±":"\xB1","ℌ":"\u210C","ℙ":"\u2119","⪻":"\u2ABB","≺":"\u227A","⪯":"\u2AAF","≼":"\u227C","≾":"\u227E","″":"\u2033","∏":"\u220F","∷":"\u2237","∝":"\u221D","𝒫":"\u{1D4AB}","Ψ":"\u03A8",""":'"',""":'"',"𝔔":"\u{1D514}","ℚ":"\u211A","𝒬":"\u{1D4AC}","⤐":"\u2910","®":"\xAE","®":"\xAE","Ŕ":"\u0154","⟫":"\u27EB","↠":"\u21A0","⤖":"\u2916","Ř":"\u0158","Ŗ":"\u0156","Р":"\u0420","ℜ":"\u211C","∋":"\u220B","⇋":"\u21CB","⥯":"\u296F","ℜ":"\u211C","Ρ":"\u03A1","⟩":"\u27E9","→":"\u2192","⇥":"\u21E5","⇄":"\u21C4","⌉":"\u2309","⟧":"\u27E7","⥝":"\u295D","⇂":"\u21C2","⥕":"\u2955","⌋":"\u230B","⊢":"\u22A2","↦":"\u21A6","⥛":"\u295B","⊳":"\u22B3","⧐":"\u29D0","⊵":"\u22B5","⥏":"\u294F","⥜":"\u295C","↾":"\u21BE","⥔":"\u2954","⇀":"\u21C0","⥓":"\u2953","⇒":"\u21D2","ℝ":"\u211D","⥰":"\u2970","⇛":"\u21DB","ℛ":"\u211B","↱":"\u21B1","⧴":"\u29F4","Щ":"\u0429","Ш":"\u0428","Ь":"\u042C","Ś":"\u015A","⪼":"\u2ABC","Š":"\u0160","Ş":"\u015E","Ŝ":"\u015C","С":"\u0421","𝔖":"\u{1D516}","↓":"\u2193","←":"\u2190","→":"\u2192","↑":"\u2191","Σ":"\u03A3","∘":"\u2218","𝕊":"\u{1D54A}","√":"\u221A","□":"\u25A1","⊓":"\u2293","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊔":"\u2294","𝒮":"\u{1D4AE}","⋆":"\u22C6","⋐":"\u22D0","⋐":"\u22D0","⊆":"\u2286","≻":"\u227B","⪰":"\u2AB0","≽":"\u227D","≿":"\u227F","∋":"\u220B","∑":"\u2211","⋑":"\u22D1","⊃":"\u2283","⊇":"\u2287","⋑":"\u22D1","Þ":"\xDE","Þ":"\xDE","™":"\u2122","Ћ":"\u040B","Ц":"\u0426","	":" ","Τ":"\u03A4","Ť":"\u0164","Ţ":"\u0162","Т":"\u0422","𝔗":"\u{1D517}","∴":"\u2234","Θ":"\u0398","  ":"\u205F\u200A"," ":"\u2009","∼":"\u223C","≃":"\u2243","≅":"\u2245","≈":"\u2248","𝕋":"\u{1D54B}","⃛":"\u20DB","𝒯":"\u{1D4AF}","Ŧ":"\u0166","Ú":"\xDA","Ú":"\xDA","↟":"\u219F","⥉":"\u2949","Ў":"\u040E","Ŭ":"\u016C","Û":"\xDB","Û":"\xDB","У":"\u0423","Ű":"\u0170","𝔘":"\u{1D518}","Ù":"\xD9","Ù":"\xD9","Ū":"\u016A","_":"_","⏟":"\u23DF","⎵":"\u23B5","⏝":"\u23DD","⋃":"\u22C3","⊎":"\u228E","Ų":"\u0172","𝕌":"\u{1D54C}","↑":"\u2191","⤒":"\u2912","⇅":"\u21C5","↕":"\u2195","⥮":"\u296E","⊥":"\u22A5","↥":"\u21A5","⇑":"\u21D1","⇕":"\u21D5","↖":"\u2196","↗":"\u2197","ϒ":"\u03D2","Υ":"\u03A5","Ů":"\u016E","𝒰":"\u{1D4B0}","Ũ":"\u0168","Ü":"\xDC","Ü":"\xDC","⊫":"\u22AB","⫫":"\u2AEB","В":"\u0412","⊩":"\u22A9","⫦":"\u2AE6","⋁":"\u22C1","‖":"\u2016","‖":"\u2016","∣":"\u2223","|":"|","❘":"\u2758","≀":"\u2240"," ":"\u200A","𝔙":"\u{1D519}","𝕍":"\u{1D54D}","𝒱":"\u{1D4B1}","⊪":"\u22AA","Ŵ":"\u0174","⋀":"\u22C0","𝔚":"\u{1D51A}","𝕎":"\u{1D54E}","𝒲":"\u{1D4B2}","𝔛":"\u{1D51B}","Ξ":"\u039E","𝕏":"\u{1D54F}","𝒳":"\u{1D4B3}","Я":"\u042F","Ї":"\u0407","Ю":"\u042E","Ý":"\xDD","Ý":"\xDD","Ŷ":"\u0176","Ы":"\u042B","𝔜":"\u{1D51C}","𝕐":"\u{1D550}","𝒴":"\u{1D4B4}","Ÿ":"\u0178","Ж":"\u0416","Ź":"\u0179","Ž":"\u017D","З":"\u0417","Ż":"\u017B","​":"\u200B","Ζ":"\u0396","ℨ":"\u2128","ℤ":"\u2124","𝒵":"\u{1D4B5}","á":"\xE1","á":"\xE1","ă":"\u0103","∾":"\u223E","∾̳":"\u223E\u0333","∿":"\u223F","â":"\xE2","â":"\xE2","´":"\xB4","´":"\xB4","а":"\u0430","æ":"\xE6","æ":"\xE6","⁡":"\u2061","𝔞":"\u{1D51E}","à":"\xE0","à":"\xE0","ℵ":"\u2135","ℵ":"\u2135","α":"\u03B1","ā":"\u0101","⨿":"\u2A3F","&":"&","&":"&","∧":"\u2227","⩕":"\u2A55","⩜":"\u2A5C","⩘":"\u2A58","⩚":"\u2A5A","∠":"\u2220","⦤":"\u29A4","∠":"\u2220","∡":"\u2221","⦨":"\u29A8","⦩":"\u29A9","⦪":"\u29AA","⦫":"\u29AB","⦬":"\u29AC","⦭":"\u29AD","⦮":"\u29AE","⦯":"\u29AF","∟":"\u221F","⊾":"\u22BE","⦝":"\u299D","∢":"\u2222","Å":"\xC5","⍼":"\u237C","ą":"\u0105","𝕒":"\u{1D552}","≈":"\u2248","⩰":"\u2A70","⩯":"\u2A6F","≊":"\u224A","≋":"\u224B","'":"'","≈":"\u2248","≊":"\u224A","å":"\xE5","å":"\xE5","𝒶":"\u{1D4B6}","*":"*","≈":"\u2248","≍":"\u224D","ã":"\xE3","ã":"\xE3","ä":"\xE4","ä":"\xE4","∳":"\u2233","⨑":"\u2A11","⫭":"\u2AED","≌":"\u224C","϶":"\u03F6","‵":"\u2035","∽":"\u223D","⋍":"\u22CD","⊽":"\u22BD","⌅":"\u2305","⌅":"\u2305","⎵":"\u23B5","⎶":"\u23B6","≌":"\u224C","б":"\u0431","„":"\u201E","∵":"\u2235","∵":"\u2235","⦰":"\u29B0","϶":"\u03F6","ℬ":"\u212C","β":"\u03B2","ℶ":"\u2136","≬":"\u226C","𝔟":"\u{1D51F}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","⨀":"\u2A00","⨁":"\u2A01","⨂":"\u2A02","⨆":"\u2A06","★":"\u2605","▽":"\u25BD","△":"\u25B3","⨄":"\u2A04","⋁":"\u22C1","⋀":"\u22C0","⤍":"\u290D","⧫":"\u29EB","▪":"\u25AA","▴":"\u25B4","▾":"\u25BE","◂":"\u25C2","▸":"\u25B8","␣":"\u2423","▒":"\u2592","░":"\u2591","▓":"\u2593","█":"\u2588","=⃥":"=\u20E5","≡⃥":"\u2261\u20E5","⌐":"\u2310","𝕓":"\u{1D553}","⊥":"\u22A5","⊥":"\u22A5","⋈":"\u22C8","╗":"\u2557","╔":"\u2554","╖":"\u2556","╓":"\u2553","═":"\u2550","╦":"\u2566","╩":"\u2569","╤":"\u2564","╧":"\u2567","╝":"\u255D","╚":"\u255A","╜":"\u255C","╙":"\u2559","║":"\u2551","╬":"\u256C","╣":"\u2563","╠":"\u2560","╫":"\u256B","╢":"\u2562","╟":"\u255F","⧉":"\u29C9","╕":"\u2555","╒":"\u2552","┐":"\u2510","┌":"\u250C","─":"\u2500","╥":"\u2565","╨":"\u2568","┬":"\u252C","┴":"\u2534","⊟":"\u229F","⊞":"\u229E","⊠":"\u22A0","╛":"\u255B","╘":"\u2558","┘":"\u2518","└":"\u2514","│":"\u2502","╪":"\u256A","╡":"\u2561","╞":"\u255E","┼":"\u253C","┤":"\u2524","├":"\u251C","‵":"\u2035","˘":"\u02D8","¦":"\xA6","¦":"\xA6","𝒷":"\u{1D4B7}","⁏":"\u204F","∽":"\u223D","⋍":"\u22CD","\":"\\","⧅":"\u29C5","⟈":"\u27C8","•":"\u2022","•":"\u2022","≎":"\u224E","⪮":"\u2AAE","≏":"\u224F","≏":"\u224F","ć":"\u0107","∩":"\u2229","⩄":"\u2A44","⩉":"\u2A49","⩋":"\u2A4B","⩇":"\u2A47","⩀":"\u2A40","∩︀":"\u2229\uFE00","⁁":"\u2041","ˇ":"\u02C7","⩍":"\u2A4D","č":"\u010D","ç":"\xE7","ç":"\xE7","ĉ":"\u0109","⩌":"\u2A4C","⩐":"\u2A50","ċ":"\u010B","¸":"\xB8","¸":"\xB8","⦲":"\u29B2","¢":"\xA2","¢":"\xA2","·":"\xB7","𝔠":"\u{1D520}","ч":"\u0447","✓":"\u2713","✓":"\u2713","χ":"\u03C7","○":"\u25CB","⧃":"\u29C3","ˆ":"\u02C6","≗":"\u2257","↺":"\u21BA","↻":"\u21BB","®":"\xAE","Ⓢ":"\u24C8","⊛":"\u229B","⊚":"\u229A","⊝":"\u229D","≗":"\u2257","⨐":"\u2A10","⫯":"\u2AEF","⧂":"\u29C2","♣":"\u2663","♣":"\u2663",":":":","≔":"\u2254","≔":"\u2254",",":",","@":"@","∁":"\u2201","∘":"\u2218","∁":"\u2201","ℂ":"\u2102","≅":"\u2245","⩭":"\u2A6D","∮":"\u222E","𝕔":"\u{1D554}","∐":"\u2210","©":"\xA9","©":"\xA9","℗":"\u2117","↵":"\u21B5","✗":"\u2717","𝒸":"\u{1D4B8}","⫏":"\u2ACF","⫑":"\u2AD1","⫐":"\u2AD0","⫒":"\u2AD2","⋯":"\u22EF","⤸":"\u2938","⤵":"\u2935","⋞":"\u22DE","⋟":"\u22DF","↶":"\u21B6","⤽":"\u293D","∪":"\u222A","⩈":"\u2A48","⩆":"\u2A46","⩊":"\u2A4A","⊍":"\u228D","⩅":"\u2A45","∪︀":"\u222A\uFE00","↷":"\u21B7","⤼":"\u293C","⋞":"\u22DE","⋟":"\u22DF","⋎":"\u22CE","⋏":"\u22CF","¤":"\xA4","¤":"\xA4","↶":"\u21B6","↷":"\u21B7","⋎":"\u22CE","⋏":"\u22CF","∲":"\u2232","∱":"\u2231","⌭":"\u232D","⇓":"\u21D3","⥥":"\u2965","†":"\u2020","ℸ":"\u2138","↓":"\u2193","‐":"\u2010","⊣":"\u22A3","⤏":"\u290F","˝":"\u02DD","ď":"\u010F","д":"\u0434","ⅆ":"\u2146","‡":"\u2021","⇊":"\u21CA","⩷":"\u2A77","°":"\xB0","°":"\xB0","δ":"\u03B4","⦱":"\u29B1","⥿":"\u297F","𝔡":"\u{1D521}","⇃":"\u21C3","⇂":"\u21C2","⋄":"\u22C4","⋄":"\u22C4","♦":"\u2666","♦":"\u2666","¨":"\xA8","ϝ":"\u03DD","⋲":"\u22F2","÷":"\xF7","÷":"\xF7","÷":"\xF7","⋇":"\u22C7","⋇":"\u22C7","ђ":"\u0452","⌞":"\u231E","⌍":"\u230D","$":"$","𝕕":"\u{1D555}","˙":"\u02D9","≐":"\u2250","≑":"\u2251","∸":"\u2238","∔":"\u2214","⊡":"\u22A1","⌆":"\u2306","↓":"\u2193","⇊":"\u21CA","⇃":"\u21C3","⇂":"\u21C2","⤐":"\u2910","⌟":"\u231F","⌌":"\u230C","𝒹":"\u{1D4B9}","ѕ":"\u0455","⧶":"\u29F6","đ":"\u0111","⋱":"\u22F1","▿":"\u25BF","▾":"\u25BE","⇵":"\u21F5","⥯":"\u296F","⦦":"\u29A6","џ":"\u045F","⟿":"\u27FF","⩷":"\u2A77","≑":"\u2251","é":"\xE9","é":"\xE9","⩮":"\u2A6E","ě":"\u011B","≖":"\u2256","ê":"\xEA","ê":"\xEA","≕":"\u2255","э":"\u044D","ė":"\u0117","ⅇ":"\u2147","≒":"\u2252","𝔢":"\u{1D522}","⪚":"\u2A9A","è":"\xE8","è":"\xE8","⪖":"\u2A96","⪘":"\u2A98","⪙":"\u2A99","⏧":"\u23E7","ℓ":"\u2113","⪕":"\u2A95","⪗":"\u2A97","ē":"\u0113","∅":"\u2205","∅":"\u2205","∅":"\u2205"," ":"\u2004"," ":"\u2005"," ":"\u2003","ŋ":"\u014B"," ":"\u2002","ę":"\u0119","𝕖":"\u{1D556}","⋕":"\u22D5","⧣":"\u29E3","⩱":"\u2A71","ε":"\u03B5","ε":"\u03B5","ϵ":"\u03F5","≖":"\u2256","≕":"\u2255","≂":"\u2242","⪖":"\u2A96","⪕":"\u2A95","=":"=","≟":"\u225F","≡":"\u2261","⩸":"\u2A78","⧥":"\u29E5","≓":"\u2253","⥱":"\u2971","ℯ":"\u212F","≐":"\u2250","≂":"\u2242","η":"\u03B7","ð":"\xF0","ð":"\xF0","ë":"\xEB","ë":"\xEB","€":"\u20AC","!":"!","∃":"\u2203","ℰ":"\u2130","ⅇ":"\u2147","≒":"\u2252","ф":"\u0444","♀":"\u2640","ffi":"\uFB03","ff":"\uFB00","ffl":"\uFB04","𝔣":"\u{1D523}","fi":"\uFB01","fj":"fj","♭":"\u266D","fl":"\uFB02","▱":"\u25B1","ƒ":"\u0192","𝕗":"\u{1D557}","∀":"\u2200","⋔":"\u22D4","⫙":"\u2AD9","⨍":"\u2A0D","½":"\xBD","½":"\xBD","⅓":"\u2153","¼":"\xBC","¼":"\xBC","⅕":"\u2155","⅙":"\u2159","⅛":"\u215B","⅔":"\u2154","⅖":"\u2156","¾":"\xBE","¾":"\xBE","⅗":"\u2157","⅜":"\u215C","⅘":"\u2158","⅚":"\u215A","⅝":"\u215D","⅞":"\u215E","⁄":"\u2044","⌢":"\u2322","𝒻":"\u{1D4BB}","≧":"\u2267","⪌":"\u2A8C","ǵ":"\u01F5","γ":"\u03B3","ϝ":"\u03DD","⪆":"\u2A86","ğ":"\u011F","ĝ":"\u011D","г":"\u0433","ġ":"\u0121","≥":"\u2265","⋛":"\u22DB","≥":"\u2265","≧":"\u2267","⩾":"\u2A7E","⩾":"\u2A7E","⪩":"\u2AA9","⪀":"\u2A80","⪂":"\u2A82","⪄":"\u2A84","⋛︀":"\u22DB\uFE00","⪔":"\u2A94","𝔤":"\u{1D524}","≫":"\u226B","⋙":"\u22D9","ℷ":"\u2137","ѓ":"\u0453","≷":"\u2277","⪒":"\u2A92","⪥":"\u2AA5","⪤":"\u2AA4","≩":"\u2269","⪊":"\u2A8A","⪊":"\u2A8A","⪈":"\u2A88","⪈":"\u2A88","≩":"\u2269","⋧":"\u22E7","𝕘":"\u{1D558}","`":"`","ℊ":"\u210A","≳":"\u2273","⪎":"\u2A8E","⪐":"\u2A90",">":">",">":">","⪧":"\u2AA7","⩺":"\u2A7A","⋗":"\u22D7","⦕":"\u2995","⩼":"\u2A7C","⪆":"\u2A86","⥸":"\u2978","⋗":"\u22D7","⋛":"\u22DB","⪌":"\u2A8C","≷":"\u2277","≳":"\u2273","≩︀":"\u2269\uFE00","≩︀":"\u2269\uFE00","⇔":"\u21D4"," ":"\u200A","½":"\xBD","ℋ":"\u210B","ъ":"\u044A","↔":"\u2194","⥈":"\u2948","↭":"\u21AD","ℏ":"\u210F","ĥ":"\u0125","♥":"\u2665","♥":"\u2665","…":"\u2026","⊹":"\u22B9","𝔥":"\u{1D525}","⤥":"\u2925","⤦":"\u2926","⇿":"\u21FF","∻":"\u223B","↩":"\u21A9","↪":"\u21AA","𝕙":"\u{1D559}","―":"\u2015","𝒽":"\u{1D4BD}","ℏ":"\u210F","ħ":"\u0127","⁃":"\u2043","‐":"\u2010","í":"\xED","í":"\xED","⁣":"\u2063","î":"\xEE","î":"\xEE","и":"\u0438","е":"\u0435","¡":"\xA1","¡":"\xA1","⇔":"\u21D4","𝔦":"\u{1D526}","ì":"\xEC","ì":"\xEC","ⅈ":"\u2148","⨌":"\u2A0C","∭":"\u222D","⧜":"\u29DC","℩":"\u2129","ij":"\u0133","ī":"\u012B","ℑ":"\u2111","ℐ":"\u2110","ℑ":"\u2111","ı":"\u0131","⊷":"\u22B7","Ƶ":"\u01B5","∈":"\u2208","℅":"\u2105","∞":"\u221E","⧝":"\u29DD","ı":"\u0131","∫":"\u222B","⊺":"\u22BA","ℤ":"\u2124","⊺":"\u22BA","⨗":"\u2A17","⨼":"\u2A3C","ё":"\u0451","į":"\u012F","𝕚":"\u{1D55A}","ι":"\u03B9","⨼":"\u2A3C","¿":"\xBF","¿":"\xBF","𝒾":"\u{1D4BE}","∈":"\u2208","⋹":"\u22F9","⋵":"\u22F5","⋴":"\u22F4","⋳":"\u22F3","∈":"\u2208","⁢":"\u2062","ĩ":"\u0129","і":"\u0456","ï":"\xEF","ï":"\xEF","ĵ":"\u0135","й":"\u0439","𝔧":"\u{1D527}","ȷ":"\u0237","𝕛":"\u{1D55B}","𝒿":"\u{1D4BF}","ј":"\u0458","є":"\u0454","κ":"\u03BA","ϰ":"\u03F0","ķ":"\u0137","к":"\u043A","𝔨":"\u{1D528}","ĸ":"\u0138","х":"\u0445","ќ":"\u045C","𝕜":"\u{1D55C}","𝓀":"\u{1D4C0}","⇚":"\u21DA","⇐":"\u21D0","⤛":"\u291B","⤎":"\u290E","≦":"\u2266","⪋":"\u2A8B","⥢":"\u2962","ĺ":"\u013A","⦴":"\u29B4","ℒ":"\u2112","λ":"\u03BB","⟨":"\u27E8","⦑":"\u2991","⟨":"\u27E8","⪅":"\u2A85","«":"\xAB","«":"\xAB","←":"\u2190","⇤":"\u21E4","⤟":"\u291F","⤝":"\u291D","↩":"\u21A9","↫":"\u21AB","⤹":"\u2939","⥳":"\u2973","↢":"\u21A2","⪫":"\u2AAB","⤙":"\u2919","⪭":"\u2AAD","⪭︀":"\u2AAD\uFE00","⤌":"\u290C","❲":"\u2772","{":"{","[":"[","⦋":"\u298B","⦏":"\u298F","⦍":"\u298D","ľ":"\u013E","ļ":"\u013C","⌈":"\u2308","{":"{","л":"\u043B","⤶":"\u2936","“":"\u201C","„":"\u201E","⥧":"\u2967","⥋":"\u294B","↲":"\u21B2","≤":"\u2264","←":"\u2190","↢":"\u21A2","↽":"\u21BD","↼":"\u21BC","⇇":"\u21C7","↔":"\u2194","⇆":"\u21C6","⇋":"\u21CB","↭":"\u21AD","⋋":"\u22CB","⋚":"\u22DA","≤":"\u2264","≦":"\u2266","⩽":"\u2A7D","⩽":"\u2A7D","⪨":"\u2AA8","⩿":"\u2A7F","⪁":"\u2A81","⪃":"\u2A83","⋚︀":"\u22DA\uFE00","⪓":"\u2A93","⪅":"\u2A85","⋖":"\u22D6","⋚":"\u22DA","⪋":"\u2A8B","≶":"\u2276","≲":"\u2272","⥼":"\u297C","⌊":"\u230A","𝔩":"\u{1D529}","≶":"\u2276","⪑":"\u2A91","↽":"\u21BD","↼":"\u21BC","⥪":"\u296A","▄":"\u2584","љ":"\u0459","≪":"\u226A","⇇":"\u21C7","⌞":"\u231E","⥫":"\u296B","◺":"\u25FA","ŀ":"\u0140","⎰":"\u23B0","⎰":"\u23B0","≨":"\u2268","⪉":"\u2A89","⪉":"\u2A89","⪇":"\u2A87","⪇":"\u2A87","≨":"\u2268","⋦":"\u22E6","⟬":"\u27EC","⇽":"\u21FD","⟦":"\u27E6","⟵":"\u27F5","⟷":"\u27F7","⟼":"\u27FC","⟶":"\u27F6","↫":"\u21AB","↬":"\u21AC","⦅":"\u2985","𝕝":"\u{1D55D}","⨭":"\u2A2D","⨴":"\u2A34","∗":"\u2217","_":"_","◊":"\u25CA","◊":"\u25CA","⧫":"\u29EB","(":"(","⦓":"\u2993","⇆":"\u21C6","⌟":"\u231F","⇋":"\u21CB","⥭":"\u296D","‎":"\u200E","⊿":"\u22BF","‹":"\u2039","𝓁":"\u{1D4C1}","↰":"\u21B0","≲":"\u2272","⪍":"\u2A8D","⪏":"\u2A8F","[":"[","‘":"\u2018","‚":"\u201A","ł":"\u0142","<":"<","<":"<","⪦":"\u2AA6","⩹":"\u2A79","⋖":"\u22D6","⋋":"\u22CB","⋉":"\u22C9","⥶":"\u2976","⩻":"\u2A7B","⦖":"\u2996","◃":"\u25C3","⊴":"\u22B4","◂":"\u25C2","⥊":"\u294A","⥦":"\u2966","≨︀":"\u2268\uFE00","≨︀":"\u2268\uFE00","∺":"\u223A","¯":"\xAF","¯":"\xAF","♂":"\u2642","✠":"\u2720","✠":"\u2720","↦":"\u21A6","↦":"\u21A6","↧":"\u21A7","↤":"\u21A4","↥":"\u21A5","▮":"\u25AE","⨩":"\u2A29","м":"\u043C","—":"\u2014","∡":"\u2221","𝔪":"\u{1D52A}","℧":"\u2127","µ":"\xB5","µ":"\xB5","∣":"\u2223","*":"*","⫰":"\u2AF0","·":"\xB7","·":"\xB7","−":"\u2212","⊟":"\u229F","∸":"\u2238","⨪":"\u2A2A","⫛":"\u2ADB","…":"\u2026","∓":"\u2213","⊧":"\u22A7","𝕞":"\u{1D55E}","∓":"\u2213","𝓂":"\u{1D4C2}","∾":"\u223E","μ":"\u03BC","⊸":"\u22B8","⊸":"\u22B8","⋙̸":"\u22D9\u0338","≫⃒":"\u226B\u20D2","≫̸":"\u226B\u0338","⇍":"\u21CD","⇎":"\u21CE","⋘̸":"\u22D8\u0338","≪⃒":"\u226A\u20D2","≪̸":"\u226A\u0338","⇏":"\u21CF","⊯":"\u22AF","⊮":"\u22AE","∇":"\u2207","ń":"\u0144","∠⃒":"\u2220\u20D2","≉":"\u2249","⩰̸":"\u2A70\u0338","≋̸":"\u224B\u0338","ʼn":"\u0149","≉":"\u2249","♮":"\u266E","♮":"\u266E","ℕ":"\u2115"," ":"\xA0"," ":"\xA0","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⩃":"\u2A43","ň":"\u0148","ņ":"\u0146","≇":"\u2247","⩭̸":"\u2A6D\u0338","⩂":"\u2A42","н":"\u043D","–":"\u2013","≠":"\u2260","⇗":"\u21D7","⤤":"\u2924","↗":"\u2197","↗":"\u2197","≐̸":"\u2250\u0338","≢":"\u2262","⤨":"\u2928","≂̸":"\u2242\u0338","∄":"\u2204","∄":"\u2204","𝔫":"\u{1D52B}","≧̸":"\u2267\u0338","≱":"\u2271","≱":"\u2271","≧̸":"\u2267\u0338","⩾̸":"\u2A7E\u0338","⩾̸":"\u2A7E\u0338","≵":"\u2275","≯":"\u226F","≯":"\u226F","⇎":"\u21CE","↮":"\u21AE","⫲":"\u2AF2","∋":"\u220B","⋼":"\u22FC","⋺":"\u22FA","∋":"\u220B","њ":"\u045A","⇍":"\u21CD","≦̸":"\u2266\u0338","↚":"\u219A","‥":"\u2025","≰":"\u2270","↚":"\u219A","↮":"\u21AE","≰":"\u2270","≦̸":"\u2266\u0338","⩽̸":"\u2A7D\u0338","⩽̸":"\u2A7D\u0338","≮":"\u226E","≴":"\u2274","≮":"\u226E","⋪":"\u22EA","⋬":"\u22EC","∤":"\u2224","𝕟":"\u{1D55F}","¬":"\xAC","¬":"\xAC","∉":"\u2209","⋹̸":"\u22F9\u0338","⋵̸":"\u22F5\u0338","∉":"\u2209","⋷":"\u22F7","⋶":"\u22F6","∌":"\u220C","∌":"\u220C","⋾":"\u22FE","⋽":"\u22FD","∦":"\u2226","∦":"\u2226","⫽⃥":"\u2AFD\u20E5","∂̸":"\u2202\u0338","⨔":"\u2A14","⊀":"\u2280","⋠":"\u22E0","⪯̸":"\u2AAF\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⇏":"\u21CF","↛":"\u219B","⤳̸":"\u2933\u0338","↝̸":"\u219D\u0338","↛":"\u219B","⋫":"\u22EB","⋭":"\u22ED","⊁":"\u2281","⋡":"\u22E1","⪰̸":"\u2AB0\u0338","𝓃":"\u{1D4C3}","∤":"\u2224","∦":"\u2226","≁":"\u2241","≄":"\u2244","≄":"\u2244","∤":"\u2224","∦":"\u2226","⋢":"\u22E2","⋣":"\u22E3","⊄":"\u2284","⫅̸":"\u2AC5\u0338","⊈":"\u2288","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⫅̸":"\u2AC5\u0338","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⊅":"\u2285","⫆̸":"\u2AC6\u0338","⊉":"\u2289","⊃⃒":"\u2283\u20D2","⊉":"\u2289","⫆̸":"\u2AC6\u0338","≹":"\u2279","ñ":"\xF1","ñ":"\xF1","≸":"\u2278","⋪":"\u22EA","⋬":"\u22EC","⋫":"\u22EB","⋭":"\u22ED","ν":"\u03BD","#":"#","№":"\u2116"," ":"\u2007","⊭":"\u22AD","⤄":"\u2904","≍⃒":"\u224D\u20D2","⊬":"\u22AC","≥⃒":"\u2265\u20D2",">⃒":">\u20D2","⧞":"\u29DE","⤂":"\u2902","≤⃒":"\u2264\u20D2","<⃒":"<\u20D2","⊴⃒":"\u22B4\u20D2","⤃":"\u2903","⊵⃒":"\u22B5\u20D2","∼⃒":"\u223C\u20D2","⇖":"\u21D6","⤣":"\u2923","↖":"\u2196","↖":"\u2196","⤧":"\u2927","Ⓢ":"\u24C8","ó":"\xF3","ó":"\xF3","⊛":"\u229B","⊚":"\u229A","ô":"\xF4","ô":"\xF4","о":"\u043E","⊝":"\u229D","ő":"\u0151","⨸":"\u2A38","⊙":"\u2299","⦼":"\u29BC","œ":"\u0153","⦿":"\u29BF","𝔬":"\u{1D52C}","˛":"\u02DB","ò":"\xF2","ò":"\xF2","⧁":"\u29C1","⦵":"\u29B5","Ω":"\u03A9","∮":"\u222E","↺":"\u21BA","⦾":"\u29BE","⦻":"\u29BB","‾":"\u203E","⧀":"\u29C0","ō":"\u014D","ω":"\u03C9","ο":"\u03BF","⦶":"\u29B6","⊖":"\u2296","𝕠":"\u{1D560}","⦷":"\u29B7","⦹":"\u29B9","⊕":"\u2295","∨":"\u2228","↻":"\u21BB","⩝":"\u2A5D","ℴ":"\u2134","ℴ":"\u2134","ª":"\xAA","ª":"\xAA","º":"\xBA","º":"\xBA","⊶":"\u22B6","⩖":"\u2A56","⩗":"\u2A57","⩛":"\u2A5B","ℴ":"\u2134","ø":"\xF8","ø":"\xF8","⊘":"\u2298","õ":"\xF5","õ":"\xF5","⊗":"\u2297","⨶":"\u2A36","ö":"\xF6","ö":"\xF6","⌽":"\u233D","∥":"\u2225","¶":"\xB6","¶":"\xB6","∥":"\u2225","⫳":"\u2AF3","⫽":"\u2AFD","∂":"\u2202","п":"\u043F","%":"%",".":".","‰":"\u2030","⊥":"\u22A5","‱":"\u2031","𝔭":"\u{1D52D}","φ":"\u03C6","ϕ":"\u03D5","ℳ":"\u2133","☎":"\u260E","π":"\u03C0","⋔":"\u22D4","ϖ":"\u03D6","ℏ":"\u210F","ℎ":"\u210E","ℏ":"\u210F","+":"+","⨣":"\u2A23","⊞":"\u229E","⨢":"\u2A22","∔":"\u2214","⨥":"\u2A25","⩲":"\u2A72","±":"\xB1","±":"\xB1","⨦":"\u2A26","⨧":"\u2A27","±":"\xB1","⨕":"\u2A15","𝕡":"\u{1D561}","£":"\xA3","£":"\xA3","≺":"\u227A","⪳":"\u2AB3","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","≺":"\u227A","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","⪹":"\u2AB9","⪵":"\u2AB5","⋨":"\u22E8","≾":"\u227E","′":"\u2032","ℙ":"\u2119","⪵":"\u2AB5","⪹":"\u2AB9","⋨":"\u22E8","∏":"\u220F","⌮":"\u232E","⌒":"\u2312","⌓":"\u2313","∝":"\u221D","∝":"\u221D","≾":"\u227E","⊰":"\u22B0","𝓅":"\u{1D4C5}","ψ":"\u03C8"," ":"\u2008","𝔮":"\u{1D52E}","⨌":"\u2A0C","𝕢":"\u{1D562}","⁗":"\u2057","𝓆":"\u{1D4C6}","ℍ":"\u210D","⨖":"\u2A16","?":"?","≟":"\u225F",""":'"',""":'"',"⇛":"\u21DB","⇒":"\u21D2","⤜":"\u291C","⤏":"\u290F","⥤":"\u2964","∽̱":"\u223D\u0331","ŕ":"\u0155","√":"\u221A","⦳":"\u29B3","⟩":"\u27E9","⦒":"\u2992","⦥":"\u29A5","⟩":"\u27E9","»":"\xBB","»":"\xBB","→":"\u2192","⥵":"\u2975","⇥":"\u21E5","⤠":"\u2920","⤳":"\u2933","⤞":"\u291E","↪":"\u21AA","↬":"\u21AC","⥅":"\u2945","⥴":"\u2974","↣":"\u21A3","↝":"\u219D","⤚":"\u291A","∶":"\u2236","ℚ":"\u211A","⤍":"\u290D","❳":"\u2773","}":"}","]":"]","⦌":"\u298C","⦎":"\u298E","⦐":"\u2990","ř":"\u0159","ŗ":"\u0157","⌉":"\u2309","}":"}","р":"\u0440","⤷":"\u2937","⥩":"\u2969","”":"\u201D","”":"\u201D","↳":"\u21B3","ℜ":"\u211C","ℛ":"\u211B","ℜ":"\u211C","ℝ":"\u211D","▭":"\u25AD","®":"\xAE","®":"\xAE","⥽":"\u297D","⌋":"\u230B","𝔯":"\u{1D52F}","⇁":"\u21C1","⇀":"\u21C0","⥬":"\u296C","ρ":"\u03C1","ϱ":"\u03F1","→":"\u2192","↣":"\u21A3","⇁":"\u21C1","⇀":"\u21C0","⇄":"\u21C4","⇌":"\u21CC","⇉":"\u21C9","↝":"\u219D","⋌":"\u22CC","˚":"\u02DA","≓":"\u2253","⇄":"\u21C4","⇌":"\u21CC","‏":"\u200F","⎱":"\u23B1","⎱":"\u23B1","⫮":"\u2AEE","⟭":"\u27ED","⇾":"\u21FE","⟧":"\u27E7","⦆":"\u2986","𝕣":"\u{1D563}","⨮":"\u2A2E","⨵":"\u2A35",")":")","⦔":"\u2994","⨒":"\u2A12","⇉":"\u21C9","›":"\u203A","𝓇":"\u{1D4C7}","↱":"\u21B1","]":"]","’":"\u2019","’":"\u2019","⋌":"\u22CC","⋊":"\u22CA","▹":"\u25B9","⊵":"\u22B5","▸":"\u25B8","⧎":"\u29CE","⥨":"\u2968","℞":"\u211E","ś":"\u015B","‚":"\u201A","≻":"\u227B","⪴":"\u2AB4","⪸":"\u2AB8","š":"\u0161","≽":"\u227D","⪰":"\u2AB0","ş":"\u015F","ŝ":"\u015D","⪶":"\u2AB6","⪺":"\u2ABA","⋩":"\u22E9","⨓":"\u2A13","≿":"\u227F","с":"\u0441","⋅":"\u22C5","⊡":"\u22A1","⩦":"\u2A66","⇘":"\u21D8","⤥":"\u2925","↘":"\u2198","↘":"\u2198","§":"\xA7","§":"\xA7",";":";","⤩":"\u2929","∖":"\u2216","∖":"\u2216","✶":"\u2736","𝔰":"\u{1D530}","⌢":"\u2322","♯":"\u266F","щ":"\u0449","ш":"\u0448","∣":"\u2223","∥":"\u2225","­":"\xAD","­":"\xAD","σ":"\u03C3","ς":"\u03C2","ς":"\u03C2","∼":"\u223C","⩪":"\u2A6A","≃":"\u2243","≃":"\u2243","⪞":"\u2A9E","⪠":"\u2AA0","⪝":"\u2A9D","⪟":"\u2A9F","≆":"\u2246","⨤":"\u2A24","⥲":"\u2972","←":"\u2190","∖":"\u2216","⨳":"\u2A33","⧤":"\u29E4","∣":"\u2223","⌣":"\u2323","⪪":"\u2AAA","⪬":"\u2AAC","⪬︀":"\u2AAC\uFE00","ь":"\u044C","/":"/","⧄":"\u29C4","⌿":"\u233F","𝕤":"\u{1D564}","♠":"\u2660","♠":"\u2660","∥":"\u2225","⊓":"\u2293","⊓︀":"\u2293\uFE00","⊔":"\u2294","⊔︀":"\u2294\uFE00","⊏":"\u228F","⊑":"\u2291","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊐":"\u2290","⊒":"\u2292","□":"\u25A1","□":"\u25A1","▪":"\u25AA","▪":"\u25AA","→":"\u2192","𝓈":"\u{1D4C8}","∖":"\u2216","⌣":"\u2323","⋆":"\u22C6","☆":"\u2606","★":"\u2605","ϵ":"\u03F5","ϕ":"\u03D5","¯":"\xAF","⊂":"\u2282","⫅":"\u2AC5","⪽":"\u2ABD","⊆":"\u2286","⫃":"\u2AC3","⫁":"\u2AC1","⫋":"\u2ACB","⊊":"\u228A","⪿":"\u2ABF","⥹":"\u2979","⊂":"\u2282","⊆":"\u2286","⫅":"\u2AC5","⊊":"\u228A","⫋":"\u2ACB","⫇":"\u2AC7","⫕":"\u2AD5","⫓":"\u2AD3","≻":"\u227B","⪸":"\u2AB8","≽":"\u227D","⪰":"\u2AB0","⪺":"\u2ABA","⪶":"\u2AB6","⋩":"\u22E9","≿":"\u227F","∑":"\u2211","♪":"\u266A","¹":"\xB9","¹":"\xB9","²":"\xB2","²":"\xB2","³":"\xB3","³":"\xB3","⊃":"\u2283","⫆":"\u2AC6","⪾":"\u2ABE","⫘":"\u2AD8","⊇":"\u2287","⫄":"\u2AC4","⟉":"\u27C9","⫗":"\u2AD7","⥻":"\u297B","⫂":"\u2AC2","⫌":"\u2ACC","⊋":"\u228B","⫀":"\u2AC0","⊃":"\u2283","⊇":"\u2287","⫆":"\u2AC6","⊋":"\u228B","⫌":"\u2ACC","⫈":"\u2AC8","⫔":"\u2AD4","⫖":"\u2AD6","⇙":"\u21D9","⤦":"\u2926","↙":"\u2199","↙":"\u2199","⤪":"\u292A","ß":"\xDF","ß":"\xDF","⌖":"\u2316","τ":"\u03C4","⎴":"\u23B4","ť":"\u0165","ţ":"\u0163","т":"\u0442","⃛":"\u20DB","⌕":"\u2315","𝔱":"\u{1D531}","∴":"\u2234","∴":"\u2234","θ":"\u03B8","ϑ":"\u03D1","ϑ":"\u03D1","≈":"\u2248","∼":"\u223C"," ":"\u2009","≈":"\u2248","∼":"\u223C","þ":"\xFE","þ":"\xFE","˜":"\u02DC","×":"\xD7","×":"\xD7","⊠":"\u22A0","⨱":"\u2A31","⨰":"\u2A30","∭":"\u222D","⤨":"\u2928","⊤":"\u22A4","⌶":"\u2336","⫱":"\u2AF1","𝕥":"\u{1D565}","⫚":"\u2ADA","⤩":"\u2929","‴":"\u2034","™":"\u2122","▵":"\u25B5","▿":"\u25BF","◃":"\u25C3","⊴":"\u22B4","≜":"\u225C","▹":"\u25B9","⊵":"\u22B5","◬":"\u25EC","≜":"\u225C","⨺":"\u2A3A","⨹":"\u2A39","⧍":"\u29CD","⨻":"\u2A3B","⏢":"\u23E2","𝓉":"\u{1D4C9}","ц":"\u0446","ћ":"\u045B","ŧ":"\u0167","≬":"\u226C","↞":"\u219E","↠":"\u21A0","⇑":"\u21D1","⥣":"\u2963","ú":"\xFA","ú":"\xFA","↑":"\u2191","ў":"\u045E","ŭ":"\u016D","û":"\xFB","û":"\xFB","у":"\u0443","⇅":"\u21C5","ű":"\u0171","⥮":"\u296E","⥾":"\u297E","𝔲":"\u{1D532}","ù":"\xF9","ù":"\xF9","↿":"\u21BF","↾":"\u21BE","▀":"\u2580","⌜":"\u231C","⌜":"\u231C","⌏":"\u230F","◸":"\u25F8","ū":"\u016B","¨":"\xA8","¨":"\xA8","ų":"\u0173","𝕦":"\u{1D566}","↑":"\u2191","↕":"\u2195","↿":"\u21BF","↾":"\u21BE","⊎":"\u228E","υ":"\u03C5","ϒ":"\u03D2","υ":"\u03C5","⇈":"\u21C8","⌝":"\u231D","⌝":"\u231D","⌎":"\u230E","ů":"\u016F","◹":"\u25F9","𝓊":"\u{1D4CA}","⋰":"\u22F0","ũ":"\u0169","▵":"\u25B5","▴":"\u25B4","⇈":"\u21C8","ü":"\xFC","ü":"\xFC","⦧":"\u29A7","⇕":"\u21D5","⫨":"\u2AE8","⫩":"\u2AE9","⊨":"\u22A8","⦜":"\u299C","ϵ":"\u03F5","ϰ":"\u03F0","∅":"\u2205","ϕ":"\u03D5","ϖ":"\u03D6","∝":"\u221D","↕":"\u2195","ϱ":"\u03F1","ς":"\u03C2","⊊︀":"\u228A\uFE00","⫋︀":"\u2ACB\uFE00","⊋︀":"\u228B\uFE00","⫌︀":"\u2ACC\uFE00","ϑ":"\u03D1","⊲":"\u22B2","⊳":"\u22B3","в":"\u0432","⊢":"\u22A2","∨":"\u2228","⊻":"\u22BB","≚":"\u225A","⋮":"\u22EE","|":"|","|":"|","𝔳":"\u{1D533}","⊲":"\u22B2","⊂⃒":"\u2282\u20D2","⊃⃒":"\u2283\u20D2","𝕧":"\u{1D567}","∝":"\u221D","⊳":"\u22B3","𝓋":"\u{1D4CB}","⫋︀":"\u2ACB\uFE00","⊊︀":"\u228A\uFE00","⫌︀":"\u2ACC\uFE00","⊋︀":"\u228B\uFE00","⦚":"\u299A","ŵ":"\u0175","⩟":"\u2A5F","∧":"\u2227","≙":"\u2259","℘":"\u2118","𝔴":"\u{1D534}","𝕨":"\u{1D568}","℘":"\u2118","≀":"\u2240","≀":"\u2240","𝓌":"\u{1D4CC}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","▽":"\u25BD","𝔵":"\u{1D535}","⟺":"\u27FA","⟷":"\u27F7","ξ":"\u03BE","⟸":"\u27F8","⟵":"\u27F5","⟼":"\u27FC","⋻":"\u22FB","⨀":"\u2A00","𝕩":"\u{1D569}","⨁":"\u2A01","⨂":"\u2A02","⟹":"\u27F9","⟶":"\u27F6","𝓍":"\u{1D4CD}","⨆":"\u2A06","⨄":"\u2A04","△":"\u25B3","⋁":"\u22C1","⋀":"\u22C0","ý":"\xFD","ý":"\xFD","я":"\u044F","ŷ":"\u0177","ы":"\u044B","¥":"\xA5","¥":"\xA5","𝔶":"\u{1D536}","ї":"\u0457","𝕪":"\u{1D56A}","𝓎":"\u{1D4CE}","ю":"\u044E","ÿ":"\xFF","ÿ":"\xFF","ź":"\u017A","ž":"\u017E","з":"\u0437","ż":"\u017C","ℨ":"\u2128","ζ":"\u03B6","𝔷":"\u{1D537}","ж":"\u0436","⇝":"\u21DD","𝕫":"\u{1D56B}","𝓏":"\u{1D4CF}","‍":"\u200D","‌":"\u200C"};var Ri=new Map([[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function Oi(t){return t.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,r)=>{if(typeof hr[e]=="string")return hr[e];if(r.charAt(0)!=="#"||e.charAt(e.length-1)!==";")return e;let n;r.charAt(1).toLowerCase()==="x"?n=parseInt(r.slice(2),16):n=parseInt(r.slice(1),10);let s="";return n===0||n>=55296&&n<=57343||n>1114111?"\uFFFD":(n=Ri.get(n)??n,n>65535&&(n-=65536,s+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),s+=String.fromCharCode(n),s)})}var ls=t=>t.toString(16).toUpperCase().padStart(2,"0");function Ee(t){return t.trim().replace(/[<>"'?&]/g,e=>"&#x"+ls(e.charCodeAt(0))+";")}var Li=/[^A-Za-z0-9\-._~!$'()*+,;:@]+/g,qi=Array.from({length:256},(t,e)=>"%"+ls(e));function _i(t){return t.replace(Li,e=>Array.from(ne.encode(e),r=>qi[r]).join(""))}function fs(t){return"<div>"+Ee(t).replace(/\n/g,"<br />")+"</div>"}function is(t,e){let r=1/0,n=null;return s=>((s<r||n&&s>n.index)&&(e.lastIndex=s,n=e.exec(t),r=s),n)}function ds(t,e){let r=t.lastIndexOf(">")+1;return e(t.slice(0,r))+t.slice(r)}function Ye(t,e,r){return ds(t,n=>n.replace(e,r))}function us(t,e,r,n){let s=[],i=0,o=0;for(;;){e.lastIndex=o;let u=e.exec(t);if(!u)break;let a=u.index,c=t.indexOf(">",a);if(c<0)break;r.lastIndex=a;let l=r.exec(t);if(!l){o=c+1;continue}s.push(t.slice(i,a),n(...l)),i=o=a+l[0].length}return s.push(t.slice(i)),s.join("")}function pr(t,e,r,n,s,i){let o=is(t,/>/g),u=is(t,n),a=[],c=0,l=0;for(;;){e.lastIndex=l;let f=e.exec(t);if(!f)break;let h=f.index;l=h+1;let d=h+f[0].length;if(r){let A=o(d);if(!A)break;d=A.index+1}let g=u(d);if(!g)break;let m=g.index+g[0].length;if(s){let A=o(m);if(!A)break;m=A.index+1}a.push(t.slice(c,h),i),c=l=m}return a.push(t.slice(c)),a.join("")}function mr(t,e){let r=t.lastIndexOf(">"),n=-1;e.lastIndex=0;let s;for(;(s=e.exec(t))&&s.index<r;)n=s.index;return n<0?t:t.slice(t.indexOf(">",n)+1)}function as(t,e){e.lastIndex=0;let r=e.exec(t);return r&&r.index<t.lastIndexOf(">")?t.slice(0,r.index):t}function hs(t){return t=t.replace(/\r\n|[\n\r\u2028\u2029]/g,""),t=pr(t,/<!--/g,!1,/-->/g,!1," "),t=Ye(t,/<br\b[^>]*>/gi,`
|
|
7
|
+
`),t=Ye(t,/<\/?(p|div|table|tr|td|th)\b[^>]*>/gi,`
|
|
8
|
+
|
|
9
|
+
`),t=pr(t,/<script\b/gi,!0,/<\/script\b/gi,!0," "),t=pr(t,/<style\b/gi,!0,/<\/style\b/gi,!0," "),t=mr(t,/<body\b/gi),t=mr(t,/<\/head\b/gi),t=mr(t,/<!doctype\b/gi),t=as(t,/<\/body\b/gi),t=as(t,/<\/html\b/gi),t=ds(t,e=>us(e,/<a\b/gi,/<a\b[^>]*href\s*=\s*["']?([^\s"']+)[^>]*>/iy,(r,n)=>` (${n}) `)),t=Ye(t,/<\/?(span|em|i|strong|b|u|a)\b[^>]*>/gi,""),t=us(t,/<li\b/gi,/<li\b[^>]*>[\n\u0001\s]*/iy,()=>"* "),t=Ye(t,/<hr\b[^>]*>/g,`
|
|
10
|
+
-------------
|
|
11
|
+
`),t=Ye(t,/<[^>]*>/g," "),t=t.replace(/\u0001/g,`
|
|
12
|
+
`).replace(/[ \t]+/g," ").replace(/^\s+$/gm,"").replace(/\n\n+/g,`
|
|
13
|
+
|
|
14
|
+
`).replace(/^\n+/,`
|
|
15
|
+
`).replace(/\n+$/,`
|
|
16
|
+
`),t=Oi(t),t}var cs=null;function ps(t){if(typeof Intl>"u")return t;let e=new Date(t);return isNaN(e.getTime())?t:(cs??=new Intl.DateTimeFormat("default",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}),cs.format(e))}function Ni(t){return(t.name?[t.name,`<${t.address}>`]:[t.address]).join(" ")}function Ct(t){let e=[],r=(n,s)=>{if(s&&e.push(", "),n.group){let i=`${n.name}:`,o=";";e.push(i),n.group.forEach(r),e.push(o)}else e.push(Ni(n))};return t.forEach(r),e.join("")}function Ii(t){return`<a href="mailto:${Ee(_i(t.address))}" class="postal-email-address">${Ee(t.name||`<${t.address}>`)}</a>`}function vt(t){let e=[],r=(n,s)=>{if(s&&e.push('<span class="postal-email-address-separator">, </span>'),n.group){let i=`<span class="postal-email-address-group">${Ee(n.name)}:</span>`,o='<span class="postal-email-address-group">;</span>';e.push(i),n.group.forEach(r),e.push(o)}else e.push(Ii(n))};return t.forEach(r),e.join(" ")}function Ui(t,e,r){t=(t||"").toString(),e=e||76;let n=0,s=t.length,i="",o,u;for(;n<s;){if(o=t.slice(n,n+e),o.length<e){i+=o;break}if(u=o.match(/^[^\n\r]*(\r?\n|\r)/)){o=u[0],i+=o,n+=o.length;continue}else(u=o.match(/(\s+)[^\s]*$/))&&u[0].length-(r?(u[1]||"").length:0)<o.length?o=o.slice(0,o.length-(u[0].length-(r?(u[1]||"").length:0))):(u=t.slice(n+o.length).match(/^[^\s]+(\s*)/))&&(o=o+u[0].slice(0,u[0].length-(r?0:(u[1]||"").length)));i+=o,n+=o.length,n<s&&(i+=`\r
|
|
17
|
+
`)}return i}function ms(t){let e=[];t.from&&e.push({key:"From",val:Ct([t.from])}),t.subject&&e.push({key:"Subject",val:t.subject}),t.date&&e.push({key:"Date",val:ps(t.date)}),t.to&&t.to.length&&e.push({key:"To",val:Ct(t.to)}),t.cc&&t.cc.length&&e.push({key:"Cc",val:Ct(t.cc)}),t.bcc&&t.bcc.length&&e.push({key:"Bcc",val:Ct(t.bcc)});let r=e.map(u=>u.key.length).reduce((u,a)=>a>u?a:u,0),n=e.flatMap(u=>{let a=r-u.key.length,c=`${u.key}: ${" ".repeat(a)}`,l=`${" ".repeat(u.key.length+1)} ${" ".repeat(a)}`;return Ui(u.val,80,!0).split(/\r?\n/).map(h=>h.trim()).map((h,d)=>`${d?l:c}${h}`)}),s=n.map(u=>u.length).reduce((u,a)=>a>u?a:u,0),i="-".repeat(s);return`
|
|
18
|
+
${i}
|
|
19
|
+
${n.join(`
|
|
20
|
+
`)}
|
|
21
|
+
${i}
|
|
22
|
+
`}function gs(t){let e=[];return t.from&&e.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${vt([t.from])}</div>`),t.subject&&e.push(`<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${Ee(t.subject)}</div>`),t.date&&e.push(`<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${Ee(t.date)}">${Ee(ps(t.date))}</div>`),t.to&&t.to.length&&e.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${vt(t.to)}</div>`),t.cc&&t.cc.length&&e.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${vt(t.cc)}</div>`),t.bcc&&t.bcc.length&&e.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${vt(t.bcc)}</div>`),`<div class="postal-email-header">${e.length?'<div class="postal-email-header-row">':""}${e.join(`</div>
|
|
23
|
+
<div class="postal-email-header-row">`)}${e.length?"</div>":""}</div>`}var ke=1,Cs=2,Tt=4,xs=8,ys=16,gr=class{constructor(e){this.str=e,this.slots=new Int32Array(48),this.length=0,this.cleaned=new Map}push(e,r,n){if((this.length+1)*3>this.slots.length){let i=new Int32Array(this.slots.length*2);i.set(this.slots),this.slots=i}let s=this.length*3;return this.slots[s]=e,this.slots[s+1]=r,this.slots[s+2]=n,this.length++}operatorAt(e){let r=e*3;return this.slots[r]&ke?this.str.charAt(this.slots[r+1]):""}isOperator(e){return(this.slots[e*3]&ke)!==0}noBreak(e){return(this.slots[e*3]&Cs)!==0}value(e){let r=this.cleaned.get(e);return r!==void 0?r:this.str.slice(this.slots[e*3+1],this.slots[e*3+2])}},Pi=/\s/,Mi=/^("(?:[^"\\]|\\[\s\S])*"@\S+)(?:\s+([\s\S]+))?$/,Hi=/^[^@\s]+@[^@\s]+$/,$i=/^[^@\s]+@\[[^[\]\\\s]*\]$/,ji=/^@(?:[^@\s"]+|\[[^[\]\\\s]*\])$/;function vs(t){return Hi.test(t)||$i.test(t)}var zi=/^[^@\s]+@\S+$/,bs=/\s*\b[^@\s]+@[^\s]+\b\s*/y,Ki=/@(\[[^[\]\\]*\])$/;function Ts(t){let e=t.charAt(t.length-1)==="]"?Ki.exec(t):null;return e?t.length-e[1].length-1:t.lastIndexOf("@")}function As(t){let e=Ts(t);if(e<0)return t;let r=t.substring(0,e);return/^[^\s"(),:;<>@[\\\]]+$/.test(r)||/^"(?:[^"\\]|\\[\s\S])*"$/.test(r)?t:'"'+r.replace(/["\\]/g,"\\$&")+'"@'+t.substring(e+1)}function Q(t){return t===32||t>=9&&t<=13||t===160||t===5760||t>=8192&&t<=8202||t===8232||t===8233||t===8239||t===8287||t===12288||t===65279}function ws(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95}function Ds(t,e){return ws(t.charCodeAt(e-1))!==ws(t.charCodeAt(e))}function Es(t,e,r){for(let n=e;n<r;n++)if(t.charCodeAt(n)===64)return n;return-1}var Gi=/^"(?:[^"\\]|\\[\s\S])*"/;function xr(t,e){if(e<0)return t;let r=e;for(;r>0&&Q(t.charCodeAt(r-1));)r--;let n=e+1;for(;n<t.length&&Q(t.charCodeAt(n));)n++;return r===e&&n===e+1?t:t.slice(0,r)+"@"+t.slice(n)}function Ss(t){let e=Gi.exec(t);if(e){let n=e[0].length;for(;n<t.length&&Q(t.charCodeAt(n));)n++;if(t.charAt(n)==="@"&&t.indexOf("@",n+1)<0)return xr(t,n)}let r=t.indexOf("@");return r<0||t.indexOf("@",r+1)>=0||t.lastIndexOf('"')>r?t:xr(t,r)}function Vi(t){let e=t.length,r=0;for(;r<e;){for(;r<e&&Q(t.charCodeAt(r));)r++;if(r>=e)break;let n=r,s=r;for(;s<e&&!Q(t.charCodeAt(s));)s++;let i=Es(t,n,s);if(i>=0){let o=-1;for(let a=s;a>n;a--)if(Ds(t,a)){o=a;break}let u=n;for(;o>=0&&i>=0;){if(i>u&&s>i+1&&o>i+1){for(let a=u;a<i;a++)if(Ds(t,a)){if(a>n)return a;let c=n;for(;c>0&&Q(t.charCodeAt(c-1));)c--;return c}}u=i+1,i=Es(t,u,s)}}r=s}return-1}function Wi(t,e){if(t=Ss(t),!Pi.test(t))return{address:t,text:e};let r,n=t.match(Mi);if(n){if(!n[2])return{address:t,text:e};t=n[1],r=[n[2]]}else{if(t.indexOf('"')>=0)return{address:t,text:e};let s=t.split(/\s+/),i=s.findIndex(vs);if(i<0&&(i=s.findIndex(o=>zi.test(o))),i<0)return{address:t,text:e};t=s.splice(i,1)[0],r=s}return{address:t,text:[e,...r].filter(s=>s).join(" ")}}function Zi(t){let e=[],r="",n="",s=0,i="",o="",u=!1,a="",c=!1,l=-1;for(let f=0,h=t.length;f<h;f++){let d=t.charAt(f);if(s){d==="\\"&&f<h-1?n+=t.charAt(++f):d==="("?(s++,n+=d):d===")"&&!--s?(e.push(n.trim()),n="",u=o!=="@"):n+=d;continue}if(u&&d!=="("&&(u=!1,d!=="@"&&d!=="<"&&!Q(t.charCodeAt(f))&&(r+=" ",o=" ")),i){if(d==="\\"&&i==='"'&&f<h-1){r+=d+t.charAt(++f),o=t.charAt(f);continue}d===i&&(i="")}else if(d==='"')i='"',c=!0;else if(d===":"&&l<0&&a==="@"&&!c)l=r.length+1;else if(d==="[")i="]";else if(d==="("){s=1;continue}else if(d==="<"){r="",o="",e.length=0,a="",c=!1,l=-1;continue}r+=d,o=d,!a&&!Q(t.charCodeAt(f))&&(a=d)}return l>=0&&r.indexOf("@",l)>=0&&(r=r.slice(l)),s&&e.push(n.trim()),{address:r.trim(),comments:e.filter(f=>f)}}function Fs(t,e,r){let n="text",s={address:[],comment:[],text:[],textWasQuoted:[],quotedLocalAt:[]},i=!1,o,u=!1,a={address:"",comment:"",text:""};for(o=e;o<r;o++){let l=t.value(o),f=o>e?t.operatorAt(o-1):"",h=o>e&&t.noBreak(o-1);if(t.isOperator(o))switch(l){case"<":n="address",u=!1;break;case"(":n="comment",u=!1;break;case'"':u=!u,n="text";break;default:n="text",u=!1;break}else{let d=f==='"'&&h&&o>e+1&&t.operatorAt(o-2)==='"';if(h&&s[n].length&&(f!==")"||a[n]==="@"||l.charAt(0)==="@")){let m=s[n].length-1;n==="text"&&!u&&(i&&l.charAt(0)==="@"&&(s.quotedLocalAt[m]=s.text[m].length),i=!1),s[n][m]+=l,n==="text"&&u&&(s.textWasQuoted[m]=!0)}else s[n].push(l),n==="text"&&(s.textWasQuoted.push(u||d),s.quotedLocalAt.push(d&&l.charAt(0)==="@"?0:-1),i=u);a[n]=l.charAt(l.length-1)}}let c=!1;return!s.text.length&&s.comment.length&&(s.text=s.comment,s.comment=[],c=!0),{data:s,textFromComment:c}}function Yi(t,e,r){return pe(Fs(t,e,r).data.text.join(" "))}function Xi(t,e,r){let n=Fs(t,e,r),s=n.data,i=n.textFromComment,o,u=[],a=[];for(let g of s.address){let m=Zi(g);for(let A of m.comments)u.push(A);m.address&&a.push(m.address)}if(s.address=a,!s.address.length&&s.text.length&&!i){let g=s.text.map(m=>Ss(m));for(o=0;o<s.text.length;o++){let m=s.quotedLocalAt[o],A=s.textWasQuoted[o]&&m>=0&&ji.test(s.text[o].slice(m))?As(s.text[o]):"";if(A||!s.textWasQuoted[o]&&vs(g[o])){s.address=[A||g[o]],s.text.splice(o,1),s.textWasQuoted.splice(o,1),s.quotedLocalAt.splice(o,1);break}}if(!s.address.length){for(o=0;o<s.text.length;o++)if(!s.textWasQuoted[o]){let m=g[o],A=Vi(m);if(A>=0){bs.lastIndex=A;let D=bs.exec(m);if(D){s.address=[D[0].trim()],s.text[o]=(m.slice(0,A)+" "+m.slice(A+D[0].length)).trim();break}}s.text[o]=s.text[o].trim()}}}!s.text.length&&s.comment.length&&(s.text=s.comment,s.comment=[]),s.address.length>1&&(s.text=s.text.concat(s.address.splice(1)));let c=!s.address.length&&s.textWasQuoted.some(g=>g),l=s.text.join(" "),f=s.address.join(" ");if(!f&&ns(l.trim()))return{address:"",name:pe(l)};c&&l.indexOf("@")>=0&&(f=As(xr(l,Ts(l))),l=""),{address:f,text:l}=Wi(f,l),!l&&u.length&&(l=u.join(" "),i=!0);let h=l||f||"",d={address:f||(i?"":l)||"",name:pe(h)};return(d.address===h||d.address===d.name)&&(d.address.match(/@/)?d.name="":d.address=""),d}var yr=class{constructor(e){this.str=(e||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=-1,this.escaped=!1,this.inDomainLiteral=!1,this.afterAt=!1,this.inGroup=!1,this.innerQuoted=!1,this.innerComment=0,this.innerLiteral=!1,this.innerEscaped=!1,this.list=new gr(this.str),this.operators={'"':'"',"(":")","<":">",",":"",":":"",";":""}}tokenize(){let e=this.str,r=e.length;for(let o=0;o<r;o++)this.checkChar(e.charAt(o),o);this.closeText(r);let n=this.list,s=n.slots,i=0;for(let o=0,u=n.length;o<u;o++){let a=s[o*3],c=s[o*3+1],l=s[o*3+2];if(a&Tt){let f=this.cleanValue(c,l,a).trim();if(!f)continue;n.cleaned.set(i,f)}else if(!(a&ke)){for(;c<l&&Q(e.charCodeAt(c));)c++;for(;l>c&&Q(e.charCodeAt(l-1));)l--;if(c===l)continue}s[i*3]=a,s[i*3+1]=c,s[i*3+2]=l,i++}return n.length=i,n}closeText(e){this.node>=0&&(this.list.slots[this.node*3+2]=e,this.node=-1)}cleanValue(e,r,n){let s=this.str,i=(n&xs)!==0,o=(n&ys)!==0,u="";for(let a=e;a<r;a++){let c=s.charAt(a);if(i&&!o&&c==="\\"){o=!0;continue}o=!1,c===`
|
|
24
|
+
`?u+=" ":(c.charCodeAt(0)>=33||c===" "||c===" ")&&(u+=c)}return u}checkChar(e,r){!this.escaped&&!this.operatorExpecting&&(!this.inDomainLiteral&&e==="["&&this.afterAt?this.inDomainLiteral=!0:this.inDomainLiteral&&(e==="]"||e===","||e===";")&&(this.inDomainLiteral=!1));let n=!1;if(this.operatorExpecting===">"?(n=this.trackInner(e),!n&&e===";"&&this.inGroup&&(this.closeText(r),this.operatorExpecting="",this.resetInner())):this.operatorExpecting===")"&&!this.escaped&&(e==="("?this.innerComment++:e===")"&&this.innerComment&&(this.innerComment--,n=!0)),!this.escaped){if(e===this.operatorExpecting&&!n){let s=this.str.charAt(r+1);this.closeText(r),this.list.push(s&&![" "," ","\r",`
|
|
25
|
+
`,",",";"].includes(s)?ke|Cs:ke,r,r+1),e!==")"&&(this.afterAt=!1),this.operatorExpecting="",this.escaped=!1,this.resetInner();return}else if(!this.operatorExpecting&&!(this.inDomainLiteral&&e===":")&&e in this.operators){this.closeText(r),this.list.push(ke,r,r+1),e===":"?this.inGroup=!0:e===";"&&(this.inGroup=!1),e!=="("&&(this.afterAt=!1),this.operatorExpecting=this.operators[e],this.escaped=!1,this.resetInner();return}else if((this.operatorExpecting==='"'||this.operatorExpecting===")")&&e==="\\"){this.escaped=!0,this.node>=0&&(this.list.slots[this.node*3]|=Tt);return}}this.node<0&&(this.node=this.list.push((this.operatorExpecting==='"'||this.operatorExpecting===")"?xs:0)|(this.escaped?ys:0),r,r)),e===`
|
|
26
|
+
`&&(e=" ",this.list.slots[this.node*3]|=Tt),e.charCodeAt(0)>=33||e===" "||e===" "?!this.operatorExpecting&&e!==" "&&e!==" "&&(this.afterAt=e==="@"):this.list.slots[this.node*3]|=Tt,this.escaped=!1}trackInner(e){return this.innerEscaped?(this.innerEscaped=!1,!0):this.innerQuoted?(e==="\\"?this.innerEscaped=!0:e==='"'&&(this.innerQuoted=!1),!0):this.innerComment?(e==="\\"?this.innerEscaped=!0:e==="("?this.innerComment++:e===")"&&this.innerComment--,!0):this.innerLiteral?(e==="]"&&(this.innerLiteral=!1),!0):e==='"'?(this.innerQuoted=!0,!0):e==="("?(this.innerComment=1,!0):e==="["&&this.afterAt?(this.innerLiteral=!0,!0):(Q(e.charCodeAt(0))||(this.afterAt=e==="@"),!1)}resetInner(){this.innerQuoted=!1,this.innerComment=0,this.innerLiteral=!1,this.innerEscaped=!1}};function Bs(t){let e=[];for(let r=t.length-1;r>=0;r--){let n=t[r],s=e.length?e[e.length-1]:null;s&&n.address===""&&n.name&&!n.group&&s.address&&s.name?s.name=n.name+", "+s.name:e.push(n)}return e.reverse()}function Qi(t){let e=new yr(t).tokenize(),r=[],n=null,s=[],i=0;for(let o=0,u=e.length;o<=u;o++){let a=o<u?e.operatorAt(o):"";if(!(o<u&&a!==","&&a!==";"&&a!==":")){if(a===":"){n||(n={name:Yi(e,i,o),group:[]},s=[]),i=o+1;continue}o>i&&(n?s:r).push(Xi(e,i,o)),i=o+1,n&&(a===";"||o===u)&&(n.group=Bs(s),r.push(n),n=null)}}return Bs(r)}function Ji(t,e){let r=Qi(t);if(e&&e.flatten){let n=[],s=i=>{i.forEach(o=>{if(o.group)return s(o.group);n.push(o)})};return s(r),n}return r}var St=Ji;function ks(t){let e="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(t),s=n.byteLength,i=s%3,o=s-i,u,a,c,l,f;for(let h=0;h<o;h=h+3)f=n[h]<<16|n[h+1]<<8|n[h+2],u=(f&16515072)>>18,a=(f&258048)>>12,c=(f&4032)>>6,l=f&63,e+=r[u]+r[a]+r[c]+r[l];return i===1?(f=n[o],u=(f&252)>>2,a=(f&3)<<4,e+=r[u]+r[a]+"=="):i===2&&(f=n[o]<<8|n[o+1],u=(f&64512)>>10,a=(f&1008)>>4,c=(f&15)<<2,e+=r[u]+r[a]+r[c]+"="),e}var eu=/-?(?:\d{1,12}\.\d{1,3}|\d{1,15})/y,tu=/"((?:[\x20\x21\x23-\x5b\x5d-\x7e]|\\["\\])*)"/y,ru=/[A-Za-z*][!#$%&'*+\-.^_`|~0-9A-Za-z:/]*/y,nu=/:[A-Za-z0-9+/=]*:/y,su=/\?[01]/y,ou=/@-?\d{1,15}/y,iu=/%"((?:[\x20\x21\x23\x24\x26-\x7e]|%[0-9a-f]{2})*)"/y,uu=/[a-z*][a-z0-9_\-.*]*/y,br=/ */y;function se(t,e){e.lastIndex=t.pos;let r=e.exec(t.input);return r&&(t.pos=e.lastIndex),r}function Rs(t){let e=se(t,tu);return e&&e[1].replace(/\\(["\\])/g,"$1")}function au(t){let e=se(t,iu);if(!e)return!1;try{return decodeURIComponent(e[1]),!0}catch{return!1}}function cu(t){let e=t.input.charAt(t.pos);switch(e){case'"':return Rs(t)??!1;case":":return!!se(t,nu);case"?":return!!se(t,su);case"@":return!!se(t,ou);case"%":return au(t)}return!!se(t,e==="-"||e>="0"&&e<="9"?eu:ru)}function lu(t){let e={input:t,pos:0};se(e,br);let r=Rs(e);if(r===null)return null;let n=new Map;for(;e.input[e.pos]===";";){e.pos++,se(e,br);let s=se(e,uu);if(!s)return null;let i=!0;if(e.input[e.pos]==="="&&(e.pos++,i=cu(e),i===!1))return null;n.set(s[0],i)}return se(e,br),e.pos===e.input.length?{value:r,params:n}:null}function fu(t){let e;try{e=new URL(t)}catch{return!1}if(e.origin!==t||!/^([a-z0-9_-]+\.)*[a-z0-9_-]+$|^\[[0-9a-f:.]+\]$/.test(e.hostname))return!1;let r=/^(localhost|.+\.localhost|127(\.\d+){3}|\[::1\])$/.test(e.hostname);return e.protocol==="https:"||e.protocol==="http:"&&r}function Os(t){let e;for(let s of t)if(s.key==="otp-token"){if(e)return;e=s}if(!e||e.value.length>8192)return;let r=lu(e.value),n=r?.params.get("origin");if(!(!r?.value||typeof n!="string"||!fu(n)))return{code:r.value,origin:n}}function du(t){return!!t&&typeof t.getReader=="function"}function hu(t){return t instanceof Blob||Object.prototype.toString.call(t)==="[object Blob]"}function pu(t){let e=Object.prototype.toString.call(t);return e==="[object ArrayBuffer]"||e==="[object SharedArrayBuffer]"}var mu=new Set(["arraybuffer","base64","utf8"]);function gu(t){let e=String(t||"").replace(/[-_\s]/g,"").toLowerCase()||"arraybuffer";if(!mu.has(e))throw X("EINVALIDOPTION",`Unknown attachment encoding ${e}`);return e}function xu(t,e,r){return t.type==="subMessage"?e==="html"?gs(t.value):ms(t.value):r?e==="html"?fs(t.value):hs(t.value):t.value}var yu=new Uint8Array([10]),bu=256,Au=2*1024*1024,wu=1e4,Du=10,Eu=1e4;function Ft(t){if(!t)return 0;let e=0;for(let r of Array.isArray(t)?t:[t])e+=1+(r.group?r.group.length:0);return e}function Xe(t,e,r,n=0){if(t==null)return e;if(typeof t!="number"||!Number.isInteger(t)||t<n)throw X("EINVALIDOPTION",`${r} must be a ${n?"positive":"non-negative"} integer`);return t}function Bu(t){return{maxNestingDepth:Xe(t.maxNestingDepth,bu,"maxNestingDepth"),maxHeadersSize:Xe(t.maxHeadersSize,Au,"maxHeadersSize"),maxPartCount:Xe(t.maxPartCount,wu,"maxPartCount",1),maxRfc822NestingDepth:Xe(t.maxRfc822NestingDepth,Du,"maxRfc822NestingDepth"),maxForwardedAddresses:Xe(t.maxForwardedAddresses,Eu,"maxForwardedAddresses")}}var Re=class t{static async parse(e,r){return new t(r).parse(e)}constructor(e,r){this.options=e||{},this.rfc822NestingDepth=r?r.rfc822NestingDepth+1:0,this.limits=r?r.limits:Bu(this.options),this.counters=r?r.counters:{headerSize:0,partCount:0,forwardedAddresses:0},this.root=this.currentNode=new Fe({postalMime:this}),this.boundaries=[],this.textContent={},this.textMap=new Map,this.textTypes=new Set,this.attachments=[],this.forceRfc822Attachments=!1,this.attachmentEncoding=gu(this.options.attachmentEncoding),this.started=!1}async finalize(){await this.root.finalize()}async processLine(e,r,n){let s=this.boundaries;if(s.length&&e.length>2&&e[0]===45&&e[1]===45)for(let i=0;i<s.length;i++){let o=s[i];if(e.length<o.value.length+2)continue;let u=!0;for(let f=0;f<o.value.length;f++)if(e[f+2]!==o.value[f]){u=!1;break}if(!u)continue;let a=o.value.length+2,c=!1;e.length>=o.value.length+4&&e[o.value.length+2]===45&&e[o.value.length+3]===45&&(c=!0,a=o.value.length+4);let l=!0;for(let f=a;f<e.length;f++)if(!ae(e[f])){l=!1;break}if(l)return c?(await o.node.finalize(!0),this.currentNode=o.node.parentNode||this.root):(await o.node.finalizeChildNodes(!0),this.currentNode=new Fe({postalMime:this,parentNode:o.node,parentMultipartType:o.node.contentType.multipart})),n?this.finalize():void 0}if(this.currentNode.feed(e,r))return this.processLine(e,r,n);if(n)return this.finalize()}readLine(){let e=this.readPos,r=this.readPos;for(;this.readPos<this.av.length;){let n=this.av[this.readPos++];if(n!==13&&n!==10&&(r=this.readPos),n===10)return{bytes:new Uint8Array(this.buf,e,r-e),lineBreak:this.av.subarray(r,this.readPos),done:this.readPos>=this.av.length}}return{bytes:new Uint8Array(this.buf,e,r-e),lineBreak:yu,done:this.readPos>=this.av.length}}addTextEntry(e,r,n){let s=this.textMap.get(e);s||(s={},this.textMap.set(e,s));let i=s[r]||[];s[r]=i,i.push(n),this.textTypes.add(r)}async collectNode(e,r,n){if(e.contentType.multipart)e.contentType.multipart==="alternative"?r=e:e.contentType.multipart==="related"&&(n=!0);else{let s=this.isInlineMessageRfc822(e),i=s&&this.rfc822NestingDepth>=this.limits.maxRfc822NestingDepth;if(s&&!i)await this.collectSubMessage(e);else if(this.isInlineTextNode(e)){let o=e.contentType.parsed.value==="text/html"?"html":"plain";this.addTextEntry(r||e,o,{type:"text",value:e.getTextContent()})}else e.content&&this.collectAttachment(e,e.content,n,i)}for(let s of e.childNodes)await this.collectNode(s,r,n)}async collectSubMessage(e){let r=new t({attachmentEncoding:"arraybuffer"},this),n=await r.parse(e.content||new ArrayBuffer(0));if(this.counters.forwardedAddresses+=Ft(n.from)+Ft(n.to)+Ft(n.cc)+Ft(n.bcc),this.counters.forwardedAddresses>this.limits.maxForwardedAddresses)throw X("EMAXFORWARDEDADDRESSES",`Maximum forwarded address count of ${this.limits.maxForwardedAddresses} addresses exceeded`);let s=r.textTypes.has("plain"),i=r.textTypes.has("html");(s||!i)&&this.addTextEntry(e,"plain",{type:"subMessage",value:n}),i&&this.addTextEntry(e,"html",{type:"subMessage",value:n}),r.textMap.forEach((o,u)=>{this.textMap.set(u,o)});for(let o of n.attachments)this.attachments.push(o)}collectAttachment(e,r,n,s){let i=e.contentDisposition.parsed.params.filename||e.contentType.parsed.params.name||null,o={filename:i?pe(Ge(i)):null,mimeType:e.contentType.parsed.value,disposition:e.contentDisposition.parsed.value||null};switch(n&&e.contentId&&!s&&(o.related=!0),s&&(o.rfc822DepthExceeded=!0),e.contentDescription&&(o.description=pe(e.contentDescription)),e.contentId&&(o.contentId=e.contentId),e.contentType.parsed.value){case"text/calendar":case"application/ics":{e.contentType.parsed.params.method&&(o.method=e.contentType.parsed.params.method.toString().toUpperCase().trim());let u=e.getTextContent(),a=u.length;for(;a>0&&u.charCodeAt(a-1)===10;)a--;o.content=ne.encode(u.slice(0,a)+`
|
|
27
|
+
`);break}default:o.content=r}this.attachments.push(o)}renderTextContent(){let e={};this.textMap.forEach(r=>{this.textTypes.forEach(n=>{let s=e[n]||[];e[n]=s;let i=r[n],o=i||r[n==="html"?"plain":"html"]||[];for(let u of o)s.push(xu(u,n,!i))})}),Object.keys(e).forEach(r=>{this.textContent[r]=e[r].join(`
|
|
28
|
+
`)})}isInlineTextNode(e){if(e.contentDisposition.parsed.value==="attachment")return!1;switch(e.contentType.parsed.value){case"text/html":case"text/plain":return!0;default:return!1}}isInlineMessageRfc822(e){if(this.forceRfc822Attachments||e.contentType.parsed.value!=="message/rfc822")return!1;let r=e.contentTransferEncoding.encoding;return r==="base64"||r==="quoted-printable"?!1:(e.contentDisposition.parsed.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}hasReportParts(){let e=!1,r=n=>{n.contentType.multipart||["message/delivery-status","message/feedback-report"].includes(n.contentType.parsed.value)&&(e=!0);for(let s of n.childNodes)r(s)};return r(this.root),e}async resolveStream(e){let r=0,n=[],s=e.getReader();for(;;){let{done:u,value:a}=await s.read();if(u)break;if(!ArrayBuffer.isView(a)){let c=X("EINVALIDINPUT","Stream chunks must be Uint8Array values");throw s.cancel(c).catch(()=>{}),c}n.push(new Uint8Array(a.buffer,a.byteOffset,a.byteLength)),r+=a.byteLength}let i=new Uint8Array(r),o=0;for(let u of n)i.set(u,o),o+=u.length;return i}async resolveInput(e){let r=e;if(du(r)&&(r=await this.resolveStream(r)),r=r||new ArrayBuffer(0),typeof r=="string"&&(r=ne.encode(r)),hu(r)&&(r=await Se(r)),ArrayBuffer.isView(r))return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);if(!pu(r))throw X("EINVALIDINPUT","Unsupported email input type");return r}buildMessage(){let e=this.root.headers,r={headers:e.map(i=>({key:i.key,originalKey:i.originalKey,value:i.value}))};for(let i of["from","sender"]){let o=e.find(u=>u.key===i);if(o&&o.value){let u=St(o.value);u&&u.length&&(r[i]=u[0])}}for(let[i,o]of[["delivered-to","deliveredTo"],["return-path","returnPath"]]){let u=e.find(a=>a.key===i);if(u&&u.value){let a=St(u.value);a&&a.length&&a[0].address&&(r[o]=a[0].address)}}for(let[i,o]of[["to","to"],["cc","cc"],["bcc","bcc"],["reply-to","replyTo"]]){let u=[];for(let a of e)if(a.key===i&&a.value)for(let c of St(a.value))u.push(c);u.length&&(r[o]=u)}for(let[i,o]of[["subject","subject"],["message-id","messageId"],["in-reply-to","inReplyTo"],["references","references"]]){let u=e.find(a=>a.key===i);u&&u.value&&(r[o]=pe(u.value))}let n=e.find(i=>i.key==="date");if(n){let i=new Date(n.value);r.date=i.toString()==="Invalid Date"?n.value:i.toISOString()}let s=Os(e);return s&&(r.otp=s),this.textContent.html&&(r.html=this.textContent.html),this.textContent.plain&&(r.text=this.textContent.plain),r.attachments=this.attachments,r.headerLines=this.root.rawHeaderLines.slice(),r}encodeAttachments(){switch(this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let e of this.attachments)e.content&&typeof e.content!="string"&&(e.content=ks(e.content),e.encoding="base64");break;case"utf8":{let e=new TextDecoder("utf8");for(let r of this.attachments)r.content&&typeof r.content!="string"&&(r.content=e.decode(r.content),r.encoding="utf8");break}}}async parse(e){if(this.started)throw X("EPARSERREUSED","Can not reuse parser, create a new PostalMime object");for(this.started=!0,this.buf=await this.resolveInput(e),this.av=new Uint8Array(this.buf),this.readPos=0;this.readPos<this.av.length;){let n=this.readLine();await this.processLine(n.bytes,n.lineBreak,n.done)}this.forceRfc822Attachments=!!this.options.forceRfc822Attachments||this.hasReportParts(),await this.collectNode(this.root,!1,!1),this.rfc822NestingDepth===0&&this.renderTextContent();let r=this.buildMessage();return this.encodeAttachments(),r}};var Cu=t=>{let e=atob(t.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-t.length%4)%4));return Uint8Array.from(e,r=>r.charCodeAt(0))},vu=t=>{let e="";for(let r of t)e+=String.fromCharCode(r);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},Ar=t=>t.reduce((e,r)=>e<<8n|BigInt(r),0n);function Tu(t,e){let r=new Uint8Array(e);for(let n=e-1;n>=0;n--)r[n]=Number(t&0xffn),t>>=8n;return r}var wr=(t,e)=>vu(Tu(t,e)),kt=t=>Ar(Cu(t)),Rt=t=>Math.ceil(t.toString(16).length/2);function Ls(t,e,r){let n=1n;for(t%=r;e>0n;)e&1n&&(n=n*t%r),t=t*t%r,e>>=1n;return n}function qs(t,e){let[r,n]=[t%e,e],[s,i]=[1n,0n];for(;n!==0n;){let o=r/n;[r,n]=[n,r-o*n],[s,i]=[i,s-o*i]}if(r!==1n)throw new Error("sem inverso");return(s%e+e)%e}async function _s(t,e){let r=Rt(e)+32,n=[];for(let o=0,u=0;u<r;o++){let a=new Uint8Array(t.length+4);a.set(t),new DataView(a.buffer).setUint32(t.length,o);let c=new Uint8Array(await crypto.subtle.digest("SHA-256",a));n.push(c),u+=c.length}let s=new Uint8Array(n.reduce((o,u)=>o+u.length,0)),i=0;for(let o of n)s.set(o,i),i+=o.length;return Ar(s)%e}var Su=(t=Date.now())=>Math.floor(t/(168*3600*1e3));function Ns(t=Su()){let e=new Uint8Array(36);return new DataView(e.buffer).setUint32(0,t),e.set(crypto.getRandomValues(new Uint8Array(32)),4),e}async function Is(t,e){let r=Rt(t.n);for(;;){let n=Ar(crypto.getRandomValues(new Uint8Array(r)))%t.n;if(!(n<2n)){try{qs(n,t.n)}catch{continue}return{blinded:await _s(e,t.n)*Ls(n,t.e,t.n)%t.n,r:n}}}}function Us(t,e,r){return e*qs(r,t.n)%t.n}async function Ps(t,e,r){return r>0n&&r<t.n&&Ls(r,t.e,t.n)===await _s(e,t.n)}var Ms=t=>({n:kt(t.n),e:kt(t.e)});function Hs(t){if(!t)return[];let e=[];for(let r of Array.isArray(t)?t:[t])if(r.group)for(let n of r.group)e.push({name:n.name||"",address:(n.address||"").toLowerCase()});else r.address&&e.push({name:r.name||"",address:r.address.toLowerCase()});return e}function Fu(t,e){let r=t||"";return!r&&e&&(r=e.replace(/<(style|script|head)[\s\S]*?<\/\1>/gi," ").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")),r.replace(/\s+/g," ").trim().slice(0,110)}function ku(t){let e=t.find(n=>n.key==="arc-authentication-results"||n.key==="authentication-results");if(!e||!/^\s*(i=1;\s*)?mx\.cloudflare\.net\s*;/i.test(e.value))return"unknown";let r=/\bdmarc=(\w+)/i.exec(e.value)?.[1]?.toLowerCase();return r==="pass"?"pass":r==="fail"?"fail":"unknown"}function Ru(t){let e=3735928559^t.length,r=1103547991^t.length;for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);e=Math.imul(e^s,2654435761),r=Math.imul(r^s,1597334677)}return e=Math.imul(e^e>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),(4294967296*(2097151&r)+(e>>>0)).toString(36)}var Dr=t=>(t||"").match(/<[^<>\s]+>/)?.[0]??(t||"").trim().split(/\s+/)[0]??"";function Ou(t){let e=Dr(t.references)||Dr(t.inReplyTo)||Dr(t.messageId);return e?Ru(e.toLowerCase()):""}function $s(t,e,r){let n=t.date&&!Number.isNaN(Date.parse(t.date))?new Date(t.date):r;return{from:Hs(t.from)[0]??null,to:Hs(t.to).slice(0,5),subject:(t.subject||"").trim().slice(0,200),date:n.toISOString(),snippet:Fu(t.text,t.html),attachments:t.attachments.filter(s=>s.disposition!=="inline"||!s.contentId).length,t:Ou(t)||void 0,auth:e?"pass":ku(t.headers),e2e:e}}async function js(t,e){let r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}async function zs(t){let e=await js(t,new CompressionStream("gzip"));return e.length<t.length?e:t}var Lu=t=>t.length>2&&t[0]===31&&t[1]===139;async function Ks(t){return Lu(t)?js(t,new DecompressionStream("gzip")):t}var Er=3,qu=new TextEncoder,Gs=new TextDecoder;function _u(t,e){let r=Y(t.c);if(!Nn.verify(Y(t.s),r,e))throw new Error("certificado do remetente com assinatura inv\xE1lida");let n=JSON.parse(Gs.decode(r));if(typeof n.a!="string"||typeof n.k!="string"||typeof n.e!="number")throw new Error("certificado do remetente malformado");return n}async function Br(t,e,r,n,s){let i=await Hn(t,qu.encode(JSON.stringify(r)),"cert"),o=await zn(t,e,n,s);return Z(new Uint8Array([Er,i.length>>8,i.length&255]),i,o)}var Cr=t=>t[0]===Er;async function vr(t,e,r,n,s){if(e.length<4||e[0]!==Er)throw new Error("n\xE3o \xE9 uma mensagem com remetente lacrado");let i=e[1]<<8|e[2],o=e.subarray(3,3+i),u=e.subarray(3+i),a=JSON.parse(Gs.decode(await ze(t,o,"cert"))),c=_u(a,n);if(s>c.e+300*1e3||s<c.i-300*1e3)throw new Error("certificado do remetente fora da validade");return{payload:await Kn(t,Y(c.k),u,r),sender:{address:c.a.toLowerCase(),publicKey:c.k}}}var qt=new TextEncoder,Ys=t=>/^[\x20-\x7e]*$/.test(t);function Tr(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)}function Sr(t){if(Ys(t))return t;let e=[],r="";for(let n of t)qt.encode(r+n).length>45&&(e.push(r),r=""),r+=n;return r&&e.push(r),e.map(n=>`=?UTF-8?B?${Tr(qt.encode(n))}?=`).join(`\r
|
|
29
|
+
`)}function Ot(t){return t.name?`${Ys(t.name)?`"${t.name.replace(/["\\]/g,"\\$&")}"`:Sr(t.name)} <${t.address}>`:t.address}var Lt=t=>t.replace(/[\r\n]+/g," ");function Vs(t,e){let r=Tr(qt.encode(e)).replace(/.{1,76}/g,`$&\r
|
|
30
|
+
`);return`Content-Type: ${t}; charset=utf-8\r
|
|
31
|
+
Content-Transfer-Encoding: base64\r
|
|
32
|
+
\r
|
|
33
|
+
${r}`}function Ws(t){let e=Sr(Lt(t.filename)).replace(/"/g,""),r=t.cid?"inline":"attachment";return`${[`Content-Type: ${t.type}; name="${e}"`,`Content-Disposition: ${r}; filename="${e}"`,"Content-Transfer-Encoding: base64",t.cid?`Content-ID: <${t.cid}>`:""].filter(Boolean).join(`\r
|
|
34
|
+
`)}\r
|
|
35
|
+
\r
|
|
36
|
+
${Tr(t.content).replace(/.{1,76}/g,`$&\r
|
|
37
|
+
`)}`}function Nu(t){let e=`alt-${crypto.randomUUID()}`,r={type:`multipart/alternative; boundary="${e}"`,content:`--${e}\r
|
|
38
|
+
${Vs("text/plain",t.text)}--${e}\r
|
|
39
|
+
${Vs("text/html",t.html)}--${e}--\r
|
|
40
|
+
`},n=(t.attachments??[]).filter(i=>i.cid),s=(t.attachments??[]).filter(i=>!i.cid);if(n.length){let i=`rel-${crypto.randomUUID()}`;r={type:`multipart/related; boundary="${i}"`,content:`--${i}\r
|
|
41
|
+
Content-Type: ${r.type}\r
|
|
42
|
+
\r
|
|
43
|
+
${r.content}${n.map(o=>`--${i}\r
|
|
44
|
+
${Ws(o)}`).join("")}--${i}--\r
|
|
45
|
+
`}}if(s.length){let i=`mix-${crypto.randomUUID()}`;r={type:`multipart/mixed; boundary="${i}"`,content:`--${i}\r
|
|
46
|
+
Content-Type: ${r.type}\r
|
|
47
|
+
\r
|
|
48
|
+
${r.content}${s.map(o=>`--${i}\r
|
|
49
|
+
${Ws(o)}`).join("")}--${i}--\r
|
|
50
|
+
`}}return r}function Fr(t,e){let r=[`From: ${Ot(t.from)}`,t.to.length?`To: ${t.to.map(Ot).join(", ")}`:"",t.cc.length?`Cc: ${t.cc.map(Ot).join(", ")}`:"",e&&t.bcc.length?`Bcc: ${t.bcc.map(Ot).join(", ")}`:"",`Subject: ${Sr(Lt(t.subject))}`,`Date: ${t.date.toUTCString().replace("GMT","+0000")}`,`Message-ID: ${t.messageId}`,t.inReplyTo?`In-Reply-To: ${Lt(t.inReplyTo)}`:"",t.references?`References: ${Lt(t.references)}`:"","MIME-Version: 1.0"].filter(Boolean),n=Nu(t);return qt.encode(`${r.join(`\r
|
|
51
|
+
`)}\r
|
|
52
|
+
Content-Type: ${n.type}\r
|
|
53
|
+
\r
|
|
54
|
+
${n.content}`)}function Xs(t){return`<${crypto.randomUUID()}@${t}>`}var Zs=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function Qs(t,e){let r=Zs(t).replace(/https?:\/\/[^\s<]+/g,s=>`<a href="${s}">${s}</a>`).replace(/\n/g,"<br>"),n=e?`<br><div>${Zs(e.header)}</div><blockquote style="margin:0 0 0 .8ex;border-left:2px solid #ccc;padding-left:1ex">${e.html}</blockquote>`:"";return`<div style="font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:1.5">${r}${n}</div>`}var Oe="shalomail.com",U=class extends Error{constructor(r,n,s){super(s);this.status=r;this.code=n}status;code},Iu={bad_key:"Invalid or revoked API key. Run `shalom login` to connect this terminal again.",key_scope:"This key cannot do that. Account keys manage agents; agent keys read and send mail.",agent_limit:"Your plan has no free agent mailbox left. Delete one, or upgrade with `shalom upgrade`.",create_limit:"You reached the daily limit of new agent mailboxes. Try again tomorrow.",agent_paused:"This agent mailbox is paused because the owner's plan no longer covers it. It still receives mail.",taken:"That address is already taken.",bad_address:"That address cannot be used. Use letters, numbers, dots, dashes or underscores.",send_limit:"Daily sending limit reached for this mailbox.",send_limit_all:"Shalom's daily limit for mail to outside addresses was reached. Mail to Shalom addresses still works.",too_many:"Too many requests. Try again later.",slow_down:"Too many requests in a row. Wait a minute.",billing_off:"Billing is not enabled yet.",no_session:"Not logged in. Run `shalom login`."};async function G(t,e,r,n,s={}){let i={"x-shalom":"1","user-agent":"shalom-cli"};s.anonymous||(i.authorization=`Bearer ${t.key}`),n!==void 0&&(i["content-type"]="application/json");let o;try{o=await fetch(`${t.api}/api${r}`,{method:e,headers:i,body:n===void 0?void 0:JSON.stringify(n)})}catch(a){throw new U(0,"offline",`Could not reach ${t.api} (${a.message}).`)}if(s.raw&&o.ok)return new Uint8Array(await o.arrayBuffer());let u=await o.json().catch(()=>({}));if(!o.ok){let a=u.error??`http_${o.status}`;throw new U(o.status,a,Iu[a]??u.message??`Request failed (${o.status}).`)}return u}async function Uu(t,e){let r=await G({api:t,key:""},"GET","/auth/config",void 0,{anonymous:!0}),n=JSON.stringify({certKey:r.certKey,tokenKey:r.tokenKey});if(e&&e!==n)throw new U(0,"server_keys","The server's signing keys changed since the first use. Stopping for safety.");return{cert:Y(r.certKey),token:Ms(r.tokenKey),wire:n}}var _t=class{constructor(e,r){this.agent=e;this.pins=r}agent;pins;keys=null;cert=null;get creds(){return{api:this.agent.api,key:this.agent.key}}server(){return this.keys??=Uu(this.agent.api,this.pins.server).then(e=>(this.pins.server||this.pins.onServer(e.wire),e)),this.keys}async summarize(e){let r=Y(e.head),n,s=!1;try{if(Cr(r)){let{payload:i,sender:o}=await vr(this.agent.secretKey,r,"head",(await this.server()).cert,e.received_at);n=JSON.parse(new TextDecoder().decode(i)),n={...n,from:{name:n.from?.name??"",address:o.address}},s=!0}else n=await $n(this.agent.secretKey,r)}catch{n={from:null,to:[],subject:"(unreadable)",date:new Date(e.received_at).toISOString(),snippet:"",attachments:0,auth:"fail",e2e:!1}}return{id:e.id,folder:e.folder,from:n.from,to:n.to,subject:n.subject,date:n.date,receivedAt:e.received_at,snippet:n.snippet,attachments:n.attachments,unread:!e.seen,starred:!!e.starred,verifiedSender:s,auth:n.auth}}async list(e="inbox",r=20,n){let s=new URLSearchParams({folder:e,limit:String(Math.min(Math.max(r,1),100))});n&&s.set("before",String(n));let{messages:i,more:o}=await G(this.creds,"GET",`/messages?${s}`);return{messages:await Promise.all(i.map(u=>this.summarize(u))),more:o}}async find(e){for(let r of["inbox","archive","sent","spam","trash"]){let n;for(let s=0;s<5;s++){let i=new URLSearchParams({folder:r,limit:"100"});n&&i.set("before",String(n));let{messages:o,more:u}=await G(this.creds,"GET",`/messages?${i}`),a=o.find(c=>c.id===e||e.length>=6&&c.id.startsWith(e));if(a)return a;if(!u||!o.length)break;n=o[o.length-1].received_at}}throw new U(404,"not_found",`Message ${e} not found.`)}async read(e){let r=await this.find(e),n=await this.summarize(r),s=await G(this.creds,"GET",`/messages/${r.id}/raw`,void 0,{raw:!0}),i;if(Cr(s)){let u=await vr(this.agent.secretKey,s,"raw",(await this.server()).cert,r.received_at);if(n.verifiedSender&&u.sender.address!==n.from?.address)throw new U(0,"tampered","The message body does not match its sender.");i=u.payload}else{if(n.verifiedSender)throw new U(0,"tampered","The message body is not sealed by its sender.");i=await ze(this.agent.secretKey,s,"raw")}let o=await Re.parse(await Ks(i),{attachmentEncoding:"arraybuffer"});return{summary:n,email:o}}update(e,r){return G(this.creds,"POST","/messages/update",{ids:e,...r})}async myCert(){if(this.cert&&this.cert.until>Date.now()+24*3600*1e3)return this.cert.signed;let{cert:e}=await G(this.creds,"POST","/cert",{});return this.cert={signed:e,until:JSON.parse(new TextDecoder().decode(Y(e.c))).e},e}async token(){let e=(await this.server()).token,r=Ns(),{blinded:n,r:s}=await Is(e,r),i=Rt(e.n),{signed:o}=await G(this.creds,"POST","/tokens",{blinded:[wr(n,i)]}),u=Us(e,kt(o[0]),s);if(!await Ps(e,r,u))throw new U(0,"bad_tokens","The server returned an invalid delivery ticket.");return{token:r,sig:wr(u,i)}}async sealed(e,r,n){let s=$s(await Re.parse(r),!0,new Date);return{head:re(await Br(e,this.agent.secretKey,n,new TextEncoder().encode(JSON.stringify(s)),"head")),raw:re(await Br(e,this.agent.secretKey,n,await zs(r),"raw"))}}async publicKeyOf(e){return(await G(this.creds,"POST","/keys",{address:e},{anonymous:!0})).publicKey}async send(e,r){let n=e.cc??[],s=e.bcc??[],i=[...e.to,...n,...s],o=D=>D.toLowerCase().endsWith(`@${Oe}`),u=e.html??Qs(e.text),a={from:e.from,to:e.to,cc:n,bcc:s,subject:e.subject,text:e.text,html:u,messageId:Xs(Oe),inReplyTo:e.inReplyTo,references:e.references,date:new Date,attachments:e.attachments},c=Fr(a,!1),l=Fr(a,!0),f=await this.myCert(),h=[...new Set(i.map(D=>D.address.toLowerCase()).filter(o))],d=[];for(let D of h){let x=await this.publicKeyOf(D);if(!x)throw new U(404,"no_such_user",`${D} does not exist.`);r(D,x),d.push({address:D,...await this.sealed(Y(x),c,f)})}let g=D=>D.filter(x=>!o(x.address)),m=i.filter(D=>!o(D.address)).length,A=await G(this.creds,"POST","/send",{...m?{to:g(e.to),cc:g(n),bcc:g(s),subject:e.subject,text:e.text,html:u,inReplyTo:e.inReplyTo,references:e.references,messageId:a.messageId,attachments:(e.attachments??[]).map(D=>({filename:D.filename,type:D.type,content:re(D.content),cid:D.cid}))}:{},sentCopy:await this.sealed(Mn(this.agent.secretKey),l,f)});for(let D of d){let x=await this.token();await G(this.creds,"POST","/deliver",{to:D.address,head:D.head,raw:D.raw,token:re(x.token),sig:x.sig},{anonymous:!0})}return{id:A.id,external:m,internal:d.length}}};var Pu=t=>t?t.name?`${t.name} <${t.address}>`:t.address:"(unknown)",Mu=t=>new Date(t).toISOString().replace("T"," ").slice(0,16);function Hu(t){return t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<br\s*\/?>/gi,`
|
|
55
|
+
`).replace(/<\/(p|div|li|h\d|tr)>/gi,`
|
|
56
|
+
`).replace(/<[^>]+>/g,"").replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&").replace(/\n{3,}/g,`
|
|
57
|
+
|
|
58
|
+
`).trim()}var kr=t=>t.text?.trim()?t.text.trim():t.html?Hu(t.html):"",Be=t=>(t??[]).filter(e=>e.address).map(e=>({name:e.name??"",address:e.address}));var $u={pdf:"application/pdf",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",txt:"text/plain",md:"text/markdown",csv:"text/csv",json:"application/json",html:"text/html",zip:"application/zip",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},Rr=t=>$u[t.split(".").pop()?.toLowerCase()??""]??"application/octet-stream",Nt=t=>(Array.isArray(t)?t:t?[t]:[]).flatMap(e=>e.split(",")).map(e=>e.trim()).filter(Boolean).map(e=>{let r=/^(.*?)\s*<([^>]+)>$/.exec(e);return r?{name:r[1].replace(/^"|"$/g,""),address:r[2].toLowerCase()}:{name:"",address:e.toLowerCase()}});function Js(t,e,r,n){let s=Be(e.replyTo).length?Be(e.replyTo):t.from?[t.from]:[],i=n.to?.length?n.to:s,o=n.all?[...Be(e.to),...Be(e.cc)].filter(l=>l.address.toLowerCase()!==r.toLowerCase()&&!i.some(f=>f.address===l.address)):n.cc??[],u=/^\s*re\s*:/i.test(t.subject)?t.subject:`Re: ${t.subject}`,a=n.quote===!1?"":`
|
|
59
|
+
|
|
60
|
+
On ${e.date??Mu(t.receivedAt)}, ${Pu(t.from)} wrote:
|
|
61
|
+
${kr(e).split(`
|
|
62
|
+
`).map(l=>`> ${l}`).join(`
|
|
63
|
+
`)}`,c=[e.references,e.messageId].filter(Boolean).join(" ")||void 0;return{to:i,cc:o,subject:u,text:n.text+a,inReplyTo:e.messageId,references:c}}import{chmodSync as to,existsSync as ju,mkdirSync as zu,readdirSync as Lc,readFileSync as Ku,rmSync as qc,writeFileSync as Gu}from"node:fs";import{homedir as Vu}from"node:os";import{join as Qe}from"node:path";var ro="https://shalomail.com",no=()=>process.env.SHALOM_CONFIG_DIR||(process.platform==="win32"&&process.env.APPDATA?Qe(process.env.APPDATA,"shalom"):Qe(process.env.XDG_CONFIG_HOME||Qe(Vu(),".config"),"shalom"));function eo(t){ju(t)||zu(t,{recursive:!0,mode:448});try{to(t,448)}catch{}}function Wu(t,e){Gu(t,JSON.stringify(e,null,2)+`
|
|
64
|
+
`,{mode:384});try{to(t,384)}catch{}}var Zu=t=>{try{return JSON.parse(Ku(t,"utf8"))}catch{return null}};var so=()=>Qe(no(),"agents"),oo=t=>Qe(so(),`${t.toLowerCase()}.json`);function Lr(t){eo(no()),eo(so()),Wu(oo(t.address),t)}var io=t=>Zu(oo(t));var Or="shalom_agent_",uo=t=>Or+Buffer.from(JSON.stringify({a:t.address,i:t.id,n:t.name,u:t.api,k:t.key,s:t.secretKey})).toString("base64url");function ao(t){if(!t.startsWith(Or))throw new Error("SHALOM_AGENT_TOKEN is not a Shalom agent token.");let e=JSON.parse(Buffer.from(t.slice(Or.length),"base64url").toString("utf8"));return{address:e.a,id:e.i,name:e.n,api:e.u,key:e.k,secretKey:e.s,createdAt:0}}var co=(t,e)=>({address:t.address,key:t.key,secretKey:Y(t.secretKey),api:e??t.api});var Yu=(t,e)=>({...t,messageId:e.messageId??null,inReplyTo:e.inReplyTo??null,references:e.references??null,replyTo:Be(e.replyTo),cc:Be(e.cc),text:kr(e),html:e.html??null,attachments:e.attachments.map(r=>({filename:r.filename??"attachment",mimeType:r.mimeType,size:r.content.byteLength,content:new Uint8Array(r.content)}))}),ho=t=>(t||process.env.SHALOM_API_URL||ro).replace(/\/+$/,""),lo=class t{constructor(e,r,n){this.file=e;this.persist=r;this.pins={...e.pins??{}},this.box=new _t(co(e,n?ho(n):e.api),{onServer:()=>{}})}file;persist;box;pins;static fromToken(e=process.env.SHALOM_AGENT_TOKEN,r={}){if(!e)throw new U(0,"no_token","Pass an agent token or set SHALOM_AGENT_TOKEN (run `shalom agents export <address>`).");return new t(ao(e),!1,r.api)}static fromFile(e,r={}){let n=(e.includes("@")?e:`${e}@${Oe}`).toLowerCase(),s=io(n);if(!s)throw new U(0,"no_agent",`${n} is not saved on this machine.`);return new t(s,!0,r.api)}get address(){return this.file.address}checkPin(e){return(r,n)=>{if(this.pins[r]&&this.pins[r]!==n&&!e)throw new U(0,"key_changed",`The encryption key of ${r} changed since the last time. Confirm with them, then pass { trustNewKey: true }.`);this.pins[r]!==n&&(this.pins[r]=n,this.persist&&(this.file.pins={...this.pins},Lr(this.file)))}}async inbox(e={}){let{messages:r}=await this.box.list(e.folder??"inbox",e.limit??20);return e.unread?r.filter(n=>n.unread):r}async read(e,r={}){let{summary:n,email:s}=await this.box.read(e);return r.markRead!==!1&&n.unread&&await this.box.update([n.id],{seen:!0}),Yu(n,s)}send(e,r={}){let n=Nt(e.to);if(!n.length)throw new U(0,"bad_request","Add at least one recipient.");return this.box.send({from:{name:this.file.name,address:this.file.address},to:n,cc:Nt(e.cc),bcc:Nt(e.bcc),subject:e.subject,text:e.text,html:e.html,inReplyTo:e.inReplyTo,references:e.references,attachments:(e.attachments??[]).map(s=>({filename:s.filename,type:s.type??Rr(s.filename),content:new Uint8Array(s.content)}))},this.checkPin(!!r.trustNewKey))}async reply(e,r,n={}){let{summary:s,email:i}=await this.box.read(e),o=Js(s,i,this.file.address,{text:r.text,all:r.all,quote:r.quote});if(!o.to.length)throw new U(0,"bad_request","Could not tell who to reply to.");return this.box.send({from:{name:this.file.name,address:this.file.address},...o,bcc:[],html:r.html,attachments:(r.attachments??[]).map(u=>({filename:u.filename,type:u.type??Rr(u.filename),content:new Uint8Array(u.content)}))},this.checkPin(!!n.trustNewKey))}async ids(e){return Promise.all((Array.isArray(e)?e:[e]).map(async r=>r.length===36?r:(await this.box.find(r)).id))}async move(e,r){await this.box.update(await this.ids(e),{folder:r})}async mark(e,r){await this.box.update(await this.ids(e),{...r.read!==void 0?{seen:r.read}:{},...r.starred!==void 0?{starred:r.starred}:{}})}async*watch(e={}){let r=Math.max(5,e.interval??15)*1e3,n=new Set;if(!e.includeExisting)for(let i of await this.inbox({limit:100}))n.add(i.id);let s=r;for(;!e.signal?.aborted;){try{let i=(await this.inbox({limit:50})).filter(o=>!n.has(o.id)).sort((o,u)=>o.receivedAt-u.receivedAt);for(let o of i)n.add(o.id),yield await this.read(o.id,{markRead:!1});s=r}catch(i){if(i instanceof U&&(i.status===401||i.status===403))throw i;s=Math.min(s*2,300*1e3)}await new Promise(i=>{let o=setTimeout(i,s);e.signal?.addEventListener("abort",()=>{clearTimeout(o),i()},{once:!0})})}}},fo=class{creds;constructor(e=process.env.SHALOM_API_KEY,r={}){if(!e)throw new U(0,"no_key","Pass an account API key or set SHALOM_API_KEY.");this.creds={api:ho(r.api),key:e}}listAgents(){return G(this.creds,"GET","/agents")}async createAgent(e,r={}){let n=(e.includes("@")?e:`${e}@${Oe}`).toLowerCase(),{secretKey:s,publicKey:i}=Pn(),o=await G(this.creds,"POST","/agents",{address:n,name:r.displayName??"",publicKey:re(i)}),u={...o.agent,api:this.creds.api,key:o.key,secretKey:re(s)};return r.save&&Lr(u),{id:o.agent.id,address:o.agent.address,name:o.agent.name,token:uo(u)}}async deleteAgent(e){let r=(e.includes("@")?e:`${e}@${Oe}`).toLowerCase(),n=(await this.listAgents()).agents.find(s=>s.address===r);if(!n)throw new U(404,"not_found",`${r} is not one of your agent mailboxes.`);await G(this.creds,"POST","/agents/delete",{id:n.id})}};export{fo as Account,lo as Agent,U as ApiError};
|