>>0);e.toBig=i;const l=(b,L,P)=>b>>>P,s=(b,L,P)=>b<<32-P|L>>>P,u=(b,L,P)=>b>>>P|L<<32-P,a=(b,L,P)=>b<<32-P|L>>>P,f=(b,L,P)=>b<<64-P|L>>>P-32,c=(b,L,P)=>b>>>P-32|L<<64-P,d=(b,L)=>L,p=(b,L)=>b,w=(b,L,P)=>b<>>32-P,v=(b,L,P)=>L<
>>32-P,E=(b,L,P)=>L<>>64-P,m=(b,L,P)=>b<>>64-P;function h(b,L,P,W){const ne=(L>>>0)+(W>>>0);return{h:b+P+(ne/2**32|0)|0,l:ne|0}}e.add=h;const y=(b,L,P)=>(b>>>0)+(L>>>0)+(P>>>0),g=(b,L,P,W)=>L+P+W+(b/2**32|0)|0,x=(b,L,P,W)=>(b>>>0)+(L>>>0)+(P>>>0)+(W>>>0),C=(b,L,P,W,ne)=>L+P+W+ne+(b/2**32|0)|0,S=(b,L,P,W,ne)=>(b>>>0)+(L>>>0)+(P>>>0)+(W>>>0)+(ne>>>0),T=(b,L,P,W,ne,ut)=>L+P+W+ne+ut+(b/2**32|0)|0,R={fromBig:r,split:o,toBig:e.toBig,shrSH:l,shrSL:s,rotrSH:u,rotrSL:a,rotrBH:f,rotrBL:c,rotr32H:d,rotr32L:p,rotlSH:w,rotlSL:v,rotlBH:E,rotlBL:m,add:h,add3L:y,add3H:g,add4L:x,add4H:C,add5H:T,add5L:S};e.default=R})(cp);Object.defineProperty(Qe,"__esModule",{value:!0});Qe.sha384=Qe.sha512_256=Qe.sha512_224=hu=Qe.sha512=Qe.SHA512=void 0;const kg=Po,O=cp,xl=ye,[Eg,Sg]=O.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Ut=new Uint32Array(80),Ft=new Uint32Array(80);class $o extends kg.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:n,Bh:r,Bl:o,Ch:i,Cl:l,Dh:s,Dl:u,Eh:a,El:f,Fh:c,Fl:d,Gh:p,Gl:w,Hh:v,Hl:E}=this;return[t,n,r,o,i,l,s,u,a,f,c,d,p,w,v,E]}set(t,n,r,o,i,l,s,u,a,f,c,d,p,w,v,E){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=o|0,this.Ch=i|0,this.Cl=l|0,this.Dh=s|0,this.Dl=u|0,this.Eh=a|0,this.El=f|0,this.Fh=c|0,this.Fl=d|0,this.Gh=p|0,this.Gl=w|0,this.Hh=v|0,this.Hl=E|0}process(t,n){for(let y=0;y<16;y++,n+=4)Ut[y]=t.getUint32(n),Ft[y]=t.getUint32(n+=4);for(let y=16;y<80;y++){const g=Ut[y-15]|0,x=Ft[y-15]|0,C=O.default.rotrSH(g,x,1)^O.default.rotrSH(g,x,8)^O.default.shrSH(g,x,7),S=O.default.rotrSL(g,x,1)^O.default.rotrSL(g,x,8)^O.default.shrSL(g,x,7),T=Ut[y-2]|0,R=Ft[y-2]|0,b=O.default.rotrSH(T,R,19)^O.default.rotrBH(T,R,61)^O.default.shrSH(T,R,6),L=O.default.rotrSL(T,R,19)^O.default.rotrBL(T,R,61)^O.default.shrSL(T,R,6),P=O.default.add4L(S,L,Ft[y-7],Ft[y-16]),W=O.default.add4H(P,C,b,Ut[y-7],Ut[y-16]);Ut[y]=W|0,Ft[y]=P|0}let{Ah:r,Al:o,Bh:i,Bl:l,Ch:s,Cl:u,Dh:a,Dl:f,Eh:c,El:d,Fh:p,Fl:w,Gh:v,Gl:E,Hh:m,Hl:h}=this;for(let y=0;y<80;y++){const g=O.default.rotrSH(c,d,14)^O.default.rotrSH(c,d,18)^O.default.rotrBH(c,d,41),x=O.default.rotrSL(c,d,14)^O.default.rotrSL(c,d,18)^O.default.rotrBL(c,d,41),C=c&p^~c&v,S=d&w^~d&E,T=O.default.add5L(h,x,S,Sg[y],Ft[y]),R=O.default.add5H(T,m,g,C,Eg[y],Ut[y]),b=T|0,L=O.default.rotrSH(r,o,28)^O.default.rotrBH(r,o,34)^O.default.rotrBH(r,o,39),P=O.default.rotrSL(r,o,28)^O.default.rotrBL(r,o,34)^O.default.rotrBL(r,o,39),W=r&i^r&s^i&s,ne=o&l^o&u^l&u;m=v|0,h=E|0,v=p|0,E=w|0,p=c|0,w=d|0,{h:c,l:d}=O.default.add(a|0,f|0,R|0,b|0),a=s|0,f=u|0,s=i|0,u=l|0,i=r|0,l=o|0;const ut=O.default.add3L(b,P,ne);r=O.default.add3H(ut,R,L,W),o=ut|0}({h:r,l:o}=O.default.add(this.Ah|0,this.Al|0,r|0,o|0)),{h:i,l}=O.default.add(this.Bh|0,this.Bl|0,i|0,l|0),{h:s,l:u}=O.default.add(this.Ch|0,this.Cl|0,s|0,u|0),{h:a,l:f}=O.default.add(this.Dh|0,this.Dl|0,a|0,f|0),{h:c,l:d}=O.default.add(this.Eh|0,this.El|0,c|0,d|0),{h:p,l:w}=O.default.add(this.Fh|0,this.Fl|0,p|0,w|0),{h:v,l:E}=O.default.add(this.Gh|0,this.Gl|0,v|0,E|0),{h:m,l:h}=O.default.add(this.Hh|0,this.Hl|0,m|0,h|0),this.set(r,o,i,l,s,u,a,f,c,d,p,w,v,E,m,h)}roundClean(){Ut.fill(0),Ft.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}Qe.SHA512=$o;class bg extends $o{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class Cg extends $o{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class _g extends $o{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}var hu=Qe.sha512=(0,xl.wrapConstructor)(()=>new $o);Qe.sha512_224=(0,xl.wrapConstructor)(()=>new bg);Qe.sha512_256=(0,xl.wrapConstructor)(()=>new Cg);Qe.sha384=(0,xl.wrapConstructor)(()=>new _g);const Tg=Gp(ag);Object.defineProperty(Oe,"__esModule",{value:!0});var fp=Oe.mnemonicToSeedSync=Oe.mnemonicToSeed=kp=Oe.validateMnemonic=Oe.entropyToMnemonic=Oe.mnemonicToEntropy=gp=Oe.generateMnemonic=void 0;/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const dp=fe,hp=wr,Ag=xr,pp=Qe,Ng=ye,ii=Tg,Ig=e=>e[0]==="あいこくしん";function mp(e){if(typeof e!="string")throw new TypeError(`Invalid mnemonic type: ${typeof e}`);return e.normalize("NFKD")}function ka(e){const t=mp(e),n=t.split(" ");if(![12,15,18,21,24].includes(n.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:n}}function yp(e){dp.default.bytes(e,16,20,24,28,32)}function Lg(e,t=128){if(dp.default.number(t),t%32!==0||t>256)throw new TypeError("Invalid entropy");return xp((0,Ng.randomBytes)(t/8),e)}var gp=Oe.generateMnemonic=Lg;const Pg=e=>{const t=8-e.length/4;return new Uint8Array([(0,Ag.sha256)(e)[0]>>t<{if(typeof t!="string")throw new Error(`Wordlist: non-string element: ${t}`)}),ii.utils.chain(ii.utils.checksum(1,Pg),ii.utils.radix2(11,!0),ii.utils.alphabet(e))}function wp(e,t){const{words:n}=ka(e),r=vp(t).decode(n);return yp(r),r}Oe.mnemonicToEntropy=wp;function xp(e,t){return yp(e),vp(t).encode(e).join(Ig(t)?" ":" ")}Oe.entropyToMnemonic=xp;function $g(e,t){try{wp(e,t)}catch{return!1}return!0}var kp=Oe.validateMnemonic=$g;const Ep=e=>mp(`mnemonic${e}`);function Rg(e,t=""){return(0,hp.pbkdf2Async)(pp.sha512,ka(e).nfkd,Ep(t),{c:2048,dkLen:64})}Oe.mnemonicToSeed=Rg;function Hg(e,t=""){return(0,hp.pbkdf2)(pp.sha512,ka(e).nfkd,Ep(t),{c:2048,dkLen:64})}fp=Oe.mnemonicToSeedSync=Hg;function pu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function zg(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function Sp(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Og(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");pu(e.outputLen),pu(e.blockLen)}function Bg(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ug(e,t){Sp(e);const n=t.outputLen;if(e.lengthnew DataView(e.buffer,e.byteOffset,e.byteLength),Fg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Fg)throw new Error("Non little-endian hardware is not supported");Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Dg(e){if(typeof e!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof e}`);return new TextEncoder().encode(e)}function Ea(e){if(typeof e=="string"&&(e=Dg(e)),!(e instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof e})`);return e}class bp{clone(){return this._cloneInto()}}function jg(e){const t=r=>e().update(Ea(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}let Cp=class extends bp{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,bn.hash(t);const r=Ea(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,i=new Uint8Array(o);i.set(r.length>o?t.create().update(r).digest():r);for(let l=0;lnew Cp(e,t).update(n).digest();Zi.create=(e,t)=>new Cp(e,t);function Mg(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),i=BigInt(4294967295),l=Number(n>>o&i),s=Number(n&i),u=r?4:0,a=r?0:4;e.setUint32(t+u,l,r),e.setUint32(t+a,s,r)}class Vg extends bp{constructor(t,n,r,o){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=os(this.buffer)}update(t){bn.exists(this);const{view:n,buffer:r,blockLen:o}=this;t=Ea(t);const i=t.length;for(let l=0;lo-l&&(this.process(r,0),l=0);for(let c=l;cf.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;ct),Wg=_p.map(e=>(9*e+5)%16);let Sa=[_p],ba=[Wg];for(let e=0;e<4;e++)for(let t of[Sa,ba])t.push(t[e].map(n=>Kg[n]));const Tp=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>new Uint8Array(e)),Qg=Sa.map((e,t)=>e.map(n=>Tp[t][n])),Gg=ba.map((e,t)=>e.map(n=>Tp[t][n])),Yg=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Xg=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),li=(e,t)=>e<>>32-t;function lf(e,t,n,r){return e===0?t^n^r:e===1?t&n|~t&r:e===2?(t|~n)^r:e===3?t&r|n&~r:t^(n|~r)}const si=new Uint32Array(16);class Zg extends Vg{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:n,h2:r,h3:o,h4:i}=this;return[t,n,r,o,i]}set(t,n,r,o,i){this.h0=t|0,this.h1=n|0,this.h2=r|0,this.h3=o|0,this.h4=i|0}process(t,n){for(let p=0;p<16;p++,n+=4)si[p]=t.getUint32(n,!0);let r=this.h0|0,o=r,i=this.h1|0,l=i,s=this.h2|0,u=s,a=this.h3|0,f=a,c=this.h4|0,d=c;for(let p=0;p<5;p++){const w=4-p,v=Yg[p],E=Xg[p],m=Sa[p],h=ba[p],y=Qg[p],g=Gg[p];for(let x=0;x<16;x++){const C=li(r+lf(p,i,s,a)+si[m[x]]+v,y[x])+c|0;r=c,c=a,a=li(s,10)|0,s=i,i=C}for(let x=0;x<16;x++){const C=li(o+lf(w,l,u,f)+si[h[x]]+E,g[x])+d|0;o=d,d=f,f=li(u,10)|0,u=l,l=C}}this.set(this.h1+s+f|0,this.h2+a+d|0,this.h3+c+o|0,this.h4+r+l|0,this.h0+i+u|0)}roundClean(){si.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const qg=jg(()=>new Zg);B.hmacSha256Sync=(e,...t)=>Zi(wl,e,B.concatBytes(...t));const is=Yh(wl);function sf(e){return BigInt(`0x${ye.bytesToHex(e)}`)}function Jg(e){return ye.hexToBytes(e.toString(16).padStart(64,"0"))}const e1=ye.utf8ToBytes("Bitcoin seed"),ls={private:76066276,public:76067358},ss=2147483648,t1=e=>qg(wl(e)),n1=e=>ye.createView(e).getUint32(0,!1),ui=e=>{if(!Number.isSafeInteger(e)||e<0||e>2**32-1)throw new Error(`Invalid number=${e}. Should be from 0 to 2 ** 32 - 1`);const t=new Uint8Array(4);return ye.createView(t).setUint32(0,e,!1),t};class xn{constructor(t){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!t||typeof t!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=t.versions||ls,this.depth=t.depth||0,this.chainCode=t.chainCode,this.index=t.index||0,this.parentFingerprint=t.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(t.publicKey&&t.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(t.privateKey){if(!B.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:sf(t.privateKey),this.privKeyBytes=Jg(this.privKey),this.pubKey=Ry(t.privateKey,!0)}else if(t.publicKey)this.pubKey=j.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=t1(this.pubKey)}get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return n1(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const t=this.privateKey;if(!t)throw new Error("No private key");return is.encode(this.serialize(this.versions.private,ye.concatBytes(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return is.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,n=ls){if(Un(t),8*t.length<128||8*t.length>512)throw new Error(`HDKey: wrong seed length=${t.length}. Should be between 128 and 512 bits; 256 bits is advised)`);const r=Zi(hu,e1,t);return new xn({versions:n,chainCode:r.slice(32),privateKey:r.slice(0,32)})}static fromExtendedKey(t,n=ls){const r=is.decode(t),o=ye.createView(r),i=o.getUint32(0,!1),l={versions:n,depth:r[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:r.slice(13,45)},s=r.slice(45),u=s[0]===0;if(i!==n[u?"private":"public"])throw new Error("Version mismatch");return u?new xn({...l,privateKey:s.slice(1)}):new xn({...l,publicKey:s})}static fromJSON(t){return xn.fromExtendedKey(t.xpriv)}derive(t){if(!/^[mM]'?/.test(t))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(t))return this;const n=t.replace(/^[mM]'?\//,"").split("/");let r=this;for(const o of n){const i=/^(\d+)('?)$/.exec(o);if(!i||i.length!==3)throw new Error(`Invalid child index: ${o}`);let l=+i[1];if(!Number.isSafeInteger(l)||l>=ss)throw new Error("Invalid index");i[2]==="'"&&(l+=ss),r=r.deriveChild(l)}return r}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let n=ui(t);if(t>=ss){const s=this.privateKey;if(!s)throw new Error("Could not derive hardened child key");n=ye.concatBytes(new Uint8Array([0]),s,n)}else n=ye.concatBytes(this.pubKey,n);const r=Zi(hu,this.chainCode,n),o=sf(r.slice(0,32)),i=r.slice(32);if(!B.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");const l={versions:this.versions,chainCode:i,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){const s=B.mod(this.privKey+o,M.n);if(!B.isValidPrivateKey(s))throw new Error("The tweak was out of range or the resulted private key is invalid");l.privateKey=s}else l.publicKey=j.fromHex(this.pubKey).add(j.fromPrivateKey(o)).toRawBytes(!0);return new xn(l)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return Un(t,32),By(t,this.privKey,{canonical:!0,der:!1})}verify(t,n){if(Un(t,32),Un(n,64),!this.publicKey)throw new Error("No publicKey set!");let r;try{r=Ct.fromCompact(n)}catch{return!1}return Fy(r,t,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(t,n){if(!this.chainCode)throw new Error("No chainCode set");return Un(n,33),ye.concatBytes(ui(t),new Uint8Array([this.depth]),ui(this.parentFingerprint),ui(this.index),this.chainCode,n)}}class Ap extends cu{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Wy(t);const r=ya(n);if(this.iHash=t.create(),!(this.iHash instanceof cu))throw new TypeError("Expected instance of class which extends utils.Hash");const o=this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const i=new Uint8Array(o);i.set(r.length>this.iHash.blockLen?t.create().update(r).digest():r);for(let l=0;lnew Ap(e,t).update(n).digest();qi.create=(e,t)=>new Ap(e,t);qi.init=qi.create;var r1=Object.defineProperty,Ro=(e,t)=>{for(var n in t)r1(e,n,{get:t[n],enumerable:!0})};function Np(){return B.bytesToHex(B.randomPrivateKey())}function Ji(e){return B.bytesToHex(No.getPublicKey(e))}var mu=new TextDecoder("utf-8"),Cr=new TextEncoder;function o1(){return{kind:255,pubkey:"",content:"",tags:[],created_at:0}}function i1(e){return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function kl(e){let t=Io(Cr.encode(i1(e)));return B.bytesToHex(t)}function l1(e){if(e.id!==kl(e)||typeof e.content!="string"||typeof e.created_at!="number"||!Array.isArray(e.tags))return!1;for(let t=0;ti===n.slice(1)&&o.indexOf(l)!==-1))return!1}return!(e.since&&t.created_at=e.until)}function a1(e,t){for(let n=0;n{t=new WebSocket(e),t.onopen=()=>{i.connect.forEach(w=>w()),d()},t.onerror=()=>{i.error.forEach(w=>w()),p()},t.onclose=async()=>{i.disconnect.forEach(w=>w()),n&&n()},t.onmessage=async w=>{var E,m,h,y;var v;try{v=JSON.parse(w.data)}catch{v=w.data}if(v.length>=1)switch(v[0]){case"EVENT":if(v.length!==3)return;let g=v[1],x=v[2];l1(x)&&o[g]&&(o[g].skipVerification||s1(x))&&a1(o[g].filters,x)&&(o[g],(((E=l[g])==null?void 0:E.event)||[]).forEach(S=>S(x)));return;case"EOSE":{if(v.length!==2)return;let S=v[1];(((m=l[S])==null?void 0:m.eose)||[]).forEach(T=>T());return}case"OK":{if(v.length<3)return;let S=v[1],T=v[2],R=v[3]||"";T?(h=s[S])==null||h.ok.forEach(b=>b()):(y=s[S])==null||y.failed.forEach(b=>b(R));return}case"NOTICE":if(v.length!==2)return;let C=v[1];i.notice.forEach(S=>S(C));return}}})}async function a(){t!=null&&t.readyState&&t.readyState===1||await u()}async function f(d){let p=JSON.stringify(d);await r,t.send(p)}const c=(d,{skipVerification:p=!1,id:w=Math.random().toString().slice(2)}={})=>{let v=w;return o[v]={id:v,filters:d,skipVerification:p},f(["REQ",v,...d]),{sub:(E,m={})=>c(E||d,{skipVerification:m.skipVerification||p,id:v}),unsub:()=>{delete o[v],delete l[v],f(["CLOSE",v])},on:(E,m)=>{l[v]=l[v]||{event:[],eose:[]},l[v][E].push(m)},off:(E,m)=>{let h=l[v],y=h[E].indexOf(m);y>=0&&h[E].splice(y,1)}}};return{url:e,sub:c,on:(d,p)=>{i[d].push(p),d==="connect"&&(t==null?void 0:t.readyState)===1&&p()},off:(d,p)=>{let w=i[d].indexOf(p);w!==-1&&i[d].splice(w,1)},publish(d){if(!d.id)throw new Error(`event ${d} has no id`);let p=d.id;var w=!1,v=!1;f(["EVENT",d]).then(()=>{w=!0,v&&(E(),v=!1)}).catch(()=>{});const E=()=>{let m=c([{ids:[p]}],{id:`monitor-${p.slice(0,5)}`}),h=setTimeout(()=>{var y;(((y=s[p])==null?void 0:y.failed)||[]).forEach(g=>g("event not seen after 5 seconds")),m.unsub()},5e3);m.on("event",()=>{var y;clearTimeout(h),(((y=s[p])==null?void 0:y.seen)||[]).forEach(g=>g())})};return{on:(m,h)=>{s[p]=s[p]||{ok:[],seen:[],failed:[]},s[p][m].push(h),m==="seen"&&(w?E():v=!0)},off:(m,h)=>{let y=s[p];if(!y)return;let g=y[m].indexOf(h);g>=0&&y[m].splice(g,1)}}},connect:a,close(){return t.close(),new Promise(d=>{n=d})},get status(){return(t==null?void 0:t.readyState)??3}}}var f1={};Ro(f1,{decrypt:()=>h1,encrypt:()=>d1});async function d1(e,t,n){const r=$h(e,"02"+t),o=Ip(r);let i=Uint8Array.from(Gy(16)),l=Cr.encode(n),s=await crypto.subtle.importKey("raw",o,{name:"AES-CBC"},!1,["encrypt"]),u=await crypto.subtle.encrypt({name:"AES-CBC",iv:i},s,l),a=vr.encode(new Uint8Array(u)),f=vr.encode(new Uint8Array(i.buffer));return`${a}?iv=${f}`}async function h1(e,t,n){let[r,o]=n.split("?iv="),i=$h(e,"02"+t),l=Ip(i),s=await crypto.subtle.importKey("raw",l,{name:"AES-CBC"},!1,["decrypt"]),u=vr.decode(r),a=vr.decode(o),f=await crypto.subtle.decrypt({name:"AES-CBC",iv:a},s,u);return mu.decode(f)}function Ip(e){return e.slice(1,33)}var p1={};Ro(p1,{queryProfile:()=>g1,searchDomain:()=>y1,useFetchImplementation:()=>m1});var El;try{El=fetch}catch{}function m1(e){El=e}async function y1(e,t=""){try{return(await(await El(`https://${e}/.well-known/nostr.json?name=${t}`)).json()).names}catch{return{}}}async function g1(e){var l,s;let[t,n]=e.split("@");if(n||(n=t,t="_"),!t.match(/^[a-z0-9-_]+$/))return null;let r=await(await El(`https://${n}/.well-known/nostr.json?name=${t}`)).json();if(!((l=r==null?void 0:r.names)!=null&&l[t]))return null;let o=r.names[t],i=((s=r.relays)==null?void 0:s[o])||[];return{pubkey:o,relays:i}}var v1={};Ro(v1,{generateSeedWords:()=>x1,privateKeyFromSeedWords:()=>w1,validateWords:()=>k1});function w1(e){let n=xn.fromMasterSeed(fp(e)).derive("m/44'/1237'/0'/0/0").privateKey;if(!n)throw new Error("could not derive private key");return B.bytesToHex(n)}function x1(){return gp(wa)}function k1(e){return kp(e,wa)}var E1={};Ro(E1,{decode:()=>S1,neventEncode:()=>A1,noteEncode:()=>_1,nprofileEncode:()=>T1,npubEncode:()=>C1,nsecEncode:()=>b1});function S1(e){var o,i;let{prefix:t,words:n}=It.decode(e,1e3),r=new Uint8Array(It.fromWords(n));if(t==="nprofile"){let l=uf(r);if(!((o=l[0])!=null&&o[0]))throw new Error("missing TLV 0 for nprofile");if(l[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:B.bytesToHex(l[0][0]),relays:l[1].map(s=>mu.decode(s))}}}if(t==="nevent"){let l=uf(r);if(!((i=l[0])!=null&&i[0]))throw new Error("missing TLV 0 for nevent");if(l[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nevent",data:{id:B.bytesToHex(l[0][0]),relays:l[1].map(s=>mu.decode(s))}}}if(t==="nsec"||t==="npub"||t==="note")return{type:t,data:B.bytesToHex(r)};throw new Error(`unknown prefix ${t}`)}function uf(e){let t={},n=e;for(;n.length>0;){let r=n[0],o=n[1],i=n.slice(2,2+o);n=n.slice(2+o),!(i.lengthCr.encode(r))}),n=It.toWords(t);return It.encode("nprofile",n,1e3)}function A1(e){let t=Lp({0:[B.hexToBytes(e.id)],1:(e.relays||[]).map(r=>Cr.encode(r))}),n=It.toWords(t);return It.encode("nevent",n,1e3)}function Lp(e){let t=[];return Object.entries(e).forEach(([n,r])=>{r.forEach(o=>{let i=new Uint8Array(o.length+2);i.set([parseInt(n)],0),i.set([o.length],1),i.set(o,2),t.push(i)})}),B.concatBytes(...t)}var N1={};Ro(N1,{createDelegation:()=>I1,getDelegator:()=>L1});function I1(e,t){let n=[];(t.kind||-1)>=0&&n.push(`kind=${t.kind}`),t.until&&n.push(`created_at<${t.until}`),t.since&&n.push(`created_at>${t.since}`);let r=n.join("&");if(r==="")throw new Error("refusing to create a delegation without any conditions");let o=Io(Cr.encode(`nostr:delegation:${t.pubkey}:${r}`)),i=B.bytesToHex(No.signSync(o,e));return{from:Ji(e),to:t.pubkey,cond:r,sig:i}}function L1(e){let t=e.tags.find(s=>s[0]==="delegation"&&s.length>=4);if(!t)return null;let n=t[1],r=t[2],o=t[3],i=r.split("&");for(let s=0;s"&&e.created_at>parseInt(f))continue;return null}}let l=Io(Cr.encode(`nostr:delegation:${e.pubkey}:${r}`));return No.verifySync(o,l,n)?n:null}B.hmacSha256Sync=(e,...t)=>qi(Io,e,B.concatBytes(...t));B.sha256Sync=(...e)=>Io(B.concatBytes(...e));const Ho=e=>e.map(n=>c1(n)),Pp=(e,t,n)=>new Promise((r,o)=>{const{relays:i}=e,l=Ho(i);let s=[],u=0,a={};localStorage.getItem(`e:${t.id}`)&&(a=JSON.parse(localStorage.getItem(`e:${t.id}`)),s=a.comments,s&&!n&&r(s),u=n?0:a.updated_at);let f=!1;l.map(async c=>{try{await c.connect();const d=c.sub([{limit:100,kinds:[1],since:u,"#e":[t.id]}]);d.on("event",p=>{s.push(p),localStorage.getItem(`e:${p.id}`)||localStorage.setItem(`e:${p.id}`,JSON.stringify(p))}),d.on("eose",()=>{const p=s.filter((v,E,m)=>E===m.findIndex(h=>h.id===v.id)),w=Math.floor(new Date().getTime()/1e3);(!(a!=null&&a.updated_at)||(a==null?void 0:a.updated_at)new Promise((n,r)=>{let o={pubkey:e,created_at:0};if(localStorage.getItem(`p:${e}`)&&(o=JSON.parse(localStorage.getItem(`p:${e}`)),o.created_at>0)){n(o);return}Ho(t).map(async l=>{await l.connect();const s=l.sub([{kinds:[0],authors:[e]}]);s.on("event",u=>{(!o.created_at||u.created_at>o.created_at)&&(o={...o,...JSON.parse(u.content),created_at:u.created_at},localStorage.setItem(`p:${e}`,JSON.stringify(o)),n(o))}),s.on("eose",()=>{s.unsub(),l.close()})})}),P1=(e,t)=>new Promise((n,r)=>{const{pubkey:o,title:i,description:l,canonical:s,relays:u}=e,a=[];let f=i;o&&(a.push(["p",o]),f+=` by #[${a.length-1}]`),l&&(f+=`
-${l}`),f+=`
-More: ${s}
-
-Comments powered by Disgus`,a.push(["r",s]),a.push(["client","Disgus"]);const c={content:f,tags:a},d=Np(),p=Ji(d);c.pubkey=p,$p(c,{pubkey:p,privateKey:d},u).then(w=>{localStorage.setItem(`r:${s}`,JSON.stringify(w)),n(w)})}),$1=e=>new Promise(async(t,n)=>{const{pubkey:r,canonical:o,relays:i}=e,l=Ho(i);if(localStorage.getItem(`r:${o}`)){t(JSON.parse(localStorage.getItem(`r:${o}`)));return}const s={"#r":[o]};r&&(s["#p"]=[r]),l.map(async(u,a)=>{await u.connect();const f=u.sub([{limit:1,kinds:[1],...s}]);f.on("event",c=>{localStorage.setItem(`r:${o}`,JSON.stringify(c)),t(c)}),f.on("eose",()=>{f.unsub(),u.close()})})}),$p=(e,t,n)=>new Promise(async(r,o)=>{const i=Ho(n);if(e.kind=1,e.created_at=Math.floor(Date.now()/1e3),e.id=kl(e),t&&t.privateKey)e.sig=yu(e,t.privateKey);else if(window.nostr){const{sig:s}=await window.nostr.signEvent(e);e.sig=s}else prompt("Enter your private key",""),e.sig=yu(e,t.privateKey);let l=!1;i.map(async s=>{await s.connect();const u=s.publish(e);u.on("seen",a=>{l||(r(e),l=!0)}),u.on("failed",a=>{alert(a.message)})})});function R1({title:e,titleId:t,...n},r){return k.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?k.createElement("title",{id:t},e):null,k.createElement("path",{fillRule:"evenodd",d:"M15.75 2.25H21a.75.75 0 01.75.75v5.25a.75.75 0 01-1.5 0V4.81L8.03 17.03a.75.75 0 01-1.06-1.06L19.19 3.75h-3.44a.75.75 0 010-1.5zm-10.5 4.5a1.5 1.5 0 00-1.5 1.5v10.5a1.5 1.5 0 001.5 1.5h10.5a1.5 1.5 0 001.5-1.5V10.5a.75.75 0 011.5 0v8.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V8.25a3 3 0 013-3h8.25a.75.75 0 010 1.5H5.25z",clipRule:"evenodd"}))}const H1=k.forwardRef(R1),z1=H1;function O1({title:e,titleId:t,...n},r){return k.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?k.createElement("title",{id:t},e):null,k.createElement("path",{fillRule:"evenodd",d:"M15 3.75A5.25 5.25 0 009.75 9v10.19l4.72-4.72a.75.75 0 111.06 1.06l-6 6a.75.75 0 01-1.06 0l-6-6a.75.75 0 111.06-1.06l4.72 4.72V9a6.75 6.75 0 0113.5 0v3a.75.75 0 01-1.5 0V9c0-2.9-2.35-5.25-5.25-5.25z",clipRule:"evenodd"}))}const B1=k.forwardRef(O1),U1=B1;function F1({title:e,titleId:t,...n},r){return k.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?k.createElement("title",{id:t},e):null,k.createElement("path",{fillRule:"evenodd",d:"M8.603 3.799A4.49 4.49 0 0112 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 013.498 1.307 4.491 4.491 0 011.307 3.497A4.49 4.49 0 0121.75 12a4.49 4.49 0 01-1.549 3.397 4.491 4.491 0 01-1.307 3.497 4.491 4.491 0 01-3.497 1.307A4.49 4.49 0 0112 21.75a4.49 4.49 0 01-3.397-1.549 4.49 4.49 0 01-3.498-1.306 4.491 4.491 0 01-1.307-3.498A4.49 4.49 0 012.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 011.307-3.497 4.49 4.49 0 013.497-1.307zm7.007 6.387a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z",clipRule:"evenodd"}))}const D1=k.forwardRef(F1),j1=D1;function M1({title:e,titleId:t,...n},r){return k.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?k.createElement("title",{id:t},e):null,k.createElement("path",{fillRule:"evenodd",d:"M12.53 16.28a.75.75 0 01-1.06 0l-7.5-7.5a.75.75 0 011.06-1.06L12 14.69l6.97-6.97a.75.75 0 111.06 1.06l-7.5 7.5z",clipRule:"evenodd"}))}const V1=k.forwardRef(M1),K1=V1;function W1({title:e,titleId:t,...n},r){return k.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?k.createElement("title",{id:t},e):null,k.createElement("path",{fillRule:"evenodd",d:"M4.5 12a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zm6 0a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zm6 0a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0z",clipRule:"evenodd"}))}const Q1=k.forwardRef(W1),G1=Q1;function Y1({title:e,titleId:t,...n},r){return k.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?k.createElement("title",{id:t},e):null,k.createElement("path",{fillRule:"evenodd",d:"M3.75 12a.75.75 0 01.75-.75h15a.75.75 0 010 1.5h-15a.75.75 0 01-.75-.75z",clipRule:"evenodd"}))}const X1=k.forwardRef(Y1),Z1=X1;function q1({title:e,titleId:t,...n},r){return k.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?k.createElement("title",{id:t},e):null,k.createElement("path",{fillRule:"evenodd",d:"M11.484 2.17a.75.75 0 011.032 0 11.209 11.209 0 007.877 3.08.75.75 0 01.722.515 12.74 12.74 0 01.635 3.985c0 5.942-4.064 10.933-9.563 12.348a.749.749 0 01-.374 0C6.314 20.683 2.25 15.692 2.25 9.75c0-1.39.223-2.73.635-3.985a.75.75 0 01.722-.516l.143.001c2.996 0 5.718-1.17 7.734-3.08zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zM12 15a.75.75 0 00-.75.75v.008c0 .414.336.75.75.75h.008a.75.75 0 00.75-.75v-.008a.75.75 0 00-.75-.75H12z",clipRule:"evenodd"}))}const J1=k.forwardRef(q1),ev=J1;function tv({title:e,titleId:t,...n},r){return k.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?k.createElement("title",{id:t},e):null,k.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"}))}const nv=k.forwardRef(tv),rv=nv;function ov({title:e,titleId:t,...n},r){return k.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?k.createElement("title",{id:t},e):null,k.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.625 12a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H8.25m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H12m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0h-.375M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))}const iv=k.forwardRef(ov),lv=iv;function sv({title:e,titleId:t,...n},r){return k.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?k.createElement("title",{id:t},e):null,k.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"}))}const uv=k.forwardRef(sv),av=uv,zo=de.createContext({}),cv=({config:e,children:t})=>{const[n,r]=k.useState(!1),[o,i]=k.useState(!1);return k.useEffect(()=>{n?Pp(e,n).then(l=>{i(l)}):$1(e).then(l=>{r(l)})},[n]),$(zo.Provider,{value:{config:e,rootEvent:n,setRootEvent:r,comments:o,setComments:i},children:t})},fv=zo.Consumer;function _a(){const{config:e,rootEvent:t,setRootEvent:n,comments:r,setComments:o}=k.useContext(zo);return{config:e,rootEvent:t,createRoot:()=>new Promise((s,u)=>{P1(e).then(a=>{n(a),s(a)})}),comments:r,refreshComments:()=>{Pp(e,t,!0).then(s=>{o(s)})}}}function dv({comment:e}){const{id:t,pubkey:n,content:r,tags:o,created_at:i}=e,{config:l,rootEvent:s}=_a(),[u,a]=k.useState(!1),f=new Date(i*1e3);k.useState();const[c,d]=k.useState();return k.useEffect(()=>{(!u||u.pubkey!==n)&&el(n,l.relays).then(p=>{a(p)})},[u,n]),k.useEffect(()=>{if(!c){const p=[],w=[];let v=r;o.forEach((E,m)=>{switch(v=v.replace(`#[${m}]`,`@${E[1]} `),E[0]){case"e":p.push(E[1]);break;case"p":w.push(E[1]);break}}),d(p[p.length-1])}},[c]),$("div",{className:"p-2 mx-auto",children:ke("div",{className:`flex items-top justify-between ${c!==s.id?"ml-14 sm:ml-20":""}`,children:[$("figure",{className:"w-12 sm:w-16 avatar mr-1 flex-basis",style:{flexGrow:0,flexShrink:0},children:u&&u.picture?$("img",{className:"object-cover rounded-full w-12 h-12 sm:w-12 sm:h-12 ring-2 ring-black",src:u.picture,style:{backgroundColor:`#${n.substr(0,6)}`,lineHeight:0}}):$("div",{className:"flex items-center justify-center w-12 h-12 sm:w-12 sm:h-12 ring-2 ring-black rounded-full uppercase text-black",style:{backgroundColor:`#${n.substr(0,6)}`,lineHeight:0,verticalAlign:"center"},children:$("span",{className:"text-3xl",children:n.substr(0,2)})})}),ke("div",{className:"flex-grow flex-shrink overflow-hidden",children:[ke("div",{className:"flex items-top justify-between",children:[ke("div",{className:"flex-shrink flex-grow overflow-hidden",children:[ke("a",{href:`https://snort.social/p/${n}`,target:"_blank",title:n,className:"text-lg block truncate",children:[c!==s.id?$(U1,{className:"inline w-4 h-4 -mt-1 mr-1 rotate-180"}):"",$("b",{children:u.display_name||u.name||n}),u.nip05?$("abbr",{title:u.nip05.replace("_@","@"),children:$(j1,{color:"purple",className:"-mt-1 mx-1 w-4 h-4 inline-block"})}):$("abbr",{className:"opacity-70",title:`No-NIP05 ${n}`,children:$(ev,{className:"-mt-1 mx-1 w-4 h-4 inline-block"})})]}),$("a",{href:`https://snort.social/e/${t}`,tit:!0,target:"_blank",le:t,className:"text-xs block whitespace-nowrap truncate opacity-70",children:ke("time",{dateTime:f.toISOString(),children:[$(rv,{className:"w-3 h-3 inline"})," ",Ey(f)]})})]}),ke("div",{className:"flex-basis ml-2 text-right",children:[$(Z1,{className:"w-6 h-6 hidden inline-block"}),$(G1,{className:"w-6 h-6 inline-block hidden"})]})]}),$("div",{className:"mt-2 text-md",children:$("p",{children:r})}),$("div",{className:"mt-2 text-md",children:ke("a",{href:`https://snort.social/e/${t}`,tit:!0,target:"_blank",le:t,className:"text-xs block whitespace-nowrap truncate opacity-70",children:["Reply on nostr",$(z1,{className:"w-3 h-3 inline-block ml-1"})]})})]})]})})}const qn="disgusUser",Ta=de.createContext(),hv=({children:e})=>{const{config:t}=k.useContext(zo),[n,r]=k.useState(!1);return k.useEffect(()=>{if(!n&&localStorage.getItem(qn)){const o=JSON.parse(localStorage.getItem(qn));r(o),el(o.pubkey,t.relays).then(i=>r({...o,...i}))}},[!n]),$(Ta.Provider,{value:{user:n,setUser:r},children:e})};Ta.Consumer;function Rp(){const{config:e}=k.useContext(zo),{relays:t}=e,{user:n,setUser:r}=k.useContext(Ta);return{user:n,signIn:()=>{if(!n)if(window.nostr)window.nostr.getPublicKey().then(s=>{el(s,t).then(u=>{localStorage.setItem(qn,JSON.stringify(u)),r(u)})});else{let s=prompt("Enter your private key","");Ji(s)?el(publicKey,t).then(a=>{localStorage.setItem(qn,JSON.stringify(a)),r({...s,_user:a})}):alert("Incorrect key.")}},signOut:()=>{localStorage.removeItem(qn),r(!1)},signInRandom:s=>{if(n)return;let u=s||prompt("What's your name?","Randy Rando");if(!u||u.length<=0)return;const a=Np(),f=Ji(a),c={name:u,about:"Random Guest"},d=o1();d.kind=0,d.pubkey=f,d.content=JSON.stringify(c),d.tags=[["client","Disgus"]],d.created_at=Math.floor(Date.now()/1e3),d.id=kl(d),d.sig=yu(d,a),Ho(t).map(async w=>{await w.connect();const v=w.publish(d);v.on("seen",()=>{n||(localStorage.setItem(qn,JSON.stringify({pubkey:f,privateKey:a,created_at:d.created_at,...c})),r({pubkey:f,privateKey:a,created_at:d.created_at,...c})),w.close()}),v.on("failed",()=>{w.close()})})}}}function af({children:e,Component:t="button",variant:n,className:r,...o}){let i=["rounded"];switch(n){case"primary":i.push("py-2","px-4","whitespace-nowrap","bg-black","text-white","font-bold");break;case"secondary":i.push("py-1","px-2","hover:ring","hover:ring-gray-300");break;default:i.push("");break}return r&&i.push(r),$(t,{className:i.join(" "),...o,children:e})}function pv(){const{config:e,rootEvent:t,createRoot:n,refreshComments:r}=_a(),{pubkey:o,relays:i}=e,[l,s]=k.useState(""),[u,a]=k.useState(!1),{user:f,signIn:c,signInRandom:d}=Rp(),p=async v=>{const E=[["e",v,i[0],"root"]];o&&E.push(["p",o]),E.push(["client","Disgus"]),l.length>0&&$p({pubkey:f.pubkey,content:l,tags:E},f,i).then(()=>{s(""),r()})};let w=setTimeout(()=>{},0);return $(If,{children:ke("form",{className:"relative appearance-none bg-white/10 bg-opacity-65 backdrop-blur-md font-mono rounded","aria-disabled":!f,onSubmit:async v=>{v.preventDefault(),t?await p(t.id):n().then(async E=>{await p(E.id)})},onFocus:v=>{clearTimeout(w),a(!0)},onBlur:v=>{w=setTimeout(()=>a(!1),100)},children:[$("textarea",{className:"w-full p-2 m-0 bg-white/10 bg-opacity-65 backdrop-blur-md focus:outline-none rounded-lg",id:"comment",placeholder:"Join the discussion...",value:l,rows:u||l.length>0?3:1,onChange:v=>{s(v.target.value)}}),(u||l.length>0)&&ke("div",{className:"bg-none text-white/75 m-0 px-2 py-1 flex items-center justify-between",children:[t?ke("a",{className:"block whitespace-nowrap truncate",rel:"nostr:event",href:`nostr:e:${t.id}`,title:`re: ${t.id}`,children:[$(av,{className:"inline-block",width:18})," ",t.id]}):$(lv,{width:18}),f?$(af,{type:"submit",variant:"primary",children:"Comment"}):$("div",{className:"whitespace-nowrap",children:$(af,{type:"button",variant:"primary",className:"mr-2 bg-lime-600 text-black",onClick:v=>{v.preventDefault(),c()},children:"Sign In"},"plugin")})]})]})})}const Hp=typeof window>"u"||typeof document>"u";let Ye=Hp?k.useEffect:k.useLayoutEffect;function Tn(e){let t=k.useRef(e);return Ye(()=>{t.current=e},[e]),t}function mv(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function un(){let e=[],t=[],n={enqueue(r){t.push(r)},addEventListener(r,o,i,l){return r.addEventListener(o,i,l),n.add(()=>r.removeEventListener(o,i,l))},requestAnimationFrame(...r){let o=requestAnimationFrame(...r);return n.add(()=>cancelAnimationFrame(o))},nextFrame(...r){return n.requestAnimationFrame(()=>n.requestAnimationFrame(...r))},setTimeout(...r){let o=setTimeout(...r);return n.add(()=>clearTimeout(o))},microTask(...r){let o={current:!0};return mv(()=>{o.current&&r[0]()}),n.add(()=>{o.current=!1})},add(r){return e.push(r),()=>{let o=e.indexOf(r);if(o>=0){let[i]=e.splice(o,1);i()}}},dispose(){for(let r of e.splice(0))r()},async workQueue(){for(let r of t.splice(0))await r()}};return n}function Sl(){let[e]=k.useState(un);return k.useEffect(()=>()=>e.dispose(),[e]),e}let se=function(e){let t=Tn(e);return de.useCallback((...n)=>t.current(...n),[t])},us={serverHandoffComplete:!1};function Aa(){let[e,t]=k.useState(us.serverHandoffComplete);return k.useEffect(()=>{e!==!0&&t(!0)},[e]),k.useEffect(()=>{us.serverHandoffComplete===!1&&(us.serverHandoffComplete=!0)},[]),e}var cf;let yv=0;function ff(){return++yv}let Na=(cf=de.useId)!=null?cf:function(){let e=Aa(),[t,n]=de.useState(e?ff:null);return Ye(()=>{t===null&&n(ff())},[t]),t!=null?""+t:void 0};function Ie(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ie),r}function bl(e){return Hp?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let gu=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var vu=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(vu||{}),gv=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(gv||{}),vv=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(vv||{});function zp(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(gu)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ia=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ia||{});function La(e,t=0){var n;return e===((n=bl(e))==null?void 0:n.body)?!1:Ie(t,{[0](){return e.matches(gu)},[1](){let r=e;for(;r!==null;){if(r.matches(gu))return!0;r=r.parentElement}return!1}})}function Op(e){let t=bl(e);un().nextFrame(()=>{t&&!La(t.activeElement,0)&&wv(e)})}function wv(e){e==null||e.focus({preventScroll:!0})}let xv=["textarea","input"].join(",");function kv(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,xv))!=null?n:!1}function Bp(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),i=t(r);if(o===null||i===null)return 0;let l=o.compareDocumentPosition(i);return l&Node.DOCUMENT_POSITION_FOLLOWING?-1:l&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Ev(e,t){return Sv(zp(),t,{relativeTo:e})}function Sv(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,l=Array.isArray(e)?n?Bp(e):e:zp(e);o.length>0&&(l=l.filter(p=>!o.includes(p))),r=r??i.activeElement;let s=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,l.indexOf(r))-1;if(t&4)return Math.max(0,l.indexOf(r))+1;if(t&8)return l.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=t&32?{preventScroll:!0}:{},f=0,c=l.length,d;do{if(f>=c||f+c<=0)return 0;let p=u+f;if(t&16)p=(p+c)%c;else{if(p<0)return 3;if(p>=c)return 1}d=l[p],d==null||d.focus(a),f+=s}while(d!==i.activeElement);return t&6&&kv(d)&&d.select(),d.hasAttribute("tabindex")||d.setAttribute("tabindex","0"),2}function as(e,t,n){let r=Tn(t);k.useEffect(()=>{function o(i){r.current(i)}return document.addEventListener(e,o,n),()=>document.removeEventListener(e,o,n)},[e,n])}function bv(e,t,n=!0){let r=k.useRef(!1);k.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function o(l,s){if(!r.current||l.defaultPrevented)return;let u=function f(c){return typeof c=="function"?f(c()):Array.isArray(c)||c instanceof Set?c:[c]}(e),a=s(l);if(a!==null&&a.getRootNode().contains(a)){for(let f of u){if(f===null)continue;let c=f instanceof HTMLElement?f:f.current;if(c!=null&&c.contains(a)||l.composed&&l.composedPath().includes(c))return}return!La(a,Ia.Loose)&&a.tabIndex!==-1&&l.preventDefault(),t(l,a)}}let i=k.useRef(null);as("mousedown",l=>{var s,u;r.current&&(i.current=((u=(s=l.composedPath)==null?void 0:s.call(l))==null?void 0:u[0])||l.target)},!0),as("click",l=>{!i.current||(o(l,()=>i.current),i.current=null)},!0),as("blur",l=>o(l,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function df(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function Cv(e,t){let[n,r]=k.useState(()=>df(e));return Ye(()=>{r(df(e))},[e.type,e.as]),Ye(()=>{n||!t.current||t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let _v=Symbol();function _r(...e){let t=k.useRef(e);k.useEffect(()=>{t.current=e},[e]);let n=se(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[_v]))?void 0:n}function Tv({container:e,accept:t,walk:n,enabled:r=!0}){let o=k.useRef(t),i=k.useRef(n);k.useEffect(()=>{o.current=t,i.current=n},[t,n]),Ye(()=>{if(!e||!r)return;let l=bl(e);if(!l)return;let s=o.current,u=i.current,a=Object.assign(c=>s(c),{acceptNode:s}),f=l.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,a,!1);for(;f.nextNode();)u(f.currentNode)},[e,r,o,i])}function Av(e){throw new Error("Unexpected object: "+e)}var rt=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(rt||{});function Nv(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1,i=(()=>{switch(e.focus){case 0:return n.findIndex(l=>!t.resolveDisabled(l));case 1:{let l=n.slice().reverse().findIndex((s,u,a)=>o!==-1&&a.length-u-1>=o?!1:!t.resolveDisabled(s));return l===-1?l:n.length-1-l}case 2:return n.findIndex((l,s)=>s<=o?!1:!t.resolveDisabled(l));case 3:{let l=n.slice().reverse().findIndex(s=>!t.resolveDisabled(s));return l===-1?l:n.length-1-l}case 4:return n.findIndex(l=>t.resolveId(l)===e.id);case 5:return null;default:Av(e)}})();return i===-1?r:i}var tl=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(tl||{}),St=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(St||{});function Tr({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:l}){let s=Up(t,e);if(i)return ai(s,n,r,l);let u=o??0;if(u&2){let{static:a=!1,...f}=s;if(a)return ai(f,n,r,l)}if(u&1){let{unmount:a=!0,...f}=s;return Ie(a?0:1,{[0](){return null},[1](){return ai({...f,hidden:!0,style:{display:"none"}},n,r,l)}})}return ai(s,n,r,l)}function ai(e,t={},n,r){let{as:o=n,children:i,refName:l="ref",...s}=cs(e,["unmount","static"]),u=e.ref!==void 0?{[l]:e.ref}:{},a=typeof i=="function"?i(t):i;s.className&&typeof s.className=="function"&&(s.className=s.className(t));let f={};if(t){let c=!1,d=[];for(let[p,w]of Object.entries(t))typeof w=="boolean"&&(c=!0),w===!0&&d.push(p);c&&(f["data-headlessui-state"]=d.join(" "))}if(o===k.Fragment&&Object.keys(hf(s)).length>0){if(!k.isValidElement(a)||Array.isArray(a)&&a.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(s).map(c=>` - ${c}`).join(`
-`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(c=>` - ${c}`).join(`
-`)].join(`
-`));return k.cloneElement(a,Object.assign({},Up(a.props,hf(cs(s,["ref"]))),f,u,Iv(a.ref,u.ref)))}return k.createElement(o,Object.assign({},cs(s,["ref"]),o!==k.Fragment&&u,o!==k.Fragment&&f),a)}function Iv(...e){return{ref:e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}}function Up(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...i){let l=n[r];for(let s of l){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;s(o,...i)}}});return t}function zn(e){var t;return Object.assign(k.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function hf(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function cs(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Lv(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Pv(n)?!1:r}function Pv(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}let Pa=k.createContext(null);Pa.displayName="OpenClosedContext";var an=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(an||{});function $a(){return k.useContext(Pa)}function Fp({value:e,children:t}){return de.createElement(Pa.Provider,{value:e},t)}var me=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(me||{});function pf(e){return[e.screenX,e.screenY]}function $v(){let e=k.useRef([-1,-1]);return{wasMoved(t){let n=pf(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=pf(t)}}}function Dp(){let e=k.useRef(!1);return Ye(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Rv(...e){return k.useMemo(()=>bl(...e),[...e])}var Hv=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Hv||{}),zv=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(zv||{}),Ov=(e=>(e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem",e))(Ov||{});function fs(e,t=n=>n){let n=e.activeItemIndex!==null?e.items[e.activeItemIndex]:null,r=Bp(t(e.items.slice()),i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{items:r,activeItemIndex:o}}let Bv={[1](e){return e.menuState===1?e:{...e,activeItemIndex:null,menuState:1}},[0](e){return e.menuState===0?e:{...e,menuState:0}},[2]:(e,t)=>{var n;let r=fs(e),o=Nv(t,{resolveItems:()=>r.items,resolveActiveIndex:()=>r.activeItemIndex,resolveId:i=>i.id,resolveDisabled:i=>i.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeItemIndex:o,activationTrigger:(n=t.trigger)!=null?n:1}},[3]:(e,t)=>{let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeItemIndex!==null?e.items.slice(e.activeItemIndex+n).concat(e.items.slice(0,e.activeItemIndex+n)):e.items).find(l=>{var s;return((s=l.dataRef.current.textValue)==null?void 0:s.startsWith(r))&&!l.dataRef.current.disabled}),i=o?e.items.indexOf(o):-1;return i===-1||i===e.activeItemIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeItemIndex:i,activationTrigger:1}},[4](e){return e.searchQuery===""?e:{...e,searchQuery:"",searchActiveItemIndex:null}},[5]:(e,t)=>{let n=fs(e,r=>[...r,{id:t.id,dataRef:t.dataRef}]);return{...e,...n}},[6]:(e,t)=>{let n=fs(e,r=>{let o=r.findIndex(i=>i.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...n,activationTrigger:1}}},Ra=k.createContext(null);Ra.displayName="MenuContext";function Cl(e){let t=k.useContext(Ra);if(t===null){let n=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Cl),n}return t}function Uv(e,t){return Ie(t.type,Bv,e,t)}let Fv=k.Fragment,Dv=zn(function(e,t){let n=k.useReducer(Uv,{menuState:1,buttonRef:k.createRef(),itemsRef:k.createRef(),items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1}),[{menuState:r,itemsRef:o,buttonRef:i},l]=n,s=_r(t);bv([i,o],(d,p)=>{var w;l({type:1}),La(p,Ia.Loose)||(d.preventDefault(),(w=i.current)==null||w.focus())},r===0);let u=se(()=>{l({type:1})}),a=k.useMemo(()=>({open:r===0,close:u}),[r,u]),f=e,c={ref:s};return de.createElement(Ra.Provider,{value:n},de.createElement(Fp,{value:Ie(r,{[0]:an.Open,[1]:an.Closed})},Tr({ourProps:c,theirProps:f,slot:a,defaultTag:Fv,name:"Menu"})))}),jv="button",Mv=zn(function(e,t){var n;let r=Na(),{id:o=`headlessui-menu-button-${r}`,...i}=e,[l,s]=Cl("Menu.Button"),u=_r(l.buttonRef,t),a=Sl(),f=se(v=>{switch(v.key){case me.Space:case me.Enter:case me.ArrowDown:v.preventDefault(),v.stopPropagation(),s({type:0}),a.nextFrame(()=>s({type:2,focus:rt.First}));break;case me.ArrowUp:v.preventDefault(),v.stopPropagation(),s({type:0}),a.nextFrame(()=>s({type:2,focus:rt.Last}));break}}),c=se(v=>{switch(v.key){case me.Space:v.preventDefault();break}}),d=se(v=>{if(Lv(v.currentTarget))return v.preventDefault();e.disabled||(l.menuState===0?(s({type:1}),a.nextFrame(()=>{var E;return(E=l.buttonRef.current)==null?void 0:E.focus({preventScroll:!0})})):(v.preventDefault(),s({type:0})))}),p=k.useMemo(()=>({open:l.menuState===0}),[l]),w={ref:u,id:o,type:Cv(e,l.buttonRef),"aria-haspopup":"menu","aria-controls":(n=l.itemsRef.current)==null?void 0:n.id,"aria-expanded":e.disabled?void 0:l.menuState===0,onKeyDown:f,onKeyUp:c,onClick:d};return Tr({ourProps:w,theirProps:i,slot:p,defaultTag:jv,name:"Menu.Button"})}),Vv="div",Kv=tl.RenderStrategy|tl.Static,Wv=zn(function(e,t){var n,r;let o=Na(),{id:i=`headlessui-menu-items-${o}`,...l}=e,[s,u]=Cl("Menu.Items"),a=_r(s.itemsRef,t),f=Rv(s.itemsRef),c=Sl(),d=$a(),p=(()=>d!==null?d===an.Open:s.menuState===0)();k.useEffect(()=>{let h=s.itemsRef.current;!h||s.menuState===0&&h!==(f==null?void 0:f.activeElement)&&h.focus({preventScroll:!0})},[s.menuState,s.itemsRef,f]),Tv({container:s.itemsRef.current,enabled:s.menuState===0,accept(h){return h.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:h.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(h){h.setAttribute("role","none")}});let w=se(h=>{var y,g;switch(c.dispose(),h.key){case me.Space:if(s.searchQuery!=="")return h.preventDefault(),h.stopPropagation(),u({type:3,value:h.key});case me.Enter:if(h.preventDefault(),h.stopPropagation(),u({type:1}),s.activeItemIndex!==null){let{dataRef:x}=s.items[s.activeItemIndex];(g=(y=x.current)==null?void 0:y.domRef.current)==null||g.click()}Op(s.buttonRef.current);break;case me.ArrowDown:return h.preventDefault(),h.stopPropagation(),u({type:2,focus:rt.Next});case me.ArrowUp:return h.preventDefault(),h.stopPropagation(),u({type:2,focus:rt.Previous});case me.Home:case me.PageUp:return h.preventDefault(),h.stopPropagation(),u({type:2,focus:rt.First});case me.End:case me.PageDown:return h.preventDefault(),h.stopPropagation(),u({type:2,focus:rt.Last});case me.Escape:h.preventDefault(),h.stopPropagation(),u({type:1}),un().nextFrame(()=>{var x;return(x=s.buttonRef.current)==null?void 0:x.focus({preventScroll:!0})});break;case me.Tab:h.preventDefault(),h.stopPropagation(),u({type:1}),un().nextFrame(()=>{Ev(s.buttonRef.current,h.shiftKey?vu.Previous:vu.Next)});break;default:h.key.length===1&&(u({type:3,value:h.key}),c.setTimeout(()=>u({type:4}),350));break}}),v=se(h=>{switch(h.key){case me.Space:h.preventDefault();break}}),E=k.useMemo(()=>({open:s.menuState===0}),[s]),m={"aria-activedescendant":s.activeItemIndex===null||(n=s.items[s.activeItemIndex])==null?void 0:n.id,"aria-labelledby":(r=s.buttonRef.current)==null?void 0:r.id,id:i,onKeyDown:w,onKeyUp:v,role:"menu",tabIndex:0,ref:a};return Tr({ourProps:m,theirProps:l,slot:E,defaultTag:Vv,features:Kv,visible:p,name:"Menu.Items"})}),Qv=k.Fragment,Gv=zn(function(e,t){let n=Na(),{id:r=`headlessui-menu-item-${n}`,disabled:o=!1,...i}=e,[l,s]=Cl("Menu.Item"),u=l.activeItemIndex!==null?l.items[l.activeItemIndex].id===r:!1,a=k.useRef(null),f=_r(t,a);Ye(()=>{if(l.menuState!==0||!u||l.activationTrigger===0)return;let g=un();return g.requestAnimationFrame(()=>{var x,C;(C=(x=a.current)==null?void 0:x.scrollIntoView)==null||C.call(x,{block:"nearest"})}),g.dispose},[a,u,l.menuState,l.activationTrigger,l.activeItemIndex]);let c=k.useRef({disabled:o,domRef:a});Ye(()=>{c.current.disabled=o},[c,o]),Ye(()=>{var g,x;c.current.textValue=(x=(g=a.current)==null?void 0:g.textContent)==null?void 0:x.toLowerCase()},[c,a]),Ye(()=>(s({type:5,id:r,dataRef:c}),()=>s({type:6,id:r})),[c,r]);let d=se(()=>{s({type:1})}),p=se(g=>{if(o)return g.preventDefault();s({type:1}),Op(l.buttonRef.current)}),w=se(()=>{if(o)return s({type:2,focus:rt.Nothing});s({type:2,focus:rt.Specific,id:r})}),v=$v(),E=se(g=>v.update(g)),m=se(g=>{!v.wasMoved(g)||o||u||s({type:2,focus:rt.Specific,id:r,trigger:0})}),h=se(g=>{!v.wasMoved(g)||o||!u||s({type:2,focus:rt.Nothing})}),y=k.useMemo(()=>({active:u,disabled:o,close:d}),[u,o,d]);return Tr({ourProps:{id:r,ref:f,role:"menuitem",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,disabled:void 0,onClick:p,onFocus:w,onPointerEnter:E,onMouseEnter:E,onPointerMove:m,onMouseMove:m,onPointerLeave:h,onMouseLeave:h},theirProps:i,slot:y,defaultTag:Qv,name:"Menu.Item"})}),Ur=Object.assign(Dv,{Button:Mv,Items:Wv,Item:Gv});function Yv(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function ds(e,...t){e&&t.length>0&&e.classList.add(...t)}function hs(e,...t){e&&t.length>0&&e.classList.remove(...t)}function Xv(e,t){let n=un();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[i,l]=[r,o].map(s=>{let[u=0]=s.split(",").filter(Boolean).map(a=>a.includes("ms")?parseFloat(a):parseFloat(a)*1e3).sort((a,f)=>f-a);return u});if(i+l!==0){let s=n.addEventListener(e,"transitionend",u=>{u.target===u.currentTarget&&(t(),s())})}else t();return n.add(()=>t()),n.dispose}function Zv(e,t,n,r){let o=n?"enter":"leave",i=un(),l=r!==void 0?Yv(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let s=Ie(o,{enter:()=>t.enter,leave:()=>t.leave}),u=Ie(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),a=Ie(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return hs(e,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),ds(e,...s,...a),i.nextFrame(()=>{hs(e,...a),ds(e,...u),Xv(e,()=>(hs(e,...s),ds(e,...t.entered),l()))}),i.dispose}function qv({container:e,direction:t,classes:n,onStart:r,onStop:o}){let i=Dp(),l=Sl(),s=Tn(t);Ye(()=>{let u=un();l.add(u.dispose);let a=e.current;if(a&&s.current!=="idle"&&i.current)return u.dispose(),r.current(s.current),u.add(Zv(a,n.current,s.current==="enter",()=>{u.dispose(),o.current(s.current)})),u.dispose},[t])}function Jv(...e){return e.filter(Boolean).join(" ")}function gn(e=""){return e.split(" ").filter(t=>t.trim().length>1)}let _l=k.createContext(null);_l.displayName="TransitionContext";var ew=(e=>(e.Visible="visible",e.Hidden="hidden",e))(ew||{});function tw(){let e=k.useContext(_l);if(e===null)throw new Error("A is used but it is missing a parent or .");return e}function nw(){let e=k.useContext(Tl);if(e===null)throw new Error("A is used but it is missing a parent or .");return e}let Tl=k.createContext(null);Tl.displayName="NestingContext";function Al(e){return"children"in e?Al(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function jp(e,t){let n=Tn(e),r=k.useRef([]),o=Dp(),i=Sl(),l=se((p,w=St.Hidden)=>{let v=r.current.findIndex(({el:E})=>E===p);v!==-1&&(Ie(w,{[St.Unmount](){r.current.splice(v,1)},[St.Hidden](){r.current[v].state="hidden"}}),i.microTask(()=>{var E;!Al(r)&&o.current&&((E=n.current)==null||E.call(n))}))}),s=se(p=>{let w=r.current.find(({el:v})=>v===p);return w?w.state!=="visible"&&(w.state="visible"):r.current.push({el:p,state:"visible"}),()=>l(p,St.Unmount)}),u=k.useRef([]),a=k.useRef(Promise.resolve()),f=k.useRef({enter:[],leave:[],idle:[]}),c=se((p,w,v)=>{u.current.splice(0),t&&(t.chains.current[w]=t.chains.current[w].filter(([E])=>E!==p)),t==null||t.chains.current[w].push([p,new Promise(E=>{u.current.push(E)})]),t==null||t.chains.current[w].push([p,new Promise(E=>{Promise.all(f.current[w].map(([m,h])=>h)).then(()=>E())})]),w==="enter"?a.current=a.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(w)):v(w)}),d=se((p,w,v)=>{Promise.all(f.current[w].splice(0).map(([E,m])=>m)).then(()=>{var E;(E=u.current.shift())==null||E()}).then(()=>v(w))});return k.useMemo(()=>({children:r,register:s,unregister:l,onStart:c,onStop:d,wait:a,chains:f}),[s,l,r,c,d,f,a])}function rw(){}let ow=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function mf(e){var t;let n={};for(let r of ow)n[r]=(t=e[r])!=null?t:rw;return n}function iw(e){let t=k.useRef(mf(e));return k.useEffect(()=>{t.current=mf(e)},[e]),t}let lw="div",Mp=tl.RenderStrategy,Vp=zn(function(e,t){let{beforeEnter:n,afterEnter:r,beforeLeave:o,afterLeave:i,enter:l,enterFrom:s,enterTo:u,entered:a,leave:f,leaveFrom:c,leaveTo:d,...p}=e,w=k.useRef(null),v=_r(w,t),E=p.unmount?St.Unmount:St.Hidden,{show:m,appear:h,initial:y}=tw(),[g,x]=k.useState(m?"visible":"hidden"),C=nw(),{register:S,unregister:T}=C,R=k.useRef(null);k.useEffect(()=>S(w),[S,w]),k.useEffect(()=>{if(E===St.Hidden&&w.current){if(m&&g!=="visible"){x("visible");return}return Ie(g,{hidden:()=>T(w),visible:()=>S(w)})}},[g,w,S,T,m,E]);let b=Tn({enter:gn(l),enterFrom:gn(s),enterTo:gn(u),entered:gn(a),leave:gn(f),leaveFrom:gn(c),leaveTo:gn(d)}),L=iw({beforeEnter:n,afterEnter:r,beforeLeave:o,afterLeave:i}),P=Aa();k.useEffect(()=>{if(P&&g==="visible"&&w.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[w,g,P]);let W=y&&!h,ne=(()=>!P||W||R.current===m?"idle":m?"enter":"leave")(),ut=se(H=>Ie(H,{enter:()=>L.current.beforeEnter(),leave:()=>L.current.beforeLeave(),idle:()=>{}})),pn=se(H=>Ie(H,{enter:()=>L.current.afterEnter(),leave:()=>L.current.afterLeave(),idle:()=>{}})),$t=jp(()=>{x("hidden"),T(w)},C);qv({container:w,classes:b,direction:ne,onStart:Tn(H=>{$t.onStart(w,H,ut)}),onStop:Tn(H=>{$t.onStop(w,H,pn),H==="leave"&&!Al($t)&&(x("hidden"),T(w))})}),k.useEffect(()=>{!W||(E===St.Hidden?R.current=null:R.current=m)},[m,W,g]);let N=p,z={ref:v};return h&&m&&(typeof window>"u"||typeof document>"u")&&(N={...N,className:Jv(p.className,...b.current.enter,...b.current.enterFrom)}),de.createElement(Tl.Provider,{value:$t},de.createElement(Fp,{value:Ie(g,{visible:an.Open,hidden:an.Closed})},Tr({ourProps:z,theirProps:N,defaultTag:lw,features:Mp,visible:g==="visible",name:"Transition.Child"})))}),wu=zn(function(e,t){let{show:n,appear:r=!1,unmount:o,...i}=e,l=k.useRef(null),s=_r(l,t);Aa();let u=$a();if(n===void 0&&u!==null&&(n=Ie(u,{[an.Open]:!0,[an.Closed]:!1})),![!0,!1].includes(n))throw new Error("A is used but it is missing a `show={true | false}` prop.");let[a,f]=k.useState(n?"visible":"hidden"),c=jp(()=>{f("hidden")}),[d,p]=k.useState(!0),w=k.useRef([n]);Ye(()=>{d!==!1&&w.current[w.current.length-1]!==n&&(w.current.push(n),p(!1))},[w,n]);let v=k.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);k.useEffect(()=>{if(n)f("visible");else if(!Al(c))f("hidden");else{let m=l.current;if(!m)return;let h=m.getBoundingClientRect();h.x===0&&h.y===0&&h.width===0&&h.height===0&&f("hidden")}},[n,c]);let E={unmount:o};return de.createElement(Tl.Provider,{value:c},de.createElement(_l.Provider,{value:v},Tr({ourProps:{...E,as:k.Fragment,children:de.createElement(Vp,{ref:s,...E,...i})},theirProps:{},defaultTag:k.Fragment,features:Mp,visible:a==="visible",name:"Transition"})))}),sw=zn(function(e,t){let n=k.useContext(_l)!==null,r=$a()!==null;return de.createElement(de.Fragment,null,!n&&r?de.createElement(wu,{ref:t,...e}):de.createElement(Vp,{ref:t,...e}))}),uw=Object.assign(wu,{Child:sw,Root:wu});function aw(){const{comments:e}=_a(),{user:t,signInRandom:n,signIn:r,signOut:o}=Rp();return ke("div",{className:"flex items-center justify-between",children:[$("div",{className:"whitespace-nowrap truncate",children:ke("b",{children:[e.length," Comments"]})}),ke(Ur,{as:"div",className:"relative block text-right",children:[$("div",{children:ke(Ur.Button,{className:"inline-flex align-center justify-center px-4 py-2",children:[$("figure",{className:"avatar placeholder mr-2",children:t&&t.picture?$("img",{className:"object-cover rounded-full w-6 h-6 ring-1 ring-black",src:t.picture,style:{backgroundColor:`#${t.pubkey.substr(0,6)}`,lineHeight:0}}):$("div",{className:"flex items-center justify-center w-6 h-6 ring-1 ring-black rounded-full uppercase text-black",style:{backgroundColor:`#${t.pubkey?t.pubkey.substr(0,6):"ffffff"}`,lineHeight:0,verticalAlign:"center"},children:$("span",{className:"text-md",children:t.pubkey?t.pubkey.substr(0,2):"?"})})}),t?$("b",{className:"inline-block whitespace-nowrap w-auto truncate",style:{maxWidth:"250px"},children:t.display_name||t.name||t.pubkey}):$("b",{children:"Login"}),$(K1,{className:"-mr-1 ml-1 w-4","aria-hidden":"true"})]})}),$(uw,{as:k.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:$(Ur.Items,{className:"absolute right-0 z-10 mt-2 w-56 origin-top-right rounded-md bg-white ring-1 ring-black ring-opacity-5 focus:outline-none",children:t?$("div",{className:"py-1",children:$(Ur.Item,{children:({active:i})=>$("a",{onClick:l=>{l.preventDefault(),o()},className:Vc(i?"bg-gray-100 text-gray-900":"text-gray-700","block px-4 py-2 text-sm"),children:"Sign Out"})})}):$("div",{className:"py-1",children:$(Ur.Item,{children:({active:i})=>$("a",{onClick:l=>{l.preventDefault(),r()},className:Vc(i?"bg-gray-100 text-gray-900":"text-gray-700","block px-4 py-2 text-sm"),children:"Sign In"})})})})})]})]})}function cw({config:e}){return $(cv,{config:e,children:$(hv,{children:ke("div",{className:"relative text-left overflow-hidden mx-auto px-2 sm:px-4",children:[$(aw,{}),$(pv,{}),$("div",{children:$(fv,{children:({comments:t})=>{if(t&&t.length>0){const n={},r=t.filter((s,u,a)=>(n[s.id]=s.created_at,u===a.findIndex(f=>f.id===s.id))),o=r.filter(s=>s.tags.filter(u=>u[0]==="e").length<=1),i=r.filter(s=>s.tags.filter(u=>u[0]==="e").length>1);o.sort((s,u)=>u.created_at-s.created_at),i.sort((s,u)=>{const a=s.tags.filter(c=>c[0]==="e").map(c=>c[1]),f=a[a.length-1];return u.created_at-(n[f]-1)});const l=[];return o.forEach(s=>{l.push(s);const u=i.filter(a=>a.tags.filter(c=>c[0]==="e").map(c=>c[1]).includes(s.id));l.push(...u)}),l.map((s,u)=>$(dv,{comment:s},u))}return $(If,{})}})})]})})})}const Kp=window.top||window,vt=Kp.document;var gf,vf,wf,xf,kf;const fw={domRoot:vt.getElementById("disgus"),relays:Array.from(vt.querySelectorAll('meta[property="nostr:relay"]')).map(e=>e.getAttribute("content"))||["wss://brb.io","wss://relay.nosphr.com"],pubkey:((gf=vt.querySelector('meta[property="nostr:pubkey"]'))==null?void 0:gf.getAttribute("content"))||!1,event_id:((vf=vt.querySelector('meta[property="nostr:event_id"]'))==null?void 0:vf.getAttribute("content"))||!1,canonical:((wf=vt.querySelector('meta[property="og:url"]'))==null?void 0:wf.getAttribute("content"))||((xf=vt.querySelector('link[rel="canonical"]'))==null?void 0:xf.href)||vt.location.href,title:((kf=vt.querySelector('meta[property="og:title"]'))==null?void 0:kf.getAttribute("content"))||vt.title},yf={...fw,...Kp.disgusConfig};ps.createRoot(yf.domRoot).render($(de.StrictMode,{children:$(cw,{config:yf})}))});export default dw();
diff --git a/src/web/templates/components/service_card.html b/src/web/templates/components/service_card.html
deleted file mode 100644
index 45e52e6..0000000
--- a/src/web/templates/components/service_card.html
+++ /dev/null
@@ -1,42 +0,0 @@
-{{/* service_card.html */}}
-
-
-
-
-
-
-
-
-
- {{if .Verified}}
-
-
-
-
- {{end}}
- {{.Name}}
-
-
- 10
-
-
-
{{shortText .Description}}
-
-
-
-
-
- {{if eq .Type "exchange"}}
-
- {{.Type}}
-
- {{else}}
-
- {{.Category}}
-
- {{end}}
- {{template "components/service_icons" .}}
-
-
-
-
diff --git a/src/web/templates/components/tos_check.html b/src/web/templates/components/tos_check.html
deleted file mode 100644
index 5bfacbc..0000000
--- a/src/web/templates/components/tos_check.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
{{.Title}}
-
{{.Text}}
- {{if .Section}}
-
ToS Section: {{.Section}}
- {{end}}
-
\ No newline at end of file
diff --git a/tailwind.config.js b/tailwind.config.js
index 58b1e1d..59352da 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -1,6 +1,6 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
- content: ["./src/web/**/*.{html,js}"],
+ content: ["./src/**/*.{html,js}"],
theme: {
extend: {},
},