wiki-viewer 1.8.3 → 1.9.0
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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__00lep-u._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__00qu86p._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__036mhjp._.js +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__05t~v6l._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__09cqzem._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0_601._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ae3dk6._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d7x3e1._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e7vs98._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fxzg4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gda_iu._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0hu~q20._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l-8clq._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0otb8ra._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0p0-p__._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0piofm3._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rrf-jr._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s6_lzw._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sh13v5._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ta~flu._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0v4im4p._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vatqe-._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vdb2nr._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__123._fe._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1377.79._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1378-ox._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__13hp4tw._.js +2 -2
- package/.next/standalone/.next/server/chunks/node_modules__pnpm_0aj5g-w._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0pqaawz._.js +1 -1
- package/.next/standalone/.next/server/edge/chunks/0p91_next_dist_0nh.6nc._.js +2 -2
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/middleware-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/static/chunks/{0d~o0h0ssgra7.js → 125_k3o0s4cid.js} +1 -1
- package/.next/standalone/README.md +4 -3
- package/.next/standalone/bin/wiki-viewer.js +6 -3
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/src/app/page.tsx +8 -6
- package/.next/standalone/src/lib/auth/admin.ts +8 -0
- package/.next/standalone/src/lib/workspace-context.ts +13 -0
- package/.next/standalone/src/middleware.ts +5 -0
- package/.next/standalone/src/stores/pin-store.ts +1 -0
- package/.next/standalone/src/stores/recent-store.ts +1 -0
- package/.next/standalone/tsconfig.tsbuildinfo +1 -1
- package/README.md +4 -3
- package/bin/wiki-viewer.js +6 -3
- package/package.json +1 -1
- /package/.next/standalone/.next/static/{Pkj31aCfRVk0Zy2rKA1wf → YQHDns_jLqFd_bbnLafs0}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{Pkj31aCfRVk0Zy2rKA1wf → YQHDns_jLqFd_bbnLafs0}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{Pkj31aCfRVk0Zy2rKA1wf → YQHDns_jLqFd_bbnLafs0}/_ssgManifest.js +0 -0
|
@@ -7,9 +7,9 @@ globalThis.__BUILD_MANIFEST = {
|
|
|
7
7
|
"static/chunks/03~yq9q893hmn.js"
|
|
8
8
|
],
|
|
9
9
|
"lowPriorityFiles": [
|
|
10
|
-
"static/
|
|
11
|
-
"static/
|
|
12
|
-
"static/
|
|
10
|
+
"static/YQHDns_jLqFd_bbnLafs0/_buildManifest.js",
|
|
11
|
+
"static/YQHDns_jLqFd_bbnLafs0/_ssgManifest.js",
|
|
12
|
+
"static/YQHDns_jLqFd_bbnLafs0/_clientMiddlewareManifest.js"
|
|
13
13
|
],
|
|
14
14
|
"rootMainFiles": [
|
|
15
15
|
"static/chunks/0ocp.6r7w_saw.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"wasm": [],
|
|
20
20
|
"assets": [],
|
|
21
21
|
"env": {
|
|
22
|
-
"__NEXT_BUILD_ID": "
|
|
22
|
+
"__NEXT_BUILD_ID": "YQHDns_jLqFd_bbnLafs0",
|
|
23
23
|
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "gd9VieOH2QNTXQqx/YwRTjjD3FcJAdLmkNlJmMeKqqc=",
|
|
24
24
|
"__NEXT_PREVIEW_MODE_ID": "0f414c3745367a780bbeef59b5fbad98",
|
|
25
25
|
"__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "cd89de44248cc24f172ca51d8ef8cb8a68e06cf2b1e7520dfecb7e9632546eeb",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/167ph4xws_-61.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0ocp.6r7w_saw.js"/><script src="/_next/static/chunks/0quh-cfcrp2ib.js" async=""></script><script src="/_next/static/chunks/06iw_iy5e90d4.js" async=""></script><script src="/_next/static/chunks/turbopack-0lf4~b-ofzbm6.js" async=""></script><script src="/_next/static/chunks/0umlolnxs~j3r.js" async=""></script><script src="/_next/static/chunks/057umwogp53v_.js" async=""></script><script src="/_next/static/chunks/0ky8fha87kp0_.js" async=""></script><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><meta name="theme-color" content="#0c0a09"/><title>Wiki Viewer</title><meta name="description" content="Local file browser, viewer, and editor"/><link rel="manifest" href="/manifest.webmanifest"/><meta name="mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-title" content="Wiki"/><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/><link rel="icon" href="/icon-192.png"/><link rel="apple-touch-icon" href="/icon-192.png"/><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body class="inter_5901b7c6-module__ec5Qua__variable font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><script>((a,b,c,d,e,f,g,h)=>{let i=document.documentElement,j=["light","dark"];function k(b){var c;(Array.isArray(a)?a:[a]).forEach(a=>{let c="class"===a,d=c&&f?e.map(a=>f[a]||a):e;c?(i.classList.remove(...d),i.classList.add(f&&f[b]?f[b]:b)):i.setAttribute(a,b)}),c=b,h&&j.includes(c)&&(i.style.colorScheme=c)}if(d)k(d);else try{let a=localStorage.getItem(b)||c,d=g&&"system"===a?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a;k(d)}catch(a){}})("class","theme","system",null,["light","dark"],null,true,true)</script><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><section aria-label="Notifications alt+T" tabindex="-1" aria-live="polite" aria-relevant="additions text" aria-atomic="false"></section><script src="/_next/static/chunks/0ocp.6r7w_saw.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[427423,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"ThemeProvider\"]\n3:I[902063,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\"]\n4:I[259666,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\"]\n5:I[187014,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"Toaster\"]\n6:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"OutletBoundary\"]\n7:\"$Sreact.suspense\"\na:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"ViewportBoundary\"]\nc:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"MetadataBoundary\"]\ne:I[514743,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\",1]\n:HL[\"/_next/static/chunks/167ph4xws_-61.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",16],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/167ph4xws_-61.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/0umlolnxs~j3r.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/057umwogp53v_.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/_next/static/chunks/0ky8fha87kp0_.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[\"$\",\"body\",null,{\"className\":\"inter_5901b7c6-module__ec5Qua__variable font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"children\":[[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],[\"$\",\"$L5\",null,{\"theme\":\"system\",\"position\":\"bottom-right\",\"toastOptions\":{\"className\":\"border-border bg-card text-card-foreground\"}}]]}]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@8\"}]}]]}],{},null,false,null]},null,false,\"$@9\"]},null,false,null],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Ld\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$e\",[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/167ph4xws_-61.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"Pkj31aCfRVk0Zy2rKA1wf\"}\n"])</script><script>self.__next_f.push([1,"f:[]\n9:\"$Wf\"\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"2\",{\"name\":\"theme-color\",\"content\":\"#0c0a09\"}]]\n"])</script><script>self.__next_f.push([1,"10:I[319772,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"IconMark\"]\n8:null\nd:[[\"$\",\"title\",\"0\",{\"children\":\"Wiki Viewer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Local file browser, viewer, and editor\"}],[\"$\",\"link\",\"2\",{\"rel\":\"manifest\",\"href\":\"/manifest.webmanifest\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"meta\",\"3\",{\"name\":\"mobile-web-app-capable\",\"content\":\"yes\"}],[\"$\",\"meta\",\"4\",{\"name\":\"apple-mobile-web-app-title\",\"content\":\"Wiki\"}],[\"$\",\"meta\",\"5\",{\"name\":\"apple-mobile-web-app-status-bar-style\",\"content\":\"black-translucent\"}],[\"$\",\"link\",\"6\",{\"rel\":\"icon\",\"href\":\"/icon-192.png\"}],[\"$\",\"link\",\"7\",{\"rel\":\"apple-touch-icon\",\"href\":\"/icon-192.png\"}],[\"$\",\"$L10\",\"8\",{}]]\n"])</script></body></html>
|
|
1
|
+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/167ph4xws_-61.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0ocp.6r7w_saw.js"/><script src="/_next/static/chunks/0quh-cfcrp2ib.js" async=""></script><script src="/_next/static/chunks/06iw_iy5e90d4.js" async=""></script><script src="/_next/static/chunks/turbopack-0lf4~b-ofzbm6.js" async=""></script><script src="/_next/static/chunks/0umlolnxs~j3r.js" async=""></script><script src="/_next/static/chunks/057umwogp53v_.js" async=""></script><script src="/_next/static/chunks/0ky8fha87kp0_.js" async=""></script><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><meta name="theme-color" content="#0c0a09"/><title>Wiki Viewer</title><meta name="description" content="Local file browser, viewer, and editor"/><link rel="manifest" href="/manifest.webmanifest"/><meta name="mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-title" content="Wiki"/><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/><link rel="icon" href="/icon-192.png"/><link rel="apple-touch-icon" href="/icon-192.png"/><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body class="inter_5901b7c6-module__ec5Qua__variable font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><script>((a,b,c,d,e,f,g,h)=>{let i=document.documentElement,j=["light","dark"];function k(b){var c;(Array.isArray(a)?a:[a]).forEach(a=>{let c="class"===a,d=c&&f?e.map(a=>f[a]||a):e;c?(i.classList.remove(...d),i.classList.add(f&&f[b]?f[b]:b)):i.setAttribute(a,b)}),c=b,h&&j.includes(c)&&(i.style.colorScheme=c)}if(d)k(d);else try{let a=localStorage.getItem(b)||c,d=g&&"system"===a?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a;k(d)}catch(a){}})("class","theme","system",null,["light","dark"],null,true,true)</script><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><section aria-label="Notifications alt+T" tabindex="-1" aria-live="polite" aria-relevant="additions text" aria-atomic="false"></section><script src="/_next/static/chunks/0ocp.6r7w_saw.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[427423,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"ThemeProvider\"]\n3:I[902063,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\"]\n4:I[259666,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\"]\n5:I[187014,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"Toaster\"]\n6:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"OutletBoundary\"]\n7:\"$Sreact.suspense\"\na:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"ViewportBoundary\"]\nc:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"MetadataBoundary\"]\ne:I[514743,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\",1]\n:HL[\"/_next/static/chunks/167ph4xws_-61.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",16],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/167ph4xws_-61.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/0umlolnxs~j3r.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/057umwogp53v_.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/_next/static/chunks/0ky8fha87kp0_.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[\"$\",\"body\",null,{\"className\":\"inter_5901b7c6-module__ec5Qua__variable font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"children\":[[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],[\"$\",\"$L5\",null,{\"theme\":\"system\",\"position\":\"bottom-right\",\"toastOptions\":{\"className\":\"border-border bg-card text-card-foreground\"}}]]}]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@8\"}]}]]}],{},null,false,null]},null,false,\"$@9\"]},null,false,null],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Ld\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$e\",[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/167ph4xws_-61.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"YQHDns_jLqFd_bbnLafs0\"}\n"])</script><script>self.__next_f.push([1,"f:[]\n9:\"$Wf\"\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"2\",{\"name\":\"theme-color\",\"content\":\"#0c0a09\"}]]\n"])</script><script>self.__next_f.push([1,"10:I[319772,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"IconMark\"]\n8:null\nd:[[\"$\",\"title\",\"0\",{\"children\":\"Wiki Viewer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Local file browser, viewer, and editor\"}],[\"$\",\"link\",\"2\",{\"rel\":\"manifest\",\"href\":\"/manifest.webmanifest\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"meta\",\"3\",{\"name\":\"mobile-web-app-capable\",\"content\":\"yes\"}],[\"$\",\"meta\",\"4\",{\"name\":\"apple-mobile-web-app-title\",\"content\":\"Wiki\"}],[\"$\",\"meta\",\"5\",{\"name\":\"apple-mobile-web-app-status-bar-style\",\"content\":\"black-translucent\"}],[\"$\",\"link\",\"6\",{\"rel\":\"icon\",\"href\":\"/icon-192.png\"}],[\"$\",\"link\",\"7\",{\"rel\":\"apple-touch-icon\",\"href\":\"/icon-192.png\"}],[\"$\",\"$L10\",\"8\",{}]]\n"])</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0ocp.6r7w_saw.js"/><script src="/_next/static/chunks/0quh-cfcrp2ib.js" async=""></script><script src="/_next/static/chunks/06iw_iy5e90d4.js" async=""></script><script src="/_next/static/chunks/turbopack-0lf4~b-ofzbm6.js" async=""></script><script src="/_next/static/chunks/057umwogp53v_.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><link rel="manifest" href="/manifest.webmanifest"/><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/0ocp.6r7w_saw.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[902063,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n3:I[259666,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n4:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"ViewportBoundary\"]\na:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"MetadataBoundary\"]\nc:I[514743,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"
|
|
1
|
+
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0ocp.6r7w_saw.js"/><script src="/_next/static/chunks/0quh-cfcrp2ib.js" async=""></script><script src="/_next/static/chunks/06iw_iy5e90d4.js" async=""></script><script src="/_next/static/chunks/turbopack-0lf4~b-ofzbm6.js" async=""></script><script src="/_next/static/chunks/057umwogp53v_.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><link rel="manifest" href="/manifest.webmanifest"/><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/0ocp.6r7w_saw.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[902063,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n3:I[259666,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n4:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"ViewportBoundary\"]\na:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"MetadataBoundary\"]\nc:I[514743,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"YQHDns_jLqFd_bbnLafs0\"}\n"])</script><script>self.__next_f.push([1,"d:[]\n7:\"$Wd\"\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\nb:[[\"$\",\"link\",\"0\",{\"rel\":\"manifest\",\"href\":\"/manifest.webmanifest\",\"crossOrigin\":\"$undefined\"}]]\n"])</script></body></html>
|
|
@@ -126,4 +126,4 @@ TOKEN=<paste token here>
|
|
|
126
126
|
# 3. Read snapshot
|
|
127
127
|
curl -s -H "Authorization: Bearer $TOKEN" \\
|
|
128
128
|
-H "X-Agent-Id: ai:claude" \\
|
|
129
|
-
${t}/api/agent/files/${e??"<path/to/file.md>"}`;await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1500)},[e])}}(e??null),[l,c]=(0,Q.useState)(""),d=(0,Q.useRef)(null),u=window.location.origin,p=(0,Q.useCallback)(()=>Df,[]),h=(0,Q.useCallback)(()=>l.replace(/\$WIKI_URL/g,u),[l,u]),f=(0,Q.useCallback)(()=>`npx wiki-viewer-mcp register --url ${u} --id ai:myagent --name "My Agent"`,[u]),m=(0,Q.useCallback)(()=>JSON.stringify({servers:{"wiki-viewer":{command:"npx",args:["wiki-viewer-mcp"],env:{WIKI_VIEWER_URL:u,WIKI_VIEWER_TOKEN:"<token from register>",WIKI_VIEWER_AGENT_ID:"ai:myagent"}}}},null,2),[u]),g=Dm(p),b=Dm(h),y=Dm(f),x=Dm(m);return((0,Q.useEffect)(()=>{if(t)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&n()}},[t,n]),(0,Q.useEffect)(()=>{t&&d.current?.focus()},[t]),(0,Q.useEffect)(()=>{if(!t)return;s();let e=setInterval(()=>void s(),1e4);return()=>clearInterval(e)},[t,s]),(0,Q.useEffect)(()=>{t&&fetch("/api/agents/install").then(e=>e.json()).then(e=>{e.bootstrapPrompt&&c(e.bootstrapPrompt)}).catch(()=>void 0)},[t]),t)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-[1px]",onClick:n,"aria-hidden":!0}),(0,X.jsxs)("aside",{ref:d,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"AI Agent Panel",className:"fixed right-0 top-0 bottom-0 z-50 flex w-80 flex-col border-l border-border bg-background shadow-xl outline-none",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)(ei,{className:"h-4 w-4 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-semibold",children:"AI Agent"})]}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:n,title:"Close panel (Esc)",children:(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-5 px-4 py-4",children:[(0,X.jsxs)("section",{className:"rounded-md border border-border bg-muted/30 p-3",children:[(0,X.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Work with this wiki using AI"}),(0,X.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:["Connect Claude, Cursor, ChatGPT, and more. Pick by what you want — each option gives a copy-paste setup. You approve every assistant in ",(0,X.jsx)("span",{className:"font-medium text-foreground/80",children:"Agents"})," below before it gets access."]})]}),(0,X.jsxs)("section",{className:"space-y-3",children:[(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsx)("p",{className:"text-xs font-semibold text-foreground",children:"Co-write docs with you"}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Edits arrive as suggestions with comments you accept or revert. No MCP needed."}),(0,X.jsx)(tX,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void b.copy(),disabled:!l,children:b.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"})," Paste into any chatbot"]})}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 pt-1",children:["Or install once so it sticks"," ",(0,X.jsx)("span",{className:"text-muted-foreground/40",children:"· Claude, OpenCode"}),":"]}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:Df}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void g.copy(),children:g.copied?(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(el,{className:"h-3.5 w-3.5"})})]})]}),(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsxs)("p",{className:"text-xs font-semibold text-foreground",children:["Edit files directly"," ",(0,X.jsx)("span",{className:"font-normal text-muted-foreground/60",children:"· Claude Code, Cursor, Codex"})]}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Native read / search / edit tools over MCP. Run to request access:"}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:f()}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void y.copy(),children:y.copied?(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(el,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50",children:["Approve in ",(0,X.jsx)("span",{className:"font-medium text-foreground/70",children:"Agents"}),", then add to your tool:"]}),(0,X.jsx)(tX,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void x.copy(),children:x.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"})," Copy config (mcp.json)"]})})]}),(0,X.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:"For developers:"}),(0,X.jsxs)("button",{type:"button",onClick:()=>void a(),className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[o?(0,X.jsx)(es,{className:"h-3 w-3 text-green-500"}):(0,X.jsx)(el,{className:"h-3 w-3"})," curl example"]}),(0,X.jsxs)("a",{href:"/api/agents/skill",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kb,{className:"h-3 w-3"})," skill"]}),(0,X.jsxs)("a",{href:"/api/agents/install",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kb,{className:"h-3 w-3"})," install JSON"]})]})]}),(0,X.jsx)(Dp,{}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:["Active Connections"," ",(0,X.jsx)("span",{className:"normal-case font-normal text-muted-foreground/50",children:"(last 5 min)"})]}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 p-3",children:0===i.length?(0,X.jsxs)("p",{className:"text-xs text-muted-foreground/60 flex items-center gap-1.5",children:[(0,X.jsx)(Di,{className:"h-3.5 w-3.5"}),"No recent activity"]}):(0,X.jsx)("ul",{className:"space-y-1.5",children:i.map(e=>(0,X.jsxs)("li",{className:"flex items-center justify-between text-xs",children:[(0,X.jsx)("span",{className:"font-mono text-foreground/80 truncate",children:e.by}),(0,X.jsxs)("span",{className:"text-muted-foreground shrink-0",children:[e.opCount," op",1!==e.opCount?"s":""]})]},e.by))})})]}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Recent Activity"}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-1 max-h-72 overflow-y-auto",children:0===r.length?(0,X.jsx)("p",{className:"text-xs text-muted-foreground/60 py-2",children:"No events recorded"}):r.map(e=>(0,X.jsx)(Dh,{event:e},`${e.path}-${e.id}`))})]}),(0,X.jsx)("section",{children:(0,X.jsx)("a",{href:"/docs/agent-collab-plan.md",target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline hover:no-underline",children:"Agent collaboration docs →"})})]})]})]}):null}var Db=/[\\\/_+.#"@\[\(\{&]/,Dy=/[\\\/_+.#"@\[\(\{&]/g,Dx=/[\s-]/,Dv=/[\s-]/g;function Dw(e){return e.toLowerCase().replace(Dv," ")}var DE='[cmdk-group=""]',Dk='[cmdk-group-items=""]',DT='[cmdk-item=""]',DN=`${DT}:not([aria-disabled="true"])`,DA="cmdk-item-select",DS="data-value",DC=(e,t,n)=>{var r;return r=e,function e(t,n,r,i,s,o,a){if(o===n.length)return s===t.length?1:.99;var l=`${s},${o}`;if(void 0!==a[l])return a[l];for(var c,d,u,p,h=i.charAt(o),f=r.indexOf(h,s),m=0;f>=0;)(c=e(t,n,r,i,f+1,o+1,a))>m&&(f===s?c*=1:Db.test(t.charAt(f-1))?(c*=.8,(u=t.slice(s,f-1).match(Dy))&&s>0&&(c*=Math.pow(.999,u.length))):Dx.test(t.charAt(f-1))?(c*=.9,(p=t.slice(s,f-1).match(Dv))&&s>0&&(c*=Math.pow(.999,p.length))):(c*=.17,s>0&&(c*=Math.pow(.999,f-s))),t.charAt(f)!==n.charAt(o)&&(c*=.9999)),(c<.1&&r.charAt(f-1)===i.charAt(o+1)||i.charAt(o+1)===i.charAt(o)&&r.charAt(f-1)!==i.charAt(o))&&.1*(d=e(t,n,r,i,f+1,o+2,a))>c&&(c=.1*d),c>m&&(m=c),f=r.indexOf(h,f+1);return a[l]=m,m}(r=n&&n.length>0?`${r+" "+n.join(" ")}`:r,t,Dw(r),Dw(t),0,0,{})},D_=Q.createContext(void 0),DM=Q.createContext(void 0),DO=Q.createContext(void 0),DI=Q.forwardRef((e,t)=>{let n=Dz(()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Dz(()=>new Set),i=Dz(()=>new Map),s=Dz(()=>new Map),o=Dz(()=>new Set),a=DH(e),{label:l,children:c,value:d,onValueChange:u,filter:p,shouldFilter:h,loop:f,disablePointerSelection:m=!1,vimBindings:g=!0,...b}=e,y=t2(),x=t2(),v=t2(),w=Q.useRef(null),E=Dq();DU(()=>{if(void 0!==d){let e=d.trim();n.current.value=e,k.emit()}},[d]),DU(()=>{E(6,_)},[]);let k=Q.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,s,o,l;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)C(),A(),E(1,S);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(v);e?e.focus():null==(i=document.getElementById(y))||i.focus()}if(E(7,()=>{var e;n.current.selectedItemId=null==(e=M())?void 0:e.id,k.emit()}),r||E(5,_),(null==(s=a.current)?void 0:s.value)!==void 0){null==(l=(o=a.current).onValueChange)||l.call(o,null!=t?t:"");return}}k.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=Q.useMemo(()=>({value:(e,t,r)=>{var i;t!==(null==(i=s.current.get(e))?void 0:i.value)&&(s.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,N(t,r)),E(2,()=>{A(),k.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),E(3,()=>{C(),A(),n.current.value||S(),k.emit()}),()=>{s.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();E(4,()=>{C(),(null==t?void 0:t.getAttribute("id"))===e&&S(),k.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{s.current.delete(e),i.current.delete(e)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:y,inputId:v,labelId:x,listInnerRef:w}),[]);function N(e,t){var r,i;let s=null!=(i=null==(r=a.current)?void 0:r.filter)?i:DC;return e?s(e,n.current.search,t):0}function A(){if(!n.current.search||!1===a.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),s=0;r.forEach(t=>{s=Math.max(e.get(t),s)}),t.push([n,s])});let r=w.current;O().sort((t,n)=>{var r,i;let s=t.getAttribute("id"),o=n.getAttribute("id");return(null!=(r=e.get(o))?r:0)-(null!=(i=e.get(s))?i:0)}).forEach(e=>{let t=e.closest(Dk);t?t.appendChild(e.parentElement===t?e:e.closest(`${Dk} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Dk} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let n=null==(t=w.current)?void 0:t.querySelector(`${DE}[${DS}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)})}function S(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(DS);k.setState("value",t||void 0)}function C(){var e,t,o,l;if(!n.current.search||!1===a.current.shouldFilter){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let c=0;for(let i of r.current){let r=N(null!=(t=null==(e=s.current.get(i))?void 0:e.value)?t:"",null!=(l=null==(o=s.current.get(i))?void 0:o.keywords)?l:[]);n.current.filtered.items.set(i,r),r>0&&c++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=c}function _(){var e,t,n;let r=M();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(DE))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function M(){var e;return null==(e=w.current)?void 0:e.querySelector(`${DT}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=w.current)?void 0:e.querySelectorAll(DN))||[])}function I(e){let t=O()[e];t&&k.setState("value",t.getAttribute(DS))}function D(e){var t;let n=M(),r=O(),i=r.findIndex(e=>e===n),s=r[i+e];null!=(t=a.current)&&t.loop&&(s=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),s&&k.setState("value",s.getAttribute(DS))}function R(e){let t=M(),n=null==t?void 0:t.closest(DE),r;for(;n&&!r;)r=null==(n=e>0?function(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}(n,DE):function(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}(n,DE))?void 0:n.querySelector(DN);r?k.setState("value",r.getAttribute(DS)):D(e)}let L=()=>I(O().length-1),j=e=>{e.preventDefault(),e.metaKey?L():e.altKey?R(1):D(1)},P=e=>{e.preventDefault(),e.metaKey?I(0):e.altKey?R(-1):D(-1)};return Q.createElement(kL.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=b.onKeyDown)||t.call(b,e);let n=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||n))switch(e.key){case"n":case"j":g&&e.ctrlKey&&j(e);break;case"ArrowDown":j(e);break;case"p":case"k":g&&e.ctrlKey&&P(e);break;case"ArrowUp":P(e);break;case"Home":e.preventDefault(),I(0);break;case"End":e.preventDefault(),L();break;case"Enter":{e.preventDefault();let t=M();if(t){let e=new Event(DA);t.dispatchEvent(e)}}}}},Q.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:DW},l),DV(e,e=>Q.createElement(DM.Provider,{value:k},Q.createElement(D_.Provider,{value:T},e))))}),DD=Q.forwardRef((e,t)=>{var n,r;let i=t2(),s=Q.useRef(null),o=Q.useContext(DO),a=Q.useContext(D_),l=DH(e),c=null!=(r=null==(n=l.current)?void 0:n.forceMount)?r:null==o?void 0:o.forceMount;DU(()=>{if(!c)return a.item(i,null==o?void 0:o.id)},[c]);let d=DG(i,s,[e.value,e.children,s],e.keywords),u=Q.useContext(DM),p=D$(e=>e.value&&e.value===d.current),h=D$(e=>!!c||!1===a.filter()||!e.search||e.filtered.items.get(i)>0);function f(){var e,t;m(),null==(t=(e=l.current).onSelect)||t.call(e,d.current)}function m(){u.setState("value",d.current,!0)}if(Q.useEffect(()=>{let t=s.current;if(!(!t||e.disabled))return t.addEventListener(DA,f),()=>t.removeEventListener(DA,f)},[h,e.onSelect,e.disabled]),!h)return null;let{disabled:g,value:b,onSelect:y,forceMount:x,keywords:v,...w}=e;return Q.createElement(kL.div,{ref:eL(s,t),...w,id:i,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!p,"data-disabled":!!g,"data-selected":!!p,onPointerMove:g||a.getDisablePointerSelection()?void 0:m,onClick:g?void 0:f},e.children)}),DR=Q.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...s}=e,o=t2(),a=Q.useRef(null),l=Q.useRef(null),c=t2(),d=Q.useContext(D_),u=D$(e=>!!i||!1===d.filter()||!e.search||e.filtered.groups.has(o));DU(()=>d.group(o),[]),DG(o,a,[e.value,e.heading,l]);let p=Q.useMemo(()=>({id:o,forceMount:i}),[i]);return Q.createElement(kL.div,{ref:eL(a,t),...s,"cmdk-group":"",role:"presentation",hidden:!u||void 0},n&&Q.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),DV(e,e=>Q.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},Q.createElement(DO.Provider,{value:p},e))))}),DL=Q.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Q.useRef(null),s=D$(e=>!e.search);return n||s?Q.createElement(kL.div,{ref:eL(i,t),...r,"cmdk-separator":"",role:"separator"}):null}),Dj=Q.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=null!=e.value,s=Q.useContext(DM),o=D$(e=>e.search),a=D$(e=>e.selectedItemId),l=Q.useContext(D_);return Q.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),Q.createElement(kL.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?e.value:o,onChange:e=>{i||s.setState("search",e.target.value),null==n||n(e.target.value)}})}),DP=Q.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,s=Q.useRef(null),o=Q.useRef(null),a=D$(e=>e.selectedItemId),l=Q.useContext(D_);return Q.useEffect(()=>{if(o.current&&s.current){let e=o.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty("--cmdk-list-height",n.toFixed(1)+"px")})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Q.createElement(kL.div,{ref:eL(s,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},DV(e,e=>Q.createElement("div",{ref:eL(o,l.listInnerRef),"cmdk-list-sizer":""},e)))}),DB=Q.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=e;return Q.createElement(rl,{open:n,onOpenChange:r},Q.createElement(rh,{container:o},Q.createElement(rm,{"cmdk-overlay":"",className:i}),Q.createElement(rx,{"aria-label":e.label,"cmdk-dialog":"",className:s},Q.createElement(DI,{ref:t,...a}))))}),DF=Object.assign(DI,{List:DP,Item:DD,Input:Dj,Group:DR,Separator:DL,Dialog:DB,Empty:Q.forwardRef((e,t)=>D$(e=>0===e.filtered.count)?Q.createElement(kL.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:Q.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...s}=e;return Q.createElement(kL.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},DV(e,e=>Q.createElement("div",{"aria-hidden":!0},e)))})});function DH(e){let t=Q.useRef(e);return DU(()=>{t.current=e}),t}var DU="u"<typeof window?Q.useEffect:Q.useLayoutEffect;function Dz(e){let t=Q.useRef();return void 0===t.current&&(t.current=e()),t}function D$(e){let t=Q.useContext(DM),n=()=>e(t.snapshot());return Q.useSyncExternalStore(t.subscribe,n,n)}function DG(e,t,n,r=[]){let i=Q.useRef(),s=Q.useContext(D_);return DU(()=>{var o;let a=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():i.current}})(),l=r.map(e=>e.trim());s.value(e,a,l),null==(o=t.current)||o.setAttribute(DS,a),i.current=a}),i}var Dq=()=>{let[e,t]=Q.useState(),n=Dz(()=>new Map);return DU(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function DV({asChild:e,children:t},n){let r;return e&&Q.isValidElement(t)?Q.cloneElement("function"==typeof(r=t.type)?r(t.props):"render"in r?r.render(t.props):t,{ref:t.ref},n(t.props.children)):n(t)}var DW={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};let DK=en("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),DY=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF,{ref:n,className:tK("flex h-full w-full flex-col overflow-hidden rounded-sm bg-popover text-popover-foreground",e),...t}));function DX({children:e,shouldFilter:t,...n}){return(0,X.jsx)(rl,{...n,children:(0,X.jsxs)(rj,{className:"overflow-hidden p-0 shadow-golden max-w-lg",children:[(0,X.jsx)(rF,{className:"sr-only",children:"Search"}),(0,X.jsx)(DY,{shouldFilter:t,className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})]})})}DY.displayName=DF.displayName;let DQ=Q.forwardRef(({className:e,...t},n)=>(0,X.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,X.jsx)(DK,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,X.jsx)(DF.Input,{ref:n,className:tK("flex h-11 w-full rounded-sm bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));DQ.displayName=DF.Input.displayName;let DJ=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.List,{ref:n,className:tK("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));DJ.displayName=DF.List.displayName;let DZ=Q.forwardRef((e,t)=>(0,X.jsx)(DF.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));DZ.displayName=DF.Empty.displayName;let D0=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.Group,{ref:n,className:tK("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));D0.displayName=DF.Group.displayName;let D1=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.Separator,{ref:n,className:tK("-mx-1 h-px bg-border",e),...t}));D1.displayName=DF.Separator.displayName;let D2=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.Item,{ref:n,className:tK("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));D2.displayName=DF.Item.displayName;let D3=null,D5=wu(e=>({query:"",results:[],loading:!1,truncated:!1,open:!1,setQuery:t=>e({query:t}),setOpen:t=>e({open:t}),clear:()=>{D3?.abort(),e({query:"",results:[],loading:!1,truncated:!1})},search:async t=>{D3?.abort();let n=new AbortController;if(D3=n,!t.trim())return void e({results:[],loading:!1,truncated:!1});e({loading:!0});try{let r=await rK("/api/wiki/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t,limit:30}),signal:n.signal});if(!r.ok)return void e({results:[],loading:!1,truncated:!1});let i=await r.json();if(n.signal.aborted)return;e({results:i.matches??[],truncated:!!i.truncated,loading:!1})}catch(t){"AbortError"!==t.name&&e({loading:!1})}}}));function D4({html:e}){let t=function(e){let t,n=[],r=/<mark>([\s\S]*?)<\/mark>/g,i=0;for(;null!==(t=r.exec(e));)t.index>i&&n.push({text:e.slice(i,t.index),mark:!1}),n.push({text:t[1]??"",mark:!0}),i=t.index+t[0].length;return i<e.length&&n.push({text:e.slice(i),mark:!1}),n}(e);return(0,X.jsx)(X.Fragment,{children:t.map((e,t)=>e.mark?(0,X.jsx)("mark",{className:"bg-yellow-200 dark:bg-yellow-700 rounded-[2px] px-[1px]",children:e.text},t):(0,X.jsx)("span",{children:e.text},t))})}function D6({onOpenFile:e,onToggleSidebar:t=()=>void 0,onNewFile:n=()=>void 0,onCopyPath:r=()=>void 0}){let i=D5(e=>e.open),s=D5(e=>e.setOpen),o=D5(e=>e.query),a=D5(e=>e.setQuery),l=D5(e=>e.results),c=D5(e=>e.loading),d=D5(e=>e.truncated),u=D5(e=>e.search),{resolvedTheme:p,setTheme:h}=(0,I_.useTheme)(),f=wp(e=>e.toggle),m=wM(e=>e.width),g=wM(e=>e.cycle),b=o.trimStart(),y=""===b||b.startsWith(">"),x=y?"":o;function v(e){e(),s(!1),a("")}(0,Q.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),s(!i))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,s]),(0,Q.useEffect)(()=>{if(!i||y)return;let e=setTimeout(()=>{u(x)},120);return()=>clearTimeout(e)},[x,y,i,u]);let w=(w_.indexOf(m)+1)%w_.length,E=wC[w_[w]];return(0,X.jsxs)(DX,{open:i,onOpenChange:e=>{s(e),e||a("")},shouldFilter:!1,children:[(0,X.jsx)(DQ,{placeholder:"Search files… ( > for actions )",value:o,onValueChange:a}),(0,X.jsxs)(DJ,{children:[y&&(0,X.jsxs)(D0,{heading:"Actions",children:[(0,X.jsxs)(D2,{value:"toggle-dark-mode",onSelect:()=>v(()=>h("dark"===p?"light":"dark")),children:["dark"===p?(0,X.jsx)(IC,{className:"mr-2 h-4 w-4"}):(0,X.jsx)(IS,{className:"mr-2 h-4 w-4"}),"dark"===p?"Switch to light mode":"Switch to dark mode"]}),(0,X.jsxs)(D2,{value:"toggle-ai-panel",onSelect:()=>v(f),children:[(0,X.jsx)(ei,{className:"mr-2 h-4 w-4"}),"Toggle AI panel"]}),(0,X.jsxs)(D2,{value:"toggle-sidebar",onSelect:()=>v(t),children:[(0,X.jsx)(_p,{className:"mr-2 h-4 w-4"}),"Toggle sidebar"]}),(0,X.jsxs)(D2,{value:"new-file",onSelect:()=>v(n),children:[(0,X.jsx)(eu,{className:"mr-2 h-4 w-4"}),"New file"]}),(0,X.jsxs)(D2,{value:"copy-path",onSelect:()=>v(r),children:[(0,X.jsx)(el,{className:"mr-2 h-4 w-4"}),"Copy current file path"]}),(0,X.jsxs)(D2,{value:"cycle-view-width",onSelect:()=>v(g),children:[(0,X.jsx)(ki,{className:"mr-2 h-4 w-4"}),(0,X.jsxs)("span",{children:["Change view width"," ",(0,X.jsxs)("span",{className:"text-muted-foreground",children:["(",wC[m]," → ",E,")"]})]})]})]}),!y&&(0,X.jsxs)(X.Fragment,{children:[c&&(0,X.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Searching…"}),!c&&""!==x.trim()&&0===l.length&&(0,X.jsx)(DZ,{children:"No matches."}),l.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D1,{}),(0,X.jsx)(D0,{heading:d?"Top results (refine query for more)":"Results",children:l.map(t=>(0,X.jsx)(D2,{value:t.path,onSelect:()=>{e(t.path),s(!1),a("")},children:(0,X.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,X.jsx)("span",{className:"truncate font-mono text-xs",children:t.path}),t.snippet&&(0,X.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:(0,X.jsx)(D4,{html:t.snippet})})]})},t.path))})]})]})]})]})}function D9({onOpenFile:e}){let t=D5(e=>e.query),n=D5(e=>e.setQuery),r=D5(e=>e.results),i=D5(e=>e.loading),s=D5(e=>e.search),o=D5(e=>e.clear),[a,l]=(0,Q.useState)(0),c=(0,Q.useRef)(null);function d(t){let n=r[t];n&&(e(n.path),o())}return(0,Q.useEffect)(()=>{l(0)},[r]),(0,Q.useEffect)(()=>{let e=c.current?.querySelector(`[data-idx="${a}"]`);e?.scrollIntoView({block:"nearest"})},[a]),(0,X.jsxs)("div",{className:"flex flex-col gap-1 px-2 py-1.5",children:[(0,X.jsxs)("div",{className:"relative",children:[(0,X.jsx)(DK,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 opacity-50"}),(0,X.jsx)("input",{type:"text",className:"w-full rounded-sm border bg-transparent py-1 pl-7 pr-2 text-xs outline-none focus:ring-1 focus:ring-ring",placeholder:"Search… (⌘K)",value:t,onChange:e=>{n(e.target.value),s(e.target.value)},onKeyDown:e=>{"Escape"===e.key?o():0!==r.length&&("ArrowDown"===e.key?(e.preventDefault(),l(e=>(e+1)%r.length)):"ArrowUp"===e.key?(e.preventDefault(),l(e=>(e-1+r.length)%r.length)):"Enter"===e.key&&(e.preventDefault(),d(a)))}})]}),""!==t.trim()&&(0,X.jsxs)("div",{ref:c,className:"max-h-64 overflow-y-auto rounded-sm border bg-popover",children:[i&&(0,X.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"Searching…"}),!i&&0===r.length&&(0,X.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"No matches"}),r.map((e,t)=>(0,X.jsxs)("button",{type:"button","data-idx":t,onClick:()=>d(t),onMouseEnter:()=>l(t),className:`block w-full px-2 py-1 text-left ${t===a?"bg-accent":"hover:bg-accent"}`,children:[(0,X.jsx)("div",{className:"truncate font-mono text-xs",children:e.path}),e.snippet&&(0,X.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:(0,X.jsx)(D4,{html:e.snippet})})]},e.path))]})]})}function D7({className:e}){let t=wM(e=>e.width),n=wM(e=>e.setWidth);return(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${e??""}`,title:`Content width: ${wC[t]}`,children:(0,X.jsx)(ks,{className:"h-3.5 w-3.5"})})}),(0,X.jsx)(Ib,{align:"end",className:"w-36",children:w_.map(e=>(0,X.jsxs)(Iy,{onClick:()=>n(e),className:"flex items-center justify-between text-xs",children:[wC[e],e===t&&(0,X.jsx)(es,{className:"h-3.5 w-3.5"})]},e))})]})}function D8(e){return e.split(".").pop()?.toLowerCase()??""}function Re(e,t){if("node-app"===t)return"node-app";if("app"===t)return"app";if("dir"===t)return"fallback";let n=e.split("/").pop()??e;if(n.startsWith(".")&&-1===n.indexOf(".",1))return"source";let r=D8(e);return r?["md","markdown"].includes(r)?"editor":"txt"===r?"text":["csv","tsv"].includes(r)?"csv":"pdf"===r?"pdf":["mmd","mermaid"].includes(r)?"mermaid":"ipynb"===r?"notebook":["png","jpg","jpeg","gif","webp","svg","avif","ico","bmp"].includes(r)?"image":["mp4","webm","mov","m4v","mp3","wav","ogg","m4a","aac"].includes(r)?"media":"docx"===r?"docx":["xlsx","xlsm"].includes(r)?"xlsx":"pptx"===r?"pptx":"html"===r?"html":(["py","js","ts","tsx","jsx","go","rs","java","c","cpp","h","sh","bash","zsh","rb","php","swift","kt","lua","sql","yaml","yml","toml","json","xml","css","scss"].includes(r),"source"):"source"}let Rt=new Set(["txt","md","markdown","json","yaml","yml","toml","csv","tsv","xml","html","css","js","ts","tsx","jsx","sh","bash","zsh","rb","py","go","rs","java","c","cpp","h","php","swift","kt","lua","sql","scss","mmd","mermaid","ini","env","log","conf"]);function Rn(e){let t=Re(e,"file");return"editor"===t||"text"===t||Rt.has(D8(e))}function Rr(e){return["md","markdown"].includes(D8(e))}function Ri(e){return"image"===Re(e,"file")}async function Rs(e){let t=await rK(`/api/wiki?dir=${encodeURIComponent(e)}`);return t.ok?(await t.json()).entries.map(t=>({name:t.name,path:e?`${e}/${t.name}`:t.name,type:t.type,size:t.size,modifiedAt:t.modifiedAt,expanded:!1})):[]}function Ro(e,t,n){return e.map(e=>e.path===t?n(e):e.children?{...e,children:Ro(e.children,t,n)}:e)}e.s(["default",0,function(){let e;wO(e=>e.loadedAt),(0,Q.useEffect)(()=>{wO.getState().load()},[]);let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[s,o]=(0,Q.useState)(()=>rV()),[a,l]=(0,Q.useState)([]),[c,d]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)(!1),[h,f]=(0,Q.useState)(null),m=(0,Q.useCallback)(async()=>{try{let e=await fetch("/api/system/workspaces");if(!e.ok)throw Error("Failed");let t=await e.json();if(l(t.workspaces),d(t.isAdmin),t.workspaces.length>0){n(!0);let e=new URLSearchParams(window.location.search).get("ws"),r=e?t.workspaces.find(t=>t.id===e):null,s=r??[...t.workspaces].sort((e,t)=>(t.lastOpenedAt??t.createdAt).localeCompare(e.lastOpenedAt??e.createdAt))[0];if(o(s.id),i(s.rootDir),!r){let e=new URL(location.href);e.searchParams.set("ws",s.id),history.replaceState(null,"",e.toString())}}else n(!1)}catch{n(!1)}},[]);(0,Q.useEffect)(()=>{m()},[m]);let g=wk(e=>e.currentPath),b=De(e=>e.recents),[y,x]=(0,Q.useState)(!1),[v,w]=(0,Q.useState)(!1),E=Dr(e=>e.pins),k=(0,Q.useRef)(null),T=wp(e=>e.activity),N=(0,Q.useMemo)(()=>{let e=new Date(Date.now()-6e4).toISOString(),t=new Set;for(let n of T)n.at>=e&&n.path&&n.by?.startsWith("ai:")&&t.add(n.path);return t},[T]);(0,Q.useEffect)(()=>{let e=()=>{wp.getState().loadActivity()};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]),(0,Q.useEffect)(()=>{De.getState().loadForWorkspace(s),Dr.getState().loadForWorkspace(s)},[s]);let A=(0,Q.useRef)(new URLSearchParams(window.location.search).get("path")),S=(0,Q.useRef)(!1),[C,_]=(0,Q.useState)([]),[M,O]=(0,Q.useState)(!1),[I,D]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),[L,j]=(0,Q.useState)(!1),[P,B]=(0,Q.useState)(!1),[F,H]=(0,Q.useState)(null),U=(0,Q.useRef)(null),z=(0,Q.useRef)(""),[$,G]=(0,Q.useState)(null),[q,V]=(0,Q.useState)(""),[W,K]=(0,Q.useState)(null),[Y,J]=(0,Q.useState)(null),[Z,ee]=(0,Q.useState)(""),[et,en]=(0,Q.useState)(null),[eR,eL]=(0,Q.useState)(null),[ej,eP]=(0,Q.useState)(!1),[eB,eF]=(0,Q.useState)(null),[eH,eU]=(0,Q.useState)(!1),[ez,e$]=(0,Q.useState)(0),[eG,eq]=(0,Q.useState)(!1),[eV,eW]=(0,Q.useState)(!1),[eK,eY]=(0,Q.useState)(null),[eX,eQ]=(0,Q.useState)(0),[eJ,eZ]=(0,Q.useState)(!1),[e0,e1]=(0,Q.useState)(!1),[e2,e3]=(0,Q.useState)(""),[e5,e4]=(0,Q.useState)(!1),[e6,e9]=(0,Q.useState)(null),e7=(0,Q.useRef)(null),[e8,te]=(0,Q.useState)(null),tt=(0,Q.useRef)(null),tn=(0,Q.useRef)(!1),tr=(0,Q.useRef)(async()=>{});(0,Q.useEffect)(()=>{M||R.current||(R.current=!0,D(!0),Rs("").then(e=>{_(e),O(!0),D(!1)}).catch(()=>{R.current=!1,D(!1)}))},[M]);let ti=(0,Q.useCallback)(async e=>{let t=e.split("/");if(t.length<=1)return;let n=[],r="";for(let e=0;e<t.length-1;e++)r=r?`${r}/${t[e]}`:t[e],n.push({prefix:r,children:await Rs(r)});_(e=>{let t=e;for(let{prefix:e,children:r}of n)t=Ro(t,e,e=>({...e,children:r,expanded:!0}));return t})},[]),ts=(0,Q.useCallback)(async e=>{let t=await Rs(e);""===e?_(e=>{let n=new Map(e.map(e=>[e.path,e]));return t.map(e=>{let t=n.get(e.path);return t&&("dir"===t.type||"app"===t.type)?{...e,expanded:t.expanded,children:t.children}:e})}):_(n=>Ro(n,e,e=>({...e,children:t,expanded:!0})))},[]),to=(0,Q.useCallback)(e=>{let t=[];for(let n of e)("dir"===n.type||"app"===n.type||"node-app"===n.type)&&n.expanded&&n.children&&(t.push(n.path),t.push(...to(n.children)));return t},[]),ta=(0,Q.useCallback)(async()=>{j(!0);try{let e=to(C),t=await Rs("");for(let n of(_(t),e)){let e=await Rs(n);_(t=>Ro(t,n,t=>({...t,children:e,expanded:!0})))}}finally{j(!1)}},[C,to]),tl=(0,Q.useCallback)(async()=>{if(eB){if(Rr(eB.name)){eZ(!0);try{await wk.getState().loadPage(eB.path)}finally{eZ(!1)}return}if(["editor","text"].includes(Re(eB.name,eB.nodeType))||Rn(eB.name)){eZ(!0);try{let e=await rK(`/api/wiki/content?path=${encodeURIComponent(eB.path)}`);if(e.ok){let t=await e.json();eY(t.content),eQ(Number(e.headers.get("X-Wiki-Revision")??0))}}catch{}eZ(!1)}}},[eB]);async function tc(e){if("dir"===e.type||"app"===e.type||"node-app"===e.type)if(e.expanded)_(t=>Ro(t,e.path,e=>({...e,expanded:!1})));else if(void 0===e.children){_(t=>Ro(t,e.path,e=>({...e,loading:!0})));let t=await Rs(e.path);_(n=>Ro(n,e.path,e=>({...e,loading:!1,children:t,expanded:!0})))}else _(t=>Ro(t,e.path,e=>({...e,expanded:!0})))}async function td(e){if("file"===e.type&&De.getState().push({path:e.path,name:e.name},s),eF({path:e.path,name:e.name,nodeType:"app"===e.type?"app":"node-app"===e.type?"node-app":"file"}),e1(!1),e9(null),eY(null),eQ(0),"file"===e.type&&Rr(e.name)){eZ(!0);try{await wk.getState().loadPage(e.path)}finally{eZ(!1)}return}if(["editor","text"].includes(Re(e.name,e.type))||Rn(e.name)){eZ(!0);try{let t=await rK(`/api/wiki/content?path=${encodeURIComponent(e.path)}`);if(t.ok){let e=await t.json();eY(e.content),eQ(Number(t.headers.get("X-Wiki-Revision")??0))}}catch{}eZ(!1)}}(0,Q.useEffect)(()=>{eB&&Rr(eB.name)&&wk.getState().currentPath!==eB.path&&wk.getState().loadPage(eB.path)},[eB]),(0,Q.useEffect)(()=>{tt.current=eB},[eB]),(0,Q.useEffect)(()=>{tn.current=e0},[e0]),(0,Q.useEffect)(()=>{tr.current=tl},[tl]),(0,Q.useEffect)(()=>{if(!t)return;let e=new Map,n=new EventSource(rW("/api/wiki/watch"));return n.onmessage=t=>{var n;let r;try{r=JSON.parse(t.data)}catch{return}let{type:i,path:s}=r,o=s.split("/");if(n=o.length>1?o.slice(0,-1).join("/"):"",e.has(n)&&clearTimeout(e.get(n)),e.set(n,setTimeout(()=>{e.delete(n),ts(n)},300)),"change"===i&&tt.current?.path===s&&!tn.current){let t=`__file__${s}`;e.has(t)&&clearTimeout(e.get(t)),e.set(t,setTimeout(()=>{e.delete(t),tr.current()},400))}},()=>{for(let t of(n.close(),e.values()))clearTimeout(t)}},[t,ts]),(0,Q.useEffect)(()=>{eU(!1)},[]);let tu=(0,Q.useCallback)(e=>{let t=e.split("/").pop()??e;ti(e),td({path:e,name:t,type:"file"})},[ti]);(0,Q.useEffect)(()=>{if(!g||eB&&eB.path===g)return;let e=g.split("/").pop()??g;td({path:g,name:e,type:"file"})},[g]),(0,Q.useEffect)(()=>{let e=new URL(window.location.href);eB?e.searchParams.set("path",eB.path):e.searchParams.delete("path"),window.history.replaceState(null,"",e.toString())},[eB]),(0,Q.useEffect)(()=>{if(S.current||!M)return;let e=A.current;if(!e){S.current=!0;return}S.current=!0,(async()=>{let t=e.split("/"),n=t[t.length-1],r=t.slice(0,-1).join("/"),i=(await Rs(r)).find(t=>t.path===e);i&&(await ti(e),td({path:e,name:n,type:i.type,modifiedAt:i.modifiedAt}))})()},[M,ti]);let tp=(0,Q.useCallback)(async e=>{if(e===s)return;try{await fetch(`/api/system/workspaces/${e}/open`,{method:"POST"})}catch{}let t=new URL(location.href);t.searchParams.set("ws",e),t.searchParams.delete("path"),history.pushState(null,"",t.toString()),eF(null),eY(null),e1(!1),_([]),O(!1),R.current=!1,wO.getState().invalidate();let n=a.find(t=>t.id===e);n&&i(n.rootDir),o(e)},[s,a]),th=(0,Q.useCallback)(async()=>{if(h)try{if(!(await fetch(`/api/system/workspaces/${h}`,{method:"DELETE"})).ok)throw Error("Failed");if(h===s){let e=a.filter(e=>e.id!==h);if(e.length>0){let t=[...e].sort((e,t)=>(t.lastOpenedAt??t.createdAt).localeCompare(e.lastOpenedAt??e.createdAt))[0];await tp(t.id)}else n(!1)}await m()}catch{}finally{f(null)}},[h,s,a,tp,m]);async function tf(){if(!eB)return;e4(!0),e9(null);let e=await rK("/api/wiki/content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:eB.path,content:e2,baseRevision:eX})});if(e.ok){let t=await e.json();"number"==typeof t.revision&&eQ(t.revision),eY(e2),e1(!1)}else e9((await e.json()).error??"Save failed");e4(!1)}let tm=(0,Q.useCallback)(async(e,t)=>{let n=Array.from(e);if(n.length){B(!0),H(null);try{for(let e of n){let n=new FormData;n.append("file",e),n.append("dir",t);let r=await rK("/api/wiki/upload",{method:"POST",body:n});if(!r.ok){let e=await r.json();H(e.error??"Upload failed"),wB(e.error??"Upload failed");break}}await ts(t)}catch{H("Upload failed.")}finally{B(!1),U.current&&(U.current.value="")}}},[ts]);function tg(e){z.current=e,U.current?.click()}async function tb(){let e=q.trim();if(!e||null===$)return;K(null);let t=$?`${$}/${e}`:e,n=await rK("/api/wiki/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});n.ok?(G(null),V(""),await ts($),""!==$&&_(e=>Ro(e,$,e=>({...e,expanded:!0})))):K((await n.json()).error??"Failed")}async function ty(){let e=Z.trim();if(!e||null===Y)return;en(null);let t=e.includes(".")?e:`${e}.md`,n=Y?`${Y}/${t}`:t,r=await rK("/api/wiki/new-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});r.ok?(J(null),ee(""),await ts(Y),""!==Y&&_(e=>Ro(e,Y,e=>({...e,expanded:!0}))),td({path:n,name:t,type:"file",modifiedAt:new Date().toISOString()})):en((await r.json()).error??"Failed")}function tx(e){navigator.clipboard.writeText(e),wP("Path copied")}function tv(e){let t=e.replace(/\.(md|markdown)$/i,"");navigator.clipboard.writeText(`[[${t}]]`),wP("Wiki link copied")}function tw(e){let t=new URL(location.href);t.searchParams.set("path",e),s&&t.searchParams.set("ws",s),navigator.clipboard.writeText(t.toString()),wP("URL copied")}async function tE(e){if(eB?.path===e&&null!==eK)return eK;if(wk.getState().currentPath===e)return wk.getState().content;let t=await rK(`/api/wiki/content?path=${encodeURIComponent(e)}`);if(!t.ok)throw Error("Cannot copy content");return(await t.json()).content}async function tk(e){try{let t=await tE(e);await navigator.clipboard.writeText(t),wP("Raw content copied")}catch{wB("Could not copy file content")}}async function tT(e,t){try{let n=await tE(e);if(!Rr(t)){await navigator.clipboard.writeText(n),wP("Content copied");return}let r=await vA(n,{pagePath:e,sanitize:!0});"ClipboardItem"in window&&navigator.clipboard.write?await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:"text/html"}),"text/plain":new Blob([n],{type:"text/plain"})})]):await navigator.clipboard.writeText(n),wP("Formatted content copied")}catch{wB("Could not copy formatted content")}}function tN(e){return(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 px-2 text-xs",title:"Copy path, wiki link, or URL",children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),"Copy",(0,X.jsx)(eo,{className:"h-3 w-3 opacity-60"})]})}),(0,X.jsxs)(Ib,{align:"end",className:"w-44",children:[(0,X.jsxs)(Iy,{onClick:()=>tx(e.path),children:[(0,X.jsx)(el,{className:"mr-2 h-3.5 w-3.5"}),"Copy path"]}),Rr(e.name)&&(0,X.jsxs)(Iy,{onClick:()=>tv(e.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy wiki link"]}),(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{onClick:()=>tw(e.path),children:[(0,X.jsx)(ey,{className:"mr-2 h-3.5 w-3.5"}),"Copy URL"]}),Rn(e.name)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{onClick:()=>void tk(e.path),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy raw content"]}),(0,X.jsxs)(Iy,{onClick:()=>void tT(e.path,e.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy formatted content"]})]})]})]})}async function tA(){eR&&(await rK("/api/wiki",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:eR})}),(eB?.path===eR||eB?.path.startsWith(`${eR}/`))&&(eF(null),eY(null)),_(e=>(function e(t,n){return t.filter(e=>e.path!==n).map(t=>t.children?{...t,children:e(t.children,n)}:t)})(e,eR)),eL(null))}function tS(e,t,n){e.preventDefault(),e.stopPropagation();let r=e7.current;!r||r.path===t||t.startsWith(`${r.path}/`)||(e.dataTransfer.dropEffect="move",te("root"===n?"":t))}async function tC(e,t){e.preventDefault(),e.stopPropagation(),te(null);let n=e7.current;if(e7.current=null,!n||n.path===t||t.startsWith(`${n.path}/`))return;let r=t?`${t}/${n.name}`:n.name;if(r!==n.path&&(await rK("/api/wiki/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:n.path,to:r})})).ok){let e=n.path.includes("/")?n.path.split("/").slice(0,-1).join("/"):"";await ts(e),t!==e&&await ts(t),eB?.path===n.path&&eF({path:r,name:n.name,nodeType:eB.nodeType})}}let t_=eB?Re(eB.name,eB.nodeType):null,tM=wM(e=>e.width),tO=null===t_||"editor"===t_||"text"===t_||"source"===t_||"notebook"===t_||"fallback"===t_,tI=tO?wA[tM]:"";return(0,X.jsxs)("div",{className:"flex h-screen gap-0 overflow-hidden bg-background",children:[null===t&&(0,X.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!1===t&&(0,X.jsx)(IA,{onSelect:e=>{let t=new URL(location.href);t.searchParams.set("ws",e),t.searchParams.delete("path"),history.replaceState(null,"",t.toString()),O(!1),R.current=!1,o(e),n(!0),m()}}),!0===t&&u&&(0,X.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,X.jsx)("div",{className:"flex items-center justify-end border-b px-3 py-2 bg-muted shrink-0",children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>p(!1),children:[(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})," Cancel"]})}),(0,X.jsx)(IA,{onSelect:e=>{p(!1),m(),tp(e)}})]}),!0===t&&!u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D6,{onOpenFile:tu,onToggleSidebar:()=>eq(e=>!e),onNewFile:()=>J(""),onCopyPath:()=>{eB&&navigator.clipboard.writeText(eB.path)}}),!eG&&(0,X.jsxs)(IP,{className:"flex flex-col w-72 shrink-0 overflow-hidden rounded-none border-r border-l-0 border-t-0 border-b-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,X.jsx)("img",{src:"/logo.svg",alt:"Wiki Viewer",className:"h-5 w-5 shrink-0"}),(0,X.jsx)("span",{className:"truncate text-xs font-semibold tracking-tight",children:"Wiki Viewer"})]}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 shrink-0",title:"Collapse sidebar",onClick:()=>eq(!0),children:(0,X.jsx)(eE,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex items-center justify-between gap-1 px-3 py-1.5 border-b bg-muted/50 shrink-0",children:[(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1 px-2 text-xs",disabled:P,children:[P?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eA,{className:"h-3.5 w-3.5"}),"New",(0,X.jsx)(eo,{className:"h-3 w-3 opacity-60"})]})}),(0,X.jsxs)(Ib,{align:"start",className:"w-44",children:[(0,X.jsxs)(Iy,{onClick:()=>{J(""),ee(""),en(null)},children:[(0,X.jsx)(eu,{className:"mr-2 h-3.5 w-3.5"}),"New file"]}),(0,X.jsxs)(Iy,{onClick:()=>{G(""),V(""),K(null)},children:[(0,X.jsx)(em,{className:"mr-2 h-3.5 w-3.5"}),"New folder"]}),(0,X.jsxs)(Iy,{onClick:()=>tg(""),disabled:P,children:[(0,X.jsx)(eI,{className:"mr-2 h-3.5 w-3.5"}),"Upload"]})]})]}),(0,X.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh tree",onClick:ta,disabled:L,children:L?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(IM,{}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"AI Agent panel",onClick:()=>wp.getState().toggle(),children:(0,X.jsx)(ei,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Settings",onClick:()=>eW(!0),children:(0,X.jsx)(eC,{className:"h-3.5 w-3.5"})})]})]}),F&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-destructive bg-destructive/10 shrink-0",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0"}),F]}),""===$&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(eh,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:q,onChange:e=>V(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tb(),"Escape"===e.key&&(G(null),V(""))}}),W&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:W}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tb,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{G(null),V("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),""===Y&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:Z,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ty(),"Escape"===e.key&&(J(null),ee(""))}}),et&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:et}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ty,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{J(null),ee("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),(0,X.jsx)("div",{className:"border-b",children:(0,X.jsx)(D9,{onOpenFile:tu})}),(0,X.jsxs)("div",{ref:k,className:tK("flex-1 overflow-auto py-1",""===e8&&"ring-2 ring-inset ring-primary bg-primary/5"),onDragOver:e=>tS(e,"","root"),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||te(null)},onDrop:e=>tC(e,""),children:[E.length>0&&(0,X.jsxs)("div",{className:"border-b mb-1",children:[(0,X.jsxs)("button",{type:"button",className:"flex w-full items-center gap-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground",onClick:()=>x(e=>!e),children:[y?(0,X.jsx)(ea,{className:"h-3 w-3"}):(0,X.jsx)(eo,{className:"h-3 w-3"}),(0,X.jsx)(eN,{className:"h-3 w-3"}),"Pinned"]}),!y&&E.map(e=>(0,X.jsxs)("div",{role:"button",tabIndex:0,className:tK("group flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer transition-colors select-none",eB?.path===e.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted"),onClick:()=>void td({path:e.path,name:e.name,type:"file",modifiedAt:""}),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),td({path:e.path,name:e.name,type:"file",modifiedAt:""}))},children:[(0,X.jsx)(e_,{className:"h-3 w-3 shrink-0 fill-current text-amber-400"}),(0,X.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs",children:e.name}),(0,X.jsx)("span",{className:"max-w-[80px] truncate text-[10px] text-muted-foreground/60",children:e.path.split("/").slice(0,-1).join("/")}),(0,X.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground/50 opacity-0 transition-colors hover:bg-muted hover:text-amber-400 group-hover:opacity-100 focus:opacity-100",title:"Remove from pinned",onClick:t=>{t.stopPropagation(),Dr.getState().toggle({path:e.path,name:e.name},s)},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]},e.path))]}),b.length>0&&(0,X.jsxs)("div",{className:"border-b mb-1",children:[(0,X.jsxs)("button",{type:"button",className:"flex w-full items-center gap-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground",onClick:()=>w(e=>!e),children:[v?(0,X.jsx)(ea,{className:"h-3 w-3"}):(0,X.jsx)(eo,{className:"h-3 w-3"}),"Recent"]}),!v&&b.slice(0,8).map(e=>(0,X.jsxs)("div",{role:"button",tabIndex:0,className:tK("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer transition-colors select-none",eB?.path===e.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted"),onClick:()=>void td({path:e.path,name:e.name,type:"file",modifiedAt:""}),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),td({path:e.path,name:e.name,type:"file",modifiedAt:""}))},children:[(0,X.jsx)(ep,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"flex-1 truncate text-xs",children:e.name}),(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/60 truncate max-w-[80px]",children:e.path.split("/").slice(0,-1).join("/")})]},e.path))]}),I?(0,X.jsx)("div",{className:"flex justify-center py-6",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===C.length?(0,X.jsxs)("div",{className:"flex flex-col items-center gap-3 px-4 py-8 text-center",children:[(0,X.jsx)("div",{className:"rounded-full bg-muted p-3",children:(0,X.jsx)(ep,{className:"h-6 w-6 text-muted-foreground"})}),(0,X.jsxs)("div",{className:"space-y-1",children:[(0,X.jsx)("p",{className:"text-sm font-medium",children:"No files yet"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Upload files or add them to the configured directory"})]}),(0,X.jsxs)(tX,{size:"sm",variant:"outline",className:"w-full gap-1.5 max-w-[180px]",onClick:()=>tg(""),disabled:P,children:[P?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eI,{className:"h-3.5 w-3.5"}),"Upload Files"]})]}):function e(t,n=0){return t.map(t=>{let r=E.some(e=>e.path===t.path);return(0,X.jsxs)(IG,{children:[(0,X.jsx)(IV,{asChild:!0,children:(0,X.jsxs)("div",{children:[(0,X.jsxs)("div",{role:"treeitem",tabIndex:0,draggable:!0,onKeyDown:e=>{if("Enter"===e.key||" "===e.key)e.preventDefault(),"dir"===t.type?tc(t):"app"===t.type||"node-app"===t.type?(td(t),tc(t)):td(t);else if("ArrowDown"===e.key){e.preventDefault();let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=n.indexOf(e.currentTarget);n[r+1]?.focus()}else if("ArrowUp"===e.key){e.preventDefault();let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=n.indexOf(e.currentTarget);n[r-1]?.focus()}else if("ArrowRight"===e.key){if(e.preventDefault(),"dir"===t.type||"app"===t.type||"node-app"===t.type)if(t.expanded){let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=n.indexOf(e.currentTarget);n[r+1]?.focus()}else tc(t)}else if("ArrowLeft"===e.key){if(e.preventDefault(),("dir"===t.type||"app"===t.type||"node-app"===t.type)&&t.expanded)tc(t);else if(n>0){let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=e.currentTarget,i=n.indexOf(r),s=Number.parseInt(r.style.paddingLeft??"0",10);for(let e=i-1;e>=0;e--)if(Number.parseInt(n[e].style.paddingLeft??"0",10)<s){n[e].focus();break}}}},onDragStart:e=>{e7.current=t,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.path)},onDragOver:e=>"dir"===t.type?tS(e,t.path,"dir"):e.preventDefault(),onDragLeave:()=>te(null),onDrop:e=>"dir"===t.type?tC(e,t.path):e.preventDefault(),className:tK("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer group transition-colors select-none",eB?.path===t.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted",e8===t.path&&"ring-2 ring-primary bg-primary-soft",t.name.startsWith(".")&&"opacity-40"),style:{paddingLeft:`${14*n+8}px`},onClick:()=>{"dir"===t.type?tc(t):"app"===t.type||"node-app"===t.type?(td(t),tc(t)):td(t)},children:["dir"===t.type||"app"===t.type||"node-app"===t.type?t.loading?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):t.expanded?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)(ea,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),"dir"===t.type?t.expanded?(0,X.jsx)(ef,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-warning")}):(0,X.jsx)(eh,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-warning")}):"app"===t.type?(0,X.jsx)(eg,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/70")}):"node-app"===t.type?(0,X.jsx)(eM,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-emerald-500")}):"html"===Re(t.name,"file")?(0,X.jsx)(eg,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/60")}):Ri(t.name)?(0,X.jsx)(eb,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-sunshine-700")}):Rn(t.name)?(0,X.jsx)(ep,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/70")}):(0,X.jsx)(ed,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/60")}),(0,X.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t.name}),N.has(t.path)&&(0,X.jsx)("span",{className:"ml-0.5 h-1.5 w-1.5 rounded-full bg-emerald-400 shrink-0 animate-pulse",title:"Agent recently active"}),(0,X.jsx)("div",{className:"flex max-w-0 shrink-0 items-center overflow-hidden opacity-0 transition-all duration-150 group-hover:max-w-7 group-hover:opacity-100 focus-within:max-w-7 focus-within:opacity-100",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"File actions",children:(0,X.jsx)(ew,{className:"h-3.5 w-3.5"})})}),(0,X.jsxs)(Ib,{align:"end",className:"w-48",children:[(0,X.jsxs)(Iy,{onClick:()=>tx(t.path),children:[(0,X.jsx)(el,{className:"mr-2 h-3.5 w-3.5"}),"Copy path"]}),Rr(t.name)&&(0,X.jsxs)(Iy,{onClick:()=>tv(t.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy wiki link"]}),(0,X.jsxs)(Iy,{onClick:()=>tw(t.path),children:[(0,X.jsx)(ey,{className:"mr-2 h-3.5 w-3.5"}),"Copy URL"]}),"file"===t.type&&Rn(t.name)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Iy,{onClick:()=>void tk(t.path),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy raw content"]}),(0,X.jsxs)(Iy,{onClick:()=>void tT(t.path,t.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy formatted content"]})]}),(0,X.jsx)(Iv,{}),"dir"===t.type&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Iy,{onClick:async()=>{t.expanded||await tc(t),J(t.path),ee(""),en(null)},children:[(0,X.jsx)(eu,{className:"mr-2 h-3.5 w-3.5"}),"New file here"]}),(0,X.jsxs)(Iy,{onClick:()=>tg(t.path),children:[(0,X.jsx)(eI,{className:"mr-2 h-3.5 w-3.5"}),"Upload here"]}),(0,X.jsxs)(Iy,{onClick:()=>{G(t.path),V(""),K(null)},children:[(0,X.jsx)(em,{className:"mr-2 h-3.5 w-3.5"}),"New subfolder"]}),(0,X.jsx)(Iv,{})]}),(0,X.jsxs)(Iy,{onClick:()=>{let e,n;return e=rW(`/api/wiki/download?path=${encodeURIComponent(t.path)}`),void((n=document.createElement("a")).href=e,n.download="file"===t.type?t.name:`${t.name}.zip`,document.body.appendChild(n),n.click(),n.remove())},children:[(0,X.jsx)(ec,{className:"mr-2 h-3.5 w-3.5"}),"file"===t.type?"Download":"Download as zip"]}),(0,X.jsxs)(Iy,{onClick:()=>Dr.getState().toggle({path:t.path,name:t.name},s),children:[(0,X.jsx)(e_,{className:tK("mr-2 h-3.5 w-3.5",r&&"fill-current text-amber-400")}),r?"Unpin":"Pin to top"]}),(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{className:"text-destructive focus:text-destructive",onClick:()=>{eL(t.path),eP("file"!==t.type)},children:[(0,X.jsx)(eO,{className:"mr-2 h-3.5 w-3.5"}),"Delete"]})]})]})})]}),$===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(eh,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:q,onChange:e=>V(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tb(),"Escape"===e.key&&(G(null),V(""))}}),W&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:W}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tb,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{G(null),V("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),Y===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:Z,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ty(),"Escape"===e.key&&(J(null),ee(""))}}),et&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:et}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ty,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{J(null),ee("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),("dir"===t.type||"app"===t.type||"node-app"===t.type)&&t.expanded&&t.children&&t.children.length>0&&e(t.children,n+1),("dir"===t.type||"app"===t.type||"node-app"===t.type)&&t.expanded&&t.children?.length===0&&(0,X.jsx)("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(n+1)*14+8+14+6+16+6}px`},children:"Empty"})]})}),(0,X.jsxs)(I4,{children:[(0,X.jsx)(I6,{onSelect:()=>tx(t.path),children:"Copy path"}),Rr(t.name)&&(0,X.jsx)(I6,{onSelect:()=>tv(t.name),children:"Copy wiki link"}),(0,X.jsx)(I9,{}),(0,X.jsx)(I6,{onSelect:()=>tw(t.path),children:"Copy URL"}),"file"===t.type&&Rn(t.name)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(I9,{}),(0,X.jsx)(I6,{onSelect:()=>void tk(t.path),children:"Copy raw content"}),(0,X.jsx)(I6,{onSelect:()=>void tT(t.path,t.name),children:"Copy formatted content"})]})]})]},t.path)})}(C)]}),(0,X.jsx)("div",{className:"border-t px-2 py-2 bg-muted shrink-0",children:(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"w-full h-auto justify-between gap-2 px-2 py-1.5 text-left",title:r??"",children:[(0,X.jsxs)("span",{className:"flex flex-col min-w-0",children:[(0,X.jsx)("span",{className:"truncate text-xs font-medium",children:a.find(e=>e.id===s)?.name??"Workspace"}),(0,X.jsx)("span",{className:"truncate text-[10px] text-muted-foreground font-mono",children:r??""})]}),(0,X.jsx)(eo,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]})}),(0,X.jsxs)(Ib,{align:"start",className:"w-60",children:[a.map(e=>(0,X.jsxs)(Iy,{onClick:()=>void tp(e.id),className:tK("gap-2",e.id===s&&"font-medium"),children:[e.id===s?(0,X.jsx)(es,{className:"h-3.5 w-3.5 shrink-0"}):(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsxs)("span",{className:"flex flex-col min-w-0 flex-1",children:[(0,X.jsx)("span",{className:"truncate",children:e.name}),(0,X.jsx)("span",{className:"truncate text-[10px] text-muted-foreground font-mono",children:e.rootDir})]}),c&&(0,X.jsx)("button",{className:"ml-auto shrink-0 rounded p-0.5 text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",title:"Delete workspace (does not delete files)",onClick:t=>{t.stopPropagation(),f(e.id)},children:(0,X.jsx)(eO,{className:"h-3.5 w-3.5"})})]},e.id)),c&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{onClick:()=>p(!0),children:[(0,X.jsx)(em,{className:"mr-2 h-3.5 w-3.5"}),"Add workspace…"]})]})]})]})})]}),(0,X.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 relative",children:[eG&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 h-7 w-7 p-0 rounded-full bg-background/50 backdrop-blur-xl backdrop-saturate-150 border border-white/[0.08] text-foreground/60 hover:text-foreground/90 hover:bg-background/70 shadow-[0_0_12px_rgba(0,0,0,0.15)] [transform:translate(-50%,-50%)_translateZ(0)]",title:"Show sidebar",onClick:()=>eq(!1),children:(0,X.jsx)(ek,{className:"h-3.5 w-3.5"})}),eB?"node-app"===t_?(0,X.jsx)(IE,{path:eB.path,title:eB.name}):"app"===t_||"html"===t_?(e="html"===t_?`/api/assets/${eB.path}`:void 0,eH?(0,X.jsx)(MB,{path:eB.path,title:eB.name,src:e,fullscreen:!0,onExit:()=>eU(!1)}):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,X.jsx)(eg,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:eB.path,children:eB.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[tN(eB),"html"===t_&&!e0&&null!==eK&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Edit source",onClick:()=>{e1(!0),e3(eK),e9(null)},children:(0,X.jsx)(eT,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:()=>e$(e=>e+1),children:(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>eU(!0),children:[(0,X.jsx)(ev,{className:"h-3.5 w-3.5"}),"Open fullscreen"]}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{eF(null),e1(!1)},children:(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})})]})]}),e0&&"html"===t_?(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,X.jsx)("textarea",{value:e2,onChange:e=>e3(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"}),(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[e6&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:e6}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",onClick:()=>{e1(!1),e9(null)},children:"Cancel"}),(0,X.jsxs)(tX,{size:"sm",className:"gap-1",onClick:tf,disabled:e5,children:[e5&&(0,X.jsx)(ex,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)(MB,{path:eB.path,title:eB.name,src:e},ez)]})):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[Ri(eB.name)?(0,X.jsx)(eb,{className:"h-4 w-4 shrink-0 text-sunshine-700"}):Rn(eB.name)?(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-accent"}):(0,X.jsx)(ed,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:eB.path,children:eB.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[tN(eB),Rn(eB.name)&&!e0&&(null!==eK||Rr(eB.name))&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{e1(!0),e3(eK??""),e9(null),Rr(eB.name)&&wk.getState().loadPage(eB.path)},children:(0,X.jsx)(eT,{className:"h-3.5 w-3.5"})}),Rn(eB.name)&&!e0&&(null!==eK||Rr(eB.name))&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:tl,disabled:eJ,children:eJ?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})}),tO&&(0,X.jsx)(D7,{}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{eF(null),eY(null),e1(!1)},children:(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})})]})]}),e0?(0,X.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:Rr(eB.name)?(0,X.jsx)(_D,{}):(0,X.jsx)("textarea",{value:e2,onChange:e=>e3(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"})}):Rr(eB.name)?(0,X.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:eJ?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):(0,X.jsx)(_D,{mode:"viewing"})}):(0,X.jsx)("div",{className:"flex-1 overflow-auto p-4 min-h-0",children:(0,X.jsx)("div",{className:tK("mx-auto w-full",tI),children:eJ?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):"csv"===t_?(0,X.jsx)(rJ,{path:eB.path,title:eB.name}):"pdf"===t_?(0,X.jsx)(MD,{path:eB.path,title:eB.name}):"mermaid"===t_?(0,X.jsx)(_U,{path:eB.path,title:eB.name}):"notebook"===t_?(0,X.jsx)(MC,{path:eB.path,title:eB.name}):"image"===t_?(0,X.jsx)(_L,{path:eB.path,title:eB.name}):"media"===t_?(0,X.jsx)(_j,{path:eB.path,title:eB.name,type:["mp4","webm","mov","m4v"].includes(D8(eB.name))?"video":"audio"}):"docx"===t_?(0,X.jsx)(MM,{path:eB.path,title:eB.name}):"xlsx"===t_?(0,X.jsx)(MI,{path:eB.path,title:eB.name}):"pptx"===t_?(0,X.jsx)(MO,{path:eB.path,title:eB.name}):"source"===t_?(0,X.jsx)(MP,{path:eB.path,title:eB.name}):"fallback"===t_?(0,X.jsx)(_R,{path:eB.path,title:eB.name}):null!==eK?(0,X.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words leading-relaxed",children:eK}):Rn(eB.name)?(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Could not load file."}):(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Preview not available for this file type."})})}),e0&&!Rr(eB.name)&&(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[e6&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:e6}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",onClick:()=>{e1(!1),e9(null)},children:"Cancel"}),(0,X.jsxs)(tX,{size:"sm",className:"gap-1",onClick:tf,disabled:e5,children:[e5&&(0,X.jsx)(ex,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)("div",{className:"flex-1 flex flex-col items-center justify-center",children:(0,X.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center px-4",children:[(0,X.jsx)(ep,{className:"h-8 w-8 text-muted-foreground"}),(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a file to view or edit"})]})})]}),(0,X.jsx)(Ij,{open:eV,onOpenChange:eW}),(0,X.jsx)(Dg,{currentPath:eB?.path}),(0,X.jsx)("input",{ref:U,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&tm(e.target.files,z.current)}}),(0,X.jsx)(rU,{open:!!eR,onOpenChange:e=>{e||eL(null)},title:ej?"Delete folder?":"Delete file?",description:ej?`"${eR?.split("/").pop()}" and all its contents will be permanently deleted.`:`"${eR?.split("/").pop()}" will be permanently removed.`,onConfirm:tA}),(0,X.jsx)(rU,{open:!!h,onOpenChange:e=>{e||f(null)},title:"Delete workspace?",description:`"${a.find(e=>e.id===h)?.name??""}" will be removed from the workspace list. Files on disk are NOT deleted.`,onConfirm:th})]})]},s??"none")}],952683)}]);
|
|
129
|
+
${t}/api/agent/files/${e??"<path/to/file.md>"}`;await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1500)},[e])}}(e??null),[l,c]=(0,Q.useState)(""),d=(0,Q.useRef)(null),u=window.location.origin,p=(0,Q.useCallback)(()=>Df,[]),h=(0,Q.useCallback)(()=>l.replace(/\$WIKI_URL/g,u),[l,u]),f=(0,Q.useCallback)(()=>`npx wiki-viewer-mcp register --url ${u} --id ai:myagent --name "My Agent"`,[u]),m=(0,Q.useCallback)(()=>JSON.stringify({servers:{"wiki-viewer":{command:"npx",args:["wiki-viewer-mcp"],env:{WIKI_VIEWER_URL:u,WIKI_VIEWER_TOKEN:"<token from register>",WIKI_VIEWER_AGENT_ID:"ai:myagent"}}}},null,2),[u]),g=Dm(p),b=Dm(h),y=Dm(f),x=Dm(m);return((0,Q.useEffect)(()=>{if(t)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&n()}},[t,n]),(0,Q.useEffect)(()=>{t&&d.current?.focus()},[t]),(0,Q.useEffect)(()=>{if(!t)return;s();let e=setInterval(()=>void s(),1e4);return()=>clearInterval(e)},[t,s]),(0,Q.useEffect)(()=>{t&&fetch("/api/agents/install").then(e=>e.json()).then(e=>{e.bootstrapPrompt&&c(e.bootstrapPrompt)}).catch(()=>void 0)},[t]),t)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-[1px]",onClick:n,"aria-hidden":!0}),(0,X.jsxs)("aside",{ref:d,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"AI Agent Panel",className:"fixed right-0 top-0 bottom-0 z-50 flex w-80 flex-col border-l border-border bg-background shadow-xl outline-none",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)(ei,{className:"h-4 w-4 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-semibold",children:"AI Agent"})]}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:n,title:"Close panel (Esc)",children:(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-5 px-4 py-4",children:[(0,X.jsxs)("section",{className:"rounded-md border border-border bg-muted/30 p-3",children:[(0,X.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Work with this wiki using AI"}),(0,X.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:["Connect Claude, Cursor, ChatGPT, and more. Pick by what you want — each option gives a copy-paste setup. You approve every assistant in ",(0,X.jsx)("span",{className:"font-medium text-foreground/80",children:"Agents"})," below before it gets access."]})]}),(0,X.jsxs)("section",{className:"space-y-3",children:[(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsx)("p",{className:"text-xs font-semibold text-foreground",children:"Co-write docs with you"}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Edits arrive as suggestions with comments you accept or revert. No MCP needed."}),(0,X.jsx)(tX,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void b.copy(),disabled:!l,children:b.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"})," Paste into any chatbot"]})}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 pt-1",children:["Or install once so it sticks"," ",(0,X.jsx)("span",{className:"text-muted-foreground/40",children:"· Claude, OpenCode"}),":"]}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:Df}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void g.copy(),children:g.copied?(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(el,{className:"h-3.5 w-3.5"})})]})]}),(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsxs)("p",{className:"text-xs font-semibold text-foreground",children:["Edit files directly"," ",(0,X.jsx)("span",{className:"font-normal text-muted-foreground/60",children:"· Claude Code, Cursor, Codex"})]}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Native read / search / edit tools over MCP. Run to request access:"}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:f()}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void y.copy(),children:y.copied?(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(el,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50",children:["Approve in ",(0,X.jsx)("span",{className:"font-medium text-foreground/70",children:"Agents"}),", then add to your tool:"]}),(0,X.jsx)(tX,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void x.copy(),children:x.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(es,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"})," Copy config (mcp.json)"]})})]}),(0,X.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:"For developers:"}),(0,X.jsxs)("button",{type:"button",onClick:()=>void a(),className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[o?(0,X.jsx)(es,{className:"h-3 w-3 text-green-500"}):(0,X.jsx)(el,{className:"h-3 w-3"})," curl example"]}),(0,X.jsxs)("a",{href:"/api/agents/skill",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kb,{className:"h-3 w-3"})," skill"]}),(0,X.jsxs)("a",{href:"/api/agents/install",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kb,{className:"h-3 w-3"})," install JSON"]})]})]}),(0,X.jsx)(Dp,{}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:["Active Connections"," ",(0,X.jsx)("span",{className:"normal-case font-normal text-muted-foreground/50",children:"(last 5 min)"})]}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 p-3",children:0===i.length?(0,X.jsxs)("p",{className:"text-xs text-muted-foreground/60 flex items-center gap-1.5",children:[(0,X.jsx)(Di,{className:"h-3.5 w-3.5"}),"No recent activity"]}):(0,X.jsx)("ul",{className:"space-y-1.5",children:i.map(e=>(0,X.jsxs)("li",{className:"flex items-center justify-between text-xs",children:[(0,X.jsx)("span",{className:"font-mono text-foreground/80 truncate",children:e.by}),(0,X.jsxs)("span",{className:"text-muted-foreground shrink-0",children:[e.opCount," op",1!==e.opCount?"s":""]})]},e.by))})})]}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Recent Activity"}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-1 max-h-72 overflow-y-auto",children:0===r.length?(0,X.jsx)("p",{className:"text-xs text-muted-foreground/60 py-2",children:"No events recorded"}):r.map(e=>(0,X.jsx)(Dh,{event:e},`${e.path}-${e.id}`))})]}),(0,X.jsx)("section",{children:(0,X.jsx)("a",{href:"/docs/agent-collab-plan.md",target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline hover:no-underline",children:"Agent collaboration docs →"})})]})]})]}):null}var Db=/[\\\/_+.#"@\[\(\{&]/,Dy=/[\\\/_+.#"@\[\(\{&]/g,Dx=/[\s-]/,Dv=/[\s-]/g;function Dw(e){return e.toLowerCase().replace(Dv," ")}var DE='[cmdk-group=""]',Dk='[cmdk-group-items=""]',DT='[cmdk-item=""]',DN=`${DT}:not([aria-disabled="true"])`,DA="cmdk-item-select",DS="data-value",DC=(e,t,n)=>{var r;return r=e,function e(t,n,r,i,s,o,a){if(o===n.length)return s===t.length?1:.99;var l=`${s},${o}`;if(void 0!==a[l])return a[l];for(var c,d,u,p,h=i.charAt(o),f=r.indexOf(h,s),m=0;f>=0;)(c=e(t,n,r,i,f+1,o+1,a))>m&&(f===s?c*=1:Db.test(t.charAt(f-1))?(c*=.8,(u=t.slice(s,f-1).match(Dy))&&s>0&&(c*=Math.pow(.999,u.length))):Dx.test(t.charAt(f-1))?(c*=.9,(p=t.slice(s,f-1).match(Dv))&&s>0&&(c*=Math.pow(.999,p.length))):(c*=.17,s>0&&(c*=Math.pow(.999,f-s))),t.charAt(f)!==n.charAt(o)&&(c*=.9999)),(c<.1&&r.charAt(f-1)===i.charAt(o+1)||i.charAt(o+1)===i.charAt(o)&&r.charAt(f-1)!==i.charAt(o))&&.1*(d=e(t,n,r,i,f+1,o+2,a))>c&&(c=.1*d),c>m&&(m=c),f=r.indexOf(h,f+1);return a[l]=m,m}(r=n&&n.length>0?`${r+" "+n.join(" ")}`:r,t,Dw(r),Dw(t),0,0,{})},D_=Q.createContext(void 0),DM=Q.createContext(void 0),DO=Q.createContext(void 0),DI=Q.forwardRef((e,t)=>{let n=Dz(()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Dz(()=>new Set),i=Dz(()=>new Map),s=Dz(()=>new Map),o=Dz(()=>new Set),a=DH(e),{label:l,children:c,value:d,onValueChange:u,filter:p,shouldFilter:h,loop:f,disablePointerSelection:m=!1,vimBindings:g=!0,...b}=e,y=t2(),x=t2(),v=t2(),w=Q.useRef(null),E=Dq();DU(()=>{if(void 0!==d){let e=d.trim();n.current.value=e,k.emit()}},[d]),DU(()=>{E(6,_)},[]);let k=Q.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,s,o,l;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)C(),A(),E(1,S);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(v);e?e.focus():null==(i=document.getElementById(y))||i.focus()}if(E(7,()=>{var e;n.current.selectedItemId=null==(e=M())?void 0:e.id,k.emit()}),r||E(5,_),(null==(s=a.current)?void 0:s.value)!==void 0){null==(l=(o=a.current).onValueChange)||l.call(o,null!=t?t:"");return}}k.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=Q.useMemo(()=>({value:(e,t,r)=>{var i;t!==(null==(i=s.current.get(e))?void 0:i.value)&&(s.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,N(t,r)),E(2,()=>{A(),k.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),E(3,()=>{C(),A(),n.current.value||S(),k.emit()}),()=>{s.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();E(4,()=>{C(),(null==t?void 0:t.getAttribute("id"))===e&&S(),k.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{s.current.delete(e),i.current.delete(e)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:y,inputId:v,labelId:x,listInnerRef:w}),[]);function N(e,t){var r,i;let s=null!=(i=null==(r=a.current)?void 0:r.filter)?i:DC;return e?s(e,n.current.search,t):0}function A(){if(!n.current.search||!1===a.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),s=0;r.forEach(t=>{s=Math.max(e.get(t),s)}),t.push([n,s])});let r=w.current;O().sort((t,n)=>{var r,i;let s=t.getAttribute("id"),o=n.getAttribute("id");return(null!=(r=e.get(o))?r:0)-(null!=(i=e.get(s))?i:0)}).forEach(e=>{let t=e.closest(Dk);t?t.appendChild(e.parentElement===t?e:e.closest(`${Dk} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Dk} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let n=null==(t=w.current)?void 0:t.querySelector(`${DE}[${DS}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)})}function S(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(DS);k.setState("value",t||void 0)}function C(){var e,t,o,l;if(!n.current.search||!1===a.current.shouldFilter){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let c=0;for(let i of r.current){let r=N(null!=(t=null==(e=s.current.get(i))?void 0:e.value)?t:"",null!=(l=null==(o=s.current.get(i))?void 0:o.keywords)?l:[]);n.current.filtered.items.set(i,r),r>0&&c++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=c}function _(){var e,t,n;let r=M();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(DE))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function M(){var e;return null==(e=w.current)?void 0:e.querySelector(`${DT}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=w.current)?void 0:e.querySelectorAll(DN))||[])}function I(e){let t=O()[e];t&&k.setState("value",t.getAttribute(DS))}function D(e){var t;let n=M(),r=O(),i=r.findIndex(e=>e===n),s=r[i+e];null!=(t=a.current)&&t.loop&&(s=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),s&&k.setState("value",s.getAttribute(DS))}function R(e){let t=M(),n=null==t?void 0:t.closest(DE),r;for(;n&&!r;)r=null==(n=e>0?function(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}(n,DE):function(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}(n,DE))?void 0:n.querySelector(DN);r?k.setState("value",r.getAttribute(DS)):D(e)}let L=()=>I(O().length-1),j=e=>{e.preventDefault(),e.metaKey?L():e.altKey?R(1):D(1)},P=e=>{e.preventDefault(),e.metaKey?I(0):e.altKey?R(-1):D(-1)};return Q.createElement(kL.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=b.onKeyDown)||t.call(b,e);let n=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||n))switch(e.key){case"n":case"j":g&&e.ctrlKey&&j(e);break;case"ArrowDown":j(e);break;case"p":case"k":g&&e.ctrlKey&&P(e);break;case"ArrowUp":P(e);break;case"Home":e.preventDefault(),I(0);break;case"End":e.preventDefault(),L();break;case"Enter":{e.preventDefault();let t=M();if(t){let e=new Event(DA);t.dispatchEvent(e)}}}}},Q.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:DW},l),DV(e,e=>Q.createElement(DM.Provider,{value:k},Q.createElement(D_.Provider,{value:T},e))))}),DD=Q.forwardRef((e,t)=>{var n,r;let i=t2(),s=Q.useRef(null),o=Q.useContext(DO),a=Q.useContext(D_),l=DH(e),c=null!=(r=null==(n=l.current)?void 0:n.forceMount)?r:null==o?void 0:o.forceMount;DU(()=>{if(!c)return a.item(i,null==o?void 0:o.id)},[c]);let d=DG(i,s,[e.value,e.children,s],e.keywords),u=Q.useContext(DM),p=D$(e=>e.value&&e.value===d.current),h=D$(e=>!!c||!1===a.filter()||!e.search||e.filtered.items.get(i)>0);function f(){var e,t;m(),null==(t=(e=l.current).onSelect)||t.call(e,d.current)}function m(){u.setState("value",d.current,!0)}if(Q.useEffect(()=>{let t=s.current;if(!(!t||e.disabled))return t.addEventListener(DA,f),()=>t.removeEventListener(DA,f)},[h,e.onSelect,e.disabled]),!h)return null;let{disabled:g,value:b,onSelect:y,forceMount:x,keywords:v,...w}=e;return Q.createElement(kL.div,{ref:eL(s,t),...w,id:i,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!p,"data-disabled":!!g,"data-selected":!!p,onPointerMove:g||a.getDisablePointerSelection()?void 0:m,onClick:g?void 0:f},e.children)}),DR=Q.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...s}=e,o=t2(),a=Q.useRef(null),l=Q.useRef(null),c=t2(),d=Q.useContext(D_),u=D$(e=>!!i||!1===d.filter()||!e.search||e.filtered.groups.has(o));DU(()=>d.group(o),[]),DG(o,a,[e.value,e.heading,l]);let p=Q.useMemo(()=>({id:o,forceMount:i}),[i]);return Q.createElement(kL.div,{ref:eL(a,t),...s,"cmdk-group":"",role:"presentation",hidden:!u||void 0},n&&Q.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),DV(e,e=>Q.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},Q.createElement(DO.Provider,{value:p},e))))}),DL=Q.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Q.useRef(null),s=D$(e=>!e.search);return n||s?Q.createElement(kL.div,{ref:eL(i,t),...r,"cmdk-separator":"",role:"separator"}):null}),Dj=Q.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=null!=e.value,s=Q.useContext(DM),o=D$(e=>e.search),a=D$(e=>e.selectedItemId),l=Q.useContext(D_);return Q.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),Q.createElement(kL.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?e.value:o,onChange:e=>{i||s.setState("search",e.target.value),null==n||n(e.target.value)}})}),DP=Q.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,s=Q.useRef(null),o=Q.useRef(null),a=D$(e=>e.selectedItemId),l=Q.useContext(D_);return Q.useEffect(()=>{if(o.current&&s.current){let e=o.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty("--cmdk-list-height",n.toFixed(1)+"px")})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Q.createElement(kL.div,{ref:eL(s,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},DV(e,e=>Q.createElement("div",{ref:eL(o,l.listInnerRef),"cmdk-list-sizer":""},e)))}),DB=Q.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=e;return Q.createElement(rl,{open:n,onOpenChange:r},Q.createElement(rh,{container:o},Q.createElement(rm,{"cmdk-overlay":"",className:i}),Q.createElement(rx,{"aria-label":e.label,"cmdk-dialog":"",className:s},Q.createElement(DI,{ref:t,...a}))))}),DF=Object.assign(DI,{List:DP,Item:DD,Input:Dj,Group:DR,Separator:DL,Dialog:DB,Empty:Q.forwardRef((e,t)=>D$(e=>0===e.filtered.count)?Q.createElement(kL.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:Q.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...s}=e;return Q.createElement(kL.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},DV(e,e=>Q.createElement("div",{"aria-hidden":!0},e)))})});function DH(e){let t=Q.useRef(e);return DU(()=>{t.current=e}),t}var DU="u"<typeof window?Q.useEffect:Q.useLayoutEffect;function Dz(e){let t=Q.useRef();return void 0===t.current&&(t.current=e()),t}function D$(e){let t=Q.useContext(DM),n=()=>e(t.snapshot());return Q.useSyncExternalStore(t.subscribe,n,n)}function DG(e,t,n,r=[]){let i=Q.useRef(),s=Q.useContext(D_);return DU(()=>{var o;let a=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():i.current}})(),l=r.map(e=>e.trim());s.value(e,a,l),null==(o=t.current)||o.setAttribute(DS,a),i.current=a}),i}var Dq=()=>{let[e,t]=Q.useState(),n=Dz(()=>new Map);return DU(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function DV({asChild:e,children:t},n){let r;return e&&Q.isValidElement(t)?Q.cloneElement("function"==typeof(r=t.type)?r(t.props):"render"in r?r.render(t.props):t,{ref:t.ref},n(t.props.children)):n(t)}var DW={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};let DK=en("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),DY=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF,{ref:n,className:tK("flex h-full w-full flex-col overflow-hidden rounded-sm bg-popover text-popover-foreground",e),...t}));function DX({children:e,shouldFilter:t,...n}){return(0,X.jsx)(rl,{...n,children:(0,X.jsxs)(rj,{className:"overflow-hidden p-0 shadow-golden max-w-lg",children:[(0,X.jsx)(rF,{className:"sr-only",children:"Search"}),(0,X.jsx)(DY,{shouldFilter:t,className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})]})})}DY.displayName=DF.displayName;let DQ=Q.forwardRef(({className:e,...t},n)=>(0,X.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,X.jsx)(DK,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,X.jsx)(DF.Input,{ref:n,className:tK("flex h-11 w-full rounded-sm bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));DQ.displayName=DF.Input.displayName;let DJ=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.List,{ref:n,className:tK("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));DJ.displayName=DF.List.displayName;let DZ=Q.forwardRef((e,t)=>(0,X.jsx)(DF.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));DZ.displayName=DF.Empty.displayName;let D0=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.Group,{ref:n,className:tK("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));D0.displayName=DF.Group.displayName;let D1=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.Separator,{ref:n,className:tK("-mx-1 h-px bg-border",e),...t}));D1.displayName=DF.Separator.displayName;let D2=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(DF.Item,{ref:n,className:tK("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));D2.displayName=DF.Item.displayName;let D3=null,D5=wu(e=>({query:"",results:[],loading:!1,truncated:!1,open:!1,setQuery:t=>e({query:t}),setOpen:t=>e({open:t}),clear:()=>{D3?.abort(),e({query:"",results:[],loading:!1,truncated:!1})},search:async t=>{D3?.abort();let n=new AbortController;if(D3=n,!t.trim())return void e({results:[],loading:!1,truncated:!1});e({loading:!0});try{let r=await rK("/api/wiki/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t,limit:30}),signal:n.signal});if(!r.ok)return void e({results:[],loading:!1,truncated:!1});let i=await r.json();if(n.signal.aborted)return;e({results:i.matches??[],truncated:!!i.truncated,loading:!1})}catch(t){"AbortError"!==t.name&&e({loading:!1})}}}));function D4({html:e}){let t=function(e){let t,n=[],r=/<mark>([\s\S]*?)<\/mark>/g,i=0;for(;null!==(t=r.exec(e));)t.index>i&&n.push({text:e.slice(i,t.index),mark:!1}),n.push({text:t[1]??"",mark:!0}),i=t.index+t[0].length;return i<e.length&&n.push({text:e.slice(i),mark:!1}),n}(e);return(0,X.jsx)(X.Fragment,{children:t.map((e,t)=>e.mark?(0,X.jsx)("mark",{className:"bg-yellow-200 dark:bg-yellow-700 rounded-[2px] px-[1px]",children:e.text},t):(0,X.jsx)("span",{children:e.text},t))})}function D6({onOpenFile:e,onToggleSidebar:t=()=>void 0,onNewFile:n=()=>void 0,onCopyPath:r=()=>void 0}){let i=D5(e=>e.open),s=D5(e=>e.setOpen),o=D5(e=>e.query),a=D5(e=>e.setQuery),l=D5(e=>e.results),c=D5(e=>e.loading),d=D5(e=>e.truncated),u=D5(e=>e.search),{resolvedTheme:p,setTheme:h}=(0,I_.useTheme)(),f=wp(e=>e.toggle),m=wM(e=>e.width),g=wM(e=>e.cycle),b=o.trimStart(),y=""===b||b.startsWith(">"),x=y?"":o;function v(e){e(),s(!1),a("")}(0,Q.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),s(!i))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,s]),(0,Q.useEffect)(()=>{if(!i||y)return;let e=setTimeout(()=>{u(x)},120);return()=>clearTimeout(e)},[x,y,i,u]);let w=(w_.indexOf(m)+1)%w_.length,E=wC[w_[w]];return(0,X.jsxs)(DX,{open:i,onOpenChange:e=>{s(e),e||a("")},shouldFilter:!1,children:[(0,X.jsx)(DQ,{placeholder:"Search files… ( > for actions )",value:o,onValueChange:a}),(0,X.jsxs)(DJ,{children:[y&&(0,X.jsxs)(D0,{heading:"Actions",children:[(0,X.jsxs)(D2,{value:"toggle-dark-mode",onSelect:()=>v(()=>h("dark"===p?"light":"dark")),children:["dark"===p?(0,X.jsx)(IC,{className:"mr-2 h-4 w-4"}):(0,X.jsx)(IS,{className:"mr-2 h-4 w-4"}),"dark"===p?"Switch to light mode":"Switch to dark mode"]}),(0,X.jsxs)(D2,{value:"toggle-ai-panel",onSelect:()=>v(f),children:[(0,X.jsx)(ei,{className:"mr-2 h-4 w-4"}),"Toggle AI panel"]}),(0,X.jsxs)(D2,{value:"toggle-sidebar",onSelect:()=>v(t),children:[(0,X.jsx)(_p,{className:"mr-2 h-4 w-4"}),"Toggle sidebar"]}),(0,X.jsxs)(D2,{value:"new-file",onSelect:()=>v(n),children:[(0,X.jsx)(eu,{className:"mr-2 h-4 w-4"}),"New file"]}),(0,X.jsxs)(D2,{value:"copy-path",onSelect:()=>v(r),children:[(0,X.jsx)(el,{className:"mr-2 h-4 w-4"}),"Copy current file path"]}),(0,X.jsxs)(D2,{value:"cycle-view-width",onSelect:()=>v(g),children:[(0,X.jsx)(ki,{className:"mr-2 h-4 w-4"}),(0,X.jsxs)("span",{children:["Change view width"," ",(0,X.jsxs)("span",{className:"text-muted-foreground",children:["(",wC[m]," → ",E,")"]})]})]})]}),!y&&(0,X.jsxs)(X.Fragment,{children:[c&&(0,X.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Searching…"}),!c&&""!==x.trim()&&0===l.length&&(0,X.jsx)(DZ,{children:"No matches."}),l.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D1,{}),(0,X.jsx)(D0,{heading:d?"Top results (refine query for more)":"Results",children:l.map(t=>(0,X.jsx)(D2,{value:t.path,onSelect:()=>{e(t.path),s(!1),a("")},children:(0,X.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,X.jsx)("span",{className:"truncate font-mono text-xs",children:t.path}),t.snippet&&(0,X.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:(0,X.jsx)(D4,{html:t.snippet})})]})},t.path))})]})]})]})]})}function D9({onOpenFile:e}){let t=D5(e=>e.query),n=D5(e=>e.setQuery),r=D5(e=>e.results),i=D5(e=>e.loading),s=D5(e=>e.search),o=D5(e=>e.clear),[a,l]=(0,Q.useState)(0),c=(0,Q.useRef)(null);function d(t){let n=r[t];n&&(e(n.path),o())}return(0,Q.useEffect)(()=>{l(0)},[r]),(0,Q.useEffect)(()=>{let e=c.current?.querySelector(`[data-idx="${a}"]`);e?.scrollIntoView({block:"nearest"})},[a]),(0,X.jsxs)("div",{className:"flex flex-col gap-1 px-2 py-1.5",children:[(0,X.jsxs)("div",{className:"relative",children:[(0,X.jsx)(DK,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 opacity-50"}),(0,X.jsx)("input",{type:"text",className:"w-full rounded-sm border bg-transparent py-1 pl-7 pr-2 text-xs outline-none focus:ring-1 focus:ring-ring",placeholder:"Search… (⌘K)",value:t,onChange:e=>{n(e.target.value),s(e.target.value)},onKeyDown:e=>{"Escape"===e.key?o():0!==r.length&&("ArrowDown"===e.key?(e.preventDefault(),l(e=>(e+1)%r.length)):"ArrowUp"===e.key?(e.preventDefault(),l(e=>(e-1+r.length)%r.length)):"Enter"===e.key&&(e.preventDefault(),d(a)))}})]}),""!==t.trim()&&(0,X.jsxs)("div",{ref:c,className:"max-h-64 overflow-y-auto rounded-sm border bg-popover",children:[i&&(0,X.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"Searching…"}),!i&&0===r.length&&(0,X.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"No matches"}),r.map((e,t)=>(0,X.jsxs)("button",{type:"button","data-idx":t,onClick:()=>d(t),onMouseEnter:()=>l(t),className:`block w-full px-2 py-1 text-left ${t===a?"bg-accent":"hover:bg-accent"}`,children:[(0,X.jsx)("div",{className:"truncate font-mono text-xs",children:e.path}),e.snippet&&(0,X.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:(0,X.jsx)(D4,{html:e.snippet})})]},e.path))]})]})}function D7({className:e}){let t=wM(e=>e.width),n=wM(e=>e.setWidth);return(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${e??""}`,title:`Content width: ${wC[t]}`,children:(0,X.jsx)(ks,{className:"h-3.5 w-3.5"})})}),(0,X.jsx)(Ib,{align:"end",className:"w-36",children:w_.map(e=>(0,X.jsxs)(Iy,{onClick:()=>n(e),className:"flex items-center justify-between text-xs",children:[wC[e],e===t&&(0,X.jsx)(es,{className:"h-3.5 w-3.5"})]},e))})]})}function D8(e){return e.split(".").pop()?.toLowerCase()??""}function Re(e,t){if("node-app"===t)return"node-app";if("app"===t)return"app";if("dir"===t)return"fallback";let n=e.split("/").pop()??e;if(n.startsWith(".")&&-1===n.indexOf(".",1))return"source";let r=D8(e);return r?["md","markdown"].includes(r)?"editor":"txt"===r?"text":["csv","tsv"].includes(r)?"csv":"pdf"===r?"pdf":["mmd","mermaid"].includes(r)?"mermaid":"ipynb"===r?"notebook":["png","jpg","jpeg","gif","webp","svg","avif","ico","bmp"].includes(r)?"image":["mp4","webm","mov","m4v","mp3","wav","ogg","m4a","aac"].includes(r)?"media":"docx"===r?"docx":["xlsx","xlsm"].includes(r)?"xlsx":"pptx"===r?"pptx":"html"===r?"html":(["py","js","ts","tsx","jsx","go","rs","java","c","cpp","h","sh","bash","zsh","rb","php","swift","kt","lua","sql","yaml","yml","toml","json","xml","css","scss"].includes(r),"source"):"source"}let Rt=new Set(["txt","md","markdown","json","yaml","yml","toml","csv","tsv","xml","html","css","js","ts","tsx","jsx","sh","bash","zsh","rb","py","go","rs","java","c","cpp","h","php","swift","kt","lua","sql","scss","mmd","mermaid","ini","env","log","conf"]);function Rn(e){let t=Re(e,"file");return"editor"===t||"text"===t||Rt.has(D8(e))}function Rr(e){return["md","markdown"].includes(D8(e))}function Ri(e){return"image"===Re(e,"file")}async function Rs(e){let t=await rK(`/api/wiki?dir=${encodeURIComponent(e)}`);return t.ok?(await t.json()).entries.map(t=>({name:t.name,path:e?`${e}/${t.name}`:t.name,type:t.type,size:t.size,modifiedAt:t.modifiedAt,expanded:!1})):[]}function Ro(e,t,n){return e.map(e=>e.path===t?n(e):e.children?{...e,children:Ro(e.children,t,n)}:e)}e.s(["default",0,function(){let e;wO(e=>e.loadedAt),(0,Q.useEffect)(()=>{wO.getState().load()},[]);let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[s,o]=(0,Q.useState)(()=>rV()),[a,l]=(0,Q.useState)([]),[c,d]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)(!1),[h,f]=(0,Q.useState)(null),m=(0,Q.useCallback)(async()=>{try{let e=await fetch("/api/system/workspaces");if(!e.ok)throw Error("Failed");let t=await e.json();if(l(t.workspaces),d(t.isAdmin),t.workspaces.length>0){n(!0);let e=new URLSearchParams(window.location.search).get("ws"),r=e?t.workspaces.find(t=>t.id===e):null,s=r??[...t.workspaces].sort((e,t)=>(t.lastOpenedAt??t.createdAt).localeCompare(e.lastOpenedAt??e.createdAt))[0];if(o(s.id),i(s.rootDir),!r){let e=new URL(location.href);e.searchParams.set("ws",s.id),history.replaceState(null,"",e.toString())}}else n(!1)}catch{n(!1)}},[]);(0,Q.useEffect)(()=>{m()},[m]);let g=wk(e=>e.currentPath),b=De(e=>e.recents),[y,x]=(0,Q.useState)(!1),[v,w]=(0,Q.useState)(!0),E=Dr(e=>e.pins),k=(0,Q.useRef)(null),T=wp(e=>e.activity),N=(0,Q.useMemo)(()=>{let e=new Date(Date.now()-6e4).toISOString(),t=new Set;for(let n of T)n.at>=e&&n.path&&n.by?.startsWith("ai:")&&t.add(n.path);return t},[T]);(0,Q.useEffect)(()=>{let e=()=>{wp.getState().loadActivity()};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]),(0,Q.useEffect)(()=>{De.getState().loadForWorkspace(s),Dr.getState().loadForWorkspace(s)},[s]);let A=(0,Q.useRef)(new URLSearchParams(window.location.search).get("path")),S=(0,Q.useRef)(!1),[C,_]=(0,Q.useState)([]),[M,O]=(0,Q.useState)(!1),[I,D]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),[L,j]=(0,Q.useState)(!1),[P,B]=(0,Q.useState)(!1),[F,H]=(0,Q.useState)(null),U=(0,Q.useRef)(null),z=(0,Q.useRef)(""),[$,G]=(0,Q.useState)(null),[q,V]=(0,Q.useState)(""),[W,K]=(0,Q.useState)(null),[Y,J]=(0,Q.useState)(null),[Z,ee]=(0,Q.useState)(""),[et,en]=(0,Q.useState)(null),[eR,eL]=(0,Q.useState)(null),[ej,eP]=(0,Q.useState)(!1),[eB,eF]=(0,Q.useState)(null),[eH,eU]=(0,Q.useState)(!1),[ez,e$]=(0,Q.useState)(0),[eG,eq]=(0,Q.useState)(!1),[eV,eW]=(0,Q.useState)(!1),[eK,eY]=(0,Q.useState)(null),[eX,eQ]=(0,Q.useState)(0),[eJ,eZ]=(0,Q.useState)(!1),[e0,e1]=(0,Q.useState)(!1),[e2,e3]=(0,Q.useState)(""),[e5,e4]=(0,Q.useState)(!1),[e6,e9]=(0,Q.useState)(null),e7=(0,Q.useRef)(null),[e8,te]=(0,Q.useState)(null),tt=(0,Q.useRef)(null),tn=(0,Q.useRef)(!1),tr=(0,Q.useRef)(async()=>{});(0,Q.useEffect)(()=>{M||R.current||(R.current=!0,D(!0),Rs("").then(e=>{_(e),O(!0),D(!1)}).catch(()=>{R.current=!1,D(!1)}))},[M]);let ti=(0,Q.useCallback)(async e=>{let t=e.split("/");if(t.length<=1)return;let n=[],r="";for(let e=0;e<t.length-1;e++)r=r?`${r}/${t[e]}`:t[e],n.push({prefix:r,children:await Rs(r)});_(e=>{let t=e;for(let{prefix:e,children:r}of n)t=Ro(t,e,e=>({...e,children:r,expanded:!0}));return t})},[]),ts=(0,Q.useCallback)(async e=>{let t=await Rs(e);""===e?_(e=>{let n=new Map(e.map(e=>[e.path,e]));return t.map(e=>{let t=n.get(e.path);return t&&("dir"===t.type||"app"===t.type)?{...e,expanded:t.expanded,children:t.children}:e})}):_(n=>Ro(n,e,e=>({...e,children:t,expanded:!0})))},[]),to=(0,Q.useCallback)(e=>{let t=[];for(let n of e)("dir"===n.type||"app"===n.type||"node-app"===n.type)&&n.expanded&&n.children&&(t.push(n.path),t.push(...to(n.children)));return t},[]),ta=(0,Q.useCallback)(async()=>{j(!0);try{let e=to(C),t=await Rs("");for(let n of(_(t),e)){let e=await Rs(n);_(t=>Ro(t,n,t=>({...t,children:e,expanded:!0})))}}finally{j(!1)}},[C,to]),tl=(0,Q.useCallback)(async()=>{if(eB){if(Rr(eB.name)){eZ(!0);try{await wk.getState().loadPage(eB.path)}finally{eZ(!1)}return}if(["editor","text"].includes(Re(eB.name,eB.nodeType))||Rn(eB.name)){eZ(!0);try{let e=await rK(`/api/wiki/content?path=${encodeURIComponent(eB.path)}`);if(e.ok){let t=await e.json();eY(t.content),eQ(Number(e.headers.get("X-Wiki-Revision")??0))}}catch{}eZ(!1)}}},[eB]);async function tc(e){if("dir"===e.type||"app"===e.type||"node-app"===e.type)if(e.expanded)_(t=>Ro(t,e.path,e=>({...e,expanded:!1})));else if(void 0===e.children){_(t=>Ro(t,e.path,e=>({...e,loading:!0})));let t=await Rs(e.path);_(n=>Ro(n,e.path,e=>({...e,loading:!1,children:t,expanded:!0})))}else _(t=>Ro(t,e.path,e=>({...e,expanded:!0})))}async function td(e){if("file"===e.type&&De.getState().push({path:e.path,name:e.name},s),eF({path:e.path,name:e.name,nodeType:"app"===e.type?"app":"node-app"===e.type?"node-app":"file"}),e1(!1),e9(null),eY(null),eQ(0),"file"===e.type&&Rr(e.name)){eZ(!0);try{await wk.getState().loadPage(e.path)}finally{eZ(!1)}return}if(["editor","text"].includes(Re(e.name,e.type))||Rn(e.name)){eZ(!0);try{let t=await rK(`/api/wiki/content?path=${encodeURIComponent(e.path)}`);if(t.ok){let e=await t.json();eY(e.content),eQ(Number(t.headers.get("X-Wiki-Revision")??0))}}catch{}eZ(!1)}}(0,Q.useEffect)(()=>{eB&&Rr(eB.name)&&wk.getState().currentPath!==eB.path&&wk.getState().loadPage(eB.path)},[eB]),(0,Q.useEffect)(()=>{tt.current=eB},[eB]),(0,Q.useEffect)(()=>{tn.current=e0},[e0]),(0,Q.useEffect)(()=>{tr.current=tl},[tl]),(0,Q.useEffect)(()=>{if(!t)return;let e=new Map,n=new EventSource(rW("/api/wiki/watch"));return n.onmessage=t=>{var n;let r;try{r=JSON.parse(t.data)}catch{return}let{type:i,path:s}=r,o=s.split("/");if(n=o.length>1?o.slice(0,-1).join("/"):"",e.has(n)&&clearTimeout(e.get(n)),e.set(n,setTimeout(()=>{e.delete(n),ts(n)},300)),"change"===i&&tt.current?.path===s&&!tn.current){let t=`__file__${s}`;e.has(t)&&clearTimeout(e.get(t)),e.set(t,setTimeout(()=>{e.delete(t),tr.current()},400))}},()=>{for(let t of(n.close(),e.values()))clearTimeout(t)}},[t,ts]),(0,Q.useEffect)(()=>{eU(!1)},[]);let tu=(0,Q.useCallback)(e=>{let t=e.split("/").pop()??e;ti(e),td({path:e,name:t,type:"file"})},[ti]);(0,Q.useEffect)(()=>{if(!g||eB&&eB.path===g)return;let e=g.split("/").pop()??g;td({path:g,name:e,type:"file"})},[g]),(0,Q.useEffect)(()=>{let e=new URL(window.location.href);eB?e.searchParams.set("path",eB.path):e.searchParams.delete("path"),window.history.replaceState(null,"",e.toString())},[eB]),(0,Q.useEffect)(()=>{if(S.current||!M)return;let e=A.current;if(!e){S.current=!0;return}S.current=!0,(async()=>{let t=e.split("/"),n=t[t.length-1],r=t.slice(0,-1).join("/"),i=(await Rs(r)).find(t=>t.path===e);i&&(await ti(e),td({path:e,name:n,type:i.type,modifiedAt:i.modifiedAt}))})()},[M,ti]);let tp=(0,Q.useCallback)(async e=>{if(e===s)return;try{await fetch(`/api/system/workspaces/${e}/open`,{method:"POST"})}catch{}let t=new URL(location.href);t.searchParams.set("ws",e),t.searchParams.delete("path"),history.pushState(null,"",t.toString()),eF(null),eY(null),e1(!1),_([]),O(!1),R.current=!1,wO.getState().invalidate();let n=a.find(t=>t.id===e);n&&i(n.rootDir),o(e)},[s,a]),th=(0,Q.useCallback)(async()=>{if(h)try{if(!(await fetch(`/api/system/workspaces/${h}`,{method:"DELETE"})).ok)throw Error("Failed");if(h===s){let e=a.filter(e=>e.id!==h);if(e.length>0){let t=[...e].sort((e,t)=>(t.lastOpenedAt??t.createdAt).localeCompare(e.lastOpenedAt??e.createdAt))[0];await tp(t.id)}else n(!1)}await m()}catch{}finally{f(null)}},[h,s,a,tp,m]);async function tf(){if(!eB)return;e4(!0),e9(null);let e=await rK("/api/wiki/content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:eB.path,content:e2,baseRevision:eX})});if(e.ok){let t=await e.json();"number"==typeof t.revision&&eQ(t.revision),eY(e2),e1(!1)}else e9((await e.json()).error??"Save failed");e4(!1)}let tm=(0,Q.useCallback)(async(e,t)=>{let n=Array.from(e);if(n.length){B(!0),H(null);try{for(let e of n){let n=new FormData;n.append("file",e),n.append("dir",t);let r=await rK("/api/wiki/upload",{method:"POST",body:n});if(!r.ok){let e=await r.json();H(e.error??"Upload failed"),wB(e.error??"Upload failed");break}}await ts(t)}catch{H("Upload failed.")}finally{B(!1),U.current&&(U.current.value="")}}},[ts]);function tg(e){z.current=e,U.current?.click()}async function tb(){let e=q.trim();if(!e||null===$)return;K(null);let t=$?`${$}/${e}`:e,n=await rK("/api/wiki/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});n.ok?(G(null),V(""),await ts($),""!==$&&_(e=>Ro(e,$,e=>({...e,expanded:!0})))):K((await n.json()).error??"Failed")}async function ty(){let e=Z.trim();if(!e||null===Y)return;en(null);let t=e.includes(".")?e:`${e}.md`,n=Y?`${Y}/${t}`:t,r=await rK("/api/wiki/new-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});r.ok?(J(null),ee(""),await ts(Y),""!==Y&&_(e=>Ro(e,Y,e=>({...e,expanded:!0}))),td({path:n,name:t,type:"file",modifiedAt:new Date().toISOString()})):en((await r.json()).error??"Failed")}function tx(e){navigator.clipboard.writeText(e),wP("Path copied")}function tv(e){let t=e.replace(/\.(md|markdown)$/i,"");navigator.clipboard.writeText(`[[${t}]]`),wP("Wiki link copied")}function tw(e){let t=new URL(location.href);t.searchParams.set("path",e),s&&t.searchParams.set("ws",s),navigator.clipboard.writeText(t.toString()),wP("URL copied")}async function tE(e){if(eB?.path===e&&null!==eK)return eK;if(wk.getState().currentPath===e)return wk.getState().content;let t=await rK(`/api/wiki/content?path=${encodeURIComponent(e)}`);if(!t.ok)throw Error("Cannot copy content");return(await t.json()).content}async function tk(e){try{let t=await tE(e);await navigator.clipboard.writeText(t),wP("Raw content copied")}catch{wB("Could not copy file content")}}async function tT(e,t){try{let n=await tE(e);if(!Rr(t)){await navigator.clipboard.writeText(n),wP("Content copied");return}let r=await vA(n,{pagePath:e,sanitize:!0});"ClipboardItem"in window&&navigator.clipboard.write?await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:"text/html"}),"text/plain":new Blob([n],{type:"text/plain"})})]):await navigator.clipboard.writeText(n),wP("Formatted content copied")}catch{wB("Could not copy formatted content")}}function tN(e){return(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 px-2 text-xs",title:"Copy path, wiki link, or URL",children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),"Copy",(0,X.jsx)(eo,{className:"h-3 w-3 opacity-60"})]})}),(0,X.jsxs)(Ib,{align:"end",className:"w-44",children:[(0,X.jsxs)(Iy,{onClick:()=>tx(e.path),children:[(0,X.jsx)(el,{className:"mr-2 h-3.5 w-3.5"}),"Copy path"]}),Rr(e.name)&&(0,X.jsxs)(Iy,{onClick:()=>tv(e.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy wiki link"]}),(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{onClick:()=>tw(e.path),children:[(0,X.jsx)(ey,{className:"mr-2 h-3.5 w-3.5"}),"Copy URL"]}),Rn(e.name)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{onClick:()=>void tk(e.path),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy raw content"]}),(0,X.jsxs)(Iy,{onClick:()=>void tT(e.path,e.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy formatted content"]})]})]})]})}async function tA(){eR&&(await rK("/api/wiki",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:eR})}),(eB?.path===eR||eB?.path.startsWith(`${eR}/`))&&(eF(null),eY(null)),_(e=>(function e(t,n){return t.filter(e=>e.path!==n).map(t=>t.children?{...t,children:e(t.children,n)}:t)})(e,eR)),eL(null))}function tS(e,t,n){e.preventDefault(),e.stopPropagation();let r=e7.current;!r||r.path===t||t.startsWith(`${r.path}/`)||(e.dataTransfer.dropEffect="move",te("root"===n?"":t))}async function tC(e,t){e.preventDefault(),e.stopPropagation(),te(null);let n=e7.current;if(e7.current=null,!n||n.path===t||t.startsWith(`${n.path}/`))return;let r=t?`${t}/${n.name}`:n.name;if(r!==n.path&&(await rK("/api/wiki/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:n.path,to:r})})).ok){let e=n.path.includes("/")?n.path.split("/").slice(0,-1).join("/"):"";await ts(e),t!==e&&await ts(t),eB?.path===n.path&&eF({path:r,name:n.name,nodeType:eB.nodeType})}}let t_=eB?Re(eB.name,eB.nodeType):null,tM=wM(e=>e.width),tO=null===t_||"editor"===t_||"text"===t_||"source"===t_||"notebook"===t_||"fallback"===t_,tI=tO?wA[tM]:"";return(0,X.jsxs)("div",{className:"flex h-screen gap-0 overflow-hidden bg-background",children:[null===t&&(0,X.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!1===t&&(0,X.jsx)(IA,{onSelect:e=>{let t=new URL(location.href);t.searchParams.set("ws",e),t.searchParams.delete("path"),history.replaceState(null,"",t.toString()),O(!1),R.current=!1,o(e),n(!0),m()}}),!0===t&&u&&(0,X.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,X.jsx)("div",{className:"flex items-center justify-end border-b px-3 py-2 bg-muted shrink-0",children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>p(!1),children:[(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})," Cancel"]})}),(0,X.jsx)(IA,{onSelect:e=>{p(!1),m(),tp(e)}})]}),!0===t&&!u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D6,{onOpenFile:tu,onToggleSidebar:()=>eq(e=>!e),onNewFile:()=>J(""),onCopyPath:()=>{eB&&navigator.clipboard.writeText(eB.path)}}),!eG&&(0,X.jsxs)(IP,{className:"flex flex-col w-72 shrink-0 overflow-hidden rounded-none border-r border-l-0 border-t-0 border-b-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,X.jsx)("img",{src:"/logo.svg",alt:"Wiki Viewer",className:"h-5 w-5 shrink-0"}),(0,X.jsx)("span",{className:"truncate text-xs font-semibold tracking-tight",children:"Wiki Viewer"})]}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 shrink-0",title:"Collapse sidebar",onClick:()=>eq(!0),children:(0,X.jsx)(eE,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex items-center justify-between gap-1 px-3 py-1.5 border-b bg-muted/50 shrink-0",children:[(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1 px-2 text-xs",disabled:P,children:[P?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eA,{className:"h-3.5 w-3.5"}),"New",(0,X.jsx)(eo,{className:"h-3 w-3 opacity-60"})]})}),(0,X.jsxs)(Ib,{align:"start",className:"w-44",children:[(0,X.jsxs)(Iy,{onClick:()=>{J(""),ee(""),en(null)},children:[(0,X.jsx)(eu,{className:"mr-2 h-3.5 w-3.5"}),"New file"]}),(0,X.jsxs)(Iy,{onClick:()=>{G(""),V(""),K(null)},children:[(0,X.jsx)(em,{className:"mr-2 h-3.5 w-3.5"}),"New folder"]}),(0,X.jsxs)(Iy,{onClick:()=>tg(""),disabled:P,children:[(0,X.jsx)(eI,{className:"mr-2 h-3.5 w-3.5"}),"Upload"]})]})]}),(0,X.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh tree",onClick:ta,disabled:L,children:L?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(IM,{}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"AI Agent panel",onClick:()=>wp.getState().toggle(),children:(0,X.jsx)(ei,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Settings",onClick:()=>eW(!0),children:(0,X.jsx)(eC,{className:"h-3.5 w-3.5"})})]})]}),F&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-destructive bg-destructive/10 shrink-0",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0"}),F]}),""===$&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(eh,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:q,onChange:e=>V(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tb(),"Escape"===e.key&&(G(null),V(""))}}),W&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:W}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tb,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{G(null),V("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),""===Y&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:Z,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ty(),"Escape"===e.key&&(J(null),ee(""))}}),et&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:et}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ty,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{J(null),ee("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),(0,X.jsx)("div",{className:"border-b",children:(0,X.jsx)(D9,{onOpenFile:tu})}),(0,X.jsxs)("div",{ref:k,className:tK("flex-1 overflow-auto py-1",""===e8&&"ring-2 ring-inset ring-primary bg-primary/5"),onDragOver:e=>tS(e,"","root"),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||te(null)},onDrop:e=>tC(e,""),children:[E.length>0&&(0,X.jsxs)("div",{className:"border-b mb-1",children:[(0,X.jsxs)("button",{type:"button",className:"flex w-full items-center gap-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground",onClick:()=>x(e=>!e),children:[y?(0,X.jsx)(ea,{className:"h-3 w-3"}):(0,X.jsx)(eo,{className:"h-3 w-3"}),(0,X.jsx)(eN,{className:"h-3 w-3"}),"Pinned",(0,X.jsx)("span",{className:"ml-auto text-[9px] tabular-nums opacity-60",children:E.length})]}),!y&&E.map(e=>(0,X.jsxs)("div",{role:"button",tabIndex:0,className:tK("group flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer transition-colors select-none",eB?.path===e.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted"),onClick:()=>void td({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),td({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}))},children:[(0,X.jsx)(e_,{className:"h-3 w-3 shrink-0 fill-current text-amber-400"}),(0,X.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs",children:e.name}),(0,X.jsx)("span",{className:"max-w-[80px] truncate text-[10px] text-muted-foreground/60",children:e.path.split("/").slice(0,-1).join("/")}),(0,X.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground/50 opacity-0 transition-colors hover:bg-muted hover:text-amber-400 group-hover:opacity-100 focus:opacity-100",title:"Remove from pinned",onClick:t=>{t.stopPropagation(),Dr.getState().toggle({path:e.path,name:e.name},s)},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]},e.path))]}),b.length>0&&(0,X.jsxs)("div",{className:"border-b mb-1",children:[(0,X.jsxs)("button",{type:"button",className:"flex w-full items-center gap-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground",onClick:()=>w(e=>!e),children:[v?(0,X.jsx)(ea,{className:"h-3 w-3"}):(0,X.jsx)(eo,{className:"h-3 w-3"}),"Recent",(0,X.jsx)("span",{className:"ml-auto text-[9px] tabular-nums opacity-60",children:b.length})]}),!v&&b.slice(0,8).map(e=>(0,X.jsxs)("div",{role:"button",tabIndex:0,className:tK("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer transition-colors select-none",eB?.path===e.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted"),onClick:()=>void td({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),td({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}))},children:[(0,X.jsx)(ep,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"flex-1 truncate text-xs",children:e.name}),(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/60 truncate max-w-[80px]",children:e.path.split("/").slice(0,-1).join("/")})]},e.path))]}),I?(0,X.jsx)("div",{className:"flex justify-center py-6",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===C.length?(0,X.jsxs)("div",{className:"flex flex-col items-center gap-3 px-4 py-8 text-center",children:[(0,X.jsx)("div",{className:"rounded-full bg-muted p-3",children:(0,X.jsx)(ep,{className:"h-6 w-6 text-muted-foreground"})}),(0,X.jsxs)("div",{className:"space-y-1",children:[(0,X.jsx)("p",{className:"text-sm font-medium",children:"No files yet"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Upload files or add them to the configured directory"})]}),(0,X.jsxs)(tX,{size:"sm",variant:"outline",className:"w-full gap-1.5 max-w-[180px]",onClick:()=>tg(""),disabled:P,children:[P?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eI,{className:"h-3.5 w-3.5"}),"Upload Files"]})]}):function e(t,n=0){return t.map(t=>{let r=E.some(e=>e.path===t.path);return(0,X.jsxs)(IG,{children:[(0,X.jsx)(IV,{asChild:!0,children:(0,X.jsxs)("div",{children:[(0,X.jsxs)("div",{role:"treeitem",tabIndex:0,draggable:!0,onKeyDown:e=>{if("Enter"===e.key||" "===e.key)e.preventDefault(),"dir"===t.type?tc(t):"app"===t.type||"node-app"===t.type?(td(t),tc(t)):td(t);else if("ArrowDown"===e.key){e.preventDefault();let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=n.indexOf(e.currentTarget);n[r+1]?.focus()}else if("ArrowUp"===e.key){e.preventDefault();let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=n.indexOf(e.currentTarget);n[r-1]?.focus()}else if("ArrowRight"===e.key){if(e.preventDefault(),"dir"===t.type||"app"===t.type||"node-app"===t.type)if(t.expanded){let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=n.indexOf(e.currentTarget);n[r+1]?.focus()}else tc(t)}else if("ArrowLeft"===e.key){if(e.preventDefault(),("dir"===t.type||"app"===t.type||"node-app"===t.type)&&t.expanded)tc(t);else if(n>0){let t=k.current;if(!t)return;let n=Array.from(t.querySelectorAll('[role="treeitem"]')),r=e.currentTarget,i=n.indexOf(r),s=Number.parseInt(r.style.paddingLeft??"0",10);for(let e=i-1;e>=0;e--)if(Number.parseInt(n[e].style.paddingLeft??"0",10)<s){n[e].focus();break}}}},onDragStart:e=>{e7.current=t,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.path)},onDragOver:e=>"dir"===t.type?tS(e,t.path,"dir"):e.preventDefault(),onDragLeave:()=>te(null),onDrop:e=>"dir"===t.type?tC(e,t.path):e.preventDefault(),className:tK("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer group transition-colors select-none",eB?.path===t.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted",e8===t.path&&"ring-2 ring-primary bg-primary-soft",t.name.startsWith(".")&&"opacity-40"),style:{paddingLeft:`${14*n+8}px`},onClick:()=>{"dir"===t.type?tc(t):"app"===t.type||"node-app"===t.type?(td(t),tc(t)):td(t)},children:["dir"===t.type||"app"===t.type||"node-app"===t.type?t.loading?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):t.expanded?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)(ea,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),"dir"===t.type?t.expanded?(0,X.jsx)(ef,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-warning")}):(0,X.jsx)(eh,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-warning")}):"app"===t.type?(0,X.jsx)(eg,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/70")}):"node-app"===t.type?(0,X.jsx)(eM,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-emerald-500")}):"html"===Re(t.name,"file")?(0,X.jsx)(eg,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/60")}):Ri(t.name)?(0,X.jsx)(eb,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-sunshine-700")}):Rn(t.name)?(0,X.jsx)(ep,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/70")}):(0,X.jsx)(ed,{className:tK("h-4 w-4 shrink-0",eB?.path!==t.path&&"text-foreground/60")}),(0,X.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t.name}),N.has(t.path)&&(0,X.jsx)("span",{className:"ml-0.5 h-1.5 w-1.5 rounded-full bg-emerald-400 shrink-0 animate-pulse",title:"Agent recently active"}),(0,X.jsx)("div",{className:"flex max-w-0 shrink-0 items-center overflow-hidden opacity-0 transition-all duration-150 group-hover:max-w-7 group-hover:opacity-100 focus-within:max-w-7 focus-within:opacity-100",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"File actions",children:(0,X.jsx)(ew,{className:"h-3.5 w-3.5"})})}),(0,X.jsxs)(Ib,{align:"end",className:"w-48",children:[(0,X.jsxs)(Iy,{onClick:()=>tx(t.path),children:[(0,X.jsx)(el,{className:"mr-2 h-3.5 w-3.5"}),"Copy path"]}),Rr(t.name)&&(0,X.jsxs)(Iy,{onClick:()=>tv(t.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy wiki link"]}),(0,X.jsxs)(Iy,{onClick:()=>tw(t.path),children:[(0,X.jsx)(ey,{className:"mr-2 h-3.5 w-3.5"}),"Copy URL"]}),"file"===t.type&&Rn(t.name)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Iy,{onClick:()=>void tk(t.path),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy raw content"]}),(0,X.jsxs)(Iy,{onClick:()=>void tT(t.path,t.name),children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"Copy formatted content"]})]}),(0,X.jsx)(Iv,{}),"dir"===t.type&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Iy,{onClick:async()=>{t.expanded||await tc(t),J(t.path),ee(""),en(null)},children:[(0,X.jsx)(eu,{className:"mr-2 h-3.5 w-3.5"}),"New file here"]}),(0,X.jsxs)(Iy,{onClick:()=>tg(t.path),children:[(0,X.jsx)(eI,{className:"mr-2 h-3.5 w-3.5"}),"Upload here"]}),(0,X.jsxs)(Iy,{onClick:()=>{G(t.path),V(""),K(null)},children:[(0,X.jsx)(em,{className:"mr-2 h-3.5 w-3.5"}),"New subfolder"]}),(0,X.jsx)(Iv,{})]}),(0,X.jsxs)(Iy,{onClick:()=>{let e,n;return e=rW(`/api/wiki/download?path=${encodeURIComponent(t.path)}`),void((n=document.createElement("a")).href=e,n.download="file"===t.type?t.name:`${t.name}.zip`,document.body.appendChild(n),n.click(),n.remove())},children:[(0,X.jsx)(ec,{className:"mr-2 h-3.5 w-3.5"}),"file"===t.type?"Download":"Download as zip"]}),(0,X.jsxs)(Iy,{onClick:()=>Dr.getState().toggle({path:t.path,name:t.name,type:"dir"===t.type?"file":t.type},s),children:[(0,X.jsx)(e_,{className:tK("mr-2 h-3.5 w-3.5",r&&"fill-current text-amber-400")}),r?"Unpin":"Pin to top"]}),(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{className:"text-destructive focus:text-destructive",onClick:()=>{eL(t.path),eP("file"!==t.type)},children:[(0,X.jsx)(eO,{className:"mr-2 h-3.5 w-3.5"}),"Delete"]})]})]})})]}),$===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(eh,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:q,onChange:e=>V(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tb(),"Escape"===e.key&&(G(null),V(""))}}),W&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:W}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tb,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{G(null),V("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),Y===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:Z,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ty(),"Escape"===e.key&&(J(null),ee(""))}}),et&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:et}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ty,children:(0,X.jsx)(es,{className:"h-3 w-3"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{J(null),ee("")},children:(0,X.jsx)(eD,{className:"h-3 w-3"})})]}),("dir"===t.type||"app"===t.type||"node-app"===t.type)&&t.expanded&&t.children&&t.children.length>0&&e(t.children,n+1),("dir"===t.type||"app"===t.type||"node-app"===t.type)&&t.expanded&&t.children?.length===0&&(0,X.jsx)("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(n+1)*14+8+14+6+16+6}px`},children:"Empty"})]})}),(0,X.jsxs)(I4,{children:[(0,X.jsx)(I6,{onSelect:()=>tx(t.path),children:"Copy path"}),Rr(t.name)&&(0,X.jsx)(I6,{onSelect:()=>tv(t.name),children:"Copy wiki link"}),(0,X.jsx)(I9,{}),(0,X.jsx)(I6,{onSelect:()=>tw(t.path),children:"Copy URL"}),"file"===t.type&&Rn(t.name)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(I9,{}),(0,X.jsx)(I6,{onSelect:()=>void tk(t.path),children:"Copy raw content"}),(0,X.jsx)(I6,{onSelect:()=>void tT(t.path,t.name),children:"Copy formatted content"})]})]})]},t.path)})}(C)]}),(0,X.jsx)("div",{className:"border-t px-2 py-2 bg-muted shrink-0",children:(0,X.jsxs)(In,{children:[(0,X.jsx)(Ii,{asChild:!0,children:(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"w-full h-auto justify-between gap-2 px-2 py-1.5 text-left",title:r??"",children:[(0,X.jsxs)("span",{className:"flex flex-col min-w-0",children:[(0,X.jsx)("span",{className:"truncate text-xs font-medium",children:a.find(e=>e.id===s)?.name??"Workspace"}),(0,X.jsx)("span",{className:"truncate text-[10px] text-muted-foreground font-mono",children:r??""})]}),(0,X.jsx)(eo,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]})}),(0,X.jsxs)(Ib,{align:"start",className:"w-60",children:[a.map(e=>(0,X.jsxs)(Iy,{onClick:()=>void tp(e.id),className:tK("gap-2",e.id===s&&"font-medium"),children:[e.id===s?(0,X.jsx)(es,{className:"h-3.5 w-3.5 shrink-0"}):(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsxs)("span",{className:"flex flex-col min-w-0 flex-1",children:[(0,X.jsx)("span",{className:"truncate",children:e.name}),(0,X.jsx)("span",{className:"truncate text-[10px] text-muted-foreground font-mono",children:e.rootDir})]}),c&&(0,X.jsx)("button",{className:"ml-auto shrink-0 rounded p-0.5 text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",title:"Delete workspace (does not delete files)",onClick:t=>{t.stopPropagation(),f(e.id)},children:(0,X.jsx)(eO,{className:"h-3.5 w-3.5"})})]},e.id)),c&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Iv,{}),(0,X.jsxs)(Iy,{onClick:()=>p(!0),children:[(0,X.jsx)(em,{className:"mr-2 h-3.5 w-3.5"}),"Add workspace…"]})]})]})]})})]}),(0,X.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 relative",children:[eG&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 h-7 w-7 p-0 rounded-full bg-background/50 backdrop-blur-xl backdrop-saturate-150 border border-white/[0.08] text-foreground/60 hover:text-foreground/90 hover:bg-background/70 shadow-[0_0_12px_rgba(0,0,0,0.15)] [transform:translate(-50%,-50%)_translateZ(0)]",title:"Show sidebar",onClick:()=>eq(!1),children:(0,X.jsx)(ek,{className:"h-3.5 w-3.5"})}),eB?"node-app"===t_?(0,X.jsx)(IE,{path:eB.path,title:eB.name}):"app"===t_||"html"===t_?(e="html"===t_?`/api/assets/${eB.path}`:void 0,eH?(0,X.jsx)(MB,{path:eB.path,title:eB.name,src:e,fullscreen:!0,onExit:()=>eU(!1)}):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,X.jsx)(eg,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:eB.path,children:eB.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[tN(eB),"html"===t_&&!e0&&null!==eK&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Edit source",onClick:()=>{e1(!0),e3(eK),e9(null)},children:(0,X.jsx)(eT,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:()=>e$(e=>e+1),children:(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,X.jsxs)(tX,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>eU(!0),children:[(0,X.jsx)(ev,{className:"h-3.5 w-3.5"}),"Open fullscreen"]}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{eF(null),e1(!1)},children:(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})})]})]}),e0&&"html"===t_?(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,X.jsx)("textarea",{value:e2,onChange:e=>e3(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"}),(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[e6&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:e6}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",onClick:()=>{e1(!1),e9(null)},children:"Cancel"}),(0,X.jsxs)(tX,{size:"sm",className:"gap-1",onClick:tf,disabled:e5,children:[e5&&(0,X.jsx)(ex,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)(MB,{path:eB.path,title:eB.name,src:e},ez)]})):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[Ri(eB.name)?(0,X.jsx)(eb,{className:"h-4 w-4 shrink-0 text-sunshine-700"}):Rn(eB.name)?(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-accent"}):(0,X.jsx)(ed,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:eB.path,children:eB.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[tN(eB),Rn(eB.name)&&!e0&&(null!==eK||Rr(eB.name))&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{e1(!0),e3(eK??""),e9(null),Rr(eB.name)&&wk.getState().loadPage(eB.path)},children:(0,X.jsx)(eT,{className:"h-3.5 w-3.5"})}),Rn(eB.name)&&!e0&&(null!==eK||Rr(eB.name))&&(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:tl,disabled:eJ,children:eJ?(0,X.jsx)(ex,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})}),tO&&(0,X.jsx)(D7,{}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{eF(null),eY(null),e1(!1)},children:(0,X.jsx)(eD,{className:"h-3.5 w-3.5"})})]})]}),e0?(0,X.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:Rr(eB.name)?(0,X.jsx)(_D,{}):(0,X.jsx)("textarea",{value:e2,onChange:e=>e3(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"})}):Rr(eB.name)?(0,X.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:eJ?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):(0,X.jsx)(_D,{mode:"viewing"})}):(0,X.jsx)("div",{className:"flex-1 overflow-auto p-4 min-h-0",children:(0,X.jsx)("div",{className:tK("mx-auto w-full",tI),children:eJ?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(ex,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):"csv"===t_?(0,X.jsx)(rJ,{path:eB.path,title:eB.name}):"pdf"===t_?(0,X.jsx)(MD,{path:eB.path,title:eB.name}):"mermaid"===t_?(0,X.jsx)(_U,{path:eB.path,title:eB.name}):"notebook"===t_?(0,X.jsx)(MC,{path:eB.path,title:eB.name}):"image"===t_?(0,X.jsx)(_L,{path:eB.path,title:eB.name}):"media"===t_?(0,X.jsx)(_j,{path:eB.path,title:eB.name,type:["mp4","webm","mov","m4v"].includes(D8(eB.name))?"video":"audio"}):"docx"===t_?(0,X.jsx)(MM,{path:eB.path,title:eB.name}):"xlsx"===t_?(0,X.jsx)(MI,{path:eB.path,title:eB.name}):"pptx"===t_?(0,X.jsx)(MO,{path:eB.path,title:eB.name}):"source"===t_?(0,X.jsx)(MP,{path:eB.path,title:eB.name}):"fallback"===t_?(0,X.jsx)(_R,{path:eB.path,title:eB.name}):null!==eK?(0,X.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words leading-relaxed",children:eK}):Rn(eB.name)?(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Could not load file."}):(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Preview not available for this file type."})})}),e0&&!Rr(eB.name)&&(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[e6&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:e6}),(0,X.jsx)(tX,{size:"sm",variant:"ghost",onClick:()=>{e1(!1),e9(null)},children:"Cancel"}),(0,X.jsxs)(tX,{size:"sm",className:"gap-1",onClick:tf,disabled:e5,children:[e5&&(0,X.jsx)(ex,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)("div",{className:"flex-1 flex flex-col items-center justify-center",children:(0,X.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center px-4",children:[(0,X.jsx)(ep,{className:"h-8 w-8 text-muted-foreground"}),(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a file to view or edit"})]})})]}),(0,X.jsx)(Ij,{open:eV,onOpenChange:eW}),(0,X.jsx)(Dg,{currentPath:eB?.path}),(0,X.jsx)("input",{ref:U,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&tm(e.target.files,z.current)}}),(0,X.jsx)(rU,{open:!!eR,onOpenChange:e=>{e||eL(null)},title:ej?"Delete folder?":"Delete file?",description:ej?`"${eR?.split("/").pop()}" and all its contents will be permanently deleted.`:`"${eR?.split("/").pop()}" will be permanently removed.`,onConfirm:tA}),(0,X.jsx)(rU,{open:!!h,onOpenChange:e=>{e||f(null)},title:"Delete workspace?",description:`"${a.find(e=>e.id===h)?.name??""}" will be removed from the workspace list. Files on disk are NOT deleted.`,onConfirm:th})]})]},s??"none")}],952683)}]);
|
|
@@ -81,9 +81,10 @@ wiki-viewer [directory] [options]
|
|
|
81
81
|
directory Directory to serve (optional — pick in the browser if omitted)
|
|
82
82
|
|
|
83
83
|
Options:
|
|
84
|
-
-p, --port <port> Port to listen on
|
|
85
|
-
-H, --host <host> Host to bind to
|
|
86
|
-
--https Enable HTTPS
|
|
84
|
+
-p, --port <port> Port to listen on (default: 3000)
|
|
85
|
+
-H, --host <host> Host to bind to (default: localhost)
|
|
86
|
+
--https Enable HTTPS (self-signed cert, required on remote)
|
|
87
|
+
--no-auth No sign-in, no session (open to anyone on the network)
|
|
87
88
|
-h, --help Show this help message
|
|
88
89
|
|
|
89
90
|
Commands:
|