@geminilight/mindos 0.6.77 → 0.6.78

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.
Files changed (204) hide show
  1. package/_standalone/.mindos-build-version +1 -1
  2. package/_standalone/.next/BUILD_ID +1 -1
  3. package/_standalone/.next/app-path-routes-manifest.json +26 -26
  4. package/_standalone/.next/build-manifest.json +3 -3
  5. package/_standalone/.next/cache/.previewinfo +1 -1
  6. package/_standalone/.next/cache/.rscinfo +1 -1
  7. package/_standalone/.next/cache/config.json +3 -3
  8. package/_standalone/.next/prerender-manifest.json +3 -3
  9. package/_standalone/.next/react-loadable-manifest.json +4 -4
  10. package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
  11. package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  12. package/_standalone/.next/server/app/_global-error.html +2 -2
  13. package/_standalone/.next/server/app/_global-error.rsc +1 -1
  14. package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  15. package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  16. package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  17. package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  18. package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  19. package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/_standalone/.next/server/app/_not-found/page.js +1 -1
  21. package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
  24. package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
  25. package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
  26. package/_standalone/.next/server/app/agents/page.js +1 -1
  27. package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
  28. package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  29. package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
  30. package/_standalone/.next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
  31. package/_standalone/.next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
  32. package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
  33. package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
  34. package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
  35. package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
  36. package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
  37. package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
  38. package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
  39. package/_standalone/.next/server/app/api/agents/copy-skill/route.js.nft.json +1 -1
  40. package/_standalone/.next/server/app/api/agents/copy-skill/route_client-reference-manifest.js +1 -1
  41. package/_standalone/.next/server/app/api/agents/custom/detect/route_client-reference-manifest.js +1 -1
  42. package/_standalone/.next/server/app/api/agents/custom/route_client-reference-manifest.js +1 -1
  43. package/_standalone/.next/server/app/api/ask/route.js.nft.json +1 -1
  44. package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
  45. package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
  46. package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
  47. package/_standalone/.next/server/app/api/backlinks/route.js.nft.json +1 -1
  48. package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
  49. package/_standalone/.next/server/app/api/bootstrap/route.js.nft.json +1 -1
  50. package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
  51. package/_standalone/.next/server/app/api/changes/route.js.nft.json +1 -1
  52. package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
  53. package/_standalone/.next/server/app/api/channels/verify/route_client-reference-manifest.js +1 -1
  54. package/_standalone/.next/server/app/api/connect/route_client-reference-manifest.js +1 -1
  55. package/_standalone/.next/server/app/api/embedding/route_client-reference-manifest.js +1 -1
  56. package/_standalone/.next/server/app/api/export/route.js.nft.json +1 -1
  57. package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
  58. package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
  59. package/_standalone/.next/server/app/api/file/import/route.js.nft.json +1 -1
  60. package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
  61. package/_standalone/.next/server/app/api/file/raw/route.js.nft.json +1 -1
  62. package/_standalone/.next/server/app/api/file/raw/route_client-reference-manifest.js +1 -1
  63. package/_standalone/.next/server/app/api/file/route.js.nft.json +1 -1
  64. package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
  65. package/_standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  66. package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  67. package/_standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  68. package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  69. package/_standalone/.next/server/app/api/graph/route.js.nft.json +1 -1
  70. package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
  71. package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  72. package/_standalone/.next/server/app/api/im/activity/route_client-reference-manifest.js +1 -1
  73. package/_standalone/.next/server/app/api/im/config/route_client-reference-manifest.js +1 -1
  74. package/_standalone/.next/server/app/api/im/feishu/long-connection/route.js.nft.json +1 -1
  75. package/_standalone/.next/server/app/api/im/feishu/long-connection/route_client-reference-manifest.js +1 -1
  76. package/_standalone/.next/server/app/api/im/status/route.js.nft.json +1 -1
  77. package/_standalone/.next/server/app/api/im/status/route_client-reference-manifest.js +1 -1
  78. package/_standalone/.next/server/app/api/im/test/route_client-reference-manifest.js +1 -1
  79. package/_standalone/.next/server/app/api/im/webhook/feishu/route.js.nft.json +1 -1
  80. package/_standalone/.next/server/app/api/im/webhook/feishu/route_client-reference-manifest.js +1 -1
  81. package/_standalone/.next/server/app/api/im/webhook-status/route.js.nft.json +1 -1
  82. package/_standalone/.next/server/app/api/im/webhook-status/route_client-reference-manifest.js +1 -1
  83. package/_standalone/.next/server/app/api/inbox/clip/route.js.nft.json +1 -1
  84. package/_standalone/.next/server/app/api/inbox/clip/route_client-reference-manifest.js +1 -1
  85. package/_standalone/.next/server/app/api/inbox/route.js.nft.json +1 -1
  86. package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
  87. package/_standalone/.next/server/app/api/init/route.js.nft.json +1 -1
  88. package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  89. package/_standalone/.next/server/app/api/lint/route.js.nft.json +1 -1
  90. package/_standalone/.next/server/app/api/lint/route_client-reference-manifest.js +1 -1
  91. package/_standalone/.next/server/app/api/mcp/agents/route.js.nft.json +1 -1
  92. package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
  93. package/_standalone/.next/server/app/api/mcp/direct-tools/route_client-reference-manifest.js +1 -1
  94. package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
  95. package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
  96. package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
  97. package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
  98. package/_standalone/.next/server/app/api/mcp/tools/route_client-reference-manifest.js +1 -1
  99. package/_standalone/.next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
  100. package/_standalone/.next/server/app/api/monitoring/route.js.nft.json +1 -1
  101. package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
  102. package/_standalone/.next/server/app/api/obsidian/compat-report/route_client-reference-manifest.js +1 -1
  103. package/_standalone/.next/server/app/api/obsidian/import/route_client-reference-manifest.js +1 -1
  104. package/_standalone/.next/server/app/api/recent-files/route.js.nft.json +1 -1
  105. package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
  106. package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  107. package/_standalone/.next/server/app/api/search/route.js.nft.json +1 -1
  108. package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  109. package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
  110. package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
  111. package/_standalone/.next/server/app/api/settings/route.js.nft.json +1 -1
  112. package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  113. package/_standalone/.next/server/app/api/settings/test-key/route.js +1 -1
  114. package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
  115. package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
  116. package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
  117. package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
  118. package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
  119. package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
  120. package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  121. package/_standalone/.next/server/app/api/space-overview/route.js +1 -1
  122. package/_standalone/.next/server/app/api/space-overview/route.js.nft.json +1 -1
  123. package/_standalone/.next/server/app/api/space-overview/route_client-reference-manifest.js +1 -1
  124. package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
  125. package/_standalone/.next/server/app/api/tree-version/route.js.nft.json +1 -1
  126. package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
  127. package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
  128. package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  129. package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
  130. package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
  131. package/_standalone/.next/server/app/api/workflows/route.js.nft.json +1 -1
  132. package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  133. package/_standalone/.next/server/app/changelog/page.js +1 -1
  134. package/_standalone/.next/server/app/changelog/page.js.nft.json +1 -1
  135. package/_standalone/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  136. package/_standalone/.next/server/app/changes/page.js +1 -1
  137. package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
  138. package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
  139. package/_standalone/.next/server/app/echo/[segment]/page.js +1 -1
  140. package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
  141. package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
  142. package/_standalone/.next/server/app/echo/page.js +1 -1
  143. package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
  144. package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
  145. package/_standalone/.next/server/app/explore/page.js +1 -1
  146. package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
  147. package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
  148. package/_standalone/.next/server/app/help/page.js +1 -1
  149. package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
  150. package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
  151. package/_standalone/.next/server/app/inbox/history/page.js +1 -1
  152. package/_standalone/.next/server/app/inbox/history/page.js.nft.json +1 -1
  153. package/_standalone/.next/server/app/inbox/history/page_client-reference-manifest.js +1 -1
  154. package/_standalone/.next/server/app/login/page.js +1 -1
  155. package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
  156. package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  157. package/_standalone/.next/server/app/page.js +1 -1
  158. package/_standalone/.next/server/app/page.js.nft.json +1 -1
  159. package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  160. package/_standalone/.next/server/app/setup/page.js +1 -1
  161. package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
  162. package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  163. package/_standalone/.next/server/app/trash/page.js +3 -3
  164. package/_standalone/.next/server/app/trash/page.js.nft.json +1 -1
  165. package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
  166. package/_standalone/.next/server/app/view/[...path]/page.js +2 -2
  167. package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
  168. package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
  169. package/_standalone/.next/server/app-paths-manifest.json +26 -26
  170. package/_standalone/.next/server/chunks/1299.js +1 -1
  171. package/_standalone/.next/server/chunks/{5913.js → 2057.js} +2 -2
  172. package/_standalone/.next/server/chunks/4802.js +33 -33
  173. package/_standalone/.next/server/chunks/5299.js +1 -1
  174. package/_standalone/.next/server/chunks/6223.js +1 -1
  175. package/_standalone/.next/server/middleware-build-manifest.js +1 -1
  176. package/_standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  177. package/_standalone/.next/server/pages/500.html +2 -2
  178. package/_standalone/.next/server/server-reference-manifest.js +1 -1
  179. package/_standalone/.next/server/server-reference-manifest.json +1 -1
  180. package/_standalone/.next/static/chunks/{7011.223941e5ce187180.js → 1768.1e964db7834ecb4f.js} +2 -2
  181. package/_standalone/.next/static/chunks/{8954.b927d1b38b3c3878.js → 1937.e178266395104aa3.js} +1 -1
  182. package/_standalone/.next/static/chunks/{5358-ac2733e1433981be.js → 5358-4d1ef32068d304de.js} +1 -1
  183. package/_standalone/.next/static/chunks/app/{layout-d17d1ec3d728ab91.js → layout-5832614ed6a78167.js} +63 -63
  184. package/_standalone/.next/static/chunks/app/trash/page-21dc1c6b6490cae8.js +1 -0
  185. package/_standalone/.next/static/chunks/app/view/[...path]/{page-283e9e8b07c8949e.js → page-e5330470ce362641.js} +2 -2
  186. package/_standalone/.next/static/chunks/webpack-6a9916defe5b8b6d.js +1 -0
  187. package/_standalone/.next/trace +72 -72
  188. package/_standalone/__tests__/agent/model-config.test.ts +90 -0
  189. package/_standalone/__tests__/ask/ask-content-input-during-run.test.tsx +1 -1
  190. package/_standalone/components/ask/AskContent.tsx +1 -1
  191. package/_standalone/package-lock.json +2 -2
  192. package/_standalone/package.json +1 -1
  193. package/_standalone/tsconfig.tsbuildinfo +1 -1
  194. package/app/__tests__/agent/model-config.test.ts +90 -0
  195. package/app/__tests__/ask/ask-content-input-during-run.test.tsx +1 -1
  196. package/app/components/ask/AskContent.tsx +1 -1
  197. package/app/lib/agent/model.ts +2 -1
  198. package/app/lib/settings.ts +17 -5
  199. package/app/package.json +1 -1
  200. package/package.json +1 -1
  201. package/_standalone/.next/static/chunks/app/trash/page-9b2798b1cd1c53e3.js +0 -1
  202. package/_standalone/.next/static/chunks/webpack-8cda3cd172a0535c.js +0 -1
  203. /package/_standalone/.next/static/{xTjrONxqaI_ZUUPRRKA_X → yJdsYbp_76hvDnNeV7OCT}/_buildManifest.js +0 -0
  204. /package/_standalone/.next/static/{xTjrONxqaI_ZUUPRRKA_X → yJdsYbp_76hvDnNeV7OCT}/_ssgManifest.js +0 -0
@@ -50,7 +50,17 @@ Be specific and actionable. Format in Markdown.`}(a,b,g)}],currentFile:c};h&&(i.
50
50
  border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
51
51
  disabled:opacity-40 disabled:cursor-not-allowed
52
52
  ${u?"bg-muted/50 border-border/50 text-muted-foreground hover:bg-muted hover:text-foreground":"bg-[var(--amber)]/10 border-[var(--amber)]/25 text-foreground hover:bg-[var(--amber)]/15"}
53
- `,title:x(a),"aria-expanded":n,"aria-haspopup":"listbox",children:[v(a,11),(0,d.jsx)("span",{className:"truncate max-w-[80px]",children:w(a)}),(0,d.jsx)(j.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&y&&(0,f.createPortal)(y,document.body)]})}},39219:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/components/UpdateToast.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/UpdateToast.tsx","default")},39624:(a,b,c)=>{"use strict";function d(){return[]}function e(a){}function f(a){let b=[];b.unshift(a);let c=b.slice(0,50);return e(c),c}function g(a,b){let c=[],d=c.findIndex(b=>b.id===a);return d>=0&&(c[d]={...c[d],...b},e(c)),c}function h(){}c.d(b,{D4:()=>f,FB:()=>d,W8:()=>g,g4:()=>h,jQ:()=>j});let i=0;function j(){return`org-${Date.now()}-${++i}`}},39868:(a,b,c)=>{"use strict";async function d(a){if(navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(a),!0}catch{}try{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select();let c=document.execCommand("copy");return document.body.removeChild(b),c}catch{return!1}}c.d(b,{l:()=>d})},41297:(a,b,c)=>{"use strict";c.d(b,{l:()=>h});var d=c(67484);let e=new Set([".txt",".md",".markdown",".csv",".json",".yaml",".yml",".xml",".html",".htm",".pdf"]);function f(a){let b=a.lastIndexOf(".");return b>=0?a.slice(b).toLowerCase():""}async function g(a){let b=a.name;try{let c=await a.arrayBuffer(),d=function(a){let b="";for(let c=0;c<a.length;c+=32768)b+=String.fromCharCode(...a.subarray(c,c+32768));return btoa(b)}(new Uint8Array(c)),e=await fetch("/api/extract-pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b,dataBase64:d})}),f={};try{f=await e.json()}catch{throw Error("Failed to parse extraction response")}if(!e.ok)throw Error(f.error||`PDF extraction failed (${e.status})`);if("error"===f.extracted)return{name:b,content:`[PDF: ${b}] Failed to extract text from this PDF.`,status:"error",error:f.extractionError||"PDF extraction failed (unable to parse PDF)"};let g="success"===f.extracted&&f.text||"";if(!g)return{name:b,content:`[PDF: ${b}] Could not extract readable text (possibly scanned/image PDF).`,status:"error",error:"No extractable text found — PDF may be scanned, image-only, or have no text content"};let h={name:b,content:`[PDF TEXT EXTRACTED: ${b}]
53
+ `,title:x(a),"aria-expanded":n,"aria-haspopup":"listbox",children:[v(a,11),(0,d.jsx)("span",{className:"truncate max-w-[80px]",children:w(a)}),(0,d.jsx)(j.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&y&&(0,f.createPortal)(y,document.body)]})}},39139:(a,b,c)=>{"use strict";c.d(b,{SQ:()=>D,Ld:()=>B,iP:()=>A,Ay:()=>E});var d=c(48249),e=c(67484),f=c(19099),g=c(24520),h=c(80600),i=c(86718),j=c(7817),k=c(84699),l=c(12417),m=c(24703),n=c(28330),o=c(96286),p=c(59347),q=c(41479),r=c(61075),s=c(60407),t=c(9311),u=c(4140),v=c(2548),w=c(47223),x=c(99829);x.callServer,x.findSourceMapURL;var y=c(1108);let z=()=>{},A=y.qQ,B=y.Dp.MIN,C=y.Dp.MAX_RATIO,D=y.Dp.MAX_ABS;function E({activePanel:a,fileTree:b,onNavigate:c,onOpenSyncSettings:x,railWidth:y=48,panelWidth:E,onWidthChange:F,onWidthCommit:G,maximized:H=!1,onMaximize:I,onImport:J,children:K}){let L=a?A[a]:280,M=H?void 0:E??L,{t:N}=(0,w.Y)(),O=(0,f.useRouter)(),P=(0,f.usePathname)(),Q="/view/Inbox"===P||"/view/Inbox/"===P,[R,S]=(0,e.useState)(null),T=(0,e.useMemo)(()=>(function a(b,c=0){let d=c;for(let e of b)"directory"===e.type&&(d=Math.max(d,a(e.children??[],c+1)));return d})(b),[b]),[U,V]=(0,e.useState)(!1),W=(0,e.useRef)(null),X=(0,e.useRef)(null),[Y,Z]=(0,e.useState)(!1),$=(0,e.useRef)(null),_=(0,e.useRef)(null),aa=(0,s.gL)(),[ab,ac]=(0,e.useState)(0),[ad,ae]=(0,e.useState)(0),[af,ag]=(0,e.useState)(!1),ah=(0,e.useCallback)(()=>{if(!af){ag(!0);try{localStorage.setItem("mindos-tree-dblclick-hint","1")}catch{}}},[af]),ai=(0,v._)({width:E??L,minWidth:B,maxWidth:D,maxWidthRatio:C,direction:"right",disabled:H,onResize:F??z,onResizeEnd:G??z});return(0,d.jsxs)("aside",{className:`
54
+ hidden md:flex fixed top-0 h-screen z-30
55
+ flex-col bg-card border-r border-border
56
+ transition-[transform,left,width] duration-200 ease-out
57
+ ${null!==a?"translate-x-0":"-translate-x-full pointer-events-none"}
58
+ `,style:{width:H?`calc(100vw - ${y}px)`:`${M}px`,left:`${y}px`},role:"region","aria-label":a?`${a} panel`:void 0,children:[(0,d.jsxs)("div",{className:`flex flex-col h-full ${"files"===a?"":"hidden"}`,children:[(0,d.jsx)(u.A,{title:N.sidebar.files,children:(0,d.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:W,type:"button",onClick:()=>{Z(!1),V(a=>!a)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":N.sidebar.new,title:N.sidebar.new,children:(0,d.jsx)(g.A,{size:13})}),U&&(0,d.jsxs)("div",{ref:X,className:"absolute top-full right-0 mt-1 min-w-[152px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{V(!1),O.push("/view/Untitled.md")},children:[(0,d.jsx)(h.A,{size:14,className:"shrink-0"}),N.sidebar.newFile]}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{V(!1),window.dispatchEvent(new Event("mindos:create-space"))},children:[(0,d.jsx)(i.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),N.sidebar.newSpace]})]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>J?.(),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":N.sidebar.importFile,title:N.sidebar.importFile,children:(0,d.jsx)(j.A,{size:13})}),(0,d.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,d.jsx)("button",{onClick:()=>S(a=>Math.max(-1,(a??T)-1)),onDoubleClick:()=>{S(-1),ah()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":N.sidebar.collapseLevel,title:af?N.sidebar.collapseLevel:N.sidebar.collapseLevelHint??N.sidebar.collapseLevel,children:(0,d.jsx)(k.A,{size:13})}),(0,d.jsx)("button",{onClick:()=>S(a=>{let b=(a??0)+1;return b>T?null:b}),onDoubleClick:()=>{S(null),ah()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":N.sidebar.expandLevel,title:af?N.sidebar.expandLevel:N.sidebar.expandLevelHint??N.sidebar.expandLevel,children:(0,d.jsx)(l.A,{size:13})}),(0,d.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:$,type:"button",onClick:()=>{V(!1),Z(a=>!a)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":N.sidebar.more,title:N.sidebar.more,children:(0,d.jsx)(m.A,{size:13})}),Y&&(0,d.jsxs)("div",{ref:_,className:"absolute top-full right-0 mt-1 min-w-[172px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{Z(!1),O.push("/view/Inbox/")},children:[(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1",children:N.sidebar.capture}),ad>0&&(0,d.jsx)("span",{className:"text-2xs font-medium tabular-nums px-1.5 py-px rounded-full bg-[var(--amber)]/10 text-[var(--amber)]/70",children:ad})]}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{Z(!1),O.push("/view/.mindos/change-log.json")},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1",children:N.changes.title})]}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{Z(!1),O.push("/trash")},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:N.trash.title}),ab>0&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:ab})]}),(0,d.jsx)("div",{className:"my-1 border-t border-border/50"}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{(0,s.Fo)(!aa)},children:[aa?(0,d.jsx)(q.A,{size:14,className:"shrink-0"}):(0,d.jsx)(r.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:N.sidebar.showHiddenFiles}),aa&&(0,d.jsx)("span",{className:"text-[var(--amber)] text-xs",children:"✓"})]})]})]})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",onDragEnter:a=>{a.dataTransfer.types.includes("Files")&&a.stopPropagation()},onDragOver:a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation())},onDrop:a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation())},children:(0,d.jsx)(s.Ay,{nodes:b,onNavigate:c,maxOpenDepth:R,onImport:J})}),(0,d.jsxs)("button",{type:"button",onClick:()=>O.push("/view/Inbox/"),className:`flex items-center gap-2 mx-2 px-2 py-1.5 text-sm rounded-lg transition-all duration-150 group shrink-0 ${Q?"bg-[var(--amber-dim)] text-[var(--amber)]":"hover:bg-muted text-muted-foreground hover:text-foreground"}`,children:[(0,d.jsx)("div",{className:`flex items-center justify-center w-5 h-5 rounded-md shrink-0 transition-colors ${Q?"bg-[var(--amber)]/15":"bg-transparent"}`,children:(0,d.jsx)(n.A,{size:13,className:`shrink-0 transition-colors ${Q?"text-[var(--amber)]":"text-[var(--amber)]/60 group-hover:text-[var(--amber)]"}`})}),(0,d.jsx)("span",{className:`flex-1 text-left text-xs transition-colors ${Q?"font-medium text-[var(--amber)]":"text-muted-foreground group-hover:text-foreground"}`,children:N.sidebar.capture}),ad>0&&(0,d.jsx)("span",{className:`text-2xs font-medium tabular-nums px-1.5 py-px rounded-full transition-colors ${Q?"bg-[var(--amber)]/15 text-[var(--amber)]":"bg-[var(--amber)]/10 text-[var(--amber)]/70"}`,children:ad})]}),(0,d.jsx)(t.Ay,{collapsed:!1,onOpenSyncSettings:x})]}),K,!H&&F&&(0,d.jsx)("div",{className:"absolute top-0 -right-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:ai,children:(0,d.jsx)("div",{className:"absolute right-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/60 transition-opacity"})})]})}},39219:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/components/UpdateToast.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/UpdateToast.tsx","default")},39624:(a,b,c)=>{"use strict";function d(){return[]}function e(a){}function f(a){let b=[];b.unshift(a);let c=b.slice(0,50);return e(c),c}function g(a,b){let c=[],d=c.findIndex(b=>b.id===a);return d>=0&&(c[d]={...c[d],...b},e(c)),c}function h(){}c.d(b,{D4:()=>f,FB:()=>d,W8:()=>g,g4:()=>h,jQ:()=>j});let i=0;function j(){return`org-${Date.now()}-${++i}`}},39868:(a,b,c)=>{"use strict";async function d(a){if(navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(a),!0}catch{}try{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select();let c=document.execCommand("copy");return document.body.removeChild(b),c}catch{return!1}}c.d(b,{l:()=>d})},39876:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(97621),g=c(42742),h=c(6079),i=c(46674),j=c(19099),k=c(47223),l=c(33191),m=c(99829);let n=(0,m.createServerReference)("70e1a503b87380112dacf7c10af6d96d79427f1c19",m.callServer,void 0,m.findSourceMapURL,"revertSpaceInitAction");function o(){let[a,b]=(0,e.useState)(null),[c,m]=(0,e.useState)(!1),[o,q]=(0,e.useTransition)(),r=(0,j.useRouter)(),{t:s}=(0,k.Y)(),t=(0,e.useCallback)(()=>{m(!1),setTimeout(()=>b(null),200)},[]);(0,e.useCallback)(a=>{let c=a.detail;"working"===c.state?(b(c),requestAnimationFrame(()=>m(!0))):"done"===c.state?(b(a=>a?{...a,state:"done"}:null),r.refresh()):t()},[r,t]);let u=(0,e.useCallback)(()=>{a&&(t(),r.push(`/view/${(0,l.O0)(a.spacePath+"/")}`))},[a,t,r]),v=(0,e.useCallback)(()=>{a&&q(async()=>{await n(a.spacePath,a.spaceName,a.description),b(a=>a?{...a,state:"reverted"}:null),r.refresh(),window.dispatchEvent(new Event("mindos:files-changed")),setTimeout(t,2e3)})},[a,r,t]),w=(0,e.useCallback)(()=>{t()},[t]);if(!a)return null;let x=s.home,{state:y}=a,z="done"===y,A="reverted"===y;return(0,d.jsx)("div",{className:`fixed bottom-6 left-1/2 z-50 -translate-x-1/2 transition-all duration-200 ease-out ${c?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-3 scale-[0.96] pointer-events-none"}`,children:(0,d.jsxs)("div",{className:"flex items-center gap-2.5 rounded-full border bg-card/95 backdrop-blur py-2 shadow-lg",style:{borderColor:"color-mix(in srgb, var(--amber) 40%, var(--border))",boxShadow:"0 8px 24px color-mix(in srgb, var(--amber) 12%, rgba(0,0,0,.2))",paddingLeft:"0.75rem",paddingRight:z?"0.5rem":"1rem"},children:[(0,d.jsx)("span",{className:`inline-flex h-6 w-6 items-center justify-center rounded-full shrink-0 ${A?"text-muted-foreground bg-muted":"text-[var(--amber)] bg-[var(--amber-subtle)]"} ${"working"===y?"animate-pulse":""}`,children:A?(0,d.jsx)(f.A,{size:12}):z?(0,d.jsx)(g.A,{size:13,strokeWidth:2.5}):(0,d.jsx)(h.A,{size:13})}),(0,d.jsx)("span",{className:"text-xs text-foreground whitespace-nowrap select-none font-medium",children:A?x.aiInitReverted(a.spaceName):z?x.aiInitReady(a.spaceName):(0,d.jsxs)(d.Fragment,{children:[x.aiInitGenerating(a.spaceName),(0,d.jsx)(p,{})]})}),z&&(0,d.jsxs)("div",{className:"flex items-center gap-1 ml-1",children:[(0,d.jsx)("button",{type:"button",onClick:u,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-opacity focus-visible:ring-2 focus-visible:ring-ring",children:x.aiInitReview}),(0,d.jsx)("button",{type:"button",onClick:v,disabled:o,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:x.aiInitDiscard}),(0,d.jsx)("button",{type:"button",onClick:w,"aria-label":"Accept",className:"ml-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors focus-visible:ring-2 focus-visible:ring-ring",children:(0,d.jsx)(i.A,{size:12})})]})]})})}function p(){return(0,d.jsxs)("span",{className:"inline-flex gap-[2px] items-end h-[1em] ml-px",children:[(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_0ms_infinite]"}),(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_200ms_infinite]"}),(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_400ms_infinite]"}),(0,d.jsx)("style",{children:`
59
+ @keyframes dotBounce {
60
+ 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
61
+ 30% { opacity: 1; transform: translateY(-2px); }
62
+ }
63
+ `})]})}},41297:(a,b,c)=>{"use strict";c.d(b,{l:()=>h});var d=c(67484);let e=new Set([".txt",".md",".markdown",".csv",".json",".yaml",".yml",".xml",".html",".htm",".pdf"]);function f(a){let b=a.lastIndexOf(".");return b>=0?a.slice(b).toLowerCase():""}async function g(a){let b=a.name;try{let c=await a.arrayBuffer(),d=function(a){let b="";for(let c=0;c<a.length;c+=32768)b+=String.fromCharCode(...a.subarray(c,c+32768));return btoa(b)}(new Uint8Array(c)),e=await fetch("/api/extract-pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b,dataBase64:d})}),f={};try{f=await e.json()}catch{throw Error("Failed to parse extraction response")}if(!e.ok)throw Error(f.error||`PDF extraction failed (${e.status})`);if("error"===f.extracted)return{name:b,content:`[PDF: ${b}] Failed to extract text from this PDF.`,status:"error",error:f.extractionError||"PDF extraction failed (unable to parse PDF)"};let g="success"===f.extracted&&f.text||"";if(!g)return{name:b,content:`[PDF: ${b}] Could not extract readable text (possibly scanned/image PDF).`,status:"error",error:"No extractable text found — PDF may be scanned, image-only, or have no text content"};let h={name:b,content:`[PDF TEXT EXTRACTED: ${b}]
54
64
 
55
65
  ${g}`,status:"success"};return f.truncated&&f.totalChars&&(h.truncatedInfo={totalChars:f.totalChars,includedChars:g.length,totalPages:f.pagesParsed??0}),h}catch(a){return{name:b,content:`[PDF: ${b}] Failed to extract text from this PDF.`,status:"error",error:a instanceof Error?a.message:"Unknown error"}}}function h(a){let[b,c]=(0,d.useState)([]),[h,i]=(0,d.useState)(""),j=(0,d.useRef)(null),k=(0,d.useRef)(a);k.current=a;let l=(0,d.useCallback)(async a=>{if(!a||0===a.length)return;let b=Array.from(a).slice(0,8),d=[],h=[];for(let a of b){let b=f(a.name);e.has(b)?d.push(a):h.push(a.name)}if(h.length>0){let a=k.current?.unsupportedType??"Unsupported file type";i(`${a}: ${h.join(", ")}`)}else i("");let j=[],l=[];for(let a of d)".pdf"===f(a.name)?(l.push({name:a.name,content:"",status:"loading"}),j.push(a)):l.push({name:a.name,content:await a.text(),status:"success"});if(c(a=>{let b=[...a];for(let a of l)b.some(b=>b.name===a.name)||b.push(a);return b}),j.length>0){let a=await Promise.all(j.map(g));c(b=>b.map(b=>"loading"!==b.status?b:a.find(a=>a.name===b.name)??b))}},[]),m=(0,d.useCallback)(a=>{c(b=>b.filter((b,c)=>c!==a))},[]);return{localAttachments:b,uploadError:h,uploadInputRef:j,pickFiles:l,removeAttachment:m,clearAttachments:(0,d.useCallback)(()=>{c([]),i("")},[]),injectFiles:(0,d.useCallback)(a=>{c(b=>{let c=[...b];for(let b of a)c.some(a=>a.name===b.name)||c.push(b);return c})},[])}}},41739:(a,b,c)=>{"use strict";c.d(b,{A:()=>x});var d=c(48249),e=c(67484),f=c(74429),g=c(93017),h=c(42742),i=c(3129),j=c(12625),k=c(59347),l=c(96286),m=c(6079),n=c(44218),o=c(35389),p=c(45231),q=c(13481),r=c(92343),s=c(50514),t=c(46674),u=c(59867),v=c(47223),w=c(54461);let x=(0,e.memo)(function({isPanel:a,showHistory:b,onToggleHistory:c,onReset:x,isLoading:y,maximized:z,onMaximize:A,askMode:B,onModeSwitch:C,onClose:D,onDockToPanel:E,hideTitle:F,sessions:G,activeSessionId:H,onLoadSession:I,onDeleteSession:J,onRenameSession:K,onTogglePinSession:L,messages:M}){let{t:N}=(0,v.Y)(),O=G&&G.length>=2,P=G?.find(a=>a.id===H),Q=P?(0,w.d)(P):null,[R,S]=(0,e.useState)(!1),T=(0,e.useRef)(null),U=(0,e.useRef)(null),[V,W]=(0,e.useState)(null),[X,Y]=(0,e.useState)(""),Z=(0,e.useRef)(null),$=(0,e.useCallback)(a=>{I?.(a),S(!1)},[I]),_=(0,e.useCallback)((a,b)=>{W(a),Y("(empty session)"===b?"":b)},[]),aa=(0,e.useCallback)(()=>{V&&K&&X.trim()&&K(V,X.trim()),W(null)},[V,X,K]),[ab,ac]=(0,e.useState)(null),ad=R&&ab&&G?(0,f.createPortal)((0,d.jsx)("div",{ref:U,className:"fixed z-50 rounded-xl border border-border/50 bg-card shadow-lg py-1 animate-in fade-in-0 slide-in-from-top-1 duration-100 max-h-[60vh] overflow-y-auto",style:{top:ab.top,left:ab.left,minWidth:Math.max(ab.width,280),maxWidth:340},role:"listbox",children:G.map(a=>{let b=a.id===H,c=(0,w.d)(a),e="(empty session)"===c?N.hints?.newChat??"New chat":c;return V===a.id?(0,d.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5",children:(0,d.jsx)("input",{ref:Z,type:"text",value:X,onChange:a=>Y(a.target.value),onKeyDown:a=>{"Enter"===a.key&&aa(),"Escape"===a.key&&W(null)},onBlur:aa,className:"flex-1 min-w-0 px-2 py-1 text-xs rounded-md border border-border bg-background text-foreground outline-none focus-visible:border-[var(--amber)]/50",placeholder:"Session name..."})},a.id):(0,d.jsxs)("div",{className:"group/item flex items-center",children:[(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":b,onClick:()=>$(a.id),className:`flex-1 min-w-0 flex items-center gap-2 px-3 py-2.5 text-xs text-left transition-colors ${b?"text-foreground font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[a.pinned&&(0,d.jsx)(g.A,{size:10,className:"shrink-0 text-[var(--amber)]/60 -rotate-45"}),b&&!a.pinned&&(0,d.jsx)(h.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"truncate",children:e})]}),(0,d.jsxs)("div",{className:"shrink-0 flex items-center gap-0.5 mr-1 opacity-0 group-hover/item:opacity-100 transition-opacity",children:[L&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),L(a.id)},className:`p-1.5 rounded-md transition-colors ${a.pinned?"text-[var(--amber)] hover:text-muted-foreground hover:bg-muted/60":"text-muted-foreground/40 hover:text-[var(--amber)] hover:bg-[var(--amber)]/5"}`,"aria-label":a.pinned?"Unpin":"Pin",children:a.pinned?(0,d.jsx)(i.A,{size:10}):(0,d.jsx)(g.A,{size:10})}),K&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),_(a.id,c)},className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-foreground hover:bg-muted/60","aria-label":`Rename: ${e}`,children:(0,d.jsx)(j.A,{size:10})}),G.length>1&&J&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),J(a.id)},className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-error hover:bg-error/5","aria-label":`Delete: ${e}`,children:(0,d.jsx)(k.A,{size:10})})]})]},a.id)})}),document.body):null;return(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 shrink-0",children:[!a&&(0,d.jsx)("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-8 h-1 rounded-full bg-muted-foreground/20 md:hidden"}),!F&&(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,d.jsx)("div",{className:"w-6 h-6 rounded-lg bg-[var(--amber)]/10 flex items-center justify-center shrink-0",children:b?(0,d.jsx)(l.A,{size:13,className:"text-[var(--amber)]"}):(0,d.jsx)(m.A,{size:13,className:"text-[var(--amber)]"})}),b?(0,d.jsx)("span",{className:"text-sm font-medium text-[var(--amber)]",children:N.ask?.sessionHistory??"Session History"}):O&&Q?(0,d.jsxs)("button",{ref:T,type:"button",onClick:()=>{G&&G.length>=2?S(a=>!a):c()},className:"flex items-center gap-1 min-w-0 text-sm font-medium text-[var(--amber)] hover:text-[var(--amber)]/80 transition-colors","aria-expanded":R,"aria-haspopup":"listbox",children:[(0,d.jsx)("span",{className:"truncate max-w-[180px]",children:"(empty session)"===Q?N.hints?.newChat??"New chat":Q}),(0,d.jsx)(n.A,{size:12,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${R?"rotate-180":""}`})]}):Q?(0,d.jsx)("span",{className:"text-sm font-medium text-muted-foreground/60 truncate max-w-[180px]",children:"(empty session)"===Q?N.hints?.newChat??"New chat":Q}):(0,d.jsx)("span",{className:"text-sm font-medium text-muted-foreground/40",children:N.hints?.newChat??"New chat"})]}),F&&(0,d.jsx)("div",{}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),c()},"aria-pressed":b,className:`p-2 rounded-lg transition-colors ${b?"bg-[var(--amber)]/10 text-[var(--amber)]":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:N.hints.sessionHistory,children:(0,d.jsx)(l.A,{size:14})}),M&&M.length>0&&(0,d.jsx)(u.A,{messages:M,disabled:y}),(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),x()},disabled:y,className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40",title:N.hints.newSession,children:(0,d.jsx)(o.A,{size:14})}),A&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),A()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:z?N.hints.restorePanel:N.hints.maximizePanel,children:z?(0,d.jsx)(p.A,{size:14}):(0,d.jsx)(q.A,{size:14})}),E&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),E()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:N.hints.dockToSide??"Dock to side panel",children:(0,d.jsx)(r.A,{size:14})}),C&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),C()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"popup"===B?N.hints.dockToSide:N.hints.openAsPopup,children:"popup"===B?(0,d.jsx)(r.A,{size:14}):(0,d.jsx)(s.A,{size:14})}),D&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),D()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:N.hints.closePanel,"aria-label":"Close",children:(0,d.jsx)(t.A,{size:14})})]}),"u">typeof document&&ad]})})},41829:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ChangeLogRenderer:()=>D});var d=c(48249),e=c(67484),f=c(2116),g=c.n(f),h=c(82318),i=c(94703),j=c(11732),k=c(12625),l=c(15273),m=c(71465),n=c(95801),o=c(80600),p=c(65255),q=c(98631),r=c(66336),s=c(96286),t=c(56692),u=c(69924),v=c(10316),w=c(44218),x=c(19794),y=c(95054),z=c(47223),A=c(27608),B=c(91199);function C(){return(0,d.jsx)("div",{className:"rounded-lg border border-border bg-card overflow-hidden animate-pulse",children:(0,d.jsx)("div",{className:"px-4 py-3 space-y-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("div",{className:"w-4 h-4 bg-muted rounded mt-1"}),(0,d.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,d.jsx)("div",{className:"h-5 bg-muted rounded w-2/3"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded w-full"})]})]})})})}function D(a){let{t:b}=(0,z.Y)(),[c,f]=(0,e.useState)("all"),[D,E]=(0,e.useState)(""),[F,G]=(0,e.useState)([]),[H,I]=(0,e.useState)({unreadCount:0,totalCount:0}),[J,K]=(0,e.useState)({}),[L,M]=(0,e.useState)(!0),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)(!1),R=(0,e.useCallback)(async()=>{M(!0),O(null);try{let a=new URLSearchParams({op:"list",limit:"120"});"all"!==c&&a.set("source",c),D.trim()&&a.set("q",D.trim());let[b,d]=await Promise.all([(0,y.n)(`/api/changes?${a.toString()}`),(0,y.n)("/api/changes?op=summary")]);G(b.events),I(d)}catch(a){O(a instanceof Error?a.message:String(a))}finally{M(!1)}},[c,D]),S=(0,e.useCallback)(async()=>{await (0,y.n)("/api/changes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"mark_seen"})}),await R()},[R]),T=(0,e.useMemo)(()=>[{value:"all",label:b.changes.filters.all},{value:"agent",label:b.changes.filters.agent},{value:"user",label:b.changes.filters.user},{value:"system",label:b.changes.filters.system}],[b]),U=(0,e.useCallback)(a=>"agent"===a?b.changes.filters.agent:"user"===a?b.changes.filters.user:b.changes.filters.system,[b]),V=(0,e.useCallback)(a=>b.changes.operations?.[a]??a,[b]);return(0,d.jsxs)("div",{style:{padding:"1.5rem 0"},children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:"w-10 h-10 rounded-lg bg-[var(--amber)]/8 flex items-center justify-center shrink-0",children:(0,d.jsx)(s.A,{size:20,className:"text-[var(--amber)]"})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("h1",{className:"text-xl font-semibold text-foreground tracking-tight",children:b.changes.title}),(0,d.jsx)("p",{className:"mt-1 text-sm text-muted-foreground leading-relaxed",children:b.changes.subtitle})]})]}),(0,d.jsxs)("div",{className:"mt-4 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"px-2.5 py-1 rounded-full bg-muted/60 text-muted-foreground text-xs font-medium",children:b.changes.eventsCount(F.length)}),H.unreadCount>0&&(0,d.jsx)("span",{className:"px-2.5 py-1 rounded-full bg-[var(--amber)]/10 text-[var(--amber)] text-xs font-medium border border-[var(--amber)]/20",children:b.changes.unreadCount(H.unreadCount)})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:()=>Q(a=>!a),className:`inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium transition-all duration-150 focus-visible:ring-2 focus-visible:ring-ring ${P?"bg-[var(--amber)]/10 text-[var(--amber)]":"bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:b.changes.filters.source,children:(0,d.jsx)(t.A,{size:14})}),(0,d.jsx)("button",{type:"button",onClick:()=>void R(),className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted transition-all duration-150 focus-visible:ring-2 focus-visible:ring-ring",title:b.changes.refresh,children:(0,d.jsx)(u.A,{size:14})}),H.unreadCount>0&&(0,d.jsxs)("button",{type:"button",onClick:()=>void S(),className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted transition-all duration-150 focus-visible:ring-2 focus-visible:ring-ring",title:b.changes.markAllRead,children:[(0,d.jsx)("span",{className:"hidden sm:inline",children:b.changes.markAllRead}),(0,d.jsx)("span",{className:"inline sm:hidden",children:"✓"})]})]})]}),(0,d.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${P?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,d.jsx)("div",{className:"overflow-hidden",children:(0,d.jsx)("div",{className:"rounded-lg border border-border/60 bg-card/60 p-4 mb-4",children:(0,d.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground block mb-1.5",children:b.changes.filters.source}),(0,d.jsx)(A.A,{value:c,onChange:a=>f(a),options:T})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground block mb-1.5",children:b.changes.filters.keyword}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(v.A,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/50"}),(0,d.jsx)("input",{value:D,onChange:a=>E(a.target.value),placeholder:b.changes.filters.keywordPlaceholder,className:"w-full pl-9 pr-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground placeholder:text-muted-foreground/40 outline-none focus-visible:ring-1 focus-visible:ring-ring hover:border-border/80 transition-all"})]})]})]})})})}),L&&(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsx)(C,{}),(0,d.jsx)(C,{}),(0,d.jsx)(C,{})]}),!L&&N&&(0,d.jsxs)("div",{className:"rounded-lg border border-error/20 bg-error/5 p-4 text-sm text-error",children:[N,(0,d.jsx)("button",{onClick:()=>void R(),className:"ml-2 underline hover:no-underline font-medium",children:b.changes.refresh})]}),!L&&!N&&0===F.length&&(0,d.jsx)("div",{className:"rounded-lg border border-border/60 bg-card/60 p-8 md:p-12",children:(0,d.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,d.jsx)("div",{className:"mb-4 p-4 bg-muted/50 rounded-lg",children:(0,d.jsx)(o.A,{size:28,className:"text-muted-foreground/60"})}),(0,d.jsx)("h3",{className:"text-base font-semibold text-foreground mb-1",children:b.changes.empty}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground max-w-sm",children:b.changes.emptyHint})]})}),!L&&!N&&F.length>0&&(0,d.jsx)("div",{className:"space-y-2",children:F.map(a=>{var c,e,f,s;let t,u,v=!!J[a.id],y=(0,B.m)(a.before??"",a.after??""),z=(0,B.S)(y),A=y.filter(a=>"insert"===a.type).length,C=y.filter(a=>"delete"===a.type).length;return(0,d.jsxs)("div",{className:"group rounded-lg border border-border/60 bg-card/70 overflow-hidden transition-all duration-150 hover:border-border hover:bg-card hover:shadow-sm",children:[(0,d.jsx)("button",{type:"button",onClick:()=>K(b=>({...b,[a.id]:!b[a.id]})),className:"w-full px-4 py-3 text-left focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring hover:bg-muted/20 transition-all",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsxs)("div",{className:"pt-0.5 text-muted-foreground/60 shrink-0 relative",children:[v&&(0,d.jsx)("div",{className:"absolute -left-4 top-0 bottom-0 w-[2px] rounded-r-full bg-[var(--amber)]"}),v?(0,d.jsx)(w.A,{size:15}):(0,d.jsx)(x.A,{size:15})]}),(0,d.jsx)("div",{className:"w-7 h-7 rounded-md bg-muted/50 flex items-center justify-center shrink-0 text-muted-foreground group-hover:bg-muted transition-all",children:"create_file"===(c=a.op)||"create_space"===c?(0,d.jsx)(h.A,{size:14}):"delete_file"===c?(0,d.jsx)(i.A,{size:14}):"update_lines"===c||"update_section"===c?(0,d.jsx)(j.A,{size:14}):"insert_lines"===c||"insert_after_heading"===c?(0,d.jsx)(k.A,{size:14}):"append_to_file"===c||"append_csv"===c?(0,d.jsx)(l.A,{size:14}):"rename_file"===c||"rename_space"===c||"move_file"===c?(0,d.jsx)(m.A,{size:14}):"import_file"===c?(0,d.jsx)(n.A,{size:14}):(0,d.jsx)(o.A,{size:14})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:function(a,b){let c=b.changes.summaries;if("Updated file content"===a)return c.updatedFileContent;if("Appended content to file"===a)return c.appendedContent;if("Moved to trash"===a)return c.movedToTrash;if("Created file"===a)return c.createdFile;if("Created space"===a)return c.createdSpace;if("Imported file into knowledge base"===a)return c.importedFile;let d=a.match(/^Inserted (\d+) line\(s\)$/);if(d)return c.insertedLines(Number(d[1]));let e=a.match(/^Updated lines (\d+)-(\d+)$/);if(e)return c.updatedLines(Number(e[1]),Number(e[2]));let f=a.match(/^Inserted content after heading "(.+)"$/);if(f)return c.insertedAfterHeading(f[1]);let g=a.match(/^Updated section "(.+)"$/);if(g)return c.updatedSection(g[1]);let h=a.match(/^Renamed file to (.+)$/);if(h)return c.renamedFile(h[1]);let i=a.match(/^Moved file to (.+)$/);if(i)return c.movedFile(i[1]);let j=a.match(/^Renamed space to (.+)$/);if(j)return c.renamedSpace(j[1]);let k=a.match(/^Appended CSV row \((\d+) cells?\)$/);return k?c.appendedCsvRow(Number(k[1])):a.startsWith("Imported legacy agent diff")?c.importedLegacyDiff:a}(a.summary,b)}),(A>0||C>0)&&(0,d.jsxs)("span",{className:"text-xs font-mono text-muted-foreground/70",children:[A>0&&(0,d.jsxs)("span",{className:"text-success font-semibold",children:["+",A]}),A>0&&C>0&&(0,d.jsx)("span",{className:"mx-0.5",children:"\xb7"}),C>0&&(0,d.jsxs)("span",{className:"text-error font-semibold",children:["-",C]})]})]}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"rounded-md px-2 py-0.5 bg-[var(--amber-dim)] text-[var(--amber)] text-xs font-medium truncate inline-block max-w-[200px]",title:a.path,children:a.path}),(0,d.jsxs)("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs font-medium ${"agent"===(e=a.source)?"bg-[var(--info)]/10 text-[var(--info)] border border-[var(--info)]/20":"user"===e?"bg-[var(--success)]/10 text-[var(--success)] border border-[var(--success)]/20":"bg-muted text-muted-foreground border border-border"} transition-colors`,children:["agent"===(f=a.source)?(0,d.jsx)(p.A,{size:13}):"user"===f?(0,d.jsx)(q.A,{size:13}):(0,d.jsx)(r.A,{size:13}),U(a.source)]}),(0,d.jsx)("span",{className:`text-xs font-medium ${(s=a.op).startsWith("create")||"import_file"===s?"text-success":s.startsWith("delete")?"text-error":s.startsWith("rename")||s.startsWith("move")?"text-muted-foreground":""}`,children:V(a.op)}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground/60 ml-auto shrink-0",children:function(a,b){let c=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(c<1)return b.changes.relativeTime.justNow;if(c<60)return b.changes.relativeTime.minutesAgo(c);let d=Math.floor(c/60);return d<24?b.changes.relativeTime.hoursAgo(d):b.changes.relativeTime.daysAgo(Math.floor(d/24))}(a.ts,b)})]})]}),(0,d.jsx)(g(),{href:`/view/${a.path.split("/").map(encodeURIComponent).join("/")}`,className:"inline-flex items-center px-2.5 py-1 rounded-md text-xs font-medium bg-[var(--amber)]/10 text-[var(--amber)] hover:bg-[var(--amber)] hover:text-[var(--amber-foreground)] focus-visible:ring-2 focus-visible:ring-ring transition-all duration-150 shrink-0",onClick:a=>a.stopPropagation(),title:b.changes.open,children:b.changes.open})]})}),v&&(t=1,u=1,(0,d.jsx)("div",{className:"border-t border-border/50 bg-background/60 max-h-80 overflow-y-auto",children:z.map((c,e)=>{if("gap"===c.type)return t+=c.count,u+=c.count,(0,d.jsx)("div",{className:"px-4 py-2 text-xs text-muted-foreground/50 border-y border-border/30 bg-muted/10 text-center font-medium",children:b.changes.unchangedLines(c.count)},`${a.id}-gap-${e}`);let f="insert"===c.type?"+":"delete"===c.type?"-":" ",g="insert"!==c.type?t:"",h="delete"!==c.type?u:"";return"insert"!==c.type&&t++,"delete"!==c.type&&u++,(0,d.jsxs)("div",{className:`flex items-start text-xs font-mono leading-6 px-4 ${"insert"===c.type?"bg-success/5 hover:bg-success/8":"delete"===c.type?"bg-error/5 hover:bg-error/8":"hover:bg-muted/20"} transition-colors`,children:[(0,d.jsx)("span",{className:"w-8 shrink-0 text-right pr-2 select-none text-muted-foreground/40",children:g}),(0,d.jsx)("span",{className:"w-8 shrink-0 text-right pr-2 select-none text-muted-foreground/40",children:h}),(0,d.jsx)("span",{className:`w-3 shrink-0 text-center select-none font-bold ${"insert"===c.type?"text-success":"delete"===c.type?"text-error":"text-muted-foreground/20"}`,children:f}),(0,d.jsx)("span",{className:`flex-1 whitespace-pre-wrap break-all overflow-hidden ${"insert"===c.type?"text-success":"delete"===c.type?"text-error":"text-muted-foreground"}`,children:c.text||"\xa0"})]},`${a.id}-${e}`)})}))]},a.id)})})]})}},42529:(a,b,c)=>{"use strict";c.d(b,{A:()=>p});var d=c(48249),e=c(67484),f=c(10316),g=c(46674),h=c(35389),i=c(22341),j=c(59347),k=c(93017),l=c(3129),m=c(12625),n=c(54461),o=c(47223);function p({sessions:a,activeSessionId:b,onLoad:c,onDelete:k,onRename:l,onTogglePin:m,onClearAll:p,onClose:r,onNewChat:s}){let{t}=(0,o.Y)(),u=t.ask,[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)(null),[z,A]=(0,e.useState)(""),[B,C]=(0,e.useState)(!1),D=(0,e.useRef)(void 0),E=(0,e.useRef)(null),F=(0,e.useRef)(null),G=(0,e.useMemo)(()=>{if(!v.trim())return a;let b=v.toLowerCase();return a.filter(a=>!!(0,n.d)(a).toLowerCase().includes(b)||a.messages.some(a=>a.content.toLowerCase().includes(b)))},[a,v]),H=(0,e.useMemo)(()=>{let a=[],b=[],c=[],d=[],e=[];for(let f of G){if(f.pinned){a.push(f);continue}let g=function(a){let b=new Date,c=new Date(b.getFullYear(),b.getMonth(),b.getDate()).getTime(),d=c-864e5*b.getDay();return a>=c?"today":a>=c-864e5?"yesterday":a>=d?"week":"older"}(f.updatedAt);"today"===g?b.push(f):"yesterday"===g?c.push(f):"week"===g?d.push(f):e.push(f)}return{pinned:a,today:b,yesterday:c,week:d,older:e}},[G]),I=a.filter(a=>a.pinned).length,J=a.filter(a=>a.messages.length>0).length,K=(0,e.useCallback)(a=>{c(a),r()},[c,r]),L=(0,e.useCallback)(()=>{s(),r()},[s,r]),M=(0,e.useCallback)(a=>{y(a.id),A((0,n.d)(a))},[]),N=(0,e.useCallback)(()=>{x&&z.trim()&&l(x,z.trim()),y(null)},[x,z,l]),O=(0,e.useCallback)(()=>{if(!B){C(!0),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>C(!1),3e3);return}D.current&&clearTimeout(D.current),p(),C(!1)},[B,p]),P=(a,c)=>0===c.length?null:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-2xs font-medium text-muted-foreground/50 uppercase tracking-wider px-1 py-2",children:a}),(0,d.jsx)("div",{className:"flex flex-col gap-1",children:c.map(a=>(0,d.jsx)(q,{session:a,isActive:a.id===b,editing:x===a.id,editValue:z,onEditValueChange:A,inputRef:F,onLoad:()=>K(a.id),onStartRename:()=>M(a),onCommitRename:N,onCancelRename:()=>y(null),onDelete:()=>k(a.id),onTogglePin:()=>m(a.id),ask:u},a.id))})]},a),Q=G.length>0;return(0,d.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 animate-in fade-in-0 duration-150",children:[(0,d.jsx)("div",{className:"px-4 pt-3 pb-2 shrink-0",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(f.A,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground/50"}),(0,d.jsx)("input",{ref:E,type:"text",value:v,onChange:a=>w(a.target.value),placeholder:u?.historySearch??"Search conversations...",className:"w-full pl-8 pr-8 py-2 text-xs rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground/40 outline-none focus-visible:border-[var(--amber)]/40 transition-colors"}),v&&(0,d.jsx)("button",{type:"button",onClick:()=>w(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded text-muted-foreground/40 hover:text-foreground",children:(0,d.jsx)(g.A,{size:12})})]})}),(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 pb-2 shrink-0",children:[(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground/60",children:[u?.historyStats?.(J)??`${J} conversations`,I>0&&(0,d.jsxs)(d.Fragment,{children:[" \xb7 ",I," ",u?.historyPinned??"pinned"]})]}),(0,d.jsxs)("button",{type:"button",onClick:L,className:"flex items-center gap-1 text-2xs text-[var(--amber)] hover:text-[var(--amber)]/80 transition-colors",children:[(0,d.jsx)(h.A,{size:11}),(0,d.jsx)("span",{children:t.hints?.newChat??"New chat"})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-3 pb-3",children:Q?(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[P(u?.historyPinned??"Pinned",H.pinned),P(u?.historyToday??"Today",H.today),P(u?.historyYesterday??"Yesterday",H.yesterday),P(u?.historyThisWeek??"This week",H.week),P(u?.historyOlder??"Older",H.older)]}):(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,d.jsx)(i.A,{size:32,className:"text-muted-foreground/20 mb-3"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground/60",children:v?"No matching conversations":u?.historyEmpty??"No conversations yet"}),!v&&(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/40 mt-1",children:u?.historyEmptyHint??"Start a new chat to begin"})]})}),J>0&&(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 border-t border-border/40 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:O,className:`text-2xs px-2 py-0.5 rounded-md transition-colors ${B?"bg-error/10 text-error font-medium":"text-muted-foreground/50 hover:text-error hover:bg-muted"}`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)(j.A,{size:10}),B?u?.confirmClear??"Confirm clear?":u?.clearAll??"Clear all"]})}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 tabular-nums",children:u?.historyCapacity?.(J)??`${J} of 30`})]})]})}function q({session:a,isActive:b,editing:c,editValue:e,onEditValueChange:f,inputRef:g,onLoad:h,onStartRename:o,onCommitRename:p,onCancelRename:q,onDelete:r,onTogglePin:s,ask:t}){let u=(0,n.d)(a),v=function(a){let b=a.messages.find(a=>"user"===a.role);if(!b)return"";let c=b.content.replace(/\s+/g," ").trim();return c.length>60?`${c.slice(0,60)}...`:c}(a),w=a.messages.length;return(0,d.jsxs)("div",{className:`group relative rounded-lg transition-colors cursor-pointer ${b?"bg-[var(--amber)]/8 border border-[var(--amber)]/15":"hover:bg-muted/60 border border-transparent"}`,onClick:h,children:[b&&(0,d.jsx)("span",{className:"absolute left-0 top-3 bottom-3 w-[2px] rounded-r-full bg-[var(--amber)]"}),(0,d.jsxs)("div",{className:"px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-0.5",children:[a.pinned&&(0,d.jsx)(k.A,{size:10,className:"shrink-0 text-[var(--amber)]/60 -rotate-45"}),c?(0,d.jsx)("input",{ref:g,type:"text",value:e,onChange:a=>f(a.target.value),onBlur:p,onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),p()),"Escape"===a.key&&(a.preventDefault(),q())},onClick:a=>a.stopPropagation(),className:"flex-1 min-w-0 bg-transparent border-b border-[var(--amber)] outline-none text-xs font-medium text-foreground"}):(0,d.jsx)("span",{className:"flex-1 min-w-0 text-xs font-medium text-foreground truncate",children:u}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 shrink-0 tabular-nums",children:function(a){let b=Math.floor((Date.now()-a.getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m ago`;let c=Math.floor(b/60);if(c<24)return`${c}h ago`;let d=Math.floor(c/24);return d<7?`${d}d ago`:a.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(new Date(a.updatedAt))})]}),!c&&v&&(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/50 truncate mt-0.5 pl-0.5",children:v}),!c&&(0,d.jsxs)("div",{className:"flex items-center justify-between mt-1.5",children:[(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground/40 flex items-center gap-1",children:[(0,d.jsx)(i.A,{size:9}),t?.historyMsgs?.(w)??`${w} msgs`]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("button",{type:"button",onClick:s,className:`p-1 rounded-md transition-colors ${a.pinned?"text-[var(--amber)] hover:text-muted-foreground":"text-muted-foreground/40 hover:text-[var(--amber)]"}`,title:a.pinned?"Unpin":"Pin",children:a.pinned?(0,d.jsx)(l.A,{size:11}):(0,d.jsx)(k.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:o,className:"p-1 rounded-md text-muted-foreground/40 hover:text-foreground hover:bg-muted/60 transition-colors",title:t?.renameSession??"Rename",children:(0,d.jsx)(m.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:r,className:"p-1 rounded-md text-muted-foreground/40 hover:text-error hover:bg-error/5 transition-colors",title:"Delete",children:(0,d.jsx)(j.A,{size:11})})]})]})]})]})}},43248:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(48249);function e({error:a,reset:b}){return(0,d.jsx)("html",{lang:"en",children:(0,d.jsx)("body",{style:{margin:0,fontFamily:"'IBM Plex Sans', system-ui, sans-serif",background:"#131210",color:"#e8e4dc"},children:(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",gap:"16px",padding:"24px",textAlign:"center"},children:[(0,d.jsx)("h2",{style:{fontSize:"18px",fontWeight:600,margin:0},children:"Something went wrong"}),(0,d.jsx)("p",{style:{fontSize:"14px",color:"#8a8275",maxWidth:"400px",margin:0},children:a.message||"An unexpected error occurred. Please try again."}),(0,d.jsxs)("div",{style:{display:"flex",gap:"12px",marginTop:"8px"},children:[(0,d.jsx)("button",{onClick:b,style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,background:"#1c1a17",color:"#e8e4dc",border:"1px solid rgba(232,228,220,0.08)",cursor:"pointer"},children:"Try again"}),(0,d.jsx)("a",{href:"/setup",style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,background:"#c8873a",color:"#fff",textDecoration:"none",cursor:"pointer"},children:"Go to Setup"})]})]})})})}},43951:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ChangeLogRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ChangeLogRenderer() from the server but ChangeLogRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/change-log/ChangeLogRenderer.tsx","ChangeLogRenderer")},45108:(a,b,c)=>{"use strict";c.d(b,{u:()=>h});var d=c(67484);let e=new Set(["image/png","image/jpeg","image/gif","image/webp"]);async function f(a){let b=a.type;if(a.size<=5242880){let c=new Uint8Array(await a.arrayBuffer()),d="";for(let a=0;a<c.length;a+=32768)d+=String.fromCharCode(...c.subarray(a,a+32768));return{data:btoa(d),mimeType:b}}return new Promise((b,c)=>{let d=new Image,e=URL.createObjectURL(a);d.onload=()=>{let{width:a,height:f}=d;if(a>1920||f>1920){let b=Math.min(1920/a,1920/f);a=Math.round(a*b),f=Math.round(f*b)}let g=document.createElement("canvas");g.width=a,g.height=f;let h=g.getContext("2d");if(!h){URL.revokeObjectURL(e),c(Error("Canvas not supported"));return}h.drawImage(d,0,0,a,f);let i=g.toDataURL("image/jpeg",.85).split(",")[1];URL.revokeObjectURL(e),b({data:i,mimeType:"image/jpeg"})},d.onerror=()=>{URL.revokeObjectURL(e),c(Error("Failed to load image"))},d.src=e})}function g(a){let b=[];for(let c of Array.from(a))if("file"===c.kind&&e.has(c.type)){let a=c.getAsFile();a&&b.push(a)}return b}function h(){let[a,b]=(0,d.useState)([]),[c,h]=(0,d.useState)(""),i=(0,d.useCallback)(async a=>{h("");let c=a.slice(0,4),d=[];for(let a of c){var g;if(g=a.type,!e.has(g)){h(`Unsupported image type: ${a.type}`);continue}try{let{data:b,mimeType:c}=await f(a);d.push({type:"image",data:b,mimeType:c,fileName:a.name||void 0})}catch{h(`Failed to process image: ${a.name}`)}}b(a=>{let b=[...a,...d];return b.length>4?(h("Maximum 4 images allowed"),b.slice(0,4)):b})},[]),j=(0,d.useCallback)(async a=>{let b=a.clipboardData?.items;if(!b)return!1;let c=g(b);return 0!==c.length&&(await i(c),!0)},[i]),k=(0,d.useCallback)(async a=>{let b=a.dataTransfer?.items;if(!b)return;let c=g(b);c.length>0&&(a.preventDefault(),await i(c))},[i]),l=(0,d.useCallback)(async a=>{if(!a)return;let b=Array.from(a).filter(a=>{var b;return b=a.type,e.has(b)});await i(b)},[i]);return{images:a,imageError:c,addImages:i,handlePaste:j,handleDrop:k,handleFileSelect:l,removeImage:(0,d.useCallback)(a=>{b(b=>b.filter((b,c)=>c!==a))},[]),clearImages:(0,d.useCallback)(()=>{b([]),h("")},[])}}},45862:(a,b,c)=>{"use strict";c.r(b),c.d(b,{SummaryRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call SummaryRenderer() from the server but SummaryRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/summary/SummaryRenderer.tsx","SummaryRenderer")},46427:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>D});var d=c(48249),e=c(67484),f=c.n(e),g=c(93053),h=c(75155),i=c(22242),j=c(91282),k=c(65732),l=c.n(k);function m(a,b){return l().unparse([a,...b])}let n=[{bg:"rgba(200,135,58,0.12)",text:"var(--amber)"},{bg:"rgba(122,173,128,0.12)",text:"var(--success)"},{bg:"rgba(138,180,216,0.12)",text:"#8ab4d8"},{bg:"rgba(200,160,216,0.12)",text:"#c8a0d8"},{bg:"rgba(200,96,96,0.12)",text:"#c86060"},{bg:"rgba(150,150,150,0.12)",text:"var(--muted-foreground)"}];function o(a){let b=0;for(let c=0;c<a.length;c++)b=31*b+a.charCodeAt(c)&65535;return n[b%n.length]}var p=c(82884),q=c(72419),r=c(44218),s=c(59347),t=c(24520);function u({value:a,onCommit:b}){let[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(a),i=(0,e.useRef)(null);function j(){f(!1),g!==a?b(g):h(a)}return c?(0,d.jsx)("input",{ref:i,value:g,onChange:a=>h(a.target.value),onBlur:j,onKeyDown:b=>{"Enter"===b.key&&j(),"Escape"===b.key&&(h(a),f(!1))},className:"w-full bg-transparent outline-none text-sm",onClick:a=>a.stopPropagation(),style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)",minWidth:60}}):(0,d.jsx)("div",{className:"truncate text-sm cursor-text",style:{color:"var(--foreground)",minWidth:60},onClick:()=>f(!0),title:a,children:a||(0,d.jsx)("span",{style:{color:"var(--muted-foreground)",opacity:.3},children:"—"})})}function v({headers:a,visibleIndices:b,onAdd:c,onCancel:f}){let[g,h]=(0,e.useState)(()=>Array(a.length).fill(""));return(0,d.jsxs)("tr",{style:{background:"color-mix(in srgb, var(--amber) 6%, transparent)",borderTop:"1px solid var(--amber)"},children:[b.map((b,e)=>(0,d.jsx)("td",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,d.jsx)("input",{autoFocus:0===e,value:g[b],onChange:a=>{var c;return c=a.target.value,void h(a=>{let d=[...a];return d[b]=c,d})},onKeyDown:a=>{"Enter"===a.key&&c(g),"Escape"===a.key&&f()},placeholder:a[b],className:"w-full bg-transparent outline-none text-sm placeholder:opacity-30",style:{color:"var(--foreground)",borderBottom:"1px solid var(--border)"}})},b)),(0,d.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"}})]})}function w({headers:a,rows:b,cfg:c,saveAction:g}){let[h,i]=(0,e.useState)(b),[j,k]=(0,e.useState)(!1),l=(0,e.useMemo)(()=>a.map((a,b)=>b).filter(b=>!c.hiddenFields.includes(a[b])),[a,c.hiddenFields]),n=a.indexOf(c.sortField),o=(0,e.useMemo)(()=>{let a=[...h];return n>=0&&a.sort((a,b)=>{let d=a[n]??"",e=b[n]??"",f=parseFloat(d),g=parseFloat(e),h=isNaN(f)||isNaN(g)?d.localeCompare(e):f-g;return"asc"===c.sortDir?h:-h}),a},[h,n,c.sortDir]),p=a.indexOf(c.groupField),w=(0,e.useMemo)(()=>{if(p<0)return[{key:null,rows:o.map(a=>({row:a,orig:a}))}];let a=new Map;for(let b of o){let c=b[p]||"(empty)";a.has(c)||a.set(c,[]),a.get(c).push(b)}return[...a.entries()].map(([a,b])=>({key:a,rows:b.map(a=>({row:a,orig:a}))}))},[o,p]);async function x(b,c,d){let e=h.map(a=>a===b?a.map((a,b)=>b===c?d:a):a);i(e),await g(m(a,e))}async function y(b){let c=h.filter(a=>a!==b);i(c),await g(m(a,c))}async function z(b){let c=[...h,b];i(c),k(!1),await g(m(a,c))}let A={borderBottom:"1px solid var(--border)",fontSize:"0.72rem",letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--muted-foreground)",fontWeight:600},B=0;return(0,d.jsxs)("div",{className:"rounded-xl overflow-hidden border",style:{borderColor:"var(--border)"},children:[(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"min-w-full text-sm border-collapse",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{style:{background:"var(--muted)"},children:[l.map(b=>(0,d.jsx)("th",{className:"px-4 py-2.5 text-left whitespace-nowrap",style:A,children:(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[a[b],c.sortField===a[b]&&("asc"===c.sortDir?(0,d.jsx)(q.A,{size:10,style:{color:"var(--amber)"}}):(0,d.jsx)(r.A,{size:10,style:{color:"var(--amber)"}}))]})},b)),(0,d.jsx)("th",{className:"w-8",style:{...A,background:"var(--muted)"}})]})}),(0,d.jsxs)("tbody",{children:[w.map((a,b)=>(0,d.jsxs)(f().Fragment,{children:[null!==a.key&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:l.length+1,className:"px-4 py-1.5",style:{background:"var(--accent)",borderBottom:"1px solid var(--border)",borderTop:"1px solid var(--border)"},children:(0,d.jsxs)("span",{className:"text-xs font-semibold font-display",style:{color:"var(--muted-foreground)"},children:[a.key," \xb7 ",a.rows.length]})})},`grp-${a.key}`),a.rows.map(({row:a,orig:b})=>{let c=B++;return(0,d.jsxs)("tr",{className:"group transition-colors",style:{background:c%2==0?"var(--background)":"var(--card)"},onMouseEnter:a=>a.currentTarget.style.background="var(--muted)",onMouseLeave:a=>a.currentTarget.style.background=c%2==0?"var(--background)":"var(--card)",children:[l.map(c=>(0,d.jsx)("td",{className:"px-4 py-2 max-w-xs",style:{borderBottom:"1px solid var(--border)"},children:(0,d.jsx)(u,{value:a[c]??"",onCommit:a=>x(b,c,a)})},c)),(0,d.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,d.jsx)("button",{onClick:()=>y(b),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/10",style:{color:"var(--muted-foreground)"},children:(0,d.jsx)(s.A,{size:12})})})]},c)})]},a.key??`section-${b}`)),j&&(0,d.jsx)(v,{headers:a,visibleIndices:l,onAdd:z,onCancel:()=>k(!1)})]})]})}),(0,d.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between",style:{background:"var(--muted)",borderTop:"1px solid var(--border)"},children:[(0,d.jsxs)("span",{className:"text-xs font-display",style:{color:"var(--muted-foreground)"},children:[h.length," rows \xb7 ",a.length," cols"]}),j?(0,d.jsx)("button",{onClick:()=>k(!1),className:"text-xs px-2.5 py-1 rounded-md",style:{color:"var(--muted-foreground)"},children:"Cancel"}):(0,d.jsxs)("button",{onClick:()=>k(!0),className:"flex items-center gap-1 text-xs px-2.5 py-1 rounded-md",style:{color:"var(--amber)",background:"var(--amber-dim)"},children:[(0,d.jsx)(t.A,{size:12})," Add row"]})]})]})}function x({headers:a,rows:b,cfg:c}){let e=a.indexOf(c.titleField),f=a.indexOf(c.descField),g=a.indexOf(c.tagField);return(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:b.map((b,c)=>{let h=e>=0?b[e]:b[0]??"",i=f>=0?b[f]:"",j=g>=0?b[g]:"",k=j?o(j):null;return(0,d.jsxs)("div",{className:"rounded-xl border p-4 flex flex-col gap-2 hover:bg-muted/50 transition-colors",style:{borderColor:"var(--border)",background:"var(--card)"},children:[j&&k&&(0,d.jsx)("span",{className:"self-start text-xs px-2 py-0.5 rounded-full font-medium",style:{background:k.bg,color:k.text},children:j}),(0,d.jsx)("p",{className:"text-sm font-semibold leading-snug",style:{color:"var(--foreground)"},children:h}),i&&(0,d.jsx)("p",{className:"text-xs leading-relaxed line-clamp-3",style:{color:"var(--muted-foreground)"},children:i}),(0,d.jsx)("div",{className:"mt-1 flex flex-col gap-0.5",children:a.map((a,c)=>{if(c===e||c===f||c===g)return null;let h=b[c];return h?(0,d.jsxs)("div",{className:"flex items-baseline gap-1.5 text-xs",children:[(0,d.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",opacity:.6,fontSize:"0.68rem"},children:a}),(0,d.jsx)("span",{className:"truncate",style:{color:"var(--muted-foreground)"},children:h})]},c):null})})]},c)})})}function y({headers:a,rows:b,cfg:c,saveAction:f}){let[g,h]=(0,e.useState)(b),[i,j]=(0,e.useState)(null),[k,l]=(0,e.useState)(""),[n,p]=(0,e.useState)(!1),q=a.indexOf(c.groupField),r=a.indexOf(c.titleField),s=a.indexOf(c.descField),{groups:u,groupKeys:v}=(0,e.useMemo)(()=>{let a=new Map;return g.forEach((b,c)=>{let d=(q>=0?b[q]:"")||"(empty)";a.has(d)||a.set(d,[]),a.get(d).push({row:b,origIdx:c})}),{groups:a,groupKeys:[...a.keys()]}},[g,q]);async function w(b,c){let d=g.map((a,d)=>{if(d!==b)return a;let e=[...a];return q>=0&&(e[q]=c),e});h(d),await f(m(a,d))}function x({group:b}){let c=u.get(b)??[],e=o(b),f=i===b;return(0,d.jsxs)("div",{className:"flex-shrink-0 w-64 flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[(0,d.jsx)("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{background:e.text}}),(0,d.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider truncate font-display",style:{color:e.text},children:b}),(0,d.jsx)("span",{className:"text-xs ml-auto shrink-0",style:{color:"var(--muted-foreground)",opacity:.5},children:c.length})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl p-1.5 min-h-[80px] transition-colors",style:{background:f?"var(--amber-dim)":"var(--muted)",border:`1px solid ${f?"var(--amber)":"transparent"}`},onDragOver:a=>{a.preventDefault(),j(b)},onDragLeave:a=>{a.currentTarget.contains(a.relatedTarget)||j(null)},onDrop:a=>{j(null);let c=parseInt(a.dataTransfer.getData("origIdx"));isNaN(c)||w(c,b)},children:[c.map(({row:b,origIdx:c})=>{let e=r>=0?b[r]:b[0]??"",f=s>=0?b[s]:"";return(0,d.jsxs)("div",{draggable:!0,onDragStart:a=>{a.dataTransfer.setData("origIdx",String(c)),j(null)},onDragEnd:()=>j(null),className:"rounded-lg border p-3 flex flex-col gap-1.5 cursor-grab active:cursor-grabbing hover:bg-muted/50 transition-colors",style:{borderColor:"var(--border)",background:"var(--card)"},children:[(0,d.jsx)("p",{className:"text-sm font-medium leading-snug",style:{color:"var(--foreground)"},children:e}),f&&(0,d.jsx)("p",{className:"text-xs leading-relaxed line-clamp-2",style:{color:"var(--muted-foreground)"},children:f}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1 mt-0.5",children:a.map((a,c)=>{if(c===q||c===r||c===s)return null;let e=b[c];return e?(0,d.jsxs)("span",{className:"text-2xs px-1.5 py-0.5 rounded font-display",style:{background:"var(--muted)",color:"var(--muted-foreground)"},children:[a,": ",e]},c):null})})]},c)}),0===c.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-12",children:(0,d.jsx)("span",{className:"text-xs",style:{color:"var(--muted-foreground)",opacity:.4},children:"Drop here"})})]})]})}return(0,d.jsxs)("div",{className:"flex gap-3 overflow-x-auto pb-3 items-start",children:[v.map(a=>(0,d.jsx)(x,{group:a},a)),(0,d.jsx)("div",{className:"flex-shrink-0 w-64",children:n?(0,d.jsxs)("div",{className:"rounded-xl border p-3 flex flex-col gap-2",style:{borderColor:"var(--border)",background:"var(--card)"},children:[(0,d.jsx)("input",{autoFocus:!0,value:k,onChange:a=>l(a.target.value),onKeyDown:a=>{"Enter"===a.key&&k.trim()&&(l(""),p(!1)),"Escape"===a.key&&(l(""),p(!1))},placeholder:"Column name…",className:"text-xs bg-transparent outline-none w-full font-display",style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)"}}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{onClick:()=>{l(""),p(!1)},className:"text-xs px-2 py-1 rounded font-display",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:"Create"}),(0,d.jsx)("button",{onClick:()=>{l(""),p(!1)},className:"text-xs px-2 py-1 rounded font-display",style:{color:"var(--muted-foreground)"},children:"Cancel"})]})]}):(0,d.jsxs)("button",{onClick:()=>p(!0),className:"flex items-center gap-1.5 text-xs px-3 py-2 rounded-xl border border-dashed w-full transition-colors hover:bg-muted font-display",style:{borderColor:"var(--border)",color:"var(--muted-foreground)"},children:[(0,d.jsx)(t.A,{size:12})," Add column"]})})]})}var z=c(46674),A=c(27608);function B({headers:a,cfg:b,view:c,onClose:e,onChange:f}){let g={color:"var(--muted-foreground)",fontSize:"0.72rem"};function h({label:b,value:c,onChange:e}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("span",{className:"font-display",style:g,children:b}),(0,d.jsx)(A.A,{value:c,onChange:e,size:"sm",options:[{value:"",label:"— none —"},...a.map(a=>({value:a,label:a}))]})]})}return(0,d.jsxs)("div",{className:"absolute right-0 top-10 z-20 w-72 rounded-xl border shadow-xl p-4 flex flex-col gap-3",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:[c," settings"]}),(0,d.jsx)("button",{onClick:e,style:{color:"var(--muted-foreground)"},children:(0,d.jsx)(z.A,{size:13})})]}),"table"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:"Sort"}),(0,d.jsx)(h,{label:"Sort by",value:b.table.sortField,onChange:a=>f({...b,table:{...b.table,sortField:a}})}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("span",{style:g,children:"Direction"}),(0,d.jsx)("div",{className:"flex rounded overflow-hidden border",style:{borderColor:"var(--border)"},children:["asc","desc"].map(a=>(0,d.jsx)("button",{onClick:()=>f({...b,table:{...b.table,sortDir:a}}),className:"px-3 py-1 text-xs transition-colors font-display",style:{fontSize:"0.72rem",background:b.table.sortDir===a?"var(--amber)":"var(--background)",color:b.table.sortDir===a?"var(--amber-foreground)":"var(--muted-foreground)"},children:a},a))})]}),(0,d.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:"Group"}),(0,d.jsx)(h,{label:"Group by",value:b.table.groupField,onChange:a=>f({...b,table:{...b.table,groupField:a}})}),(0,d.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:"Columns"}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:a.map(a=>{let c=b.table.hiddenFields.includes(a);return(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{style:g,children:a}),(0,d.jsx)("button",{onClick:()=>{let d=c?b.table.hiddenFields.filter(b=>b!==a):[...b.table.hiddenFields,a];f({...b,table:{...b.table,hiddenFields:d}})},className:"text-xs px-2 py-0.5 rounded transition-colors font-display",style:{background:c?"var(--muted)":"var(--amber-dim)",color:c?"var(--muted-foreground)":"var(--amber)"},children:c?"Hidden":"Visible"})]},a)})})]}),"gallery"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{label:"Title",value:b.gallery.titleField,onChange:a=>f({...b,gallery:{...b.gallery,titleField:a}})}),(0,d.jsx)(h,{label:"Description",value:b.gallery.descField,onChange:a=>f({...b,gallery:{...b.gallery,descField:a}})}),(0,d.jsx)(h,{label:"Tag / Badge",value:b.gallery.tagField,onChange:a=>f({...b,gallery:{...b.gallery,tagField:a}})})]}),"board"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{label:"Group by",value:b.board.groupField,onChange:a=>f({...b,board:{...b.board,groupField:a}})}),(0,d.jsx)(h,{label:"Card title",value:b.board.titleField,onChange:a=>f({...b,board:{...b.board,titleField:a}})}),(0,d.jsx)(h,{label:"Card desc",value:b.board.descField,onChange:a=>f({...b,board:{...b.board,descField:a}})})]})]})}let C=[{id:"table",icon:(0,d.jsx)(g.A,{size:13}),label:"Table"},{id:"gallery",icon:(0,d.jsx)(h.A,{size:13}),label:"Gallery"},{id:"board",icon:(0,d.jsx)(i.A,{size:13}),label:"Board"}];function D({filePath:a,content:b,saveAction:c}){let{headers:f,rows:g}=(0,e.useMemo)(()=>{let a;return{headers:(a=l().parse(b,{skipEmptyLines:!0}).data)[0]??[],rows:a.slice(1)}},[b]),h=(0,e.useMemo)(()=>({activeView:"table",table:{sortField:"",sortDir:"asc",groupField:"",hiddenFields:[]},gallery:{titleField:f[0]??"",descField:f[1]??"",tagField:f[2]??""},board:{groupField:f[f.length-1]??"",titleField:f[0]??"",descField:f[1]??""}}),[f]),[i,k]=(0,p.Un)("csv",a,h),[m,n]=(0,e.useState)(!1),o=(0,e.useCallback)(a=>{k(a)},[k]),q=i.activeView;return(0,d.jsxs)("div",{className:"w-full py-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4 relative",children:[(0,d.jsx)("div",{className:"flex items-center gap-0.5 p-1 rounded-lg",style:{background:"var(--muted)"},children:C.map(a=>(0,d.jsxs)("button",{onClick:()=>o({...i,activeView:a.id}),className:"flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors font-display",style:{background:q===a.id?"var(--card)":"transparent",color:q===a.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:q===a.id?"0 1px 3px rgba(0,0,0,0.1)":"none"},children:[a.icon,a.label]},a.id))}),(0,d.jsx)("div",{className:"flex-1"}),(0,d.jsxs)("span",{className:"text-xs font-display",style:{color:"var(--muted-foreground)",opacity:.5},children:[g.length," rows"]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{onClick:()=>n(a=>!a),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors",style:{background:m?"var(--accent)":"var(--muted)",color:m?"var(--foreground)":"var(--muted-foreground)"},title:"View settings",children:(0,d.jsx)(j.A,{size:13})}),m&&(0,d.jsx)(B,{headers:f,cfg:i,view:q,onClose:()=>n(!1),onChange:o})]})]}),"table"===q&&(0,d.jsx)(w,{headers:f,rows:g,cfg:i.table,saveAction:c}),"gallery"===q&&(0,d.jsx)(x,{headers:f,rows:g,cfg:i.gallery}),"board"===q&&(0,d.jsx)(y,{headers:f,rows:g,cfg:i.board,saveAction:c})]})}},47223:(a,b,c)=>{"use strict";c.d(b,{D:()=>f,Y:()=>g});var d=c(31417),e=c(52610);let f=(0,d.v)(a=>({locale:"en",t:e.D.en,setLocale:b=>{document.cookie=`locale=${b};path=/;max-age=31536000;SameSite=Lax`,document.documentElement.lang="zh"===b?"zh":"en",window.__mindos_locale__=b,a({locale:b,t:e.D[b]}),window.dispatchEvent(new Event("mindos-locale-change"))},_init:b=>{"en"!==f.getState().locale&&a({locale:"en",t:e.D.en});let c=()=>{a({locale:"en",t:e.D.en})};return window.addEventListener("mindos-locale-change",c),()=>window.removeEventListener("mindos-locale-change",c)}}));function g(){return f()}},47336:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ImageRenderer:()=>g});var d=c(48249),e=c(67484);let f=[.25,.5,.75,1,1.5,2,3,4];function g({filePath:a}){let b=`/api/file/raw?path=${encodeURIComponent(a)}`,c=a.split("/").pop()??"image",g=c.split(".").pop()?.toLowerCase()??"",h=["png","svg","webp","ico","gif"].includes(g),[i,j]=(0,e.useState)(!0),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(0),[o,p]=(0,e.useState)("fit"),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(null),u=(0,e.useRef)(null),v=(0,e.useRef)(null),w=(0,e.useCallback)(()=>{j(!1);let a=u.current;a&&r({w:a.naturalWidth,h:a.naturalHeight})},[]),x=(0,e.useCallback)(()=>{j(!1),l(!0)},[]),y=(0,e.useCallback)(()=>{l(!1),j(!0),n(a=>a+1)},[]),z=(0,e.useCallback)(()=>{p(a=>{let b="fit"===a?1:a;return f.find(a=>a>b)??b})},[]),A=(0,e.useCallback)(()=>{p(a=>{let b="fit"===a?1:a;return[...f].reverse().find(a=>a<b)??b})},[]),B=(0,e.useCallback)(()=>{p(a=>"fit"===a?1:"fit")},[]),C="fit"===o?"Fit":`${Math.round(100*o)}%`,D="fit"===o?{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain"}:q?{width:q.w*o,height:"auto"}:{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain"};return(0,d.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[q&&(0,d.jsxs)("span",{children:[q.w," x ",q.h]}),null!==s&&(0,d.jsx)("span",{children:s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`}),(0,d.jsx)("span",{className:"uppercase opacity-60",children:g})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("button",{onClick:A,disabled:!q,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-30",title:"Zoom out (-)",children:"-"}),(0,d.jsx)("button",{onClick:B,disabled:!q,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors min-w-[48px] text-center disabled:opacity-30",title:"fit"===o?"Actual size (1)":"Fit to view (0)",children:C}),(0,d.jsx)("button",{onClick:z,disabled:!q,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-30",title:"Zoom in (+)",children:"+"})]})]}),(0,d.jsxs)("div",{ref:v,tabIndex:-1,className:`relative flex-1 min-h-[70vh] overflow-auto flex items-center justify-center outline-none ${h?"bg-checkerboard":"bg-[var(--bg-secondary)]"}`,children:[i&&!k&&(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:(0,d.jsx)("span",{className:"text-sm text-[var(--text-tertiary)] animate-pulse",children:"Loading..."})}),k&&(0,d.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center z-10 gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load image"}),(0,d.jsx)("button",{onClick:y,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}),(0,d.jsx)("img",{ref:u,src:b,alt:c,onLoad:w,onError:x,draggable:!1,className:"select-none",style:{display:k?"none":"block",...D}},m)]})]})}},49223:(a,b,c)=>{"use strict";c.d(b,{EI:()=>g,No:()=>e,R3:()=>h,_r:()=>f});let d={id:"mindos",name:"MindOS"};function e(a,b){let c=b??d;return{...a,agentId:c.id,agentName:c.name}}function f({sessionAgent:a,initialAgent:b}){return a??b??null}function g(a){return a.agentId&&a.agentName&&a.agentId!==d.id?{id:a.agentId,name:a.agentName}:null}function h(a,b){return{...a,defaultAcpAgent:b}}},49905:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{default:()=>i});var e=c(48249),f=c(19099),g=c(89119),h=a([g]);function i({fileTree:a,children:b}){let c=(0,f.usePathname)();return"/login"===c?(0,e.jsx)(e.Fragment,{children:b}):(0,e.jsx)(g.A,{fileTree:a,children:b})}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},51488:(a,b,c)=>{"use strict";c.r(b),c.d(b,{SummaryRenderer:()=>m});var d=c(48249),e=c(67484),f=c(69924),g=c(6079),h=c(80600),i=c(13576),j=c(33191);function k(a){let b=Date.now()-a,c=Math.floor(b/6e4),d=Math.floor(b/36e5),e=Math.floor(b/864e5);return c<1?"just now":c<60?`${c}m ago`:d<24?`${d}h ago`:`${e}d ago`}function l(a){return a.split("/").pop()?.replace(/\.(md|csv)$/,"")??a}function m({filePath:a}){let[b,c]=(0,e.useState)([]),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(!1),u=(0,e.useRef)(null),v=(0,e.useMemo)(()=>m.replace(/^### (.+)$/gm,'<h3 style="font-size:.8rem;font-weight:600;color:var(--muted-foreground);text-transform:uppercase;letter-spacing:.06em;margin:1em 0 .3em">$1</h3>').replace(/^## (.+)$/gm,'<h2 style="font-size:.9rem;font-weight:700;color:var(--foreground);margin:1.2em 0 .4em">$1</h2>').replace(/^# (.+)$/gm,'<h1 style="font-size:1rem;font-weight:700;color:var(--foreground);margin:1.2em 0 .4em">$1</h1>').replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,'<code class="font-display" style="font-size:.82em;padding:1px 5px;border-radius:4px;background:var(--muted)">$1</code>').replace(/^[-*] (.+)$/gm,'<li style="margin:.2em 0;padding-left:.3em">$1</li>').replace(/(<li[^>]*>.*<\/li>\n?)+/g,a=>`<ul style="margin:.4em 0;padding-left:1.4em;list-style:disc">${a}</ul>`).replace(/\n{2,}/g,'</p><p style="margin:.5em 0;font-size:.85rem;line-height:1.7;color:var(--foreground)">').replace(/^(?!<[hulo])(.+)$/gm,'<p style="margin:.5em 0;font-size:.85rem;line-height:1.7;color:var(--foreground)">$1</p>'),[m]);async function w(){if(0===b.length)return;u.current?.abort();let a=new AbortController;u.current=a,n(""),r(""),p(!0),t(!1);let c=b.map(a=>a.path),d=b.map(a=>`- **${l(a.path)}** (${a.path}, modified ${k(a.mtime)})`).join("\n"),e=`You are summarizing recent changes in a personal knowledge base (MindOS).
56
66
 
@@ -116,7 +126,24 @@ ${b.join("\n\n---\n\n")}`}if("ai-only"===b){let b=a.filter(a=>"assistant"===a.ro
116
126
 
117
127
  ${b.join("\n\n---\n\n")}`}return s(a,"full",c)}function t(a,b){let c="ai-only"===b?a.filter(a=>"assistant"===a.role):a,d=c.reduce((a,b)=>a+(0,r.Oo)(b.content).trim().length,0);return{msgCount:c.length,charCount:d}}function u({text:a}){let{t:b}=(0,n.Y)(),[c,f]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=(0,r.Oo)(a).trim();return i?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{ref:h,type:"button",onClick:a=>{a.stopPropagation(),f(a=>!a)},className:`p-1 rounded-md border transition-colors ${c?"border-[var(--amber)]/40 bg-[var(--amber)]/10 text-[var(--amber)]":"border-border/60 bg-card text-muted-foreground hover:text-[var(--amber)] shadow-sm"}`,title:b.ask?.saveToKB??"Save to knowledge base",children:(0,d.jsx)(g.A,{size:11})}),c&&(0,d.jsx)(v,{anchorRef:h,content:i,onClose:()=>f(!1)})]}):null}function v({anchorRef:a,content:b,onClose:c}){let{t:f}=(0,n.Y)(),g=f.ask,[h,i]=(0,e.useState)("select"),[j,k]=(0,e.useState)([]),l=[{role:"assistant",content:b}];return(0,d.jsxs)(y,{anchorRef:a,onClose:c,children:["select"===h&&(0,d.jsx)(w,{content:b,onSelect:i,onClose:c,ask:g}),"archive"===h&&(0,d.jsx)(z,{content:b,defaultFilenamePrefix:"insight",dirPaths:j,onClose:c,ask:g}),"digest"===h&&(0,d.jsx)(D,{messages:l,onClose:c,ask:g})]})}function w({content:a,onSelect:b,onClose:c,ask:e}){let f=a.length>1e3?`~${(a.length/1e3).toFixed(1)}k`:`${a.length}`;return(0,d.jsxs)("div",{className:"p-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(g.A,{size:11,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs font-semibold text-foreground",children:e?.saveToKBTitle??"Save to KB"}),(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground",children:["(",f," chars)"]})]}),(0,d.jsx)("button",{type:"button",onClick:c,className:"text-2xs text-muted-foreground hover:text-foreground",children:e?.cancelSave??"Cancel"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>b("archive"),className:"flex flex-col items-center gap-1 p-2.5 border border-[var(--amber)]/30 rounded-lg hover:border-[var(--amber)]/60 hover:shadow-sm active:scale-[0.98] transition-all",children:[(0,d.jsx)(g.A,{size:16,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-foreground",children:e?.saveDirectly??"Save directly"}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground text-center leading-tight",children:e?.saveDirectlyDesc??"Save as-is"})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>b("digest"),className:"flex flex-col items-center gap-1 p-2.5 border border-border rounded-lg hover:border-[var(--amber)]/50 hover:shadow-sm active:scale-[0.98] transition-all",children:[(0,d.jsx)(h.A,{size:16,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-foreground",children:e?.organizeToNote??"Organize to note"}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground text-center leading-tight",children:e?.organizeToNoteDesc??"AI organizes"})]})]})]})}function x({messages:a,disabled:b}){let{t:c}=(0,n.Y)(),[f,h]=(0,e.useState)(!1),i=(0,e.useRef)(null);return a.some(a=>"assistant"===a.role&&a.content.trim())?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{ref:i,type:"button",onClick:a=>{a.stopPropagation(),h(a=>!a)},disabled:b,className:`p-2 rounded-lg transition-colors ${f?"bg-[var(--amber)]/10 text-[var(--amber)]":"text-muted-foreground hover:text-foreground hover:bg-muted"} disabled:opacity-40`,title:c.ask?.saveSession??"Save session",children:(0,d.jsx)(g.A,{size:14})}),f&&(0,d.jsx)(A,{anchorRef:i,messages:a,onClose:()=>h(!1)})]}):null}function y({anchorRef:a,onClose:b,children:c}){let g=(0,e.useRef)(null),[h,i]=(0,e.useState)(null);return((0,e.useCallback)(()=>{if(!a.current)return;let b=a.current.getBoundingClientRect();i({top:b.bottom+6,right:Math.max(8,window.innerWidth-b.right)})},[a]),!h||"u"<typeof document)?null:(0,f.createPortal)((0,d.jsx)("div",{ref:g,className:"fixed z-50 rounded-xl border border-border bg-card shadow-lg animate-in fade-in-0 slide-in-from-top-1 duration-100",style:{top:h.top,right:h.right,width:300},children:c}),document.body)}function z({content:a,defaultFilenamePrefix:b,dirPaths:c,onClose:f,ask:h}){let l,m,n=new Date,r=`${b}-${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}.md`,[s,t]=(0,e.useState)(""),[u,v]=(0,e.useState)(r),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(""),C=(0,e.useRef)(null),D=(m=(l=u.trim()||r).endsWith(".md")?l:`${l}.md`,s?`${s}/${m}`:m),E=(0,e.useCallback)(async()=>{x(!0),B("");try{await (0,o.n)("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:D,op:"create_file",content:function(a,b=new Date){let c=b.getFullYear(),d=String(b.getMonth()+1).padStart(2,"0"),e=String(b.getDate()).padStart(2,"0");return`> Saved from MindOS Ask \xb7 ${c}-${d}-${e}
118
128
 
119
- ${a}`}(a),source:"user"})}),z(!0),p.oR.success(h?.savedToKB?.replace("{path}",D.split("/").pop())??"Saved"),setTimeout(f,1e3)}catch(a){B(a?.message?.includes("exist")?h?.fileExistsSwitch??"File exists":a?.message??"Failed")}finally{x(!1)}},[a,D,h,f]);return(0,d.jsxs)("div",{className:"p-3 space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(g.A,{size:11,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs font-semibold",children:h?.saveToKBTitle??"Save to KB"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-2xs text-muted-foreground mb-0.5 block",children:h?.targetFolder??"Folder"}),(0,d.jsx)(q.A,{dirPaths:c,value:s,onChange:t,rootLabel:"Root"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-2xs text-muted-foreground mb-0.5 block",children:h?.fileName??"Filename"}),(0,d.jsx)("input",{ref:C,type:"text",value:u,onChange:a=>v(a.target.value),onKeyDown:a=>{"Enter"===a.key&&E(),"Escape"===a.key&&f()},className:"w-full px-2 py-1 text-xs font-mono rounded-md border border-border bg-background text-foreground outline-none focus-visible:border-[var(--amber)]/50"})]}),(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground/60 font-mono truncate",children:D}),A&&(0,d.jsxs)("div",{className:"flex items-center gap-1 text-2xs text-error",children:[(0,d.jsx)(i.A,{size:10}),A]}),(0,d.jsxs)("div",{className:"flex justify-end gap-1.5 pt-1 border-t border-border/30",children:[(0,d.jsx)("button",{type:"button",onClick:f,className:"px-2 py-0.5 text-2xs rounded text-muted-foreground hover:bg-muted",children:h?.cancelSave??"Cancel"}),(0,d.jsxs)("button",{type:"button",onClick:E,disabled:w||y||!u.trim(),className:`flex items-center gap-1 px-2.5 py-0.5 text-2xs font-medium rounded transition-colors ${y?"bg-success/10 text-success":"bg-[var(--amber)] text-[var(--amber-foreground)]"} disabled:opacity-50`,children:[w&&(0,d.jsx)(j.A,{size:9,className:"animate-spin"}),y&&(0,d.jsx)(k.A,{size:9}),h?.confirmSave??"Save"]})]})]})}function A({anchorRef:a,messages:b,onClose:c}){let{t:f}=(0,n.Y)(),g=f.ask,[h,i]=(0,e.useState)("select"),[j,k]=(0,e.useState)([]);return(0,d.jsxs)(y,{anchorRef:a,onClose:c,children:["select"===h&&(0,d.jsx)(B,{messages:b,onSelect:i,onClose:c,ask:g}),"archive"===h&&(0,d.jsx)(C,{messages:b,dirPaths:j,onBack:()=>i("select"),onClose:c,ask:g}),"digest"===h&&(0,d.jsx)(D,{messages:b,onClose:c,ask:g})]})}function B({messages:a,onSelect:b,onClose:c,ask:e}){let f=t(a,"full");return(0,d.jsxs)("div",{className:"p-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(g.A,{size:11,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs font-semibold text-foreground",children:e?.saveSession??"Save Session"}),(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground",children:["(",f.msgCount,")"]})]}),(0,d.jsx)("button",{type:"button",onClick:c,className:"text-2xs text-muted-foreground hover:text-foreground",children:e?.cancelSave??"Cancel"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>b("archive"),className:"flex flex-col items-center gap-1 p-2.5 border border-[var(--amber)]/30 rounded-lg hover:border-[var(--amber)]/60 hover:shadow-sm active:scale-[0.98] transition-all",children:[(0,d.jsx)(g.A,{size:16,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-foreground",children:e?.saveDirectly??"Save directly"}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground text-center leading-tight",children:e?.saveDirectlyDesc??"Save as-is"})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>b("digest"),className:"flex flex-col items-center gap-1 p-2.5 border border-border rounded-lg hover:border-[var(--amber)]/50 hover:shadow-sm active:scale-[0.98] transition-all",children:[(0,d.jsx)(h.A,{size:16,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-foreground",children:e?.organizeToNote??"Organize to note"}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground text-center leading-tight",children:e?.organizeToNoteDesc??"AI extracts insights"})]})]})]})}function C({messages:a,dirPaths:b,onBack:c,onClose:f,ask:h}){let n,r,u=new Date,v=`session-${u.getFullYear()}-${String(u.getMonth()+1).padStart(2,"0")}-${String(u.getDate()).padStart(2,"0")}.md`,[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)(v),[A,B]=(0,e.useState)("full"),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(""),K=(0,e.useRef)(null),L=(r=(n=y.trim()||v).endsWith(".md")?n:`${n}.md`,w?`${w}/${r}`:r),M=t(a,A),N=(0,e.useCallback)(async()=>{F(!0),J("");try{await (0,o.n)("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:L,op:"create_file",content:s(a,A),source:"user"})}),H(!0),p.oR.success(h?.savedToKB?.replace("{path}",L.split("/").pop())??"Saved"),setTimeout(f,1e3)}catch(a){J(a?.message?.includes("exist")?h?.fileExistsSwitch??"File exists":a?.message??"Failed")}finally{F(!1)}},[a,A,L,h,f]),O=s(a,A).slice(0,300);return(0,d.jsxs)("div",{className:"p-3 space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("button",{type:"button",onClick:c,className:"text-muted-foreground hover:text-foreground",children:(0,d.jsx)(l.A,{size:11,className:"rotate-180"})}),(0,d.jsx)(g.A,{size:11,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs font-semibold",children:h?.saveDirectly??"Save directly"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-2xs text-muted-foreground mb-0.5 block",children:h?.targetFolder??"Folder"}),(0,d.jsx)(q.A,{dirPaths:b,value:w,onChange:x,rootLabel:"Root"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-2xs text-muted-foreground mb-0.5 block",children:h?.fileName??"Filename"}),(0,d.jsx)("input",{ref:K,type:"text",value:y,onChange:a=>z(a.target.value),onKeyDown:a=>{"Enter"===a.key&&N(),"Escape"===a.key&&f()},className:"w-full px-2 py-1 text-xs font-mono rounded-md border border-border bg-background text-foreground outline-none focus-visible:border-[var(--amber)]/50"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[["full","ai-only"].map(a=>(0,d.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,d.jsx)("input",{type:"radio",name:"fmt",checked:A===a,onChange:()=>B(a),className:"w-2.5 h-2.5 accent-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-2xs",children:"full"===a?h?.formatFull??"Full":h?.formatAiOnly??"AI only"})]},a)),(0,d.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[M.msgCount," msgs"]})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>D(a=>!a),className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",children:[C?(0,d.jsx)(m.A,{size:9}):(0,d.jsx)(l.A,{size:9})," Preview"]}),C&&(0,d.jsxs)("pre",{className:"px-2 py-1 text-[10px] text-muted-foreground bg-muted/30 rounded-md max-h-24 overflow-auto whitespace-pre-wrap font-mono",children:[O,O.length>=300?"...":""]}),(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground/60 font-mono truncate",children:L}),I&&(0,d.jsxs)("div",{className:"flex items-center gap-1 text-2xs text-error",children:[(0,d.jsx)(i.A,{size:10}),I]}),(0,d.jsxs)("div",{className:"flex justify-end gap-1.5 pt-1 border-t border-border/30",children:[(0,d.jsx)("button",{type:"button",onClick:f,className:"px-2 py-0.5 text-2xs rounded text-muted-foreground hover:bg-muted",children:h?.cancelSave??"Cancel"}),(0,d.jsxs)("button",{type:"button",onClick:N,disabled:E||G||!y.trim(),className:`flex items-center gap-1 px-2.5 py-0.5 text-2xs font-medium rounded transition-colors ${G?"bg-success/10 text-success":"bg-[var(--amber)] text-[var(--amber-foreground)]"} disabled:opacity-50`,children:[E&&(0,d.jsx)(j.A,{size:9,className:"animate-spin"}),G&&(0,d.jsx)(k.A,{size:9}),h?.confirmSave??"Save"]})]})]})}function D({messages:a,onClose:b,ask:c}){return(0,e.useCallback)(()=>{let d=s(a,"full");window.dispatchEvent(new CustomEvent("mindos:session-organize",{detail:{content:d,name:"conversation.md"}})),b(),p.oR.success(c?.organizing??"AI is organizing...")},[a,b,c]),null}},60442:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call CsvRenderer() from the server but CsvRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/csv/CsvRenderer.tsx","CsvRenderer")},60725:(a,b,c)=>{"use strict";function d(a,b,c){let d,e,f;if("stdio"===c){var g,h;let b={type:"stdio",command:"mindos",args:["mcp"]};if("toml"===a.format){let b=`[${a.configKey}.mindos]
129
+ ${a}`}(a),source:"user"})}),z(!0),p.oR.success(h?.savedToKB?.replace("{path}",D.split("/").pop())??"Saved"),setTimeout(f,1e3)}catch(a){B(a?.message?.includes("exist")?h?.fileExistsSwitch??"File exists":a?.message??"Failed")}finally{x(!1)}},[a,D,h,f]);return(0,d.jsxs)("div",{className:"p-3 space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(g.A,{size:11,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs font-semibold",children:h?.saveToKBTitle??"Save to KB"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-2xs text-muted-foreground mb-0.5 block",children:h?.targetFolder??"Folder"}),(0,d.jsx)(q.A,{dirPaths:c,value:s,onChange:t,rootLabel:"Root"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-2xs text-muted-foreground mb-0.5 block",children:h?.fileName??"Filename"}),(0,d.jsx)("input",{ref:C,type:"text",value:u,onChange:a=>v(a.target.value),onKeyDown:a=>{"Enter"===a.key&&E(),"Escape"===a.key&&f()},className:"w-full px-2 py-1 text-xs font-mono rounded-md border border-border bg-background text-foreground outline-none focus-visible:border-[var(--amber)]/50"})]}),(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground/60 font-mono truncate",children:D}),A&&(0,d.jsxs)("div",{className:"flex items-center gap-1 text-2xs text-error",children:[(0,d.jsx)(i.A,{size:10}),A]}),(0,d.jsxs)("div",{className:"flex justify-end gap-1.5 pt-1 border-t border-border/30",children:[(0,d.jsx)("button",{type:"button",onClick:f,className:"px-2 py-0.5 text-2xs rounded text-muted-foreground hover:bg-muted",children:h?.cancelSave??"Cancel"}),(0,d.jsxs)("button",{type:"button",onClick:E,disabled:w||y||!u.trim(),className:`flex items-center gap-1 px-2.5 py-0.5 text-2xs font-medium rounded transition-colors ${y?"bg-success/10 text-success":"bg-[var(--amber)] text-[var(--amber-foreground)]"} disabled:opacity-50`,children:[w&&(0,d.jsx)(j.A,{size:9,className:"animate-spin"}),y&&(0,d.jsx)(k.A,{size:9}),h?.confirmSave??"Save"]})]})]})}function A({anchorRef:a,messages:b,onClose:c}){let{t:f}=(0,n.Y)(),g=f.ask,[h,i]=(0,e.useState)("select"),[j,k]=(0,e.useState)([]);return(0,d.jsxs)(y,{anchorRef:a,onClose:c,children:["select"===h&&(0,d.jsx)(B,{messages:b,onSelect:i,onClose:c,ask:g}),"archive"===h&&(0,d.jsx)(C,{messages:b,dirPaths:j,onBack:()=>i("select"),onClose:c,ask:g}),"digest"===h&&(0,d.jsx)(D,{messages:b,onClose:c,ask:g})]})}function B({messages:a,onSelect:b,onClose:c,ask:e}){let f=t(a,"full");return(0,d.jsxs)("div",{className:"p-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(g.A,{size:11,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs font-semibold text-foreground",children:e?.saveSession??"Save Session"}),(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground",children:["(",f.msgCount,")"]})]}),(0,d.jsx)("button",{type:"button",onClick:c,className:"text-2xs text-muted-foreground hover:text-foreground",children:e?.cancelSave??"Cancel"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>b("archive"),className:"flex flex-col items-center gap-1 p-2.5 border border-[var(--amber)]/30 rounded-lg hover:border-[var(--amber)]/60 hover:shadow-sm active:scale-[0.98] transition-all",children:[(0,d.jsx)(g.A,{size:16,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-foreground",children:e?.saveDirectly??"Save directly"}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground text-center leading-tight",children:e?.saveDirectlyDesc??"Save as-is"})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>b("digest"),className:"flex flex-col items-center gap-1 p-2.5 border border-border rounded-lg hover:border-[var(--amber)]/50 hover:shadow-sm active:scale-[0.98] transition-all",children:[(0,d.jsx)(h.A,{size:16,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-foreground",children:e?.organizeToNote??"Organize to note"}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground text-center leading-tight",children:e?.organizeToNoteDesc??"AI extracts insights"})]})]})]})}function C({messages:a,dirPaths:b,onBack:c,onClose:f,ask:h}){let n,r,u=new Date,v=`session-${u.getFullYear()}-${String(u.getMonth()+1).padStart(2,"0")}-${String(u.getDate()).padStart(2,"0")}.md`,[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)(v),[A,B]=(0,e.useState)("full"),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(""),K=(0,e.useRef)(null),L=(r=(n=y.trim()||v).endsWith(".md")?n:`${n}.md`,w?`${w}/${r}`:r),M=t(a,A),N=(0,e.useCallback)(async()=>{F(!0),J("");try{await (0,o.n)("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:L,op:"create_file",content:s(a,A),source:"user"})}),H(!0),p.oR.success(h?.savedToKB?.replace("{path}",L.split("/").pop())??"Saved"),setTimeout(f,1e3)}catch(a){J(a?.message?.includes("exist")?h?.fileExistsSwitch??"File exists":a?.message??"Failed")}finally{F(!1)}},[a,A,L,h,f]),O=s(a,A).slice(0,300);return(0,d.jsxs)("div",{className:"p-3 space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("button",{type:"button",onClick:c,className:"text-muted-foreground hover:text-foreground",children:(0,d.jsx)(l.A,{size:11,className:"rotate-180"})}),(0,d.jsx)(g.A,{size:11,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs font-semibold",children:h?.saveDirectly??"Save directly"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-2xs text-muted-foreground mb-0.5 block",children:h?.targetFolder??"Folder"}),(0,d.jsx)(q.A,{dirPaths:b,value:w,onChange:x,rootLabel:"Root"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-2xs text-muted-foreground mb-0.5 block",children:h?.fileName??"Filename"}),(0,d.jsx)("input",{ref:K,type:"text",value:y,onChange:a=>z(a.target.value),onKeyDown:a=>{"Enter"===a.key&&N(),"Escape"===a.key&&f()},className:"w-full px-2 py-1 text-xs font-mono rounded-md border border-border bg-background text-foreground outline-none focus-visible:border-[var(--amber)]/50"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[["full","ai-only"].map(a=>(0,d.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,d.jsx)("input",{type:"radio",name:"fmt",checked:A===a,onChange:()=>B(a),className:"w-2.5 h-2.5 accent-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-2xs",children:"full"===a?h?.formatFull??"Full":h?.formatAiOnly??"AI only"})]},a)),(0,d.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[M.msgCount," msgs"]})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>D(a=>!a),className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",children:[C?(0,d.jsx)(m.A,{size:9}):(0,d.jsx)(l.A,{size:9})," Preview"]}),C&&(0,d.jsxs)("pre",{className:"px-2 py-1 text-[10px] text-muted-foreground bg-muted/30 rounded-md max-h-24 overflow-auto whitespace-pre-wrap font-mono",children:[O,O.length>=300?"...":""]}),(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground/60 font-mono truncate",children:L}),I&&(0,d.jsxs)("div",{className:"flex items-center gap-1 text-2xs text-error",children:[(0,d.jsx)(i.A,{size:10}),I]}),(0,d.jsxs)("div",{className:"flex justify-end gap-1.5 pt-1 border-t border-border/30",children:[(0,d.jsx)("button",{type:"button",onClick:f,className:"px-2 py-0.5 text-2xs rounded text-muted-foreground hover:bg-muted",children:h?.cancelSave??"Cancel"}),(0,d.jsxs)("button",{type:"button",onClick:N,disabled:E||G||!y.trim(),className:`flex items-center gap-1 px-2.5 py-0.5 text-2xs font-medium rounded transition-colors ${G?"bg-success/10 text-success":"bg-[var(--amber)] text-[var(--amber-foreground)]"} disabled:opacity-50`,children:[E&&(0,d.jsx)(j.A,{size:9,className:"animate-spin"}),G&&(0,d.jsx)(k.A,{size:9}),h?.confirmSave??"Save"]})]})]})}function D({messages:a,onClose:b,ask:c}){return(0,e.useCallback)(()=>{let d=s(a,"full");window.dispatchEvent(new CustomEvent("mindos:session-organize",{detail:{content:d,name:"conversation.md"}})),b(),p.oR.success(c?.organizing??"AI is organizing...")},[a,b,c]),null}},60407:(a,b,c)=>{"use strict";c.d(b,{Ay:()=>ad,Fo:()=>K,gL:()=>L});var d=c(48249),e=c(67484),f=c(19099),g=c(93491),h=c(33191),i=c(83654),j=c(80600),k=c(40560),l=c(44218),m=c(28330),n=c(86718),o=c(7309),p=c(65032),q=c(24703),r=c(16944),s=c(15273),t=c(12625),u=c(59347),v=c(99829);let w=(0,v.createServerReference)("60ab0d3c84bb6d698ee12971c21f6045efa7949932",v.callServer,void 0,v.findSourceMapURL,"createFileAction"),x=(0,v.createServerReference)("60ef4ff13bf21f7c2b6c815665780901527192c5d5",v.callServer,void 0,v.findSourceMapURL,"renameSpaceAction");var y=c(85445);let z=(0,v.createServerReference)("40de74449dd799a41abfbf2a739413ccee995921bd",v.callServer,void 0,v.findSourceMapURL,"deleteSpaceAction"),A=(0,v.createServerReference)("405d040a570ac543784d25876f1b836d8b94d24834",v.callServer,void 0,v.findSourceMapURL,"deleteFolderAction");var B=c(98840),C=c(79241),D=c(99101),E=c(47223),F=c(57056),G=c(29713);let H="show-hidden-files";function I(a){let b=b=>{b.key===H&&a()},c=()=>a();return window.addEventListener("storage",b),window.addEventListener("mindos:hidden-files-changed",c),()=>{window.removeEventListener("storage",b),window.removeEventListener("mindos:hidden-files-changed",c)}}function J(){return!1}function K(a){localStorage.setItem(H,String(a)),window.dispatchEvent(new Event("mindos:hidden-files-changed"))}function L(){return(0,e.useSyncExternalStore)(I,J,()=>!1)}var M=c(24520),N=c(37917),O=c(801);let P=(0,v.createServerReference)("401cf69cdaa8002e224ae0ca52c1eb18701e71a01b",v.callServer,void 0,v.findSourceMapURL,"convertToSpaceAction");var Q=c(95054);async function R(){try{let a=await (0,Q.n)("/api/settings"),b=a.ai?.provider??"",c=(a.ai?.providers??{})[b];return!!c?.apiKey}catch{return!1}}async function S(a){try{await navigator.clipboard.writeText(a)}catch{}}let T="w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",U="w-full flex items-center gap-2 px-3 py-2 text-sm text-error hover:bg-error/10 transition-colors text-left",V="my-1 border-t border-border/50";function W({x:a,y:b,onClose:c,menuHeight:f,children:g}){let h=(0,e.useRef)(null),i=Math.min(b,window.innerHeight-(f??160)),j=Math.min(a,window.innerWidth-200);return(0,d.jsx)("div",{ref:h,className:"fixed z-50 min-w-[180px] bg-card border border-border rounded-lg shadow-lg py-1",style:{top:i,left:j},children:g})}function X({x:a,y:b,node:c,onClose:e,onRename:g,onNewFile:i,onImport:j,onDelete:k}){let l=(0,f.useRouter)(),{t:m}=(0,E.Y)(),{isPinned:n,togglePin:o}=(0,G.Z)(),p=n(c.path);return(0,d.jsxs)(W,{x:a,y:b,onClose:e,children:[(0,d.jsxs)("button",{className:T,onClick:()=>{i(),e()},children:[(0,d.jsx)(M.A,{size:14,className:"shrink-0"})," ",m.fileTree.newFile]}),(0,d.jsxs)("button",{className:T,onClick:()=>{l.push(`/view/${(0,h.O0)(`${c.path}/INSTRUCTION.md`)}`),e()},children:[(0,d.jsx)(N.A,{size:14,className:"shrink-0"})," ",m.fileTree.viewRules]}),j&&(0,d.jsxs)("button",{className:T,onClick:()=>{j(c.path),e()},children:[(0,d.jsx)(O.A,{size:14,className:"shrink-0"})," ",m.fileTree.importFile]}),(0,d.jsx)("div",{className:V}),(0,d.jsxs)("button",{className:T,onClick:()=>{o(c.path),e()},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${p?"fill-[var(--amber)] text-[var(--amber)]":""}`}),p?m.fileTree.removeFromFavorites:m.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:T,onClick:()=>{S(c.path),e()},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",m.fileTree.copyPath]}),(0,d.jsxs)("button",{className:T,onClick:()=>{g(),e()},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",m.fileTree.renameSpace]}),(0,d.jsx)("div",{className:V}),(0,d.jsxs)("button",{className:U,onClick:()=>{e(),k()},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"}),m.fileTree.deleteSpace]})]})}function Y({x:a,y:b,node:c,onClose:g,onRename:h,onNewFile:i,onDelete:j}){let k=(0,f.useRouter)(),{t:l}=(0,E.Y)(),[m,o]=(0,e.useTransition)(),{isPinned:p,togglePin:q}=(0,G.Z)(),v=p(c.path);return(0,d.jsxs)(W,{x:a,y:b,onClose:g,menuHeight:220,children:[(0,d.jsxs)("button",{className:T,onClick:()=>{i(),g()},children:[(0,d.jsx)(M.A,{size:14,className:"shrink-0"})," ",l.fileTree.newFile]}),(0,d.jsx)("div",{className:V}),(0,d.jsxs)("button",{className:T,onClick:()=>{q(c.path),g()},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${v?"fill-[var(--amber)] text-[var(--amber)]":""}`}),v?l.fileTree.removeFromFavorites:l.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:T,disabled:m,onClick:()=>{o(async()=>{if((await P(c.path)).success){k.refresh(),window.dispatchEvent(new Event("mindos:files-changed"));let a=c.name.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||c.name;R().then(b=>{b&&function(a,b,c=""){let d="u">typeof document&&"zh"===document.documentElement.lang?`初始化新建的心智空间「${a}」,路径为「${b}/」。${c?`描述:「${c}」。`:""}两个文件均已存在模板,用 write_file 覆盖:
130
+ 1. 「${b}/README.md」— 写入空间用途、结构概览、使用指南
131
+ 2. 「${b}/INSTRUCTION.md」— 写入 AI Agent 在此空间中的行为规则和操作约定
132
+
133
+ 内容简洁实用,直接使用工具写入。`:`Initialize the new Mind Space "${a}" at "${b}/". ${c?`Description: "${c}". `:""}Both files already exist with templates — use write_file to overwrite:
134
+ 1. "${b}/README.md" — write purpose, structure overview, usage guidelines
135
+ 2. "${b}/INSTRUCTION.md" — write rules for AI agents operating in this space
136
+
137
+ Keep content concise and actionable. Write files directly using tools.`;window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spaceName:a,spacePath:b,description:c,state:"working"}})),fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:d}],currentFile:b+"/INSTRUCTION.md"})}).then(async a=>{if(!a.ok||!a.body)throw Error(`HTTP ${a.status}`);let c=a.body.getReader();try{for(;;){let{done:a}=await c.read();if(a)break}}finally{c.releaseLock()}window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:b,state:"done"}})),window.dispatchEvent(new Event("mindos:files-changed"))}).catch(()=>{window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:b,state:"error"}}))})}(a,c.path)})}g()})},children:[(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"})," ",l.fileTree.convertToSpace]}),(0,d.jsxs)("button",{className:T,onClick:()=>{S(c.path),g()},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",l.fileTree.copyPath]}),(0,d.jsxs)("button",{className:T,onClick:()=>{h(),g()},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",l.fileTree.rename]}),(0,d.jsx)("div",{className:V}),(0,d.jsxs)("button",{className:U,onClick:()=>{g(),j()},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"}),l.fileTree.deleteFolder]})]})}var Z=c(63710);function $(){window.dispatchEvent(new Event("mindos:files-changed"))}async function _(a){try{await navigator.clipboard.writeText(a)}catch{}}function aa({dirPath:a,depth:b,onDone:c}){let[g,i]=(0,e.useState)(""),[j,l]=(0,e.useTransition)(),[m,n]=(0,e.useState)(""),o=(0,f.useRouter)(),{t:p}=(0,E.Y)(),q=(0,e.useRef)(null),r=(0,e.useCallback)(()=>{let b=g.trim();b?l(async()=>{let d=await w(a,b);d.success&&d.filePath?(c(),o.push(`/view/${(0,h.O0)(d.filePath)}`),o.refresh(),$()):n(d.error||p.fileTree.failed)}):n(p.fileTree.enterFileName)},[g,a,c,o,p]);return(0,d.jsxs)("div",{ref:q,className:"px-2 pb-1",style:{paddingLeft:`${12*b+20}px`},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("input",{autoFocus:!0,type:"text",value:g,onChange:a=>{i(a.target.value),n("")},onKeyDown:a=>{"Enter"===a.key&&r(),"Escape"===a.key&&c()},placeholder:"filename.md",className:" flex-1 bg-muted border border-border rounded px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring "}),j?(0,d.jsx)(k.A,{size:13,className:"text-muted-foreground animate-spin shrink-0"}):(0,d.jsx)("button",{onClick:r,className:"text-xs text-[var(--amber)] hover:text-foreground shrink-0 px-1",children:p.fileTree.create})]}),m&&(0,d.jsx)("p",{className:"text-xs text-error mt-0.5 px-1",children:m})]})}function ab({node:a,depth:b,currentPath:c,onNavigate:i,maxOpenDepth:j,onImport:r}){let s=(0,f.useRouter)(),t=c.startsWith(a.path+"/")||c===a.path,u=!!a.isSpace,[v,w]=(0,e.useState)(0===b||t),[C,G]=(0,e.useState)(!1),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(a.name),[L,M]=(0,e.useTransition)(),N=(0,e.useRef)(null),O=(0,e.useRef)(null),[P,Q]=(0,e.useState)(null),{t:R}=(0,E.Y)(),[S,T]=(0,e.useState)(null),[U,V]=(0,e.useTransition)(),{isDragTarget:W,handleRowDragOver:_,handleRowDragEnter:ab,handleRowDragLeave:ac,handleRowDrop:ae}=function(a,b,c,d){let[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=(0,e.useRef)(null),j=(0,e.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),k=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy",i.current&&(clearTimeout(i.current),i.current=null),f||g(!0))},[f]),l=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation(),g(!0),j(),b||(h.current=setTimeout(()=>{c(!0),h.current=null},500)))},[b,j,c]);return{isDragTarget:f,handleRowDragOver:k,handleRowDragEnter:l,handleRowDragLeave:(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.stopPropagation(),i.current=setTimeout(()=>{g(!1),j(),i.current=null},50))},[j]),handleRowDrop:(0,e.useCallback)(b=>{b.preventDefault(),b.stopPropagation(),g(!1),j(),i.current&&(clearTimeout(i.current),i.current=null);let c=b.dataTransfer.files;c.length>0&&(0,Z.Nh)(Array.from(c),a.path,d)},[a.path,d,j])}}(a,v,w,R),af=(0,e.useCallback)(()=>w(a=>!a),[]);(0,e.useRef)(void 0);let ag=(0,e.useCallback)(b=>{b?.preventDefault(),b?.stopPropagation(),O.current&&(clearTimeout(O.current),O.current=null),K(a.name),I(!0),setTimeout(()=>N.current?.select(),0)},[a.name]),ah=(0,e.useCallback)(()=>{let b=J.trim();b&&b!==a.name?M(async()=>{let c=u?x:y.f,d=await c(a.path,b);d.success&&d.newPath?(I(!1),s.push(`/view/${(0,h.O0)(d.newPath)}`),s.refresh(),$()):I(!1)}):I(!1)},[J,a.name,a.path,s,u]),ai=(0,e.useCallback)(()=>{H||(O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{s.push(`/view/${(0,h.O0)(a.path)}`),i?.(),O.current=null},180))},[H,s,a.path,i]);(0,e.useCallback)(a=>{a.stopPropagation(),af()},[af]);let aj=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),Q({x:a.clientX,y:a.clientY})},[]),ak=u?function a(b){return"file"===b.type?+!g.C.has(b.name):(b.children??[]).reduce((b,c)=>b+a(c),0)}(a):0;if(H)return(0,d.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*b+8}px`},children:[(0,d.jsx)("input",{ref:N,autoFocus:!0,value:J,onChange:a=>K(a.target.value),onKeyDown:a=>{"Enter"===a.key&&ah(),"Escape"===a.key&&I(!1)},onBlur:ah,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),L&&(0,d.jsx)(k.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]});let al=u&&0===b;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:`relative group/dir flex items-center transition-colors duration-100 ${W?"bg-[var(--amber)]/10 rounded-md":""}`,onContextMenu:aj,onDragEnter:ab,onDragOver:_,onDragLeave:ac,onDrop:ae,children:[(0,d.jsx)("button",{onClick:af,className:"shrink-0 p-1 rounded hover:bg-muted text-muted-foreground transition-colors",style:{marginLeft:`${12*b+4}px`},"aria-label":v?`Collapse ${a.name}`:`Expand ${a.name}`,"aria-expanded":v,children:(0,d.jsx)("span",{className:"block transition-transform duration-150",style:{transform:v?"rotate(0deg)":"rotate(-90deg)"},children:(0,d.jsx)(l.A,{size:10})})}),(0,d.jsxs)("button",{type:"button",onClick:ai,draggable:!0,onDragStart:b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.setData("text/mindos-type","directory"),b.dataTransfer.effectAllowed="copy"},className:`
138
+ flex-1 flex items-center gap-1.5 px-1 py-1 rounded text-left min-w-0 pr-16
139
+ text-sm transition-colors duration-100
140
+ hover:bg-muted cursor-default
141
+ ${t?"text-foreground":"text-muted-foreground hover:text-foreground"}
142
+ `,children:[u?"Inbox"===a.name?(0,d.jsx)(m.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):v?(0,d.jsx)(o.A,{size:14,className:"text-yellow-400 shrink-0"}):(0,d.jsx)(p.A,{size:14,className:"text-yellow-400 shrink-0"}),(0,d.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:a.name}),u&&!v&&(0,d.jsx)("span",{className:"ml-auto text-xs text-muted-foreground shrink-0 tabular-nums pr-1",children:ak})]}),(0,d.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/dir:flex items-center gap-0.5 z-10",children:(0,d.jsx)("button",{type:"button",onClick:a=>{a.preventDefault(),a.stopPropagation();let b=a.currentTarget.getBoundingClientRect();Q({x:b.left,y:b.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,d.jsx)(q.A,{size:14})})})]}),(0,d.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${v?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,d.jsxs)("div",{className:`overflow-hidden ${al?"border-l-2 ml-[18px]":""}`,style:al?{borderColor:"color-mix(in srgb, var(--amber) 30%, transparent)"}:void 0,...!v&&{inert:!0},children:[a.children&&(0,d.jsx)(ad,{nodes:a.children,depth:al?1:b+1,onNavigate:i,maxOpenDepth:j,parentIsSpace:u,onImport:r}),C&&(0,d.jsx)(aa,{dirPath:a.path,depth:al?0:b,onDone:()=>G(!1)})]})}),P&&(u?(0,d.jsx)(X,{x:P.x,y:P.y,node:a,onClose:()=>Q(null),onRename:()=>ag(),onNewFile:()=>{w(!0),G(!0)},onImport:r,onDelete:()=>T("space")}):(0,d.jsx)(Y,{x:P.x,y:P.y,node:a,onClose:()=>Q(null),onRename:()=>ag(),onNewFile:()=>{w(!0),G(!0)},onDelete:()=>T("folder")})),(0,d.jsx)(F.TM,{open:null!==S,title:"space"===S?R.fileTree.deleteSpace:R.fileTree.deleteFolder,message:"space"===S?R.fileTree.confirmDeleteSpace(a.name):R.fileTree.confirmDeleteFolder(a.name),confirmLabel:"space"===S?R.fileTree.deleteSpace:R.fileTree.deleteFolder,cancelLabel:R.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>T(null),onConfirm:()=>{T(null),V(async()=>{let b="space"===S?await z(a.path):await A(a.path);if(b.success&&b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;D.oR.undo(`${R.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,B.Y)(c);a.success?(s.refresh(),$()):D.oR.error(a.error??"Undo failed")},{label:R.trash?.undo??"Undo"}),s.push("/"),s.refresh(),$()}})}})]})}function ac({node:a,depth:b,currentPath:c,onNavigate:l}){let m=(0,f.useRouter)(),n=c===a.path,[o,p]=(0,e.useState)(!1),[v,w]=(0,e.useState)(a.name),[x,z]=(0,e.useTransition)(),[,A]=(0,e.useTransition)(),H=(0,e.useRef)(null),{t:I}=(0,E.Y)(),{isPinned:J,togglePin:K}=(0,G.Z)(),L=J(a.path),M=!a.path.includes("/")&&g.A.has(a.name),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(null),R=(0,e.useCallback)(()=>{o||(m.push(`/view/${(0,h.O0)(a.path)}`),l?.())},[m,a.path,l,o]),S=(0,e.useCallback)(b=>{b.stopPropagation(),w(a.name),p(!0),setTimeout(()=>H.current?.select(),0)},[a.name]),X=(0,e.useCallback)(()=>{let b=v.trim();b&&b!==a.name?z(async()=>{let c=await (0,y.f)(a.path,b);c.success&&c.newPath?(p(!1),m.push(`/view/${(0,h.O0)(c.newPath)}`),m.refresh(),$()):p(!1)}):p(!1)},[v,a.name,a.path,m]),Y=(0,e.useCallback)(a=>{a.stopPropagation(),O(!0)},[]),Z=(0,e.useCallback)(b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.effectAllowed="copy"},[a.path]),aa=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),Q({x:a.clientX,y:a.clientY})},[]);return o?(0,d.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*b+8}px`},children:[(0,d.jsx)("input",{ref:H,autoFocus:!0,value:v,onChange:a=>w(a.target.value),onKeyDown:a=>{"Enter"===a.key&&X(),"Escape"===a.key&&p(!1)},onBlur:X,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),x&&(0,d.jsx)(k.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]}):(0,d.jsxs)("div",{className:"relative group/file",children:[(0,d.jsxs)("button",{onClick:R,onContextMenu:aa,draggable:!0,onDragStart:Z,"data-filepath":a.path,className:`
143
+ w-full flex items-center gap-1.5 px-2 py-1 rounded text-left
144
+ text-sm transition-colors duration-100 cursor-default pr-16
145
+ ${n?"bg-accent text-foreground":"hover:bg-muted text-muted-foreground hover:text-foreground"}
146
+ `,style:{paddingLeft:`${12*b+8}px`},children:["directory"===a.type?null:".csv"===a.extension?(0,d.jsx)(i.A,{size:14,className:"text-success shrink-0"}):(0,d.jsx)(j.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:a.name}),L&&(0,d.jsx)(r.A,{size:10,className:"shrink-0 fill-[var(--amber)] text-[var(--amber)] opacity-60"})]}),(0,d.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/file:flex items-center gap-0.5",children:(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation();let b=a.currentTarget.getBoundingClientRect();Q({x:b.left,y:b.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,d.jsx)(q.A,{size:14})})}),P&&(0,d.jsxs)(W,{x:P.x,y:P.y,onClose:()=>Q(null),menuHeight:140,children:[(0,d.jsxs)("button",{className:T,onClick:()=>{_(a.path),Q(null)},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",I.fileTree.copyPath]}),(0,d.jsxs)("button",{className:T,onClick:()=>{K(a.path),Q(null)},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${L?"fill-[var(--amber)] text-[var(--amber)]":""}`}),L?I.fileTree.removeFromFavorites:I.fileTree.pinToFavorites]}),!M&&(0,d.jsxs)("button",{className:T,onClick:a=>{Q(null),S(a)},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",I.fileTree.rename]}),!M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:V}),(0,d.jsxs)("button",{className:U,onClick:a=>{Q(null),Y(a)},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"})," ",I.fileTree.delete]})]})]}),(0,d.jsx)(F.TM,{open:N,title:I.fileTree.delete,message:I.fileTree.confirmDelete(a.name),confirmLabel:I.fileTree.delete,cancelLabel:I.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>O(!1),onConfirm:()=>{O(!1),A(async()=>{let b=await (0,C.i)(a.path);if(b.success){if(b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;D.oR.undo(`${I.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,B.Y)(c);a.success?(m.refresh(),$()):D.oR.error(a.error??"Undo failed")},{label:I.trash?.undo??"Undo"})}m.refresh(),$()}})}})]})}function ad({nodes:a,depth:b=0,onNavigate:c,maxOpenDepth:e,parentIsSpace:h,onImport:i}){var j;let k,l=(k="/view/",(j=(0,f.usePathname)()).startsWith(k)?j.slice(k.length).split("/").map(decodeURIComponent).join("/"):""),m=L(),n=0===b,o=m?a:a.filter(a=>!(n&&a.name.startsWith(".")||"file"===a.type&&g.C.has(a.name)||"directory"===a.type&&a.name.startsWith("."))),p=n?o.filter(a=>"directory"!==a.type||"Inbox"!==a.name):o;return(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:p.map(a=>"directory"===a.type?(0,d.jsx)(ab,{node:a,depth:b,currentPath:l,onNavigate:c,maxOpenDepth:e,onImport:i},a.path):(0,d.jsx)(ac,{node:a,depth:b,currentPath:l,onNavigate:c},a.path))})}},60442:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call CsvRenderer() from the server but CsvRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/csv/CsvRenderer.tsx","CsvRenderer")},60725:(a,b,c)=>{"use strict";function d(a,b,c){let d,e,f;if("stdio"===c){var g,h;let b={type:"stdio",command:"mindos",args:["mcp"]};if("toml"===a.format){let b=`[${a.configKey}.mindos]
120
147
  command = "mindos"
121
148
  args = ["mcp"]
122
149
 
@@ -126,11 +153,11 @@ MCP_TRANSPORT = "stdio"`;return{snippet:b,displaySnippet:b,path:a.globalPath}}if
126
153
  flex-col bg-background border-l border-border/40 shadow-[-4px_0_16px_rgba(0,0,0,0.04)]
127
154
  ${y?"":"transition-[width,transform] duration-200 ease-out"}
128
155
  ${a?"translate-x-0":"translate-x-full pointer-events-none"}
129
- `,style:{width:E,minWidth:`${o}px`},role:"complementary","aria-label":"MindOS panel",children:[(0,e.jsx)(i.default,{fallback:(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 px-6 text-center",children:[(0,e.jsx)(g.A,{size:20,className:"text-muted-foreground"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"MindOS encountered an error."}),(0,e.jsx)("button",{onClick:()=>window.location.reload(),className:"text-xs px-3 py-1.5 rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Reload page"})]}),children:(0,e.jsx)("div",{className:"flex min-h-0 w-full flex-1 flex-col overflow-hidden",children:(0,e.jsx)(h.A,{visible:a,variant:"panel",currentFile:a?c:void 0,initialMessage:d,initialAcpAgent:k,onFirstMessage:l,onClose:b,askMode:r,onModeSwitch:s,maximized:t,onMaximize:u})})}),(0,e.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:D,children:(0,e.jsx)("div",{className:"absolute left-[2px] top-0 w-[1px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/50 transition-opacity duration-150"})})]})}d()}catch(a){d(a)}})},63112:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ConfigRenderer() from the server but ConfigRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/config/ConfigRenderer.tsx","ConfigRenderer")},63710:(a,b,c)=>{"use strict";c.d(b,{Aw:()=>i,Nh:()=>k,QL:()=>f,TM:()=>g,h0:()=>h,lL:()=>j});var d=c(99101);function e(a){let b=new Uint8Array(a),c=[];for(let a=0;a<b.length;a+=8192)c.push(String.fromCharCode(...b.subarray(a,a+8192)));return btoa(c.join(""))}async function f(a,b){let c=[],f=0;for(let b of a){if(b.size>0xa00000){f++;continue}try{if(b.name.toLowerCase().endsWith(".pdf")){let a=await b.arrayBuffer();c.push({name:b.name,content:e(a),encoding:"base64"})}else{let a=await b.text();c.push({name:b.name,content:a})}}catch{}}if(0===c.length)return void(f>0?d.oR.error(b.inbox.tooLarge(f),4e3):a.length>0&&d.oR.error(b.inbox.saveFailed,4e3));try{var g;let a=await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:c})});if(!a.ok){let c=await a.json().catch(()=>({}));console.error("[QuickDrop] Save failed:",c.error),d.oR.error(b.inbox.saveFailed,4e3);return}let e=await a.json(),h=e.saved?.length??0,i=e.skipped?.length??0;g=f,h>0&&g>0&&0===i?d.oR.success(b.inbox.savedWithOversized(h,g),4e3):h>0&&i+g>0?d.oR.success(b.inbox.savedWithSkipped(h,i+g),4e3):h>0?d.oR.success(b.inbox.savedToast(h),3e3):(g>0&&d.oR.error(b.inbox.tooLarge(g),4e3),i>0&&d.oR.error(b.inbox.savedWithSkipped(0,i),4e3),0===g&&0===i&&d.oR.error(b.inbox.saveFailed,4e3)),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated"))}catch(a){console.error("[QuickDrop] Network error:",a),d.oR.error(b.inbox.saveFailed,4e3)}}async function g(a,b){try{let c=await fetch("/api/inbox/clip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:a})}),e=await c.json();if(!c.ok){let a=e.error||b.inbox.clipFailed;return d.oR.error(a,4e3),{ok:!1}}return d.oR.success(b.inbox.clipSuccess(e.title||a),3e3),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated")),{ok:!0,title:e.title}}catch(a){return console.error("[ClipURL] Network error:",a),d.oR.error(b.inbox.clipFailed,4e3),{ok:!1}}}function h(a){let b=a.trim();if(!b.startsWith("http://")&&!b.startsWith("https://"))return!1;try{return new URL(b),!0}catch{return!1}}function i(a){if(a.dataTransfer?.files&&a.dataTransfer.files.length>0)return null;let b=a.dataTransfer?.getData("text/uri-list");if(b){let a=b.split(/[\r\n]+/).find(a=>!a.startsWith("#")&&a.trim().length>0);if(a&&h(a))return a.trim()}let c=a.dataTransfer?.getData("text/plain");return c&&h(c)?c.trim():null}function j(a){let b=a.dataTransfer?.types??[];return!b.includes("Files")&&(b.includes("text/uri-list")||b.includes("text/plain"))}async function k(a,b,c){let f=[],g=0,h=new Set(["pdf","png","jpg","jpeg","gif","webp","bmp","ico","mp3","wav","m4a","ogg","flac","aac","mp4","webm","mov","mkv"]);for(let b of a){if(b.size>0xa00000){g++;continue}try{let a=(b.name.split(".").pop()??"").toLowerCase();if(h.has(a)){let a=await b.arrayBuffer();f.push({name:b.name,content:e(a),encoding:"base64"})}else{let a=await b.text();f.push({name:b.name,content:a})}}catch{}}if(0===f.length)return void(g>0?d.oR.error(c.inbox.tooLarge(g),4e3):a.length>0&&d.oR.error(c.inbox.saveFailed,4e3));let i=b.split("/").pop()||b;try{let a=await fetch("/api/file/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:f,targetSpace:b,organize:!1,conflict:"rename"})});if(!a.ok){let b=await a.json().catch(()=>({}));console.error("[TreeDrop] Save failed:",b.error),d.oR.error(c.inbox.saveFailed,4e3);return}let e=await a.json(),h=e.created?.length??0,j=e.skipped?.length??0;h>0&&j+g>0?d.oR.success(c.inbox.savedWithSkipped(h,j+g),4e3):h>0?d.oR.success(c.inbox.savedToDir(h,i),3e3):(g>0&&d.oR.error(c.inbox.tooLarge(g),4e3),j>0&&d.oR.error(c.inbox.savedWithSkipped(0,j),4e3)),window.dispatchEvent(new Event("mindos:files-changed"))}catch(a){console.error("[TreeDrop] Network error:",a),d.oR.error(c.inbox.saveFailed,4e3)}}},63956:(a,b,c)=>{"use strict";c.r(b),c.d(b,{VideoRenderer:()=>f});var d=c(48249),e=c(67484);function f({filePath:a}){let b=`/api/file/raw?path=${encodeURIComponent(a)}`,c=a.split("/").pop()??"video",f=c.split(".").pop()?.toLowerCase()??"",[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(0),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),o=(0,e.useRef)(null),p=(0,e.useCallback)(()=>{let a=o.current;a&&n({w:a.videoWidth,h:a.videoHeight})},[]),q=(0,e.useCallback)(()=>{h(!1),j(a=>a+1)},[]);return(0,d.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[m&&(0,d.jsxs)("span",{children:[m.w," x ",m.h]}),null!==k&&(0,d.jsx)("span",{children:k<1024?`${k} B`:k<1048576?`${(k/1024).toFixed(1)} KB`:`${(k/1048576).toFixed(1)} MB`}),(0,d.jsx)("span",{className:"uppercase opacity-60",children:f})]}),(0,d.jsx)("div",{className:"flex-1 min-h-[50vh] flex items-center justify-center bg-black rounded-b-lg overflow-hidden",children:g?(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-neutral-400",children:"Failed to load video"}),(0,d.jsx)("button",{onClick:q,className:"text-xs px-3 py-1.5 rounded-md bg-neutral-800 hover:bg-neutral-700 text-neutral-200 transition-colors",children:"Retry"})]}):(0,d.jsx)("video",{ref:o,controls:!0,preload:"metadata",className:"max-w-full max-h-[70vh]",onLoadedMetadata:p,onError:()=>h(!0),children:(0,d.jsx)("source",{src:b})},i)})]})}},65141:(a,b,c)=>{"use strict";c.d(b,{b:()=>g});var d=c(67484),e=c(97916),f=c(4615);function g(){let[a,b]=(0,d.useState)("files"),[c,g]=(0,d.useState)(null),[h,i]=(0,d.useState)(!1),[j,k]=(0,d.useState)(!1),l=(0,d.useCallback)(a=>g(a),[]),m=(0,d.useCallback)(a=>{try{localStorage.setItem("left-panel-width",String(a))}catch{}},[]),n=(0,d.useCallback)(()=>i(a=>!a),[]),o=(0,d.useCallback)(a=>{k(a);try{localStorage.setItem("rail-expanded",String(a))}catch{}},[]),p=j?f.we:f.SG,q=c??(a?e.iP[a]:280);return{activePanel:a,setActivePanel:b,panelWidth:c,panelMaximized:h,railExpanded:j,railWidth:p,panelOpen:null!==a,effectivePanelWidth:q,handlePanelWidthChange:l,handlePanelWidthCommit:m,handlePanelMaximize:n,handleExpandedChange:o}}},65965:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>H});var e=c(48249),f=c(67484),g=c(74429),h=c(24520),i=c(80600),j=c(33407),k=c(46674),l=c(51161),m=c(74118),n=c(47223),o=c(38957),p=c(54461),q=c(41297),r=c(45108),s=c(15330),t=c(55232),u=c(74356),v=c(6597),w=c(82110),x=c(42529),y=c(41739),z=c(33827),A=c(74190),B=c(4452),C=c(93574),D=c(49223),E=c(33191),F=c(17009),G=a([B]);function H({visible:a,currentFile:b,initialMessage:c,initialAcpAgent:d,onFirstMessage:G,variant:H,onClose:I,maximized:J,onMaximize:K,askMode:L,onModeSwitch:M,onDockToPanel:N}){let O="panel"===H,P="home"===H,Q=(0,f.useRef)(null),R=(0,f.useRef)(null),{t:S}=(0,n.Y)(),[T,U]=(0,f.useState)(!1),[V,W]=(0,f.useState)(""),X=(0,f.useRef)("");X.current=V;let[Y,Z]=(0,f.useState)([]),$=(0,f.useRef)(Y);$.current=Y;let[_,aa]=(0,f.useState)(!1),[ab,ac]=(0,f.useState)(!1),[ad,ae]=(0,f.useState)(!1),af=(0,f.useRef)(null),ag=(0,f.useRef)(null),[ah,ai]=(0,f.useState)(null),[aj,ak]=(0,f.useState)(null),al=(0,f.useRef)(aj);al.current=aj;let[am,an]=(0,f.useState)(null),ao=(0,f.useRef)(am),ap=(0,f.useRef)(null);ao.current=am;let[aq,ar]=(0,f.useState)("agent"),[as,at]=(0,f.useState)(null),[au,av]=(0,f.useState)(null),aw=(0,p.X)(b),ax=(0,f.useRef)(aw);ax.current=aw;let ay=(0,f.useMemo)(()=>({unsupportedType:S.fileImport?.unsupported}),[S]),az=(0,q.l)(ay),aA=(0,f.useRef)(az);aA.current=az;let aB=(0,r.u)(),aC=(0,s.Q)(),aD=(0,t.C)(),aE=(0,F.z)(),aF=(0,f.useRef)(aB);aF.current=aB;let aG=(0,f.useRef)(aC);aG.current=aC;let aH=(0,f.useRef)(aD);aH.current=aD;let aI=(0,f.useCallback)(()=>{W(""),ak(null),Z(b?[b]:[]),aA.current.clearAttachments()},[b]),aJ=(0,f.useCallback)(a=>{W(a.content),a.images&&a.images.length>0&&aF.current.clearImages(),a.attachedFiles&&Z(a.attachedFiles),a.skillName&&aH.current.resetSlash(),an((0,D.EI)(a)),setTimeout(()=>Q.current?.focus(),50)},[]),aK=(0,f.useRef)({inputValueRef:X,mentionRef:aG,slashRef:aH,imageUploadRef:aF,sessionRef:ax,uploadRef:aA,selectedSkillRef:al,selectedAcpAgentRef:ao,attachedFilesRef:$}),aL=(0,C.t)({currentFile:b,chatMode:aq,providerOverride:as,modelOverride:au,onFirstMessage:G,refs:aK.current,errorLabels:{noResponse:S.ask.errorNoResponse,stopped:S.ask.stopped},resetInputState:aI,onRestoreInput:aJ}),{isLoading:aM,loadingPhase:aN,reconnectAttempt:aO,reconnectMaxRef:aP}=aL,aQ=aL.submit,aR=aL.stop,aS=(0,f.useCallback)(a=>{an(a),aw.setSessionDefaultAcpAgent(a)},[aw]),aT=az.localAttachments.some(a=>"loading"===a.status),aU=az.uploadError||aB.imageError||(aT?S.ask.uploadsProcessing??"Wait for uploaded files to finish processing before sending.":"");(0,f.useRef)(!1),(0,f.useRef)(b),(0,f.useRef)(aw.clearPersistTimer).current=aw.clearPersistTimer;let aV=(0,f.useRef)(null),aW=(0,f.useRef)(null),aX=(0,f.useRef)(null),aY=(0,f.useCallback)((a,b)=>{W(a);let c=b??a.length;aW.current&&clearTimeout(aW.current),aX.current&&clearTimeout(aX.current),aW.current=setTimeout(()=>aG.current.updateMentionFromInput(a,c),80),aX.current=setTimeout(()=>aH.current.updateSlashFromInput(a,c),80)},[]),aZ=(0,f.useCallback)(a=>{let b=Q.current,c=X.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("@"),f=c.slice(0,e)+c.slice(d);W(f),aG.current.resetMention(),$.current.includes(a)||Z(b=>[...b,a]),setTimeout(()=>{Q.current?.focus(),Q.current?.setSelectionRange(e,e)},0)},[]),a$=(0,f.useCallback)(a=>{let b=Q.current,c=X.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("/"),f=c.slice(0,e)+c.slice(d);W(f),ak(a),aH.current.resetSlash(),setTimeout(()=>{Q.current?.focus(),Q.current?.setSelectionRange(e,e)},0)},[]),a_=(0,f.useRef)(aZ);a_.current=aZ;let a0=(0,f.useRef)(a$);a0.current=a$;let a1=(0,f.useCallback)(a=>{let b=aG.current,c=aH.current;if(null!==b.mentionQuery){if("Escape"===a.key){a.preventDefault(),b.resetMention();return}if("ArrowDown"===a.key)a.preventDefault(),b.navigateMention("down");else if("ArrowUp"===a.key)a.preventDefault(),b.navigateMention("up");else if("Enter"===a.key||"Tab"===a.key){if("Enter"===a.key&&(a.shiftKey||a.nativeEvent.isComposing))return;b.mentionResults.length>0&&(a.preventDefault(),a_.current(b.mentionResults[b.mentionIndex]))}return}if(null!==c.slashQuery){if("Escape"===a.key){a.preventDefault(),c.resetSlash();return}if("ArrowDown"===a.key)a.preventDefault(),c.navigateSlash("down");else if("ArrowUp"===a.key)a.preventDefault(),c.navigateSlash("up");else if("Enter"===a.key||"Tab"===a.key){if("Enter"===a.key&&(a.shiftKey||a.nativeEvent.isComposing))return;c.slashResults.length>0&&(a.preventDefault(),a0.current(c.slashResults[c.slashIndex]))}return}"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&!aL.isLoadingRef.current&&(X.current.trim()||aF.current.images.length>0)&&(a.preventDefault(),a.currentTarget.form?.requestSubmit())},[]),a2=(0,f.useCallback)(()=>{aL.isLoadingRef.current||(ax.current.resetSession(),W(""),Z(b?[b]:[]),aA.current.clearAttachments(),aF.current.clearImages(),aG.current.resetMention(),aH.current.resetSlash(),ak(null),an(null),ap.current=null,aa(!1),aL.firstMessageFired.current=!1,setTimeout(()=>Q.current?.focus(),0))},[b]),a3=(0,f.useCallback)(a=>{(a.dataTransfer.types.includes("text/mindos-path")||a.dataTransfer.types.includes("Files"))&&(a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy",ac(!0))},[]),a4=(0,f.useCallback)(()=>ac(!1),[]),a5=(0,f.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),ac(!1);let b=a.dataTransfer.getData("text/mindos-path");if(b){let c=a.dataTransfer.getData("text/mindos-type"),d="directory"===c?b.replace(/\/?$/,"/"):b;$.current.includes(d)||Z(a=>[...a,d]);return}let c=a.dataTransfer.files;if(c.length>0){let b=Array.from(c).some(a=>a.type.startsWith("image/")),d=Array.from(c).filter(a=>!a.type.startsWith("image/"));(async()=>{try{if(b&&await aF.current.handleDrop(a),d.length>0){let a=new DataTransfer;d.forEach(b=>a.items.add(b)),await aA.current.pickFiles(a.files)}}catch(a){console.warn("[AskContent] Drop file processing failed:",a)}})()}},[]),a6=(0,f.useCallback)(a=>{let b=a.clipboardData?.items;!b||Array.from(b).some(a=>"file"===a.kind&&a.type.startsWith("image/"))&&(a.preventDefault(),aF.current.handlePaste(a))},[]),a7=(0,f.useCallback)(a=>{if(aL.isLoadingRef.current)return;let c=aw.sessions.find(b=>b.id===a)??null;ax.current.loadSession(a),aa(!1),W(""),Z(b?[b]:[]),aA.current.clearAttachments(),aF.current.clearImages(),aG.current.resetMention(),aH.current.resetSlash(),ak(null),an(c?.defaultAcpAgent??null),setTimeout(()=>Q.current?.focus(),0)},[b,aw.sessions]),a8=(0,f.useCallback)(()=>aa(a=>!a),[]),a9=(0,f.useMemo)(()=>({connecting:S.ask.connecting,thinking:S.ask.thinking,generating:S.ask.generating,reconnecting:aO>0?S.ask.reconnecting(aO,aP.current):void 0,copyMessage:S.ask.copyMessage}),[S,aO]),ba=(0,f.useCallback)(a=>{at(a),av(null)},[]);return(0,e.jsxs)("div",{className:"flex min-h-0 w-full flex-col h-full",children:[(0,e.jsx)(y.A,{isPanel:O||P,showHistory:_,onToggleHistory:a8,onReset:a2,isLoading:aM,maximized:J,onMaximize:K,askMode:P?void 0:L,onModeSwitch:P?void 0:M,onClose:P?void 0:I,onDockToPanel:J?N:void 0,sessions:aw.sessions,activeSessionId:aw.activeSessionId,onLoadSession:a7,onDeleteSession:aw.deleteSession,onRenameSession:aw.renameSession,onTogglePinSession:aw.togglePinSession,messages:aw.messages}),_&&(0,e.jsx)(x.A,{sessions:aw.sessions,activeSessionId:aw.activeSessionId,onLoad:a7,onDelete:aw.deleteSession,onRename:aw.renameSession,onTogglePin:aw.togglePinSession,onClearAll:aw.clearAllSessions,onClose:()=>aa(!1),onNewChat:a2}),!_&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col",children:[!P&&(0,e.jsx)(u.A,{messages:aw.messages,isLoading:aM,loadingPhase:aN,emptyPrompt:S.ask.emptyPrompt,emptyHint:S.ask.emptyHint,suggestions:S.ask.suggestions,onSuggestionClick:W,labels:a9}),P&&(aw.messages.length>0||J)&&(0,e.jsx)(u.A,{messages:aw.messages,isLoading:aM,loadingPhase:aN,emptyPrompt:S.ask.emptyPrompt,emptyHint:S.ask.emptyHint,suggestions:J&&0===aw.messages.length?S.ask.suggestions:[],onSuggestionClick:W,labels:a9})]}),null!==aC.mentionQuery&&aC.mentionResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(v.A,{results:aC.mentionResults,selectedIndex:aC.mentionIndex,query:aC.mentionQuery??void 0,onSelect:aZ})}),null!==aD.slashQuery&&aD.slashResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(w.A,{results:aD.slashResults,selectedIndex:aD.slashIndex,query:aD.slashQuery??void 0,onSelect:a$})}),(0,e.jsx)("div",{className:(0,E.cn)("shrink-0",P?"px-2 pb-2 pt-0.5":"px-3 pb-2.5 pt-1"),children:(0,e.jsxs)("div",{className:(0,E.cn)("rounded-xl bg-muted/40 transition-all focus-within:bg-muted/60",ab&&"ring-2 ring-[var(--amber)] bg-[var(--amber-dim)]"),onDragOver:a3,onDragLeave:a4,onDrop:a5,children:[(Y.length>0||az.localAttachments.length>0||aB.images.length>0||aj||am||az.uploadError||aB.imageError)&&(0,e.jsxs)("div",{className:(0,E.cn)("px-3 pt-2.5 pb-1",O?"max-h-24 overflow-y-auto":"max-h-28 overflow-y-auto"),children:[(0,e.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[Y.map(a=>(0,e.jsx)(z.A,{path:a,variant:"kb",onRemove:()=>Z(b=>b.filter(b=>b!==a))},a)),az.localAttachments.map((a,b)=>(0,e.jsx)(z.A,{path:a.name,variant:"upload",status:a.status,error:a.error,truncatedInfo:a.truncatedInfo,onRemove:()=>az.removeAttachment(b)},`up-${a.name}-${b}`)),aB.images.map((a,b)=>(0,e.jsx)(z.A,{path:a.fileName||`Image ${b+1}`,variant:"image",imageData:a.data,imageMime:a.mimeType,onRemove:()=>aB.removeImage(b)},`img-${b}`)),aj&&(0,e.jsx)(z.A,{path:aj.name,variant:"skill",onRemove:()=>{ak(null),Q.current?.focus()}}),am&&(0,e.jsx)(z.A,{path:"object"==typeof am&&"name"in am?am.name:"Remote Agent",variant:"agent",onRemove:()=>{aS(null),Q.current?.focus()}})]}),aU&&(0,e.jsx)("div",{className:"mt-1 text-xs text-error",children:aU})]}),(0,e.jsxs)("form",{ref:aV,onSubmit:aQ,className:(0,E.cn)("flex items-end gap-1.5",P?"px-2 py-1.5":"px-3 py-2"),children:[(0,e.jsx)("div",{className:"relative shrink-0",children:(0,e.jsx)("button",{ref:af,type:"button",onClick:()=>ae(a=>!a),className:"p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:S.hints.attachFile,children:(0,e.jsx)(h.A,{size:15})})}),T&&ad&&ah&&(0,g.createPortal)((0,e.jsxs)("div",{ref:ag,className:"fixed py-1 rounded-xl border border-border/60 bg-card shadow-lg z-50 min-w-[150px] animate-in fade-in-0 slide-in-from-bottom-2 duration-150",style:{top:`${ah.top}px`,left:`${ah.left}px`,transform:"translateY(-100%)"},onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",onClick:()=>{az.uploadInputRef.current?.click(),ae(!1)},children:[(0,e.jsx)(i.A,{size:12,className:"shrink-0 text-muted-foreground"}),S.ask.attachFileLabel]}),(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",onClick:()=>{R.current?.click(),ae(!1)},children:[(0,e.jsx)(j.A,{size:12,className:"shrink-0 text-muted-foreground"}),S.ask.attachImageLabel]})]}),document.body),(0,e.jsx)("input",{ref:az.uploadInputRef,type:"file",className:"hidden",multiple:!0,accept:".txt,.md,.markdown,.csv,.json,.yaml,.yml,.xml,.html,.htm,.pdf,text/plain,text/markdown,text/csv,application/json,application/pdf",onChange:async a=>{let b=a.currentTarget;await az.pickFiles(b.files),b.value=""}}),(0,e.jsx)("input",{ref:R,type:"file",className:"hidden",multiple:!0,accept:"image/png,image/jpeg,image/gif,image/webp",onChange:async a=>{let b=a.currentTarget;await aB.handleFileSelect(b.files),b.value=""}}),(0,e.jsx)("textarea",{ref:a=>{Q.current=a},value:V,onChange:a=>aY(a.target.value,a.target.selectionStart??void 0),onKeyDown:a1,onPaste:a6,placeholder:S.ask.placeholder,rows:1,className:(0,E.cn)("min-w-0 flex-1 resize-none overflow-y-hidden bg-transparent py-2 leading-relaxed text-foreground placeholder:text-muted-foreground/50 outline-none focus-visible:ring-0",P?"text-xs":"text-sm")}),aM?(0,e.jsx)("button",{type:"button",onClick:aR,className:"p-2 rounded-xl transition-colors shrink-0 text-foreground bg-muted hover:bg-muted/80",title:"reconnecting"===aN?S.ask.cancelReconnect:S.ask.stopTitle,children:"reconnecting"===aN?(0,e.jsx)(k.A,{size:15}):(0,e.jsx)(l.A,{size:15})}):(0,e.jsx)("button",{type:"submit",title:aT?S.ask.uploadsProcessing??"Wait for uploaded files to finish processing before sending.":S.ask.send,disabled:aT||!V.trim()&&0===aB.images.length,className:"p-2 rounded-xl disabled:opacity-20 disabled:scale-95 disabled:cursor-not-allowed transition-all duration-150 shrink-0 bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm shadow-[var(--amber)]/15 hover:shadow-md hover:shadow-[var(--amber)]/20 active:scale-95",children:(0,e.jsx)(m.A,{size:14})})]}),(0,e.jsxs)("div",{className:(0,E.cn)("flex items-center justify-between border-t border-border/10",O?"px-2 pb-1.5 pt-1 gap-1":"px-3 pb-2 pt-1.5"),children:[(0,e.jsxs)("div",{className:(0,E.cn)("flex items-center flex-wrap",O?"gap-1":"gap-2"),children:[(0,e.jsx)(o.Ay,{mode:aq,onChange:ar,disabled:aM}),T&&(0,e.jsx)(A.A,{selectedAgent:am,onSelect:aS,installedAgents:aE.installedAgents,loading:aE.loading}),T&&(0,e.jsx)(B.A,{providerValue:as,onProviderChange:ba,modelValue:au,onModelChange:av,disabled:aM})]}),!O&&!P&&(0,e.jsxs)("span",{className:"hidden md:inline text-2xs text-muted-foreground/40 select-none shrink-0",children:[(0,e.jsx)("kbd",{className:"font-mono",children:"Enter"})," ",S.ask.send," \xb7 ",(0,e.jsx)("kbd",{className:"font-mono",children:"Shift+Enter"})," ",S.ask.newlineHint]})]})]})})]})]})}B=(G.then?(await G)():G)[0],new WeakMap,d()}catch(a){d(a)}})},66535:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AgentInspectorRenderer:()=>v});var d=c(48249),e=c(67484),f=c(19099),g=c(13576),h=c(22772),i=c(50567),j=c(59347),k=c(10316),l=c(76592),m=c(49681),n=c(8455),o=c(44218);function p(a){return/read|list|get|search/.test(a)?/search/.test(a)?"search":"read":/create/.test(a)?"create":/delete/.test(a)?"delete":/write|update|insert|append/.test(a)?"write":"other"}let q={read:{bg:"rgba(138,180,216,0.10)",text:"var(--tool-read)",border:"rgba(138,180,216,0.25)"},write:{bg:"rgba(200,135,58,0.10)",text:"var(--amber)",border:"rgba(200,135,58,0.25)"},create:{bg:"rgba(122,173,128,0.10)",text:"var(--success)",border:"rgba(122,173,128,0.25)"},delete:{bg:"rgba(200,80,80,0.10)",text:"var(--error)",border:"rgba(200,80,80,0.25)"},search:{bg:"rgba(200,160,216,0.10)",text:"var(--tool-search)",border:"rgba(200,160,216,0.25)"},other:{bg:"var(--muted)",text:"var(--muted-foreground)",border:"var(--border)"}};function r({kind:a,size:b=13}){return"read"===a?(0,d.jsx)(g.A,{size:b}):"write"===a?(0,d.jsx)(h.A,{size:b}):"create"===a?(0,d.jsx)(i.A,{size:b}):"delete"===a?(0,d.jsx)(j.A,{size:b}):"search"===a?(0,d.jsx)(k.A,{size:b}):(0,d.jsx)(l.A,{size:b})}function s(a){try{return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return a}}function t({op:a}){var b,c;let g,h,i,j,k=(0,f.useRouter)(),[l,t]=(0,e.useState)(!1),u=p(a.tool),v=q[u],w="string"==typeof(b=a.params).path?b.path:null,x=a.tool.replace("mindos_","");return(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",marginBottom:8},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",cursor:"pointer",userSelect:"none"},onClick:()=>t(a=>!a),children:[(0,d.jsxs)("span",{className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:999,fontSize:"0.68rem",fontWeight:600,background:v.bg,color:v.text,border:`1px solid ${v.border}`,flexShrink:0},children:[(0,d.jsx)(r,{kind:u,size:10}),u]}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.78rem",color:"var(--foreground)",fontWeight:600,flexShrink:0},children:x}),w&&(0,d.jsx)("span",{style:{fontSize:"0.72rem",color:"var(--amber)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},onClick:a=>{a.stopPropagation(),k.push("/view/"+w.split("/").map(encodeURIComponent).join("/"))},title:w,className:"font-display",children:w}),(0,d.jsxs)("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[a.agentName&&(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.62rem",fontWeight:500,padding:"1px 6px",borderRadius:999,background:"var(--muted)",color:"var(--muted-foreground)",whiteSpace:"nowrap",maxWidth:120,overflow:"hidden",textOverflow:"ellipsis"},title:a.agentName,children:a.agentName.length>30?a.agentName.slice(0,30)+"...":a.agentName}),"ok"===a.result?(0,d.jsx)(m.A,{size:13,style:{color:"var(--success)"}}):(0,d.jsx)(n.A,{size:13,style:{color:"var(--error)"}}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6},title:s(a.ts),children:(c=a.ts,h=Math.floor((g=Date.now()-new Date(c).getTime())/6e4),i=Math.floor(g/36e5),j=Math.floor(g/864e5),h<1?"just now":h<60?`${h}m ago`:i<24?`${i}h ago`:`${j}d ago`)}),(0,d.jsx)(o.A,{size:12,style:{color:"var(--muted-foreground)",transform:l?"rotate(180deg)":"none",transition:"transform .15s"}})]})]}),l&&(0,d.jsxs)("div",{style:{borderTop:"1px solid var(--border)",padding:"10px 14px",background:"var(--background)"},children:[(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8*!!a.message},children:Object.entries(a.params).map(([a,b])=>(0,d.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:[(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.7,flexShrink:0,minWidth:80},children:a}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--foreground)",wordBreak:"break-all",lineHeight:1.5},children:function(a,b=120){let c="string"==typeof a?a:JSON.stringify(a);return c.length>b?c.slice(0,b)+"…":c}(b)})]},a))}),a.message&&(0,d.jsx)("div",{className:"font-display",style:{marginTop:6,padding:"5px 9px",borderRadius:5,fontSize:"0.72rem",background:"error"===a.result?"rgba(200,80,80,0.08)":"rgba(122,173,128,0.08)",color:"error"===a.result?"var(--error)":"var(--success)",border:`1px solid ${"error"===a.result?"rgba(200,80,80,0.2)":"rgba(122,173,128,0.2)"}`},children:a.message}),a.agentName&&(0,d.jsxs)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.68rem",color:"var(--muted-foreground)"},children:["Agent: ",(0,d.jsx)("span",{style:{color:"var(--foreground)",fontWeight:500},children:a.agentName})]}),(0,d.jsx)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.65rem",color:"var(--muted-foreground)",opacity:.5},children:s(a.ts)})]})]})}let u=["all","write","create","delete","read","search"];function v({content:a}){let[b,c]=(0,e.useState)("all"),f=(0,e.useMemo)(()=>(function(a){try{let b=JSON.parse(a);if(Array.isArray(b.events))return b.events.filter(a=>!!a?.tool&&!!a?.ts).sort((a,b)=>new Date(b.ts).getTime()-new Date(a.ts).getTime())}catch{}return(function(a){let b=[];for(let c of a.split("\n")){let a=c.trim();if(!(!a||a.startsWith("#")||a.startsWith("//")))try{let c=JSON.parse(a);c.tool&&c.ts&&b.push(c)}catch{}}return b})(a).sort((a,b)=>new Date(b.ts).getTime()-new Date(a.ts).getTime())})(a),[a]),g=(0,e.useMemo)(()=>"all"===b?f:f.filter(a=>p(a.tool)===b),[f,b]),h=(0,e.useMemo)(()=>{let a={all:f.length};for(let b of f){let c=p(b.tool);a[c]=(a[c]??0)+1}return a},[f]);return 0===f.length?(0,d.jsxs)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:12},children:[(0,d.jsx)(l.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,d.jsx)("p",{children:"No agent operations logged yet."}),(0,d.jsxs)("p",{style:{marginTop:6,opacity:.6,fontSize:11},children:["Agent writes appear here from ",(0,d.jsx)("code",{style:{background:"var(--muted)",padding:"1px 5px",borderRadius:4},children:".mindos/agent-audit-log.json"}),"."]})]}):(0,d.jsxs)("div",{style:{maxWidth:760,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:"1.2rem",flexWrap:"wrap"},children:u.map(a=>{let e=h[a]??0;if("all"!==a&&!e)return null;let f="all"!==a?q[a]:void 0,g=b===a;return(0,d.jsxs)("button",{onClick:()=>c(a),className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:999,fontSize:"0.7rem",cursor:"pointer",border:"none",background:g?f?.bg??"var(--accent)":"var(--muted)",color:g?f?.text??"var(--foreground)":"var(--muted-foreground)",outline:g?`1px solid ${f?.border??"var(--border)"}`:"none",transition:"all .1s"},children:["all"!==a&&(0,d.jsx)(r,{kind:a,size:10}),a," ",(0,d.jsxs)("span",{style:{opacity:.6},children:["(",e,")"]})]},a)})}),(0,d.jsx)("div",{children:g.map((a,b)=>(0,d.jsx)(t,{op:a},b))})]})}},66874:(a,b,c)=>{"use strict";c.r(b),c.d(b,{BacklinksRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call BacklinksRenderer() from the server but BacklinksRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/backlinks/BacklinksRenderer.tsx","BacklinksRenderer")},66913:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AgentInspectorRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call AgentInspectorRenderer() from the server but AgentInspectorRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/agent-inspector/AgentInspectorRenderer.tsx","AgentInspectorRenderer")},67809:(a,b,c)=>{"use strict";c.d(b,{default:()=>f});var d=c(48249),e=c(67484);class f extends e.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,b){console.error("[ErrorBoundary]",a,b.componentStack)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,d.jsx)("div",{className:"flex items-center justify-center min-h-[50vh] px-4",children:(0,d.jsxs)("div",{className:"text-center max-w-md",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Something went wrong"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:this.state.error?.message||"An unexpected error occurred."}),(0,d.jsx)("button",{onClick:()=>this.setState({hasError:!1,error:void 0}),className:"px-4 py-2 text-sm rounded-lg border border-border hover:bg-muted transition-colors",children:"Try again"})]})}):this.props.children}}},68533:(a,b,c)=>{"use strict";c.d(b,{TooltipProvider:()=>e});var d=c(77943);(0,d.registerClientReference)(function(){throw Error("Attempted to call Tooltip() from the server but Tooltip is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","Tooltip"),(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipTrigger() from the server but TooltipTrigger is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipTrigger"),(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipContent() from the server but TooltipContent is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipContent");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipProvider() from the server but TooltipProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipProvider")},69593:(a,b,c)=>{"use strict";c.d(b,{Oo:()=>e,dB:()=>k});var d=c(67484);function e(a){let b=a.replace(/<(thinking|reasoning|scratchpad)>[\s\S]*?<\/\1>/gi,"");return(b=b.replace(/<(?:thinking|reasoning|scratchpad)>[\s\S]*$/gi,"")).trim()}let f=new Set(["create_file","write_file","batch_create_files","append_to_file","insert_after_heading","update_section","edit_lines","delete_file","rename_file","move_file","append_csv"]),g=new Set(["read_file","read_lines","search","list_files"]);function h(a,b){return b&&"object"==typeof b?"string"==typeof b.path?b.path:"string"==typeof b.from_path?b.from_path:"batch_create_files"===a&&Array.isArray(b.files)?b.files.map(a=>a.path??"").filter(Boolean).join(", "):"":""}async function i(a){try{let b=await fetch(`/api/file?path=${encodeURIComponent(a)}&op=read_file`);if(!b.ok)return"";return(await b.json()).content??""}catch{return""}}async function j(a,b,c,d){let j=a.getReader(),k=new TextDecoder,l="",m=[],n=new Map,o="",p=0,q=new Set;try{for(;!d?.aborted;){let{done:a,value:d}=await j.read();if(a)break;let u=(l+=k.decode(d,{stream:!0})).split("\n");for(let a of(l=u.pop()??"",u)){let d,j=a.trim();if(!j.startsWith("data:"))continue;let k=j.slice(5).trim();if(!k)continue;try{d=JSON.parse(k)}catch{continue}let l=d.type;switch(l){case"tool_start":{var r,s,t;let a=d.toolName,e=d.toolCallId,j=d.args;p++;let k=(r=l,s=a,t=j,"text_delta"===r?{stage:"analyzing"}:"tool_start"===r&&s?f.has(s)?{stage:"writing",detail:h(s,t)||void 0}:g.has(s)?{stage:"reading",detail:t&&"object"==typeof t&&"path"in t&&"string"==typeof t.path?t.path:void 0}:{stage:"analyzing"}:null);if(k&&b({stageHint:k}),f.has(a)){let d=h(a,j),f="update";"create_file"===a||"batch_create_files"===a?f="create":("delete_file"===a||"rename_file"===a||"move_file"===a)&&(f="unknown"),"update"===f&&d&&!q.has(d)&&(q.add(d),i(d).then(a=>{a&&c(d,a)})),n.set(e,{name:a,path:d,action:f}),b({currentTool:{name:a,path:d}})}break}case"tool_end":{let a=d.toolCallId,c=!!d.isError,e=n.get(a);if(e){if("batch_create_files"===e.name)for(let b of e.path.split(", ").filter(Boolean))m.push({action:e.action,path:b,toolCallId:a,ok:!c});else m.push({action:e.action,path:e.path,toolCallId:a,ok:!c});n.delete(a),b({changes:[...m],currentTool:null})}break}case"text_delta":o+=d.delta??"",b({stageHint:{stage:"analyzing"},summary:e(o)});break;case"error":throw Error(d.message||"AI organize failed")}}}}finally{j.releaseLock()}return{changes:m,summary:e(o),toolCallCount:p}}function k(){let[a,b]=(0,d.useState)("idle"),[c,e]=(0,d.useState)([]),[f,g]=(0,d.useState)(null),[h,i]=(0,d.useState)(null),[k,l]=(0,d.useState)(""),[m,n]=(0,d.useState)(null),[o,p]=(0,d.useState)(0),q=(0,d.useRef)(null),r=(0,d.useRef)(0),s=(0,d.useRef)(new Map),[t,u]=(0,d.useState)([]),[v,w]=(0,d.useState)("upload"),x=(0,d.useRef)(0),[y,z]=(0,d.useState)(0),A=(0,d.useCallback)(async(a,c,d="upload")=>{b("organizing"),e([]),g(null),i({stage:"connecting"}),l(""),n(null),p(0),u(a.map(a=>a.name)),w(d),x.current=Date.now(),z(0),s.current=new Map,r.current=Date.now();let f=new AbortController;q.current=f;let h=a.map(a=>({name:a.name,content:a.content.length>2e4?a.content.slice(0,2e4)+"\n\n[...truncated to first ~20000 chars]":a.content}));try{let a=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:c}],uploadedFiles:h,maxSteps:15,mode:"organize"}),signal:f.signal});if(!a.ok){let b=`Request failed (${a.status})`;try{let c=await a.json();"string"==typeof c?.error?b=c.error:"object"==typeof c?.error&&c.error?.message?b=c.error.message:c?.message&&(b=c.message)}catch{}throw Error(b)}if(!a.body)throw Error("No response body");let d=await j(a.body,a=>{r.current=Date.now(),a.changes&&e(a.changes),void 0!==a.currentTool&&g(a.currentTool),a.stageHint&&i(a.stageHint),void 0!==a.summary&&l(a.summary)},(a,b)=>{s.current.set(a,b)},f.signal);e(d.changes),l(d.summary),p(d.toolCallCount),g(null),z(Date.now()-x.current),b("done")}catch(a){"AbortError"===a.name?b("idle"):(n(a.message),b("error"))}finally{q.current=null}},[]),B=(0,d.useCallback)(()=>{q.current?.abort()},[]),C=(0,d.useCallback)(async a=>{let b=c.find(b=>b.path===a&&b.ok&&!b.undone);if(!b)return!1;try{if("create"===b.action){if(!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:b.path})})).ok)return!1}else{if("update"!==b.action)return!1;let c=s.current.get(a);if(!c||!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:b.path,content:c})})).ok)return!1}return e(b=>b.map(b=>b.path===a&&b.ok&&!b.undone?{...b,undone:!0}:b)),!0}catch{return!1}},[c]),D=(0,d.useCallback)(async()=>{let a=c.filter(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&s.current.has(a.path))),b=0;for(let c of a)try{if("create"===c.action)(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:c.path})})).ok&&b++;else if("update"===c.action){let a=s.current.get(c.path);a&&(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:c.path,content:a})})).ok&&b++}}catch{}return b>0&&e(a=>a.map(a=>!a.ok||a.undone?a:"create"===a.action||"update"===a.action&&s.current.has(a.path)?{...a,undone:!0}:a)),b},[c]),E=(0,d.useCallback)(a=>{let b=c.find(b=>b.path===a&&b.ok&&!b.undone);return!!b&&("create"===b.action||"update"===b.action&&s.current.has(a))},[c]),F=c.some(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&s.current.has(a.path))),G=(0,d.useCallback)(()=>{b("idle"),e([]),g(null),i(null),l(""),n(null),p(0),u([]),w("upload"),z(0),x.current=0,s.current=new Map,r.current=0},[]);return{phase:a,changes:c,currentTool:f,stageHint:h,summary:k,error:m,toolCallCount:o,sourceFileNames:t,source:v,durationMs:y,snapshots:s,start:A,abort:B,undoOne:C,undoAll:D,canUndo:E,hasAnyUndoable:F,reset:G}}},69626:(a,b,c)=>{"use strict";c.d(b,{i:()=>e});var d=c(99829);let e=(0,d.createServerReference)("402bfd1a6d1b8f6b5285f8a7662bc64aa3ecb50fb6",d.callServer,void 0,d.findSourceMapURL,"deleteFileAction")},70137:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(67484),f=c(46674),g=c(47223);function h(){let{t:a}=(0,g.Y)(),b=a.settings.update.updateToast,[c,h]=(0,e.useState)("hidden"),[i,j]=(0,e.useState)({});(0,e.useRef)(null);let[k,l]=(0,e.useState)(!1),m=(0,e.useRef)(new Set);(0,e.useRef)({});let n=(0,e.useCallback)(()=>{m.current.forEach(clearTimeout),m.current.clear()},[]),o=(0,e.useCallback)((a,b)=>{let c=setTimeout(()=>{m.current.delete(c),h(a)},b);m.current.add(c)},[]),p=(0,e.useCallback)(()=>{n(),window.dispatchEvent(new CustomEvent("mindos:open-settings",{detail:{tab:"update"}})),h("dismissing"),o("hidden",200)},[n,o]),q=(0,e.useCallback)(()=>{n(),i.desktop&&localStorage.setItem("mindos_update_skip_desktop",i.desktop.version),i.core&&localStorage.setItem("mindos_update_skip_core",i.core.version),h("dismissing"),o("hidden",200)},[i,n,o]);if(!k||"hidden"===c)return null;let r=!!(i.desktop&&i.core),s=r?b.titleMultiple:i.desktop?b.titleSingle(b.desktopLabel,i.desktop.version):i.core?b.titleSingle(b.coreLabel,i.core.version):"",t=r?`${b.desktopLabel} v${i.desktop.version} \u00B7 ${b.coreLabel} v${i.core.version}`:"";return(0,d.jsx)("div",{role:"status","aria-live":"polite",className:`
156
+ `,style:{width:E,minWidth:`${o}px`},role:"complementary","aria-label":"MindOS panel",children:[(0,e.jsx)(i.default,{fallback:(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 px-6 text-center",children:[(0,e.jsx)(g.A,{size:20,className:"text-muted-foreground"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"MindOS encountered an error."}),(0,e.jsx)("button",{onClick:()=>window.location.reload(),className:"text-xs px-3 py-1.5 rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Reload page"})]}),children:(0,e.jsx)("div",{className:"flex min-h-0 w-full flex-1 flex-col overflow-hidden",children:(0,e.jsx)(h.A,{visible:a,variant:"panel",currentFile:a?c:void 0,initialMessage:d,initialAcpAgent:k,onFirstMessage:l,onClose:b,askMode:r,onModeSwitch:s,maximized:t,onMaximize:u})})}),(0,e.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:D,children:(0,e.jsx)("div",{className:"absolute left-[2px] top-0 w-[1px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/50 transition-opacity duration-150"})})]})}d()}catch(a){d(a)}})},63112:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ConfigRenderer() from the server but ConfigRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/config/ConfigRenderer.tsx","ConfigRenderer")},63710:(a,b,c)=>{"use strict";c.d(b,{Aw:()=>i,Nh:()=>k,QL:()=>f,TM:()=>g,h0:()=>h,lL:()=>j});var d=c(99101);function e(a){let b=new Uint8Array(a),c=[];for(let a=0;a<b.length;a+=8192)c.push(String.fromCharCode(...b.subarray(a,a+8192)));return btoa(c.join(""))}async function f(a,b){let c=[],f=0;for(let b of a){if(b.size>0xa00000){f++;continue}try{if(b.name.toLowerCase().endsWith(".pdf")){let a=await b.arrayBuffer();c.push({name:b.name,content:e(a),encoding:"base64"})}else{let a=await b.text();c.push({name:b.name,content:a})}}catch{}}if(0===c.length)return void(f>0?d.oR.error(b.inbox.tooLarge(f),4e3):a.length>0&&d.oR.error(b.inbox.saveFailed,4e3));try{var g;let a=await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:c})});if(!a.ok){let c=await a.json().catch(()=>({}));console.error("[QuickDrop] Save failed:",c.error),d.oR.error(b.inbox.saveFailed,4e3);return}let e=await a.json(),h=e.saved?.length??0,i=e.skipped?.length??0;g=f,h>0&&g>0&&0===i?d.oR.success(b.inbox.savedWithOversized(h,g),4e3):h>0&&i+g>0?d.oR.success(b.inbox.savedWithSkipped(h,i+g),4e3):h>0?d.oR.success(b.inbox.savedToast(h),3e3):(g>0&&d.oR.error(b.inbox.tooLarge(g),4e3),i>0&&d.oR.error(b.inbox.savedWithSkipped(0,i),4e3),0===g&&0===i&&d.oR.error(b.inbox.saveFailed,4e3)),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated"))}catch(a){console.error("[QuickDrop] Network error:",a),d.oR.error(b.inbox.saveFailed,4e3)}}async function g(a,b){try{let c=await fetch("/api/inbox/clip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:a})}),e=await c.json();if(!c.ok){let a=e.error||b.inbox.clipFailed;return d.oR.error(a,4e3),{ok:!1}}return d.oR.success(b.inbox.clipSuccess(e.title||a),3e3),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated")),{ok:!0,title:e.title}}catch(a){return console.error("[ClipURL] Network error:",a),d.oR.error(b.inbox.clipFailed,4e3),{ok:!1}}}function h(a){let b=a.trim();if(!b.startsWith("http://")&&!b.startsWith("https://"))return!1;try{return new URL(b),!0}catch{return!1}}function i(a){if(a.dataTransfer?.files&&a.dataTransfer.files.length>0)return null;let b=a.dataTransfer?.getData("text/uri-list");if(b){let a=b.split(/[\r\n]+/).find(a=>!a.startsWith("#")&&a.trim().length>0);if(a&&h(a))return a.trim()}let c=a.dataTransfer?.getData("text/plain");return c&&h(c)?c.trim():null}function j(a){let b=a.dataTransfer?.types??[];return!b.includes("Files")&&(b.includes("text/uri-list")||b.includes("text/plain"))}async function k(a,b,c){let f=[],g=0,h=new Set(["pdf","png","jpg","jpeg","gif","webp","bmp","ico","mp3","wav","m4a","ogg","flac","aac","mp4","webm","mov","mkv"]);for(let b of a){if(b.size>0xa00000){g++;continue}try{let a=(b.name.split(".").pop()??"").toLowerCase();if(h.has(a)){let a=await b.arrayBuffer();f.push({name:b.name,content:e(a),encoding:"base64"})}else{let a=await b.text();f.push({name:b.name,content:a})}}catch{}}if(0===f.length)return void(g>0?d.oR.error(c.inbox.tooLarge(g),4e3):a.length>0&&d.oR.error(c.inbox.saveFailed,4e3));let i=b.split("/").pop()||b;try{let a=await fetch("/api/file/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:f,targetSpace:b,organize:!1,conflict:"rename"})});if(!a.ok){let b=await a.json().catch(()=>({}));console.error("[TreeDrop] Save failed:",b.error),d.oR.error(c.inbox.saveFailed,4e3);return}let e=await a.json(),h=e.created?.length??0,j=e.skipped?.length??0;h>0&&j+g>0?d.oR.success(c.inbox.savedWithSkipped(h,j+g),4e3):h>0?d.oR.success(c.inbox.savedToDir(h,i),3e3):(g>0&&d.oR.error(c.inbox.tooLarge(g),4e3),j>0&&d.oR.error(c.inbox.savedWithSkipped(0,j),4e3)),window.dispatchEvent(new Event("mindos:files-changed"))}catch(a){console.error("[TreeDrop] Network error:",a),d.oR.error(c.inbox.saveFailed,4e3)}}},63956:(a,b,c)=>{"use strict";c.r(b),c.d(b,{VideoRenderer:()=>f});var d=c(48249),e=c(67484);function f({filePath:a}){let b=`/api/file/raw?path=${encodeURIComponent(a)}`,c=a.split("/").pop()??"video",f=c.split(".").pop()?.toLowerCase()??"",[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(0),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),o=(0,e.useRef)(null),p=(0,e.useCallback)(()=>{let a=o.current;a&&n({w:a.videoWidth,h:a.videoHeight})},[]),q=(0,e.useCallback)(()=>{h(!1),j(a=>a+1)},[]);return(0,d.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[m&&(0,d.jsxs)("span",{children:[m.w," x ",m.h]}),null!==k&&(0,d.jsx)("span",{children:k<1024?`${k} B`:k<1048576?`${(k/1024).toFixed(1)} KB`:`${(k/1048576).toFixed(1)} MB`}),(0,d.jsx)("span",{className:"uppercase opacity-60",children:f})]}),(0,d.jsx)("div",{className:"flex-1 min-h-[50vh] flex items-center justify-center bg-black rounded-b-lg overflow-hidden",children:g?(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-neutral-400",children:"Failed to load video"}),(0,d.jsx)("button",{onClick:q,className:"text-xs px-3 py-1.5 rounded-md bg-neutral-800 hover:bg-neutral-700 text-neutral-200 transition-colors",children:"Retry"})]}):(0,d.jsx)("video",{ref:o,controls:!0,preload:"metadata",className:"max-w-full max-h-[70vh]",onLoadedMetadata:p,onError:()=>h(!0),children:(0,d.jsx)("source",{src:b})},i)})]})}},65141:(a,b,c)=>{"use strict";c.d(b,{b:()=>g});var d=c(67484),e=c(39139),f=c(4615);function g(){let[a,b]=(0,d.useState)("files"),[c,g]=(0,d.useState)(null),[h,i]=(0,d.useState)(!1),[j,k]=(0,d.useState)(!1),l=(0,d.useCallback)(a=>g(a),[]),m=(0,d.useCallback)(a=>{try{localStorage.setItem("left-panel-width",String(a))}catch{}},[]),n=(0,d.useCallback)(()=>i(a=>!a),[]),o=(0,d.useCallback)(a=>{k(a);try{localStorage.setItem("rail-expanded",String(a))}catch{}},[]),p=j?f.we:f.SG,q=c??(a?e.iP[a]:280);return{activePanel:a,setActivePanel:b,panelWidth:c,panelMaximized:h,railExpanded:j,railWidth:p,panelOpen:null!==a,effectivePanelWidth:q,handlePanelWidthChange:l,handlePanelWidthCommit:m,handlePanelMaximize:n,handleExpandedChange:o}}},65965:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>H});var e=c(48249),f=c(67484),g=c(74429),h=c(24520),i=c(80600),j=c(33407),k=c(46674),l=c(51161),m=c(74118),n=c(47223),o=c(38957),p=c(54461),q=c(41297),r=c(45108),s=c(15330),t=c(55232),u=c(74356),v=c(6597),w=c(82110),x=c(42529),y=c(41739),z=c(33827),A=c(74190),B=c(4452),C=c(93574),D=c(49223),E=c(33191),F=c(17009),G=a([B]);function H({visible:a,currentFile:b,initialMessage:c,initialAcpAgent:d,onFirstMessage:G,variant:H,onClose:I,maximized:J,onMaximize:K,askMode:L,onModeSwitch:M,onDockToPanel:N}){let O="panel"===H,P="home"===H,Q=(0,f.useRef)(null),R=(0,f.useRef)(null),{t:S}=(0,n.Y)(),[T,U]=(0,f.useState)(!1),[V,W]=(0,f.useState)(""),X=(0,f.useRef)("");X.current=V;let[Y,Z]=(0,f.useState)([]),$=(0,f.useRef)(Y);$.current=Y;let[_,aa]=(0,f.useState)(!1),[ab,ac]=(0,f.useState)(!1),[ad,ae]=(0,f.useState)(!1),af=(0,f.useRef)(null),ag=(0,f.useRef)(null),[ah,ai]=(0,f.useState)(null),[aj,ak]=(0,f.useState)(null),al=(0,f.useRef)(aj);al.current=aj;let[am,an]=(0,f.useState)(null),ao=(0,f.useRef)(am),ap=(0,f.useRef)(null);ao.current=am;let[aq,ar]=(0,f.useState)("agent"),[as,at]=(0,f.useState)(null),[au,av]=(0,f.useState)(null),aw=(0,p.X)(b),ax=(0,f.useRef)(aw);ax.current=aw;let ay=(0,f.useMemo)(()=>({unsupportedType:S.fileImport?.unsupported}),[S]),az=(0,q.l)(ay),aA=(0,f.useRef)(az);aA.current=az;let aB=(0,r.u)(),aC=(0,s.Q)(),aD=(0,t.C)(),aE=(0,F.z)(),aF=(0,f.useRef)(aB);aF.current=aB;let aG=(0,f.useRef)(aC);aG.current=aC;let aH=(0,f.useRef)(aD);aH.current=aD;let aI=(0,f.useCallback)(()=>{W(""),ak(null),Z(b?[b]:[]),aA.current.clearAttachments()},[b]),aJ=(0,f.useCallback)(a=>{W(a.content),a.images&&a.images.length>0&&aF.current.clearImages(),a.attachedFiles&&Z(a.attachedFiles),a.skillName&&aH.current.resetSlash(),an((0,D.EI)(a)),setTimeout(()=>Q.current?.focus(),50)},[]),aK=(0,f.useRef)({inputValueRef:X,mentionRef:aG,slashRef:aH,imageUploadRef:aF,sessionRef:ax,uploadRef:aA,selectedSkillRef:al,selectedAcpAgentRef:ao,attachedFilesRef:$}),aL=(0,C.t)({currentFile:b,chatMode:aq,providerOverride:as,modelOverride:au,onFirstMessage:G,refs:aK.current,errorLabels:{noResponse:S.ask.errorNoResponse,stopped:S.ask.stopped},resetInputState:aI,onRestoreInput:aJ}),{isLoading:aM,loadingPhase:aN,reconnectAttempt:aO,reconnectMaxRef:aP}=aL,aQ=aL.submit,aR=aL.stop,aS=(0,f.useCallback)(a=>{an(a),aw.setSessionDefaultAcpAgent(a)},[aw]),aT=az.localAttachments.some(a=>"loading"===a.status),aU=az.uploadError||aB.imageError||"";(0,f.useRef)(!1),(0,f.useRef)(b),(0,f.useRef)(aw.clearPersistTimer).current=aw.clearPersistTimer;let aV=(0,f.useRef)(null),aW=(0,f.useRef)(null),aX=(0,f.useRef)(null),aY=(0,f.useCallback)((a,b)=>{W(a);let c=b??a.length;aW.current&&clearTimeout(aW.current),aX.current&&clearTimeout(aX.current),aW.current=setTimeout(()=>aG.current.updateMentionFromInput(a,c),80),aX.current=setTimeout(()=>aH.current.updateSlashFromInput(a,c),80)},[]),aZ=(0,f.useCallback)(a=>{let b=Q.current,c=X.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("@"),f=c.slice(0,e)+c.slice(d);W(f),aG.current.resetMention(),$.current.includes(a)||Z(b=>[...b,a]),setTimeout(()=>{Q.current?.focus(),Q.current?.setSelectionRange(e,e)},0)},[]),a$=(0,f.useCallback)(a=>{let b=Q.current,c=X.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("/"),f=c.slice(0,e)+c.slice(d);W(f),ak(a),aH.current.resetSlash(),setTimeout(()=>{Q.current?.focus(),Q.current?.setSelectionRange(e,e)},0)},[]),a_=(0,f.useRef)(aZ);a_.current=aZ;let a0=(0,f.useRef)(a$);a0.current=a$;let a1=(0,f.useCallback)(a=>{let b=aG.current,c=aH.current;if(null!==b.mentionQuery){if("Escape"===a.key){a.preventDefault(),b.resetMention();return}if("ArrowDown"===a.key)a.preventDefault(),b.navigateMention("down");else if("ArrowUp"===a.key)a.preventDefault(),b.navigateMention("up");else if("Enter"===a.key||"Tab"===a.key){if("Enter"===a.key&&(a.shiftKey||a.nativeEvent.isComposing))return;b.mentionResults.length>0&&(a.preventDefault(),a_.current(b.mentionResults[b.mentionIndex]))}return}if(null!==c.slashQuery){if("Escape"===a.key){a.preventDefault(),c.resetSlash();return}if("ArrowDown"===a.key)a.preventDefault(),c.navigateSlash("down");else if("ArrowUp"===a.key)a.preventDefault(),c.navigateSlash("up");else if("Enter"===a.key||"Tab"===a.key){if("Enter"===a.key&&(a.shiftKey||a.nativeEvent.isComposing))return;c.slashResults.length>0&&(a.preventDefault(),a0.current(c.slashResults[c.slashIndex]))}return}"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&!aL.isLoadingRef.current&&(X.current.trim()||aF.current.images.length>0)&&(a.preventDefault(),a.currentTarget.form?.requestSubmit())},[]),a2=(0,f.useCallback)(()=>{aL.isLoadingRef.current||(ax.current.resetSession(),W(""),Z(b?[b]:[]),aA.current.clearAttachments(),aF.current.clearImages(),aG.current.resetMention(),aH.current.resetSlash(),ak(null),an(null),ap.current=null,aa(!1),aL.firstMessageFired.current=!1,setTimeout(()=>Q.current?.focus(),0))},[b]),a3=(0,f.useCallback)(a=>{(a.dataTransfer.types.includes("text/mindos-path")||a.dataTransfer.types.includes("Files"))&&(a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy",ac(!0))},[]),a4=(0,f.useCallback)(()=>ac(!1),[]),a5=(0,f.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),ac(!1);let b=a.dataTransfer.getData("text/mindos-path");if(b){let c=a.dataTransfer.getData("text/mindos-type"),d="directory"===c?b.replace(/\/?$/,"/"):b;$.current.includes(d)||Z(a=>[...a,d]);return}let c=a.dataTransfer.files;if(c.length>0){let b=Array.from(c).some(a=>a.type.startsWith("image/")),d=Array.from(c).filter(a=>!a.type.startsWith("image/"));(async()=>{try{if(b&&await aF.current.handleDrop(a),d.length>0){let a=new DataTransfer;d.forEach(b=>a.items.add(b)),await aA.current.pickFiles(a.files)}}catch(a){console.warn("[AskContent] Drop file processing failed:",a)}})()}},[]),a6=(0,f.useCallback)(a=>{let b=a.clipboardData?.items;!b||Array.from(b).some(a=>"file"===a.kind&&a.type.startsWith("image/"))&&(a.preventDefault(),aF.current.handlePaste(a))},[]),a7=(0,f.useCallback)(a=>{if(aL.isLoadingRef.current)return;let c=aw.sessions.find(b=>b.id===a)??null;ax.current.loadSession(a),aa(!1),W(""),Z(b?[b]:[]),aA.current.clearAttachments(),aF.current.clearImages(),aG.current.resetMention(),aH.current.resetSlash(),ak(null),an(c?.defaultAcpAgent??null),setTimeout(()=>Q.current?.focus(),0)},[b,aw.sessions]),a8=(0,f.useCallback)(()=>aa(a=>!a),[]),a9=(0,f.useMemo)(()=>({connecting:S.ask.connecting,thinking:S.ask.thinking,generating:S.ask.generating,reconnecting:aO>0?S.ask.reconnecting(aO,aP.current):void 0,copyMessage:S.ask.copyMessage}),[S,aO]),ba=(0,f.useCallback)(a=>{at(a),av(null)},[]);return(0,e.jsxs)("div",{className:"flex min-h-0 w-full flex-col h-full",children:[(0,e.jsx)(y.A,{isPanel:O||P,showHistory:_,onToggleHistory:a8,onReset:a2,isLoading:aM,maximized:J,onMaximize:K,askMode:P?void 0:L,onModeSwitch:P?void 0:M,onClose:P?void 0:I,onDockToPanel:J?N:void 0,sessions:aw.sessions,activeSessionId:aw.activeSessionId,onLoadSession:a7,onDeleteSession:aw.deleteSession,onRenameSession:aw.renameSession,onTogglePinSession:aw.togglePinSession,messages:aw.messages}),_&&(0,e.jsx)(x.A,{sessions:aw.sessions,activeSessionId:aw.activeSessionId,onLoad:a7,onDelete:aw.deleteSession,onRename:aw.renameSession,onTogglePin:aw.togglePinSession,onClearAll:aw.clearAllSessions,onClose:()=>aa(!1),onNewChat:a2}),!_&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col",children:[!P&&(0,e.jsx)(u.A,{messages:aw.messages,isLoading:aM,loadingPhase:aN,emptyPrompt:S.ask.emptyPrompt,emptyHint:S.ask.emptyHint,suggestions:S.ask.suggestions,onSuggestionClick:W,labels:a9}),P&&(aw.messages.length>0||J)&&(0,e.jsx)(u.A,{messages:aw.messages,isLoading:aM,loadingPhase:aN,emptyPrompt:S.ask.emptyPrompt,emptyHint:S.ask.emptyHint,suggestions:J&&0===aw.messages.length?S.ask.suggestions:[],onSuggestionClick:W,labels:a9})]}),null!==aC.mentionQuery&&aC.mentionResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(v.A,{results:aC.mentionResults,selectedIndex:aC.mentionIndex,query:aC.mentionQuery??void 0,onSelect:aZ})}),null!==aD.slashQuery&&aD.slashResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(w.A,{results:aD.slashResults,selectedIndex:aD.slashIndex,query:aD.slashQuery??void 0,onSelect:a$})}),(0,e.jsx)("div",{className:(0,E.cn)("shrink-0",P?"px-2 pb-2 pt-0.5":"px-3 pb-2.5 pt-1"),children:(0,e.jsxs)("div",{className:(0,E.cn)("rounded-xl bg-muted/40 transition-all focus-within:bg-muted/60",ab&&"ring-2 ring-[var(--amber)] bg-[var(--amber-dim)]"),onDragOver:a3,onDragLeave:a4,onDrop:a5,children:[(Y.length>0||az.localAttachments.length>0||aB.images.length>0||aj||am||az.uploadError||aB.imageError)&&(0,e.jsxs)("div",{className:(0,E.cn)("px-3 pt-2.5 pb-1",O?"max-h-24 overflow-y-auto":"max-h-28 overflow-y-auto"),children:[(0,e.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[Y.map(a=>(0,e.jsx)(z.A,{path:a,variant:"kb",onRemove:()=>Z(b=>b.filter(b=>b!==a))},a)),az.localAttachments.map((a,b)=>(0,e.jsx)(z.A,{path:a.name,variant:"upload",status:a.status,error:a.error,truncatedInfo:a.truncatedInfo,onRemove:()=>az.removeAttachment(b)},`up-${a.name}-${b}`)),aB.images.map((a,b)=>(0,e.jsx)(z.A,{path:a.fileName||`Image ${b+1}`,variant:"image",imageData:a.data,imageMime:a.mimeType,onRemove:()=>aB.removeImage(b)},`img-${b}`)),aj&&(0,e.jsx)(z.A,{path:aj.name,variant:"skill",onRemove:()=>{ak(null),Q.current?.focus()}}),am&&(0,e.jsx)(z.A,{path:"object"==typeof am&&"name"in am?am.name:"Remote Agent",variant:"agent",onRemove:()=>{aS(null),Q.current?.focus()}})]}),aU&&(0,e.jsx)("div",{className:"mt-1 text-xs text-error",children:aU})]}),(0,e.jsxs)("form",{ref:aV,onSubmit:aQ,className:(0,E.cn)("flex items-end gap-1.5",P?"px-2 py-1.5":"px-3 py-2"),children:[(0,e.jsx)("div",{className:"relative shrink-0",children:(0,e.jsx)("button",{ref:af,type:"button",onClick:()=>ae(a=>!a),className:"p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:S.hints.attachFile,children:(0,e.jsx)(h.A,{size:15})})}),T&&ad&&ah&&(0,g.createPortal)((0,e.jsxs)("div",{ref:ag,className:"fixed py-1 rounded-xl border border-border/60 bg-card shadow-lg z-50 min-w-[150px] animate-in fade-in-0 slide-in-from-bottom-2 duration-150",style:{top:`${ah.top}px`,left:`${ah.left}px`,transform:"translateY(-100%)"},onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",onClick:()=>{az.uploadInputRef.current?.click(),ae(!1)},children:[(0,e.jsx)(i.A,{size:12,className:"shrink-0 text-muted-foreground"}),S.ask.attachFileLabel]}),(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",onClick:()=>{R.current?.click(),ae(!1)},children:[(0,e.jsx)(j.A,{size:12,className:"shrink-0 text-muted-foreground"}),S.ask.attachImageLabel]})]}),document.body),(0,e.jsx)("input",{ref:az.uploadInputRef,type:"file",className:"hidden",multiple:!0,accept:".txt,.md,.markdown,.csv,.json,.yaml,.yml,.xml,.html,.htm,.pdf,text/plain,text/markdown,text/csv,application/json,application/pdf",onChange:async a=>{let b=a.currentTarget;await az.pickFiles(b.files),b.value=""}}),(0,e.jsx)("input",{ref:R,type:"file",className:"hidden",multiple:!0,accept:"image/png,image/jpeg,image/gif,image/webp",onChange:async a=>{let b=a.currentTarget;await aB.handleFileSelect(b.files),b.value=""}}),(0,e.jsx)("textarea",{ref:a=>{Q.current=a},value:V,onChange:a=>aY(a.target.value,a.target.selectionStart??void 0),onKeyDown:a1,onPaste:a6,placeholder:S.ask.placeholder,rows:1,className:(0,E.cn)("min-w-0 flex-1 resize-none overflow-y-hidden bg-transparent py-2 leading-relaxed text-foreground placeholder:text-muted-foreground/50 outline-none focus-visible:ring-0",P?"text-xs":"text-sm")}),aM?(0,e.jsx)("button",{type:"button",onClick:aR,className:"p-2 rounded-xl transition-colors shrink-0 text-foreground bg-muted hover:bg-muted/80",title:"reconnecting"===aN?S.ask.cancelReconnect:S.ask.stopTitle,children:"reconnecting"===aN?(0,e.jsx)(k.A,{size:15}):(0,e.jsx)(l.A,{size:15})}):(0,e.jsx)("button",{type:"submit",title:aT?S.ask.uploadsProcessing??"Wait for uploaded files to finish processing before sending.":S.ask.send,disabled:aT||!V.trim()&&0===aB.images.length,className:"p-2 rounded-xl disabled:opacity-20 disabled:scale-95 disabled:cursor-not-allowed transition-all duration-150 shrink-0 bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm shadow-[var(--amber)]/15 hover:shadow-md hover:shadow-[var(--amber)]/20 active:scale-95",children:(0,e.jsx)(m.A,{size:14})})]}),(0,e.jsxs)("div",{className:(0,E.cn)("flex items-center justify-between border-t border-border/10",O?"px-2 pb-1.5 pt-1 gap-1":"px-3 pb-2 pt-1.5"),children:[(0,e.jsxs)("div",{className:(0,E.cn)("flex items-center flex-wrap",O?"gap-1":"gap-2"),children:[(0,e.jsx)(o.Ay,{mode:aq,onChange:ar,disabled:aM}),T&&(0,e.jsx)(A.A,{selectedAgent:am,onSelect:aS,installedAgents:aE.installedAgents,loading:aE.loading}),T&&(0,e.jsx)(B.A,{providerValue:as,onProviderChange:ba,modelValue:au,onModelChange:av,disabled:aM})]}),!O&&!P&&(0,e.jsxs)("span",{className:"hidden md:inline text-2xs text-muted-foreground/40 select-none shrink-0",children:[(0,e.jsx)("kbd",{className:"font-mono",children:"Enter"})," ",S.ask.send," \xb7 ",(0,e.jsx)("kbd",{className:"font-mono",children:"Shift+Enter"})," ",S.ask.newlineHint]})]})]})})]})]})}B=(G.then?(await G)():G)[0],new WeakMap,d()}catch(a){d(a)}})},66535:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AgentInspectorRenderer:()=>v});var d=c(48249),e=c(67484),f=c(19099),g=c(13576),h=c(22772),i=c(50567),j=c(59347),k=c(10316),l=c(76592),m=c(49681),n=c(8455),o=c(44218);function p(a){return/read|list|get|search/.test(a)?/search/.test(a)?"search":"read":/create/.test(a)?"create":/delete/.test(a)?"delete":/write|update|insert|append/.test(a)?"write":"other"}let q={read:{bg:"rgba(138,180,216,0.10)",text:"var(--tool-read)",border:"rgba(138,180,216,0.25)"},write:{bg:"rgba(200,135,58,0.10)",text:"var(--amber)",border:"rgba(200,135,58,0.25)"},create:{bg:"rgba(122,173,128,0.10)",text:"var(--success)",border:"rgba(122,173,128,0.25)"},delete:{bg:"rgba(200,80,80,0.10)",text:"var(--error)",border:"rgba(200,80,80,0.25)"},search:{bg:"rgba(200,160,216,0.10)",text:"var(--tool-search)",border:"rgba(200,160,216,0.25)"},other:{bg:"var(--muted)",text:"var(--muted-foreground)",border:"var(--border)"}};function r({kind:a,size:b=13}){return"read"===a?(0,d.jsx)(g.A,{size:b}):"write"===a?(0,d.jsx)(h.A,{size:b}):"create"===a?(0,d.jsx)(i.A,{size:b}):"delete"===a?(0,d.jsx)(j.A,{size:b}):"search"===a?(0,d.jsx)(k.A,{size:b}):(0,d.jsx)(l.A,{size:b})}function s(a){try{return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return a}}function t({op:a}){var b,c;let g,h,i,j,k=(0,f.useRouter)(),[l,t]=(0,e.useState)(!1),u=p(a.tool),v=q[u],w="string"==typeof(b=a.params).path?b.path:null,x=a.tool.replace("mindos_","");return(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",marginBottom:8},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",cursor:"pointer",userSelect:"none"},onClick:()=>t(a=>!a),children:[(0,d.jsxs)("span",{className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:999,fontSize:"0.68rem",fontWeight:600,background:v.bg,color:v.text,border:`1px solid ${v.border}`,flexShrink:0},children:[(0,d.jsx)(r,{kind:u,size:10}),u]}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.78rem",color:"var(--foreground)",fontWeight:600,flexShrink:0},children:x}),w&&(0,d.jsx)("span",{style:{fontSize:"0.72rem",color:"var(--amber)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},onClick:a=>{a.stopPropagation(),k.push("/view/"+w.split("/").map(encodeURIComponent).join("/"))},title:w,className:"font-display",children:w}),(0,d.jsxs)("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[a.agentName&&(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.62rem",fontWeight:500,padding:"1px 6px",borderRadius:999,background:"var(--muted)",color:"var(--muted-foreground)",whiteSpace:"nowrap",maxWidth:120,overflow:"hidden",textOverflow:"ellipsis"},title:a.agentName,children:a.agentName.length>30?a.agentName.slice(0,30)+"...":a.agentName}),"ok"===a.result?(0,d.jsx)(m.A,{size:13,style:{color:"var(--success)"}}):(0,d.jsx)(n.A,{size:13,style:{color:"var(--error)"}}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6},title:s(a.ts),children:(c=a.ts,h=Math.floor((g=Date.now()-new Date(c).getTime())/6e4),i=Math.floor(g/36e5),j=Math.floor(g/864e5),h<1?"just now":h<60?`${h}m ago`:i<24?`${i}h ago`:`${j}d ago`)}),(0,d.jsx)(o.A,{size:12,style:{color:"var(--muted-foreground)",transform:l?"rotate(180deg)":"none",transition:"transform .15s"}})]})]}),l&&(0,d.jsxs)("div",{style:{borderTop:"1px solid var(--border)",padding:"10px 14px",background:"var(--background)"},children:[(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8*!!a.message},children:Object.entries(a.params).map(([a,b])=>(0,d.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:[(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.7,flexShrink:0,minWidth:80},children:a}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--foreground)",wordBreak:"break-all",lineHeight:1.5},children:function(a,b=120){let c="string"==typeof a?a:JSON.stringify(a);return c.length>b?c.slice(0,b)+"…":c}(b)})]},a))}),a.message&&(0,d.jsx)("div",{className:"font-display",style:{marginTop:6,padding:"5px 9px",borderRadius:5,fontSize:"0.72rem",background:"error"===a.result?"rgba(200,80,80,0.08)":"rgba(122,173,128,0.08)",color:"error"===a.result?"var(--error)":"var(--success)",border:`1px solid ${"error"===a.result?"rgba(200,80,80,0.2)":"rgba(122,173,128,0.2)"}`},children:a.message}),a.agentName&&(0,d.jsxs)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.68rem",color:"var(--muted-foreground)"},children:["Agent: ",(0,d.jsx)("span",{style:{color:"var(--foreground)",fontWeight:500},children:a.agentName})]}),(0,d.jsx)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.65rem",color:"var(--muted-foreground)",opacity:.5},children:s(a.ts)})]})]})}let u=["all","write","create","delete","read","search"];function v({content:a}){let[b,c]=(0,e.useState)("all"),f=(0,e.useMemo)(()=>(function(a){try{let b=JSON.parse(a);if(Array.isArray(b.events))return b.events.filter(a=>!!a?.tool&&!!a?.ts).sort((a,b)=>new Date(b.ts).getTime()-new Date(a.ts).getTime())}catch{}return(function(a){let b=[];for(let c of a.split("\n")){let a=c.trim();if(!(!a||a.startsWith("#")||a.startsWith("//")))try{let c=JSON.parse(a);c.tool&&c.ts&&b.push(c)}catch{}}return b})(a).sort((a,b)=>new Date(b.ts).getTime()-new Date(a.ts).getTime())})(a),[a]),g=(0,e.useMemo)(()=>"all"===b?f:f.filter(a=>p(a.tool)===b),[f,b]),h=(0,e.useMemo)(()=>{let a={all:f.length};for(let b of f){let c=p(b.tool);a[c]=(a[c]??0)+1}return a},[f]);return 0===f.length?(0,d.jsxs)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:12},children:[(0,d.jsx)(l.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,d.jsx)("p",{children:"No agent operations logged yet."}),(0,d.jsxs)("p",{style:{marginTop:6,opacity:.6,fontSize:11},children:["Agent writes appear here from ",(0,d.jsx)("code",{style:{background:"var(--muted)",padding:"1px 5px",borderRadius:4},children:".mindos/agent-audit-log.json"}),"."]})]}):(0,d.jsxs)("div",{style:{maxWidth:760,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:"1.2rem",flexWrap:"wrap"},children:u.map(a=>{let e=h[a]??0;if("all"!==a&&!e)return null;let f="all"!==a?q[a]:void 0,g=b===a;return(0,d.jsxs)("button",{onClick:()=>c(a),className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:999,fontSize:"0.7rem",cursor:"pointer",border:"none",background:g?f?.bg??"var(--accent)":"var(--muted)",color:g?f?.text??"var(--foreground)":"var(--muted-foreground)",outline:g?`1px solid ${f?.border??"var(--border)"}`:"none",transition:"all .1s"},children:["all"!==a&&(0,d.jsx)(r,{kind:a,size:10}),a," ",(0,d.jsxs)("span",{style:{opacity:.6},children:["(",e,")"]})]},a)})}),(0,d.jsx)("div",{children:g.map((a,b)=>(0,d.jsx)(t,{op:a},b))})]})}},66874:(a,b,c)=>{"use strict";c.r(b),c.d(b,{BacklinksRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call BacklinksRenderer() from the server but BacklinksRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/backlinks/BacklinksRenderer.tsx","BacklinksRenderer")},66913:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AgentInspectorRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call AgentInspectorRenderer() from the server but AgentInspectorRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/agent-inspector/AgentInspectorRenderer.tsx","AgentInspectorRenderer")},67809:(a,b,c)=>{"use strict";c.d(b,{default:()=>f});var d=c(48249),e=c(67484);class f extends e.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,b){console.error("[ErrorBoundary]",a,b.componentStack)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,d.jsx)("div",{className:"flex items-center justify-center min-h-[50vh] px-4",children:(0,d.jsxs)("div",{className:"text-center max-w-md",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Something went wrong"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:this.state.error?.message||"An unexpected error occurred."}),(0,d.jsx)("button",{onClick:()=>this.setState({hasError:!1,error:void 0}),className:"px-4 py-2 text-sm rounded-lg border border-border hover:bg-muted transition-colors",children:"Try again"})]})}):this.props.children}}},68533:(a,b,c)=>{"use strict";c.d(b,{TooltipProvider:()=>e});var d=c(77943);(0,d.registerClientReference)(function(){throw Error("Attempted to call Tooltip() from the server but Tooltip is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","Tooltip"),(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipTrigger() from the server but TooltipTrigger is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipTrigger"),(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipContent() from the server but TooltipContent is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipContent");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipProvider() from the server but TooltipProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipProvider")},69593:(a,b,c)=>{"use strict";c.d(b,{Oo:()=>e,dB:()=>k});var d=c(67484);function e(a){let b=a.replace(/<(thinking|reasoning|scratchpad)>[\s\S]*?<\/\1>/gi,"");return(b=b.replace(/<(?:thinking|reasoning|scratchpad)>[\s\S]*$/gi,"")).trim()}let f=new Set(["create_file","write_file","batch_create_files","append_to_file","insert_after_heading","update_section","edit_lines","delete_file","rename_file","move_file","append_csv"]),g=new Set(["read_file","read_lines","search","list_files"]);function h(a,b){return b&&"object"==typeof b?"string"==typeof b.path?b.path:"string"==typeof b.from_path?b.from_path:"batch_create_files"===a&&Array.isArray(b.files)?b.files.map(a=>a.path??"").filter(Boolean).join(", "):"":""}async function i(a){try{let b=await fetch(`/api/file?path=${encodeURIComponent(a)}&op=read_file`);if(!b.ok)return"";return(await b.json()).content??""}catch{return""}}async function j(a,b,c,d){let j=a.getReader(),k=new TextDecoder,l="",m=[],n=new Map,o="",p=0,q=new Set;try{for(;!d?.aborted;){let{done:a,value:d}=await j.read();if(a)break;let u=(l+=k.decode(d,{stream:!0})).split("\n");for(let a of(l=u.pop()??"",u)){let d,j=a.trim();if(!j.startsWith("data:"))continue;let k=j.slice(5).trim();if(!k)continue;try{d=JSON.parse(k)}catch{continue}let l=d.type;switch(l){case"tool_start":{var r,s,t;let a=d.toolName,e=d.toolCallId,j=d.args;p++;let k=(r=l,s=a,t=j,"text_delta"===r?{stage:"analyzing"}:"tool_start"===r&&s?f.has(s)?{stage:"writing",detail:h(s,t)||void 0}:g.has(s)?{stage:"reading",detail:t&&"object"==typeof t&&"path"in t&&"string"==typeof t.path?t.path:void 0}:{stage:"analyzing"}:null);if(k&&b({stageHint:k}),f.has(a)){let d=h(a,j),f="update";"create_file"===a||"batch_create_files"===a?f="create":("delete_file"===a||"rename_file"===a||"move_file"===a)&&(f="unknown"),"update"===f&&d&&!q.has(d)&&(q.add(d),i(d).then(a=>{a&&c(d,a)})),n.set(e,{name:a,path:d,action:f}),b({currentTool:{name:a,path:d}})}break}case"tool_end":{let a=d.toolCallId,c=!!d.isError,e=n.get(a);if(e){if("batch_create_files"===e.name)for(let b of e.path.split(", ").filter(Boolean))m.push({action:e.action,path:b,toolCallId:a,ok:!c});else m.push({action:e.action,path:e.path,toolCallId:a,ok:!c});n.delete(a),b({changes:[...m],currentTool:null})}break}case"text_delta":o+=d.delta??"",b({stageHint:{stage:"analyzing"},summary:e(o)});break;case"error":throw Error(d.message||"AI organize failed")}}}}finally{j.releaseLock()}return{changes:m,summary:e(o),toolCallCount:p}}function k(){let[a,b]=(0,d.useState)("idle"),[c,e]=(0,d.useState)([]),[f,g]=(0,d.useState)(null),[h,i]=(0,d.useState)(null),[k,l]=(0,d.useState)(""),[m,n]=(0,d.useState)(null),[o,p]=(0,d.useState)(0),q=(0,d.useRef)(null),r=(0,d.useRef)(0),s=(0,d.useRef)(new Map),[t,u]=(0,d.useState)([]),[v,w]=(0,d.useState)("upload"),x=(0,d.useRef)(0),[y,z]=(0,d.useState)(0),A=(0,d.useCallback)(async(a,c,d="upload")=>{b("organizing"),e([]),g(null),i({stage:"connecting"}),l(""),n(null),p(0),u(a.map(a=>a.name)),w(d),x.current=Date.now(),z(0),s.current=new Map,r.current=Date.now();let f=new AbortController;q.current=f;let h=a.map(a=>({name:a.name,content:a.content.length>2e4?a.content.slice(0,2e4)+"\n\n[...truncated to first ~20000 chars]":a.content}));try{let a=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:c}],uploadedFiles:h,maxSteps:15,mode:"organize"}),signal:f.signal});if(!a.ok){let b=`Request failed (${a.status})`;try{let c=await a.json();"string"==typeof c?.error?b=c.error:"object"==typeof c?.error&&c.error?.message?b=c.error.message:c?.message&&(b=c.message)}catch{}throw Error(b)}if(!a.body)throw Error("No response body");let d=await j(a.body,a=>{r.current=Date.now(),a.changes&&e(a.changes),void 0!==a.currentTool&&g(a.currentTool),a.stageHint&&i(a.stageHint),void 0!==a.summary&&l(a.summary)},(a,b)=>{s.current.set(a,b)},f.signal);e(d.changes),l(d.summary),p(d.toolCallCount),g(null),z(Date.now()-x.current),b("done")}catch(a){"AbortError"===a.name?b("idle"):(n(a.message),b("error"))}finally{q.current=null}},[]),B=(0,d.useCallback)(()=>{q.current?.abort()},[]),C=(0,d.useCallback)(async a=>{let b=c.find(b=>b.path===a&&b.ok&&!b.undone);if(!b)return!1;try{if("create"===b.action){if(!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:b.path})})).ok)return!1}else{if("update"!==b.action)return!1;let c=s.current.get(a);if(!c||!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:b.path,content:c})})).ok)return!1}return e(b=>b.map(b=>b.path===a&&b.ok&&!b.undone?{...b,undone:!0}:b)),!0}catch{return!1}},[c]),D=(0,d.useCallback)(async()=>{let a=c.filter(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&s.current.has(a.path))),b=0;for(let c of a)try{if("create"===c.action)(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:c.path})})).ok&&b++;else if("update"===c.action){let a=s.current.get(c.path);a&&(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:c.path,content:a})})).ok&&b++}}catch{}return b>0&&e(a=>a.map(a=>!a.ok||a.undone?a:"create"===a.action||"update"===a.action&&s.current.has(a.path)?{...a,undone:!0}:a)),b},[c]),E=(0,d.useCallback)(a=>{let b=c.find(b=>b.path===a&&b.ok&&!b.undone);return!!b&&("create"===b.action||"update"===b.action&&s.current.has(a))},[c]),F=c.some(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&s.current.has(a.path))),G=(0,d.useCallback)(()=>{b("idle"),e([]),g(null),i(null),l(""),n(null),p(0),u([]),w("upload"),z(0),x.current=0,s.current=new Map,r.current=0},[]);return{phase:a,changes:c,currentTool:f,stageHint:h,summary:k,error:m,toolCallCount:o,sourceFileNames:t,source:v,durationMs:y,snapshots:s,start:A,abort:B,undoOne:C,undoAll:D,canUndo:E,hasAnyUndoable:F,reset:G}}},70137:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(67484),f=c(46674),g=c(47223);function h(){let{t:a}=(0,g.Y)(),b=a.settings.update.updateToast,[c,h]=(0,e.useState)("hidden"),[i,j]=(0,e.useState)({});(0,e.useRef)(null);let[k,l]=(0,e.useState)(!1),m=(0,e.useRef)(new Set);(0,e.useRef)({});let n=(0,e.useCallback)(()=>{m.current.forEach(clearTimeout),m.current.clear()},[]),o=(0,e.useCallback)((a,b)=>{let c=setTimeout(()=>{m.current.delete(c),h(a)},b);m.current.add(c)},[]),p=(0,e.useCallback)(()=>{n(),window.dispatchEvent(new CustomEvent("mindos:open-settings",{detail:{tab:"update"}})),h("dismissing"),o("hidden",200)},[n,o]),q=(0,e.useCallback)(()=>{n(),i.desktop&&localStorage.setItem("mindos_update_skip_desktop",i.desktop.version),i.core&&localStorage.setItem("mindos_update_skip_core",i.core.version),h("dismissing"),o("hidden",200)},[i,n,o]);if(!k||"hidden"===c)return null;let r=!!(i.desktop&&i.core),s=r?b.titleMultiple:i.desktop?b.titleSingle(b.desktopLabel,i.desktop.version):i.core?b.titleSingle(b.coreLabel,i.core.version):"",t=r?`${b.desktopLabel} v${i.desktop.version} \u00B7 ${b.coreLabel} v${i.core.version}`:"";return(0,d.jsx)("div",{role:"status","aria-live":"polite",className:`
130
157
  fixed bottom-14 right-4 z-40 pointer-events-none
131
158
  transition-all duration-200
132
159
  ${"visible"===c?"opacity-100 translate-y-0":"opacity-0 translate-y-2"}
133
- `,children:(0,d.jsxs)("div",{className:"pointer-events-auto flex flex-col gap-2.5 bg-card border border-border rounded-xl shadow-lg px-4 py-3 w-[290px]",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"mt-[5px] w-2 h-2 rounded-full bg-[var(--amber)] shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-foreground leading-snug",children:s}),t&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:t})]}),(0,d.jsx)("button",{type:"button",onClick:q,className:"shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":"Dismiss",children:(0,d.jsx)(f.A,{size:13})})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:p,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded-lg text-[var(--amber-foreground)] bg-[var(--amber)] hover:opacity-90 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:b.viewDetails}),(0,d.jsx)("button",{type:"button",onClick:q,className:"flex-1 px-3 py-1.5 text-xs rounded-lg text-muted-foreground border border-border hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r?b.skipAll:b.skipVersion})]})]})})}},70567:(a,b,c)=>{Promise.resolve().then(c.bind(c,55038))},70875:(a,b,c)=>{"use strict";c.d(b,{f:()=>e});var d=c(99829);let e=(0,d.createServerReference)("601b3ade603fade849edae59cc49f82afc4854330c",d.callServer,void 0,d.findSourceMapURL,"renameFileAction")},72362:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>j});var d=c(48249),e=c(67484),f=c(40560),g=c(42742),h=c(46674),i=c(24520);function j({content:a,saveAction:b}){let c=(0,e.useMemo)(()=>{try{return JSON.parse(a)}catch{return null}},[a]),[j,k]=(0,e.useState)(c),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)({}),t=j??{},u=t.uiSchema?.sections??[],v=t.keySpecs??{},w=(0,e.useCallback)(async a=>{m(!0),o(!1),q("");try{await b(`${JSON.stringify(a,null,2)}
160
+ `,children:(0,d.jsxs)("div",{className:"pointer-events-auto flex flex-col gap-2.5 bg-card border border-border rounded-xl shadow-lg px-4 py-3 w-[290px]",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"mt-[5px] w-2 h-2 rounded-full bg-[var(--amber)] shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-foreground leading-snug",children:s}),t&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:t})]}),(0,d.jsx)("button",{type:"button",onClick:q,className:"shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":"Dismiss",children:(0,d.jsx)(f.A,{size:13})})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:p,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded-lg text-[var(--amber-foreground)] bg-[var(--amber)] hover:opacity-90 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:b.viewDetails}),(0,d.jsx)("button",{type:"button",onClick:q,className:"flex-1 px-3 py-1.5 text-xs rounded-lg text-muted-foreground border border-border hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r?b.skipAll:b.skipVersion})]})]})})}},70567:(a,b,c)=>{Promise.resolve().then(c.bind(c,55038))},72362:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>j});var d=c(48249),e=c(67484),f=c(40560),g=c(42742),h=c(46674),i=c(24520);function j({content:a,saveAction:b}){let c=(0,e.useMemo)(()=>{try{return JSON.parse(a)}catch{return null}},[a]),[j,k]=(0,e.useState)(c),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)({}),t=j??{},u=t.uiSchema?.sections??[],v=t.keySpecs??{},w=(0,e.useCallback)(async a=>{m(!0),o(!1),q("");try{await b(`${JSON.stringify(a,null,2)}
134
161
  `),o(!0),setTimeout(()=>o(!1),1200)}catch(a){q(a instanceof Error?a.message:"Failed to save")}finally{m(!1)}},[b]),x=(0,e.useCallback)(async(a,b)=>{if(!j)return;let c=function(a,b,c){let d=b.split("."),e=structuredClone(a),f=e;for(let a=0;a<d.length-1;a++){let b=d[a],c=f[b];(!c||"object"!=typeof c||Array.isArray(c))&&(f[b]={}),f=f[b]}return f[d[d.length-1]]=c,e}(j,a,b);k(c),await w(c)},[j,w]);return c&&j?(0,d.jsxs)("div",{className:"max-w-3xl mx-auto flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card px-4 py-2.5",children:[(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:"CONFIG Control Panel"}),(0,d.jsxs)("div",{className:"text-xs flex items-center gap-2",children:[l&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,d.jsx)(f.A,{size:12,className:"animate-spin"}),"Saving"]}),!l&&n&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",style:{color:"var(--success)"},children:[(0,d.jsx)(g.A,{size:12}),"Saved"]})]})]}),p&&(0,d.jsx)("div",{className:"rounded-lg border border-error/30 bg-error/10 px-3 py-2 text-xs text-error",children:p}),u.map(a=>(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4",children:[(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:a.title}),a.description&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:a.description})]}),(0,d.jsx)("div",{className:"space-y-3",children:a.fields.map(a=>{let b=v[a]??{},c=function(a,b){let c=b.split("."),d=a;for(let a of c){if(!d||"object"!=typeof d||!(a in d))return null;d=d[a]}return d}(j,a),e=b.label||a;return(0,d.jsxs)("div",{className:"rounded-lg border border-border/80 bg-background px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-1.5",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-sm text-foreground",children:e}),b.description&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:b.description})]}),"switch"===b.control&&"boolean"==typeof c&&(0,d.jsx)("button",{type:"button",onClick:()=>x(a,!c),className:"px-2.5 py-1 rounded-md text-xs font-medium",style:{background:c?"var(--amber)":"var(--muted)",color:c?"var(--amber-foreground)":"var(--muted-foreground)"},children:c?"ON":"OFF"})]}),"text"===b.control&&"string"==typeof c&&(0,d.jsx)("input",{defaultValue:c,onBlur:b=>x(a,b.target.value),className:"w-full px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground"}),"number"===b.control&&"number"==typeof c&&(0,d.jsx)("input",{type:"number",defaultValue:c,min:b.constraints?.min,max:b.constraints?.max,onBlur:d=>{let e=Number(d.target.value),f=b.constraints?.min,g=b.constraints?.max,h=Number.isFinite(e)?e:c;"number"==typeof f&&h<f&&(h=f),"number"==typeof g&&h>g&&(h=g),x(a,h)},className:"w-full px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground"}),"tag-list"===b.control&&Array.isArray(c)&&(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.map((b,e)=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded border border-border text-xs bg-muted text-foreground",children:[String(b),(0,d.jsx)("button",{type:"button",onClick:()=>x(a,c.filter((a,b)=>b!==e)),className:"text-muted-foreground hover:text-foreground",children:(0,d.jsx)(h.A,{size:11})})]},`${String(b)}-${e}`))}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{value:r[a]??"",onChange:b=>s(c=>({...c,[a]:b.target.value})),onKeyDown:b=>{if("Enter"!==b.key)return;b.preventDefault();let d=(r[a]??"").trim();d&&(x(a,[...c,d]),s(b=>({...b,[a]:""})))},className:"flex-1 px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground",placeholder:"Add item"}),(0,d.jsxs)("button",{type:"button",onClick:()=>{let b=(r[a]??"").trim();b&&(x(a,[...c,b]),s(b=>({...b,[a]:""})))},className:"px-2.5 py-1.5 rounded-md text-xs bg-muted text-foreground inline-flex items-center gap-1",children:[(0,d.jsx)(i.A,{size:12})," Add"]})]})]})]},a)})})]},a.id))]}):(0,d.jsx)("div",{className:"rounded-xl border border-border p-4 text-sm text-error",children:"CONFIG.json parse failed. Please check JSON format."})}},73778:(a,b,c)=>{"use strict";c.d(b,{A:()=>m});var d=c(48249),e=c(2116),f=c.n(e),g=c(67484),h=c(19099),i=c(96286),j=c(46674),k=c(95054),l=c(47223);function m(){let[a,b]=(0,g.useState)(0),[c,e]=(0,g.useState)(null),[m,n]=(0,g.useState)(!1);(0,g.useRef)(0);let[o,p]=(0,g.useState)(!1),[q,r]=(0,g.useState)(!1),s=(0,h.usePathname)(),{t}=(0,l.Y)();async function u(){try{await (0,k.n)("/api/changes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"mark_seen"})})}catch{}finally{b(0),e(0)}}return((0,g.useMemo)(()=>!(a<=0||s?.startsWith("/changes")||s?.startsWith("/changelog"))&&(null===c||!(a<=c))&&!m,[c,s,a,m]),o)?(0,d.jsx)("div",{className:`fixed right-3 top-[60px] md:right-6 md:top-4 z-30 transition-all duration-150 ease-out ${q?"opacity-100 translate-y-0 scale-100":"opacity-0 -translate-y-2 scale-[0.98] pointer-events-none"}`,children:(0,d.jsx)("div",{className:"rounded-2xl border bg-card/95 backdrop-blur px-3 py-2.5 shadow-lg min-w-[260px] max-w-[350px]",style:{borderColor:"color-mix(in srgb, var(--amber) 45%, var(--border))",boxShadow:"0 12px 28px color-mix(in srgb, var(--amber) 14%, rgba(0,0,0,.24))"},children:(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-[var(--amber)] bg-[var(--amber-subtle)]",children:(0,d.jsx)(i.A,{size:14})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-xs text-foreground font-medium whitespace-nowrap",children:t.changes.unreadBanner(a)}),(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-1.5",children:[(0,d.jsx)(f(),{href:"/changelog",className:"inline-flex items-center rounded-md px-2.5 py-1 text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] focus-visible:ring-2 focus-visible:ring-ring hover:opacity-90",children:t.changes.reviewNow}),(0,d.jsx)("button",{type:"button",onClick:()=>void u(),className:"inline-flex items-center rounded-md px-2 py-1 text-xs font-medium bg-muted text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:t.changes.markAllRead})]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>e(a),"aria-label":t.changes.dismiss,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring",children:(0,d.jsx)(j.A,{size:14})})]})})}):null}},74190:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(74429),g=c(65255),h=c(42742),i=c(46674),j=c(44218),k=c(47223);function l({selectedAgent:a,onSelect:b,installedAgents:c,loading:l=!1}){let{t:m}=(0,k.Y)(),n=m.panels?.agents??{acpDefaultAgent:"MindOS",acpSelectAgent:"Select Agent",acpChangeAgent:"Change agent"},[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(null),u=(0,e.useCallback)(()=>{b(null),p(!1)},[b]),v=(0,e.useCallback)(a=>{b({id:a.id,name:a.name}),p(!1)},[b]),w=(0,e.useCallback)(a=>{a.stopPropagation(),b(null)},[b]),x=!a,y=a?.name??n.acpDefaultAgent,z=o&&q?(0,d.jsxs)("div",{ref:t,role:"listbox","aria-label":n.acpSelectAgent,className:"fixed z-50 min-w-[180px] max-w-[240px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:q.left,..."up"===q.direction?{bottom:window.innerHeight-q.top}:{top:q.top}},children:[(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":x,onClick:u,className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-left transition-colors hover:bg-muted",children:[(0,d.jsx)(g.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"flex-1 truncate font-medium",children:n.acpDefaultAgent}),x&&(0,d.jsx)(h.A,{size:11,className:"shrink-0 text-[var(--amber)]"})]}),c.length>0&&(0,d.jsx)("div",{className:"mx-2 my-1 border-t border-border/60"}),c.map(b=>{let c=a?.id===b.id;return(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":c,onClick:()=>v(b),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-left transition-colors hover:bg-muted",children:[(0,d.jsx)("span",{className:"w-2 h-2 rounded-full bg-[var(--success)] shrink-0"}),(0,d.jsx)("span",{className:"flex-1 truncate",children:b.name}),c&&(0,d.jsx)(h.A,{size:11,className:"shrink-0 text-[var(--amber)]"})]},b.id)})]}):null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{ref:s,type:"button",onClick:()=>p(a=>!a),className:`
135
162
  inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
136
163
  text-2xs font-medium transition-colors
@@ -142,29 +169,7 @@ MCP_TRANSPORT = "stdio"`;return{snippet:b,displaySnippet:b,path:a.globalPath}}if
142
169
  `,children:[(0,d.jsxs)(x(),{href:e,className:"flex flex-1 min-w-0 items-center gap-2.5 text-left rounded-xl pl-2.5 pr-2 py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,d.jsx)(A.lx,{name:a.name,status:b,size:"sm"}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground truncate leading-tight",children:a.name}),"connected"===b&&a.transport&&(0,d.jsx)("span",{className:"text-2xs font-mono tabular-nums px-1.5 py-0.5 rounded-md bg-muted/90 text-muted-foreground shrink-0 border border-border/50",children:a.transport}),h&&(0,d.jsx)("span",{title:j,className:"shrink-0 text-muted-foreground/70",children:(0,d.jsx)(i.A,{size:12})}),(0,d.jsx)("span",{className:"flex-1 min-w-[4px]"}),(0,d.jsx)(v.A,{size:15,className:`shrink-0 transition-opacity duration-150 ${c?"text-[var(--amber)] opacity-90":"text-muted-foreground/45 group-hover:text-muted-foreground/80"}`,"aria-hidden":!0})]}),"detected"===b&&(0,d.jsx)("div",{className:"pr-2 py-2 shrink-0",children:(0,d.jsx)(C,{agentKey:a.key,agentName:a.name,onInstallAgent:f,copy:g})})]})}function C({agentKey:a,agentName:b,onInstallAgent:c,copy:f}){let[g,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)("idle"),l=async b=>{if(b.stopPropagation(),g)return;i(!0),k("idle");let d=await c(a);i(!1),k(d?"success":"error")},m="error"===j,n="success"===j,o=g?f.installing:n?f.installSuccess:m?f.retryInstall:f.install;return(0,d.jsxs)("button",{type:"button",onClick:l,disabled:g,className:`flex items-center gap-1 px-2 py-1.5 text-2xs rounded-lg font-medium text-white disabled:opacity-50 transition-colors shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${m?"bg-error hover:bg-error/90":n?"bg-success hover:bg-success/90":"bg-[var(--amber)] hover:bg-[var(--amber)]/90"}`,"aria-label":`${b} ${o}`,children:[g?(0,d.jsx)(h.A,{size:10,className:"animate-spin"}):null,!g&&n?(0,d.jsx)(y.A,{size:10}):null,!g&&m?(0,d.jsx)(z.A,{size:10}):null,o,(0,d.jsx)("span",{className:"sr-only","aria-live":"polite",children:m?f.installFailed:""})]})}function D({connected:a,detected:b,notFound:c,selectedAgentKey:e,onInstallAgent:f,listCopy:g,showNotDetected:h,setShowNotDetected:i,p:j}){return(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-0 py-1.5 mb-1",children:(0,d.jsx)("span",{className:"text-2xs font-semibold text-muted-foreground/70 uppercase tracking-wider",children:j.rosterLabel})}),a.length>0&&(0,d.jsxs)("section",{className:"mb-3",children:[(0,d.jsxs)("h3",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground/80 uppercase tracking-wider mb-2 pl-0.5",children:[(0,d.jsx)("span",{className:"w-1 h-3 rounded-full bg-[var(--success)]/50","aria-hidden":"true"}),j.sectionConnected," ",(0,d.jsxs)("span",{className:"text-muted-foreground/50 tabular-nums",children:["(",a.length,")"]})]}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,d.jsx)(B,{agent:a,agentStatus:"connected",selected:e===a.key,detailHref:`/agents/${encodeURIComponent(a.key)}`,onInstallAgent:f,copy:g},a.key))})]}),b.length>0&&(0,d.jsxs)("section",{className:"mb-3",children:[(0,d.jsxs)("h3",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground/80 uppercase tracking-wider mb-2 pl-0.5",children:[(0,d.jsx)("span",{className:"w-1 h-3 rounded-full bg-[var(--amber)]/50","aria-hidden":"true"}),j.sectionDetected," ",(0,d.jsxs)("span",{className:"text-muted-foreground/50 tabular-nums",children:["(",b.length,")"]})]}),(0,d.jsx)("div",{className:"space-y-1.5",children:b.map(a=>(0,d.jsx)(B,{agent:a,agentStatus:"detected",selected:e===a.key,detailHref:`/agents/${encodeURIComponent(a.key)}`,onInstallAgent:f,copy:g},a.key))})]}),c.length>0&&(0,d.jsxs)("section",{children:[(0,d.jsxs)("button",{type:"button",onClick:()=>i(!h),className:"flex items-center gap-1 text-[11px] font-medium text-muted-foreground uppercase tracking-wider mb-2 hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm pl-0.5",children:[h?(0,d.jsx)(u.A,{size:12}):(0,d.jsx)(v.A,{size:12}),j.sectionNotDetected," (",c.length,")"]}),h&&(0,d.jsx)("div",{className:"space-y-1.5",children:c.map(a=>(0,d.jsx)(B,{agent:a,agentStatus:"notFound",selected:e===a.key,detailHref:`/agents/${encodeURIComponent(a.key)}`,onInstallAgent:f,copy:g},a.key))})]})]})}var E=c(2887),F=c(8455),G=c(49681),H=c(33740),I=c(34545);function J(){let{t:a}=(0,m.Y)(),b=a.panels.im,c=(0,f.useSearchParams)().get("platform"),[i,j]=(0,e.useState)([]),[k,l]=(0,e.useState)(!0),[n,o]=(0,e.useState)(!1),p=(0,e.useCallback)(async()=>{o(!1);try{let a=await fetch("/api/im/status");if(a.ok){let b=await a.json();j(b.platforms??[])}else o(!0)}catch{o(!0)}l(!1)},[]);if(k)return(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(h.A,{size:16,className:"animate-spin text-muted-foreground"})});if(n)return(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2 py-8 px-3",children:[(0,d.jsx)(F.A,{size:16,className:"text-muted-foreground"}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground",children:b.fetchError}),(0,d.jsxs)("button",{type:"button",onClick:()=>{l(!0),p()},className:"inline-flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,d.jsx)(g.A,{size:11})," ",b.retry]})]});let q=i.filter(a=>a.connected).length;return(0,d.jsxs)("div",{className:"flex flex-col py-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mb-0.5",children:[(0,d.jsx)("span",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider",children:b.title}),q>0&&(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground/60",children:[q," ",b.connected]})]}),(0,d.jsx)("div",{className:"flex flex-col",children:I.P.map(({id:a,name:b,icon:e})=>{let f=i.find(b=>b.platform===a),g=f?.connected??!1,h=c===a;return(0,d.jsxs)(x(),{href:`/agents?tab=channels&platform=${a}`,className:`
143
170
  relative flex items-center gap-2.5 px-3 py-2 text-left rounded-sm transition-colors
144
171
  ${h?"bg-[var(--amber-dim)]/40 pl-3.5":"hover:bg-muted/50"}
145
- `,children:[h&&(0,d.jsx)("span",{className:"pointer-events-none absolute bottom-[22%] left-0 top-[22%] w-0.5 rounded-r-full bg-[var(--amber)]","aria-hidden":!0}),(0,d.jsx)("span",{className:"text-sm",children:e}),(0,d.jsx)("span",{className:"text-sm flex-1 truncate text-foreground",children:b}),g?(0,d.jsx)(G.A,{size:14,className:"text-success shrink-0"}):(0,d.jsx)(H.A,{size:14,className:"text-border shrink-0"})]},a)})})]})}function K({active:a,maximized:b,onMaximize:c,selectedAgentKey:o=null}){let{t:p}=(0,m.Y)(),q=p.panels.agents,r=(0,f.useRouter)(),s=(0,k.kr)(),u=(0,f.usePathname)(),v=(0,f.useSearchParams)(),w="/agents"===u&&"channels"===v.get("tab"),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),F=(0,l.V)(),G=async()=>{y(!0),await s.refresh(),y(!1)},H=s.agents.filter(a=>a.present&&a.installed),I=s.agents.filter(a=>a.present&&!a.installed),K=s.agents.filter(a=>!a.present),L=async a=>{let b=await s.installAgent(a);return b&&await s.refresh(),b},M=u?.startsWith("/agents/")?decodeURIComponent(u.slice(8)):null,N={installing:q.installing,install:q.install,installSuccess:q.installSuccess,installFailed:q.installFailed,retryInstall:q.retryInstall},O={navOverview:q.navOverview,navMcp:q.navMcp,navSkills:q.navSkills,navChannels:q.channels,navNetwork:q.navNetwork,navSessions:q.navSessions,navActivity:q.navActivity},P=(0,d.jsx)(t,{copy:O,connectedCount:H.length,mcpEnabled:s.status?.connectionMode?.mcp??!1,channelsActive:w,onChannelsClick:()=>{r.push("/agents?tab=channels")}});return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(n.A,{title:q.title,maximized:b,onMaximize:c,children:(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[!s.loading&&(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground",children:[H.length," ",q.connected,F.agents.length>0&&(0,d.jsxs)(d.Fragment,{children:[" \xb7 ",q.a2aLabel," ",F.agents.length]})]}),(0,d.jsx)("button",{onClick:G,disabled:x,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":q.refresh,title:q.refresh,type:"button",children:(0,d.jsx)(g.A,{size:12,className:x?"animate-spin":""})})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:s.loading?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(h.A,{size:16,className:"animate-spin text-muted-foreground"})}):0===s.agents.length&&0===s.skills.length?(0,d.jsxs)("div",{className:"flex flex-col gap-2 py-4 px-0",children:[P,(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),(0,d.jsxs)("div",{className:"mx-3 rounded-lg border border-border/40 bg-card/30 px-3 py-5 text-center",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-1.5",children:q.noAgents}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/40 mb-3",children:q.skillsEmptyHint}),(0,d.jsxs)("button",{onClick:G,type:"button",className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,d.jsx)(g.A,{size:11})," ",q.retry]})]})]}):(0,d.jsxs)("div",{className:"pb-3",children:[P,(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),w?(0,d.jsx)(J,{}):(0,d.jsx)("div",{className:"px-3 py-3 space-y-4",children:(0,d.jsx)(D,{connected:H,detected:I,notFound:K,selectedAgentKey:M??o,listCopy:N,onInstallAgent:L,showNotDetected:z,setShowNotDetected:A,p:{rosterLabel:q.rosterLabel,sectionConnected:q.sectionConnected,sectionDetected:q.sectionDetected,sectionNotDetected:q.sectionNotDetected}})})]})}),(0,d.jsxs)("div",{className:"px-3 py-2 border-t border-border shrink-0 space-y-1",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>C(!0),className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,d.jsx)(i.A,{size:11}),q.a2aDiscover]}),(0,d.jsxs)("button",{type:"button",onClick:()=>{window.dispatchEvent(new CustomEvent("mindos:open-settings",{detail:{tab:"mcp"}}))},className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,d.jsx)(j.A,{size:11}),q.advancedConfig]})]}),(0,d.jsx)(E.A,{open:B,onClose:()=>C(!1),onDiscover:F.discover,discovering:F.discovering,error:F.error})]})}},78335:()=>{},78340:(a,b,c)=>{"use strict";c.r(b),c.d(b,{BacklinksRenderer:()=>l});var d=c(48249),e=c(67484),f=c(19099),g=c(80600),h=c(86588),i=c(33191);function j(a){return a.split("/").pop()?.replace(/\.md$/,"")??a}function k({text:a}){let b=a.split(/(\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\))/g);return(0,d.jsx)("span",{children:b.map((a,b)=>/^\[\[/.test(a)||/^\[/.test(a)?(0,d.jsx)("span",{style:{color:"var(--amber)",fontWeight:500},children:a},b):(0,d.jsx)("span",{children:a},b))})}function l({filePath:a}){let b=(0,f.useRouter)(),[c,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!0);if(m)return(0,d.jsx)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",fontSize:12,color:"var(--muted-foreground)"},children:"Scanning backlinks…"});let o=c??[];return(0,d.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsx)("div",{style:{marginBottom:"1.5rem",display:"flex",alignItems:"center",gap:8},children:(0,d.jsx)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:0===o.length?"No backlinks found":`${o.length} file${1===o.length?"":"s"} link here`})}),0===o.length?(0,d.jsxs)("div",{style:{border:"1px dashed var(--border)",borderRadius:10,padding:"2.5rem 1.5rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:13},children:[(0,d.jsx)(g.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,d.jsxs)("p",{className:"font-display",style:{fontSize:12},children:["No other files link to ",(0,d.jsx)("strong",{style:{color:"var(--foreground)"},children:j(a)})," yet."]})]}):(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:o.map(({filePath:a,snippets:c})=>{let e,f=j(a),l=(e=a.split("/")).length>1?e.slice(0,-1).join("/"):"";return(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",cursor:"pointer",transition:"border-color .15s"},onClick:()=>b.push("/view/"+(0,i.O0)(a)),onMouseEnter:a=>a.currentTarget.style.borderColor="rgba(200,135,58,0.4)",onMouseLeave:a=>a.currentTarget.style.borderColor="var(--border)",children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",borderBottom:c.length>0?"1px solid var(--border)":"none",background:"var(--muted)"},children:[(0,d.jsx)(g.A,{size:13,style:{color:"var(--muted-foreground)",flexShrink:0}}),(0,d.jsx)("span",{style:{fontWeight:600,fontSize:"0.85rem",color:"var(--foreground)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f}),l&&(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6,flexShrink:0},children:l}),(0,d.jsx)(h.A,{size:11,style:{color:"var(--muted-foreground)",opacity:.5,flexShrink:0}})]}),c.map((a,b)=>(0,d.jsx)("div",{style:{padding:"8px 14px",borderBottom:b<c.length-1?"1px solid var(--border)":"none",background:"var(--background)"},children:a.split("\n").map((a,b)=>(0,d.jsx)("div",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--muted-foreground)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,d.jsx)(k,{text:a})},b))},b))]},a)})})]})}c(95054)},78890:(a,b,c)=>{"use strict";c.d(b,{G:()=>i,M:()=>j});var d=c(48249),e=c(2116),f=c.n(e),g=c(19794),h=c(33191);function i({icon:a,title:b,subtitle:c,badge:e,href:i,onClick:j,active:k}){let l=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:a}),(0,d.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"block text-left text-sm font-medium text-foreground truncate",title:b,children:b}),c?(0,d.jsx)("span",{className:"block text-left text-2xs text-muted-foreground truncate",title:c,children:c}):null]}),e,(0,d.jsx)(g.A,{size:14,className:"shrink-0 text-muted-foreground"})]}),m=!!k,n=(0,h.cn)("relative flex items-center gap-3 py-2.5 transition-[background-color] duration-150 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",m?"bg-[var(--amber-dim)]/40 pl-3.5 pr-4 text-foreground":"px-4",!m&&"cursor-pointer hover:bg-muted/50",m&&"cursor-default"),o=m?(0,d.jsx)("span",{className:"pointer-events-none absolute bottom-[22%] left-0 top-[22%] w-0.5 rounded-r-full bg-[var(--amber)]","aria-hidden":!0}):null;return i?(0,d.jsxs)(f(),{href:i,className:n,"aria-current":k?"page":void 0,children:[o,l]}):(0,d.jsxs)("button",{type:"button",onClick:j,className:(0,h.cn)(n,"w-full"),children:[o,l]})}function j({label:a}){return(0,d.jsx)("span",{className:"text-2xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground shrink-0",children:a})}},80829:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(46674),g=c(49681),h=c(2797),i=c(69924),j=c(9311),k=c(81285);function l({open:a,onClose:b,anchorRect:c,railWidth:l,onOpenSyncSettings:m,syncStatus:n,onSyncStatusRefresh:o}){let p=(0,e.useRef)(null);(0,e.useRef)(b).current=b;let{syncing:q,syncResult:r,syncNow:s}=(0,j.bj)(o);if(!a||!c)return null;let t=(0,j.Bq)(n,q),{label:u}=(0,j.ky)(t,n),v=Math.max(8,c.bottom-180);return(0,d.jsxs)("div",{ref:p,className:"fixed z-40 w-[240px] border rounded-lg bg-card shadow-lg border-border animate-in fade-in slide-in-from-left-2 duration-150",style:{top:v,left:l},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Sync"}),(0,d.jsx)("button",{onClick:b,className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,d.jsx)(f.A,{size:14})})]}),(0,d.jsxs)("div",{className:"p-3 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${j.BG[t]} ${"syncing"===t||"conflicts"===t||"error"===t?"animate-pulse":""}`}),(0,d.jsx)("span",{className:"text-sm text-foreground",children:u}),"success"===r&&(0,d.jsx)(g.A,{size:14,className:"text-success shrink-0"}),"error"===r&&(0,d.jsx)(h.A,{size:14,className:"text-error shrink-0"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:["off"!==t&&(0,d.jsxs)(k.jn,{onClick:s,disabled:q,className:"text-xs px-3 py-1.5 flex items-center gap-1.5",children:[(0,d.jsx)(i.A,{size:12,className:q?"animate-spin":""}),"Sync Now"]}),(0,d.jsx)("button",{onClick:()=>{m(),b()},className:"text-xs text-muted-foreground hover:text-foreground transition-colors rounded px-1 py-0.5 focus-visible:ring-2 focus-visible:ring-ring",children:"Settings →"})]})]})]})}},80992:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GraphRenderer:()=>j});var d=c(48249),e=c(67484),f=c(19099),g=c(96103),h=c(54633);c(71763),c(95054);let i=(0,e.memo)(function({data:a}){let b=(0,f.useRouter)(),{label:c,id:i,isCurrent:j,isOrphan:k,size:l=1}=a,m=(0,e.useCallback)(()=>{let a=i.split("/").map(encodeURIComponent).join("/");b.push("/view/"+a)},[i,b]),n=.8+Math.min(.1*l,1.2);return(0,d.jsxs)("div",{onClick:m,title:i,className:"group font-display",style:{fontSize:10*n,padding:`${4*n}px ${12*n}px`,borderRadius:999,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap",maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",opacity:k?.4:1,background:j?"var(--amber)":"var(--card)",color:j?"var(--amber-foreground)":"var(--foreground)",border:`1.5px solid ${j?"var(--amber)":"var(--border)"}`,boxShadow:j?"0 0 20px var(--amber-dim), 0 0 0 2px var(--amber-dim)":"0 2px 4px rgba(0,0,0,0.1)",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",zIndex:j?10:1},onMouseEnter:a=>{j||(a.currentTarget.style.borderColor="var(--amber)",a.currentTarget.style.background="var(--accent)")},onMouseLeave:a=>{j||(a.currentTarget.style.borderColor="var(--border)",a.currentTarget.style.background="var(--card)")},children:[(0,d.jsx)(g.h7,{type:"target",position:h.yX.Top,style:{opacity:0}}),c,(0,d.jsx)(g.h7,{type:"source",position:h.yX.Bottom,style:{opacity:0}})]})});function j({filePath:a}){let[b,c]=(0,e.useState)(null),[f,h]=(0,e.useState)(!0),[j,k]=(0,e.useState)("local"),[l,m]=(0,e.useState)(!1),n=(0,e.useMemo)(()=>{if(!b)return new Map;let a=new Map;for(let c of b.edges)a.set(c.source,(a.get(c.source)||0)+1),a.set(c.target,(a.get(c.target)||0)+1);return a},[b]),o=(0,e.useMemo)(()=>{if(!b)return null;let a=new Map;for(let c of b.edges)a.has(c.source)||a.set(c.source,new Set),a.has(c.target)||a.set(c.target,new Set),a.get(c.source).add(c.target),a.get(c.target).add(c.source);return a},[b]),{filteredNodes:p,filteredEdges:q}=(0,e.useMemo)(()=>{let c,d;if(!b)return{filteredNodes:[],filteredEdges:[]};if("global"===j)c=b.nodes,d=b.edges;else{let e=new Set,f=[{id:a,depth:0}];for(e.add(a);f.length>0;){let{id:a,depth:b}=f.shift();if(!(b>=2))for(let c of o?.get(a)??new Set)e.has(c)||(e.add(c),f.push({id:c,depth:b+1}))}let g=new Set((c=b.nodes.filter(a=>e.has(a.id))).map(a=>a.id));d=b.edges.filter(a=>g.has(a.source)&&g.has(a.target))}return{filteredNodes:c,filteredEdges:d}},[b,j,a,o]),r=(0,e.useMemo)(()=>{let a=new Set;for(let b of q)a.add(b.source),a.add(b.target);return a},[q]),{rfNodes:s,rfEdges:t}=(0,e.useMemo)(()=>{if(0===p.length)return{rfNodes:[],rfEdges:[]};let b=function(a,b,c){let d=a.length;if(0===d)return{};let e=(void 0)??(d>100?80:150),f=.6*Math.sqrt(108e4/Math.max(d,1)),g={};a.forEach((a,b)=>{let c=2*Math.PI*b/d,e=360*Math.random();g[a]={x:600+Math.cos(c)*e,y:450+Math.sin(c)*e}});let h={};for(let c=0;c<e;c++){let i=120*(1-c/e);for(let b of a)h[b]={x:0,y:0};for(let b=0;b<d;b++)for(let c=b+1;c<d;c++){let d=a[b],e=a[c],i=g[d].x-g[e].x,j=g[d].y-g[e].y,k=Math.sqrt(i*i+j*j||.01),l=f*f/k;h[d].x+=i/k*l,h[d].y+=j/k*l,h[e].x-=i/k*l,h[e].y-=j/k*l}for(let a of b){let b=a.source,c=a.target;if(!g[b]||!g[c])continue;let d=g[b].x-g[c].x,e=g[b].y-g[c].y,i=Math.sqrt(d*d+e*e||.01),j=i*i/f;h[b].x-=d/i*j,h[b].y-=e/i*j,h[c].x+=d/i*j,h[c].y+=e/i*j}for(let b of a){let a=g[b].x-600,c=g[b].y-450,d=Math.sqrt(a*a+c*c)||.01,e=.05*d;h[b].x-=a/d*e,h[b].y-=c/d*e}for(let b of a){let a=h[b],c=Math.sqrt(a.x*a.x+a.y*a.y)||.01;g[b].x+=a.x/c*Math.min(c,i),g[b].y+=a.y/c*Math.min(c,i),g[b].x=Math.max(0,Math.min(1200,g[b].x)),g[b].y=Math.max(0,Math.min(900,g[b].y))}}return g}(p.map(a=>a.id),q);return{rfNodes:p.map(c=>({id:c.id,type:"wiki",position:b[c.id]??{x:0,y:0},data:{label:c.label,id:c.id,isCurrent:c.id===a,isOrphan:!r.has(c.id),size:n.get(c.id)||1}})),rfEdges:q.map((b,c)=>{let d=b.source===a||b.target===a;return{id:`e-${c}`,source:b.source,target:b.target,type:"default",markerEnd:{type:"arrowclosed",color:d?"var(--amber)":"var(--border)"},style:{stroke:d?"var(--amber)":"var(--border)",strokeWidth:d?1.5:1,opacity:d?.8:.4},animated:d}})}},[p,q,a,r,n]),u=(0,e.useMemo)(()=>({wiki:i}),[]);return!l||f?(0,d.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400,borderRadius:12,background:"var(--muted)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,d.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",fontSize:12},children:f?"Building graph…":"Loading…"})}):(0,d.jsxs)("div",{style:{width:"100%",position:"relative",zIndex:0},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10,flexWrap:"wrap"},children:[(0,d.jsxs)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:[p.length," nodes \xb7 ",q.length," edges"]}),(0,d.jsx)("div",{style:{display:"flex",gap:2,padding:3,borderRadius:8,background:"var(--muted)"},children:[{id:"local",label:"Local"},{id:"global",label:"Global"}].map(a=>(0,d.jsx)("button",{onClick:()=>k(a.id),className:"font-display",style:{padding:"3px 12px",borderRadius:5,fontSize:11,cursor:"pointer",border:"none",outline:"none",background:j===a.id?"var(--card)":"transparent",color:j===a.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:j===a.id?"0 1px 3px rgba(0,0,0,0.1)":"none",transition:"all 0.1s"},children:a.label},a.id))})]}),(0,d.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400},children:(0,d.jsxs)(g.Gc,{nodes:s,edges:t,nodeTypes:u,fitView:!0,fitViewOptions:{padding:.15},proOptions:{hideAttribution:!0},style:{background:"var(--background)",borderRadius:12,border:"1px solid var(--border)"},children:[(0,d.jsx)(g.VS,{color:"var(--border)",gap:24,size:1,variant:g._5.Dots}),(0,d.jsx)(g.H2,{showInteractive:!1}),(0,d.jsx)(g.of,{nodeColor:a=>a.data?.isCurrent?"var(--amber)":"var(--muted-foreground)"})]})})]})}},81057:(a,b,c)=>{"use strict";c.d(b,{Ay:()=>ad,Fo:()=>K,gL:()=>L});var d=c(48249),e=c(67484),f=c(19099),g=c(93491),h=c(33191),i=c(83654),j=c(80600),k=c(40560),l=c(44218),m=c(28330),n=c(86718),o=c(7309),p=c(65032),q=c(24703),r=c(16944),s=c(15273),t=c(12625),u=c(59347),v=c(99829);let w=(0,v.createServerReference)("601154dbe8197d0302b831be5738171c809f1cea77",v.callServer,void 0,v.findSourceMapURL,"createFileAction"),x=(0,v.createServerReference)("60f246fd8da04a0ec8ab76137f28fb7340240d085b",v.callServer,void 0,v.findSourceMapURL,"renameSpaceAction");var y=c(70875);let z=(0,v.createServerReference)("400075e6fbbbd8600f701563efd1216813d5622f6a",v.callServer,void 0,v.findSourceMapURL,"deleteSpaceAction"),A=(0,v.createServerReference)("40bbf2cf0735ba2df4cb23017f1ace350fc0fc4c11",v.callServer,void 0,v.findSourceMapURL,"deleteFolderAction");var B=c(86307),C=c(69626),D=c(99101),E=c(47223),F=c(57056),G=c(29713);let H="show-hidden-files";function I(a){let b=b=>{b.key===H&&a()},c=()=>a();return window.addEventListener("storage",b),window.addEventListener("mindos:hidden-files-changed",c),()=>{window.removeEventListener("storage",b),window.removeEventListener("mindos:hidden-files-changed",c)}}function J(){return!1}function K(a){localStorage.setItem(H,String(a)),window.dispatchEvent(new Event("mindos:hidden-files-changed"))}function L(){return(0,e.useSyncExternalStore)(I,J,()=>!1)}var M=c(24520),N=c(37917),O=c(801);let P=(0,v.createServerReference)("40a7898f1a0cca79522354efc02212027a3f258d22",v.callServer,void 0,v.findSourceMapURL,"convertToSpaceAction");var Q=c(95054);async function R(){try{let a=await (0,Q.n)("/api/settings"),b=a.ai?.provider??"",c=(a.ai?.providers??{})[b];return!!c?.apiKey}catch{return!1}}async function S(a){try{await navigator.clipboard.writeText(a)}catch{}}let T="w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",U="w-full flex items-center gap-2 px-3 py-2 text-sm text-error hover:bg-error/10 transition-colors text-left",V="my-1 border-t border-border/50";function W({x:a,y:b,onClose:c,menuHeight:f,children:g}){let h=(0,e.useRef)(null),i=Math.min(b,window.innerHeight-(f??160)),j=Math.min(a,window.innerWidth-200);return(0,d.jsx)("div",{ref:h,className:"fixed z-50 min-w-[180px] bg-card border border-border rounded-lg shadow-lg py-1",style:{top:i,left:j},children:g})}function X({x:a,y:b,node:c,onClose:e,onRename:g,onNewFile:i,onImport:j,onDelete:k}){let l=(0,f.useRouter)(),{t:m}=(0,E.Y)(),{isPinned:n,togglePin:o}=(0,G.Z)(),p=n(c.path);return(0,d.jsxs)(W,{x:a,y:b,onClose:e,children:[(0,d.jsxs)("button",{className:T,onClick:()=>{i(),e()},children:[(0,d.jsx)(M.A,{size:14,className:"shrink-0"})," ",m.fileTree.newFile]}),(0,d.jsxs)("button",{className:T,onClick:()=>{l.push(`/view/${(0,h.O0)(`${c.path}/INSTRUCTION.md`)}`),e()},children:[(0,d.jsx)(N.A,{size:14,className:"shrink-0"})," ",m.fileTree.viewRules]}),j&&(0,d.jsxs)("button",{className:T,onClick:()=>{j(c.path),e()},children:[(0,d.jsx)(O.A,{size:14,className:"shrink-0"})," ",m.fileTree.importFile]}),(0,d.jsx)("div",{className:V}),(0,d.jsxs)("button",{className:T,onClick:()=>{o(c.path),e()},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${p?"fill-[var(--amber)] text-[var(--amber)]":""}`}),p?m.fileTree.removeFromFavorites:m.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:T,onClick:()=>{S(c.path),e()},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",m.fileTree.copyPath]}),(0,d.jsxs)("button",{className:T,onClick:()=>{g(),e()},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",m.fileTree.renameSpace]}),(0,d.jsx)("div",{className:V}),(0,d.jsxs)("button",{className:U,onClick:()=>{e(),k()},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"}),m.fileTree.deleteSpace]})]})}function Y({x:a,y:b,node:c,onClose:g,onRename:h,onNewFile:i,onDelete:j}){let k=(0,f.useRouter)(),{t:l}=(0,E.Y)(),[m,o]=(0,e.useTransition)(),{isPinned:p,togglePin:q}=(0,G.Z)(),v=p(c.path);return(0,d.jsxs)(W,{x:a,y:b,onClose:g,menuHeight:220,children:[(0,d.jsxs)("button",{className:T,onClick:()=>{i(),g()},children:[(0,d.jsx)(M.A,{size:14,className:"shrink-0"})," ",l.fileTree.newFile]}),(0,d.jsx)("div",{className:V}),(0,d.jsxs)("button",{className:T,onClick:()=>{q(c.path),g()},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${v?"fill-[var(--amber)] text-[var(--amber)]":""}`}),v?l.fileTree.removeFromFavorites:l.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:T,disabled:m,onClick:()=>{o(async()=>{if((await P(c.path)).success){k.refresh(),window.dispatchEvent(new Event("mindos:files-changed"));let a=c.name.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||c.name;R().then(b=>{b&&function(a,b,c=""){let d="u">typeof document&&"zh"===document.documentElement.lang?`初始化新建的心智空间「${a}」,路径为「${b}/」。${c?`描述:「${c}」。`:""}两个文件均已存在模板,用 write_file 覆盖:
146
- 1. 「${b}/README.md」— 写入空间用途、结构概览、使用指南
147
- 2. 「${b}/INSTRUCTION.md」— 写入 AI Agent 在此空间中的行为规则和操作约定
148
-
149
- 内容简洁实用,直接使用工具写入。`:`Initialize the new Mind Space "${a}" at "${b}/". ${c?`Description: "${c}". `:""}Both files already exist with templates — use write_file to overwrite:
150
- 1. "${b}/README.md" — write purpose, structure overview, usage guidelines
151
- 2. "${b}/INSTRUCTION.md" — write rules for AI agents operating in this space
152
-
153
- Keep content concise and actionable. Write files directly using tools.`;window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spaceName:a,spacePath:b,description:c,state:"working"}})),fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:d}],currentFile:b+"/INSTRUCTION.md"})}).then(async a=>{if(!a.ok||!a.body)throw Error(`HTTP ${a.status}`);let c=a.body.getReader();try{for(;;){let{done:a}=await c.read();if(a)break}}finally{c.releaseLock()}window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:b,state:"done"}})),window.dispatchEvent(new Event("mindos:files-changed"))}).catch(()=>{window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:b,state:"error"}}))})}(a,c.path)})}g()})},children:[(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"})," ",l.fileTree.convertToSpace]}),(0,d.jsxs)("button",{className:T,onClick:()=>{S(c.path),g()},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",l.fileTree.copyPath]}),(0,d.jsxs)("button",{className:T,onClick:()=>{h(),g()},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",l.fileTree.rename]}),(0,d.jsx)("div",{className:V}),(0,d.jsxs)("button",{className:U,onClick:()=>{g(),j()},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"}),l.fileTree.deleteFolder]})]})}var Z=c(63710);function $(){window.dispatchEvent(new Event("mindos:files-changed"))}async function _(a){try{await navigator.clipboard.writeText(a)}catch{}}function aa({dirPath:a,depth:b,onDone:c}){let[g,i]=(0,e.useState)(""),[j,l]=(0,e.useTransition)(),[m,n]=(0,e.useState)(""),o=(0,f.useRouter)(),{t:p}=(0,E.Y)(),q=(0,e.useRef)(null),r=(0,e.useCallback)(()=>{let b=g.trim();b?l(async()=>{let d=await w(a,b);d.success&&d.filePath?(c(),o.push(`/view/${(0,h.O0)(d.filePath)}`),o.refresh(),$()):n(d.error||p.fileTree.failed)}):n(p.fileTree.enterFileName)},[g,a,c,o,p]);return(0,d.jsxs)("div",{ref:q,className:"px-2 pb-1",style:{paddingLeft:`${12*b+20}px`},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("input",{autoFocus:!0,type:"text",value:g,onChange:a=>{i(a.target.value),n("")},onKeyDown:a=>{"Enter"===a.key&&r(),"Escape"===a.key&&c()},placeholder:"filename.md",className:" flex-1 bg-muted border border-border rounded px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring "}),j?(0,d.jsx)(k.A,{size:13,className:"text-muted-foreground animate-spin shrink-0"}):(0,d.jsx)("button",{onClick:r,className:"text-xs text-[var(--amber)] hover:text-foreground shrink-0 px-1",children:p.fileTree.create})]}),m&&(0,d.jsx)("p",{className:"text-xs text-error mt-0.5 px-1",children:m})]})}function ab({node:a,depth:b,currentPath:c,onNavigate:i,maxOpenDepth:j,onImport:r}){let s=(0,f.useRouter)(),t=c.startsWith(a.path+"/")||c===a.path,u=!!a.isSpace,[v,w]=(0,e.useState)(0===b||t),[C,G]=(0,e.useState)(!1),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(a.name),[L,M]=(0,e.useTransition)(),N=(0,e.useRef)(null),O=(0,e.useRef)(null),[P,Q]=(0,e.useState)(null),{t:R}=(0,E.Y)(),[S,T]=(0,e.useState)(null),[U,V]=(0,e.useTransition)(),{isDragTarget:W,handleRowDragOver:_,handleRowDragEnter:ab,handleRowDragLeave:ac,handleRowDrop:ae}=function(a,b,c,d){let[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=(0,e.useRef)(null),j=(0,e.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),k=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy",i.current&&(clearTimeout(i.current),i.current=null),f||g(!0))},[f]),l=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation(),g(!0),j(),b||(h.current=setTimeout(()=>{c(!0),h.current=null},500)))},[b,j,c]);return{isDragTarget:f,handleRowDragOver:k,handleRowDragEnter:l,handleRowDragLeave:(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.stopPropagation(),i.current=setTimeout(()=>{g(!1),j(),i.current=null},50))},[j]),handleRowDrop:(0,e.useCallback)(b=>{b.preventDefault(),b.stopPropagation(),g(!1),j(),i.current&&(clearTimeout(i.current),i.current=null);let c=b.dataTransfer.files;c.length>0&&(0,Z.Nh)(Array.from(c),a.path,d)},[a.path,d,j])}}(a,v,w,R),af=(0,e.useCallback)(()=>w(a=>!a),[]);(0,e.useRef)(void 0);let ag=(0,e.useCallback)(b=>{b?.preventDefault(),b?.stopPropagation(),O.current&&(clearTimeout(O.current),O.current=null),K(a.name),I(!0),setTimeout(()=>N.current?.select(),0)},[a.name]),ah=(0,e.useCallback)(()=>{let b=J.trim();b&&b!==a.name?M(async()=>{let c=u?x:y.f,d=await c(a.path,b);d.success&&d.newPath?(I(!1),s.push(`/view/${(0,h.O0)(d.newPath)}`),s.refresh(),$()):I(!1)}):I(!1)},[J,a.name,a.path,s,u]),ai=(0,e.useCallback)(()=>{H||(O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{s.push(`/view/${(0,h.O0)(a.path)}`),i?.(),O.current=null},180))},[H,s,a.path,i]);(0,e.useCallback)(a=>{a.stopPropagation(),af()},[af]);let aj=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),Q({x:a.clientX,y:a.clientY})},[]),ak=u?function a(b){return"file"===b.type?+!g.C.has(b.name):(b.children??[]).reduce((b,c)=>b+a(c),0)}(a):0;if(H)return(0,d.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*b+8}px`},children:[(0,d.jsx)("input",{ref:N,autoFocus:!0,value:J,onChange:a=>K(a.target.value),onKeyDown:a=>{"Enter"===a.key&&ah(),"Escape"===a.key&&I(!1)},onBlur:ah,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),L&&(0,d.jsx)(k.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]});let al=u&&0===b;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:`relative group/dir flex items-center transition-colors duration-100 ${W?"bg-[var(--amber)]/10 rounded-md":""}`,onContextMenu:aj,onDragEnter:ab,onDragOver:_,onDragLeave:ac,onDrop:ae,children:[(0,d.jsx)("button",{onClick:af,className:"shrink-0 p-1 rounded hover:bg-muted text-muted-foreground transition-colors",style:{marginLeft:`${12*b+4}px`},"aria-label":v?`Collapse ${a.name}`:`Expand ${a.name}`,"aria-expanded":v,children:(0,d.jsx)("span",{className:"block transition-transform duration-150",style:{transform:v?"rotate(0deg)":"rotate(-90deg)"},children:(0,d.jsx)(l.A,{size:10})})}),(0,d.jsxs)("button",{type:"button",onClick:ai,draggable:!0,onDragStart:b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.setData("text/mindos-type","directory"),b.dataTransfer.effectAllowed="copy"},className:`
154
- flex-1 flex items-center gap-1.5 px-1 py-1 rounded text-left min-w-0 pr-16
155
- text-sm transition-colors duration-100
156
- hover:bg-muted cursor-default
157
- ${t?"text-foreground":"text-muted-foreground hover:text-foreground"}
158
- `,children:[u?"Inbox"===a.name?(0,d.jsx)(m.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):v?(0,d.jsx)(o.A,{size:14,className:"text-yellow-400 shrink-0"}):(0,d.jsx)(p.A,{size:14,className:"text-yellow-400 shrink-0"}),(0,d.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:a.name}),u&&!v&&(0,d.jsx)("span",{className:"ml-auto text-xs text-muted-foreground shrink-0 tabular-nums pr-1",children:ak})]}),(0,d.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/dir:flex items-center gap-0.5 z-10",children:(0,d.jsx)("button",{type:"button",onClick:a=>{a.preventDefault(),a.stopPropagation();let b=a.currentTarget.getBoundingClientRect();Q({x:b.left,y:b.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,d.jsx)(q.A,{size:14})})})]}),(0,d.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${v?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,d.jsxs)("div",{className:`overflow-hidden ${al?"border-l-2 ml-[18px]":""}`,style:al?{borderColor:"color-mix(in srgb, var(--amber) 30%, transparent)"}:void 0,...!v&&{inert:!0},children:[a.children&&(0,d.jsx)(ad,{nodes:a.children,depth:al?1:b+1,onNavigate:i,maxOpenDepth:j,parentIsSpace:u,onImport:r}),C&&(0,d.jsx)(aa,{dirPath:a.path,depth:al?0:b,onDone:()=>G(!1)})]})}),P&&(u?(0,d.jsx)(X,{x:P.x,y:P.y,node:a,onClose:()=>Q(null),onRename:()=>ag(),onNewFile:()=>{w(!0),G(!0)},onImport:r,onDelete:()=>T("space")}):(0,d.jsx)(Y,{x:P.x,y:P.y,node:a,onClose:()=>Q(null),onRename:()=>ag(),onNewFile:()=>{w(!0),G(!0)},onDelete:()=>T("folder")})),(0,d.jsx)(F.TM,{open:null!==S,title:"space"===S?R.fileTree.deleteSpace:R.fileTree.deleteFolder,message:"space"===S?R.fileTree.confirmDeleteSpace(a.name):R.fileTree.confirmDeleteFolder(a.name),confirmLabel:"space"===S?R.fileTree.deleteSpace:R.fileTree.deleteFolder,cancelLabel:R.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>T(null),onConfirm:()=>{T(null),V(async()=>{let b="space"===S?await z(a.path):await A(a.path);if(b.success&&b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;D.oR.undo(`${R.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,B.Y)(c);a.success?(s.refresh(),$()):D.oR.error(a.error??"Undo failed")},{label:R.trash?.undo??"Undo"}),s.push("/"),s.refresh(),$()}})}})]})}function ac({node:a,depth:b,currentPath:c,onNavigate:l}){let m=(0,f.useRouter)(),n=c===a.path,[o,p]=(0,e.useState)(!1),[v,w]=(0,e.useState)(a.name),[x,z]=(0,e.useTransition)(),[,A]=(0,e.useTransition)(),H=(0,e.useRef)(null),{t:I}=(0,E.Y)(),{isPinned:J,togglePin:K}=(0,G.Z)(),L=J(a.path),M=!a.path.includes("/")&&g.A.has(a.name),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(null),R=(0,e.useCallback)(()=>{o||(m.push(`/view/${(0,h.O0)(a.path)}`),l?.())},[m,a.path,l,o]),S=(0,e.useCallback)(b=>{b.stopPropagation(),w(a.name),p(!0),setTimeout(()=>H.current?.select(),0)},[a.name]),X=(0,e.useCallback)(()=>{let b=v.trim();b&&b!==a.name?z(async()=>{let c=await (0,y.f)(a.path,b);c.success&&c.newPath?(p(!1),m.push(`/view/${(0,h.O0)(c.newPath)}`),m.refresh(),$()):p(!1)}):p(!1)},[v,a.name,a.path,m]),Y=(0,e.useCallback)(a=>{a.stopPropagation(),O(!0)},[]),Z=(0,e.useCallback)(b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.effectAllowed="copy"},[a.path]),aa=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),Q({x:a.clientX,y:a.clientY})},[]);return o?(0,d.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*b+8}px`},children:[(0,d.jsx)("input",{ref:H,autoFocus:!0,value:v,onChange:a=>w(a.target.value),onKeyDown:a=>{"Enter"===a.key&&X(),"Escape"===a.key&&p(!1)},onBlur:X,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),x&&(0,d.jsx)(k.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]}):(0,d.jsxs)("div",{className:"relative group/file",children:[(0,d.jsxs)("button",{onClick:R,onContextMenu:aa,draggable:!0,onDragStart:Z,"data-filepath":a.path,className:`
159
- w-full flex items-center gap-1.5 px-2 py-1 rounded text-left
160
- text-sm transition-colors duration-100 cursor-default pr-16
161
- ${n?"bg-accent text-foreground":"hover:bg-muted text-muted-foreground hover:text-foreground"}
162
- `,style:{paddingLeft:`${12*b+8}px`},children:["directory"===a.type?null:".csv"===a.extension?(0,d.jsx)(i.A,{size:14,className:"text-success shrink-0"}):(0,d.jsx)(j.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:a.name}),L&&(0,d.jsx)(r.A,{size:10,className:"shrink-0 fill-[var(--amber)] text-[var(--amber)] opacity-60"})]}),(0,d.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/file:flex items-center gap-0.5",children:(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation();let b=a.currentTarget.getBoundingClientRect();Q({x:b.left,y:b.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,d.jsx)(q.A,{size:14})})}),P&&(0,d.jsxs)(W,{x:P.x,y:P.y,onClose:()=>Q(null),menuHeight:140,children:[(0,d.jsxs)("button",{className:T,onClick:()=>{_(a.path),Q(null)},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",I.fileTree.copyPath]}),(0,d.jsxs)("button",{className:T,onClick:()=>{K(a.path),Q(null)},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${L?"fill-[var(--amber)] text-[var(--amber)]":""}`}),L?I.fileTree.removeFromFavorites:I.fileTree.pinToFavorites]}),!M&&(0,d.jsxs)("button",{className:T,onClick:a=>{Q(null),S(a)},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",I.fileTree.rename]}),!M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:V}),(0,d.jsxs)("button",{className:U,onClick:a=>{Q(null),Y(a)},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"})," ",I.fileTree.delete]})]})]}),(0,d.jsx)(F.TM,{open:N,title:I.fileTree.delete,message:I.fileTree.confirmDelete(a.name),confirmLabel:I.fileTree.delete,cancelLabel:I.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>O(!1),onConfirm:()=>{O(!1),A(async()=>{let b=await (0,C.i)(a.path);if(b.success){if(b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;D.oR.undo(`${I.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,B.Y)(c);a.success?(m.refresh(),$()):D.oR.error(a.error??"Undo failed")},{label:I.trash?.undo??"Undo"})}m.refresh(),$()}})}})]})}function ad({nodes:a,depth:b=0,onNavigate:c,maxOpenDepth:e,parentIsSpace:h,onImport:i}){var j;let k,l=(k="/view/",(j=(0,f.usePathname)()).startsWith(k)?j.slice(k.length).split("/").map(decodeURIComponent).join("/"):""),m=L(),n=0===b,o=m?a:a.filter(a=>!(n&&a.name.startsWith(".")||"file"===a.type&&g.C.has(a.name)||"directory"===a.type&&a.name.startsWith("."))),p=n?o.filter(a=>"directory"!==a.type||"Inbox"!==a.name):o;return(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:p.map(a=>"directory"===a.type?(0,d.jsx)(ab,{node:a,depth:b,currentPath:l,onNavigate:c,maxOpenDepth:e,onImport:i},a.path):(0,d.jsx)(ac,{node:a,depth:b,currentPath:l,onNavigate:c},a.path))})}},81285:(a,b,c)=>{"use strict";c.d(b,{D0:()=>k,jn:()=>p,l6:()=>n,lM:()=>o,pd:()=>l,yA:()=>m});var d=c(48249),e=c(67484),f=c.n(e),g=c(41479),h=c(61075),i=c(44218),j=c(42742);function k({label:a,hint:b,hintError:c,children:e}){return(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-sm text-foreground font-medium",children:a}),e,b&&(0,d.jsx)("p",{className:`text-xs ${c?"text-destructive":"text-muted-foreground"}`,children:b})]})}function l({className:a="",...b}){return(0,d.jsx)("input",{...b,className:`w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 ${a}`})}function m({value:a,onChange:b,placeholder:c,disabled:f,className:i="",size:j="md"}){let[k,l]=(0,e.useState)(!1),m="sm"===j;return(0,d.jsxs)("div",{className:`flex items-center border border-border rounded-lg bg-background focus-within:ring-1 focus-within:ring-ring overflow-hidden ${i}`,children:[(0,d.jsx)("input",{type:k?"text":"password",value:a,onChange:a=>b(a.target.value),placeholder:c??"••••••••",disabled:f,className:`flex-1 bg-transparent text-foreground placeholder:text-muted-foreground outline-none disabled:opacity-50 ${m?"px-2.5 py-1.5 text-xs font-mono":"px-3 py-2 text-sm"}`}),!!a&&(0,d.jsx)("button",{type:"button",tabIndex:-1,onMouseDown:a=>a.preventDefault(),onClick:()=>l(a=>!a),disabled:f,className:`shrink-0 text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 ${m?"p-1.5":"p-2"}`,title:k?"Hide":"Show",children:k?(0,d.jsx)(g.A,{size:m?14:16}):(0,d.jsx)(h.A,{size:m?14:16})})]})}function n({value:a,onChange:b,children:c,className:g="",disabled:h}){let k=(0,e.useId)(),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(-1),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useMemo)(()=>f().Children.toArray(c).filter(a=>f().isValidElement(a)&&"option"===a.type).map(a=>({value:String(a.props.value??""),label:String(a.props.children??a.props.value??"")})),[c]),s=r.findIndex(b=>b.value===a),t=r[s]?.label??"",u=(0,e.useCallback)(a=>{a>=0&&a<r.length&&(b?.({target:{value:r[a].value}}),m(!1))},[r,b]),v=(0,e.useCallback)(a=>{if(!l){["Enter"," ","ArrowDown","ArrowUp"].includes(a.key)&&(a.preventDefault(),m(!0),o(s>=0?s:0));return}switch(a.key){case"ArrowDown":a.preventDefault(),o(a=>Math.min(a+1,r.length-1));break;case"ArrowUp":a.preventDefault(),o(a=>Math.max(a-1,0));break;case"Enter":case" ":a.preventDefault(),u(n);break;case"Escape":a.preventDefault(),m(!1);break;case"Tab":m(!1)}},[l,r.length,s,n,u]);return(0,d.jsxs)("div",{ref:p,className:`relative ${g}`,children:[(0,d.jsxs)("button",{type:"button",disabled:h,onClick:()=>{m(a=>!a),o(s>=0?s:0)},onKeyDown:v,"aria-haspopup":"listbox","aria-expanded":l,className:"w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground text-left flex items-center justify-between gap-2 outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,d.jsx)("span",{className:`truncate ${t?"":"text-muted-foreground"}`,children:t||"—"}),(0,d.jsx)(i.A,{size:14,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${l?"rotate-180":""}`})]}),l&&(0,d.jsx)("div",{ref:q,role:"listbox","aria-activedescendant":n>=0?`${k}-opt-${n}`:void 0,className:"absolute z-20 w-full mt-1 py-1 border border-border rounded-lg bg-card shadow-lg max-h-60 overflow-auto animate-in fade-in-0 zoom-in-95 duration-100",children:r.map((b,c)=>{let e=b.value===a,f=c===n;return(0,d.jsxs)("button",{id:`${k}-opt-${c}`,role:"option","aria-selected":e,type:"button",onMouseDown:a=>{a.preventDefault(),u(c)},onMouseEnter:()=>o(c),className:`w-full px-3 py-1.5 text-sm text-left flex items-center gap-2 transition-colors ${f?"bg-accent text-accent-foreground":"text-foreground"}`,children:[(0,d.jsx)(j.A,{size:14,className:`shrink-0 ${e?"text-[var(--amber)]":"invisible"}`}),(0,d.jsx)("span",{className:"truncate",children:b.label})]},b.value)})})]})}function o({checked:a,onChange:b,size:c="md",disabled:e,title:f,onClick:g}){let h="sm"===c;return(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:e,title:f,onClick:g??(()=>b?.(!a)),className:`relative inline-flex shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60 ${h?"h-4 w-7":"h-5 w-9"} ${a?"bg-[var(--amber)]":"bg-muted"}`,children:(0,d.jsx)("span",{className:`pointer-events-none inline-block rounded-full bg-white shadow-sm transition-transform ${h?"h-3 w-3":"h-4 w-4"} ${a?h?"translate-x-3":"translate-x-4":"translate-x-0"}`})})}function p({children:a,disabled:b,onClick:c,type:e="button",className:f="",...g}){return(0,d.jsx)("button",{type:e,onClick:c,disabled:b,className:`px-4 py-2 text-sm font-medium rounded-lg bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${f}`,...g,children:a})}},82110:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(48249),e=c(67484),f=c(95801),g=c(93096);function h({results:a,selectedIndex:b,query:c,onSelect:h}){let i=(0,e.useRef)(null),j=(0,e.useRef)(null),[k,l]=(0,e.useState)(280);return 0===a.length?null:(0,d.jsxs)("div",{ref:j,className:"border border-border rounded-lg bg-card shadow-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-1.5",children:[(0,d.jsx)(f.A,{size:11,className:"text-[var(--amber)]/50"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Skills"}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 ml-auto",children:a.length})]}),(0,d.jsx)("div",{ref:i,className:"overflow-y-auto",style:{maxHeight:k},children:a.map((a,e)=>(0,d.jsxs)("button",{type:"button",onMouseDown:b=>{b.preventDefault(),h(a)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors ${e===b?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:[(0,d.jsx)(f.A,{size:13,className:"text-[var(--amber)] shrink-0"}),(0,d.jsxs)("span",{className:"text-sm font-medium shrink-0",children:["/",(0,d.jsx)(g.A,{text:a.name,query:c})]}),a.description&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/50 truncate min-w-0 flex-1",title:a.description,children:a.description})]},a.name))}),(0,d.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex gap-3 text-2xs text-muted-foreground/40 shrink-0",children:[(0,d.jsx)("span",{children:"↑↓ navigate"}),(0,d.jsx)("span",{children:"↵ / Tab select"}),(0,d.jsx)("span",{children:"ESC dismiss"})]})]})}},82626:(a,b,c)=>{"use strict";c.d(b,{A:()=>r});var d=c(48249),e=c(19099),f=c(4815),g=c(46218),h=c(61075),i=c(4140),j=c(78890),k=c(67484),l=c(70971),m=c(8455),n=c(22341);c(95054);var o=c(47223);function p(){let[a,b]=(0,k.useState)(null),[c,e]=(0,k.useState)([]),[f,g]=(0,k.useState)(!0),{t:h}=(0,o.Y)();return f||!a?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:(0,d.jsx)("div",{className:"h-2 w-20 bg-muted rounded animate-pulse"})}):(0,d.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-3 border-t border-border",children:[(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.fileCount}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Files"})]}),(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.unreadChanges}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Changes"})]}),(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.sessionCount}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Chats"})]})]}),c.length>0&&(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-0.5",children:"Recent"}),c.map(a=>{let b=function(a){try{let b=new Date(a),c=new Date().getTime()-b.getTime(),d=Math.floor(c/6e4),e=Math.floor(c/36e5),f=Math.floor(c/864e5);if(d<1)return"now";if(d<60)return`${d}m ago`;if(e<24)return`${e}h ago`;if(f<7)return`${f}d ago`;return b.toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{return"recently"}}(a.ts),c=function(a){switch(a){case"create":return(0,d.jsx)(l.A,{size:12,className:"text-success"});case"write":case"append":return(0,d.jsx)(m.A,{size:12,className:"text-foreground"});case"delete":return(0,d.jsx)(m.A,{size:12,className:"text-destructive"});case"rename":case"move":return(0,d.jsx)(n.A,{size:12,className:"text-muted-foreground"});default:return(0,d.jsx)(m.A,{size:12,className:"text-muted-foreground"})}}(a.op),e=a.path.split("/").pop()||a.path;return(0,d.jsxs)("div",{className:"flex items-start gap-2 p-1.5 rounded hover:bg-muted/40 transition-colors text-xs",children:[(0,d.jsx)("span",{className:"text-muted-foreground shrink-0 mt-0.5",children:c}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-foreground truncate font-medium",title:e,children:e}),(0,d.jsx)("p",{className:"text-muted-foreground text-2xs",children:b})]})]},a.id)})]})]})}var q=c(10072);function r({active:a,maximized:b,onMaximize:c}){let{t:k}=(0,o.Y)(),l=k.panels.echo,m=(0,e.usePathname)()??"",n={imprint:{icon:(0,d.jsx)(f.A,{size:14}),title:l.imprintTitle},growth:{icon:(0,d.jsx)(g.A,{size:14}),title:l.growthTitle},self:{icon:(0,d.jsx)(h.A,{size:14}),title:l.selfTitle}};return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(i.A,{title:l.title,maximized:b,onMaximize:c}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0 flex flex-col",children:[(0,d.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:q.RS.map(a=>{let b=n[a],c=q.AI[a],e=m===c||m.startsWith(`${c}/`);return(0,d.jsx)(j.G,{href:c,icon:b.icon,title:b.title,active:e},a)})}),(0,d.jsx)("div",{className:"mt-auto",children:(0,d.jsx)(p,{})})]})]})}},82704:()=>{},82884:(a,b,c)=>{"use strict";c.d(b,{Un:()=>f});var d=c(67484);let e="mindos-renderer-state-change";function f(a,b,c){let f=`mindos-renderer:${a}:${b}`,g=(0,d.useRef)({key:f,raw:null,parsed:c});return g.current.key!==f&&(g.current={key:f,raw:null,parsed:c}),[(0,d.useSyncExternalStore)(a=>{let b=()=>a();return window.addEventListener("storage",b),window.addEventListener(e,b),()=>{window.removeEventListener("storage",b),window.removeEventListener(e,b)}},()=>{try{let a=localStorage.getItem(f);if(a===g.current.raw)return g.current.parsed;if(null===a)return g.current={key:f,raw:null,parsed:c},c;let b=JSON.parse(a);return g.current={key:f,raw:a,parsed:b},b}catch{return c}},()=>c),(0,d.useCallback)(a=>{try{let b=(()=>{try{let a=localStorage.getItem(f);return null!==a?JSON.parse(a):c}catch{return c}})(),d="function"==typeof a?a(b):a,e=JSON.stringify(d);localStorage.setItem(f,e),g.current={key:f,raw:e,parsed:d}}catch{}window.dispatchEvent(new Event(e))},[f,c])]}},83539:(a,b,c)=>{"use strict";c.r(b),c.d(b,{WorkflowYamlRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call WorkflowYamlRenderer() from the server but WorkflowYamlRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/workflow-yaml/WorkflowYamlRenderer.tsx","WorkflowYamlRenderer")},84197:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(2116),g=c.n(f),h=c(24520),i=c(40560),j=c(95801),k=c(31675),l=c(4140),m=c(47223),n=c(33191);function o({active:a,maximized:b,onMaximize:c}){let{t:f}=(0,m.Y)(),o=f.panels.workflows,[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)(!0),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(""),B=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/workflows");if(!a.ok)return;let b=await a.json();q(b.workflows??[])}catch{}finally{s(!1)}},[]),C=async()=>{let a=v.trim();if(a&&!x){y(!0),A("");try{let b=await fetch("/api/workflows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a})}),c=await b.json();if(!b.ok)return void A(409===b.status?o.exists:c.error||"Error");u(!1),w(""),await B(),window.location.href=`/view/${(0,n.O0)(c.path)}`}catch{A("Network error")}finally{y(!1)}}};return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(l.A,{title:o.title,maximized:b,onMaximize:c,children:(0,d.jsx)("button",{onClick:()=>u(a=>!a),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":o.newWorkflow,title:o.newWorkflow,children:(0,d.jsx)(h.A,{size:13})})}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[t&&(0,d.jsxs)("div",{className:"px-3 py-3 border-b border-border",children:[(0,d.jsx)("label",{className:"block text-xs font-medium text-muted-foreground mb-1.5",children:o.name}),(0,d.jsx)("input",{type:"text",value:v,onChange:a=>{w(a.target.value),A("")},onKeyDown:a=>"Enter"===a.key&&C(),placeholder:o.namePlaceholder,autoFocus:!0,className:"w-full px-2.5 py-1.5 text-sm rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),z&&(0,d.jsx)("p",{className:"text-xs text-[var(--error)] mt-1",children:z}),(0,d.jsxs)("div",{className:"flex gap-2 mt-2.5",children:[(0,d.jsx)("button",{onClick:()=>{u(!1),w(""),A("")},className:"flex-1 px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground hover:bg-muted transition-colors",children:o.cancel}),(0,d.jsx)("button",{onClick:C,disabled:!v.trim()||x,className:"flex-1 px-3 py-1.5 text-xs rounded-md font-medium transition-colors disabled:opacity-50 bg-[var(--amber)] text-[var(--amber-foreground)]",children:x?o.creating:o.create})]})]}),r&&(0,d.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:(0,d.jsx)(i.A,{size:16,className:"animate-spin"})}),!r&&0===p.length&&!t&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:[(0,d.jsx)(j.A,{size:24,className:"text-muted-foreground/40 mb-3"}),(0,d.jsx)("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:o.empty}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-4 max-w-[200px]",children:o.emptyDesc}),(0,d.jsxs)("button",{onClick:()=>u(!0),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md font-medium bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors",children:[(0,d.jsx)(h.A,{size:12}),o.newWorkflow]})]}),!r&&p.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:p.map(a=>(0,d.jsxs)(g(),{href:`/view/${(0,n.O0)(a.path)}`,className:`flex items-start gap-2.5 px-3 py-2 mx-1 rounded-lg transition-colors hover:bg-muted ${a.error?"opacity-70":""}`,children:[(0,d.jsx)(j.A,{size:14,className:"shrink-0 mt-0.5 text-[var(--amber)]"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground block truncate",children:a.title}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[a.error?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-2xs text-[var(--error)]",children:[(0,d.jsx)(k.A,{size:10}),o.parseError]}):(0,d.jsx)("span",{className:"text-2xs text-muted-foreground",children:o.nSteps(a.stepCount)}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/60",suppressHydrationWarning:!0,children:(0,n.KW)(a.mtime,f.home?.relativeTime)})]})]})]},a.path))})]})]})}},84276:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(5735);function e(){return(0,d.jsxs)("div",{className:"content-width px-4 md:px-6 py-10 md:py-14 animate-pulse","aria-busy":"true","aria-label":"Loading",children:[(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,d.jsx)("div",{className:"w-1 h-7 rounded-full bg-muted"}),(0,d.jsx)("div",{className:"h-6 w-28 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"h-4 w-64 bg-muted rounded ml-4 mb-6"}),(0,d.jsxs)("div",{className:"w-full max-w-xl flex flex-col sm:flex-row items-stretch sm:items-center gap-2 ml-4",children:[(0,d.jsx)("div",{className:"flex-1 h-12 rounded-xl bg-muted"}),(0,d.jsx)("div",{className:"h-12 w-16 rounded-xl bg-muted shrink-0"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 mt-4 ml-4",children:[(0,d.jsx)("div",{className:"h-9 w-28 rounded-lg bg-muted"}),(0,d.jsx)("div",{className:"h-9 w-40 rounded-lg bg-muted"})]})]}),(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-4 w-16 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:Array.from({length:6}).map((a,b)=>(0,d.jsxs)("div",{className:"flex items-start gap-3 px-3.5 py-3 rounded-xl border border-border",children:[(0,d.jsx)("div",{className:"w-5 h-5 rounded bg-muted shrink-0 mt-0.5"}),(0,d.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,d.jsx)("div",{className:"h-4 w-20 bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-full bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-12 bg-muted rounded"})]})]},b))})]}),(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-4 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"flex flex-col gap-3",children:Array.from({length:3}).map((a,b)=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-3 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"flex flex-col gap-0.5 ml-2 border-l border-border/40 pl-3",children:Array.from({length:2}).map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2",children:[(0,d.jsx)("div",{className:"w-3 h-3 rounded bg-muted shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,d.jsx)("div",{className:"h-4 w-40 bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"h-3 w-12 bg-muted rounded shrink-0"})]},b))})]},b))})]})]})}},84668:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(31417),g=c(21245);let h="mindos_walkthrough_done";function i(a,b){if(a>=g.g.length||b)try{localStorage.setItem(h,"1")}catch{}fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{walkthroughStep:a,walkthroughDismissed:b}})}).catch(a=>{console.warn("[walkthrough-store] persist failed:",a)})}let j=(0,f.v)((a,b)=>{let c=g.g.length;return{status:"idle",currentStep:0,totalSteps:c,start:()=>{a({currentStep:0,status:"active"}),i(0,!1)},next:()=>{let d=b().currentStep+1;d>=c?(a({status:"completed"}),i(c,!1)):(a({currentStep:d}),i(d,!1))},back:()=>{let c=b().currentStep;c>0&&(a({currentStep:c-1}),i(c-1,!1))},skip:()=>{a({status:"dismissed"}),i(b().currentStep,!0)},_init:()=>{let b="1"===new URLSearchParams(window.location.search).get("welcome");if(b){let a=new URL(window.location.href);a.searchParams.delete("welcome"),window.history.replaceState({},"",a.pathname+(a.search||"")),window.dispatchEvent(new Event("mindos:first-visit"))}return window.innerWidth<768||function(){try{return"1"===localStorage.getItem(h)}catch{return!1}}()?()=>{}:(fetch("/api/setup").then(a=>a.json()).then(d=>{let e=d.guideState;if(e){if(e.walkthroughDismissed||"number"==typeof e.walkthroughStep&&e.walkthroughStep>=c){try{localStorage.setItem(h,"1")}catch{}return}e.active&&!e.dismissed&&void 0===e.walkthroughStep?b&&a({status:"active",currentStep:0}):"number"==typeof e.walkthroughStep&&e.walkthroughStep>=0&&e.walkthroughStep<c&&!e.walkthroughDismissed&&a({status:"active",currentStep:e.walkthroughStep})}}).catch(a=>{console.warn("[walkthrough-store] guideState read failed:",a)}),()=>{})}}});var k=c(47223);function l({stepIndex:a,rect:b,position:c}){let f,g,h=j(),{t:i}=(0,k.Y)(),[l,m]=(0,e.useState)({width:1024,height:768});if(!h)return null;let n=i.walkthrough.steps[a];if(!n)return null;"right"===c?(f=b.top+b.height/2,g=b.right+12):(f=b.bottom+12,g=b.left+b.width/2);let o=l.width-320,p=l.height-200;return g=Math.min(g,o),f=Math.max(f=Math.min(f,p),8),(0,d.jsxs)("div",{className:`fixed z-[102] w-[280px] rounded-xl border shadow-lg animate-in fade-in duration-200 ${"right"===c?"slide-in-from-left-2":"slide-in-from-top-2"}`,style:{top:`${f}px`,left:`${g}px`,transform:"right"===c?"translateY(-50%)":"translateX(-50%)",background:"var(--card)",borderColor:"var(--amber)"},children:[(0,d.jsxs)("div",{className:"p-4",children:[(0,d.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,d.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:i.walkthrough.step(a+1,h.totalSteps)})}),(0,d.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--foreground)"},children:n.title}),(0,d.jsx)("p",{className:"text-xs leading-relaxed",style:{color:"var(--muted-foreground)"},children:n.body}),(0,d.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-3",style:{borderTop:"1px solid var(--border)"},children:[(0,d.jsx)("button",{onClick:h.skip,className:"text-xs transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:i.walkthrough.skip}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[a>0&&(0,d.jsx)("button",{onClick:h.back,className:"text-xs px-2.5 py-1 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:i.walkthrough.back}),(0,d.jsx)("button",{onClick:h.next,className:"text-xs px-3 py-1.5 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a===h.totalSteps-1?i.walkthrough.done:i.walkthrough.next})]})]})]}),(0,d.jsx)("div",{className:"flex items-center justify-center gap-1.5 pb-3",children:Array.from({length:h.totalSteps},(b,c)=>(0,d.jsx)("div",{className:"w-1.5 h-1.5 rounded-full transition-all duration-200",style:{background:c===a?"var(--amber)":"var(--border)",transform:c===a?"scale(1.3)":void 0}},c))})]})}function m(){let a=j(),[b,c]=(0,e.useState)(null),[f,h]=(0,e.useState)(!1),i=(0,e.useId)(),k=a?g.g[a.currentStep]:null;return((0,e.useCallback)(()=>{if(!k)return;let a=document.querySelector(`[data-walkthrough="${k.anchor}"]`);a?c(a.getBoundingClientRect()):c(null)},[k]),a?.skip,a?.currentStep,a&&k)?f?(0,d.jsx)(n,{}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("svg",{className:"fixed inset-0 z-[100] pointer-events-auto",width:"100%",height:"100%",onClick:c=>{if(b){let d=c.clientX,e=c.clientY;d>=b.left-6&&d<=b.right+6&&e>=b.top-6&&e<=b.bottom+6||a.skip()}else a.skip()},children:[(0,d.jsx)("defs",{children:(0,d.jsxs)("mask",{id:i,children:[(0,d.jsx)("rect",{width:"100%",height:"100%",fill:"white"}),b&&(0,d.jsx)("rect",{x:b.left-6,y:b.top-6,width:b.width+12,height:b.height+12,rx:8,ry:8,fill:"black"})]})}),(0,d.jsx)("rect",{width:"100%",height:"100%",fill:"rgba(0, 0, 0, 0.5)",mask:`url(#${i})`})]}),b&&(0,d.jsx)(l,{stepIndex:a.currentStep,rect:b,position:k.position}),!b&&(0,d.jsx)("div",{className:"fixed inset-0 z-[101] flex items-center justify-center pointer-events-none",children:(0,d.jsx)("button",{onClick:a.skip,className:"pointer-events-auto px-4 py-2 text-sm rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a.currentStep===a.totalSteps-1?"✓":"→"})})]}):null}function n(){let a=j(),{t:b}=(0,k.Y)();if(!a)return null;let c=b.walkthrough.steps[a.currentStep];return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-sm",onClick:a.skip}),(0,d.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 z-[101] rounded-t-2xl border-t shadow-lg p-5 pb-8 animate-in slide-in-from-bottom duration-300",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,d.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:b.walkthrough.step(a.currentStep+1,a.totalSteps)}),(0,d.jsx)("div",{className:"flex items-center gap-1 ml-auto",children:Array.from({length:a.totalSteps},(b,c)=>(0,d.jsx)("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:c===a.currentStep?"var(--amber)":"var(--border)"}},c))})]}),(0,d.jsx)("h3",{className:"text-base font-semibold mb-1",style:{color:"var(--foreground)"},children:c.title}),(0,d.jsx)("p",{className:"text-sm leading-relaxed mb-5",style:{color:"var(--muted-foreground)"},children:c.body}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("button",{onClick:a.skip,className:"text-sm transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:b.walkthrough.skip}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[a.currentStep>0&&(0,d.jsx)("button",{onClick:a.back,className:"text-sm px-3 py-2 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:b.walkthrough.back}),(0,d.jsx)("button",{onClick:a.next,className:"text-sm px-4 py-2 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a.currentStep===a.totalSteps-1?b.walkthrough.done:b.walkthrough.next})]})]})]})]}):null}function o(){return"active"===j(a=>a.status)?(0,d.jsx)(m,{}):null}},85034:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/app/error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/app/error.tsx","default")},86307:(a,b,c)=>{"use strict";c.d(b,{Y:()=>e});var d=c(99829);let e=(0,d.createServerReference)("40bcc5793a14a03e9df4d2aaa57df8cab35308b5c5",d.callServer,void 0,d.findSourceMapURL,"undoDeleteAction")},86364:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/svg+xml",sizes:"any",url:(0,d.fillMetadataSegment)(".",await a.params,"icon.svg")+"?3c05474ce4fc06a8"}]},86367:(a,b,c)=>{"use strict";c.d(b,{LD:()=>d,LZ:()=>e,qQ:()=>f});let d=[{id:"c1",icon:"\uD83D\uDC64",category:"memory-sync",scenario:"first-day"},{id:"c2",icon:"\uD83D\uDCE5",category:"knowledge-management",scenario:"daily"},{id:"c3",icon:"\uD83D\uDD04",category:"memory-sync",scenario:"project"},{id:"c4",icon:"\uD83D\uDD01",category:"experience-evolution",scenario:"daily"},{id:"c5",icon:"\uD83D\uDCA1",category:"auto-execute",scenario:"daily"},{id:"c6",icon:"\uD83D\uDE80",category:"auto-execute",scenario:"project"},{id:"c7",icon:"\uD83D\uDD0D",category:"knowledge-management",scenario:"project"},{id:"c8",icon:"\uD83E\uDD1D",category:"human-insights",scenario:"daily"},{id:"c9",icon:"\uD83D\uDEE1️",category:"audit-control",scenario:"advanced"}],e=["knowledge-management","memory-sync","auto-execute","experience-evolution","human-insights","audit-control"],f=["first-day","daily","project","advanced"]},86593:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(97621),g=c(42742),h=c(6079),i=c(46674),j=c(19099),k=c(47223),l=c(33191),m=c(99829);let n=(0,m.createServerReference)("70f94a918fa4b57af3cd27dc53e1d38168b26b7f87",m.callServer,void 0,m.findSourceMapURL,"revertSpaceInitAction");function o(){let[a,b]=(0,e.useState)(null),[c,m]=(0,e.useState)(!1),[o,q]=(0,e.useTransition)(),r=(0,j.useRouter)(),{t:s}=(0,k.Y)(),t=(0,e.useCallback)(()=>{m(!1),setTimeout(()=>b(null),200)},[]);(0,e.useCallback)(a=>{let c=a.detail;"working"===c.state?(b(c),requestAnimationFrame(()=>m(!0))):"done"===c.state?(b(a=>a?{...a,state:"done"}:null),r.refresh()):t()},[r,t]);let u=(0,e.useCallback)(()=>{a&&(t(),r.push(`/view/${(0,l.O0)(a.spacePath+"/")}`))},[a,t,r]),v=(0,e.useCallback)(()=>{a&&q(async()=>{await n(a.spacePath,a.spaceName,a.description),b(a=>a?{...a,state:"reverted"}:null),r.refresh(),window.dispatchEvent(new Event("mindos:files-changed")),setTimeout(t,2e3)})},[a,r,t]),w=(0,e.useCallback)(()=>{t()},[t]);if(!a)return null;let x=s.home,{state:y}=a,z="done"===y,A="reverted"===y;return(0,d.jsx)("div",{className:`fixed bottom-6 left-1/2 z-50 -translate-x-1/2 transition-all duration-200 ease-out ${c?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-3 scale-[0.96] pointer-events-none"}`,children:(0,d.jsxs)("div",{className:"flex items-center gap-2.5 rounded-full border bg-card/95 backdrop-blur py-2 shadow-lg",style:{borderColor:"color-mix(in srgb, var(--amber) 40%, var(--border))",boxShadow:"0 8px 24px color-mix(in srgb, var(--amber) 12%, rgba(0,0,0,.2))",paddingLeft:"0.75rem",paddingRight:z?"0.5rem":"1rem"},children:[(0,d.jsx)("span",{className:`inline-flex h-6 w-6 items-center justify-center rounded-full shrink-0 ${A?"text-muted-foreground bg-muted":"text-[var(--amber)] bg-[var(--amber-subtle)]"} ${"working"===y?"animate-pulse":""}`,children:A?(0,d.jsx)(f.A,{size:12}):z?(0,d.jsx)(g.A,{size:13,strokeWidth:2.5}):(0,d.jsx)(h.A,{size:13})}),(0,d.jsx)("span",{className:"text-xs text-foreground whitespace-nowrap select-none font-medium",children:A?x.aiInitReverted(a.spaceName):z?x.aiInitReady(a.spaceName):(0,d.jsxs)(d.Fragment,{children:[x.aiInitGenerating(a.spaceName),(0,d.jsx)(p,{})]})}),z&&(0,d.jsxs)("div",{className:"flex items-center gap-1 ml-1",children:[(0,d.jsx)("button",{type:"button",onClick:u,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-opacity focus-visible:ring-2 focus-visible:ring-ring",children:x.aiInitReview}),(0,d.jsx)("button",{type:"button",onClick:v,disabled:o,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:x.aiInitDiscard}),(0,d.jsx)("button",{type:"button",onClick:w,"aria-label":"Accept",className:"ml-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors focus-visible:ring-2 focus-visible:ring-ring",children:(0,d.jsx)(i.A,{size:12})})]})]})})}function p(){return(0,d.jsxs)("span",{className:"inline-flex gap-[2px] items-end h-[1em] ml-px",children:[(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_0ms_infinite]"}),(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_200ms_infinite]"}),(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_400ms_infinite]"}),(0,d.jsx)("style",{children:`
163
- @keyframes dotBounce {
164
- 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
165
- 30% { opacity: 1; transform: translateY(-2px); }
166
- }
167
- `})]})}},86771:(a,b,c)=>{Promise.resolve().then(c.bind(c,2420))},89119:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>P});var e=c(48249),f=c(67484),g=c(19099),h=c(2116),i=c.n(h),j=c(9915),k=c(10316),l=c(95581),m=c(46674),n=c(801),o=c(4615),p=c(97916),q=c(81057),r=c(20892),s=c(99791),t=c(74434),u=c(29820),v=c(82626),w=c(84197),x=c(61112),y=c(96716),z=c(2923),A=c(80829),B=c(23017),C=c(73778),D=c(86593),E=c(4949),F=c(9311),G=c(47223),H=c(90314),I=c(2518),J=c(84668);c(4246);var K=c(65141),L=c(13859),M=c(69593);c(99101);var N=c(63710),O=a([x,L]);[x,L]=O.then?(await O)():O;let Q=(0,H.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./SearchModal"]},ssr:!1}),R=(0,H.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./AskModal"]},ssr:!1}),S=(0,H.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./SettingsModal"]},ssr:!1}),T=(0,H.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./CreateSpaceModal"]},ssr:!1}),U=(0,H.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./ImportModal"]},ssr:!1});function P({fileTree:a,children:b}){let c=(0,K.b)(),d=(0,L.$)(),[h,H]=(0,f.useState)(!1),[O,P]=(0,f.useState)(void 0),[V,W]=(0,f.useState)(!1),[X,Y]=(0,f.useState)(null),[Z,$]=(0,f.useState)(null),[_,aa]=(0,f.useState)(()=>y.wl),ab=(0,M.dB)(),[ac,ad]=(0,f.useState)(!1),[ae,af]=(0,f.useState)(0),ag=(0,f.useCallback)(()=>{ad(!1),"organizing"!==ab.phase||ab.abort(),ab.reset()},[ab]),ah=(0,f.useCallback)(()=>{af(a=>a+1),window.dispatchEvent(new Event("mindos:organize-history-update"))},[]),[ai,aj]=(0,f.useState)(!1),[ak,al]=(0,f.useState)(void 0),[am,an]=(0,f.useState)(void 0),[ao,ap]=(0,f.useState)(!1),aq=(0,f.useRef)(0),ar=(0,f.useCallback)(a=>{al(a),an(void 0),aj(!0)},[]),as=(0,f.useCallback)(()=>{aj(!1),al(void 0),an(void 0)},[]),[at,au]=(0,f.useState)(!1),[av,aw]=(0,f.useState)(!1),[ax,ay]=(0,f.useState)(!1),{t:az}=(0,G.Y)(),aA=(0,g.useRouter)(),aB=(0,g.usePathname)(),aC=(0,f.useMemo)(()=>(function a(b,c=""){let d=[];for(let e of b)if("directory"===e.type&&!e.name.startsWith(".")){let b=c?`${c}/${e.name}`:e.name;d.push(b),e.children&&d.push(...a(e.children,b))}return d})(a),[a]),{status:aD,fetchStatus:aE}=(0,F.dW)(),aF=aB.startsWith("/view/")?aB.slice(6).split("/").map(decodeURIComponent).join("/"):void 0,aG=(0,f.useCallback)(()=>{d.askMaximized&&d.toggleAskMaximized()},[d.askMaximized,d.toggleAskMaximized]),aH=aB?.startsWith("/agents"),aI=c.activePanel??(aH?"agents":null);(0,f.useRef)([]);let aJ=(0,f.useCallback)(()=>{let a=()=>window.dispatchEvent(new Event("guide-state-updated"));"guide"===d.askOpenSource?fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{askedAI:!0}})}).then(a).catch(a=>console.warn("Guide state update failed:",a)):"guide-next"===d.askOpenSource&&a()},[d.askOpenSource]),aK=(0,f.useCallback)(a=>{aa(a);try{localStorage.setItem("right-agent-detail-panel-width",String(a))}catch{}},[]),aL=(0,f.useCallback)(()=>$(null),[]),aM=null!==Z&&"agents"===c.activePanel,aN=(0,f.useCallback)(()=>{P("sync"),W(!1),H(!0)},[]),aO=(0,f.useCallback)(()=>{H(!0),P(void 0)},[]),aP=(0,f.useCallback)(()=>{H(!1),P(void 0)},[]),aQ=(0,f.useCallback)(a=>{Y(a),W(a=>!a)},[]),aR=(0,f.useCallback)(a=>{c.handleExpandedChange(a),W(!1)},[c]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I.A,{}),(0,e.jsx)(J.A,{}),(0,e.jsx)("a",{href:"#main-content",className:"sr-only focus-visible:not-sr-only focus-visible:fixed focus-visible:top-2 focus-visible:left-2 focus-visible:z-[60] focus-visible:px-4 focus-visible:py-2 focus-visible:rounded-lg focus-visible:text-sm focus-visible:font-medium bg-[var(--amber)] text-[var(--amber-foreground)]",children:"Skip to main content"}),(0,e.jsx)(o.Ay,{activePanel:aI,onPanelChange:c.setActivePanel,onEchoClick:()=>{aG();let a="echo"===c.activePanel,b=aB?.startsWith("/echo");a?b?c.setActivePanel(null):aA.push("/echo/about-you"):(c.setActivePanel("echo"),aA.push("/echo/about-you"))},onAgentsClick:()=>{aG();let a="agents"===c.activePanel,b=aB?.startsWith("/agents");a?b?c.setActivePanel(null):aA.push("/agents"):(c.setActivePanel("agents"),aA.push("/agents")),$(null)},onDiscoverClick:()=>{aG();let a="discover"===c.activePanel,b=aB?.startsWith("/explore");a?b?c.setActivePanel(null):aA.push("/explore"):(c.setActivePanel("discover"),aA.push("/explore"))},onSpacesClick:()=>{aG();let a="/"===aB,b="files"===c.activePanel,d="/wiki"===aB||aB?.startsWith("/view/")||aB?.startsWith("/wiki/");a||!b?(c.setActivePanel("files"),aA.push("/wiki")):d?c.setActivePanel(null):aA.push("/wiki")},syncStatus:aD,expanded:c.railExpanded,onExpandedChange:aR,onSettingsClick:aO,onSyncClick:aQ}),(0,e.jsxs)(p.Ay,{activePanel:c.activePanel,fileTree:a,onNavigate:()=>{},onOpenSyncSettings:aN,railWidth:c.railWidth,panelWidth:c.panelWidth??void 0,onWidthChange:c.handlePanelWidthChange,onWidthCommit:c.handlePanelWidthCommit,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize,onImport:ar,children:[(0,e.jsx)("div",{className:`flex flex-col h-full ${"echo"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(v.A,{active:"echo"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"search"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(s.A,{active:"search"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"agents"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(t.A,{active:"agents"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize,selectedAgentKey:aM?Z:null})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"discover"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(u.A,{active:"discover"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"workflows"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(w.A,{active:"workflows"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})})]}),(0,e.jsx)(x.Ay,{open:d.askPanelOpen,onClose:d.closeAskPanel,currentFile:aF,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aJ,width:d.askPanelWidth,onWidthChange:d.handleAskWidthChange,onWidthCommit:d.handleAskWidthCommit,askMode:d.askMode,onModeSwitch:d.handleAskModeSwitch,maximized:d.askMaximized,onMaximize:d.toggleAskMaximized,sidebarOffset:c.panelOpen?c.railWidth+c.effectivePanelWidth:c.railWidth}),(0,e.jsx)(y.Ay,{open:aM,agentKey:Z,onClose:aL,rightOffset:d.askPanelOpen?d.askPanelWidth:0,width:_,onWidthChange:aa,onWidthCommit:aK}),(0,e.jsx)(R,{open:d.desktopAskPopupOpen,onClose:d.closeDesktopAskPopup,currentFile:aF,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aJ,askMode:d.askMode,onModeSwitch:d.handleAskModeSwitch}),(0,e.jsx)(z.A,{onToggle:d.toggleAskPanel,askPanelOpen:d.askPanelOpen||d.desktopAskPopupOpen}),(0,e.jsx)(B.A,{}),(0,e.jsx)(S,{open:h,onClose:aP,initialTab:O}),(0,e.jsx)(A.A,{open:V,onClose:()=>W(!1),anchorRect:X,railWidth:c.railWidth,onOpenSyncSettings:aN,syncStatus:aD,onSyncStatusRefresh:aE}),(0,e.jsxs)("header",{className:"md:hidden fixed top-0 left-0 right-0 z-30 bg-card border-b border-border flex items-center justify-between px-3 py-2",style:{paddingTop:"env(safe-area-inset-top, 0px)"},children:[(0,e.jsx)("button",{onClick:()=>au(!0),className:"p-3 -ml-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":"Open menu",children:(0,e.jsx)(j.A,{size:20})}),(0,e.jsxs)(i(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,e.jsx)(r.A,{id:"mobile"}),(0,e.jsx)("span",{className:"text-foreground text-sm font-brand",children:"MindOS"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:aN,className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent flex items-center justify-center","aria-label":"Sync status",children:(0,e.jsx)(F.jc,{status:aD})}),(0,e.jsx)("button",{onClick:()=>aw(!0),className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":az.sidebar.searchTitle,children:(0,e.jsx)(k.A,{size:20})}),(0,e.jsx)("button",{onClick:()=>{H(!0),P(void 0)},className:"p-3 -mr-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":az.sidebar.settingsTitle,children:(0,e.jsx)(l.A,{size:20})})]})]}),at&&(0,e.jsx)("div",{className:"md:hidden fixed inset-0 z-40 overlay-backdrop",onClick:()=>au(!1)}),(0,e.jsxs)("aside",{className:`md:hidden fixed top-0 left-0 h-screen w-[85vw] max-w-[320px] z-50 bg-card border-r border-border flex flex-col transition-transform duration-300 ease-in-out ${at?"translate-x-0":"-translate-x-full"}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-4 border-b border-border shrink-0",children:[(0,e.jsxs)(i(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,e.jsx)(r.A,{id:"drawer"}),(0,e.jsx)("span",{className:"text-foreground text-sm font-brand",children:"MindOS"})]}),(0,e.jsx)("button",{onClick:()=>au(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,e.jsx)(m.A,{size:16})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",children:(0,e.jsx)(q.Ay,{nodes:a,onNavigate:()=>au(!1),onImport:ar})})]}),(0,e.jsx)(Q,{open:av,onClose:()=>aw(!1)}),(0,e.jsx)(R,{open:ax,onClose:()=>ay(!1),currentFile:aF}),(0,e.jsxs)("main",{id:"main-content",className:"min-h-screen transition-all duration-200 pt-[52px] md:pt-0",onDragEnter:a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),aq.current++,1===aq.current&&ap(!0))},onDragOver:a=>{a.dataTransfer.types.includes("Files")&&a.preventDefault()},onDragLeave:()=>{aq.current=Math.max(0,aq.current-1),0===aq.current&&ap(!1)},onDrop:a=>{a.preventDefault(),aq.current=0,ap(!1),a.dataTransfer.files.length>0&&!ai&&(0,N.QL)(Array.from(a.dataTransfer.files),az)},children:[(0,e.jsxs)("div",{className:"min-h-screen bg-background",style:{overflowX:"clip"},children:[(0,e.jsx)(C.A,{}),b]}),(0,e.jsx)(D.A,{}),(0,e.jsx)(T,{t:az,dirPaths:aC}),ao&&!ai&&(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm transition-opacity duration-200",children:(0,e.jsxs)("div",{className:"border-2 border-dashed border-[var(--amber)]/50 rounded-xl p-12 flex flex-col items-center gap-3",children:[(0,e.jsx)(n.A,{size:48,className:"text-[var(--amber)]/60"}),(0,e.jsx)("p",{className:"text-sm text-foreground font-medium",children:az.inbox.dropOverlay}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:az.inbox.dropOverlayFormats})]})})]}),(0,e.jsx)(U,{open:ai,onClose:as,defaultSpace:ak,initialFiles:am,aiOrganize:ab,dirPaths:aC}),ac&&(0,e.jsx)(E.A,{aiOrganize:ab,onDismiss:ag,onCancel:()=>{ab.abort(),ab.reset(),ad(!1)},onHistoryUpdate:ah}),(0,e.jsx)("style",{children:`
172
+ `,children:[h&&(0,d.jsx)("span",{className:"pointer-events-none absolute bottom-[22%] left-0 top-[22%] w-0.5 rounded-r-full bg-[var(--amber)]","aria-hidden":!0}),(0,d.jsx)("span",{className:"text-sm",children:e}),(0,d.jsx)("span",{className:"text-sm flex-1 truncate text-foreground",children:b}),g?(0,d.jsx)(G.A,{size:14,className:"text-success shrink-0"}):(0,d.jsx)(H.A,{size:14,className:"text-border shrink-0"})]},a)})})]})}function K({active:a,maximized:b,onMaximize:c,selectedAgentKey:o=null}){let{t:p}=(0,m.Y)(),q=p.panels.agents,r=(0,f.useRouter)(),s=(0,k.kr)(),u=(0,f.usePathname)(),v=(0,f.useSearchParams)(),w="/agents"===u&&"channels"===v.get("tab"),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),F=(0,l.V)(),G=async()=>{y(!0),await s.refresh(),y(!1)},H=s.agents.filter(a=>a.present&&a.installed),I=s.agents.filter(a=>a.present&&!a.installed),K=s.agents.filter(a=>!a.present),L=async a=>{let b=await s.installAgent(a);return b&&await s.refresh(),b},M=u?.startsWith("/agents/")?decodeURIComponent(u.slice(8)):null,N={installing:q.installing,install:q.install,installSuccess:q.installSuccess,installFailed:q.installFailed,retryInstall:q.retryInstall},O={navOverview:q.navOverview,navMcp:q.navMcp,navSkills:q.navSkills,navChannels:q.channels,navNetwork:q.navNetwork,navSessions:q.navSessions,navActivity:q.navActivity},P=(0,d.jsx)(t,{copy:O,connectedCount:H.length,mcpEnabled:s.status?.connectionMode?.mcp??!1,channelsActive:w,onChannelsClick:()=>{r.push("/agents?tab=channels")}});return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(n.A,{title:q.title,maximized:b,onMaximize:c,children:(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[!s.loading&&(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground",children:[H.length," ",q.connected,F.agents.length>0&&(0,d.jsxs)(d.Fragment,{children:[" \xb7 ",q.a2aLabel," ",F.agents.length]})]}),(0,d.jsx)("button",{onClick:G,disabled:x,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":q.refresh,title:q.refresh,type:"button",children:(0,d.jsx)(g.A,{size:12,className:x?"animate-spin":""})})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:s.loading?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(h.A,{size:16,className:"animate-spin text-muted-foreground"})}):0===s.agents.length&&0===s.skills.length?(0,d.jsxs)("div",{className:"flex flex-col gap-2 py-4 px-0",children:[P,(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),(0,d.jsxs)("div",{className:"mx-3 rounded-lg border border-border/40 bg-card/30 px-3 py-5 text-center",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-1.5",children:q.noAgents}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/40 mb-3",children:q.skillsEmptyHint}),(0,d.jsxs)("button",{onClick:G,type:"button",className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,d.jsx)(g.A,{size:11})," ",q.retry]})]})]}):(0,d.jsxs)("div",{className:"pb-3",children:[P,(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),w?(0,d.jsx)(J,{}):(0,d.jsx)("div",{className:"px-3 py-3 space-y-4",children:(0,d.jsx)(D,{connected:H,detected:I,notFound:K,selectedAgentKey:M??o,listCopy:N,onInstallAgent:L,showNotDetected:z,setShowNotDetected:A,p:{rosterLabel:q.rosterLabel,sectionConnected:q.sectionConnected,sectionDetected:q.sectionDetected,sectionNotDetected:q.sectionNotDetected}})})]})}),(0,d.jsxs)("div",{className:"px-3 py-2 border-t border-border shrink-0 space-y-1",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>C(!0),className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,d.jsx)(i.A,{size:11}),q.a2aDiscover]}),(0,d.jsxs)("button",{type:"button",onClick:()=>{window.dispatchEvent(new CustomEvent("mindos:open-settings",{detail:{tab:"mcp"}}))},className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,d.jsx)(j.A,{size:11}),q.advancedConfig]})]}),(0,d.jsx)(E.A,{open:B,onClose:()=>C(!1),onDiscover:F.discover,discovering:F.discovering,error:F.error})]})}},78335:()=>{},78340:(a,b,c)=>{"use strict";c.r(b),c.d(b,{BacklinksRenderer:()=>l});var d=c(48249),e=c(67484),f=c(19099),g=c(80600),h=c(86588),i=c(33191);function j(a){return a.split("/").pop()?.replace(/\.md$/,"")??a}function k({text:a}){let b=a.split(/(\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\))/g);return(0,d.jsx)("span",{children:b.map((a,b)=>/^\[\[/.test(a)||/^\[/.test(a)?(0,d.jsx)("span",{style:{color:"var(--amber)",fontWeight:500},children:a},b):(0,d.jsx)("span",{children:a},b))})}function l({filePath:a}){let b=(0,f.useRouter)(),[c,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!0);if(m)return(0,d.jsx)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",fontSize:12,color:"var(--muted-foreground)"},children:"Scanning backlinks…"});let o=c??[];return(0,d.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsx)("div",{style:{marginBottom:"1.5rem",display:"flex",alignItems:"center",gap:8},children:(0,d.jsx)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:0===o.length?"No backlinks found":`${o.length} file${1===o.length?"":"s"} link here`})}),0===o.length?(0,d.jsxs)("div",{style:{border:"1px dashed var(--border)",borderRadius:10,padding:"2.5rem 1.5rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:13},children:[(0,d.jsx)(g.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,d.jsxs)("p",{className:"font-display",style:{fontSize:12},children:["No other files link to ",(0,d.jsx)("strong",{style:{color:"var(--foreground)"},children:j(a)})," yet."]})]}):(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:o.map(({filePath:a,snippets:c})=>{let e,f=j(a),l=(e=a.split("/")).length>1?e.slice(0,-1).join("/"):"";return(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",cursor:"pointer",transition:"border-color .15s"},onClick:()=>b.push("/view/"+(0,i.O0)(a)),onMouseEnter:a=>a.currentTarget.style.borderColor="rgba(200,135,58,0.4)",onMouseLeave:a=>a.currentTarget.style.borderColor="var(--border)",children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",borderBottom:c.length>0?"1px solid var(--border)":"none",background:"var(--muted)"},children:[(0,d.jsx)(g.A,{size:13,style:{color:"var(--muted-foreground)",flexShrink:0}}),(0,d.jsx)("span",{style:{fontWeight:600,fontSize:"0.85rem",color:"var(--foreground)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f}),l&&(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6,flexShrink:0},children:l}),(0,d.jsx)(h.A,{size:11,style:{color:"var(--muted-foreground)",opacity:.5,flexShrink:0}})]}),c.map((a,b)=>(0,d.jsx)("div",{style:{padding:"8px 14px",borderBottom:b<c.length-1?"1px solid var(--border)":"none",background:"var(--background)"},children:a.split("\n").map((a,b)=>(0,d.jsx)("div",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--muted-foreground)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,d.jsx)(k,{text:a})},b))},b))]},a)})})]})}c(95054)},78890:(a,b,c)=>{"use strict";c.d(b,{G:()=>i,M:()=>j});var d=c(48249),e=c(2116),f=c.n(e),g=c(19794),h=c(33191);function i({icon:a,title:b,subtitle:c,badge:e,href:i,onClick:j,active:k}){let l=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:a}),(0,d.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"block text-left text-sm font-medium text-foreground truncate",title:b,children:b}),c?(0,d.jsx)("span",{className:"block text-left text-2xs text-muted-foreground truncate",title:c,children:c}):null]}),e,(0,d.jsx)(g.A,{size:14,className:"shrink-0 text-muted-foreground"})]}),m=!!k,n=(0,h.cn)("relative flex items-center gap-3 py-2.5 transition-[background-color] duration-150 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",m?"bg-[var(--amber-dim)]/40 pl-3.5 pr-4 text-foreground":"px-4",!m&&"cursor-pointer hover:bg-muted/50",m&&"cursor-default"),o=m?(0,d.jsx)("span",{className:"pointer-events-none absolute bottom-[22%] left-0 top-[22%] w-0.5 rounded-r-full bg-[var(--amber)]","aria-hidden":!0}):null;return i?(0,d.jsxs)(f(),{href:i,className:n,"aria-current":k?"page":void 0,children:[o,l]}):(0,d.jsxs)("button",{type:"button",onClick:j,className:(0,h.cn)(n,"w-full"),children:[o,l]})}function j({label:a}){return(0,d.jsx)("span",{className:"text-2xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground shrink-0",children:a})}},79241:(a,b,c)=>{"use strict";c.d(b,{i:()=>e});var d=c(99829);let e=(0,d.createServerReference)("405aedd2151a7e91866f880ea819b1fa2244244d8d",d.callServer,void 0,d.findSourceMapURL,"deleteFileAction")},80829:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(46674),g=c(49681),h=c(2797),i=c(69924),j=c(9311),k=c(81285);function l({open:a,onClose:b,anchorRect:c,railWidth:l,onOpenSyncSettings:m,syncStatus:n,onSyncStatusRefresh:o}){let p=(0,e.useRef)(null);(0,e.useRef)(b).current=b;let{syncing:q,syncResult:r,syncNow:s}=(0,j.bj)(o);if(!a||!c)return null;let t=(0,j.Bq)(n,q),{label:u}=(0,j.ky)(t,n),v=Math.max(8,c.bottom-180);return(0,d.jsxs)("div",{ref:p,className:"fixed z-40 w-[240px] border rounded-lg bg-card shadow-lg border-border animate-in fade-in slide-in-from-left-2 duration-150",style:{top:v,left:l},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Sync"}),(0,d.jsx)("button",{onClick:b,className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,d.jsx)(f.A,{size:14})})]}),(0,d.jsxs)("div",{className:"p-3 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${j.BG[t]} ${"syncing"===t||"conflicts"===t||"error"===t?"animate-pulse":""}`}),(0,d.jsx)("span",{className:"text-sm text-foreground",children:u}),"success"===r&&(0,d.jsx)(g.A,{size:14,className:"text-success shrink-0"}),"error"===r&&(0,d.jsx)(h.A,{size:14,className:"text-error shrink-0"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:["off"!==t&&(0,d.jsxs)(k.jn,{onClick:s,disabled:q,className:"text-xs px-3 py-1.5 flex items-center gap-1.5",children:[(0,d.jsx)(i.A,{size:12,className:q?"animate-spin":""}),"Sync Now"]}),(0,d.jsx)("button",{onClick:()=>{m(),b()},className:"text-xs text-muted-foreground hover:text-foreground transition-colors rounded px-1 py-0.5 focus-visible:ring-2 focus-visible:ring-ring",children:"Settings →"})]})]})]})}},80992:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GraphRenderer:()=>j});var d=c(48249),e=c(67484),f=c(19099),g=c(96103),h=c(54633);c(71763),c(95054);let i=(0,e.memo)(function({data:a}){let b=(0,f.useRouter)(),{label:c,id:i,isCurrent:j,isOrphan:k,size:l=1}=a,m=(0,e.useCallback)(()=>{let a=i.split("/").map(encodeURIComponent).join("/");b.push("/view/"+a)},[i,b]),n=.8+Math.min(.1*l,1.2);return(0,d.jsxs)("div",{onClick:m,title:i,className:"group font-display",style:{fontSize:10*n,padding:`${4*n}px ${12*n}px`,borderRadius:999,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap",maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",opacity:k?.4:1,background:j?"var(--amber)":"var(--card)",color:j?"var(--amber-foreground)":"var(--foreground)",border:`1.5px solid ${j?"var(--amber)":"var(--border)"}`,boxShadow:j?"0 0 20px var(--amber-dim), 0 0 0 2px var(--amber-dim)":"0 2px 4px rgba(0,0,0,0.1)",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",zIndex:j?10:1},onMouseEnter:a=>{j||(a.currentTarget.style.borderColor="var(--amber)",a.currentTarget.style.background="var(--accent)")},onMouseLeave:a=>{j||(a.currentTarget.style.borderColor="var(--border)",a.currentTarget.style.background="var(--card)")},children:[(0,d.jsx)(g.h7,{type:"target",position:h.yX.Top,style:{opacity:0}}),c,(0,d.jsx)(g.h7,{type:"source",position:h.yX.Bottom,style:{opacity:0}})]})});function j({filePath:a}){let[b,c]=(0,e.useState)(null),[f,h]=(0,e.useState)(!0),[j,k]=(0,e.useState)("local"),[l,m]=(0,e.useState)(!1),n=(0,e.useMemo)(()=>{if(!b)return new Map;let a=new Map;for(let c of b.edges)a.set(c.source,(a.get(c.source)||0)+1),a.set(c.target,(a.get(c.target)||0)+1);return a},[b]),o=(0,e.useMemo)(()=>{if(!b)return null;let a=new Map;for(let c of b.edges)a.has(c.source)||a.set(c.source,new Set),a.has(c.target)||a.set(c.target,new Set),a.get(c.source).add(c.target),a.get(c.target).add(c.source);return a},[b]),{filteredNodes:p,filteredEdges:q}=(0,e.useMemo)(()=>{let c,d;if(!b)return{filteredNodes:[],filteredEdges:[]};if("global"===j)c=b.nodes,d=b.edges;else{let e=new Set,f=[{id:a,depth:0}];for(e.add(a);f.length>0;){let{id:a,depth:b}=f.shift();if(!(b>=2))for(let c of o?.get(a)??new Set)e.has(c)||(e.add(c),f.push({id:c,depth:b+1}))}let g=new Set((c=b.nodes.filter(a=>e.has(a.id))).map(a=>a.id));d=b.edges.filter(a=>g.has(a.source)&&g.has(a.target))}return{filteredNodes:c,filteredEdges:d}},[b,j,a,o]),r=(0,e.useMemo)(()=>{let a=new Set;for(let b of q)a.add(b.source),a.add(b.target);return a},[q]),{rfNodes:s,rfEdges:t}=(0,e.useMemo)(()=>{if(0===p.length)return{rfNodes:[],rfEdges:[]};let b=function(a,b,c){let d=a.length;if(0===d)return{};let e=(void 0)??(d>100?80:150),f=.6*Math.sqrt(108e4/Math.max(d,1)),g={};a.forEach((a,b)=>{let c=2*Math.PI*b/d,e=360*Math.random();g[a]={x:600+Math.cos(c)*e,y:450+Math.sin(c)*e}});let h={};for(let c=0;c<e;c++){let i=120*(1-c/e);for(let b of a)h[b]={x:0,y:0};for(let b=0;b<d;b++)for(let c=b+1;c<d;c++){let d=a[b],e=a[c],i=g[d].x-g[e].x,j=g[d].y-g[e].y,k=Math.sqrt(i*i+j*j||.01),l=f*f/k;h[d].x+=i/k*l,h[d].y+=j/k*l,h[e].x-=i/k*l,h[e].y-=j/k*l}for(let a of b){let b=a.source,c=a.target;if(!g[b]||!g[c])continue;let d=g[b].x-g[c].x,e=g[b].y-g[c].y,i=Math.sqrt(d*d+e*e||.01),j=i*i/f;h[b].x-=d/i*j,h[b].y-=e/i*j,h[c].x+=d/i*j,h[c].y+=e/i*j}for(let b of a){let a=g[b].x-600,c=g[b].y-450,d=Math.sqrt(a*a+c*c)||.01,e=.05*d;h[b].x-=a/d*e,h[b].y-=c/d*e}for(let b of a){let a=h[b],c=Math.sqrt(a.x*a.x+a.y*a.y)||.01;g[b].x+=a.x/c*Math.min(c,i),g[b].y+=a.y/c*Math.min(c,i),g[b].x=Math.max(0,Math.min(1200,g[b].x)),g[b].y=Math.max(0,Math.min(900,g[b].y))}}return g}(p.map(a=>a.id),q);return{rfNodes:p.map(c=>({id:c.id,type:"wiki",position:b[c.id]??{x:0,y:0},data:{label:c.label,id:c.id,isCurrent:c.id===a,isOrphan:!r.has(c.id),size:n.get(c.id)||1}})),rfEdges:q.map((b,c)=>{let d=b.source===a||b.target===a;return{id:`e-${c}`,source:b.source,target:b.target,type:"default",markerEnd:{type:"arrowclosed",color:d?"var(--amber)":"var(--border)"},style:{stroke:d?"var(--amber)":"var(--border)",strokeWidth:d?1.5:1,opacity:d?.8:.4},animated:d}})}},[p,q,a,r,n]),u=(0,e.useMemo)(()=>({wiki:i}),[]);return!l||f?(0,d.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400,borderRadius:12,background:"var(--muted)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,d.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",fontSize:12},children:f?"Building graph…":"Loading…"})}):(0,d.jsxs)("div",{style:{width:"100%",position:"relative",zIndex:0},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10,flexWrap:"wrap"},children:[(0,d.jsxs)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:[p.length," nodes \xb7 ",q.length," edges"]}),(0,d.jsx)("div",{style:{display:"flex",gap:2,padding:3,borderRadius:8,background:"var(--muted)"},children:[{id:"local",label:"Local"},{id:"global",label:"Global"}].map(a=>(0,d.jsx)("button",{onClick:()=>k(a.id),className:"font-display",style:{padding:"3px 12px",borderRadius:5,fontSize:11,cursor:"pointer",border:"none",outline:"none",background:j===a.id?"var(--card)":"transparent",color:j===a.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:j===a.id?"0 1px 3px rgba(0,0,0,0.1)":"none",transition:"all 0.1s"},children:a.label},a.id))})]}),(0,d.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400},children:(0,d.jsxs)(g.Gc,{nodes:s,edges:t,nodeTypes:u,fitView:!0,fitViewOptions:{padding:.15},proOptions:{hideAttribution:!0},style:{background:"var(--background)",borderRadius:12,border:"1px solid var(--border)"},children:[(0,d.jsx)(g.VS,{color:"var(--border)",gap:24,size:1,variant:g._5.Dots}),(0,d.jsx)(g.H2,{showInteractive:!1}),(0,d.jsx)(g.of,{nodeColor:a=>a.data?.isCurrent?"var(--amber)":"var(--muted-foreground)"})]})})]})}},81285:(a,b,c)=>{"use strict";c.d(b,{D0:()=>k,jn:()=>p,l6:()=>n,lM:()=>o,pd:()=>l,yA:()=>m});var d=c(48249),e=c(67484),f=c.n(e),g=c(41479),h=c(61075),i=c(44218),j=c(42742);function k({label:a,hint:b,hintError:c,children:e}){return(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-sm text-foreground font-medium",children:a}),e,b&&(0,d.jsx)("p",{className:`text-xs ${c?"text-destructive":"text-muted-foreground"}`,children:b})]})}function l({className:a="",...b}){return(0,d.jsx)("input",{...b,className:`w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 ${a}`})}function m({value:a,onChange:b,placeholder:c,disabled:f,className:i="",size:j="md"}){let[k,l]=(0,e.useState)(!1),m="sm"===j;return(0,d.jsxs)("div",{className:`flex items-center border border-border rounded-lg bg-background focus-within:ring-1 focus-within:ring-ring overflow-hidden ${i}`,children:[(0,d.jsx)("input",{type:k?"text":"password",value:a,onChange:a=>b(a.target.value),placeholder:c??"••••••••",disabled:f,className:`flex-1 bg-transparent text-foreground placeholder:text-muted-foreground outline-none disabled:opacity-50 ${m?"px-2.5 py-1.5 text-xs font-mono":"px-3 py-2 text-sm"}`}),!!a&&(0,d.jsx)("button",{type:"button",tabIndex:-1,onMouseDown:a=>a.preventDefault(),onClick:()=>l(a=>!a),disabled:f,className:`shrink-0 text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 ${m?"p-1.5":"p-2"}`,title:k?"Hide":"Show",children:k?(0,d.jsx)(g.A,{size:m?14:16}):(0,d.jsx)(h.A,{size:m?14:16})})]})}function n({value:a,onChange:b,children:c,className:g="",disabled:h}){let k=(0,e.useId)(),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(-1),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useMemo)(()=>f().Children.toArray(c).filter(a=>f().isValidElement(a)&&"option"===a.type).map(a=>({value:String(a.props.value??""),label:String(a.props.children??a.props.value??"")})),[c]),s=r.findIndex(b=>b.value===a),t=r[s]?.label??"",u=(0,e.useCallback)(a=>{a>=0&&a<r.length&&(b?.({target:{value:r[a].value}}),m(!1))},[r,b]),v=(0,e.useCallback)(a=>{if(!l){["Enter"," ","ArrowDown","ArrowUp"].includes(a.key)&&(a.preventDefault(),m(!0),o(s>=0?s:0));return}switch(a.key){case"ArrowDown":a.preventDefault(),o(a=>Math.min(a+1,r.length-1));break;case"ArrowUp":a.preventDefault(),o(a=>Math.max(a-1,0));break;case"Enter":case" ":a.preventDefault(),u(n);break;case"Escape":a.preventDefault(),m(!1);break;case"Tab":m(!1)}},[l,r.length,s,n,u]);return(0,d.jsxs)("div",{ref:p,className:`relative ${g}`,children:[(0,d.jsxs)("button",{type:"button",disabled:h,onClick:()=>{m(a=>!a),o(s>=0?s:0)},onKeyDown:v,"aria-haspopup":"listbox","aria-expanded":l,className:"w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground text-left flex items-center justify-between gap-2 outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,d.jsx)("span",{className:`truncate ${t?"":"text-muted-foreground"}`,children:t||"—"}),(0,d.jsx)(i.A,{size:14,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${l?"rotate-180":""}`})]}),l&&(0,d.jsx)("div",{ref:q,role:"listbox","aria-activedescendant":n>=0?`${k}-opt-${n}`:void 0,className:"absolute z-20 w-full mt-1 py-1 border border-border rounded-lg bg-card shadow-lg max-h-60 overflow-auto animate-in fade-in-0 zoom-in-95 duration-100",children:r.map((b,c)=>{let e=b.value===a,f=c===n;return(0,d.jsxs)("button",{id:`${k}-opt-${c}`,role:"option","aria-selected":e,type:"button",onMouseDown:a=>{a.preventDefault(),u(c)},onMouseEnter:()=>o(c),className:`w-full px-3 py-1.5 text-sm text-left flex items-center gap-2 transition-colors ${f?"bg-accent text-accent-foreground":"text-foreground"}`,children:[(0,d.jsx)(j.A,{size:14,className:`shrink-0 ${e?"text-[var(--amber)]":"invisible"}`}),(0,d.jsx)("span",{className:"truncate",children:b.label})]},b.value)})})]})}function o({checked:a,onChange:b,size:c="md",disabled:e,title:f,onClick:g}){let h="sm"===c;return(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:e,title:f,onClick:g??(()=>b?.(!a)),className:`relative inline-flex shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60 ${h?"h-4 w-7":"h-5 w-9"} ${a?"bg-[var(--amber)]":"bg-muted"}`,children:(0,d.jsx)("span",{className:`pointer-events-none inline-block rounded-full bg-white shadow-sm transition-transform ${h?"h-3 w-3":"h-4 w-4"} ${a?h?"translate-x-3":"translate-x-4":"translate-x-0"}`})})}function p({children:a,disabled:b,onClick:c,type:e="button",className:f="",...g}){return(0,d.jsx)("button",{type:e,onClick:c,disabled:b,className:`px-4 py-2 text-sm font-medium rounded-lg bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${f}`,...g,children:a})}},82110:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(48249),e=c(67484),f=c(95801),g=c(93096);function h({results:a,selectedIndex:b,query:c,onSelect:h}){let i=(0,e.useRef)(null),j=(0,e.useRef)(null),[k,l]=(0,e.useState)(280);return 0===a.length?null:(0,d.jsxs)("div",{ref:j,className:"border border-border rounded-lg bg-card shadow-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-1.5",children:[(0,d.jsx)(f.A,{size:11,className:"text-[var(--amber)]/50"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Skills"}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 ml-auto",children:a.length})]}),(0,d.jsx)("div",{ref:i,className:"overflow-y-auto",style:{maxHeight:k},children:a.map((a,e)=>(0,d.jsxs)("button",{type:"button",onMouseDown:b=>{b.preventDefault(),h(a)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors ${e===b?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:[(0,d.jsx)(f.A,{size:13,className:"text-[var(--amber)] shrink-0"}),(0,d.jsxs)("span",{className:"text-sm font-medium shrink-0",children:["/",(0,d.jsx)(g.A,{text:a.name,query:c})]}),a.description&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/50 truncate min-w-0 flex-1",title:a.description,children:a.description})]},a.name))}),(0,d.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex gap-3 text-2xs text-muted-foreground/40 shrink-0",children:[(0,d.jsx)("span",{children:"↑↓ navigate"}),(0,d.jsx)("span",{children:"↵ / Tab select"}),(0,d.jsx)("span",{children:"ESC dismiss"})]})]})}},82626:(a,b,c)=>{"use strict";c.d(b,{A:()=>r});var d=c(48249),e=c(19099),f=c(4815),g=c(46218),h=c(61075),i=c(4140),j=c(78890),k=c(67484),l=c(70971),m=c(8455),n=c(22341);c(95054);var o=c(47223);function p(){let[a,b]=(0,k.useState)(null),[c,e]=(0,k.useState)([]),[f,g]=(0,k.useState)(!0),{t:h}=(0,o.Y)();return f||!a?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:(0,d.jsx)("div",{className:"h-2 w-20 bg-muted rounded animate-pulse"})}):(0,d.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-3 border-t border-border",children:[(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.fileCount}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Files"})]}),(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.unreadChanges}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Changes"})]}),(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.sessionCount}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Chats"})]})]}),c.length>0&&(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-0.5",children:"Recent"}),c.map(a=>{let b=function(a){try{let b=new Date(a),c=new Date().getTime()-b.getTime(),d=Math.floor(c/6e4),e=Math.floor(c/36e5),f=Math.floor(c/864e5);if(d<1)return"now";if(d<60)return`${d}m ago`;if(e<24)return`${e}h ago`;if(f<7)return`${f}d ago`;return b.toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{return"recently"}}(a.ts),c=function(a){switch(a){case"create":return(0,d.jsx)(l.A,{size:12,className:"text-success"});case"write":case"append":return(0,d.jsx)(m.A,{size:12,className:"text-foreground"});case"delete":return(0,d.jsx)(m.A,{size:12,className:"text-destructive"});case"rename":case"move":return(0,d.jsx)(n.A,{size:12,className:"text-muted-foreground"});default:return(0,d.jsx)(m.A,{size:12,className:"text-muted-foreground"})}}(a.op),e=a.path.split("/").pop()||a.path;return(0,d.jsxs)("div",{className:"flex items-start gap-2 p-1.5 rounded hover:bg-muted/40 transition-colors text-xs",children:[(0,d.jsx)("span",{className:"text-muted-foreground shrink-0 mt-0.5",children:c}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-foreground truncate font-medium",title:e,children:e}),(0,d.jsx)("p",{className:"text-muted-foreground text-2xs",children:b})]})]},a.id)})]})]})}var q=c(10072);function r({active:a,maximized:b,onMaximize:c}){let{t:k}=(0,o.Y)(),l=k.panels.echo,m=(0,e.usePathname)()??"",n={imprint:{icon:(0,d.jsx)(f.A,{size:14}),title:l.imprintTitle},growth:{icon:(0,d.jsx)(g.A,{size:14}),title:l.growthTitle},self:{icon:(0,d.jsx)(h.A,{size:14}),title:l.selfTitle}};return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(i.A,{title:l.title,maximized:b,onMaximize:c}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0 flex flex-col",children:[(0,d.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:q.RS.map(a=>{let b=n[a],c=q.AI[a],e=m===c||m.startsWith(`${c}/`);return(0,d.jsx)(j.G,{href:c,icon:b.icon,title:b.title,active:e},a)})}),(0,d.jsx)("div",{className:"mt-auto",children:(0,d.jsx)(p,{})})]})]})}},82704:()=>{},82884:(a,b,c)=>{"use strict";c.d(b,{Un:()=>f});var d=c(67484);let e="mindos-renderer-state-change";function f(a,b,c){let f=`mindos-renderer:${a}:${b}`,g=(0,d.useRef)({key:f,raw:null,parsed:c});return g.current.key!==f&&(g.current={key:f,raw:null,parsed:c}),[(0,d.useSyncExternalStore)(a=>{let b=()=>a();return window.addEventListener("storage",b),window.addEventListener(e,b),()=>{window.removeEventListener("storage",b),window.removeEventListener(e,b)}},()=>{try{let a=localStorage.getItem(f);if(a===g.current.raw)return g.current.parsed;if(null===a)return g.current={key:f,raw:null,parsed:c},c;let b=JSON.parse(a);return g.current={key:f,raw:a,parsed:b},b}catch{return c}},()=>c),(0,d.useCallback)(a=>{try{let b=(()=>{try{let a=localStorage.getItem(f);return null!==a?JSON.parse(a):c}catch{return c}})(),d="function"==typeof a?a(b):a,e=JSON.stringify(d);localStorage.setItem(f,e),g.current={key:f,raw:e,parsed:d}}catch{}window.dispatchEvent(new Event(e))},[f,c])]}},83539:(a,b,c)=>{"use strict";c.r(b),c.d(b,{WorkflowYamlRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call WorkflowYamlRenderer() from the server but WorkflowYamlRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/workflow-yaml/WorkflowYamlRenderer.tsx","WorkflowYamlRenderer")},84197:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(2116),g=c.n(f),h=c(24520),i=c(40560),j=c(95801),k=c(31675),l=c(4140),m=c(47223),n=c(33191);function o({active:a,maximized:b,onMaximize:c}){let{t:f}=(0,m.Y)(),o=f.panels.workflows,[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)(!0),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(""),B=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/workflows");if(!a.ok)return;let b=await a.json();q(b.workflows??[])}catch{}finally{s(!1)}},[]),C=async()=>{let a=v.trim();if(a&&!x){y(!0),A("");try{let b=await fetch("/api/workflows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a})}),c=await b.json();if(!b.ok)return void A(409===b.status?o.exists:c.error||"Error");u(!1),w(""),await B(),window.location.href=`/view/${(0,n.O0)(c.path)}`}catch{A("Network error")}finally{y(!1)}}};return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(l.A,{title:o.title,maximized:b,onMaximize:c,children:(0,d.jsx)("button",{onClick:()=>u(a=>!a),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":o.newWorkflow,title:o.newWorkflow,children:(0,d.jsx)(h.A,{size:13})})}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[t&&(0,d.jsxs)("div",{className:"px-3 py-3 border-b border-border",children:[(0,d.jsx)("label",{className:"block text-xs font-medium text-muted-foreground mb-1.5",children:o.name}),(0,d.jsx)("input",{type:"text",value:v,onChange:a=>{w(a.target.value),A("")},onKeyDown:a=>"Enter"===a.key&&C(),placeholder:o.namePlaceholder,autoFocus:!0,className:"w-full px-2.5 py-1.5 text-sm rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),z&&(0,d.jsx)("p",{className:"text-xs text-[var(--error)] mt-1",children:z}),(0,d.jsxs)("div",{className:"flex gap-2 mt-2.5",children:[(0,d.jsx)("button",{onClick:()=>{u(!1),w(""),A("")},className:"flex-1 px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground hover:bg-muted transition-colors",children:o.cancel}),(0,d.jsx)("button",{onClick:C,disabled:!v.trim()||x,className:"flex-1 px-3 py-1.5 text-xs rounded-md font-medium transition-colors disabled:opacity-50 bg-[var(--amber)] text-[var(--amber-foreground)]",children:x?o.creating:o.create})]})]}),r&&(0,d.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:(0,d.jsx)(i.A,{size:16,className:"animate-spin"})}),!r&&0===p.length&&!t&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:[(0,d.jsx)(j.A,{size:24,className:"text-muted-foreground/40 mb-3"}),(0,d.jsx)("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:o.empty}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-4 max-w-[200px]",children:o.emptyDesc}),(0,d.jsxs)("button",{onClick:()=>u(!0),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md font-medium bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors",children:[(0,d.jsx)(h.A,{size:12}),o.newWorkflow]})]}),!r&&p.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:p.map(a=>(0,d.jsxs)(g(),{href:`/view/${(0,n.O0)(a.path)}`,className:`flex items-start gap-2.5 px-3 py-2 mx-1 rounded-lg transition-colors hover:bg-muted ${a.error?"opacity-70":""}`,children:[(0,d.jsx)(j.A,{size:14,className:"shrink-0 mt-0.5 text-[var(--amber)]"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground block truncate",children:a.title}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[a.error?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-2xs text-[var(--error)]",children:[(0,d.jsx)(k.A,{size:10}),o.parseError]}):(0,d.jsx)("span",{className:"text-2xs text-muted-foreground",children:o.nSteps(a.stepCount)}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/60",suppressHydrationWarning:!0,children:(0,n.KW)(a.mtime,f.home?.relativeTime)})]})]})]},a.path))})]})]})}},84276:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(5735);function e(){return(0,d.jsxs)("div",{className:"content-width px-4 md:px-6 py-10 md:py-14 animate-pulse","aria-busy":"true","aria-label":"Loading",children:[(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,d.jsx)("div",{className:"w-1 h-7 rounded-full bg-muted"}),(0,d.jsx)("div",{className:"h-6 w-28 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"h-4 w-64 bg-muted rounded ml-4 mb-6"}),(0,d.jsxs)("div",{className:"w-full max-w-xl flex flex-col sm:flex-row items-stretch sm:items-center gap-2 ml-4",children:[(0,d.jsx)("div",{className:"flex-1 h-12 rounded-xl bg-muted"}),(0,d.jsx)("div",{className:"h-12 w-16 rounded-xl bg-muted shrink-0"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 mt-4 ml-4",children:[(0,d.jsx)("div",{className:"h-9 w-28 rounded-lg bg-muted"}),(0,d.jsx)("div",{className:"h-9 w-40 rounded-lg bg-muted"})]})]}),(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-4 w-16 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:Array.from({length:6}).map((a,b)=>(0,d.jsxs)("div",{className:"flex items-start gap-3 px-3.5 py-3 rounded-xl border border-border",children:[(0,d.jsx)("div",{className:"w-5 h-5 rounded bg-muted shrink-0 mt-0.5"}),(0,d.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,d.jsx)("div",{className:"h-4 w-20 bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-full bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-12 bg-muted rounded"})]})]},b))})]}),(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-4 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"flex flex-col gap-3",children:Array.from({length:3}).map((a,b)=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-3 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"flex flex-col gap-0.5 ml-2 border-l border-border/40 pl-3",children:Array.from({length:2}).map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2",children:[(0,d.jsx)("div",{className:"w-3 h-3 rounded bg-muted shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,d.jsx)("div",{className:"h-4 w-40 bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"h-3 w-12 bg-muted rounded shrink-0"})]},b))})]},b))})]})]})}},84668:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(31417),g=c(21245);let h="mindos_walkthrough_done";function i(a,b){if(a>=g.g.length||b)try{localStorage.setItem(h,"1")}catch{}fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{walkthroughStep:a,walkthroughDismissed:b}})}).catch(a=>{console.warn("[walkthrough-store] persist failed:",a)})}let j=(0,f.v)((a,b)=>{let c=g.g.length;return{status:"idle",currentStep:0,totalSteps:c,start:()=>{a({currentStep:0,status:"active"}),i(0,!1)},next:()=>{let d=b().currentStep+1;d>=c?(a({status:"completed"}),i(c,!1)):(a({currentStep:d}),i(d,!1))},back:()=>{let c=b().currentStep;c>0&&(a({currentStep:c-1}),i(c-1,!1))},skip:()=>{a({status:"dismissed"}),i(b().currentStep,!0)},_init:()=>{let b="1"===new URLSearchParams(window.location.search).get("welcome");if(b){let a=new URL(window.location.href);a.searchParams.delete("welcome"),window.history.replaceState({},"",a.pathname+(a.search||"")),window.dispatchEvent(new Event("mindos:first-visit"))}return window.innerWidth<768||function(){try{return"1"===localStorage.getItem(h)}catch{return!1}}()?()=>{}:(fetch("/api/setup").then(a=>a.json()).then(d=>{let e=d.guideState;if(e){if(e.walkthroughDismissed||"number"==typeof e.walkthroughStep&&e.walkthroughStep>=c){try{localStorage.setItem(h,"1")}catch{}return}e.active&&!e.dismissed&&void 0===e.walkthroughStep?b&&a({status:"active",currentStep:0}):"number"==typeof e.walkthroughStep&&e.walkthroughStep>=0&&e.walkthroughStep<c&&!e.walkthroughDismissed&&a({status:"active",currentStep:e.walkthroughStep})}}).catch(a=>{console.warn("[walkthrough-store] guideState read failed:",a)}),()=>{})}}});var k=c(47223);function l({stepIndex:a,rect:b,position:c}){let f,g,h=j(),{t:i}=(0,k.Y)(),[l,m]=(0,e.useState)({width:1024,height:768});if(!h)return null;let n=i.walkthrough.steps[a];if(!n)return null;"right"===c?(f=b.top+b.height/2,g=b.right+12):(f=b.bottom+12,g=b.left+b.width/2);let o=l.width-320,p=l.height-200;return g=Math.min(g,o),f=Math.max(f=Math.min(f,p),8),(0,d.jsxs)("div",{className:`fixed z-[102] w-[280px] rounded-xl border shadow-lg animate-in fade-in duration-200 ${"right"===c?"slide-in-from-left-2":"slide-in-from-top-2"}`,style:{top:`${f}px`,left:`${g}px`,transform:"right"===c?"translateY(-50%)":"translateX(-50%)",background:"var(--card)",borderColor:"var(--amber)"},children:[(0,d.jsxs)("div",{className:"p-4",children:[(0,d.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,d.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:i.walkthrough.step(a+1,h.totalSteps)})}),(0,d.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--foreground)"},children:n.title}),(0,d.jsx)("p",{className:"text-xs leading-relaxed",style:{color:"var(--muted-foreground)"},children:n.body}),(0,d.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-3",style:{borderTop:"1px solid var(--border)"},children:[(0,d.jsx)("button",{onClick:h.skip,className:"text-xs transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:i.walkthrough.skip}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[a>0&&(0,d.jsx)("button",{onClick:h.back,className:"text-xs px-2.5 py-1 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:i.walkthrough.back}),(0,d.jsx)("button",{onClick:h.next,className:"text-xs px-3 py-1.5 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a===h.totalSteps-1?i.walkthrough.done:i.walkthrough.next})]})]})]}),(0,d.jsx)("div",{className:"flex items-center justify-center gap-1.5 pb-3",children:Array.from({length:h.totalSteps},(b,c)=>(0,d.jsx)("div",{className:"w-1.5 h-1.5 rounded-full transition-all duration-200",style:{background:c===a?"var(--amber)":"var(--border)",transform:c===a?"scale(1.3)":void 0}},c))})]})}function m(){let a=j(),[b,c]=(0,e.useState)(null),[f,h]=(0,e.useState)(!1),i=(0,e.useId)(),k=a?g.g[a.currentStep]:null;return((0,e.useCallback)(()=>{if(!k)return;let a=document.querySelector(`[data-walkthrough="${k.anchor}"]`);a?c(a.getBoundingClientRect()):c(null)},[k]),a?.skip,a?.currentStep,a&&k)?f?(0,d.jsx)(n,{}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("svg",{className:"fixed inset-0 z-[100] pointer-events-auto",width:"100%",height:"100%",onClick:c=>{if(b){let d=c.clientX,e=c.clientY;d>=b.left-6&&d<=b.right+6&&e>=b.top-6&&e<=b.bottom+6||a.skip()}else a.skip()},children:[(0,d.jsx)("defs",{children:(0,d.jsxs)("mask",{id:i,children:[(0,d.jsx)("rect",{width:"100%",height:"100%",fill:"white"}),b&&(0,d.jsx)("rect",{x:b.left-6,y:b.top-6,width:b.width+12,height:b.height+12,rx:8,ry:8,fill:"black"})]})}),(0,d.jsx)("rect",{width:"100%",height:"100%",fill:"rgba(0, 0, 0, 0.5)",mask:`url(#${i})`})]}),b&&(0,d.jsx)(l,{stepIndex:a.currentStep,rect:b,position:k.position}),!b&&(0,d.jsx)("div",{className:"fixed inset-0 z-[101] flex items-center justify-center pointer-events-none",children:(0,d.jsx)("button",{onClick:a.skip,className:"pointer-events-auto px-4 py-2 text-sm rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a.currentStep===a.totalSteps-1?"✓":"→"})})]}):null}function n(){let a=j(),{t:b}=(0,k.Y)();if(!a)return null;let c=b.walkthrough.steps[a.currentStep];return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-sm",onClick:a.skip}),(0,d.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 z-[101] rounded-t-2xl border-t shadow-lg p-5 pb-8 animate-in slide-in-from-bottom duration-300",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,d.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:b.walkthrough.step(a.currentStep+1,a.totalSteps)}),(0,d.jsx)("div",{className:"flex items-center gap-1 ml-auto",children:Array.from({length:a.totalSteps},(b,c)=>(0,d.jsx)("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:c===a.currentStep?"var(--amber)":"var(--border)"}},c))})]}),(0,d.jsx)("h3",{className:"text-base font-semibold mb-1",style:{color:"var(--foreground)"},children:c.title}),(0,d.jsx)("p",{className:"text-sm leading-relaxed mb-5",style:{color:"var(--muted-foreground)"},children:c.body}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("button",{onClick:a.skip,className:"text-sm transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:b.walkthrough.skip}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[a.currentStep>0&&(0,d.jsx)("button",{onClick:a.back,className:"text-sm px-3 py-2 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:b.walkthrough.back}),(0,d.jsx)("button",{onClick:a.next,className:"text-sm px-4 py-2 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a.currentStep===a.totalSteps-1?b.walkthrough.done:b.walkthrough.next})]})]})]})]}):null}function o(){return"active"===j(a=>a.status)?(0,d.jsx)(m,{}):null}},85034:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/app/error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/app/error.tsx","default")},85445:(a,b,c)=>{"use strict";c.d(b,{f:()=>e});var d=c(99829);let e=(0,d.createServerReference)("60f73022b80fe6341f846867a83401d51ae7d5be3a",d.callServer,void 0,d.findSourceMapURL,"renameFileAction")},86364:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/svg+xml",sizes:"any",url:(0,d.fillMetadataSegment)(".",await a.params,"icon.svg")+"?3c05474ce4fc06a8"}]},86367:(a,b,c)=>{"use strict";c.d(b,{LD:()=>d,LZ:()=>e,qQ:()=>f});let d=[{id:"c1",icon:"\uD83D\uDC64",category:"memory-sync",scenario:"first-day"},{id:"c2",icon:"\uD83D\uDCE5",category:"knowledge-management",scenario:"daily"},{id:"c3",icon:"\uD83D\uDD04",category:"memory-sync",scenario:"project"},{id:"c4",icon:"\uD83D\uDD01",category:"experience-evolution",scenario:"daily"},{id:"c5",icon:"\uD83D\uDCA1",category:"auto-execute",scenario:"daily"},{id:"c6",icon:"\uD83D\uDE80",category:"auto-execute",scenario:"project"},{id:"c7",icon:"\uD83D\uDD0D",category:"knowledge-management",scenario:"project"},{id:"c8",icon:"\uD83E\uDD1D",category:"human-insights",scenario:"daily"},{id:"c9",icon:"\uD83D\uDEE1️",category:"audit-control",scenario:"advanced"}],e=["knowledge-management","memory-sync","auto-execute","experience-evolution","human-insights","audit-control"],f=["first-day","daily","project","advanced"]},86771:(a,b,c)=>{Promise.resolve().then(c.bind(c,2420))},89119:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>P});var e=c(48249),f=c(67484),g=c(19099),h=c(2116),i=c.n(h),j=c(9915),k=c(10316),l=c(95581),m=c(46674),n=c(801),o=c(4615),p=c(39139),q=c(60407),r=c(20892),s=c(99791),t=c(74434),u=c(29820),v=c(82626),w=c(84197),x=c(61112),y=c(96716),z=c(2923),A=c(80829),B=c(23017),C=c(73778),D=c(39876),E=c(4949),F=c(9311),G=c(47223),H=c(90314),I=c(2518),J=c(84668);c(4246);var K=c(65141),L=c(13859),M=c(69593);c(99101);var N=c(63710),O=a([x,L]);[x,L]=O.then?(await O)():O;let Q=(0,H.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./SearchModal"]},ssr:!1}),R=(0,H.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./AskModal"]},ssr:!1}),S=(0,H.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./SettingsModal"]},ssr:!1}),T=(0,H.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./CreateSpaceModal"]},ssr:!1}),U=(0,H.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./ImportModal"]},ssr:!1});function P({fileTree:a,children:b}){let c=(0,K.b)(),d=(0,L.$)(),[h,H]=(0,f.useState)(!1),[O,P]=(0,f.useState)(void 0),[V,W]=(0,f.useState)(!1),[X,Y]=(0,f.useState)(null),[Z,$]=(0,f.useState)(null),[_,aa]=(0,f.useState)(()=>y.wl),ab=(0,M.dB)(),[ac,ad]=(0,f.useState)(!1),[ae,af]=(0,f.useState)(0),ag=(0,f.useCallback)(()=>{ad(!1),"organizing"!==ab.phase||ab.abort(),ab.reset()},[ab]),ah=(0,f.useCallback)(()=>{af(a=>a+1),window.dispatchEvent(new Event("mindos:organize-history-update"))},[]),[ai,aj]=(0,f.useState)(!1),[ak,al]=(0,f.useState)(void 0),[am,an]=(0,f.useState)(void 0),[ao,ap]=(0,f.useState)(!1),aq=(0,f.useRef)(0),ar=(0,f.useCallback)(a=>{al(a),an(void 0),aj(!0)},[]),as=(0,f.useCallback)(()=>{aj(!1),al(void 0),an(void 0)},[]),[at,au]=(0,f.useState)(!1),[av,aw]=(0,f.useState)(!1),[ax,ay]=(0,f.useState)(!1),{t:az}=(0,G.Y)(),aA=(0,g.useRouter)(),aB=(0,g.usePathname)(),aC=(0,f.useMemo)(()=>(function a(b,c=""){let d=[];for(let e of b)if("directory"===e.type&&!e.name.startsWith(".")){let b=c?`${c}/${e.name}`:e.name;d.push(b),e.children&&d.push(...a(e.children,b))}return d})(a),[a]),{status:aD,fetchStatus:aE}=(0,F.dW)(),aF=aB.startsWith("/view/")?aB.slice(6).split("/").map(decodeURIComponent).join("/"):void 0,aG=(0,f.useCallback)(()=>{d.askMaximized&&d.toggleAskMaximized()},[d.askMaximized,d.toggleAskMaximized]),aH=aB?.startsWith("/agents"),aI=c.activePanel??(aH?"agents":null);(0,f.useRef)([]);let aJ=(0,f.useCallback)(()=>{let a=()=>window.dispatchEvent(new Event("guide-state-updated"));"guide"===d.askOpenSource?fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{askedAI:!0}})}).then(a).catch(a=>console.warn("Guide state update failed:",a)):"guide-next"===d.askOpenSource&&a()},[d.askOpenSource]),aK=(0,f.useCallback)(a=>{aa(a);try{localStorage.setItem("right-agent-detail-panel-width",String(a))}catch{}},[]),aL=(0,f.useCallback)(()=>$(null),[]),aM=null!==Z&&"agents"===c.activePanel,aN=(0,f.useCallback)(()=>{P("sync"),W(!1),H(!0)},[]),aO=(0,f.useCallback)(()=>{H(!0),P(void 0)},[]),aP=(0,f.useCallback)(()=>{H(!1),P(void 0)},[]),aQ=(0,f.useCallback)(a=>{Y(a),W(a=>!a)},[]),aR=(0,f.useCallback)(a=>{c.handleExpandedChange(a),W(!1)},[c]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I.A,{}),(0,e.jsx)(J.A,{}),(0,e.jsx)("a",{href:"#main-content",className:"sr-only focus-visible:not-sr-only focus-visible:fixed focus-visible:top-2 focus-visible:left-2 focus-visible:z-[60] focus-visible:px-4 focus-visible:py-2 focus-visible:rounded-lg focus-visible:text-sm focus-visible:font-medium bg-[var(--amber)] text-[var(--amber-foreground)]",children:"Skip to main content"}),(0,e.jsx)(o.Ay,{activePanel:aI,onPanelChange:c.setActivePanel,onEchoClick:()=>{aG();let a="echo"===c.activePanel,b=aB?.startsWith("/echo");a?b?c.setActivePanel(null):aA.push("/echo/about-you"):(c.setActivePanel("echo"),aA.push("/echo/about-you"))},onAgentsClick:()=>{aG();let a="agents"===c.activePanel,b=aB?.startsWith("/agents");a?b?c.setActivePanel(null):aA.push("/agents"):(c.setActivePanel("agents"),aA.push("/agents")),$(null)},onDiscoverClick:()=>{aG();let a="discover"===c.activePanel,b=aB?.startsWith("/explore");a?b?c.setActivePanel(null):aA.push("/explore"):(c.setActivePanel("discover"),aA.push("/explore"))},onSpacesClick:()=>{aG();let a="/"===aB,b="files"===c.activePanel,d="/wiki"===aB||aB?.startsWith("/view/")||aB?.startsWith("/wiki/");a||!b?(c.setActivePanel("files"),aA.push("/wiki")):d?c.setActivePanel(null):aA.push("/wiki")},syncStatus:aD,expanded:c.railExpanded,onExpandedChange:aR,onSettingsClick:aO,onSyncClick:aQ}),(0,e.jsxs)(p.Ay,{activePanel:c.activePanel,fileTree:a,onNavigate:()=>{},onOpenSyncSettings:aN,railWidth:c.railWidth,panelWidth:c.panelWidth??void 0,onWidthChange:c.handlePanelWidthChange,onWidthCommit:c.handlePanelWidthCommit,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize,onImport:ar,children:[(0,e.jsx)("div",{className:`flex flex-col h-full ${"echo"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(v.A,{active:"echo"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"search"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(s.A,{active:"search"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"agents"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(t.A,{active:"agents"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize,selectedAgentKey:aM?Z:null})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"discover"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(u.A,{active:"discover"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"workflows"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(w.A,{active:"workflows"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})})]}),(0,e.jsx)(x.Ay,{open:d.askPanelOpen,onClose:d.closeAskPanel,currentFile:aF,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aJ,width:d.askPanelWidth,onWidthChange:d.handleAskWidthChange,onWidthCommit:d.handleAskWidthCommit,askMode:d.askMode,onModeSwitch:d.handleAskModeSwitch,maximized:d.askMaximized,onMaximize:d.toggleAskMaximized,sidebarOffset:c.panelOpen?c.railWidth+c.effectivePanelWidth:c.railWidth}),(0,e.jsx)(y.Ay,{open:aM,agentKey:Z,onClose:aL,rightOffset:d.askPanelOpen?d.askPanelWidth:0,width:_,onWidthChange:aa,onWidthCommit:aK}),(0,e.jsx)(R,{open:d.desktopAskPopupOpen,onClose:d.closeDesktopAskPopup,currentFile:aF,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aJ,askMode:d.askMode,onModeSwitch:d.handleAskModeSwitch}),(0,e.jsx)(z.A,{onToggle:d.toggleAskPanel,askPanelOpen:d.askPanelOpen||d.desktopAskPopupOpen}),(0,e.jsx)(B.A,{}),(0,e.jsx)(S,{open:h,onClose:aP,initialTab:O}),(0,e.jsx)(A.A,{open:V,onClose:()=>W(!1),anchorRect:X,railWidth:c.railWidth,onOpenSyncSettings:aN,syncStatus:aD,onSyncStatusRefresh:aE}),(0,e.jsxs)("header",{className:"md:hidden fixed top-0 left-0 right-0 z-30 bg-card border-b border-border flex items-center justify-between px-3 py-2",style:{paddingTop:"env(safe-area-inset-top, 0px)"},children:[(0,e.jsx)("button",{onClick:()=>au(!0),className:"p-3 -ml-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":"Open menu",children:(0,e.jsx)(j.A,{size:20})}),(0,e.jsxs)(i(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,e.jsx)(r.A,{id:"mobile"}),(0,e.jsx)("span",{className:"text-foreground text-sm font-brand",children:"MindOS"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:aN,className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent flex items-center justify-center","aria-label":"Sync status",children:(0,e.jsx)(F.jc,{status:aD})}),(0,e.jsx)("button",{onClick:()=>aw(!0),className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":az.sidebar.searchTitle,children:(0,e.jsx)(k.A,{size:20})}),(0,e.jsx)("button",{onClick:()=>{H(!0),P(void 0)},className:"p-3 -mr-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":az.sidebar.settingsTitle,children:(0,e.jsx)(l.A,{size:20})})]})]}),at&&(0,e.jsx)("div",{className:"md:hidden fixed inset-0 z-40 overlay-backdrop",onClick:()=>au(!1)}),(0,e.jsxs)("aside",{className:`md:hidden fixed top-0 left-0 h-screen w-[85vw] max-w-[320px] z-50 bg-card border-r border-border flex flex-col transition-transform duration-300 ease-in-out ${at?"translate-x-0":"-translate-x-full"}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-4 border-b border-border shrink-0",children:[(0,e.jsxs)(i(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,e.jsx)(r.A,{id:"drawer"}),(0,e.jsx)("span",{className:"text-foreground text-sm font-brand",children:"MindOS"})]}),(0,e.jsx)("button",{onClick:()=>au(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,e.jsx)(m.A,{size:16})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",children:(0,e.jsx)(q.Ay,{nodes:a,onNavigate:()=>au(!1),onImport:ar})})]}),(0,e.jsx)(Q,{open:av,onClose:()=>aw(!1)}),(0,e.jsx)(R,{open:ax,onClose:()=>ay(!1),currentFile:aF}),(0,e.jsxs)("main",{id:"main-content",className:"min-h-screen transition-all duration-200 pt-[52px] md:pt-0",onDragEnter:a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),aq.current++,1===aq.current&&ap(!0))},onDragOver:a=>{a.dataTransfer.types.includes("Files")&&a.preventDefault()},onDragLeave:()=>{aq.current=Math.max(0,aq.current-1),0===aq.current&&ap(!1)},onDrop:a=>{a.preventDefault(),aq.current=0,ap(!1),a.dataTransfer.files.length>0&&!ai&&(0,N.QL)(Array.from(a.dataTransfer.files),az)},children:[(0,e.jsxs)("div",{className:"min-h-screen bg-background",style:{overflowX:"clip"},children:[(0,e.jsx)(C.A,{}),b]}),(0,e.jsx)(D.A,{}),(0,e.jsx)(T,{t:az,dirPaths:aC}),ao&&!ai&&(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm transition-opacity duration-200",children:(0,e.jsxs)("div",{className:"border-2 border-dashed border-[var(--amber)]/50 rounded-xl p-12 flex flex-col items-center gap-3",children:[(0,e.jsx)(n.A,{size:48,className:"text-[var(--amber)]/60"}),(0,e.jsx)("p",{className:"text-sm text-foreground font-medium",children:az.inbox.dropOverlay}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:az.inbox.dropOverlayFormats})]})})]}),(0,e.jsx)(U,{open:ai,onClose:as,defaultSpace:ak,initialFiles:am,aiOrganize:ab,dirPaths:aC}),ac&&(0,e.jsx)(E.A,{aiOrganize:ab,onDismiss:ag,onCancel:()=>{ab.abort(),ab.reset(),ad(!1)},onHistoryUpdate:ah}),(0,e.jsx)("style",{children:`
168
173
  @media (min-width: 768px) {
169
174
  :root {
170
175
  --right-panel-width: ${d.askMaximized?`calc(100vw - ${c.panelOpen?c.railWidth+c.effectivePanelWidth:c.railWidth}px)`:`${d.askPanelOpen?d.askPanelWidth:0}px`};
@@ -180,12 +185,7 @@ Keep content concise and actionable. Write files directly using tools.`;window.d
180
185
  hidden md:flex fixed top-0 h-screen z-[31] flex-col bg-card border-l border-border shadow-sm
181
186
  transition-transform duration-200 ease-out
182
187
  ${a?"translate-x-0":"translate-x-full pointer-events-none"}
183
- `,style:{width:`${j}px`,right:`${i}px`},role:"complementary","aria-label":q.agentDetailPanelAria,"aria-hidden":!a||!v,children:[v&&(0,d.jsx)("div",{className:"flex flex-col flex-1 min-h-0 overflow-y-auto",children:(0,d.jsx)(t,{agent:v.agent,agentStatus:v.status,mcpStatus:n,onBack:c,onInstallAgent:o,copy:A,headerVariant:"dock"})}),(0,d.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:z,children:(0,d.jsx)("div",{className:"absolute left-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/50 transition-opacity"})})]})}},97916:(a,b,c)=>{"use strict";c.d(b,{SQ:()=>D,Ld:()=>B,iP:()=>A,Ay:()=>E});var d=c(48249),e=c(67484),f=c(19099),g=c(24520),h=c(80600),i=c(86718),j=c(7817),k=c(84699),l=c(12417),m=c(24703),n=c(28330),o=c(96286),p=c(59347),q=c(41479),r=c(61075),s=c(81057),t=c(9311),u=c(4140),v=c(2548),w=c(47223),x=c(99829);x.callServer,x.findSourceMapURL;var y=c(1108);let z=()=>{},A=y.qQ,B=y.Dp.MIN,C=y.Dp.MAX_RATIO,D=y.Dp.MAX_ABS;function E({activePanel:a,fileTree:b,onNavigate:c,onOpenSyncSettings:x,railWidth:y=48,panelWidth:E,onWidthChange:F,onWidthCommit:G,maximized:H=!1,onMaximize:I,onImport:J,children:K}){let L=a?A[a]:280,M=H?void 0:E??L,{t:N}=(0,w.Y)(),O=(0,f.useRouter)(),P=(0,f.usePathname)(),Q="/view/Inbox"===P||"/view/Inbox/"===P,[R,S]=(0,e.useState)(null),T=(0,e.useMemo)(()=>(function a(b,c=0){let d=c;for(let e of b)"directory"===e.type&&(d=Math.max(d,a(e.children??[],c+1)));return d})(b),[b]),[U,V]=(0,e.useState)(!1),W=(0,e.useRef)(null),X=(0,e.useRef)(null),[Y,Z]=(0,e.useState)(!1),$=(0,e.useRef)(null),_=(0,e.useRef)(null),aa=(0,s.gL)(),[ab,ac]=(0,e.useState)(0),[ad,ae]=(0,e.useState)(0),[af,ag]=(0,e.useState)(!1),ah=(0,e.useCallback)(()=>{if(!af){ag(!0);try{localStorage.setItem("mindos-tree-dblclick-hint","1")}catch{}}},[af]),ai=(0,v._)({width:E??L,minWidth:B,maxWidth:D,maxWidthRatio:C,direction:"right",disabled:H,onResize:F??z,onResizeEnd:G??z});return(0,d.jsxs)("aside",{className:`
184
- hidden md:flex fixed top-0 h-screen z-30
185
- flex-col bg-card border-r border-border
186
- transition-[transform,left,width] duration-200 ease-out
187
- ${null!==a?"translate-x-0":"-translate-x-full pointer-events-none"}
188
- `,style:{width:H?`calc(100vw - ${y}px)`:`${M}px`,left:`${y}px`},role:"region","aria-label":a?`${a} panel`:void 0,children:[(0,d.jsxs)("div",{className:`flex flex-col h-full ${"files"===a?"":"hidden"}`,children:[(0,d.jsx)(u.A,{title:N.sidebar.files,children:(0,d.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:W,type:"button",onClick:()=>{Z(!1),V(a=>!a)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":N.sidebar.new,title:N.sidebar.new,children:(0,d.jsx)(g.A,{size:13})}),U&&(0,d.jsxs)("div",{ref:X,className:"absolute top-full right-0 mt-1 min-w-[152px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{V(!1),O.push("/view/Untitled.md")},children:[(0,d.jsx)(h.A,{size:14,className:"shrink-0"}),N.sidebar.newFile]}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{V(!1),window.dispatchEvent(new Event("mindos:create-space"))},children:[(0,d.jsx)(i.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),N.sidebar.newSpace]})]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>J?.(),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":N.sidebar.importFile,title:N.sidebar.importFile,children:(0,d.jsx)(j.A,{size:13})}),(0,d.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,d.jsx)("button",{onClick:()=>S(a=>Math.max(-1,(a??T)-1)),onDoubleClick:()=>{S(-1),ah()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":N.sidebar.collapseLevel,title:af?N.sidebar.collapseLevel:N.sidebar.collapseLevelHint??N.sidebar.collapseLevel,children:(0,d.jsx)(k.A,{size:13})}),(0,d.jsx)("button",{onClick:()=>S(a=>{let b=(a??0)+1;return b>T?null:b}),onDoubleClick:()=>{S(null),ah()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":N.sidebar.expandLevel,title:af?N.sidebar.expandLevel:N.sidebar.expandLevelHint??N.sidebar.expandLevel,children:(0,d.jsx)(l.A,{size:13})}),(0,d.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:$,type:"button",onClick:()=>{V(!1),Z(a=>!a)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":N.sidebar.more,title:N.sidebar.more,children:(0,d.jsx)(m.A,{size:13})}),Y&&(0,d.jsxs)("div",{ref:_,className:"absolute top-full right-0 mt-1 min-w-[172px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{Z(!1),O.push("/view/Inbox/")},children:[(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1",children:N.sidebar.capture}),ad>0&&(0,d.jsx)("span",{className:"text-2xs font-medium tabular-nums px-1.5 py-px rounded-full bg-[var(--amber)]/10 text-[var(--amber)]/70",children:ad})]}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{Z(!1),O.push("/view/.mindos/change-log.json")},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1",children:N.changes.title})]}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{Z(!1),O.push("/trash")},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:N.trash.title}),ab>0&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:ab})]}),(0,d.jsx)("div",{className:"my-1 border-t border-border/50"}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{(0,s.Fo)(!aa)},children:[aa?(0,d.jsx)(q.A,{size:14,className:"shrink-0"}):(0,d.jsx)(r.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:N.sidebar.showHiddenFiles}),aa&&(0,d.jsx)("span",{className:"text-[var(--amber)] text-xs",children:"✓"})]})]})]})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",onDragEnter:a=>{a.dataTransfer.types.includes("Files")&&a.stopPropagation()},onDragOver:a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation())},onDrop:a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation())},children:(0,d.jsx)(s.Ay,{nodes:b,onNavigate:c,maxOpenDepth:R,onImport:J})}),(0,d.jsxs)("button",{type:"button",onClick:()=>O.push("/view/Inbox/"),className:`flex items-center gap-2 mx-2 px-2 py-1.5 text-sm rounded-lg transition-all duration-150 group shrink-0 ${Q?"bg-[var(--amber-dim)] text-[var(--amber)]":"hover:bg-muted text-muted-foreground hover:text-foreground"}`,children:[(0,d.jsx)("div",{className:`flex items-center justify-center w-5 h-5 rounded-md shrink-0 transition-colors ${Q?"bg-[var(--amber)]/15":"bg-transparent"}`,children:(0,d.jsx)(n.A,{size:13,className:`shrink-0 transition-colors ${Q?"text-[var(--amber)]":"text-[var(--amber)]/60 group-hover:text-[var(--amber)]"}`})}),(0,d.jsx)("span",{className:`flex-1 text-left text-xs transition-colors ${Q?"font-medium text-[var(--amber)]":"text-muted-foreground group-hover:text-foreground"}`,children:N.sidebar.capture}),ad>0&&(0,d.jsx)("span",{className:`text-2xs font-medium tabular-nums px-1.5 py-px rounded-full transition-colors ${Q?"bg-[var(--amber)]/15 text-[var(--amber)]":"bg-[var(--amber)]/10 text-[var(--amber)]/70"}`,children:ad})]}),(0,d.jsx)(t.Ay,{collapsed:!1,onOpenSyncSettings:x})]}),K,!H&&F&&(0,d.jsx)("div",{className:"absolute top-0 -right-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:ai,children:(0,d.jsx)("div",{className:"absolute right-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/60 transition-opacity"})})]})}},98610:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Ot:()=>k,T_:()=>l,Ux:()=>j,bf:()=>h,jt:()=>m,rl:()=>g});var e=c(14270),f=a([e]);e=(f.then?(await f)():f)[0];let l={anthropic:{id:"anthropic",name:"Anthropic",nameZh:"Anthropic",shortLabel:"Anthropic",defaultModel:"claude-sonnet-4-6",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://console.anthropic.com/settings/keys",category:"primary"},openai:{id:"openai",name:"OpenAI",nameZh:"OpenAI",shortLabel:"OpenAI",defaultModel:"gpt-5.4",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.openai.com/api-keys",category:"primary"},google:{id:"google",name:"Google Gemini",nameZh:"Google Gemini",shortLabel:"Gemini",defaultModel:"gemini-2.5-flash",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://aistudio.google.com/apikey",category:"primary"},groq:{id:"groq",name:"Groq",nameZh:"Groq",shortLabel:"Groq",defaultModel:"llama-3.3-70b-versatile",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://console.groq.com/keys",category:"more"},xai:{id:"xai",name:"xAI (Grok)",nameZh:"xAI (Grok)",shortLabel:"xAI",defaultModel:"grok-3",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},openrouter:{id:"openrouter",name:"OpenRouter",nameZh:"OpenRouter",shortLabel:"OpenRouter",defaultModel:"anthropic/claude-sonnet-4",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},mistral:{id:"mistral",name:"Mistral",nameZh:"Mistral",shortLabel:"Mistral",defaultModel:"mistral-large-latest",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},deepseek:{id:"deepseek",name:"DeepSeek",nameZh:"DeepSeek",shortLabel:"DeepSeek",defaultModel:"deepseek-chat",piProviderOverride:"openai",fixedBaseUrl:"https://api.deepseek.com/v1",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.deepseek.com/api_keys",category:"more"},zai:{id:"zai",name:"ZhipuAI (GLM)",nameZh:"智谱 AI (GLM 国际版)",shortLabel:"智谱GLM",defaultModel:"glm-4-plus",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"zai-cn":{id:"zai-cn",name:"ZhipuAI (GLM China)",nameZh:"智谱 AI (GLM 国内版)",shortLabel:"智谱GLM-CN",description:"China region version",descriptionZh:"中国区版本",defaultModel:"glm-4-plus",piProviderOverride:"zai",fixedBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://open.bigmodel.cn/",category:"more"},"kimi-coding":{id:"kimi-coding",name:"Kimi Coding",nameZh:"Kimi Coding (月之暗面)",shortLabel:"Kimi Coding",defaultModel:"kimi-k2-thinking",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},cerebras:{id:"cerebras",name:"Cerebras",nameZh:"Cerebras",shortLabel:"Cerebras",defaultModel:"llama-4-scout-17b-16e",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},minimax:{id:"minimax",name:"MiniMax",nameZh:"MiniMax (国际版)",shortLabel:"MiniMax",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"minimax-cn":{id:"minimax-cn",name:"MiniMax (China)",nameZh:"MiniMax (国内版)",shortLabel:"MiniMax-CN",description:"China region version",descriptionZh:"中国区版本",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},huggingface:{id:"huggingface",name:"Hugging Face",nameZh:"Hugging Face",shortLabel:"HuggingFace",defaultModel:"Qwen/Qwen3-235B-A22B-Thinking-2507",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},ollama:{id:"ollama",name:"Ollama",nameZh:"Ollama (本地)",shortLabel:"Ollama",description:"Local server (requires setup)",descriptionZh:"本地服务器 (需要本地部署)",defaultModel:"llama3.2",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:11434/v1",apiKeyFallback:"ollama",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://ollama.com/download",category:"local"},"lm-studio":{id:"lm-studio",name:"LM Studio",nameZh:"LM Studio (本地)",shortLabel:"LM Studio",description:"Local OpenAI-compatible server",descriptionZh:"本地 OpenAI 兼容服务",defaultModel:"local-model",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:1234/v1",apiKeyFallback:"lm-studio",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://lmstudio.ai/",category:"local"},vllm:{id:"vllm",name:"vLLM",nameZh:"vLLM (本地)",shortLabel:"vLLM",description:"Local OpenAI-compatible server",descriptionZh:"本地 OpenAI 兼容服务",defaultModel:"local-model",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:8000/v1",apiKeyFallback:"vllm",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://docs.vllm.ai/",category:"local"}},m=Object.keys(l);function g(a){return a in l}function h(){let a=[],b=[],c=[];for(let d of m){let e=l[d].category;"primary"===e?a.push(d):"local"===e?b.push(d):c.push(d)}return b.sort((a,b)=>l[a].name.localeCompare(l[b].name)),c.sort((a,b)=>l[a].name.localeCompare(l[b].name)),{primary:a,local:b,more:c}}function i(a){return l[a].piProviderOverride??a}let n={deepseek:"DEEPSEEK_API_KEY"};function j(a){return n[a]?n[a]:o[i(a)]}function k(a){let b=l[a];if(b.fixedBaseUrl)return b.fixedBaseUrl;try{let b=(0,e.getModels)(i(a));return b[0]?.baseUrl??""}catch{return""}}let o={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",google:"GEMINI_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY",zai:"ZAI_API_KEY","zai-cn":"ZAI_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_API_KEY",huggingface:"HF_TOKEN","kimi-coding":"KIMI_API_KEY"};d()}catch(a){d(a)}})},99101:(a,b,c)=>{"use strict";c.d(b,{B1:()=>h,X8:()=>j,dV:()=>i,oR:()=>l});let d=[],e=[],f=0;function g(){for(let a of e)a()}function h(a){return e=[...e,a],()=>{e=e.filter(b=>b!==a)}}function i(){return d}function j(a){d=d.filter(b=>b.id!==a),g()}function k(a){let b=`toast-${++f}`,c={id:b,message:a.message,type:a.type??"info",duration:a.duration??2e3,action:a.action};d=[...d,c].slice(-3),g(),c.duration>0&&setTimeout(()=>j(b),c.duration)}function l(a,b){k({message:a,...b})}l.success=(a,b)=>k({message:a,type:"success",duration:b}),l.undo=(a,b,c)=>k({message:a,type:"info",duration:c?.duration??5e3,action:{label:c?.label??"Undo",onClick:b}}),l.error=(a,b)=>k({message:a,type:"error",duration:b}),l.copy=(a="Copied")=>k({message:a,type:"success",duration:1500})},99713:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},99791:(a,b,c)=>{"use strict";c.d(b,{A:()=>q});var d=c(48249),e=c(67484),f=c(19099),g=c(10316),h=c(46674),i=c(83654),j=c(80600),k=c(19794),l=c(33191),m=c(95054),n=c(47223),o=c(4140),p=c(95657);function q({active:a,onNavigate:b,maximized:c,onMaximize:q}){let[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)([]),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(0),[z,A]=(0,e.useState)(null),B=(0,e.useRef)(null),C=(0,f.useRouter)(),D=(0,e.useRef)(null),{t:E}=(0,n.Y)(),F=(0,e.useCallback)(a=>{if(D.current&&clearTimeout(D.current),!a.trim()){u([]),w(!1);return}w(!0),D.current=setTimeout(async()=>{try{let b=await (0,m.n)(`/api/search?q=${encodeURIComponent(a)}`);u(Array.isArray(b)?b:[]),y(0)}catch{u([])}finally{w(!1)}},300)},[]),G=(0,e.useCallback)(a=>{let b=a.target.value;s(b),F(b)},[F]),H=(0,e.useCallback)(a=>{C.push(`/view/${(0,l.O0)(a.path)}`),b?.()},[C,b]),I=(0,e.useCallback)(a=>{"ArrowDown"===a.key?(a.preventDefault(),y(a=>Math.min(a+1,t.length-1))):"ArrowUp"===a.key?(a.preventDefault(),y(a=>Math.max(a-1,0))):"Enter"===a.key&&t[x]&&H(t[x])},[t,x,H]),J=(0,e.useCallback)((a,b)=>{a.dataTransfer.effectAllowed="copy",a.dataTransfer.setData("text/mindos-path",b.path),a.dataTransfer.setData("text/mindos-type","file");let c=new Image;a.dataTransfer.setDragImage(c,0,0)},[]),K=(0,e.useCallback)(()=>{A(null)},[]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(o.A,{title:"Search",maximized:c,onMaximize:q}),(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border shrink-0 overflow-hidden",children:[(0,d.jsx)(g.A,{size:16,className:"text-muted-foreground shrink-0 flex-none"}),(0,d.jsx)("input",{ref:B,type:"text",value:r,onChange:G,onKeyDown:I,placeholder:E.search.placeholder,"aria-label":E.search.placeholder,className:"flex-1 min-w-0 bg-transparent text-foreground text-base font-medium placeholder:text-muted-foreground/60 outline-none"}),v&&(0,d.jsx)("div",{className:"w-4 h-4 border-2 border-muted-foreground/30 border-t-foreground rounded-full animate-spin shrink-0 flex-none"}),!v&&r&&(0,d.jsx)("button",{onClick:()=>{s(""),u([]),B.current?.focus()},className:"shrink-0 flex-none p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":E.search.clear,children:(0,d.jsx)(h.A,{size:16})})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",role:"listbox","aria-label":"Search results",children:[0===t.length&&!r&&!v&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-12 text-center",children:[(0,d.jsx)("div",{className:"flex items-center justify-center w-12 h-12 rounded-lg bg-muted mb-4",children:(0,d.jsx)(g.A,{size:20,className:"text-muted-foreground/60"})}),(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1",children:E.search.emptyTitle}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70",children:E.search.emptyHint})]}),0===t.length&&r&&!v&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-12 text-center",children:[(0,d.jsx)("div",{className:"flex items-center justify-center w-12 h-12 rounded-lg bg-muted mb-4",children:(0,d.jsx)(g.A,{size:20,className:"text-muted-foreground/60"})}),(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1",children:E.search.noResults}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70",children:E.search.noResultsHint})]}),v&&0===t.length&&(0,d.jsx)("div",{className:"space-y-2 p-3",children:[1,2,3].map(a=>(0,d.jsxs)("div",{className:"px-3 py-2.5 space-y-2 animate-pulse",children:[(0,d.jsx)("div",{className:"h-4 bg-muted rounded-md w-3/4"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded-md w-1/2"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded-md w-2/3"})]},a))}),t.length>0&&(0,d.jsx)(p.aY,{totalCount:t.length,overscan:100,itemContent:a=>{let b,c=t[a],e=c.path.endsWith(".csv")?".csv":".md",{name:f,breadcrumb:g}={name:(b=c.path.split("/").filter(Boolean))[b.length-1],breadcrumb:b.slice(0,-1)},h=a===x,l=a===z;return(0,d.jsxs)("button",{role:"option","aria-selected":h,draggable:!0,onDragStart:a=>J(a,c),onDragEnd:K,onDragEnter:()=>A(a),onDragLeave:()=>A(null),onClick:()=>H(c),onMouseEnter:()=>y(a),className:`
188
+ `,style:{width:`${j}px`,right:`${i}px`},role:"complementary","aria-label":q.agentDetailPanelAria,"aria-hidden":!a||!v,children:[v&&(0,d.jsx)("div",{className:"flex flex-col flex-1 min-h-0 overflow-y-auto",children:(0,d.jsx)(t,{agent:v.agent,agentStatus:v.status,mcpStatus:n,onBack:c,onInstallAgent:o,copy:A,headerVariant:"dock"})}),(0,d.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:z,children:(0,d.jsx)("div",{className:"absolute left-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/50 transition-opacity"})})]})}},98610:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Ot:()=>k,T_:()=>l,Ux:()=>j,bf:()=>h,jt:()=>m,rl:()=>g});var e=c(14270),f=a([e]);e=(f.then?(await f)():f)[0];let l={anthropic:{id:"anthropic",name:"Anthropic",nameZh:"Anthropic",shortLabel:"Anthropic",defaultModel:"claude-sonnet-4-6",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://console.anthropic.com/settings/keys",category:"primary"},openai:{id:"openai",name:"OpenAI",nameZh:"OpenAI",shortLabel:"OpenAI",defaultModel:"gpt-5.4",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.openai.com/api-keys",category:"primary"},google:{id:"google",name:"Google Gemini",nameZh:"Google Gemini",shortLabel:"Gemini",defaultModel:"gemini-2.5-flash",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://aistudio.google.com/apikey",category:"primary"},groq:{id:"groq",name:"Groq",nameZh:"Groq",shortLabel:"Groq",defaultModel:"llama-3.3-70b-versatile",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://console.groq.com/keys",category:"more"},xai:{id:"xai",name:"xAI (Grok)",nameZh:"xAI (Grok)",shortLabel:"xAI",defaultModel:"grok-3",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},openrouter:{id:"openrouter",name:"OpenRouter",nameZh:"OpenRouter",shortLabel:"OpenRouter",defaultModel:"anthropic/claude-sonnet-4",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},mistral:{id:"mistral",name:"Mistral",nameZh:"Mistral",shortLabel:"Mistral",defaultModel:"mistral-large-latest",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},deepseek:{id:"deepseek",name:"DeepSeek",nameZh:"DeepSeek",shortLabel:"DeepSeek",defaultModel:"deepseek-chat",piProviderOverride:"openai",fixedBaseUrl:"https://api.deepseek.com/v1",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.deepseek.com/api_keys",category:"more"},zai:{id:"zai",name:"ZhipuAI (GLM)",nameZh:"智谱 AI (GLM 国际版)",shortLabel:"智谱GLM",defaultModel:"glm-4-plus",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"zai-cn":{id:"zai-cn",name:"ZhipuAI (GLM China)",nameZh:"智谱 AI (GLM 国内版)",shortLabel:"智谱GLM-CN",description:"China region version",descriptionZh:"中国区版本",defaultModel:"glm-4-plus",piProviderOverride:"zai",fixedBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://open.bigmodel.cn/",category:"more"},"kimi-coding":{id:"kimi-coding",name:"Kimi Coding",nameZh:"Kimi Coding (月之暗面)",shortLabel:"Kimi Coding",defaultModel:"kimi-k2-thinking",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},cerebras:{id:"cerebras",name:"Cerebras",nameZh:"Cerebras",shortLabel:"Cerebras",defaultModel:"llama-4-scout-17b-16e",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},minimax:{id:"minimax",name:"MiniMax",nameZh:"MiniMax (国际版)",shortLabel:"MiniMax",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"minimax-cn":{id:"minimax-cn",name:"MiniMax (China)",nameZh:"MiniMax (国内版)",shortLabel:"MiniMax-CN",description:"China region version",descriptionZh:"中国区版本",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},huggingface:{id:"huggingface",name:"Hugging Face",nameZh:"Hugging Face",shortLabel:"HuggingFace",defaultModel:"Qwen/Qwen3-235B-A22B-Thinking-2507",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},ollama:{id:"ollama",name:"Ollama",nameZh:"Ollama (本地)",shortLabel:"Ollama",description:"Local server (requires setup)",descriptionZh:"本地服务器 (需要本地部署)",defaultModel:"llama3.2",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:11434/v1",apiKeyFallback:"ollama",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://ollama.com/download",category:"local"},"lm-studio":{id:"lm-studio",name:"LM Studio",nameZh:"LM Studio (本地)",shortLabel:"LM Studio",description:"Local OpenAI-compatible server",descriptionZh:"本地 OpenAI 兼容服务",defaultModel:"local-model",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:1234/v1",apiKeyFallback:"lm-studio",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://lmstudio.ai/",category:"local"},vllm:{id:"vllm",name:"vLLM",nameZh:"vLLM (本地)",shortLabel:"vLLM",description:"Local OpenAI-compatible server",descriptionZh:"本地 OpenAI 兼容服务",defaultModel:"local-model",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:8000/v1",apiKeyFallback:"vllm",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://docs.vllm.ai/",category:"local"}},m=Object.keys(l);function g(a){return a in l}function h(){let a=[],b=[],c=[];for(let d of m){let e=l[d].category;"primary"===e?a.push(d):"local"===e?b.push(d):c.push(d)}return b.sort((a,b)=>l[a].name.localeCompare(l[b].name)),c.sort((a,b)=>l[a].name.localeCompare(l[b].name)),{primary:a,local:b,more:c}}function i(a){return l[a].piProviderOverride??a}let n={deepseek:"DEEPSEEK_API_KEY"};function j(a){return n[a]?n[a]:o[i(a)]}function k(a){let b=l[a];if(b.fixedBaseUrl)return b.fixedBaseUrl;try{let b=(0,e.getModels)(i(a));return b[0]?.baseUrl??""}catch{return""}}let o={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",google:"GEMINI_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY",zai:"ZAI_API_KEY","zai-cn":"ZAI_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_API_KEY",huggingface:"HF_TOKEN","kimi-coding":"KIMI_API_KEY"};d()}catch(a){d(a)}})},98840:(a,b,c)=>{"use strict";c.d(b,{Y:()=>e});var d=c(99829);let e=(0,d.createServerReference)("40bf825815eb8b675c2f4109e77f425ad7dab8aae9",d.callServer,void 0,d.findSourceMapURL,"undoDeleteAction")},99101:(a,b,c)=>{"use strict";c.d(b,{B1:()=>h,X8:()=>j,dV:()=>i,oR:()=>l});let d=[],e=[],f=0;function g(){for(let a of e)a()}function h(a){return e=[...e,a],()=>{e=e.filter(b=>b!==a)}}function i(){return d}function j(a){d=d.filter(b=>b.id!==a),g()}function k(a){let b=`toast-${++f}`,c={id:b,message:a.message,type:a.type??"info",duration:a.duration??2e3,action:a.action};d=[...d,c].slice(-3),g(),c.duration>0&&setTimeout(()=>j(b),c.duration)}function l(a,b){k({message:a,...b})}l.success=(a,b)=>k({message:a,type:"success",duration:b}),l.undo=(a,b,c)=>k({message:a,type:"info",duration:c?.duration??5e3,action:{label:c?.label??"Undo",onClick:b}}),l.error=(a,b)=>k({message:a,type:"error",duration:b}),l.copy=(a="Copied")=>k({message:a,type:"success",duration:1500})},99713:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},99791:(a,b,c)=>{"use strict";c.d(b,{A:()=>q});var d=c(48249),e=c(67484),f=c(19099),g=c(10316),h=c(46674),i=c(83654),j=c(80600),k=c(19794),l=c(33191),m=c(95054),n=c(47223),o=c(4140),p=c(95657);function q({active:a,onNavigate:b,maximized:c,onMaximize:q}){let[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)([]),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(0),[z,A]=(0,e.useState)(null),B=(0,e.useRef)(null),C=(0,f.useRouter)(),D=(0,e.useRef)(null),{t:E}=(0,n.Y)(),F=(0,e.useCallback)(a=>{if(D.current&&clearTimeout(D.current),!a.trim()){u([]),w(!1);return}w(!0),D.current=setTimeout(async()=>{try{let b=await (0,m.n)(`/api/search?q=${encodeURIComponent(a)}`);u(Array.isArray(b)?b:[]),y(0)}catch{u([])}finally{w(!1)}},300)},[]),G=(0,e.useCallback)(a=>{let b=a.target.value;s(b),F(b)},[F]),H=(0,e.useCallback)(a=>{C.push(`/view/${(0,l.O0)(a.path)}`),b?.()},[C,b]),I=(0,e.useCallback)(a=>{"ArrowDown"===a.key?(a.preventDefault(),y(a=>Math.min(a+1,t.length-1))):"ArrowUp"===a.key?(a.preventDefault(),y(a=>Math.max(a-1,0))):"Enter"===a.key&&t[x]&&H(t[x])},[t,x,H]),J=(0,e.useCallback)((a,b)=>{a.dataTransfer.effectAllowed="copy",a.dataTransfer.setData("text/mindos-path",b.path),a.dataTransfer.setData("text/mindos-type","file");let c=new Image;a.dataTransfer.setDragImage(c,0,0)},[]),K=(0,e.useCallback)(()=>{A(null)},[]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(o.A,{title:"Search",maximized:c,onMaximize:q}),(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border shrink-0 overflow-hidden",children:[(0,d.jsx)(g.A,{size:16,className:"text-muted-foreground shrink-0 flex-none"}),(0,d.jsx)("input",{ref:B,type:"text",value:r,onChange:G,onKeyDown:I,placeholder:E.search.placeholder,"aria-label":E.search.placeholder,className:"flex-1 min-w-0 bg-transparent text-foreground text-base font-medium placeholder:text-muted-foreground/60 outline-none"}),v&&(0,d.jsx)("div",{className:"w-4 h-4 border-2 border-muted-foreground/30 border-t-foreground rounded-full animate-spin shrink-0 flex-none"}),!v&&r&&(0,d.jsx)("button",{onClick:()=>{s(""),u([]),B.current?.focus()},className:"shrink-0 flex-none p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":E.search.clear,children:(0,d.jsx)(h.A,{size:16})})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",role:"listbox","aria-label":"Search results",children:[0===t.length&&!r&&!v&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-12 text-center",children:[(0,d.jsx)("div",{className:"flex items-center justify-center w-12 h-12 rounded-lg bg-muted mb-4",children:(0,d.jsx)(g.A,{size:20,className:"text-muted-foreground/60"})}),(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1",children:E.search.emptyTitle}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70",children:E.search.emptyHint})]}),0===t.length&&r&&!v&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-12 text-center",children:[(0,d.jsx)("div",{className:"flex items-center justify-center w-12 h-12 rounded-lg bg-muted mb-4",children:(0,d.jsx)(g.A,{size:20,className:"text-muted-foreground/60"})}),(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1",children:E.search.noResults}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70",children:E.search.noResultsHint})]}),v&&0===t.length&&(0,d.jsx)("div",{className:"space-y-2 p-3",children:[1,2,3].map(a=>(0,d.jsxs)("div",{className:"px-3 py-2.5 space-y-2 animate-pulse",children:[(0,d.jsx)("div",{className:"h-4 bg-muted rounded-md w-3/4"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded-md w-1/2"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded-md w-2/3"})]},a))}),t.length>0&&(0,d.jsx)(p.aY,{totalCount:t.length,overscan:100,itemContent:a=>{let b,c=t[a],e=c.path.endsWith(".csv")?".csv":".md",{name:f,breadcrumb:g}={name:(b=c.path.split("/").filter(Boolean))[b.length-1],breadcrumb:b.slice(0,-1)},h=a===x,l=a===z;return(0,d.jsxs)("button",{role:"option","aria-selected":h,draggable:!0,onDragStart:a=>J(a,c),onDragEnd:K,onDragEnter:()=>A(a),onDragLeave:()=>A(null),onClick:()=>H(c),onMouseEnter:()=>y(a),className:`
189
189
  w-full px-3 py-2.5 flex items-start gap-3 text-left transition-colors duration-100
190
190
  border-b border-border/50
191
191
  ${h?"bg-[var(--amber-dim)] border-l-2 border-[var(--amber)]":"border-l-2 border-transparent"}