diff --git a/app/web/dist/bundle.js b/app/web/dist/bundle.js index 8fad2ce..542cf89 100644 --- a/app/web/dist/bundle.js +++ b/app/web/dist/bundle.js @@ -21,5 +21,5 @@ function Wf(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Arra * hash-wasm (https://www.npmjs.com/package/hash-wasm) * (c) Dani Biro * @license MIT - */function Tp(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;class Up{constructor(){this.mutex=Promise.resolve()}lock(){let e=()=>{};return this.mutex=this.mutex.then(()=>new Promise(e)),new Promise(t=>{e=t})}dispatch(e){return Tp(this,void 0,void 0,function*(){const t=yield this.lock();try{return yield Promise.resolve(e())}finally{t()}})}}var _p;const Np="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Lp=null!==(_p=Np.Buffer)&&void 0!==_p?_p:null,Op=Np.TextEncoder?new Np.TextEncoder:null;function Mp(e,t){return(15&e)+(e>>6|e>>3&8)<<4|(15&t)+(t>>6|t>>3&8)}function jp(e,t){const n=t.length>>1;for(let i=0;i>>4;e[i++]=n>9?n+Hp:n+Gp,n=15&t[r],e[i++]=n>9?n+Hp:n+Gp}return String.fromCharCode.apply(null,e)}const Kp=null!==Lp?e=>{if("string"==typeof e){const t=Lp.from(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(Lp.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")}:e=>{if("string"==typeof e)return Op.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")},Vp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qp=new Uint8Array(256);for(let e=0;e<64;e++)qp[Vp.charCodeAt(e)]=e;function Yp(e,t=!0){const n=e.length,i=n%3,r=[],s=n-i;for(let t=0;t>18&63)+Vp.charAt(n>>12&63)+Vp.charAt(n>>6&63)+Vp.charAt(63&n);r.push(i)}if(1===i){const i=e[n-1],s=Vp.charAt(i>>2),o=Vp.charAt(i<<4&63);r.push(`${s}${o}`),t&&r.push("==")}else if(2===i){const i=(e[n-2]<<8)+e[n-1],s=Vp.charAt(i>>10),o=Vp.charAt(i>>4&63),a=Vp.charAt(i<<2&63);r.push(`${s}${o}${a}`),t&&r.push("=")}return r.join("")}function Wp(e){const t=function(e){let t=Math.floor(.75*e.length);const n=e.length;return"="===e[n-1]&&(t-=1,"="===e[n-2]&&(t-=1)),t}(e),n=e.length,i=new Uint8Array(t);let r=0;for(let t=0;t>4,r+=1,i[r]=(15&s)<<4|o>>2,r+=1,i[r]=(3&o)<<6|63&a,r+=1}return i}const zp=16384,Zp=new Up,Xp=new Map;function eh(e,t){return Tp(this,void 0,void 0,function*(){let n=null,i=null,r=!1;if("undefined"==typeof WebAssembly)throw new Error("WebAssembly is not supported in this environment!");const s=()=>new DataView(n.exports.memory.buffer).getUint32(n.exports.STATE_SIZE,!0),o=Zp.dispatch(()=>Tp(this,void 0,void 0,function*(){if(!Xp.has(e.name)){const t=Wp(e.data),n=WebAssembly.compile(t);Xp.set(e.name,n)}const t=yield Xp.get(e.name);n=yield WebAssembly.instantiate(t,{})})),a=(e=null)=>{r=!0,n.exports.Hash_Init(e)},l=e=>{if(!r)throw new Error("update() called before init()");(e=>{let t=0;for(;t{if(!r)throw new Error("digest() called before init()");return r=!1,n.exports.Hash_Final(s),"binary"===e?i.slice(0,t):Jp(c,i,t)},d=e=>"string"==typeof e?e.length<4096:e.byteLength!0;break;case"blake2b":case"blake2s":f=(e,t)=>t<=512&&d(e);break;case"blake3":f=(e,t)=>0===t&&d(e);break;case"xxhash64":case"xxhash3":case"xxhash128":case"crc64":f=()=>!1}return yield(()=>Tp(this,void 0,void 0,function*(){n||(yield o);const e=n.exports.Hash_GetBuffer(),t=n.exports.memory.buffer;i=new Uint8Array(t,e,zp)}))(),{getMemory:()=>i,writeMemory:(e,t=0)=>{i.set(e,t)},getExports:()=>n.exports,setMemorySize:e=>{n.exports.Hash_SetMemorySize(e);const t=n.exports.Hash_GetBuffer(),r=n.exports.memory.buffer;i=new Uint8Array(r,t,e)},init:a,update:l,digest:u,save:()=>{if(!r)throw new Error("save() can only be called after init() and before digest()");const t=n.exports.Hash_GetState(),i=s(),o=n.exports.memory.buffer,a=new Uint8Array(o,t,i),l=new Uint8Array(4+i);return jp(l,e.hash),l.set(a,4),l},load:t=>{if(!(t instanceof Uint8Array))throw new Error("load() expects an Uint8Array generated by save()");const i=n.exports.Hash_GetState(),o=s(),a=4+o,l=n.exports.memory.buffer;if(t.length!==a)throw new Error(`Bad state length (expected ${a} bytes, got ${t.length})`);if(!function(e,t){if(e.length!==2*t.length)return!1;for(let n=0;n{if(!f(e,r))return a(r),l(e),u("hex",s);const o=Kp(e);return i.set(o),n.exports.Hash_Calculate(o.length,r,s),Jp(c,i,t)},hashLength:t}})}new Up;var th={name:"argon2",data:"AGFzbQEAAAABKQVgAX8Bf2AAAX9gEH9/f39/f39/f39/f39/f38AYAR/f39/AGACf38AAwYFAAECAwQFBgEBAoCAAgYIAX8BQZCoBAsHQQQGbWVtb3J5AgASSGFzaF9TZXRNZW1vcnlTaXplAAAOSGFzaF9HZXRCdWZmZXIAAQ5IYXNoX0NhbGN1bGF0ZQAECvEyBVgBAn9BACEBAkAgAEEAKAKICCICRg0AAkAgACACayIAQRB2IABBgIB8cSAASWoiAEAAQX9HDQBB/wHADwtBACEBQQBBACkDiAggAEEQdK18NwOICAsgAcALcAECfwJAQQAoAoAIIgANAEEAPwBBEHQiADYCgAhBACgCiAgiAUGAgCBGDQACQEGAgCAgAWsiAEEQdiAAQYCAfHEgAElqIgBAAEF/Rw0AQQAPC0EAQQApA4gIIABBEHStfDcDiAhBACgCgAghAAsgAAvcDgECfiAAIAQpAwAiECAAKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAMIBAgDCkDAIVCIIkiEDcDACAIIBAgCCkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgBCAQIAQpAwCFQiiJIhA3AwAgACAQIAApAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIAwgECAMKQMAhUIwiSIQNwMAIAggECAIKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAEIBAgBCkDAIVCAYk3AwAgASAFKQMAIhAgASkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgDSAQIA0pAwCFQiCJIhA3AwAgCSAQIAkpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAUgECAFKQMAhUIoiSIQNwMAIAEgECABKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACANIBAgDSkDAIVCMIkiEDcDACAJIBAgCSkDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgBSAQIAUpAwCFQgGJNwMAIAIgBikDACIQIAIpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIA4gECAOKQMAhUIgiSIQNwMAIAogECAKKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAGIBAgBikDAIVCKIkiEDcDACACIBAgAikDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgDiAQIA4pAwCFQjCJIhA3AwAgCiAQIAopAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIAYgECAGKQMAhUIBiTcDACADIAcpAwAiECADKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAPIBAgDykDAIVCIIkiEDcDACALIBAgCykDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgByAQIAcpAwCFQiiJIhA3AwAgAyAQIAMpAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIA8gECAPKQMAhUIwiSIQNwMAIAsgECALKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAHIBAgBykDAIVCAYk3AwAgACAFKQMAIhAgACkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgDyAQIA8pAwCFQiCJIhA3AwAgCiAQIAopAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAUgECAFKQMAhUIoiSIQNwMAIAAgECAAKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAPIBAgDykDAIVCMIkiEDcDACAKIBAgCikDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgBSAQIAUpAwCFQgGJNwMAIAEgBikDACIQIAEpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAwgECAMKQMAhUIgiSIQNwMAIAsgECALKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAGIBAgBikDAIVCKIkiEDcDACABIBAgASkDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgDCAQIAwpAwCFQjCJIhA3AwAgCyAQIAspAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIAYgECAGKQMAhUIBiTcDACACIAcpAwAiECACKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACANIBAgDSkDAIVCIIkiEDcDACAIIBAgCCkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgByAQIAcpAwCFQiiJIhA3AwAgAiAQIAIpAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIA0gECANKQMAhUIwiSIQNwMAIAggECAIKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAHIBAgBykDAIVCAYk3AwAgAyAEKQMAIhAgAykDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgDiAQIA4pAwCFQiCJIhA3AwAgCSAQIAkpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAQgECAEKQMAhUIoiSIQNwMAIAMgECADKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAOIBAgDikDAIVCMIkiEDcDACAJIBAgCSkDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgBCAQIAQpAwCFQgGJNwMAC98aAQN/QQAhBEEAIAIpAwAgASkDAIU3A5AIQQAgAikDCCABKQMIhTcDmAhBACACKQMQIAEpAxCFNwOgCEEAIAIpAxggASkDGIU3A6gIQQAgAikDICABKQMghTcDsAhBACACKQMoIAEpAyiFNwO4CEEAIAIpAzAgASkDMIU3A8AIQQAgAikDOCABKQM4hTcDyAhBACACKQNAIAEpA0CFNwPQCEEAIAIpA0ggASkDSIU3A9gIQQAgAikDUCABKQNQhTcD4AhBACACKQNYIAEpA1iFNwPoCEEAIAIpA2AgASkDYIU3A/AIQQAgAikDaCABKQNohTcD+AhBACACKQNwIAEpA3CFNwOACUEAIAIpA3ggASkDeIU3A4gJQQAgAikDgAEgASkDgAGFNwOQCUEAIAIpA4gBIAEpA4gBhTcDmAlBACACKQOQASABKQOQAYU3A6AJQQAgAikDmAEgASkDmAGFNwOoCUEAIAIpA6ABIAEpA6ABhTcDsAlBACACKQOoASABKQOoAYU3A7gJQQAgAikDsAEgASkDsAGFNwPACUEAIAIpA7gBIAEpA7gBhTcDyAlBACACKQPAASABKQPAAYU3A9AJQQAgAikDyAEgASkD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",hash:"e4cdc523"},nh={name:"blake2b",data:"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",hash:"c6f286e6"};function ih(e){return!Number.isInteger(e)||e<8||e>512||e%8!=0?new Error("Invalid variant! Valid values: 8, 16, ..., 512"):null}function rh(e=512,t=null){if(ih(e))return Promise.reject(ih(e));let n=null,i=e;if(null!==t){if(n=Kp(t),n.length>64)return Promise.reject(new Error("Max key length is 64 bytes"));r=e,s=n.length,i=r|s<<16}var r,s;const o=e/8;return eh(nh,o).then(e=>{i>512&&e.writeMemory(n),e.init(i);const t={init:i>512?()=>(e.writeMemory(n),e.init(i),t):()=>(e.init(i),t),update:n=>(e.update(n),t),digest:t=>e.digest(t),save:()=>e.save(),load:n=>(e.load(n),t),blockSize:128,digestSize:o};return t})}new Up;const sh=new DataView(new ArrayBuffer(4));function oh(e){return sh.setInt32(0,e,!0),new Uint8Array(sh.buffer)}function ah(e,t,n){return Tp(this,void 0,void 0,function*(){if(n<=64){const e=yield rh(8*n);return e.update(oh(n)),e.update(t),e.digest("binary")}const i=Math.ceil(n/32)-2,r=new Uint8Array(n);e.init(),e.update(oh(n)),e.update(t);let s=e.digest("binary");r.set(s.subarray(0,32),0);for(let t=1;t{var t;if(!e||"object"!=typeof e)throw new Error("Invalid options parameter. It requires an object.");if(!e.password)throw new Error("Password must be specified");if(e.password=Kp(e.password),e.password.length<1)throw new Error("Password must be specified");if(!e.salt)throw new Error("Salt must be specified");if(e.salt=Kp(e.salt),e.salt.length<8)throw new Error("Salt should be at least 8 bytes long");if(e.secret=Kp(null!==(t=e.secret)&&void 0!==t?t:""),!Number.isInteger(e.iterations)||e.iterations<1)throw new Error("Iterations should be a positive number");if(!Number.isInteger(e.parallelism)||e.parallelism<1)throw new Error("Parallelism should be a positive number");if(!Number.isInteger(e.hashLength)||e.hashLength<4)throw new Error("Hash length should be at least 4 bytes.");if(!Number.isInteger(e.memorySize))throw new Error("Memory size should be specified.");if(e.memorySize<8*e.parallelism)throw new Error("Memory size should be at least 8 * parallelism.");if(void 0===e.outputType&&(e.outputType="hex"),!["hex","binary","encoded"].includes(e.outputType))throw new Error(`Insupported output type ${e.outputType}. Valid values: ['hex', 'binary', 'encoded']`)})(e),lh(Object.assign(Object.assign({},e),{hashType:"id"}))})}new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up;const uh={parallelism:4,iterations:8,memorySize:262144,hashLength:32,outputType:"binary"};let dh=null,fh=0;const ph=new Map;async function hh(e,t){try{const n=function(){if(dh)return dh;const e=new Blob(["\n importScripts('https://cdn.jsdelivr.net/npm/hash-wasm@4.11.0/dist/argon2.umd.min.js');\n\n const ARGON2_CONFIG = {\n parallelism: 4,\n iterations: 8,\n memorySize: 262144,\n hashLength: 32,\n outputType: \"binary\"\n };\n\n self.onmessage = async function(e) {\n const { password, salt, id } = e.data;\n\n try {\n const result = await hashwasm.argon2id({\n password: password,\n salt: new Uint8Array(salt),\n ...ARGON2_CONFIG\n });\n\n self.postMessage({\n id,\n success: true,\n result: Array.from(result)\n });\n } catch (error) {\n self.postMessage({\n id,\n success: false,\n error: error.message\n });\n }\n };\n "],{type:"application/javascript"});return dh=new Worker(URL.createObjectURL(e)),dh.onmessage=function(e){const{id:t,success:n,result:i,error:r}=e.data,s=ph.get(t);s&&(ph.delete(t),n?s.resolve(new Uint8Array(i)):s.reject(new Error(r)))},dh.onerror=function(e){console.error("Argon2 worker error:",e)},dh}(),i=++fh;return new Promise((r,s)=>{ph.set(i,{resolve:r,reject:s}),n.postMessage({id:i,password:e,salt:Array.from(t)})})}catch(n){console.warn("Worker failed, falling back to main thread:",n);return await ch({password:e,salt:t,...uh})}}const{window:gh}=l;function mh(e){let t,n,r,s,o,a,l,f,h,g,v,A,k,I,C,E,x,B;function Q(e,t){return"extension"===e[2]?yh:vh}let F=Q(e),D=F(e),$=e[10]&&Fh(e),P=e[11]&&Dh(e);return{c(){t=p("div"),n=p("div"),r=p("div"),s=p("h2"),s.textContent="Login to Nostr",o=m(),a=p("button"),a.textContent="×",l=m(),f=p("div"),h=p("div"),g=p("button"),g.textContent="Extension",v=m(),A=p("button"),A.textContent="Nsec",k=m(),I=p("div"),D.c(),C=m(),$&&$.c(),E=m(),P&&P.c(),b(s,"class","svelte-4xpfbi"),b(a,"class","close-btn svelte-4xpfbi"),b(r,"class","modal-header svelte-4xpfbi"),b(g,"class","tab-btn svelte-4xpfbi"),S(g,"active","extension"===e[2]),b(A,"class","tab-btn svelte-4xpfbi"),S(A,"active","nsec"===e[2]),b(h,"class","tabs svelte-4xpfbi"),b(I,"class","tab-content svelte-4xpfbi"),b(f,"class","tab-container svelte-4xpfbi"),b(n,"class","modal svelte-4xpfbi"),S(n,"dark-theme",e[1]),b(t,"class","modal-overlay svelte-4xpfbi"),b(t,"role","button"),b(t,"tabindex","0")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(r,s),c(r,o),c(r,a),c(n,l),c(n,f),c(f,h),c(h,g),c(h,v),c(h,A),c(f,k),c(f,I),D.m(I,null),c(I,C),$&&$.m(I,null),c(I,E),P&&P.m(I,null),x||(B=[y(a,"click",e[17]),y(g,"click",e[26]),y(A,"click",e[27]),y(n,"click",w(e[24])),y(n,"keydown",w(e[25])),y(t,"click",e[17]),y(t,"keydown",e[32])],x=!0)},p(e,t){4&t[0]&&S(g,"active","extension"===e[2]),4&t[0]&&S(A,"active","nsec"===e[2]),F===(F=Q(e))&&D?D.p(e,t):(D.d(1),D=F(e),D&&(D.c(),D.m(I,C))),e[10]?$?$.p(e,t):($=Fh(e),$.c(),$.m(I,E)):$&&($.d(1),$=null),e[11]?P?P.p(e,t):(P=Dh(e),P.c(),P.m(I,null)):P&&(P.d(1),P=null),2&t[0]&&S(n,"dark-theme",e[1])},d(e){e&&d(t),D.d(),$&&$.d(),P&&P.d(),x=!1,i(B)}}}function vh(e){let t;function n(e,t){return e[14]?bh:wh}let i=n(e),r=i(e);return{c(){t=p("div"),r.c(),b(t,"class","nsec-login svelte-4xpfbi")},m(e,n){u(e,t,n),r.m(t,null)},p(e,s){i===(i=n(e))&&r?r.p(e,s):(r.d(1),r=i(e),r&&(r.c(),r.m(t,null)))},d(e){e&&d(t),r.d()}}}function yh(e){let t,n,i,r,s,o,a,l=e[7]?"Connecting...":"Log in using extension";return{c(){t=p("div"),n=p("p"),n.textContent="Login using a NIP-07 compatible browser\n extension like nos2x or Alby.",i=m(),r=p("button"),s=g(l),b(n,"class","svelte-4xpfbi"),b(r,"class","login-extension-btn svelte-4xpfbi"),r.disabled=e[7],b(t,"class","extension-login svelte-4xpfbi")},m(l,d){u(l,t,d),c(t,n),c(t,i),c(t,r),c(r,s),o||(a=y(r,"click",e[21]),o=!0)},p(e,t){128&t[0]&&l!==(l=e[7]?"Connecting...":"Log in using extension")&&k(s,l),128&t[0]&&(r.disabled=e[7])},d(e){e&&d(t),o=!1,a()}}}function wh(e){let t,n,r,s,o,a,l,f,h,v,w,A,C,E,x,S,B,Q,F,D,$,P,R,T=e[8]?"Generating...":"Generate New Key",U=e[12]&&Ah(e),_=e[4]&&kh(e);function N(e,t){return e[9]?Eh:e[7]?Ch:Ih}let L=N(e),O=L(e);return{c(){t=p("p"),t.textContent="Enter your nsec or generate a new one. Optionally\n set a password to encrypt it securely.",n=m(),r=p("button"),s=g(T),a=m(),U&&U.c(),l=m(),f=p("input"),v=m(),w=p("div"),A=p("label"),A.textContent="Encryption Password (optional but recommended):",C=m(),E=p("input"),S=m(),_&&_.c(),B=m(),Q=p("small"),Q.textContent="Password uses Argon2id with ~3 second derivation time for security.",F=m(),D=p("button"),O.c(),b(t,"class","svelte-4xpfbi"),b(r,"class","generate-btn svelte-4xpfbi"),r.disabled=o=e[7]||e[8],b(f,"type","password"),b(f,"placeholder","nsec1..."),f.disabled=h=e[7]||e[9],b(f,"class","nsec-input svelte-4xpfbi"),b(A,"class","svelte-4xpfbi"),b(E,"type","password"),b(E,"placeholder","Enter password (min 8 chars)"),E.disabled=x=e[7]||e[9],b(E,"class","password-input svelte-4xpfbi"),b(Q,"class","password-hint svelte-4xpfbi"),b(w,"class","password-section svelte-4xpfbi"),b(D,"class","login-nsec-btn svelte-4xpfbi"),D.disabled=$=e[7]||e[9]||!e[3].trim()},m(i,o){u(i,t,o),u(i,n,o),u(i,r,o),c(r,s),u(i,a,o),U&&U.m(i,o),u(i,l,o),u(i,f,o),I(f,e[3]),u(i,v,o),u(i,w,o),c(w,A),c(w,C),c(w,E),I(E,e[4]),c(w,S),_&&_.m(w,null),c(w,B),c(w,Q),u(i,F,o),u(i,D,o),O.m(D,null),P||(R=[y(r,"click",e[20]),y(f,"input",e[29]),y(E,"input",e[30]),y(D,"click",e[22])],P=!0)},p(e,t){256&t[0]&&T!==(T=e[8]?"Generating...":"Generate New Key")&&k(s,T),384&t[0]&&o!==(o=e[7]||e[8])&&(r.disabled=o),e[12]?U?U.p(e,t):(U=Ah(e),U.c(),U.m(l.parentNode,l)):U&&(U.d(1),U=null),640&t[0]&&h!==(h=e[7]||e[9])&&(f.disabled=h),8&t[0]&&f.value!==e[3]&&I(f,e[3]),640&t[0]&&x!==(x=e[7]||e[9])&&(E.disabled=x),16&t[0]&&E.value!==e[4]&&I(E,e[4]),e[4]?_?_.p(e,t):(_=kh(e),_.c(),_.m(w,B)):_&&(_.d(1),_=null),L!==(L=N(e))&&(O.d(1),O=L(e),O&&(O.c(),O.m(D,null))),648&t[0]&&$!==($=e[7]||e[9]||!e[3].trim())&&(D.disabled=$)},d(e){e&&d(t),e&&d(n),e&&d(r),e&&d(a),U&&U.d(e),e&&d(l),e&&d(f),e&&d(v),e&&d(w),_&&_.d(),e&&d(F),e&&d(D),O.d(),P=!1,i(R)}}}function bh(e){let t,n,r,s,o,a,l,f,h,v,w,A,k,C,E=e[15]&&xh(e);function x(e,t){return e[9]?Qh:e[7]?Bh:Sh}let S=x(e),B=S(e);return{c(){t=p("p"),t.textContent="You have a stored encrypted key. Enter your\n password to unlock it.",n=m(),E&&E.c(),r=m(),s=p("input"),a=m(),l=p("button"),B.c(),h=m(),v=p("button"),w=g("Clear stored key & start fresh"),b(t,"class","svelte-4xpfbi"),b(s,"type","password"),b(s,"placeholder","Enter your password"),s.disabled=o=e[7]||e[9],b(s,"class","password-input svelte-4xpfbi"),b(l,"class","login-nsec-btn svelte-4xpfbi"),l.disabled=f=e[7]||e[9]||!e[6],b(v,"class","clear-btn svelte-4xpfbi"),v.disabled=A=e[7]||e[9]},m(i,o){u(i,t,o),u(i,n,o),E&&E.m(i,o),u(i,r,o),u(i,s,o),I(s,e[6]),u(i,a,o),u(i,l,o),B.m(l,null),u(i,h,o),u(i,v,o),c(v,w),k||(C=[y(s,"input",e[28]),y(l,"click",e[18]),y(v,"click",e[16])],k=!0)},p(e,t){e[15]?E?E.p(e,t):(E=xh(e),E.c(),E.m(r.parentNode,r)):E&&(E.d(1),E=null),640&t[0]&&o!==(o=e[7]||e[9])&&(s.disabled=o),64&t[0]&&s.value!==e[6]&&I(s,e[6]),S!==(S=x(e))&&(B.d(1),B=S(e),B&&(B.c(),B.m(l,null))),704&t[0]&&f!==(f=e[7]||e[9]||!e[6])&&(l.disabled=f),640&t[0]&&A!==(A=e[7]||e[9])&&(v.disabled=A)},d(e){e&&d(t),e&&d(n),E&&E.d(e),e&&d(r),e&&d(s),e&&d(a),e&&d(l),B.d(),e&&d(h),e&&d(v),k=!1,i(C)}}}function Ah(e){let t,n,i,r,s;return{c(){t=p("div"),n=p("label"),n.textContent="Your new public key (npub):",i=m(),r=p("code"),s=g(e[12]),b(n,"class","svelte-4xpfbi"),b(r,"class","npub-display svelte-4xpfbi"),b(t,"class","generated-info svelte-4xpfbi")},m(e,o){u(e,t,o),c(t,n),c(t,i),c(t,r),c(r,s)},p(e,t){4096&t[0]&&k(s,e[12])},d(e){e&&d(t)}}}function kh(e){let t,n,i,r;return{c(){t=p("input"),b(t,"type","password"),b(t,"placeholder","Confirm password"),t.disabled=n=e[7]||e[9],b(t,"class","password-input svelte-4xpfbi")},m(n,s){u(n,t,s),I(t,e[5]),i||(r=y(t,"input",e[31]),i=!0)},p(e,i){640&i[0]&&n!==(n=e[7]||e[9])&&(t.disabled=n),32&i[0]&&t.value!==e[5]&&I(t,e[5])},d(e){e&&d(t),i=!1,r()}}}function Ih(e){let t;return{c(){t=g("Log in with nsec")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Ch(e){let t;return{c(){t=g("Logging in...")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Eh(e){let t;return{c(){t=g("Deriving key...")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function xh(e){let t,n,i,r,s,o,a,l=e[15].slice(0,16)+"",f=e[15].slice(-8)+"";return{c(){t=p("div"),n=p("label"),n.textContent="Stored public key:",i=m(),r=p("code"),s=g(l),o=g("..."),a=g(f),b(n,"class","svelte-4xpfbi"),b(r,"class","npub-display svelte-4xpfbi"),b(t,"class","stored-info svelte-4xpfbi")},m(e,l){u(e,t,l),c(t,n),c(t,i),c(t,r),c(r,s),c(r,o),c(r,a)},p(e,t){32768&t[0]&&l!==(l=e[15].slice(0,16)+"")&&k(s,l),32768&t[0]&&f!==(f=e[15].slice(-8)+"")&&k(a,f)},d(e){e&&d(t)}}}function Sh(e){let t;return{c(){t=g("Unlock")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Bh(e){let t;return{c(){t=g("Unlocking...")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Qh(e){let t;return{c(){t=g("Deriving key...")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Fh(e){let t,n;return{c(){t=p("div"),n=g(e[10]),b(t,"class","message error-message svelte-4xpfbi")},m(e,i){u(e,t,i),c(t,n)},p(e,t){1024&t[0]&&k(n,e[10])},d(e){e&&d(t)}}}function Dh(e){let t,n;return{c(){t=p("div"),n=g(e[11]),b(t,"class","message success-message svelte-4xpfbi")},m(e,i){u(e,t,i),c(t,n)},p(e,t){2048&t[0]&&k(n,e[11])},d(e){e&&d(t)}}}function $h(e){let t,n,i,r,s,o,a,l,f,h,v,y=e[13].toFixed(1)+"";return{c(){t=p("div"),n=p("div"),i=p("div"),r=m(),s=p("h3"),s.textContent="Deriving encryption key",o=m(),a=p("div"),l=g(y),f=g("s"),h=m(),v=p("p"),v.textContent="This may take 3-6 seconds for security",b(i,"class","deriving-spinner svelte-4xpfbi"),b(s,"class","svelte-4xpfbi"),b(a,"class","deriving-timer svelte-4xpfbi"),b(v,"class","deriving-note svelte-4xpfbi"),b(n,"class","deriving-modal svelte-4xpfbi"),S(n,"dark-theme",e[1]),b(t,"class","deriving-overlay svelte-4xpfbi")},m(e,d){u(e,t,d),c(t,n),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),c(a,l),c(a,f),c(n,h),c(n,v)},p(e,t){8192&t[0]&&y!==(y=e[13].toFixed(1)+"")&&k(l,y),2&t[0]&&S(n,"dark-theme",e[1])},d(e){e&&d(t)}}}function Ph(t){let n,i,r,s,o=t[0]&&mh(t),a=t[9]&&$h(t);return{c(){o&&o.c(),n=m(),a&&a.c(),i=v()},m(e,l){o&&o.m(e,l),u(e,n,l),a&&a.m(e,l),u(e,i,l),r||(s=y(gh,"keydown",t[23]),r=!0)},p(e,t){e[0]?o?o.p(e,t):(o=mh(e),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null),e[9]?a?a.p(e,t):(a=$h(e),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},i:e,o:e,d(e){o&&o.d(e),e&&d(n),a&&a.d(e),e&&d(i),r=!1,s()}}}function Rh(e,t,n){const i=P();let{showModal:r=!1}=t,{isDarkTheme:s=!1}=t,o="extension",a="",l="",c="",u="",d=!1,f=!1,p=!1,h="",g="",m="",v="",y=0,w=null,b=null;function A(){n(13,y=0),w=performance.now(),k()}function k(){null!==w&&(n(13,y=(performance.now()-w)/1e3),b=requestAnimationFrame(k))}function I(){w=null,b&&(cancelAnimationFrame(b),b=null)}$(()=>{I()});let C=!1,E="";function x(){n(14,C=!!localStorage.getItem("nostr_privkey_encrypted")),n(15,E=localStorage.getItem("nostr_pubkey")||"")}function S(){n(0,r=!1),n(3,a=""),n(4,l=""),n(5,c=""),n(6,u=""),n(10,h=""),n(11,g=""),m="",n(12,v=""),i("close")}function B(e){n(2,o=e),n(10,h=""),n(11,g=""),m="",n(12,v="")}async function Q(){n(7,d=!0),n(10,h=""),n(11,g="");try{if(!a.trim())throw new Error("Please enter your nsec");if(!function(e){if(!e||!e.startsWith("nsec1"))return!1;try{return"nsec"===vu(e).type}catch{return!1}}(a.trim()))throw new Error("Invalid nsec format or checksum");if(l){if(l.length<8)throw new Error("Password must be at least 8 characters");if(l!==c)throw new Error("Passwords do not match")}const e=ff.fromKey(a.trim()),t=await e.getPublicKey();if(localStorage.setItem("nostr_auth_method","nsec"),localStorage.setItem("nostr_pubkey",t),l){n(9,p=!0),A();const e=await async function(e,t){if(!e.startsWith("nsec1"))throw new Error("Invalid nsec format - must start with nsec1");try{if("nsec"!==vu(e).type)throw new Error("Invalid nsec - wrong type")}catch(e){throw new Error("Invalid nsec - bech32 checksum failed")}const n=crypto.getRandomValues(new Uint8Array(32)),i=crypto.getRandomValues(new Uint8Array(12)),r=await hh(t,n),s=await crypto.subtle.importKey("raw",r,{name:"AES-GCM"},!1,["encrypt"]),o=new TextEncoder,a=await crypto.subtle.encrypt({name:"AES-GCM",iv:i},s,o.encode(e)),l=new Uint8Array(n.length+i.length+a.byteLength);return l.set(n,0),l.set(i,n.length),l.set(new Uint8Array(a),n.length+i.length),btoa(String.fromCharCode(...l))}(a.trim(),l);I(),n(9,p=!1),localStorage.setItem("nostr_privkey_encrypted",e),localStorage.removeItem("nostr_privkey")}else localStorage.setItem("nostr_privkey",a.trim()),localStorage.removeItem("nostr_privkey_encrypted"),n(11,g="Successfully logged in with nsec!");i("login",{method:"nsec",pubkey:t,privateKey:a.trim(),signer:e}),setTimeout(()=>{S()},1500)}catch(e){n(10,h=e.message)}finally{n(7,d=!1)}}D(()=>{x()});return e.$$set=e=>{"showModal"in e&&n(0,r=e.showModal),"isDarkTheme"in e&&n(1,s=e.isDarkTheme)},e.$$.update=()=>{1&e.$$.dirty[0]&&r&&x()},[r,s,o,a,l,c,u,d,f,p,h,g,v,y,C,E,function(){localStorage.removeItem("nostr_privkey_encrypted"),localStorage.removeItem("nostr_privkey"),localStorage.removeItem("nostr_pubkey"),localStorage.removeItem("nostr_auth_method"),n(14,C=!1),n(15,E=""),n(6,u=""),n(10,h=""),n(11,g="")},S,async function(){n(7,d=!0),n(9,p=!0),A(),n(10,h=""),n(11,g="");try{if(!u)throw new Error("Please enter your password");const e=localStorage.getItem("nostr_privkey_encrypted");if(!e)throw new Error("No encrypted key found");const t=await async function(e,t){const n=new Uint8Array(atob(e).split("").map(e=>e.charCodeAt(0)));if(n.length<60)throw new Error("Invalid encrypted data - too short");const i=n.slice(0,32),r=n.slice(32,44),s=n.slice(44),o=await hh(t,i),a=await crypto.subtle.importKey("raw",o,{name:"AES-GCM"},!1,["decrypt"]);let l;try{l=await crypto.subtle.decrypt({name:"AES-GCM",iv:r},a,s)}catch(e){throw new Error("Decryption failed - invalid password or corrupted data")}const c=(new TextDecoder).decode(l);if(!c.startsWith("nsec1"))throw new Error("Decryption produced invalid data - not an nsec");try{if("nsec"!==vu(c).type)throw new Error("Decryption produced invalid nsec type")}catch(e){throw new Error("Decryption produced invalid nsec - bech32 checksum failed")}return c}(e,u);I(),n(9,p=!1);const r=ff.fromKey(t),s=await r.getPublicKey();i("login",{method:"nsec",pubkey:s,privateKey:t,signer:r}),S()}catch(e){I(),e.message.includes("decrypt")||e.message.includes("tag")?n(10,h="Invalid password"):n(10,h=e.message)}finally{n(7,d=!1),n(9,p=!1),I()}},B,async function(){n(8,f=!0),n(10,h=""),n(11,g="");try{const e=Zc(),t=bu("nsec",e),i=wu(Xc(e));m=t,n(12,v=i),n(3,a=t),n(11,g="New key generated! Set an encryption password below to secure it.")}catch(e){n(10,h="Failed to generate key: "+e.message)}finally{n(8,f=!1)}},async function(){n(7,d=!0),n(10,h=""),n(11,g="");try{if(!window.nostr)throw new Error("No Nostr extension found. Please install a NIP-07 compatible extension like nos2x or Alby.");const e=await window.nostr.getPublicKey();e&&(localStorage.setItem("nostr_auth_method","extension"),localStorage.setItem("nostr_pubkey",e),n(11,g="Successfully logged in with extension!"),i("login",{method:"extension",pubkey:e,signer:window.nostr}),setTimeout(()=>{S()},1500))}catch(e){n(10,h=e.message)}finally{n(7,d=!1)}},Q,function(e){"Escape"===e.key&&S(),"Enter"===e.key&&"nsec"===o&&Q()},function(t){R.call(this,e,t)},function(t){R.call(this,e,t)},()=>B("extension"),()=>B("nsec"),function(){u=this.value,n(6,u)},function(){a=this.value,n(3,a)},function(){l=this.value,n(4,l)},function(){c=this.value,n(5,c)},e=>"Escape"===e.key&&S()]}class Th extends se{constructor(e){super(),re(this,e,Rh,Ph,s,{showModal:0,isDarkTheme:1},null,[-1,-1])}}function Uh(e,t,n){const i=e.slice();return i[72]=t[n],i}function _h(e,t,n){const i=e.slice();return i[75]=t[n],i}function Nh(e,t,n){const i=e.slice();return i[72]=t[n],i}function Lh(e,t,n){const i=e.slice();return i[72]=t[n],i}function Oh(e,t,n){const i=e.slice();return i[72]=t[n],i}function Mh(e,t,n){const i=e.slice();return i[72]=t[n],i}function jh(e,t,n){const i=e.slice();return i[72]=t[n],i}function Hh(e){let t,n,i;return{c(){t=p("div"),n=g(e[3]),b(t,"class",i="message "+e[4]+" svelte-1y8wjwc")},m(e,i){u(e,t,i),c(t,n)},p(e,r){8&r[0]&&k(n,e[3]),16&r[0]&&i!==(i="message "+e[4]+" svelte-1y8wjwc")&&b(t,"class",i)},d(e){e&&d(t)}}}function Gh(e){let t,n,r,s,o,a,l,f,h,v,w,A,k,C,E,x,S,B,Q,F,D,$,P,R,T,U,_,N;function L(e,t){return e[5]&&e[5].length>0?Kh:Jh}let O=L(e),M=O(e);function j(e,t){return e[8]&&e[8].length>0?Wh:Yh}let H=j(e),G=H(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Banned Pubkeys",s=m(),o=p("div"),a=p("input"),l=m(),f=p("input"),h=m(),v=p("button"),w=g("Ban Pubkey"),A=m(),k=p("div"),M.c(),C=m(),E=p("div"),x=p("h3"),x.textContent="Allowed Pubkeys",S=m(),B=p("div"),Q=p("input"),F=m(),D=p("input"),$=m(),P=p("button"),R=g("Allow Pubkey"),T=m(),U=p("div"),G.c(),b(r,"class","svelte-1y8wjwc"),b(a,"type","text"),b(a,"placeholder","Pubkey (64 hex chars)"),b(a,"class","svelte-1y8wjwc"),b(f,"type","text"),b(f,"placeholder","Reason (optional)"),b(f,"class","svelte-1y8wjwc"),v.disabled=e[2],b(v,"class","svelte-1y8wjwc"),b(o,"class","add-form svelte-1y8wjwc"),b(k,"class","list svelte-1y8wjwc"),b(n,"class","section svelte-1y8wjwc"),b(x,"class","svelte-1y8wjwc"),b(Q,"type","text"),b(Q,"placeholder","Pubkey (64 hex chars)"),b(Q,"class","svelte-1y8wjwc"),b(D,"type","text"),b(D,"placeholder","Reason (optional)"),b(D,"class","svelte-1y8wjwc"),P.disabled=e[2],b(P,"class","svelte-1y8wjwc"),b(B,"class","add-form svelte-1y8wjwc"),b(U,"class","list svelte-1y8wjwc"),b(E,"class","section svelte-1y8wjwc"),b(t,"class","pubkeys-section")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),I(a,e[6]),c(o,l),c(o,f),I(f,e[7]),c(o,h),c(o,v),c(v,w),c(n,A),c(n,k),M.m(k,null),c(t,C),c(t,E),c(E,x),c(E,S),c(E,B),c(B,Q),I(Q,e[9]),c(B,F),c(B,D),I(D,e[10]),c(B,$),c(B,P),c(P,R),c(E,T),c(E,U),G.m(U,null),_||(N=[y(a,"input",e[43]),y(f,"input",e[44]),y(v,"click",e[25]),y(Q,"input",e[45]),y(D,"input",e[46]),y(P,"click",e[26])],_=!0)},p(e,t){64&t[0]&&a.value!==e[6]&&I(a,e[6]),128&t[0]&&f.value!==e[7]&&I(f,e[7]),4&t[0]&&(v.disabled=e[2]),O===(O=L(e))&&M?M.p(e,t):(M.d(1),M=O(e),M&&(M.c(),M.m(k,null))),512&t[0]&&Q.value!==e[9]&&I(Q,e[9]),1024&t[0]&&D.value!==e[10]&&I(D,e[10]),4&t[0]&&(P.disabled=e[2]),H===(H=j(e))&&G?G.p(e,t):(G.d(1),G=H(e),G&&(G.c(),G.m(U,null)))},d(e){e&&d(t),M.d(),G.d(),_=!1,i(N)}}}function Jh(t){let n;return{c(){n=p("div"),n.innerHTML="

No banned pubkeys configured.

",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Kh(e){let t,n=e[5],i=[];for(let t=0;tNo allowed pubkeys configured.

",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Wh(e){let t,n=e[8],i=[];for(let t=0;t0?tg:eg}let O=L(e),M=O(e);let j=function(e){return e[22]&&e[22].length>0?sg:rg}(e),H=j(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Banned Events",s=m(),o=p("div"),a=p("input"),l=m(),f=p("input"),h=m(),v=p("button"),w=g("Ban Event"),A=m(),k=p("div"),M.c(),C=m(),E=p("div"),x=p("h3"),x.textContent="Allowed Events",S=m(),B=p("div"),Q=p("input"),F=m(),D=p("input"),$=m(),P=p("button"),R=g("Allow Event"),T=m(),U=p("div"),H.c(),b(r,"class","svelte-1y8wjwc"),b(a,"type","text"),b(a,"placeholder","Event ID (64 hex chars)"),b(a,"class","svelte-1y8wjwc"),b(f,"type","text"),b(f,"placeholder","Reason (optional)"),b(f,"class","svelte-1y8wjwc"),v.disabled=e[2],b(v,"class","svelte-1y8wjwc"),b(o,"class","add-form svelte-1y8wjwc"),b(k,"class","list svelte-1y8wjwc"),b(n,"class","section svelte-1y8wjwc"),b(x,"class","svelte-1y8wjwc"),b(Q,"type","text"),b(Q,"placeholder","Event ID (64 hex chars)"),b(Q,"class","svelte-1y8wjwc"),b(D,"type","text"),b(D,"placeholder","Reason (optional)"),b(D,"class","svelte-1y8wjwc"),P.disabled=e[2],b(P,"class","svelte-1y8wjwc"),b(B,"class","add-form svelte-1y8wjwc"),b(U,"class","list svelte-1y8wjwc"),b(E,"class","section svelte-1y8wjwc"),b(t,"class","events-section")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),I(a,e[12]),c(o,l),c(o,f),I(f,e[13]),c(o,h),c(o,v),c(v,w),c(n,A),c(n,k),M.m(k,null),c(t,C),c(t,E),c(E,x),c(E,S),c(E,B),c(B,Q),I(Q,e[14]),c(B,F),c(B,D),I(D,e[15]),c(B,$),c(B,P),c(P,R),c(E,T),c(E,U),H.m(U,null),_||(N=[y(a,"input",e[47]),y(f,"input",e[48]),y(v,"click",e[27]),y(Q,"input",e[49]),y(D,"input",e[50]),y(P,"click",e[28])],_=!0)},p(e,t){4096&t[0]&&a.value!==e[12]&&I(a,e[12]),8192&t[0]&&f.value!==e[13]&&I(f,e[13]),4&t[0]&&(v.disabled=e[2]),O===(O=L(e))&&M?M.p(e,t):(M.d(1),M=O(e),M&&(M.c(),M.m(k,null))),16384&t[0]&&Q.value!==e[14]&&I(Q,e[14]),32768&t[0]&&D.value!==e[15]&&I(D,e[15]),4&t[0]&&(P.disabled=e[2]),H.p(e,t)},d(e){e&&d(t),M.d(),H.d(),_=!1,i(N)}}}function eg(t){let n;return{c(){n=p("div"),n.innerHTML="

No banned events configured.

",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function tg(e){let t,n=e[11],i=[];for(let t=0;tNo allowed events configured.

",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function sg(e){let t,n=e[22],i=[];for(let t=0;t0?cg:lg}let S=x(e),B=S(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Blocked IPs",s=m(),o=p("div"),a=p("input"),l=m(),f=p("input"),h=m(),v=p("button"),w=g("Block IP"),A=m(),k=p("div"),B.c(),b(r,"class","svelte-1y8wjwc"),b(a,"type","text"),b(a,"placeholder","IP Address"),b(a,"class","svelte-1y8wjwc"),b(f,"type","text"),b(f,"placeholder","Reason (optional)"),b(f,"class","svelte-1y8wjwc"),v.disabled=e[2],b(v,"class","svelte-1y8wjwc"),b(o,"class","add-form svelte-1y8wjwc"),b(k,"class","list svelte-1y8wjwc"),b(n,"class","section svelte-1y8wjwc"),b(t,"class","ips-section")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),I(a,e[17]),c(o,l),c(o,f),I(f,e[18]),c(o,h),c(o,v),c(v,w),c(n,A),c(n,k),B.m(k,null),C||(E=[y(a,"input",e[51]),y(f,"input",e[52]),y(v,"click",e[29])],C=!0)},p(e,t){131072&t[0]&&a.value!==e[17]&&I(a,e[17]),262144&t[0]&&f.value!==e[18]&&I(f,e[18]),4&t[0]&&(v.disabled=e[2]),S===(S=x(e))&&B?B.p(e,t):(B.d(1),B=S(e),B&&(B.c(),B.m(k,null)))},d(e){e&&d(t),B.d(),C=!1,i(E)}}}function lg(t){let n;return{c(){n=p("div"),n.innerHTML="

No blocked IPs configured.

",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function cg(e){let t,n=e[16],i=[];for(let t=0;t0?hg:pg}let x=E(e),S=x(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Allowed Event Kinds",s=m(),o=p("div"),a=p("input"),l=m(),f=p("button"),h=g("Allow Kind"),v=m(),w=p("div"),S.c(),b(r,"class","svelte-1y8wjwc"),b(a,"type","number"),b(a,"placeholder","Kind number"),b(a,"class","svelte-1y8wjwc"),f.disabled=e[2],b(f,"class","svelte-1y8wjwc"),b(o,"class","add-form svelte-1y8wjwc"),b(w,"class","list svelte-1y8wjwc"),b(n,"class","section svelte-1y8wjwc"),b(t,"class","kinds-section")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),I(a,e[20]),c(o,l),c(o,f),c(f,h),c(n,v),c(n,w),S.m(w,null),k||(C=[y(a,"input",e[53]),y(f,"click",e[30])],k=!0)},p(e,t){1048576&t[0]&&A(a.value)!==e[20]&&I(a,e[20]),4&t[0]&&(f.disabled=e[2]),x===(x=E(e))&&S?S.p(e,t):(S.d(1),S=x(e),S&&(S.c(),S.m(w,null)))},d(e){e&&d(t),S.d(),k=!1,i(C)}}}function pg(t){let n;return{c(){n=p("div"),n.innerHTML="

No allowed kinds configured. All kinds are\n allowed by default.

",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function hg(e){let t,n=e[19],i=[];for(let t=0;t0?yg:vg}let w=v(e),A=w(e);return{c(){t=p("div"),n=p("div"),i=p("h3"),i.textContent="Events Needing Moderation",r=m(),s=p("button"),o=g("Refresh"),a=m(),l=p("div"),A.c(),b(i,"class","svelte-1y8wjwc"),s.disabled=e[2],b(l,"class","list svelte-1y8wjwc"),b(n,"class","section svelte-1y8wjwc"),b(t,"class","moderation-section")},m(d,p){u(d,t,p),c(t,n),c(n,i),c(n,r),c(n,s),c(s,o),c(n,a),c(n,l),A.m(l,null),f||(h=y(s,"click",e[24]),f=!0)},p(e,t){4&t[0]&&(s.disabled=e[2]),w===(w=v(e))&&A?A.p(e,t):(A.d(1),A=w(e),A&&(A.c(),A.m(l,null)))},d(e){e&&d(t),A.d(),f=!1,h()}}}function vg(t){let n;return{c(){n=p("div"),n.innerHTML="

No events need moderation at this time.

",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function yg(e){let t,n=e[21],i=[];for(let t=0;tManaged ACL Configuration \n

Configure access control using NIP-86 management API

\n
Owner Only: This interface is restricted to relay owners\n only.
',s=m(),q&&q.c(),o=m(),a=p("div"),l=p("button"),f=g("Pubkeys"),v=m(),w=p("button"),A=g("Events"),I=m(),C=p("button"),E=g("IPs"),S=m(),B=p("button"),Q=g("Kinds"),D=m(),$=p("button"),P=g("Moderation"),T=m(),U=p("button"),_=g("Relay Config"),L=m(),O=p("div"),Y&&Y.c(),M=m(),W&&W.c(),j=m(),z&&z.c(),H=m(),Z&&Z.c(),G=m(),X&&X.c(),J=m(),ee&&ee.c(),b(r,"class","header svelte-1y8wjwc"),b(l,"class",h="tab "+("pubkeys"===t[1]?"active":"")+" svelte-1y8wjwc"),b(w,"class",k="tab "+("events"===t[1]?"active":"")+" svelte-1y8wjwc"),b(C,"class",x="tab "+("ips"===t[1]?"active":"")+" svelte-1y8wjwc"),b(B,"class",F="tab "+("kinds"===t[1]?"active":"")+" svelte-1y8wjwc"),b($,"class",R="tab "+("moderation"===t[1]?"active":"")+" svelte-1y8wjwc"),b(U,"class",N="tab "+("relay"===t[1]?"active":"")+" svelte-1y8wjwc"),b(a,"class","tabs svelte-1y8wjwc"),b(O,"class","tab-content svelte-1y8wjwc")},m(e,i){u(e,n,i),c(n,r),c(n,s),q&&q.m(n,null),c(n,o),c(n,a),c(a,l),c(l,f),c(a,v),c(a,w),c(w,A),c(a,I),c(a,C),c(C,E),c(a,S),c(a,B),c(B,Q),c(a,D),c(a,$),c($,P),c(a,T),c(a,U),c(U,_),c(n,L),c(n,O),Y&&Y.m(O,null),c(O,M),W&&W.m(O,null),c(O,j),z&&z.m(O,null),c(O,H),Z&&Z.m(O,null),c(O,G),X&&X.m(O,null),c(O,J),ee&&ee.m(O,null),K||(V=[y(l,"click",t[37]),y(w,"click",t[38]),y(C,"click",t[39]),y(B,"click",t[40]),y($,"click",t[41]),y(U,"click",t[42])],K=!0)},p(e,t){e[3]?q?q.p(e,t):(q=Hh(e),q.c(),q.m(n,o)):q&&(q.d(1),q=null),2&t[0]&&h!==(h="tab "+("pubkeys"===e[1]?"active":"")+" svelte-1y8wjwc")&&b(l,"class",h),2&t[0]&&k!==(k="tab "+("events"===e[1]?"active":"")+" svelte-1y8wjwc")&&b(w,"class",k),2&t[0]&&x!==(x="tab "+("ips"===e[1]?"active":"")+" svelte-1y8wjwc")&&b(C,"class",x),2&t[0]&&F!==(F="tab "+("kinds"===e[1]?"active":"")+" svelte-1y8wjwc")&&b(B,"class",F),2&t[0]&&R!==(R="tab "+("moderation"===e[1]?"active":"")+" svelte-1y8wjwc")&&b($,"class",R),2&t[0]&&N!==(N="tab "+("relay"===e[1]?"active":"")+" svelte-1y8wjwc")&&b(U,"class",N),"pubkeys"===e[1]?Y?Y.p(e,t):(Y=Gh(e),Y.c(),Y.m(O,M)):Y&&(Y.d(1),Y=null),"events"===e[1]?W?W.p(e,t):(W=Xh(e),W.c(),W.m(O,j)):W&&(W.d(1),W=null),"ips"===e[1]?z?z.p(e,t):(z=ag(e),z.c(),z.m(O,H)):z&&(z.d(1),z=null),"kinds"===e[1]?Z?Z.p(e,t):(Z=fg(e),Z.c(),Z.m(O,G)):Z&&(Z.d(1),Z=null),"moderation"===e[1]?X?X.p(e,t):(X=mg(e),X.c(),X.m(O,J)):X&&(X.d(1),X=null),"relay"===e[1]?ee?ee.p(e,t):(ee=Ag(e),ee.c(),ee.m(O,null)):ee&&(ee.d(1),ee=null)},i:e,o:e,d(e){e&&d(n),q&&q.d(),Y&&Y.d(),W&&W.d(),z&&z.d(),Z&&Z.d(),X&&X.d(),ee&&ee.d(),K=!1,i(V)}}}function Eg(e,t,n){let{userSigner:i}=t,{userPubkey:r}=t,s="pubkeys",o=!1,a="",l="info",c=[],u="",d="",f=[],p="",h="",g=[],m="",v="",y="",w="",b=[],k="",I="",C=[],E="",x=[],S={relay_name:"",relay_description:"",relay_icon:""};async function B(){try{n(2,o=!0),console.log("Fetching relay info from /");const e=await fetch(window.location.origin+"/",{headers:{Accept:"application/nostr+json"}});if(console.log("Response status:",e.status),console.log("Response headers:",e.headers),e.ok){const t=await e.json();console.log("Raw relay info:",t),n(0,S={relay_name:t.name||"",relay_description:t.description||"",relay_icon:t.icon||""}),console.log("Updated relayConfig:",S),console.log("Loaded relay info:",t),n(3,a="Relay configuration loaded successfully"),n(4,l="success")}else console.error("Failed to fetch relay info, status:",e.status),n(3,a=`Failed to fetch relay info: ${e.status}`),n(4,l="error")}catch(e){console.error("Failed to fetch relay info:",e),n(3,a=`Failed to fetch relay info: ${e.message}`),n(4,l="error")}finally{n(2,o=!1)}}async function Q(e,t=[]){try{n(2,o=!0),n(3,a="");const s={method:e,params:t},l=await async function(e,t){if(!i)throw new Error("No signer available for authentication. Please log in with a Nostr extension.");if(!r)throw new Error("No user pubkey available for authentication.");const n=window.location.origin+t,s={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",n],["method",e]],content:"",pubkey:r},o=await i.signEvent(s),a=JSON.stringify(o);return`Nostr ${btoa(a)}`}("POST","/api/nip86"),c=await fetch("/api/nip86",{method:"POST",headers:{"Content-Type":"application/nostr+json+rpc",Authorization:l},body:JSON.stringify(s)});if(!c.ok)throw new Error(`HTTP ${c.status}: ${c.statusText}`);const u=await c.json();if(u.error)throw new Error(u.error);return u.result}catch(e){throw console.error("NIP-86 API error:",e),n(3,a=e.message),n(4,l="error"),e}finally{n(2,o=!1)}}async function F(){try{n(5,c=await Q("listbannedpubkeys"))}catch(e){console.error("Failed to load banned pubkeys:",e)}}async function $(){try{n(8,f=await Q("listallowedpubkeys"))}catch(e){console.error("Failed to load allowed pubkeys:",e)}}async function P(){try{n(11,g=await Q("listbannedevents"))}catch(e){console.error("Failed to load banned events:",e)}}async function R(){try{n(16,b=await Q("listblockedips"))}catch(e){console.error("Failed to load blocked IPs:",e)}}async function T(){try{n(19,C=await Q("listallowedkinds"))}catch(e){console.error("Failed to load allowed kinds:",e)}}async function U(){try{n(2,o=!0),n(21,x=await Q("listeventsneedingmoderation")),console.log("Loaded events needing moderation:",x)}catch(e){console.error("Failed to load events needing moderation:",e),n(3,a=`Failed to load moderation events: ${e.message}`),n(4,l="error"),n(21,x=[])}finally{n(2,o=!1)}}async function _(e){try{await Q("disallowkind",[e]),n(3,a="Kind disallowed successfully"),n(4,l="success"),await T()}catch(e){console.error("Failed to disallow kind:",e)}}async function N(e){try{await Q("allowevent",[e,"Approved from moderation queue"]),n(3,a="Event allowed successfully"),n(4,l="success"),await U()}catch(e){console.error("Failed to allow event from moderation:",e)}}async function L(e){try{await Q("banevent",[e,"Banned from moderation queue"]),n(3,a="Event banned successfully"),n(4,l="success"),await U()}catch(e){console.error("Failed to ban event from moderation:",e)}}D(()=>{setTimeout(()=>{B()},100)}),async function(){await Promise.all([F(),$(),P(),R(),T()])}();return e.$$set=e=>{"userSigner"in e&&n(35,i=e.userSigner),"userPubkey"in e&&n(36,r=e.userPubkey)},e.$$.update=()=>{1&e.$$.dirty[0]&&console.log("relayConfig changed:",S)},[S,s,o,a,l,c,u,d,f,p,h,g,m,v,y,w,b,k,I,C,E,x,[],B,U,async function(){if(u)try{await Q("banpubkey",[u,d]),n(3,a="Pubkey banned successfully"),n(4,l="success"),n(6,u=""),n(7,d=""),await F()}catch(e){console.error("Failed to ban pubkey:",e)}},async function(){if(p)try{await Q("allowpubkey",[p,h]),n(3,a="Pubkey allowed successfully"),n(4,l="success"),n(9,p=""),n(10,h=""),await $()}catch(e){console.error("Failed to allow pubkey:",e)}},async function(){if(m)try{await Q("banevent",[m,v]),n(3,a="Event banned successfully"),n(4,l="success"),n(12,m=""),n(13,v=""),await P()}catch(e){console.error("Failed to ban event:",e)}},async function(){if(y)try{await Q("allowevent",[y,w]),n(3,a="Event allowed successfully"),n(4,l="success"),n(14,y=""),n(15,w="")}catch(e){console.error("Failed to allow event:",e)}},async function(){if(k)try{await Q("blockip",[k,I]),n(3,a="IP blocked successfully"),n(4,l="success"),n(17,k=""),n(18,I=""),await R()}catch(e){console.error("Failed to block IP:",e)}},async function(){if(!E)return;const e=parseInt(E);if(isNaN(e))return n(3,a="Invalid kind number"),void n(4,l="error");try{await Q("allowkind",[e]),n(3,a="Kind allowed successfully"),n(4,l="success"),n(20,E=""),await T()}catch(e){console.error("Failed to allow kind:",e)}},_,async function(){try{n(2,o=!0),n(3,a="");const e=[];if(S.relay_name&&e.push(Q("changerelayname",[S.relay_name])),S.relay_description&&e.push(Q("changerelaydescription",[S.relay_description])),S.relay_icon&&e.push(Q("changerelayicon",[S.relay_icon])),0===e.length)return n(3,a="No changes to update"),void n(4,l="info");await Promise.all(e),n(3,a="Relay configuration updated successfully"),n(4,l="success"),await B()}catch(e){console.error("Failed to update relay configuration:",e),n(3,a=`Failed to update relay configuration: ${e.message}`),n(4,l="error")}finally{n(2,o=!1)}},N,L,i,r,()=>n(1,s="pubkeys"),()=>n(1,s="events"),()=>n(1,s="ips"),()=>n(1,s="kinds"),()=>{n(1,s="moderation"),x&&0!==x.length||U()},()=>n(1,s="relay"),function(){u=this.value,n(6,u)},function(){d=this.value,n(7,d)},function(){p=this.value,n(9,p)},function(){h=this.value,n(10,h)},function(){m=this.value,n(12,m)},function(){v=this.value,n(13,v)},function(){y=this.value,n(14,y)},function(){w=this.value,n(15,w)},function(){k=this.value,n(17,k)},function(){I=this.value,n(18,I)},function(){E=A(this.value),n(20,E)},e=>_(e),e=>N(e.id),e=>L(e.id),function(){S.relay_name=this.value,n(0,S)},function(){S.relay_description=this.value,n(0,S)},function(){S.relay_icon=this.value,n(0,S)}]}class xg extends se{constructor(e){super(),re(this,e,Eg,Cg,s,{userSigner:35,userPubkey:36},null,[-1,-1,-1])}}function Sg(e){let t,n;return{c(){t=p("span"),n=g(e[3]),b(t,"class","permission-badge svelte-1qkhxam")},m(e,i){u(e,t,i),c(t,n)},p(e,t){8&t&&k(n,e[3])},d(e){e&&d(t)}}}function Bg(t){let n,i,r;return{c(){n=p("button"),n.textContent="Log in",b(n,"class","login-btn svelte-1qkhxam")},m(e,s){u(e,n,s),i||(r=y(n,"click",t[7]),i=!0)},p:e,d(e){e&&d(n),i=!1,r()}}}function Qg(e){let t,n,i,r,s,o,a=(e[4]?.name||e[5])+"";function l(e,t){return e[4]?.picture?Dg:Fg}let f=l(e),h=f(e);return{c(){t=p("button"),h.c(),n=m(),i=p("span"),r=g(a),b(i,"class","user-name svelte-1qkhxam"),b(t,"class","user-profile-btn svelte-1qkhxam")},m(a,l){u(a,t,l),h.m(t,null),c(t,n),c(t,i),c(i,r),s||(o=y(t,"click",e[6]),s=!0)},p(e,i){f===(f=l(e))&&h?h.p(e,i):(h.d(1),h=f(e),h&&(h.c(),h.m(t,n))),48&i&&a!==(a=(e[4]?.name||e[5])+"")&&k(r,a)},d(e){e&&d(t),h.d(),s=!1,o()}}}function Fg(t){let n;return{c(){n=p("div"),n.textContent="👤",b(n,"class","user-avatar-placeholder svelte-1qkhxam")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Dg(e){let t,n;return{c(){t=p("img"),a(t.src,n=e[4].picture)||b(t,"src",n),b(t,"alt","User avatar"),b(t,"class","user-avatar svelte-1qkhxam")},m(e,n){u(e,t,n)},p(e,i){16&i&&!a(t.src,n=e[4].picture)&&b(t,"src",n)},d(e){e&&d(t)}}}function $g(t){let n,i,r,s,o,l,f,h,v,y,w=t[1]&&t[2]&&Sg(t);function A(e,t){return e[1]?Qg:Bg}let k=A(t),I=k(t);return{c(){n=p("header"),i=p("div"),r=p("img"),o=m(),l=p("div"),f=p("span"),h=g("ORLY? dashboard\n "),w&&w.c(),v=m(),y=p("div"),I.c(),a(r.src,s="/orly.png")||b(r,"src","/orly.png"),b(r,"alt","ORLY Logo"),b(r,"class","logo svelte-1qkhxam"),b(f,"class","app-title svelte-1qkhxam"),b(l,"class","header-title svelte-1qkhxam"),b(y,"class","header-buttons svelte-1qkhxam"),b(i,"class","header-content svelte-1qkhxam"),b(n,"class","main-header svelte-1qkhxam"),S(n,"dark-theme",t[0])},m(e,t){u(e,n,t),c(n,i),c(i,r),c(i,o),c(i,l),c(l,f),c(f,h),w&&w.m(f,null),c(i,v),c(i,y),I.m(y,null)},p(e,[t]){e[1]&&e[2]?w?w.p(e,t):(w=Sg(e),w.c(),w.m(f,null)):w&&(w.d(1),w=null),k===(k=A(e))&&I?I.p(e,t):(I.d(1),I=k(e),I&&(I.c(),I.m(y,null))),1&t&&S(n,"dark-theme",e[0])},i:e,o:e,d(e){e&&d(n),w&&w.d(),I.d()}}}function Pg(e,t,n){let{isDarkTheme:i=!1}=t,{isLoggedIn:r=!1}=t,{userRole:s=""}=t,{currentEffectiveRole:o=""}=t,{userProfile:a=null}=t,{userPubkey:l=""}=t;const c=P();return e.$$set=e=>{"isDarkTheme"in e&&n(0,i=e.isDarkTheme),"isLoggedIn"in e&&n(1,r=e.isLoggedIn),"userRole"in e&&n(2,s=e.userRole),"currentEffectiveRole"in e&&n(3,o=e.currentEffectiveRole),"userProfile"in e&&n(4,a=e.userProfile),"userPubkey"in e&&n(5,l=e.userPubkey)},[i,r,s,o,a,l,function(){c("openSettingsDrawer")},function(){c("openLoginModal")}]}class Rg extends se{constructor(e){super(),re(this,e,Pg,$g,s,{isDarkTheme:0,isLoggedIn:1,userRole:2,currentEffectiveRole:3,userProfile:4,userPubkey:5})}}function Tg(e,t,n){const i=e.slice();return i[10]=t[n],i}function Ug(e){let t,n,r;function s(){return e[6](e[10])}function o(...t){return e[7](e[10],...t)}return{c(){t=p("span"),t.textContent="✕",b(t,"class","tab-close-icon svelte-wfmuj"),b(t,"role","button"),b(t,"tabindex","0")},m(e,i){u(e,t,i),n||(r=[y(t,"click",w(s)),y(t,"keydown",o)],n=!0)},p(t,n){e=t},d(e){e&&d(t),n=!1,i(r)}}}function _g(e){let t,n,i,r,s,o,a,l,f,h,v=e[10].icon+"",w=e[10].label+"",A=e[10].isSearchTab&&Ug(e);function I(){return e[8](e[10])}return{c(){t=p("button"),n=p("span"),i=g(v),r=m(),s=p("span"),o=g(w),a=m(),A&&A.c(),l=m(),b(n,"class","tab-icon svelte-wfmuj"),b(s,"class","tab-label svelte-wfmuj"),b(t,"class","tab svelte-wfmuj"),S(t,"active",e[2]===e[10].id)},m(e,d){u(e,t,d),c(t,n),c(n,i),c(t,r),c(t,s),c(s,o),c(t,a),A&&A.m(t,null),c(t,l),f||(h=y(t,"click",I),f=!0)},p(n,r){e=n,2&r&&v!==(v=e[10].icon+"")&&k(i,v),2&r&&w!==(w=e[10].label+"")&&k(o,w),e[10].isSearchTab?A?A.p(e,r):(A=Ug(e),A.c(),A.m(t,l)):A&&(A.d(1),A=null),6&r&&S(t,"active",e[2]===e[10].id)},d(e){e&&d(t),A&&A.d(),f=!1,h()}}}function Ng(e){let t,n,i,r,s,o,a,l;return{c(){t=p("a"),n=h("svg"),i=h("path"),r=h("path"),s=m(),o=p("span"),a=g("v"),l=g(e[3]),b(i,"d","M5 6h12v2h1.5c1.38 0 2.5 1.12 2.5 2.5v1c0 1.38-1.12 2.5-2.5 2.5H17v1c0 1.66-1.34 3-3 3H8c-1.66 0-3-1.34-3-3V6zm12 6h1.5c.28 0 .5-.22.5-.5v-1c0-.28-.22-.5-.5-.5H17v2z"),b(r,"d","M9 9c1.5 0 3 .5 3 2.5S10.5 14 9 14c0-1.5.5-3.5 2-4.5"),b(r,"stroke","currentColor"),b(r,"stroke-width","1"),b(r,"fill","none"),b(n,"class","version-icon svelte-wfmuj"),b(n,"viewBox","0 0 24 24"),b(n,"fill","currentColor"),b(n,"xmlns","http://www.w3.org/2000/svg"),b(o,"class","version-text svelte-wfmuj"),b(t,"href","https://next.orly.dev"),b(t,"target","_blank"),b(t,"rel","noopener noreferrer"),b(t,"class","version-link svelte-wfmuj")},m(e,d){u(e,t,d),c(t,n),c(n,i),c(n,r),c(t,s),c(t,o),c(o,a),c(o,l)},p(e,t){8&t&&k(l,e[3])},d(e){e&&d(t)}}}function Lg(t){let n,i,r,s,o=t[1],a=[];for(let e=0;e{"isDarkTheme"in e&&n(0,i=e.isDarkTheme),"tabs"in e&&n(1,r=e.tabs),"selectedTab"in e&&n(2,s=e.selectedTab),"version"in e&&n(3,o=e.version)},[i,r,s,o,l,c,e=>c(e.id),(e,t)=>"Enter"===t.key&&c(e.id),e=>l(e.id)]}class Mg extends se{constructor(e){super(),re(this,e,Og,Lg,s,{isDarkTheme:0,tabs:1,selectedTab:2,version:3})}}function jg(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in to access export functionality.",r=m(),s=p("button"),s.textContent="Log In",b(i,"class","svelte-jzrdtj"),b(s,"class","login-btn svelte-jzrdtj"),b(n,"class","login-prompt svelte-jzrdtj")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[5]),o=!0)},p:e,d(e){e&&d(n),o=!1,a()}}}function Hg(e){let t,n,i=e[0]&&Gg(e),r=e[1]&&Jg(e);return{c(){i&&i.c(),t=m(),r&&r.c(),n=v()},m(e,s){i&&i.m(e,s),u(e,t,s),r&&r.m(e,s),u(e,n,s)},p(e,s){e[0]?i?i.p(e,s):(i=Gg(e),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),e[1]?r?r.p(e,s):(r=Jg(e),r.c(),r.m(n.parentNode,n)):r&&(r.d(1),r=null)},d(e){i&&i.d(e),e&&d(t),r&&r.d(e),e&&d(n)}}}function Gg(t){let n,i,r,s,o,a,l,f;return{c(){n=p("div"),i=p("h3"),i.textContent="Export My Events",r=m(),s=p("p"),s.textContent="Download your personal events as a JSONL file.",o=m(),a=p("button"),a.textContent="📤 Export My Events",b(i,"class","svelte-jzrdtj"),b(s,"class","svelte-jzrdtj"),b(a,"class","export-btn svelte-jzrdtj"),b(n,"class","export-section svelte-jzrdtj")},m(e,d){u(e,n,d),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),l||(f=y(a,"click",t[3]),l=!0)},p:e,d(e){e&&d(n),l=!1,f()}}}function Jg(t){let n,i,r,s,o,a,l,f;return{c(){n=p("div"),i=p("h3"),i.textContent="Export All Events",r=m(),s=p("p"),s.textContent="Download the complete database as a JSONL file. This includes\n all events from all users.",o=m(),a=p("button"),a.textContent="📤 Export All Events",b(i,"class","svelte-jzrdtj"),b(s,"class","svelte-jzrdtj"),b(a,"class","export-btn svelte-jzrdtj"),b(n,"class","export-section svelte-jzrdtj")},m(e,d){u(e,n,d),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),l||(f=y(a,"click",t[4]),l=!0)},p:e,d(e){e&&d(n),l=!1,f()}}}function Kg(t){let n;function i(e,t){return e[2]?Hg:jg}let r=i(t),s=r(t);return{c(){s.c(),n=v()},m(e,t){s.m(e,t),u(e,n,t)},p(e,[t]){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n.parentNode,n)))},i:e,o:e,d(e){s.d(e),e&&d(n)}}}function Vg(e,t,n){let i,r,{isLoggedIn:s=!1}=t,{currentEffectiveRole:o=""}=t,{aclMode:a=""}=t;const l=P();return e.$$set=e=>{"isLoggedIn"in e&&n(0,s=e.isLoggedIn),"currentEffectiveRole"in e&&n(6,o=e.currentEffectiveRole),"aclMode"in e&&n(7,a=e.aclMode)},e.$$.update=()=>{129&e.$$.dirty&&n(2,i="none"===a||s),192&e.$$.dirty&&n(1,r="none"===a||"admin"===o||"owner"===o)},[s,r,i,function(){l("exportMyEvents")},function(){l("exportAllEvents")},function(){l("openLoginModal")},o,a]}class qg extends se{constructor(e){super(),re(this,e,Vg,Kg,s,{isLoggedIn:0,currentEffectiveRole:6,aclMode:7})}}function Yg(t){let n,i,r,s,o,a,l,f;return{c(){n=p("div"),i=p("h3"),i.textContent="Import Events",r=m(),s=p("p"),s.textContent="Please log in to access import functionality.",o=m(),a=p("button"),a.textContent="Log In",b(i,"class","recovery-header svelte-nonyqh"),b(s,"class","recovery-description svelte-nonyqh"),b(a,"class","login-btn svelte-nonyqh"),b(n,"class","login-prompt svelte-nonyqh")},m(e,d){u(e,n,d),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),l||(f=y(a,"click",t[6]),l=!0)},p:e,d(e){e&&d(n),l=!1,f()}}}function Wg(t){let n;return{c(){n=p("div"),n.innerHTML='

Import Events

\n

Admin or owner permission required for import functionality.

',b(n,"class","permission-denied svelte-nonyqh")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function zg(e){let t,n,r,s,o,a,l,f,h,v,w,A,k,I,C=e[2]&&Zg(e);return{c(){t=p("h3"),t.textContent="Import Events",n=m(),r=p("p"),r.textContent="Upload a JSONL file to import events into the database.",s=m(),o=p("div"),a=p("input"),l=m(),f=p("div"),h=p("button"),v=g("Import Events"),A=m(),C&&C.c(),b(t,"class","svelte-nonyqh"),b(r,"class","svelte-nonyqh"),b(a,"type","file"),b(a,"id","import-file"),b(a,"accept",".jsonl,.txt"),b(a,"class","svelte-nonyqh"),b(h,"class","import-btn svelte-nonyqh"),h.disabled=w=!e[1]||"Uploading..."===e[2],b(f,"class","import-row svelte-nonyqh"),b(o,"class","recovery-controls-card svelte-nonyqh")},m(i,d){u(i,t,d),u(i,n,d),u(i,r,d),u(i,s,d),u(i,o,d),c(o,a),c(o,l),c(o,f),c(f,h),c(h,v),c(f,A),C&&C.m(f,null),k||(I=[y(a,"change",e[4]),y(h,"click",e[5])],k=!0)},p(e,t){6&t&&w!==(w=!e[1]||"Uploading..."===e[2])&&(h.disabled=w),e[2]?C?C.p(e,t):(C=Zg(e),C.c(),C.m(f,null)):C&&(C.d(1),C=null)},d(e){e&&d(t),e&&d(n),e&&d(r),e&&d(s),e&&d(o),C&&C.d(),k=!1,i(I)}}}function Zg(e){let t,n;return{c(){t=p("span"),n=g(e[2]),b(t,"class","import-message svelte-nonyqh"),S(t,"uploading","Uploading..."===e[2]),S(t,"success","Upload complete"===e[2]),S(t,"error",e[2].startsWith("Import failed")||e[2].startsWith("Admin")||e[2].startsWith("Please"))},m(e,i){u(e,t,i),c(t,n)},p(e,i){4&i&&k(n,e[2]),4&i&&S(t,"uploading","Uploading..."===e[2]),4&i&&S(t,"success","Upload complete"===e[2]),4&i&&S(t,"error",e[2].startsWith("Import failed")||e[2].startsWith("Admin")||e[2].startsWith("Please"))},d(e){e&&d(t)}}}function Xg(t){let n;function i(e,t){return e[3]?zg:e[0]?Wg:Yg}let r=i(t),s=r(t);return{c(){n=p("div"),s.c(),b(n,"class","import-section svelte-nonyqh")},m(e,t){u(e,n,t),s.m(n,null)},p(e,[t]){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n,null)))},i:e,o:e,d(e){e&&d(n),s.d()}}}function em(e,t,n){let i,{isLoggedIn:r=!1}=t,{currentEffectiveRole:s=""}=t,{selectedFile:o=null}=t,{aclMode:a=""}=t,{importMessage:l=""}=t;const c=P();return e.$$set=e=>{"isLoggedIn"in e&&n(0,r=e.isLoggedIn),"currentEffectiveRole"in e&&n(7,s=e.currentEffectiveRole),"selectedFile"in e&&n(1,o=e.selectedFile),"aclMode"in e&&n(8,a=e.aclMode),"importMessage"in e&&n(2,l=e.importMessage)},e.$$.update=()=>{385&e.$$.dirty&&n(3,i="none"===a||r&&("admin"===s||"owner"===s))},[r,o,l,i,function(e){c("fileSelect",e)},function(){c("importEvents")},function(){c("openLoginModal")},s,a]}class tm extends se{constructor(e){super(),re(this,e,em,Xg,s,{isLoggedIn:0,currentEffectiveRole:7,selectedFile:1,aclMode:8,importMessage:2})}}const nm={0:"Profile Metadata",1:"Text Note",2:"Recommend Relay",3:"Contacts",4:"Encrypted DM",5:"Delete Request",6:"Repost",7:"Reaction",8:"Badge Award",16:"Generic Repost",40:"Channel Creation",41:"Channel Metadata",42:"Channel Message",43:"Channel Hide Message",44:"Channel Mute User",1063:"File Metadata",1311:"Live Chat Message",1984:"Reporting",1985:"Label",9734:"Zap Request",9735:"Zap Receipt",1e4:"Mute List",10001:"Pin List",10002:"Relay List Metadata",10003:"Bookmark List",10004:"Communities List",10005:"Public Chats List",10006:"Blocked Relays List",10007:"Search Relays List",10009:"User Groups",10015:"Interests List",10030:"User Emoji List",13194:"Wallet Info",22242:"Client Auth",23194:"Wallet Request",23195:"Wallet Response",24133:"Nostr Connect",27235:"HTTP Auth",3e4:"Categorized People List",30001:"Categorized Bookmarks",30002:"Categorized Relay List",30003:"Bookmark Sets",30004:"Curation Sets",30005:"Video Sets",30008:"Profile Badges",30009:"Badge Definition",30015:"Interest Sets",30017:"Create/Update Stall",30018:"Create/Update Product",30019:"Marketplace UI/UX",30020:"Product Sold As Auction",30023:"Long-form Content",30024:"Draft Long-form Content",30030:"Emoji Sets",30063:"Release Artifact Sets",30078:"Application-specific Data",30311:"Live Event",30315:"User Statuses",30388:"Slide Set",30402:"Classified Listing",30403:"Draft Classified Listing",30617:"Repository Announcement",30618:"Repository State Announcement",30818:"Wiki Article",30819:"Redirects",31922:"Date-Based Calendar Event",31923:"Time-Based Calendar Event",31924:"Calendar",31925:"Calendar Event RSVP",31989:"Handler Recommendation",31990:"Handler Information",34550:"Community Definition",34551:"Community Post Approval"};function im(e,t=null){if(!e||"string"!=typeof e)return!1;return!!/^[0-9a-fA-F]+$/.test(e)&&(!t||e.length===t)}function rm(e){const t=new Date(1e3*e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function sm(e){return Math.floor(new Date(e).getTime()/1e3)}function om(e,t,n){const i=e.slice();return i[62]=t[n],i[64]=n,i}function am(e,t,n){const i=e.slice();return i[65]=t[n],i}function lm(e,t,n){const i=e.slice();return i[68]=t[n],i}function cm(e,t,n){const i=e.slice();return i[71]=t[n],i}function um(e,t,n){const i=e.slice();return i[71]=t[n].kind,i[74]=t[n].name,i}function dm(e){let t,n,i,r,s,o,a=e[20],l=[];for(let t=0;t0&&pm(t),Ge=t[17]&&gm(t),Je=t[2].length>0&&mm(t),Ke=t[18]&&ym(t),Ve=t[3].length>0&&wm(t),qe=t[19]&&Am(t),Ye=t[4].length>0&&km(t),We=t[5]&&Cm(t),ze=t[6]&&Em(t),Ze=t[8]&&xm(t);return{c(){n=p("div"),r=p("div"),s=p("div"),o=p("label"),o.textContent="Search Text (NIP-50)",a=m(),l=p("div"),f=p("input"),h=m(),v=p("label"),v.textContent="Event Kinds",w=m(),C=p("div"),E=p("button"),x=g(Oe),B=g(" Select Kinds ("),Q=g(Me),F=g(" selected)"),D=m(),je&&je.c(),$=m(),He&&He.c(),P=m(),R=p("label"),R.textContent="Authors (Pubkeys)",T=m(),U=p("div"),_=p("div"),N=p("input"),L=m(),O=p("button"),O.textContent="Add",M=m(),Ge&&Ge.c(),j=m(),Je&&Je.c(),H=m(),G=p("label"),G.textContent="Event IDs",J=m(),K=p("div"),V=p("div"),q=p("input"),Y=m(),W=p("button"),W.textContent="Add",z=m(),Ke&&Ke.c(),Z=m(),Ve&&Ve.c(),X=m(),ee=p("label"),ee.textContent="Tags (#e, #p, #a)",te=m(),ne=p("div"),ie=p("div"),re=p("span"),re.textContent="#",se=m(),oe=p("input"),ae=m(),le=p("input"),ce=m(),ue=p("button"),ue.textContent="Add",de=m(),qe&&qe.c(),fe=m(),Ye&&Ye.c(),pe=m(),he=p("label"),he.textContent="Since",ge=m(),me=p("div"),ve=p("input"),ye=m(),We&&We.c(),we=m(),be=p("label"),be.textContent="Until",Ae=m(),ke=p("div"),Ie=p("input"),Ce=m(),ze&&ze.c(),Ee=m(),xe=p("label"),xe.textContent="Limit",Se=m(),Be=p("div"),Qe=p("input"),Fe=m(),Ze&&Ze.c(),De=m(),$e=p("div"),Pe=p("button"),Pe.textContent="🧹",Re=m(),Te=p("div"),Ue=m(),_e=p("button"),_e.textContent="",b(o,"for","search-text"),b(o,"class","svelte-1a1v6k0"),b(f,"id","search-text"),b(f,"type","text"),b(f,"placeholder","Search events..."),b(f,"class","filter-input svelte-1a1v6k0"),b(l,"class","field-content svelte-1a1v6k0"),b(v,"class","svelte-1a1v6k0"),b(E,"class","picker-toggle-btn svelte-1a1v6k0"),b(C,"class","field-content svelte-1a1v6k0"),b(R,"class","svelte-1a1v6k0"),b(N,"type","text"),b(N,"placeholder","64 character hex pubkey..."),b(N,"class","filter-input svelte-1a1v6k0"),b(N,"maxlength","64"),b(O,"class","add-btn svelte-1a1v6k0"),b(_,"class","input-group svelte-1a1v6k0"),b(U,"class","field-content svelte-1a1v6k0"),b(G,"class","svelte-1a1v6k0"),b(q,"type","text"),b(q,"placeholder","64 character hex event ID..."),b(q,"class","filter-input svelte-1a1v6k0"),b(q,"maxlength","64"),b(W,"class","add-btn svelte-1a1v6k0"),b(V,"class","input-group svelte-1a1v6k0"),b(K,"class","field-content svelte-1a1v6k0"),b(ee,"class","svelte-1a1v6k0"),b(re,"class","hash-prefix svelte-1a1v6k0"),b(oe,"type","text"),b(oe,"placeholder","Tag"),b(oe,"class","filter-input tag-name-input svelte-1a1v6k0"),b(oe,"maxlength","1"),b(le,"type","text"),b(le,"placeholder","Value..."),b(le,"class","filter-input tag-value-input svelte-1a1v6k0"),b(ue,"class","add-btn svelte-1a1v6k0"),b(ie,"class","tag-input-group svelte-1a1v6k0"),b(ne,"class","field-content svelte-1a1v6k0"),b(he,"for","since-timestamp"),b(he,"class","svelte-1a1v6k0"),b(ve,"id","since-timestamp"),b(ve,"type","datetime-local"),ve.value=t[32](),b(ve,"class","filter-input svelte-1a1v6k0"),b(me,"class","field-content timestamp-field svelte-1a1v6k0"),b(be,"for","until-timestamp"),b(be,"class","svelte-1a1v6k0"),b(Ie,"id","until-timestamp"),b(Ie,"type","datetime-local"),Ie.value=t[33](),b(Ie,"class","filter-input svelte-1a1v6k0"),b(ke,"class","field-content timestamp-field svelte-1a1v6k0"),b(xe,"for","limit"),b(xe,"class","svelte-1a1v6k0"),b(Qe,"id","limit"),b(Qe,"type","number"),b(Qe,"placeholder","Max events to return"),b(Qe,"class","filter-input svelte-1a1v6k0"),b(Qe,"min","1"),b(Be,"class","field-content svelte-1a1v6k0"),b(s,"class","filter-grid svelte-1a1v6k0"),b(r,"class","filter-content svelte-1a1v6k0"),b(Pe,"class","clear-all-btn svelte-1a1v6k0"),b(Pe,"title","Clear all filters"),b(Te,"class","spacer svelte-1a1v6k0"),b(_e,"class","json-toggle-btn svelte-1a1v6k0"),b(_e,"title","Edit filter JSON"),S(_e,"active",t[8]),b($e,"class","clear-column svelte-1a1v6k0"),b(n,"class","filter-builder svelte-1a1v6k0")},m(e,i){u(e,n,i),c(n,r),c(r,s),c(s,o),c(s,a),c(s,l),c(l,f),I(f,t[0]),c(s,h),c(s,v),c(s,w),c(s,C),c(C,E),c(E,x),c(E,B),c(E,Q),c(E,F),c(C,D),je&&je.m(C,null),c(C,$),He&&He.m(C,null),c(s,P),c(s,R),c(s,T),c(s,U),c(U,_),c(_,N),I(N,t[13]),c(_,L),c(_,O),c(U,M),Ge&&Ge.m(U,null),c(U,j),Je&&Je.m(U,null),c(s,H),c(s,G),c(s,J),c(s,K),c(K,V),c(V,q),I(q,t[14]),c(V,Y),c(V,W),c(K,z),Ke&&Ke.m(K,null),c(K,Z),Ve&&Ve.m(K,null),c(s,X),c(s,ee),c(s,te),c(s,ne),c(ne,ie),c(ie,re),c(ie,se),c(ie,oe),I(oe,t[15]),c(ie,ae),c(ie,le),I(le,t[16]),c(ie,ce),c(ie,ue),c(ne,de),qe&&qe.m(ne,null),c(ne,fe),Ye&&Ye.m(ne,null),c(s,pe),c(s,he),c(s,ge),c(s,me),c(me,ve),c(me,ye),We&&We.m(me,null),c(s,we),c(s,be),c(s,Ae),c(s,ke),c(ke,Ie),c(ke,Ce),ze&&ze.m(ke,null),c(s,Ee),c(s,xe),c(s,Se),c(s,Be),c(Be,Qe),I(Qe,t[7]),c(s,Fe),Ze&&Ze.m(s,null),c(n,De),c(n,$e),c($e,Pe),c($e,Re),c($e,Te),c($e,Ue),c($e,_e),Ne||(Le=[y(f,"input",t[38]),y(E,"click",t[39]),y(N,"input",t[43]),y(N,"keydown",t[44]),y(O,"click",t[25]),y(q,"input",t[46]),y(q,"keydown",t[47]),y(W,"click",t[27]),y(oe,"input",t[49]),y(le,"input",t[50]),y(le,"keydown",t[51]),y(ue,"click",t[29]),y(ve,"change",t[34]),y(Ie,"change",t[35]),y(Qe,"input",t[55]),y(Pe,"click",t[31]),y(_e,"click",t[57])],Ne=!0)},p(e,t){1&t[0]&&f.value!==e[0]&&I(f,e[0]),4096&t[0]&&Oe!==(Oe=e[12]?"▼":"▶")&&k(x,Oe),2&t[0]&&Me!==(Me=e[1].length+"")&&k(Q,Me),e[12]?je?je.p(e,t):(je=dm(e),je.c(),je.m(C,$)):je&&(je.d(1),je=null),e[1].length>0?He?He.p(e,t):(He=pm(e),He.c(),He.m(C,null)):He&&(He.d(1),He=null),8192&t[0]&&N.value!==e[13]&&I(N,e[13]),e[17]?Ge?Ge.p(e,t):(Ge=gm(e),Ge.c(),Ge.m(U,j)):Ge&&(Ge.d(1),Ge=null),e[2].length>0?Je?Je.p(e,t):(Je=mm(e),Je.c(),Je.m(U,null)):Je&&(Je.d(1),Je=null),16384&t[0]&&q.value!==e[14]&&I(q,e[14]),e[18]?Ke?Ke.p(e,t):(Ke=ym(e),Ke.c(),Ke.m(K,Z)):Ke&&(Ke.d(1),Ke=null),e[3].length>0?Ve?Ve.p(e,t):(Ve=wm(e),Ve.c(),Ve.m(K,null)):Ve&&(Ve.d(1),Ve=null),32768&t[0]&&oe.value!==e[15]&&I(oe,e[15]),65536&t[0]&&le.value!==e[16]&&I(le,e[16]),e[19]?qe?qe.p(e,t):(qe=Am(e),qe.c(),qe.m(ne,fe)):qe&&(qe.d(1),qe=null),e[4].length>0?Ye?Ye.p(e,t):(Ye=km(e),Ye.c(),Ye.m(ne,null)):Ye&&(Ye.d(1),Ye=null),e[5]?We?We.p(e,t):(We=Cm(e),We.c(),We.m(me,null)):We&&(We.d(1),We=null),e[6]?ze?ze.p(e,t):(ze=Em(e),ze.c(),ze.m(ke,null)):ze&&(ze.d(1),ze=null),128&t[0]&&A(Qe.value)!==e[7]&&I(Qe,e[7]),e[8]?Ze?Ze.p(e,t):(Ze=xm(e),Ze.c(),Ze.m(s,null)):Ze&&(Ze.d(1),Ze=null),256&t[0]&&S(_e,"active",e[8])},i:e,o:e,d(e){e&&d(n),je&&je.d(),He&&He.d(),Ge&&Ge.d(),Je&&Je.d(),Ke&&Ke.d(),Ve&&Ve.d(),qe&&qe.d(),Ye&&Ye.d(),We&&We.d(),ze&&ze.d(),Ze&&Ze.d(),Ne=!1,i(Le)}}}function Qm(e,t,n){let i,r;const s=P();let{searchText:o=""}=t,{selectedKinds:a=[]}=t,{pubkeys:l=[]}=t,{eventIds:c=[]}=t,{tags:u=[]}=t,{sinceTimestamp:d=null}=t,{untilTimestamp:f=null}=t,{limit:p=null}=t,{showJsonEditor:h=!1}=t,g="",m="",v=!1,y="",w="",b="",k="",I="",C="",E="",x="",S=null,B=!1;function Q(e){a.includes(e)?n(1,a=a.filter(t=>t!==e)):n(1,a=[...a,e].sort((e,t)=>e-t))}function F(e){n(1,a=a.filter(t=>t!==e))}function D(){const e=w.trim();e&&(im(e,64)?l.includes(e)?n(17,C="Pubkey already added"):(n(2,l=[...l,e]),n(13,w=""),n(17,C="")):n(17,C="Invalid pubkey: must be 64 character hex string"))}function R(e){n(2,l=l.filter(t=>t!==e))}function T(){const e=b.trim();e&&(im(e,64)?c.includes(e)?n(18,E="Event ID already added"):(n(3,c=[...c,e]),n(14,b=""),n(18,E="")):n(18,E="Invalid event ID: must be 64 character hex string"))}function U(e){n(3,c=c.filter(t=>t!==e))}function _(){const e=k.trim(),t=I.trim();e&&t&&(/^[a-zA-Z]$/.test(e)?u.some(n=>n.name===e&&n.value===t)?n(19,x="Tag already added"):(n(4,u=[...u,{name:e,value:t}]),n(15,k=""),n(16,I=""),n(19,x="")):n(19,x="Invalid tag name: must be single letter a-z or A-Z"))}function N(e){n(4,u=u.filter((t,n)=>n!==e))}function L(){s("apply",{searchText:o,selectedKinds:a,pubkeys:l,eventIds:c,tags:u,sinceTimestamp:d,untilTimestamp:f,limit:p})}$(()=>{S&&clearTimeout(S)});return e.$$set=e=>{"searchText"in e&&n(0,o=e.searchText),"selectedKinds"in e&&n(1,a=e.selectedKinds),"pubkeys"in e&&n(2,l=e.pubkeys),"eventIds"in e&&n(3,c=e.eventIds),"tags"in e&&n(4,u=e.tags),"sinceTimestamp"in e&&n(5,d=e.sinceTimestamp),"untilTimestamp"in e&&n(6,f=e.untilTimestamp),"limit"in e&&n(7,p=e.limit),"showJsonEditor"in e&&n(8,h=e.showJsonEditor)},e.$$.update=()=>{if(256&e.$$.dirty[0]&&h){const e=function(){const e={};return a.length>0&&(e.kinds=a),l.length>0&&(e.authors=l),c.length>0&&(e.ids=c),d&&(e.since=d),f&&(e.until=f),p&&(e.limit=p),o&&(e.search=o),u.forEach(t=>{const n=`#${t.name}`;e[n]||(e[n]=[]),e[n].push(t.value)}),e}();n(10,g=JSON.stringify(e,null,2))}255&e.$$.dirty[0]|32&e.$$.dirty[1]&&(B?(S&&clearTimeout(S),S=setTimeout(()=>{L()},1e3)):n(36,B=!0)),512&e.$$.dirty[0]|64&e.$$.dirty[1]&&n(20,r=i.filter(e=>e.kind.toString().includes(y)||e.name.toLowerCase().includes(y.toLowerCase())))},n(37,i=Object.entries(nm).map(([e,t])=>({kind:parseInt(e),name:t})).sort((e,t)=>e.kind-t.kind)),[o,a,l,c,u,d,f,p,h,y,g,m,v,w,b,k,I,C,E,x,r,s,function(){try{const e=JSON.parse(g);n(11,m=""),n(1,a=e.kinds||[]),n(2,l=e.authors||[]),n(3,c=e.ids||[]),n(5,d=e.since||null),n(6,f=e.until||null),n(7,p=e.limit||null),n(0,o=e.search||""),n(4,u=[]),Object.keys(e).forEach(t=>{if(t.startsWith("#")&&2===t.length){const n=t.slice(1);(Array.isArray(e[t])?e[t]:[e[t]]).forEach(e=>{u.push({name:n,value:String(e)})})}}),n(4,u),S&&clearTimeout(S),L()}catch(e){n(11,m="Invalid JSON: "+e.message)}},Q,F,D,R,T,U,_,N,function(){n(0,o=""),n(1,a=[]),n(2,l=[]),n(3,c=[]),n(4,u=[]),n(5,d=null),n(6,f=null),n(7,p=null),s("clear")},function(){return d?rm(d):""},function(){return f?rm(f):""},function(e){const t=e.target.value;n(5,d=t?sm(t):null)},function(e){const t=e.target.value;n(6,f=t?sm(t):null)},B,i,function(){o=this.value,n(0,o)},()=>n(12,v=!v),function(){y=this.value,n(9,y)},e=>Q(e),e=>F(e),function(){w=this.value,n(13,w)},e=>"Enter"===e.key&&D(),e=>R(e),function(){b=this.value,n(14,b)},e=>"Enter"===e.key&&T(),e=>U(e),function(){k=this.value,n(15,k)},function(){I=this.value,n(16,I)},e=>"Enter"===e.key&&_(),e=>N(e),()=>n(5,d=null),()=>n(6,f=null),function(){p=A(this.value),n(7,p)},function(){g=this.value,n(10,g),n(8,h)},()=>s("toggleJson")]}class Fm extends se{constructor(e){super(),re(this,e,Qm,Bm,s,{searchText:0,selectedKinds:1,pubkeys:2,eventIds:3,tags:4,sinceTimestamp:5,untilTimestamp:6,limit:7,showJsonEditor:8},null,[-1,-1,-1])}}function Dm(e,t,n){const i=e.slice();return i[28]=t[n],i}function $m(e,t,n){const i=e.slice();return i[31]=t[n],i}function Pm(t){let n;return{c(){n=p("div"),n.innerHTML="

❌ Read, write, admin, or owner permission required to view all\n events.

",b(n,"class","permission-denied svelte-5kb1ec")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Rm(e){let t,n,i,r;function s(e,t){return e[4].length>0?Um:e[6]?void 0:Tm}let o=s(e),a=o&&o(e),l=e[6]&&Gm();return{c(){t=p("div"),a&&a.c(),n=m(),l&&l.c(),b(t,"class","events-view-content svelte-5kb1ec")},m(s,o){u(s,t,o),a&&a.m(t,null),c(t,n),l&&l.m(t,null),i||(r=y(t,"scroll",e[9]),i=!0)},p(e,i){o===(o=s(e))&&a?a.p(e,i):(a&&a.d(1),a=o&&o(e),a&&(a.c(),a.m(t,n))),e[6]?l||(l=Gm(),l.c(),l.m(t,null)):l&&(l.d(1),l=null)},d(e){e&&d(t),a&&a.d(),l&&l.d(),i=!1,r()}}}function Tm(t){let n;return{c(){n=p("div"),n.innerHTML="

No events found.

",b(n,"class","no-events svelte-5kb1ec")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Um(e){let t,n=e[4],i=[];for(let t=0;t0&&Lm(e);return{c(){t=p("div"),n=p("span"),n.textContent="🗑️ Delete Event",i=m(),r&&r.c(),b(n,"class","delete-event-label svelte-5kb1ec"),b(t,"class","delete-event-info svelte-5kb1ec")},m(e,s){u(e,t,s),c(t,n),c(t,i),r&&r.m(t,null)},p(e,n){e[28].tags&&e[28].tags.length>0?r?r.p(e,n):(r=Lm(e),r.c(),r.m(t,null)):r&&(r.d(1),r=null)},d(e){e&&d(t),r&&r.d()}}}function Lm(e){let t,n=e[28].tags.filter(Xm),i=[];for(let t=0;t👤',s=m(),o=p("div"),a=p("div"),l=g(U),f=m(),h=p("div"),v=p("span"),w=g(_),A=m(),I=p("span"),C=g(N),E=m(),x=p("div"),B=p("div"),Q=g(L),F=m(),H.c(),D=m(),G&&G.c(),$=m(),V&&V.c(),P=m(),b(r,"class","events-view-avatar svelte-5kb1ec"),b(a,"class","events-view-author svelte-5kb1ec"),b(v,"class","kind-number svelte-5kb1ec"),S(v,"delete-event",5===e[28].kind),b(I,"class","kind-name svelte-5kb1ec"),b(h,"class","events-view-kind svelte-5kb1ec"),b(o,"class","events-view-info svelte-5kb1ec"),b(B,"class","event-timestamp svelte-5kb1ec"),b(x,"class","events-view-content svelte-5kb1ec"),b(n,"class","events-view-row svelte-5kb1ec"),b(n,"role","button"),b(n,"tabindex","0"),b(t,"class","events-view-item svelte-5kb1ec"),S(t,"expanded",e[5].has(e[28].id))},m(e,i){u(e,t,i),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),c(a,l),c(o,f),c(o,h),c(h,v),c(v,w),c(h,A),c(h,I),c(I,C),c(n,E),c(n,x),c(x,B),c(B,Q),c(x,F),H.m(x,null),c(n,D),G&&G.m(n,null),c(t,$),V&&V.m(t,null),c(t,P),R||(T=[y(n,"click",J),y(n,"keydown",K)],R=!0)},p(i,r){e=i,16&r[0]&&U!==(U=Ym(e[28].pubkey)+"")&&k(l,U),16&r[0]&&_!==(_=e[28].kind+"")&&k(w,_),16&r[0]&&S(v,"delete-event",5===e[28].kind),16&r[0]&&N!==(N=Wm(e[28].kind)+"")&&k(C,N),16&r[0]&&L!==(L=zm(e[28].created_at)+"")&&k(Q,L),j===(j=M(e))&&H?H.p(e,r):(H.d(1),H=j(e),H&&(H.c(),H.m(x,null))),5!==e[28].kind&&("admin"===e[2]||"owner"===e[2]||"write"===e[2]&&e[28].pubkey&&e[28].pubkey===e[3])?G?G.p(e,r):(G=Mm(e),G.c(),G.m(n,null)):G&&(G.d(1),G=null),48&r[0]&&(O=e[5].has(e[28].id)),O?V?V.p(e,r):(V=jm(e),V.c(),V.m(t,P)):V&&(V.d(1),V=null),48&r[0]&&S(t,"expanded",e[5].has(e[28].id))},d(e){e&&d(t),H.d(),G&&G.d(),V&&V.d(),R=!1,i(T)}}}function Gm(e){let t;return{c(){t=p("div"),t.innerHTML='
\n

Loading events...

',b(t,"class","loading-events svelte-5kb1ec")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Jm(e){let t,n,r,s,o,a,l,f,h,v,w,A,k,I,C,E,x,B,Q,F,D,$,P,R;function T(e,t){return e[6]?Vm:Km}r=new Fm({props:{showJsonEditor:e[8]}}),r.$on("apply",e[17]),r.$on("clear",e[18]),r.$on("toggleJson",e[16]);let U=T(e),_=U(e);return{c(){t=p("div"),n=p("div"),ee(r.$$.fragment),s=m(),o=p("div"),a=p("div"),l=p("button"),l.innerHTML='',f=m(),h=p("div"),v=p("label"),w=p("input"),A=m(),k=p("span"),I=m(),C=p("span"),C.textContent="Only show my events",E=m(),x=p("div"),B=p("button"),Q=g("🔄 Load More"),F=m(),D=p("button"),_.c(),b(n,"class","filter-panel svelte-5kb1ec"),S(n,"open",e[7]),b(l,"class","filter-btn svelte-5kb1ec"),b(l,"title","Filter events"),S(l,"active",e[7]),b(w,"type","checkbox"),b(w,"class","svelte-5kb1ec"),b(k,"class","toggle-slider svelte-5kb1ec"),b(C,"class","toggle-label svelte-5kb1ec"),b(v,"class","toggle-container svelte-5kb1ec"),b(h,"class","events-view-toggle svelte-5kb1ec"),b(a,"class","events-view-left svelte-5kb1ec"),b(B,"class","refresh-btn svelte-5kb1ec"),B.disabled=e[6],b(D,"class","reload-btn svelte-5kb1ec"),D.disabled=e[6],b(x,"class","events-view-buttons svelte-5kb1ec"),b(o,"class","events-view-header svelte-5kb1ec"),b(t,"class","events-view-footer svelte-5kb1ec")},m(i,d){u(i,t,d),c(t,n),te(r,n,null),c(t,s),c(t,o),c(o,a),c(a,l),c(a,f),c(a,h),c(h,v),c(v,w),w.checked=e[0],c(v,A),c(v,k),c(v,I),c(v,C),c(o,E),c(o,x),c(x,B),c(B,Q),c(x,F),c(x,D),_.m(D,null),$=!0,P||(R=[y(l,"click",e[15]),y(w,"change",e[23]),y(w,"change",e[24]),y(B,"click",e[25]),y(D,"click",e[26])],P=!0)},p(e,t){const i={};256&t[0]&&(i.showJsonEditor=e[8]),r.$set(i),(!$||128&t[0])&&S(n,"open",e[7]),(!$||128&t[0])&&S(l,"active",e[7]),1&t[0]&&(w.checked=e[0]),(!$||64&t[0])&&(B.disabled=e[6]),U!==(U=T(e))&&(_.d(1),_=U(e),_&&(_.c(),_.m(D,null))),(!$||64&t[0])&&(D.disabled=e[6])},i(e){$||(z(r.$$.fragment,e),$=!0)},o(e){Z(r.$$.fragment,e),$=!1},d(e){e&&d(t),ne(r),_.d(),P=!1,i(R)}}}function Km(e){let t;return{c(){t=g("🔄")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Vm(e){let t;return{c(){t=p("div"),b(t,"class","spinner svelte-5kb1ec")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function qm(e){let t,n,i;function r(e,t){return!e[1]||"read"!==e[2]&&"write"!==e[2]&&"admin"!==e[2]&&"owner"!==e[2]?Pm:Rm}let s=r(e),o=s(e),a=e[1]&&("read"===e[2]||"write"===e[2]||"admin"===e[2]||"owner"===e[2])&&Jm(e);return{c(){t=p("div"),o.c(),n=m(),a&&a.c(),b(t,"class","events-view-container svelte-5kb1ec")},m(e,r){u(e,t,r),o.m(t,null),c(t,n),a&&a.m(t,null),i=!0},p(e,i){s===(s=r(e))&&o?o.p(e,i):(o.d(1),o=s(e),o&&(o.c(),o.m(t,n))),!e[1]||"read"!==e[2]&&"write"!==e[2]&&"admin"!==e[2]&&"owner"!==e[2]?a&&(Y(),Z(a,1,1,()=>{a=null}),W()):a?(a.p(e,i),6&i[0]&&z(a,1)):(a=Jm(e),a.c(),z(a,1),a.m(t,null))},i(e){i||(z(a),i=!0)},o(e){Z(a),i=!1},d(e){e&&d(t),o.d(),a&&a.d()}}}function Ym(e){return e?e.slice(0,8)+"..."+e.slice(-8):""}function Wm(e){return{0:"Profile",1:"Text Note",2:"Recommend Relay",3:"Contacts",4:"Encrypted DM",5:"Delete",6:"Repost",7:"Reaction",8:"Badge Award",16:"Generic Repost",40:"Channel Creation",41:"Channel Metadata",42:"Channel Message",43:"Channel Hide Message",44:"Channel Mute User",1984:"Reporting",9734:"Zap Request",9735:"Zap",1e4:"Mute List",10001:"Pin List",10002:"Relay List",22242:"Client Auth",24133:"Nostr Connect",27235:"HTTP Auth",3e4:"Categorized People",30001:"Categorized Bookmarks",30008:"Profile Badges",30009:"Badge Definition",30017:"Create or update a stall",30018:"Create or update a product",30023:"Long-form Content",30024:"Draft Long-form Content",30078:"Application-specific Data",30311:"Live Event",30315:"User Statuses",30402:"Classified Listing",30403:"Draft Classified Listing",31922:"Date-Based Calendar Event",31923:"Time-Based Calendar Event",31924:"Calendar",31925:"Calendar Event RSVP",31989:"Handler recommendation",31990:"Handler information",34550:"Community Definition"}[e]||`Kind ${e}`}function zm(e){return new Date(1e3*e).toLocaleString()}function Zm(e){return e?e.length>100?e.slice(0,100)+"...":e:""}const Xm=e=>"e"===e[0];function ev(e,t,n){let{isLoggedIn:i=!1}=t,{userRole:r=""}=t,{userPubkey:s=""}=t,{filteredEvents:o=[]}=t,{expandedEvents:a=new Set}=t,{isLoadingEvents:l=!1}=t,{showOnlyMyEvents:c=!1}=t,{showFilterBuilder:u=!1}=t;const d=P();let f=!1;function p(e){d("toggleEventExpansion",e)}function h(e){d("deleteEvent",e)}function g(e,t){d("copyEventToClipboard",{event:e,e:t})}function m(){d("toggleChange")}function v(e,t){d("loadAllEvents",{refresh:e,authors:t})}return e.$$set=e=>{"isLoggedIn"in e&&n(1,i=e.isLoggedIn),"userRole"in e&&n(2,r=e.userRole),"userPubkey"in e&&n(3,s=e.userPubkey),"filteredEvents"in e&&n(4,o=e.filteredEvents),"expandedEvents"in e&&n(5,a=e.expandedEvents),"isLoadingEvents"in e&&n(6,l=e.isLoadingEvents),"showOnlyMyEvents"in e&&n(0,c=e.showOnlyMyEvents),"showFilterBuilder"in e&&n(7,u=e.showFilterBuilder)},[c,i,r,s,o,a,l,u,f,function(e){d("scroll",e)},p,h,g,m,v,function(){d("toggleFilterBuilder")},function(){n(8,f=!f)},function(e){d("filterApply",e.detail)},function(){d("filterClear")},e=>h(e.id),e=>p(e.id),(e,t)=>"Enter"===t.key&&p(e.id),(e,t)=>g(e,t),function(){c=this.checked,n(0,c)},()=>m(),()=>{v(!1,c&&s?[s]:null)},()=>{v(!0,c&&s?[s]:null)}]}class tv extends se{constructor(e){super(),re(this,e,ev,qm,s,{isLoggedIn:1,userRole:2,userPubkey:3,filteredEvents:4,expandedEvents:5,isLoadingEvents:6,showOnlyMyEvents:0,showFilterBuilder:7},null,[-1,-1])}}const nv=[{kind:0,name:"Metadata",description:"User profile information (name, about, picture, nip05, etc.)",nip:"01",isReplaceable:!0,template:{kind:0,content:"",tags:[]}},{kind:1,name:"Short Text Note",description:"Short-form text post (like a tweet)",nip:"01",template:{kind:1,content:"",tags:[]}},{kind:2,name:"Recommend Relay",description:"Relay recommendation",nip:"01",deprecated:!0,template:{kind:2,content:"",tags:[]}},{kind:3,name:"Follows",description:"Following list with optional relay hints",nip:"02",isReplaceable:!0,template:{kind:3,content:"",tags:[]}},{kind:4,name:"Encrypted Direct Message",description:"Private message using NIP-04 encryption",nip:"04",deprecated:!0,template:{kind:4,content:"",tags:[]}},{kind:5,name:"Event Deletion Request",description:"Request to delete events",nip:"09",template:{kind:5,content:"",tags:[]}},{kind:6,name:"Repost",description:"Share/repost another text note",nip:"18",template:{kind:6,content:"",tags:[]}},{kind:7,name:"Reaction",description:"Like, emoji reaction to an event",nip:"25",template:{kind:7,content:"",tags:[]}},{kind:8,name:"Badge Award",description:"Award a badge to someone",nip:"58",template:{kind:8,content:"",tags:[]}},{kind:9,name:"Chat Message",description:"Chat message",nip:"C7",template:{kind:9,content:"",tags:[]}},{kind:10,name:"Group Chat Threaded Reply",description:"Threaded reply in group chat",nip:"29",deprecated:!0,template:{kind:10,content:"",tags:[]}},{kind:11,name:"Thread",description:"Thread event",nip:"7D",template:{kind:11,content:"",tags:[]}},{kind:12,name:"Group Thread Reply",description:"Reply in group thread",nip:"29",deprecated:!0,template:{kind:12,content:"",tags:[]}},{kind:13,name:"Seal",description:"Sealed/encrypted event wrapper",nip:"59",template:{kind:13,content:"",tags:[]}},{kind:14,name:"Direct Message",description:"Private direct message using NIP-17",nip:"17",template:{kind:14,content:"",tags:[]}},{kind:15,name:"File Message",description:"File message in DMs",nip:"17",template:{kind:15,content:"",tags:[]}},{kind:16,name:"Generic Repost",description:"Repost any event kind",nip:"18",template:{kind:16,content:"",tags:[]}},{kind:17,name:"Reaction to Website",description:"Reaction to a website URL",nip:"25",template:{kind:17,content:"",tags:[]}},{kind:20,name:"Picture",description:"Picture-first feed post",nip:"68",template:{kind:20,content:"",tags:[]}},{kind:21,name:"Video Event",description:"Horizontal video event",nip:"71",template:{kind:21,content:"",tags:[]}},{kind:22,name:"Short-form Video",description:"Short-form portrait video (like TikTok)",nip:"71",template:{kind:22,content:"",tags:[]}},{kind:40,name:"Channel Creation",description:"Create a public chat channel",nip:"28",template:{kind:40,content:"",tags:[]}},{kind:41,name:"Channel Metadata",description:"Set channel name, about, picture",nip:"28",template:{kind:41,content:"",tags:[]}},{kind:42,name:"Channel Message",description:"Post message in channel",nip:"28",template:{kind:42,content:"",tags:[]}},{kind:43,name:"Channel Hide Message",description:"Hide a message in channel",nip:"28",template:{kind:43,content:"",tags:[]}},{kind:44,name:"Channel Mute User",description:"Mute a user in channel",nip:"28",template:{kind:44,content:"",tags:[]}},{kind:62,name:"Request to Vanish",description:"Request permanent deletion of all user data",nip:"62",template:{kind:62,content:"",tags:[]}},{kind:64,name:"Chess (PGN)",description:"Chess game in PGN format",nip:"64",template:{kind:64,content:"",tags:[]}},{kind:443,name:"KeyPackage",description:"Marmot protocol key package",nip:null,spec:"Marmot",template:{kind:443,content:"",tags:[]}},{kind:444,name:"Welcome Message",description:"Marmot protocol welcome message",nip:null,spec:"Marmot",template:{kind:444,content:"",tags:[]}},{kind:445,name:"Group Event",description:"Marmot protocol group event",nip:null,spec:"Marmot",template:{kind:445,content:"",tags:[]}},{kind:818,name:"Merge Requests",description:"Git merge request",nip:"54",template:{kind:818,content:"",tags:[]}},{kind:1018,name:"Poll Response",description:"Response to a poll",nip:"88",template:{kind:1018,content:"",tags:[]}},{kind:1021,name:"Bid",description:"Auction bid",nip:"15",template:{kind:1021,content:"",tags:[]}},{kind:1022,name:"Bid Confirmation",description:"Confirmation of auction bid",nip:"15",template:{kind:1022,content:"",tags:[]}},{kind:1040,name:"OpenTimestamps",description:"OpenTimestamps attestation",nip:"03",template:{kind:1040,content:"",tags:[]}},{kind:1059,name:"Gift Wrap",description:"Encrypted gift-wrapped event",nip:"59",template:{kind:1059,content:"",tags:[]}},{kind:1060,name:"Gift Wrap (Kind 4)",description:"Gift wrap variant for NIP-04 compatibility",nip:"59",template:{kind:1060,content:"",tags:[]}},{kind:1063,name:"File Metadata",description:"Metadata for shared files",nip:"94",template:{kind:1063,content:"",tags:[]}},{kind:1068,name:"Poll",description:"Create a poll",nip:"88",template:{kind:1068,content:"",tags:[]}},{kind:1111,name:"Comment",description:"Comment on events or external content",nip:"22",template:{kind:1111,content:"",tags:[]}},{kind:1222,name:"Voice Message",description:"Voice message",nip:"A0",template:{kind:1222,content:"",tags:[]}},{kind:1244,name:"Voice Message Comment",description:"Comment on voice message",nip:"A0",template:{kind:1244,content:"",tags:[]}},{kind:1311,name:"Live Chat Message",description:"Message in live stream chat",nip:"53",template:{kind:1311,content:"",tags:[]}},{kind:1337,name:"Code Snippet",description:"Code snippet post",nip:"C0",template:{kind:1337,content:"",tags:[]}},{kind:1517,name:"Bitcoin Block",description:"Bitcoin block data",nip:null,spec:"Nostrocket",template:{kind:1517,content:"",tags:[]}},{kind:1617,name:"Patches",description:"Git patches",nip:"34",template:{kind:1617,content:"",tags:[]}},{kind:1618,name:"Pull Requests",description:"Git pull request",nip:"34",template:{kind:1618,content:"",tags:[]}},{kind:1619,name:"Pull Request Updates",description:"Updates to git pull request",nip:"34",template:{kind:1619,content:"",tags:[]}},{kind:1621,name:"Issues",description:"Git issues",nip:"34",template:{kind:1621,content:"",tags:[]}},{kind:1622,name:"Git Replies",description:"Replies on git objects",nip:"34",deprecated:!0,template:{kind:1622,content:"",tags:[]}},{kind:1630,name:"Status",description:"Git status",nip:"34",template:{kind:1630,content:"",tags:[]}},{kind:1631,name:"Status",description:"Git status",nip:"34",template:{kind:1631,content:"",tags:[]}},{kind:1632,name:"Status",description:"Git status",nip:"34",template:{kind:1632,content:"",tags:[]}},{kind:1633,name:"Status",description:"Git status",nip:"34",template:{kind:1633,content:"",tags:[]}},{kind:1808,name:"Live Stream",description:"Live streaming event",nip:null,spec:"zap.stream",template:{kind:1808,content:"",tags:[]}},{kind:1971,name:"Problem Tracker",description:"Problem tracking",nip:null,spec:"Nostrocket",template:{kind:1971,content:"",tags:[]}},{kind:1984,name:"Reporting",description:"Report content or users",nip:"56",template:{kind:1984,content:"",tags:[]}},{kind:1985,name:"Label",description:"Label/tag content with namespace",nip:"32",template:{kind:1985,content:"",tags:[]}},{kind:1986,name:"Relay Reviews",description:"Reviews of relays",nip:null,template:{kind:1986,content:"",tags:[]}},{kind:1987,name:"AI Embeddings",description:"AI embeddings/vector lists",nip:null,spec:"NKBIP-02",template:{kind:1987,content:"",tags:[]}},{kind:2003,name:"Torrent",description:"Torrent magnet link",nip:"35",template:{kind:2003,content:"",tags:[]}},{kind:2004,name:"Torrent Comment",description:"Comment on torrent",nip:"35",template:{kind:2004,content:"",tags:[]}},{kind:2022,name:"Coinjoin Pool",description:"Coinjoin coordination",nip:null,spec:"joinstr",template:{kind:2022,content:"",tags:[]}},{kind:4550,name:"Community Post Approval",description:"Approve post in community",nip:"72",template:{kind:4550,content:"",tags:[]}},{kind:5e3,name:"Job Request",description:"Data vending machine job request (start of range)",nip:"90",template:{kind:5e3,content:"",tags:[]}},{kind:6e3,name:"Job Result",description:"Data vending machine job result (start of range)",nip:"90",template:{kind:6e3,content:"",tags:[]}},{kind:7e3,name:"Job Feedback",description:"Feedback on job request/result",nip:"90",template:{kind:7e3,content:"",tags:[]}},{kind:7374,name:"Reserved Cashu Wallet Tokens",description:"Reserved Cashu wallet tokens",nip:"60",template:{kind:7374,content:"",tags:[]}},{kind:7375,name:"Cashu Wallet Tokens",description:"Cashu wallet tokens",nip:"60",template:{kind:7375,content:"",tags:[]}},{kind:7376,name:"Cashu Wallet History",description:"Cashu wallet transaction history",nip:"60",template:{kind:7376,content:"",tags:[]}},{kind:7516,name:"Geocache Log",description:"Geocaching log entry",nip:null,spec:"geocaching",template:{kind:7516,content:"",tags:[]}},{kind:7517,name:"Geocache Proof of Find",description:"Proof of geocache find",nip:null,spec:"geocaching",template:{kind:7517,content:"",tags:[]}},{kind:8e3,name:"Add User",description:"Add user to group",nip:"43",template:{kind:8e3,content:"",tags:[]}},{kind:8001,name:"Remove User",description:"Remove user from group",nip:"43",template:{kind:8001,content:"",tags:[]}},{kind:9e3,name:"Group Control Events",description:"Group control events (start of range)",nip:"29",template:{kind:9e3,content:"",tags:[]}},{kind:9041,name:"Zap Goal",description:"Fundraising goal for zaps",nip:"75",template:{kind:9041,content:"",tags:[]}},{kind:9321,name:"Nutzap",description:"Cashu nutzap",nip:"61",template:{kind:9321,content:"",tags:[]}},{kind:9467,name:"Tidal Login",description:"Tidal streaming login",nip:null,spec:"Tidal-nostr",template:{kind:9467,content:"",tags:[]}},{kind:9734,name:"Zap Request",description:"Request Lightning payment",nip:"57",template:{kind:9734,content:"",tags:[]}},{kind:9735,name:"Zap",description:"Lightning payment receipt",nip:"57",template:{kind:9735,content:"",tags:[]}},{kind:9802,name:"Highlights",description:"Highlighted text selection",nip:"84",template:{kind:9802,content:"",tags:[]}},{kind:1e4,name:"Mute List",description:"List of muted users/content",nip:"51",isReplaceable:!0,template:{kind:1e4,content:"",tags:[]}},{kind:10001,name:"Pin List",description:"Pinned events",nip:"51",isReplaceable:!0,template:{kind:10001,content:"",tags:[]}},{kind:10002,name:"Relay List Metadata",description:"User's preferred relays for read/write",nip:"65",isReplaceable:!0,template:{kind:10002,content:"",tags:[]}},{kind:10003,name:"Bookmark List",description:"Bookmarked events",nip:"51",isReplaceable:!0,template:{kind:10003,content:"",tags:[]}},{kind:10004,name:"Communities List",description:"Communities user belongs to",nip:"51",isReplaceable:!0,template:{kind:10004,content:"",tags:[]}},{kind:10005,name:"Public Chats List",description:"Public chats user is in",nip:"51",isReplaceable:!0,template:{kind:10005,content:"",tags:[]}},{kind:10006,name:"Blocked Relays List",description:"Relays user has blocked",nip:"51",isReplaceable:!0,template:{kind:10006,content:"",tags:[]}},{kind:10007,name:"Search Relays List",description:"Preferred search relays",nip:"51",isReplaceable:!0,template:{kind:10007,content:"",tags:[]}},{kind:10008,name:"Relay Group Configuration",description:"Relay group configuration",nip:null,isReplaceable:!0,template:{kind:10008,content:"",tags:[]}},{kind:10009,name:"User Groups",description:"Groups user belongs to",nip:"29",isReplaceable:!0,template:{kind:10009,content:"",tags:[]}},{kind:10012,name:"Favorite Relays List",description:"User's favorite relays",nip:"51",isReplaceable:!0,template:{kind:10012,content:"",tags:[]}},{kind:10013,name:"Private Event Relay List",description:"Relays for private events",nip:"37",isReplaceable:!0,template:{kind:10013,content:"",tags:[]}},{kind:10015,name:"Interests List",description:"User interests/topics",nip:"51",isReplaceable:!0,template:{kind:10015,content:"",tags:[]}},{kind:10019,name:"Nutzap Mint Recommendation",description:"Recommended Cashu mints for nutzaps",nip:"61",isReplaceable:!0,template:{kind:10019,content:"",tags:[]}},{kind:10020,name:"Media Follows",description:"Followed media accounts",nip:"51",isReplaceable:!0,template:{kind:10020,content:"",tags:[]}},{kind:10030,name:"User Emoji List",description:"Custom emoji list",nip:"51",isReplaceable:!0,template:{kind:10030,content:"",tags:[]}},{kind:10050,name:"DM Relays List",description:"Relays to receive DMs on",nip:"17",isReplaceable:!0,template:{kind:10050,content:"",tags:[]}},{kind:10051,name:"KeyPackage Relays List",description:"Marmot key package relays",nip:null,isReplaceable:!0,spec:"Marmot",template:{kind:10051,content:"",tags:[]}},{kind:10063,name:"User Server List",description:"Blossom server list",nip:null,isReplaceable:!0,spec:"Blossom",template:{kind:10063,content:"",tags:[]}},{kind:10096,name:"File Storage Server List",description:"File storage servers",nip:"96",isReplaceable:!0,deprecated:!0,template:{kind:10096,content:"",tags:[]}},{kind:10166,name:"Relay Monitor Announcement",description:"Relay monitoring announcement",nip:"66",isReplaceable:!0,template:{kind:10166,content:"",tags:[]}},{kind:10312,name:"Room Presence",description:"Presence in live room",nip:"53",isReplaceable:!0,template:{kind:10312,content:"",tags:[]}},{kind:10377,name:"Proxy Announcement",description:"Nostr proxy announcement",nip:null,isReplaceable:!0,spec:"Nostr Epoxy",template:{kind:10377,content:"",tags:[]}},{kind:11111,name:"Transport Method Announcement",description:"Transport method announcement",nip:null,isReplaceable:!0,spec:"Nostr Epoxy",template:{kind:11111,content:"",tags:[]}},{kind:12345,name:"Relay Policy Configuration",description:"Relay-internal policy configuration (admin only)",nip:null,isReplaceable:!0,spec:"orly",template:{kind:12345,content:"",tags:[]}},{kind:13004,name:"JWT Binding",description:"Link between JWT certificate and pubkey",nip:null,isReplaceable:!0,template:{kind:13004,content:"",tags:[]}},{kind:13194,name:"Wallet Service Info",description:"NWC wallet service information",nip:"47",isReplaceable:!0,template:{kind:13194,content:"",tags:[]}},{kind:13534,name:"Membership Lists",description:"Group membership lists",nip:"43",isReplaceable:!0,template:{kind:13534,content:"",tags:[]}},{kind:14388,name:"User Sound Effect Lists",description:"Sound effect lists",nip:null,isReplaceable:!0,spec:"Corny Chat",template:{kind:14388,content:"",tags:[]}},{kind:17375,name:"Cashu Wallet Event",description:"Cashu wallet event",nip:"60",isReplaceable:!0,template:{kind:17375,content:"",tags:[]}},{kind:21e3,name:"Lightning Pub RPC",description:"Lightning.Pub RPC",nip:null,isEphemeral:!0,spec:"Lightning.Pub",template:{kind:21e3,content:"",tags:[]}},{kind:22242,name:"Client Authentication",description:"Authenticate to relay",nip:"42",isEphemeral:!0,template:{kind:22242,content:"",tags:[]}},{kind:23194,name:"Wallet Request",description:"NWC wallet request",nip:"47",isEphemeral:!0,template:{kind:23194,content:"",tags:[]}},{kind:23195,name:"Wallet Response",description:"NWC wallet response",nip:"47",isEphemeral:!0,template:{kind:23195,content:"",tags:[]}},{kind:23196,name:"Wallet Notification (NIP-04)",description:"NWC wallet notification (NIP-04 encrypted)",nip:"47",isEphemeral:!0,template:{kind:23196,content:"",tags:[]}},{kind:23197,name:"Wallet Notification",description:"NWC wallet notification",nip:"47",isEphemeral:!0,template:{kind:23197,content:"",tags:[]}},{kind:24133,name:"Nostr Connect",description:"Remote signer connection",nip:"46",isEphemeral:!0,template:{kind:24133,content:"",tags:[]}},{kind:24242,name:"Blobs Stored on Mediaservers",description:"Blossom blob storage",nip:null,isEphemeral:!0,spec:"Blossom",template:{kind:24242,content:"",tags:[]}},{kind:27235,name:"HTTP Auth",description:"Authenticate HTTP requests",nip:"98",isEphemeral:!0,template:{kind:27235,content:"",tags:[]}},{kind:28934,name:"Join Request",description:"Request to join group",nip:"43",isEphemeral:!0,template:{kind:28934,content:"",tags:[]}},{kind:28935,name:"Invite Request",description:"Invite to group",nip:"43",isEphemeral:!0,template:{kind:28935,content:"",tags:[]}},{kind:28936,name:"Leave Request",description:"Leave group request",nip:"43",isEphemeral:!0,template:{kind:28936,content:"",tags:[]}},{kind:3e4,name:"Follow Sets",description:"Categorized people lists",nip:"51",isAddressable:!0,template:{kind:3e4,content:"",tags:[["d","identifier"]]}},{kind:30001,name:"Generic Lists",description:"Generic categorized lists",nip:"51",isAddressable:!0,deprecated:!0,template:{kind:30001,content:"",tags:[["d","identifier"]]}},{kind:30002,name:"Relay Sets",description:"Categorized relay lists",nip:"51",isAddressable:!0,template:{kind:30002,content:"",tags:[["d","identifier"]]}},{kind:30003,name:"Bookmark Sets",description:"Categorized bookmark lists",nip:"51",isAddressable:!0,template:{kind:30003,content:"",tags:[["d","identifier"]]}},{kind:30004,name:"Curation Sets",description:"Curated content sets",nip:"51",isAddressable:!0,template:{kind:30004,content:"",tags:[["d","identifier"]]}},{kind:30005,name:"Video Sets",description:"Video playlists",nip:"51",isAddressable:!0,template:{kind:30005,content:"",tags:[["d","identifier"]]}},{kind:30007,name:"Kind Mute Sets",description:"Muted event kinds",nip:"51",isAddressable:!0,template:{kind:30007,content:"",tags:[["d","identifier"]]}},{kind:30008,name:"Profile Badges",description:"Badges displayed on profile",nip:"58",isAddressable:!0,template:{kind:30008,content:"",tags:[["d","identifier"]]}},{kind:30009,name:"Badge Definition",description:"Define a badge/achievement",nip:"58",isAddressable:!0,template:{kind:30009,content:"",tags:[["d","identifier"]]}},{kind:30015,name:"Interest Sets",description:"Interest/topic sets",nip:"51",isAddressable:!0,template:{kind:30015,content:"",tags:[["d","identifier"]]}},{kind:30017,name:"Stall",description:"Marketplace stall definition",nip:"15",isAddressable:!0,template:{kind:30017,content:"",tags:[["d","identifier"]]}},{kind:30018,name:"Product",description:"Marketplace product listing",nip:"15",isAddressable:!0,template:{kind:30018,content:"",tags:[["d","identifier"]]}},{kind:30019,name:"Marketplace UI/UX",description:"Marketplace interface settings",nip:"15",isAddressable:!0,template:{kind:30019,content:"",tags:[["d","identifier"]]}},{kind:30020,name:"Product Sold as Auction",description:"Auction product listing",nip:"15",isAddressable:!0,template:{kind:30020,content:"",tags:[["d","identifier"]]}},{kind:30023,name:"Long-form Content",description:"Blog post, article in markdown",nip:"23",isAddressable:!0,template:{kind:30023,content:"",tags:[["d","identifier"]]}},{kind:30024,name:"Draft Long-form Content",description:"Draft article",nip:"23",isAddressable:!0,template:{kind:30024,content:"",tags:[["d","identifier"]]}},{kind:30030,name:"Emoji Sets",description:"Custom emoji sets",nip:"51",isAddressable:!0,template:{kind:30030,content:"",tags:[["d","identifier"]]}},{kind:30040,name:"Curated Publication Index",description:"Publication index",nip:null,isAddressable:!0,spec:"NKBIP-01",template:{kind:30040,content:"",tags:[["d","identifier"]]}},{kind:30041,name:"Curated Publication Content",description:"Publication content",nip:null,isAddressable:!0,spec:"NKBIP-01",template:{kind:30041,content:"",tags:[["d","identifier"]]}},{kind:30063,name:"Release Artifact Sets",description:"Software release artifacts",nip:"51",isAddressable:!0,template:{kind:30063,content:"",tags:[["d","identifier"]]}},{kind:30078,name:"Application-specific Data",description:"App-specific key-value storage",nip:"78",isAddressable:!0,template:{kind:30078,content:"",tags:[["d","identifier"]]}},{kind:30166,name:"Relay Discovery",description:"Relay discovery/monitoring",nip:"66",isAddressable:!0,template:{kind:30166,content:"",tags:[["d","identifier"]]}},{kind:30267,name:"App Curation Sets",description:"Curated app sets",nip:"51",isAddressable:!0,template:{kind:30267,content:"",tags:[["d","identifier"]]}},{kind:30311,name:"Live Event",description:"Live streaming event",nip:"53",isAddressable:!0,template:{kind:30311,content:"",tags:[["d","identifier"]]}},{kind:30312,name:"Interactive Room",description:"Interactive live room",nip:"53",isAddressable:!0,template:{kind:30312,content:"",tags:[["d","identifier"]]}},{kind:30313,name:"Conference Event",description:"Conference/meetup event",nip:"53",isAddressable:!0,template:{kind:30313,content:"",tags:[["d","identifier"]]}},{kind:30315,name:"User Statuses",description:"User status updates",nip:"38",isAddressable:!0,template:{kind:30315,content:"",tags:[["d","identifier"]]}},{kind:30388,name:"Slide Set",description:"Presentation slides",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:30388,content:"",tags:[["d","identifier"]]}},{kind:30402,name:"Classified Listing",description:"Classified ad listing",nip:"99",isAddressable:!0,template:{kind:30402,content:"",tags:[["d","identifier"]]}},{kind:30403,name:"Draft Classified Listing",description:"Draft classified ad",nip:"99",isAddressable:!0,template:{kind:30403,content:"",tags:[["d","identifier"]]}},{kind:30617,name:"Repository Announcements",description:"Git repository announcement",nip:"34",isAddressable:!0,template:{kind:30617,content:"",tags:[["d","identifier"]]}},{kind:30618,name:"Repository State Announcements",description:"Git repository state",nip:"34",isAddressable:!0,template:{kind:30618,content:"",tags:[["d","identifier"]]}},{kind:30818,name:"Wiki Article",description:"Wiki article",nip:"54",isAddressable:!0,template:{kind:30818,content:"",tags:[["d","identifier"]]}},{kind:30819,name:"Redirects",description:"URL redirects",nip:"54",isAddressable:!0,template:{kind:30819,content:"",tags:[["d","identifier"]]}},{kind:31234,name:"Draft Event",description:"Draft of any event",nip:"37",isAddressable:!0,template:{kind:31234,content:"",tags:[["d","identifier"]]}},{kind:31388,name:"Link Set",description:"Link collection",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:31388,content:"",tags:[["d","identifier"]]}},{kind:31890,name:"Feed",description:"Custom feed definition",nip:null,isAddressable:!0,spec:"NUD: Custom Feeds",template:{kind:31890,content:"",tags:[["d","identifier"]]}},{kind:31922,name:"Date-Based Calendar Event",description:"All-day calendar event",nip:"52",isAddressable:!0,template:{kind:31922,content:"",tags:[["d","identifier"]]}},{kind:31923,name:"Time-Based Calendar Event",description:"Calendar event with time",nip:"52",isAddressable:!0,template:{kind:31923,content:"",tags:[["d","identifier"]]}},{kind:31924,name:"Calendar",description:"Calendar definition",nip:"52",isAddressable:!0,template:{kind:31924,content:"",tags:[["d","identifier"]]}},{kind:31925,name:"Calendar Event RSVP",description:"RSVP to calendar event",nip:"52",isAddressable:!0,template:{kind:31925,content:"",tags:[["d","identifier"]]}},{kind:31989,name:"Handler Recommendation",description:"Recommended app for event kind",nip:"89",isAddressable:!0,template:{kind:31989,content:"",tags:[["d","identifier"]]}},{kind:31990,name:"Handler Information",description:"App handler declaration",nip:"89",isAddressable:!0,template:{kind:31990,content:"",tags:[["d","identifier"]]}},{kind:32123,name:"WaveLake Track",description:"WaveLake music track",nip:null,isAddressable:!0,spec:"WaveLake",template:{kind:32123,content:"",tags:[["d","identifier"]]}},{kind:32267,name:"Software Application",description:"Software application listing",nip:null,isAddressable:!0,template:{kind:32267,content:"",tags:[["d","identifier"]]}},{kind:32388,name:"User Room Favorites",description:"Favorite rooms",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:32388,content:"",tags:[["d","identifier"]]}},{kind:33388,name:"High Scores",description:"Game high scores",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:33388,content:"",tags:[["d","identifier"]]}},{kind:34235,name:"Video Event Horizontal",description:"Horizontal video event",nip:"71",isAddressable:!0,template:{kind:34235,content:"",tags:[["d","identifier"]]}},{kind:34236,name:"Video Event Vertical",description:"Vertical video event",nip:"71",isAddressable:!0,template:{kind:34236,content:"",tags:[["d","identifier"]]}},{kind:34388,name:"Sound Effects",description:"Sound effect definitions",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:34388,content:"",tags:[["d","identifier"]]}},{kind:34550,name:"Community Definition",description:"Define a community",nip:"72",isAddressable:!0,template:{kind:34550,content:"",tags:[["d","identifier"]]}},{kind:37516,name:"Geocache Listing",description:"Geocache location listing",nip:null,isAddressable:!0,spec:"geocaching",template:{kind:37516,content:"",tags:[["d","identifier"]]}},{kind:38172,name:"Cashu Mint Announcement",description:"Cashu mint announcement",nip:"87",isAddressable:!0,template:{kind:38172,content:"",tags:[["d","identifier"]]}},{kind:38173,name:"Fedimint Announcement",description:"Fedimint announcement",nip:"87",isAddressable:!0,template:{kind:38173,content:"",tags:[["d","identifier"]]}},{kind:38383,name:"Peer-to-peer Order Events",description:"P2P trading orders",nip:"69",isAddressable:!0,template:{kind:38383,content:"",tags:[["d","identifier"]]}},{kind:39e3,name:"Group Metadata Events",description:"Group metadata (start of range)",nip:"29",isAddressable:!0,template:{kind:39e3,content:"",tags:[["d","identifier"]]}},{kind:39089,name:"Starter Packs",description:"Starter pack lists",nip:"51",isAddressable:!0,template:{kind:39089,content:"",tags:[["d","identifier"]]}},{kind:39092,name:"Media Starter Packs",description:"Media starter packs",nip:"51",isAddressable:!0,template:{kind:39092,content:"",tags:[["d","identifier"]]}},{kind:39701,name:"Web Bookmarks",description:"Web URL bookmarks",nip:"B0",isAddressable:!0,template:{kind:39701,content:"",tags:[["d","identifier"]]}},{kind:39998,name:"ACL Event",description:"Access control list event",nip:null,isAddressable:!0,template:{kind:39998,content:"",tags:[["d","identifier"]]}}];function iv(e,t=null){const n=function(e){return nv.find(t=>t.kind===e)}(e);return n?{...n.template,created_at:Math.floor(Date.now()/1e3),pubkey:t||""}:{kind:e,content:"",tags:[],created_at:Math.floor(Date.now()/1e3),pubkey:t||""}}const rv=[{id:"all",name:"All Kinds",filter:()=>!0},{id:"regular",name:"Regular Events (0-9999)",filter:e=>e.kind<1e4&&!e.isReplaceable},{id:"replaceable",name:"Replaceable (10000-19999)",filter:e=>e.isReplaceable},{id:"ephemeral",name:"Ephemeral (20000-29999)",filter:e=>e.isEphemeral},{id:"addressable",name:"Addressable (30000-39999)",filter:e=>e.isAddressable},{id:"social",name:"Social",filter:e=>[0,1,3,6,7].includes(e.kind)},{id:"messaging",name:"Messaging",filter:e=>[4,9,10,11,12,14,15,40,41,42].includes(e.kind)},{id:"lists",name:"Lists",filter:e=>e.name.toLowerCase().includes("list")||e.name.toLowerCase().includes("set")},{id:"marketplace",name:"Marketplace",filter:e=>[30017,30018,30019,30020,1021,1022,30402,30403].includes(e.kind)},{id:"lightning",name:"Lightning/Zaps",filter:e=>[9734,9735,9041,9321,7374,7375,7376].includes(e.kind)},{id:"media",name:"Media",filter:e=>[20,21,22,1063,1222,1244].includes(e.kind)},{id:"git",name:"Git/Code",filter:e=>[818,1337,1617,1618,1619,1621,1622,30617,30618].includes(e.kind)},{id:"calendar",name:"Calendar",filter:e=>[31922,31923,31924,31925].includes(e.kind)},{id:"groups",name:"Groups",filter:e=>e.kind>=9e3&&e.kind<=9030||e.kind>=39e3&&e.kind<=39009}];function sv(e,t,n){const i=e.slice();return i[13]=t[n],i}function ov(e,t,n){const i=e.slice();return i[16]=t[n],i}function av(e){let t,n,r,s,o,a,l,h,v,w,A,C,E,x,S,B,Q,F,D,$,P,R,T,U,_,N=e[3].length+"",L=1!==e[3].length?"s":"",O=rv,M=[];for(let t=0;t=2e4&&e.kind<3e4?"badge-ephemeral":"badge-regular"}function gv(e){return e.isAddressable?"Addressable":e.isReplaceable?"Replaceable":e.kind>=2e4&&e.kind<3e4?"Ephemeral":"Regular"}function mv(e,t,n){let{isOpen:i=!1}=t,{userPubkey:r=""}=t;const s=P();let o="",a="all",l=nv;function c(e){const t=iv(e.kind,r);s("select",{kind:e,template:t}),u()}function u(){n(0,i=!1),n(1,o=""),n(2,a="all"),s("close")}return e.$$set=e=>{"isOpen"in e&&n(0,i=e.isOpen),"userPubkey"in e&&n(8,r=e.userPubkey)},e.$$.update=()=>{if(6&e.$$.dirty){let e=nv;const t=rv.find(e=>e.id===a);if(t&&(e=e.filter(t.filter)),o.trim()){const t=o.toLowerCase();e=e.filter(e=>e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.kind.toString().includes(t)||e.nip&&e.nip.includes(t))}n(3,l=e)}},[i,o,a,l,c,u,function(e){"Escape"===e.key&&u()},function(e){e.target===e.currentTarget&&u()},r,function(){o=this.value,n(1,o)},e=>n(2,a=e.id),e=>c(e)]}class vv extends se{constructor(e){super(),re(this,e,mv,pv,s,{isOpen:0,userPubkey:8})}}function yv(e){let t,n,i,r,s,o,a,l,f,h;return{c(){t=p("div"),n=p("div"),i=p("span"),i.textContent="⚠",r=m(),s=p("span"),o=g(e[1]),a=m(),l=p("button"),l.textContent="×",b(i,"class","error-icon svelte-46pmgb"),b(s,"class","error-message svelte-46pmgb"),b(n,"class","error-content svelte-46pmgb"),b(l,"class","error-dismiss svelte-46pmgb"),b(t,"class","error-banner svelte-46pmgb")},m(d,p){u(d,t,p),c(t,n),c(n,i),c(n,r),c(n,s),c(s,o),c(t,a),c(t,l),f||(h=y(l,"click",e[10]),f=!0)},p(e,t){2&t&&k(o,e[1])},d(e){e&&d(t),f=!1,h()}}}function wv(e){let t,n,r,s,o,a,l,f,h,g,v,w,A,k,C,E,x,S,B,Q=e[1]&&yv(e);function F(t){e[14](t)}let D={userPubkey:e[2]};return void 0!==e[3]&&(D.isOpen=e[3]),C=new vv({props:D}),U.push(()=>X(C,"isOpen",F)),C.$on("select",e[8]),C.$on("close",e[9]),{c(){t=p("div"),n=p("div"),r=p("button"),r.textContent="Generate Template",s=m(),o=p("button"),o.textContent="Reformat",a=m(),l=p("button"),l.textContent="Sign",f=m(),h=p("button"),h.textContent="Publish",g=m(),Q&&Q.c(),v=m(),w=p("div"),A=p("textarea"),k=m(),ee(C.$$.fragment),b(r,"class","compose-btn template-btn svelte-46pmgb"),b(o,"class","compose-btn reformat-btn svelte-46pmgb"),b(l,"class","compose-btn sign-btn svelte-46pmgb"),b(h,"class","compose-btn publish-btn svelte-46pmgb"),b(n,"class","compose-header svelte-46pmgb"),b(A,"class","compose-textarea svelte-46pmgb"),b(A,"placeholder","Enter your Nostr event JSON here, or click 'Generate Template' to start with a template..."),b(A,"spellcheck","false"),b(w,"class","compose-editor svelte-46pmgb"),b(t,"class","compose-view svelte-46pmgb")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(n,a),c(n,l),c(n,f),c(n,h),c(t,g),Q&&Q.m(t,null),c(t,v),c(t,w),c(w,A),I(A,e[0]),u(i,k,d),te(C,i,d),x=!0,S||(B=[y(r,"click",e[7]),y(o,"click",e[4]),y(l,"click",e[5]),y(h,"click",e[6]),y(A,"input",e[13])],S=!0)},p(e,[n]){e[1]?Q?Q.p(e,n):(Q=yv(e),Q.c(),Q.m(t,v)):Q&&(Q.d(1),Q=null),1&n&&I(A,e[0]);const i={};4&n&&(i.userPubkey=e[2]),!E&&8&n&&(E=!0,i.isOpen=e[3],j(()=>E=!1)),C.$set(i)},i(e){x||(z(C.$$.fragment,e),x=!0)},o(e){Z(C.$$.fragment,e),x=!1},d(e){e&&d(t),Q&&Q.d(),e&&d(k),ne(C,e),S=!1,i(B)}}}function bv(e,t,n){let{composeEventJson:i=""}=t,{userPubkey:r=""}=t,{userRole:s=""}=t,{policyEnabled:o=!1}=t,{publishError:a=""}=t;const l=P();let c=!1;return e.$$set=e=>{"composeEventJson"in e&&n(0,i=e.composeEventJson),"userPubkey"in e&&n(2,r=e.userPubkey),"userRole"in e&&n(11,s=e.userRole),"policyEnabled"in e&&n(12,o=e.policyEnabled),"publishError"in e&&n(1,a=e.publishError)},[i,a,r,c,function(){l("reformatJson")},function(){l("signEvent")},function(){l("publishEvent")},function(){n(3,c=!0)},function(e){const{kind:t,template:r}=e.detail;n(0,i=JSON.stringify(r,null,2)),l("templateSelected",{kind:t,template:r})},function(){n(3,c=!1)},function(){n(1,a=""),l("clearError")},s,o,function(){i=this.value,n(0,i)},function(e){c=e,n(3,c)}]}class Av extends se{constructor(e){super(),re(this,e,bv,wv,s,{composeEventJson:0,userPubkey:2,userRole:11,policyEnabled:12,publishError:1})}}function kv(e,t,n){const i=e.slice();return i[23]=t[n],i}function Iv(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in to access sprocket management.",r=m(),s=p("button"),s.textContent="Log In",b(i,"class","svelte-fiaj1r"),b(s,"class","login-btn svelte-fiaj1r"),b(n,"class","login-prompt svelte-fiaj1r")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[18]),o=!0)},p:e,d(e){e&&d(n),o=!1,a()}}}function Cv(e){let t,n,i,r,s,o,a,l,f,h=(e[2]||"none")+"";return{c(){t=p("div"),n=p("p"),n.textContent="❌ Owner permission required for sprocket management.",i=m(),r=p("p"),r.innerHTML='To enable sprocket functionality, set the ORLY_OWNERS environment variable with your npub when starting the relay.',s=m(),o=p("p"),a=g("Current user role: "),l=p("strong"),f=g(h),b(n,"class","svelte-fiaj1r"),b(r,"class","svelte-fiaj1r"),b(o,"class","svelte-fiaj1r"),b(t,"class","permission-denied svelte-fiaj1r")},m(e,d){u(e,t,d),c(t,n),c(t,i),c(t,r),c(t,s),c(t,o),c(o,a),c(o,l),c(l,f)},p(e,t){4&t&&h!==(h=(e[2]||"none")+"")&&k(f,h)},d(e){e&&d(t)}}}function Ev(e){let t,n,r,s,o,a,l,h,v,w,A,C,E,x,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q,Y,W,z,Z,X,ee,te,ne,ie,re,se,oe,ae,le,ce,ue,de,fe,pe,he,ge,me=e[3]?.is_running?"🟢 Running":"🔴 Stopped",ve=e[3]?.script_exists?"✅ Exists":"❌ Not found",ye=e[3]?.pid&&xv(e),we=e[6]&&Sv(e),be=e[8],Ae=[];for(let t=0;t{"isLoggedIn"in e&&n(1,i=e.isLoggedIn),"userRole"in e&&n(2,r=e.userRole),"sprocketStatus"in e&&n(3,s=e.sprocketStatus),"isLoadingSprocket"in e&&n(4,o=e.isLoadingSprocket),"sprocketUploadFile"in e&&n(5,a=e.sprocketUploadFile),"sprocketScript"in e&&n(0,l=e.sprocketScript),"sprocketMessage"in e&&n(6,c=e.sprocketMessage),"sprocketMessageType"in e&&n(7,u=e.sprocketMessageType),"sprocketVersions"in e&&n(8,d=e.sprocketVersions)},[l,i,r,s,o,a,c,u,d,function(){f("restartSprocket")},function(){f("deleteSprocket")},function(e){f("sprocketFileSelect",e)},function(){f("uploadSprocketScript")},function(){f("saveSprocket")},function(){f("loadSprocket")},function(){f("loadVersions")},p,h,function(){f("openLoginModal")},function(){l=this.value,n(0,l)},e=>p(e),e=>h(e.name)]}class Pv extends se{constructor(e){super(),re(this,e,$v,Dv,s,{isLoggedIn:1,userRole:2,sprocketStatus:3,isLoadingSprocket:4,sprocketUploadFile:5,sprocketScript:0,sprocketMessage:6,sprocketMessageType:7,sprocketVersions:8})}}function Rv(e,t,n){const i=e.slice();return i[26]=t[n],i}function Tv(e,t,n){const i=e.slice();return i[29]=t[n],i}function Uv(e,t,n){const i=e.slice();return i[32]=t[n],i}function _v(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in to access policy configuration.",r=m(),s=p("button"),s.textContent="Log In",b(i,"class","svelte-gkxvxc"),b(s,"class","login-btn svelte-gkxvxc"),b(n,"class","login-prompt svelte-gkxvxc")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[16]),o=!0)},p:e,d(e){e&&d(n),o=!1,a()}}}function Nv(e){let t,n,i,r,s,o,a,l,f,h=(e[3]||"none")+"";return{c(){t=p("div"),n=p("p"),n.textContent="Policy configuration requires owner or policy admin permissions.",i=m(),r=p("p"),r.innerHTML='To become a policy admin, ask an existing policy admin to add your pubkey\n to the policy_admins list.',s=m(),o=p("p"),a=g("Current user role: "),l=p("strong"),f=g(h),b(n,"class","svelte-gkxvxc"),b(r,"class","svelte-gkxvxc"),b(o,"class","svelte-gkxvxc"),b(t,"class","permission-denied svelte-gkxvxc")},m(e,d){u(e,t,d),c(t,n),c(t,i),c(t,r),c(t,s),c(t,o),c(o,a),c(o,l),c(l,f)},p(e,t){8&t[0]&&h!==(h=(e[3]||"none")+"")&&k(f,h)},d(e){e&&d(t)}}}function Lv(e){let t,n,r,s,o,a,l,f,h,v,w,A,C,E,x,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q,Y,W,z,Z,X,ee,te,ne,ie,re,se,oe,ae,le,ce,ue,de,fe,pe,he,ge,me,ve,ye,we,be,Ae,ke,Ie,Ce,Ee,xe,Se,Be,Qe,Fe,De,$e,Pe,Re=e[5]?"Policy Enabled":"Policy Disabled",Te=e[10].length+"",Ue=e[4]&&Ov(),_e=e[9].length>0&&Mv(e),Ne=e[7]&&Hv(e);function Le(e,t){return 0===e[1].length?Jv:Gv}let Oe=Le(e),Me=Oe(e);function je(e,t){return 0===e[10].length?qv:Vv}let He=je(e),Ge=He(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Policy Editor",s=m(),o=p("div"),a=p("span"),l=g(Re),f=m(),Ue&&Ue.c(),h=m(),v=p("div"),v.innerHTML='

Edit the policy JSON below and click "Save & Publish" to update the relay's policy configuration.\n Changes are applied immediately after validation.

\n

Policy updates are published as kind 12345 events and require policy admin permissions.

',w=m(),A=p("div"),C=p("textarea"),E=m(),_e&&_e.c(),x=m(),B=p("div"),Q=p("button"),F=g("Load Current"),D=m(),$=p("button"),P=g("Format JSON"),R=m(),T=p("button"),U=g("Validate"),_=m(),N=p("button"),L=g("Save & Publish"),O=m(),Ne&&Ne.c(),M=m(),j=p("div"),H=p("h3"),H.textContent="Policy Administrators",G=m(),J=p("div"),J.innerHTML='

Policy admins can update the relay's policy configuration via kind 12345 events.\n Their follows get whitelisted if policy_follow_whitelist_enabled is true in the policy.

\n

Note: Policy admins are separate from relay admins (ORLY_ADMINS).\n Changes here update the JSON editor - click "Save & Publish" to apply.

',K=m(),V=p("div"),Me.c(),q=m(),Y=p("div"),W=p("input"),z=m(),Z=p("button"),X=g("+ Add Admin"),te=m(),ne=p("div"),ie=p("h3"),ie.textContent="Policy Follow Whitelist",re=m(),se=p("div"),se.innerHTML='

Pubkeys followed by policy admins (kind 3 events).\n These get automatic read+write access when rules have write_allow_follows: true.

',oe=m(),ae=p("div"),le=p("span"),ce=g(Te),ue=g(" pubkey(s) in whitelist"),de=m(),fe=p("button"),pe=g("🔄 Refresh Follows"),he=m(),ge=p("div"),Ge.c(),me=m(),ve=p("div"),ye=p("h3"),ye.textContent="Policy Reference",we=m(),be=p("div"),Ae=p("h4"),Ae.textContent="Structure Overview",ke=m(),Ie=p("ul"),Ie.innerHTML='
  • kind.whitelist - Only allow these event kinds (takes precedence)
  • \n
  • kind.blacklist - Deny these event kinds (if no whitelist)
  • \n
  • global - Rules applied to all events
  • \n
  • rules - Per-kind rules (keyed by kind number as string)
  • \n
  • default_policy - "allow" or "deny" when no rules match
  • \n
  • policy_admins - Hex pubkeys that can update policy
  • \n
  • policy_follow_whitelist_enabled - Enable follow-based access
  • ',Ce=m(),Ee=p("h4"),Ee.textContent="Rule Fields",xe=m(),Se=p("ul"),Se.innerHTML='
  • description - Human-readable rule description
  • \n
  • write_allow / write_deny - Pubkey lists for write access
  • \n
  • read_allow / read_deny - Pubkey lists for read access
  • \n
  • write_allow_follows - Grant access to policy admin follows
  • \n
  • size_limit - Max total event size in bytes
  • \n
  • content_limit - Max content field size in bytes
  • \n
  • max_expiry - Max expiry offset in seconds
  • \n
  • max_age_of_event - Max age of created_at in seconds
  • \n
  • max_age_event_in_future - Max future offset in seconds
  • \n
  • must_have_tags - Required tag letters (e.g., ["d", "t"])
  • \n
  • tag_validation - Regex patterns for tag values
  • \n
  • script - Path to external validation script
  • ',Be=m(),Qe=p("h4"),Qe.textContent="Example Policy",Fe=m(),De=p("pre"),De.textContent=`${e[20]}`,b(r,"class","svelte-gkxvxc"),b(a,"class","status-badge svelte-gkxvxc"),S(a,"enabled",e[5]),b(o,"class","policy-status svelte-gkxvxc"),b(n,"class","policy-header svelte-gkxvxc"),b(v,"class","policy-info svelte-gkxvxc"),b(C,"class","policy-editor svelte-gkxvxc"),b(C,"placeholder","Loading policy configuration..."),C.disabled=e[6],b(C,"spellcheck","false"),b(A,"class","editor-container svelte-gkxvxc"),b(Q,"class","policy-btn load-btn svelte-gkxvxc"),Q.disabled=e[6],b($,"class","policy-btn format-btn svelte-gkxvxc"),$.disabled=e[6],b(T,"class","policy-btn validate-btn svelte-gkxvxc"),T.disabled=e[6],b(N,"class","policy-btn save-btn svelte-gkxvxc"),N.disabled=e[6],b(B,"class","policy-actions svelte-gkxvxc"),b(t,"class","policy-section svelte-gkxvxc"),b(J,"class","policy-info svelte-gkxvxc"),b(V,"class","admin-list svelte-gkxvxc"),b(W,"type","text"),b(W,"placeholder","npub or hex pubkey"),W.disabled=e[6],b(W,"class","svelte-gkxvxc"),b(Z,"class","policy-btn add-btn svelte-gkxvxc"),Z.disabled=ee=e[6]||!e[11].trim(),b(Y,"class","add-admin svelte-gkxvxc"),b(j,"class","policy-section svelte-gkxvxc"),b(se,"class","policy-info svelte-gkxvxc"),b(le,"class","follows-count svelte-gkxvxc"),b(fe,"class","policy-btn refresh-btn svelte-gkxvxc"),fe.disabled=e[6],b(ae,"class","follows-header svelte-gkxvxc"),b(ge,"class","follows-list svelte-gkxvxc"),b(ne,"class","policy-section svelte-gkxvxc"),b(Ae,"class","svelte-gkxvxc"),b(Ie,"class","field-list svelte-gkxvxc"),b(Ee,"class","svelte-gkxvxc"),b(Se,"class","field-list svelte-gkxvxc"),b(Qe,"class","svelte-gkxvxc"),b(De,"class","example-json svelte-gkxvxc"),b(be,"class","reference-content svelte-gkxvxc"),b(ve,"class","policy-section svelte-gkxvxc")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),c(a,l),c(o,f),Ue&&Ue.m(o,null),c(t,h),c(t,v),c(t,w),c(t,A),c(A,C),I(C,e[0]),c(t,E),_e&&_e.m(t,null),c(t,x),c(t,B),c(B,Q),c(Q,F),c(B,D),c(B,$),c($,P),c(B,R),c(B,T),c(T,U),c(B,_),c(B,N),c(N,L),c(t,O),Ne&&Ne.m(t,null),u(i,M,d),u(i,j,d),c(j,H),c(j,G),c(j,J),c(j,K),c(j,V),Me.m(V,null),c(j,q),c(j,Y),c(Y,W),I(W,e[11]),c(Y,z),c(Y,Z),c(Z,X),u(i,te,d),u(i,ne,d),c(ne,ie),c(ne,re),c(ne,se),c(ne,oe),c(ne,ae),c(ae,le),c(le,ce),c(le,ue),c(ae,de),c(ae,fe),c(fe,pe),c(ne,he),c(ne,ge),Ge.m(ge,null),u(i,me,d),u(i,ve,d),c(ve,ye),c(ve,we),c(ve,be),c(be,Ae),c(be,ke),c(be,Ie),c(be,Ce),c(be,Ee),c(be,xe),c(be,Se),c(be,Be),c(be,Qe),c(be,Fe),c(be,De),$e||(Pe=[y(C,"input",e[21]),y(Q,"click",e[12]),y($,"click",e[15]),y(T,"click",e[13]),y(N,"click",e[14]),y(W,"input",e[23]),y(W,"keydown",e[24]),y(Z,"click",e[18]),y(fe,"click",e[17])],$e=!0)},p(e,n){32&n[0]&&Re!==(Re=e[5]?"Policy Enabled":"Policy Disabled")&&k(l,Re),32&n[0]&&S(a,"enabled",e[5]),e[4]?Ue||(Ue=Ov(),Ue.c(),Ue.m(o,null)):Ue&&(Ue.d(1),Ue=null),64&n[0]&&(C.disabled=e[6]),1&n[0]&&I(C,e[0]),e[9].length>0?_e?_e.p(e,n):(_e=Mv(e),_e.c(),_e.m(t,x)):_e&&(_e.d(1),_e=null),64&n[0]&&(Q.disabled=e[6]),64&n[0]&&($.disabled=e[6]),64&n[0]&&(T.disabled=e[6]),64&n[0]&&(N.disabled=e[6]),e[7]?Ne?Ne.p(e,n):(Ne=Hv(e),Ne.c(),Ne.m(t,null)):Ne&&(Ne.d(1),Ne=null),Oe===(Oe=Le(e))&&Me?Me.p(e,n):(Me.d(1),Me=Oe(e),Me&&(Me.c(),Me.m(V,null))),64&n[0]&&(W.disabled=e[6]),2048&n[0]&&W.value!==e[11]&&I(W,e[11]),2112&n[0]&&ee!==(ee=e[6]||!e[11].trim())&&(Z.disabled=ee),1024&n[0]&&Te!==(Te=e[10].length+"")&&k(ce,Te),64&n[0]&&(fe.disabled=e[6]),He===(He=je(e))&&Ge?Ge.p(e,n):(Ge.d(1),Ge=He(e),Ge&&(Ge.c(),Ge.m(ge,null)))},d(e){e&&d(t),Ue&&Ue.d(),_e&&_e.d(),Ne&&Ne.d(),e&&d(M),e&&d(j),Me.d(),e&&d(te),e&&d(ne),Ge.d(),e&&d(me),e&&d(ve),$e=!1,i(Pe)}}}function Ov(e){let t;return{c(){t=p("span"),t.textContent="Policy Admin",b(t,"class","admin-badge svelte-gkxvxc")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Mv(e){let t,n,i,r,s=e[9],o=[];for(let t=0;t{"isLoggedIn"in e&&n(2,i=e.isLoggedIn),"userRole"in e&&n(3,r=e.userRole),"isPolicyAdmin"in e&&n(4,s=e.isPolicyAdmin),"policyEnabled"in e&&n(5,o=e.policyEnabled),"policyJson"in e&&n(0,a=e.policyJson),"isLoadingPolicy"in e&&n(6,l=e.isLoadingPolicy),"policyMessage"in e&&n(7,c=e.policyMessage),"policyMessageType"in e&&n(8,u=e.policyMessageType),"validationErrors"in e&&n(9,d=e.validationErrors),"policyAdmins"in e&&n(1,f=e.policyAdmins),"policyFollows"in e&&n(10,p=e.policyFollows)},e.$$.update=()=>{if(1&e.$$.dirty[0])try{if(a){const e=JSON.parse(a);n(1,f=e.policy_admins||[])}}catch(e){}},[a,f,i,r,s,o,l,c,u,d,p,g,function(){h("loadPolicy")},function(){h("validatePolicy")},function(){h("savePolicy")},function(){h("formatJson")},function(){h("openLoginModal")},function(){h("refreshFollows")},m,v,'{\n "kind": {\n "whitelist": [0, 1, 3, 6, 7, 10002],\n "blacklist": []\n },\n "global": {\n "description": "Global rules applied to all events",\n "size_limit": 65536,\n "max_age_of_event": 86400,\n "max_age_event_in_future": 300\n },\n "rules": {\n "1": {\n "description": "Kind 1 (short text notes)",\n "content_limit": 8192,\n "write_allow_follows": true\n },\n "30023": {\n "description": "Long-form articles",\n "content_limit": 100000,\n "tag_validation": {\n "d": "^[a-z0-9-]{1,64}$",\n "t": "^[a-z0-9-]{1,32}$"\n }\n }\n },\n "default_policy": "allow",\n "policy_admins": [""],\n "policy_follow_whitelist_enabled": true\n}',function(){a=this.value,n(0,a)},e=>v(e),function(){g=this.value,n(11,g)},e=>"Enter"===e.key&&m()]}class Zv extends se{constructor(e){super(),re(this,e,zv,Wv,s,{isLoggedIn:2,userRole:3,isPolicyAdmin:4,policyEnabled:5,policyJson:0,isLoadingPolicy:6,policyMessage:7,policyMessageType:8,validationErrors:9,policyAdmins:1,policyFollows:10},null,[-1,-1])}}const Xv=[{id:"social",name:"Social/Notes",description:"User profiles, notes, follows, reposts, reactions, and relay lists",kinds:[0,1,3,6,7,10002]},{id:"dm",name:"Direct Messages",description:"Encrypted direct messages (legacy and NIP-17 gift-wrapped)",kinds:[4,14,1059]},{id:"longform",name:"Long-form Content",description:"Blog posts and article drafts",kinds:[30023,30024]},{id:"media",name:"Media",description:"File metadata and media attachments",kinds:[1063,20,21,22]},{id:"marketplace_nip15",name:"Marketplace (NIP-15)",description:"Legacy NIP-15 stalls and products",kinds:[30017,30018,30019,30020]},{id:"marketplace_nip99",name:"Marketplace (NIP-99/Gamma)",description:"NIP-99 classified listings, collections, shipping, reviews (Plebeian Market)",kinds:[30402,30403,30405,30406,31555]},{id:"order_communication",name:"Order Communication",description:"Gamma Markets order messages and payment receipts (kinds 16, 17)",kinds:[16,17]},{id:"groups_nip29",name:"Group Messaging (NIP-29)",description:"Simple relay-based group chat messages",kinds:[9,10,11,12]},{id:"groups_nip72",name:"Communities (NIP-72)",description:"Community definitions and threaded discussions",kinds:[34550,1111,4550]},{id:"lists",name:"Lists/Bookmarks",description:"Mute lists, pin lists, and parameterized list events",kinds:[1e4,10001,3e4,30001]}];function ey(e,t,n){const i=e.slice();return i[68]=t[n],i}function ty(e,t,n){const i=e.slice();return i[73]=t[n],i}function ny(e,t,n){const i=e.slice();return i[76]=t[n],i}function iy(e,t,n){const i=e.slice();return i[79]=t[n],i}function ry(e,t,n){const i=e.slice();return i[82]=t[n],i}function sy(e,t,n){const i=e.slice();return i[82]=t[n],i}function oy(e,t,n){const i=e.slice();return i[68]=t[n],i}function ay(e){let t,n,i;return{c(){t=p("div"),n=g(e[2]),b(t,"class",i="message "+e[3]+" svelte-vbat7g")},m(e,i){u(e,t,i),c(t,n)},p(e,r){4&r[0]&&k(n,e[2]),8&r[0]&&i!==(i="message "+e[3]+" svelte-vbat7g")&&b(t,"class",i)},d(e){e&&d(t)}}}function ly(e){let t,n,r,s,o,a,l,f,h,v,w,A,I,C,E,x,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q=e[6].length+"",Y=e[9].length+"",W=e[12].length+"",z=e[13].length+"",Z=e[14].length+"",X="trusted"===e[0]&&uy(e),ee="blacklist"===e[0]&&gy(e),te="unclassified"===e[0]&&by(e),ne="spam"===e[0]&&Cy(e),ie="ips"===e[0]&&Qy(e),re="settings"===e[0]&&Ty(e);return{c(){t=p("div"),n=p("button"),r=g("Trusted ("),s=g(q),o=g(")"),a=m(),l=p("button"),f=g("Blacklist ("),h=g(Y),v=g(")"),w=m(),A=p("button"),I=g("Unclassified ("),C=g(W),E=g(")"),x=m(),B=p("button"),Q=g("Spam ("),F=g(z),D=g(")"),$=m(),P=p("button"),R=g("Blocked IPs ("),T=g(Z),U=g(")"),_=m(),N=p("button"),N.textContent="Settings",L=m(),O=p("div"),X&&X.c(),M=m(),ee&&ee.c(),j=m(),te&&te.c(),H=m(),ne&&ne.c(),G=m(),ie&&ie.c(),J=m(),re&&re.c(),b(n,"class","tab svelte-vbat7g"),S(n,"active","trusted"===e[0]),b(l,"class","tab svelte-vbat7g"),S(l,"active","blacklist"===e[0]),b(A,"class","tab svelte-vbat7g"),S(A,"active","unclassified"===e[0]),b(B,"class","tab svelte-vbat7g"),S(B,"active","spam"===e[0]),b(P,"class","tab svelte-vbat7g"),S(P,"active","ips"===e[0]),b(N,"class","tab svelte-vbat7g"),S(N,"active","settings"===e[0]),b(t,"class","tabs svelte-vbat7g"),b(O,"class","tab-content svelte-vbat7g")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(t,a),c(t,l),c(l,f),c(l,h),c(l,v),c(t,w),c(t,A),c(A,I),c(A,C),c(A,E),c(t,x),c(t,B),c(B,Q),c(B,F),c(B,D),c(t,$),c(t,P),c(P,R),c(P,T),c(P,U),c(t,_),c(t,N),u(i,L,d),u(i,O,d),X&&X.m(O,null),c(O,M),ee&&ee.m(O,null),c(O,j),te&&te.m(O,null),c(O,H),ne&&ne.m(O,null),c(O,G),ie&&ie.m(O,null),c(O,J),re&&re.m(O,null),K||(V=[y(n,"click",e[36]),y(l,"click",e[37]),y(A,"click",e[38]),y(B,"click",e[39]),y(P,"click",e[40]),y(N,"click",e[41])],K=!0)},p(e,t){64&t[0]&&q!==(q=e[6].length+"")&&k(s,q),1&t[0]&&S(n,"active","trusted"===e[0]),512&t[0]&&Y!==(Y=e[9].length+"")&&k(h,Y),1&t[0]&&S(l,"active","blacklist"===e[0]),4096&t[0]&&W!==(W=e[12].length+"")&&k(C,W),1&t[0]&&S(A,"active","unclassified"===e[0]),8192&t[0]&&z!==(z=e[13].length+"")&&k(F,z),1&t[0]&&S(B,"active","spam"===e[0]),16384&t[0]&&Z!==(Z=e[14].length+"")&&k(T,Z),1&t[0]&&S(P,"active","ips"===e[0]),1&t[0]&&S(N,"active","settings"===e[0]),"trusted"===e[0]?X?X.p(e,t):(X=uy(e),X.c(),X.m(O,M)):X&&(X.d(1),X=null),"blacklist"===e[0]?ee?ee.p(e,t):(ee=gy(e),ee.c(),ee.m(O,j)):ee&&(ee.d(1),ee=null),"unclassified"===e[0]?te?te.p(e,t):(te=by(e),te.c(),te.m(O,H)):te&&(te.d(1),te=null),"spam"===e[0]?ne?ne.p(e,t):(ne=Cy(e),ne.c(),ne.m(O,G)):ne&&(ne.d(1),ne=null),"ips"===e[0]?ie?ie.p(e,t):(ie=Qy(e),ie.c(),ie.m(O,J)):ie&&(ie.d(1),ie=null),"settings"===e[0]?re?re.p(e,t):(re=Ty(e),re.c(),re.m(O,null)):re&&(re.d(1),re=null)},d(e){e&&d(t),e&&d(L),e&&d(O),X&&X.d(),ee&&ee.d(),te&&te.d(),ne&&ne.d(),ie&&ie.d(),re&&re.d(),K=!1,i(V)}}}function cy(e){let t,n,r,s,o,a,l,h,g,v,w,k,C,E,x,S,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q,Y,W,z,Z,X=Xv,ee=[];for(let t=0;tInitial Configuration \n

    Configure curating mode before the relay will accept events. Select which event kinds to allow and set rate limiting parameters.

    ',r=m(),s=p("div"),o=p("h4"),o.textContent="Allowed Event Kinds",a=m(),l=p("p"),l.textContent="Select categories of events to allow. At least one must be selected.",h=m(),g=p("div");for(let e=0;e0?fy:dy}let B=S(e),Q=B(e);return{c(){t=p("div"),n=p("h3"),n.textContent="Trusted Publishers",r=m(),s=p("p"),s.textContent="Trusted users can publish unlimited events without rate limiting.",o=m(),a=p("div"),l=p("input"),f=m(),h=p("input"),v=m(),w=p("button"),A=g("Trust"),k=m(),C=p("div"),Q.c(),b(n,"class","svelte-vbat7g"),b(s,"class","help-text svelte-vbat7g"),b(l,"type","text"),b(l,"placeholder","Pubkey (64 hex chars)"),b(l,"class","svelte-vbat7g"),b(h,"type","text"),b(h,"placeholder","Note (optional)"),b(h,"class","svelte-vbat7g"),w.disabled=e[1],b(w,"class","svelte-vbat7g"),b(a,"class","add-form svelte-vbat7g"),b(C,"class","list svelte-vbat7g"),b(t,"class","section svelte-vbat7g")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(t,o),c(t,a),c(a,l),I(l,e[7]),c(a,f),c(a,h),I(h,e[8]),c(a,v),c(a,w),c(w,A),c(t,k),c(t,C),Q.m(C,null),E||(x=[y(l,"input",e[42]),y(h,"input",e[43]),y(w,"click",e[44])],E=!0)},p(e,t){128&t[0]&&l.value!==e[7]&&I(l,e[7]),256&t[0]&&h.value!==e[8]&&I(h,e[8]),2&t[0]&&(w.disabled=e[1]),B===(B=S(e))&&Q?Q.p(e,t):(Q.d(1),Q=B(e),Q&&(Q.c(),Q.m(C,null)))},d(e){e&&d(t),Q.d(),E=!1,i(x)}}}function dy(t){let n;return{c(){n=p("div"),n.textContent="No trusted pubkeys yet.",b(n,"class","empty svelte-vbat7g")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function fy(e){let t,n=e[6],i=[];for(let t=0;t0?vy:my}let B=S(e),Q=B(e);return{c(){t=p("div"),n=p("h3"),n.textContent="Blacklisted Publishers",r=m(),s=p("p"),s.textContent="Blacklisted users cannot publish any events.",o=m(),a=p("div"),l=p("input"),f=m(),h=p("input"),v=m(),w=p("button"),A=g("Blacklist"),k=m(),C=p("div"),Q.c(),b(n,"class","svelte-vbat7g"),b(s,"class","help-text svelte-vbat7g"),b(l,"type","text"),b(l,"placeholder","Pubkey (64 hex chars)"),b(l,"class","svelte-vbat7g"),b(h,"type","text"),b(h,"placeholder","Reason (optional)"),b(h,"class","svelte-vbat7g"),w.disabled=e[1],b(w,"class","svelte-vbat7g"),b(a,"class","add-form svelte-vbat7g"),b(C,"class","list svelte-vbat7g"),b(t,"class","section svelte-vbat7g")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(t,o),c(t,a),c(a,l),I(l,e[10]),c(a,f),c(a,h),I(h,e[11]),c(a,v),c(a,w),c(w,A),c(t,k),c(t,C),Q.m(C,null),E||(x=[y(l,"input",e[46]),y(h,"input",e[47]),y(w,"click",e[48])],E=!0)},p(e,t){1024&t[0]&&l.value!==e[10]&&I(l,e[10]),2048&t[0]&&h.value!==e[11]&&I(h,e[11]),2&t[0]&&(w.disabled=e[1]),B===(B=S(e))&&Q?Q.p(e,t):(Q.d(1),Q=B(e),Q&&(Q.c(),Q.m(C,null)))},d(e){e&&d(t),Q.d(),E=!1,i(x)}}}function my(t){let n;return{c(){n=p("div"),n.textContent="No blacklisted pubkeys.",b(n,"class","empty svelte-vbat7g")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function vy(e){let t,n=e[9],i=[];for(let t=0;t0?ky:Ay}let x=E(e),S=x(e);return{c(){t=p("div"),n=p("h3"),n.textContent="Unclassified Users",r=m(),s=p("p"),s.textContent="Users who have posted events but haven't been classified. Sorted by event count.",o=m(),a=p("div"),l=p("button"),f=g("Refresh"),h=m(),v=p("button"),w=g("Scan Database"),A=m(),k=p("div"),S.c(),b(n,"class","svelte-vbat7g"),b(s,"class","help-text svelte-vbat7g"),b(l,"class","refresh-btn svelte-vbat7g"),l.disabled=e[1],b(v,"class","scan-btn svelte-vbat7g"),v.disabled=e[1],b(a,"class","button-row svelte-vbat7g"),b(k,"class","list svelte-vbat7g"),b(t,"class","section svelte-vbat7g")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(t,o),c(t,a),c(a,l),c(l,f),c(a,h),c(a,v),c(v,w),c(t,A),c(t,k),S.m(k,null),I||(C=[y(l,"click",e[15]),y(v,"click",e[16])],I=!0)},p(e,t){2&t[0]&&(l.disabled=e[1]),2&t[0]&&(v.disabled=e[1]),x===(x=E(e))&&S?S.p(e,t):(S.d(1),S=x(e),S&&(S.c(),S.m(k,null)))},d(e){e&&d(t),S.d(),I=!1,i(C)}}}function Ay(t){let n;return{c(){n=p("div"),n.textContent="No unclassified users.",b(n,"class","empty svelte-vbat7g")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function ky(e){let t,n=e[12],i=[];for(let t=0;t0?xy:Ey}let A=w(e),k=A(e);return{c(){t=p("div"),n=p("h3"),n.textContent="Spam Events",i=m(),r=p("p"),r.textContent="Events flagged as spam are hidden from query results but remain in the database.",s=m(),o=p("button"),a=g("Refresh"),l=m(),f=p("div"),k.c(),b(n,"class","svelte-vbat7g"),b(r,"class","help-text svelte-vbat7g"),b(o,"class","refresh-btn svelte-vbat7g"),o.disabled=e[1],b(f,"class","list svelte-vbat7g"),b(t,"class","section svelte-vbat7g")},m(d,p){u(d,t,p),c(t,n),c(t,i),c(t,r),c(t,s),c(t,o),c(o,a),c(t,l),c(t,f),k.m(f,null),h||(v=y(o,"click",e[17]),h=!0)},p(e,t){2&t[0]&&(o.disabled=e[1]),A===(A=w(e))&&k?k.p(e,t):(k.d(1),k=A(e),k&&(k.c(),k.m(f,null)))},d(e){e&&d(t),k.d(),h=!1,v()}}}function Ey(t){let n;return{c(){n=p("div"),n.textContent="No spam events flagged.",b(n,"class","empty svelte-vbat7g")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function xy(e){let t,n=e[13],i=[];for(let t=0;t0?Dy:Fy}let A=w(e),k=A(e);return{c(){t=p("div"),n=p("h3"),n.textContent="Blocked IP Addresses",i=m(),r=p("p"),r.textContent="IP addresses blocked due to rate limit violations.",s=m(),o=p("button"),a=g("Refresh"),l=m(),f=p("div"),k.c(),b(n,"class","svelte-vbat7g"),b(r,"class","help-text svelte-vbat7g"),b(o,"class","refresh-btn svelte-vbat7g"),o.disabled=e[1],b(f,"class","list svelte-vbat7g"),b(t,"class","section svelte-vbat7g")},m(d,p){u(d,t,p),c(t,n),c(t,i),c(t,r),c(t,s),c(t,o),c(o,a),c(t,l),c(t,f),k.m(f,null),h||(v=y(o,"click",e[18]),h=!0)},p(e,t){2&t[0]&&(o.disabled=e[1]),A===(A=w(e))&&k?k.p(e,t):(k.d(1),k=A(e),k&&(k.c(),k.m(f,null)))},d(e){e&&d(t),k.d(),h=!1,v()}}}function Fy(t){let n;return{c(){n=p("div"),n.textContent="No blocked IPs.",b(n,"class","empty svelte-vbat7g")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Dy(e){let t,n=e[14],i=[];for(let t=0;tt!==e),u):n(5,u.categories=[...u.categories,e],u)}async function _(){if(!i||!r)return n(2,a="Please log in with a Nostr extension to publish configuration"),void n(3,l="error");if(0===u.categories.length&&!u.custom_kinds.trim())return n(2,a="Please select at least one kind category or enter custom kinds"),void n(3,l="error");try{n(1,o=!0),n(2,a="");const e=[["d","curating-config"],["daily_limit",String(u.daily_limit)],["first_ban_hours",String(u.first_ban_hours)],["second_ban_hours",String(u.second_ban_hours)]];for(const t of u.categories)e.push(["kind_category",t]);const t=function(e){if(!e||!e.trim())return[];const t=new Set,n=e.split(",").map(e=>e.trim());for(const e of n)if(e)if(e.includes("-")){const[n,i]=e.split("-").map(e=>parseInt(e.trim(),10));if(!isNaN(n)&&!isNaN(i)&&n<=i&&i-n<=1e3)for(let e=n;e<=i;e++)t.add(e)}else{const n=parseInt(e,10);isNaN(n)||t.add(n)}return Array.from(t).sort((e,t)=>e-t)}(u.custom_kinds);for(const n of t)e.push(["kind",String(n)]);const s={kind:30078,created_at:Math.floor(Date.now()/1e3),tags:e,content:"Curating relay configuration",pubkey:r},d=await i.signEvent(s),f=new WebSocket(window.location.origin.replace(/^http/,"ws"));await new Promise((e,t)=>{f.onopen=()=>{f.send(JSON.stringify(["EVENT",d]))},f.onmessage=n=>{const i=JSON.parse(n.data);"OK"===i[0]&&(!0===i[2]?e():t(new Error(i[3]||"Event rejected")))},f.onerror=e=>t(new Error("WebSocket error")),setTimeout(()=>t(new Error("Timeout")),1e4)}),f.close(),n(2,a="Configuration published successfully"),n(3,l="success"),n(4,c=!0),await k()}catch(e){console.error("Failed to publish configuration:",e),n(2,a=`Failed to publish: ${e.message}`),n(3,l="error")}finally{n(1,o=!1)}}D(async()=>{await async function(){try{const e=await b("isconfigured");n(4,c=!0===e),c&&(await async function(){try{const e=await b("getcuratingconfig");e&&n(5,u={daily_limit:e.daily_limit||50,first_ban_hours:e.first_ban_hours||1,second_ban_hours:e.second_ban_hours||168,categories:e.categories||[],custom_kinds:e.custom_kinds?e.custom_kinds.join(", "):"",kind_ranges:e.kind_ranges||[]})}catch(e){console.error("Failed to load config:",e)}}(),await k())}catch(e){console.error("Failed to check configuration:",e),n(4,c=!1)}}()});return e.$$set=e=>{"userSigner"in e&&n(29,i=e.userSigner),"userPubkey"in e&&n(30,r=e.userPubkey)},[s,o,a,l,c,u,d,f,p,h,g,m,v,y,w,E,async function(){try{const e=await b("scanpubkeys");showMessage(`Database scanned: ${e.total_pubkeys} pubkeys, ${e.total_events} events (${e.skipped} skipped)`,"success"),await E()}catch(e){console.error("Failed to scan database:",e),showMessage("Failed to scan database: "+e.message,"error")}},x,S,B,Q,F,$,P,R,T,U,_,async function(){await _()},i,r,e=>U(e.id),function(){u.custom_kinds=this.value,n(5,u)},function(){u.daily_limit=A(this.value),n(5,u)},function(){u.first_ban_hours=A(this.value),n(5,u)},function(){u.second_ban_hours=A(this.value),n(5,u)},()=>n(0,s="trusted"),()=>n(0,s="blacklist"),()=>n(0,s="unclassified"),()=>n(0,s="spam"),()=>n(0,s="ips"),()=>n(0,s="settings"),function(){f=this.value,n(7,f)},function(){p=this.value,n(8,p)},()=>B(),e=>Q(e.pubkey),function(){g=this.value,n(10,g)},function(){m=this.value,n(11,m)},()=>F(),e=>$(e.pubkey),e=>B(e.pubkey,""),e=>F(e.pubkey,""),e=>P(e.event_id),e=>R(e.event_id),e=>T(e.ip),e=>U(e.id),function(){u.custom_kinds=this.value,n(5,u)},function(){u.daily_limit=A(this.value),n(5,u)},function(){u.first_ban_hours=A(this.value),n(5,u)},function(){u.second_ban_hours=A(this.value),n(5,u)}]}class Ky extends se{constructor(e){super(),re(this,e,Jy,jy,s,{userSigner:29,userPubkey:30},null,[-1,-1,-1])}}const{window:Vy}=l;function qy(e,t,n){const i=e.slice();return i[57]=t[n],i}function Yy(e,t,n){const i=e.slice();return i[54]=t[n],i}function Wy(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in to view your Blossom storage.",r=m(),s=p("button"),s.textContent="Log In",b(i,"class","svelte-on0yal"),b(s,"class","login-btn svelte-on0yal"),b(n,"class","login-prompt svelte-on0yal")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[20]),o=!0)},p:e,d(e){e&&d(n),o=!1,a()}}}function zy(e){let t,n,i,r,s,o,a,l,f,h,v,w,A,I,C=e[0]||e[12]?"Loading...":"Refresh";function E(e,t){return e[13]?ew:e[10]?Xy:Zy}let x=E(e),S=x(e),B=e[14]&&!e[10]&&!e[13]&&nw(e),Q=!e[10]&&!e[13]&&iw(e),F=e[2]&&sw(e);function D(e,t){return e[10]&&!e[13]?aw:ow}let $=D(e),P=$(e);return{c(){t=p("div"),n=p("div"),S.c(),i=m(),r=p("div"),B&&B.c(),s=m(),o=p("button"),a=g("🔄 "),l=g(C),h=m(),Q&&Q.c(),v=m(),F&&F.c(),w=m(),P.c(),b(o,"class","refresh-btn svelte-on0yal"),o.disabled=f=e[0]||e[12],b(r,"class","header-buttons svelte-on0yal"),b(n,"class","header-section svelte-on0yal"),b(t,"class","blossom-view svelte-on0yal")},m(d,f){u(d,t,f),c(t,n),S.m(n,null),c(n,i),c(n,r),B&&B.m(r,null),c(r,s),c(r,o),c(o,a),c(o,l),c(t,h),Q&&Q.m(t,null),c(t,v),F&&F.m(t,null),c(t,w),P.m(t,null),A||(I=y(o,"click",e[30]),A=!0)},p(e,a){x===(x=E(e))&&S?S.p(e,a):(S.d(1),S=x(e),S&&(S.c(),S.m(n,i))),!e[14]||e[10]||e[13]?B&&(B.d(1),B=null):B?B.p(e,a):(B=nw(e),B.c(),B.m(r,s)),4097&a[0]&&C!==(C=e[0]||e[12]?"Loading...":"Refresh")&&k(l,C),4097&a[0]&&f!==(f=e[0]||e[12])&&(o.disabled=f),e[10]||e[13]?Q&&(Q.d(1),Q=null):Q?Q.p(e,a):(Q=iw(e),Q.c(),Q.m(t,v)),e[2]?F?F.p(e,a):(F=sw(e),F.c(),F.m(t,w)):F&&(F.d(1),F=null),$===($=D(e))&&P?P.p(e,a):(P.d(1),P=$(e),P&&(P.c(),P.m(t,null)))},d(e){e&&d(t),S.d(),B&&B.d(),Q&&Q.d(),F&&F.d(),P.d(),A=!1,I()}}}function Zy(t){let n;return{c(){n=p("h3"),n.textContent="Blossom Media Storage",b(n,"class","svelte-on0yal")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Xy(t){let n,i,r,s,o;return{c(){n=p("button"),n.textContent="← Back",i=m(),r=p("h3"),r.textContent="All Users Storage",b(n,"class","back-btn svelte-on0yal"),b(r,"class","svelte-on0yal")},m(e,a){u(e,n,a),u(e,i,a),u(e,r,a),s||(o=y(n,"click",t[27]),s=!0)},p:e,d(e){e&&d(n),e&&d(i),e&&d(r),s=!1,o()}}}function ew(e){let t,n,i,r,s,o,a,l=(e[13].profile?.name||_w(e[25](e[13].pubkey)))+"",f=e[13].profile?.picture&&tw(e);return{c(){t=p("button"),t.textContent="← Back",n=m(),i=p("h3"),f&&f.c(),r=m(),s=g(l),b(t,"class","back-btn svelte-on0yal"),b(i,"class","user-header svelte-on0yal")},m(l,d){u(l,t,d),u(l,n,d),u(l,i,d),f&&f.m(i,null),c(i,r),c(i,s),o||(a=y(t,"click",e[29]),o=!0)},p(e,t){e[13].profile?.picture?f?f.p(e,t):(f=tw(e),f.c(),f.m(i,r)):f&&(f.d(1),f=null),8192&t[0]&&l!==(l=(e[13].profile?.name||_w(e[25](e[13].pubkey)))+"")&&k(s,l)},d(e){e&&d(t),e&&d(n),e&&d(i),f&&f.d(),o=!1,a()}}}function tw(e){let t,n;return{c(){t=p("img"),a(t.src,n=e[13].profile.picture)||b(t,"src",n),b(t,"alt",""),b(t,"class","header-avatar svelte-on0yal")},m(e,n){u(e,t,n)},p(e,i){8192&i[0]&&!a(t.src,n=e[13].profile.picture)&&b(t,"src",n)},d(e){e&&d(t)}}}function nw(e){let t,n,i,r;return{c(){t=p("button"),n=g("Admin"),b(t,"class","admin-btn svelte-on0yal"),t.disabled=e[0]},m(s,o){u(s,t,o),c(t,n),i||(r=y(t,"click",e[26]),i=!0)},p(e,n){1&n[0]&&(t.disabled=e[0])},d(e){e&&d(t),i=!1,r()}}}function iw(e){let t,n,r,s,o,a,l,f,h,v,w=e[3].length>0&&rw(e);return{c(){t=p("div"),n=p("span"),n.textContent="Upload new files",r=m(),s=p("input"),o=m(),w&&w.c(),a=m(),l=p("button"),f=g("Select Files"),b(n,"class","upload-label svelte-on0yal"),b(s,"type","file"),s.multiple=!0,b(s,"class","file-input-hidden svelte-on0yal"),b(l,"class","select-btn svelte-on0yal"),l.disabled=e[4],b(t,"class","upload-section svelte-on0yal")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),e[39](s),c(t,o),w&&w.m(t,null),c(t,a),c(t,l),c(l,f),h||(v=[y(s,"change",e[22]),y(l,"click",e[23])],h=!0)},p(e,n){e[3].length>0?w?w.p(e,n):(w=rw(e),w.c(),w.m(t,a)):w&&(w.d(1),w=null),16&n[0]&&(l.disabled=e[4])},d(n){n&&d(t),e[39](null),w&&w.d(),h=!1,i(v)}}}function rw(e){let t,n,i,r,s,o,a,l,f=e[3].length+"",h=(e[4]?e[5]:"Upload")+"";return{c(){t=p("span"),n=g(f),i=g(" file(s) selected"),r=m(),s=p("button"),o=g(h),b(t,"class","selected-count svelte-on0yal"),b(s,"class","upload-btn svelte-on0yal"),s.disabled=e[4]},m(d,f){u(d,t,f),c(t,n),c(t,i),u(d,r,f),u(d,s,f),c(s,o),a||(l=y(s,"click",e[24]),a=!0)},p(e,t){8&t[0]&&f!==(f=e[3].length+"")&&k(n,f),48&t[0]&&h!==(h=(e[4]?e[5]:"Upload")+"")&&k(o,h),16&t[0]&&(s.disabled=e[4])},d(e){e&&d(t),e&&d(r),e&&d(s),a=!1,l()}}}function sw(e){let t,n;return{c(){t=p("div"),n=g(e[2]),b(t,"class","error-message svelte-on0yal")},m(e,i){u(e,t,i),c(t,n)},p(e,t){4&t[0]&&k(n,e[2])},d(e){e&&d(t)}}}function ow(e){let t,n,i;function r(e,i){return 1&i[0]&&(t=null),null==t&&(t=!(!e[0]||0!==e[31]().length)),t?uw:(null==n&&(n=!(0!==e[31]().length)),n?cw:lw)}let s=r(e,[-1,-1]),o=s(e);return{c(){o.c(),i=v()},m(e,t){o.m(e,t),u(e,i,t)},p(e,t){s===(s=r(e,t))&&o?o.p(e,t):(o.d(1),o=s(e),o&&(o.c(),o.m(i.parentNode,i)))},d(e){o.d(e),e&&d(i)}}}function aw(e){let t;function n(e,t){return e[12]?vw:0===e[11].length?mw:gw}let i=n(e),r=i(e);return{c(){r.c(),t=v()},m(e,n){r.m(e,n),u(e,t,n)},p(e,s){i===(i=n(e))&&r?r.p(e,s):(r.d(1),r=i(e),r&&(r.c(),r.m(t.parentNode,t)))},d(e){r.d(e),e&&d(t)}}}function lw(e){let t,n=e[31](),i=[];for(let t=0;tNo users have uploaded files yet.

    ",b(n,"class","empty-state svelte-on0yal")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function vw(t){let n;return{c(){n=p("div"),n.textContent="Loading user statistics...",b(n,"class","loading svelte-on0yal")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function yw(t){let n;return{c(){n=p("div"),b(n,"class","user-avatar-placeholder svelte-on0yal")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function ww(e){let t,n;return{c(){t=p("img"),a(t.src,n=e[54].profile.picture)||b(t,"src",n),b(t,"alt",""),b(t,"class","user-avatar svelte-on0yal")},m(e,n){u(e,t,n)},p(e,i){2048&i[0]&&!a(t.src,n=e[54].profile.picture)&&b(t,"src",n)},d(e){e&&d(t)}}}function bw(e){let t,n,r,s,o,a,l,f,h,v,w,A,I,C,E,x,S,B,Q,F,D,$,P,R,T,U=(e[54].profile?.name||_w(e[25](e[54].pubkey)))+"",_=e[25](e[54].pubkey)+"",N=_w(e[25](e[54].pubkey))+"",L=e[54].blob_count+"",O=Dw(e[54].total_size_bytes)+"";function M(e,t){return e[54].profile?.picture?ww:yw}let j=M(e),H=j(e);function G(){return e[40](e[54])}function J(...t){return e[41](e[54],...t)}return{c(){t=p("div"),n=p("div"),H.c(),r=m(),s=p("div"),o=p("div"),a=g(U),l=m(),f=p("div"),h=p("span"),v=g(_),w=m(),A=p("span"),I=g(N),E=m(),x=p("div"),S=p("span"),B=g(L),Q=g(" files"),F=m(),D=p("span"),$=g(O),P=m(),b(n,"class","user-avatar-container svelte-on0yal"),b(o,"class","user-name svelte-on0yal"),b(h,"class","npub-full svelte-on0yal"),b(A,"class","npub-truncated svelte-on0yal"),b(f,"class","user-npub svelte-on0yal"),b(f,"title",C=e[54].pubkey),b(s,"class","user-info svelte-on0yal"),b(S,"class","blob-count svelte-on0yal"),b(D,"class","total-size svelte-on0yal"),b(x,"class","user-stats svelte-on0yal"),b(t,"class","user-stat-item svelte-on0yal"),b(t,"role","button"),b(t,"tabindex","0")},m(e,i){u(e,t,i),c(t,n),H.m(n,null),c(t,r),c(t,s),c(s,o),c(o,a),c(s,l),c(s,f),c(f,h),c(h,v),c(f,w),c(f,A),c(A,I),c(t,E),c(t,x),c(x,S),c(S,B),c(S,Q),c(x,F),c(x,D),c(D,$),c(t,P),R||(T=[y(t,"click",G),y(t,"keypress",J)],R=!0)},p(t,i){j===(j=M(e=t))&&H?H.p(e,i):(H.d(1),H=j(e),H&&(H.c(),H.m(n,null))),2048&i[0]&&U!==(U=(e[54].profile?.name||_w(e[25](e[54].pubkey)))+"")&&k(a,U),2048&i[0]&&_!==(_=e[25](e[54].pubkey)+"")&&k(v,_),2048&i[0]&&N!==(N=_w(e[25](e[54].pubkey))+"")&&k(I,N),2048&i[0]&&C!==(C=e[54].pubkey)&&b(f,"title",C),2048&i[0]&&L!==(L=e[54].blob_count+"")&&k(B,L),2048&i[0]&&O!==(O=Dw(e[54].total_size_bytes)+"")&&k($,O)},d(e){e&&d(t),H.d(),R=!1,i(T)}}}function Aw(e){let t,n,r,s,o,a,l,f,h,v,A,I,C,E,x,S,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q,Y,W,z,Z,X,ee,te=Pw(e[8].sha256)+"",ne=(e[8].type||"unknown")+"",ie="image"===Rw(e[8].type),re=Dw(e[8].size)+"",se=$w(e[8].uploaded)+"",oe=ie&&kw(e);function ae(e,t){return 256&t[0]&&(S=null),256&t[0]&&(B=null),256&t[0]&&(Q=null),null==S&&(S=!("image"!==Rw(e[8].type))),S?xw:(null==B&&(B=!("video"!==Rw(e[8].type))),B?Ew:(null==Q&&(Q=!("audio"!==Rw(e[8].type))),Q?Cw:Iw))}let le=ae(e,[-1,-1]),ce=le(e);return{c(){t=p("div"),n=p("div"),r=p("div"),s=p("div"),o=p("span"),a=g(te),l=m(),f=p("span"),h=g(ne),v=m(),A=p("div"),oe&&oe.c(),I=m(),C=p("button"),C.textContent="X",E=m(),x=p("div"),ce.c(),F=m(),D=p("div"),$=p("div"),P=p("span"),R=g("Size: "),T=g(re),U=m(),_=p("span"),N=g("Uploaded: "),L=g(se),O=m(),M=p("div"),j=p("input"),G=m(),J=p("button"),J.textContent="Copy",K=m(),V=p("div"),q=p("a"),Y=g("Open in New Tab"),z=m(),Z=p("button"),Z.textContent="Delete",b(o,"class","modal-hash svelte-on0yal"),b(f,"class","modal-type svelte-on0yal"),b(s,"class","modal-title svelte-on0yal"),b(C,"class","close-btn svelte-on0yal"),b(A,"class","modal-controls svelte-on0yal"),b(r,"class","modal-header svelte-on0yal"),b(x,"class","modal-body svelte-on0yal"),b($,"class","blob-details svelte-on0yal"),b(j,"type","text"),j.readOnly=!0,j.value=H=Uw(e[8]),b(j,"class","blob-url-input svelte-on0yal"),b(J,"class","copy-btn svelte-on0yal"),b(M,"class","blob-url-section svelte-on0yal"),b(q,"href",W=Uw(e[8])),b(q,"target","_blank"),b(q,"rel","noopener noreferrer"),b(q,"class","action-btn svelte-on0yal"),b(Z,"class","action-btn danger svelte-on0yal"),b(V,"class","modal-actions svelte-on0yal"),b(D,"class","modal-footer svelte-on0yal"),b(n,"class","modal-content svelte-on0yal"),b(n,"role","dialog"),b(t,"class","modal-overlay svelte-on0yal"),b(t,"role","button"),b(t,"tabindex","0")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(r,s),c(s,o),c(o,a),c(s,l),c(s,f),c(f,h),c(r,v),c(r,A),oe&&oe.m(A,null),c(A,I),c(A,C),c(n,E),c(n,x),ce.m(x,null),c(n,F),c(n,D),c(D,$),c($,P),c(P,R),c(P,T),c($,U),c($,_),c(_,N),c(_,L),c(D,O),c(D,M),c(M,j),c(M,G),c(M,J),c(D,K),c(D,V),c(V,q),c(q,Y),c(V,z),c(V,Z),X||(ee=[y(C,"click",e[16]),y(j,"click",Nw),y(J,"click",e[45]),y(Z,"click",e[46]),y(n,"click",w(e[37])),y(n,"keypress",w(e[38])),y(t,"click",e[16]),y(t,"keypress",e[47])],X=!0)},p(e,t){256&t[0]&&te!==(te=Pw(e[8].sha256)+"")&&k(a,te),256&t[0]&&ne!==(ne=(e[8].type||"unknown")+"")&&k(h,ne),256&t[0]&&(ie="image"===Rw(e[8].type)),ie?oe?oe.p(e,t):(oe=kw(e),oe.c(),oe.m(A,I)):oe&&(oe.d(1),oe=null),le===(le=ae(e,t))&&ce?ce.p(e,t):(ce.d(1),ce=le(e),ce&&(ce.c(),ce.m(x,null))),256&t[0]&&re!==(re=Dw(e[8].size)+"")&&k(T,re),256&t[0]&&se!==(se=$w(e[8].uploaded)+"")&&k(L,se),256&t[0]&&H!==(H=Uw(e[8]))&&j.value!==H&&(j.value=H),256&t[0]&&W!==(W=Uw(e[8]))&&b(q,"href",W)},d(e){e&&d(t),oe&&oe.d(),ce.d(),X=!1,i(ee)}}}function kw(e){let t,n,r,s,o,a,l,f,h,v,w,A,I,C=Math.round(100*e[9])+"";return{c(){t=p("button"),n=g("-"),s=m(),o=p("span"),a=g(C),l=g("%"),f=m(),h=p("button"),v=g("+"),b(t,"class","zoom-btn svelte-on0yal"),t.disabled=r=e[9]<=Bw,b(o,"class","zoom-level svelte-on0yal"),b(h,"class","zoom-btn svelte-on0yal"),h.disabled=w=e[9]>=Qw},m(i,r){u(i,t,r),c(t,n),u(i,s,r),u(i,o,r),c(o,a),c(o,l),u(i,f,r),u(i,h,r),c(h,v),A||(I=[y(t,"click",e[18]),y(h,"click",e[17])],A=!0)},p(e,n){512&n[0]&&r!==(r=e[9]<=Bw)&&(t.disabled=r),512&n[0]&&C!==(C=Math.round(100*e[9])+"")&&k(a,C),512&n[0]&&w!==(w=e[9]>=Qw)&&(h.disabled=w)},d(e){e&&d(t),e&&d(s),e&&d(o),e&&d(f),e&&d(h),A=!1,i(I)}}}function Iw(e){let t,n,i,r,s,o,a,l,f,h=Tw(e[8].type)+"";return{c(){t=p("div"),n=p("div"),i=g(h),r=m(),s=p("p"),s.textContent="Preview not available for this file type.",o=m(),a=p("a"),l=g("Download File"),b(n,"class","file-icon svelte-on0yal"),b(a,"href",f=Uw(e[8])),b(a,"target","_blank"),b(a,"rel","noopener noreferrer"),b(a,"class","download-link svelte-on0yal"),b(t,"class","file-preview svelte-on0yal")},m(e,d){u(e,t,d),c(t,n),c(n,i),c(t,r),c(t,s),c(t,o),c(t,a),c(a,l)},p(e,t){256&t[0]&&h!==(h=Tw(e[8].type)+"")&&k(i,h),256&t[0]&&f!==(f=Uw(e[8]))&&b(a,"href",f)},d(e){e&&d(t)}}}function Cw(e){let t,n,i;return{c(){t=p("div"),n=p("audio"),n.controls=!0,a(n.src,i=Uw(e[8]))||b(n,"src",i),b(n,"class","svelte-on0yal"),b(t,"class","media-container audio svelte-on0yal")},m(e,i){u(e,t,i),c(t,n)},p(e,t){256&t[0]&&!a(n.src,i=Uw(e[8]))&&b(n,"src",i)},d(e){e&&d(t)}}}function Ew(e){let t,n,i,r;return{c(){t=p("div"),n=p("video"),i=p("track"),b(i,"kind","captions"),n.controls=!0,a(n.src,r=Uw(e[8]))||b(n,"src",r),b(n,"class","svelte-on0yal"),b(t,"class","media-container svelte-on0yal")},m(e,r){u(e,t,r),c(t,n),c(n,i)},p(e,t){256&t[0]&&!a(n.src,r=Uw(e[8]))&&b(n,"src",r)},d(e){e&&d(t)}}}function xw(e){let t,n,i;return{c(){t=p("div"),n=p("img"),a(n.src,i=Uw(e[8]))||b(n,"src",i),b(n,"alt","Blob content"),b(n,"class","svelte-on0yal"),b(t,"class","media-container svelte-on0yal"),C(t,"transform","scale("+e[9]+")")},m(e,i){u(e,t,i),c(t,n)},p(e,r){256&r[0]&&!a(n.src,i=Uw(e[8]))&&b(n,"src",i),512&r[0]&&C(t,"transform","scale("+e[9]+")")},d(e){e&&d(t)}}}function Sw(t){let n,i,r,s;function o(e,t){return e[1]?zy:Wy}let a=o(t),l=a(t),c=t[7]&&t[8]&&Aw(t);return{c(){l.c(),n=m(),c&&c.c(),i=v()},m(e,o){l.m(e,o),u(e,n,o),c&&c.m(e,o),u(e,i,o),r||(s=y(Vy,"keydown",t[19]),r=!0)},p(e,t){a===(a=o(e))&&l?l.p(e,t):(l.d(1),l=a(e),l&&(l.c(),l.m(n.parentNode,n))),e[7]&&e[8]?c?c.p(e,t):(c=Aw(e),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null)},i:e,o:e,d(e){l.d(e),e&&d(n),c&&c.d(e),e&&d(i),r=!1,s()}}}const Bw=.25,Qw=4;async function Fw(e,t,n=null){if(!e)return console.log("No signer available for Blossom auth"),null;try{const i=Math.floor(Date.now()/1e3),r=[["t",t],["expiration",(i+60).toString()]];n&&r.push(["x",n]);const s={kind:24242,created_at:i,tags:r,content:`Blossom ${t} operation`},o=await e.signEvent(s);return btoa(JSON.stringify(o)).replace(/\+/g,"-").replace(/\//g,"_")}catch(e){return console.error("Error creating Blossom auth:",e),null}}function Dw(e){if(!e)return"0 B";const t=["B","KB","MB","GB"];let n=0,i=e;for(;i>=1024&&ne.target.select();function Lw(e,t,n){let i,r,{isLoggedIn:s=!1}=t,{userPubkey:o=""}=t,{userSigner:a=null}=t,{currentEffectiveRole:l=""}=t;const c=P();let u,d=[],f=!1,p="",h=[],g=!1,m="",v=!1,y=null,w=1,b=!1,A=[],k=!1,I=null,C=[],E=!1;async function x(){if(o){n(0,f=!0),n(2,p="");try{const e=`${window.location.origin}/blossom/list/${o}`,t=await Fw(a,"list"),n=await fetch(e,{headers:t?{Authorization:`Nostr ${t}`}:{}});if(!n.ok)throw new Error(`Failed to load blobs: ${n.statusText}`);const i=await n.json();d=Array.isArray(i)?i:[],d.sort((e,t)=>(t.uploaded||0)-(e.uploaded||0)),console.log("Loaded blobs:",d)}catch(e){console.error("Error loading blobs:",e),n(2,p=e.message||"Failed to load blobs")}finally{n(0,f=!1)}}}function S(e){n(8,y=e),n(9,w=1),n(7,v=!0)}function B(){n(7,v=!1),n(8,y=null),n(9,w=1)}function Q(){wBw&&n(9,w=Math.max(Bw,w-.25))}async function $(e){if(confirm(`Delete blob ${Pw(e.sha256)}?`))try{const t=`${window.location.origin}/blossom/${e.sha256}`,n=await Fw(a,"delete",e.sha256),i=await fetch(t,{method:"DELETE",headers:n?{Authorization:`Nostr ${n}`}:{}});if(!i.ok)throw new Error(`Failed to delete: ${i.statusText}`);d=d.filter(t=>t.sha256!==e.sha256),y?.sha256===e.sha256&&B()}catch(e){console.error("Error deleting blob:",e),alert(`Failed to delete blob: ${e.message}`)}}async function T(){n(12,k=!0),n(2,p="");try{const e=`${window.location.origin}/blossom/admin/users`,t=await Fw(a,"admin"),i=await fetch(e,{headers:t?{Authorization:`Nostr ${t}`}:{}});if(!i.ok)throw new Error(`Failed to load user stats: ${i.statusText}`);n(11,A=await i.json());for(const e of A)Sp(e.pubkey).then(t=>{e.profile=t||{name:"",picture:""},n(11,A)}).catch(()=>{e.profile={name:"",picture:""}})}catch(e){console.error("Error fetching admin user stats:",e),n(2,p=e.message||"Failed to load user stats")}finally{n(12,k=!1)}}async function _(e){n(0,f=!0),n(2,p="");try{const t=`${window.location.origin}/blossom/list/${e}`,n=await Fw(a,"list"),i=await fetch(t,{headers:n?{Authorization:`Nostr ${n}`}:{}});if(!i.ok)throw new Error(`Failed to load user blobs: ${i.statusText}`);C=await i.json(),C.sort((e,t)=>(t.uploaded||0)-(e.uploaded||0))}catch(e){console.error("Error loading user blobs:",e),n(2,p=e.message||"Failed to load user blobs")}finally{n(0,f=!1)}}async function N(e){n(13,I={pubkey:e.pubkey,profile:e.profile}),await _(e.pubkey)}D(()=>{i&&!E&&(n(36,E=!0),x())});return e.$$set=e=>{"isLoggedIn"in e&&n(32,s=e.isLoggedIn),"userPubkey"in e&&n(33,o=e.userPubkey),"userSigner"in e&&n(34,a=e.userSigner),"currentEffectiveRole"in e&&n(35,l=e.currentEffectiveRole)},e.$$.update=()=>{6&e.$$.dirty[1]&&n(1,i=s&&o),16&e.$$.dirty[1]&&n(14,r="admin"===l||"owner"===l),3&e.$$.dirty[0]|32&e.$$.dirty[1]&&(!i||E||f||(n(36,E=!0),x()))},[f,i,p,h,g,m,u,v,y,w,b,A,k,I,r,S,B,Q,F,function(e){v&&("Escape"===e.key?B():"+"===e.key||"="===e.key?Q():"-"===e.key&&F())},function(){c("openLoginModal")},$,function(e){n(3,h=Array.from(e.target.files))},function(){u?.click()},async function(){if(0===h.length)return;n(4,g=!0),n(2,p="");const e=[],t=[];for(let i=0;i0&&await x(),t.length>0&&n(2,p=`Failed to upload: ${t.map(e=>e.name).join(", ")}`)},function(e){try{return wu(e)}catch(t){return Pw(e)}},function(){n(10,b=!0),T()},function(){n(10,b=!1),n(11,A=[]),n(13,I=null),C=[]},N,function(){n(13,I=null),C=[]},function(){I?_(I.pubkey):b?T():x()},function(){return I?C:d},s,o,a,l,E,function(t){R.call(this,e,t)},function(t){R.call(this,e,t)},function(e){U[e?"unshift":"push"](()=>{u=e,n(6,u)})},e=>N(e),(e,t)=>"Enter"===t.key&&N(e),e=>$(e),e=>S(e),(e,t)=>"Enter"===t.key&&S(e),()=>{navigator.clipboard.writeText(Uw(y))},()=>$(y),e=>"Enter"===e.key&&B()]}class Ow extends se{constructor(e){super(),re(this,e,Lw,Sw,s,{isLoggedIn:32,userPubkey:33,userSigner:34,currentEffectiveRole:35},null,[-1,-1])}}function Mw(e,t,n){const i=e.slice();return i[29]=t[n],i}function jw(e,t,n){const i=e.slice();return i[32]=t[n],i}function Hw(e){let t,n,i;function r(e,t){return e[0]?Jw:Kw}let s=r(e),o=s(e);return{c(){t=p("div"),n=p("p"),n.textContent="Log viewer is only available to relay owners.",i=m(),o.c(),b(n,"class","svelte-w6h7aj"),b(t,"class","login-prompt svelte-w6h7aj")},m(e,r){u(e,t,r),c(t,n),c(t,i),o.m(t,null)},p(e,n){s===(s=r(e))&&o?o.p(e,n):(o.d(1),o=s(e),o&&(o.c(),o.m(t,null)))},d(e){e&&d(t),o.d()}}}function Gw(e){let t,n,r,s,o,a,l,h,v,w,A,I,C,x,S,B,Q,F,D,$,P,R,T,U,_,N,L,O,j,H,G,J=e[3]?"Loading...":"Refresh",K=e[2].length+"",V=e[12],q=[];for(let t=0;te[18].call(v)),b(a,"class","level-selector svelte-w6h7aj"),b(A,"class","clear-btn svelte-w6h7aj"),A.disabled=C=e[3]||0===e[2].length,b(S,"class","refresh-btn svelte-w6h7aj"),S.disabled=e[3],b(o,"class","header-controls svelte-w6h7aj"),b(n,"class","header-section svelte-w6h7aj"),b($,"class","log-info svelte-w6h7aj"),b(j,"class","log-list svelte-w6h7aj"),b(t,"class","log-view svelte-w6h7aj")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),c(a,l),c(a,h),c(a,v);for(let e=0;eNo logs available.

    ",b(n,"class","empty-state svelte-w6h7aj")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function zw(e){let t,n,i,r,s=e[29].file+"",o=e[29].line+"";return{c(){t=p("span"),n=g(s),i=g(":"),r=g(o),b(t,"class","log-location svelte-w6h7aj")},m(e,s){u(e,t,s),c(t,n),c(t,i),c(t,r)},p(e,t){4&t[0]&&s!==(s=e[29].file+"")&&k(n,s),4&t[0]&&o!==(o=e[29].line+"")&&k(r,o)},d(e){e&&d(t)}}}function Zw(e){let t,n,i,r,s,o,a,l,f,h,v,y=ib(e[29].timestamp)+"",w=e[29].level+"",A=e[29].message+"",I=e[29].file&&zw(e);return{c(){t=p("div"),n=p("span"),i=g(y),r=m(),s=p("span"),o=g(w),l=m(),I&&I.c(),f=m(),h=p("span"),v=g(A),b(n,"class","log-timestamp svelte-w6h7aj"),b(s,"class",a="log-level "+rb(e[29].level)+" svelte-w6h7aj"),b(h,"class","log-message svelte-w6h7aj"),b(t,"class","log-entry svelte-w6h7aj")},m(e,a){u(e,t,a),c(t,n),c(n,i),c(t,r),c(t,s),c(s,o),c(t,l),I&&I.m(t,null),c(t,f),c(t,h),c(h,v)},p(e,n){4&n[0]&&y!==(y=ib(e[29].timestamp)+"")&&k(i,y),4&n[0]&&w!==(w=e[29].level+"")&&k(o,w),4&n[0]&&a!==(a="log-level "+rb(e[29].level)+" svelte-w6h7aj")&&b(s,"class",a),e[29].file?I?I.p(e,n):(I=zw(e),I.c(),I.m(t,f)):I&&(I.d(1),I=null),4&n[0]&&A!==(A=e[29].message+"")&&k(v,A)},d(e){e&&d(t),I&&I.d()}}}function Xw(e){let t;return{c(){t=p("span"),t.textContent="End of logs"},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function eb(e){let t;return{c(){t=p("span"),t.textContent="Scroll for more"},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function tb(e){let t;return{c(){t=p("span"),t.textContent="Loading more..."},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function nb(t){let n;function i(e,t){return e[4]?Gw:Hw}let r=i(t),s=r(t);return{c(){s.c(),n=v()},m(e,t){s.m(e,t),u(e,n,t)},p(e,t){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n.parentNode,n)))},i:e,o:e,d(e){s.d(e),e&&d(n)}}}function ib(e){if(!e)return"";return new Date(e).toLocaleString()}function rb(e){switch(e?.toUpperCase()){case"TRC":case"TRACE":return"level-trace";case"DBG":case"DEBUG":return"level-debug";case"INF":case"INFO":default:return"level-info";case"WRN":case"WARN":return"level-warn";case"ERR":case"ERROR":return"level-error";case"FTL":case"FATAL":return"level-fatal"}}function sb(e,t,n){let i,{isLoggedIn:r=!1}=t,{userRole:s=""}=t,{userSigner:o=null}=t;const a=P();let l=[],c=!1,u=!0,d=0,f=0,p="",h="info",g="info";const m=["trace","debug","info","warn","error","fatal"];let v,y,w;async function b(e="GET",t="/api/logs"){if(!o)return null;try{const n={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",`${window.location.origin}${t}`],["method",e]],content:""},i=await o.signEvent(n);return btoa(JSON.stringify(i)).replace(/\+/g,"-").replace(/\//g,"_")}catch(e){return console.error("Error creating auth header:",e),null}}async function A(e=!1){if(!c){n(3,c=!0),n(7,p=""),e&&(d=0,n(2,l=[]));try{const t=`/api/logs?offset=${d}&limit=100`,i=await b("GET",t),r=`${window.location.origin}${t}`,s=await fetch(r,{headers:i?{Authorization:`Nostr ${i}`}:{}});if(!s.ok)throw new Error(`Failed to load logs: ${s.statusText}`);const o=await s.json();n(2,l=e?o.logs||[]:[...l,...o.logs||[]]),n(6,f=o.total||0),n(5,u=o.has_more||!1),d=l.length}catch(e){console.error("Error loading logs:",e),n(7,p=e.message||"Failed to load logs")}finally{n(3,c=!1)}}}async function k(){try{const e=await fetch(`${window.location.origin}/api/logs/level`);if(e.ok){const t=await e.json();n(8,h=t.level||"info"),n(9,g=h)}}catch(e){console.error("Error loading log level:",e)}}D(()=>{i&&(A(!0),k(),function(){if(!y)return;w=new IntersectionObserver(e=>{e[0].isIntersecting&&u&&!c&&u&&!c&&A(!1)},{threshold:.1}),w.observe(y)}())}),$(()=>{w&&w.disconnect()});return e.$$set=e=>{"isLoggedIn"in e&&n(0,r=e.isLoggedIn),"userRole"in e&&n(1,s=e.userRole),"userSigner"in e&&n(17,o=e.userSigner)},e.$$.update=()=>{3&e.$$.dirty[0]&&n(4,i=r&&"owner"===s),28&e.$$.dirty[0]&&i&&0===l.length&&!c&&(A(!0),k())},[r,s,l,c,i,u,f,p,h,g,v,y,m,A,async function(){if(g!==h)try{const e=await b("POST","/api/logs/level"),t=await fetch(`${window.location.origin}/api/logs/level`,{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:`Nostr ${e}`}:{}},body:JSON.stringify({level:g})});if(!t.ok)throw new Error(`Failed to set log level: ${t.statusText}`);const i=await t.json();n(8,h=i.level),n(9,g=h)}catch(e){console.error("Error setting log level:",e),n(7,p=e.message||"Failed to set log level"),n(9,g=h)}},async function(){if(confirm("Are you sure you want to clear all logs?"))try{const e=await b("POST","/api/logs/clear"),t=await fetch(`${window.location.origin}/api/logs/clear`,{method:"POST",headers:e?{Authorization:`Nostr ${e}`}:{}});if(!t.ok)throw new Error(`Failed to clear logs: ${t.statusText}`);n(2,l=[]),d=0,n(5,u=!1),n(6,f=0)}catch(e){console.error("Error clearing logs:",e),n(7,p=e.message||"Failed to clear logs")}},function(){a("openLoginModal")},o,function(){g=x(this),n(9,g),n(12,m)},()=>A(!0),function(e){U[e?"unshift":"push"](()=>{y=e,n(11,y)})},function(e){U[e?"unshift":"push"](()=>{v=e,n(10,v)})}]}class ob extends se{constructor(e){super(),re(this,e,sb,nb,s,{isLoggedIn:0,userRole:1,userSigner:17},null,[-1,-1])}}async function ab(e,t,n,i){if(!e||!t)return console.log("createNIP98Auth: No signer or pubkey available",{hasSigner:!!e,hasPubkey:!!t}),null;try{const t={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",i],["method",n.toUpperCase()]],content:""};console.log("createNIP98Auth: Signing event for",n,i);const r=await e.signEvent(t);console.log("createNIP98Auth: Signed event:",{id:r.id,pubkey:r.pubkey,kind:r.kind,created_at:r.created_at,tags:r.tags,hasSig:!!r.sig});const s=JSON.stringify(r);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_")}catch(e){return console.error("createNIP98Auth: Error:",e),null}}async function lb(){try{const e=await fetch(`${window.location.origin}/api/nrc/config`);if(e.ok)return await e.json()}catch(e){console.error("Error fetching NRC config:",e)}return{enabled:!1,badger_required:!0}}function cb(e){return hp[e]||`Kind ${e}`}function ub(e){return e?e.slice(0,8)+"..."+e.slice(-8):"unknown"}function db(e,t=100){return e?e.length>t?e.slice(0,t)+"...":e:""}function fb(e){return e?new Date(1e3*e).toLocaleString():""}async function pb(e){try{return await navigator.clipboard.writeText(e),!0}catch(t){console.error("Failed to copy to clipboard:",t);try{const t=document.createElement("textarea");return t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),!0}catch(e){return console.error("Fallback copy also failed:",e),!1}}}function hb(e,t=!0){if(!e)return;const n=e.textContent,i=e.style.backgroundColor;t?(e.textContent="",e.style.backgroundColor="#4CAF50"):(e.textContent="L",e.style.backgroundColor="#f44336"),setTimeout(()=>{e.textContent=n,e.style.backgroundColor=i},2e3)}function gb(e,t,n){const i=e.slice();return i[31]=t[n],i}function mb(e){let t,n,r,s,o,a,l,f,h,w,A,C,E,x,S,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q,Y,W,z,Z,X,ee,te=(e[5].rendezvous_url||"Not configured")+"",ne=e[4].length+"",ie=e[5].mint_url&&bb(e),re=!e[5].mint_url&&Ab();function se(e,t){return 0===e[4].length?Ib:kb}let oe=se(e),ae=oe(e),le=e[7]&&Sb(e);return{c(){t=p("div"),n=p("div"),n.innerHTML='Status: \n Enabled',r=m(),s=p("div"),o=p("span"),o.textContent="Rendezvous:",a=m(),l=p("span"),f=g(te),h=m(),ie&&ie.c(),w=m(),A=p("div"),C=p("h3"),C.textContent="Create New Connection",E=m(),x=p("div"),S=p("div"),B=p("label"),B.textContent="Device Label",Q=m(),F=p("input"),D=m(),$=p("div"),P=p("label"),R=p("input"),U=g("\n Include CAT (Cashu Access Token)\n "),re&&re.c(),_=m(),N=p("button"),L=g("+ Create Connection"),M=m(),j=p("div"),H=p("h3"),G=g("Connections ("),J=g(ne),K=g(")"),V=m(),ae.c(),q=m(),Y=p("button"),W=g("Refresh"),z=m(),le&&le.c(),Z=v(),b(n,"class","status-item svelte-gwb5vv"),b(o,"class","status-label svelte-gwb5vv"),b(l,"class","status-value svelte-gwb5vv"),b(s,"class","status-item svelte-gwb5vv"),b(t,"class","config-status svelte-gwb5vv"),b(C,"class","svelte-gwb5vv"),b(B,"for","new-label"),b(B,"class","svelte-gwb5vv"),b(F,"type","text"),b(F,"id","new-label"),b(F,"placeholder","e.g., Phone, Laptop, Tablet"),F.disabled=e[6],b(F,"class","svelte-gwb5vv"),b(S,"class","form-group svelte-gwb5vv"),b(R,"type","checkbox"),R.disabled=T=e[6]||!e[5].mint_url,b(R,"class","svelte-gwb5vv"),b(P,"class","svelte-gwb5vv"),b($,"class","form-group checkbox-group svelte-gwb5vv"),b(N,"class","create-btn svelte-gwb5vv"),N.disabled=O=e[6]||!e[9].trim(),b(x,"class","create-form svelte-gwb5vv"),b(A,"class","section svelte-gwb5vv"),b(H,"class","svelte-gwb5vv"),b(Y,"class","refresh-btn svelte-gwb5vv"),Y.disabled=e[6],b(j,"class","section svelte-gwb5vv")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(s,o),c(s,a),c(s,l),c(l,f),c(t,h),ie&&ie.m(t,null),u(i,w,d),u(i,A,d),c(A,C),c(A,E),c(A,x),c(x,S),c(S,B),c(S,Q),c(S,F),I(F,e[9]),c(x,D),c(x,$),c($,P),c(P,R),R.checked=e[10],c(P,U),re&&re.m(P,null),c(x,_),c(x,N),c(N,L),u(i,M,d),u(i,j,d),c(j,H),c(H,G),c(H,J),c(H,K),c(j,V),ae.m(j,null),c(j,q),c(j,Y),c(Y,W),u(i,z,d),le&&le.m(i,d),u(i,Z,d),X||(ee=[y(F,"input",e[24]),y(R,"change",e[25]),y(N,"click",e[15]),y(Y,"click",e[14])],X=!0)},p(e,n){32&n[0]&&te!==(te=(e[5].rendezvous_url||"Not configured")+"")&&k(f,te),e[5].mint_url?ie?ie.p(e,n):(ie=bb(e),ie.c(),ie.m(t,null)):ie&&(ie.d(1),ie=null),64&n[0]&&(F.disabled=e[6]),512&n[0]&&F.value!==e[9]&&I(F,e[9]),96&n[0]&&T!==(T=e[6]||!e[5].mint_url)&&(R.disabled=T),1024&n[0]&&(R.checked=e[10]),e[5].mint_url?re&&(re.d(1),re=null):re||(re=Ab(),re.c(),re.m(P,null)),576&n[0]&&O!==(O=e[6]||!e[9].trim())&&(N.disabled=O),16&n[0]&&ne!==(ne=e[4].length+"")&&k(J,ne),oe===(oe=se(e))&&ae?ae.p(e,n):(ae.d(1),ae=oe(e),ae&&(ae.c(),ae.m(j,q))),64&n[0]&&(Y.disabled=e[6]),e[7]?le?le.p(e,n):(le=Sb(e),le.c(),le.m(Z.parentNode,Z)):le&&(le.d(1),le=null)},d(e){e&&d(t),ie&&ie.d(),e&&d(w),e&&d(A),re&&re.d(),e&&d(M),e&&d(j),ae.d(),e&&d(z),le&&le.d(e),e&&d(Z),X=!1,i(ee)}}}function vb(e){let t,n,i,r,s,o,a,l=(e[1]||"none")+"";return{c(){t=p("div"),n=p("p"),n.textContent="Owner permission required for relay connection management.",i=m(),r=p("p"),s=g("Current role: "),o=p("strong"),a=g(l),b(n,"class","svelte-gwb5vv"),b(r,"class","svelte-gwb5vv"),b(t,"class","permission-denied svelte-gwb5vv")},m(e,l){u(e,t,l),c(t,n),c(t,i),c(t,r),c(r,s),c(r,o),c(o,a)},p(e,t){2&t[0]&&l!==(l=(e[1]||"none")+"")&&k(a,l)},d(e){e&&d(t)}}}function yb(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in to manage relay connections.",r=m(),s=p("button"),s.textContent="Log In",b(i,"class","svelte-gwb5vv"),b(s,"class","login-btn svelte-gwb5vv"),b(n,"class","login-prompt svelte-gwb5vv")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[20]),o=!0)},p:e,d(e){e&&d(n),o=!1,a()}}}function wb(e){let t;function n(e,t){return e[3]?Qb:Bb}let i=n(e),r=i(e);return{c(){t=p("div"),r.c(),b(t,"class","not-enabled svelte-gwb5vv")},m(e,n){u(e,t,n),r.m(t,null)},p(e,s){i!==(i=n(e))&&(r.d(1),r=i(e),r&&(r.c(),r.m(t,null)))},d(e){e&&d(t),r.d()}}}function bb(e){let t,n,i,r,s,o=e[5].mint_url+"";return{c(){t=p("div"),n=p("span"),n.textContent="Cashu Mint:",i=m(),r=p("span"),s=g(o),b(n,"class","status-label svelte-gwb5vv"),b(r,"class","status-value svelte-gwb5vv"),b(t,"class","status-item svelte-gwb5vv")},m(e,o){u(e,t,o),c(t,n),c(t,i),c(t,r),c(r,s)},p(e,t){32&t[0]&&o!==(o=e[5].mint_url+"")&&k(s,o)},d(e){e&&d(t)}}}function Ab(e){let t;return{c(){t=p("span"),t.textContent="(requires Cashu mint)",b(t,"class","hint svelte-gwb5vv")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function kb(e){let t,n=e[4],i=[];for(let t=0;tORLY_NRC_ENABLED=true and configure ORLY_NRC_RENDEZVOUS_URL to enable.',b(t,"class","svelte-gwb5vv"),b(i,"class","svelte-gwb5vv")},m(e,r){u(e,t,r),u(e,n,r),u(e,i,r)},d(e){e&&d(t),e&&d(n),e&&d(i)}}}function Qb(e){let t,n,i;return{c(){t=p("p"),t.textContent="NRC requires the Badger database backend.",n=m(),i=p("p"),i.innerHTML='Set ORLY_DB_TYPE=badger to enable NRC functionality.',b(t,"class","svelte-gwb5vv"),b(i,"class","svelte-gwb5vv")},m(e,r){u(e,t,r),u(e,n,r),u(e,i,r)},d(e){e&&d(t),e&&d(n),e&&d(i)}}}function Fb(e){let t,n,r,s,o,a,l,f,h,v,A,I,C,E,x,S,B,Q;return{c(){t=p("div"),n=p("div"),r=p("h3"),s=g('Connection URI for "'),o=g(e[13]),a=g('"'),l=m(),f=p("p"),f.textContent="Copy this URI to your Nostr client to connect to this relay remotely.\n Keep it secret - anyone with this URI can access your relay.",h=m(),v=p("div"),A=p("textarea"),I=m(),C=p("div"),E=p("button"),E.textContent="Copy to Clipboard",x=m(),S=p("button"),S.textContent="Close",b(r,"class","svelte-gwb5vv"),b(f,"class","modal-description svelte-gwb5vv"),A.readOnly=!0,A.value=e[12],b(A,"class","svelte-gwb5vv"),b(v,"class","uri-display svelte-gwb5vv"),b(E,"class","copy-btn svelte-gwb5vv"),b(S,"class","close-btn svelte-gwb5vv"),b(C,"class","modal-actions svelte-gwb5vv"),b(n,"class","modal svelte-gwb5vv"),b(t,"class","modal-overlay svelte-gwb5vv")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(r,s),c(r,o),c(r,a),c(n,l),c(n,f),c(n,h),c(n,v),c(v,A),c(n,I),c(n,C),c(C,E),c(C,x),c(C,S),B||(Q=[y(E,"click",e[18]),y(S,"click",e[19]),y(n,"click",w(e[23])),y(t,"click",e[19])],B=!0)},p(e,t){8192&t[0]&&k(o,e[13]),4096&t[0]&&(A.value=e[12])},d(e){e&&d(t),B=!1,i(Q)}}}function Db(t){let n,i,r,s,o,a,l;function f(e,t){return e[2]?e[0]?"owner"!==e[1]?vb:mb:yb:wb}let h=f(t),g=h(t),y=t[11]&&Fb(t);return{c(){n=p("div"),i=p("h2"),i.textContent="Relay Connect",r=m(),s=p("p"),s.textContent="Nostr Relay Connect (NRC) allows remote access to this relay through a public relay tunnel.\n Create connection strings for your devices to sync securely.",o=m(),g.c(),a=m(),y&&y.c(),l=v(),b(i,"class","svelte-gwb5vv"),b(s,"class","description svelte-gwb5vv"),b(n,"class","relay-connect-view svelte-gwb5vv")},m(e,t){u(e,n,t),c(n,i),c(n,r),c(n,s),c(n,o),g.m(n,null),u(e,a,t),y&&y.m(e,t),u(e,l,t)},p(e,t){h===(h=f(e))&&g?g.p(e,t):(g.d(1),g=h(e),g&&(g.c(),g.m(n,null))),e[11]?y?y.p(e,t):(y=Fb(e),y.c(),y.m(l.parentNode,l)):y&&(y.d(1),y=null)},i:e,o:e,d(e){e&&d(n),g.d(),e&&d(a),y&&y.d(e),e&&d(l)}}}function $b(e){return e?new Date(1e3*e).toLocaleString():"Never"}function Pb(e,t,n){let{isLoggedIn:i=!1}=t,{userRole:r=""}=t,{userSigner:s=null}=t,{userPubkey:o=""}=t;const a=P();let l=!1,c=!1,u=[],d={},f=!1,p="",h="info",g="",m=!1,v=!1,y="",w="";async function b(){if(i&&s&&o){n(6,f=!0);try{const e=await async function(e,t){const n=`${window.location.origin}/api/nrc/connections`,i=await ab(e,t,"GET",n),r=await fetch(n,{headers:i?{Authorization:`Nostr ${i}`}:{}});if(!r.ok){const e=await r.text();throw new Error(e||`Failed to get NRC connections: ${r.statusText}`)}return await r.json()}(s,o);n(4,u=e.connections||[]),n(5,d=e.config||{})}catch(e){I(`Failed to load connections: ${e.message}`,"error")}finally{n(6,f=!1)}}}async function A(e,t){if(confirm(`Are you sure you want to delete the connection "${t}"? This will revoke access for any device using this connection.`)){n(6,f=!0);try{await async function(e,t,n){const i=`${window.location.origin}/api/nrc/connections/${n}`,r=await ab(e,t,"DELETE",i),s=await fetch(i,{method:"DELETE",headers:r?{Authorization:`Nostr ${r}`}:{}});if(!s.ok){const e=await s.text();throw new Error(e||`Failed to delete NRC connection: ${s.statusText}`)}return await s.json()}(s,o,e),await b(),I(`Connection "${t}" deleted`,"success")}catch(e){I(`Failed to delete connection: ${e.message}`,"error")}finally{n(6,f=!1)}}}async function k(e,t){n(6,f=!0);try{const i=await async function(e,t,n){const i=`${window.location.origin}/api/nrc/connections/${n}/uri`,r=await ab(e,t,"GET",i),s=await fetch(i,{headers:r?{Authorization:`Nostr ${r}`}:{}});if(!s.ok){const e=await s.text();throw new Error(e||`Failed to get NRC URI: ${s.statusText}`)}return await s.json()}(s,o,e);n(12,y=i.uri),n(13,w=t),n(11,v=!0)}catch(e){I(`Failed to get URI: ${e.message}`,"error")}finally{n(6,f=!1)}}function I(e,t="info"){n(7,p=e),n(8,h=t),setTimeout(()=>{p===e&&n(7,p="")},5e3)}D(async()=>{await async function(){try{const e=await lb();n(2,l=e.enabled),n(3,c=e.badger_required),l&&i&&"owner"===r&&await b()}catch(e){console.error("Failed to load NRC config:",e)}}()});return e.$$set=e=>{"isLoggedIn"in e&&n(0,i=e.isLoggedIn),"userRole"in e&&n(1,r=e.userRole),"userSigner"in e&&n(21,s=e.userSigner),"userPubkey"in e&&n(22,o=e.userPubkey)},e.$$.update=()=>{7&e.$$.dirty[0]&&i&&"owner"===r&&l&&b()},[i,r,l,c,u,d,f,p,h,g,m,v,y,w,b,async function(){if(g.trim()){n(6,f=!0);try{const e=await async function(e,t,n,i=!1){const r=`${window.location.origin}/api/nrc/connections`,s=await ab(e,t,"POST",r),o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",...s?{Authorization:`Nostr ${s}`}:{}},body:JSON.stringify({label:n,use_cashu:i})});if(!o.ok){const e=await o.text();throw new Error(e||`Failed to create NRC connection: ${o.statusText}`)}return await o.json()}(s,o,g.trim(),m);n(12,y=e.uri),n(13,w=e.label),n(11,v=!0),n(9,g=""),n(10,m=!1),await b(),I(`Connection "${e.label}" created successfully`,"success")}catch(e){I(`Failed to create connection: ${e.message}`,"error")}finally{n(6,f=!1)}}else I("Please enter a label for the connection","error")},A,k,async function(e){const t=await pb(y);hb(e.target.closest("button"),t),t||I("Failed to copy to clipboard","error")},function(){n(11,v=!1),n(12,y=""),n(13,w="")},function(){a("openLoginModal")},s,o,function(t){R.call(this,e,t)},function(){g=this.value,n(9,g)},function(){m=this.checked,n(10,m)},e=>k(e.id,e.label),e=>A(e.id,e.label)]}class Rb extends se{constructor(e){super(),re(this,e,Pb,Db,s,{isLoggedIn:0,userRole:1,userSigner:21,userPubkey:22},null,[-1,-1])}}function Tb(e){let t,n,i,r,s,o,a,l,f,h,v;return{c(){t=p("div"),n=p("div"),i=p("h3"),i.textContent="Active Filter",r=m(),s=p("button"),s.textContent="🧹 Sweep",o=m(),a=p("div"),l=p("pre"),f=g(e[2]),b(i,"class","svelte-1tyqaa5"),b(s,"class","sweep-btn svelte-1tyqaa5"),b(s,"title","Clear filter"),b(n,"class","filter-display-header svelte-1tyqaa5"),b(l,"class","filter-json svelte-1tyqaa5"),b(a,"class","filter-json-container svelte-1tyqaa5"),b(t,"class","filter-display svelte-1tyqaa5")},m(d,p){u(d,t,p),c(t,n),c(n,i),c(n,r),c(n,s),c(t,o),c(t,a),c(a,l),c(l,f),h||(v=y(s,"click",e[3]),h=!0)},p(e,t){4&t&&k(f,e[2])},d(e){e&&d(t),h=!1,v()}}}function Ub(t){let n,i=t[0]&&t[1]&&Tb(t);return{c(){i&&i.c(),n=v()},m(e,t){i&&i.m(e,t),u(e,n,t)},p(e,[t]){e[0]&&e[1]?i?i.p(e,t):(i=Tb(e),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},i:e,o:e,d(e){i&&i.d(e),e&&d(n)}}}function _b(e,t,n){let i,r;const s=P();let{filter:o={}}=t,{showFilter:a=!0}=t;return e.$$set=e=>{"filter"in e&&n(4,o=e.filter),"showFilter"in e&&n(0,a=e.showFilter)},e.$$.update=()=>{16&e.$$.dirty&&n(2,i=function(e){return JSON.stringify(e,null,2)}(o)),16&e.$$.dirty&&n(1,r=Object.keys(o).length>0)},[a,r,i,function(){s("sweep")},o]}class Nb extends se{constructor(e){super(),re(this,e,_b,Ub,s,{filter:4,showFilter:0})}}class Lb{constructor(e,t,n){this.relayUrl=e,this.userSigner=t,this.userPubkey=n,this.ws=null,this.challenge=null,this.isAuthenticated=!1,this.authPromise=null}async connect(){return new Promise((e,t)=>{this.ws=new WebSocket(this.relayUrl),this.ws.onopen=()=>{console.log("WebSocket connected to relay:",this.relayUrl),e()},this.ws.onmessage=async e=>{try{const t=JSON.parse(e.data);await this.handleMessage(t)}catch(e){console.error("Error parsing relay message:",e)}},this.ws.onerror=e=>{console.error("WebSocket error:",e),t(new Error("Failed to connect to relay"))},this.ws.onclose=()=>{console.log("WebSocket connection closed"),this.isAuthenticated=!1,this.challenge=null},setTimeout(()=>{this.ws.readyState!==WebSocket.OPEN&&t(new Error("Connection timeout"))},1e4)})}async handleMessage(e){const[t,...n]=e;switch(t){case"AUTH":this.challenge=n[0],console.log("Received AUTH challenge:",this.challenge),await this.authenticate();break;case"OK":const[e,i,r]=n;e&&i?(console.log("Authentication successful for event:",e),this.isAuthenticated=!0,this.authPromise&&(this.authPromise.resolve(),this.authPromise=null)):e&&!i&&(console.error("Authentication failed:",r),this.authPromise&&(this.authPromise.reject(new Error(r||"Authentication failed")),this.authPromise=null));break;case"NOTICE":console.log("Relay notice:",n[0]);break;default:console.log("Unhandled message type:",t,n)}}async authenticate(){if(!this.challenge)throw new Error("No challenge received from relay");if(!this.userSigner)throw new Error("No signer available for authentication");try{const e={kind:22242,created_at:Math.floor(Date.now()/1e3),tags:[["relay",this.relayUrl],["challenge",this.challenge]],content:"",pubkey:this.userPubkey},t=["AUTH",await this.userSigner.signEvent(e)];return this.ws.send(JSON.stringify(t)),console.log("Sent authentication event to relay"),new Promise((e,t)=>{this.authPromise={resolve:e,reject:t},setTimeout(()=>{this.authPromise&&(this.authPromise.reject(new Error("Authentication timeout")),this.authPromise=null)},1e4)})}catch(e){throw console.error("Authentication error:",e),e}}async publishEvent(e){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");return new Promise((t,n)=>{const i=["EVENT",e];this.ws.send(JSON.stringify(i));const r=this.ws.onmessage,s=setTimeout(()=>{this.ws.onmessage=r,n(new Error("Publish timeout"))},15e3);this.ws.onmessage=async i=>{try{const o=JSON.parse(i.data),[a,l,c,u]=o;if("OK"===a&&l===e.id)if(c)clearTimeout(s),this.ws.onmessage=r,console.log("Event published successfully:",l),t({success:!0,eventId:l,reason:u});else{if(console.error("Event publish failed:",u),u&&u.includes("auth-required"))return void console.log("Authentication required, waiting for AUTH challenge...");clearTimeout(s),this.ws.onmessage=r,n(new Error(`Publish failed: ${u}`))}else if("AUTH"===a){this.challenge=o[1],console.log("Received AUTH challenge during publish:",this.challenge);try{await this.authenticate(),console.log("Authentication successful, retrying event publish...");const t=["EVENT",e];this.ws.send(JSON.stringify(t))}catch(e){clearTimeout(s),this.ws.onmessage=r,n(new Error(`Authentication failed: ${e.message}`))}}else await this.handleMessage(o)}catch(e){clearTimeout(s),this.ws.onmessage=r,n(e)}}})}close(){this.ws&&(this.ws.close(),this.ws=null),this.isAuthenticated=!1,this.challenge=null}getAuthenticated(){return this.isAuthenticated}}async function Ob(e,t,n,i){const r=new Lb(e,n,i);try{await r.connect();return await r.publishEvent(t)}finally{r.close()}}function Mb(e,t,n){const i=e.slice();return i[171]=t[n],i}function jb(e,t,n){const i=e.slice();return i[181]=t[n],i}function Hb(e,t,n){const i=e.slice();return i[174]=t[n],i}function Gb(e,t,n){const i=e.slice();i[174]=t[n];const r=i[52](i[174]);return i[175]=r,i}function Jb(e,t,n){const i=e.slice();return i[178]=t[n],i}function Kb(t){let n;function i(e,t){return e[1]?aA:oA}let r=i(t),s=r(t);return{c(){n=p("div"),s.c(),b(n,"class","welcome-message svelte-u3u5mw")},m(e,t){u(e,n,t),s.m(n,null)},p(e,t){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n,null)))},i:e,o:e,d(e){e&&d(n),s.d()}}}function Vb(e){let t,n,i=e[6],r=[];for(let t=0;tZ(r[e],1,1,()=>{r[e]=null});return{c(){for(let e=0;e=0||""!==t[36]&&parseInt(t[36])>=0,P=pp,R=[];for(let e=0;eEvent Recovery \n

    Search and recover old versions of replaceable events

    ',s=m(),o=p("div"),a=p("div"),l=p("div"),h=p("label"),h.textContent="Select Event Kind:",g=m(),v=p("select"),w=p("option"),w.textContent="Choose a replaceable kind...";for(let e=0;et[116].call(v)),b(l,"class","kind-selector svelte-u3u5mw"),b(x,"for","custom-kind"),b(x,"class","svelte-u3u5mw"),b(B,"id","custom-kind"),b(B,"type","number"),b(B,"placeholder","e.g., 10001"),b(B,"min","0"),b(B,"class","svelte-u3u5mw"),b(C,"class","custom-kind-input svelte-u3u5mw"),b(a,"class","recovery-controls svelte-u3u5mw"),b(o,"class","recovery-controls-card svelte-u3u5mw"),b(n,"class","recovery-tab svelte-u3u5mw")},m(e,i){u(e,n,i),c(n,r),c(n,s),c(n,o),c(o,a),c(a,l),c(l,h),c(l,g),c(l,v),c(v,w);for(let e=0;e=0||""!==e[36]&&parseInt(e[36])>=0),$?T?T.p(e,t):(T=yA(e),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},i:e,o:e,d(e){e&&d(n),f(R,e),T&&T.d(),F=!1,i(D)}}}function Yb(e){let t,n;return t=new ob({props:{isLoggedIn:e[1],userRole:e[4],userSigner:e[13]}}),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),16&n[0]&&(i.userRole=e[4]),8192&n[0]&&(i.userSigner=e[13]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function Wb(e){let t,n;return t=new Rb({props:{isLoggedIn:e[1],userRole:e[4],userSigner:e[13],userPubkey:e[2]}}),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),16&n[0]&&(i.userRole=e[4]),8192&n[0]&&(i.userSigner=e[13]),4&n[0]&&(i.userPubkey=e[2]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function zb(e){let t,n,i;function r(t){e[115](t)}let s={isLoggedIn:e[1],userRole:e[4],isPolicyAdmin:JA,policyEnabled:e[8],isLoadingPolicy:e[27],policyMessage:e[28],policyMessageType:e[29],validationErrors:e[30],policyFollows:e[31]};return void 0!==e[26]&&(s.policyJson=e[26]),t=new Zv({props:s}),U.push(()=>X(t,"policyJson",r)),t.$on("loadPolicy",e[60]),t.$on("validatePolicy",e[61]),t.$on("savePolicy",e[62]),t.$on("formatJson",e[63]),t.$on("addPolicyAdmin",e[64]),t.$on("removePolicyAdmin",e[65]),t.$on("refreshFollows",e[66]),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,n){te(t,e,n),i=!0},p(e,i){const r={};2&i[0]&&(r.isLoggedIn=e[1]),16&i[0]&&(r.userRole=e[4]),256&i[0]&&(r.policyEnabled=e[8]),134217728&i[0]&&(r.isLoadingPolicy=e[27]),268435456&i[0]&&(r.policyMessage=e[28]),536870912&i[0]&&(r.policyMessageType=e[29]),1073741824&i[0]&&(r.validationErrors=e[30]),1&i[1]&&(r.policyFollows=e[31]),!n&&67108864&i[0]&&(n=!0,r.policyJson=e[26],j(()=>n=!1)),t.$set(r)},i(e){i||(z(t.$$.fragment,e),i=!0)},o(e){Z(t.$$.fragment,e),i=!1},d(e){ne(t,e)}}}function Zb(e){let t,n,i;function r(t){e[112](t)}let s={isLoggedIn:e[1],userRole:e[4],sprocketStatus:e[20],isLoadingSprocket:e[22],sprocketUploadFile:e[25],sprocketMessage:e[23],sprocketMessageType:e[24],sprocketVersions:e[21]};return void 0!==e[19]&&(s.sprocketScript=e[19]),t=new Pv({props:s}),U.push(()=>X(t,"sprocketScript",r)),t.$on("restartSprocket",e[55]),t.$on("deleteSprocket",e[56]),t.$on("sprocketFileSelect",e[67]),t.$on("uploadSprocketScript",e[68]),t.$on("saveSprocket",e[54]),t.$on("loadSprocket",e[53]),t.$on("loadVersions",e[57]),t.$on("loadVersion",e[113]),t.$on("deleteVersion",e[114]),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,n){te(t,e,n),i=!0},p(e,i){const r={};2&i[0]&&(r.isLoggedIn=e[1]),16&i[0]&&(r.userRole=e[4]),1048576&i[0]&&(r.sprocketStatus=e[20]),4194304&i[0]&&(r.isLoadingSprocket=e[22]),33554432&i[0]&&(r.sprocketUploadFile=e[25]),8388608&i[0]&&(r.sprocketMessage=e[23]),16777216&i[0]&&(r.sprocketMessageType=e[24]),2097152&i[0]&&(r.sprocketVersions=e[21]),!n&&524288&i[0]&&(n=!0,r.sprocketScript=e[19],j(()=>n=!1)),t.$set(r)},i(e){i||(z(t.$$.fragment,e),i=!0)},o(e){Z(t.$$.fragment,e),i=!1},d(e){ne(t,e)}}}function Xb(e){let t,n,i,r;const s=[QA,BA,SA],o=[];function a(e,t){return"curating"!==e[9]?0:e[1]&&"owner"===e[4]?1:2}return n=a(e),i=o[n]=s[n](e),{c(){t=p("div"),i.c(),b(t,"class","curation-view-container")},m(e,i){u(e,t,i),o[n].m(t,null),r=!0},p(e,r){let l=n;n=a(e),n===l?o[n].p(e,r):(Y(),Z(o[l],1,1,()=>{o[l]=null}),W(),i=o[n],i?i.p(e,r):(i=o[n]=s[n](e),i.c()),z(i,1),i.m(t,null))},i(e){r||(z(i),r=!0)},o(e){Z(i),r=!1},d(e){e&&d(t),o[n].d()}}}function eA(e){let t,n,i,r;const s=[$A,DA,FA],o=[];function a(e,t){return"managed"!==e[9]?0:e[1]&&"owner"===e[4]?1:2}return n=a(e),i=o[n]=s[n](e),{c(){t=p("div"),i.c(),b(t,"class","managed-acl-view svelte-u3u5mw")},m(e,i){u(e,t,i),o[n].m(t,null),r=!0},p(e,r){let l=n;n=a(e),n===l?o[n].p(e,r):(Y(),Z(o[l],1,1,()=>{o[l]=null}),W(),i=o[n],i?i.p(e,r):(i=o[n]=s[n](e),i.c()),z(i,1),i.m(t,null))},i(e){r||(z(i),r=!0)},o(e){Z(i),r=!1},d(e){e&&d(t),o[n].d()}}}function tA(e){let t,n,i;function r(t){e[111](t)}let s={userPubkey:e[2],userRole:e[4],policyEnabled:e[8],publishError:e[34]};return void 0!==e[33]&&(s.composeEventJson=e[33]),t=new Av({props:s}),U.push(()=>X(t,"composeEventJson",r)),t.$on("reformatJson",e[90]),t.$on("signEvent",e[91]),t.$on("publishEvent",e[92]),t.$on("clearError",e[93]),{c(){ee(t.$$.fragment)},m(e,n){te(t,e,n),i=!0},p(e,i){const r={};4&i[0]&&(r.userPubkey=e[2]),16&i[0]&&(r.userRole=e[4]),256&i[0]&&(r.policyEnabled=e[8]),8&i[1]&&(r.publishError=e[34]),!n&&4&i[1]&&(n=!0,r.composeEventJson=e[33],j(()=>n=!1)),t.$set(r)},i(e){i||(z(t.$$.fragment,e),i=!0)},o(e){Z(t.$$.fragment,e),i=!1},d(e){ne(t,e)}}}function nA(e){let t,n;return t=new Ow({props:{isLoggedIn:e[1],userPubkey:e[2],userSigner:e[13],currentEffectiveRole:e[10]}}),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),4&n[0]&&(i.userPubkey=e[2]),8192&n[0]&&(i.userSigner=e[13]),1024&n[0]&&(i.currentEffectiveRole=e[10]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function iA(e){let t,n;return t=new tv({props:{isLoggedIn:e[1],userRole:e[4],userPubkey:e[2],filteredEvents:e[41],expandedEvents:e[18],isLoadingEvents:e[7],showOnlyMyEvents:GA,showFilterBuilder:e[15]}}),t.$on("scroll",e[89]),t.$on("toggleEventExpansion",e[107]),t.$on("deleteEvent",e[108]),t.$on("copyEventToClipboard",e[109]),t.$on("toggleChange",e[45]),t.$on("loadAllEvents",e[110]),t.$on("toggleFilterBuilder",e[76]),t.$on("filterApply",e[77]),t.$on("filterClear",e[78]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),16&n[0]&&(i.userRole=e[4]),4&n[0]&&(i.userPubkey=e[2]),1024&n[1]&&(i.filteredEvents=e[41]),262144&n[0]&&(i.expandedEvents=e[18]),128&n[0]&&(i.isLoadingEvents=e[7]),32768&n[0]&&(i.showFilterBuilder=e[15]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function rA(e){let t,n;return t=new tm({props:{isLoggedIn:e[1],currentEffectiveRole:e[10],selectedFile:e[16],aclMode:e[9],importMessage:e[17]}}),t.$on("fileSelect",e[86]),t.$on("importEvents",e[87]),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),1024&n[0]&&(i.currentEffectiveRole=e[10]),65536&n[0]&&(i.selectedFile=e[16]),512&n[0]&&(i.aclMode=e[9]),131072&n[0]&&(i.importMessage=e[17]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function sA(e){let t,n;return t=new qg({props:{isLoggedIn:e[1],currentEffectiveRole:e[10],aclMode:e[9]}}),t.$on("exportMyEvents",e[85]),t.$on("exportAllEvents",e[84]),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),1024&n[0]&&(i.currentEffectiveRole=e[10]),512&n[0]&&(i.aclMode=e[9]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function oA(t){let n;return{c(){n=p("p"),n.textContent="Log in to access your user dashboard",b(n,"class","svelte-u3u5mw")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function aA(e){let t,n,i,r=(e[3]?.name||e[2].slice(0,8)+"...")+"";return{c(){t=p("p"),n=g("Welcome "),i=g(r),b(t,"class","svelte-u3u5mw")},m(e,r){u(e,t,r),c(t,n),c(t,i)},p(e,t){12&t[0]&&r!==(r=(e[3]?.name||e[2].slice(0,8)+"...")+"")&&k(i,r)},d(e){e&&d(t)}}}function lA(e){let t,n,r,s,o,a,l,f,h,v,w,A,I,C,E,x,S,B,Q,F,D,$=e[181].label+"",P=e[42].get(e[181].id)?.isLoading,R=!e[42].get(e[181].id)?.hasMore&&e[42].get(e[181].id)?.events?.length>0;function T(){return e[121](e[181])}function U(e,t){return 64&t[0]&&(C=null),64&t[0]&&(E=null),null==C&&(C=!!(e[42].get(e[181].id)?.events?.length>0)),C?uA:(null==E&&(E=!e[42].get(e[181].id)?.isLoading),E?cA:void 0)}w=new Nb({props:{filter:e[42].get(e[181].id)?.filter||{}}}),w.$on("sweep",function(){return e[122](e[181])});let _=U(e,[-1,-1,-1,-1,-1,-1]),N=_&&_(e),L=P&&hA(),O=R&&gA();function M(...t){return e[127](e[181],...t)}return{c(){t=p("div"),n=p("div"),r=p("h2"),s=g("🔍 "),o=g($),a=m(),l=p("button"),f=g("🔄 Refresh"),v=m(),ee(w.$$.fragment),A=m(),I=p("div"),N&&N.c(),x=m(),L&&L.c(),S=m(),O&&O.c(),B=m(),b(r,"class","svelte-u3u5mw"),b(l,"class","refresh-btn svelte-u3u5mw"),l.disabled=h=e[42].get(e[181].id)?.isLoading,b(n,"class","search-results-header svelte-u3u5mw"),b(I,"class","search-results-content svelte-u3u5mw"),b(t,"class","search-results-view svelte-u3u5mw")},m(e,i){u(e,t,i),c(t,n),c(n,r),c(r,s),c(r,o),c(n,a),c(n,l),c(l,f),c(t,v),te(w,t,null),c(t,A),c(t,I),N&&N.m(I,null),c(I,x),L&&L.m(I,null),c(I,S),O&&O.m(I,null),c(t,B),Q=!0,F||(D=[y(l,"click",T),y(I,"scroll",M)],F=!0)},p(t,n){e=t,(!Q||64&n[0])&&$!==($=e[181].label+"")&&k(o,$),(!Q||64&n[0]&&h!==(h=e[42].get(e[181].id)?.isLoading))&&(l.disabled=h);const i={};64&n[0]&&(i.filter=e[42].get(e[181].id)?.filter||{}),w.$set(i),_===(_=U(e,n))&&N?N.p(e,n):(N&&N.d(1),N=_&&_(e),N&&(N.c(),N.m(I,x))),64&n[0]&&(P=e[42].get(e[181].id)?.isLoading),P?L||(L=hA(),L.c(),L.m(I,S)):L&&(L.d(1),L=null),64&n[0]&&(R=!e[42].get(e[181].id)?.hasMore&&e[42].get(e[181].id)?.events?.length>0),R?O||(O=gA(),O.c(),O.m(I,null)):O&&(O.d(1),O=null)},i(e){Q||(z(w.$$.fragment,e),Q=!0)},o(e){Z(w.$$.fragment,e),Q=!1},d(e){e&&d(t),ne(w),N&&N.d(),L&&L.d(),O&&O.d(),F=!1,i(D)}}}function cA(t){let n;return{c(){n=p("div"),n.innerHTML='

    No search results found.

    ',b(n,"class","no-search-results svelte-u3u5mw")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function uA(e){let t,n=e[42].get(e[181].id).events,i=[];for(let t=0;t👤',s=m(),o=p("div"),a=p("div"),l=g(N),f=m(),h=p("div"),v=p("span"),w=g(L),A=m(),I=p("span"),C=g(O),E=m(),x=p("div"),B=p("div"),Q=g(M),F=m(),D=p("div"),$=g(j),P=m(),G&&G.c(),R=m(),V&&V.c(),T=m(),b(r,"class","search-result-avatar svelte-u3u5mw"),b(a,"class","search-result-author svelte-u3u5mw"),b(v,"class","kind-number svelte-u3u5mw"),b(I,"class","kind-name svelte-u3u5mw"),b(h,"class","search-result-kind svelte-u3u5mw"),b(o,"class","search-result-info svelte-u3u5mw"),b(B,"class","event-timestamp svelte-u3u5mw"),b(D,"class","event-content-single-line svelte-u3u5mw"),b(x,"class","search-result-content svelte-u3u5mw"),b(n,"class","search-result-row svelte-u3u5mw"),b(n,"role","button"),b(n,"tabindex","0"),b(t,"class","search-result-item svelte-u3u5mw"),S(t,"expanded",e[18].has(e[174].id))},m(e,i){u(e,t,i),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),c(a,l),c(o,f),c(o,h),c(h,v),c(v,w),c(h,A),c(h,I),c(I,C),c(n,E),c(n,x),c(x,B),c(B,Q),c(x,F),c(x,D),c(D,$),c(n,P),G&&G.m(n,null),c(t,R),V&&V.m(t,null),c(t,T),U||(_=[y(n,"click",J),y(n,"keydown",K)],U=!0)},p(i,r){e=i,64&r[0]&&N!==(N=ub(e[174].pubkey)+"")&&k(l,N),64&r[0]&&L!==(L=e[174].kind+"")&&k(w,L),64&r[0]&&O!==(O=cb(e[174].kind)+"")&&k(C,O),64&r[0]&&M!==(M=fb(e[174].created_at)+"")&&k(Q,M),64&r[0]&&j!==(j=db(e[174].content)+"")&&k($,j),5!==e[174].kind&&("admin"===e[4]||"owner"===e[4]||"write"===e[4]&&e[174].pubkey&&e[174].pubkey===e[2])?G?G.p(e,r):(G=dA(e),G.c(),G.m(n,null)):G&&(G.d(1),G=null),262208&r[0]&&(H=e[18].has(e[174].id)),H?V?V.p(e,r):(V=fA(e),V.c(),V.m(t,T)):V&&(V.d(1),V=null),262208&r[0]|2048&r[1]&&S(t,"expanded",e[18].has(e[174].id))},d(e){e&&d(t),G&&G.d(),V&&V.d(),U=!1,i(_)}}}function hA(e){let t;return{c(){t=p("div"),t.innerHTML='
    \n

    Searching...

    ',b(t,"class","loading-search-results svelte-u3u5mw")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function gA(e){let t;return{c(){t=p("div"),t.innerHTML='

    No more search results to load.

    ',b(t,"class","end-of-search-results svelte-u3u5mw")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function mA(e){let t,n,i=e[181].id===e[5]&&lA(e);return{c(){i&&i.c(),t=v()},m(e,r){i&&i.m(e,r),u(e,t,r),n=!0},p(e,n){e[181].id===e[5]?i?(i.p(e,n),96&n[0]&&z(i,1)):(i=lA(e),i.c(),z(i,1),i.m(t.parentNode,t)):i&&(Y(),Z(i,1,1,()=>{i=null}),W())},i(e){n||(z(i),n=!0)},o(e){Z(i),n=!1},d(e){i&&i.d(e),e&&d(t)}}}function vA(t){let n,i,r=t[178].label+"";return{c(){n=p("option"),i=g(r),n.__value=t[178].value,n.value=n.__value},m(e,t){u(e,n,t),c(n,i)},p:e,d(e){e&&d(n)}}}function yA(e){let t;function n(e,t){return e[38]?AA:0===e[37].length?bA:wA}let i=n(e),r=i(e);return{c(){t=p("div"),r.c(),b(t,"class","recovery-results svelte-u3u5mw")},m(e,n){u(e,t,n),r.m(t,null)},p(e,s){i===(i=n(e))&&r?r.p(e,s):(r.d(1),r=i(e),r&&(r.c(),r.m(t,null)))},d(e){e&&d(t),r.d()}}}function wA(e){let t,n,i,r=e[37],s=[];for(let t=0;tORLY_ACL_MODE=curating in your\n environment variables and restart the relay.',b(i,"class","svelte-u3u5mw"),b(s,"class","svelte-u3u5mw"),b(a,"class","svelte-u3u5mw"),b(y,"class","svelte-u3u5mw"),b(n,"class","acl-mode-warning svelte-u3u5mw")},m(e,t){u(e,n,t),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),c(a,l),c(a,f),c(f,h),c(n,v),c(n,y)},p(e,t){512&t[0]&&w!==(w=(e[9]||"unknown")+"")&&k(h,w)},i:e,o:e,d(e){e&&d(n)}}}function FA(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in with owner permissions to access\n managed ACL configuration.",r=m(),s=p("button"),s.textContent="Log In",b(s,"class","login-btn svelte-u3u5mw"),b(n,"class","access-denied")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[70]),o=!0)},p:e,i:e,o:e,d(e){e&&d(n),o=!1,a()}}}function DA(e){let t,n;return t=new xg({props:{userSigner:e[13],userPubkey:e[2]}}),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};8192&n[0]&&(i.userSigner=e[13]),4&n[0]&&(i.userPubkey=e[2]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function $A(t){let n,i,r,s,o,a,l,f,h,v,y,w=(t[9]||"unknown")+"";return{c(){n=p("div"),i=p("h3"),i.textContent="⚠️ Managed ACL Mode Not Active",r=m(),s=p("p"),s.textContent='To use the Managed ACL interface, you need to set\n the ACL mode to "managed" in your relay\n configuration.',o=m(),a=p("p"),l=g("Current ACL mode: "),f=p("strong"),h=g(w),v=m(),y=p("p"),y.innerHTML='Please set ORLY_ACL_MODE=managed in your\n environment variables and restart the relay.',b(i,"class","svelte-u3u5mw"),b(s,"class","svelte-u3u5mw"),b(a,"class","svelte-u3u5mw"),b(y,"class","svelte-u3u5mw"),b(n,"class","acl-mode-warning svelte-u3u5mw")},m(e,t){u(e,n,t),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),c(a,l),c(a,f),c(f,h),c(n,v),c(n,y)},p(e,t){512&t[0]&&w!==(w=(e[9]||"unknown")+"")&&k(h,w)},i:e,o:e,d(e){e&&d(n)}}}function PA(e){let t,n,r,s,o,a,l,f,h,g;function v(e,t){return e[3]?TA:e[1]&&e[2]?RA:void 0}let A=v(e),k=A&&A(e);return{c(){t=p("div"),n=p("div"),r=p("div"),s=p("h2"),s.textContent="Settings",o=m(),a=p("button"),a.textContent="✕",l=m(),f=p("div"),k&&k.c(),b(s,"class","svelte-u3u5mw"),b(a,"class","close-btn svelte-u3u5mw"),b(r,"class","drawer-header svelte-u3u5mw"),b(f,"class","drawer-content"),b(n,"class","settings-drawer svelte-u3u5mw"),S(n,"dark-theme",e[0]),b(t,"class","drawer-overlay svelte-u3u5mw"),b(t,"role","button"),b(t,"tabindex","0")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(r,s),c(r,o),c(r,a),c(n,l),c(n,f),k&&k.m(f,null),h||(g=[y(a,"click",e[75]),y(n,"click",w(e[102])),y(n,"keydown",w(e[103])),y(t,"click",e[75]),y(t,"keydown",e[129])],h=!0)},p(e,t){A===(A=v(e))&&k?k.p(e,t):(k&&k.d(1),k=A&&A(e),k&&(k.c(),k.m(f,null))),1&t[0]&&S(n,"dark-theme",e[0])},d(e){e&&d(t),k&&k.d(),h=!1,i(g)}}}function RA(e){let t,n,r,s,o,a,l,f,h,v,w,A,I,C,E,x,S,B=e[2].slice(0,16)+"",Q=e[2].slice(-8)+"";return{c(){t=p("div"),n=p("button"),n.textContent="Log out",r=m(),s=p("h3"),s.textContent="Profile Loading",o=m(),a=p("p"),a.textContent="Your profile metadata is being loaded...",l=m(),f=p("button"),f.textContent="Retry Loading Profile",h=m(),v=p("div"),w=p("strong"),w.textContent="Public Key:",A=m(),I=g(B),C=g("..."),E=g(Q),b(n,"class","logout-btn floating svelte-u3u5mw"),b(s,"class","svelte-u3u5mw"),b(a,"class","svelte-u3u5mw"),b(f,"class","retry-profile-btn svelte-u3u5mw"),b(v,"class","user-pubkey-display svelte-u3u5mw"),b(t,"class","profile-loading-section svelte-u3u5mw")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(t,o),c(t,a),c(t,l),c(t,f),c(t,h),c(t,v),c(v,w),c(v,A),c(v,I),c(v,C),c(v,E),x||(S=[y(n,"click",e[72]),y(f,"click",e[83])],x=!0)},p(e,t){4&t[0]&&B!==(B=e[2].slice(0,16)+"")&&k(I,B),4&t[0]&&Q!==(Q=e[2].slice(-8)+"")&&k(E,Q)},d(e){e&&d(t),x=!1,i(S)}}}function TA(e){let t,n,i,r,s,o,a,l,f,h,w,A,I,C,E,x=(e[3].name||"Unknown User")+"",S=e[3].banner&&UA(e);function B(e,t){return e[3].picture?NA:_A}let Q=B(e),F=Q(e),D=e[3].nip05&&LA(e),$=e[3].about&&OA(e),P=e[4]&&"read"!==e[4]&&MA(e);return{c(){t=p("div"),n=p("div"),S&&S.c(),i=m(),r=p("button"),r.textContent="Log out",s=m(),F.c(),o=m(),a=p("div"),l=p("h3"),f=g(x),h=m(),D&&D.c(),w=m(),$&&$.c(),A=m(),P&&P.c(),I=v(),b(r,"class","logout-btn floating svelte-u3u5mw"),b(l,"class","profile-username svelte-u3u5mw"),b(a,"class","name-row svelte-u3u5mw"),b(n,"class","profile-hero svelte-u3u5mw"),b(t,"class","profile-section svelte-u3u5mw")},m(d,p){u(d,t,p),c(t,n),S&&S.m(n,null),c(n,i),c(n,r),c(n,s),F.m(n,null),c(n,o),c(n,a),c(a,l),c(l,f),c(a,h),D&&D.m(a,null),c(t,w),$&&$.m(t,null),u(d,A,p),P&&P.m(d,p),u(d,I,p),C||(E=y(r,"click",e[72]),C=!0)},p(e,r){e[3].banner?S?S.p(e,r):(S=UA(e),S.c(),S.m(n,i)):S&&(S.d(1),S=null),Q===(Q=B(e))&&F?F.p(e,r):(F.d(1),F=Q(e),F&&(F.c(),F.m(n,o))),8&r[0]&&x!==(x=(e[3].name||"Unknown User")+"")&&k(f,x),e[3].nip05?D?D.p(e,r):(D=LA(e),D.c(),D.m(a,null)):D&&(D.d(1),D=null),e[3].about?$?$.p(e,r):($=OA(e),$.c(),$.m(t,null)):$&&($.d(1),$=null),e[4]&&"read"!==e[4]?P?P.p(e,r):(P=MA(e),P.c(),P.m(I.parentNode,I)):P&&(P.d(1),P=null)},d(e){e&&d(t),S&&S.d(),F.d(),D&&D.d(),$&&$.d(),e&&d(A),P&&P.d(e),e&&d(I),C=!1,E()}}}function UA(e){let t,n;return{c(){t=p("img"),a(t.src,n=e[3].banner)||b(t,"src",n),b(t,"alt","Profile banner"),b(t,"class","profile-banner svelte-u3u5mw")},m(e,n){u(e,t,n)},p(e,i){8&i[0]&&!a(t.src,n=e[3].banner)&&b(t,"src",n)},d(e){e&&d(t)}}}function _A(t){let n;return{c(){n=p("div"),n.textContent="👤",b(n,"class","profile-avatar-placeholder overlap svelte-u3u5mw")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function NA(e){let t,n;return{c(){t=p("img"),a(t.src,n=e[3].picture)||b(t,"src",n),b(t,"alt","User avatar"),b(t,"class","profile-avatar overlap svelte-u3u5mw")},m(e,n){u(e,t,n)},p(e,i){8&i[0]&&!a(t.src,n=e[3].picture)&&b(t,"src",n)},d(e){e&&d(t)}}}function LA(e){let t,n,i=e[3].nip05+"";return{c(){t=p("span"),n=g(i),b(t,"class","profile-nip05-inline svelte-u3u5mw")},m(e,i){u(e,t,i),c(t,n)},p(e,t){8&t[0]&&i!==(i=e[3].nip05+"")&&k(n,i)},d(e){e&&d(t)}}}function OA(e){let t,n;return{c(){t=p("div"),n=p("p"),b(n,"class","profile-about svelte-u3u5mw"),b(t,"class","about-card svelte-u3u5mw")},m(i,r){u(i,t,r),c(t,n),n.innerHTML=e[40]},p(e,t){512&t[1]&&(n.innerHTML=e[40])},d(e){e&&d(t)}}}function MA(e){let t,n,i,r,s,o,a=e[95](),l=[];for(let t=0;tX(v,"showModal",E)),v.$on("login",e[71]),v.$on("close",e[73]),{c(){ee(t.$$.fragment),n=m(),i=p("div"),ee(r.$$.fragment),s=m(),o=p("main"),f.c(),h=m(),C&&C.c(),g=m(),ee(v.$$.fragment),b(o,"class","main-content svelte-u3u5mw"),b(i,"class","app-container svelte-u3u5mw"),S(i,"dark-theme",e[0])},m(e,a){te(t,e,a),u(e,n,a),u(e,i,a),te(r,i,null),c(i,s),c(i,o),k[l].m(o,null),u(e,h,a),C&&C.m(e,a),u(e,g,a),te(v,e,a),w=!0},p(e,n){const s={};1&n[0]&&(s.isDarkTheme=e[0]),2&n[0]&&(s.isLoggedIn=e[1]),16&n[0]&&(s.userRole=e[4]),1024&n[0]&&(s.currentEffectiveRole=e[10]),8&n[0]&&(s.userProfile=e[3]),4&n[0]&&(s.userPubkey=e[2]),t.$set(s);const a={};1&n[0]&&(a.isDarkTheme=e[0]),2048&n[0]&&(a.tabs=e[11]),32&n[0]&&(a.selectedTab=e[5]),2&n[1]&&(a.version=e[32]),r.$set(a);let c=l;l=I(e,n),l===c?k[l].p(e,n):(Y(),Z(k[c],1,1,()=>{k[c]=null}),W(),f=k[l],f?f.p(e,n):(f=k[l]=A[l](e),f.c()),z(f,1),f.m(o,null)),(!w||1&n[0])&&S(i,"dark-theme",e[0]),e[14]?C?C.p(e,n):(C=PA(e),C.c(),C.m(g.parentNode,g)):C&&(C.d(1),C=null);const u={};1&n[0]&&(u.isDarkTheme=e[0]),!y&&4096&n[0]&&(y=!0,u.showModal=e[12],j(()=>y=!1)),v.$set(u)},i(e){w||(z(t.$$.fragment,e),z(r.$$.fragment,e),z(f),z(v.$$.fragment,e),w=!0)},o(e){Z(t.$$.fragment,e),Z(r.$$.fragment,e),Z(f),Z(v.$$.fragment,e),w=!1},d(e){ne(t,e),e&&d(n),e&&d(i),ne(r),k[l].d(),e&&d(h),C&&C.d(e),e&&d(g),ne(v,e)}}}let GA=!1,JA=!1;function KA(e,t,n){let i,r,s,o,a;"undefined"!=typeof window&&(window.debugIndexedDB=Rp);let l=!1,c=!1,u=!1,d="",f="",p=null,h="",g=null,m=!1,v=localStorage.getItem("selectedTab")||"export",y=!1,w={},b=[],k=[],I=null,C="",E=new Set,S=!1,B=!0,Q=null,F="",D=new Map,$=[],P=0,T=[],U=!0,_=null,N="",L=null,O=[],M=!1,j="",H="info",G=!1,J=null,K="",V=!1,q=!1,Y="",W="info",z=[],Z=[],X=!1,ee="",te="",ne="",ie="",re=null,se="",oe=[],ae=!1,le=!0,ce=null;function ue(e){E.has(e)?E.delete(e):E.add(e),n(18,E)}async function de(e,t){const n=JSON.stringify(e),i=await pb(n);hb(t.target.closest(".copy-json-btn"),i),i||alert("Failed to copy to clipboard. Please copy manually.")}async function fe(e){if(!u)return void alert("Please log in first");const t=k.find(t=>t.id===e);if(!t)return void alert("Event not found");if("admin"===h||"owner"===h||"write"===h&&t.pubkey&&t.pubkey===d){if(confirm("Are you sure you want to delete this event?"))try{if(!g)throw new Error("Signer not available for signing");const i={kind:5,created_at:Math.floor(Date.now()/1e3),tags:[["e",e]],content:""};console.log("Created delete event template:",i),console.log("User pubkey:",d),console.log("Target event:",t),console.log("Target event pubkey:",t.pubkey);const r=await g.signEvent(i);console.log("Signed delete event:",r),console.log("Signed delete event pubkey:",r.pubkey),console.log("Delete event tags:",r.tags);const s=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`;try{const e=await Ob(s,r,g,d);e.success?console.log("Delete event published successfully to ORLY relay"):console.error("Failed to publish delete event:",e.reason)}catch(e){console.error("Error publishing delete event:",e)}const o=t.pubkey&&t.pubkey===d;if(o){const t=await vp.publish(r);if(console.log("Delete event published:",t),!(t.success&&t.okCount>0))throw new Error("No relays accepted the delete event");{await new Promise(e=>setTimeout(e,2e3));try{const n=await Fp(e,{timeout:5e3});n?(console.warn("Event still exists after deletion attempt:",n),alert(`Warning: Delete event was accepted by ${t.okCount} relay(s), but the event still exists on the relay. This may indicate the relay does not properly handle delete events.`)):console.log("Event successfully deleted and verified")}catch(e){console.log("Could not fetch event after deletion (likely deleted):",e.message)}try{const t=await Dp(e,{timeout:5e3});if(t.length>0){console.log(`Delete event verification: Found ${t.length} delete event(s) targeting ${e}`);const n=t.find(e=>e.pubkey&&e.pubkey===d);n?console.log("Our delete event found in database:",n.id):console.warn("Our delete event not found in database, but other delete events exist")}else console.warn("No delete events found in database for target event:",e)}catch(e){console.log("Could not verify delete event in database:",e.message)}n(96,k=k.filter(t=>t.id!==e)),T=T.filter(t=>t.id!==e),$=$.filter(t=>t.id!==e);for(const[t,n]of D)n.events&&(n.events=n.events.filter(t=>t.id!==e),D.set(t,n));me(),console.log("Reloading events to show delete event...");const i=GA&&u&&d?[d]:null;await Ue(!0,i),alert(`Event deleted successfully (accepted by ${t.okCount} relay(s))`)}}else{const t=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`,i=new mp;await i.connectToRelay(t);const s=await i.publish(r);if(console.log("Delete event published to local relay only:",s),!(s.success&&s.okCount>0))throw new Error("Local relay did not accept the delete event");{await new Promise(e=>setTimeout(e,2e3));try{const t=await Fp(e,{timeout:5e3});t?(console.warn("Event still exists after deletion attempt:",t),alert(`Warning: Delete event was accepted by ${s.okCount} relay(s), but the event still exists on the relay. This may indicate the relay does not properly handle delete events.`)):console.log("Event successfully deleted and verified")}catch(e){console.log("Could not fetch event after deletion (likely deleted):",e.message)}try{const t=await Dp(e,{timeout:5e3});if(t.length>0){console.log(`Delete event verification: Found ${t.length} delete event(s) targeting ${e}`);const n=t.find(e=>e.pubkey&&e.pubkey===d);n?console.log("Our delete event found in database:",n.id):console.warn("Our delete event not found in database, but other delete events exist")}else console.warn("No delete events found in database for target event:",e)}catch(e){console.log("Could not verify delete event in database:",e.message)}n(96,k=k.filter(t=>t.id!==e)),T=T.filter(t=>t.id!==e),$=$.filter(t=>t.id!==e);for(const[t,n]of D)n.events&&(n.events=n.events.filter(t=>t.id!==e),D.set(t,n));me(),console.log("Reloading events to show delete event...");const t=GA&&u&&d?[d]:null;await Ue(!0,t),alert("Event deleted successfully (local relay only - admin/owner deleting other user's event)")}}}catch(e){console.error("Failed to delete event:",e),alert("Failed to delete event: "+e.message)}}else alert("You do not have permission to delete this event")}async function pe(){const e=se?parseInt(se):re;if(null==e||isNaN(e))console.log("No valid kind to load, kindToUse:",e);else if(u){console.log("Loading recovery events for kind:",e,"user:",d),n(38,ae=!0);try{const t=[{kinds:[e],authors:[d],limit:100}];ce&&(t[0].until=ce),console.log("Recovery filters:",t);const i=await Pp(t,{timeout:3e4,cacheFirst:!0});console.log("Recovery events received:",i.length),console.log("Recovery events kinds:",i.map(e=>e.kind)),n(37,oe=ce?[...oe,...i]:i),i.length>0?(ce=Math.min(...i.map(e=>e.created_at)),n(39,le=100===i.length)):n(39,le=!1)}catch(e){console.error("Failed to load recovery events:",e)}finally{n(38,ae=!1)}}else console.log("Not logged in, cannot load recovery events")}async function he(e){if(confirm("Are you sure you want to repost this event?"))try{const t=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`;console.log("Reposting event to local relay:",t,e);const i={...e};if(i.created_at=Math.floor(Date.now()/1e3),i.id="",i.sig="",e.kind>=3e4&&e.kind<=39999){const t=e.tags.find(e=>"d"===e[0]);t&&(i.tags=i.tags.filter(e=>"d"!==e[0]),i.tags.push(t))}if(g){const e=await g.signEvent(i);console.log("Signed event for repost:",e);const r=await vp.publish(e,[t]);console.log("Repost publish result:",r),r.success&&r.okCount>0?(alert("Event reposted successfully!"),n(39,le=!1),await pe()):alert("Failed to repost event. Check console for details.")}else alert("No signer available. Please log in.")}catch(e){console.error("Error reposting event:",e),alert("Error reposting event: "+e.message)}}async function ge(e){if(confirm("Are you sure you want to repost this event to all your write relays?"))try{const t=await async function(){if(!d)return[];try{const e=await Ep([{kinds:[10002],authors:[d],limit:1}]);if(0===e.length)return console.log("No relay list event found for user"),[];const t=e[0];console.log("Found relay list event:",t);const n=[];for(const e of t.tags)if("r"===e[0]&&e.length>=2){const t=e[1],i=e.length>=3?e[2]:null;i&&"write"!==i||n.push(t)}return console.log("Found write relays:",n),n}catch(e){return console.error("Error fetching user write relays:",e),[]}}(),i=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`,r=[i,...t.filter(e=>e!==i)];1===r.length&&alert("No write relays found in your relay list. Only posting to local relay."),console.log("Reposting event to all relays:",r,e);const s={...e};if(s.created_at=Math.floor(Date.now()/1e3),s.id="",s.sig="",e.kind>=3e4&&e.kind<=39999){const t=e.tags.find(e=>"d"===e[0]);t&&(s.tags=s.tags.filter(e=>"d"!==e[0]),s.tags.push(t))}if(g){const e=await g.signEvent(s);console.log("Signed event for repost to all:",e);const t=await vp.publish(e,r);console.log("Repost to all publish result:",t),t.success&&t.okCount>0?(alert(`Event reposted successfully to ${r.length} relays!`),n(39,le=!1),await pe()):alert("Failed to repost event. Check console for details.")}else alert("No signer available. Please log in.")}catch(e){console.error("Error reposting event to all:",e),alert("Error reposting event to all: "+e.message)}}if("undefined"!=typeof window&&window.matchMedia){const e=window.matchMedia("(prefers-color-scheme: dark)");l=e.matches,e.addEventListener("change",e=>{n(0,l=e.matches)})}if("undefined"!=typeof localStorage){const e=localStorage.getItem("nostr_auth_method"),t=localStorage.getItem("nostr_pubkey");e&&t&&(u=!0,d=t,f=e,"extension"===e&&window.nostr&&(g=window.nostr),Pe(),Re()),function(){if("undefined"==typeof localStorage)return;try{const t=localStorage.getItem("app_state");if(t){const i=JSON.parse(t);i.selectedTab&&Ee.some(e=>e.id===i.selectedTab)&&n(5,v=i.selectedTab),i.expandedEvents&&n(18,E=new Set(i.expandedEvents)),i.globalEventsCache&&($=i.globalEventsCache),i.globalCacheTimestamp&&(P=i.globalCacheTimestamp),void 0!==i.hasMoreEvents&&(B=i.hasMoreEvents),i.oldestEventTimestamp&&(Q=i.oldestEventTimestamp),void 0!==i.hasMoreMyEvents&&(U=i.hasMoreMyEvents),i.oldestMyEventTimestamp&&(_=i.oldestMyEventTimestamp),$.length>0&&((e=P)&&Date.now()-et.created_at-e.created_at),P=Date.now(),me()}async function ye(){if(u&&"owner"===h&&G)try{n(22,M=!0);const e=await fetch("/api/sprocket/status",{method:"GET",headers:{Authorization:`Nostr ${await Oe("GET","/api/sprocket/status")}`,"Content-Type":"application/json"}});e.ok?n(20,L=await e.json()):ke("Failed to load sprocket status","error")}catch(e){ke(`Error loading sprocket status: ${e.message}`,"error")}finally{n(22,M=!1)}}async function we(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/versions",{method:"GET",headers:{Authorization:`Nostr ${await Oe("GET","/api/sprocket/versions")}`,"Content-Type":"application/json"}});e.ok?n(21,O=await e.json()):ke("Failed to load versions","error")}catch(e){ke(`Error loading versions: ${e.message}`,"error")}finally{n(22,M=!1)}}async function be(e){u&&"owner"===h&&(n(19,N=e.content),ke(`Loaded version: ${e.name}`,"success"))}async function Ae(e){if(u&&"owner"===h&&confirm(`Are you sure you want to delete version ${e}?`))try{n(22,M=!0);const t=await fetch("/api/sprocket/delete-version",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/delete-version")}`,"Content-Type":"application/json"},body:JSON.stringify({filename:e})});if(t.ok)ke(`Version ${e} deleted successfully`,"success"),await we();else{ke(`Failed to delete version: ${await t.text()}`,"error")}}catch(e){ke(`Error deleting version: ${e.message}`,"error")}finally{n(22,M=!1)}}function ke(e,t="info"){n(23,j=e),n(24,H=t),setTimeout(()=>{n(23,j="")},5e3)}function Ie(e,t="info"){n(28,Y=e),n(29,W=t),"error"!==t&&setTimeout(()=>{n(28,Y="")},5e3)}async function Ce(){if(n(30,z=[]),!K.trim())return n(30,z=["Policy JSON is empty"]),Ie("Validation failed","error"),!1;try{const e=JSON.parse(K);if("object"!=typeof e||null===e)return n(30,z=["Policy must be a JSON object"]),Ie("Validation failed","error"),!1;if(e.policy_admins)if(Array.isArray(e.policy_admins))for(const t of e.policy_admins)"string"==typeof t&&/^[0-9a-fA-F]{64}$/.test(t)||z.push(`Invalid policy_admin pubkey: ${t}`);else z.push("policy_admins must be an array");if(e.rules)if("object"!=typeof e.rules)z.push("rules must be an object");else for(const[t,n]of Object.entries(e.rules))if(/^\d+$/.test(t)||z.push(`Invalid kind number: ${t}`),n.tag_validation&&"object"==typeof n.tag_validation)for(const[e,t]of Object.entries(n.tag_validation))try{new RegExp(t)}catch(n){z.push(`Invalid regex for tag '${e}': ${t}`)}return e.default_policy&&!["allow","deny"].includes(e.default_policy)&&z.push("default_policy must be 'allow' or 'deny'"),z.length>0?(Ie("Validation failed - see errors below","error"),!1):(Ie("Validation passed","success"),!0)}catch(e){return n(30,z=[`JSON parse error: ${e.message}`]),Ie("Invalid JSON syntax","error"),!1}}const Ee=[{id:"export",icon:"📤",label:"Export"},{id:"import",icon:"💾",label:"Import",requiresAdmin:!0},{id:"events",icon:"📡",label:"Events"},{id:"blossom",icon:"🌸",label:"Blossom"},{id:"compose",icon:"✏️",label:"Compose",requiresWrite:!0},{id:"recovery",icon:"🔄",label:"Recovery"},{id:"managed-acl",icon:"🛡️",label:"Managed ACL",requiresOwner:!0},{id:"curation",icon:"📋",label:"Curation",requiresOwner:!0},{id:"sprocket",icon:"⚙️",label:"Sprocket",requiresOwner:!0},{id:"policy",icon:"📜",label:"Policy",requiresOwner:!0},{id:"relay-connect",icon:"🔗",label:"Relay Connect",requiresOwner:!0},{id:"logs",icon:"📋",label:"Logs",requiresOwner:!0}];function xe(e){n(5,v=e),"sprocket"===e&&u&&"owner"===h&&G&&(ye(),we()),me()}function Se(){n(14,m=!1)}function Be(e){Qe(e)}function Qe(e){n(6,b=b.filter(t=>t.id!==e)),D.delete(e),v===e&&n(5,v="export")}async function Fe(e,t=!0){const n=D.get(e);if(n&&!n.isLoading){n.isLoading=!0,D.set(e,n);try{const i={...n.filter};!t&&n.oldestTimestamp&&(i.until=n.oldestTimestamp),t||(i.limit=200),console.log("Loading search results with filter:",i);const r=await Qp([i],{timeout:3e4});if(console.log("Received search results:",r.length,"events"),n.events=t?r.sort((e,t)=>t.created_at-e.created_at):[...n.events,...r].sort((e,t)=>t.created_at-e.created_at),r.length>0){const e=Math.min(...r.map(e=>e.created_at));(!n.oldestTimestamp||e0){const e=s.filter(e=>e.pubkey&&e.pubkey!==d);e.length>0&&console.warn("Server returned non-user events:",e.length,"out of",s.length)}if(e?(n(96,k=s.sort((e,t)=>t.created_at-e.created_at)),ve(s)):(n(96,k=[...k,...s].sort((e,t)=>t.created_at-e.created_at)),ve(k)),s.length>0){const e=Math.min(...s.map(e=>e.created_at));(!Q||e{if("events"===v){const e=document.querySelectorAll(".events-view-content")[0];e&&e.scrollHeight<=e.clientHeight&&_e()}},100)}catch(e){console.error("Failed to load events:",e),alert("Failed to load events: "+e.message)}finally{n(7,S=!1)}}}async function _e(){await Ue(!1)}let Ne=!1;async function Le(e,t){if(!u||!d)throw new Error("Not logged in");const n={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",window.location.origin+e],["method",t.toUpperCase()]],content:"",pubkey:d};let i;if(g&&"extension"===f)try{i=await g.signEvent(n)}catch(e){throw new Error("Failed to sign with extension: "+e.message)}else{if("nsec"!==f)throw new Error("No valid signer available");n.id="mock-id-"+Date.now(),n.sig="mock-signature-"+Date.now(),i=n}const r=JSON.stringify(i);return`Nostr ${btoa(r)}`}async function Oe(e,t){if(!u||!d)throw new Error("Not logged in");const n={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",window.location.origin+t],["method",e.toUpperCase()]],content:"",pubkey:d};let i;if(g&&"extension"===f)try{i=await g.signEvent(n)}catch(e){throw new Error("Failed to sign with extension: "+e.message)}else{if("nsec"!==f)throw new Error("No valid signer available");n.id="mock-id-"+Date.now(),n.sig="mock-signature-"+Date.now(),i=n}const r=JSON.stringify(i);return btoa(r)}function Me(e,t){const n=e.toLowerCase();if(n.includes("policy")||n.includes("blocked")||n.includes("denied")){let n=`Policy Error: ${e}`;return null!==t&&(n+=`\n\nKind ${t} may be restricted by the relay's policy configuration.`),V&&(n+="\n\nThe relay has policy enforcement enabled. Contact a relay administrator to allow this event kind or adjust your permissions."),n}if(n.includes("auth")||n.includes("permission")||n.includes("unauthorized"))return`Permission Error: ${e}\n\nYour current permissions may not allow publishing this type of event. Current role: ${h||"unknown"}. Contact a relay administrator to upgrade your permissions.`;if(n.includes("kind")||n.includes("not allowed")||n.includes("restricted")){let n=`Event Type Error: ${e}`;return null!==t&&(n+=`\n\nKind ${t} is not currently allowed on this relay.`),n+="\n\nThe relay administrator may need to update the policy configuration to allow this event kind.",n}return n.includes("rate")||n.includes("limit")||n.includes("too many")?`Rate Limit Error: ${e}\n\nPlease wait a moment before trying again.`:n.includes("size")||n.includes("too large")||n.includes("content")?`Size Limit Error: ${e}\n\nThe event may exceed the relay's size limits. Try reducing the content length.`:`Publishing failed: ${e}`}function je(e){n(97,F=e),localStorage.setItem("viewAsRole",e),console.log("View as role changed to:",e,"Current effective role:",a)}F=localStorage.getItem("viewAsRole")||"";return e.$$.update=()=>{var t;if(6&e.$$.dirty[0]|8&e.$$.dirty[3]&&n(41,i=k.sort((e,t)=>t.created_at-e.created_at)),8&e.$$.dirty[0]&&n(40,r=p?.about?(t=p.about,t?t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):"").replace(/\n{2,}/g,"
    "):""),16&e.$$.dirty[0]|16&e.$$.dirty[3]&&n(10,a=F&&""!==F?F:h),1810&e.$$.dirty[0]|112&e.$$.dirty[3]&&n(101,s=Ee.filter(e=>{const t=a;return!(e.requiresAdmin&&(!u||"admin"!==t&&"owner"!==t))&&(!(e.requiresOwner&&(!u||"owner"!==t))&&(!(e.requiresWrite&&(!u||"read"===t))&&(!("sprocket"===e.id&&!G)&&(!("policy"===e.id&&!V)&&(!("relay-connect"===e.id&&!X)&&(("managed-acl"!==e.id||"managed"===ee)&&(("curation"!==e.id||"curating"===ee)&&(console.log(`Tab ${e.id} filter check:`,{isLoggedIn:u,userRole:h,viewAsRole:F,currentRole:t,requiresAdmin:e.requiresAdmin,requiresOwner:e.requiresOwner,requiresWrite:e.requiresWrite,visible:!0}),!0))))))))})),64&e.$$.dirty[0]|256&e.$$.dirty[3]&&n(11,o=[...s,...b]),2578&e.$$.dirty[0]|256&e.$$.dirty[3]&&console.log("Tabs debug:",{isLoggedIn:u,userRole:h,aclMode:ee,filteredBaseTabs:s.map(e=>e.id),allTabs:o.map(e=>e.id)}),1&e.$$.dirty[0]&&"undefined"!=typeof document&&(l?document.body.classList.add("dark-theme"):document.body.classList.remove("dark-theme")),14&e.$$.dirty[0]&&u&&d&&!p&&$e(),182&e.$$.dirty[0]|136&e.$$.dirty[3]&&"events"===v&&u&&("read"===h||"write"===h||"admin"===h||"owner"===h)&&0===k.length&&!Ne&&!S){n(100,Ne=!0);Ue(!0,null)}32&e.$$.dirty[0]|8&e.$$.dirty[3]&&("events"!==v||"events"===v&&k.length>0)&&n(100,Ne=!1),32&e.$$.dirty[0]&&localStorage.setItem("selectedTab",v)},[l,u,d,p,h,v,b,S,V,ee,a,o,c,g,m,y,I,C,E,N,L,O,M,j,H,J,K,q,Y,W,z,Z,te,ne,ie,re,se,oe,ae,le,r,i,D,ue,de,async function(){console.log("Toggle changed, showOnlyMyEvents:",GA),n(100,Ne=!1),await Ue(!0,null)},fe,pe,he,ge,function(){console.log("selectRecoveryKind called, recoverySelectedKind:",re),null!=re?(n(36,se=""),n(37,oe=[]),ce=null,n(39,le=!0),pe()):console.log("No kind selected, skipping load")},function(){console.log("handleCustomKindInput called, recoveryCustomKind:",se);const e=parseInt(se);""!==se&&!isNaN(e)&&e>=0&&(n(35,re=null),n(37,oe=[]),ce=null,n(39,le=!0),pe())},function(e){const t=oe.filter(t=>t.kind===e.kind&&t.pubkey===e.pubkey),n=Math.max(...t.map(e=>e.created_at));return e.created_at===n},async function(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/status",{method:"GET",headers:{Authorization:`Nostr ${await Oe("GET","/api/sprocket/status")}`,"Content-Type":"application/json"}});if(e.ok){const t=await e.json();n(19,N=t.script_content||""),n(20,L=t),ke("Script loaded successfully","success")}else ke("Failed to load script","error")}catch(e){ke(`Error loading script: ${e.message}`,"error")}finally{n(22,M=!1)}},async function(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/update",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/update")}`,"Content-Type":"text/plain"},body:N});if(e.ok)ke("Script saved and updated successfully","success"),await ye(),await we();else{ke(`Failed to save script: ${await e.text()}`,"error")}}catch(e){ke(`Error saving script: ${e.message}`,"error")}finally{n(22,M=!1)}},async function(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/restart",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/restart")}`,"Content-Type":"application/json"}});if(e.ok)ke("Sprocket restarted successfully","success"),await ye();else{ke(`Failed to restart sprocket: ${await e.text()}`,"error")}}catch(e){ke(`Error restarting sprocket: ${e.message}`,"error")}finally{n(22,M=!1)}},async function(){if(u&&"owner"===h&&confirm("Are you sure you want to delete the sprocket script? This will stop the current process."))try{n(22,M=!0);const e=await fetch("/api/sprocket/update",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/update")}`,"Content-Type":"text/plain"},body:""});if(e.ok)n(19,N=""),ke("Sprocket script deleted successfully","success"),await ye(),await we();else{ke(`Failed to delete script: ${await e.text()}`,"error")}}catch(e){ke(`Error deleting script: ${e.message}`,"error")}finally{n(22,M=!1)}},we,be,Ae,async function(){if(u&&("owner"===h||JA))try{n(27,q=!0),n(30,z=[]);const e={kinds:[12345],limit:1},t=await Pp(e);if(t&&t.length>0){n(26,K=t[0].content);try{n(26,K=JSON.stringify(JSON.parse(K),null,2))}catch(e){}Ie("Policy loaded successfully","success")}else{const e=await fetch("/api/policy",{method:"GET",headers:{Authorization:`Nostr ${await Oe("GET","/api/policy")}`,"Content-Type":"application/json"}});if(e.ok){const t=await e.json();n(26,K=JSON.stringify(t,null,2)),Ie("Policy loaded from file","success")}else Ie("No policy configuration found","info"),n(26,K="")}}catch(e){Ie(`Error loading policy: ${e.message}`,"error")}finally{n(27,q=!1)}},Ce,async function(){if(!u||"owner"!==h&&!JA)return;if(await Ce())try{n(27,q=!0);const e={kind:12345,created_at:Math.floor(Date.now()/1e3),tags:[],content:K},t=await Ob(e,g);t.success?Ie("Policy updated successfully","success"):Ie(`Failed to publish policy: ${t.error||"Unknown error"}`,"error")}catch(e){Ie(`Error saving policy: ${e.message}`,"error")}finally{n(27,q=!1)}},function(){try{const e=JSON.parse(K);n(26,K=JSON.stringify(e,null,2)),Ie("JSON formatted","success")}catch(e){Ie(`Cannot format: ${e.message}`,"error")}},function(e){const t=e.detail;if(!t)return void Ie("Please enter a pubkey","error");const i=function(e){if(!e)return null;if(/^[0-9a-fA-F]{64}$/.test(e))return e.toLowerCase();if(e.startsWith("npub1"))try{const t="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n=e.slice(5);let i=[];for(const e of n){const n=t.indexOf(e.toLowerCase());if(-1===n)throw new Error("Invalid character in npub");i.push(...[...Array(5)].map((e,t)=>n>>4-t&1))}i=i.slice(0,-30);const r=[];for(let e=0;e+8<=i.length;e+=8){let t=0;for(let n=0;n<8;n++)t=t<<1|i[e+n];r.push(t)}return r.map(e=>e.toString(16).padStart(2,"0")).join("")}catch(e){return console.error("Failed to decode npub:",e),null}return null}(t);if(i&&64===i.length)try{const e=JSON.parse(K||"{}");if(e.policy_admins||(e.policy_admins=[]),e.policy_admins.includes(i))return void Ie("Admin already in list","warning");e.policy_admins.push(i),n(26,K=JSON.stringify(e,null,2)),Ie("Admin added - click 'Save & Publish' to apply","info")}catch(e){Ie(`Error adding admin: ${e.message}`,"error")}else Ie("Invalid pubkey format. Use hex (64 chars) or npub","error")},function(e){const t=e.detail;try{const e=JSON.parse(K||"{}");e.policy_admins&&(e.policy_admins=e.policy_admins.filter(e=>e!==t),n(26,K=JSON.stringify(e,null,2)),Ie("Admin removed - click 'Save & Publish' to apply","info"))}catch(e){Ie(`Error removing admin: ${e.message}`,"error")}},async function(){if(u&&("owner"===h||JA))try{n(27,q=!0),n(31,Z=[]);let e=[];try{e=JSON.parse(K||"{}").policy_admins||[]}catch(e){return void Ie("Cannot parse policy JSON to get admins","error")}if(0===e.length)return void Ie("No policy admins configured","warning");const t={kinds:[3],authors:e,limit:e.length},i=await Pp(t),r=new Set;for(const e of i)if(e.tags)for(const t of e.tags)"p"===t[0]&&t[1]&&64===t[1].length&&r.add(t[1]);n(31,Z=Array.from(r)),Ie(`Loaded ${Z.length} follows from ${i.length} admin(s)`,"success")}catch(e){Ie(`Error loading follows: ${e.message}`,"error")}finally{n(27,q=!1)}},function(e){n(25,J=e.target.files[0])},async function(){if(u&&"owner"===h&&J)try{n(22,M=!0);const e=await J.text(),t=await fetch("/api/sprocket/update",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/update")}`,"Content-Type":"text/plain"},body:e});if(t.ok)n(19,N=e),ke("Script uploaded and updated successfully","success"),await ye(),await we();else{ke(`Failed to upload script: ${await t.text()}`,"error")}}catch(e){ke(`Error uploading script: ${e.message}`,"error")}finally{n(22,M=!1),n(25,J=null);const e=document.getElementById("sprocket-upload-file");e&&(e.value="")}},xe,function(){u||n(12,c=!0)},async function(e){const{method:t,pubkey:i,privateKey:r,signer:s}=e.detail;n(1,u=!0),n(2,d=i),f=t,n(13,g=s),n(12,c=!1);try{if(await $p(),"extension"===t&&s)vp.setSigner(s);else if("nsec"===t&&r){const e=new ff(r);vp.setSigner(e)}n(3,p=await Sp(i)),console.log("Profile loaded:",p)}catch(e){console.error("Failed to load profile:",e)}await Pe(),await Re()},function(){n(1,u=!1),n(2,d=""),f="",n(3,p=null),n(4,h=""),n(13,g=null),userPrivkey=null,n(14,m=!1),T=[],n(96,k=[]),$=[],P=0,me(),"undefined"!=typeof localStorage&&(localStorage.removeItem("nostr_auth_method"),localStorage.removeItem("nostr_pubkey"),localStorage.removeItem("nostr_privkey"))},function(){n(12,c=!1)},function(){n(14,m=!0)},Se,function(){n(15,y=!y)},function(e){const{searchText:t,selectedKinds:n,pubkeys:i,eventIds:r,tags:s,sinceTimestamp:o,untilTimestamp:a,limit:l}=e.detail,c=function({searchText:e=null,kinds:t=[],authors:n=[],ids:i=[],tags:r=[],since:s=null,until:o=null,limit:a=null}){const l={};return e&&e.trim()&&(l.search=e.trim()),t&&t.length>0&&(l.kinds=t),n&&n.length>0&&(l.authors=n),i&&i.length>0&&(l.ids=i),r&&r.length>0&&r.forEach(e=>{if(e.name&&e.value){const t=`#${e.name}`;l[t]||(l[t]=[]),l[t].push(e.value)}}),s&&(l.since=s),o&&(l.until=o),a&&a>0&&(l.limit=a),l}({searchText:t,kinds:n,authors:i,ids:r,tags:s,since:o,until:a,limit:l||100});w=c,Ue(!0,null)},function(){w={},Ue(!0,null)},Be,Qe,Fe,De,$e,async function(){await Te([])},async function(){await Te([d])},function(e){n(16,I=e.detail.target.files[0])},async function(){if("none"!==ee&&(!u||"admin"!==h&&"owner"!==h))return n(17,C="Admin or owner permission required"),void setTimeout(()=>{n(17,C="")},5e3);if(!I)return n(17,C="Please select a file"),void setTimeout(()=>{n(17,C="")},5e3);try{n(17,C="Uploading...");const e={};"none"!==ee&&u&&(e.Authorization=await Le("/api/import","POST"));const t=new FormData;t.append("file",I);const i=await fetch("/api/import",{method:"POST",headers:e,body:t});if(!i.ok)throw new Error(`Import failed: ${i.status} ${i.statusText}`);await i.json();n(17,C="Upload complete"),n(16,I=null),document.getElementById("import-file").value="",setTimeout(()=>{n(17,C="")},5e3)}catch(e){console.error("Import failed:",e),n(17,C="Import failed: "+e.message),setTimeout(()=>{n(17,C="")},5e3)}},Ue,function(e){const{scrollTop:t,scrollHeight:n,clientHeight:i}=e.target;n-t-i<100&&_e()},function(){try{if(!ne.trim())return void alert("Please enter some JSON to reformat");const e=JSON.parse(ne);n(33,ne=JSON.stringify(e,null,2))}catch(e){alert("Invalid JSON: "+e.message)}},async function(){try{if(!ne.trim())return void alert("Please enter an event to sign");if(!u||!d)return void alert("Please log in to sign events");if(!g)return void alert("No signer available. Please log in with a valid authentication method.");const e=JSON.parse(ne);e.pubkey=d,e.created_at=Math.floor(Date.now()/1e3),delete e.id,delete e.sig;const t=await g.signEvent(e);n(33,ne=JSON.stringify(t,null,2)),alert("Event signed successfully!")}catch(e){console.error("Error signing event:",e),alert("Error signing event: "+e.message)}},async function(){n(34,ie="");try{if(!ne.trim())return void n(34,ie="Please enter an event to publish");if(!u)return void n(34,ie="Please log in to publish events");if(!g)return void n(34,ie="No signer available. Please log in with a valid authentication method.");let e;try{e=JSON.parse(ne)}catch(e){return void n(34,ie=`Invalid JSON: ${e.message}`)}if(!e.id||!e.sig)return void n(34,ie='Event must be signed before publishing. Please click "Sign" first.');if("read"===h)return void n(34,ie=`Permission denied: Your current role is "${h}" which does not allow publishing events. Contact a relay administrator to upgrade your permissions.`);const t=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`,i=await Ob(t,e,g,d);if(i.success)n(34,ie=""),alert("Event published successfully to ORLY relay!");else{const t=i.reason||"Unknown error";n(34,ie=Me(t,e.kind))}}catch(e){console.error("Error publishing event:",e);const t=e.message||"Unknown error";n(34,ie=Me(t,null))}},function(){n(34,ie="")},je,function(){const e=["owner","admin","write","read"],t=e.indexOf(h);return-1===t?["read"]:e.slice(t)},k,F,G,X,Ne,s,function(t){R.call(this,e,t)},function(t){R.call(this,e,t)},e=>e.id===v,e=>xe(e.detail),e=>Qe(e.detail),e=>ue(e.detail),e=>fe(e.detail),e=>de(e.detail.event,e.detail.e),e=>Ue(e.detail.refresh,e.detail.authors),function(e){ne=e,n(33,ne)},function(e){N=e,n(19,N)},e=>be(e.detail),e=>Ae(e.detail),function(e){K=e,n(26,K)},function(){re=x(this),n(35,re)},function(){se=A(this.value),n(36,se)},e=>ge(e),e=>he(e),(e,t)=>de(e,t),e=>Fe(e.id,!0),e=>Be(e.id),e=>fe(e.id),e=>ue(e.id),(e,t)=>"Enter"===t.key&&ue(e.id),(e,t)=>de(e,t),(e,t)=>De(t,e.id),e=>je(e===h?"":e),e=>"Escape"===e.key&&Se(),function(e){c=e,n(12,c)}]}return new class extends se{constructor(e){super(),re(this,e,KA,HA,s,{},null,[-1,-1,-1,-1,-1,-1])}}({target:document.body,props:{name:"world"}})}(); + */function Tp(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;class Up{constructor(){this.mutex=Promise.resolve()}lock(){let e=()=>{};return this.mutex=this.mutex.then(()=>new Promise(e)),new Promise(t=>{e=t})}dispatch(e){return Tp(this,void 0,void 0,function*(){const t=yield this.lock();try{return yield Promise.resolve(e())}finally{t()}})}}var _p;const Np="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Lp=null!==(_p=Np.Buffer)&&void 0!==_p?_p:null,Op=Np.TextEncoder?new Np.TextEncoder:null;function Mp(e,t){return(15&e)+(e>>6|e>>3&8)<<4|(15&t)+(t>>6|t>>3&8)}function jp(e,t){const n=t.length>>1;for(let i=0;i>>4;e[i++]=n>9?n+Hp:n+Gp,n=15&t[r],e[i++]=n>9?n+Hp:n+Gp}return String.fromCharCode.apply(null,e)}const Kp=null!==Lp?e=>{if("string"==typeof e){const t=Lp.from(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(Lp.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")}:e=>{if("string"==typeof e)return Op.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")},Vp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qp=new Uint8Array(256);for(let e=0;e<64;e++)qp[Vp.charCodeAt(e)]=e;function Yp(e,t=!0){const n=e.length,i=n%3,r=[],s=n-i;for(let t=0;t>18&63)+Vp.charAt(n>>12&63)+Vp.charAt(n>>6&63)+Vp.charAt(63&n);r.push(i)}if(1===i){const i=e[n-1],s=Vp.charAt(i>>2),o=Vp.charAt(i<<4&63);r.push(`${s}${o}`),t&&r.push("==")}else if(2===i){const i=(e[n-2]<<8)+e[n-1],s=Vp.charAt(i>>10),o=Vp.charAt(i>>4&63),a=Vp.charAt(i<<2&63);r.push(`${s}${o}${a}`),t&&r.push("=")}return r.join("")}function Wp(e){const t=function(e){let t=Math.floor(.75*e.length);const n=e.length;return"="===e[n-1]&&(t-=1,"="===e[n-2]&&(t-=1)),t}(e),n=e.length,i=new Uint8Array(t);let r=0;for(let t=0;t>4,r+=1,i[r]=(15&s)<<4|o>>2,r+=1,i[r]=(3&o)<<6|63&a,r+=1}return i}const zp=16384,Zp=new Up,Xp=new Map;function eh(e,t){return Tp(this,void 0,void 0,function*(){let n=null,i=null,r=!1;if("undefined"==typeof WebAssembly)throw new Error("WebAssembly is not supported in this environment!");const s=()=>new DataView(n.exports.memory.buffer).getUint32(n.exports.STATE_SIZE,!0),o=Zp.dispatch(()=>Tp(this,void 0,void 0,function*(){if(!Xp.has(e.name)){const t=Wp(e.data),n=WebAssembly.compile(t);Xp.set(e.name,n)}const t=yield Xp.get(e.name);n=yield WebAssembly.instantiate(t,{})})),a=(e=null)=>{r=!0,n.exports.Hash_Init(e)},l=e=>{if(!r)throw new Error("update() called before init()");(e=>{let t=0;for(;t{if(!r)throw new Error("digest() called before init()");return r=!1,n.exports.Hash_Final(s),"binary"===e?i.slice(0,t):Jp(c,i,t)},d=e=>"string"==typeof e?e.length<4096:e.byteLength!0;break;case"blake2b":case"blake2s":f=(e,t)=>t<=512&&d(e);break;case"blake3":f=(e,t)=>0===t&&d(e);break;case"xxhash64":case"xxhash3":case"xxhash128":case"crc64":f=()=>!1}return yield(()=>Tp(this,void 0,void 0,function*(){n||(yield o);const e=n.exports.Hash_GetBuffer(),t=n.exports.memory.buffer;i=new Uint8Array(t,e,zp)}))(),{getMemory:()=>i,writeMemory:(e,t=0)=>{i.set(e,t)},getExports:()=>n.exports,setMemorySize:e=>{n.exports.Hash_SetMemorySize(e);const t=n.exports.Hash_GetBuffer(),r=n.exports.memory.buffer;i=new Uint8Array(r,t,e)},init:a,update:l,digest:u,save:()=>{if(!r)throw new Error("save() can only be called after init() and before digest()");const t=n.exports.Hash_GetState(),i=s(),o=n.exports.memory.buffer,a=new Uint8Array(o,t,i),l=new Uint8Array(4+i);return jp(l,e.hash),l.set(a,4),l},load:t=>{if(!(t instanceof Uint8Array))throw new Error("load() expects an Uint8Array generated by save()");const i=n.exports.Hash_GetState(),o=s(),a=4+o,l=n.exports.memory.buffer;if(t.length!==a)throw new Error(`Bad state length (expected ${a} bytes, got ${t.length})`);if(!function(e,t){if(e.length!==2*t.length)return!1;for(let n=0;n{if(!f(e,r))return a(r),l(e),u("hex",s);const o=Kp(e);return i.set(o),n.exports.Hash_Calculate(o.length,r,s),Jp(c,i,t)},hashLength:t}})}new Up;var th={name:"argon2",data:"AGFzbQEAAAABKQVgAX8Bf2AAAX9gEH9/f39/f39/f39/f39/f38AYAR/f39/AGACf38AAwYFAAECAwQFBgEBAoCAAgYIAX8BQZCoBAsHQQQGbWVtb3J5AgASSGFzaF9TZXRNZW1vcnlTaXplAAAOSGFzaF9HZXRCdWZmZXIAAQ5IYXNoX0NhbGN1bGF0ZQAECvEyBVgBAn9BACEBAkAgAEEAKAKICCICRg0AAkAgACACayIAQRB2IABBgIB8cSAASWoiAEAAQX9HDQBB/wHADwtBACEBQQBBACkDiAggAEEQdK18NwOICAsgAcALcAECfwJAQQAoAoAIIgANAEEAPwBBEHQiADYCgAhBACgCiAgiAUGAgCBGDQACQEGAgCAgAWsiAEEQdiAAQYCAfHEgAElqIgBAAEF/Rw0AQQAPC0EAQQApA4gIIABBEHStfDcDiAhBACgCgAghAAsgAAvcDgECfiAAIAQpAwAiECAAKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAMIBAgDCkDAIVCIIkiEDcDACAIIBAgCCkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgBCAQIAQpAwCFQiiJIhA3AwAgACAQIAApAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIAwgECAMKQMAhUIwiSIQNwMAIAggECAIKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAEIBAgBCkDAIVCAYk3AwAgASAFKQMAIhAgASkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgDSAQIA0pAwCFQiCJIhA3AwAgCSAQIAkpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAUgECAFKQMAhUIoiSIQNwMAIAEgECABKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACANIBAgDSkDAIVCMIkiEDcDACAJIBAgCSkDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgBSAQIAUpAwCFQgGJNwMAIAIgBikDACIQIAIpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIA4gECAOKQMAhUIgiSIQNwMAIAogECAKKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAGIBAgBikDAIVCKIkiEDcDACACIBAgAikDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgDiAQIA4pAwCFQjCJIhA3AwAgCiAQIAopAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIAYgECAGKQMAhUIBiTcDACADIAcpAwAiECADKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAPIBAgDykDAIVCIIkiEDcDACALIBAgCykDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgByAQIAcpAwCFQiiJIhA3AwAgAyAQIAMpAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIA8gECAPKQMAhUIwiSIQNwMAIAsgECALKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAHIBAgBykDAIVCAYk3AwAgACAFKQMAIhAgACkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgDyAQIA8pAwCFQiCJIhA3AwAgCiAQIAopAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAUgECAFKQMAhUIoiSIQNwMAIAAgECAAKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAPIBAgDykDAIVCMIkiEDcDACAKIBAgCikDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgBSAQIAUpAwCFQgGJNwMAIAEgBikDACIQIAEpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAwgECAMKQMAhUIgiSIQNwMAIAsgECALKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAGIBAgBikDAIVCKIkiEDcDACABIBAgASkDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgDCAQIAwpAwCFQjCJIhA3AwAgCyAQIAspAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIAYgECAGKQMAhUIBiTcDACACIAcpAwAiECACKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACANIBAgDSkDAIVCIIkiEDcDACAIIBAgCCkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgByAQIAcpAwCFQiiJIhA3AwAgAiAQIAIpAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIA0gECANKQMAhUIwiSIQNwMAIAggECAIKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAHIBAgBykDAIVCAYk3AwAgAyAEKQMAIhAgAykDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgDiAQIA4pAwCFQiCJIhA3AwAgCSAQIAkpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAQgECAEKQMAhUIoiSIQNwMAIAMgECADKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAOIBAgDikDAIVCMIkiEDcDACAJIBAgCSkDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgBCAQIAQpAwCFQgGJNwMAC98aAQN/QQAhBEEAIAIpAwAgASkDAIU3A5AIQQAgAikDCCABKQMIhTcDmAhBACACKQMQIAEpAxCFNwOgCEEAIAIpAxggASkDGIU3A6gIQQAgAikDICABKQMghTcDsAhBACACKQMoIAEpAyiFNwO4CEEAIAIpAzAgASkDMIU3A8AIQQAgAikDOCABKQM4hTcDyAhBACACKQNAIAEpA0CFNwPQCEEAIAIpA0ggASkDSIU3A9gIQQAgAikDUCABKQNQhTcD4AhBACACKQNYIAEpA1iFNwPoCEEAIAIpA2AgASkDYIU3A/AIQQAgAikDaCABKQNohTcD+AhBACACKQNwIAEpA3CFNwOACUEAIAIpA3ggASkDeIU3A4gJQQAgAikDgAEgASkDgAGFNwOQCUEAIAIpA4gBIAEpA4gBhTcDmAlBACACKQOQASABKQOQAYU3A6AJQQAgAikDmAEgASkDmAGFNwOoCUEAIAIpA6ABIAEpA6ABhTcDsAlBACACKQOoASABKQOoAYU3A7gJQQAgAikDsAEgASkDsAGFNwPACUEAIAIpA7gBIAEpA7gBhTcDyAlBACACKQPAASABKQPAAYU3A9AJQQAgAikDyAEgASkD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",hash:"e4cdc523"},nh={name:"blake2b",data:"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",hash:"c6f286e6"};function ih(e){return!Number.isInteger(e)||e<8||e>512||e%8!=0?new Error("Invalid variant! Valid values: 8, 16, ..., 512"):null}function rh(e=512,t=null){if(ih(e))return Promise.reject(ih(e));let n=null,i=e;if(null!==t){if(n=Kp(t),n.length>64)return Promise.reject(new Error("Max key length is 64 bytes"));r=e,s=n.length,i=r|s<<16}var r,s;const o=e/8;return eh(nh,o).then(e=>{i>512&&e.writeMemory(n),e.init(i);const t={init:i>512?()=>(e.writeMemory(n),e.init(i),t):()=>(e.init(i),t),update:n=>(e.update(n),t),digest:t=>e.digest(t),save:()=>e.save(),load:n=>(e.load(n),t),blockSize:128,digestSize:o};return t})}new Up;const sh=new DataView(new ArrayBuffer(4));function oh(e){return sh.setInt32(0,e,!0),new Uint8Array(sh.buffer)}function ah(e,t,n){return Tp(this,void 0,void 0,function*(){if(n<=64){const e=yield rh(8*n);return e.update(oh(n)),e.update(t),e.digest("binary")}const i=Math.ceil(n/32)-2,r=new Uint8Array(n);e.init(),e.update(oh(n)),e.update(t);let s=e.digest("binary");r.set(s.subarray(0,32),0);for(let t=1;t{var t;if(!e||"object"!=typeof e)throw new Error("Invalid options parameter. It requires an object.");if(!e.password)throw new Error("Password must be specified");if(e.password=Kp(e.password),e.password.length<1)throw new Error("Password must be specified");if(!e.salt)throw new Error("Salt must be specified");if(e.salt=Kp(e.salt),e.salt.length<8)throw new Error("Salt should be at least 8 bytes long");if(e.secret=Kp(null!==(t=e.secret)&&void 0!==t?t:""),!Number.isInteger(e.iterations)||e.iterations<1)throw new Error("Iterations should be a positive number");if(!Number.isInteger(e.parallelism)||e.parallelism<1)throw new Error("Parallelism should be a positive number");if(!Number.isInteger(e.hashLength)||e.hashLength<4)throw new Error("Hash length should be at least 4 bytes.");if(!Number.isInteger(e.memorySize))throw new Error("Memory size should be specified.");if(e.memorySize<8*e.parallelism)throw new Error("Memory size should be at least 8 * parallelism.");if(void 0===e.outputType&&(e.outputType="hex"),!["hex","binary","encoded"].includes(e.outputType))throw new Error(`Insupported output type ${e.outputType}. Valid values: ['hex', 'binary', 'encoded']`)})(e),lh(Object.assign(Object.assign({},e),{hashType:"id"}))})}new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up,new Up;const uh={parallelism:4,iterations:8,memorySize:262144,hashLength:32,outputType:"binary"};let dh=null,fh=0;const ph=new Map;async function hh(e,t){try{const n=function(){if(dh)return dh;const e=new Blob(["\n importScripts('https://cdn.jsdelivr.net/npm/hash-wasm@4.11.0/dist/argon2.umd.min.js');\n\n const ARGON2_CONFIG = {\n parallelism: 4,\n iterations: 8,\n memorySize: 262144,\n hashLength: 32,\n outputType: \"binary\"\n };\n\n self.onmessage = async function(e) {\n const { password, salt, id } = e.data;\n\n try {\n const result = await hashwasm.argon2id({\n password: password,\n salt: new Uint8Array(salt),\n ...ARGON2_CONFIG\n });\n\n self.postMessage({\n id,\n success: true,\n result: Array.from(result)\n });\n } catch (error) {\n self.postMessage({\n id,\n success: false,\n error: error.message\n });\n }\n };\n "],{type:"application/javascript"});return dh=new Worker(URL.createObjectURL(e)),dh.onmessage=function(e){const{id:t,success:n,result:i,error:r}=e.data,s=ph.get(t);s&&(ph.delete(t),n?s.resolve(new Uint8Array(i)):s.reject(new Error(r)))},dh.onerror=function(e){console.error("Argon2 worker error:",e)},dh}(),i=++fh;return new Promise((r,s)=>{ph.set(i,{resolve:r,reject:s}),n.postMessage({id:i,password:e,salt:Array.from(t)})})}catch(n){console.warn("Worker failed, falling back to main thread:",n);return await ch({password:e,salt:t,...uh})}}const{window:gh}=l;function mh(e){let t,n,r,s,o,a,l,f,h,g,v,A,k,I,C,E,x,B;function Q(e,t){return"extension"===e[2]?yh:vh}let F=Q(e),D=F(e),$=e[10]&&Fh(e),P=e[11]&&Dh(e);return{c(){t=p("div"),n=p("div"),r=p("div"),s=p("h2"),s.textContent="Login to Nostr",o=m(),a=p("button"),a.textContent="×",l=m(),f=p("div"),h=p("div"),g=p("button"),g.textContent="Extension",v=m(),A=p("button"),A.textContent="Nsec",k=m(),I=p("div"),D.c(),C=m(),$&&$.c(),E=m(),P&&P.c(),b(s,"class","svelte-4xpfbi"),b(a,"class","close-btn svelte-4xpfbi"),b(r,"class","modal-header svelte-4xpfbi"),b(g,"class","tab-btn svelte-4xpfbi"),S(g,"active","extension"===e[2]),b(A,"class","tab-btn svelte-4xpfbi"),S(A,"active","nsec"===e[2]),b(h,"class","tabs svelte-4xpfbi"),b(I,"class","tab-content svelte-4xpfbi"),b(f,"class","tab-container svelte-4xpfbi"),b(n,"class","modal svelte-4xpfbi"),S(n,"dark-theme",e[1]),b(t,"class","modal-overlay svelte-4xpfbi"),b(t,"role","button"),b(t,"tabindex","0")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(r,s),c(r,o),c(r,a),c(n,l),c(n,f),c(f,h),c(h,g),c(h,v),c(h,A),c(f,k),c(f,I),D.m(I,null),c(I,C),$&&$.m(I,null),c(I,E),P&&P.m(I,null),x||(B=[y(a,"click",e[17]),y(g,"click",e[26]),y(A,"click",e[27]),y(n,"click",w(e[24])),y(n,"keydown",w(e[25])),y(t,"click",e[17]),y(t,"keydown",e[32])],x=!0)},p(e,t){4&t[0]&&S(g,"active","extension"===e[2]),4&t[0]&&S(A,"active","nsec"===e[2]),F===(F=Q(e))&&D?D.p(e,t):(D.d(1),D=F(e),D&&(D.c(),D.m(I,C))),e[10]?$?$.p(e,t):($=Fh(e),$.c(),$.m(I,E)):$&&($.d(1),$=null),e[11]?P?P.p(e,t):(P=Dh(e),P.c(),P.m(I,null)):P&&(P.d(1),P=null),2&t[0]&&S(n,"dark-theme",e[1])},d(e){e&&d(t),D.d(),$&&$.d(),P&&P.d(),x=!1,i(B)}}}function vh(e){let t;function n(e,t){return e[14]?bh:wh}let i=n(e),r=i(e);return{c(){t=p("div"),r.c(),b(t,"class","nsec-login svelte-4xpfbi")},m(e,n){u(e,t,n),r.m(t,null)},p(e,s){i===(i=n(e))&&r?r.p(e,s):(r.d(1),r=i(e),r&&(r.c(),r.m(t,null)))},d(e){e&&d(t),r.d()}}}function yh(e){let t,n,i,r,s,o,a,l=e[7]?"Connecting...":"Log in using extension";return{c(){t=p("div"),n=p("p"),n.textContent="Login using a NIP-07 compatible browser\n extension like nos2x or Alby.",i=m(),r=p("button"),s=g(l),b(n,"class","svelte-4xpfbi"),b(r,"class","login-extension-btn svelte-4xpfbi"),r.disabled=e[7],b(t,"class","extension-login svelte-4xpfbi")},m(l,d){u(l,t,d),c(t,n),c(t,i),c(t,r),c(r,s),o||(a=y(r,"click",e[21]),o=!0)},p(e,t){128&t[0]&&l!==(l=e[7]?"Connecting...":"Log in using extension")&&k(s,l),128&t[0]&&(r.disabled=e[7])},d(e){e&&d(t),o=!1,a()}}}function wh(e){let t,n,r,s,o,a,l,f,h,v,w,A,C,E,x,S,B,Q,F,D,$,P,R,T=e[8]?"Generating...":"Generate New Key",U=e[12]&&Ah(e),_=e[4]&&kh(e);function N(e,t){return e[9]?Eh:e[7]?Ch:Ih}let L=N(e),O=L(e);return{c(){t=p("p"),t.textContent="Enter your nsec or generate a new one. Optionally\n set a password to encrypt it securely.",n=m(),r=p("button"),s=g(T),a=m(),U&&U.c(),l=m(),f=p("input"),v=m(),w=p("div"),A=p("label"),A.textContent="Encryption Password (optional but recommended):",C=m(),E=p("input"),S=m(),_&&_.c(),B=m(),Q=p("small"),Q.textContent="Password uses Argon2id with ~3 second derivation time for security.",F=m(),D=p("button"),O.c(),b(t,"class","svelte-4xpfbi"),b(r,"class","generate-btn svelte-4xpfbi"),r.disabled=o=e[7]||e[8],b(f,"type","password"),b(f,"placeholder","nsec1..."),f.disabled=h=e[7]||e[9],b(f,"class","nsec-input svelte-4xpfbi"),b(A,"class","svelte-4xpfbi"),b(E,"type","password"),b(E,"placeholder","Enter password (min 8 chars)"),E.disabled=x=e[7]||e[9],b(E,"class","password-input svelte-4xpfbi"),b(Q,"class","password-hint svelte-4xpfbi"),b(w,"class","password-section svelte-4xpfbi"),b(D,"class","login-nsec-btn svelte-4xpfbi"),D.disabled=$=e[7]||e[9]||!e[3].trim()},m(i,o){u(i,t,o),u(i,n,o),u(i,r,o),c(r,s),u(i,a,o),U&&U.m(i,o),u(i,l,o),u(i,f,o),I(f,e[3]),u(i,v,o),u(i,w,o),c(w,A),c(w,C),c(w,E),I(E,e[4]),c(w,S),_&&_.m(w,null),c(w,B),c(w,Q),u(i,F,o),u(i,D,o),O.m(D,null),P||(R=[y(r,"click",e[20]),y(f,"input",e[29]),y(E,"input",e[30]),y(D,"click",e[22])],P=!0)},p(e,t){256&t[0]&&T!==(T=e[8]?"Generating...":"Generate New Key")&&k(s,T),384&t[0]&&o!==(o=e[7]||e[8])&&(r.disabled=o),e[12]?U?U.p(e,t):(U=Ah(e),U.c(),U.m(l.parentNode,l)):U&&(U.d(1),U=null),640&t[0]&&h!==(h=e[7]||e[9])&&(f.disabled=h),8&t[0]&&f.value!==e[3]&&I(f,e[3]),640&t[0]&&x!==(x=e[7]||e[9])&&(E.disabled=x),16&t[0]&&E.value!==e[4]&&I(E,e[4]),e[4]?_?_.p(e,t):(_=kh(e),_.c(),_.m(w,B)):_&&(_.d(1),_=null),L!==(L=N(e))&&(O.d(1),O=L(e),O&&(O.c(),O.m(D,null))),648&t[0]&&$!==($=e[7]||e[9]||!e[3].trim())&&(D.disabled=$)},d(e){e&&d(t),e&&d(n),e&&d(r),e&&d(a),U&&U.d(e),e&&d(l),e&&d(f),e&&d(v),e&&d(w),_&&_.d(),e&&d(F),e&&d(D),O.d(),P=!1,i(R)}}}function bh(e){let t,n,r,s,o,a,l,f,h,v,w,A,k,C,E=e[15]&&xh(e);function x(e,t){return e[9]?Qh:e[7]?Bh:Sh}let S=x(e),B=S(e);return{c(){t=p("p"),t.textContent="You have a stored encrypted key. Enter your\n password to unlock it.",n=m(),E&&E.c(),r=m(),s=p("input"),a=m(),l=p("button"),B.c(),h=m(),v=p("button"),w=g("Clear stored key & start fresh"),b(t,"class","svelte-4xpfbi"),b(s,"type","password"),b(s,"placeholder","Enter your password"),s.disabled=o=e[7]||e[9],b(s,"class","password-input svelte-4xpfbi"),b(l,"class","login-nsec-btn svelte-4xpfbi"),l.disabled=f=e[7]||e[9]||!e[6],b(v,"class","clear-btn svelte-4xpfbi"),v.disabled=A=e[7]||e[9]},m(i,o){u(i,t,o),u(i,n,o),E&&E.m(i,o),u(i,r,o),u(i,s,o),I(s,e[6]),u(i,a,o),u(i,l,o),B.m(l,null),u(i,h,o),u(i,v,o),c(v,w),k||(C=[y(s,"input",e[28]),y(l,"click",e[18]),y(v,"click",e[16])],k=!0)},p(e,t){e[15]?E?E.p(e,t):(E=xh(e),E.c(),E.m(r.parentNode,r)):E&&(E.d(1),E=null),640&t[0]&&o!==(o=e[7]||e[9])&&(s.disabled=o),64&t[0]&&s.value!==e[6]&&I(s,e[6]),S!==(S=x(e))&&(B.d(1),B=S(e),B&&(B.c(),B.m(l,null))),704&t[0]&&f!==(f=e[7]||e[9]||!e[6])&&(l.disabled=f),640&t[0]&&A!==(A=e[7]||e[9])&&(v.disabled=A)},d(e){e&&d(t),e&&d(n),E&&E.d(e),e&&d(r),e&&d(s),e&&d(a),e&&d(l),B.d(),e&&d(h),e&&d(v),k=!1,i(C)}}}function Ah(e){let t,n,i,r,s;return{c(){t=p("div"),n=p("label"),n.textContent="Your new public key (npub):",i=m(),r=p("code"),s=g(e[12]),b(n,"class","svelte-4xpfbi"),b(r,"class","npub-display svelte-4xpfbi"),b(t,"class","generated-info svelte-4xpfbi")},m(e,o){u(e,t,o),c(t,n),c(t,i),c(t,r),c(r,s)},p(e,t){4096&t[0]&&k(s,e[12])},d(e){e&&d(t)}}}function kh(e){let t,n,i,r;return{c(){t=p("input"),b(t,"type","password"),b(t,"placeholder","Confirm password"),t.disabled=n=e[7]||e[9],b(t,"class","password-input svelte-4xpfbi")},m(n,s){u(n,t,s),I(t,e[5]),i||(r=y(t,"input",e[31]),i=!0)},p(e,i){640&i[0]&&n!==(n=e[7]||e[9])&&(t.disabled=n),32&i[0]&&t.value!==e[5]&&I(t,e[5])},d(e){e&&d(t),i=!1,r()}}}function Ih(e){let t;return{c(){t=g("Log in with nsec")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Ch(e){let t;return{c(){t=g("Logging in...")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Eh(e){let t;return{c(){t=g("Deriving key...")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function xh(e){let t,n,i,r,s,o,a,l=e[15].slice(0,16)+"",f=e[15].slice(-8)+"";return{c(){t=p("div"),n=p("label"),n.textContent="Stored public key:",i=m(),r=p("code"),s=g(l),o=g("..."),a=g(f),b(n,"class","svelte-4xpfbi"),b(r,"class","npub-display svelte-4xpfbi"),b(t,"class","stored-info svelte-4xpfbi")},m(e,l){u(e,t,l),c(t,n),c(t,i),c(t,r),c(r,s),c(r,o),c(r,a)},p(e,t){32768&t[0]&&l!==(l=e[15].slice(0,16)+"")&&k(s,l),32768&t[0]&&f!==(f=e[15].slice(-8)+"")&&k(a,f)},d(e){e&&d(t)}}}function Sh(e){let t;return{c(){t=g("Unlock")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Bh(e){let t;return{c(){t=g("Unlocking...")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Qh(e){let t;return{c(){t=g("Deriving key...")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Fh(e){let t,n;return{c(){t=p("div"),n=g(e[10]),b(t,"class","message error-message svelte-4xpfbi")},m(e,i){u(e,t,i),c(t,n)},p(e,t){1024&t[0]&&k(n,e[10])},d(e){e&&d(t)}}}function Dh(e){let t,n;return{c(){t=p("div"),n=g(e[11]),b(t,"class","message success-message svelte-4xpfbi")},m(e,i){u(e,t,i),c(t,n)},p(e,t){2048&t[0]&&k(n,e[11])},d(e){e&&d(t)}}}function $h(e){let t,n,i,r,s,o,a,l,f,h,v,y=e[13].toFixed(1)+"";return{c(){t=p("div"),n=p("div"),i=p("div"),r=m(),s=p("h3"),s.textContent="Deriving encryption key",o=m(),a=p("div"),l=g(y),f=g("s"),h=m(),v=p("p"),v.textContent="This may take 3-6 seconds for security",b(i,"class","deriving-spinner svelte-4xpfbi"),b(s,"class","svelte-4xpfbi"),b(a,"class","deriving-timer svelte-4xpfbi"),b(v,"class","deriving-note svelte-4xpfbi"),b(n,"class","deriving-modal svelte-4xpfbi"),S(n,"dark-theme",e[1]),b(t,"class","deriving-overlay svelte-4xpfbi")},m(e,d){u(e,t,d),c(t,n),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),c(a,l),c(a,f),c(n,h),c(n,v)},p(e,t){8192&t[0]&&y!==(y=e[13].toFixed(1)+"")&&k(l,y),2&t[0]&&S(n,"dark-theme",e[1])},d(e){e&&d(t)}}}function Ph(t){let n,i,r,s,o=t[0]&&mh(t),a=t[9]&&$h(t);return{c(){o&&o.c(),n=m(),a&&a.c(),i=v()},m(e,l){o&&o.m(e,l),u(e,n,l),a&&a.m(e,l),u(e,i,l),r||(s=y(gh,"keydown",t[23]),r=!0)},p(e,t){e[0]?o?o.p(e,t):(o=mh(e),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null),e[9]?a?a.p(e,t):(a=$h(e),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},i:e,o:e,d(e){o&&o.d(e),e&&d(n),a&&a.d(e),e&&d(i),r=!1,s()}}}function Rh(e,t,n){const i=P();let{showModal:r=!1}=t,{isDarkTheme:s=!1}=t,o="extension",a="",l="",c="",u="",d=!1,f=!1,p=!1,h="",g="",m="",v="",y=0,w=null,b=null;function A(){n(13,y=0),w=performance.now(),k()}function k(){null!==w&&(n(13,y=(performance.now()-w)/1e3),b=requestAnimationFrame(k))}function I(){w=null,b&&(cancelAnimationFrame(b),b=null)}$(()=>{I()});let C=!1,E="";function x(){n(14,C=!!localStorage.getItem("nostr_privkey_encrypted")),n(15,E=localStorage.getItem("nostr_pubkey")||"")}function S(){n(0,r=!1),n(3,a=""),n(4,l=""),n(5,c=""),n(6,u=""),n(10,h=""),n(11,g=""),m="",n(12,v=""),i("close")}function B(e){n(2,o=e),n(10,h=""),n(11,g=""),m="",n(12,v="")}async function Q(){n(7,d=!0),n(10,h=""),n(11,g="");try{if(!a.trim())throw new Error("Please enter your nsec");if(!function(e){if(!e||!e.startsWith("nsec1"))return!1;try{return"nsec"===vu(e).type}catch{return!1}}(a.trim()))throw new Error("Invalid nsec format or checksum");if(l){if(l.length<8)throw new Error("Password must be at least 8 characters");if(l!==c)throw new Error("Passwords do not match")}const e=ff.fromKey(a.trim()),t=await e.getPublicKey();if(localStorage.setItem("nostr_auth_method","nsec"),localStorage.setItem("nostr_pubkey",t),l){n(9,p=!0),A();const e=await async function(e,t){if(!e.startsWith("nsec1"))throw new Error("Invalid nsec format - must start with nsec1");try{if("nsec"!==vu(e).type)throw new Error("Invalid nsec - wrong type")}catch(e){throw new Error("Invalid nsec - bech32 checksum failed")}const n=crypto.getRandomValues(new Uint8Array(32)),i=crypto.getRandomValues(new Uint8Array(12)),r=await hh(t,n),s=await crypto.subtle.importKey("raw",r,{name:"AES-GCM"},!1,["encrypt"]),o=new TextEncoder,a=await crypto.subtle.encrypt({name:"AES-GCM",iv:i},s,o.encode(e)),l=new Uint8Array(n.length+i.length+a.byteLength);return l.set(n,0),l.set(i,n.length),l.set(new Uint8Array(a),n.length+i.length),btoa(String.fromCharCode(...l))}(a.trim(),l);I(),n(9,p=!1),localStorage.setItem("nostr_privkey_encrypted",e),localStorage.removeItem("nostr_privkey")}else localStorage.setItem("nostr_privkey",a.trim()),localStorage.removeItem("nostr_privkey_encrypted"),n(11,g="Successfully logged in with nsec!");i("login",{method:"nsec",pubkey:t,privateKey:a.trim(),signer:e}),setTimeout(()=>{S()},1500)}catch(e){n(10,h=e.message)}finally{n(7,d=!1)}}D(()=>{x()});return e.$$set=e=>{"showModal"in e&&n(0,r=e.showModal),"isDarkTheme"in e&&n(1,s=e.isDarkTheme)},e.$$.update=()=>{1&e.$$.dirty[0]&&r&&x()},[r,s,o,a,l,c,u,d,f,p,h,g,v,y,C,E,function(){localStorage.removeItem("nostr_privkey_encrypted"),localStorage.removeItem("nostr_privkey"),localStorage.removeItem("nostr_pubkey"),localStorage.removeItem("nostr_auth_method"),n(14,C=!1),n(15,E=""),n(6,u=""),n(10,h=""),n(11,g="")},S,async function(){n(7,d=!0),n(9,p=!0),A(),n(10,h=""),n(11,g="");try{if(!u)throw new Error("Please enter your password");const e=localStorage.getItem("nostr_privkey_encrypted");if(!e)throw new Error("No encrypted key found");const t=await async function(e,t){const n=new Uint8Array(atob(e).split("").map(e=>e.charCodeAt(0)));if(n.length<60)throw new Error("Invalid encrypted data - too short");const i=n.slice(0,32),r=n.slice(32,44),s=n.slice(44),o=await hh(t,i),a=await crypto.subtle.importKey("raw",o,{name:"AES-GCM"},!1,["decrypt"]);let l;try{l=await crypto.subtle.decrypt({name:"AES-GCM",iv:r},a,s)}catch(e){throw new Error("Decryption failed - invalid password or corrupted data")}const c=(new TextDecoder).decode(l);if(!c.startsWith("nsec1"))throw new Error("Decryption produced invalid data - not an nsec");try{if("nsec"!==vu(c).type)throw new Error("Decryption produced invalid nsec type")}catch(e){throw new Error("Decryption produced invalid nsec - bech32 checksum failed")}return c}(e,u);I(),n(9,p=!1);const r=ff.fromKey(t),s=await r.getPublicKey();i("login",{method:"nsec",pubkey:s,privateKey:t,signer:r}),S()}catch(e){I(),e.message.includes("decrypt")||e.message.includes("tag")?n(10,h="Invalid password"):n(10,h=e.message)}finally{n(7,d=!1),n(9,p=!1),I()}},B,async function(){n(8,f=!0),n(10,h=""),n(11,g="");try{const e=Zc(),t=bu("nsec",e),i=wu(Xc(e));m=t,n(12,v=i),n(3,a=t),n(11,g="New key generated! Set an encryption password below to secure it.")}catch(e){n(10,h="Failed to generate key: "+e.message)}finally{n(8,f=!1)}},async function(){n(7,d=!0),n(10,h=""),n(11,g="");try{if(!window.nostr)throw new Error("No Nostr extension found. Please install a NIP-07 compatible extension like nos2x or Alby.");const e=await window.nostr.getPublicKey();e&&(localStorage.setItem("nostr_auth_method","extension"),localStorage.setItem("nostr_pubkey",e),n(11,g="Successfully logged in with extension!"),i("login",{method:"extension",pubkey:e,signer:window.nostr}),setTimeout(()=>{S()},1500))}catch(e){n(10,h=e.message)}finally{n(7,d=!1)}},Q,function(e){"Escape"===e.key&&S(),"Enter"===e.key&&"nsec"===o&&Q()},function(t){R.call(this,e,t)},function(t){R.call(this,e,t)},()=>B("extension"),()=>B("nsec"),function(){u=this.value,n(6,u)},function(){a=this.value,n(3,a)},function(){l=this.value,n(4,l)},function(){c=this.value,n(5,c)},e=>"Escape"===e.key&&S()]}class Th extends se{constructor(e){super(),re(this,e,Rh,Ph,s,{showModal:0,isDarkTheme:1},null,[-1,-1])}}function Uh(e,t,n){const i=e.slice();return i[72]=t[n],i}function _h(e,t,n){const i=e.slice();return i[75]=t[n],i}function Nh(e,t,n){const i=e.slice();return i[72]=t[n],i}function Lh(e,t,n){const i=e.slice();return i[72]=t[n],i}function Oh(e,t,n){const i=e.slice();return i[72]=t[n],i}function Mh(e,t,n){const i=e.slice();return i[72]=t[n],i}function jh(e,t,n){const i=e.slice();return i[72]=t[n],i}function Hh(e){let t,n,i;return{c(){t=p("div"),n=g(e[3]),b(t,"class",i="message "+e[4]+" svelte-1y8wjwc")},m(e,i){u(e,t,i),c(t,n)},p(e,r){8&r[0]&&k(n,e[3]),16&r[0]&&i!==(i="message "+e[4]+" svelte-1y8wjwc")&&b(t,"class",i)},d(e){e&&d(t)}}}function Gh(e){let t,n,r,s,o,a,l,f,h,v,w,A,k,C,E,x,S,B,Q,F,D,$,P,R,T,U,_,N;function L(e,t){return e[5]&&e[5].length>0?Kh:Jh}let O=L(e),M=O(e);function j(e,t){return e[8]&&e[8].length>0?Wh:Yh}let H=j(e),G=H(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Banned Pubkeys",s=m(),o=p("div"),a=p("input"),l=m(),f=p("input"),h=m(),v=p("button"),w=g("Ban Pubkey"),A=m(),k=p("div"),M.c(),C=m(),E=p("div"),x=p("h3"),x.textContent="Allowed Pubkeys",S=m(),B=p("div"),Q=p("input"),F=m(),D=p("input"),$=m(),P=p("button"),R=g("Allow Pubkey"),T=m(),U=p("div"),G.c(),b(r,"class","svelte-1y8wjwc"),b(a,"type","text"),b(a,"placeholder","Pubkey (64 hex chars)"),b(a,"class","svelte-1y8wjwc"),b(f,"type","text"),b(f,"placeholder","Reason (optional)"),b(f,"class","svelte-1y8wjwc"),v.disabled=e[2],b(v,"class","svelte-1y8wjwc"),b(o,"class","add-form svelte-1y8wjwc"),b(k,"class","list svelte-1y8wjwc"),b(n,"class","section svelte-1y8wjwc"),b(x,"class","svelte-1y8wjwc"),b(Q,"type","text"),b(Q,"placeholder","Pubkey (64 hex chars)"),b(Q,"class","svelte-1y8wjwc"),b(D,"type","text"),b(D,"placeholder","Reason (optional)"),b(D,"class","svelte-1y8wjwc"),P.disabled=e[2],b(P,"class","svelte-1y8wjwc"),b(B,"class","add-form svelte-1y8wjwc"),b(U,"class","list svelte-1y8wjwc"),b(E,"class","section svelte-1y8wjwc"),b(t,"class","pubkeys-section")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),I(a,e[6]),c(o,l),c(o,f),I(f,e[7]),c(o,h),c(o,v),c(v,w),c(n,A),c(n,k),M.m(k,null),c(t,C),c(t,E),c(E,x),c(E,S),c(E,B),c(B,Q),I(Q,e[9]),c(B,F),c(B,D),I(D,e[10]),c(B,$),c(B,P),c(P,R),c(E,T),c(E,U),G.m(U,null),_||(N=[y(a,"input",e[43]),y(f,"input",e[44]),y(v,"click",e[25]),y(Q,"input",e[45]),y(D,"input",e[46]),y(P,"click",e[26])],_=!0)},p(e,t){64&t[0]&&a.value!==e[6]&&I(a,e[6]),128&t[0]&&f.value!==e[7]&&I(f,e[7]),4&t[0]&&(v.disabled=e[2]),O===(O=L(e))&&M?M.p(e,t):(M.d(1),M=O(e),M&&(M.c(),M.m(k,null))),512&t[0]&&Q.value!==e[9]&&I(Q,e[9]),1024&t[0]&&D.value!==e[10]&&I(D,e[10]),4&t[0]&&(P.disabled=e[2]),H===(H=j(e))&&G?G.p(e,t):(G.d(1),G=H(e),G&&(G.c(),G.m(U,null)))},d(e){e&&d(t),M.d(),G.d(),_=!1,i(N)}}}function Jh(t){let n;return{c(){n=p("div"),n.innerHTML="

    No banned pubkeys configured.

    ",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Kh(e){let t,n=e[5],i=[];for(let t=0;tNo allowed pubkeys configured.

    ",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Wh(e){let t,n=e[8],i=[];for(let t=0;t0?tg:eg}let O=L(e),M=O(e);let j=function(e){return e[22]&&e[22].length>0?sg:rg}(e),H=j(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Banned Events",s=m(),o=p("div"),a=p("input"),l=m(),f=p("input"),h=m(),v=p("button"),w=g("Ban Event"),A=m(),k=p("div"),M.c(),C=m(),E=p("div"),x=p("h3"),x.textContent="Allowed Events",S=m(),B=p("div"),Q=p("input"),F=m(),D=p("input"),$=m(),P=p("button"),R=g("Allow Event"),T=m(),U=p("div"),H.c(),b(r,"class","svelte-1y8wjwc"),b(a,"type","text"),b(a,"placeholder","Event ID (64 hex chars)"),b(a,"class","svelte-1y8wjwc"),b(f,"type","text"),b(f,"placeholder","Reason (optional)"),b(f,"class","svelte-1y8wjwc"),v.disabled=e[2],b(v,"class","svelte-1y8wjwc"),b(o,"class","add-form svelte-1y8wjwc"),b(k,"class","list svelte-1y8wjwc"),b(n,"class","section svelte-1y8wjwc"),b(x,"class","svelte-1y8wjwc"),b(Q,"type","text"),b(Q,"placeholder","Event ID (64 hex chars)"),b(Q,"class","svelte-1y8wjwc"),b(D,"type","text"),b(D,"placeholder","Reason (optional)"),b(D,"class","svelte-1y8wjwc"),P.disabled=e[2],b(P,"class","svelte-1y8wjwc"),b(B,"class","add-form svelte-1y8wjwc"),b(U,"class","list svelte-1y8wjwc"),b(E,"class","section svelte-1y8wjwc"),b(t,"class","events-section")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),I(a,e[12]),c(o,l),c(o,f),I(f,e[13]),c(o,h),c(o,v),c(v,w),c(n,A),c(n,k),M.m(k,null),c(t,C),c(t,E),c(E,x),c(E,S),c(E,B),c(B,Q),I(Q,e[14]),c(B,F),c(B,D),I(D,e[15]),c(B,$),c(B,P),c(P,R),c(E,T),c(E,U),H.m(U,null),_||(N=[y(a,"input",e[47]),y(f,"input",e[48]),y(v,"click",e[27]),y(Q,"input",e[49]),y(D,"input",e[50]),y(P,"click",e[28])],_=!0)},p(e,t){4096&t[0]&&a.value!==e[12]&&I(a,e[12]),8192&t[0]&&f.value!==e[13]&&I(f,e[13]),4&t[0]&&(v.disabled=e[2]),O===(O=L(e))&&M?M.p(e,t):(M.d(1),M=O(e),M&&(M.c(),M.m(k,null))),16384&t[0]&&Q.value!==e[14]&&I(Q,e[14]),32768&t[0]&&D.value!==e[15]&&I(D,e[15]),4&t[0]&&(P.disabled=e[2]),H.p(e,t)},d(e){e&&d(t),M.d(),H.d(),_=!1,i(N)}}}function eg(t){let n;return{c(){n=p("div"),n.innerHTML="

    No banned events configured.

    ",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function tg(e){let t,n=e[11],i=[];for(let t=0;tNo allowed events configured.

    ",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function sg(e){let t,n=e[22],i=[];for(let t=0;t0?cg:lg}let S=x(e),B=S(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Blocked IPs",s=m(),o=p("div"),a=p("input"),l=m(),f=p("input"),h=m(),v=p("button"),w=g("Block IP"),A=m(),k=p("div"),B.c(),b(r,"class","svelte-1y8wjwc"),b(a,"type","text"),b(a,"placeholder","IP Address"),b(a,"class","svelte-1y8wjwc"),b(f,"type","text"),b(f,"placeholder","Reason (optional)"),b(f,"class","svelte-1y8wjwc"),v.disabled=e[2],b(v,"class","svelte-1y8wjwc"),b(o,"class","add-form svelte-1y8wjwc"),b(k,"class","list svelte-1y8wjwc"),b(n,"class","section svelte-1y8wjwc"),b(t,"class","ips-section")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),I(a,e[17]),c(o,l),c(o,f),I(f,e[18]),c(o,h),c(o,v),c(v,w),c(n,A),c(n,k),B.m(k,null),C||(E=[y(a,"input",e[51]),y(f,"input",e[52]),y(v,"click",e[29])],C=!0)},p(e,t){131072&t[0]&&a.value!==e[17]&&I(a,e[17]),262144&t[0]&&f.value!==e[18]&&I(f,e[18]),4&t[0]&&(v.disabled=e[2]),S===(S=x(e))&&B?B.p(e,t):(B.d(1),B=S(e),B&&(B.c(),B.m(k,null)))},d(e){e&&d(t),B.d(),C=!1,i(E)}}}function lg(t){let n;return{c(){n=p("div"),n.innerHTML="

    No blocked IPs configured.

    ",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function cg(e){let t,n=e[16],i=[];for(let t=0;t0?hg:pg}let x=E(e),S=x(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Allowed Event Kinds",s=m(),o=p("div"),a=p("input"),l=m(),f=p("button"),h=g("Allow Kind"),v=m(),w=p("div"),S.c(),b(r,"class","svelte-1y8wjwc"),b(a,"type","number"),b(a,"placeholder","Kind number"),b(a,"class","svelte-1y8wjwc"),f.disabled=e[2],b(f,"class","svelte-1y8wjwc"),b(o,"class","add-form svelte-1y8wjwc"),b(w,"class","list svelte-1y8wjwc"),b(n,"class","section svelte-1y8wjwc"),b(t,"class","kinds-section")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),I(a,e[20]),c(o,l),c(o,f),c(f,h),c(n,v),c(n,w),S.m(w,null),k||(C=[y(a,"input",e[53]),y(f,"click",e[30])],k=!0)},p(e,t){1048576&t[0]&&A(a.value)!==e[20]&&I(a,e[20]),4&t[0]&&(f.disabled=e[2]),x===(x=E(e))&&S?S.p(e,t):(S.d(1),S=x(e),S&&(S.c(),S.m(w,null)))},d(e){e&&d(t),S.d(),k=!1,i(C)}}}function pg(t){let n;return{c(){n=p("div"),n.innerHTML="

    No allowed kinds configured. All kinds are\n allowed by default.

    ",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function hg(e){let t,n=e[19],i=[];for(let t=0;t0?yg:vg}let w=v(e),A=w(e);return{c(){t=p("div"),n=p("div"),i=p("h3"),i.textContent="Events Needing Moderation",r=m(),s=p("button"),o=g("Refresh"),a=m(),l=p("div"),A.c(),b(i,"class","svelte-1y8wjwc"),s.disabled=e[2],b(l,"class","list svelte-1y8wjwc"),b(n,"class","section svelte-1y8wjwc"),b(t,"class","moderation-section")},m(d,p){u(d,t,p),c(t,n),c(n,i),c(n,r),c(n,s),c(s,o),c(n,a),c(n,l),A.m(l,null),f||(h=y(s,"click",e[24]),f=!0)},p(e,t){4&t[0]&&(s.disabled=e[2]),w===(w=v(e))&&A?A.p(e,t):(A.d(1),A=w(e),A&&(A.c(),A.m(l,null)))},d(e){e&&d(t),A.d(),f=!1,h()}}}function vg(t){let n;return{c(){n=p("div"),n.innerHTML="

    No events need moderation at this time.

    ",b(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function yg(e){let t,n=e[21],i=[];for(let t=0;tManaged ACL Configuration \n

    Configure access control using NIP-86 management API

    \n
    Owner Only: This interface is restricted to relay owners\n only.
    ',s=m(),q&&q.c(),o=m(),a=p("div"),l=p("button"),f=g("Pubkeys"),v=m(),w=p("button"),A=g("Events"),I=m(),C=p("button"),E=g("IPs"),S=m(),B=p("button"),Q=g("Kinds"),D=m(),$=p("button"),P=g("Moderation"),T=m(),U=p("button"),_=g("Relay Config"),L=m(),O=p("div"),Y&&Y.c(),M=m(),W&&W.c(),j=m(),z&&z.c(),H=m(),Z&&Z.c(),G=m(),X&&X.c(),J=m(),ee&&ee.c(),b(r,"class","header svelte-1y8wjwc"),b(l,"class",h="tab "+("pubkeys"===t[1]?"active":"")+" svelte-1y8wjwc"),b(w,"class",k="tab "+("events"===t[1]?"active":"")+" svelte-1y8wjwc"),b(C,"class",x="tab "+("ips"===t[1]?"active":"")+" svelte-1y8wjwc"),b(B,"class",F="tab "+("kinds"===t[1]?"active":"")+" svelte-1y8wjwc"),b($,"class",R="tab "+("moderation"===t[1]?"active":"")+" svelte-1y8wjwc"),b(U,"class",N="tab "+("relay"===t[1]?"active":"")+" svelte-1y8wjwc"),b(a,"class","tabs svelte-1y8wjwc"),b(O,"class","tab-content svelte-1y8wjwc")},m(e,i){u(e,n,i),c(n,r),c(n,s),q&&q.m(n,null),c(n,o),c(n,a),c(a,l),c(l,f),c(a,v),c(a,w),c(w,A),c(a,I),c(a,C),c(C,E),c(a,S),c(a,B),c(B,Q),c(a,D),c(a,$),c($,P),c(a,T),c(a,U),c(U,_),c(n,L),c(n,O),Y&&Y.m(O,null),c(O,M),W&&W.m(O,null),c(O,j),z&&z.m(O,null),c(O,H),Z&&Z.m(O,null),c(O,G),X&&X.m(O,null),c(O,J),ee&&ee.m(O,null),K||(V=[y(l,"click",t[37]),y(w,"click",t[38]),y(C,"click",t[39]),y(B,"click",t[40]),y($,"click",t[41]),y(U,"click",t[42])],K=!0)},p(e,t){e[3]?q?q.p(e,t):(q=Hh(e),q.c(),q.m(n,o)):q&&(q.d(1),q=null),2&t[0]&&h!==(h="tab "+("pubkeys"===e[1]?"active":"")+" svelte-1y8wjwc")&&b(l,"class",h),2&t[0]&&k!==(k="tab "+("events"===e[1]?"active":"")+" svelte-1y8wjwc")&&b(w,"class",k),2&t[0]&&x!==(x="tab "+("ips"===e[1]?"active":"")+" svelte-1y8wjwc")&&b(C,"class",x),2&t[0]&&F!==(F="tab "+("kinds"===e[1]?"active":"")+" svelte-1y8wjwc")&&b(B,"class",F),2&t[0]&&R!==(R="tab "+("moderation"===e[1]?"active":"")+" svelte-1y8wjwc")&&b($,"class",R),2&t[0]&&N!==(N="tab "+("relay"===e[1]?"active":"")+" svelte-1y8wjwc")&&b(U,"class",N),"pubkeys"===e[1]?Y?Y.p(e,t):(Y=Gh(e),Y.c(),Y.m(O,M)):Y&&(Y.d(1),Y=null),"events"===e[1]?W?W.p(e,t):(W=Xh(e),W.c(),W.m(O,j)):W&&(W.d(1),W=null),"ips"===e[1]?z?z.p(e,t):(z=ag(e),z.c(),z.m(O,H)):z&&(z.d(1),z=null),"kinds"===e[1]?Z?Z.p(e,t):(Z=fg(e),Z.c(),Z.m(O,G)):Z&&(Z.d(1),Z=null),"moderation"===e[1]?X?X.p(e,t):(X=mg(e),X.c(),X.m(O,J)):X&&(X.d(1),X=null),"relay"===e[1]?ee?ee.p(e,t):(ee=Ag(e),ee.c(),ee.m(O,null)):ee&&(ee.d(1),ee=null)},i:e,o:e,d(e){e&&d(n),q&&q.d(),Y&&Y.d(),W&&W.d(),z&&z.d(),Z&&Z.d(),X&&X.d(),ee&&ee.d(),K=!1,i(V)}}}function Eg(e,t,n){let{userSigner:i}=t,{userPubkey:r}=t,s="pubkeys",o=!1,a="",l="info",c=[],u="",d="",f=[],p="",h="",g=[],m="",v="",y="",w="",b=[],k="",I="",C=[],E="",x=[],S={relay_name:"",relay_description:"",relay_icon:""};async function B(){try{n(2,o=!0),console.log("Fetching relay info from /");const e=await fetch(window.location.origin+"/",{headers:{Accept:"application/nostr+json"}});if(console.log("Response status:",e.status),console.log("Response headers:",e.headers),e.ok){const t=await e.json();console.log("Raw relay info:",t),n(0,S={relay_name:t.name||"",relay_description:t.description||"",relay_icon:t.icon||""}),console.log("Updated relayConfig:",S),console.log("Loaded relay info:",t),n(3,a="Relay configuration loaded successfully"),n(4,l="success")}else console.error("Failed to fetch relay info, status:",e.status),n(3,a=`Failed to fetch relay info: ${e.status}`),n(4,l="error")}catch(e){console.error("Failed to fetch relay info:",e),n(3,a=`Failed to fetch relay info: ${e.message}`),n(4,l="error")}finally{n(2,o=!1)}}async function Q(e,t=[]){try{n(2,o=!0),n(3,a="");const s={method:e,params:t},l=await async function(e,t){if(!i)throw new Error("No signer available for authentication. Please log in with a Nostr extension.");if(!r)throw new Error("No user pubkey available for authentication.");const n=window.location.origin+t,s={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",n],["method",e]],content:"",pubkey:r},o=await i.signEvent(s),a=JSON.stringify(o);return`Nostr ${btoa(a)}`}("POST","/api/nip86"),c=await fetch("/api/nip86",{method:"POST",headers:{"Content-Type":"application/nostr+json+rpc",Authorization:l},body:JSON.stringify(s)});if(!c.ok)throw new Error(`HTTP ${c.status}: ${c.statusText}`);const u=await c.json();if(u.error)throw new Error(u.error);return u.result}catch(e){throw console.error("NIP-86 API error:",e),n(3,a=e.message),n(4,l="error"),e}finally{n(2,o=!1)}}async function F(){try{n(5,c=await Q("listbannedpubkeys"))}catch(e){console.error("Failed to load banned pubkeys:",e)}}async function $(){try{n(8,f=await Q("listallowedpubkeys"))}catch(e){console.error("Failed to load allowed pubkeys:",e)}}async function P(){try{n(11,g=await Q("listbannedevents"))}catch(e){console.error("Failed to load banned events:",e)}}async function R(){try{n(16,b=await Q("listblockedips"))}catch(e){console.error("Failed to load blocked IPs:",e)}}async function T(){try{n(19,C=await Q("listallowedkinds"))}catch(e){console.error("Failed to load allowed kinds:",e)}}async function U(){try{n(2,o=!0),n(21,x=await Q("listeventsneedingmoderation")),console.log("Loaded events needing moderation:",x)}catch(e){console.error("Failed to load events needing moderation:",e),n(3,a=`Failed to load moderation events: ${e.message}`),n(4,l="error"),n(21,x=[])}finally{n(2,o=!1)}}async function _(e){try{await Q("disallowkind",[e]),n(3,a="Kind disallowed successfully"),n(4,l="success"),await T()}catch(e){console.error("Failed to disallow kind:",e)}}async function N(e){try{await Q("allowevent",[e,"Approved from moderation queue"]),n(3,a="Event allowed successfully"),n(4,l="success"),await U()}catch(e){console.error("Failed to allow event from moderation:",e)}}async function L(e){try{await Q("banevent",[e,"Banned from moderation queue"]),n(3,a="Event banned successfully"),n(4,l="success"),await U()}catch(e){console.error("Failed to ban event from moderation:",e)}}D(()=>{setTimeout(()=>{B()},100)}),async function(){await Promise.all([F(),$(),P(),R(),T()])}();return e.$$set=e=>{"userSigner"in e&&n(35,i=e.userSigner),"userPubkey"in e&&n(36,r=e.userPubkey)},e.$$.update=()=>{1&e.$$.dirty[0]&&console.log("relayConfig changed:",S)},[S,s,o,a,l,c,u,d,f,p,h,g,m,v,y,w,b,k,I,C,E,x,[],B,U,async function(){if(u)try{await Q("banpubkey",[u,d]),n(3,a="Pubkey banned successfully"),n(4,l="success"),n(6,u=""),n(7,d=""),await F()}catch(e){console.error("Failed to ban pubkey:",e)}},async function(){if(p)try{await Q("allowpubkey",[p,h]),n(3,a="Pubkey allowed successfully"),n(4,l="success"),n(9,p=""),n(10,h=""),await $()}catch(e){console.error("Failed to allow pubkey:",e)}},async function(){if(m)try{await Q("banevent",[m,v]),n(3,a="Event banned successfully"),n(4,l="success"),n(12,m=""),n(13,v=""),await P()}catch(e){console.error("Failed to ban event:",e)}},async function(){if(y)try{await Q("allowevent",[y,w]),n(3,a="Event allowed successfully"),n(4,l="success"),n(14,y=""),n(15,w="")}catch(e){console.error("Failed to allow event:",e)}},async function(){if(k)try{await Q("blockip",[k,I]),n(3,a="IP blocked successfully"),n(4,l="success"),n(17,k=""),n(18,I=""),await R()}catch(e){console.error("Failed to block IP:",e)}},async function(){if(!E)return;const e=parseInt(E);if(isNaN(e))return n(3,a="Invalid kind number"),void n(4,l="error");try{await Q("allowkind",[e]),n(3,a="Kind allowed successfully"),n(4,l="success"),n(20,E=""),await T()}catch(e){console.error("Failed to allow kind:",e)}},_,async function(){try{n(2,o=!0),n(3,a="");const e=[];if(S.relay_name&&e.push(Q("changerelayname",[S.relay_name])),S.relay_description&&e.push(Q("changerelaydescription",[S.relay_description])),S.relay_icon&&e.push(Q("changerelayicon",[S.relay_icon])),0===e.length)return n(3,a="No changes to update"),void n(4,l="info");await Promise.all(e),n(3,a="Relay configuration updated successfully"),n(4,l="success"),await B()}catch(e){console.error("Failed to update relay configuration:",e),n(3,a=`Failed to update relay configuration: ${e.message}`),n(4,l="error")}finally{n(2,o=!1)}},N,L,i,r,()=>n(1,s="pubkeys"),()=>n(1,s="events"),()=>n(1,s="ips"),()=>n(1,s="kinds"),()=>{n(1,s="moderation"),x&&0!==x.length||U()},()=>n(1,s="relay"),function(){u=this.value,n(6,u)},function(){d=this.value,n(7,d)},function(){p=this.value,n(9,p)},function(){h=this.value,n(10,h)},function(){m=this.value,n(12,m)},function(){v=this.value,n(13,v)},function(){y=this.value,n(14,y)},function(){w=this.value,n(15,w)},function(){k=this.value,n(17,k)},function(){I=this.value,n(18,I)},function(){E=A(this.value),n(20,E)},e=>_(e),e=>N(e.id),e=>L(e.id),function(){S.relay_name=this.value,n(0,S)},function(){S.relay_description=this.value,n(0,S)},function(){S.relay_icon=this.value,n(0,S)}]}class xg extends se{constructor(e){super(),re(this,e,Eg,Cg,s,{userSigner:35,userPubkey:36},null,[-1,-1,-1])}}function Sg(e){let t,n;return{c(){t=p("span"),n=g(e[3]),b(t,"class","permission-badge svelte-1qkhxam")},m(e,i){u(e,t,i),c(t,n)},p(e,t){8&t&&k(n,e[3])},d(e){e&&d(t)}}}function Bg(t){let n,i,r;return{c(){n=p("button"),n.textContent="Log in",b(n,"class","login-btn svelte-1qkhxam")},m(e,s){u(e,n,s),i||(r=y(n,"click",t[7]),i=!0)},p:e,d(e){e&&d(n),i=!1,r()}}}function Qg(e){let t,n,i,r,s,o,a=(e[4]?.name||e[5])+"";function l(e,t){return e[4]?.picture?Dg:Fg}let f=l(e),h=f(e);return{c(){t=p("button"),h.c(),n=m(),i=p("span"),r=g(a),b(i,"class","user-name svelte-1qkhxam"),b(t,"class","user-profile-btn svelte-1qkhxam")},m(a,l){u(a,t,l),h.m(t,null),c(t,n),c(t,i),c(i,r),s||(o=y(t,"click",e[6]),s=!0)},p(e,i){f===(f=l(e))&&h?h.p(e,i):(h.d(1),h=f(e),h&&(h.c(),h.m(t,n))),48&i&&a!==(a=(e[4]?.name||e[5])+"")&&k(r,a)},d(e){e&&d(t),h.d(),s=!1,o()}}}function Fg(t){let n;return{c(){n=p("div"),n.textContent="👤",b(n,"class","user-avatar-placeholder svelte-1qkhxam")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Dg(e){let t,n;return{c(){t=p("img"),a(t.src,n=e[4].picture)||b(t,"src",n),b(t,"alt","User avatar"),b(t,"class","user-avatar svelte-1qkhxam")},m(e,n){u(e,t,n)},p(e,i){16&i&&!a(t.src,n=e[4].picture)&&b(t,"src",n)},d(e){e&&d(t)}}}function $g(t){let n,i,r,s,o,l,f,h,v,y,w=t[1]&&t[2]&&Sg(t);function A(e,t){return e[1]?Qg:Bg}let k=A(t),I=k(t);return{c(){n=p("header"),i=p("div"),r=p("img"),o=m(),l=p("div"),f=p("span"),h=g("ORLY? dashboard\n "),w&&w.c(),v=m(),y=p("div"),I.c(),a(r.src,s="/orly.png")||b(r,"src","/orly.png"),b(r,"alt","ORLY Logo"),b(r,"class","logo svelte-1qkhxam"),b(f,"class","app-title svelte-1qkhxam"),b(l,"class","header-title svelte-1qkhxam"),b(y,"class","header-buttons svelte-1qkhxam"),b(i,"class","header-content svelte-1qkhxam"),b(n,"class","main-header svelte-1qkhxam"),S(n,"dark-theme",t[0])},m(e,t){u(e,n,t),c(n,i),c(i,r),c(i,o),c(i,l),c(l,f),c(f,h),w&&w.m(f,null),c(i,v),c(i,y),I.m(y,null)},p(e,[t]){e[1]&&e[2]?w?w.p(e,t):(w=Sg(e),w.c(),w.m(f,null)):w&&(w.d(1),w=null),k===(k=A(e))&&I?I.p(e,t):(I.d(1),I=k(e),I&&(I.c(),I.m(y,null))),1&t&&S(n,"dark-theme",e[0])},i:e,o:e,d(e){e&&d(n),w&&w.d(),I.d()}}}function Pg(e,t,n){let{isDarkTheme:i=!1}=t,{isLoggedIn:r=!1}=t,{userRole:s=""}=t,{currentEffectiveRole:o=""}=t,{userProfile:a=null}=t,{userPubkey:l=""}=t;const c=P();return e.$$set=e=>{"isDarkTheme"in e&&n(0,i=e.isDarkTheme),"isLoggedIn"in e&&n(1,r=e.isLoggedIn),"userRole"in e&&n(2,s=e.userRole),"currentEffectiveRole"in e&&n(3,o=e.currentEffectiveRole),"userProfile"in e&&n(4,a=e.userProfile),"userPubkey"in e&&n(5,l=e.userPubkey)},[i,r,s,o,a,l,function(){c("openSettingsDrawer")},function(){c("openLoginModal")}]}class Rg extends se{constructor(e){super(),re(this,e,Pg,$g,s,{isDarkTheme:0,isLoggedIn:1,userRole:2,currentEffectiveRole:3,userProfile:4,userPubkey:5})}}function Tg(e,t,n){const i=e.slice();return i[10]=t[n],i}function Ug(e){let t,n,r;function s(){return e[6](e[10])}function o(...t){return e[7](e[10],...t)}return{c(){t=p("span"),t.textContent="✕",b(t,"class","tab-close-icon svelte-wfmuj"),b(t,"role","button"),b(t,"tabindex","0")},m(e,i){u(e,t,i),n||(r=[y(t,"click",w(s)),y(t,"keydown",o)],n=!0)},p(t,n){e=t},d(e){e&&d(t),n=!1,i(r)}}}function _g(e){let t,n,i,r,s,o,a,l,f,h,v=e[10].icon+"",w=e[10].label+"",A=e[10].isSearchTab&&Ug(e);function I(){return e[8](e[10])}return{c(){t=p("button"),n=p("span"),i=g(v),r=m(),s=p("span"),o=g(w),a=m(),A&&A.c(),l=m(),b(n,"class","tab-icon svelte-wfmuj"),b(s,"class","tab-label svelte-wfmuj"),b(t,"class","tab svelte-wfmuj"),S(t,"active",e[2]===e[10].id)},m(e,d){u(e,t,d),c(t,n),c(n,i),c(t,r),c(t,s),c(s,o),c(t,a),A&&A.m(t,null),c(t,l),f||(h=y(t,"click",I),f=!0)},p(n,r){e=n,2&r&&v!==(v=e[10].icon+"")&&k(i,v),2&r&&w!==(w=e[10].label+"")&&k(o,w),e[10].isSearchTab?A?A.p(e,r):(A=Ug(e),A.c(),A.m(t,l)):A&&(A.d(1),A=null),6&r&&S(t,"active",e[2]===e[10].id)},d(e){e&&d(t),A&&A.d(),f=!1,h()}}}function Ng(e){let t,n,i,r,s,o,a,l;return{c(){t=p("a"),n=h("svg"),i=h("path"),r=h("path"),s=m(),o=p("span"),a=g("v"),l=g(e[3]),b(i,"d","M5 6h12v2h1.5c1.38 0 2.5 1.12 2.5 2.5v1c0 1.38-1.12 2.5-2.5 2.5H17v1c0 1.66-1.34 3-3 3H8c-1.66 0-3-1.34-3-3V6zm12 6h1.5c.28 0 .5-.22.5-.5v-1c0-.28-.22-.5-.5-.5H17v2z"),b(r,"d","M9 9c1.5 0 3 .5 3 2.5S10.5 14 9 14c0-1.5.5-3.5 2-4.5"),b(r,"stroke","currentColor"),b(r,"stroke-width","1"),b(r,"fill","none"),b(n,"class","version-icon svelte-wfmuj"),b(n,"viewBox","0 0 24 24"),b(n,"fill","currentColor"),b(n,"xmlns","http://www.w3.org/2000/svg"),b(o,"class","version-text svelte-wfmuj"),b(t,"href","https://next.orly.dev"),b(t,"target","_blank"),b(t,"rel","noopener noreferrer"),b(t,"class","version-link svelte-wfmuj")},m(e,d){u(e,t,d),c(t,n),c(n,i),c(n,r),c(t,s),c(t,o),c(o,a),c(o,l)},p(e,t){8&t&&k(l,e[3])},d(e){e&&d(t)}}}function Lg(t){let n,i,r,s,o=t[1],a=[];for(let e=0;e{"isDarkTheme"in e&&n(0,i=e.isDarkTheme),"tabs"in e&&n(1,r=e.tabs),"selectedTab"in e&&n(2,s=e.selectedTab),"version"in e&&n(3,o=e.version)},[i,r,s,o,l,c,e=>c(e.id),(e,t)=>"Enter"===t.key&&c(e.id),e=>l(e.id)]}class Mg extends se{constructor(e){super(),re(this,e,Og,Lg,s,{isDarkTheme:0,tabs:1,selectedTab:2,version:3})}}function jg(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in to access export functionality.",r=m(),s=p("button"),s.textContent="Log In",b(i,"class","svelte-jzrdtj"),b(s,"class","login-btn svelte-jzrdtj"),b(n,"class","login-prompt svelte-jzrdtj")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[5]),o=!0)},p:e,d(e){e&&d(n),o=!1,a()}}}function Hg(e){let t,n,i=e[0]&&Gg(e),r=e[1]&&Jg(e);return{c(){i&&i.c(),t=m(),r&&r.c(),n=v()},m(e,s){i&&i.m(e,s),u(e,t,s),r&&r.m(e,s),u(e,n,s)},p(e,s){e[0]?i?i.p(e,s):(i=Gg(e),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),e[1]?r?r.p(e,s):(r=Jg(e),r.c(),r.m(n.parentNode,n)):r&&(r.d(1),r=null)},d(e){i&&i.d(e),e&&d(t),r&&r.d(e),e&&d(n)}}}function Gg(t){let n,i,r,s,o,a,l,f;return{c(){n=p("div"),i=p("h3"),i.textContent="Export My Events",r=m(),s=p("p"),s.textContent="Download your personal events as a JSONL file.",o=m(),a=p("button"),a.textContent="📤 Export My Events",b(i,"class","svelte-jzrdtj"),b(s,"class","svelte-jzrdtj"),b(a,"class","export-btn svelte-jzrdtj"),b(n,"class","export-section svelte-jzrdtj")},m(e,d){u(e,n,d),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),l||(f=y(a,"click",t[3]),l=!0)},p:e,d(e){e&&d(n),l=!1,f()}}}function Jg(t){let n,i,r,s,o,a,l,f;return{c(){n=p("div"),i=p("h3"),i.textContent="Export All Events",r=m(),s=p("p"),s.textContent="Download the complete database as a JSONL file. This includes\n all events from all users.",o=m(),a=p("button"),a.textContent="📤 Export All Events",b(i,"class","svelte-jzrdtj"),b(s,"class","svelte-jzrdtj"),b(a,"class","export-btn svelte-jzrdtj"),b(n,"class","export-section svelte-jzrdtj")},m(e,d){u(e,n,d),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),l||(f=y(a,"click",t[4]),l=!0)},p:e,d(e){e&&d(n),l=!1,f()}}}function Kg(t){let n;function i(e,t){return e[2]?Hg:jg}let r=i(t),s=r(t);return{c(){s.c(),n=v()},m(e,t){s.m(e,t),u(e,n,t)},p(e,[t]){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n.parentNode,n)))},i:e,o:e,d(e){s.d(e),e&&d(n)}}}function Vg(e,t,n){let i,r,{isLoggedIn:s=!1}=t,{currentEffectiveRole:o=""}=t,{aclMode:a=""}=t;const l=P();return e.$$set=e=>{"isLoggedIn"in e&&n(0,s=e.isLoggedIn),"currentEffectiveRole"in e&&n(6,o=e.currentEffectiveRole),"aclMode"in e&&n(7,a=e.aclMode)},e.$$.update=()=>{129&e.$$.dirty&&n(2,i="none"===a||s),192&e.$$.dirty&&n(1,r="none"===a||"admin"===o||"owner"===o)},[s,r,i,function(){l("exportMyEvents")},function(){l("exportAllEvents")},function(){l("openLoginModal")},o,a]}class qg extends se{constructor(e){super(),re(this,e,Vg,Kg,s,{isLoggedIn:0,currentEffectiveRole:6,aclMode:7})}}function Yg(t){let n,i,r,s,o,a,l,f;return{c(){n=p("div"),i=p("h3"),i.textContent="Import Events",r=m(),s=p("p"),s.textContent="Please log in to access import functionality.",o=m(),a=p("button"),a.textContent="Log In",b(i,"class","recovery-header svelte-nonyqh"),b(s,"class","recovery-description svelte-nonyqh"),b(a,"class","login-btn svelte-nonyqh"),b(n,"class","login-prompt svelte-nonyqh")},m(e,d){u(e,n,d),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),l||(f=y(a,"click",t[6]),l=!0)},p:e,d(e){e&&d(n),l=!1,f()}}}function Wg(t){let n;return{c(){n=p("div"),n.innerHTML='

    Import Events

    \n

    Admin or owner permission required for import functionality.

    ',b(n,"class","permission-denied svelte-nonyqh")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function zg(e){let t,n,r,s,o,a,l,f,h,v,w,A,k,I,C=e[2]&&Zg(e);return{c(){t=p("h3"),t.textContent="Import Events",n=m(),r=p("p"),r.textContent="Upload a JSONL file to import events into the database.",s=m(),o=p("div"),a=p("input"),l=m(),f=p("div"),h=p("button"),v=g("Import Events"),A=m(),C&&C.c(),b(t,"class","svelte-nonyqh"),b(r,"class","svelte-nonyqh"),b(a,"type","file"),b(a,"id","import-file"),b(a,"accept",".jsonl,.txt"),b(a,"class","svelte-nonyqh"),b(h,"class","import-btn svelte-nonyqh"),h.disabled=w=!e[1]||"Uploading..."===e[2],b(f,"class","import-row svelte-nonyqh"),b(o,"class","recovery-controls-card svelte-nonyqh")},m(i,d){u(i,t,d),u(i,n,d),u(i,r,d),u(i,s,d),u(i,o,d),c(o,a),c(o,l),c(o,f),c(f,h),c(h,v),c(f,A),C&&C.m(f,null),k||(I=[y(a,"change",e[4]),y(h,"click",e[5])],k=!0)},p(e,t){6&t&&w!==(w=!e[1]||"Uploading..."===e[2])&&(h.disabled=w),e[2]?C?C.p(e,t):(C=Zg(e),C.c(),C.m(f,null)):C&&(C.d(1),C=null)},d(e){e&&d(t),e&&d(n),e&&d(r),e&&d(s),e&&d(o),C&&C.d(),k=!1,i(I)}}}function Zg(e){let t,n;return{c(){t=p("span"),n=g(e[2]),b(t,"class","import-message svelte-nonyqh"),S(t,"uploading","Uploading..."===e[2]),S(t,"success","Upload complete"===e[2]),S(t,"error",e[2].startsWith("Import failed")||e[2].startsWith("Admin")||e[2].startsWith("Please"))},m(e,i){u(e,t,i),c(t,n)},p(e,i){4&i&&k(n,e[2]),4&i&&S(t,"uploading","Uploading..."===e[2]),4&i&&S(t,"success","Upload complete"===e[2]),4&i&&S(t,"error",e[2].startsWith("Import failed")||e[2].startsWith("Admin")||e[2].startsWith("Please"))},d(e){e&&d(t)}}}function Xg(t){let n;function i(e,t){return e[3]?zg:e[0]?Wg:Yg}let r=i(t),s=r(t);return{c(){n=p("div"),s.c(),b(n,"class","import-section svelte-nonyqh")},m(e,t){u(e,n,t),s.m(n,null)},p(e,[t]){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n,null)))},i:e,o:e,d(e){e&&d(n),s.d()}}}function em(e,t,n){let i,{isLoggedIn:r=!1}=t,{currentEffectiveRole:s=""}=t,{selectedFile:o=null}=t,{aclMode:a=""}=t,{importMessage:l=""}=t;const c=P();return e.$$set=e=>{"isLoggedIn"in e&&n(0,r=e.isLoggedIn),"currentEffectiveRole"in e&&n(7,s=e.currentEffectiveRole),"selectedFile"in e&&n(1,o=e.selectedFile),"aclMode"in e&&n(8,a=e.aclMode),"importMessage"in e&&n(2,l=e.importMessage)},e.$$.update=()=>{385&e.$$.dirty&&n(3,i="none"===a||r&&("admin"===s||"owner"===s))},[r,o,l,i,function(e){c("fileSelect",e)},function(){c("importEvents")},function(){c("openLoginModal")},s,a]}class tm extends se{constructor(e){super(),re(this,e,em,Xg,s,{isLoggedIn:0,currentEffectiveRole:7,selectedFile:1,aclMode:8,importMessage:2})}}const nm={0:"Profile Metadata",1:"Text Note",2:"Recommend Relay",3:"Contacts",4:"Encrypted DM",5:"Delete Request",6:"Repost",7:"Reaction",8:"Badge Award",16:"Generic Repost",40:"Channel Creation",41:"Channel Metadata",42:"Channel Message",43:"Channel Hide Message",44:"Channel Mute User",1063:"File Metadata",1311:"Live Chat Message",1984:"Reporting",1985:"Label",9734:"Zap Request",9735:"Zap Receipt",1e4:"Mute List",10001:"Pin List",10002:"Relay List Metadata",10003:"Bookmark List",10004:"Communities List",10005:"Public Chats List",10006:"Blocked Relays List",10007:"Search Relays List",10009:"User Groups",10015:"Interests List",10030:"User Emoji List",13194:"Wallet Info",22242:"Client Auth",23194:"Wallet Request",23195:"Wallet Response",24133:"Nostr Connect",27235:"HTTP Auth",3e4:"Categorized People List",30001:"Categorized Bookmarks",30002:"Categorized Relay List",30003:"Bookmark Sets",30004:"Curation Sets",30005:"Video Sets",30008:"Profile Badges",30009:"Badge Definition",30015:"Interest Sets",30017:"Create/Update Stall",30018:"Create/Update Product",30019:"Marketplace UI/UX",30020:"Product Sold As Auction",30023:"Long-form Content",30024:"Draft Long-form Content",30030:"Emoji Sets",30063:"Release Artifact Sets",30078:"Application-specific Data",30311:"Live Event",30315:"User Statuses",30388:"Slide Set",30402:"Classified Listing",30403:"Draft Classified Listing",30617:"Repository Announcement",30618:"Repository State Announcement",30818:"Wiki Article",30819:"Redirects",31922:"Date-Based Calendar Event",31923:"Time-Based Calendar Event",31924:"Calendar",31925:"Calendar Event RSVP",31989:"Handler Recommendation",31990:"Handler Information",34550:"Community Definition",34551:"Community Post Approval"};function im(e,t=null){if(!e||"string"!=typeof e)return!1;return!!/^[0-9a-fA-F]+$/.test(e)&&(!t||e.length===t)}function rm(e){const t=new Date(1e3*e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function sm(e){return Math.floor(new Date(e).getTime()/1e3)}function om(e,t,n){const i=e.slice();return i[62]=t[n],i[64]=n,i}function am(e,t,n){const i=e.slice();return i[65]=t[n],i}function lm(e,t,n){const i=e.slice();return i[68]=t[n],i}function cm(e,t,n){const i=e.slice();return i[71]=t[n],i}function um(e,t,n){const i=e.slice();return i[71]=t[n].kind,i[74]=t[n].name,i}function dm(e){let t,n,i,r,s,o,a=e[20],l=[];for(let t=0;t0&&pm(t),Ge=t[17]&&gm(t),Je=t[2].length>0&&mm(t),Ke=t[18]&&ym(t),Ve=t[3].length>0&&wm(t),qe=t[19]&&Am(t),Ye=t[4].length>0&&km(t),We=t[5]&&Cm(t),ze=t[6]&&Em(t),Ze=t[8]&&xm(t);return{c(){n=p("div"),r=p("div"),s=p("div"),o=p("label"),o.textContent="Search Text (NIP-50)",a=m(),l=p("div"),f=p("input"),h=m(),v=p("label"),v.textContent="Event Kinds",w=m(),C=p("div"),E=p("button"),x=g(Oe),B=g(" Select Kinds ("),Q=g(Me),F=g(" selected)"),D=m(),je&&je.c(),$=m(),He&&He.c(),P=m(),R=p("label"),R.textContent="Authors (Pubkeys)",T=m(),U=p("div"),_=p("div"),N=p("input"),L=m(),O=p("button"),O.textContent="Add",M=m(),Ge&&Ge.c(),j=m(),Je&&Je.c(),H=m(),G=p("label"),G.textContent="Event IDs",J=m(),K=p("div"),V=p("div"),q=p("input"),Y=m(),W=p("button"),W.textContent="Add",z=m(),Ke&&Ke.c(),Z=m(),Ve&&Ve.c(),X=m(),ee=p("label"),ee.textContent="Tags (#e, #p, #a)",te=m(),ne=p("div"),ie=p("div"),re=p("span"),re.textContent="#",se=m(),oe=p("input"),ae=m(),le=p("input"),ce=m(),ue=p("button"),ue.textContent="Add",de=m(),qe&&qe.c(),fe=m(),Ye&&Ye.c(),pe=m(),he=p("label"),he.textContent="Since",ge=m(),me=p("div"),ve=p("input"),ye=m(),We&&We.c(),we=m(),be=p("label"),be.textContent="Until",Ae=m(),ke=p("div"),Ie=p("input"),Ce=m(),ze&&ze.c(),Ee=m(),xe=p("label"),xe.textContent="Limit",Se=m(),Be=p("div"),Qe=p("input"),Fe=m(),Ze&&Ze.c(),De=m(),$e=p("div"),Pe=p("button"),Pe.textContent="🧹",Re=m(),Te=p("div"),Ue=m(),_e=p("button"),_e.textContent="",b(o,"for","search-text"),b(o,"class","svelte-1a1v6k0"),b(f,"id","search-text"),b(f,"type","text"),b(f,"placeholder","Search events..."),b(f,"class","filter-input svelte-1a1v6k0"),b(l,"class","field-content svelte-1a1v6k0"),b(v,"class","svelte-1a1v6k0"),b(E,"class","picker-toggle-btn svelte-1a1v6k0"),b(C,"class","field-content svelte-1a1v6k0"),b(R,"class","svelte-1a1v6k0"),b(N,"type","text"),b(N,"placeholder","64 character hex pubkey..."),b(N,"class","filter-input svelte-1a1v6k0"),b(N,"maxlength","64"),b(O,"class","add-btn svelte-1a1v6k0"),b(_,"class","input-group svelte-1a1v6k0"),b(U,"class","field-content svelte-1a1v6k0"),b(G,"class","svelte-1a1v6k0"),b(q,"type","text"),b(q,"placeholder","64 character hex event ID..."),b(q,"class","filter-input svelte-1a1v6k0"),b(q,"maxlength","64"),b(W,"class","add-btn svelte-1a1v6k0"),b(V,"class","input-group svelte-1a1v6k0"),b(K,"class","field-content svelte-1a1v6k0"),b(ee,"class","svelte-1a1v6k0"),b(re,"class","hash-prefix svelte-1a1v6k0"),b(oe,"type","text"),b(oe,"placeholder","Tag"),b(oe,"class","filter-input tag-name-input svelte-1a1v6k0"),b(oe,"maxlength","1"),b(le,"type","text"),b(le,"placeholder","Value..."),b(le,"class","filter-input tag-value-input svelte-1a1v6k0"),b(ue,"class","add-btn svelte-1a1v6k0"),b(ie,"class","tag-input-group svelte-1a1v6k0"),b(ne,"class","field-content svelte-1a1v6k0"),b(he,"for","since-timestamp"),b(he,"class","svelte-1a1v6k0"),b(ve,"id","since-timestamp"),b(ve,"type","datetime-local"),ve.value=t[32](),b(ve,"class","filter-input svelte-1a1v6k0"),b(me,"class","field-content timestamp-field svelte-1a1v6k0"),b(be,"for","until-timestamp"),b(be,"class","svelte-1a1v6k0"),b(Ie,"id","until-timestamp"),b(Ie,"type","datetime-local"),Ie.value=t[33](),b(Ie,"class","filter-input svelte-1a1v6k0"),b(ke,"class","field-content timestamp-field svelte-1a1v6k0"),b(xe,"for","limit"),b(xe,"class","svelte-1a1v6k0"),b(Qe,"id","limit"),b(Qe,"type","number"),b(Qe,"placeholder","Max events to return"),b(Qe,"class","filter-input svelte-1a1v6k0"),b(Qe,"min","1"),b(Be,"class","field-content svelte-1a1v6k0"),b(s,"class","filter-grid svelte-1a1v6k0"),b(r,"class","filter-content svelte-1a1v6k0"),b(Pe,"class","clear-all-btn svelte-1a1v6k0"),b(Pe,"title","Clear all filters"),b(Te,"class","spacer svelte-1a1v6k0"),b(_e,"class","json-toggle-btn svelte-1a1v6k0"),b(_e,"title","Edit filter JSON"),S(_e,"active",t[8]),b($e,"class","clear-column svelte-1a1v6k0"),b(n,"class","filter-builder svelte-1a1v6k0")},m(e,i){u(e,n,i),c(n,r),c(r,s),c(s,o),c(s,a),c(s,l),c(l,f),I(f,t[0]),c(s,h),c(s,v),c(s,w),c(s,C),c(C,E),c(E,x),c(E,B),c(E,Q),c(E,F),c(C,D),je&&je.m(C,null),c(C,$),He&&He.m(C,null),c(s,P),c(s,R),c(s,T),c(s,U),c(U,_),c(_,N),I(N,t[13]),c(_,L),c(_,O),c(U,M),Ge&&Ge.m(U,null),c(U,j),Je&&Je.m(U,null),c(s,H),c(s,G),c(s,J),c(s,K),c(K,V),c(V,q),I(q,t[14]),c(V,Y),c(V,W),c(K,z),Ke&&Ke.m(K,null),c(K,Z),Ve&&Ve.m(K,null),c(s,X),c(s,ee),c(s,te),c(s,ne),c(ne,ie),c(ie,re),c(ie,se),c(ie,oe),I(oe,t[15]),c(ie,ae),c(ie,le),I(le,t[16]),c(ie,ce),c(ie,ue),c(ne,de),qe&&qe.m(ne,null),c(ne,fe),Ye&&Ye.m(ne,null),c(s,pe),c(s,he),c(s,ge),c(s,me),c(me,ve),c(me,ye),We&&We.m(me,null),c(s,we),c(s,be),c(s,Ae),c(s,ke),c(ke,Ie),c(ke,Ce),ze&&ze.m(ke,null),c(s,Ee),c(s,xe),c(s,Se),c(s,Be),c(Be,Qe),I(Qe,t[7]),c(s,Fe),Ze&&Ze.m(s,null),c(n,De),c(n,$e),c($e,Pe),c($e,Re),c($e,Te),c($e,Ue),c($e,_e),Ne||(Le=[y(f,"input",t[38]),y(E,"click",t[39]),y(N,"input",t[43]),y(N,"keydown",t[44]),y(O,"click",t[25]),y(q,"input",t[46]),y(q,"keydown",t[47]),y(W,"click",t[27]),y(oe,"input",t[49]),y(le,"input",t[50]),y(le,"keydown",t[51]),y(ue,"click",t[29]),y(ve,"change",t[34]),y(Ie,"change",t[35]),y(Qe,"input",t[55]),y(Pe,"click",t[31]),y(_e,"click",t[57])],Ne=!0)},p(e,t){1&t[0]&&f.value!==e[0]&&I(f,e[0]),4096&t[0]&&Oe!==(Oe=e[12]?"▼":"▶")&&k(x,Oe),2&t[0]&&Me!==(Me=e[1].length+"")&&k(Q,Me),e[12]?je?je.p(e,t):(je=dm(e),je.c(),je.m(C,$)):je&&(je.d(1),je=null),e[1].length>0?He?He.p(e,t):(He=pm(e),He.c(),He.m(C,null)):He&&(He.d(1),He=null),8192&t[0]&&N.value!==e[13]&&I(N,e[13]),e[17]?Ge?Ge.p(e,t):(Ge=gm(e),Ge.c(),Ge.m(U,j)):Ge&&(Ge.d(1),Ge=null),e[2].length>0?Je?Je.p(e,t):(Je=mm(e),Je.c(),Je.m(U,null)):Je&&(Je.d(1),Je=null),16384&t[0]&&q.value!==e[14]&&I(q,e[14]),e[18]?Ke?Ke.p(e,t):(Ke=ym(e),Ke.c(),Ke.m(K,Z)):Ke&&(Ke.d(1),Ke=null),e[3].length>0?Ve?Ve.p(e,t):(Ve=wm(e),Ve.c(),Ve.m(K,null)):Ve&&(Ve.d(1),Ve=null),32768&t[0]&&oe.value!==e[15]&&I(oe,e[15]),65536&t[0]&&le.value!==e[16]&&I(le,e[16]),e[19]?qe?qe.p(e,t):(qe=Am(e),qe.c(),qe.m(ne,fe)):qe&&(qe.d(1),qe=null),e[4].length>0?Ye?Ye.p(e,t):(Ye=km(e),Ye.c(),Ye.m(ne,null)):Ye&&(Ye.d(1),Ye=null),e[5]?We?We.p(e,t):(We=Cm(e),We.c(),We.m(me,null)):We&&(We.d(1),We=null),e[6]?ze?ze.p(e,t):(ze=Em(e),ze.c(),ze.m(ke,null)):ze&&(ze.d(1),ze=null),128&t[0]&&A(Qe.value)!==e[7]&&I(Qe,e[7]),e[8]?Ze?Ze.p(e,t):(Ze=xm(e),Ze.c(),Ze.m(s,null)):Ze&&(Ze.d(1),Ze=null),256&t[0]&&S(_e,"active",e[8])},i:e,o:e,d(e){e&&d(n),je&&je.d(),He&&He.d(),Ge&&Ge.d(),Je&&Je.d(),Ke&&Ke.d(),Ve&&Ve.d(),qe&&qe.d(),Ye&&Ye.d(),We&&We.d(),ze&&ze.d(),Ze&&Ze.d(),Ne=!1,i(Le)}}}function Qm(e,t,n){let i,r;const s=P();let{searchText:o=""}=t,{selectedKinds:a=[]}=t,{pubkeys:l=[]}=t,{eventIds:c=[]}=t,{tags:u=[]}=t,{sinceTimestamp:d=null}=t,{untilTimestamp:f=null}=t,{limit:p=null}=t,{showJsonEditor:h=!1}=t,g="",m="",v=!1,y="",w="",b="",k="",I="",C="",E="",x="",S=null,B=!1;function Q(e){a.includes(e)?n(1,a=a.filter(t=>t!==e)):n(1,a=[...a,e].sort((e,t)=>e-t))}function F(e){n(1,a=a.filter(t=>t!==e))}function D(){const e=w.trim();e&&(im(e,64)?l.includes(e)?n(17,C="Pubkey already added"):(n(2,l=[...l,e]),n(13,w=""),n(17,C="")):n(17,C="Invalid pubkey: must be 64 character hex string"))}function R(e){n(2,l=l.filter(t=>t!==e))}function T(){const e=b.trim();e&&(im(e,64)?c.includes(e)?n(18,E="Event ID already added"):(n(3,c=[...c,e]),n(14,b=""),n(18,E="")):n(18,E="Invalid event ID: must be 64 character hex string"))}function U(e){n(3,c=c.filter(t=>t!==e))}function _(){const e=k.trim(),t=I.trim();e&&t&&(/^[a-zA-Z]$/.test(e)?u.some(n=>n.name===e&&n.value===t)?n(19,x="Tag already added"):(n(4,u=[...u,{name:e,value:t}]),n(15,k=""),n(16,I=""),n(19,x="")):n(19,x="Invalid tag name: must be single letter a-z or A-Z"))}function N(e){n(4,u=u.filter((t,n)=>n!==e))}function L(){s("apply",{searchText:o,selectedKinds:a,pubkeys:l,eventIds:c,tags:u,sinceTimestamp:d,untilTimestamp:f,limit:p})}$(()=>{S&&clearTimeout(S)});return e.$$set=e=>{"searchText"in e&&n(0,o=e.searchText),"selectedKinds"in e&&n(1,a=e.selectedKinds),"pubkeys"in e&&n(2,l=e.pubkeys),"eventIds"in e&&n(3,c=e.eventIds),"tags"in e&&n(4,u=e.tags),"sinceTimestamp"in e&&n(5,d=e.sinceTimestamp),"untilTimestamp"in e&&n(6,f=e.untilTimestamp),"limit"in e&&n(7,p=e.limit),"showJsonEditor"in e&&n(8,h=e.showJsonEditor)},e.$$.update=()=>{if(256&e.$$.dirty[0]&&h){const e=function(){const e={};return a.length>0&&(e.kinds=a),l.length>0&&(e.authors=l),c.length>0&&(e.ids=c),d&&(e.since=d),f&&(e.until=f),p&&(e.limit=p),o&&(e.search=o),u.forEach(t=>{const n=`#${t.name}`;e[n]||(e[n]=[]),e[n].push(t.value)}),e}();n(10,g=JSON.stringify(e,null,2))}255&e.$$.dirty[0]|32&e.$$.dirty[1]&&(B?(S&&clearTimeout(S),S=setTimeout(()=>{L()},1e3)):n(36,B=!0)),512&e.$$.dirty[0]|64&e.$$.dirty[1]&&n(20,r=i.filter(e=>e.kind.toString().includes(y)||e.name.toLowerCase().includes(y.toLowerCase())))},n(37,i=Object.entries(nm).map(([e,t])=>({kind:parseInt(e),name:t})).sort((e,t)=>e.kind-t.kind)),[o,a,l,c,u,d,f,p,h,y,g,m,v,w,b,k,I,C,E,x,r,s,function(){try{const e=JSON.parse(g);n(11,m=""),n(1,a=e.kinds||[]),n(2,l=e.authors||[]),n(3,c=e.ids||[]),n(5,d=e.since||null),n(6,f=e.until||null),n(7,p=e.limit||null),n(0,o=e.search||""),n(4,u=[]),Object.keys(e).forEach(t=>{if(t.startsWith("#")&&2===t.length){const n=t.slice(1);(Array.isArray(e[t])?e[t]:[e[t]]).forEach(e=>{u.push({name:n,value:String(e)})})}}),n(4,u),S&&clearTimeout(S),L()}catch(e){n(11,m="Invalid JSON: "+e.message)}},Q,F,D,R,T,U,_,N,function(){n(0,o=""),n(1,a=[]),n(2,l=[]),n(3,c=[]),n(4,u=[]),n(5,d=null),n(6,f=null),n(7,p=null),s("clear")},function(){return d?rm(d):""},function(){return f?rm(f):""},function(e){const t=e.target.value;n(5,d=t?sm(t):null)},function(e){const t=e.target.value;n(6,f=t?sm(t):null)},B,i,function(){o=this.value,n(0,o)},()=>n(12,v=!v),function(){y=this.value,n(9,y)},e=>Q(e),e=>F(e),function(){w=this.value,n(13,w)},e=>"Enter"===e.key&&D(),e=>R(e),function(){b=this.value,n(14,b)},e=>"Enter"===e.key&&T(),e=>U(e),function(){k=this.value,n(15,k)},function(){I=this.value,n(16,I)},e=>"Enter"===e.key&&_(),e=>N(e),()=>n(5,d=null),()=>n(6,f=null),function(){p=A(this.value),n(7,p)},function(){g=this.value,n(10,g),n(8,h)},()=>s("toggleJson")]}class Fm extends se{constructor(e){super(),re(this,e,Qm,Bm,s,{searchText:0,selectedKinds:1,pubkeys:2,eventIds:3,tags:4,sinceTimestamp:5,untilTimestamp:6,limit:7,showJsonEditor:8},null,[-1,-1,-1])}}function Dm(e,t,n){const i=e.slice();return i[28]=t[n],i}function $m(e,t,n){const i=e.slice();return i[31]=t[n],i}function Pm(t){let n;return{c(){n=p("div"),n.innerHTML="

    ❌ Read, write, admin, or owner permission required to view all\n events.

    ",b(n,"class","permission-denied svelte-5kb1ec")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Rm(e){let t,n,i,r;function s(e,t){return e[4].length>0?Um:e[6]?void 0:Tm}let o=s(e),a=o&&o(e),l=e[6]&&Gm();return{c(){t=p("div"),a&&a.c(),n=m(),l&&l.c(),b(t,"class","events-view-content svelte-5kb1ec")},m(s,o){u(s,t,o),a&&a.m(t,null),c(t,n),l&&l.m(t,null),i||(r=y(t,"scroll",e[9]),i=!0)},p(e,i){o===(o=s(e))&&a?a.p(e,i):(a&&a.d(1),a=o&&o(e),a&&(a.c(),a.m(t,n))),e[6]?l||(l=Gm(),l.c(),l.m(t,null)):l&&(l.d(1),l=null)},d(e){e&&d(t),a&&a.d(),l&&l.d(),i=!1,r()}}}function Tm(t){let n;return{c(){n=p("div"),n.innerHTML="

    No events found.

    ",b(n,"class","no-events svelte-5kb1ec")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Um(e){let t,n=e[4],i=[];for(let t=0;t0&&Lm(e);return{c(){t=p("div"),n=p("span"),n.textContent="🗑️ Delete Event",i=m(),r&&r.c(),b(n,"class","delete-event-label svelte-5kb1ec"),b(t,"class","delete-event-info svelte-5kb1ec")},m(e,s){u(e,t,s),c(t,n),c(t,i),r&&r.m(t,null)},p(e,n){e[28].tags&&e[28].tags.length>0?r?r.p(e,n):(r=Lm(e),r.c(),r.m(t,null)):r&&(r.d(1),r=null)},d(e){e&&d(t),r&&r.d()}}}function Lm(e){let t,n=e[28].tags.filter(Xm),i=[];for(let t=0;t👤',s=m(),o=p("div"),a=p("div"),l=g(U),f=m(),h=p("div"),v=p("span"),w=g(_),A=m(),I=p("span"),C=g(N),E=m(),x=p("div"),B=p("div"),Q=g(L),F=m(),H.c(),D=m(),G&&G.c(),$=m(),V&&V.c(),P=m(),b(r,"class","events-view-avatar svelte-5kb1ec"),b(a,"class","events-view-author svelte-5kb1ec"),b(v,"class","kind-number svelte-5kb1ec"),S(v,"delete-event",5===e[28].kind),b(I,"class","kind-name svelte-5kb1ec"),b(h,"class","events-view-kind svelte-5kb1ec"),b(o,"class","events-view-info svelte-5kb1ec"),b(B,"class","event-timestamp svelte-5kb1ec"),b(x,"class","events-view-content svelte-5kb1ec"),b(n,"class","events-view-row svelte-5kb1ec"),b(n,"role","button"),b(n,"tabindex","0"),b(t,"class","events-view-item svelte-5kb1ec"),S(t,"expanded",e[5].has(e[28].id))},m(e,i){u(e,t,i),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),c(a,l),c(o,f),c(o,h),c(h,v),c(v,w),c(h,A),c(h,I),c(I,C),c(n,E),c(n,x),c(x,B),c(B,Q),c(x,F),H.m(x,null),c(n,D),G&&G.m(n,null),c(t,$),V&&V.m(t,null),c(t,P),R||(T=[y(n,"click",J),y(n,"keydown",K)],R=!0)},p(i,r){e=i,16&r[0]&&U!==(U=Ym(e[28].pubkey)+"")&&k(l,U),16&r[0]&&_!==(_=e[28].kind+"")&&k(w,_),16&r[0]&&S(v,"delete-event",5===e[28].kind),16&r[0]&&N!==(N=Wm(e[28].kind)+"")&&k(C,N),16&r[0]&&L!==(L=zm(e[28].created_at)+"")&&k(Q,L),j===(j=M(e))&&H?H.p(e,r):(H.d(1),H=j(e),H&&(H.c(),H.m(x,null))),5!==e[28].kind&&("admin"===e[2]||"owner"===e[2]||"write"===e[2]&&e[28].pubkey&&e[28].pubkey===e[3])?G?G.p(e,r):(G=Mm(e),G.c(),G.m(n,null)):G&&(G.d(1),G=null),48&r[0]&&(O=e[5].has(e[28].id)),O?V?V.p(e,r):(V=jm(e),V.c(),V.m(t,P)):V&&(V.d(1),V=null),48&r[0]&&S(t,"expanded",e[5].has(e[28].id))},d(e){e&&d(t),H.d(),G&&G.d(),V&&V.d(),R=!1,i(T)}}}function Gm(e){let t;return{c(){t=p("div"),t.innerHTML='
    \n

    Loading events...

    ',b(t,"class","loading-events svelte-5kb1ec")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Jm(e){let t,n,r,s,o,a,l,f,h,v,w,A,k,I,C,E,x,B,Q,F,D,$,P,R;function T(e,t){return e[6]?Vm:Km}r=new Fm({props:{showJsonEditor:e[8]}}),r.$on("apply",e[17]),r.$on("clear",e[18]),r.$on("toggleJson",e[16]);let U=T(e),_=U(e);return{c(){t=p("div"),n=p("div"),ee(r.$$.fragment),s=m(),o=p("div"),a=p("div"),l=p("button"),l.innerHTML='',f=m(),h=p("div"),v=p("label"),w=p("input"),A=m(),k=p("span"),I=m(),C=p("span"),C.textContent="Only show my events",E=m(),x=p("div"),B=p("button"),Q=g("🔄 Load More"),F=m(),D=p("button"),_.c(),b(n,"class","filter-panel svelte-5kb1ec"),S(n,"open",e[7]),b(l,"class","filter-btn svelte-5kb1ec"),b(l,"title","Filter events"),S(l,"active",e[7]),b(w,"type","checkbox"),b(w,"class","svelte-5kb1ec"),b(k,"class","toggle-slider svelte-5kb1ec"),b(C,"class","toggle-label svelte-5kb1ec"),b(v,"class","toggle-container svelte-5kb1ec"),b(h,"class","events-view-toggle svelte-5kb1ec"),b(a,"class","events-view-left svelte-5kb1ec"),b(B,"class","refresh-btn svelte-5kb1ec"),B.disabled=e[6],b(D,"class","reload-btn svelte-5kb1ec"),D.disabled=e[6],b(x,"class","events-view-buttons svelte-5kb1ec"),b(o,"class","events-view-header svelte-5kb1ec"),b(t,"class","events-view-footer svelte-5kb1ec")},m(i,d){u(i,t,d),c(t,n),te(r,n,null),c(t,s),c(t,o),c(o,a),c(a,l),c(a,f),c(a,h),c(h,v),c(v,w),w.checked=e[0],c(v,A),c(v,k),c(v,I),c(v,C),c(o,E),c(o,x),c(x,B),c(B,Q),c(x,F),c(x,D),_.m(D,null),$=!0,P||(R=[y(l,"click",e[15]),y(w,"change",e[23]),y(w,"change",e[24]),y(B,"click",e[25]),y(D,"click",e[26])],P=!0)},p(e,t){const i={};256&t[0]&&(i.showJsonEditor=e[8]),r.$set(i),(!$||128&t[0])&&S(n,"open",e[7]),(!$||128&t[0])&&S(l,"active",e[7]),1&t[0]&&(w.checked=e[0]),(!$||64&t[0])&&(B.disabled=e[6]),U!==(U=T(e))&&(_.d(1),_=U(e),_&&(_.c(),_.m(D,null))),(!$||64&t[0])&&(D.disabled=e[6])},i(e){$||(z(r.$$.fragment,e),$=!0)},o(e){Z(r.$$.fragment,e),$=!1},d(e){e&&d(t),ne(r),_.d(),P=!1,i(R)}}}function Km(e){let t;return{c(){t=g("🔄")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Vm(e){let t;return{c(){t=p("div"),b(t,"class","spinner svelte-5kb1ec")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function qm(e){let t,n,i;function r(e,t){return!e[1]||"read"!==e[2]&&"write"!==e[2]&&"admin"!==e[2]&&"owner"!==e[2]?Pm:Rm}let s=r(e),o=s(e),a=e[1]&&("read"===e[2]||"write"===e[2]||"admin"===e[2]||"owner"===e[2])&&Jm(e);return{c(){t=p("div"),o.c(),n=m(),a&&a.c(),b(t,"class","events-view-container svelte-5kb1ec")},m(e,r){u(e,t,r),o.m(t,null),c(t,n),a&&a.m(t,null),i=!0},p(e,i){s===(s=r(e))&&o?o.p(e,i):(o.d(1),o=s(e),o&&(o.c(),o.m(t,n))),!e[1]||"read"!==e[2]&&"write"!==e[2]&&"admin"!==e[2]&&"owner"!==e[2]?a&&(Y(),Z(a,1,1,()=>{a=null}),W()):a?(a.p(e,i),6&i[0]&&z(a,1)):(a=Jm(e),a.c(),z(a,1),a.m(t,null))},i(e){i||(z(a),i=!0)},o(e){Z(a),i=!1},d(e){e&&d(t),o.d(),a&&a.d()}}}function Ym(e){return e?e.slice(0,8)+"..."+e.slice(-8):""}function Wm(e){return{0:"Profile",1:"Text Note",2:"Recommend Relay",3:"Contacts",4:"Encrypted DM",5:"Delete",6:"Repost",7:"Reaction",8:"Badge Award",16:"Generic Repost",40:"Channel Creation",41:"Channel Metadata",42:"Channel Message",43:"Channel Hide Message",44:"Channel Mute User",1984:"Reporting",9734:"Zap Request",9735:"Zap",1e4:"Mute List",10001:"Pin List",10002:"Relay List",22242:"Client Auth",24133:"Nostr Connect",27235:"HTTP Auth",3e4:"Categorized People",30001:"Categorized Bookmarks",30008:"Profile Badges",30009:"Badge Definition",30017:"Create or update a stall",30018:"Create or update a product",30023:"Long-form Content",30024:"Draft Long-form Content",30078:"Application-specific Data",30311:"Live Event",30315:"User Statuses",30402:"Classified Listing",30403:"Draft Classified Listing",31922:"Date-Based Calendar Event",31923:"Time-Based Calendar Event",31924:"Calendar",31925:"Calendar Event RSVP",31989:"Handler recommendation",31990:"Handler information",34550:"Community Definition"}[e]||`Kind ${e}`}function zm(e){return new Date(1e3*e).toLocaleString()}function Zm(e){return e?e.length>100?e.slice(0,100)+"...":e:""}const Xm=e=>"e"===e[0];function ev(e,t,n){let{isLoggedIn:i=!1}=t,{userRole:r=""}=t,{userPubkey:s=""}=t,{filteredEvents:o=[]}=t,{expandedEvents:a=new Set}=t,{isLoadingEvents:l=!1}=t,{showOnlyMyEvents:c=!1}=t,{showFilterBuilder:u=!1}=t;const d=P();let f=!1;function p(e){d("toggleEventExpansion",e)}function h(e){d("deleteEvent",e)}function g(e,t){d("copyEventToClipboard",{event:e,e:t})}function m(){d("toggleChange")}function v(e,t){d("loadAllEvents",{refresh:e,authors:t})}return e.$$set=e=>{"isLoggedIn"in e&&n(1,i=e.isLoggedIn),"userRole"in e&&n(2,r=e.userRole),"userPubkey"in e&&n(3,s=e.userPubkey),"filteredEvents"in e&&n(4,o=e.filteredEvents),"expandedEvents"in e&&n(5,a=e.expandedEvents),"isLoadingEvents"in e&&n(6,l=e.isLoadingEvents),"showOnlyMyEvents"in e&&n(0,c=e.showOnlyMyEvents),"showFilterBuilder"in e&&n(7,u=e.showFilterBuilder)},[c,i,r,s,o,a,l,u,f,function(e){d("scroll",e)},p,h,g,m,v,function(){d("toggleFilterBuilder")},function(){n(8,f=!f)},function(e){d("filterApply",e.detail)},function(){d("filterClear")},e=>h(e.id),e=>p(e.id),(e,t)=>"Enter"===t.key&&p(e.id),(e,t)=>g(e,t),function(){c=this.checked,n(0,c)},()=>m(),()=>{v(!1,c&&s?[s]:null)},()=>{v(!0,c&&s?[s]:null)}]}class tv extends se{constructor(e){super(),re(this,e,ev,qm,s,{isLoggedIn:1,userRole:2,userPubkey:3,filteredEvents:4,expandedEvents:5,isLoadingEvents:6,showOnlyMyEvents:0,showFilterBuilder:7},null,[-1,-1])}}const nv=[{kind:0,name:"Metadata",description:"User profile information (name, about, picture, nip05, etc.)",nip:"01",isReplaceable:!0,template:{kind:0,content:"",tags:[]}},{kind:1,name:"Short Text Note",description:"Short-form text post (like a tweet)",nip:"01",template:{kind:1,content:"",tags:[]}},{kind:2,name:"Recommend Relay",description:"Relay recommendation",nip:"01",deprecated:!0,template:{kind:2,content:"",tags:[]}},{kind:3,name:"Follows",description:"Following list with optional relay hints",nip:"02",isReplaceable:!0,template:{kind:3,content:"",tags:[]}},{kind:4,name:"Encrypted Direct Message",description:"Private message using NIP-04 encryption",nip:"04",deprecated:!0,template:{kind:4,content:"",tags:[]}},{kind:5,name:"Event Deletion Request",description:"Request to delete events",nip:"09",template:{kind:5,content:"",tags:[]}},{kind:6,name:"Repost",description:"Share/repost another text note",nip:"18",template:{kind:6,content:"",tags:[]}},{kind:7,name:"Reaction",description:"Like, emoji reaction to an event",nip:"25",template:{kind:7,content:"",tags:[]}},{kind:8,name:"Badge Award",description:"Award a badge to someone",nip:"58",template:{kind:8,content:"",tags:[]}},{kind:9,name:"Chat Message",description:"Chat message",nip:"C7",template:{kind:9,content:"",tags:[]}},{kind:10,name:"Group Chat Threaded Reply",description:"Threaded reply in group chat",nip:"29",deprecated:!0,template:{kind:10,content:"",tags:[]}},{kind:11,name:"Thread",description:"Thread event",nip:"7D",template:{kind:11,content:"",tags:[]}},{kind:12,name:"Group Thread Reply",description:"Reply in group thread",nip:"29",deprecated:!0,template:{kind:12,content:"",tags:[]}},{kind:13,name:"Seal",description:"Sealed/encrypted event wrapper",nip:"59",template:{kind:13,content:"",tags:[]}},{kind:14,name:"Direct Message",description:"Private direct message using NIP-17",nip:"17",template:{kind:14,content:"",tags:[]}},{kind:15,name:"File Message",description:"File message in DMs",nip:"17",template:{kind:15,content:"",tags:[]}},{kind:16,name:"Generic Repost",description:"Repost any event kind",nip:"18",template:{kind:16,content:"",tags:[]}},{kind:17,name:"Reaction to Website",description:"Reaction to a website URL",nip:"25",template:{kind:17,content:"",tags:[]}},{kind:20,name:"Picture",description:"Picture-first feed post",nip:"68",template:{kind:20,content:"",tags:[]}},{kind:21,name:"Video Event",description:"Horizontal video event",nip:"71",template:{kind:21,content:"",tags:[]}},{kind:22,name:"Short-form Video",description:"Short-form portrait video (like TikTok)",nip:"71",template:{kind:22,content:"",tags:[]}},{kind:40,name:"Channel Creation",description:"Create a public chat channel",nip:"28",template:{kind:40,content:"",tags:[]}},{kind:41,name:"Channel Metadata",description:"Set channel name, about, picture",nip:"28",template:{kind:41,content:"",tags:[]}},{kind:42,name:"Channel Message",description:"Post message in channel",nip:"28",template:{kind:42,content:"",tags:[]}},{kind:43,name:"Channel Hide Message",description:"Hide a message in channel",nip:"28",template:{kind:43,content:"",tags:[]}},{kind:44,name:"Channel Mute User",description:"Mute a user in channel",nip:"28",template:{kind:44,content:"",tags:[]}},{kind:62,name:"Request to Vanish",description:"Request permanent deletion of all user data",nip:"62",template:{kind:62,content:"",tags:[]}},{kind:64,name:"Chess (PGN)",description:"Chess game in PGN format",nip:"64",template:{kind:64,content:"",tags:[]}},{kind:443,name:"KeyPackage",description:"Marmot protocol key package",nip:null,spec:"Marmot",template:{kind:443,content:"",tags:[]}},{kind:444,name:"Welcome Message",description:"Marmot protocol welcome message",nip:null,spec:"Marmot",template:{kind:444,content:"",tags:[]}},{kind:445,name:"Group Event",description:"Marmot protocol group event",nip:null,spec:"Marmot",template:{kind:445,content:"",tags:[]}},{kind:818,name:"Merge Requests",description:"Git merge request",nip:"54",template:{kind:818,content:"",tags:[]}},{kind:1018,name:"Poll Response",description:"Response to a poll",nip:"88",template:{kind:1018,content:"",tags:[]}},{kind:1021,name:"Bid",description:"Auction bid",nip:"15",template:{kind:1021,content:"",tags:[]}},{kind:1022,name:"Bid Confirmation",description:"Confirmation of auction bid",nip:"15",template:{kind:1022,content:"",tags:[]}},{kind:1040,name:"OpenTimestamps",description:"OpenTimestamps attestation",nip:"03",template:{kind:1040,content:"",tags:[]}},{kind:1059,name:"Gift Wrap",description:"Encrypted gift-wrapped event",nip:"59",template:{kind:1059,content:"",tags:[]}},{kind:1060,name:"Gift Wrap (Kind 4)",description:"Gift wrap variant for NIP-04 compatibility",nip:"59",template:{kind:1060,content:"",tags:[]}},{kind:1063,name:"File Metadata",description:"Metadata for shared files",nip:"94",template:{kind:1063,content:"",tags:[]}},{kind:1068,name:"Poll",description:"Create a poll",nip:"88",template:{kind:1068,content:"",tags:[]}},{kind:1111,name:"Comment",description:"Comment on events or external content",nip:"22",template:{kind:1111,content:"",tags:[]}},{kind:1222,name:"Voice Message",description:"Voice message",nip:"A0",template:{kind:1222,content:"",tags:[]}},{kind:1244,name:"Voice Message Comment",description:"Comment on voice message",nip:"A0",template:{kind:1244,content:"",tags:[]}},{kind:1311,name:"Live Chat Message",description:"Message in live stream chat",nip:"53",template:{kind:1311,content:"",tags:[]}},{kind:1337,name:"Code Snippet",description:"Code snippet post",nip:"C0",template:{kind:1337,content:"",tags:[]}},{kind:1517,name:"Bitcoin Block",description:"Bitcoin block data",nip:null,spec:"Nostrocket",template:{kind:1517,content:"",tags:[]}},{kind:1617,name:"Patches",description:"Git patches",nip:"34",template:{kind:1617,content:"",tags:[]}},{kind:1618,name:"Pull Requests",description:"Git pull request",nip:"34",template:{kind:1618,content:"",tags:[]}},{kind:1619,name:"Pull Request Updates",description:"Updates to git pull request",nip:"34",template:{kind:1619,content:"",tags:[]}},{kind:1621,name:"Issues",description:"Git issues",nip:"34",template:{kind:1621,content:"",tags:[]}},{kind:1622,name:"Git Replies",description:"Replies on git objects",nip:"34",deprecated:!0,template:{kind:1622,content:"",tags:[]}},{kind:1630,name:"Status",description:"Git status",nip:"34",template:{kind:1630,content:"",tags:[]}},{kind:1631,name:"Status",description:"Git status",nip:"34",template:{kind:1631,content:"",tags:[]}},{kind:1632,name:"Status",description:"Git status",nip:"34",template:{kind:1632,content:"",tags:[]}},{kind:1633,name:"Status",description:"Git status",nip:"34",template:{kind:1633,content:"",tags:[]}},{kind:1808,name:"Live Stream",description:"Live streaming event",nip:null,spec:"zap.stream",template:{kind:1808,content:"",tags:[]}},{kind:1971,name:"Problem Tracker",description:"Problem tracking",nip:null,spec:"Nostrocket",template:{kind:1971,content:"",tags:[]}},{kind:1984,name:"Reporting",description:"Report content or users",nip:"56",template:{kind:1984,content:"",tags:[]}},{kind:1985,name:"Label",description:"Label/tag content with namespace",nip:"32",template:{kind:1985,content:"",tags:[]}},{kind:1986,name:"Relay Reviews",description:"Reviews of relays",nip:null,template:{kind:1986,content:"",tags:[]}},{kind:1987,name:"AI Embeddings",description:"AI embeddings/vector lists",nip:null,spec:"NKBIP-02",template:{kind:1987,content:"",tags:[]}},{kind:2003,name:"Torrent",description:"Torrent magnet link",nip:"35",template:{kind:2003,content:"",tags:[]}},{kind:2004,name:"Torrent Comment",description:"Comment on torrent",nip:"35",template:{kind:2004,content:"",tags:[]}},{kind:2022,name:"Coinjoin Pool",description:"Coinjoin coordination",nip:null,spec:"joinstr",template:{kind:2022,content:"",tags:[]}},{kind:4550,name:"Community Post Approval",description:"Approve post in community",nip:"72",template:{kind:4550,content:"",tags:[]}},{kind:5e3,name:"Job Request",description:"Data vending machine job request (start of range)",nip:"90",template:{kind:5e3,content:"",tags:[]}},{kind:6e3,name:"Job Result",description:"Data vending machine job result (start of range)",nip:"90",template:{kind:6e3,content:"",tags:[]}},{kind:7e3,name:"Job Feedback",description:"Feedback on job request/result",nip:"90",template:{kind:7e3,content:"",tags:[]}},{kind:7374,name:"Reserved Cashu Wallet Tokens",description:"Reserved Cashu wallet tokens",nip:"60",template:{kind:7374,content:"",tags:[]}},{kind:7375,name:"Cashu Wallet Tokens",description:"Cashu wallet tokens",nip:"60",template:{kind:7375,content:"",tags:[]}},{kind:7376,name:"Cashu Wallet History",description:"Cashu wallet transaction history",nip:"60",template:{kind:7376,content:"",tags:[]}},{kind:7516,name:"Geocache Log",description:"Geocaching log entry",nip:null,spec:"geocaching",template:{kind:7516,content:"",tags:[]}},{kind:7517,name:"Geocache Proof of Find",description:"Proof of geocache find",nip:null,spec:"geocaching",template:{kind:7517,content:"",tags:[]}},{kind:8e3,name:"Add User",description:"Add user to group",nip:"43",template:{kind:8e3,content:"",tags:[]}},{kind:8001,name:"Remove User",description:"Remove user from group",nip:"43",template:{kind:8001,content:"",tags:[]}},{kind:9e3,name:"Group Control Events",description:"Group control events (start of range)",nip:"29",template:{kind:9e3,content:"",tags:[]}},{kind:9041,name:"Zap Goal",description:"Fundraising goal for zaps",nip:"75",template:{kind:9041,content:"",tags:[]}},{kind:9321,name:"Nutzap",description:"Cashu nutzap",nip:"61",template:{kind:9321,content:"",tags:[]}},{kind:9467,name:"Tidal Login",description:"Tidal streaming login",nip:null,spec:"Tidal-nostr",template:{kind:9467,content:"",tags:[]}},{kind:9734,name:"Zap Request",description:"Request Lightning payment",nip:"57",template:{kind:9734,content:"",tags:[]}},{kind:9735,name:"Zap",description:"Lightning payment receipt",nip:"57",template:{kind:9735,content:"",tags:[]}},{kind:9802,name:"Highlights",description:"Highlighted text selection",nip:"84",template:{kind:9802,content:"",tags:[]}},{kind:1e4,name:"Mute List",description:"List of muted users/content",nip:"51",isReplaceable:!0,template:{kind:1e4,content:"",tags:[]}},{kind:10001,name:"Pin List",description:"Pinned events",nip:"51",isReplaceable:!0,template:{kind:10001,content:"",tags:[]}},{kind:10002,name:"Relay List Metadata",description:"User's preferred relays for read/write",nip:"65",isReplaceable:!0,template:{kind:10002,content:"",tags:[]}},{kind:10003,name:"Bookmark List",description:"Bookmarked events",nip:"51",isReplaceable:!0,template:{kind:10003,content:"",tags:[]}},{kind:10004,name:"Communities List",description:"Communities user belongs to",nip:"51",isReplaceable:!0,template:{kind:10004,content:"",tags:[]}},{kind:10005,name:"Public Chats List",description:"Public chats user is in",nip:"51",isReplaceable:!0,template:{kind:10005,content:"",tags:[]}},{kind:10006,name:"Blocked Relays List",description:"Relays user has blocked",nip:"51",isReplaceable:!0,template:{kind:10006,content:"",tags:[]}},{kind:10007,name:"Search Relays List",description:"Preferred search relays",nip:"51",isReplaceable:!0,template:{kind:10007,content:"",tags:[]}},{kind:10008,name:"Relay Group Configuration",description:"Relay group configuration",nip:null,isReplaceable:!0,template:{kind:10008,content:"",tags:[]}},{kind:10009,name:"User Groups",description:"Groups user belongs to",nip:"29",isReplaceable:!0,template:{kind:10009,content:"",tags:[]}},{kind:10012,name:"Favorite Relays List",description:"User's favorite relays",nip:"51",isReplaceable:!0,template:{kind:10012,content:"",tags:[]}},{kind:10013,name:"Private Event Relay List",description:"Relays for private events",nip:"37",isReplaceable:!0,template:{kind:10013,content:"",tags:[]}},{kind:10015,name:"Interests List",description:"User interests/topics",nip:"51",isReplaceable:!0,template:{kind:10015,content:"",tags:[]}},{kind:10019,name:"Nutzap Mint Recommendation",description:"Recommended Cashu mints for nutzaps",nip:"61",isReplaceable:!0,template:{kind:10019,content:"",tags:[]}},{kind:10020,name:"Media Follows",description:"Followed media accounts",nip:"51",isReplaceable:!0,template:{kind:10020,content:"",tags:[]}},{kind:10030,name:"User Emoji List",description:"Custom emoji list",nip:"51",isReplaceable:!0,template:{kind:10030,content:"",tags:[]}},{kind:10050,name:"DM Relays List",description:"Relays to receive DMs on",nip:"17",isReplaceable:!0,template:{kind:10050,content:"",tags:[]}},{kind:10051,name:"KeyPackage Relays List",description:"Marmot key package relays",nip:null,isReplaceable:!0,spec:"Marmot",template:{kind:10051,content:"",tags:[]}},{kind:10063,name:"User Server List",description:"Blossom server list",nip:null,isReplaceable:!0,spec:"Blossom",template:{kind:10063,content:"",tags:[]}},{kind:10096,name:"File Storage Server List",description:"File storage servers",nip:"96",isReplaceable:!0,deprecated:!0,template:{kind:10096,content:"",tags:[]}},{kind:10166,name:"Relay Monitor Announcement",description:"Relay monitoring announcement",nip:"66",isReplaceable:!0,template:{kind:10166,content:"",tags:[]}},{kind:10312,name:"Room Presence",description:"Presence in live room",nip:"53",isReplaceable:!0,template:{kind:10312,content:"",tags:[]}},{kind:10377,name:"Proxy Announcement",description:"Nostr proxy announcement",nip:null,isReplaceable:!0,spec:"Nostr Epoxy",template:{kind:10377,content:"",tags:[]}},{kind:11111,name:"Transport Method Announcement",description:"Transport method announcement",nip:null,isReplaceable:!0,spec:"Nostr Epoxy",template:{kind:11111,content:"",tags:[]}},{kind:12345,name:"Relay Policy Configuration",description:"Relay-internal policy configuration (admin only)",nip:null,isReplaceable:!0,spec:"orly",template:{kind:12345,content:"",tags:[]}},{kind:13004,name:"JWT Binding",description:"Link between JWT certificate and pubkey",nip:null,isReplaceable:!0,template:{kind:13004,content:"",tags:[]}},{kind:13194,name:"Wallet Service Info",description:"NWC wallet service information",nip:"47",isReplaceable:!0,template:{kind:13194,content:"",tags:[]}},{kind:13534,name:"Membership Lists",description:"Group membership lists",nip:"43",isReplaceable:!0,template:{kind:13534,content:"",tags:[]}},{kind:14388,name:"User Sound Effect Lists",description:"Sound effect lists",nip:null,isReplaceable:!0,spec:"Corny Chat",template:{kind:14388,content:"",tags:[]}},{kind:17375,name:"Cashu Wallet Event",description:"Cashu wallet event",nip:"60",isReplaceable:!0,template:{kind:17375,content:"",tags:[]}},{kind:21e3,name:"Lightning Pub RPC",description:"Lightning.Pub RPC",nip:null,isEphemeral:!0,spec:"Lightning.Pub",template:{kind:21e3,content:"",tags:[]}},{kind:22242,name:"Client Authentication",description:"Authenticate to relay",nip:"42",isEphemeral:!0,template:{kind:22242,content:"",tags:[]}},{kind:23194,name:"Wallet Request",description:"NWC wallet request",nip:"47",isEphemeral:!0,template:{kind:23194,content:"",tags:[]}},{kind:23195,name:"Wallet Response",description:"NWC wallet response",nip:"47",isEphemeral:!0,template:{kind:23195,content:"",tags:[]}},{kind:23196,name:"Wallet Notification (NIP-04)",description:"NWC wallet notification (NIP-04 encrypted)",nip:"47",isEphemeral:!0,template:{kind:23196,content:"",tags:[]}},{kind:23197,name:"Wallet Notification",description:"NWC wallet notification",nip:"47",isEphemeral:!0,template:{kind:23197,content:"",tags:[]}},{kind:24133,name:"Nostr Connect",description:"Remote signer connection",nip:"46",isEphemeral:!0,template:{kind:24133,content:"",tags:[]}},{kind:24242,name:"Blobs Stored on Mediaservers",description:"Blossom blob storage",nip:null,isEphemeral:!0,spec:"Blossom",template:{kind:24242,content:"",tags:[]}},{kind:27235,name:"HTTP Auth",description:"Authenticate HTTP requests",nip:"98",isEphemeral:!0,template:{kind:27235,content:"",tags:[]}},{kind:28934,name:"Join Request",description:"Request to join group",nip:"43",isEphemeral:!0,template:{kind:28934,content:"",tags:[]}},{kind:28935,name:"Invite Request",description:"Invite to group",nip:"43",isEphemeral:!0,template:{kind:28935,content:"",tags:[]}},{kind:28936,name:"Leave Request",description:"Leave group request",nip:"43",isEphemeral:!0,template:{kind:28936,content:"",tags:[]}},{kind:3e4,name:"Follow Sets",description:"Categorized people lists",nip:"51",isAddressable:!0,template:{kind:3e4,content:"",tags:[["d","identifier"]]}},{kind:30001,name:"Generic Lists",description:"Generic categorized lists",nip:"51",isAddressable:!0,deprecated:!0,template:{kind:30001,content:"",tags:[["d","identifier"]]}},{kind:30002,name:"Relay Sets",description:"Categorized relay lists",nip:"51",isAddressable:!0,template:{kind:30002,content:"",tags:[["d","identifier"]]}},{kind:30003,name:"Bookmark Sets",description:"Categorized bookmark lists",nip:"51",isAddressable:!0,template:{kind:30003,content:"",tags:[["d","identifier"]]}},{kind:30004,name:"Curation Sets",description:"Curated content sets",nip:"51",isAddressable:!0,template:{kind:30004,content:"",tags:[["d","identifier"]]}},{kind:30005,name:"Video Sets",description:"Video playlists",nip:"51",isAddressable:!0,template:{kind:30005,content:"",tags:[["d","identifier"]]}},{kind:30007,name:"Kind Mute Sets",description:"Muted event kinds",nip:"51",isAddressable:!0,template:{kind:30007,content:"",tags:[["d","identifier"]]}},{kind:30008,name:"Profile Badges",description:"Badges displayed on profile",nip:"58",isAddressable:!0,template:{kind:30008,content:"",tags:[["d","identifier"]]}},{kind:30009,name:"Badge Definition",description:"Define a badge/achievement",nip:"58",isAddressable:!0,template:{kind:30009,content:"",tags:[["d","identifier"]]}},{kind:30015,name:"Interest Sets",description:"Interest/topic sets",nip:"51",isAddressable:!0,template:{kind:30015,content:"",tags:[["d","identifier"]]}},{kind:30017,name:"Stall",description:"Marketplace stall definition",nip:"15",isAddressable:!0,template:{kind:30017,content:"",tags:[["d","identifier"]]}},{kind:30018,name:"Product",description:"Marketplace product listing",nip:"15",isAddressable:!0,template:{kind:30018,content:"",tags:[["d","identifier"]]}},{kind:30019,name:"Marketplace UI/UX",description:"Marketplace interface settings",nip:"15",isAddressable:!0,template:{kind:30019,content:"",tags:[["d","identifier"]]}},{kind:30020,name:"Product Sold as Auction",description:"Auction product listing",nip:"15",isAddressable:!0,template:{kind:30020,content:"",tags:[["d","identifier"]]}},{kind:30023,name:"Long-form Content",description:"Blog post, article in markdown",nip:"23",isAddressable:!0,template:{kind:30023,content:"",tags:[["d","identifier"]]}},{kind:30024,name:"Draft Long-form Content",description:"Draft article",nip:"23",isAddressable:!0,template:{kind:30024,content:"",tags:[["d","identifier"]]}},{kind:30030,name:"Emoji Sets",description:"Custom emoji sets",nip:"51",isAddressable:!0,template:{kind:30030,content:"",tags:[["d","identifier"]]}},{kind:30040,name:"Curated Publication Index",description:"Publication index",nip:null,isAddressable:!0,spec:"NKBIP-01",template:{kind:30040,content:"",tags:[["d","identifier"]]}},{kind:30041,name:"Curated Publication Content",description:"Publication content",nip:null,isAddressable:!0,spec:"NKBIP-01",template:{kind:30041,content:"",tags:[["d","identifier"]]}},{kind:30063,name:"Release Artifact Sets",description:"Software release artifacts",nip:"51",isAddressable:!0,template:{kind:30063,content:"",tags:[["d","identifier"]]}},{kind:30078,name:"Application-specific Data",description:"App-specific key-value storage",nip:"78",isAddressable:!0,template:{kind:30078,content:"",tags:[["d","identifier"]]}},{kind:30166,name:"Relay Discovery",description:"Relay discovery/monitoring",nip:"66",isAddressable:!0,template:{kind:30166,content:"",tags:[["d","identifier"]]}},{kind:30267,name:"App Curation Sets",description:"Curated app sets",nip:"51",isAddressable:!0,template:{kind:30267,content:"",tags:[["d","identifier"]]}},{kind:30311,name:"Live Event",description:"Live streaming event",nip:"53",isAddressable:!0,template:{kind:30311,content:"",tags:[["d","identifier"]]}},{kind:30312,name:"Interactive Room",description:"Interactive live room",nip:"53",isAddressable:!0,template:{kind:30312,content:"",tags:[["d","identifier"]]}},{kind:30313,name:"Conference Event",description:"Conference/meetup event",nip:"53",isAddressable:!0,template:{kind:30313,content:"",tags:[["d","identifier"]]}},{kind:30315,name:"User Statuses",description:"User status updates",nip:"38",isAddressable:!0,template:{kind:30315,content:"",tags:[["d","identifier"]]}},{kind:30388,name:"Slide Set",description:"Presentation slides",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:30388,content:"",tags:[["d","identifier"]]}},{kind:30402,name:"Classified Listing",description:"Classified ad listing",nip:"99",isAddressable:!0,template:{kind:30402,content:"",tags:[["d","identifier"]]}},{kind:30403,name:"Draft Classified Listing",description:"Draft classified ad",nip:"99",isAddressable:!0,template:{kind:30403,content:"",tags:[["d","identifier"]]}},{kind:30617,name:"Repository Announcements",description:"Git repository announcement",nip:"34",isAddressable:!0,template:{kind:30617,content:"",tags:[["d","identifier"]]}},{kind:30618,name:"Repository State Announcements",description:"Git repository state",nip:"34",isAddressable:!0,template:{kind:30618,content:"",tags:[["d","identifier"]]}},{kind:30818,name:"Wiki Article",description:"Wiki article",nip:"54",isAddressable:!0,template:{kind:30818,content:"",tags:[["d","identifier"]]}},{kind:30819,name:"Redirects",description:"URL redirects",nip:"54",isAddressable:!0,template:{kind:30819,content:"",tags:[["d","identifier"]]}},{kind:31234,name:"Draft Event",description:"Draft of any event",nip:"37",isAddressable:!0,template:{kind:31234,content:"",tags:[["d","identifier"]]}},{kind:31388,name:"Link Set",description:"Link collection",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:31388,content:"",tags:[["d","identifier"]]}},{kind:31890,name:"Feed",description:"Custom feed definition",nip:null,isAddressable:!0,spec:"NUD: Custom Feeds",template:{kind:31890,content:"",tags:[["d","identifier"]]}},{kind:31922,name:"Date-Based Calendar Event",description:"All-day calendar event",nip:"52",isAddressable:!0,template:{kind:31922,content:"",tags:[["d","identifier"]]}},{kind:31923,name:"Time-Based Calendar Event",description:"Calendar event with time",nip:"52",isAddressable:!0,template:{kind:31923,content:"",tags:[["d","identifier"]]}},{kind:31924,name:"Calendar",description:"Calendar definition",nip:"52",isAddressable:!0,template:{kind:31924,content:"",tags:[["d","identifier"]]}},{kind:31925,name:"Calendar Event RSVP",description:"RSVP to calendar event",nip:"52",isAddressable:!0,template:{kind:31925,content:"",tags:[["d","identifier"]]}},{kind:31989,name:"Handler Recommendation",description:"Recommended app for event kind",nip:"89",isAddressable:!0,template:{kind:31989,content:"",tags:[["d","identifier"]]}},{kind:31990,name:"Handler Information",description:"App handler declaration",nip:"89",isAddressable:!0,template:{kind:31990,content:"",tags:[["d","identifier"]]}},{kind:32123,name:"WaveLake Track",description:"WaveLake music track",nip:null,isAddressable:!0,spec:"WaveLake",template:{kind:32123,content:"",tags:[["d","identifier"]]}},{kind:32267,name:"Software Application",description:"Software application listing",nip:null,isAddressable:!0,template:{kind:32267,content:"",tags:[["d","identifier"]]}},{kind:32388,name:"User Room Favorites",description:"Favorite rooms",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:32388,content:"",tags:[["d","identifier"]]}},{kind:33388,name:"High Scores",description:"Game high scores",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:33388,content:"",tags:[["d","identifier"]]}},{kind:34235,name:"Video Event Horizontal",description:"Horizontal video event",nip:"71",isAddressable:!0,template:{kind:34235,content:"",tags:[["d","identifier"]]}},{kind:34236,name:"Video Event Vertical",description:"Vertical video event",nip:"71",isAddressable:!0,template:{kind:34236,content:"",tags:[["d","identifier"]]}},{kind:34388,name:"Sound Effects",description:"Sound effect definitions",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:34388,content:"",tags:[["d","identifier"]]}},{kind:34550,name:"Community Definition",description:"Define a community",nip:"72",isAddressable:!0,template:{kind:34550,content:"",tags:[["d","identifier"]]}},{kind:37516,name:"Geocache Listing",description:"Geocache location listing",nip:null,isAddressable:!0,spec:"geocaching",template:{kind:37516,content:"",tags:[["d","identifier"]]}},{kind:38172,name:"Cashu Mint Announcement",description:"Cashu mint announcement",nip:"87",isAddressable:!0,template:{kind:38172,content:"",tags:[["d","identifier"]]}},{kind:38173,name:"Fedimint Announcement",description:"Fedimint announcement",nip:"87",isAddressable:!0,template:{kind:38173,content:"",tags:[["d","identifier"]]}},{kind:38383,name:"Peer-to-peer Order Events",description:"P2P trading orders",nip:"69",isAddressable:!0,template:{kind:38383,content:"",tags:[["d","identifier"]]}},{kind:39e3,name:"Group Metadata Events",description:"Group metadata (start of range)",nip:"29",isAddressable:!0,template:{kind:39e3,content:"",tags:[["d","identifier"]]}},{kind:39089,name:"Starter Packs",description:"Starter pack lists",nip:"51",isAddressable:!0,template:{kind:39089,content:"",tags:[["d","identifier"]]}},{kind:39092,name:"Media Starter Packs",description:"Media starter packs",nip:"51",isAddressable:!0,template:{kind:39092,content:"",tags:[["d","identifier"]]}},{kind:39701,name:"Web Bookmarks",description:"Web URL bookmarks",nip:"B0",isAddressable:!0,template:{kind:39701,content:"",tags:[["d","identifier"]]}},{kind:39998,name:"ACL Event",description:"Access control list event",nip:null,isAddressable:!0,template:{kind:39998,content:"",tags:[["d","identifier"]]}}];function iv(e,t=null){const n=function(e){return nv.find(t=>t.kind===e)}(e);return n?{...n.template,created_at:Math.floor(Date.now()/1e3),pubkey:t||""}:{kind:e,content:"",tags:[],created_at:Math.floor(Date.now()/1e3),pubkey:t||""}}const rv=[{id:"all",name:"All Kinds",filter:()=>!0},{id:"regular",name:"Regular Events (0-9999)",filter:e=>e.kind<1e4&&!e.isReplaceable},{id:"replaceable",name:"Replaceable (10000-19999)",filter:e=>e.isReplaceable},{id:"ephemeral",name:"Ephemeral (20000-29999)",filter:e=>e.isEphemeral},{id:"addressable",name:"Addressable (30000-39999)",filter:e=>e.isAddressable},{id:"social",name:"Social",filter:e=>[0,1,3,6,7].includes(e.kind)},{id:"messaging",name:"Messaging",filter:e=>[4,9,10,11,12,14,15,40,41,42].includes(e.kind)},{id:"lists",name:"Lists",filter:e=>e.name.toLowerCase().includes("list")||e.name.toLowerCase().includes("set")},{id:"marketplace",name:"Marketplace",filter:e=>[30017,30018,30019,30020,1021,1022,30402,30403].includes(e.kind)},{id:"lightning",name:"Lightning/Zaps",filter:e=>[9734,9735,9041,9321,7374,7375,7376].includes(e.kind)},{id:"media",name:"Media",filter:e=>[20,21,22,1063,1222,1244].includes(e.kind)},{id:"git",name:"Git/Code",filter:e=>[818,1337,1617,1618,1619,1621,1622,30617,30618].includes(e.kind)},{id:"calendar",name:"Calendar",filter:e=>[31922,31923,31924,31925].includes(e.kind)},{id:"groups",name:"Groups",filter:e=>e.kind>=9e3&&e.kind<=9030||e.kind>=39e3&&e.kind<=39009}];function sv(e,t,n){const i=e.slice();return i[13]=t[n],i}function ov(e,t,n){const i=e.slice();return i[16]=t[n],i}function av(e){let t,n,r,s,o,a,l,h,v,w,A,C,E,x,S,B,Q,F,D,$,P,R,T,U,_,N=e[3].length+"",L=1!==e[3].length?"s":"",O=rv,M=[];for(let t=0;t=2e4&&e.kind<3e4?"badge-ephemeral":"badge-regular"}function gv(e){return e.isAddressable?"Addressable":e.isReplaceable?"Replaceable":e.kind>=2e4&&e.kind<3e4?"Ephemeral":"Regular"}function mv(e,t,n){let{isOpen:i=!1}=t,{userPubkey:r=""}=t;const s=P();let o="",a="all",l=nv;function c(e){const t=iv(e.kind,r);s("select",{kind:e,template:t}),u()}function u(){n(0,i=!1),n(1,o=""),n(2,a="all"),s("close")}return e.$$set=e=>{"isOpen"in e&&n(0,i=e.isOpen),"userPubkey"in e&&n(8,r=e.userPubkey)},e.$$.update=()=>{if(6&e.$$.dirty){let e=nv;const t=rv.find(e=>e.id===a);if(t&&(e=e.filter(t.filter)),o.trim()){const t=o.toLowerCase();e=e.filter(e=>e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.kind.toString().includes(t)||e.nip&&e.nip.includes(t))}n(3,l=e)}},[i,o,a,l,c,u,function(e){"Escape"===e.key&&u()},function(e){e.target===e.currentTarget&&u()},r,function(){o=this.value,n(1,o)},e=>n(2,a=e.id),e=>c(e)]}class vv extends se{constructor(e){super(),re(this,e,mv,pv,s,{isOpen:0,userPubkey:8})}}function yv(e){let t,n,i,r,s,o,a,l,f,h;return{c(){t=p("div"),n=p("div"),i=p("span"),i.textContent="⚠",r=m(),s=p("span"),o=g(e[1]),a=m(),l=p("button"),l.textContent="×",b(i,"class","error-icon svelte-46pmgb"),b(s,"class","error-message svelte-46pmgb"),b(n,"class","error-content svelte-46pmgb"),b(l,"class","error-dismiss svelte-46pmgb"),b(t,"class","error-banner svelte-46pmgb")},m(d,p){u(d,t,p),c(t,n),c(n,i),c(n,r),c(n,s),c(s,o),c(t,a),c(t,l),f||(h=y(l,"click",e[10]),f=!0)},p(e,t){2&t&&k(o,e[1])},d(e){e&&d(t),f=!1,h()}}}function wv(e){let t,n,r,s,o,a,l,f,h,g,v,w,A,k,C,E,x,S,B,Q=e[1]&&yv(e);function F(t){e[14](t)}let D={userPubkey:e[2]};return void 0!==e[3]&&(D.isOpen=e[3]),C=new vv({props:D}),U.push(()=>X(C,"isOpen",F)),C.$on("select",e[8]),C.$on("close",e[9]),{c(){t=p("div"),n=p("div"),r=p("button"),r.textContent="Generate Template",s=m(),o=p("button"),o.textContent="Reformat",a=m(),l=p("button"),l.textContent="Sign",f=m(),h=p("button"),h.textContent="Publish",g=m(),Q&&Q.c(),v=m(),w=p("div"),A=p("textarea"),k=m(),ee(C.$$.fragment),b(r,"class","compose-btn template-btn svelte-46pmgb"),b(o,"class","compose-btn reformat-btn svelte-46pmgb"),b(l,"class","compose-btn sign-btn svelte-46pmgb"),b(h,"class","compose-btn publish-btn svelte-46pmgb"),b(n,"class","compose-header svelte-46pmgb"),b(A,"class","compose-textarea svelte-46pmgb"),b(A,"placeholder","Enter your Nostr event JSON here, or click 'Generate Template' to start with a template..."),b(A,"spellcheck","false"),b(w,"class","compose-editor svelte-46pmgb"),b(t,"class","compose-view svelte-46pmgb")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(n,a),c(n,l),c(n,f),c(n,h),c(t,g),Q&&Q.m(t,null),c(t,v),c(t,w),c(w,A),I(A,e[0]),u(i,k,d),te(C,i,d),x=!0,S||(B=[y(r,"click",e[7]),y(o,"click",e[4]),y(l,"click",e[5]),y(h,"click",e[6]),y(A,"input",e[13])],S=!0)},p(e,[n]){e[1]?Q?Q.p(e,n):(Q=yv(e),Q.c(),Q.m(t,v)):Q&&(Q.d(1),Q=null),1&n&&I(A,e[0]);const i={};4&n&&(i.userPubkey=e[2]),!E&&8&n&&(E=!0,i.isOpen=e[3],j(()=>E=!1)),C.$set(i)},i(e){x||(z(C.$$.fragment,e),x=!0)},o(e){Z(C.$$.fragment,e),x=!1},d(e){e&&d(t),Q&&Q.d(),e&&d(k),ne(C,e),S=!1,i(B)}}}function bv(e,t,n){let{composeEventJson:i=""}=t,{userPubkey:r=""}=t,{userRole:s=""}=t,{policyEnabled:o=!1}=t,{publishError:a=""}=t;const l=P();let c=!1;return e.$$set=e=>{"composeEventJson"in e&&n(0,i=e.composeEventJson),"userPubkey"in e&&n(2,r=e.userPubkey),"userRole"in e&&n(11,s=e.userRole),"policyEnabled"in e&&n(12,o=e.policyEnabled),"publishError"in e&&n(1,a=e.publishError)},[i,a,r,c,function(){l("reformatJson")},function(){l("signEvent")},function(){l("publishEvent")},function(){n(3,c=!0)},function(e){const{kind:t,template:r}=e.detail;n(0,i=JSON.stringify(r,null,2)),l("templateSelected",{kind:t,template:r})},function(){n(3,c=!1)},function(){n(1,a=""),l("clearError")},s,o,function(){i=this.value,n(0,i)},function(e){c=e,n(3,c)}]}class Av extends se{constructor(e){super(),re(this,e,bv,wv,s,{composeEventJson:0,userPubkey:2,userRole:11,policyEnabled:12,publishError:1})}}function kv(e,t,n){const i=e.slice();return i[23]=t[n],i}function Iv(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in to access sprocket management.",r=m(),s=p("button"),s.textContent="Log In",b(i,"class","svelte-fiaj1r"),b(s,"class","login-btn svelte-fiaj1r"),b(n,"class","login-prompt svelte-fiaj1r")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[18]),o=!0)},p:e,d(e){e&&d(n),o=!1,a()}}}function Cv(e){let t,n,i,r,s,o,a,l,f,h=(e[2]||"none")+"";return{c(){t=p("div"),n=p("p"),n.textContent="❌ Owner permission required for sprocket management.",i=m(),r=p("p"),r.innerHTML='To enable sprocket functionality, set the ORLY_OWNERS environment variable with your npub when starting the relay.',s=m(),o=p("p"),a=g("Current user role: "),l=p("strong"),f=g(h),b(n,"class","svelte-fiaj1r"),b(r,"class","svelte-fiaj1r"),b(o,"class","svelte-fiaj1r"),b(t,"class","permission-denied svelte-fiaj1r")},m(e,d){u(e,t,d),c(t,n),c(t,i),c(t,r),c(t,s),c(t,o),c(o,a),c(o,l),c(l,f)},p(e,t){4&t&&h!==(h=(e[2]||"none")+"")&&k(f,h)},d(e){e&&d(t)}}}function Ev(e){let t,n,r,s,o,a,l,h,v,w,A,C,E,x,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q,Y,W,z,Z,X,ee,te,ne,ie,re,se,oe,ae,le,ce,ue,de,fe,pe,he,ge,me=e[3]?.is_running?"🟢 Running":"🔴 Stopped",ve=e[3]?.script_exists?"✅ Exists":"❌ Not found",ye=e[3]?.pid&&xv(e),we=e[6]&&Sv(e),be=e[8],Ae=[];for(let t=0;t{"isLoggedIn"in e&&n(1,i=e.isLoggedIn),"userRole"in e&&n(2,r=e.userRole),"sprocketStatus"in e&&n(3,s=e.sprocketStatus),"isLoadingSprocket"in e&&n(4,o=e.isLoadingSprocket),"sprocketUploadFile"in e&&n(5,a=e.sprocketUploadFile),"sprocketScript"in e&&n(0,l=e.sprocketScript),"sprocketMessage"in e&&n(6,c=e.sprocketMessage),"sprocketMessageType"in e&&n(7,u=e.sprocketMessageType),"sprocketVersions"in e&&n(8,d=e.sprocketVersions)},[l,i,r,s,o,a,c,u,d,function(){f("restartSprocket")},function(){f("deleteSprocket")},function(e){f("sprocketFileSelect",e)},function(){f("uploadSprocketScript")},function(){f("saveSprocket")},function(){f("loadSprocket")},function(){f("loadVersions")},p,h,function(){f("openLoginModal")},function(){l=this.value,n(0,l)},e=>p(e),e=>h(e.name)]}class Pv extends se{constructor(e){super(),re(this,e,$v,Dv,s,{isLoggedIn:1,userRole:2,sprocketStatus:3,isLoadingSprocket:4,sprocketUploadFile:5,sprocketScript:0,sprocketMessage:6,sprocketMessageType:7,sprocketVersions:8})}}function Rv(e,t,n){const i=e.slice();return i[26]=t[n],i}function Tv(e,t,n){const i=e.slice();return i[29]=t[n],i}function Uv(e,t,n){const i=e.slice();return i[32]=t[n],i}function _v(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in to access policy configuration.",r=m(),s=p("button"),s.textContent="Log In",b(i,"class","svelte-gkxvxc"),b(s,"class","login-btn svelte-gkxvxc"),b(n,"class","login-prompt svelte-gkxvxc")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[16]),o=!0)},p:e,d(e){e&&d(n),o=!1,a()}}}function Nv(e){let t,n,i,r,s,o,a,l,f,h=(e[3]||"none")+"";return{c(){t=p("div"),n=p("p"),n.textContent="Policy configuration requires owner or policy admin permissions.",i=m(),r=p("p"),r.innerHTML='To become a policy admin, ask an existing policy admin to add your pubkey\n to the policy_admins list.',s=m(),o=p("p"),a=g("Current user role: "),l=p("strong"),f=g(h),b(n,"class","svelte-gkxvxc"),b(r,"class","svelte-gkxvxc"),b(o,"class","svelte-gkxvxc"),b(t,"class","permission-denied svelte-gkxvxc")},m(e,d){u(e,t,d),c(t,n),c(t,i),c(t,r),c(t,s),c(t,o),c(o,a),c(o,l),c(l,f)},p(e,t){8&t[0]&&h!==(h=(e[3]||"none")+"")&&k(f,h)},d(e){e&&d(t)}}}function Lv(e){let t,n,r,s,o,a,l,f,h,v,w,A,C,E,x,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q,Y,W,z,Z,X,ee,te,ne,ie,re,se,oe,ae,le,ce,ue,de,fe,pe,he,ge,me,ve,ye,we,be,Ae,ke,Ie,Ce,Ee,xe,Se,Be,Qe,Fe,De,$e,Pe,Re=e[5]?"Policy Enabled":"Policy Disabled",Te=e[10].length+"",Ue=e[4]&&Ov(),_e=e[9].length>0&&Mv(e),Ne=e[7]&&Hv(e);function Le(e,t){return 0===e[1].length?Jv:Gv}let Oe=Le(e),Me=Oe(e);function je(e,t){return 0===e[10].length?qv:Vv}let He=je(e),Ge=He(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Policy Editor",s=m(),o=p("div"),a=p("span"),l=g(Re),f=m(),Ue&&Ue.c(),h=m(),v=p("div"),v.innerHTML='

    Edit the policy JSON below and click "Save & Publish" to update the relay's policy configuration.\n Changes are applied immediately after validation.

    \n

    Policy updates are published as kind 12345 events and require policy admin permissions.

    ',w=m(),A=p("div"),C=p("textarea"),E=m(),_e&&_e.c(),x=m(),B=p("div"),Q=p("button"),F=g("Load Current"),D=m(),$=p("button"),P=g("Format JSON"),R=m(),T=p("button"),U=g("Validate"),_=m(),N=p("button"),L=g("Save & Publish"),O=m(),Ne&&Ne.c(),M=m(),j=p("div"),H=p("h3"),H.textContent="Policy Administrators",G=m(),J=p("div"),J.innerHTML='

    Policy admins can update the relay's policy configuration via kind 12345 events.\n Their follows get whitelisted if policy_follow_whitelist_enabled is true in the policy.

    \n

    Note: Policy admins are separate from relay admins (ORLY_ADMINS).\n Changes here update the JSON editor - click "Save & Publish" to apply.

    ',K=m(),V=p("div"),Me.c(),q=m(),Y=p("div"),W=p("input"),z=m(),Z=p("button"),X=g("+ Add Admin"),te=m(),ne=p("div"),ie=p("h3"),ie.textContent="Policy Follow Whitelist",re=m(),se=p("div"),se.innerHTML='

    Pubkeys followed by policy admins (kind 3 events).\n These get automatic read+write access when rules have write_allow_follows: true.

    ',oe=m(),ae=p("div"),le=p("span"),ce=g(Te),ue=g(" pubkey(s) in whitelist"),de=m(),fe=p("button"),pe=g("🔄 Refresh Follows"),he=m(),ge=p("div"),Ge.c(),me=m(),ve=p("div"),ye=p("h3"),ye.textContent="Policy Reference",we=m(),be=p("div"),Ae=p("h4"),Ae.textContent="Structure Overview",ke=m(),Ie=p("ul"),Ie.innerHTML='
  • kind.whitelist - Only allow these event kinds (takes precedence)
  • \n
  • kind.blacklist - Deny these event kinds (if no whitelist)
  • \n
  • global - Rules applied to all events
  • \n
  • rules - Per-kind rules (keyed by kind number as string)
  • \n
  • default_policy - "allow" or "deny" when no rules match
  • \n
  • policy_admins - Hex pubkeys that can update policy
  • \n
  • policy_follow_whitelist_enabled - Enable follow-based access
  • ',Ce=m(),Ee=p("h4"),Ee.textContent="Rule Fields",xe=m(),Se=p("ul"),Se.innerHTML='
  • description - Human-readable rule description
  • \n
  • write_allow / write_deny - Pubkey lists for write access
  • \n
  • read_allow / read_deny - Pubkey lists for read access
  • \n
  • write_allow_follows - Grant access to policy admin follows
  • \n
  • size_limit - Max total event size in bytes
  • \n
  • content_limit - Max content field size in bytes
  • \n
  • max_expiry - Max expiry offset in seconds
  • \n
  • max_age_of_event - Max age of created_at in seconds
  • \n
  • max_age_event_in_future - Max future offset in seconds
  • \n
  • must_have_tags - Required tag letters (e.g., ["d", "t"])
  • \n
  • tag_validation - Regex patterns for tag values
  • \n
  • script - Path to external validation script
  • ',Be=m(),Qe=p("h4"),Qe.textContent="Example Policy",Fe=m(),De=p("pre"),De.textContent=`${e[20]}`,b(r,"class","svelte-gkxvxc"),b(a,"class","status-badge svelte-gkxvxc"),S(a,"enabled",e[5]),b(o,"class","policy-status svelte-gkxvxc"),b(n,"class","policy-header svelte-gkxvxc"),b(v,"class","policy-info svelte-gkxvxc"),b(C,"class","policy-editor svelte-gkxvxc"),b(C,"placeholder","Loading policy configuration..."),C.disabled=e[6],b(C,"spellcheck","false"),b(A,"class","editor-container svelte-gkxvxc"),b(Q,"class","policy-btn load-btn svelte-gkxvxc"),Q.disabled=e[6],b($,"class","policy-btn format-btn svelte-gkxvxc"),$.disabled=e[6],b(T,"class","policy-btn validate-btn svelte-gkxvxc"),T.disabled=e[6],b(N,"class","policy-btn save-btn svelte-gkxvxc"),N.disabled=e[6],b(B,"class","policy-actions svelte-gkxvxc"),b(t,"class","policy-section svelte-gkxvxc"),b(J,"class","policy-info svelte-gkxvxc"),b(V,"class","admin-list svelte-gkxvxc"),b(W,"type","text"),b(W,"placeholder","npub or hex pubkey"),W.disabled=e[6],b(W,"class","svelte-gkxvxc"),b(Z,"class","policy-btn add-btn svelte-gkxvxc"),Z.disabled=ee=e[6]||!e[11].trim(),b(Y,"class","add-admin svelte-gkxvxc"),b(j,"class","policy-section svelte-gkxvxc"),b(se,"class","policy-info svelte-gkxvxc"),b(le,"class","follows-count svelte-gkxvxc"),b(fe,"class","policy-btn refresh-btn svelte-gkxvxc"),fe.disabled=e[6],b(ae,"class","follows-header svelte-gkxvxc"),b(ge,"class","follows-list svelte-gkxvxc"),b(ne,"class","policy-section svelte-gkxvxc"),b(Ae,"class","svelte-gkxvxc"),b(Ie,"class","field-list svelte-gkxvxc"),b(Ee,"class","svelte-gkxvxc"),b(Se,"class","field-list svelte-gkxvxc"),b(Qe,"class","svelte-gkxvxc"),b(De,"class","example-json svelte-gkxvxc"),b(be,"class","reference-content svelte-gkxvxc"),b(ve,"class","policy-section svelte-gkxvxc")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),c(a,l),c(o,f),Ue&&Ue.m(o,null),c(t,h),c(t,v),c(t,w),c(t,A),c(A,C),I(C,e[0]),c(t,E),_e&&_e.m(t,null),c(t,x),c(t,B),c(B,Q),c(Q,F),c(B,D),c(B,$),c($,P),c(B,R),c(B,T),c(T,U),c(B,_),c(B,N),c(N,L),c(t,O),Ne&&Ne.m(t,null),u(i,M,d),u(i,j,d),c(j,H),c(j,G),c(j,J),c(j,K),c(j,V),Me.m(V,null),c(j,q),c(j,Y),c(Y,W),I(W,e[11]),c(Y,z),c(Y,Z),c(Z,X),u(i,te,d),u(i,ne,d),c(ne,ie),c(ne,re),c(ne,se),c(ne,oe),c(ne,ae),c(ae,le),c(le,ce),c(le,ue),c(ae,de),c(ae,fe),c(fe,pe),c(ne,he),c(ne,ge),Ge.m(ge,null),u(i,me,d),u(i,ve,d),c(ve,ye),c(ve,we),c(ve,be),c(be,Ae),c(be,ke),c(be,Ie),c(be,Ce),c(be,Ee),c(be,xe),c(be,Se),c(be,Be),c(be,Qe),c(be,Fe),c(be,De),$e||(Pe=[y(C,"input",e[21]),y(Q,"click",e[12]),y($,"click",e[15]),y(T,"click",e[13]),y(N,"click",e[14]),y(W,"input",e[23]),y(W,"keydown",e[24]),y(Z,"click",e[18]),y(fe,"click",e[17])],$e=!0)},p(e,n){32&n[0]&&Re!==(Re=e[5]?"Policy Enabled":"Policy Disabled")&&k(l,Re),32&n[0]&&S(a,"enabled",e[5]),e[4]?Ue||(Ue=Ov(),Ue.c(),Ue.m(o,null)):Ue&&(Ue.d(1),Ue=null),64&n[0]&&(C.disabled=e[6]),1&n[0]&&I(C,e[0]),e[9].length>0?_e?_e.p(e,n):(_e=Mv(e),_e.c(),_e.m(t,x)):_e&&(_e.d(1),_e=null),64&n[0]&&(Q.disabled=e[6]),64&n[0]&&($.disabled=e[6]),64&n[0]&&(T.disabled=e[6]),64&n[0]&&(N.disabled=e[6]),e[7]?Ne?Ne.p(e,n):(Ne=Hv(e),Ne.c(),Ne.m(t,null)):Ne&&(Ne.d(1),Ne=null),Oe===(Oe=Le(e))&&Me?Me.p(e,n):(Me.d(1),Me=Oe(e),Me&&(Me.c(),Me.m(V,null))),64&n[0]&&(W.disabled=e[6]),2048&n[0]&&W.value!==e[11]&&I(W,e[11]),2112&n[0]&&ee!==(ee=e[6]||!e[11].trim())&&(Z.disabled=ee),1024&n[0]&&Te!==(Te=e[10].length+"")&&k(ce,Te),64&n[0]&&(fe.disabled=e[6]),He===(He=je(e))&&Ge?Ge.p(e,n):(Ge.d(1),Ge=He(e),Ge&&(Ge.c(),Ge.m(ge,null)))},d(e){e&&d(t),Ue&&Ue.d(),_e&&_e.d(),Ne&&Ne.d(),e&&d(M),e&&d(j),Me.d(),e&&d(te),e&&d(ne),Ge.d(),e&&d(me),e&&d(ve),$e=!1,i(Pe)}}}function Ov(e){let t;return{c(){t=p("span"),t.textContent="Policy Admin",b(t,"class","admin-badge svelte-gkxvxc")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Mv(e){let t,n,i,r,s=e[9],o=[];for(let t=0;t{"isLoggedIn"in e&&n(2,i=e.isLoggedIn),"userRole"in e&&n(3,r=e.userRole),"isPolicyAdmin"in e&&n(4,s=e.isPolicyAdmin),"policyEnabled"in e&&n(5,o=e.policyEnabled),"policyJson"in e&&n(0,a=e.policyJson),"isLoadingPolicy"in e&&n(6,l=e.isLoadingPolicy),"policyMessage"in e&&n(7,c=e.policyMessage),"policyMessageType"in e&&n(8,u=e.policyMessageType),"validationErrors"in e&&n(9,d=e.validationErrors),"policyAdmins"in e&&n(1,f=e.policyAdmins),"policyFollows"in e&&n(10,p=e.policyFollows)},e.$$.update=()=>{if(1&e.$$.dirty[0])try{if(a){const e=JSON.parse(a);n(1,f=e.policy_admins||[])}}catch(e){}},[a,f,i,r,s,o,l,c,u,d,p,g,function(){h("loadPolicy")},function(){h("validatePolicy")},function(){h("savePolicy")},function(){h("formatJson")},function(){h("openLoginModal")},function(){h("refreshFollows")},m,v,'{\n "kind": {\n "whitelist": [0, 1, 3, 6, 7, 10002],\n "blacklist": []\n },\n "global": {\n "description": "Global rules applied to all events",\n "size_limit": 65536,\n "max_age_of_event": 86400,\n "max_age_event_in_future": 300\n },\n "rules": {\n "1": {\n "description": "Kind 1 (short text notes)",\n "content_limit": 8192,\n "write_allow_follows": true\n },\n "30023": {\n "description": "Long-form articles",\n "content_limit": 100000,\n "tag_validation": {\n "d": "^[a-z0-9-]{1,64}$",\n "t": "^[a-z0-9-]{1,32}$"\n }\n }\n },\n "default_policy": "allow",\n "policy_admins": [""],\n "policy_follow_whitelist_enabled": true\n}',function(){a=this.value,n(0,a)},e=>v(e),function(){g=this.value,n(11,g)},e=>"Enter"===e.key&&m()]}class Zv extends se{constructor(e){super(),re(this,e,zv,Wv,s,{isLoggedIn:2,userRole:3,isPolicyAdmin:4,policyEnabled:5,policyJson:0,isLoadingPolicy:6,policyMessage:7,policyMessageType:8,validationErrors:9,policyAdmins:1,policyFollows:10},null,[-1,-1])}}const Xv=[{id:"social",name:"Social/Notes",description:"User profiles, notes, follows, reposts, reactions, and relay lists",kinds:[0,1,3,6,7,10002]},{id:"dm",name:"Direct Messages",description:"Encrypted direct messages (legacy and NIP-17 gift-wrapped)",kinds:[4,14,1059]},{id:"longform",name:"Long-form Content",description:"Blog posts and article drafts",kinds:[30023,30024]},{id:"media",name:"Media",description:"File metadata and media attachments",kinds:[1063,20,21,22]},{id:"marketplace_nip15",name:"Marketplace (NIP-15)",description:"Legacy NIP-15 stalls and products",kinds:[30017,30018,30019,30020]},{id:"marketplace_nip99",name:"Marketplace (NIP-99/Gamma)",description:"NIP-99 classified listings, collections, shipping, reviews (Plebeian Market)",kinds:[30402,30403,30405,30406,31555]},{id:"order_communication",name:"Order Communication",description:"Gamma Markets order messages and payment receipts (kinds 16, 17)",kinds:[16,17]},{id:"groups_nip29",name:"Group Messaging (NIP-29)",description:"Simple relay-based group chat messages",kinds:[9,10,11,12]},{id:"groups_nip72",name:"Communities (NIP-72)",description:"Community definitions and threaded discussions",kinds:[34550,1111,4550]},{id:"lists",name:"Lists/Bookmarks",description:"Mute lists, pin lists, and parameterized list events",kinds:[1e4,10001,3e4,30001]}];function ey(e,t,n){const i=e.slice();return i[68]=t[n],i}function ty(e,t,n){const i=e.slice();return i[73]=t[n],i}function ny(e,t,n){const i=e.slice();return i[76]=t[n],i}function iy(e,t,n){const i=e.slice();return i[79]=t[n],i}function ry(e,t,n){const i=e.slice();return i[82]=t[n],i}function sy(e,t,n){const i=e.slice();return i[82]=t[n],i}function oy(e,t,n){const i=e.slice();return i[68]=t[n],i}function ay(e){let t,n,i;return{c(){t=p("div"),n=g(e[2]),b(t,"class",i="message "+e[3]+" svelte-vbat7g")},m(e,i){u(e,t,i),c(t,n)},p(e,r){4&r[0]&&k(n,e[2]),8&r[0]&&i!==(i="message "+e[3]+" svelte-vbat7g")&&b(t,"class",i)},d(e){e&&d(t)}}}function ly(e){let t,n,r,s,o,a,l,f,h,v,w,A,I,C,E,x,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q=e[6].length+"",Y=e[9].length+"",W=e[12].length+"",z=e[13].length+"",Z=e[14].length+"",X="trusted"===e[0]&&uy(e),ee="blacklist"===e[0]&&gy(e),te="unclassified"===e[0]&&by(e),ne="spam"===e[0]&&Cy(e),ie="ips"===e[0]&&Qy(e),re="settings"===e[0]&&Ty(e);return{c(){t=p("div"),n=p("button"),r=g("Trusted ("),s=g(q),o=g(")"),a=m(),l=p("button"),f=g("Blacklist ("),h=g(Y),v=g(")"),w=m(),A=p("button"),I=g("Unclassified ("),C=g(W),E=g(")"),x=m(),B=p("button"),Q=g("Spam ("),F=g(z),D=g(")"),$=m(),P=p("button"),R=g("Blocked IPs ("),T=g(Z),U=g(")"),_=m(),N=p("button"),N.textContent="Settings",L=m(),O=p("div"),X&&X.c(),M=m(),ee&&ee.c(),j=m(),te&&te.c(),H=m(),ne&&ne.c(),G=m(),ie&&ie.c(),J=m(),re&&re.c(),b(n,"class","tab svelte-vbat7g"),S(n,"active","trusted"===e[0]),b(l,"class","tab svelte-vbat7g"),S(l,"active","blacklist"===e[0]),b(A,"class","tab svelte-vbat7g"),S(A,"active","unclassified"===e[0]),b(B,"class","tab svelte-vbat7g"),S(B,"active","spam"===e[0]),b(P,"class","tab svelte-vbat7g"),S(P,"active","ips"===e[0]),b(N,"class","tab svelte-vbat7g"),S(N,"active","settings"===e[0]),b(t,"class","tabs svelte-vbat7g"),b(O,"class","tab-content svelte-vbat7g")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(t,a),c(t,l),c(l,f),c(l,h),c(l,v),c(t,w),c(t,A),c(A,I),c(A,C),c(A,E),c(t,x),c(t,B),c(B,Q),c(B,F),c(B,D),c(t,$),c(t,P),c(P,R),c(P,T),c(P,U),c(t,_),c(t,N),u(i,L,d),u(i,O,d),X&&X.m(O,null),c(O,M),ee&&ee.m(O,null),c(O,j),te&&te.m(O,null),c(O,H),ne&&ne.m(O,null),c(O,G),ie&&ie.m(O,null),c(O,J),re&&re.m(O,null),K||(V=[y(n,"click",e[36]),y(l,"click",e[37]),y(A,"click",e[38]),y(B,"click",e[39]),y(P,"click",e[40]),y(N,"click",e[41])],K=!0)},p(e,t){64&t[0]&&q!==(q=e[6].length+"")&&k(s,q),1&t[0]&&S(n,"active","trusted"===e[0]),512&t[0]&&Y!==(Y=e[9].length+"")&&k(h,Y),1&t[0]&&S(l,"active","blacklist"===e[0]),4096&t[0]&&W!==(W=e[12].length+"")&&k(C,W),1&t[0]&&S(A,"active","unclassified"===e[0]),8192&t[0]&&z!==(z=e[13].length+"")&&k(F,z),1&t[0]&&S(B,"active","spam"===e[0]),16384&t[0]&&Z!==(Z=e[14].length+"")&&k(T,Z),1&t[0]&&S(P,"active","ips"===e[0]),1&t[0]&&S(N,"active","settings"===e[0]),"trusted"===e[0]?X?X.p(e,t):(X=uy(e),X.c(),X.m(O,M)):X&&(X.d(1),X=null),"blacklist"===e[0]?ee?ee.p(e,t):(ee=gy(e),ee.c(),ee.m(O,j)):ee&&(ee.d(1),ee=null),"unclassified"===e[0]?te?te.p(e,t):(te=by(e),te.c(),te.m(O,H)):te&&(te.d(1),te=null),"spam"===e[0]?ne?ne.p(e,t):(ne=Cy(e),ne.c(),ne.m(O,G)):ne&&(ne.d(1),ne=null),"ips"===e[0]?ie?ie.p(e,t):(ie=Qy(e),ie.c(),ie.m(O,J)):ie&&(ie.d(1),ie=null),"settings"===e[0]?re?re.p(e,t):(re=Ty(e),re.c(),re.m(O,null)):re&&(re.d(1),re=null)},d(e){e&&d(t),e&&d(L),e&&d(O),X&&X.d(),ee&&ee.d(),te&&te.d(),ne&&ne.d(),ie&&ie.d(),re&&re.d(),K=!1,i(V)}}}function cy(e){let t,n,r,s,o,a,l,h,g,v,w,k,C,E,x,S,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q,Y,W,z,Z,X=Xv,ee=[];for(let t=0;tInitial Configuration \n

    Configure curating mode before the relay will accept events. Select which event kinds to allow and set rate limiting parameters.

    ',r=m(),s=p("div"),o=p("h4"),o.textContent="Allowed Event Kinds",a=m(),l=p("p"),l.textContent="Select categories of events to allow. At least one must be selected.",h=m(),g=p("div");for(let e=0;e0?fy:dy}let B=S(e),Q=B(e);return{c(){t=p("div"),n=p("h3"),n.textContent="Trusted Publishers",r=m(),s=p("p"),s.textContent="Trusted users can publish unlimited events without rate limiting.",o=m(),a=p("div"),l=p("input"),f=m(),h=p("input"),v=m(),w=p("button"),A=g("Trust"),k=m(),C=p("div"),Q.c(),b(n,"class","svelte-vbat7g"),b(s,"class","help-text svelte-vbat7g"),b(l,"type","text"),b(l,"placeholder","Pubkey (64 hex chars)"),b(l,"class","svelte-vbat7g"),b(h,"type","text"),b(h,"placeholder","Note (optional)"),b(h,"class","svelte-vbat7g"),w.disabled=e[1],b(w,"class","svelte-vbat7g"),b(a,"class","add-form svelte-vbat7g"),b(C,"class","list svelte-vbat7g"),b(t,"class","section svelte-vbat7g")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(t,o),c(t,a),c(a,l),I(l,e[7]),c(a,f),c(a,h),I(h,e[8]),c(a,v),c(a,w),c(w,A),c(t,k),c(t,C),Q.m(C,null),E||(x=[y(l,"input",e[42]),y(h,"input",e[43]),y(w,"click",e[44])],E=!0)},p(e,t){128&t[0]&&l.value!==e[7]&&I(l,e[7]),256&t[0]&&h.value!==e[8]&&I(h,e[8]),2&t[0]&&(w.disabled=e[1]),B===(B=S(e))&&Q?Q.p(e,t):(Q.d(1),Q=B(e),Q&&(Q.c(),Q.m(C,null)))},d(e){e&&d(t),Q.d(),E=!1,i(x)}}}function dy(t){let n;return{c(){n=p("div"),n.textContent="No trusted pubkeys yet.",b(n,"class","empty svelte-vbat7g")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function fy(e){let t,n=e[6],i=[];for(let t=0;t0?vy:my}let B=S(e),Q=B(e);return{c(){t=p("div"),n=p("h3"),n.textContent="Blacklisted Publishers",r=m(),s=p("p"),s.textContent="Blacklisted users cannot publish any events.",o=m(),a=p("div"),l=p("input"),f=m(),h=p("input"),v=m(),w=p("button"),A=g("Blacklist"),k=m(),C=p("div"),Q.c(),b(n,"class","svelte-vbat7g"),b(s,"class","help-text svelte-vbat7g"),b(l,"type","text"),b(l,"placeholder","Pubkey (64 hex chars)"),b(l,"class","svelte-vbat7g"),b(h,"type","text"),b(h,"placeholder","Reason (optional)"),b(h,"class","svelte-vbat7g"),w.disabled=e[1],b(w,"class","svelte-vbat7g"),b(a,"class","add-form svelte-vbat7g"),b(C,"class","list svelte-vbat7g"),b(t,"class","section svelte-vbat7g")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(t,o),c(t,a),c(a,l),I(l,e[10]),c(a,f),c(a,h),I(h,e[11]),c(a,v),c(a,w),c(w,A),c(t,k),c(t,C),Q.m(C,null),E||(x=[y(l,"input",e[46]),y(h,"input",e[47]),y(w,"click",e[48])],E=!0)},p(e,t){1024&t[0]&&l.value!==e[10]&&I(l,e[10]),2048&t[0]&&h.value!==e[11]&&I(h,e[11]),2&t[0]&&(w.disabled=e[1]),B===(B=S(e))&&Q?Q.p(e,t):(Q.d(1),Q=B(e),Q&&(Q.c(),Q.m(C,null)))},d(e){e&&d(t),Q.d(),E=!1,i(x)}}}function my(t){let n;return{c(){n=p("div"),n.textContent="No blacklisted pubkeys.",b(n,"class","empty svelte-vbat7g")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function vy(e){let t,n=e[9],i=[];for(let t=0;t0?ky:Ay}let x=E(e),S=x(e);return{c(){t=p("div"),n=p("h3"),n.textContent="Unclassified Users",r=m(),s=p("p"),s.textContent="Users who have posted events but haven't been classified. Sorted by event count.",o=m(),a=p("div"),l=p("button"),f=g("Refresh"),h=m(),v=p("button"),w=g("Scan Database"),A=m(),k=p("div"),S.c(),b(n,"class","svelte-vbat7g"),b(s,"class","help-text svelte-vbat7g"),b(l,"class","refresh-btn svelte-vbat7g"),l.disabled=e[1],b(v,"class","scan-btn svelte-vbat7g"),v.disabled=e[1],b(a,"class","button-row svelte-vbat7g"),b(k,"class","list svelte-vbat7g"),b(t,"class","section svelte-vbat7g")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(t,o),c(t,a),c(a,l),c(l,f),c(a,h),c(a,v),c(v,w),c(t,A),c(t,k),S.m(k,null),I||(C=[y(l,"click",e[15]),y(v,"click",e[16])],I=!0)},p(e,t){2&t[0]&&(l.disabled=e[1]),2&t[0]&&(v.disabled=e[1]),x===(x=E(e))&&S?S.p(e,t):(S.d(1),S=x(e),S&&(S.c(),S.m(k,null)))},d(e){e&&d(t),S.d(),I=!1,i(C)}}}function Ay(t){let n;return{c(){n=p("div"),n.textContent="No unclassified users.",b(n,"class","empty svelte-vbat7g")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function ky(e){let t,n=e[12],i=[];for(let t=0;t0?xy:Ey}let A=w(e),k=A(e);return{c(){t=p("div"),n=p("h3"),n.textContent="Spam Events",i=m(),r=p("p"),r.textContent="Events flagged as spam are hidden from query results but remain in the database.",s=m(),o=p("button"),a=g("Refresh"),l=m(),f=p("div"),k.c(),b(n,"class","svelte-vbat7g"),b(r,"class","help-text svelte-vbat7g"),b(o,"class","refresh-btn svelte-vbat7g"),o.disabled=e[1],b(f,"class","list svelte-vbat7g"),b(t,"class","section svelte-vbat7g")},m(d,p){u(d,t,p),c(t,n),c(t,i),c(t,r),c(t,s),c(t,o),c(o,a),c(t,l),c(t,f),k.m(f,null),h||(v=y(o,"click",e[17]),h=!0)},p(e,t){2&t[0]&&(o.disabled=e[1]),A===(A=w(e))&&k?k.p(e,t):(k.d(1),k=A(e),k&&(k.c(),k.m(f,null)))},d(e){e&&d(t),k.d(),h=!1,v()}}}function Ey(t){let n;return{c(){n=p("div"),n.textContent="No spam events flagged.",b(n,"class","empty svelte-vbat7g")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function xy(e){let t,n=e[13],i=[];for(let t=0;t0?Dy:Fy}let A=w(e),k=A(e);return{c(){t=p("div"),n=p("h3"),n.textContent="Blocked IP Addresses",i=m(),r=p("p"),r.textContent="IP addresses blocked due to rate limit violations.",s=m(),o=p("button"),a=g("Refresh"),l=m(),f=p("div"),k.c(),b(n,"class","svelte-vbat7g"),b(r,"class","help-text svelte-vbat7g"),b(o,"class","refresh-btn svelte-vbat7g"),o.disabled=e[1],b(f,"class","list svelte-vbat7g"),b(t,"class","section svelte-vbat7g")},m(d,p){u(d,t,p),c(t,n),c(t,i),c(t,r),c(t,s),c(t,o),c(o,a),c(t,l),c(t,f),k.m(f,null),h||(v=y(o,"click",e[18]),h=!0)},p(e,t){2&t[0]&&(o.disabled=e[1]),A===(A=w(e))&&k?k.p(e,t):(k.d(1),k=A(e),k&&(k.c(),k.m(f,null)))},d(e){e&&d(t),k.d(),h=!1,v()}}}function Fy(t){let n;return{c(){n=p("div"),n.textContent="No blocked IPs.",b(n,"class","empty svelte-vbat7g")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Dy(e){let t,n=e[14],i=[];for(let t=0;tt!==e),u):n(5,u.categories=[...u.categories,e],u)}async function _(){if(!i||!r)return n(2,a="Please log in with a Nostr extension to publish configuration"),void n(3,l="error");if(0===u.categories.length&&!u.custom_kinds.trim())return n(2,a="Please select at least one kind category or enter custom kinds"),void n(3,l="error");try{n(1,o=!0),n(2,a="");const e=[["d","curating-config"],["daily_limit",String(u.daily_limit)],["first_ban_hours",String(u.first_ban_hours)],["second_ban_hours",String(u.second_ban_hours)]];for(const t of u.categories)e.push(["kind_category",t]);const t=function(e){if(!e||!e.trim())return[];const t=new Set,n=e.split(",").map(e=>e.trim());for(const e of n)if(e)if(e.includes("-")){const[n,i]=e.split("-").map(e=>parseInt(e.trim(),10));if(!isNaN(n)&&!isNaN(i)&&n<=i&&i-n<=1e3)for(let e=n;e<=i;e++)t.add(e)}else{const n=parseInt(e,10);isNaN(n)||t.add(n)}return Array.from(t).sort((e,t)=>e-t)}(u.custom_kinds);for(const n of t)e.push(["kind",String(n)]);const s={kind:30078,created_at:Math.floor(Date.now()/1e3),tags:e,content:"Curating relay configuration",pubkey:r},d=await i.signEvent(s),f=new WebSocket(window.location.origin.replace(/^http/,"ws"));await new Promise((e,t)=>{f.onopen=()=>{f.send(JSON.stringify(["EVENT",d]))},f.onmessage=n=>{const i=JSON.parse(n.data);"OK"===i[0]&&(!0===i[2]?e():t(new Error(i[3]||"Event rejected")))},f.onerror=e=>t(new Error("WebSocket error")),setTimeout(()=>t(new Error("Timeout")),1e4)}),f.close(),n(2,a="Configuration published successfully"),n(3,l="success"),n(4,c=!0),await k()}catch(e){console.error("Failed to publish configuration:",e),n(2,a=`Failed to publish: ${e.message}`),n(3,l="error")}finally{n(1,o=!1)}}D(async()=>{await async function(){try{const e=await b("isconfigured");n(4,c=!0===e),c&&(await async function(){try{const e=await b("getcuratingconfig");e&&n(5,u={daily_limit:e.daily_limit||50,first_ban_hours:e.first_ban_hours||1,second_ban_hours:e.second_ban_hours||168,categories:e.categories||[],custom_kinds:e.custom_kinds?e.custom_kinds.join(", "):"",kind_ranges:e.kind_ranges||[]})}catch(e){console.error("Failed to load config:",e)}}(),await k())}catch(e){console.error("Failed to check configuration:",e),n(4,c=!1)}}()});return e.$$set=e=>{"userSigner"in e&&n(29,i=e.userSigner),"userPubkey"in e&&n(30,r=e.userPubkey)},[s,o,a,l,c,u,d,f,p,h,g,m,v,y,w,E,async function(){try{const e=await b("scanpubkeys");showMessage(`Database scanned: ${e.total_pubkeys} pubkeys, ${e.total_events} events (${e.skipped} skipped)`,"success"),await E()}catch(e){console.error("Failed to scan database:",e),showMessage("Failed to scan database: "+e.message,"error")}},x,S,B,Q,F,$,P,R,T,U,_,async function(){await _()},i,r,e=>U(e.id),function(){u.custom_kinds=this.value,n(5,u)},function(){u.daily_limit=A(this.value),n(5,u)},function(){u.first_ban_hours=A(this.value),n(5,u)},function(){u.second_ban_hours=A(this.value),n(5,u)},()=>n(0,s="trusted"),()=>n(0,s="blacklist"),()=>n(0,s="unclassified"),()=>n(0,s="spam"),()=>n(0,s="ips"),()=>n(0,s="settings"),function(){f=this.value,n(7,f)},function(){p=this.value,n(8,p)},()=>B(),e=>Q(e.pubkey),function(){g=this.value,n(10,g)},function(){m=this.value,n(11,m)},()=>F(),e=>$(e.pubkey),e=>B(e.pubkey,""),e=>F(e.pubkey,""),e=>P(e.event_id),e=>R(e.event_id),e=>T(e.ip),e=>U(e.id),function(){u.custom_kinds=this.value,n(5,u)},function(){u.daily_limit=A(this.value),n(5,u)},function(){u.first_ban_hours=A(this.value),n(5,u)},function(){u.second_ban_hours=A(this.value),n(5,u)}]}class Ky extends se{constructor(e){super(),re(this,e,Jy,jy,s,{userSigner:29,userPubkey:30},null,[-1,-1,-1])}}const{window:Vy}=l;function qy(e,t,n){const i=e.slice();return i[57]=t[n],i}function Yy(e,t,n){const i=e.slice();return i[54]=t[n],i}function Wy(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in to view your Blossom storage.",r=m(),s=p("button"),s.textContent="Log In",b(i,"class","svelte-on0yal"),b(s,"class","login-btn svelte-on0yal"),b(n,"class","login-prompt svelte-on0yal")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[20]),o=!0)},p:e,d(e){e&&d(n),o=!1,a()}}}function zy(e){let t,n,i,r,s,o,a,l,f,h,v,w,A,I,C=e[0]||e[12]?"Loading...":"Refresh";function E(e,t){return e[13]?ew:e[10]?Xy:Zy}let x=E(e),S=x(e),B=e[14]&&!e[10]&&!e[13]&&nw(e),Q=!e[10]&&!e[13]&&iw(e),F=e[2]&&sw(e);function D(e,t){return e[10]&&!e[13]?aw:ow}let $=D(e),P=$(e);return{c(){t=p("div"),n=p("div"),S.c(),i=m(),r=p("div"),B&&B.c(),s=m(),o=p("button"),a=g("🔄 "),l=g(C),h=m(),Q&&Q.c(),v=m(),F&&F.c(),w=m(),P.c(),b(o,"class","refresh-btn svelte-on0yal"),o.disabled=f=e[0]||e[12],b(r,"class","header-buttons svelte-on0yal"),b(n,"class","header-section svelte-on0yal"),b(t,"class","blossom-view svelte-on0yal")},m(d,f){u(d,t,f),c(t,n),S.m(n,null),c(n,i),c(n,r),B&&B.m(r,null),c(r,s),c(r,o),c(o,a),c(o,l),c(t,h),Q&&Q.m(t,null),c(t,v),F&&F.m(t,null),c(t,w),P.m(t,null),A||(I=y(o,"click",e[30]),A=!0)},p(e,a){x===(x=E(e))&&S?S.p(e,a):(S.d(1),S=x(e),S&&(S.c(),S.m(n,i))),!e[14]||e[10]||e[13]?B&&(B.d(1),B=null):B?B.p(e,a):(B=nw(e),B.c(),B.m(r,s)),4097&a[0]&&C!==(C=e[0]||e[12]?"Loading...":"Refresh")&&k(l,C),4097&a[0]&&f!==(f=e[0]||e[12])&&(o.disabled=f),e[10]||e[13]?Q&&(Q.d(1),Q=null):Q?Q.p(e,a):(Q=iw(e),Q.c(),Q.m(t,v)),e[2]?F?F.p(e,a):(F=sw(e),F.c(),F.m(t,w)):F&&(F.d(1),F=null),$===($=D(e))&&P?P.p(e,a):(P.d(1),P=$(e),P&&(P.c(),P.m(t,null)))},d(e){e&&d(t),S.d(),B&&B.d(),Q&&Q.d(),F&&F.d(),P.d(),A=!1,I()}}}function Zy(t){let n;return{c(){n=p("h3"),n.textContent="Blossom Media Storage",b(n,"class","svelte-on0yal")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Xy(t){let n,i,r,s,o;return{c(){n=p("button"),n.textContent="← Back",i=m(),r=p("h3"),r.textContent="All Users Storage",b(n,"class","back-btn svelte-on0yal"),b(r,"class","svelte-on0yal")},m(e,a){u(e,n,a),u(e,i,a),u(e,r,a),s||(o=y(n,"click",t[27]),s=!0)},p:e,d(e){e&&d(n),e&&d(i),e&&d(r),s=!1,o()}}}function ew(e){let t,n,i,r,s,o,a,l=(e[13].profile?.name||_w(e[25](e[13].pubkey)))+"",f=e[13].profile?.picture&&tw(e);return{c(){t=p("button"),t.textContent="← Back",n=m(),i=p("h3"),f&&f.c(),r=m(),s=g(l),b(t,"class","back-btn svelte-on0yal"),b(i,"class","user-header svelte-on0yal")},m(l,d){u(l,t,d),u(l,n,d),u(l,i,d),f&&f.m(i,null),c(i,r),c(i,s),o||(a=y(t,"click",e[29]),o=!0)},p(e,t){e[13].profile?.picture?f?f.p(e,t):(f=tw(e),f.c(),f.m(i,r)):f&&(f.d(1),f=null),8192&t[0]&&l!==(l=(e[13].profile?.name||_w(e[25](e[13].pubkey)))+"")&&k(s,l)},d(e){e&&d(t),e&&d(n),e&&d(i),f&&f.d(),o=!1,a()}}}function tw(e){let t,n;return{c(){t=p("img"),a(t.src,n=e[13].profile.picture)||b(t,"src",n),b(t,"alt",""),b(t,"class","header-avatar svelte-on0yal")},m(e,n){u(e,t,n)},p(e,i){8192&i[0]&&!a(t.src,n=e[13].profile.picture)&&b(t,"src",n)},d(e){e&&d(t)}}}function nw(e){let t,n,i,r;return{c(){t=p("button"),n=g("Admin"),b(t,"class","admin-btn svelte-on0yal"),t.disabled=e[0]},m(s,o){u(s,t,o),c(t,n),i||(r=y(t,"click",e[26]),i=!0)},p(e,n){1&n[0]&&(t.disabled=e[0])},d(e){e&&d(t),i=!1,r()}}}function iw(e){let t,n,r,s,o,a,l,f,h,v,w=e[3].length>0&&rw(e);return{c(){t=p("div"),n=p("span"),n.textContent="Upload new files",r=m(),s=p("input"),o=m(),w&&w.c(),a=m(),l=p("button"),f=g("Select Files"),b(n,"class","upload-label svelte-on0yal"),b(s,"type","file"),s.multiple=!0,b(s,"class","file-input-hidden svelte-on0yal"),b(l,"class","select-btn svelte-on0yal"),l.disabled=e[4],b(t,"class","upload-section svelte-on0yal")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),e[39](s),c(t,o),w&&w.m(t,null),c(t,a),c(t,l),c(l,f),h||(v=[y(s,"change",e[22]),y(l,"click",e[23])],h=!0)},p(e,n){e[3].length>0?w?w.p(e,n):(w=rw(e),w.c(),w.m(t,a)):w&&(w.d(1),w=null),16&n[0]&&(l.disabled=e[4])},d(n){n&&d(t),e[39](null),w&&w.d(),h=!1,i(v)}}}function rw(e){let t,n,i,r,s,o,a,l,f=e[3].length+"",h=(e[4]?e[5]:"Upload")+"";return{c(){t=p("span"),n=g(f),i=g(" file(s) selected"),r=m(),s=p("button"),o=g(h),b(t,"class","selected-count svelte-on0yal"),b(s,"class","upload-btn svelte-on0yal"),s.disabled=e[4]},m(d,f){u(d,t,f),c(t,n),c(t,i),u(d,r,f),u(d,s,f),c(s,o),a||(l=y(s,"click",e[24]),a=!0)},p(e,t){8&t[0]&&f!==(f=e[3].length+"")&&k(n,f),48&t[0]&&h!==(h=(e[4]?e[5]:"Upload")+"")&&k(o,h),16&t[0]&&(s.disabled=e[4])},d(e){e&&d(t),e&&d(r),e&&d(s),a=!1,l()}}}function sw(e){let t,n;return{c(){t=p("div"),n=g(e[2]),b(t,"class","error-message svelte-on0yal")},m(e,i){u(e,t,i),c(t,n)},p(e,t){4&t[0]&&k(n,e[2])},d(e){e&&d(t)}}}function ow(e){let t,n,i;function r(e,i){return 1&i[0]&&(t=null),null==t&&(t=!(!e[0]||0!==e[31]().length)),t?uw:(null==n&&(n=!(0!==e[31]().length)),n?cw:lw)}let s=r(e,[-1,-1]),o=s(e);return{c(){o.c(),i=v()},m(e,t){o.m(e,t),u(e,i,t)},p(e,t){s===(s=r(e,t))&&o?o.p(e,t):(o.d(1),o=s(e),o&&(o.c(),o.m(i.parentNode,i)))},d(e){o.d(e),e&&d(i)}}}function aw(e){let t;function n(e,t){return e[12]?vw:0===e[11].length?mw:gw}let i=n(e),r=i(e);return{c(){r.c(),t=v()},m(e,n){r.m(e,n),u(e,t,n)},p(e,s){i===(i=n(e))&&r?r.p(e,s):(r.d(1),r=i(e),r&&(r.c(),r.m(t.parentNode,t)))},d(e){r.d(e),e&&d(t)}}}function lw(e){let t,n=e[31](),i=[];for(let t=0;tNo users have uploaded files yet.

    ",b(n,"class","empty-state svelte-on0yal")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function vw(t){let n;return{c(){n=p("div"),n.textContent="Loading user statistics...",b(n,"class","loading svelte-on0yal")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function yw(t){let n;return{c(){n=p("div"),b(n,"class","user-avatar-placeholder svelte-on0yal")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function ww(e){let t,n;return{c(){t=p("img"),a(t.src,n=e[54].profile.picture)||b(t,"src",n),b(t,"alt",""),b(t,"class","user-avatar svelte-on0yal")},m(e,n){u(e,t,n)},p(e,i){2048&i[0]&&!a(t.src,n=e[54].profile.picture)&&b(t,"src",n)},d(e){e&&d(t)}}}function bw(e){let t,n,r,s,o,a,l,f,h,v,w,A,I,C,E,x,S,B,Q,F,D,$,P,R,T,U=(e[54].profile?.name||_w(e[25](e[54].pubkey)))+"",_=e[25](e[54].pubkey)+"",N=_w(e[25](e[54].pubkey))+"",L=e[54].blob_count+"",O=Dw(e[54].total_size_bytes)+"";function M(e,t){return e[54].profile?.picture?ww:yw}let j=M(e),H=j(e);function G(){return e[40](e[54])}function J(...t){return e[41](e[54],...t)}return{c(){t=p("div"),n=p("div"),H.c(),r=m(),s=p("div"),o=p("div"),a=g(U),l=m(),f=p("div"),h=p("span"),v=g(_),w=m(),A=p("span"),I=g(N),E=m(),x=p("div"),S=p("span"),B=g(L),Q=g(" files"),F=m(),D=p("span"),$=g(O),P=m(),b(n,"class","user-avatar-container svelte-on0yal"),b(o,"class","user-name svelte-on0yal"),b(h,"class","npub-full svelte-on0yal"),b(A,"class","npub-truncated svelte-on0yal"),b(f,"class","user-npub svelte-on0yal"),b(f,"title",C=e[54].pubkey),b(s,"class","user-info svelte-on0yal"),b(S,"class","blob-count svelte-on0yal"),b(D,"class","total-size svelte-on0yal"),b(x,"class","user-stats svelte-on0yal"),b(t,"class","user-stat-item svelte-on0yal"),b(t,"role","button"),b(t,"tabindex","0")},m(e,i){u(e,t,i),c(t,n),H.m(n,null),c(t,r),c(t,s),c(s,o),c(o,a),c(s,l),c(s,f),c(f,h),c(h,v),c(f,w),c(f,A),c(A,I),c(t,E),c(t,x),c(x,S),c(S,B),c(S,Q),c(x,F),c(x,D),c(D,$),c(t,P),R||(T=[y(t,"click",G),y(t,"keypress",J)],R=!0)},p(t,i){j===(j=M(e=t))&&H?H.p(e,i):(H.d(1),H=j(e),H&&(H.c(),H.m(n,null))),2048&i[0]&&U!==(U=(e[54].profile?.name||_w(e[25](e[54].pubkey)))+"")&&k(a,U),2048&i[0]&&_!==(_=e[25](e[54].pubkey)+"")&&k(v,_),2048&i[0]&&N!==(N=_w(e[25](e[54].pubkey))+"")&&k(I,N),2048&i[0]&&C!==(C=e[54].pubkey)&&b(f,"title",C),2048&i[0]&&L!==(L=e[54].blob_count+"")&&k(B,L),2048&i[0]&&O!==(O=Dw(e[54].total_size_bytes)+"")&&k($,O)},d(e){e&&d(t),H.d(),R=!1,i(T)}}}function Aw(e){let t,n,r,s,o,a,l,f,h,v,A,I,C,E,x,S,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q,Y,W,z,Z,X,ee,te=Pw(e[8].sha256)+"",ne=(e[8].type||"unknown")+"",ie="image"===Rw(e[8].type),re=Dw(e[8].size)+"",se=$w(e[8].uploaded)+"",oe=ie&&kw(e);function ae(e,t){return 256&t[0]&&(S=null),256&t[0]&&(B=null),256&t[0]&&(Q=null),null==S&&(S=!("image"!==Rw(e[8].type))),S?xw:(null==B&&(B=!("video"!==Rw(e[8].type))),B?Ew:(null==Q&&(Q=!("audio"!==Rw(e[8].type))),Q?Cw:Iw))}let le=ae(e,[-1,-1]),ce=le(e);return{c(){t=p("div"),n=p("div"),r=p("div"),s=p("div"),o=p("span"),a=g(te),l=m(),f=p("span"),h=g(ne),v=m(),A=p("div"),oe&&oe.c(),I=m(),C=p("button"),C.textContent="X",E=m(),x=p("div"),ce.c(),F=m(),D=p("div"),$=p("div"),P=p("span"),R=g("Size: "),T=g(re),U=m(),_=p("span"),N=g("Uploaded: "),L=g(se),O=m(),M=p("div"),j=p("input"),G=m(),J=p("button"),J.textContent="Copy",K=m(),V=p("div"),q=p("a"),Y=g("Open in New Tab"),z=m(),Z=p("button"),Z.textContent="Delete",b(o,"class","modal-hash svelte-on0yal"),b(f,"class","modal-type svelte-on0yal"),b(s,"class","modal-title svelte-on0yal"),b(C,"class","close-btn svelte-on0yal"),b(A,"class","modal-controls svelte-on0yal"),b(r,"class","modal-header svelte-on0yal"),b(x,"class","modal-body svelte-on0yal"),b($,"class","blob-details svelte-on0yal"),b(j,"type","text"),j.readOnly=!0,j.value=H=Uw(e[8]),b(j,"class","blob-url-input svelte-on0yal"),b(J,"class","copy-btn svelte-on0yal"),b(M,"class","blob-url-section svelte-on0yal"),b(q,"href",W=Uw(e[8])),b(q,"target","_blank"),b(q,"rel","noopener noreferrer"),b(q,"class","action-btn svelte-on0yal"),b(Z,"class","action-btn danger svelte-on0yal"),b(V,"class","modal-actions svelte-on0yal"),b(D,"class","modal-footer svelte-on0yal"),b(n,"class","modal-content svelte-on0yal"),b(n,"role","dialog"),b(t,"class","modal-overlay svelte-on0yal"),b(t,"role","button"),b(t,"tabindex","0")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(r,s),c(s,o),c(o,a),c(s,l),c(s,f),c(f,h),c(r,v),c(r,A),oe&&oe.m(A,null),c(A,I),c(A,C),c(n,E),c(n,x),ce.m(x,null),c(n,F),c(n,D),c(D,$),c($,P),c(P,R),c(P,T),c($,U),c($,_),c(_,N),c(_,L),c(D,O),c(D,M),c(M,j),c(M,G),c(M,J),c(D,K),c(D,V),c(V,q),c(q,Y),c(V,z),c(V,Z),X||(ee=[y(C,"click",e[16]),y(j,"click",Nw),y(J,"click",e[45]),y(Z,"click",e[46]),y(n,"click",w(e[37])),y(n,"keypress",w(e[38])),y(t,"click",e[16]),y(t,"keypress",e[47])],X=!0)},p(e,t){256&t[0]&&te!==(te=Pw(e[8].sha256)+"")&&k(a,te),256&t[0]&&ne!==(ne=(e[8].type||"unknown")+"")&&k(h,ne),256&t[0]&&(ie="image"===Rw(e[8].type)),ie?oe?oe.p(e,t):(oe=kw(e),oe.c(),oe.m(A,I)):oe&&(oe.d(1),oe=null),le===(le=ae(e,t))&&ce?ce.p(e,t):(ce.d(1),ce=le(e),ce&&(ce.c(),ce.m(x,null))),256&t[0]&&re!==(re=Dw(e[8].size)+"")&&k(T,re),256&t[0]&&se!==(se=$w(e[8].uploaded)+"")&&k(L,se),256&t[0]&&H!==(H=Uw(e[8]))&&j.value!==H&&(j.value=H),256&t[0]&&W!==(W=Uw(e[8]))&&b(q,"href",W)},d(e){e&&d(t),oe&&oe.d(),ce.d(),X=!1,i(ee)}}}function kw(e){let t,n,r,s,o,a,l,f,h,v,w,A,I,C=Math.round(100*e[9])+"";return{c(){t=p("button"),n=g("-"),s=m(),o=p("span"),a=g(C),l=g("%"),f=m(),h=p("button"),v=g("+"),b(t,"class","zoom-btn svelte-on0yal"),t.disabled=r=e[9]<=Bw,b(o,"class","zoom-level svelte-on0yal"),b(h,"class","zoom-btn svelte-on0yal"),h.disabled=w=e[9]>=Qw},m(i,r){u(i,t,r),c(t,n),u(i,s,r),u(i,o,r),c(o,a),c(o,l),u(i,f,r),u(i,h,r),c(h,v),A||(I=[y(t,"click",e[18]),y(h,"click",e[17])],A=!0)},p(e,n){512&n[0]&&r!==(r=e[9]<=Bw)&&(t.disabled=r),512&n[0]&&C!==(C=Math.round(100*e[9])+"")&&k(a,C),512&n[0]&&w!==(w=e[9]>=Qw)&&(h.disabled=w)},d(e){e&&d(t),e&&d(s),e&&d(o),e&&d(f),e&&d(h),A=!1,i(I)}}}function Iw(e){let t,n,i,r,s,o,a,l,f,h=Tw(e[8].type)+"";return{c(){t=p("div"),n=p("div"),i=g(h),r=m(),s=p("p"),s.textContent="Preview not available for this file type.",o=m(),a=p("a"),l=g("Download File"),b(n,"class","file-icon svelte-on0yal"),b(a,"href",f=Uw(e[8])),b(a,"target","_blank"),b(a,"rel","noopener noreferrer"),b(a,"class","download-link svelte-on0yal"),b(t,"class","file-preview svelte-on0yal")},m(e,d){u(e,t,d),c(t,n),c(n,i),c(t,r),c(t,s),c(t,o),c(t,a),c(a,l)},p(e,t){256&t[0]&&h!==(h=Tw(e[8].type)+"")&&k(i,h),256&t[0]&&f!==(f=Uw(e[8]))&&b(a,"href",f)},d(e){e&&d(t)}}}function Cw(e){let t,n,i;return{c(){t=p("div"),n=p("audio"),n.controls=!0,a(n.src,i=Uw(e[8]))||b(n,"src",i),b(n,"class","svelte-on0yal"),b(t,"class","media-container audio svelte-on0yal")},m(e,i){u(e,t,i),c(t,n)},p(e,t){256&t[0]&&!a(n.src,i=Uw(e[8]))&&b(n,"src",i)},d(e){e&&d(t)}}}function Ew(e){let t,n,i,r;return{c(){t=p("div"),n=p("video"),i=p("track"),b(i,"kind","captions"),n.controls=!0,a(n.src,r=Uw(e[8]))||b(n,"src",r),b(n,"class","svelte-on0yal"),b(t,"class","media-container svelte-on0yal")},m(e,r){u(e,t,r),c(t,n),c(n,i)},p(e,t){256&t[0]&&!a(n.src,r=Uw(e[8]))&&b(n,"src",r)},d(e){e&&d(t)}}}function xw(e){let t,n,i;return{c(){t=p("div"),n=p("img"),a(n.src,i=Uw(e[8]))||b(n,"src",i),b(n,"alt","Blob content"),b(n,"class","svelte-on0yal"),b(t,"class","media-container svelte-on0yal"),C(t,"transform","scale("+e[9]+")")},m(e,i){u(e,t,i),c(t,n)},p(e,r){256&r[0]&&!a(n.src,i=Uw(e[8]))&&b(n,"src",i),512&r[0]&&C(t,"transform","scale("+e[9]+")")},d(e){e&&d(t)}}}function Sw(t){let n,i,r,s;function o(e,t){return e[1]?zy:Wy}let a=o(t),l=a(t),c=t[7]&&t[8]&&Aw(t);return{c(){l.c(),n=m(),c&&c.c(),i=v()},m(e,o){l.m(e,o),u(e,n,o),c&&c.m(e,o),u(e,i,o),r||(s=y(Vy,"keydown",t[19]),r=!0)},p(e,t){a===(a=o(e))&&l?l.p(e,t):(l.d(1),l=a(e),l&&(l.c(),l.m(n.parentNode,n))),e[7]&&e[8]?c?c.p(e,t):(c=Aw(e),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null)},i:e,o:e,d(e){l.d(e),e&&d(n),c&&c.d(e),e&&d(i),r=!1,s()}}}const Bw=.25,Qw=4;async function Fw(e,t,n=null){if(!e)return console.log("No signer available for Blossom auth"),null;try{const i=Math.floor(Date.now()/1e3),r=[["t",t],["expiration",(i+60).toString()]];n&&r.push(["x",n]);const s={kind:24242,created_at:i,tags:r,content:`Blossom ${t} operation`},o=await e.signEvent(s);return btoa(JSON.stringify(o)).replace(/\+/g,"-").replace(/\//g,"_")}catch(e){return console.error("Error creating Blossom auth:",e),null}}function Dw(e){if(!e)return"0 B";const t=["B","KB","MB","GB"];let n=0,i=e;for(;i>=1024&&ne.target.select();function Lw(e,t,n){let i,r,{isLoggedIn:s=!1}=t,{userPubkey:o=""}=t,{userSigner:a=null}=t,{currentEffectiveRole:l=""}=t;const c=P();let u,d=[],f=!1,p="",h=[],g=!1,m="",v=!1,y=null,w=1,b=!1,A=[],k=!1,I=null,C=[],E=!1;async function x(){if(o){n(0,f=!0),n(2,p="");try{const e=`${window.location.origin}/blossom/list/${o}`,t=await Fw(a,"list"),n=await fetch(e,{headers:t?{Authorization:`Nostr ${t}`}:{}});if(!n.ok)throw new Error(`Failed to load blobs: ${n.statusText}`);const i=await n.json();d=Array.isArray(i)?i:[],d.sort((e,t)=>(t.uploaded||0)-(e.uploaded||0)),console.log("Loaded blobs:",d)}catch(e){console.error("Error loading blobs:",e),n(2,p=e.message||"Failed to load blobs")}finally{n(0,f=!1)}}}function S(e){n(8,y=e),n(9,w=1),n(7,v=!0)}function B(){n(7,v=!1),n(8,y=null),n(9,w=1)}function Q(){wBw&&n(9,w=Math.max(Bw,w-.25))}async function $(e){if(confirm(`Delete blob ${Pw(e.sha256)}?`))try{const t=`${window.location.origin}/blossom/${e.sha256}`,n=await Fw(a,"delete",e.sha256),i=await fetch(t,{method:"DELETE",headers:n?{Authorization:`Nostr ${n}`}:{}});if(!i.ok)throw new Error(`Failed to delete: ${i.statusText}`);d=d.filter(t=>t.sha256!==e.sha256),y?.sha256===e.sha256&&B()}catch(e){console.error("Error deleting blob:",e),alert(`Failed to delete blob: ${e.message}`)}}async function T(){n(12,k=!0),n(2,p="");try{const e=`${window.location.origin}/blossom/admin/users`,t=await Fw(a,"admin"),i=await fetch(e,{headers:t?{Authorization:`Nostr ${t}`}:{}});if(!i.ok)throw new Error(`Failed to load user stats: ${i.statusText}`);n(11,A=await i.json());for(const e of A)Sp(e.pubkey).then(t=>{e.profile=t||{name:"",picture:""},n(11,A)}).catch(()=>{e.profile={name:"",picture:""}})}catch(e){console.error("Error fetching admin user stats:",e),n(2,p=e.message||"Failed to load user stats")}finally{n(12,k=!1)}}async function _(e){n(0,f=!0),n(2,p="");try{const t=`${window.location.origin}/blossom/list/${e}`,n=await Fw(a,"list"),i=await fetch(t,{headers:n?{Authorization:`Nostr ${n}`}:{}});if(!i.ok)throw new Error(`Failed to load user blobs: ${i.statusText}`);C=await i.json(),C.sort((e,t)=>(t.uploaded||0)-(e.uploaded||0))}catch(e){console.error("Error loading user blobs:",e),n(2,p=e.message||"Failed to load user blobs")}finally{n(0,f=!1)}}async function N(e){n(13,I={pubkey:e.pubkey,profile:e.profile}),await _(e.pubkey)}D(()=>{i&&!E&&(n(36,E=!0),x())});return e.$$set=e=>{"isLoggedIn"in e&&n(32,s=e.isLoggedIn),"userPubkey"in e&&n(33,o=e.userPubkey),"userSigner"in e&&n(34,a=e.userSigner),"currentEffectiveRole"in e&&n(35,l=e.currentEffectiveRole)},e.$$.update=()=>{6&e.$$.dirty[1]&&n(1,i=s&&o),16&e.$$.dirty[1]&&n(14,r="admin"===l||"owner"===l),3&e.$$.dirty[0]|32&e.$$.dirty[1]&&(!i||E||f||(n(36,E=!0),x()))},[f,i,p,h,g,m,u,v,y,w,b,A,k,I,r,S,B,Q,F,function(e){v&&("Escape"===e.key?B():"+"===e.key||"="===e.key?Q():"-"===e.key&&F())},function(){c("openLoginModal")},$,function(e){n(3,h=Array.from(e.target.files))},function(){u?.click()},async function(){if(0===h.length)return;n(4,g=!0),n(2,p="");const e=[],t=[];for(let i=0;i0&&await x(),t.length>0&&n(2,p=`Failed to upload: ${t.map(e=>e.name).join(", ")}`)},function(e){try{return wu(e)}catch(t){return Pw(e)}},function(){n(10,b=!0),T()},function(){n(10,b=!1),n(11,A=[]),n(13,I=null),C=[]},N,function(){n(13,I=null),C=[]},function(){I?_(I.pubkey):b?T():x()},function(){return I?C:d},s,o,a,l,E,function(t){R.call(this,e,t)},function(t){R.call(this,e,t)},function(e){U[e?"unshift":"push"](()=>{u=e,n(6,u)})},e=>N(e),(e,t)=>"Enter"===t.key&&N(e),e=>$(e),e=>S(e),(e,t)=>"Enter"===t.key&&S(e),()=>{navigator.clipboard.writeText(Uw(y))},()=>$(y),e=>"Enter"===e.key&&B()]}class Ow extends se{constructor(e){super(),re(this,e,Lw,Sw,s,{isLoggedIn:32,userPubkey:33,userSigner:34,currentEffectiveRole:35},null,[-1,-1])}}function Mw(e,t,n){const i=e.slice();return i[29]=t[n],i}function jw(e,t,n){const i=e.slice();return i[32]=t[n],i}function Hw(e){let t,n,i;function r(e,t){return e[0]?Jw:Kw}let s=r(e),o=s(e);return{c(){t=p("div"),n=p("p"),n.textContent="Log viewer is only available to relay owners.",i=m(),o.c(),b(n,"class","svelte-w6h7aj"),b(t,"class","login-prompt svelte-w6h7aj")},m(e,r){u(e,t,r),c(t,n),c(t,i),o.m(t,null)},p(e,n){s===(s=r(e))&&o?o.p(e,n):(o.d(1),o=s(e),o&&(o.c(),o.m(t,null)))},d(e){e&&d(t),o.d()}}}function Gw(e){let t,n,r,s,o,a,l,h,v,w,A,I,C,x,S,B,Q,F,D,$,P,R,T,U,_,N,L,O,j,H,G,J=e[3]?"Loading...":"Refresh",K=e[2].length+"",V=e[12],q=[];for(let t=0;te[18].call(v)),b(a,"class","level-selector svelte-w6h7aj"),b(A,"class","clear-btn svelte-w6h7aj"),A.disabled=C=e[3]||0===e[2].length,b(S,"class","refresh-btn svelte-w6h7aj"),S.disabled=e[3],b(o,"class","header-controls svelte-w6h7aj"),b(n,"class","header-section svelte-w6h7aj"),b($,"class","log-info svelte-w6h7aj"),b(j,"class","log-list svelte-w6h7aj"),b(t,"class","log-view svelte-w6h7aj")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),c(a,l),c(a,h),c(a,v);for(let e=0;eNo logs available.

    ",b(n,"class","empty-state svelte-w6h7aj")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function zw(e){let t,n,i,r,s=e[29].file+"",o=e[29].line+"";return{c(){t=p("span"),n=g(s),i=g(":"),r=g(o),b(t,"class","log-location svelte-w6h7aj")},m(e,s){u(e,t,s),c(t,n),c(t,i),c(t,r)},p(e,t){4&t[0]&&s!==(s=e[29].file+"")&&k(n,s),4&t[0]&&o!==(o=e[29].line+"")&&k(r,o)},d(e){e&&d(t)}}}function Zw(e){let t,n,i,r,s,o,a,l,f,h,v,y=ib(e[29].timestamp)+"",w=e[29].level+"",A=e[29].message+"",I=e[29].file&&zw(e);return{c(){t=p("div"),n=p("span"),i=g(y),r=m(),s=p("span"),o=g(w),l=m(),I&&I.c(),f=m(),h=p("span"),v=g(A),b(n,"class","log-timestamp svelte-w6h7aj"),b(s,"class",a="log-level "+rb(e[29].level)+" svelte-w6h7aj"),b(h,"class","log-message svelte-w6h7aj"),b(t,"class","log-entry svelte-w6h7aj")},m(e,a){u(e,t,a),c(t,n),c(n,i),c(t,r),c(t,s),c(s,o),c(t,l),I&&I.m(t,null),c(t,f),c(t,h),c(h,v)},p(e,n){4&n[0]&&y!==(y=ib(e[29].timestamp)+"")&&k(i,y),4&n[0]&&w!==(w=e[29].level+"")&&k(o,w),4&n[0]&&a!==(a="log-level "+rb(e[29].level)+" svelte-w6h7aj")&&b(s,"class",a),e[29].file?I?I.p(e,n):(I=zw(e),I.c(),I.m(t,f)):I&&(I.d(1),I=null),4&n[0]&&A!==(A=e[29].message+"")&&k(v,A)},d(e){e&&d(t),I&&I.d()}}}function Xw(e){let t;return{c(){t=p("span"),t.textContent="End of logs"},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function eb(e){let t;return{c(){t=p("span"),t.textContent="Scroll for more"},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function tb(e){let t;return{c(){t=p("span"),t.textContent="Loading more..."},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function nb(t){let n;function i(e,t){return e[4]?Gw:Hw}let r=i(t),s=r(t);return{c(){s.c(),n=v()},m(e,t){s.m(e,t),u(e,n,t)},p(e,t){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n.parentNode,n)))},i:e,o:e,d(e){s.d(e),e&&d(n)}}}function ib(e){if(!e)return"";return new Date(e).toLocaleString()}function rb(e){switch(e?.toUpperCase()){case"TRC":case"TRACE":return"level-trace";case"DBG":case"DEBUG":return"level-debug";case"INF":case"INFO":default:return"level-info";case"WRN":case"WARN":return"level-warn";case"ERR":case"ERROR":return"level-error";case"FTL":case"FATAL":return"level-fatal"}}function sb(e,t,n){let i,{isLoggedIn:r=!1}=t,{userRole:s=""}=t,{userSigner:o=null}=t;const a=P();let l=[],c=!1,u=!0,d=0,f=0,p="",h="info",g="info";const m=["trace","debug","info","warn","error","fatal"];let v,y,w;async function b(e="GET",t="/api/logs"){if(!o)return null;try{const n={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",`${window.location.origin}${t}`],["method",e]],content:""},i=await o.signEvent(n);return btoa(JSON.stringify(i)).replace(/\+/g,"-").replace(/\//g,"_")}catch(e){return console.error("Error creating auth header:",e),null}}async function A(e=!1){if(!c){n(3,c=!0),n(7,p=""),e&&(d=0,n(2,l=[]));try{const t=`/api/logs?offset=${d}&limit=100`,i=await b("GET",t),r=`${window.location.origin}${t}`,s=await fetch(r,{headers:i?{Authorization:`Nostr ${i}`}:{}});if(!s.ok)throw new Error(`Failed to load logs: ${s.statusText}`);const o=await s.json();n(2,l=e?o.logs||[]:[...l,...o.logs||[]]),n(6,f=o.total||0),n(5,u=o.has_more||!1),d=l.length}catch(e){console.error("Error loading logs:",e),n(7,p=e.message||"Failed to load logs")}finally{n(3,c=!1)}}}async function k(){try{const e=await fetch(`${window.location.origin}/api/logs/level`);if(e.ok){const t=await e.json();n(8,h=t.level||"info"),n(9,g=h)}}catch(e){console.error("Error loading log level:",e)}}D(()=>{i&&(A(!0),k(),function(){if(!y)return;w=new IntersectionObserver(e=>{e[0].isIntersecting&&u&&!c&&u&&!c&&A(!1)},{threshold:.1}),w.observe(y)}())}),$(()=>{w&&w.disconnect()});return e.$$set=e=>{"isLoggedIn"in e&&n(0,r=e.isLoggedIn),"userRole"in e&&n(1,s=e.userRole),"userSigner"in e&&n(17,o=e.userSigner)},e.$$.update=()=>{3&e.$$.dirty[0]&&n(4,i=r&&"owner"===s),28&e.$$.dirty[0]&&i&&0===l.length&&!c&&(A(!0),k())},[r,s,l,c,i,u,f,p,h,g,v,y,m,A,async function(){if(g!==h)try{const e=await b("POST","/api/logs/level"),t=await fetch(`${window.location.origin}/api/logs/level`,{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:`Nostr ${e}`}:{}},body:JSON.stringify({level:g})});if(!t.ok)throw new Error(`Failed to set log level: ${t.statusText}`);const i=await t.json();n(8,h=i.level),n(9,g=h)}catch(e){console.error("Error setting log level:",e),n(7,p=e.message||"Failed to set log level"),n(9,g=h)}},async function(){if(confirm("Are you sure you want to clear all logs?"))try{const e=await b("POST","/api/logs/clear"),t=await fetch(`${window.location.origin}/api/logs/clear`,{method:"POST",headers:e?{Authorization:`Nostr ${e}`}:{}});if(!t.ok)throw new Error(`Failed to clear logs: ${t.statusText}`);n(2,l=[]),d=0,n(5,u=!1),n(6,f=0)}catch(e){console.error("Error clearing logs:",e),n(7,p=e.message||"Failed to clear logs")}},function(){a("openLoginModal")},o,function(){g=x(this),n(9,g),n(12,m)},()=>A(!0),function(e){U[e?"unshift":"push"](()=>{y=e,n(11,y)})},function(e){U[e?"unshift":"push"](()=>{v=e,n(10,v)})}]}class ob extends se{constructor(e){super(),re(this,e,sb,nb,s,{isLoggedIn:0,userRole:1,userSigner:17},null,[-1,-1])}}async function ab(e,t,n,i){if(!e||!t)return console.log("createNIP98Auth: No signer or pubkey available",{hasSigner:!!e,hasPubkey:!!t}),null;try{const t={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",i],["method",n.toUpperCase()]],content:""};console.log("createNIP98Auth: Signing event for",n,i);const r=await e.signEvent(t);console.log("createNIP98Auth: Signed event:",{id:r.id,pubkey:r.pubkey,kind:r.kind,created_at:r.created_at,tags:r.tags,hasSig:!!r.sig});const s=JSON.stringify(r);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_")}catch(e){return console.error("createNIP98Auth: Error:",e),null}}async function lb(){try{const e=await fetch(`${window.location.origin}/api/nrc/config`);if(e.ok)return await e.json()}catch(e){console.error("Error fetching NRC config:",e)}return{enabled:!1,badger_required:!0}}function cb(e){return hp[e]||`Kind ${e}`}function ub(e){return e?e.slice(0,8)+"..."+e.slice(-8):"unknown"}function db(e,t=100){return e?e.length>t?e.slice(0,t)+"...":e:""}function fb(e){return e?new Date(1e3*e).toLocaleString():""}async function pb(e){try{return await navigator.clipboard.writeText(e),!0}catch(t){console.error("Failed to copy to clipboard:",t);try{const t=document.createElement("textarea");return t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),!0}catch(e){return console.error("Fallback copy also failed:",e),!1}}}function hb(e,t=!0){if(!e)return;const n=e.textContent,i=e.style.backgroundColor;t?(e.textContent="",e.style.backgroundColor="#4CAF50"):(e.textContent="L",e.style.backgroundColor="#f44336"),setTimeout(()=>{e.textContent=n,e.style.backgroundColor=i},2e3)}function gb(e,t,n){const i=e.slice();return i[31]=t[n],i}function mb(e){let t,n,r,s,o,a,l,f,h,w,A,C,E,x,S,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,j,H,G,J,K,V,q,Y,W,z,Z,X,ee,te=(e[5].rendezvous_url||"Not configured")+"",ne=e[4].length+"",ie=e[5].mint_url&&bb(e),re=!e[5].mint_url&&Ab();function se(e,t){return 0===e[4].length?Ib:kb}let oe=se(e),ae=oe(e),le=e[7]&&Sb(e);return{c(){t=p("div"),n=p("div"),n.innerHTML='Status: \n Enabled',r=m(),s=p("div"),o=p("span"),o.textContent="Rendezvous:",a=m(),l=p("span"),f=g(te),h=m(),ie&&ie.c(),w=m(),A=p("div"),C=p("h3"),C.textContent="Create New Connection",E=m(),x=p("div"),S=p("div"),B=p("label"),B.textContent="Device Label",Q=m(),F=p("input"),D=m(),$=p("div"),P=p("label"),R=p("input"),U=g("\n Include CAT (Cashu Access Token)\n "),re&&re.c(),_=m(),N=p("button"),L=g("+ Create Connection"),M=m(),j=p("div"),H=p("h3"),G=g("Connections ("),J=g(ne),K=g(")"),V=m(),ae.c(),q=m(),Y=p("button"),W=g("Refresh"),z=m(),le&&le.c(),Z=v(),b(n,"class","status-item svelte-gwb5vv"),b(o,"class","status-label svelte-gwb5vv"),b(l,"class","status-value svelte-gwb5vv"),b(s,"class","status-item svelte-gwb5vv"),b(t,"class","config-status svelte-gwb5vv"),b(C,"class","svelte-gwb5vv"),b(B,"for","new-label"),b(B,"class","svelte-gwb5vv"),b(F,"type","text"),b(F,"id","new-label"),b(F,"placeholder","e.g., Phone, Laptop, Tablet"),F.disabled=e[6],b(F,"class","svelte-gwb5vv"),b(S,"class","form-group svelte-gwb5vv"),b(R,"type","checkbox"),R.disabled=T=e[6]||!e[5].mint_url,b(R,"class","svelte-gwb5vv"),b(P,"class","svelte-gwb5vv"),b($,"class","form-group checkbox-group svelte-gwb5vv"),b(N,"class","create-btn svelte-gwb5vv"),N.disabled=O=e[6]||!e[9].trim(),b(x,"class","create-form svelte-gwb5vv"),b(A,"class","section svelte-gwb5vv"),b(H,"class","svelte-gwb5vv"),b(Y,"class","refresh-btn svelte-gwb5vv"),Y.disabled=e[6],b(j,"class","section svelte-gwb5vv")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(s,o),c(s,a),c(s,l),c(l,f),c(t,h),ie&&ie.m(t,null),u(i,w,d),u(i,A,d),c(A,C),c(A,E),c(A,x),c(x,S),c(S,B),c(S,Q),c(S,F),I(F,e[9]),c(x,D),c(x,$),c($,P),c(P,R),R.checked=e[10],c(P,U),re&&re.m(P,null),c(x,_),c(x,N),c(N,L),u(i,M,d),u(i,j,d),c(j,H),c(H,G),c(H,J),c(H,K),c(j,V),ae.m(j,null),c(j,q),c(j,Y),c(Y,W),u(i,z,d),le&&le.m(i,d),u(i,Z,d),X||(ee=[y(F,"input",e[24]),y(R,"change",e[25]),y(N,"click",e[15]),y(Y,"click",e[14])],X=!0)},p(e,n){32&n[0]&&te!==(te=(e[5].rendezvous_url||"Not configured")+"")&&k(f,te),e[5].mint_url?ie?ie.p(e,n):(ie=bb(e),ie.c(),ie.m(t,null)):ie&&(ie.d(1),ie=null),64&n[0]&&(F.disabled=e[6]),512&n[0]&&F.value!==e[9]&&I(F,e[9]),96&n[0]&&T!==(T=e[6]||!e[5].mint_url)&&(R.disabled=T),1024&n[0]&&(R.checked=e[10]),e[5].mint_url?re&&(re.d(1),re=null):re||(re=Ab(),re.c(),re.m(P,null)),576&n[0]&&O!==(O=e[6]||!e[9].trim())&&(N.disabled=O),16&n[0]&&ne!==(ne=e[4].length+"")&&k(J,ne),oe===(oe=se(e))&&ae?ae.p(e,n):(ae.d(1),ae=oe(e),ae&&(ae.c(),ae.m(j,q))),64&n[0]&&(Y.disabled=e[6]),e[7]?le?le.p(e,n):(le=Sb(e),le.c(),le.m(Z.parentNode,Z)):le&&(le.d(1),le=null)},d(e){e&&d(t),ie&&ie.d(),e&&d(w),e&&d(A),re&&re.d(),e&&d(M),e&&d(j),ae.d(),e&&d(z),le&&le.d(e),e&&d(Z),X=!1,i(ee)}}}function vb(e){let t,n,i,r,s,o,a,l=(e[1]||"none")+"";return{c(){t=p("div"),n=p("p"),n.textContent="Owner permission required for relay connection management.",i=m(),r=p("p"),s=g("Current role: "),o=p("strong"),a=g(l),b(n,"class","svelte-gwb5vv"),b(r,"class","svelte-gwb5vv"),b(t,"class","permission-denied svelte-gwb5vv")},m(e,l){u(e,t,l),c(t,n),c(t,i),c(t,r),c(r,s),c(r,o),c(o,a)},p(e,t){2&t[0]&&l!==(l=(e[1]||"none")+"")&&k(a,l)},d(e){e&&d(t)}}}function yb(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in to manage relay connections.",r=m(),s=p("button"),s.textContent="Log In",b(i,"class","svelte-gwb5vv"),b(s,"class","login-btn svelte-gwb5vv"),b(n,"class","login-prompt svelte-gwb5vv")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[20]),o=!0)},p:e,d(e){e&&d(n),o=!1,a()}}}function wb(e){let t;function n(e,t){return e[3]?Qb:Bb}let i=n(e),r=i(e);return{c(){t=p("div"),r.c(),b(t,"class","not-enabled svelte-gwb5vv")},m(e,n){u(e,t,n),r.m(t,null)},p(e,s){i!==(i=n(e))&&(r.d(1),r=i(e),r&&(r.c(),r.m(t,null)))},d(e){e&&d(t),r.d()}}}function bb(e){let t,n,i,r,s,o=e[5].mint_url+"";return{c(){t=p("div"),n=p("span"),n.textContent="Cashu Mint:",i=m(),r=p("span"),s=g(o),b(n,"class","status-label svelte-gwb5vv"),b(r,"class","status-value svelte-gwb5vv"),b(t,"class","status-item svelte-gwb5vv")},m(e,o){u(e,t,o),c(t,n),c(t,i),c(t,r),c(r,s)},p(e,t){32&t[0]&&o!==(o=e[5].mint_url+"")&&k(s,o)},d(e){e&&d(t)}}}function Ab(e){let t;return{c(){t=p("span"),t.textContent="(requires Cashu mint)",b(t,"class","hint svelte-gwb5vv")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function kb(e){let t,n=e[4],i=[];for(let t=0;tORLY_NRC_ENABLED=true and configure ORLY_NRC_RENDEZVOUS_URL to enable.',b(t,"class","svelte-gwb5vv"),b(i,"class","svelte-gwb5vv")},m(e,r){u(e,t,r),u(e,n,r),u(e,i,r)},d(e){e&&d(t),e&&d(n),e&&d(i)}}}function Qb(e){let t,n,i;return{c(){t=p("p"),t.textContent="NRC requires the Badger database backend.",n=m(),i=p("p"),i.innerHTML='Set ORLY_DB_TYPE=badger to enable NRC functionality.',b(t,"class","svelte-gwb5vv"),b(i,"class","svelte-gwb5vv")},m(e,r){u(e,t,r),u(e,n,r),u(e,i,r)},d(e){e&&d(t),e&&d(n),e&&d(i)}}}function Fb(e){let t,n,r,s,o,a,l,f,h,v,A,I,C,E,x,S,B,Q;return{c(){t=p("div"),n=p("div"),r=p("h3"),s=g('Connection URI for "'),o=g(e[13]),a=g('"'),l=m(),f=p("p"),f.textContent="Copy this URI to your Nostr client to connect to this relay remotely.\n Keep it secret - anyone with this URI can access your relay.",h=m(),v=p("div"),A=p("textarea"),I=m(),C=p("div"),E=p("button"),E.textContent="Copy to Clipboard",x=m(),S=p("button"),S.textContent="Close",b(r,"class","svelte-gwb5vv"),b(f,"class","modal-description svelte-gwb5vv"),A.readOnly=!0,A.value=e[12],b(A,"class","svelte-gwb5vv"),b(v,"class","uri-display svelte-gwb5vv"),b(E,"class","copy-btn svelte-gwb5vv"),b(S,"class","close-btn svelte-gwb5vv"),b(C,"class","modal-actions svelte-gwb5vv"),b(n,"class","modal svelte-gwb5vv"),b(t,"class","modal-overlay svelte-gwb5vv")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(r,s),c(r,o),c(r,a),c(n,l),c(n,f),c(n,h),c(n,v),c(v,A),c(n,I),c(n,C),c(C,E),c(C,x),c(C,S),B||(Q=[y(E,"click",e[18]),y(S,"click",e[19]),y(n,"click",w(e[23])),y(t,"click",e[19])],B=!0)},p(e,t){8192&t[0]&&k(o,e[13]),4096&t[0]&&(A.value=e[12])},d(e){e&&d(t),B=!1,i(Q)}}}function Db(t){let n,i,r,s,o,a,l;function f(e,t){return e[2]?e[0]?"owner"!==e[1]?vb:mb:yb:wb}let h=f(t),g=h(t),y=t[11]&&Fb(t);return{c(){n=p("div"),i=p("h2"),i.textContent="Relay Connect",r=m(),s=p("p"),s.textContent="Nostr Relay Connect (NRC) allows remote access to this relay through a public relay tunnel.\n Create connection strings for your devices to sync securely.",o=m(),g.c(),a=m(),y&&y.c(),l=v(),b(i,"class","svelte-gwb5vv"),b(s,"class","description svelte-gwb5vv"),b(n,"class","relay-connect-view svelte-gwb5vv")},m(e,t){u(e,n,t),c(n,i),c(n,r),c(n,s),c(n,o),g.m(n,null),u(e,a,t),y&&y.m(e,t),u(e,l,t)},p(e,t){h===(h=f(e))&&g?g.p(e,t):(g.d(1),g=h(e),g&&(g.c(),g.m(n,null))),e[11]?y?y.p(e,t):(y=Fb(e),y.c(),y.m(l.parentNode,l)):y&&(y.d(1),y=null)},i:e,o:e,d(e){e&&d(n),g.d(),e&&d(a),y&&y.d(e),e&&d(l)}}}function $b(e){return e?new Date(1e3*e).toLocaleString():"Never"}function Pb(e,t,n){let{isLoggedIn:i=!1}=t,{userRole:r=""}=t,{userSigner:s=null}=t,{userPubkey:o=""}=t;const a=P();let l=!1,c=!1,u=[],d={},f=!1,p="",h="info",g="",m=!1,v=!1,y="",w="";async function b(){if(i&&s&&o){n(6,f=!0);try{const e=await async function(e,t){const n=`${window.location.origin}/api/nrc/connections`,i=await ab(e,t,"GET",n),r=await fetch(n,{headers:i?{Authorization:`Nostr ${i}`}:{}});if(!r.ok){const e=await r.text();throw new Error(e||`Failed to get NRC connections: ${r.statusText}`)}return await r.json()}(s,o);n(4,u=e.connections||[]),n(5,d=e.config||{})}catch(e){I(`Failed to load connections: ${e.message}`,"error")}finally{n(6,f=!1)}}}async function A(e,t){if(confirm(`Are you sure you want to delete the connection "${t}"? This will revoke access for any device using this connection.`)){n(6,f=!0);try{await async function(e,t,n){const i=`${window.location.origin}/api/nrc/connections/${n}`,r=await ab(e,t,"DELETE",i),s=await fetch(i,{method:"DELETE",headers:r?{Authorization:`Nostr ${r}`}:{}});if(!s.ok){const e=await s.text();throw new Error(e||`Failed to delete NRC connection: ${s.statusText}`)}return await s.json()}(s,o,e),await b(),I(`Connection "${t}" deleted`,"success")}catch(e){I(`Failed to delete connection: ${e.message}`,"error")}finally{n(6,f=!1)}}}async function k(e,t){n(6,f=!0);try{const i=await async function(e,t,n){const i=`${window.location.origin}/api/nrc/connections/${n}/uri`,r=await ab(e,t,"GET",i),s=await fetch(i,{headers:r?{Authorization:`Nostr ${r}`}:{}});if(!s.ok){const e=await s.text();throw new Error(e||`Failed to get NRC URI: ${s.statusText}`)}return await s.json()}(s,o,e);n(12,y=i.uri),n(13,w=t),n(11,v=!0)}catch(e){I(`Failed to get URI: ${e.message}`,"error")}finally{n(6,f=!1)}}function I(e,t="info"){n(7,p=e),n(8,h=t),setTimeout(()=>{p===e&&n(7,p="")},5e3)}D(async()=>{await async function(){try{const e=await lb();n(2,l=e.enabled),n(3,c=e.badger_required),l&&i&&"owner"===r&&await b()}catch(e){console.error("Failed to load NRC config:",e)}}()});return e.$$set=e=>{"isLoggedIn"in e&&n(0,i=e.isLoggedIn),"userRole"in e&&n(1,r=e.userRole),"userSigner"in e&&n(21,s=e.userSigner),"userPubkey"in e&&n(22,o=e.userPubkey)},e.$$.update=()=>{7&e.$$.dirty[0]&&i&&"owner"===r&&l&&b()},[i,r,l,c,u,d,f,p,h,g,m,v,y,w,b,async function(){if(g.trim()){n(6,f=!0);try{const e=await async function(e,t,n,i=!1){const r=`${window.location.origin}/api/nrc/connections`,s=await ab(e,t,"POST",r),o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",...s?{Authorization:`Nostr ${s}`}:{}},body:JSON.stringify({label:n,use_cashu:i})});if(!o.ok){const e=await o.text();throw new Error(e||`Failed to create NRC connection: ${o.statusText}`)}return await o.json()}(s,o,g.trim(),m);n(12,y=e.uri),n(13,w=e.label),n(11,v=!0),n(9,g=""),n(10,m=!1),await b(),I(`Connection "${e.label}" created successfully`,"success")}catch(e){I(`Failed to create connection: ${e.message}`,"error")}finally{n(6,f=!1)}}else I("Please enter a label for the connection","error")},A,k,async function(e){const t=await pb(y);hb(e.target.closest("button"),t),t||I("Failed to copy to clipboard","error")},function(){n(11,v=!1),n(12,y=""),n(13,w="")},function(){a("openLoginModal")},s,o,function(t){R.call(this,e,t)},function(){g=this.value,n(9,g)},function(){m=this.checked,n(10,m)},e=>k(e.id,e.label),e=>A(e.id,e.label)]}class Rb extends se{constructor(e){super(),re(this,e,Pb,Db,s,{isLoggedIn:0,userRole:1,userSigner:21,userPubkey:22},null,[-1,-1])}}function Tb(e){let t,n,i,r,s,o,a,l,f,h,v;return{c(){t=p("div"),n=p("div"),i=p("h3"),i.textContent="Active Filter",r=m(),s=p("button"),s.textContent="🧹 Sweep",o=m(),a=p("div"),l=p("pre"),f=g(e[2]),b(i,"class","svelte-1tyqaa5"),b(s,"class","sweep-btn svelte-1tyqaa5"),b(s,"title","Clear filter"),b(n,"class","filter-display-header svelte-1tyqaa5"),b(l,"class","filter-json svelte-1tyqaa5"),b(a,"class","filter-json-container svelte-1tyqaa5"),b(t,"class","filter-display svelte-1tyqaa5")},m(d,p){u(d,t,p),c(t,n),c(n,i),c(n,r),c(n,s),c(t,o),c(t,a),c(a,l),c(l,f),h||(v=y(s,"click",e[3]),h=!0)},p(e,t){4&t&&k(f,e[2])},d(e){e&&d(t),h=!1,v()}}}function Ub(t){let n,i=t[0]&&t[1]&&Tb(t);return{c(){i&&i.c(),n=v()},m(e,t){i&&i.m(e,t),u(e,n,t)},p(e,[t]){e[0]&&e[1]?i?i.p(e,t):(i=Tb(e),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},i:e,o:e,d(e){i&&i.d(e),e&&d(n)}}}function _b(e,t,n){let i,r;const s=P();let{filter:o={}}=t,{showFilter:a=!0}=t;return e.$$set=e=>{"filter"in e&&n(4,o=e.filter),"showFilter"in e&&n(0,a=e.showFilter)},e.$$.update=()=>{16&e.$$.dirty&&n(2,i=function(e){return JSON.stringify(e,null,2)}(o)),16&e.$$.dirty&&n(1,r=Object.keys(o).length>0)},[a,r,i,function(){s("sweep")},o]}class Nb extends se{constructor(e){super(),re(this,e,_b,Ub,s,{filter:4,showFilter:0})}}class Lb{constructor(e,t,n){this.relayUrl=e,this.userSigner=t,this.userPubkey=n,this.ws=null,this.challenge=null,this.isAuthenticated=!1,this.authPromise=null}async connect(){return new Promise((e,t)=>{this.ws=new WebSocket(this.relayUrl),this.ws.onopen=()=>{console.log("WebSocket connected to relay:",this.relayUrl),e()},this.ws.onmessage=async e=>{try{const t=JSON.parse(e.data);await this.handleMessage(t)}catch(e){console.error("Error parsing relay message:",e)}},this.ws.onerror=e=>{console.error("WebSocket error:",e),t(new Error("Failed to connect to relay"))},this.ws.onclose=()=>{console.log("WebSocket connection closed"),this.isAuthenticated=!1,this.challenge=null},setTimeout(()=>{this.ws.readyState!==WebSocket.OPEN&&t(new Error("Connection timeout"))},1e4)})}async handleMessage(e){const[t,...n]=e;switch(t){case"AUTH":this.challenge=n[0],console.log("Received AUTH challenge:",this.challenge),await this.authenticate();break;case"OK":const[e,i,r]=n;e&&i?(console.log("Authentication successful for event:",e),this.isAuthenticated=!0,this.authPromise&&(this.authPromise.resolve(),this.authPromise=null)):e&&!i&&(console.error("Authentication failed:",r),this.authPromise&&(this.authPromise.reject(new Error(r||"Authentication failed")),this.authPromise=null));break;case"NOTICE":console.log("Relay notice:",n[0]);break;default:console.log("Unhandled message type:",t,n)}}async authenticate(){if(!this.challenge)throw new Error("No challenge received from relay");if(!this.userSigner)throw new Error("No signer available for authentication");try{const e={kind:22242,created_at:Math.floor(Date.now()/1e3),tags:[["relay",this.relayUrl],["challenge",this.challenge]],content:"",pubkey:this.userPubkey},t=["AUTH",await this.userSigner.signEvent(e)];return this.ws.send(JSON.stringify(t)),console.log("Sent authentication event to relay"),new Promise((e,t)=>{this.authPromise={resolve:e,reject:t},setTimeout(()=>{this.authPromise&&(this.authPromise.reject(new Error("Authentication timeout")),this.authPromise=null)},1e4)})}catch(e){throw console.error("Authentication error:",e),e}}async publishEvent(e){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");return new Promise((t,n)=>{const i=["EVENT",e];this.ws.send(JSON.stringify(i));const r=this.ws.onmessage,s=setTimeout(()=>{this.ws.onmessage=r,n(new Error("Publish timeout"))},15e3);this.ws.onmessage=async i=>{try{const o=JSON.parse(i.data),[a,l,c,u]=o;if("OK"===a&&l===e.id)if(c)clearTimeout(s),this.ws.onmessage=r,console.log("Event published successfully:",l),t({success:!0,eventId:l,reason:u});else{if(console.error("Event publish failed:",u),u&&u.includes("auth-required"))return void console.log("Authentication required, waiting for AUTH challenge...");clearTimeout(s),this.ws.onmessage=r,n(new Error(`Publish failed: ${u}`))}else if("AUTH"===a){this.challenge=o[1],console.log("Received AUTH challenge during publish:",this.challenge);try{await this.authenticate(),console.log("Authentication successful, retrying event publish...");const t=["EVENT",e];this.ws.send(JSON.stringify(t))}catch(e){clearTimeout(s),this.ws.onmessage=r,n(new Error(`Authentication failed: ${e.message}`))}}else await this.handleMessage(o)}catch(e){clearTimeout(s),this.ws.onmessage=r,n(e)}}})}close(){this.ws&&(this.ws.close(),this.ws=null),this.isAuthenticated=!1,this.challenge=null}getAuthenticated(){return this.isAuthenticated}}async function Ob(e,t,n,i){const r=new Lb(e,n,i);try{await r.connect();return await r.publishEvent(t)}finally{r.close()}}function Mb(e,t,n){const i=e.slice();return i[171]=t[n],i}function jb(e,t,n){const i=e.slice();return i[181]=t[n],i}function Hb(e,t,n){const i=e.slice();return i[174]=t[n],i}function Gb(e,t,n){const i=e.slice();i[174]=t[n];const r=i[52](i[174]);return i[175]=r,i}function Jb(e,t,n){const i=e.slice();return i[178]=t[n],i}function Kb(t){let n;function i(e,t){return e[1]?aA:oA}let r=i(t),s=r(t);return{c(){n=p("div"),s.c(),b(n,"class","welcome-message svelte-u3u5mw")},m(e,t){u(e,n,t),s.m(n,null)},p(e,t){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n,null)))},i:e,o:e,d(e){e&&d(n),s.d()}}}function Vb(e){let t,n,i=e[6],r=[];for(let t=0;tZ(r[e],1,1,()=>{r[e]=null});return{c(){for(let e=0;e=0||""!==t[36]&&parseInt(t[36])>=0,P=pp,R=[];for(let e=0;eEvent Recovery \n

    Search and recover old versions of replaceable events

    ',s=m(),o=p("div"),a=p("div"),l=p("div"),h=p("label"),h.textContent="Select Event Kind:",g=m(),v=p("select"),w=p("option"),w.textContent="Choose a replaceable kind...";for(let e=0;et[116].call(v)),b(l,"class","kind-selector svelte-u3u5mw"),b(x,"for","custom-kind"),b(x,"class","svelte-u3u5mw"),b(B,"id","custom-kind"),b(B,"type","number"),b(B,"placeholder","e.g., 10001"),b(B,"min","0"),b(B,"class","svelte-u3u5mw"),b(C,"class","custom-kind-input svelte-u3u5mw"),b(a,"class","recovery-controls svelte-u3u5mw"),b(o,"class","recovery-controls-card svelte-u3u5mw"),b(n,"class","recovery-tab svelte-u3u5mw")},m(e,i){u(e,n,i),c(n,r),c(n,s),c(n,o),c(o,a),c(a,l),c(l,h),c(l,g),c(l,v),c(v,w);for(let e=0;e=0||""!==e[36]&&parseInt(e[36])>=0),$?T?T.p(e,t):(T=yA(e),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},i:e,o:e,d(e){e&&d(n),f(R,e),T&&T.d(),F=!1,i(D)}}}function Yb(e){let t,n;return t=new ob({props:{isLoggedIn:e[1],userRole:e[4],userSigner:e[13]}}),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),16&n[0]&&(i.userRole=e[4]),8192&n[0]&&(i.userSigner=e[13]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function Wb(e){let t,n;return t=new Rb({props:{isLoggedIn:e[1],userRole:e[4],userSigner:e[13],userPubkey:e[2]}}),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),16&n[0]&&(i.userRole=e[4]),8192&n[0]&&(i.userSigner=e[13]),4&n[0]&&(i.userPubkey=e[2]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function zb(e){let t,n,i;function r(t){e[115](t)}let s={isLoggedIn:e[1],userRole:e[4],isPolicyAdmin:JA,policyEnabled:e[8],isLoadingPolicy:e[27],policyMessage:e[28],policyMessageType:e[29],validationErrors:e[30],policyFollows:e[31]};return void 0!==e[26]&&(s.policyJson=e[26]),t=new Zv({props:s}),U.push(()=>X(t,"policyJson",r)),t.$on("loadPolicy",e[60]),t.$on("validatePolicy",e[61]),t.$on("savePolicy",e[62]),t.$on("formatJson",e[63]),t.$on("addPolicyAdmin",e[64]),t.$on("removePolicyAdmin",e[65]),t.$on("refreshFollows",e[66]),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,n){te(t,e,n),i=!0},p(e,i){const r={};2&i[0]&&(r.isLoggedIn=e[1]),16&i[0]&&(r.userRole=e[4]),256&i[0]&&(r.policyEnabled=e[8]),134217728&i[0]&&(r.isLoadingPolicy=e[27]),268435456&i[0]&&(r.policyMessage=e[28]),536870912&i[0]&&(r.policyMessageType=e[29]),1073741824&i[0]&&(r.validationErrors=e[30]),1&i[1]&&(r.policyFollows=e[31]),!n&&67108864&i[0]&&(n=!0,r.policyJson=e[26],j(()=>n=!1)),t.$set(r)},i(e){i||(z(t.$$.fragment,e),i=!0)},o(e){Z(t.$$.fragment,e),i=!1},d(e){ne(t,e)}}}function Zb(e){let t,n,i;function r(t){e[112](t)}let s={isLoggedIn:e[1],userRole:e[4],sprocketStatus:e[20],isLoadingSprocket:e[22],sprocketUploadFile:e[25],sprocketMessage:e[23],sprocketMessageType:e[24],sprocketVersions:e[21]};return void 0!==e[19]&&(s.sprocketScript=e[19]),t=new Pv({props:s}),U.push(()=>X(t,"sprocketScript",r)),t.$on("restartSprocket",e[55]),t.$on("deleteSprocket",e[56]),t.$on("sprocketFileSelect",e[67]),t.$on("uploadSprocketScript",e[68]),t.$on("saveSprocket",e[54]),t.$on("loadSprocket",e[53]),t.$on("loadVersions",e[57]),t.$on("loadVersion",e[113]),t.$on("deleteVersion",e[114]),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,n){te(t,e,n),i=!0},p(e,i){const r={};2&i[0]&&(r.isLoggedIn=e[1]),16&i[0]&&(r.userRole=e[4]),1048576&i[0]&&(r.sprocketStatus=e[20]),4194304&i[0]&&(r.isLoadingSprocket=e[22]),33554432&i[0]&&(r.sprocketUploadFile=e[25]),8388608&i[0]&&(r.sprocketMessage=e[23]),16777216&i[0]&&(r.sprocketMessageType=e[24]),2097152&i[0]&&(r.sprocketVersions=e[21]),!n&&524288&i[0]&&(n=!0,r.sprocketScript=e[19],j(()=>n=!1)),t.$set(r)},i(e){i||(z(t.$$.fragment,e),i=!0)},o(e){Z(t.$$.fragment,e),i=!1},d(e){ne(t,e)}}}function Xb(e){let t,n,i,r;const s=[QA,BA,SA],o=[];function a(e,t){return"curating"!==e[9]?0:e[1]&&"owner"===e[4]?1:2}return n=a(e),i=o[n]=s[n](e),{c(){t=p("div"),i.c(),b(t,"class","curation-view-container")},m(e,i){u(e,t,i),o[n].m(t,null),r=!0},p(e,r){let l=n;n=a(e),n===l?o[n].p(e,r):(Y(),Z(o[l],1,1,()=>{o[l]=null}),W(),i=o[n],i?i.p(e,r):(i=o[n]=s[n](e),i.c()),z(i,1),i.m(t,null))},i(e){r||(z(i),r=!0)},o(e){Z(i),r=!1},d(e){e&&d(t),o[n].d()}}}function eA(e){let t,n,i,r;const s=[$A,DA,FA],o=[];function a(e,t){return"managed"!==e[9]?0:e[1]&&"owner"===e[4]?1:2}return n=a(e),i=o[n]=s[n](e),{c(){t=p("div"),i.c(),b(t,"class","managed-acl-view svelte-u3u5mw")},m(e,i){u(e,t,i),o[n].m(t,null),r=!0},p(e,r){let l=n;n=a(e),n===l?o[n].p(e,r):(Y(),Z(o[l],1,1,()=>{o[l]=null}),W(),i=o[n],i?i.p(e,r):(i=o[n]=s[n](e),i.c()),z(i,1),i.m(t,null))},i(e){r||(z(i),r=!0)},o(e){Z(i),r=!1},d(e){e&&d(t),o[n].d()}}}function tA(e){let t,n,i;function r(t){e[111](t)}let s={userPubkey:e[2],userRole:e[4],policyEnabled:e[8],publishError:e[34]};return void 0!==e[33]&&(s.composeEventJson=e[33]),t=new Av({props:s}),U.push(()=>X(t,"composeEventJson",r)),t.$on("reformatJson",e[90]),t.$on("signEvent",e[91]),t.$on("publishEvent",e[92]),t.$on("clearError",e[93]),{c(){ee(t.$$.fragment)},m(e,n){te(t,e,n),i=!0},p(e,i){const r={};4&i[0]&&(r.userPubkey=e[2]),16&i[0]&&(r.userRole=e[4]),256&i[0]&&(r.policyEnabled=e[8]),8&i[1]&&(r.publishError=e[34]),!n&&4&i[1]&&(n=!0,r.composeEventJson=e[33],j(()=>n=!1)),t.$set(r)},i(e){i||(z(t.$$.fragment,e),i=!0)},o(e){Z(t.$$.fragment,e),i=!1},d(e){ne(t,e)}}}function nA(e){let t,n;return t=new Ow({props:{isLoggedIn:e[1],userPubkey:e[2],userSigner:e[13],currentEffectiveRole:e[10]}}),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),4&n[0]&&(i.userPubkey=e[2]),8192&n[0]&&(i.userSigner=e[13]),1024&n[0]&&(i.currentEffectiveRole=e[10]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function iA(e){let t,n;return t=new tv({props:{isLoggedIn:e[1],userRole:e[4],userPubkey:e[2],filteredEvents:e[41],expandedEvents:e[18],isLoadingEvents:e[7],showOnlyMyEvents:GA,showFilterBuilder:e[15]}}),t.$on("scroll",e[89]),t.$on("toggleEventExpansion",e[107]),t.$on("deleteEvent",e[108]),t.$on("copyEventToClipboard",e[109]),t.$on("toggleChange",e[45]),t.$on("loadAllEvents",e[110]),t.$on("toggleFilterBuilder",e[76]),t.$on("filterApply",e[77]),t.$on("filterClear",e[78]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),16&n[0]&&(i.userRole=e[4]),4&n[0]&&(i.userPubkey=e[2]),1024&n[1]&&(i.filteredEvents=e[41]),262144&n[0]&&(i.expandedEvents=e[18]),128&n[0]&&(i.isLoadingEvents=e[7]),32768&n[0]&&(i.showFilterBuilder=e[15]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function rA(e){let t,n;return t=new tm({props:{isLoggedIn:e[1],currentEffectiveRole:e[10],selectedFile:e[16],aclMode:e[9],importMessage:e[17]}}),t.$on("fileSelect",e[86]),t.$on("importEvents",e[87]),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),1024&n[0]&&(i.currentEffectiveRole=e[10]),65536&n[0]&&(i.selectedFile=e[16]),512&n[0]&&(i.aclMode=e[9]),131072&n[0]&&(i.importMessage=e[17]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function sA(e){let t,n;return t=new qg({props:{isLoggedIn:e[1],currentEffectiveRole:e[10],aclMode:e[9]}}),t.$on("exportMyEvents",e[85]),t.$on("exportAllEvents",e[84]),t.$on("openLoginModal",e[70]),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};2&n[0]&&(i.isLoggedIn=e[1]),1024&n[0]&&(i.currentEffectiveRole=e[10]),512&n[0]&&(i.aclMode=e[9]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function oA(t){let n;return{c(){n=p("p"),n.textContent="Log in to access your user dashboard",b(n,"class","svelte-u3u5mw")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function aA(e){let t,n,i,r=(e[3]?.name||e[2].slice(0,8)+"...")+"";return{c(){t=p("p"),n=g("Welcome "),i=g(r),b(t,"class","svelte-u3u5mw")},m(e,r){u(e,t,r),c(t,n),c(t,i)},p(e,t){12&t[0]&&r!==(r=(e[3]?.name||e[2].slice(0,8)+"...")+"")&&k(i,r)},d(e){e&&d(t)}}}function lA(e){let t,n,r,s,o,a,l,f,h,v,w,A,I,C,E,x,S,B,Q,F,D,$=e[181].label+"",P=e[42].get(e[181].id)?.isLoading,R=!e[42].get(e[181].id)?.hasMore&&e[42].get(e[181].id)?.events?.length>0;function T(){return e[121](e[181])}function U(e,t){return 64&t[0]&&(C=null),64&t[0]&&(E=null),null==C&&(C=!!(e[42].get(e[181].id)?.events?.length>0)),C?uA:(null==E&&(E=!e[42].get(e[181].id)?.isLoading),E?cA:void 0)}w=new Nb({props:{filter:e[42].get(e[181].id)?.filter||{}}}),w.$on("sweep",function(){return e[122](e[181])});let _=U(e,[-1,-1,-1,-1,-1,-1]),N=_&&_(e),L=P&&hA(),O=R&&gA();function M(...t){return e[127](e[181],...t)}return{c(){t=p("div"),n=p("div"),r=p("h2"),s=g("🔍 "),o=g($),a=m(),l=p("button"),f=g("🔄 Refresh"),v=m(),ee(w.$$.fragment),A=m(),I=p("div"),N&&N.c(),x=m(),L&&L.c(),S=m(),O&&O.c(),B=m(),b(r,"class","svelte-u3u5mw"),b(l,"class","refresh-btn svelte-u3u5mw"),l.disabled=h=e[42].get(e[181].id)?.isLoading,b(n,"class","search-results-header svelte-u3u5mw"),b(I,"class","search-results-content svelte-u3u5mw"),b(t,"class","search-results-view svelte-u3u5mw")},m(e,i){u(e,t,i),c(t,n),c(n,r),c(r,s),c(r,o),c(n,a),c(n,l),c(l,f),c(t,v),te(w,t,null),c(t,A),c(t,I),N&&N.m(I,null),c(I,x),L&&L.m(I,null),c(I,S),O&&O.m(I,null),c(t,B),Q=!0,F||(D=[y(l,"click",T),y(I,"scroll",M)],F=!0)},p(t,n){e=t,(!Q||64&n[0])&&$!==($=e[181].label+"")&&k(o,$),(!Q||64&n[0]&&h!==(h=e[42].get(e[181].id)?.isLoading))&&(l.disabled=h);const i={};64&n[0]&&(i.filter=e[42].get(e[181].id)?.filter||{}),w.$set(i),_===(_=U(e,n))&&N?N.p(e,n):(N&&N.d(1),N=_&&_(e),N&&(N.c(),N.m(I,x))),64&n[0]&&(P=e[42].get(e[181].id)?.isLoading),P?L||(L=hA(),L.c(),L.m(I,S)):L&&(L.d(1),L=null),64&n[0]&&(R=!e[42].get(e[181].id)?.hasMore&&e[42].get(e[181].id)?.events?.length>0),R?O||(O=gA(),O.c(),O.m(I,null)):O&&(O.d(1),O=null)},i(e){Q||(z(w.$$.fragment,e),Q=!0)},o(e){Z(w.$$.fragment,e),Q=!1},d(e){e&&d(t),ne(w),N&&N.d(),L&&L.d(),O&&O.d(),F=!1,i(D)}}}function cA(t){let n;return{c(){n=p("div"),n.innerHTML='

    No search results found.

    ',b(n,"class","no-search-results svelte-u3u5mw")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function uA(e){let t,n=e[42].get(e[181].id).events,i=[];for(let t=0;t👤',s=m(),o=p("div"),a=p("div"),l=g(N),f=m(),h=p("div"),v=p("span"),w=g(L),A=m(),I=p("span"),C=g(O),E=m(),x=p("div"),B=p("div"),Q=g(M),F=m(),D=p("div"),$=g(j),P=m(),G&&G.c(),R=m(),V&&V.c(),T=m(),b(r,"class","search-result-avatar svelte-u3u5mw"),b(a,"class","search-result-author svelte-u3u5mw"),b(v,"class","kind-number svelte-u3u5mw"),b(I,"class","kind-name svelte-u3u5mw"),b(h,"class","search-result-kind svelte-u3u5mw"),b(o,"class","search-result-info svelte-u3u5mw"),b(B,"class","event-timestamp svelte-u3u5mw"),b(D,"class","event-content-single-line svelte-u3u5mw"),b(x,"class","search-result-content svelte-u3u5mw"),b(n,"class","search-result-row svelte-u3u5mw"),b(n,"role","button"),b(n,"tabindex","0"),b(t,"class","search-result-item svelte-u3u5mw"),S(t,"expanded",e[18].has(e[174].id))},m(e,i){u(e,t,i),c(t,n),c(n,r),c(n,s),c(n,o),c(o,a),c(a,l),c(o,f),c(o,h),c(h,v),c(v,w),c(h,A),c(h,I),c(I,C),c(n,E),c(n,x),c(x,B),c(B,Q),c(x,F),c(x,D),c(D,$),c(n,P),G&&G.m(n,null),c(t,R),V&&V.m(t,null),c(t,T),U||(_=[y(n,"click",J),y(n,"keydown",K)],U=!0)},p(i,r){e=i,64&r[0]&&N!==(N=ub(e[174].pubkey)+"")&&k(l,N),64&r[0]&&L!==(L=e[174].kind+"")&&k(w,L),64&r[0]&&O!==(O=cb(e[174].kind)+"")&&k(C,O),64&r[0]&&M!==(M=fb(e[174].created_at)+"")&&k(Q,M),64&r[0]&&j!==(j=db(e[174].content)+"")&&k($,j),5!==e[174].kind&&("admin"===e[4]||"owner"===e[4]||"write"===e[4]&&e[174].pubkey&&e[174].pubkey===e[2])?G?G.p(e,r):(G=dA(e),G.c(),G.m(n,null)):G&&(G.d(1),G=null),262208&r[0]&&(H=e[18].has(e[174].id)),H?V?V.p(e,r):(V=fA(e),V.c(),V.m(t,T)):V&&(V.d(1),V=null),262208&r[0]|2048&r[1]&&S(t,"expanded",e[18].has(e[174].id))},d(e){e&&d(t),G&&G.d(),V&&V.d(),U=!1,i(_)}}}function hA(e){let t;return{c(){t=p("div"),t.innerHTML='
    \n

    Searching...

    ',b(t,"class","loading-search-results svelte-u3u5mw")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function gA(e){let t;return{c(){t=p("div"),t.innerHTML='

    No more search results to load.

    ',b(t,"class","end-of-search-results svelte-u3u5mw")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function mA(e){let t,n,i=e[181].id===e[5]&&lA(e);return{c(){i&&i.c(),t=v()},m(e,r){i&&i.m(e,r),u(e,t,r),n=!0},p(e,n){e[181].id===e[5]?i?(i.p(e,n),96&n[0]&&z(i,1)):(i=lA(e),i.c(),z(i,1),i.m(t.parentNode,t)):i&&(Y(),Z(i,1,1,()=>{i=null}),W())},i(e){n||(z(i),n=!0)},o(e){Z(i),n=!1},d(e){i&&i.d(e),e&&d(t)}}}function vA(t){let n,i,r=t[178].label+"";return{c(){n=p("option"),i=g(r),n.__value=t[178].value,n.value=n.__value},m(e,t){u(e,n,t),c(n,i)},p:e,d(e){e&&d(n)}}}function yA(e){let t;function n(e,t){return e[38]?AA:0===e[37].length?bA:wA}let i=n(e),r=i(e);return{c(){t=p("div"),r.c(),b(t,"class","recovery-results svelte-u3u5mw")},m(e,n){u(e,t,n),r.m(t,null)},p(e,s){i===(i=n(e))&&r?r.p(e,s):(r.d(1),r=i(e),r&&(r.c(),r.m(t,null)))},d(e){e&&d(t),r.d()}}}function wA(e){let t,n,i,r=e[37],s=[];for(let t=0;tORLY_ACL_MODE=curating in your\n environment variables and restart the relay.',b(i,"class","svelte-u3u5mw"),b(s,"class","svelte-u3u5mw"),b(a,"class","svelte-u3u5mw"),b(y,"class","svelte-u3u5mw"),b(n,"class","acl-mode-warning svelte-u3u5mw")},m(e,t){u(e,n,t),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),c(a,l),c(a,f),c(f,h),c(n,v),c(n,y)},p(e,t){512&t[0]&&w!==(w=(e[9]||"unknown")+"")&&k(h,w)},i:e,o:e,d(e){e&&d(n)}}}function FA(t){let n,i,r,s,o,a;return{c(){n=p("div"),i=p("p"),i.textContent="Please log in with owner permissions to access\n managed ACL configuration.",r=m(),s=p("button"),s.textContent="Log In",b(s,"class","login-btn svelte-u3u5mw"),b(n,"class","access-denied")},m(e,l){u(e,n,l),c(n,i),c(n,r),c(n,s),o||(a=y(s,"click",t[70]),o=!0)},p:e,i:e,o:e,d(e){e&&d(n),o=!1,a()}}}function DA(e){let t,n;return t=new xg({props:{userSigner:e[13],userPubkey:e[2]}}),{c(){ee(t.$$.fragment)},m(e,i){te(t,e,i),n=!0},p(e,n){const i={};8192&n[0]&&(i.userSigner=e[13]),4&n[0]&&(i.userPubkey=e[2]),t.$set(i)},i(e){n||(z(t.$$.fragment,e),n=!0)},o(e){Z(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function $A(t){let n,i,r,s,o,a,l,f,h,v,y,w=(t[9]||"unknown")+"";return{c(){n=p("div"),i=p("h3"),i.textContent="⚠️ Managed ACL Mode Not Active",r=m(),s=p("p"),s.textContent='To use the Managed ACL interface, you need to set\n the ACL mode to "managed" in your relay\n configuration.',o=m(),a=p("p"),l=g("Current ACL mode: "),f=p("strong"),h=g(w),v=m(),y=p("p"),y.innerHTML='Please set ORLY_ACL_MODE=managed in your\n environment variables and restart the relay.',b(i,"class","svelte-u3u5mw"),b(s,"class","svelte-u3u5mw"),b(a,"class","svelte-u3u5mw"),b(y,"class","svelte-u3u5mw"),b(n,"class","acl-mode-warning svelte-u3u5mw")},m(e,t){u(e,n,t),c(n,i),c(n,r),c(n,s),c(n,o),c(n,a),c(a,l),c(a,f),c(f,h),c(n,v),c(n,y)},p(e,t){512&t[0]&&w!==(w=(e[9]||"unknown")+"")&&k(h,w)},i:e,o:e,d(e){e&&d(n)}}}function PA(e){let t,n,r,s,o,a,l,f,h,g;function v(e,t){return e[3]?TA:e[1]&&e[2]?RA:void 0}let A=v(e),k=A&&A(e);return{c(){t=p("div"),n=p("div"),r=p("div"),s=p("h2"),s.textContent="Settings",o=m(),a=p("button"),a.textContent="✕",l=m(),f=p("div"),k&&k.c(),b(s,"class","svelte-u3u5mw"),b(a,"class","close-btn svelte-u3u5mw"),b(r,"class","drawer-header svelte-u3u5mw"),b(f,"class","drawer-content"),b(n,"class","settings-drawer svelte-u3u5mw"),S(n,"dark-theme",e[0]),b(t,"class","drawer-overlay svelte-u3u5mw"),b(t,"role","button"),b(t,"tabindex","0")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(r,s),c(r,o),c(r,a),c(n,l),c(n,f),k&&k.m(f,null),h||(g=[y(a,"click",e[75]),y(n,"click",w(e[102])),y(n,"keydown",w(e[103])),y(t,"click",e[75]),y(t,"keydown",e[129])],h=!0)},p(e,t){A===(A=v(e))&&k?k.p(e,t):(k&&k.d(1),k=A&&A(e),k&&(k.c(),k.m(f,null))),1&t[0]&&S(n,"dark-theme",e[0])},d(e){e&&d(t),k&&k.d(),h=!1,i(g)}}}function RA(e){let t,n,r,s,o,a,l,f,h,v,w,A,I,C,E,x,S,B=e[2].slice(0,16)+"",Q=e[2].slice(-8)+"";return{c(){t=p("div"),n=p("button"),n.textContent="Log out",r=m(),s=p("h3"),s.textContent="Profile Loading",o=m(),a=p("p"),a.textContent="Your profile metadata is being loaded...",l=m(),f=p("button"),f.textContent="Retry Loading Profile",h=m(),v=p("div"),w=p("strong"),w.textContent="Public Key:",A=m(),I=g(B),C=g("..."),E=g(Q),b(n,"class","logout-btn floating svelte-u3u5mw"),b(s,"class","svelte-u3u5mw"),b(a,"class","svelte-u3u5mw"),b(f,"class","retry-profile-btn svelte-u3u5mw"),b(v,"class","user-pubkey-display svelte-u3u5mw"),b(t,"class","profile-loading-section svelte-u3u5mw")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(t,o),c(t,a),c(t,l),c(t,f),c(t,h),c(t,v),c(v,w),c(v,A),c(v,I),c(v,C),c(v,E),x||(S=[y(n,"click",e[72]),y(f,"click",e[83])],x=!0)},p(e,t){4&t[0]&&B!==(B=e[2].slice(0,16)+"")&&k(I,B),4&t[0]&&Q!==(Q=e[2].slice(-8)+"")&&k(E,Q)},d(e){e&&d(t),x=!1,i(S)}}}function TA(e){let t,n,i,r,s,o,a,l,f,h,w,A,I,C,E,x=(e[3].name||"Unknown User")+"",S=e[3].banner&&UA(e);function B(e,t){return e[3].picture?NA:_A}let Q=B(e),F=Q(e),D=e[3].nip05&&LA(e),$=e[3].about&&OA(e),P=e[4]&&"read"!==e[4]&&MA(e);return{c(){t=p("div"),n=p("div"),S&&S.c(),i=m(),r=p("button"),r.textContent="Log out",s=m(),F.c(),o=m(),a=p("div"),l=p("h3"),f=g(x),h=m(),D&&D.c(),w=m(),$&&$.c(),A=m(),P&&P.c(),I=v(),b(r,"class","logout-btn floating svelte-u3u5mw"),b(l,"class","profile-username svelte-u3u5mw"),b(a,"class","name-row svelte-u3u5mw"),b(n,"class","profile-hero svelte-u3u5mw"),b(t,"class","profile-section svelte-u3u5mw")},m(d,p){u(d,t,p),c(t,n),S&&S.m(n,null),c(n,i),c(n,r),c(n,s),F.m(n,null),c(n,o),c(n,a),c(a,l),c(l,f),c(a,h),D&&D.m(a,null),c(t,w),$&&$.m(t,null),u(d,A,p),P&&P.m(d,p),u(d,I,p),C||(E=y(r,"click",e[72]),C=!0)},p(e,r){e[3].banner?S?S.p(e,r):(S=UA(e),S.c(),S.m(n,i)):S&&(S.d(1),S=null),Q===(Q=B(e))&&F?F.p(e,r):(F.d(1),F=Q(e),F&&(F.c(),F.m(n,o))),8&r[0]&&x!==(x=(e[3].name||"Unknown User")+"")&&k(f,x),e[3].nip05?D?D.p(e,r):(D=LA(e),D.c(),D.m(a,null)):D&&(D.d(1),D=null),e[3].about?$?$.p(e,r):($=OA(e),$.c(),$.m(t,null)):$&&($.d(1),$=null),e[4]&&"read"!==e[4]?P?P.p(e,r):(P=MA(e),P.c(),P.m(I.parentNode,I)):P&&(P.d(1),P=null)},d(e){e&&d(t),S&&S.d(),F.d(),D&&D.d(),$&&$.d(),e&&d(A),P&&P.d(e),e&&d(I),C=!1,E()}}}function UA(e){let t,n;return{c(){t=p("img"),a(t.src,n=e[3].banner)||b(t,"src",n),b(t,"alt","Profile banner"),b(t,"class","profile-banner svelte-u3u5mw")},m(e,n){u(e,t,n)},p(e,i){8&i[0]&&!a(t.src,n=e[3].banner)&&b(t,"src",n)},d(e){e&&d(t)}}}function _A(t){let n;return{c(){n=p("div"),n.textContent="👤",b(n,"class","profile-avatar-placeholder overlap svelte-u3u5mw")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function NA(e){let t,n;return{c(){t=p("img"),a(t.src,n=e[3].picture)||b(t,"src",n),b(t,"alt","User avatar"),b(t,"class","profile-avatar overlap svelte-u3u5mw")},m(e,n){u(e,t,n)},p(e,i){8&i[0]&&!a(t.src,n=e[3].picture)&&b(t,"src",n)},d(e){e&&d(t)}}}function LA(e){let t,n,i=e[3].nip05+"";return{c(){t=p("span"),n=g(i),b(t,"class","profile-nip05-inline svelte-u3u5mw")},m(e,i){u(e,t,i),c(t,n)},p(e,t){8&t[0]&&i!==(i=e[3].nip05+"")&&k(n,i)},d(e){e&&d(t)}}}function OA(e){let t,n;return{c(){t=p("div"),n=p("p"),b(n,"class","profile-about svelte-u3u5mw"),b(t,"class","about-card svelte-u3u5mw")},m(i,r){u(i,t,r),c(t,n),n.innerHTML=e[40]},p(e,t){512&t[1]&&(n.innerHTML=e[40])},d(e){e&&d(t)}}}function MA(e){let t,n,i,r,s,o,a=e[95](),l=[];for(let t=0;tX(v,"showModal",E)),v.$on("login",e[71]),v.$on("close",e[73]),{c(){ee(t.$$.fragment),n=m(),i=p("div"),ee(r.$$.fragment),s=m(),o=p("main"),f.c(),h=m(),C&&C.c(),g=m(),ee(v.$$.fragment),b(o,"class","main-content svelte-u3u5mw"),b(i,"class","app-container svelte-u3u5mw"),S(i,"dark-theme",e[0])},m(e,a){te(t,e,a),u(e,n,a),u(e,i,a),te(r,i,null),c(i,s),c(i,o),k[l].m(o,null),u(e,h,a),C&&C.m(e,a),u(e,g,a),te(v,e,a),w=!0},p(e,n){const s={};1&n[0]&&(s.isDarkTheme=e[0]),2&n[0]&&(s.isLoggedIn=e[1]),16&n[0]&&(s.userRole=e[4]),1024&n[0]&&(s.currentEffectiveRole=e[10]),8&n[0]&&(s.userProfile=e[3]),4&n[0]&&(s.userPubkey=e[2]),t.$set(s);const a={};1&n[0]&&(a.isDarkTheme=e[0]),2048&n[0]&&(a.tabs=e[11]),32&n[0]&&(a.selectedTab=e[5]),2&n[1]&&(a.version=e[32]),r.$set(a);let c=l;l=I(e,n),l===c?k[l].p(e,n):(Y(),Z(k[c],1,1,()=>{k[c]=null}),W(),f=k[l],f?f.p(e,n):(f=k[l]=A[l](e),f.c()),z(f,1),f.m(o,null)),(!w||1&n[0])&&S(i,"dark-theme",e[0]),e[14]?C?C.p(e,n):(C=PA(e),C.c(),C.m(g.parentNode,g)):C&&(C.d(1),C=null);const u={};1&n[0]&&(u.isDarkTheme=e[0]),!y&&4096&n[0]&&(y=!0,u.showModal=e[12],j(()=>y=!1)),v.$set(u)},i(e){w||(z(t.$$.fragment,e),z(r.$$.fragment,e),z(f),z(v.$$.fragment,e),w=!0)},o(e){Z(t.$$.fragment,e),Z(r.$$.fragment,e),Z(f),Z(v.$$.fragment,e),w=!1},d(e){ne(t,e),e&&d(n),e&&d(i),ne(r),k[l].d(),e&&d(h),C&&C.d(e),e&&d(g),ne(v,e)}}}let GA=!1,JA=!1;function KA(e,t,n){let i,r,s,o,a;"undefined"!=typeof window&&(window.debugIndexedDB=Rp);let l=!1,c=!1,u=!1,d="",f="",p=null,h="",g=null,m=!1,v=localStorage.getItem("selectedTab")||"export",y=!1,w={},b=[],k=[],I=null,C="",E=new Set,S=!1,B=!0,Q=null,F="",D=new Map,$=[],P=0,T=[],U=!0,_=null,N="",L=null,O=[],M=!1,j="",H="info",G=!1,J=null,K="",V=!1,q=!1,Y="",W="info",z=[],Z=[],X=!1,ee="",te="",ne="",ie="",re=null,se="",oe=[],ae=!1,le=!0,ce=null;function ue(e){E.has(e)?E.delete(e):E.add(e),n(18,E)}async function de(e,t){const n=JSON.stringify(e),i=await pb(n);hb(t.target.closest(".copy-json-btn"),i),i||alert("Failed to copy to clipboard. Please copy manually.")}async function fe(e){if(!u)return void alert("Please log in first");const t=k.find(t=>t.id===e);if(!t)return void alert("Event not found");if("admin"===h||"owner"===h||"write"===h&&t.pubkey&&t.pubkey===d){if(confirm("Are you sure you want to delete this event?"))try{if(!g)throw new Error("Signer not available for signing");const i={kind:5,created_at:Math.floor(Date.now()/1e3),tags:[["e",e]],content:""};console.log("Created delete event template:",i),console.log("User pubkey:",d),console.log("Target event:",t),console.log("Target event pubkey:",t.pubkey);const r=await g.signEvent(i);console.log("Signed delete event:",r),console.log("Signed delete event pubkey:",r.pubkey),console.log("Delete event tags:",r.tags);const s=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`;try{const e=await Ob(s,r,g,d);e.success?console.log("Delete event published successfully to ORLY relay"):console.error("Failed to publish delete event:",e.reason)}catch(e){console.error("Error publishing delete event:",e)}const o=t.pubkey&&t.pubkey===d;if(o){const t=await vp.publish(r);if(console.log("Delete event published:",t),!(t.success&&t.okCount>0))throw new Error("No relays accepted the delete event");{await new Promise(e=>setTimeout(e,2e3));try{const n=await Fp(e,{timeout:5e3});n?(console.warn("Event still exists after deletion attempt:",n),alert(`Warning: Delete event was accepted by ${t.okCount} relay(s), but the event still exists on the relay. This may indicate the relay does not properly handle delete events.`)):console.log("Event successfully deleted and verified")}catch(e){console.log("Could not fetch event after deletion (likely deleted):",e.message)}try{const t=await Dp(e,{timeout:5e3});if(t.length>0){console.log(`Delete event verification: Found ${t.length} delete event(s) targeting ${e}`);const n=t.find(e=>e.pubkey&&e.pubkey===d);n?console.log("Our delete event found in database:",n.id):console.warn("Our delete event not found in database, but other delete events exist")}else console.warn("No delete events found in database for target event:",e)}catch(e){console.log("Could not verify delete event in database:",e.message)}n(96,k=k.filter(t=>t.id!==e)),T=T.filter(t=>t.id!==e),$=$.filter(t=>t.id!==e);for(const[t,n]of D)n.events&&(n.events=n.events.filter(t=>t.id!==e),D.set(t,n));me(),console.log("Reloading events to show delete event...");const i=GA&&u&&d?[d]:null;await Ue(!0,i),alert(`Event deleted successfully (accepted by ${t.okCount} relay(s))`)}}else{const t=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`,i=new mp;await i.connectToRelay(t);const s=await i.publish(r);if(console.log("Delete event published to local relay only:",s),!(s.success&&s.okCount>0))throw new Error("Local relay did not accept the delete event");{await new Promise(e=>setTimeout(e,2e3));try{const t=await Fp(e,{timeout:5e3});t?(console.warn("Event still exists after deletion attempt:",t),alert(`Warning: Delete event was accepted by ${s.okCount} relay(s), but the event still exists on the relay. This may indicate the relay does not properly handle delete events.`)):console.log("Event successfully deleted and verified")}catch(e){console.log("Could not fetch event after deletion (likely deleted):",e.message)}try{const t=await Dp(e,{timeout:5e3});if(t.length>0){console.log(`Delete event verification: Found ${t.length} delete event(s) targeting ${e}`);const n=t.find(e=>e.pubkey&&e.pubkey===d);n?console.log("Our delete event found in database:",n.id):console.warn("Our delete event not found in database, but other delete events exist")}else console.warn("No delete events found in database for target event:",e)}catch(e){console.log("Could not verify delete event in database:",e.message)}n(96,k=k.filter(t=>t.id!==e)),T=T.filter(t=>t.id!==e),$=$.filter(t=>t.id!==e);for(const[t,n]of D)n.events&&(n.events=n.events.filter(t=>t.id!==e),D.set(t,n));me(),console.log("Reloading events to show delete event...");const t=GA&&u&&d?[d]:null;await Ue(!0,t),alert("Event deleted successfully (local relay only - admin/owner deleting other user's event)")}}}catch(e){console.error("Failed to delete event:",e),alert("Failed to delete event: "+e.message)}}else alert("You do not have permission to delete this event")}async function pe(){const e=se?parseInt(se):re;if(null==e||isNaN(e))console.log("No valid kind to load, kindToUse:",e);else if(u){console.log("Loading recovery events for kind:",e,"user:",d),n(38,ae=!0);try{const t=[{kinds:[e],authors:[d],limit:100}];ce&&(t[0].until=ce),console.log("Recovery filters:",t);const i=await Pp(t,{timeout:3e4,cacheFirst:!0});console.log("Recovery events received:",i.length),console.log("Recovery events kinds:",i.map(e=>e.kind)),n(37,oe=ce?[...oe,...i]:i),i.length>0?(ce=Math.min(...i.map(e=>e.created_at)),n(39,le=100===i.length)):n(39,le=!1)}catch(e){console.error("Failed to load recovery events:",e)}finally{n(38,ae=!1)}}else console.log("Not logged in, cannot load recovery events")}async function he(e){if(confirm("Are you sure you want to repost this event?"))try{const t=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`;console.log("Reposting event to local relay:",t,e);const i={...e};if(i.created_at=Math.floor(Date.now()/1e3),i.id="",i.sig="",e.kind>=3e4&&e.kind<=39999){const t=e.tags.find(e=>"d"===e[0]);t&&(i.tags=i.tags.filter(e=>"d"!==e[0]),i.tags.push(t))}if(g){const e=await g.signEvent(i);console.log("Signed event for repost:",e);const r=await vp.publish(e,[t]);console.log("Repost publish result:",r),r.success&&r.okCount>0?(alert("Event reposted successfully!"),n(39,le=!1),await pe()):alert("Failed to repost event. Check console for details.")}else alert("No signer available. Please log in.")}catch(e){console.error("Error reposting event:",e),alert("Error reposting event: "+e.message)}}async function ge(e){if(confirm("Are you sure you want to repost this event to all your write relays?"))try{const t=await async function(){if(!d)return[];try{const e=await Ep([{kinds:[10002],authors:[d],limit:1}]);if(0===e.length)return console.log("No relay list event found for user"),[];const t=e[0];console.log("Found relay list event:",t);const n=[];for(const e of t.tags)if("r"===e[0]&&e.length>=2){const t=e[1],i=e.length>=3?e[2]:null;i&&"write"!==i||n.push(t)}return console.log("Found write relays:",n),n}catch(e){return console.error("Error fetching user write relays:",e),[]}}(),i=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`,r=[i,...t.filter(e=>e!==i)];1===r.length&&alert("No write relays found in your relay list. Only posting to local relay."),console.log("Reposting event to all relays:",r,e);const s={...e};if(s.created_at=Math.floor(Date.now()/1e3),s.id="",s.sig="",e.kind>=3e4&&e.kind<=39999){const t=e.tags.find(e=>"d"===e[0]);t&&(s.tags=s.tags.filter(e=>"d"!==e[0]),s.tags.push(t))}if(g){const e=await g.signEvent(s);console.log("Signed event for repost to all:",e);const t=await vp.publish(e,r);console.log("Repost to all publish result:",t),t.success&&t.okCount>0?(alert(`Event reposted successfully to ${r.length} relays!`),n(39,le=!1),await pe()):alert("Failed to repost event. Check console for details.")}else alert("No signer available. Please log in.")}catch(e){console.error("Error reposting event to all:",e),alert("Error reposting event to all: "+e.message)}}if("undefined"!=typeof window&&window.matchMedia){const e=window.matchMedia("(prefers-color-scheme: dark)");l=e.matches,e.addEventListener("change",e=>{n(0,l=e.matches)})}if("undefined"!=typeof localStorage){const e=localStorage.getItem("nostr_auth_method"),t=localStorage.getItem("nostr_pubkey");e&&t&&(u=!0,d=t,f=e,"extension"===e&&window.nostr&&(g=window.nostr),Pe(),Re()),function(){if("undefined"==typeof localStorage)return;try{const t=localStorage.getItem("app_state");if(t){const i=JSON.parse(t);i.selectedTab&&Ee.some(e=>e.id===i.selectedTab)&&n(5,v=i.selectedTab),i.expandedEvents&&n(18,E=new Set(i.expandedEvents)),i.globalEventsCache&&($=i.globalEventsCache),i.globalCacheTimestamp&&(P=i.globalCacheTimestamp),void 0!==i.hasMoreEvents&&(B=i.hasMoreEvents),i.oldestEventTimestamp&&(Q=i.oldestEventTimestamp),void 0!==i.hasMoreMyEvents&&(U=i.hasMoreMyEvents),i.oldestMyEventTimestamp&&(_=i.oldestMyEventTimestamp),$.length>0&&((e=P)&&Date.now()-et.created_at-e.created_at),P=Date.now(),me()}async function ye(){if(u&&"owner"===h&&G)try{n(22,M=!0);const e=await fetch("/api/sprocket/status",{method:"GET",headers:{Authorization:`Nostr ${await Oe("GET","/api/sprocket/status")}`,"Content-Type":"application/json"}});e.ok?n(20,L=await e.json()):ke("Failed to load sprocket status","error")}catch(e){ke(`Error loading sprocket status: ${e.message}`,"error")}finally{n(22,M=!1)}}async function we(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/versions",{method:"GET",headers:{Authorization:`Nostr ${await Oe("GET","/api/sprocket/versions")}`,"Content-Type":"application/json"}});e.ok?n(21,O=await e.json()):ke("Failed to load versions","error")}catch(e){ke(`Error loading versions: ${e.message}`,"error")}finally{n(22,M=!1)}}async function be(e){u&&"owner"===h&&(n(19,N=e.content),ke(`Loaded version: ${e.name}`,"success"))}async function Ae(e){if(u&&"owner"===h&&confirm(`Are you sure you want to delete version ${e}?`))try{n(22,M=!0);const t=await fetch("/api/sprocket/delete-version",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/delete-version")}`,"Content-Type":"application/json"},body:JSON.stringify({filename:e})});if(t.ok)ke(`Version ${e} deleted successfully`,"success"),await we();else{ke(`Failed to delete version: ${await t.text()}`,"error")}}catch(e){ke(`Error deleting version: ${e.message}`,"error")}finally{n(22,M=!1)}}function ke(e,t="info"){n(23,j=e),n(24,H=t),setTimeout(()=>{n(23,j="")},5e3)}function Ie(e,t="info"){n(28,Y=e),n(29,W=t),"error"!==t&&setTimeout(()=>{n(28,Y="")},5e3)}async function Ce(){if(n(30,z=[]),!K.trim())return n(30,z=["Policy JSON is empty"]),Ie("Validation failed","error"),!1;try{const e=JSON.parse(K);if("object"!=typeof e||null===e)return n(30,z=["Policy must be a JSON object"]),Ie("Validation failed","error"),!1;if(e.policy_admins)if(Array.isArray(e.policy_admins))for(const t of e.policy_admins)"string"==typeof t&&/^[0-9a-fA-F]{64}$/.test(t)||z.push(`Invalid policy_admin pubkey: ${t}`);else z.push("policy_admins must be an array");if(e.rules)if("object"!=typeof e.rules)z.push("rules must be an object");else for(const[t,n]of Object.entries(e.rules))if(/^\d+$/.test(t)||z.push(`Invalid kind number: ${t}`),n.tag_validation&&"object"==typeof n.tag_validation)for(const[e,t]of Object.entries(n.tag_validation))try{new RegExp(t)}catch(n){z.push(`Invalid regex for tag '${e}': ${t}`)}return e.default_policy&&!["allow","deny"].includes(e.default_policy)&&z.push("default_policy must be 'allow' or 'deny'"),z.length>0?(Ie("Validation failed - see errors below","error"),!1):(Ie("Validation passed","success"),!0)}catch(e){return n(30,z=[`JSON parse error: ${e.message}`]),Ie("Invalid JSON syntax","error"),!1}}const Ee=[{id:"export",icon:"📤",label:"Export"},{id:"import",icon:"💾",label:"Import",requiresAdmin:!0},{id:"events",icon:"📡",label:"Events"},{id:"blossom",icon:"🌸",label:"Blossom"},{id:"compose",icon:"✏️",label:"Compose",requiresWrite:!0},{id:"recovery",icon:"🔄",label:"Recovery"},{id:"managed-acl",icon:"🛡️",label:"Managed ACL",requiresOwner:!0},{id:"curation",icon:"📋",label:"Curation",requiresOwner:!0},{id:"sprocket",icon:"⚙️",label:"Sprocket",requiresOwner:!0},{id:"policy",icon:"📜",label:"Policy",requiresOwner:!0},{id:"relay-connect",icon:"🔗",label:"Relay Connect",requiresOwner:!0},{id:"logs",icon:"📋",label:"Logs",requiresOwner:!0}];function xe(e){n(5,v=e),"sprocket"===e&&u&&"owner"===h&&G&&(ye(),we()),me()}function Se(){n(14,m=!1)}function Be(e){Qe(e)}function Qe(e){n(6,b=b.filter(t=>t.id!==e)),D.delete(e),v===e&&n(5,v="export")}async function Fe(e,t=!0){const n=D.get(e);if(n&&!n.isLoading){n.isLoading=!0,D.set(e,n);try{const i={...n.filter};!t&&n.oldestTimestamp&&(i.until=n.oldestTimestamp),t||(i.limit=200),console.log("Loading search results with filter:",i);const r=await Qp([i],{timeout:3e4});if(console.log("Received search results:",r.length,"events"),n.events=t?r.sort((e,t)=>t.created_at-e.created_at):[...n.events,...r].sort((e,t)=>t.created_at-e.created_at),r.length>0){const e=Math.min(...r.map(e=>e.created_at));(!n.oldestTimestamp||e0){const e=s.filter(e=>e.pubkey&&e.pubkey!==d);e.length>0&&console.warn("Server returned non-user events:",e.length,"out of",s.length)}if(e?(n(96,k=s.sort((e,t)=>t.created_at-e.created_at)),ve(s)):(n(96,k=[...k,...s].sort((e,t)=>t.created_at-e.created_at)),ve(k)),s.length>0){const e=Math.min(...s.map(e=>e.created_at));(!Q||e{if("events"===v){const e=document.querySelectorAll(".events-view-content")[0];e&&e.scrollHeight<=e.clientHeight&&_e()}},100)}catch(e){console.error("Failed to load events:",e),alert("Failed to load events: "+e.message)}finally{n(7,S=!1)}}}async function _e(){await Ue(!1)}let Ne=!1;async function Le(e,t){if(!u||!d)throw new Error("Not logged in");const n={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",window.location.origin+e],["method",t.toUpperCase()]],content:"",pubkey:d};let i;if(g&&"extension"===f)try{i=await g.signEvent(n)}catch(e){throw new Error("Failed to sign with extension: "+e.message)}else{if("nsec"!==f)throw new Error("No valid signer available");n.id="mock-id-"+Date.now(),n.sig="mock-signature-"+Date.now(),i=n}const r=JSON.stringify(i);return`Nostr ${btoa(r)}`}async function Oe(e,t){if(!u||!d)throw new Error("Not logged in");const n={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",window.location.origin+t],["method",e.toUpperCase()]],content:"",pubkey:d};let i;if(g&&"extension"===f)try{i=await g.signEvent(n)}catch(e){throw new Error("Failed to sign with extension: "+e.message)}else{if("nsec"!==f)throw new Error("No valid signer available");n.id="mock-id-"+Date.now(),n.sig="mock-signature-"+Date.now(),i=n}const r=JSON.stringify(i);return btoa(r)}function Me(e,t){const n=e.toLowerCase();if(n.includes("policy")||n.includes("blocked")||n.includes("denied")){let n=`Policy Error: ${e}`;return null!==t&&(n+=`\n\nKind ${t} may be restricted by the relay's policy configuration.`),V&&(n+="\n\nThe relay has policy enforcement enabled. Contact a relay administrator to allow this event kind or adjust your permissions."),n}if(n.includes("auth")||n.includes("permission")||n.includes("unauthorized"))return`Permission Error: ${e}\n\nYour current permissions may not allow publishing this type of event. Current role: ${h||"unknown"}. Contact a relay administrator to upgrade your permissions.`;if(n.includes("kind")||n.includes("not allowed")||n.includes("restricted")){let n=`Event Type Error: ${e}`;return null!==t&&(n+=`\n\nKind ${t} is not currently allowed on this relay.`),n+="\n\nThe relay administrator may need to update the policy configuration to allow this event kind.",n}return n.includes("rate")||n.includes("limit")||n.includes("too many")?`Rate Limit Error: ${e}\n\nPlease wait a moment before trying again.`:n.includes("size")||n.includes("too large")||n.includes("content")?`Size Limit Error: ${e}\n\nThe event may exceed the relay's size limits. Try reducing the content length.`:`Publishing failed: ${e}`}function je(e){n(97,F=e),localStorage.setItem("viewAsRole",e),console.log("View as role changed to:",e,"Current effective role:",a)}F=localStorage.getItem("viewAsRole")||"";return e.$$.update=()=>{var t;if(6&e.$$.dirty[0]|8&e.$$.dirty[3]&&n(41,i=k.sort((e,t)=>t.created_at-e.created_at)),8&e.$$.dirty[0]&&n(40,r=p?.about?(t=p.about,t?t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):"").replace(/\n{2,}/g,"
    "):""),16&e.$$.dirty[0]|16&e.$$.dirty[3]&&n(10,a=F&&""!==F?F:h),1810&e.$$.dirty[0]|112&e.$$.dirty[3]&&n(101,s=Ee.filter(e=>{const t=a;return!(e.requiresAdmin&&(!u||"admin"!==t&&"owner"!==t))&&(!(e.requiresOwner&&(!u||"owner"!==t))&&(!(e.requiresWrite&&(!u||"read"===t))&&(!("sprocket"===e.id&&!G)&&(!("policy"===e.id&&!V)&&(!("relay-connect"===e.id&&!X)&&(("managed-acl"!==e.id||"managed"===ee)&&(("curation"!==e.id||"curating"===ee)&&(console.log(`Tab ${e.id} filter check:`,{isLoggedIn:u,userRole:h,viewAsRole:F,currentRole:t,requiresAdmin:e.requiresAdmin,requiresOwner:e.requiresOwner,requiresWrite:e.requiresWrite,visible:!0}),!0))))))))})),64&e.$$.dirty[0]|256&e.$$.dirty[3]&&n(11,o=[...s,...b]),2578&e.$$.dirty[0]|256&e.$$.dirty[3]&&console.log("Tabs debug:",{isLoggedIn:u,userRole:h,aclMode:ee,filteredBaseTabs:s.map(e=>e.id),allTabs:o.map(e=>e.id)}),1&e.$$.dirty[0]&&"undefined"!=typeof document&&(l?document.body.classList.add("dark-theme"):document.body.classList.remove("dark-theme")),14&e.$$.dirty[0]&&u&&d&&!p&&$e(),182&e.$$.dirty[0]|136&e.$$.dirty[3]&&"events"===v&&u&&("read"===h||"write"===h||"admin"===h||"owner"===h)&&0===k.length&&!Ne&&!S){n(100,Ne=!0);Ue(!0,null)}32&e.$$.dirty[0]|8&e.$$.dirty[3]&&("events"!==v||"events"===v&&k.length>0)&&n(100,Ne=!1),32&e.$$.dirty[0]&&localStorage.setItem("selectedTab",v)},[l,u,d,p,h,v,b,S,V,ee,a,o,c,g,m,y,I,C,E,N,L,O,M,j,H,J,K,q,Y,W,z,Z,te,ne,ie,re,se,oe,ae,le,r,i,D,ue,de,async function(){console.log("Toggle changed, showOnlyMyEvents:",GA),n(100,Ne=!1),await Ue(!0,null)},fe,pe,he,ge,function(){console.log("selectRecoveryKind called, recoverySelectedKind:",re),null!=re?(n(36,se=""),n(37,oe=[]),ce=null,n(39,le=!0),pe()):console.log("No kind selected, skipping load")},function(){console.log("handleCustomKindInput called, recoveryCustomKind:",se);const e=parseInt(se);""!==se&&!isNaN(e)&&e>=0&&(n(35,re=null),n(37,oe=[]),ce=null,n(39,le=!0),pe())},function(e){const t=oe.filter(t=>t.kind===e.kind&&t.pubkey===e.pubkey),n=Math.max(...t.map(e=>e.created_at));return e.created_at===n},async function(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/status",{method:"GET",headers:{Authorization:`Nostr ${await Oe("GET","/api/sprocket/status")}`,"Content-Type":"application/json"}});if(e.ok){const t=await e.json();n(19,N=t.script_content||""),n(20,L=t),ke("Script loaded successfully","success")}else ke("Failed to load script","error")}catch(e){ke(`Error loading script: ${e.message}`,"error")}finally{n(22,M=!1)}},async function(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/update",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/update")}`,"Content-Type":"text/plain"},body:N});if(e.ok)ke("Script saved and updated successfully","success"),await ye(),await we();else{ke(`Failed to save script: ${await e.text()}`,"error")}}catch(e){ke(`Error saving script: ${e.message}`,"error")}finally{n(22,M=!1)}},async function(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/restart",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/restart")}`,"Content-Type":"application/json"}});if(e.ok)ke("Sprocket restarted successfully","success"),await ye();else{ke(`Failed to restart sprocket: ${await e.text()}`,"error")}}catch(e){ke(`Error restarting sprocket: ${e.message}`,"error")}finally{n(22,M=!1)}},async function(){if(u&&"owner"===h&&confirm("Are you sure you want to delete the sprocket script? This will stop the current process."))try{n(22,M=!0);const e=await fetch("/api/sprocket/update",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/update")}`,"Content-Type":"text/plain"},body:""});if(e.ok)n(19,N=""),ke("Sprocket script deleted successfully","success"),await ye(),await we();else{ke(`Failed to delete script: ${await e.text()}`,"error")}}catch(e){ke(`Error deleting script: ${e.message}`,"error")}finally{n(22,M=!1)}},we,be,Ae,async function(){if(u&&("owner"===h||JA))try{n(27,q=!0),n(30,z=[]);const e={kinds:[12345],limit:1},t=await Pp(e);if(t&&t.length>0){n(26,K=t[0].content);try{n(26,K=JSON.stringify(JSON.parse(K),null,2))}catch(e){}Ie("Policy loaded successfully","success")}else{const e=await fetch("/api/policy",{method:"GET",headers:{Authorization:`Nostr ${await Oe("GET","/api/policy")}`,"Content-Type":"application/json"}});if(e.ok){const t=await e.json();n(26,K=JSON.stringify(t,null,2)),Ie("Policy loaded from file","success")}else Ie("No policy configuration found","info"),n(26,K="")}}catch(e){Ie(`Error loading policy: ${e.message}`,"error")}finally{n(27,q=!1)}},Ce,async function(){if(!u||"owner"!==h&&!JA)return;if(await Ce())try{n(27,q=!0);const e={kind:12345,created_at:Math.floor(Date.now()/1e3),tags:[],content:K},t=await Ob(e,g);t.success?Ie("Policy updated successfully","success"):Ie(`Failed to publish policy: ${t.error||"Unknown error"}`,"error")}catch(e){Ie(`Error saving policy: ${e.message}`,"error")}finally{n(27,q=!1)}},function(){try{const e=JSON.parse(K);n(26,K=JSON.stringify(e,null,2)),Ie("JSON formatted","success")}catch(e){Ie(`Cannot format: ${e.message}`,"error")}},function(e){const t=e.detail;if(!t)return void Ie("Please enter a pubkey","error");const i=function(e){if(!e)return null;if(/^[0-9a-fA-F]{64}$/.test(e))return e.toLowerCase();if(e.startsWith("npub1"))try{const t="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n=e.slice(5);let i=[];for(const e of n){const n=t.indexOf(e.toLowerCase());if(-1===n)throw new Error("Invalid character in npub");i.push(...[...Array(5)].map((e,t)=>n>>4-t&1))}i=i.slice(0,-30);const r=[];for(let e=0;e+8<=i.length;e+=8){let t=0;for(let n=0;n<8;n++)t=t<<1|i[e+n];r.push(t)}return r.map(e=>e.toString(16).padStart(2,"0")).join("")}catch(e){return console.error("Failed to decode npub:",e),null}return null}(t);if(i&&64===i.length)try{const e=JSON.parse(K||"{}");if(e.policy_admins||(e.policy_admins=[]),e.policy_admins.includes(i))return void Ie("Admin already in list","warning");e.policy_admins.push(i),n(26,K=JSON.stringify(e,null,2)),Ie("Admin added - click 'Save & Publish' to apply","info")}catch(e){Ie(`Error adding admin: ${e.message}`,"error")}else Ie("Invalid pubkey format. Use hex (64 chars) or npub","error")},function(e){const t=e.detail;try{const e=JSON.parse(K||"{}");e.policy_admins&&(e.policy_admins=e.policy_admins.filter(e=>e!==t),n(26,K=JSON.stringify(e,null,2)),Ie("Admin removed - click 'Save & Publish' to apply","info"))}catch(e){Ie(`Error removing admin: ${e.message}`,"error")}},async function(){if(u&&("owner"===h||JA))try{n(27,q=!0),n(31,Z=[]);let e=[];try{e=JSON.parse(K||"{}").policy_admins||[]}catch(e){return void Ie("Cannot parse policy JSON to get admins","error")}if(0===e.length)return void Ie("No policy admins configured","warning");const t={kinds:[3],authors:e,limit:e.length},i=await Pp(t),r=new Set;for(const e of i)if(e.tags)for(const t of e.tags)"p"===t[0]&&t[1]&&64===t[1].length&&r.add(t[1]);n(31,Z=Array.from(r)),Ie(`Loaded ${Z.length} follows from ${i.length} admin(s)`,"success")}catch(e){Ie(`Error loading follows: ${e.message}`,"error")}finally{n(27,q=!1)}},function(e){n(25,J=e.target.files[0])},async function(){if(u&&"owner"===h&&J)try{n(22,M=!0);const e=await J.text(),t=await fetch("/api/sprocket/update",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/update")}`,"Content-Type":"text/plain"},body:e});if(t.ok)n(19,N=e),ke("Script uploaded and updated successfully","success"),await ye(),await we();else{ke(`Failed to upload script: ${await t.text()}`,"error")}}catch(e){ke(`Error uploading script: ${e.message}`,"error")}finally{n(22,M=!1),n(25,J=null);const e=document.getElementById("sprocket-upload-file");e&&(e.value="")}},xe,function(){u||n(12,c=!0)},async function(e){const{method:t,pubkey:i,privateKey:r,signer:s}=e.detail;n(1,u=!0),n(2,d=i),f=t,n(13,g=s),n(12,c=!1);try{if(await $p(),"extension"===t&&s)vp.setSigner(s);else if("nsec"===t&&r){const e=new ff(r);vp.setSigner(e)}n(3,p=await Sp(i)),console.log("Profile loaded:",p)}catch(e){console.error("Failed to load profile:",e)}await Pe(),await Re()},function(){n(1,u=!1),n(2,d=""),f="",n(3,p=null),n(4,h=""),n(13,g=null),userPrivkey=null,n(14,m=!1),T=[],n(96,k=[]),$=[],P=0,me(),"undefined"!=typeof localStorage&&(localStorage.removeItem("nostr_auth_method"),localStorage.removeItem("nostr_pubkey"),localStorage.removeItem("nostr_privkey"))},function(){n(12,c=!1)},function(){n(14,m=!0)},Se,function(){n(15,y=!y)},function(e){const{searchText:t,selectedKinds:n,pubkeys:i,eventIds:r,tags:s,sinceTimestamp:o,untilTimestamp:a,limit:l}=e.detail,c=function({searchText:e=null,kinds:t=[],authors:n=[],ids:i=[],tags:r=[],since:s=null,until:o=null,limit:a=null}){const l={};return e&&e.trim()&&(l.search=e.trim()),t&&t.length>0&&(l.kinds=t),n&&n.length>0&&(l.authors=n),i&&i.length>0&&(l.ids=i),r&&r.length>0&&r.forEach(e=>{if(e.name&&e.value){const t=`#${e.name}`;l[t]||(l[t]=[]),l[t].push(e.value)}}),s&&(l.since=s),o&&(l.until=o),a&&a>0&&(l.limit=a),l}({searchText:t,kinds:n,authors:i,ids:r,tags:s,since:o,until:a,limit:l||100});w=c,Ue(!0,null)},function(){w={},Ue(!0,null)},Be,Qe,Fe,De,$e,async function(){await Te([])},async function(){await Te([d])},function(e){n(16,I=e.detail.target.files[0])},async function(){if("none"!==ee&&(!u||"admin"!==h&&"owner"!==h))return n(17,C="Admin or owner permission required"),void setTimeout(()=>{n(17,C="")},5e3);if(!I)return n(17,C="Please select a file"),void setTimeout(()=>{n(17,C="")},5e3);try{n(17,C="Uploading...");const e={};"none"!==ee&&u&&(e.Authorization=await Le("/api/import","POST"));const t=new FormData;t.append("file",I);const i=await fetch("/api/import",{method:"POST",headers:e,body:t});if(!i.ok)throw new Error(`Import failed: ${i.status} ${i.statusText}`);await i.json();n(17,C="Upload complete"),n(16,I=null),document.getElementById("import-file").value="",setTimeout(()=>{n(17,C="")},5e3)}catch(e){console.error("Import failed:",e),n(17,C="Import failed: "+e.message),setTimeout(()=>{n(17,C="")},5e3)}},Ue,function(e){const{scrollTop:t,scrollHeight:n,clientHeight:i}=e.target;n-t-i<100&&_e()},function(){try{if(!ne.trim())return void alert("Please enter some JSON to reformat");const e=JSON.parse(ne);n(33,ne=JSON.stringify(e,null,2))}catch(e){alert("Invalid JSON: "+e.message)}},async function(){try{if(!ne.trim())return void alert("Please enter an event to sign");if(!u||!d)return void alert("Please log in to sign events");if(!g)return void alert("No signer available. Please log in with a valid authentication method.");const e=JSON.parse(ne);e.pubkey=d,e.created_at=Math.floor(Date.now()/1e3),delete e.id,delete e.sig;const t=await g.signEvent(e);n(33,ne=JSON.stringify(t,null,2)),alert("Event signed successfully!")}catch(e){console.error("Error signing event:",e),alert("Error signing event: "+e.message)}},async function(){n(34,ie="");try{if(!ne.trim())return void n(34,ie="Please enter an event to publish");if(!u)return void n(34,ie="Please log in to publish events");if(!g)return void n(34,ie="No signer available. Please log in with a valid authentication method.");let e;try{e=JSON.parse(ne)}catch(e){return void n(34,ie=`Invalid JSON: ${e.message}`)}if(!e.id||!e.sig)return void n(34,ie='Event must be signed before publishing. Please click "Sign" first.');if("read"===h)return void n(34,ie=`Permission denied: Your current role is "${h}" which does not allow publishing events. Contact a relay administrator to upgrade your permissions.`);const t=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`,i=await Ob(t,e,g,d);if(i.success)n(34,ie=""),alert("Event published successfully to ORLY relay!");else{const t=i.reason||"Unknown error";n(34,ie=Me(t,e.kind))}}catch(e){console.error("Error publishing event:",e);const t=e.message||"Unknown error";n(34,ie=Me(t,null))}},function(){n(34,ie="")},je,function(){const e=["owner","admin","write","read"],t=e.indexOf(h);return-1===t?["read"]:e.slice(t)},k,F,G,X,Ne,s,function(t){R.call(this,e,t)},function(t){R.call(this,e,t)},e=>e.id===v,e=>xe(e.detail),e=>Qe(e.detail),e=>ue(e.detail),e=>fe(e.detail),e=>de(e.detail.event,e.detail.e),e=>Ue(e.detail.refresh,e.detail.authors),function(e){ne=e,n(33,ne)},function(e){N=e,n(19,N)},e=>be(e.detail),e=>Ae(e.detail),function(e){K=e,n(26,K)},function(){re=x(this),n(35,re)},function(){se=A(this.value),n(36,se)},e=>ge(e),e=>he(e),(e,t)=>de(e,t),e=>Fe(e.id,!0),e=>Be(e.id),e=>fe(e.id),e=>ue(e.id),(e,t)=>"Enter"===t.key&&ue(e.id),(e,t)=>de(e,t),(e,t)=>De(t,e.id),e=>je(e===h?"":e),e=>"Escape"===e.key&&Se(),function(e){c=e,n(12,c)}]}return new class extends se{constructor(e){super(),re(this,e,KA,HA,s,{},null,[-1,-1,-1,-1,-1,-1])}}({target:document.body,props:{name:"world"}})}(); //# sourceMappingURL=bundle.js.map diff --git a/app/web/dist/bundle.js.map b/app/web/dist/bundle.js.map index d37f4f0..885fba9 100644 --- a/app/web/dist/bundle.js.map +++ b/app/web/dist/bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"bundle.js","sources":["../node_modules/svelte/internal/index.mjs","../node_modules/nostr-tools/node_modules/@noble/curves/node_modules/@noble/hashes/esm/_assert.js","../node_modules/nostr-tools/node_modules/@noble/curves/node_modules/@noble/hashes/esm/crypto.js","../node_modules/nostr-tools/node_modules/@noble/curves/node_modules/@noble/hashes/esm/utils.js","../node_modules/nostr-tools/node_modules/@noble/curves/node_modules/@noble/hashes/esm/_sha2.js","../node_modules/nostr-tools/node_modules/@noble/curves/node_modules/@noble/hashes/esm/sha256.js","../node_modules/nostr-tools/node_modules/@noble/curves/esm/abstract/utils.js","../node_modules/nostr-tools/node_modules/@noble/curves/esm/abstract/modular.js","../node_modules/nostr-tools/node_modules/@noble/curves/esm/abstract/curve.js","../node_modules/nostr-tools/node_modules/@noble/curves/esm/abstract/weierstrass.js","../node_modules/nostr-tools/node_modules/@noble/curves/node_modules/@noble/hashes/esm/hmac.js","../node_modules/nostr-tools/node_modules/@noble/curves/esm/_shortw_utils.js","../node_modules/nostr-tools/node_modules/@noble/curves/esm/secp256k1.js","../node_modules/nostr-tools/node_modules/@noble/hashes/esm/crypto.js","../node_modules/nostr-tools/node_modules/@noble/hashes/esm/utils.js","../node_modules/nostr-tools/node_modules/@noble/hashes/esm/_assert.js","../node_modules/nostr-tools/node_modules/@noble/hashes/esm/_sha2.js","../node_modules/nostr-tools/node_modules/@noble/hashes/esm/sha256.js","../node_modules/nostr-tools/lib/esm/pool.js","../node_modules/nostr-tools/node_modules/@scure/base/lib/esm/index.js","../node_modules/@noble/ciphers/esm/_assert.js","../node_modules/@noble/ciphers/esm/utils.js","../node_modules/@noble/ciphers/esm/aes.js","../node_modules/@noble/ciphers/esm/_arx.js","../node_modules/@noble/ciphers/esm/chacha.js","../node_modules/nostr-tools/node_modules/@noble/hashes/esm/hmac.js","../node_modules/nostr-tools/node_modules/@noble/hashes/esm/hkdf.js","../node_modules/nostr-tools/lib/esm/index.js","../node_modules/nostr-tools/lib/esm/kinds.js","../node_modules/tslib/tslib.es6.mjs","../node_modules/rxjs/dist/esm5/internal/util/isFunction.js","../node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js","../node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js","../node_modules/rxjs/dist/esm5/internal/util/arrRemove.js","../node_modules/rxjs/dist/esm5/internal/Subscription.js","../node_modules/rxjs/dist/esm5/internal/config.js","../node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js","../node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js","../node_modules/rxjs/dist/esm5/internal/util/noop.js","../node_modules/rxjs/dist/esm5/internal/util/errorContext.js","../node_modules/rxjs/dist/esm5/internal/Subscriber.js","../node_modules/rxjs/dist/esm5/internal/symbol/observable.js","../node_modules/rxjs/dist/esm5/internal/util/identity.js","../node_modules/rxjs/dist/esm5/internal/Observable.js","../node_modules/rxjs/dist/esm5/internal/util/pipe.js","../node_modules/rxjs/dist/esm5/internal/util/lift.js","../node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js","../node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js","../node_modules/rxjs/dist/esm5/internal/Subject.js","../node_modules/rxjs/dist/esm5/internal/scheduler/dateTimestampProvider.js","../node_modules/rxjs/dist/esm5/internal/ReplaySubject.js","../node_modules/rxjs/dist/esm5/internal/scheduler/Action.js","../node_modules/rxjs/dist/esm5/internal/scheduler/intervalProvider.js","../node_modules/rxjs/dist/esm5/internal/scheduler/AsyncAction.js","../node_modules/rxjs/dist/esm5/internal/Scheduler.js","../node_modules/rxjs/dist/esm5/internal/scheduler/AsyncScheduler.js","../node_modules/rxjs/dist/esm5/internal/scheduler/async.js","../node_modules/rxjs/dist/esm5/internal/observable/empty.js","../node_modules/rxjs/dist/esm5/internal/util/isScheduler.js","../node_modules/rxjs/dist/esm5/internal/util/args.js","../node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js","../node_modules/rxjs/dist/esm5/internal/util/isPromise.js","../node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js","../node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js","../node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js","../node_modules/rxjs/dist/esm5/internal/symbol/iterator.js","../node_modules/rxjs/dist/esm5/internal/util/isIterable.js","../node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js","../node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js","../node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js","../node_modules/rxjs/dist/esm5/internal/operators/observeOn.js","../node_modules/rxjs/dist/esm5/internal/operators/subscribeOn.js","../node_modules/rxjs/dist/esm5/internal/scheduled/scheduleAsyncIterable.js","../node_modules/rxjs/dist/esm5/internal/scheduled/scheduled.js","../node_modules/rxjs/dist/esm5/internal/scheduled/scheduleObservable.js","../node_modules/rxjs/dist/esm5/internal/scheduled/scheduleArray.js","../node_modules/rxjs/dist/esm5/internal/scheduled/schedulePromise.js","../node_modules/rxjs/dist/esm5/internal/scheduled/scheduleIterable.js","../node_modules/rxjs/dist/esm5/internal/scheduled/scheduleReadableStreamLike.js","../node_modules/rxjs/dist/esm5/internal/observable/from.js","../node_modules/rxjs/dist/esm5/internal/observable/of.js","../node_modules/rxjs/dist/esm5/internal/operators/map.js","../node_modules/rxjs/dist/esm5/internal/util/mapOneOrManyArgs.js","../node_modules/rxjs/dist/esm5/internal/util/argsArgArrayOrObject.js","../node_modules/rxjs/dist/esm5/internal/observable/combineLatest.js","../node_modules/rxjs/dist/esm5/internal/util/createObject.js","../node_modules/rxjs/dist/esm5/internal/operators/mergeMap.js","../node_modules/rxjs/dist/esm5/internal/operators/mergeInternals.js","../node_modules/rxjs/dist/esm5/internal/operators/mergeAll.js","../node_modules/rxjs/dist/esm5/internal/observable/concat.js","../node_modules/rxjs/dist/esm5/internal/operators/concatAll.js","../node_modules/rxjs/dist/esm5/internal/observable/defer.js","../node_modules/rxjs/dist/esm5/internal/observable/timer.js","../node_modules/rxjs/dist/esm5/internal/util/isDate.js","../node_modules/rxjs/dist/esm5/internal/observable/merge.js","../node_modules/rxjs/dist/esm5/internal/operators/filter.js","../node_modules/rxjs/dist/esm5/internal/operators/take.js","../node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js","../node_modules/rxjs/dist/esm5/internal/operators/endWith.js","../node_modules/rxjs/dist/esm5/internal/operators/finalize.js","../node_modules/rxjs/dist/esm5/internal/operators/merge.js","../node_modules/rxjs/dist/esm5/internal/operators/mergeWith.js","../node_modules/rxjs/dist/esm5/internal/operators/scan.js","../node_modules/rxjs/dist/esm5/internal/operators/scanInternals.js","../node_modules/rxjs/dist/esm5/internal/operators/share.js","../node_modules/rxjs/dist/esm5/internal/operators/switchMap.js","../node_modules/rxjs/dist/esm5/internal/operators/tap.js","../node_modules/applesauce-core/dist/helpers/tags.js","../node_modules/nostr-tools/lib/esm/pure.js","../node_modules/applesauce-core/dist/helpers/cache.js","../node_modules/nostr-tools/lib/esm/utils.js","../node_modules/applesauce-core/dist/helpers/event.js","../node_modules/applesauce-core/dist/helpers/time.js","../node_modules/applesauce-core/dist/helpers/expiration.js","../node_modules/nostr-tools/lib/esm/nip19.js","../node_modules/applesauce-core/dist/helpers/url.js","../node_modules/applesauce-core/dist/helpers/relays.js","../node_modules/applesauce-core/dist/helpers/string.js","../node_modules/@noble/hashes/esm/crypto.js","../node_modules/@noble/hashes/esm/utils.js","../node_modules/applesauce-core/dist/helpers/pointers.js","../node_modules/applesauce-core/dist/helpers/groups.js","../node_modules/applesauce-core/dist/helpers/encrypted-content.js","../node_modules/applesauce-core/dist/helpers/hidden-content.js","../node_modules/applesauce-core/dist/helpers/hidden-tags.js","../node_modules/applesauce-core/dist/helpers/event-tags.js","../node_modules/applesauce-core/dist/helpers/lru.js","../node_modules/ms/index.js","../node_modules/debug/src/common.js","../node_modules/debug/src/browser.js","../node_modules/applesauce-core/dist/logger.js","../node_modules/applesauce-core/dist/event-store/event-memory.js","../node_modules/hash-sum/hash-sum.js","../node_modules/applesauce-core/dist/helpers/filter.js","../node_modules/applesauce-core/dist/models/blossom.js","../node_modules/applesauce-core/dist/helpers/blossom.js","../node_modules/applesauce-core/dist/helpers/profile.js","../node_modules/applesauce-core/dist/helpers/json.js","../node_modules/light-bolt11-decoder/node_modules/@scure/base/lib/index.js","../node_modules/light-bolt11-decoder/bolt11.js","../node_modules/applesauce-core/dist/helpers/comment.js","../node_modules/applesauce-core/dist/helpers/contacts.js","../node_modules/applesauce-core/dist/helpers/encrypted-content-cache.js","../node_modules/applesauce-core/dist/helpers/event-cache.js","../node_modules/applesauce-core/dist/helpers/lnurl.js","../node_modules/applesauce-core/dist/helpers/mailboxes.js","../node_modules/applesauce-core/dist/helpers/mutes.js","../node_modules/applesauce-core/dist/helpers/reports.js","../node_modules/applesauce-core/dist/helpers/threading.js","../node_modules/applesauce-core/dist/observable/claim-events.js","../node_modules/applesauce-core/dist/observable/claim-latest.js","../node_modules/applesauce-core/dist/observable/defined.js","../node_modules/applesauce-core/dist/observable/with-immediate-value.js","../node_modules/applesauce-core/dist/models/common.js","../node_modules/rxjs/dist/esm5/internal/operators/ignoreElements.js","../node_modules/rxjs/dist/esm5/internal/operators/takeUntil.js","../node_modules/rxjs/dist/esm5/internal/operators/repeat.js","../node_modules/applesauce-core/dist/observable/watch-event-updates.js","../node_modules/applesauce-core/dist/models/contacts.js","../node_modules/applesauce-core/dist/models/comments.js","../node_modules/applesauce-core/dist/models/mailboxes.js","../node_modules/applesauce-core/dist/models/mutes.js","../node_modules/applesauce-core/dist/models/profile.js","../node_modules/applesauce-core/dist/models/reactions.js","../node_modules/applesauce-core/dist/models/thread.js","../node_modules/applesauce-core/dist/event-store/model-mixin.js","../node_modules/applesauce-core/dist/event-store/event-store.js","../node_modules/applesauce-core/dist/helpers/delete.js","../node_modules/applesauce-core/dist/promise/deferred.js","../node_modules/applesauce-signers/dist/signers/amber-clipboard-signer.js","../node_modules/applesauce-signers/dist/helpers/nostr-connect.js","../node_modules/applesauce-signers/dist/signers/private-key-signer.js","../node_modules/applesauce-signers/node_modules/@noble/secp256k1/lib/esm/index.js","../node_modules/applesauce-signers/node_modules/@scure/base/lib/esm/index.js","../node_modules/applesauce-signers/dist/signers/serial-port-signer.js","../src/constants.js","../src/nostr.js","../node_modules/hash-wasm/dist/index.esm.js","../src/nsec-crypto.js","../src/LoginModal.svelte","../src/ManagedACL.svelte","../src/Header.svelte","../src/Sidebar.svelte","../src/ExportView.svelte","../src/ImportView.svelte","../src/helpers.tsx","../src/FilterBuilder.svelte","../src/EventsView.svelte","../src/eventKinds.js","../src/EventTemplateSelector.svelte","../src/ComposeView.svelte","../src/SprocketView.svelte","../src/PolicyView.svelte","../src/kindCategories.js","../src/CurationView.svelte","../src/BlossomView.svelte","../src/LogView.svelte","../src/api.js","../src/utils.js","../src/RelayConnectView.svelte","../src/FilterDisplay.svelte","../src/websocket-auth.js","../src/App.svelte","../src/main.js"],"sourcesContent":["function noop() { }\nconst identity = x => x;\nfunction assign(tar, src) {\n // @ts-ignore\n for (const k in src)\n tar[k] = src[k];\n return tar;\n}\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\nfunction is_promise(value) {\n return !!value && (typeof value === 'object' || typeof value === 'function') && typeof value.then === 'function';\n}\nfunction add_location(element, file, line, column, char) {\n element.__svelte_meta = {\n loc: { file, line, column, char }\n };\n}\nfunction run(fn) {\n return fn();\n}\nfunction blank_object() {\n return Object.create(null);\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === 'function';\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');\n}\nlet src_url_equal_anchor;\nfunction src_url_equal(element_src, url) {\n if (!src_url_equal_anchor) {\n src_url_equal_anchor = document.createElement('a');\n }\n src_url_equal_anchor.href = url;\n return element_src === src_url_equal_anchor.href;\n}\nfunction not_equal(a, b) {\n return a != a ? b == b : a !== b;\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nfunction validate_store(store, name) {\n if (store != null && typeof store.subscribe !== 'function') {\n throw new Error(`'${name}' is not a store with a 'subscribe' method`);\n }\n}\nfunction subscribe(store, ...callbacks) {\n if (store == null) {\n return noop;\n }\n const unsub = store.subscribe(...callbacks);\n return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\nfunction get_store_value(store) {\n let value;\n subscribe(store, _ => value = _)();\n return value;\n}\nfunction component_subscribe(component, store, callback) {\n component.$$.on_destroy.push(subscribe(store, callback));\n}\nfunction create_slot(definition, ctx, $$scope, fn) {\n if (definition) {\n const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n return definition[0](slot_ctx);\n }\n}\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n return definition[1] && fn\n ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))\n : $$scope.ctx;\n}\nfunction get_slot_changes(definition, $$scope, dirty, fn) {\n if (definition[2] && fn) {\n const lets = definition[2](fn(dirty));\n if ($$scope.dirty === undefined) {\n return lets;\n }\n if (typeof lets === 'object') {\n const merged = [];\n const len = Math.max($$scope.dirty.length, lets.length);\n for (let i = 0; i < len; i += 1) {\n merged[i] = $$scope.dirty[i] | lets[i];\n }\n return merged;\n }\n return $$scope.dirty | lets;\n }\n return $$scope.dirty;\n}\nfunction update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);\n}\nfunction get_all_dirty_from_scope($$scope) {\n if ($$scope.ctx.length > 32) {\n const dirty = [];\n const length = $$scope.ctx.length / 32;\n for (let i = 0; i < length; i++) {\n dirty[i] = -1;\n }\n return dirty;\n }\n return -1;\n}\nfunction exclude_internal_props(props) {\n const result = {};\n for (const k in props)\n if (k[0] !== '$')\n result[k] = props[k];\n return result;\n}\nfunction compute_rest_props(props, keys) {\n const rest = {};\n keys = new Set(keys);\n for (const k in props)\n if (!keys.has(k) && k[0] !== '$')\n rest[k] = props[k];\n return rest;\n}\nfunction compute_slots(slots) {\n const result = {};\n for (const key in slots) {\n result[key] = true;\n }\n return result;\n}\nfunction once(fn) {\n let ran = false;\n return function (...args) {\n if (ran)\n return;\n ran = true;\n fn.call(this, ...args);\n };\n}\nfunction null_to_empty(value) {\n return value == null ? '' : value;\n}\nfunction set_store_value(store, ret, value) {\n store.set(value);\n return ret;\n}\nconst has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nfunction action_destroyer(action_result) {\n return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\nfunction split_css_unit(value) {\n const split = typeof value === 'string' && value.match(/^\\s*(-?[\\d.]+)([^\\s]*)\\s*$/);\n return split ? [parseFloat(split[1]), split[2] || 'px'] : [value, 'px'];\n}\nconst contenteditable_truthy_values = ['', true, 1, 'true', 'contenteditable'];\n\nconst is_client = typeof window !== 'undefined';\nlet now = is_client\n ? () => window.performance.now()\n : () => Date.now();\nlet raf = is_client ? cb => requestAnimationFrame(cb) : noop;\n// used internally for testing\nfunction set_now(fn) {\n now = fn;\n}\nfunction set_raf(fn) {\n raf = fn;\n}\n\nconst tasks = new Set();\nfunction run_tasks(now) {\n tasks.forEach(task => {\n if (!task.c(now)) {\n tasks.delete(task);\n task.f();\n }\n });\n if (tasks.size !== 0)\n raf(run_tasks);\n}\n/**\n * For testing purposes only!\n */\nfunction clear_loops() {\n tasks.clear();\n}\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n */\nfunction loop(callback) {\n let task;\n if (tasks.size === 0)\n raf(run_tasks);\n return {\n promise: new Promise(fulfill => {\n tasks.add(task = { c: callback, f: fulfill });\n }),\n abort() {\n tasks.delete(task);\n }\n };\n}\n\nconst globals = (typeof window !== 'undefined'\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : global);\n\n/**\n * Resize observer singleton.\n * One listener per element only!\n * https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ\n */\nclass ResizeObserverSingleton {\n constructor(options) {\n this.options = options;\n this._listeners = 'WeakMap' in globals ? new WeakMap() : undefined;\n }\n observe(element, listener) {\n this._listeners.set(element, listener);\n this._getObserver().observe(element, this.options);\n return () => {\n this._listeners.delete(element);\n this._observer.unobserve(element); // this line can probably be removed\n };\n }\n _getObserver() {\n var _a;\n return (_a = this._observer) !== null && _a !== void 0 ? _a : (this._observer = new ResizeObserver((entries) => {\n var _a;\n for (const entry of entries) {\n ResizeObserverSingleton.entries.set(entry.target, entry);\n (_a = this._listeners.get(entry.target)) === null || _a === void 0 ? void 0 : _a(entry);\n }\n }));\n }\n}\n// Needs to be written like this to pass the tree-shake-test\nResizeObserverSingleton.entries = 'WeakMap' in globals ? new WeakMap() : undefined;\n\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\nfunction start_hydrating() {\n is_hydrating = true;\n}\nfunction end_hydrating() {\n is_hydrating = false;\n}\nfunction upper_bound(low, high, key, value) {\n // Return first index of value larger than input value in the range [low, high)\n while (low < high) {\n const mid = low + ((high - low) >> 1);\n if (key(mid) <= value) {\n low = mid + 1;\n }\n else {\n high = mid;\n }\n }\n return low;\n}\nfunction init_hydrate(target) {\n if (target.hydrate_init)\n return;\n target.hydrate_init = true;\n // We know that all children have claim_order values since the unclaimed have been detached if target is not \n let children = target.childNodes;\n // If target is , there may be children without claim_order\n if (target.nodeName === 'HEAD') {\n const myChildren = [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n if (node.claim_order !== undefined) {\n myChildren.push(node);\n }\n }\n children = myChildren;\n }\n /*\n * Reorder claimed children optimally.\n * We can reorder claimed children optimally by finding the longest subsequence of\n * nodes that are already claimed in order and only moving the rest. The longest\n * subsequence of nodes that are claimed in order can be found by\n * computing the longest increasing subsequence of .claim_order values.\n *\n * This algorithm is optimal in generating the least amount of reorder operations\n * possible.\n *\n * Proof:\n * We know that, given a set of reordering operations, the nodes that do not move\n * always form an increasing subsequence, since they do not move among each other\n * meaning that they must be already ordered among each other. Thus, the maximal\n * set of nodes that do not move form a longest increasing subsequence.\n */\n // Compute longest increasing subsequence\n // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n const m = new Int32Array(children.length + 1);\n // Predecessor indices + 1\n const p = new Int32Array(children.length);\n m[0] = -1;\n let longest = 0;\n for (let i = 0; i < children.length; i++) {\n const current = children[i].claim_order;\n // Find the largest subsequence length such that it ends in a value less than our current value\n // upper_bound returns first greater value, so we subtract one\n // with fast path for when we are on the current longest subsequence\n const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;\n p[i] = m[seqLen] + 1;\n const newLen = seqLen + 1;\n // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n m[newLen] = i;\n longest = Math.max(newLen, longest);\n }\n // The longest increasing subsequence of nodes (initially reversed)\n const lis = [];\n // The rest of the nodes, nodes that will be moved\n const toMove = [];\n let last = children.length - 1;\n for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n lis.push(children[cur - 1]);\n for (; last >= cur; last--) {\n toMove.push(children[last]);\n }\n last--;\n }\n for (; last >= 0; last--) {\n toMove.push(children[last]);\n }\n lis.reverse();\n // We sort the nodes being moved to guarantee that their insertion order matches the claim order\n toMove.sort((a, b) => a.claim_order - b.claim_order);\n // Finally, we move the nodes\n for (let i = 0, j = 0; i < toMove.length; i++) {\n while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {\n j++;\n }\n const anchor = j < lis.length ? lis[j] : null;\n target.insertBefore(toMove[i], anchor);\n }\n}\nfunction append(target, node) {\n target.appendChild(node);\n}\nfunction append_styles(target, style_sheet_id, styles) {\n const append_styles_to = get_root_for_style(target);\n if (!append_styles_to.getElementById(style_sheet_id)) {\n const style = element('style');\n style.id = style_sheet_id;\n style.textContent = styles;\n append_stylesheet(append_styles_to, style);\n }\n}\nfunction get_root_for_style(node) {\n if (!node)\n return document;\n const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n if (root && root.host) {\n return root;\n }\n return node.ownerDocument;\n}\nfunction append_empty_stylesheet(node) {\n const style_element = element('style');\n append_stylesheet(get_root_for_style(node), style_element);\n return style_element.sheet;\n}\nfunction append_stylesheet(node, style) {\n append(node.head || node, style);\n return style.sheet;\n}\nfunction append_hydration(target, node) {\n if (is_hydrating) {\n init_hydrate(target);\n if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentNode !== target))) {\n target.actual_end_child = target.firstChild;\n }\n // Skip nodes of undefined ordering\n while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {\n target.actual_end_child = target.actual_end_child.nextSibling;\n }\n if (node !== target.actual_end_child) {\n // We only insert if the ordering of this node should be modified or the parent node is not target\n if (node.claim_order !== undefined || node.parentNode !== target) {\n target.insertBefore(node, target.actual_end_child);\n }\n }\n else {\n target.actual_end_child = node.nextSibling;\n }\n }\n else if (node.parentNode !== target || node.nextSibling !== null) {\n target.appendChild(node);\n }\n}\nfunction insert(target, node, anchor) {\n target.insertBefore(node, anchor || null);\n}\nfunction insert_hydration(target, node, anchor) {\n if (is_hydrating && !anchor) {\n append_hydration(target, node);\n }\n else if (node.parentNode !== target || node.nextSibling != anchor) {\n target.insertBefore(node, anchor || null);\n }\n}\nfunction detach(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\nfunction destroy_each(iterations, detaching) {\n for (let i = 0; i < iterations.length; i += 1) {\n if (iterations[i])\n iterations[i].d(detaching);\n }\n}\nfunction element(name) {\n return document.createElement(name);\n}\nfunction element_is(name, is) {\n return document.createElement(name, { is });\n}\nfunction object_without_properties(obj, exclude) {\n const target = {};\n for (const k in obj) {\n if (has_prop(obj, k)\n // @ts-ignore\n && exclude.indexOf(k) === -1) {\n // @ts-ignore\n target[k] = obj[k];\n }\n }\n return target;\n}\nfunction svg_element(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n}\nfunction text(data) {\n return document.createTextNode(data);\n}\nfunction space() {\n return text(' ');\n}\nfunction empty() {\n return text('');\n}\nfunction comment(content) {\n return document.createComment(content);\n}\nfunction listen(node, event, handler, options) {\n node.addEventListener(event, handler, options);\n return () => node.removeEventListener(event, handler, options);\n}\nfunction prevent_default(fn) {\n return function (event) {\n event.preventDefault();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_propagation(fn) {\n return function (event) {\n event.stopPropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_immediate_propagation(fn) {\n return function (event) {\n event.stopImmediatePropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction self(fn) {\n return function (event) {\n // @ts-ignore\n if (event.target === this)\n fn.call(this, event);\n };\n}\nfunction trusted(fn) {\n return function (event) {\n // @ts-ignore\n if (event.isTrusted)\n fn.call(this, event);\n };\n}\nfunction attr(node, attribute, value) {\n if (value == null)\n node.removeAttribute(attribute);\n else if (node.getAttribute(attribute) !== value)\n node.setAttribute(attribute, value);\n}\n/**\n * List of attributes that should always be set through the attr method,\n * because updating them through the property setter doesn't work reliably.\n * In the example of `width`/`height`, the problem is that the setter only\n * accepts numeric values, but the attribute can also be set to a string like `50%`.\n * If this list becomes too big, rethink this approach.\n */\nconst always_set_through_set_attribute = ['width', 'height'];\nfunction set_attributes(node, attributes) {\n // @ts-ignore\n const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n for (const key in attributes) {\n if (attributes[key] == null) {\n node.removeAttribute(key);\n }\n else if (key === 'style') {\n node.style.cssText = attributes[key];\n }\n else if (key === '__value') {\n node.value = node[key] = attributes[key];\n }\n else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {\n node[key] = attributes[key];\n }\n else {\n attr(node, key, attributes[key]);\n }\n }\n}\nfunction set_svg_attributes(node, attributes) {\n for (const key in attributes) {\n attr(node, key, attributes[key]);\n }\n}\nfunction set_custom_element_data_map(node, data_map) {\n Object.keys(data_map).forEach((key) => {\n set_custom_element_data(node, key, data_map[key]);\n });\n}\nfunction set_custom_element_data(node, prop, value) {\n if (prop in node) {\n node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n }\n else {\n attr(node, prop, value);\n }\n}\nfunction set_dynamic_element_data(tag) {\n return (/-/.test(tag)) ? set_custom_element_data_map : set_attributes;\n}\nfunction xlink_attr(node, attribute, value) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\nfunction get_binding_group_value(group, __value, checked) {\n const value = new Set();\n for (let i = 0; i < group.length; i += 1) {\n if (group[i].checked)\n value.add(group[i].__value);\n }\n if (!checked) {\n value.delete(__value);\n }\n return Array.from(value);\n}\nfunction init_binding_group(group) {\n let _inputs;\n return {\n /* push */ p(...inputs) {\n _inputs = inputs;\n _inputs.forEach(input => group.push(input));\n },\n /* remove */ r() {\n _inputs.forEach(input => group.splice(group.indexOf(input), 1));\n }\n };\n}\nfunction init_binding_group_dynamic(group, indexes) {\n let _group = get_binding_group(group);\n let _inputs;\n function get_binding_group(group) {\n for (let i = 0; i < indexes.length; i++) {\n group = group[indexes[i]] = group[indexes[i]] || [];\n }\n return group;\n }\n function push() {\n _inputs.forEach(input => _group.push(input));\n }\n function remove() {\n _inputs.forEach(input => _group.splice(_group.indexOf(input), 1));\n }\n return {\n /* update */ u(new_indexes) {\n indexes = new_indexes;\n const new_group = get_binding_group(group);\n if (new_group !== _group) {\n remove();\n _group = new_group;\n push();\n }\n },\n /* push */ p(...inputs) {\n _inputs = inputs;\n push();\n },\n /* remove */ r: remove\n };\n}\nfunction to_number(value) {\n return value === '' ? null : +value;\n}\nfunction time_ranges_to_array(ranges) {\n const array = [];\n for (let i = 0; i < ranges.length; i += 1) {\n array.push({ start: ranges.start(i), end: ranges.end(i) });\n }\n return array;\n}\nfunction children(element) {\n return Array.from(element.childNodes);\n}\nfunction init_claim_info(nodes) {\n if (nodes.claim_info === undefined) {\n nodes.claim_info = { last_index: 0, total_claimed: 0 };\n }\n}\nfunction claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {\n // Try to find nodes in an order such that we lengthen the longest increasing subsequence\n init_claim_info(nodes);\n const resultNode = (() => {\n // We first try to find an element after the previous one\n for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n return node;\n }\n }\n // Otherwise, we try to find one before\n // We iterate in reverse so that we don't go too far back\n for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n else if (replacement === undefined) {\n // Since we spliced before the last_index, we decrease it\n nodes.claim_info.last_index--;\n }\n return node;\n }\n }\n // If we can't find any matching node, we create a new one\n return createNode();\n })();\n resultNode.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n return resultNode;\n}\nfunction claim_element_base(nodes, name, attributes, create_element) {\n return claim_node(nodes, (node) => node.nodeName === name, (node) => {\n const remove = [];\n for (let j = 0; j < node.attributes.length; j++) {\n const attribute = node.attributes[j];\n if (!attributes[attribute.name]) {\n remove.push(attribute.name);\n }\n }\n remove.forEach(v => node.removeAttribute(v));\n return undefined;\n }, () => create_element(name));\n}\nfunction claim_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, element);\n}\nfunction claim_svg_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, svg_element);\n}\nfunction claim_text(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 3, (node) => {\n const dataStr = '' + data;\n if (node.data.startsWith(dataStr)) {\n if (node.data.length !== dataStr.length) {\n return node.splitText(dataStr.length);\n }\n }\n else {\n node.data = dataStr;\n }\n }, () => text(data), true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n );\n}\nfunction claim_space(nodes) {\n return claim_text(nodes, ' ');\n}\nfunction claim_comment(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 8, (node) => {\n node.data = '' + data;\n return undefined;\n }, () => comment(data), true);\n}\nfunction find_comment(nodes, text, start) {\n for (let i = start; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n return i;\n }\n }\n return nodes.length;\n}\nfunction claim_html_tag(nodes, is_svg) {\n // find html opening tag\n const start_index = find_comment(nodes, 'HTML_TAG_START', 0);\n const end_index = find_comment(nodes, 'HTML_TAG_END', start_index);\n if (start_index === end_index) {\n return new HtmlTagHydration(undefined, is_svg);\n }\n init_claim_info(nodes);\n const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n detach(html_tag_nodes[0]);\n detach(html_tag_nodes[html_tag_nodes.length - 1]);\n const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n for (const n of claimed_nodes) {\n n.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n }\n return new HtmlTagHydration(claimed_nodes, is_svg);\n}\nfunction set_data(text, data) {\n data = '' + data;\n if (text.data === data)\n return;\n text.data = data;\n}\nfunction set_data_contenteditable(text, data) {\n data = '' + data;\n if (text.wholeText === data)\n return;\n text.data = data;\n}\nfunction set_data_maybe_contenteditable(text, data, attr_value) {\n if (~contenteditable_truthy_values.indexOf(attr_value)) {\n set_data_contenteditable(text, data);\n }\n else {\n set_data(text, data);\n }\n}\nfunction set_input_value(input, value) {\n input.value = value == null ? '' : value;\n}\nfunction set_input_type(input, type) {\n try {\n input.type = type;\n }\n catch (e) {\n // do nothing\n }\n}\nfunction set_style(node, key, value, important) {\n if (value == null) {\n node.style.removeProperty(key);\n }\n else {\n node.style.setProperty(key, value, important ? 'important' : '');\n }\n}\nfunction select_option(select, value, mounting) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n if (option.__value === value) {\n option.selected = true;\n return;\n }\n }\n if (!mounting || value !== undefined) {\n select.selectedIndex = -1; // no option should be selected\n }\n}\nfunction select_options(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n option.selected = ~value.indexOf(option.__value);\n }\n}\nfunction select_value(select) {\n const selected_option = select.querySelector(':checked');\n return selected_option && selected_option.__value;\n}\nfunction select_multiple_value(select) {\n return [].map.call(select.querySelectorAll(':checked'), option => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\nlet crossorigin;\nfunction is_crossorigin() {\n if (crossorigin === undefined) {\n crossorigin = false;\n try {\n if (typeof window !== 'undefined' && window.parent) {\n void window.parent.document;\n }\n }\n catch (error) {\n crossorigin = true;\n }\n }\n return crossorigin;\n}\nfunction add_iframe_resize_listener(node, fn) {\n const computed_style = getComputedStyle(node);\n if (computed_style.position === 'static') {\n node.style.position = 'relative';\n }\n const iframe = element('iframe');\n iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');\n iframe.setAttribute('aria-hidden', 'true');\n iframe.tabIndex = -1;\n const crossorigin = is_crossorigin();\n let unsubscribe;\n if (crossorigin) {\n iframe.src = \"data:text/html,\";\n unsubscribe = listen(window, 'message', (event) => {\n if (event.source === iframe.contentWindow)\n fn();\n });\n }\n else {\n iframe.src = 'about:blank';\n iframe.onload = () => {\n unsubscribe = listen(iframe.contentWindow, 'resize', fn);\n // make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)\n // see https://github.com/sveltejs/svelte/issues/4233\n fn();\n };\n }\n append(node, iframe);\n return () => {\n if (crossorigin) {\n unsubscribe();\n }\n else if (unsubscribe && iframe.contentWindow) {\n unsubscribe();\n }\n detach(iframe);\n };\n}\nconst resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'content-box' });\nconst resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'border-box' });\nconst resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'device-pixel-content-box' });\nfunction toggle_class(element, name, toggle) {\n element.classList[toggle ? 'add' : 'remove'](name);\n}\nfunction custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n const e = document.createEvent('CustomEvent');\n e.initCustomEvent(type, bubbles, cancelable, detail);\n return e;\n}\nfunction query_selector_all(selector, parent = document.body) {\n return Array.from(parent.querySelectorAll(selector));\n}\nfunction head_selector(nodeId, head) {\n const result = [];\n let started = 0;\n for (const node of head.childNodes) {\n if (node.nodeType === 8 /* comment node */) {\n const comment = node.textContent.trim();\n if (comment === `HEAD_${nodeId}_END`) {\n started -= 1;\n result.push(node);\n }\n else if (comment === `HEAD_${nodeId}_START`) {\n started += 1;\n result.push(node);\n }\n }\n else if (started > 0) {\n result.push(node);\n }\n }\n return result;\n}\nclass HtmlTag {\n constructor(is_svg = false) {\n this.is_svg = false;\n this.is_svg = is_svg;\n this.e = this.n = null;\n }\n c(html) {\n this.h(html);\n }\n m(html, target, anchor = null) {\n if (!this.e) {\n if (this.is_svg)\n this.e = svg_element(target.nodeName);\n /** #7364 target for