var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function s(t){return"function"==typeof t}function o(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function i(e,n,r){e.$$.on_destroy.push(function(e,...n){if(null==e){for(const t of n)t(void 0);return t}const r=e.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}(n,r))}function a(t,e,n){return t.set(n),e}const l="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function c(t,e){t.appendChild(e)}function u(t,e,n){t.insertBefore(e,n||null)}function d(t){t.parentNode&&t.parentNode.removeChild(t)}function f(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function w(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function b(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function m(t,e){e=""+e,t.data!==e&&(t.data=e)}function v(t,e){t.value=null==e?"":e}function E(t,e,n,r){null==n?t.style.removeProperty(e):t.style.setProperty(e,n,"")}function x(t,e,n){t.classList.toggle(e,!!n)}let k;function $(t){k=t}function A(){if(!k)throw new Error("Function called outside component initialization");return k}function B(t){A().$$.on_mount.push(t)}function I(){const t=A();return(e,n,{cancelable:r=!1}={})=>{const s=t.$$.callbacks[e];if(s){const o=function(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}(e,n,{cancelable:r});return s.slice().forEach(e=>{e.call(t,o)}),!o.defaultPrevented}return!0}}function _(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(t=>t.call(this,e))}const L=[],S=[];let C=[];const U=[],T=Promise.resolve();let N=!1;function O(t){C.push(t)}const R=new Set;let P=0;function D(){if(0!==P)return;const t=k;do{try{for(;P{H.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function M(t){return void 0!==t?.length?t:Array.from(t)}function Z(t){t&&t.c()}function G(t,n,o){const{fragment:i,after_update:a}=t.$$;i&&i.m(n,o),O(()=>{const n=t.$$.on_mount.map(e).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...n):r(n),t.$$.on_mount=[]}),a.forEach(O)}function W(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];C.forEach(r=>-1===t.indexOf(r)?e.push(r):n.push(r)),n.forEach(t=>t()),C=e}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Y(t,e){-1===t.$$.dirty[0]&&(L.push(t),N||(N=!0,T.then(D)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const s=r.length?r[0]:n;return h.ctx&&a(h.ctx[t],h.ctx[t]=s)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](s),g&&Y(e,t)),n}):[],h.update(),g=!0,r(h.before_update),h.fragment=!!i&&i(h.ctx),s.target){if(s.hydrate){const t=function(t){return Array.from(t.childNodes)}(s.target);h.fragment&&h.fragment.l(t),t.forEach(d)}else h.fragment&&h.fragment.c();s.intro&&z(e.$$.fragment),G(e,s.target,s.anchor),D()}$(f)}class Q{$$=void 0;$$set=void 0;$destroy(){W(this,1),this.$destroy=t}$on(e,n){if(!s(n))return t;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function X(e){let n,r,s;return{c(){n=h("button"),n.textContent="Login",b(n,"class","login-header-btn svelte-1bc06ax")},m(t,o){u(t,n,o),r||(s=y(n,"click",e[9]),r=!0)},p:t,d(t){t&&d(n),r=!1,s()}}}function tt(t){let e,n,s,o,i,a,l,f,w,v,E,k,$,A,B=nt(t[2])+"";return{c(){e=h("nav"),n=h("button"),n.textContent="Dashboard",s=p(),o=h("button"),o.textContent="Config",i=p(),a=h("button"),a.textContent="Update",l=p(),f=h("div"),w=h("span"),v=g(B),E=p(),k=h("button"),k.textContent="Logout",b(n,"class","nav-btn svelte-1bc06ax"),x(n,"active","dashboard"===t[0]),b(o,"class","nav-btn svelte-1bc06ax"),x(o,"active","config"===t[0]),b(a,"class","nav-btn svelte-1bc06ax"),x(a,"active","update"===t[0]),b(e,"class","svelte-1bc06ax"),b(w,"class","pubkey svelte-1bc06ax"),b(k,"class","logout-btn svelte-1bc06ax"),b(f,"class","user-section svelte-1bc06ax")},m(r,d){u(r,e,d),c(e,n),c(e,s),c(e,o),c(e,i),c(e,a),u(r,l,d),u(r,f,d),c(f,w),c(w,v),c(f,E),c(f,k),$||(A=[y(n,"click",t[5]),y(o,"click",t[6]),y(a,"click",t[7]),y(k,"click",t[8])],$=!0)},p(t,e){1&e&&x(n,"active","dashboard"===t[0]),1&e&&x(o,"active","config"===t[0]),1&e&&x(a,"active","update"===t[0]),4&e&&B!==(B=nt(t[2])+"")&&m(v,B)},d(t){t&&(d(e),d(l),d(f)),$=!1,r(A)}}}function et(e){let n,r,s,o;function i(t,e){return t[1]?tt:X}let a=i(e),l=a(e);return{c(){n=h("header"),r=h("div"),s=h("h1"),s.textContent="ORLY Launcher",o=p(),l.c(),b(s,"class","svelte-1bc06ax"),b(r,"class","header-content svelte-1bc06ax"),b(n,"class","svelte-1bc06ax")},m(t,e){u(t,n,e),c(n,r),c(r,s),c(r,o),l.m(r,null)},p(t,[e]){a===(a=i(t))&&l?l.p(t,e):(l.d(1),l=a(t),l&&(l.c(),l.m(r,null)))},i:t,o:t,d(t){t&&d(n),l.d()}}}function nt(t){return t?t.slice(0,8)+"..."+t.slice(-4):""}function rt(t,e,n){const r=I();let{currentPage:s="dashboard"}=e,{isLoggedIn:o=!1}=e,{userPubkey:i=""}=e;function a(t){r("navigate",t)}return t.$$set=t=>{"currentPage"in t&&n(0,s=t.currentPage),"isLoggedIn"in t&&n(1,o=t.isLoggedIn),"userPubkey"in t&&n(2,i=t.userPubkey)},[s,o,i,r,a,()=>a("dashboard"),()=>a("config"),()=>a("update"),()=>r("logout"),()=>r("login")]}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class st extends Q{constructor(t){super(),J(this,t,rt,et,o,{currentPage:0,isLoggedIn:1,userPubkey:2})}}function ot(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function it(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function at(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}const lt="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,ct=t=>t instanceof Uint8Array,ut=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),dt=(t,e)=>t<<32-e|t>>>e;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function ft(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),!ct(t))throw new Error("expected Uint8Array, got "+typeof t);return t}let ht=class{clone(){return this._cloneInto()}};function gt(t){const e=e=>t().update(ft(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function pt(t=32){if(lt&&"function"==typeof lt.getRandomValues)return lt.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}let yt=class extends ht{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ut(this.buffer)}update(t){at(this);const{view:e,buffer:n,blockLen:r}=this,s=(t=ft(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>s&o),a=Number(n&o),l=r?4:0,c=r?0:4;t.setUint32(e+l,i,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),s),this.process(n,0);const i=ut(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;tt&e^~t&n,bt=(t,e,n)=>t&e^t&n^e&n,mt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),vt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Et=new Uint32Array(64);let xt=class extends yt{constructor(){super(64,32,8,!1),this.A=0|vt[0],this.B=0|vt[1],this.C=0|vt[2],this.D=0|vt[3],this.E=0|vt[4],this.F=0|vt[5],this.G=0|vt[6],this.H=0|vt[7]}get(){const{A:t,B:e,C:n,D:r,E:s,F:o,G:i,H:a}=this;return[t,e,n,r,s,o,i,a]}set(t,e,n,r,s,o,i,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)Et[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Et[t-15],n=Et[t-2],r=dt(e,7)^dt(e,18)^e>>>3,s=dt(n,17)^dt(n,19)^n>>>10;Et[t]=s+Et[t-7]+r+Et[t-16]|0}let{A:n,B:r,C:s,D:o,E:i,F:a,G:l,H:c}=this;for(let t=0;t<64;t++){const e=c+(dt(i,6)^dt(i,11)^dt(i,25))+wt(i,a,l)+mt[t]+Et[t]|0,u=(dt(n,2)^dt(n,13)^dt(n,22))+bt(n,r,s)|0;c=l,l=a,a=i,i=o+e|0,o=s,s=r,r=n,n=e+u|0}n=n+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,i=i+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,s,o,i,a,l,c)}roundClean(){Et.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const kt=gt(()=>new xt);
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const $t=BigInt(1),At=BigInt(2),Bt=t=>t instanceof Uint8Array,It=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function _t(t){if(!Bt(t))throw new Error("Uint8Array expected");let e="";for(let n=0;nt+e.length,0));let n=0;return t.forEach(t=>{if(!Bt(t))throw new Error("Uint8Array expected");e.set(t,n),n+=t.length}),e}const Pt=t=>(At<new Uint8Array(t),qt=t=>Uint8Array.from(t);function Ht(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=Dt(t),s=Dt(t),o=0;const i=()=>{r.fill(1),s.fill(0),o=0},a=(...t)=>n(s,r,...t),l=(t=Dt())=>{s=a(qt([0]),t),r=a(),0!==t.length&&(s=a(qt([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(i(),l(t);!(n=e(c()));)l();return i(),n}}const Ft={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function Vt(t,e,n={}){const r=(e,n,r)=>{const s=Ft[n];if("function"!=typeof s)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||s(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}var jt=Object.freeze({__proto__:null,bitMask:Pt,bytesToHex:_t,bytesToNumberBE:Ct,bytesToNumberLE:Ut,concatBytes:Rt,createHmacDrbg:Ht,ensureBytes:Ot,hexToBytes:St,hexToNumber:Lt,numberToBytesBE:Tt,numberToBytesLE:Nt,validateObject:Vt});
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zt=BigInt(0),Kt=BigInt(1),Mt=BigInt(2),Zt=BigInt(3),Gt=BigInt(4),Wt=BigInt(5),Yt=BigInt(8);function Jt(t,e){const n=t%e;return n>=zt?n:e+n}function Qt(t,e,n){if(n<=zt||e 0");if(n===Kt)return zt;let r=Kt;for(;e>zt;)e&Kt&&(r=r*t%n),t=t*t%n,e>>=Kt;return r}function Xt(t,e,n){let r=t;for(;e-- >zt;)r*=r,r%=n;return r}function te(t,e){if(t===zt||e<=zt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=Jt(t,e),r=e,s=zt,o=Kt;for(;n!==zt;){const t=r%n,e=s-o*(r/n);r=n,n=t,s=o,o=e}if(r!==Kt)throw new Error("invert: does not exist");return Jt(s,e)}function ee(t){if(t%Gt===Zt){const e=(t+Kt)/Gt;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%Yt===Wt){const e=(t-Wt)/Yt;return function(t,n){const r=t.mul(n,Mt),s=t.pow(r,e),o=t.mul(n,s),i=t.mul(t.mul(o,Mt),s),a=t.mul(o,t.sub(i,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-Kt)/Mt;let n,r,s;for(n=t-Kt,r=0;n%Mt===zt;n/=Mt,r++);for(s=Mt;s(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Vt(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...re(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:ce,hexToBytes:ue}=jt,de={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=de;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:ce(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=de,n="string"==typeof t?ue(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:o}=de._parseInt(n.subarray(2)),{d:i,l:a}=de._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:i}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),s=e(n(t.r)),o=r.length/2,i=s.length/2,a=n(o),l=n(i);return`30${n(i+o+4)}02${l}${s}02${a}${r}`}},fe=BigInt(0),he=BigInt(1);BigInt(2);const ge=BigInt(3);function pe(t){const e=function(t){const e=le(t);Vt(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const s=e.toAffine();return Rt(Uint8Array.from([4]),n.toBytes(s.x),n.toBytes(s.y))}),s=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:s}=e,o=n.sqr(t),i=n.mul(o,t);return n.add(n.add(i,n.mul(t,r)),s)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function i(t){return"bigint"==typeof t&&fen.eql(t,n.ZERO);return s(e)&&s(r)?d.ZERO:new d(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map(t=>t.pz));return t.map((t,n)=>t.toAffine(e[n])).map(d.fromAffine)}static fromHex(t){const e=d.fromAffine(s(Ot("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return d.BASE.multiply(l(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const s=n.sqr(r),i=o(t);if(!n.eql(s,i))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){u(t);const{px:e,py:r,pz:s}=this,{px:o,py:i,pz:a}=t,l=n.eql(n.mul(e,a),n.mul(o,s)),c=n.eql(n.mul(r,a),n.mul(i,s));return l&&c}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,s=n.mul(r,ge),{px:o,py:i,pz:a}=this;let l=n.ZERO,c=n.ZERO,u=n.ZERO,f=n.mul(o,o),h=n.mul(i,i),g=n.mul(a,a),p=n.mul(o,i);return p=n.add(p,p),u=n.mul(o,a),u=n.add(u,u),l=n.mul(t,u),c=n.mul(s,g),c=n.add(l,c),l=n.sub(h,c),c=n.add(h,c),c=n.mul(l,c),l=n.mul(p,l),u=n.mul(s,u),g=n.mul(t,g),p=n.sub(f,g),p=n.mul(t,p),p=n.add(p,u),u=n.add(f,f),f=n.add(u,f),f=n.add(f,g),f=n.mul(f,p),c=n.add(c,f),g=n.mul(i,a),g=n.add(g,g),f=n.mul(g,p),l=n.sub(l,f),u=n.mul(g,h),u=n.add(u,u),u=n.add(u,u),new d(l,c,u)}add(t){u(t);const{px:r,py:s,pz:o}=this,{px:i,py:a,pz:l}=t;let c=n.ZERO,f=n.ZERO,h=n.ZERO;const g=e.a,p=n.mul(e.b,ge);let y=n.mul(r,i),w=n.mul(s,a),b=n.mul(o,l),m=n.add(r,s),v=n.add(i,a);m=n.mul(m,v),v=n.add(y,w),m=n.sub(m,v),v=n.add(r,o);let E=n.add(i,l);return v=n.mul(v,E),E=n.add(y,b),v=n.sub(v,E),E=n.add(s,o),c=n.add(a,l),E=n.mul(E,c),c=n.add(w,b),E=n.sub(E,c),h=n.mul(g,v),c=n.mul(p,b),h=n.add(c,h),c=n.sub(w,h),h=n.add(w,h),f=n.mul(c,h),w=n.add(y,y),w=n.add(w,y),b=n.mul(g,b),v=n.mul(p,v),w=n.add(w,b),b=n.sub(y,b),b=n.mul(g,b),v=n.add(v,b),y=n.mul(w,v),f=n.add(f,y),y=n.mul(E,v),c=n.mul(m,c),c=n.sub(c,y),y=n.mul(m,w),h=n.mul(E,h),h=n.add(h,y),new d(c,f,h)}subtract(t){return this.add(t.negate())}is0(){return this.equals(d.ZERO)}wNAF(t){return h.wNAFCached(this,c,t,t=>{const e=n.invertBatch(t.map(t=>t.pz));return t.map((t,n)=>t.toAffine(e[n])).map(d.fromAffine)})}multiplyUnsafe(t){const r=d.ZERO;if(t===fe)return r;if(a(t),t===he)return this;const{endo:s}=e;if(!s)return h.unsafeLadder(this,t);let{k1neg:o,k1:i,k2neg:l,k2:c}=s.splitScalar(t),u=r,f=r,g=this;for(;i>fe||c>fe;)i&he&&(u=u.add(g)),c&he&&(f=f.add(g)),g=g.double(),i>>=he,c>>=he;return o&&(u=u.negate()),l&&(f=f.negate()),f=new d(n.mul(f.px,s.beta),f.py,f.pz),u.add(f)}multiply(t){a(t);let r,s,o=t;const{endo:i}=e;if(i){const{k1neg:t,k1:e,k2neg:a,k2:l}=i.splitScalar(o);let{p:c,f:u}=this.wNAF(e),{p:f,f:g}=this.wNAF(l);c=h.constTimeNegate(t,c),f=h.constTimeNegate(a,f),f=new d(n.mul(f.px,i.beta),f.py,f.pz),r=c.add(f),s=u.add(g)}else{const{p:t,f:e}=this.wNAF(o);r=t,s=e}return d.normalizeZ([r,s])[0]}multiplyAndAddUnsafe(t,e,n){const r=d.BASE,s=(t,e)=>e!==fe&&e!==he&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=s(this,e).add(s(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:s}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(s));const i=n.mul(e,t),a=n.mul(r,t),l=n.mul(s,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(l,n.ONE))throw new Error("invZ was invalid");return{x:i,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===he)return!0;if(n)return n(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===he?this:n?n(d,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(d,this,t)}toHex(t=!0){return _t(this.toRawBytes(t))}}d.BASE=new d(e.Gx,e.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);const f=e.nBitLength,h=function(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,s=e;for(;n>ie;)n&ae&&(r=r.add(s)),s=s.double(),n>>=ae;return r},precomputeWindow(t,e){const{windows:n,windowSize:s}=r(e),o=[];let i=t,a=i;for(let t=0;t>=f,r>a&&(r-=d,o+=ae);const i=e,h=e+Math.abs(r)-1,g=t%2!=0,p=r<0;0===r?c=c.add(n(g,s[i])):l=l.add(n(p,s[h]))}return{p:l,f:c}},wNAFCached(t,e,n,r){const s=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,s),1!==s&&e.set(t,r(o))),this.wNAF(s,o,n)}}}(d,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:d,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:i}}function ye(t){const e=function(t){const e=le(t);return Vt(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,s=n.BYTES+1,o=2*n.BYTES+1;function i(t){return Jt(t,r)}function a(t){return te(t,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:u,isWithinCurveOrder:d}=pe({...e,toBytes(t,e,r){const s=e.toAffine(),o=n.toBytes(s.x),i=Rt;return r?i(Uint8Array.from([e.hasEvenY()?2:3]),o):i(Uint8Array.from([4]),o,n.toBytes(s.y))},fromBytes(t){const e=t.length,r=t[0],i=t.subarray(1);if(e!==s||2!==r&&3!==r){if(e===o&&4===r){return{x:n.fromBytes(i.subarray(0,n.BYTES)),y:n.fromBytes(i.subarray(n.BYTES,2*n.BYTES))}}throw new Error(`Point of length ${e} was invalid. Expected ${s} compressed bytes or ${o} uncompressed bytes`)}{const t=Ct(i);if(!(fe<(a=t)&&a_t(Tt(t,e.nByteLength));function h(t){return t>r>>he}const g=(t,e,n)=>Ct(t.slice(e,n));class p{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=Ot("compactSignature",t,2*n),new p(g(t,0,n),g(t,n,2*n))}static fromDER(t){const{r:e,s:n}=de.toSig(Ot("DER",t));return new p(e,n)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new p(this.r,this.s,t)}recoverPublicKey(t){const{r:r,s:s,recovery:o}=this,c=m(Ot("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const u=2===o||3===o?r+e.n:r;if(u>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=1&o?"03":"02",h=l.fromHex(d+f(u)),g=a(u),p=i(-c*g),y=i(s*g),w=l.BASE.multiplyAndAddUnsafe(h,p,y);if(!w)throw new Error("point at infinify");return w.assertValidity(),w}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new p(this.r,i(-this.s),this.recovery):this}toDERRawBytes(){return St(this.toDERHex())}toDERHex(){return de.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return St(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const y={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=oe(e.n);return function(t,e,n=!1){const r=t.length,s=se(e),o=oe(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const i=Jt(n?Ct(t):Ut(t),e-Kt)+Kt;return n?Nt(i,s):Tt(i,s)}(e.randomBytes(t),e.n)},precompute:(t=8,e=l.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function w(t){const e=t instanceof Uint8Array,n="string"==typeof t,r=(e||n)&&t.length;return e?r===s||r===o:n?r===2*s||r===2*o:t instanceof l}const b=e.bits2int||function(t){const n=Ct(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},m=e.bits2int_modN||function(t){return i(b(t))},v=Pt(e.nBitLength);function E(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(fe<=t&&tt in s))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:u}=e;let{lowS:f,prehash:g,extraEntropy:y}=s;null==f&&(f=!0),t=Ot("msgHash",t),g&&(t=Ot("prehashed msgHash",o(t)));const w=m(t),v=c(r),x=[E(v),E(w)];if(null!=y){const t=!0===y?u(n.BYTES):y;x.push(Ot("extraEntropy",t))}const $=Rt(...x),A=w;return{seed:$,k2sig:function(t){const e=b(t);if(!d(e))return;const n=a(e),r=l.BASE.multiply(e).toAffine(),s=i(r.x);if(s===fe)return;const o=i(n*i(A+s*v));if(o===fe)return;let c=(r.x===s?0:2)|Number(r.y&he),u=o;return f&&h(o)&&(u=function(t){return h(t)?i(-t):t}(o),c^=1),new p(s,u,c)}}}const k={lowS:e.lowS,prehash:!1},$={lowS:e.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return l.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(w(t))throw new Error("first arg must be private key");if(!w(e))throw new Error("second arg must be public key");return l.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,n,r=k){const{seed:s,k2sig:o}=x(t,n,r),i=e;return Ht(i.hash.outputLen,i.nByteLength,i.hmac)(s,o)},verify:function(t,n,r,s=$){const o=t;if(n=Ot("msgHash",n),r=Ot("publicKey",r),"strict"in s)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:u}=s;let d,f;try{if("string"==typeof o||o instanceof Uint8Array)try{d=p.fromDER(o)}catch(t){if(!(t instanceof de.Err))throw t;d=p.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;d=new p(t,e)}}f=l.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&d.hasHighS())return!1;u&&(n=e.hash(n));const{r:h,s:g}=d,y=m(n),w=a(g),b=i(y*w),v=i(h*w),E=l.BASE.multiplyAndAddUnsafe(f,b,v)?.toAffine();return!!E&&i(E.x)===h},ProjectivePoint:l,Signature:p,utils:y}}BigInt(4);class we extends ht{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");ot(t.outputLen),ot(t.blockLen)}(t);const n=ft(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,s=new Uint8Array(r);s.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew we(t,e).update(n).digest();
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
function me(t){return{hash:t,hmac:(e,...n)=>be(t,e,function(...t){const e=new Uint8Array(t.reduce((t,e)=>t+e.length,0));let n=0;return t.forEach(t=>{if(!ct(t))throw new Error("Uint8Array expected");e.set(t,n),n+=t.length}),e}(...n)),randomBytes:pt}}be.create=(t,e)=>new we(t,e);
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const ve=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ee=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),xe=BigInt(1),ke=BigInt(2),$e=(t,e)=>(t+e/ke)/e;function Ae(t){const e=ve,n=BigInt(3),r=BigInt(6),s=BigInt(11),o=BigInt(22),i=BigInt(23),a=BigInt(44),l=BigInt(88),c=t*t*t%e,u=c*c*t%e,d=Xt(u,n,e)*u%e,f=Xt(d,n,e)*u%e,h=Xt(f,ke,e)*c%e,g=Xt(h,s,e)*h%e,p=Xt(g,o,e)*g%e,y=Xt(p,a,e)*p%e,w=Xt(y,l,e)*y%e,b=Xt(w,a,e)*p%e,m=Xt(b,n,e)*u%e,v=Xt(m,i,e)*g%e,E=Xt(v,r,e)*c%e,x=Xt(E,ke,e);if(!Be.eql(Be.sqr(x),t))throw new Error("Cannot find square root");return x}const Be=function(t,e,n=!1,r={}){if(t<=zt)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:o}=re(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const i=ee(t),a=Object.freeze({ORDER:t,BITS:s,BYTES:o,MASK:Pt(s),ZERO:zt,ONE:Kt,create:e=>Jt(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return zt<=e&&et===zt,isOdd:t=>(t&Kt)===Kt,neg:e=>Jt(-e,t),eql:(t,e)=>t===e,sqr:e=>Jt(e*e,t),add:(e,n)=>Jt(e+n,t),sub:(e,n)=>Jt(e-n,t),mul:(e,n)=>Jt(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===zt)return t.ONE;if(n===Kt)return e;let r=t.ONE,s=e;for(;n>zt;)n&Kt&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Kt;return r}(a,t,e),div:(e,n)=>Jt(e*te(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>te(e,t),sqrt:r.sqrt||(t=>i(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce((e,r,s)=>t.is0(r)?e:(n[s]=e,t.mul(e,r)),t.ONE),s=t.inv(r);return e.reduceRight((e,r,s)=>t.is0(r)?e:(n[s]=t.mul(e,n[s]),t.mul(e,r)),s),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?Nt(t,o):Tt(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?Ut(t):Ct(t)}});return Object.freeze(a)}(ve,void 0,void 0,{sqrt:Ae}),Ie=function(t,e){const n=e=>ye({...t,...me(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Be,n:Ee,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Ee,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-xe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,i=BigInt("0x100000000000000000000000000000000"),a=$e(o*t,e),l=$e(-r*t,e);let c=Jt(t-a*n-l*s,e),u=Jt(-a*r-l*o,e);const d=c>i,f=u>i;if(d&&(c=e-c),f&&(u=e-u),c>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:d,k1:c,k2neg:f,k2:u}}}},kt),_e=BigInt(0),Le=t=>"bigint"==typeof t&&_et.charCodeAt(0)));n=Rt(e,e),Se[t]=n}return kt(Rt(n,...e))}const Ue=t=>t.toRawBytes(!0).slice(1),Te=t=>Tt(t,32),Ne=t=>Jt(t,ve),Oe=t=>Jt(t,Ee),Re=Ie.ProjectivePoint;function Pe(t){let e=Ie.utils.normPrivateKeyToScalar(t),n=Re.fromPrivateKey(e);return{scalar:n.hasEvenY()?e:Oe(-e),bytes:Ue(n)}}function De(t){if(!Le(t))throw new Error("bad x: need 0 < x < p");const e=Ne(t*t);let n=Ae(Ne(e*t+BigInt(7)));n%ke!==_e&&(n=Ne(-n));const r=new Re(t,n,xe);return r.assertValidity(),r}function qe(...t){return Oe(Ct(Ce("BIP0340/challenge",...t)))}function He(t){return Pe(t).bytes}function Fe(t,e,n=pt(32)){const r=Ot("message",t),{bytes:s,scalar:o}=Pe(e),i=Ot("auxRand",n,32),a=Te(o^Ct(Ce("BIP0340/aux",i))),l=Ce("BIP0340/nonce",a,s,r),c=Oe(Ct(l));if(c===_e)throw new Error("sign failed: k is zero");const{bytes:u,scalar:d}=Pe(c),f=qe(u,s,r),h=new Uint8Array(64);if(h.set(u,0),h.set(Te(Oe(d+f*o)),32),!Ve(h,r,s))throw new Error("sign: Invalid signature produced");return h}function Ve(t,e,n){const r=Ot("signature",t,64),s=Ot("message",e),o=Ot("publicKey",n,32);try{const t=De(Ct(o)),e=Ct(r.subarray(0,32));if(!Le(e))return!1;const n=Ct(r.subarray(32,64));if(!("bigint"==typeof(c=n)&&_e({getPublicKey:He,sign:Fe,verify:Ve,utils:{randomPrivateKey:Ie.utils.randomPrivateKey,lift_x:De,pointToBytes:Ue,numberToBytesBE:Tt,bytesToNumberBE:Ct,taggedHash:Ce,mod:Jt}}))(),ze=t=>t instanceof Uint8Array,Ke=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Me=(t,e)=>t<<32-e|t>>>e;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");const Ze=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Ge(t){if(!ze(t))throw new Error("Uint8Array expected");let e="";for(let n=0;nt().update(We(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Qe(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Xe(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}const tn={number:Qe,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:Xe,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Qe(t.outputLen),Qe(t.blockLen)},exists:function(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")},output:function(t,e){Xe(t);const n=e.outputLen;if(t.lengthr-o&&(this.process(n,0),o=0);for(let t=o;t>s&o),a=Number(n&o),l=r?4:0,c=r?0:4;t.setUint32(e+l,i,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),s),this.process(n,0);const i=Ke(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;tt&e^~t&n,rn=(t,e,n)=>t&e^t&n^e&n,sn=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),on=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),an=new Uint32Array(64);class ln extends en{constructor(){super(64,32,8,!1),this.A=0|on[0],this.B=0|on[1],this.C=0|on[2],this.D=0|on[3],this.E=0|on[4],this.F=0|on[5],this.G=0|on[6],this.H=0|on[7]}get(){const{A:t,B:e,C:n,D:r,E:s,F:o,G:i,H:a}=this;return[t,e,n,r,s,o,i,a]}set(t,e,n,r,s,o,i,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)an[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=an[t-15],n=an[t-2],r=Me(e,7)^Me(e,18)^e>>>3,s=Me(n,17)^Me(n,19)^n>>>10;an[t]=s+an[t-7]+r+an[t-16]|0}let{A:n,B:r,C:s,D:o,E:i,F:a,G:l,H:c}=this;for(let t=0;t<64;t++){const e=c+(Me(i,6)^Me(i,11)^Me(i,25))+nn(i,a,l)+sn[t]+an[t]|0,u=(Me(n,2)^Me(n,13)^Me(n,22))+rn(n,r,s)|0;c=l,l=a,a=i,i=o+e|0,o=s,s=r,r=n,n=e+u|0}n=n+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,i=i+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,s,o,i,a,l,c)}roundClean(){an.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class cn extends ln{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const un=Je(()=>new ln);Je(()=>new cn);var dn=Symbol("verified");function fn(t){if(!(t instanceof Object))return!1;if("number"!=typeof t.kind)return!1;if("string"!=typeof t.content)return!1;if("number"!=typeof t.created_at)return!1;if("string"!=typeof t.pubkey)return!1;if(!t.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(t.tags))return!1;for(let e=0;en=>t(e(n)),n=Array.from(t).reverse().reduce((t,n)=>t?e(t,n.encode):n.encode,void 0),r=t.reduce((t,n)=>t?e(t,n.decode):n.decode,void 0);return{encode:n,decode:r}}function En(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("alphabet.encode input should be an array of numbers");return e.map(e=>{if(mn(e),e<0||e>=t.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${t.length})`);return t[e]})},decode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("alphabet.decode input should be array of strings");return e.map(e=>{if("string"!=typeof e)throw new Error(`alphabet.decode: not string element=${e}`);const n=t.indexOf(e);if(-1===n)throw new Error(`Unknown letter: "${e}". Allowed: ${t}`);return n})}}}function xn(t=""){if("string"!=typeof t)throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("join.encode input should be array of strings");for(let t of e)if("string"!=typeof t)throw new Error(`join.encode: non-string input=${t}`);return e.join(t)},decode:e=>{if("string"!=typeof e)throw new Error("join.decode input should be string");return e.split(t)}}}function kn(t,e="="){if(mn(t),"string"!=typeof e)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let t of n)if("string"!=typeof t)throw new Error(`padding.encode: non-string input=${t}`);for(;n.length*t%8;)n.push(e);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let t of n)if("string"!=typeof t)throw new Error(`padding.decode: non-string input=${t}`);let r=n.length;if(r*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===e;r--)if(!((r-1)*t%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function $n(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}function An(t,e,n){if(e<2)throw new Error(`convertRadix: wrong from=${e}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(t))throw new Error("convertRadix: data should be array");if(!t.length)return[];let r=0;const s=[],o=Array.from(t);for(o.forEach(t=>{if(mn(t),t<0||t>=e)throw new Error(`Wrong integer: ${t}`)});;){let t=0,i=!0;for(let s=r;se?Bn(e,t%e):t,In=(t,e)=>t+(e-Bn(t,e));function _n(t,e,n,r){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(In(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${In(e,n)}`);let s=0,o=0;const i=2**n-1,a=[];for(const r of t){if(mn(r),r>=2**e)throw new Error(`convertRadix2: invalid data word=${r} from=${e}`);if(s=s<32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=n;o-=n)a.push((s>>o-n&i)>>>0);s&=2**o-1}if(s=s<=e)throw new Error("Excess padding");if(!r&&s)throw new Error(`Non-zero padding: ${s}`);return r&&o>0&&a.push(s>>>0),a}function Ln(t,e=!1){if(mn(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(In(8,t)>32||In(t,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return _n(Array.from(n),8,t,!e)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(_n(n,t,8,e))}}}function Sn(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(t){}}}const Cn=vn(Ln(4),En("0123456789ABCDEF"),xn("")),Un=vn(Ln(5),En("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),kn(5),xn(""));vn(Ln(5),En("0123456789ABCDEFGHIJKLMNOPQRSTUV"),kn(5),xn("")),vn(Ln(5),En("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),xn(""),$n(t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const Tn=vn(Ln(6),En("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),kn(6),xn("")),Nn=vn(Ln(6),En("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),kn(6),xn("")),On=t=>{return vn((mn(e=58),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return An(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(An(t,e,256))}}),En(t),xn(""));var e},Rn=On("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");On("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),On("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const Pn=[0,2,3,5,6,7,9,10,11],Dn={encode(t){let e="";for(let n=0;n>25;let n=(33554431&t)<<5;for(let t=0;t>t&1)&&(n^=Hn[t]);return n}function Vn(t,e,n=1){const r=t.length;let s=1;for(let e=0;e126)throw new Error(`Invalid prefix (${t})`);s=Fn(s)^n>>5}s=Fn(s);for(let e=0;en)throw new TypeError(`Wrong string length: ${t.length} (${t}). Expected (8..${n})`);const r=t.toLowerCase();if(t!==r&&t!==t.toUpperCase())throw new Error("String must be lowercase or uppercase");const s=(t=r).lastIndexOf("1");if(0===s||-1===s)throw new Error('Letter "1" must be present between prefix and data only');const o=t.slice(0,s),i=t.slice(s+1);if(i.length<6)throw new Error("Data must be at least 6 characters long");const a=qn.decode(i).slice(0,-6),l=Vn(o,a,e);if(!i.endsWith(l))throw new Error(`Invalid checksum in ${t}: expected "${l}"`);return{prefix:o,words:a}}return{encode:function(t,n,r=90){if("string"!=typeof t)throw new Error("bech32.encode prefix should be string, not "+typeof t);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof n);const s=t.length+7+n.length;if(!1!==r&&s>r)throw new TypeError(`Length ${s} exceeds limit ${r}`);return`${t=t.toLowerCase()}1${qn.encode(n)}${Vn(t,n,e)}`},decode:i,decodeToBytes:function(t){const{prefix:e,words:n}=i(t,!1);return{prefix:e,words:n,bytes:r(n)}},decodeUnsafe:Sn(i),fromWords:r,fromWordsUnsafe:o,toWords:s}}const zn=jn("bech32");jn("bech32m");const Kn={utf8:{encode:t=>(new TextDecoder).decode(t),decode:t=>(new TextEncoder).encode(t)},hex:vn(Ln(4),En("0123456789abcdef"),xn(""),$n(t=>{if("string"!=typeof t||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()})),base16:Cn,base32:Un,base64:Tn,base64url:Nn,base58:Rn,base58xmr:Dn};Object.keys(Kn).join(", ");var Mn=new TextDecoder("utf-8");new TextEncoder;function Zn(t){let e={},n=t;for(;n.length>0;){let t=n[0],r=n[1],s=n.slice(2,2+r);if(n=n.slice(2+r),s.lengthMn.decode(t)):[]}}}case"nevent":{let t=Zn(r);if(!t[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==t[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(t[2]&&32!==t[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(t[3]&&4!==t[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:Ge(t[0][0]),relays:t[1]?t[1].map(t=>Mn.decode(t)):[],author:t[2]?.[0]?Ge(t[2][0]):void 0,kind:t[3]?.[0]?parseInt(Ge(t[3][0]),16):void 0}}}case"naddr":{let t=Zn(r);if(!t[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!t[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==t[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!t[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==t[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:Mn.decode(t[0][0]),pubkey:Ge(t[2][0]),kind:parseInt(Ge(t[3][0]),16),relays:t[1]?t[1].map(t=>Mn.decode(t)):[]}}}case"nsec":return{type:e,data:r};case"npub":case"note":return{type:e,data:Ge(r)};default:throw new Error(`unknown prefix ${e}`)}}(t)}catch{throw new Error("Invalid nsec format")}if("nsec"!==e.type)throw new Error("Please enter an nsec (private key)");const s=e.data,o=wn(s),i={getPublicKey:async()=>o,signEvent:async t=>bn(t,s)};n(6,u="Successfully logged in!"),r("login",{method:"nsec",pubkey:o,privateKey:t,signer:i}),setTimeout(h,500)}catch(t){n(5,c=t.message)}finally{n(4,l=!1)}}return t.$$set=t=>{"showModal"in t&&n(0,s=t.showModal),"isDarkTheme"in t&&n(1,o=t.isDarkTheme)},[s,o,i,a,l,c,u,f,h,g,async function(){n(5,c=""),n(6,u="");try{const t=yn(),e=Wn("nsec",t),r=Gn(wn(t));d=e,n(7,f=r),n(3,a=e),n(6,u="New key generated!")}catch(t){n(5,c="Failed to generate key: "+t.message)}},async function(){n(4,l=!0),n(5,c=""),n(6,u="");try{if(!window.nostr)throw new Error("No Nostr extension found. Please install nos2x or Alby.");const t=await window.nostr.getPublicKey();t&&(n(6,u="Successfully logged in with extension!"),r("login",{method:"extension",pubkey:t,signer:window.nostr}),setTimeout(h,500))}catch(t){n(5,c=t.message)}finally{n(4,l=!1)}},p,function(t){"Escape"===t.key&&h(),"Enter"===t.key&&"nsec"===i&&p()},function(e){_.call(this,t,e)},function(e){_.call(this,t,e)},()=>g("extension"),()=>g("nsec"),function(){a=this.value,n(3,a)},t=>"Escape"===t.key&&h()]}class or extends Q{constructor(t){super(),J(this,t,sr,rr,o,{showModal:0,isDarkTheme:1})}}const ir=[];function ar(e,n=t){let r;const s=new Set;function i(t){if(o(e,t)&&(e=t,r)){const t=!ir.length;for(const t of s)t[1](),ir.push(t,e);if(t){for(let t=0;t{s.delete(c),0===s.size&&r&&(r(),r=null)}}}}const lr=ar(!1),cr=ar(""),ur=ar(null),dr=ar(""),fr=ar(null),hr=ar(null),gr=ar(null),pr=ar(!1),yr=ar("");async function wr(t,e={},n,r){const s=`${window.location.origin}${t}`,o=e.method||"GET",i=await async function(t,e,n,r){if(!t||!e)return null;try{const e={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",r],["method",n.toUpperCase()]],content:""},s=await t.signEvent(e),o=JSON.stringify(s);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_")}catch(t){return console.error("createNIP98Auth error:",t),null}}(n,r,o,s),a={...e.headers};return i&&(a.Authorization=`Nostr ${i}`),fetch(s,{...e,headers:a})}function br(t){let e,n,r,s,o,i=t[0].pid+"";return{c(){e=h("div"),n=h("span"),n.textContent="PID:",r=p(),s=h("span"),o=g(i),b(n,"class","label svelte-xh5u5u"),b(s,"class","value svelte-xh5u5u"),b(e,"class","detail-row svelte-xh5u5u")},m(t,i){u(t,e,i),c(e,n),c(e,r),c(e,s),c(s,o)},p(t,e){1&e&&i!==(i=t[0].pid+"")&&m(o,i)},d(t){t&&d(e)}}}function mr(t){let e,n,r,s,o,i=t[0].restarts+"";return{c(){e=h("div"),n=h("span"),n.textContent="Restarts:",r=p(),s=h("span"),o=g(i),b(n,"class","label svelte-xh5u5u"),b(s,"class","value warning svelte-xh5u5u"),b(e,"class","detail-row svelte-xh5u5u")},m(t,i){u(t,e,i),c(e,n),c(e,r),c(e,s),c(s,o)},p(t,e){1&e&&i!==(i=t[0].restarts+"")&&m(o,i)},d(t){t&&d(e)}}}function vr(e){let n,r,s,o,i,a,l,f,y,w,v,x,k,$,A,B,I,_,L,S,C,U,T=xr(e[0].status)+"",N=e[0].name+"",O=e[0].status+"",R=e[0].binary+"",P=e[0].pid>0&&br(e),D=e[0].restarts>0&&mr(e);return{c(){n=h("div"),r=h("div"),s=h("span"),o=g(T),i=p(),a=h("span"),l=g(N),f=p(),y=h("div"),w=h("div"),v=h("span"),v.textContent="Status:",x=p(),k=h("span"),$=g(O),A=p(),P&&P.c(),B=p(),I=h("div"),_=h("span"),_.textContent="Binary:",L=p(),S=h("span"),C=g(R),U=p(),D&&D.c(),b(s,"class","status-indicator svelte-xh5u5u"),E(s,"color",Er(e[0].status)),b(a,"class","process-name svelte-xh5u5u"),b(r,"class","process-header svelte-xh5u5u"),b(v,"class","label svelte-xh5u5u"),b(k,"class","value svelte-xh5u5u"),E(k,"color",Er(e[0].status)),b(w,"class","detail-row svelte-xh5u5u"),b(_,"class","label svelte-xh5u5u"),b(S,"class","value binary svelte-xh5u5u"),b(I,"class","detail-row svelte-xh5u5u"),b(y,"class","process-details svelte-xh5u5u"),b(n,"class","process-card svelte-xh5u5u")},m(t,e){u(t,n,e),c(n,r),c(r,s),c(s,o),c(r,i),c(r,a),c(a,l),c(n,f),c(n,y),c(y,w),c(w,v),c(w,x),c(w,k),c(k,$),c(y,A),P&&P.m(y,null),c(y,B),c(y,I),c(I,_),c(I,L),c(I,S),c(S,C),c(y,U),D&&D.m(y,null)},p(t,[e]){1&e&&T!==(T=xr(t[0].status)+"")&&m(o,T),1&e&&E(s,"color",Er(t[0].status)),1&e&&N!==(N=t[0].name+"")&&m(l,N),1&e&&O!==(O=t[0].status+"")&&m($,O),1&e&&E(k,"color",Er(t[0].status)),t[0].pid>0?P?P.p(t,e):(P=br(t),P.c(),P.m(y,B)):P&&(P.d(1),P=null),1&e&&R!==(R=t[0].binary+"")&&m(C,R),t[0].restarts>0?D?D.p(t,e):(D=mr(t),D.c(),D.m(y,null)):D&&(D.d(1),D=null)},i:t,o:t,d(t){t&&d(n),P&&P.d(),D&&D.d()}}}function Er(t){switch(t){case"running":return"var(--success)";case"stopped":default:return"var(--muted-color)";case"crashed":return"var(--error)"}}function xr(t){switch(t){case"running":return"●";case"stopped":return"○";case"crashed":return"✗";default:return"?"}}function kr(t,e,n){let{process:r}=e;return t.$$set=t=>{"process"in t&&n(0,r=t.process)},[r]}class $r extends Q{constructor(t){super(),J(this,t,kr,vr,o,{process:0})}}function Ar(t,e,n){const r=t.slice();return r[8]=e[n],r}function Br(t){let e,n;return{c(){e=h("div"),n=g(t[1]),b(e,"class","error-banner svelte-17dya06")},m(t,r){u(t,e,r),c(e,n)},p(t,e){2&e&&m(n,t[1])},d(t){t&&d(e)}}}function Ir(e){let n;return{c(){n=h("div"),n.textContent="Loading status...",b(n,"class","loading svelte-17dya06")},m(t,e){u(t,n,e)},p:t,i:t,o:t,d(t){t&&d(n)}}}function _r(t){let e,n,r,s,o,i,a,l,y,w,v,E,x,k,$,A,B,I,_,L,S,C,U,T=t[2].version+"",N=t[2].uptime+"",O=(t[2].processes?.length||0)+"",R=M(t[2].processes||[]),P=[];for(let e=0;eK(P[t],1,1,()=>{P[t]=null});return{c(){e=h("div"),n=h("div"),r=h("span"),r.textContent="Version",s=p(),o=h("span"),i=g(T),a=p(),l=h("div"),y=h("span"),y.textContent="Uptime",w=p(),v=h("span"),E=g(N),x=p(),k=h("div"),$=h("span"),$.textContent="Processes",A=p(),B=h("span"),I=g(O),_=p(),L=h("h3"),L.textContent="Managed Processes",S=p(),C=h("div");for(let t=0;t{L[r]=null}),j()),~x?(k=L[x],k?k.p(t,n):(k=L[x]=_[x](t),k.c()),z(k,1),k.m(e,null)):k=null)},i(t){$||(z(k),$=!0)},o(t){K(k),$=!1},d(t){t&&d(e),I&&I.d(),~x&&L[x].d(),A=!1,r(B)}}}function Cr(t,e,n){let r,s,o,l,c,u;var d;async function f(){try{a(fr,c=await async function(t,e){const n=await wr("/api/status",{},t,e);if(!n.ok)throw new Error(`Failed to fetch status: ${n.statusText}`);return n.json()}(l,o),c),a(yr,s="",s)}catch(t){a(yr,s=t.message,s)}}return i(t,pr,t=>n(0,r=t)),i(t,yr,t=>n(1,s=t)),i(t,cr,t=>n(6,o=t)),i(t,ur,t=>n(7,l=t)),i(t,fr,t=>n(2,c=t)),B(async()=>{await f(),u=setInterval(f,5e3)}),d=()=>{u&&clearInterval(u)},A().$$.on_destroy.push(d),[r,s,c,f,async function(){if(confirm("Are you sure you want to restart all services?")){a(pr,r=!0,r);try{await async function(t,e){const n=await wr("/api/restart",{method:"POST"},t,e);if(!n.ok)throw new Error(`Restart failed: ${n.statusText}`);return n.json()}(l,o),setTimeout(f,2e3)}catch(t){a(yr,s=t.message,s)}finally{a(pr,r=!1,r)}}}]}class Ur extends Q{constructor(t){super(),J(this,t,Cr,Sr,o,{})}}function Tr(t,e,n){const r=t.slice();return r[6]=e[n],r}function Nr(t){let e,n;return{c(){e=h("div"),n=g(t[1]),b(e,"class","error-banner svelte-1kruta9")},m(t,r){u(t,e,r),c(e,n)},p(t,e){2&e&&m(n,t[1])},d(t){t&&d(e)}}}function Or(e){let n;return{c(){n=h("div"),n.textContent="Loading configuration...",b(n,"class","loading svelte-1kruta9")},m(t,e){u(t,n,e)},p:t,d(t){t&&d(n)}}}function Rr(t){let e,n,r,s,o,i,a,l,y,w,v,E,k,$,A,B,I,_,L,S,C,U,T,N,O,R,P,D,q,H,F,V,j,z,K,Z,G,W,Y,J,Q,X,tt,et,nt,rt,st,ot,it,at,lt,ct,ut,dt,ft,ht,gt,pt,yt,wt,bt,mt,vt,Et,xt,kt,$t,At,Bt,It,_t,Lt,St,Ct,Ut,Tt,Nt,Ot,Rt,Pt,Dt,qt,Ht,Ft,Vt,jt,zt,Kt,Mt,Zt,Gt,Wt,Yt,Jt,Qt,Xt,te,ee,ne,re,se,oe,ie,ae,le,ce,ue,de,fe,he,ge,pe,ye,we,be,me,ve,Ee=t[2].db_backend+"",xe=t[2].db_binary+"",ke=t[2].db_listen+"",$e=t[2].data_dir+"",Ae=t[2].acl_enabled?"Yes":"No",Be=t[2].acl_mode+"",Ie=t[2].acl_binary+"",_e=t[2].acl_listen+"",Le=t[2].relay_binary+"",Se=t[2].log_level+"",Ce=t[2].distributed_sync_enabled?"Enabled":"Disabled",Ue=t[2].cluster_sync_enabled?"Enabled":"Disabled",Te=t[2].relay_group_enabled?"Enabled":"Disabled",Ne=t[2].negentropy_enabled?"Enabled":"Disabled",Oe=t[2].bin_dir+"",Re=M(t[2].admin_owners||[]),Pe=[];for(let e=0;eConfiguration is loaded from environment variables. To change settings, update the environment and restart the launcher.
',b(r,"class","svelte-1kruta9"),b(a,"class","label svelte-1kruta9"),b(y,"class","value svelte-1kruta9"),b(i,"class","config-item svelte-1kruta9"),b(k,"class","label svelte-1kruta9"),b(A,"class","value mono svelte-1kruta9"),b(E,"class","config-item svelte-1kruta9"),b(L,"class","label svelte-1kruta9"),b(C,"class","value mono svelte-1kruta9"),b(_,"class","config-item svelte-1kruta9"),b(O,"class","label svelte-1kruta9"),b(P,"class","value mono svelte-1kruta9"),b(N,"class","config-item svelte-1kruta9"),b(o,"class","config-grid svelte-1kruta9"),b(n,"class","config-section svelte-1kruta9"),b(F,"class","svelte-1kruta9"),b(K,"class","label svelte-1kruta9"),b(G,"class","value bool svelte-1kruta9"),x(G,"enabled",t[2].acl_enabled),b(z,"class","config-item svelte-1kruta9"),b(Q,"class","label svelte-1kruta9"),b(tt,"class","value svelte-1kruta9"),b(J,"class","config-item svelte-1kruta9"),b(st,"class","label svelte-1kruta9"),b(it,"class","value mono svelte-1kruta9"),b(rt,"class","config-item svelte-1kruta9"),b(ut,"class","label svelte-1kruta9"),b(ft,"class","value mono svelte-1kruta9"),b(ct,"class","config-item svelte-1kruta9"),b(j,"class","config-grid svelte-1kruta9"),b(H,"class","config-section svelte-1kruta9"),b(yt,"class","svelte-1kruta9"),b(vt,"class","label svelte-1kruta9"),b(xt,"class","value mono svelte-1kruta9"),b(mt,"class","config-item svelte-1kruta9"),b(Bt,"class","label svelte-1kruta9"),b(_t,"class","value svelte-1kruta9"),b(At,"class","config-item svelte-1kruta9"),b(bt,"class","config-grid svelte-1kruta9"),b(pt,"class","config-section svelte-1kruta9"),b(Ut,"class","svelte-1kruta9"),b(Rt,"class","label svelte-1kruta9"),b(Dt,"class","value bool svelte-1kruta9"),x(Dt,"enabled",t[2].distributed_sync_enabled),b(Ot,"class","config-item svelte-1kruta9"),b(Vt,"class","label svelte-1kruta9"),b(zt,"class","value bool svelte-1kruta9"),x(zt,"enabled",t[2].cluster_sync_enabled),b(Ft,"class","config-item svelte-1kruta9"),b(Gt,"class","label svelte-1kruta9"),b(Yt,"class","value bool svelte-1kruta9"),x(Yt,"enabled",t[2].relay_group_enabled),b(Zt,"class","config-item svelte-1kruta9"),b(te,"class","label svelte-1kruta9"),b(ne,"class","value bool svelte-1kruta9"),x(ne,"enabled",t[2].negentropy_enabled),b(Xt,"class","config-item svelte-1kruta9"),b(Nt,"class","config-grid svelte-1kruta9"),b(Ct,"class","config-section svelte-1kruta9"),b(ie,"class","svelte-1kruta9"),b(ue,"class","label svelte-1kruta9"),b(fe,"class","value mono svelte-1kruta9"),b(ce,"class","config-item svelte-1kruta9"),b(ye,"class","label svelte-1kruta9"),b(be,"class","owners-list svelte-1kruta9"),b(pe,"class","config-item full-width svelte-1kruta9"),b(le,"class","config-grid svelte-1kruta9"),b(oe,"class","config-section svelte-1kruta9"),b(e,"class","config-sections svelte-1kruta9"),b(ve,"class","config-note svelte-1kruta9")},m(t,d){u(t,e,d),c(e,n),c(n,r),c(n,s),c(n,o),c(o,i),c(i,a),c(i,l),c(i,y),c(y,w),c(o,v),c(o,E),c(E,k),c(E,$),c(E,A),c(A,B),c(o,I),c(o,_),c(_,L),c(_,S),c(_,C),c(C,U),c(o,T),c(o,N),c(N,O),c(N,R),c(N,P),c(P,D),c(e,q),c(e,H),c(H,F),c(H,V),c(H,j),c(j,z),c(z,K),c(z,Z),c(z,G),c(G,W),c(j,Y),c(j,J),c(J,Q),c(J,X),c(J,tt),c(tt,et),c(j,nt),c(j,rt),c(rt,st),c(rt,ot),c(rt,it),c(it,at),c(j,lt),c(j,ct),c(ct,ut),c(ct,dt),c(ct,ft),c(ft,ht),c(e,gt),c(e,pt),c(pt,yt),c(pt,wt),c(pt,bt),c(bt,mt),c(mt,vt),c(mt,Et),c(mt,xt),c(xt,kt),c(bt,$t),c(bt,At),c(At,Bt),c(At,It),c(At,_t),c(_t,Lt),c(e,St),c(e,Ct),c(Ct,Ut),c(Ct,Tt),c(Ct,Nt),c(Nt,Ot),c(Ot,Rt),c(Ot,Pt),c(Ot,Dt),c(Dt,qt),c(Nt,Ht),c(Nt,Ft),c(Ft,Vt),c(Ft,jt),c(Ft,zt),c(zt,Kt),c(Nt,Mt),c(Nt,Zt),c(Zt,Gt),c(Zt,Wt),c(Zt,Yt),c(Yt,Jt),c(Nt,Qt),c(Nt,Xt),c(Xt,te),c(Xt,ee),c(Xt,ne),c(ne,re),c(e,se),c(e,oe),c(oe,ie),c(oe,ae),c(oe,le),c(le,ce),c(ce,ue),c(ce,de),c(ce,fe),c(fe,he),c(le,ge),c(le,pe),c(pe,ye),c(pe,we),c(pe,be);for(let t=0;tn(0,r=t)),i(t,yr,t=>n(1,s=t)),i(t,cr,t=>n(4,o=t)),i(t,ur,t=>n(5,l=t)),i(t,hr,t=>n(2,c=t)),B(async()=>{await u()}),[r,s,c,u]}class Fr extends Q{constructor(t){super(),J(this,t,Hr,qr,o,{})}}function Vr(t,e,n){const r=t.slice();return r[15]=e[n],r}function jr(t,e,n){const r=t.slice();return r[18]=e[n],r[19]=e,r[20]=n,r}function zr(t){let e,n;return{c(){e=h("div"),n=g(t[4]),b(e,"class","error-banner svelte-1ig49gt")},m(t,r){u(t,e,r),c(e,n)},p(t,e){16&e&&m(n,t[4])},d(t){t&&d(e)}}}function Kr(t){let e,n,r,s=t[2].message+"",o=t[2].downloaded_files?.length&&Mr(t);return{c(){e=h("div"),n=g(s),r=p(),o&&o.c(),b(e,"class","success-banner svelte-1ig49gt")},m(t,s){u(t,e,s),c(e,n),c(e,r),o&&o.m(e,null)},p(t,r){4&r&&s!==(s=t[2].message+"")&&m(n,s),t[2].downloaded_files?.length?o?o.p(t,r):(o=Mr(t),o.c(),o.m(e,null)):o&&(o.d(1),o=null)},d(t){t&&d(e),o&&o.d()}}}function Mr(t){let e,n,r,s=t[2].downloaded_files.join(", ")+"";return{c(){e=h("br"),n=g("Downloaded: "),r=g(s)},m(t,s){u(t,e,s),u(t,n,s),u(t,r,s)},p(t,e){4&e&&s!==(s=t[2].downloaded_files.join(", ")+"")&&m(r,s)},d(t){t&&(d(e),d(n),d(r))}}}function Zr(t){let e,n,r,s,o,i,a,l,f=t[18]+"";function w(){t[10].call(o,t[18])}return{c(){e=h("div"),n=h("span"),r=g(f),s=p(),o=h("input"),i=p(),b(n,"class","binary-name svelte-1ig49gt"),b(o,"type","text"),b(o,"placeholder","https://..."),o.disabled=t[3],b(o,"class","svelte-1ig49gt"),b(e,"class","url-input svelte-1ig49gt")},m(d,f){u(d,e,f),c(e,n),c(n,r),c(e,s),c(e,o),v(o,t[1][t[18]]),c(e,i),a||(l=y(o,"input",w),a=!0)},p(e,n){t=e,2&n&&f!==(f=t[18]+"")&&m(r,f),8&n&&(o.disabled=t[3]),2&n&&o.value!==t[1][t[18]]&&v(o,t[1][t[18]])},d(t){t&&d(e),a=!1,l()}}}function Gr(t){let e,n,r,s,o,i,a,l=M(t[5].available_versions),g=[];for(let e=0;eVersion | Installed | Binaries | Status | ',i=p(),a=h("tbody");for(let t=0;tUpdate Binaries',o=p(),tt&&tt.c(),i=p(),et&&et.c(),a=p(),l=h("div"),w=h("h3"),w.textContent="Current Version",E=p(),x=h("div"),k=h("span"),$=g(Q),A=p(),B=h("button"),I=g("Rollback"),L=p(),S=h("div"),C=h("h3"),C.textContent="Install New Version",U=p(),T=h("div"),N=h("label"),N.textContent="Version",O=p(),R=h("input"),P=p(),D=h("div"),q=h("div"),H=h("label"),H.textContent="Binary URLs",F=p(),V=h("button"),j=g("Fill from Release"),z=p();for(let t=0;tn(4,r=t)),i(t,cr,t=>n(11,s=t)),i(t,ur,t=>n(12,o=t)),i(t,pr,t=>n(13,l=t)),i(t,gr,t=>n(5,c=t));let u="",d={orly:"","orly-db-badger":"","orly-acl-follows":"","orly-launcher":""},f=null,h=!1;async function g(){a(pr,l=!0,l);try{a(gr,c=await async function(t,e){const n=await wr("/api/binaries",{},t,e);if(!n.ok)throw new Error(`Failed to fetch binaries: ${n.statusText}`);return n.json()}(o,s),c),a(yr,r="",r)}catch(t){a(yr,r=t.message,r)}finally{a(pr,l=!1,l)}}return B(async()=>{await g()}),[u,d,f,h,r,c,async function(){const t={};for(const[e,n]of Object.entries(d))n.trim()&&(t[e]=n.trim());if(u.trim())if(0!==Object.keys(t).length){n(3,h=!0),n(2,f=null),a(yr,r="",r);try{n(2,f=await async function(t,e,n,r){const s=await wr("/api/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({version:n,urls:r})},t,e);if(!s.ok){const t=await s.json();throw new Error(t.message||`Update failed: ${s.statusText}`)}return s.json()}(o,s,u.trim(),t)),await g()}catch(t){a(yr,r=t.message,r)}finally{n(3,h=!1)}}else a(yr,r="At least one binary URL is required",r);else a(yr,r="Version is required",r)},async function(){if(confirm("Are you sure you want to rollback to the previous version?")){n(3,h=!0),a(yr,r="",r);try{const t=await async function(t,e){const n=await wr("/api/rollback",{method:"POST"},t,e);if(!n.ok){const t=await n.json();throw new Error(t.message||`Rollback failed: ${n.statusText}`)}return n.json()}(o,s);n(2,f={success:!0,message:`Rolled back from ${t.previous_version} to ${t.current_version}. Restart services to apply.`}),await g()}catch(t){a(yr,r=t.message,r)}finally{n(3,h=!1)}}},function(){const t=prompt("Enter release base URL (e.g., https://git.mleku.dev/mleku/next.orly.dev/releases/download/v0.55.11):");if(!t)return;const e=t.replace(/\/$/,""),r=prompt("Enter architecture (amd64 or arm64):","amd64");if(!r)return;const s=u.trim()||t.split("/").pop();n(1,d.orly=`${e}/orly-${s.replace("v","")}-linux-${r}`,d),n(1,d["orly-db-badger"]=`${e}/orly-db-badger-${s.replace("v","")}-linux-${r}`,d),n(1,d["orly-acl-follows"]=`${e}/orly-acl-follows-${s.replace("v","")}-linux-${r}`,d),n(1,d["orly-launcher"]=`${e}/orly-launcher-${s.replace("v","")}-linux-${r}`,d),u.trim()||n(0,u=s)},function(){u=this.value,n(0,u)},function(t){d[t]=this.value,n(1,d)}]}class Xr extends Q{constructor(t){super(),J(this,t,Qr,Jr,o,{})}}function ts(e){let n,r;return n=new Xr({}),{c(){Z(n.$$.fragment)},m(t,e){G(n,t,e),r=!0},p:t,i(t){r||(z(n.$$.fragment,t),r=!0)},o(t){K(n.$$.fragment,t),r=!1},d(t){W(n,t)}}}function es(e){let n,r;return n=new Fr({}),{c(){Z(n.$$.fragment)},m(t,e){G(n,t,e),r=!0},p:t,i(t){r||(z(n.$$.fragment,t),r=!0)},o(t){K(n.$$.fragment,t),r=!1},d(t){W(n,t)}}}function ns(e){let n,r;return n=new Ur({}),{c(){Z(n.$$.fragment)},m(t,e){G(n,t,e),r=!0},p:t,i(t){r||(z(n.$$.fragment,t),r=!0)},o(t){K(n.$$.fragment,t),r=!1},d(t){W(n,t)}}}function rs(e){let n,r,s,o,i,a,l,f;return{c(){n=h("div"),r=h("h2"),r.textContent="ORLY Launcher Admin",s=p(),o=h("p"),o.textContent="Please login to manage the relay services.",i=p(),a=h("button"),a.textContent="Login with Nostr",b(r,"class","svelte-4k9oqz"),b(o,"class","svelte-4k9oqz"),b(a,"class","login-btn svelte-4k9oqz"),b(n,"class","login-prompt svelte-4k9oqz")},m(t,d){u(t,n,d),c(n,r),c(n,s),c(n,o),c(n,i),c(n,a),l||(f=y(a,"click",e[10]),l=!0)},p:t,i:t,o:t,d(t){t&&d(n),l=!1,f()}}}function ss(t){let e,n,r,s,o,i,a,l,f,g;n=new st({props:{currentPage:t[0],isLoggedIn:t[4],userPubkey:t[3]}}),n.$on("navigate",t[8]),n.$on("login",t[9]),n.$on("logout",t[6]);const y=[rs,ns,es,ts],w=[];function m(t,e){return t[4]?"dashboard"===t[0]?1:"config"===t[0]?2:"update"===t[0]?3:-1:0}function v(e){t[11](e)}~(o=m(t))&&(i=w[o]=y[o](t));let E={isDarkTheme:t[2]};return void 0!==t[1]&&(E.showModal=t[1]),l=new or({props:E}),S.push(()=>function(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}(l,"showModal",v)),l.$on("login",t[5]),l.$on("close",t[12]),{c(){e=h("main"),Z(n.$$.fragment),r=p(),s=h("div"),i&&i.c(),a=p(),Z(l.$$.fragment),b(s,"class","content svelte-4k9oqz"),b(e,"class","svelte-4k9oqz"),x(e,"dark-theme",t[2])},m(t,i){u(t,e,i),G(n,e,null),c(e,r),c(e,s),~o&&w[o].m(s,null),c(e,a),G(l,e,null),g=!0},p(t,[r]){const a={};1&r&&(a.currentPage=t[0]),16&r&&(a.isLoggedIn=t[4]),8&r&&(a.userPubkey=t[3]),n.$set(a);let c=o;o=m(t),o===c?~o&&w[o].p(t,r):(i&&(V(),K(w[c],1,1,()=>{w[c]=null}),j()),~o?(i=w[o],i?i.p(t,r):(i=w[o]=y[o](t),i.c()),z(i,1),i.m(s,null)):i=null);const u={};var d;4&r&&(u.isDarkTheme=t[2]),!f&&2&r&&(f=!0,u.showModal=t[1],d=()=>f=!1,U.push(d)),l.$set(u),(!g||4&r)&&x(e,"dark-theme",t[2])},i(t){g||(z(n.$$.fragment,t),z(i),z(l.$$.fragment,t),g=!0)},o(t){K(n.$$.fragment,t),K(i),K(l.$$.fragment,t),g=!1},d(t){t&&d(e),W(n),~o&&w[o].d(),W(l)}}}function os(t,e,n){let r,s,o,l;i(t,dr,t=>n(13,r=t)),i(t,ur,t=>n(14,s=t)),i(t,cr,t=>n(3,o=t)),i(t,lr,t=>n(4,l=t));let c="dashboard",u=!1,d=!1;function f(t){n(0,c=t)}B(()=>{const t=localStorage.getItem("launcher_auth_method"),e=localStorage.getItem("launcher_pubkey");"extension"===t&&e&&window.nostr&&window.nostr.getPublicKey().then(t=>{t===e&&(a(lr,l=!0,l),a(cr,o=t,o),a(ur,s=window.nostr,s),a(dr,r="extension",r))}).catch(()=>{localStorage.removeItem("launcher_auth_method"),localStorage.removeItem("launcher_pubkey")}),n(2,d=window.matchMedia("(prefers-color-scheme: dark)").matches)});return[c,u,d,o,l,function(t){const{method:e,pubkey:i,signer:c,privateKey:d}=t.detail;a(lr,l=!0,l),a(cr,o=i,o),a(ur,s=c,s),a(dr,r=e,r),localStorage.setItem("launcher_auth_method",e),localStorage.setItem("launcher_pubkey",i),n(1,u=!1)},function(){a(lr,l=!1,l),a(cr,o="",o),a(ur,s=null,s),a(dr,r="",r),localStorage.removeItem("launcher_auth_method"),localStorage.removeItem("launcher_pubkey"),localStorage.removeItem("launcher_privkey_encrypted")},f,t=>f(t.detail),()=>n(1,u=!0),()=>n(1,u=!0),function(t){u=t,n(1,u)},()=>n(1,u=!1)]}return new class extends Q{constructor(t){super(),J(this,t,os,ss,o,{})}}({target:document.body})}();