import"../chunks/Bzak7iHL.js";import{o as Me}from"../chunks/DUC-ssvh.js";import{p as Ke,d as o,f as Le,t as L,a as Te,h as d,g as t,e as s,r as a,s as R,u as H,G as qe}from"../chunks/BBD-8XME.js";import{d as Fe,a as g,s as v}from"../chunks/DNn3Nckx.js";import{i as de}from"../chunks/RaRNNC-y.js";import{e as V,i as W}from"../chunks/C5a--lgk.js";import{a as _,f as y}from"../chunks/CKcqngaU.js";import{s as Se}from"../chunks/DZuEJlJ5.js";import{s as O,r as Ae}from"../chunks/BVZqxpRe.js";import{s as Q}from"../chunks/CBWLjDtu.js";import{b as Ne}from"../chunks/BxfT1SOA.js";import{b as De}from"../chunks/DtXypsxD.js";import{s as Ge,a as T}from"../chunks/BexJutgU.js";import{s as Ie,g as ce}from"../chunks/cIQD_rb4.js";import{b as u}from"../chunks/BeSd-T80.js";import{w as pe,a as je,i as ze,m as Re}from"../chunks/CruZBLYW.js";const He=()=>{const x=Ie;return{page:{subscribe:x.page.subscribe},navigating:{subscribe:x.navigating.subscribe},updated:x.updated}},Ve={subscribe(x){return He().page.subscribe(x)}};var We=y(' '),Oe=y(' '),Qe=y(''),Be=y('
No matches
'),Je=y('
esc
'),Ue=y('
',1);function vt(x,q){Ke(q,!0);const B=()=>T(Ve,"$page",$),J=()=>T(ze,"$isConnected",$),ve=()=>T(Re,"$memoryCount",$),me=()=>T(je,"$avgRetention",$),[$,fe]=Ge();let c=R(!1),f=R(""),w=R(void 0);Me(()=>{pe.connect();function r(e){if((e.metaKey||e.ctrlKey)&&e.key==="k"){e.preventDefault(),d(c,!t(c)),d(f,""),t(c)&&requestAnimationFrame(()=>{var n;return(n=t(w))==null?void 0:n.focus()});return}if(e.key==="Escape"&&t(c)){d(c,!1);return}if(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement)return;if(e.key==="/"){e.preventDefault();const n=document.querySelector('input[type="text"]');n==null||n.focus();return}const i={g:"/graph",m:"/memories",t:"/timeline",f:"/feed",e:"/explore",i:"/intentions",s:"/stats"}[e.key.toLowerCase()];i&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),ce(`${u}${i}`))}return window.addEventListener("keydown",r),()=>{pe.disconnect(),window.removeEventListener("keydown",r)}});const C=[{href:"/graph",label:"Graph",icon:"◎",shortcut:"G"},{href:"/memories",label:"Memories",icon:"◈",shortcut:"M"},{href:"/timeline",label:"Timeline",icon:"◷",shortcut:"T"},{href:"/feed",label:"Feed",icon:"◉",shortcut:"F"},{href:"/explore",label:"Explore",icon:"◬",shortcut:"E"},{href:"/intentions",label:"Intentions",icon:"◇",shortcut:"I"},{href:"/stats",label:"Stats",icon:"◫",shortcut:"S"},{href:"/settings",label:"Settings",icon:"⚙",shortcut:","}],xe=C.slice(0,5);function U(r,e){const p=e.startsWith(u)?e.slice(u.length)||"/":e;return r==="/graph"?p==="/"||p==="/graph":p.startsWith(r)}let E=H(()=>t(f)?C.filter(r=>r.label.toLowerCase().includes(t(f).toLowerCase())):C);function X(r){d(c,!1),d(f,""),ce(`${u}${r}`)}var Y=Ue(),F=o(Le(Y),6),S=s(F),Z=s(S),A=o(Z,2);V(A,21,()=>C,W,(r,e)=>{const p=H(()=>U(t(e).href,B().url.pathname));var i=We(),n=s(i),b=s(n,!0);a(n);var m=o(n,2),k=s(m,!0);a(m);var M=o(m,2),l=s(M,!0);a(M),a(i),L(()=>{O(i,"href",`${u??""}${t(e).href??""}`),Q(i,1,`flex items-center gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 text-sm ${t(p)?"bg-synapse/15 text-synapse-glow border border-synapse/30 shadow-[0_0_12px_rgba(99,102,241,0.15)] nav-active-border":"text-dim hover:text-text hover:bg-white/[0.03] border border-transparent"}`),v(b,t(e).icon),v(k,t(e).label),v(l,t(e).shortcut)}),_(r,i)}),a(A);var N=o(A,2),ue=s(N);a(N);var P=o(N,2),D=s(P),ee=s(D),te=o(ee,2),be=s(te,!0);a(te),a(D);var ae=o(D,2),G=s(ae),he=s(G);a(G);var se=o(G,2),ge=s(se);a(se),a(ae),a(P),a(S);var I=o(S,2),re=s(I),_e=s(re);Se(_e,()=>q.children),a(re),a(I);var ne=o(I,2),oe=s(ne),ie=s(oe);V(ie,17,()=>xe,W,(r,e)=>{const p=H(()=>U(t(e).href,B().url.pathname));var i=Oe(),n=s(i),b=s(n,!0);a(n);var m=o(n,2),k=s(m,!0);a(m),a(i),L(()=>{O(i,"href",`${u??""}${t(e).href??""}`),Q(i,1,`flex flex-col items-center gap-0.5 px-3 py-2 rounded-lg transition-all min-w-[3.5rem] ${t(p)?"text-synapse-glow":"text-muted"}`),v(b,t(e).icon),v(k,t(e).label)}),_(r,i)});var ye=o(ie,2);a(oe),a(ne),a(F);var we=o(F,2);{var ke=r=>{var e=Je(),p=s(e),i=s(p),n=o(s(i),2);Ae(n),De(n,l=>d(w,l),()=>t(w)),qe(2),a(i);var b=o(i,2),m=s(b);V(m,17,()=>t(E),W,(l,h)=>{var K=Qe(),j=s(K),$e=s(j,!0);a(j);var z=o(j,2),Ce=s(z,!0);a(z);var le=o(z,2),Ee=s(le,!0);a(le),a(K),L(()=>{v($e,t(h).icon),v(Ce,t(h).label),v(Ee,t(h).shortcut)}),g("click",K,()=>X(t(h).href)),_(l,K)});var k=o(m,2);{var M=l=>{var h=Be();_(l,h)};de(k,l=>{t(E).length===0&&l(M)})}a(b),a(p),a(e),g("keydown",e,l=>{l.key==="Escape"&&d(c,!1)}),g("click",e,l=>{l.target===l.currentTarget&&d(c,!1)}),g("keydown",n,l=>{l.key==="Enter"&&t(E).length>0&&X(t(E)[0].href)}),Ne(n,()=>t(f),l=>d(f,l)),_(r,e)};de(we,r=>{t(c)&&r(ke)})}L(r=>{O(Z,"href",`${u??""}/graph`),Q(ee,1,`w-2 h-2 rounded-full ${J()?"bg-recall animate-pulse-glow":"bg-decay"}`),v(be,J()?"Connected":"Offline"),v(he,`${ve()??""} memories`),v(ge,`${r??""}% retention`)},[()=>(me()*100).toFixed(0)]),g("click",ue,()=>{d(c,!0),d(f,""),requestAnimationFrame(()=>{var r;return(r=t(w))==null?void 0:r.focus()})}),g("click",ye,()=>{d(c,!0),d(f,""),requestAnimationFrame(()=>{var r;return(r=t(w))==null?void 0:r.focus()})}),_(x,Y),Te(),fe()}Fe(["click","keydown"]);export{vt as component};