pagedex 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -9
- package/bin/pagedex.js +73 -5
- package/dist/assets/index-A_l6j1w5.css +1 -0
- package/dist/assets/index-vKzhpzX9.js +185 -0
- package/dist/index.html +3 -2
- package/docs/MCP.md +107 -0
- package/docs/README.md +2 -1
- package/docs/getting-started.md +6 -0
- package/docs/images/desktop-edit.png +0 -0
- package/docs/images/desktop-preview.png +0 -0
- package/docs/images/desktop-switcher.png +0 -0
- package/docs/images/mobile-preview.png +0 -0
- package/docs/mcp-and-api.md +7 -6
- package/package.json +4 -1
- package/src/server/index.js +4 -0
- package/src/server/mcp.js +423 -65
- package/dist/assets/TiptapEditor-OFHNcjy3.js +0 -1
- package/dist/assets/index-BXGU3AiE.css +0 -1
- package/dist/assets/index-ZVjt99Mq.js +0 -6
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{color-scheme:dark;--bg: #111216;--bg-alt: #181a20;--bg-hover: rgba(255, 255, 255, .06);--border: rgba(255, 255, 255, .09);--text: #eceef2;--muted: #9499a6;--accent: #8b5cf6;--accent-hover: #7c3aed;--accent-soft: rgba(139, 92, 246, .16);--green: #4ade80;--amber: #fbbf24;--code-bg: #16181f;--glass: rgba(24, 26, 32, .88);--font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace}[data-theme=light]{color-scheme:light;--bg: #ffffff;--bg-alt: #f7f7f9;--bg-hover: rgba(0, 0, 0, .05);--border: rgba(0, 0, 0, .09);--text: #18181b;--muted: #6b7280;--accent: #6d28d9;--accent-hover: #5b21b6;--accent-soft: rgba(109, 40, 217, .1);--green: #16a34a;--amber: #d97706;--code-bg: #f3f4f6;--glass: rgba(247, 247, 249, .9)}*{box-sizing:border-box}html,body,#root{margin:0;height:100%;background:var(--bg);color:var(--text);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;overscroll-behavior-x:none;overflow-x:hidden}.app{display:grid;grid-template-columns:270px 1fr;height:100vh}.sidebar,.rightbar{background:var(--bg-alt);border-right:1px solid var(--border);display:flex;flex-direction:column;min-height:0}.workspace-body{flex:1;display:flex;min-height:0;min-width:0}.workspace-body.outline-right,.workspace-body.outline-hidden{flex-direction:row}.workspace-body.outline-bottom{flex-direction:column}.note-pane{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0}.workspace-body.outline-bottom .note-pane{flex:7 1 0%}.rightbar{border-right:0;border-left:1px solid var(--border);padding:0;width:240px;flex-shrink:0;overflow:hidden}.workspace-body.outline-bottom .rightbar{flex:3 1 0%;width:100%;max-height:none;min-height:0;border-left:0;border-top:1px solid var(--border)}.rightbar-head{height:44px;padding:0 12px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:8px;flex-shrink:0}.rightbar-body{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:18px}.workspace-body.outline-bottom .rightbar-body{display:grid;grid-template-columns:1fr 1fr;gap:16px;padding:10px 20px 14px}.rightbar-sec{min-width:0}.panel-subtitle{display:none}.workspace-body.outline-bottom .panel-subtitle{display:block;font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);margin:2px 0 4px}.backlinks-title{margin-top:0}.workspace-body.outline-bottom .backlinks-title{font-size:10.5px;margin:2px 0 4px}.brand{height:44px;padding:0 12px 0 14px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:8px;flex-shrink:0}.brand-title{font-weight:700;font-size:14px;display:flex;align-items:center;gap:8px}.brand-logo{display:block;flex-shrink:0;border-radius:5px}.pill{font-size:11px;padding:2px 7px;border-radius:999px;background:var(--accent-soft);color:var(--green);font-weight:600}.pill.off{color:var(--amber)}.sidebar-tabs{display:grid;grid-template-columns:1fr 1fr;gap:2px;margin:10px 12px 0;padding:3px;border-radius:8px;background:var(--bg);border:1px solid var(--border)}.sidebar-tab{background:transparent;border:0;color:var(--muted);font-size:12px;font-weight:600;padding:5px 8px;border-radius:6px;cursor:pointer;font-family:inherit;display:flex;align-items:center;justify-content:center;gap:6px}.sidebar-tab:hover{color:var(--text)}.sidebar-tab.active{background:var(--bg-alt);color:var(--text);box-shadow:0 1px 2px #00000040}.search-wrap{padding:8px 12px 10px;border-bottom:1px solid var(--border)}.search{width:100%;padding:7px 10px;border-radius:6px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:13px;outline:none}.search:focus{border-color:var(--accent)}.git-badge{font-size:10.5px;font-weight:700;min-width:18px;text-align:center;padding:1px 5px;border-radius:4px;font-family:var(--font-mono);flex-shrink:0}.git-M{color:var(--amber);background:#fbbf2424}.git-U,.git-A{color:var(--green);background:#4ade8024}.git-D{color:#f87171;background:#f8717124}.changes-bar{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:6px 8px 8px;border-bottom:1px solid var(--border);margin-bottom:6px}.changes-select{background:var(--bg);border:1px solid var(--border);color:var(--text);border-radius:6px;padding:4px 8px;font-size:12px;outline:none}.commit-files{max-height:220px;overflow-y:auto;border:1px solid var(--border);border-radius:8px;background:var(--bg);padding:6px;margin-bottom:12px}.commit-file-row{display:flex;align-items:center;gap:8px;padding:5px 6px;font-size:12.5px;cursor:pointer;border-radius:6px}.commit-file-row:hover{background:var(--bg-hover)}.git-output{background:var(--code-bg);border:1px solid var(--border);border-radius:8px;padding:10px;font-family:var(--font-mono);font-size:11.5px;white-space:pre-wrap;max-height:140px;overflow-y:auto;margin-top:8px}.diff-wrap{margin:0 auto}.diff-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;flex-wrap:wrap}.diff-hunk{border:1px solid var(--border);border-radius:10px;overflow:hidden;margin-bottom:14px;background:var(--code-bg)}.diff-hunk-bar{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 10px;background:var(--bg-alt);border-bottom:1px solid var(--border);font-family:var(--font-mono);font-size:11.5px;color:var(--muted)}.diff-line{display:grid;grid-template-columns:36px 20px 1fr 28px;align-items:start;font-family:var(--font-mono);font-size:12.5px;line-height:1.5;padding:1px 6px}.diff-line.add{background:#4ade801f}.diff-line.del{background:#f8717121}.diff-ln{color:var(--muted);font-size:11px;-webkit-user-select:none;user-select:none;text-align:right;padding-right:8px}.diff-sig{-webkit-user-select:none;user-select:none;font-weight:700}.diff-line.add .diff-sig{color:var(--green)}.diff-line.del .diff-sig{color:#f87171}.diff-txt{white-space:pre-wrap;word-break:break-word}.diff-discard-btn{background:none;border:0;color:var(--muted);cursor:pointer;font-size:13px;padding:0 4px;border-radius:4px;line-height:1.4}.diff-discard-btn:hover{color:#f87171;background:#f8717129}.tree{flex:1;overflow-y:auto;padding:8px;font-size:13px}.tree-dir-btn,.tree-file{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:5px 8px;border-radius:5px;cursor:pointer;display:flex;align-items:center;gap:6px;font-size:13px;font-family:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.tree-dir-btn{color:var(--muted);font-weight:600}.tree-dir-btn:hover,.tree-file-row:hover{background:var(--bg-hover)}.tree-file-row{display:flex;align-items:center;border-radius:5px;gap:2px}.tree-file-row.active{background:var(--accent-soft)}.tree-file-row .tree-file,.tree-file-row .tree-dir-btn{flex:1;min-width:0}.tree-file-row .tree-file:hover,.tree-file-row .tree-dir-btn:hover{background:none}.tree-file.active{background:none;color:var(--accent);font-weight:600}.tree-row-more{background:none;border:0;color:var(--muted);cursor:pointer;padding:4px 6px;border-radius:4px;font-size:13px;line-height:1;opacity:0;flex-shrink:0}.tree-file-row:hover .tree-row-more,.tree-file-row.active .tree-row-more{opacity:1}.tree-row-more:hover{color:var(--text);background:var(--bg-hover)}@media(hover:none),(max-width:768px){.tree-row-more{opacity:.75}}.file-ctx-menu{position:fixed;z-index:60;background:var(--glass);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border);border-radius:10px;padding:5px;min-width:170px;display:flex;flex-direction:column;gap:2px;box-shadow:0 12px 32px #00000080}.tree-children{padding-left:14px}.main{display:flex;flex-direction:column;min-width:0;min-height:0}.topbar{height:44px;padding:0 14px 0 18px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0}.topbar-left{display:flex;align-items:center;gap:8px;min-width:0}.crumbs{font-family:var(--font-mono);font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.actions{display:flex;gap:6px;align-items:center;position:relative}.icon-btn{width:30px;height:30px;padding:0;border-radius:7px;border:0;background:transparent;color:var(--muted);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .12s,color .12s}.icon-btn:hover,.icon-btn:active{background:var(--bg-hover);color:var(--text)}.icon-btn.active{color:var(--accent);background:var(--accent-soft)}@media(max-width:960px){.outline-toggle-btn.active{color:var(--muted);background:transparent}}.more-menu{position:absolute;top:calc(100% + 6px);right:0;z-index:35;background:var(--glass);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border);border-radius:12px;padding:5px;min-width:155px;display:flex;flex-direction:column;gap:2px;box-shadow:0 12px 32px #00000073}.more-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:8px 10px;border-radius:8px;font-size:13px;cursor:pointer;font-family:inherit;display:flex;align-items:center;justify-content:space-between}.more-item:hover{background:var(--bg-hover)}.more-item.active{color:var(--accent);font-weight:600}.outline-menu-trigger{display:none}.outline-menu-trigger.show-desktop{display:flex}.tiptap-wrap{margin:0 auto}.tiptap-toolbar{display:flex;gap:4px;align-items:center;overflow-x:auto;padding:6px 8px;margin-bottom:16px;background:var(--glass);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border);border-radius:12px;position:sticky;top:0;z-index:5}.tiptap-toolbar .btn{border-color:transparent;background:transparent;padding:5px 9px;border-radius:7px}.tiptap-toolbar .btn:hover{background:var(--bg-hover)}.tiptap-toolbar .btn.active{background:var(--accent-soft);color:var(--accent)}.tiptap-toolbar .btn.primary{background:var(--accent);color:#fff;padding:5px 12px;border-radius:8px}.tiptap-body .ProseMirror{outline:none;min-height:55vh;overflow-wrap:anywhere;word-break:break-word}.tiptap-body .ProseMirror>:first-child{margin-top:0}.btn{background:var(--bg-alt);border:1px solid var(--border);color:var(--text);border-radius:8px;padding:5px 11px;font-size:12.5px;font-weight:500;cursor:pointer;white-space:nowrap;flex-shrink:0;transition:background .12s,border-color .12s}.btn:hover{background:var(--bg-hover)}.btn.active{border-color:var(--accent);color:var(--accent);background:var(--accent-soft)}.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}.btn.primary:hover{background:var(--accent-hover);border-color:var(--accent-hover)}.menu-btn{display:none;gap:5px}.backdrop{display:none}.content-scroll{flex:1;overflow-y:auto;overflow-x:hidden;min-width:0;padding:28px 36px 80px}.doc{max-width:780px;width:100%;margin:0 auto;line-height:1.65;font-size:15px;overflow-wrap:anywhere;word-break:break-word}.doc h1,.doc h2,.doc h3,.doc h4{margin-top:1.5em;margin-bottom:.5em;line-height:1.25}.doc h1{font-size:1.85em;border-bottom:1px solid var(--border);padding-bottom:.3em;margin-top:0}.doc h2{font-size:1.35em}.doc h3{font-size:1.12em}.doc p{margin:.8em 0}.doc a,.wikilink{color:var(--accent);text-decoration:none;cursor:pointer}.doc a:hover,.wikilink:hover{text-decoration:underline}.wikilink.broken{color:var(--amber);border-bottom:1px dashed var(--amber)}.doc code{font-family:var(--font-mono);font-size:.88em;background:var(--code-bg);padding:2px 5px;border-radius:4px;overflow-wrap:anywhere}.doc pre{background:var(--code-bg);border:1px solid var(--border);padding:14px 16px;border-radius:8px;max-width:100%;overflow-x:auto;font-size:13px;line-height:1.5}.doc pre code{background:none;padding:0}.doc blockquote{margin:1em 0;padding:8px 14px;border-left:3px solid var(--accent);background:var(--accent-soft);border-radius:0 6px 6px 0}.doc blockquote p{margin:.3em 0}.doc ul,.doc ol{padding-left:1.5em}.doc li{margin:.3em 0}.doc hr{border:0;border-top:1px solid var(--border);margin:1.8em 0}.doc table{display:block;max-width:100%;overflow-x:auto;border-collapse:collapse;margin:1em 0;font-size:14px}.doc th,.doc td{border:1px solid var(--border);padding:7px 10px;text-align:left}.doc th{background:var(--bg-alt)}.doc img{max-width:100%;height:auto;border-radius:8px;border:1px solid var(--border)}.raw-view{max-width:860px;width:100%;margin:0 auto;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font-family:var(--font-mono);font-size:13px;line-height:1.55;background:var(--code-bg);border:1px solid var(--border);padding:18px;border-radius:8px}.hljs{color:var(--text);background:transparent}.hljs-comment,.hljs-quote{color:#7f849c;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst,.hljs-section{color:#c084fc}.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable,.hljs-tag .hljs-attr{color:#f59e0b}.hljs-string,.hljs-doctag,.hljs-regexp{color:#4ade80}.hljs-title,.hljs-title.function_,.hljs-title.class_{color:#60a5fa}.hljs-type,.hljs-built_in,.hljs-class .hljs-title{color:#38bdf8}.hljs-attr,.hljs-attribute,.hljs-symbol,.hljs-bullet,.hljs-link{color:#f472b6}.hljs-addition{color:#4ade80;background:#4ade801f}.hljs-deletion{color:#f87171;background:#f871711f}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}[data-theme=light] .hljs-comment,[data-theme=light] .hljs-quote{color:#6b7280}[data-theme=light] .hljs-keyword,[data-theme=light] .hljs-selector-tag,[data-theme=light] .hljs-subst,[data-theme=light] .hljs-section{color:#7c3aed}[data-theme=light] .hljs-number,[data-theme=light] .hljs-literal,[data-theme=light] .hljs-variable,[data-theme=light] .hljs-template-variable,[data-theme=light] .hljs-tag .hljs-attr{color:#b45309}[data-theme=light] .hljs-string,[data-theme=light] .hljs-doctag,[data-theme=light] .hljs-regexp{color:#15803d}[data-theme=light] .hljs-title,[data-theme=light] .hljs-title.function_,[data-theme=light] .hljs-title.class_{color:#2563eb}[data-theme=light] .hljs-type,[data-theme=light] .hljs-built_in,[data-theme=light] .hljs-class .hljs-title{color:#0369a1}[data-theme=light] .hljs-attr,[data-theme=light] .hljs-attribute,[data-theme=light] .hljs-symbol,[data-theme=light] .hljs-bullet,[data-theme=light] .hljs-link{color:#be185d}.img-wrap{text-align:center}.img-wrap img{max-width:100%;max-height:80vh}.binary-card{max-width:460px;margin:40px auto;padding:28px 24px;border:1px solid var(--border);border-radius:12px;background:var(--bg-alt);text-align:center}.binary-card-name{font-size:16px;font-weight:700;margin-bottom:6px}.binary-card-path{font-size:12.5px;color:var(--muted);font-family:var(--font-mono);margin-bottom:18px}.panel-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin:8px 0}.toc-item,.backlink-item{display:block;padding:4px 6px;border-radius:4px;font-size:12.5px;color:var(--text);text-decoration:none;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.toc-item:hover,.backlink-item:hover{background:var(--bg-hover);color:var(--accent)}.toc-h2{padding-left:14px;color:var(--muted)}.toc-h3{padding-left:24px;color:var(--muted);font-size:12px}.empty-note{font-size:12px;color:var(--muted);padding:4px 6px}.fab-wrap{position:fixed;right:18px;bottom:18px;z-index:25;display:flex;flex-direction:column;align-items:flex-end;gap:8px}.fab-btn{width:48px;height:48px;border-radius:999px;border:0;background:var(--accent);color:#fff;font-size:20px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 6px 20px #00000059}.fab-menu{background:var(--bg-alt);border:1px solid var(--border);border-radius:10px;padding:6px;min-width:170px;display:flex;flex-direction:column;gap:2px;box-shadow:0 10px 28px #0006}.fab-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:8px 10px;border-radius:6px;font-size:13px;cursor:pointer;display:flex;align-items:center;gap:8px;font-family:inherit}.fab-item:hover{background:var(--bg-hover);color:var(--accent)}.mobile-bar,.sheet-backdrop,.bottom-sheet{display:none}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#000000a6;z-index:50;display:flex;align-items:center;justify-content:center;padding:12px}.modal{width:min(96vw,760px);height:min(90vh,660px);background:var(--bg-alt);border:1px solid var(--border);border-radius:14px;box-shadow:0 18px 48px #0000008c;display:flex;flex-direction:column;overflow:hidden}.modal-head{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--border);flex-shrink:0}.modal-head h2{margin:0;font-size:16px}.settings-tabs{display:flex;gap:6px;padding:10px 16px;border-bottom:1px solid var(--border);overflow-x:auto;flex-shrink:0;background:var(--bg)}.settings-tab{background:none;border:1px solid transparent;color:var(--muted);padding:6px 12px;border-radius:999px;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap;font-family:inherit}.settings-tab:hover{color:var(--text);background:var(--bg-hover)}.settings-tab.active{color:var(--accent);background:var(--accent-soft);border-color:var(--accent)}.modal-body{flex:1;overflow-y:auto;padding:18px}.field{margin-bottom:16px}.field label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px;font-weight:600}.field-hint{font-size:11.5px;color:var(--muted);margin-top:4px}.field input[type=text],.field select{width:100%;padding:9px 11px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:13px;outline:none}.field input[type=range]{width:100%}.toggle-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border-radius:8px;background:var(--bg);border:1px solid var(--border);margin-bottom:12px;font-size:13px;cursor:pointer}.endpoint-box{background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:10px 12px;font-family:var(--font-mono);font-size:12px;margin-bottom:8px;word-break:break-all}.modal-foot{display:flex;justify-content:space-between;gap:8px;padding:12px 18px;border-top:1px solid var(--border);flex-shrink:0}.switcher-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#0000008c;z-index:45;display:flex;align-items:flex-end;justify-content:center;padding:14px}@media(min-width:769px){.switcher-backdrop{align-items:center}}.switcher{width:100%;max-width:520px;max-height:70vh;background:var(--bg-alt);border:1px solid var(--border);border-radius:16px;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 18px 48px #0000008c}.switcher-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-bottom:1px solid var(--border)}.switcher-tabs{display:flex;gap:4px}.switcher-tab{background:none;border:0;color:var(--muted);font-size:12px;font-weight:600;padding:5px 10px;border-radius:7px;cursor:pointer;font-family:inherit}.switcher-tab:hover{color:var(--text);background:var(--bg-hover)}.switcher-tab.active{background:var(--accent-soft);color:var(--accent)}.switcher-cap{font-size:11px;color:var(--muted);font-family:var(--font-mono)}.switcher-group-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);padding:8px 10px 4px}.switcher-row-top{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%}.switcher-time{font-size:11px;color:var(--muted);font-family:var(--font-mono);flex-shrink:0}.switcher-list{flex:1;overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:2px}.switcher-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:10px 12px;border-radius:10px;cursor:pointer;font-family:inherit;display:flex;flex-direction:column;gap:2px}.switcher-item:hover,.switcher-item.selected{background:var(--accent-soft);color:var(--accent)}.switcher-path{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.switcher-snippet{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.switcher-input-wrap{padding:10px 12px;border-top:1px solid var(--border);display:flex;align-items:center;gap:8px;background:var(--bg-alt)}.switcher-input{flex:1;padding:10px 14px;border-radius:999px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:14px;outline:none}.switcher-input:focus{border-color:var(--accent)}.switcher-clear{width:30px;height:30px;border-radius:999px;border:0;background:var(--bg-hover);color:var(--text);font-size:15px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}.folder-picker{margin-top:6px;max-height:170px;overflow-y:auto;border:1px solid var(--border);border-radius:8px;background:var(--bg);padding:4px;display:flex;flex-direction:column;gap:2px}.folder-pick-item{width:100%;text-align:left;background:none;border:0;color:var(--text);padding:6px 8px;border-radius:6px;cursor:pointer;font-size:12.5px;font-family:var(--font-mono)}.folder-pick-item:hover{background:var(--bg-hover)}.folder-pick-item.active{background:var(--accent-soft);color:var(--accent);font-weight:600}.desktop-tabs{display:flex;align-items:center;gap:4px;padding:6px 14px 0;background:var(--bg-alt);border-bottom:1px solid var(--border);overflow-x:auto}.desktop-tab{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:8px 8px 0 0;border:1px solid transparent;border-bottom:0;background:none;color:var(--muted);font-size:12px;cursor:pointer;font-family:inherit;white-space:nowrap;max-width:180px}.desktop-tab:hover{background:var(--bg-hover);color:var(--text)}.desktop-tab.active{background:var(--bg);color:var(--text);border-color:var(--border);font-weight:600}.desktop-tab-title{overflow:hidden;text-overflow:ellipsis}.desktop-tab-close{border:0;background:none;color:var(--muted);cursor:pointer;padding:0 2px;font-size:13px;line-height:1}.desktop-tab-close:hover{color:var(--text)}.desktop-tab-add{border:0;background:none;color:var(--muted);cursor:pointer;padding:4px 8px;font-size:16px;border-radius:6px}.desktop-tab-add:hover{background:var(--bg-hover);color:var(--text)}.new-tab-view{min-height:60vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px}.new-tab-btn{width:210px;padding:12px 18px;border-radius:999px;border:1px solid var(--border);background:var(--bg-alt);color:var(--text);font-size:14px;font-family:inherit;cursor:pointer;display:flex;align-items:center;gap:12px}.new-tab-btn:hover,.new-tab-btn:active{background:var(--bg-hover);border-color:var(--accent);color:var(--accent)}.new-tab-btn svg{width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}.tabs-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0a0c12f0;z-index:42;display:flex;flex-direction:column;justify-content:flex-end}.tabs-grid{overflow-y:auto;padding:20px 14px 12px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;max-width:680px;width:100%;margin:0 auto}.tab-card-wrap{display:flex;flex-direction:column;align-items:center;gap:6px}.tab-card{width:100%;height:190px;background:var(--bg-alt);border:1.5px solid var(--border);border-radius:16px;padding:12px;position:relative;cursor:pointer;overflow:hidden;text-align:left;color:var(--text);font-family:inherit;display:flex;flex-direction:column;gap:6px}.tab-card.active{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}.tab-card-close{position:absolute;top:8px;right:8px;width:24px;height:24px;border-radius:999px;border:0;background:var(--bg-hover);color:var(--text);font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center}.tab-card-title{font-size:13px;font-weight:700;color:var(--accent);padding-right:26px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tab-card-preview{font-size:11px;line-height:1.45;color:var(--muted);overflow:hidden;white-space:pre-wrap}.tab-card-label{font-size:12px;font-weight:600;color:var(--text);max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tabs-footer{display:flex;align-items:center;justify-content:space-between;padding:12px 18px calc(14px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--border);background:var(--bg-alt)}.tabs-footer-btn{background:none;border:0;color:var(--text);font-size:15px;font-weight:600;cursor:pointer;padding:4px 8px;font-family:inherit}.tabs-count-badge{width:21px;height:21px;border:1.7px solid currentColor;border-radius:5px;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center}@media(max-width:960px){.app{grid-template-columns:230px 1fr}.outline-menu-trigger{display:flex}.backdrop.open{display:block;position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:20}.workspace-body:not(.outline-bottom) .rightbar{position:fixed;inset:0 0 0 auto;width:min(84vw,300px);z-index:30;transform:translate(100%);transition:transform .18s ease}.workspace-body:not(.outline-bottom) .rightbar.mobile-open{transform:translate(0)}}@media(max-width:768px){.app{grid-template-columns:1fr}.workspace-body.outline-bottom .rightbar-body{grid-template-columns:1fr;gap:10px;padding:10px 14px calc(74px + env(safe-area-inset-bottom,0px))}.menu-btn{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;padding:0}.menu-btn svg{width:19px;height:19px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}.icon-btn{width:34px;height:34px}.desktop-tabs,.fab-wrap{display:none}.sheet-backdrop,.bottom-sheet{display:block}.sidebar{position:fixed;inset:0 auto 0 0;width:min(84vw,310px);z-index:30;transform:translate(-100%);transition:transform .18s ease}.sidebar.open{transform:translate(0)}.backdrop.open{display:block;position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:20}.brand{height:48px;padding:0 12px 0 14px}.brand-title{font-size:15px;gap:8px}.sidebar-tabs{margin:10px 12px 0;padding:3px;gap:2px}.sidebar-tab{font-size:13px;padding:6px 8px;border-radius:6px}.search-wrap{padding:8px 12px 10px}.search{font-size:16px;padding:8px 11px;border-radius:7px}.tree{padding:8px 10px;font-size:14px}.tree-dir-btn,.tree-file{padding:8px 9px;font-size:14px;border-radius:6px}.tree-row-more{min-width:32px;min-height:32px;padding:4px 6px;font-size:15px;display:inline-flex;align-items:center;justify-content:center}.changes-bar{padding:6px 8px 8px}.changes-select{font-size:13.5px;padding:6px 9px}.topbar{height:48px;padding:0 12px}.rightbar-head{height:44px;padding:0 12px}.crumbs{font-size:13px}.btn{padding:8px 13px;font-size:13.5px;border-radius:8px}.more-menu,.file-ctx-menu{min-width:200px;padding:5px;border-radius:12px}.more-item{padding:10px 12px;font-size:14px;border-radius:8px}.new-tab-view{gap:12px}.new-tab-btn{width:min(84vw,270px);padding:14px 20px;font-size:15.5px}.new-tab-btn svg{width:19px;height:19px}.switcher-tab{font-size:13.5px;padding:7px 12px}.switcher-item{padding:12px 14px}.switcher-path{font-size:15px}.switcher-snippet{font-size:13px}.switcher-input{font-size:16px;padding:11px 16px}.switcher-clear{width:34px;height:34px;font-size:17px}.field label{font-size:13px}.field input[type=text],.field select{font-size:16px;padding:11px 12px;border-radius:9px}.folder-picker{max-height:200px;padding:6px}.folder-pick-item{padding:10px 12px;font-size:14px;border-radius:7px}.toggle-row{padding:12px 14px;font-size:14px}.commit-file-row{padding:8px 10px;font-size:14px}.content-scroll{padding:18px 16px calc(86px + env(safe-area-inset-bottom,0px))}.mobile-bar{position:fixed;left:50%;transform:translate(-50%);bottom:calc(14px + env(safe-area-inset-bottom,0px));z-index:25;display:flex;align-items:center;gap:6px;background:var(--glass);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);border:1px solid var(--border);border-radius:999px;padding:7px 12px;box-shadow:0 10px 30px #00000073}.mobile-bar-btn{background:none;border:0;color:var(--muted);cursor:pointer;display:flex;align-items:center;justify-content:center;width:42px;height:40px;border-radius:999px}.mobile-bar-btn svg{width:21px;height:21px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}.mobile-bar-btn.active,.mobile-bar-btn:active{color:var(--accent);background:var(--accent-soft)}.tabs-count-badge{width:23px;height:23px;font-size:12px}.sheet-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:35}.bottom-sheet{position:fixed;left:0;right:0;bottom:0;z-index:36;background:var(--bg-alt);border-top:1px solid var(--border);border-radius:18px 18px 0 0;padding:10px 14px calc(18px + env(safe-area-inset-bottom,0px));box-shadow:0 -12px 36px #00000080}.sheet-handle{width:38px;height:4px;border-radius:999px;background:var(--border);margin:0 auto 12px}.sheet-list{background:var(--bg);border:1px solid var(--border);border-radius:12px;overflow:hidden}.sheet-item{width:100%;background:none;border:0;border-bottom:1px solid var(--border);color:var(--text);padding:14px 16px;font-size:15px;font-family:inherit;display:flex;align-items:center;gap:12px;cursor:pointer;text-align:left}.sheet-item:last-child{border-bottom:0}.sheet-item:active,.sheet-item:hover{background:var(--bg-hover);color:var(--accent)}.sheet-item svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0;color:var(--muted)}}.media-viewer{display:flex;flex-direction:column;height:100%;min-height:480px}.media-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;border-bottom:1px solid var(--border);background:var(--bg-alt);font-size:13px;color:var(--muted)}.pdf-frame,.html-frame{flex:1;width:100%;height:100%;min-height:600px;border:0;background:#fff}.video-player{width:100%;max-width:960px;max-height:calc(100vh - 180px);margin:24px auto;border-radius:10px;background:#000}.csv-scroll{overflow-x:auto}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TiptapEditor-OFHNcjy3.js","assets/vendor-react-E4kvVwMA.js","assets/vendor-tiptap-ChgD7Piv.js","assets/vendor-markdown-C94ubdL7.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as u,j as e,R as Is,c as Ws}from"./vendor-react-E4kvVwMA.js";import{m as Dt}from"./vendor-markdown-C94ubdL7.js";import{H as De,d as zs}from"./vendor-hljs-B8we2J8a.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))c(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const d of o.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&c(d)}).observe(document,{childList:!0,subtree:!0});function i(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function c(n){if(n.ep)return;n.ep=!0;const o=i(n);fetch(n.href,o)}})();const ne={theme:"dark",fontSize:15,lineHeight:1.65,maxWidth:780,outlinePosition:"right",startupMode:"readme",startupPath:"README.md",autoCollapsed:["apps"],hiddenFolders:[],hideCollapsedInSearch:!0};function _s(){try{const s=localStorage.getItem("vault-settings");if(!s)return ne;const t=JSON.parse(s);return{...ne,...t,theme:t.theme==="light"?"light":"dark",fontSize:Number(t.fontSize)>=12&&Number(t.fontSize)<=22?Number(t.fontSize):15,lineHeight:Number(t.lineHeight)>=1.3&&Number(t.lineHeight)<=2.1?Number(t.lineHeight):1.65,maxWidth:Number(t.maxWidth)>=560&&Number(t.maxWidth)<=1040?Number(t.maxWidth):780,outlinePosition:["right","bottom","hidden"].includes(t.outlinePosition)?t.outlinePosition:"right",autoCollapsed:Array.isArray(t.autoCollapsed)?t.autoCollapsed:["apps"],hiddenFolders:Array.isArray(t.hiddenFolders)?t.hiddenFolders:[]}}catch{return ne}}function Us(s){const t=decodeURIComponent(location.hash.slice(1)||"");return t||(s.startupMode==="newtab"?null:s.startupMode==="last"?localStorage.getItem("vault-last-path")||"README.md":s.startupMode==="custom"&&s.startupPath.trim()||"README.md")}function Ve(s){return s?s.split("/").pop().replace(/\.md$/i,""):"New tab"}function Fe(s){return/\.(md|markdown|mdx)$/i.test(s)}function $e(s){return/\.(png|jpe?g|gif|webp|svg|ico)$/i.test(s)}function Mt(s){return/\.svg$/i.test(s)}function Oe(s){return/\.pdf$/i.test(s)}function qe(s){return/\.(mp3|wav|m4a|ogg)$/i.test(s)}function Xe(s){return/\.(mp4|webm|mov)$/i.test(s)}function Fs(s){return/\.html?$/i.test(s)}function Os(s){return/\.(csv|tsv)$/i.test(s)}function Ge(s){return/\.(epub|zip|tar|gz|tgz|7z|rar|docx?|xlsx?|pptx?|odt|ods|odp|mkv|avi|dmg|exe|bin|whl|sqlite|db)$/i.test(s)}function _t(s,t){const i=t.split("#")[0],c=s.includes("/")?s.split("/").slice(0,-1).join("/"):"",n=(c?`${c}/`:"")+i,o=[];for(const d of n.split("/"))d==="."||d===""||(d===".."?o.pop():o.push(d));return o.join("/")}function qs(s,t){const i=s.split("|")[0].split("#")[0].trim().replace(/\.md$/i,"").replace(/^\/+/,"").toLowerCase();if(!i)return null;const c=t.filter(d=>d.endsWith(".md")),n=c.find(d=>d.slice(0,-3).toLowerCase()===i);if(n)return n;const o=i.split("/").pop();return c.find(d=>d.slice(0,-3).split("/").pop().toLowerCase()===o)||null}function Ke(s,t){const i=(s||"").trim().replace(/^\/+|\/+$/g,"");if(!i)return"";const c=/\.[a-z0-9]+$/i.test(i)?i:`${i}.md`,n=(t||"").trim().replace(/^\/+|\/+$/g,"");return n?`${n}/${c}`:c}De.registerLanguage("dockerfile",zs);const At={js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",tsx:"typescript",py:"python",pyw:"python",sh:"bash",bash:"bash",zsh:"bash",json:"json",jsonc:"json",yml:"yaml",yaml:"yaml",css:"css",scss:"scss",less:"less",html:"xml",htm:"xml",xml:"xml",svg:"xml",md:"markdown",markdown:"markdown",sql:"sql",rs:"rust",go:"go",java:"java",kt:"kotlin",c:"c",h:"c",cpp:"cpp",hpp:"cpp",cc:"cpp",toml:"ini",ini:"ini",conf:"ini",env:"ini",diff:"diff",patch:"diff",rb:"ruby",php:"php",swift:"swift",makefile:"makefile",dockerfile:"dockerfile"};function Ut(s){return String(s).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Ft(s,t){const i=String(s??"");try{const c=(t||"").trim().toLowerCase();if(c&&De.getLanguage(c))return De.highlight(i,{language:c,ignoreIllegals:!0}).value;if(i.length<=15e4)return De.highlightAuto(i).value}catch{}return Ut(i)}function Xs(s,t,i){const c=[],o=s.split(/(```[\s\S]*?```)/g).map((l,r)=>r%2===1?l:l.replace(/\[\[([^\]]+)\]\]/g,(x,p)=>{const[m,$]=p.split("|"),R=($||m).trim(),C=qs(p,i);return C?`<a class="wikilink" data-path="${C.replace(/"/g,""")}">${R}</a>`:`<span class="wikilink broken" title="Note not created yet">${R}</span>`})).join(""),d=new Dt.Renderer;return d.heading=({tokens:l,depth:r})=>{const x=d.parser.parseInline(l),p=x.replace(/<[^>]+>/g,""),m=p.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return c.push({level:r,text:p,id:m}),`<h${r} id="${m}">${x}</h${r}>`},d.image=({href:l,title:r,text:x})=>`<img src="${/^https?:\/\//.test(l)?l:`/api/v1/file?path=${encodeURIComponent(_t(t,l))}`}" alt="${x||""}"${r?` title="${r}"`:""} />`,d.link=({href:l,title:r,tokens:x})=>{const p=d.parser.parseInline(x);return/^https?:\/\//.test(l)?`<a href="${l}" target="_blank" rel="noreferrer"${r?` title="${r}"`:""}>${p}</a>`:`<a class="md-rel-link" data-href="${l.replace(/"/g,""")}">${p}</a>`},d.code=({text:l,lang:r})=>{const x=Ft(l,r);return`<pre><code class="${r?`hljs language-${Ut(r.trim())}`:"hljs"}">${x}</code></pre>`},{renderedHtml:Dt.parse(o,{renderer:d,gfm:!0,breaks:!1}),headings:c}}function Gs(s,t){if(!s)return"";const i=t.split("/").pop().toLowerCase(),c=i.includes(".")?i.split(".").pop():i,n=At[c]||At[i]||"";return Ft(s,n)}const Vs=120,Ks=.28,Bt=6,Te=.25,Le=.28,Re=18;function Js(s){let t=s;for(;t&&t!==document.body;){const i=t.tagName;if(i==="PRE"||i==="TABLE"||i==="INPUT"||i==="TEXTAREA"||i==="SELECT"||t.isContentEditable)return!0;if(t.scrollWidth>t.clientWidth+2){const c=getComputedStyle(t).overflowX;if(c==="auto"||c==="scroll")return!0}t=t.parentElement}return!1}function Pt(s,t){if(s)for(const i of t)s.style[i]=""}function Ys({drawerOpen:s,outlineDrawerOpen:t,outlinePosition:i="right",setDrawerOpen:c,onOpenOutline:n,setOutlineDrawerOpen:o,disabled:d=!1}){const b=u.useRef({drawerOpen:s,outlineDrawerOpen:t,outlinePosition:i,setDrawerOpen:c,onOpenOutline:n,setOutlineDrawerOpen:o,disabled:d});b.current={drawerOpen:s,outlineDrawerOpen:t,outlinePosition:i,setDrawerOpen:c,onOpenOutline:n,setOutlineDrawerOpen:o,disabled:d},u.useEffect(()=>{let l=null;const r=C=>{C&&(Pt(C.panelEl,["transform","transition"]),Pt(C.backdropEl,["display","position","inset","zIndex","background","opacity","transition"]))},x=C=>{const h=b.current;if(h.disabled||C.touches.length!==1)return;const v=C.touches[0],S=v.clientX,L=v.clientY,f=document.documentElement.clientWidth||window.innerWidth,y=Math.min(Vs,Math.round(f*Ks));let w=null,E=null;if(h.drawerOpen&&f<=768?(w="left",E="close"):h.outlineDrawerOpen&&f<=960&&h.outlinePosition!=="bottom"?(w="right",E="close"):!h.drawerOpen&&!h.outlineDrawerOpen&&!Js(C.target)&&(S<=y&&f<=768?(w="left",E="open"):S>=f-y&&f<=960&&h.outlinePosition!=="bottom"&&(w="right",E="open")),!w)return;const B=document.querySelector(w==="left"?".sidebar":".rightbar"),W=document.querySelector(".backdrop"),U=(B==null?void 0:B.offsetWidth)||(w==="left"?310:300);l={side:w,action:E,startX:S,startY:L,lastX:S,startTime:performance.now(),lastTime:performance.now(),locked:null,panelEl:B,backdropEl:W,width:U}},p=C=>{if(!l||C.touches.length!==1)return;const h=C.touches[0],v=h.clientX-l.startX,S=h.clientY-l.startY;if(l.lastX=h.clientX,l.lastTime=performance.now(),!l.locked){if(Math.abs(S)>=Bt&&Math.abs(S)>=Math.abs(v)){l.locked="vertical",l=null;return}if(Math.abs(v)>=Bt&&Math.abs(v)>Math.abs(S)){if(!(l.side==="left"&&l.action==="open"&&v>0||l.side==="left"&&l.action==="close"&&v<0||l.side==="right"&&l.action==="open"&&v<0||l.side==="right"&&l.action==="close"&&v>0)){l=null;return}l.locked="horizontal",l.panelEl&&(l.panelEl.style.transition="none"),l.backdropEl&&(l.backdropEl.style.display="block",l.backdropEl.style.position="fixed",l.backdropEl.style.inset="0",l.backdropEl.style.zIndex="20",l.backdropEl.style.background="rgba(0, 0, 0, 0.5)",l.backdropEl.style.transition="none")}else return}l.locked==="horizontal"&&C.cancelable&&C.preventDefault();const L=l.width;let f;if(l.side==="left"?f=l.action==="open"?v/L:1+v/L:f=l.action==="open"?-v/L:1-v/L,f=Math.max(0,Math.min(1,f)),l.panelEl){const y=l.side==="left"?(f-1)*100:(1-f)*100;l.panelEl.style.transform=`translateX(${y}%)`}l.backdropEl&&(l.backdropEl.style.opacity=String(f))},m=C=>{if(!l)return;const h=l;if(l=null,h.locked!=="horizontal"){r(h);return}const v=h.lastX-h.startX,S=Math.max(1,h.lastTime-h.startTime),L=v/S;let f=!1;if(C||(h.side==="left"&&h.action==="open"?f=v>=h.width*Te||v>=Re&&L>=Le:h.side==="left"&&h.action==="close"||h.side==="right"&&h.action==="open"?f=-v>=h.width*Te||-v>=Re&&-L>=Le:h.side==="right"&&h.action==="close"&&(f=v>=h.width*Te||v>=Re&&L>=Le)),r(h),!f)return;const y=b.current;h.side==="left"?h.action==="open"?(y.setOutlineDrawerOpen(!1),y.setDrawerOpen(!0)):y.setDrawerOpen(!1):h.action==="open"?y.onOpenOutline():y.setOutlineDrawerOpen(!1)},$=()=>m(!1),R=()=>m(!0);return window.addEventListener("touchstart",x,{passive:!0}),window.addEventListener("touchmove",p,{passive:!1}),window.addEventListener("touchend",$,{passive:!0}),window.addEventListener("touchcancel",R,{passive:!0}),()=>{window.removeEventListener("touchstart",x),window.removeEventListener("touchmove",p),window.removeEventListener("touchend",$),window.removeEventListener("touchcancel",R)}},[])}const Qs=450,Ht=8;function It(s){const t=u.useRef(null),i=u.useRef(null),c=u.useRef(!1),n=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return{onTouchStart:o=>{if(o.touches.length!==1)return;const d=o.touches[0],b=o.currentTarget.closest(".tree-file-row")||o.currentTarget;i.current={x:d.clientX,y:d.clientY},c.current=!1,n(),t.current=setTimeout(()=>{var l;t.current=null,c.current=!0,(l=navigator.vibrate)==null||l.call(navigator,10),s(b.getBoundingClientRect())},Qs)},onTouchMove:o=>{if(!t.current||!i.current||o.touches.length!==1)return;const d=o.touches[0];(Math.abs(d.clientX-i.current.x)>Ht||Math.abs(d.clientY-i.current.y)>Ht)&&n()},onTouchEnd:()=>n(),onTouchCancel:()=>n(),onContextMenu:o=>{o.preventDefault();const d=o.currentTarget.closest(".tree-file-row")||o.currentTarget;s(d.getBoundingClientRect())},consumeClick:o=>c.current?(c.current=!1,o.preventDefault(),o.stopPropagation(),!0):!1}}function Ot({node:s,activePath:t,filter:i,collapsed:c,hiddenSet:n,onToggleDir:o,onSelectFile:d,onOpenMenu:b}){const l=It(x=>b(s.path,x,"dir")),r=It(x=>b(s.path,x,"file"));if(s.type==="dir"){if(n.has(s.path.toLowerCase())||n.has(s.name.toLowerCase()))return null;const x=m=>m.type==="file"?m.path.toLowerCase().includes(i):m.children.some(x);if(i&&!x(s))return null;const p=!i&&c.has(s.path);return e.jsxs("div",{children:[e.jsxs("div",{className:"tree-file-row",children:[e.jsxs("button",{className:"tree-dir-btn",title:s.path,onTouchStart:l.onTouchStart,onTouchMove:l.onTouchMove,onTouchEnd:l.onTouchEnd,onTouchCancel:l.onTouchCancel,onContextMenu:l.onContextMenu,onClick:m=>{l.consumeClick(m)||o(s.path)},children:[p?"▸ ":"▾ ",s.name]}),e.jsx("button",{className:"tree-row-more","aria-label":`Actions for folder ${s.name}`,onClick:m=>{m.stopPropagation(),b(s.path,m.currentTarget.getBoundingClientRect(),"dir")},children:"⋯"})]}),!p&&e.jsx("div",{className:"tree-children",children:s.children.map(m=>e.jsx(Ot,{node:m,activePath:t,filter:i,collapsed:c,hiddenSet:n,onToggleDir:o,onSelectFile:d,onOpenMenu:b},m.path))})]})}return i&&!s.path.toLowerCase().includes(i)?null:e.jsxs("div",{className:`tree-file-row${s.path===t?" active":""}`,children:[e.jsx("button",{className:`tree-file${s.path===t?" active":""}`,title:s.path,onTouchStart:r.onTouchStart,onTouchMove:r.onTouchMove,onTouchEnd:r.onTouchEnd,onTouchCancel:r.onTouchCancel,onContextMenu:r.onContextMenu,onClick:x=>{r.consumeClick(x)||d(s.path)},children:s.name}),e.jsx("button",{className:"tree-row-more","aria-label":`Actions for ${s.name}`,onClick:x=>{x.stopPropagation(),b(s.path,x.currentTarget.getBoundingClientRect())},children:"⋯"})]})}function Zs({drawerOpen:s,live:t,settings:i,setSettings:c,sidebarTab:n,setSidebarTab:o,gitChanges:d,searchRef:b,filter:l,setFilter:r,tree:x,activePath:p,collapsed:m,hiddenSet:$,toggleDir:R,setViewMode:C,openFile:h,openRowMenu:v,changesSort:S,setChangesSort:L,openCommitDialog:f,sortedChanges:y,loadDiff:w}){return e.jsxs("aside",{className:`sidebar${s?" open":""}`,children:[e.jsxs("div",{className:"brand",children:[e.jsxs("div",{className:"brand-title",children:[e.jsx("img",{src:"/vault-logo.svg",alt:"",width:"20",height:"20",className:"brand-logo"}),e.jsx("span",{children:"Vault"}),e.jsx("span",{className:`pill${t?"":" off"}`,children:t?"Live":"Reconnecting"})]}),e.jsx("button",{className:"icon-btn","aria-label":i.theme==="dark"?"Switch to light theme":"Switch to dark theme",title:i.theme==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>c(E=>({...E,theme:E.theme==="dark"?"light":"dark"})),children:i.theme==="dark"?e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})]}):e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})})]}),e.jsxs("div",{className:"sidebar-tabs",children:[e.jsx("button",{className:`sidebar-tab${n==="files"?" active":""}`,onClick:()=>o("files"),children:"Files"}),e.jsxs("button",{className:`sidebar-tab${n==="changes"?" active":""}`,onClick:()=>o("changes"),children:[e.jsx("span",{children:"Changes"}),d.length>0&&e.jsx("span",{className:"pill",children:d.length})]})]}),e.jsx("div",{className:"search-wrap",children:e.jsx("input",{ref:b,className:"search",type:"search",placeholder:n==="files"?"Filter files... (/)":"Filter changes...",value:l,onChange:E=>r(E.target.value.trim().toLowerCase())})}),e.jsx("div",{className:"tree",children:n==="files"?x.map(E=>e.jsx(Ot,{node:E,activePath:p,filter:l,collapsed:m,hiddenSet:$,onToggleDir:R,onSelectFile:B=>{C("preview"),h(B)},onOpenMenu:v},E.path)):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"changes-bar",children:[e.jsxs("select",{className:"changes-select","aria-label":"Sort changes",value:S,onChange:E=>L(E.target.value),children:[e.jsx("option",{value:"path",children:"Sort: Path"}),e.jsx("option",{value:"recent",children:"Sort: Recent"}),e.jsx("option",{value:"status",children:"Sort: Status"})]}),d.length>0&&e.jsx("button",{className:"btn primary",onClick:f,children:"Commit"})]}),y.length===0?e.jsx("div",{className:"empty-note",style:{padding:"10px 8px"},children:"Working tree clean"}):y.map(E=>e.jsxs("div",{className:`tree-file-row${E.path===p?" active":""}`,children:[e.jsxs("button",{className:`tree-file${E.path===p?" active":""}`,title:E.path,onClick:()=>{E.status!=="D"&&(C("diff"),h(E.path),w(E.path))},children:[e.jsx("span",{className:`git-badge git-${E.status}`,children:E.status}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:E.path})]}),e.jsx("button",{className:"tree-row-more","aria-label":`Actions for ${E.path}`,onClick:B=>{B.stopPropagation(),v(E.path,B.currentTarget.getBoundingClientRect())},children:"⋯"})]},E.path))]})})]})}function en({tabs:s,activeTabId:t,switchTab:i,closeTab:c,createNewTab:n}){return e.jsxs("div",{className:"desktop-tabs",children:[s.map(o=>e.jsxs("div",{className:`desktop-tab${o.id===t?" active":""}`,onClick:()=>i(o),children:[e.jsx("span",{className:"desktop-tab-title",children:o.title}),e.jsx("button",{className:"desktop-tab-close",onClick:d=>c(o.id,d),children:"×"})]},o.id)),e.jsx("button",{className:"desktop-tab-add",title:"New tab",onClick:n,children:"+"})]})}function tn({setDrawerOpen:s,activePath:t,moreMenuOpen:i,setMoreMenuOpen:c,viewMode:n,setViewMode:o,loadDiff:d,setDeleteError:b,setDeleteTarget:l,outlinePosition:r,outlineDrawerOpen:x,onToggleOutline:p,onOpenOutline:m}){const $=x||r!=="hidden";return e.jsxs("div",{className:"topbar",children:[e.jsxs("div",{className:"topbar-left",children:[e.jsx("button",{className:"icon-btn menu-btn","aria-label":"Toggle files",onClick:()=>s(R=>!R),children:e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M9 3v18"})]})}),e.jsx("div",{className:"crumbs",children:t||"New tab"})]}),e.jsxs("div",{className:"actions",children:[e.jsx("button",{className:`icon-btn outline-toggle-btn${$?" active":""}`,"aria-label":"Toggle outline",title:"Toggle outline & backlinks",onClick:p,children:e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M15 3v18"})]})}),e.jsx("button",{className:"icon-btn","aria-label":"Note options",title:"Note options",onClick:()=>c(R=>!R),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[e.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}),i&&e.jsxs("div",{className:"more-menu",onMouseLeave:()=>c(!1),children:[t&&e.jsx("a",{className:"more-item",href:`/api/v1/file?path=${encodeURIComponent(t)}&download=1`,download:t.split("/").pop(),style:{textDecoration:"none",borderBottom:"1px solid var(--border)",marginBottom:3,paddingBottom:9},onClick:()=>c(!1),children:e.jsx("span",{children:"Download"})}),e.jsxs("button",{className:`more-item${n==="preview"?" active":""}`,onClick:()=>{o("preview"),c(!1)},children:[e.jsx("span",{children:"Preview"}),n==="preview"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${n==="edit"?" active":""}`,onClick:()=>{o("edit"),c(!1)},children:[e.jsx("span",{children:"Edit"}),n==="edit"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${n==="diff"?" active":""}`,onClick:()=>{o("diff"),c(!1),d(t)},children:[e.jsx("span",{children:"Diff"}),n==="diff"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${n==="raw"?" active":""}`,onClick:()=>{o("raw"),c(!1)},children:[e.jsx("span",{children:"Raw"}),n==="raw"&&e.jsx("span",{children:"✓"})]}),e.jsx("button",{className:`more-item outline-menu-trigger${r==="hidden"?" show-desktop":""}`,style:{borderTop:"1px solid var(--border)",marginTop:3,paddingTop:9},onClick:()=>{c(!1),m()},children:e.jsx("span",{children:"Outline"})}),t&&e.jsx("button",{className:"more-item",style:{color:"#f87171",borderTop:"1px solid var(--border)",marginTop:3,paddingTop:9},onClick:()=>{c(!1),b(""),l(t)},children:e.jsx("span",{children:"Delete"})})]})]})]})}const sn="modulepreload",nn=function(s){return"/"+s},Wt={},an=function(t,i,c){let n=Promise.resolve();if(i&&i.length>0){let d=function(r){return Promise.all(r.map(x=>Promise.resolve(x).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const b=document.querySelector("meta[property=csp-nonce]"),l=(b==null?void 0:b.nonce)||(b==null?void 0:b.getAttribute("nonce"));n=d(i.map(r=>{if(r=nn(r),r in Wt)return;Wt[r]=!0;const x=r.endsWith(".css"),p=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${p}`))return;const m=document.createElement("link");if(m.rel=x?"stylesheet":sn,x||(m.as="script"),m.crossOrigin="",m.href=r,l&&m.setAttribute("nonce",l),document.head.appendChild(m),x)return new Promise(($,R)=>{m.addEventListener("load",$),m.addEventListener("error",()=>R(new Error(`Unable to preload CSS for ${r}`)))})}))}function o(d){const b=new Event("vite:preloadError",{cancelable:!0});if(b.payload=d,window.dispatchEvent(b),!b.defaultPrevented)throw d}return n.then(d=>{for(const b of d||[])b.status==="rejected"&&o(b.reason);return t().catch(o)})};function ln(s,t=","){const i=[];let c=[],n="",o=!1;for(let d=0;d<s.length;d+=1){const b=s[d];if(o){b==='"'?s[d+1]==='"'?(n+='"',d+=1):o=!1:n+=b;continue}b==='"'?o=!0:b===t?(c.push(n),n=""):b==="\r"?(s[d+1]===`
|
|
3
|
-
`&&(d+=1),c.push(n),i.push(c),c=[],n=""):b===`
|
|
4
|
-
`?(c.push(n),i.push(c),c=[],n=""):n+=b}return(n.length>0||c.length>0)&&(c.push(n),i.push(c)),i}const on=u.lazy(()=>an(()=>import("./TiptapEditor-OFHNcjy3.js"),__vite__mapDeps([0,1,2,3])));function rn({scrollRef:s,activePath:t,openNewNoteDialog:i,openFile:c,openSwitcher:n,setDrawerOpen:o,setSettingsOpen:d,isImg:b,isSvg:l,isMarkdown:r,isPdf:x,isAudio:p,isVideo:m,isHtml:$,isCsv:R,reloadTick:C,isBinaryDownload:h,viewMode:v,settings:S,diffData:L,requestDiscard:f,content:y,saving:w,dirty:E,setDraftContent:B,setDirty:W,saveActiveNote:U,highlightedRawHtml:Me,handleDocClick:pe,renderedHtml:G}){var ee,fe;const V=u.useMemo(()=>{if(!R||v!=="preview"||!y)return[];const I=t.toLowerCase().endsWith(".tsv")?" ":",";return ln(y,I)},[R,v,y,t]),ae=t?`/api/v1/file?path=${encodeURIComponent(t)}&t=${C}`:"",Q=t?`/api/v1/file?path=${encodeURIComponent(t)}&download=1`:"",Z=t?`/raw/${t.split("/").map(encodeURIComponent).join("/")}?t=${C}`:"";return e.jsx("div",{ref:s,className:"content-scroll",children:t?b&&!(l&&v==="raw")?e.jsx("div",{className:"doc img-wrap",children:e.jsx("img",{src:ae,alt:t})}):x?e.jsxs("div",{className:"media-viewer pdf-viewer",children:[e.jsxs("div",{className:"media-bar",children:[e.jsx("span",{children:t.split("/").pop()}),e.jsx("a",{className:"btn",href:Q,download:t.split("/").pop(),children:"Download PDF"})]}),e.jsx("iframe",{className:"pdf-frame",src:ae,title:t})]}):p?e.jsxs("div",{className:"doc binary-card audio-viewer",children:[e.jsx("div",{className:"binary-card-name",children:t.split("/").pop()}),e.jsx("div",{className:"binary-card-path",children:t}),e.jsx("audio",{controls:!0,src:ae,style:{width:"100%",maxWidth:460}}),e.jsx("a",{className:"btn",href:Q,download:t.split("/").pop(),style:{textDecoration:"none",display:"inline-flex",alignItems:"center",gap:6,marginTop:12},children:"Download audio"})]}):m?e.jsxs("div",{className:"media-viewer video-viewer",children:[e.jsxs("div",{className:"media-bar",children:[e.jsx("span",{children:t.split("/").pop()}),e.jsx("a",{className:"btn",href:Q,download:t.split("/").pop(),children:"Download video"})]}),e.jsx("video",{controls:!0,src:ae,className:"video-player"})]}):h?e.jsxs("div",{className:"doc binary-card",children:[e.jsx("div",{className:"binary-card-name",children:t.split("/").pop()}),e.jsx("div",{className:"binary-card-path",children:t}),e.jsx("a",{className:"btn primary",href:`/api/v1/file?path=${encodeURIComponent(t)}&download=1`,download:t.split("/").pop(),style:{textDecoration:"none",display:"inline-flex",alignItems:"center",gap:6},children:"Download file"})]}):v==="diff"?e.jsxs("div",{className:"diff-wrap",style:{maxWidth:`${S.maxWidth+80}px`},children:[e.jsxs("div",{className:"diff-head",children:[e.jsx("span",{style:{fontSize:13,color:"var(--muted)"},children:L!=null&&L.untracked?"Untracked file":`${((ee=L==null?void 0:L.hunks)==null?void 0:ee.length)||0} hunk(s)`}),((fe=L==null?void 0:L.hunks)==null?void 0:fe.length)>0&&e.jsx("button",{className:"btn",style:{color:"#f87171"},onClick:()=>f(),children:"Discard file"})]}),!L||L.hunks.length===0?e.jsx("div",{className:"empty-note",children:"No uncommitted changes for this file."}):L.hunks.map((I,O)=>e.jsxs("div",{className:"diff-hunk",children:[e.jsxs("div",{className:"diff-hunk-bar",children:[e.jsx("span",{children:I.header}),!L.untracked&&e.jsx("button",{className:"btn",onClick:()=>f({hunkIndex:O}),children:"Discard hunk"})]}),I.lines.map((z,H)=>e.jsxs("div",{className:`diff-line ${z.type}`,children:[e.jsx("span",{className:"diff-ln",children:z.newLine??z.oldLine??""}),e.jsx("span",{className:"diff-sig",children:z.type==="add"?"+":z.type==="del"?"-":" "}),e.jsx("span",{className:"diff-txt",children:z.text||" "}),!L.untracked&&z.type!=="context"?e.jsx("button",{className:"diff-discard-btn",title:"Discard line",onClick:()=>f({hunkIndex:O,lineIndex:H,previewText:`${z.type==="add"?"+":"-"} ${z.text}`}),children:"↺"}):e.jsx("span",{})]},H))]},O))]}):v==="edit"&&r?e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"empty-note",style:{padding:"24px"},children:"Loading editor..."}),children:e.jsx(on,{fileKey:t,content:y,fontSize:S.fontSize,lineHeight:S.lineHeight,maxWidth:S.maxWidth,saving:w,dirty:E,onChange:I=>{B(I),W(I!==y)},onSave:U})}):$&&v==="preview"?e.jsx("div",{className:"media-viewer html-viewer",children:e.jsx("iframe",{className:"html-frame",src:Z,sandbox:"allow-scripts",title:t})}):R&&v==="preview"?e.jsx("div",{className:"doc csv-wrap",style:{fontSize:`${Math.max(12,S.fontSize-1)}px`,maxWidth:`${S.maxWidth+160}px`},children:V.length===0?e.jsx("div",{className:"empty-note",children:"Empty table."}):e.jsx("div",{className:"csv-scroll",children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsx("tr",{children:V[0].map((I,O)=>e.jsx("th",{children:I},O))})}),e.jsx("tbody",{children:V.slice(1).map((I,O)=>e.jsx("tr",{children:V[0].map((z,H)=>e.jsx("td",{children:I[H]??""},H))},O))})]})})}):v==="raw"||!r?e.jsx("pre",{className:"raw-view",style:{fontSize:`${Math.max(12,S.fontSize-2)}px`,maxWidth:`${S.maxWidth+80}px`},children:e.jsx("code",{className:"hljs",dangerouslySetInnerHTML:{__html:Me}})}):e.jsx("div",{className:"doc",style:{fontSize:`${S.fontSize}px`,lineHeight:S.lineHeight,maxWidth:`${S.maxWidth}px`},onClick:pe,dangerouslySetInnerHTML:{__html:G}}):e.jsxs("div",{className:"new-tab-view",children:[e.jsxs("button",{className:"new-tab-btn",onClick:()=>i(""),children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 5v14M5 12h14"})}),e.jsx("span",{children:"Create new note"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:()=>c("README.md"),children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"})}),e.jsx("span",{children:"Go to README"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:n,children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m20 20-3.5-3.5"})]}),e.jsx("span",{children:"Go to file"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:()=>o(!0),children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})}),e.jsx("span",{children:"Browse files"})]}),e.jsxs("button",{className:"new-tab-btn",onClick:()=>d(!0),children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{children:"Settings"})]})]})})}function cn({headings:s,isImg:t,isBinaryDownload:i,viewMode:c,currentBacklinks:n,openFile:o,position:d="right",onChangePosition:b,mobileOpen:l=!1,onCloseMobile:r}){const[x,p]=u.useState(!1);if(d==="hidden"&&!l&&window.innerWidth>960)return null;const m=t?"Image preview":i?"Binary file":c==="raw"?"Raw view":c==="edit"?"Edit mode":c==="diff"?"Diff mode":"No headings";return e.jsxs("aside",{className:`rightbar${l?" mobile-open":""}`,children:[e.jsxs("div",{className:"rightbar-head",children:[e.jsx("div",{className:"panel-title",style:{margin:0},children:d==="bottom"?"Outline & Backlinks":"Outline"}),e.jsxs("div",{className:"actions",children:[e.jsx("button",{className:"icon-btn","aria-label":"Outline panel options",title:"Outline panel options",onClick:()=>p($=>!$),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[e.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}),x&&e.jsxs("div",{className:"more-menu",onMouseLeave:()=>p(!1),children:[e.jsxs("button",{className:`more-item${d==="right"?" active":""}`,onClick:()=>{b("right"),p(!1)},children:[e.jsx("span",{children:"Position: Right"}),d==="right"&&e.jsx("span",{children:"✓"})]}),e.jsxs("button",{className:`more-item${d==="bottom"?" active":""}`,onClick:()=>{b("bottom"),r==null||r(),p(!1)},children:[e.jsx("span",{children:"Position: Bottom"}),d==="bottom"&&e.jsx("span",{children:"✓"})]}),e.jsx("button",{className:"more-item",style:{borderTop:"1px solid var(--border)",marginTop:2,paddingTop:8},onClick:()=>{window.innerWidth<=960&&l?r==null||r():b("hidden"),p(!1)},children:e.jsx("span",{children:"Hide panel"})})]})]})]}),e.jsxs("div",{className:"rightbar-body",children:[e.jsxs("div",{className:"rightbar-sec",children:[e.jsx("div",{className:"panel-subtitle",children:"Outline"}),s.length===0?e.jsx("div",{className:"empty-note",children:m}):s.map(($,R)=>e.jsx("a",{className:`toc-item toc-h${$.level}`,onClick:()=>{var C;(C=document.getElementById($.id))==null||C.scrollIntoView({behavior:"smooth"}),r==null||r()},children:$.text},`${$.id}-${R}`))]}),e.jsxs("div",{className:"rightbar-sec",children:[e.jsx("div",{className:"panel-title backlinks-title",children:"Backlinks"}),n.length===0?e.jsx("div",{className:"empty-note",children:"No backlinks yet"}):n.map($=>e.jsx("a",{className:"backlink-item",onClick:()=>{o($),r==null||r()},children:$},$))]})]})]})}function dn({fabOpen:s,setFabOpen:t,openSwitcher:i,drawerOpen:c,setDrawerOpen:n,openFile:o,viewMode:d,setViewMode:b,settings:l,setSettings:r,setSettingsOpen:x,scrollRef:p,loadDiff:m,activePath:$,createNewTab:R,tabsOpen:C,setTabsOpen:h,tabs:v,activeTabId:S,switchTab:L,closeTab:f,onToggleOutline:y}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"fab-wrap",children:[s&&e.jsxs("div",{className:"fab-menu",children:[e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),i()},children:"🔍 Quick switcher"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),n(w=>!w)},children:"📁 Toggle files"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),y==null||y()},children:"📑 Toggle outline"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),o("README.md")},children:"🏠 Home (README)"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),b(w=>w==="raw"?"preview":"raw")},children:d==="raw"?"📄 Preview mode":"🧾 Raw view"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),r(w=>({...w,theme:w.theme==="dark"?"light":"dark"}))},children:l.theme==="dark"?"☀️ Light theme":"🌙 Dark theme"}),e.jsx("button",{className:"fab-item",onClick:()=>{t(!1),x(!0)},children:"⚙️ Settings"}),e.jsx("button",{className:"fab-item",onClick:()=>{var w;t(!1),(w=p.current)==null||w.scrollTo({top:0,behavior:"smooth"})},children:"⬆️ Scroll to top"})]}),e.jsx("button",{className:"fab-btn","aria-label":"Quick actions",onClick:()=>t(w=>!w),children:s?"×":"+"})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sheet-backdrop",onClick:()=>t(!1)}),e.jsxs("div",{className:"bottom-sheet",role:"dialog","aria-label":"Quick actions",children:[e.jsx("div",{className:"sheet-handle"}),e.jsxs("div",{className:"sheet-list",children:[e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),i()},children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m20 20-3.5-3.5"})]}),e.jsx("span",{children:"Open quick switcher"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),n(w=>!w)},children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M9 3v18"})]}),e.jsx("span",{children:"Toggle files sidebar"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),y==null||y()},children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M15 3v18"})]}),e.jsx("span",{children:"Toggle outline sidebar"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),o("README.md")},children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"})}),e.jsx("span",{children:"Go to Home (README)"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),b(w=>w==="edit"?"preview":"edit")},children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 20h9M16.5 3.5a2.12 2.12 0 1 1 3 3L7 19l-4 1 1-4Z"})}),e.jsx("span",{children:d==="edit"?"Switch to Preview mode":"Switch to Edit mode"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),b("diff"),m($)},children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 3v18M3 12h18"})}),e.jsx("span",{children:"View Git Diff"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),b(w=>w==="raw"?"preview":"raw")},children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"})}),e.jsx("span",{children:d==="raw"?"Switch to Preview mode":"Switch to Raw view"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{var w;t(!1),(w=p.current)==null||w.scrollTo({top:0,behavior:"smooth"})},children:[e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),e.jsx("span",{children:"Scroll to top"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),r(w=>({...w,theme:w.theme==="dark"?"light":"dark"}))},children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})]}),e.jsx("span",{children:l.theme==="dark"?"Switch to Light theme":"Switch to Dark theme"})]}),e.jsxs("button",{className:"sheet-item",onClick:()=>{t(!1),x(!0)},children:[e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{children:"Settings"})]})]})]})]}),e.jsxs("nav",{className:"mobile-bar","aria-label":"Mobile quick actions",children:[e.jsx("button",{className:`mobile-bar-btn${c?" active":""}`,"aria-label":"Files",onClick:()=>{t(!1),n(w=>!w)},children:e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M9 3v18"})]})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"Back",onClick:()=>window.history.back(),children:e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"Forward",onClick:()=>window.history.forward(),children:e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"Search",onClick:()=>{t(!1),i()},children:e.jsxs("svg",{viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m20 20-3.5-3.5"})]})}),e.jsx("button",{className:"mobile-bar-btn","aria-label":"New tab",onClick:R,children:e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})}),e.jsx("button",{className:`mobile-bar-btn${C?" active":""}`,"aria-label":"Open tabs",onClick:()=>{t(!1),h(!0)},children:e.jsx("span",{className:"tabs-count-badge",children:v.length})}),e.jsx("button",{className:`mobile-bar-btn${s?" active":""}`,"aria-label":"Menu",onClick:()=>t(w=>!w),children:e.jsx("svg",{viewBox:"0 0 24 24",children:e.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})})]}),C&&e.jsxs("div",{className:"tabs-overlay",onClick:()=>h(!1),children:[e.jsx("div",{className:"tabs-grid",onClick:w=>w.stopPropagation(),children:v.map(w=>e.jsxs("div",{className:"tab-card-wrap",children:[e.jsxs("div",{className:`tab-card${w.id===S?" active":""}`,onClick:()=>L(w),children:[e.jsx("button",{className:"tab-card-close","aria-label":"Close tab",onClick:E=>f(w.id,E),children:"×"}),e.jsx("div",{className:"tab-card-title",children:w.title}),e.jsx("div",{className:"tab-card-preview",children:w.preview||(w.path?w.path:"Empty tab")})]}),e.jsx("div",{className:"tab-card-label",children:w.title})]},w.id))}),e.jsxs("div",{className:"tabs-footer",onClick:w=>w.stopPropagation(),children:[e.jsx("button",{className:"tabs-footer-btn","aria-label":"New tab",onClick:R,children:"+"}),e.jsxs("span",{style:{fontSize:14,fontWeight:600},children:[v.length," ",v.length===1?"tab":"tabs"]}),e.jsx("button",{className:"tabs-footer-btn",onClick:()=>h(!1),children:"Done"})]})]})]})}function hn({switcherOpen:s,setSwitcherOpen:t,switcherTab:i,setSwitcherTab:c,switcherIdx:n,setSwitcherIdx:o,switcherInputRef:d,totalFiles:b,fileStats:l,switcherItems:r,switcherData:x,openFile:p,isLargeVault:m,pagedFiles:$,loadMorePagedFiles:R,switcherQuery:C,setSwitcherQuery:h}){return s?e.jsx("div",{className:"switcher-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"switcher",onClick:v=>v.stopPropagation(),children:[e.jsxs("div",{className:"switcher-head",children:[e.jsxs("div",{className:"switcher-tabs",children:[e.jsx("button",{className:`switcher-tab${i==="recent"?" active":""}`,onClick:()=>{var v;c("recent"),o(0),(v=d.current)==null||v.focus()},children:"Recent"}),e.jsx("button",{className:`switcher-tab${i==="alpha"?" active":""}`,onClick:()=>{var v;c("alpha"),o(0),(v=d.current)==null||v.focus()},children:"A–Z"})]}),b>l.length&&e.jsxs("span",{className:"switcher-cap",children:[l.length.toLocaleString()," / ",b.toLocaleString()," indexed"]})]}),e.jsxs("div",{className:"switcher-list",children:[r.length===0?e.jsx("div",{className:"empty-note",style:{padding:"12px"},children:"No matching notes"}):(()=>{let v=0;const S=Date.now(),L=f=>{if(!f)return"";const y=Math.max(0,S-f);return y<6e4?"now":y<36e5?`${Math.floor(y/6e4)}m`:y<864e5?`${Math.floor(y/36e5)}h`:y<7*864e5?`${Math.floor(y/864e5)}d`:new Date(f).toLocaleDateString(void 0,{month:"short",day:"numeric"})};return x.groups.map(f=>e.jsxs(Is.Fragment,{children:[f.label&&e.jsx("div",{className:"switcher-group-title",children:f.label}),f.items.map(y=>{const w=v++;return e.jsxs("button",{className:`switcher-item${w===n?" selected":""}`,onClick:()=>{t(!1),p(y.path)},children:[e.jsxs("div",{className:"switcher-row-top",children:[e.jsx("span",{className:"switcher-path",children:y.path}),y.mtimeMs>0&&e.jsx("span",{className:"switcher-time",children:L(y.mtimeMs)})]}),y.snippet&&e.jsx("span",{className:"switcher-snippet",children:y.snippet})]},y.path)})]},f.label||"all"))})(),m&&$.hasMore&&e.jsx("button",{className:"btn",style:{margin:"8px auto",display:"block"},onClick:R,children:"Load more"})]}),e.jsxs("div",{className:"switcher-input-wrap",children:[e.jsx("input",{ref:d,className:"switcher-input",type:"text",placeholder:"Find a note...",value:C,onChange:v=>{h(v.target.value),o(0)},onKeyDown:v=>{v.key==="ArrowDown"?(v.preventDefault(),o(S=>Math.min(S+1,Math.max(0,r.length-1)))):v.key==="ArrowUp"?(v.preventDefault(),o(S=>Math.max(S-1,0))):v.key==="Enter"&&r[n]&&(v.preventDefault(),t(!1),p(r[n].path))}}),e.jsx("button",{className:"switcher-clear","aria-label":"Clear or close",onClick:()=>C?h(""):t(!1),children:"×"})]})]})}):null}function mn({fileMenu:s,setFileMenu:t,openNewNoteDialog:i,uploadDirRef:c,uploadInputRef:n,setRenameError:o,setRenameTarget:d,setTabs:b,setActiveTabId:l,setViewMode:r,openFile:x,gitChanges:p,loadDiff:m,requestDiscard:$,setDeleteError:R,setDeleteTarget:C}){return s?e.jsx("div",{style:{position:"fixed",inset:0,zIndex:59},onClick:()=>t(null),children:e.jsx("div",{className:"file-ctx-menu",style:{left:s.x,top:s.y},onClick:h=>h.stopPropagation(),children:s.type==="dir"?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"more-item",onClick:()=>{const h=s.path;t(null),i(h)},children:e.jsx("span",{children:"New note here"})}),e.jsx("button",{className:"more-item",onClick:()=>{var h;c.current=s.path,t(null),(h=n.current)==null||h.click()},children:e.jsx("span",{children:"Upload file..."})}),e.jsx("button",{className:"more-item",onClick:()=>{const h=s.path;t(null),o(""),d({type:"dir",oldPath:h,newPath:h})},children:e.jsx("span",{children:"Rename / Move"})}),e.jsx("button",{className:"more-item",onClick:()=>{var h;(h=navigator.clipboard)==null||h.writeText(s.path),t(null)},children:e.jsx("span",{children:"Copy path"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"more-item",onClick:()=>{const h=s.path,v=`tab-${Date.now()}`;t(null),b(S=>[...S,{id:v,path:h,title:Ve(h),preview:""}]),l(v),r("preview"),x(h,!1,v)},children:e.jsx("span",{children:"Open in new tab"})}),e.jsx("button",{className:"more-item",onClick:()=>{const h=s.path;t(null),o(""),d({type:"file",oldPath:h,newPath:h})},children:e.jsx("span",{children:"Rename / Move"})}),e.jsx("button",{className:"more-item",onClick:()=>{var h;(h=navigator.clipboard)==null||h.writeText(s.path),t(null)},children:e.jsx("span",{children:"Copy path"})}),s.path.endsWith(".md")&&e.jsx("button",{className:"more-item",onClick:()=>{var h;(h=navigator.clipboard)==null||h.writeText(`[[${s.path.replace(/\.md$/i,"")}]]`),t(null)},children:e.jsx("span",{children:"Copy [[wikilink]]"})}),p.some(h=>h.path===s.path)&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"more-item",onClick:()=>{const h=s.path;t(null),r("diff"),x(h),m(h)},children:e.jsx("span",{children:"View Diff"})}),e.jsx("button",{className:"more-item",style:{color:"var(--amber)"},onClick:()=>{const h=s.path;t(null),$({path:h})},children:e.jsx("span",{children:"Discard changes"})})]}),e.jsx("button",{className:"more-item",style:{color:"#f87171",borderTop:"1px solid var(--border)",marginTop:2,paddingTop:8},onClick:()=>{const h=s.path;t(null),R(""),C(h)},children:e.jsx("span",{children:"Delete"})})]})})}):null}function un({newNoteOpen:s,setNewNoteOpen:t,newNoteTitle:i,setNewNoteTitle:c,newNoteFolder:n,setNewNoteFolder:o,allFolders:d,newNoteError:b,confirmNewNote:l}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:460},onClick:r=>r.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"New note"}),e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Title"}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:"My note title",value:i,onChange:r=>c(r.target.value),onKeyDown:r=>r.key==="Enter"&&l()})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Folder"}),e.jsx("input",{type:"text",placeholder:"(vault root) or type/select folder",value:n,onChange:r=>o(r.target.value),onKeyDown:r=>r.key==="Enter"&&l()}),e.jsx("div",{className:"folder-picker",children:d.map(r=>{const x=n.trim().replace(/^\/+|\/+$/g,"")===r;return e.jsx("button",{type:"button",className:`folder-pick-item${x?" active":""}`,onClick:()=>o(r),children:r||"/ (vault root)"},r||"__root__")})})]}),Ke(i,n)&&e.jsxs("div",{style:{fontSize:12,color:"var(--muted)",fontFamily:"var(--font-mono)"},children:["Path: ",Ke(i,n)]}),b&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:b})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:l,children:"Create note"})]})]})}):null}function pn({renameTarget:s,setRenameTarget:t,renameError:i,confirmRenameFile:c}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(null),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:440},onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Rename / Move"}),e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"New path"}),e.jsx("input",{type:"text",value:s.newPath,onChange:n=>t(o=>({...o,newPath:n.target.value})),onKeyDown:n=>n.key==="Enter"&&c()})]}),i&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:i})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:c,children:"Rename"})]})]})}):null}function fn({deleteTarget:s,setDeleteTarget:t,deleteError:i,confirmDeleteFile:c}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(null),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:420},onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Delete file?"}),e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{style:{fontSize:13,color:"var(--muted)"},children:["This will permanently remove ",e.jsx("strong",{style:{color:"var(--text)"},children:s})," from disk."]}),i&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:i})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Cancel"}),e.jsx("button",{className:"btn",style:{background:"#ef4444",borderColor:"#ef4444",color:"#ffffff",fontWeight:600},onClick:c,children:"Delete"})]})]})}):null}function xn({discardTarget:s,setDiscardTarget:t,discardError:i,confirmDiscard:c}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(null),children:e.jsxs("div",{className:"modal",style:{height:"auto",maxWidth:440},onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:s.hunkIndex===void 0?"Discard file changes?":s.lineIndex===void 0?"Discard hunk?":"Discard line?"}),e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsx("div",{style:{fontSize:13,color:"var(--muted)",marginBottom:10},children:s.path}),s.previewText&&e.jsx("div",{className:"git-output",style:{marginTop:0},children:s.previewText}),i&&e.jsx("div",{className:"git-output",style:{color:"#f87171"},children:i})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(null),children:"Cancel"}),e.jsx("button",{className:"btn",style:{background:"#ef4444",borderColor:"#ef4444",color:"#ffffff",fontWeight:600},onClick:c,children:"Discard"})]})]})}):null}function jn({commitOpen:s,setCommitOpen:t,commitSelected:i,setCommitSelected:c,gitChanges:n,commitMessage:o,setCommitMessage:d,commitPush:b,setCommitPush:l,commitStatus:r,commitBusy:x,handleCommitSubmit:p}){return s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"modal",onClick:m=>m.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Commit & Push"}),e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Close"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Files (",i.size," selected)"]}),e.jsx("div",{className:"commit-files",children:n.map(m=>e.jsxs("label",{className:"commit-file-row",children:[e.jsx("input",{type:"checkbox",checked:i.has(m.path),onChange:$=>{c(R=>{const C=new Set(R);return $.target.checked?C.add(m.path):C.delete(m.path),C})}}),e.jsx("span",{className:`git-badge git-${m.status}`,children:m.status}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.path})]},m.path))})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Commit message"}),e.jsx("input",{type:"text",placeholder:"docs: update vault notes",value:o,onChange:m=>d(m.target.value)})]}),e.jsxs("label",{className:"toggle-row",children:[e.jsx("span",{children:"Push to remote after commit"}),e.jsx("input",{type:"checkbox",checked:b,onChange:m=>l(m.target.checked)})]}),r&&e.jsx("div",{className:"git-output",style:{color:r.ok?"var(--green)":"#f87171"},children:r.text})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Cancel"}),e.jsx("button",{className:"btn primary",disabled:x||!o.trim()||i.size===0,onClick:p,children:x?"Running...":b?"Commit & Push":"Commit"})]})]})}):null}function zt(s){return s.split(",").map(t=>t.trim().replace(/^\/+|\/+$/g,"")).filter(Boolean)}function vn({settingsOpen:s,setSettingsOpen:t,settingsTab:i,setSettingsTab:c,settings:n,setSettings:o,setCollapsed:d}){const[b,l]=u.useState(()=>n.autoCollapsed.join(", ")),[r,x]=u.useState(()=>n.hiddenFolders.join(", "));return u.useEffect(()=>{s&&(l(n.autoCollapsed.join(", ")),x(n.hiddenFolders.join(", ")))},[s]),s?e.jsx("div",{className:"modal-backdrop",onClick:()=>t(!1),children:e.jsxs("div",{className:"modal",onClick:p=>p.stopPropagation(),children:[e.jsxs("div",{className:"modal-head",children:[e.jsx("h2",{children:"Settings"}),e.jsx("button",{className:"btn",onClick:()=>t(!1),children:"Close"})]}),e.jsx("div",{className:"settings-tabs",children:[["general","General"],["appearance","Appearance"],["files","Files & Search"],["endpoints","API & MCP"]].map(([p,m])=>e.jsx("button",{className:`settings-tab${i===p?" active":""}`,onClick:()=>c(p),children:m},p))}),e.jsxs("div",{className:"modal-body",children:[i==="general"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"On startup / first open"}),e.jsxs("select",{value:n.startupMode,onChange:p=>o(m=>({...m,startupMode:p.target.value})),children:[e.jsx("option",{value:"readme",children:"README.md"}),e.jsx("option",{value:"last",children:"Last opened note"}),e.jsx("option",{value:"newtab",children:"New tab launcher"}),e.jsx("option",{value:"custom",children:"Custom note path"})]}),e.jsx("div",{className:"field-hint",children:"Used when opening the vault without a specific #note in the URL."})]}),n.startupMode==="custom"&&e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Custom startup note path"}),e.jsx("input",{type:"text",placeholder:"core/README.md",value:n.startupPath,onChange:p=>o(m=>({...m,startupPath:p.target.value}))})]})]}),i==="appearance"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Theme"}),e.jsxs("select",{value:n.theme,onChange:p=>o(m=>({...m,theme:p.target.value})),children:[e.jsx("option",{value:"dark",children:"Dark"}),e.jsx("option",{value:"light",children:"Light"})]})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Outline & Backlinks panel"}),e.jsxs("select",{value:n.outlinePosition,onChange:p=>o(m=>({...m,outlinePosition:p.target.value})),children:[e.jsx("option",{value:"right",children:"Right sidebar"}),e.jsx("option",{value:"bottom",children:"Bottom panel"}),e.jsx("option",{value:"hidden",children:"Hidden"})]})]}),e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Reader font size: ",n.fontSize,"px"]}),e.jsx("input",{type:"range",min:"13",max:"20",value:n.fontSize,onChange:p=>o(m=>({...m,fontSize:Number(p.target.value)}))})]}),e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Line height: ",n.lineHeight]}),e.jsx("input",{type:"range",min:"1.35",max:"2.0",step:"0.05",value:n.lineHeight,onChange:p=>o(m=>({...m,lineHeight:Number(p.target.value)}))})]}),e.jsxs("div",{className:"field",children:[e.jsxs("label",{children:["Max reading width: ",n.maxWidth,"px"]}),e.jsx("input",{type:"range",min:"580",max:"980",step:"20",value:n.maxWidth,onChange:p=>o(m=>({...m,maxWidth:Number(p.target.value)}))})]})]}),i==="files"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Auto-collapsed folders (comma-separated)"}),e.jsx("input",{type:"text",placeholder:"apps, templates",value:b,onChange:p=>{const m=p.target.value;l(m);const $=zt(m);o(R=>({...R,autoCollapsed:$})),d(new Set($))},onBlur:()=>l(n.autoCollapsed.join(", "))})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Hidden folders (hide from sidebar & search)"}),e.jsx("input",{type:"text",placeholder:"ideas, templates",value:r,onChange:p=>{const m=p.target.value;x(m);const $=zt(m);o(R=>({...R,hiddenFolders:$}))},onBlur:()=>x(n.hiddenFolders.join(", "))})]}),e.jsxs("label",{className:"toggle-row",children:[e.jsx("span",{children:"Hide auto-collapsed folders from Quick Switcher"}),e.jsx("input",{type:"checkbox",checked:n.hideCollapsedInSearch,onChange:p=>o(m=>({...m,hideCollapsedInSearch:p.target.checked}))})]})]}),i==="endpoints"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"REST API (v1)"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/health"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/tree"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/file?path=README.md"}),e.jsxs("div",{className:"endpoint-box",children:["PUT / POST / PATCH /api/v1/file — ","{ path, content, append? } or { path, target, replacement, replaceAll? }"]}),e.jsx("div",{className:"endpoint-box",children:"DELETE /api/v1/file?path=..."}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/search?q=python"}),e.jsx("div",{className:"endpoint-box",children:"GET /api/v1/events (SSE)"})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"MCP Endpoint (Streamable HTTP)"}),e.jsx("div",{className:"endpoint-box",children:"POST /mcp — tools: list_vault, read_note, search_vault, write_note, delete_note"})]})]})]}),e.jsxs("div",{className:"modal-foot",children:[e.jsx("button",{className:"btn",onClick:()=>{o(ne),d(new Set(ne.autoCollapsed)),l(ne.autoCollapsed.join(", ")),x(ne.hiddenFolders.join(", "))},children:"Reset defaults"}),e.jsx("button",{className:"btn primary",onClick:()=>t(!1),children:"Done"})]})]})}):null}function gn(){const[s,t]=u.useState([]),[i,c]=u.useState([]),[n,o]=u.useState([]),[d,b]=u.useState(0),[l,r]=u.useState({}),[x,p]=u.useState(_s),[m,$]=u.useState("general"),R=Us(x),[C,h]=u.useState(()=>[{id:"tab-1",path:R,title:Ve(R),preview:""}]),[v,S]=u.useState("tab-1"),L=C.find(a=>a.id===v)||C[0],f=(L==null?void 0:L.path)||"",[y,w]=u.useState(!1),[E,B]=u.useState(""),[W,U]=u.useState("preview"),[Me,pe]=u.useState(null),[G,V]=u.useState(null),[ae,Q]=u.useState(""),[Z,ee]=u.useState(null),[fe,I]=u.useState(""),[O,z]=u.useState(null),[H,Ae]=u.useState(null),[qt,Be]=u.useState(""),[Je,Pe]=u.useState(!1),[He,Ye]=u.useState(""),[Qe,Ze]=u.useState(""),[Xt,he]=u.useState(""),et=u.useRef(null),tt=u.useRef(""),[Gt,Vt]=u.useState(!1),[bn,xe]=u.useState(""),[Kt,je]=u.useState(!1),[Jt,st]=u.useState(!1),[Yt,Qt]=u.useState("files"),[ie,nt]=u.useState([]),[ve,Zt]=u.useState("path"),[at,it]=u.useState(!1),[Ie,lt]=u.useState(""),[ot,es]=u.useState(!1),[rt,ct]=u.useState(()=>new Set),[ts,dt]=u.useState(!1),[ss,me]=u.useState(null),[ge,ns]=u.useState(""),[as,ht]=u.useState(()=>new Set(x.autoCollapsed)),[is,mt]=u.useState(!0),[be,q]=u.useState(!1),[we,le]=u.useState(!1),[ut,pt]=u.useState(!1),[ft,We]=u.useState(!1),[K,ze]=u.useState(!1),[oe,ls]=u.useState("recent"),[J,xt]=u.useState(""),[os,jt]=u.useState(0),[vt,Ne]=u.useState([]),[ke,ye]=u.useState({items:[],hasMore:!1}),[rs,cs]=u.useState(0),ds=u.useRef(null),gt=u.useRef(null),te=u.useRef(null);u.useEffect(()=>{document.documentElement.setAttribute("data-theme",x.theme),localStorage.setItem("vault-settings",JSON.stringify(x))},[x]),u.useEffect(()=>{const a=j=>{var g;if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"){j.preventDefault(),Ce();return}j.key==="/"&&((g=document.activeElement)==null?void 0:g.tagName)!=="INPUT"&&(j.preventDefault(),Ce()),j.key==="Escape"&&K&&ze(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[K]);function Ce(){xt(""),jt(0),Ne([]),ze(!0),setTimeout(()=>{var a;return(a=gt.current)==null?void 0:a.focus()},40)}u.useEffect(()=>{if(!K)return;const a=J.trim();if(!a){Ne([]);return}const j=setTimeout(async()=>{try{const k=await(await fetch(`/api/v1/search?q=${encodeURIComponent(a)}`)).json();Ne(k.results||[])}catch{Ne([])}},150);return()=>clearTimeout(j)},[J,K]);const Se=u.useMemo(()=>new Set(x.hiddenFolders.map(a=>a.toLowerCase())),[x.hiddenFolders]),hs=u.useMemo(()=>{const a=[""],j=g=>{for(const k of g)if(k.type==="dir"){if(Se.has(k.path.toLowerCase())||Se.has(k.name.toLowerCase()))continue;a.push(k.path),j(k.children||[])}};return j(s),a},[s,Se]),re=d>n.length;u.useEffect(()=>{if(!K||!re){ye({items:[],hasMore:!1});return}const a=oe==="alpha"?"name":"mtime",j=J.trim(),g=setTimeout(async()=>{try{const N=await(await fetch(`/api/v1/files?sort=${a}&offset=0&limit=100&q=${encodeURIComponent(j)}`)).json();ye({items:N.items||[],hasMore:!!N.hasMore})}catch{ye({items:[],hasMore:!1})}},100);return()=>clearTimeout(g)},[K,re,oe,J]);async function ms(){const a=oe==="alpha"?"name":"mtime",j=J.trim(),g=ke.items.length,N=await(await fetch(`/api/v1/files?sort=${a}&offset=${g}&limit=100&q=${encodeURIComponent(j)}`)).json();ye(T=>({items:[...T.items,...N.items||[]],hasMore:!!N.hasMore}))}const bt=u.useMemo(()=>{const a=J.trim().toLowerCase(),j=D=>{const P=D.toLowerCase();return x.hiddenFolders.some(M=>P.startsWith(M.toLowerCase()+"/"))?!0:x.hideCollapsedInSearch?x.autoCollapsed.some(M=>{const Ue=M.toLowerCase()+"/";return P.startsWith(Ue)&&!a.includes(M.toLowerCase())}):!1},g=re?ke.items:n.length>0?n:i.map(D=>({path:D,mtimeMs:0})),k=new Map(g.map(D=>[D.path,D.mtimeMs||0]));let N;if(!a)N=g.filter(D=>!j(D.path)).map(D=>({path:D.path,mtimeMs:D.mtimeMs||0,snippet:""}));else{const D=g.filter(M=>!j(M.path)&&M.path.toLowerCase().includes(a)).map(M=>({path:M.path,mtimeMs:M.mtimeMs||0,snippet:""})),P=new Set(D.map(M=>M.path));for(const M of vt)!j(M.path)&&!P.has(M.path)&&(P.add(M.path),D.push({path:M.path,mtimeMs:M.mtimeMs??k.get(M.path)??0,snippet:M.snippet||""}));N=D}const T=re?N.length:100;if(oe==="alpha"){const D=[...N].sort((P,M)=>{const Ue=P.path.split("/").pop().toLowerCase(),Hs=M.path.split("/").pop().toLowerCase();return Ue.localeCompare(Hs)||P.path.localeCompare(M.path)}).slice(0,T);return{groups:[{label:null,items:D}],items:D}}const X=[...N].sort((D,P)=>(P.mtimeMs||0)-(D.mtimeMs||0)).slice(0,T),_=Date.now(),F=new Date(_);F.setHours(0,0,0,0);const Ee=F.getTime(),_e=864e5,de=new Map([["Today",[]],["Yesterday",[]],["Last 7 days",[]],["Last 30 days",[]],["Older",[]]]);for(const D of X){const P=D.mtimeMs||0;P>=Ee?de.get("Today").push(D):P>=Ee-_e?de.get("Yesterday").push(D):P>=Ee-7*_e?de.get("Last 7 days").push(D):P>=Ee-30*_e?de.get("Last 30 days").push(D):de.get("Older").push(D)}const Lt=[],Rt=[];for(const[D,P]of de)P.length>0&&(Lt.push({label:D,items:P}),Rt.push(...P));return{groups:Lt,items:Rt}},[J,oe,re,ke.items,n,i,vt,x.autoCollapsed,x.hiddenFolders,x.hideCollapsedInSearch]),us=bt.items;async function Y(){var k;const[a,j]=await Promise.all([fetch("/api/v1/tree?limit=10000"),fetch("/api/v1/changes")]),g=await a.json();if(t(g.tree),c(g.flatFiles),o(g.fileStats||[]),b(g.totalFiles??((k=g.flatFiles)==null?void 0:k.length)??0),r(g.backlinks),j.ok){const N=await j.json();nt(N.changes||[])}}function wt(){const a=`tab-${Date.now()}`;h(j=>[...j,{id:a,path:null,title:"New tab",preview:""}]),S(a),B(""),w(!1),q(!1),pt(!1)}function Nt(a,j){j==null||j.stopPropagation(),h(g=>{const k=g.filter(N=>N.id!==a);if(k.length===0){const N={id:`tab-${Date.now()}`,path:null,title:"New tab",preview:""};return S(N.id),B(""),[N]}if(a===v){const N=k[k.length-1];S(N.id),N.path?A(N.path,!1,N.id):B("")}return k})}function kt(a){S(a.id),w(!1),a.path?A(a.path,!1,a.id):(B(""),location.hash="")}async function A(a,j=!1,g=v){var X;if(!a){B("");return}const k=((X=te.current)==null?void 0:X.scrollTop)??0;let N="";if($e(a)&&!Mt(a)||Oe(a)||qe(a)||Xe(a)||Ge(a)){if(!(await fetch(`/api/v1/file?path=${encodeURIComponent(a)}`,{method:"HEAD"})).ok)return a!=="README.md"?A("README.md",!1,g):void 0;B(""),xe(""),je(!1),$e(a)?N="[Image preview]":Oe(a)?N="[PDF document]":qe(a)?N="[Audio]":Xe(a)?N="[Video]":N="[Binary file — download]"}else{const _=await fetch(`/api/v1/file?path=${encodeURIComponent(a)}`);if(!_.ok)return a!=="README.md"?A("README.md",!1,g):void 0;const F=await _.text();B(F),xe(F),je(!1),N=F.replace(/^#+\s*/gm,"").slice(0,260)}location.hash=encodeURIComponent(a),localStorage.setItem("vault-last-path",a),h(_=>_.map(F=>F.id===g?{...F,path:a,title:Ve(a),preview:N}:F)),j?requestAnimationFrame(()=>{te.current&&(te.current.scrollTop=k)}):(q(!1),requestAnimationFrame(()=>{te.current&&(te.current.scrollTop=0)})),W==="diff"&&ce(a)}async function ce(a=f){if(!a)return;const j=await fetch(`/api/v1/git/diff?path=${encodeURIComponent(a)}`);j.ok?pe(await j.json()):pe(null)}function yt({path:a=f,hunkIndex:j,lineIndex:g,previewText:k}={}){a&&(Q(""),V({path:a,hunkIndex:j,lineIndex:g,previewText:k}))}async function ps(){if(!(G!=null&&G.path))return;const{path:a,hunkIndex:j,lineIndex:g}=G,k=await fetch("/api/v1/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,hunkIndex:j,lineIndex:g})}),N=await k.json().catch(()=>({}));k.ok?(V(null),Q(""),await Y(),a===f&&(await A(f,!0),await ce(f))):Q(N.error||"Failed to discard")}async function fs(){if(!Z)return;I("");const a=await fetch(`/api/v1/file?path=${encodeURIComponent(Z)}`,{method:"DELETE"}),j=await a.json().catch(()=>({}));if(a.ok){const g=Z;ee(null),localStorage.getItem("vault-last-path")===g&&localStorage.removeItem("vault-last-path");const k=N=>N.filter(T=>!(T.type==="file"&&T.path===g)).map(T=>T.type==="dir"?{...T,children:k(T.children||[])}:T);if(t(N=>k(N)),c(N=>N.filter(T=>T!==g)),o(N=>N.filter(T=>T.path!==g)),nt(N=>N.filter(T=>T.path!==g)),g===f){U("preview");const N=C.filter(T=>T.path!==g);if(N.length>0){const T=N[N.length-1];h(N),S(T.id),T.path?await A(T.path,!1,T.id):(B(""),location.hash="")}else await A("README.md",!1,v)}else h(N=>N.filter(T=>T.path!==g));await Y()}else I(j.error||"Failed to delete file")}async function xs(a){var X;const j=Array.from(a||[]);if(!j.length)return;const g=tt.current||"",k=new FormData;k.append("dir",g);for(const _ of j)k.append("files",_);const N=await fetch("/api/v1/file/upload",{method:"POST",body:k}),T=await N.json().catch(()=>({}));if(N.ok&&(await Y(),((X=T.uploaded)==null?void 0:X.length)===1)){const _=T.uploaded[0].path;/\.(md|markdown|txt|png|jpe?g|gif|webp|svg|ico)$/i.test(_)&&A(_)}}async function js(){if(!(H!=null&&H.oldPath)||!(H!=null&&H.newPath.trim()))return;Be("");const a=H.type==="dir",j=a?"/api/v1/dir/rename":"/api/v1/file/rename",g=H.newPath.trim().replace(/^\/+|\/+$/g,""),k=await fetch(j,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:H.oldPath,newPath:g})}),N=await k.json().catch(()=>({}));if(k.ok){const{oldPath:T}=H;Ae(null),await Y(),a?f.startsWith(`${T}/`)&&A(`${g}${f.slice(T.length)}`):T===f&&A(g)}else Be(N.error||"Failed to rename")}function vs(a,j,g="file"){const k=window.innerWidth<=768?215:175,N=window.innerWidth<=768?310:250,T=Math.min(j.right-k,window.innerWidth-(k+12)),X=Math.min(j.bottom+4,window.innerHeight-N);z({type:g,path:a,x:Math.max(8,T),y:Math.max(8,X)})}function Ct(a=""){Ye(""),Ze(a.replace(/^\/+|\/+$/g,"")),he(""),Pe(!0)}async function gs(){const a=Ke(He,Qe);if(!a){he("Please enter a note title");return}if(i.includes(a)){he(`Already exists: ${a}`);return}he("");const j=He.trim().replace(/\.md$/i,""),g=await fetch("/api/v1/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,content:`# ${j}
|
|
5
|
-
|
|
6
|
-
`})}),k=await g.json().catch(()=>({}));if(!g.ok||k.error){he(k.error||"Failed to create note");return}Pe(!1),await Y(),U("edit"),A(a)}u.useEffect(()=>{Y(),A(f)},[]),u.useEffect(()=>{const a=()=>{const j=decodeURIComponent(location.hash.slice(1)||"");j&&j!==f&&A(j)};return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[f]),u.useEffect(()=>{const a=new EventSource("/api/v1/events");return a.onopen=()=>mt(!0),a.onmessage=async j=>{JSON.parse(j.data).type==="reload"&&(await Y(),cs(k=>k+1),await A(f,!0))},a.onerror=()=>mt(!1),()=>a.close()},[f]);async function bs(a){if(f){st(!0);try{(await fetch("/api/v1/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:f,content:a})})).ok&&(B(a),xe(a),je(!1))}finally{st(!1)}}}const{renderedHtml:ws,headings:Ns}=u.useMemo(()=>!Fe(f)||W!=="preview"||$e(f)||Ge(f)?{renderedHtml:"",headings:[]}:Xs(E,f,i),[E,f,W,i]),ks=u.useMemo(()=>!E||W!=="raw"&&Fe(f)?"":Gs(E,f),[E,f,W]);function ys(a){const j=a.target.closest("a.wikilink");if(j){a.preventDefault(),A(j.dataset.path);return}const g=a.target.closest("a.md-rel-link");if(g){a.preventDefault();const k=_t(f,g.dataset.href);i.includes(k)&&A(k)}}function Cs(a){ht(j=>{const g=new Set(j);return g.has(a)?g.delete(a):g.add(a),g})}const Ss=u.useMemo(()=>{const j=[...ie.filter(g=>!ge||g.path.toLowerCase().includes(ge))];return ve==="recent"?j.sort((g,k)=>(k.mtimeMs||0)-(g.mtimeMs||0)||g.path.localeCompare(k.path)):ve==="status"?j.sort((g,k)=>g.status.localeCompare(k.status)||g.path.localeCompare(k.path)):j.sort((g,k)=>g.path.localeCompare(k.path)),j},[ie,ge,ve]);function Es(){ct(new Set(ie.map(a=>a.path))),lt(""),me(null),it(!0)}async function $s(){if(Ie.trim()){dt(!0),me(null);try{const a=await fetch("/api/v1/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:Ie.trim(),files:Array.from(rt),push:ot})}),j=await a.json();!a.ok||j.error?me({ok:!1,text:j.error||"Commit failed"}):(me({ok:!0,text:j.output||"Committed successfully"}),await Y())}catch(a){me({ok:!1,text:a.message})}finally{dt(!1)}}}const Ts=l[f]||[],St=$e(f),Ls=Mt(f),Rs=Fe(f),Ds=Oe(f),Ms=qe(f),As=Xe(f),Bs=Fs(f),Ps=Os(f),Et=Ge(f),se=x.outlinePosition||"right",ue=a=>p(j=>({...j,outlinePosition:a})),$t=()=>{ue("right"),window.innerWidth<=960&&(q(!1),le(!0))},Tt=()=>{window.innerWidth<=960?se==="bottom"?(ue("hidden"),le(!1)):(se==="hidden"&&ue("right"),q(!1),le(a=>!a)):ue(se==="hidden"?"right":"hidden")};return Ys({drawerOpen:be,outlineDrawerOpen:we,outlinePosition:se,setDrawerOpen:q,onOpenOutline:$t,setOutlineDrawerOpen:le,disabled:!!(K||ft||y||at||ut||Je||H||Z||G)}),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`backdrop${be||we?" open":""}`,onClick:()=>{q(!1),le(!1)}}),e.jsxs("div",{className:"app",children:[e.jsx(Zs,{drawerOpen:be,live:is,settings:x,setSettings:p,sidebarTab:Yt,setSidebarTab:Qt,gitChanges:ie,searchRef:ds,filter:ge,setFilter:ns,tree:s,activePath:f,collapsed:as,hiddenSet:Se,toggleDir:Cs,setViewMode:U,openFile:A,openRowMenu:vs,changesSort:ve,setChangesSort:Zt,openCommitDialog:Es,sortedChanges:Ss,loadDiff:ce}),e.jsxs("main",{className:"main",children:[e.jsx(en,{tabs:C,activeTabId:v,switchTab:kt,closeTab:Nt,createNewTab:wt}),e.jsxs("div",{className:`workspace-body outline-${se}`,children:[e.jsxs("div",{className:"note-pane",children:[e.jsx(tn,{setDrawerOpen:q,activePath:f,moreMenuOpen:Gt,setMoreMenuOpen:Vt,viewMode:W,setViewMode:U,loadDiff:ce,setDeleteError:I,setDeleteTarget:ee,outlinePosition:se,outlineDrawerOpen:we,onToggleOutline:Tt,onOpenOutline:$t}),e.jsx(rn,{scrollRef:te,activePath:f,openNewNoteDialog:Ct,openFile:A,openSwitcher:Ce,setDrawerOpen:q,setSettingsOpen:We,isImg:St,isSvg:Ls,isMarkdown:Rs,isPdf:Ds,isAudio:Ms,isVideo:As,isHtml:Bs,isCsv:Ps,reloadTick:rs,isBinaryDownload:Et,viewMode:W,settings:x,diffData:Me,requestDiscard:yt,content:E,saving:Jt,dirty:Kt,setDraftContent:xe,setDirty:je,saveActiveNote:bs,highlightedRawHtml:ks,handleDocClick:ys,renderedHtml:ws})]}),e.jsx(cn,{headings:Ns,isImg:St,isBinaryDownload:Et,viewMode:W,currentBacklinks:Ts,openFile:A,position:se,onChangePosition:ue,mobileOpen:we,onCloseMobile:()=>le(!1)})]})]})]}),e.jsx(dn,{fabOpen:ut,setFabOpen:pt,openSwitcher:Ce,drawerOpen:be,setDrawerOpen:q,onToggleOutline:Tt,openFile:A,viewMode:W,setViewMode:U,settings:x,setSettings:p,setSettingsOpen:We,scrollRef:te,loadDiff:ce,activePath:f,createNewTab:wt,tabsOpen:y,setTabsOpen:w,tabs:C,activeTabId:v,switchTab:kt,closeTab:Nt}),e.jsx(hn,{switcherOpen:K,setSwitcherOpen:ze,switcherTab:oe,setSwitcherTab:ls,switcherIdx:os,setSwitcherIdx:jt,switcherInputRef:gt,totalFiles:d,fileStats:n,switcherItems:us,switcherData:bt,openFile:A,isLargeVault:re,pagedFiles:ke,loadMorePagedFiles:ms,switcherQuery:J,setSwitcherQuery:xt}),e.jsx("input",{ref:et,type:"file",multiple:!0,style:{display:"none"},onChange:a=>{xs(a.target.files),a.target.value=""}}),e.jsx(mn,{fileMenu:O,setFileMenu:z,openNewNoteDialog:Ct,uploadDirRef:tt,uploadInputRef:et,setRenameError:Be,setRenameTarget:Ae,setTabs:h,setActiveTabId:S,setViewMode:U,openFile:A,gitChanges:ie,loadDiff:ce,requestDiscard:yt,setDeleteError:I,setDeleteTarget:ee}),e.jsx(un,{newNoteOpen:Je,setNewNoteOpen:Pe,newNoteTitle:He,setNewNoteTitle:Ye,newNoteFolder:Qe,setNewNoteFolder:Ze,allFolders:hs,newNoteError:Xt,confirmNewNote:gs}),e.jsx(pn,{renameTarget:H,setRenameTarget:Ae,renameError:qt,confirmRenameFile:js}),e.jsx(fn,{deleteTarget:Z,setDeleteTarget:ee,deleteError:fe,confirmDeleteFile:fs}),e.jsx(xn,{discardTarget:G,setDiscardTarget:V,discardError:ae,confirmDiscard:ps}),e.jsx(jn,{commitOpen:at,setCommitOpen:it,commitSelected:rt,setCommitSelected:ct,gitChanges:ie,commitMessage:Ie,setCommitMessage:lt,commitPush:ot,setCommitPush:es,commitStatus:ss,commitBusy:ts,handleCommitSubmit:$s}),e.jsx(vn,{settingsOpen:ft,setSettingsOpen:We,settingsTab:m,setSettingsTab:$,settings:x,setSettings:p,setCollapsed:ht})]})}Ws.createRoot(document.getElementById("root")).render(e.jsx(gn,{}));
|