memory-eternal 0.9.11 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/README.en.md +37 -0
- package/README.md +48 -0
- package/lib/api.js +76 -0
- package/lib/client.js +17 -11
- package/lib/feedback.js +205 -0
- package/package.json +2 -2
- package/web/app.js +20 -14
package/lib/client.js
CHANGED
|
@@ -3,12 +3,17 @@ window.__ModuleLoader__.load({
|
|
|
3
3
|
factory: (require) => {
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
|
-
var
|
|
7
|
-
`),
|
|
8
|
-
`)){let
|
|
9
|
-
`)).body;if(!
|
|
10
|
-
`)){let
|
|
11
|
-
`)}var e=require("react/jsx-runtime"),Ze="memory-eternal",U="/memory-eternal/api",Zt=100,Qt=["slots","locale"],Dt={nav:"\u8BB0\u5FC6",loading:"\u52A0\u8F7D\u4E2D\u2026",refresh:"\u5237\u65B0",overview:"\u8BB0\u5FC6\u5E93\u6982\u89C8",total:"\u77E5\u8BC6\u5361",recent:"\u8FD1 7 \u5929\u65B0\u589E",tags:"\u6807\u7B7E",searchPlaceholder:"\u641C\u7D22\u8BB0\u5FC6\uFF08\u652F\u6301\u4E2D\u6587\u7247\u6BB5\uFF09\u2026",search:"\u641C\u7D22",all:"\u5168\u90E8",kindProject:"\u9879\u76EE",kindKnowledge:"\u77E5\u8BC6",kindContent:"\u5185\u5BB9",kindPrompt:"\u63D0\u793A\u8BCD",kindBusiness:"\u4E1A\u52A1",kindTool:"\u5DE5\u5177",kindMistake:"\u6559\u8BAD",cardsTab:"\u77E5\u8BC6\u5361",graphTab:"\u77E5\u8BC6\u56FE\u8C31",graph:"\u77E5\u8BC6\u56FE\u8C31",graphHint:"\u8282\u70B9=\u77E5\u8BC6\u5361\uFF1B\u8FDE\u7EBF=[[\u94FE\u63A5]] \u6216\u5171\u4EAB\u6807\u7B7E\u3002\u70B9\u51FB\u8282\u70B9\u9605\u8BFB\u5361\u7247\u3002",graphTip:"\u5DE6\u952E\u51F8\u663E \xB7 Shift+\u62D6\u62FD\u6846\u9009 \xB7 \u53F3\u952E\u83DC\u5355 \xB7 \u6EDA\u8F6E\u7F29\u653E \xB7 \u62D6\u62FD\u5E73\u79FB",rebuild:"\u91CD\u5EFA",reset:"\u91CD\u7F6E",expandAll:"\u5168\u90E8\u5C55\u5F00",capped:"\u5DF2\u5C55\u793A\u6700\u6838\u5FC3\u7684",clearFocus:"\u53D6\u6D88\u9AD8\u4EAE",empty:"\u8BB0\u5FC6\u5E93\u8FD8\u662F\u7A7A\u7684\u3002\u591A\u804A\u51E0\u8F6E\u540E\uFF0C\u503C\u5F97\u4FDD\u5B58\u7684\u5185\u5BB9\u4F1A\u81EA\u52A8\u6C89\u6DC0\u6210\u77E5\u8BC6\u5361\u3002",emptyGraph:"\u56FE\u8C31\u6682\u65E0\u6570\u636E\u3002",open:"\u9605\u8BFB",updated:"\u66F4\u65B0\u4E8E",created:"\u521B\u5EFA\u4E8E",source:"\u6765\u6E90",close:"\u5173\u95ED",vaultDir:"\u8BB0\u5FC6\u5E93\u76EE\u5F55",capture:"\u81EA\u52A8\u6C89\u6DC0",recall:"\u81EA\u52A8\u53EC\u56DE",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u7981\u7528",error:"\u52A0\u8F7D\u5931\u8D25",back:"\u8FD4\u56DE\u5217\u8868",cardCount:"\u5F20\u5361",nodes:"\u8282\u70B9",edges:"\u8FDE\u7EBF",memoryTitle:"\u8BB0\u5FC6\u5E93",memoryHint:"\u4F60\u7684\u672C\u5730\u7B2C\u4E8C\u5927\u8111",zoomIn:"\u653E\u5927",zoomOut:"\u7F29\u5C0F",fit:"\u9002\u5E94",enterFullscreen:"\u5168\u5C4F",exitFullscreen:"\u9000\u51FA\u5168\u5C4F",exportGraph:"\u5BFC\u51FA",openCard:"\u6253\u5F00\u5361\u7247",focusNeighbors:"\u51F8\u663E\u5173\u8054",copyName:"\u590D\u5236\u540D\u79F0",noMatch:"\u6CA1\u6709\u5339\u914D\u7684\u8BB0\u5FC6",clearFilter:"\u6E05\u9664\u8FC7\u6EE4",filterLabel:"\u7B5B\u9009",sortRecent:"\u6700\u8FD1",sortTitle:"\u6807\u9898",sortHot:"\u70ED\u70B9",exportSel:"\u5BFC\u51FA\u9009\u4E2D",clearSelection:"\u6E05\u7A7A\u9009\u62E9",download:"\u4E0B\u8F7D",openNewTab:"\u65B0\u6807\u7B7E\u6253\u5F00",copyImage:"\u590D\u5236\u56FE\u7247",done:"\u5B8C\u6210",downloaded:"\u5DF2\u5F00\u59CB\u4E0B\u8F7D",openedTab:"\u5DF2\u5728\u65B0\u6807\u7B7E\u6253\u5F00",copied:"\u5DF2\u590D\u5236",exportedSel:"\u4E2A\u8282\u70B9\u5DF2\u5BFC\u51FA",fullscreen:"\u5168\u5C4F",exitFull:"\u9000\u51FA\u5168\u5C4F",copyFail:"\u590D\u5236\u5931\u8D25",timeDim:"\u65F6\u95F4\u7EF4",timeNew:"3 \u5929\u5185",timeRecent:"2 \u5468\u5185",timeMonth:"1 \u6708\u5185",timeOld:"\u66F4\u65E9",newBadge:"\u65B0",expand:"\u5C55\u5F00\u5168\u90E8",collapse:"\u6536\u8D77",exportVault:"\u5BFC\u51FAMD",exportJson:"\u5BFC\u51FAJSON",exporting:"\u5BFC\u51FA\u4E2D\u2026",exportedVault:"\u8BB0\u5FC6\u5E93\u5DF2\u5BFC\u51FA",exportFail:"\u5BFC\u51FA\u5931\u8D25",importVault:"\u5BFC\u5165",importedVault:"\u5BFC\u5165\u5B8C\u6210",importedSkipped:"\uFF08\u8DF3\u8FC7\u91CD\u590D ",importFail:"\u5BFC\u5165\u5931\u8D25",location:"\u81EA\u9009\u4F4D\u7F6E",saveAs:"\u53E6\u5B58\u4E3A",saveAsUnsupported:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u9009\u62E9\u4FDD\u5B58\u4F4D\u7F6E",exportedTo:"\u5DF2\u5BFC\u51FA\u5230",defaultDownloads:"\u9ED8\u8BA4\u4E0B\u8F7D\u6587\u4EF6\u5939",exportCancel:"\u5DF2\u53D6\u6D88\u5BFC\u51FA",manage:"\u7BA1\u7406",tabUsage:"\u7528\u91CF/\u4ECA\u65E5",tabOptimize:"\u6574\u7406\u5EFA\u8BAE",adminLoadFail:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF1A\u8BF7\u5F7B\u5E95\u91CD\u542F dsh-desktop\uFF08host \u9700\u52A0\u8F7D\u65B0\u7248 /memory-eternal \u8DEF\u7531\uFF09",retry:"\u91CD\u8BD5",mergeSimilar:"\u4E00\u952E\u5408\u5E76\u76F8\u4F3C",trendLabel:"\u8FD1 30 \u5929\u8D8B\u52BF",cleanStale:"\u{1F5D1}\uFE0F \u4E00\u952E\u6E05\u7406\u9648\u65E7",deletedStale:"\u4E2A\u9648\u65E7\u5361\u5DF2\u6E05\u7406",newCard:"\u65B0\u5EFA",tplDecision:"\u{1F4DD} \u6280\u672F\u51B3\u7B56",tplBug:"\u{1F41B} \u8E29\u5751",tplMeeting:"\u{1F4CB} \u4F1A\u8BAE\u7EAA\u8981",tplWeekly:"\u{1F4CA} \u5468\u62A5",createCard:"\u521B\u5EFA",cardTitle:"\u6807\u9898",cardBody:"\u6B63\u6587",fbUseful:"\u6709\u7528",fbIrr:"\u65E0\u5173",todayAdd:"\u4ECA\u65E5\u65B0\u589E",weekAdd:"\u8FD1 7 \u5929",byKind:"\u5206\u7C7B\u7EDF\u8BA1",todayList:"\u4ECA\u65E5\u6C89\u6DC0",budgetLabel:"\u4F1A\u8BDD\u9884\u7B97",budgetChars:"\u9884\u7B97\u5B57\u7B26",recallLimitLabel:"\u53EC\u56DE\u6761\u6570",embeddingLabel:"\u8BED\u4E49\u53EC\u56DE",mergePairs:"\u76F8\u4F3C\u5361\u5BF9\uFF08\u53EF\u5408\u5E76\uFF09",staleCards:"\u9648\u65E7\u5361\uFF08>90 \u5929\u672A\u66F4\u65B0\uFF09",noOptimize:"\u6682\u65E0\u53EF\u6574\u7406\u9879\uFF0C\u5F88\u5065\u5EB7 \u{1F389}",oneClickOptimize:"\u4E00\u952E\u4F18\u5316",oneClickOptimizeConfirm:"\u786E\u8BA4\u4E00\u952E\u4F18\u5316\uFF1F\u5C06\u5408\u5E76\u6240\u6709\u76F8\u4F3C\u5361\u5BF9\uFF08\u9ED8\u8BA4\u4E0D\u6E05\u7406\u9648\u65E7\u5361\uFF09\u3002",oneClickAlsoStale:"\u540C\u65F6\u6E05\u7406\u9648\u65E7\u5361",oneClickOptimizeDone:"\u4E00\u952E\u4F18\u5316\u5B8C\u6210",optimizedMerged:"\u5BF9\u5DF2\u5408\u5E76",optimizedStaleDeleted:"\u5F20\u9648\u65E7\u5361\u5DF2\u6E05\u7406",mcpSetupStatus:"Agent MCP \u6302\u8F7D\u72B6\u6001",rerunSetup:"\u8865\u5168 MCP",notInstalled:"\u672A\u5B89\u88C5",noMcpEntry:"\u914D\u7F6E\u7F3A\u5931",nodePathMismatch:"node \u8DEF\u5F84\u4E0D\u4E00\u81F4\uFF0C\u5EFA\u8BAE\u91CD\u8DD1 setup",nodePathNote:"node \u73AF\u5883\u4E0D\u540C\uFF08\u53EF\u7528\uFF09",healthy:"\u914D\u7F6E\u6B63\u5E38",mcpSetupHint:"\u300C\u81EA\u52A8\u6302\u8F7D MCP\u300D= \u8BA9 Claude Code / Codex / Cursor \u8FD9\u4E9B\u5DE5\u5177\u80FD\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002\u5F00\u542F\u540E\u81EA\u52A8\u628A\u5B83\u4EEC\u914D\u7F6E\u597D\uFF1B\u5173\u6389\u5C31\u4E0D\u52A8\u4F60\u7535\u8111\u4E0A\u4EFB\u4F55\u914D\u7F6E\u6587\u4EF6\uFF0C\u9700\u8981\u65F6\u624B\u52A8\u8DD1 dsh-memory setup\u3002",mcpManageHint:"\u6BCF\u4E2A agent \u7528\u4E0B\u65B9\u6309\u94AE\u5355\u72EC\u5B89\u88C5/\u5378\u8F7D MCP",tabConfig:"\u8BB0\u5FC6\u914D\u7F6E",tabAudit:"\u5BA1\u6838\u4E2D\u5FC3",statusApproved:"\u5DF2\u5BA1\u6838",statusPending:"\u5F85\u5BA1\u6838",statusRejected:"\u5DF2\u9A73\u56DE",allStatus:"\u5168\u90E8\u72B6\u6001",tabRecycle:"\u56DE\u6536\u4E2D\u5FC3",pending:"\u5F85\u5BA1\u6838",rejected:"\u5DF2\u9A73\u56DE",selectAll:"\u5168\u9009",approve:"\u6279\u51C6",reject:"\u9A73\u56DE",allAgents:"\u5168\u90E8\u667A\u80FD\u4F53",noAuditItems:"\u6682\u65E0\u5BA1\u6838\u9879\u76EE",deletedAt:"\u5220\u9664\u4E8E",restore:"\u6062\u590D",restoreDelete:"\u5220\u9664\u8FDB\u56DE\u6536\u7AD9",purge:"\u6C38\u4E45\u5220\u9664",emptyRecycle:"\u56DE\u6536\u7AD9\u4E3A\u7A7A",recycleHint:"\u5220\u9664\u7684\u5361\u7247\u5148\u8FDB\u56DE\u6536\u7AD9\uFF0C30 \u5929\u5185\u53EF\u6062\u590D\uFF0C\u8D85\u671F\u81EA\u52A8\u6C38\u4E45\u5220\u9664",purgeConfirm:"\u786E\u5B9A\u6C38\u4E45\u5220\u9664\uFF1F\u4E0D\u53EF\u6062\u590D\u3002",recycleDeleteConfirm:"\u786E\u5B9A\u5220\u9664\u8FDB\u56DE\u6536\u7AD9\uFF1F30 \u5929\u5185\u53EF\u6062\u590D\u3002",modeInit:"\u542F\u52A8\u65F6\u62C9\u4E00\u6B21",modeInterval:"\u5468\u671F\u4FDD\u6D3B",modeManual:"\u4EC5\u624B\u52A8",serviceConfig:"\u670D\u52A1\u81EA\u7BA1\u7406\u914D\u7F6E",auditConfig:"\u81EA\u52A8\u5BA1\u6838\u914D\u7F6E",auditHint:"\u547D\u4E2D\u514D\u5BA1\u7684\u65B0\u5361\u76F4\u63A5\u5165\u5E93\uFF0C\u5176\u4F59\u8FDB\u5F85\u5BA1\u6838",auditMode:"\u5BA1\u6838\u6A21\u5F0F",auditAll:"\u5168\u90E8\u8981\u5BA1\u6838",auditNone:"\u5168\u90E8\u514D\u5BA1",auditExemptAgents:"\u514D\u5BA1\u667A\u80FD\u4F53",auditExemptKinds:"\u514D\u5BA1\u7C7B\u578B",allExempt:"\u5168\u90E8\u514D\u5BA1",recycleDays:"\u56DE\u6536\u4FDD\u7559\u5929\u6570",editInSetting:"\u7F16\u8F91\u8BF7\u5230 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6",setupRunInTerminal:"\u8BF7\u590D\u5236\u4EE5\u4E0B\u547D\u4EE4\u5230\u7EC8\u7AEF\u6267\u884C\uFF1A",dshMemoryConfig:"DSH \u8BB0\u5FC6\u914D\u7F6E",autoCapture:"\u81EA\u52A8\u6C89\u6DC0",autoRecall:"\u81EA\u52A8\u53EC\u56DE",captureMinChars:"\u6355\u83B7\u6700\u5C0F\u957F\u5EA6",maxCardsPerDay:"\u65E5\u914D\u989D",dedupThreshold:"\u53BB\u91CD\u9608\u503C",recallLimit:"\u53EC\u56DE\u6761\u6570",vaultMulti:"\u591A\u5E93\uFF08\u6309\u9879\u76EE\u9694\u79BB\uFF09",vaultMultiHint:"\u7559\u7A7A\u5373\u5355\u5E93\uFF0C\u8001\u914D\u7F6E\u4E0D\u53D7\u5F71\u54CD",vaultNow:"\u5F53\u524D\u751F\u6548",vaultSource:"\u6765\u6E90",vaultWorkspace:"\u5F53\u524D workspace",vaultNamePh:"\u5E93\u540D\uFF0C\u5982 work",vaultPathPh:"\u76EE\u5F55\uFF0C\u5982 D:/vaults/work",vaultMatchPh:"\u9879\u76EE\u76EE\u5F55\uFF08\u53EF\u9009\uFF0C\u6309 workspace \u81EA\u52A8\u9009\u5E93\uFF09",vaultAdd:"\u6DFB\u52A0\u4E00\u4E2A\u5E93",vaultActive:"\u6FC0\u6D3B\u5E93",vaultActiveNone:"\u9ED8\u8BA4\u5E93\uFF08\u4E0D\u6307\u5B9A\uFF09",vaultSrcEnv:"\u73AF\u5883\u53D8\u91CF MEMORY_VAULT_DIR",vaultSrcProfile:"\u6FC0\u6D3B\u5E93\u914D\u7F6E",vaultSrcWorkspace:"\u6309\u9879\u76EE\u76EE\u5F55\u81EA\u52A8\u547D\u4E2D",vaultSrcVaultDir:"\u5355\u5E93\u914D\u7F6E vaultDir",vaultSrcDefault:"\u9ED8\u8BA4\u76EE\u5F55",recallSummaryLen:"\u53EC\u56DE\u6458\u8981\u957F\u5EA6",recallBody:"\u53EC\u56DE\u542B\u6B63\u6587",autoWeb:"Web server",autoWebMode:"\u4FDD\u6D3B\u6A21\u5F0F",webPort:"Web \u7AEF\u53E3",webCheckIntervalMs:"\u63A2\u6D3B\u95F4\u9694(ms)",webMaxRestart:"\u6700\u5927\u91CD\u542F\u6B21\u6570",watchdogAutoSpawn:"\u770B\u95E8\u72D7\u8FDB\u7A0B",autoMcpSetup:"\u81EA\u52A8\u6302\u8F7D MCP",saveConfig:"\u4FDD\u5B58\u914D\u7F6E",saveFail:"\u4FDD\u5B58\u5931\u8D25",savedOk:"\u5DF2\u4FDD\u5B58",recallTool:"recall \u5DE5\u5177",costControl:"\u6210\u672C\u63A7\u5236",costHint:"\u7701 token\u3001\u63A7 LLM \u6D88\u8017",distillEnabled:"\u84B8\u998F\u77E5\u8BC6\u5361(\u5F00=LLM \u538B\u7F29, \u5173=\u539F\u6587\u5361\u96F6 LLM)",dedupByLLM:"\u8BED\u4E49\u53BB\u91CD\u5582 LLM(\u5173=\u7EAF\u8BCD\u6CD5\u66F4\u7701)",captureMaxTokens:"\u84B8\u998F\u8F93\u51FA\u4E0A\u9650(token)",recallMinScore:"\u53EC\u56DE\u76F8\u5173\u6027\u9608\u503C(\u8D8A\u9AD8\u8D8A\u7701)",configNeedsDsh:"\u914D\u7F6E\u7F16\u8F91\u9700\u5728 DSH \u5185\u6253\u5F00\uFF08\u672C\u9875\u53EF\u80FD\u53EA\u8BFB\u6216\u6709\u90E8\u5206\u7F3A\u5931\uFF09",installMcp:"\u5B89\u88C5 MCP",uninstallMcp:"\u5378\u8F7D MCP",uninstallConfirm:"\u786E\u8BA4\u5378\u8F7D\u8BE5\u667A\u80FD\u4F53\u7684 MCP\uFF1FClaude Code/Codex \u5C06\u65E0\u6CD5\u518D\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002",presetConfig:"\u4E00\u952E\u63A8\u8350\u914D\u7F6E",presetHint:"\u70B9\u51FB\u586B\u5145\u5BF9\u5E94\u65B9\u6848\uFF0C\u70B9\u4FDD\u5B58\u751F\u6548",planA:"A \u8F7B\u91CF\u7701\u5FC3",planB:"B \u6781\u81F4\u7701\u94B1",planC:"C \u9AD8\u8D28\u91CF",pluginInfo:"\u63D2\u4EF6\u4FE1\u606F",organizeTitle:"\u6574\u7406\u5EFA\u8BAE",scanAndOrganize:"\u4E00\u952E\u641C\u7D22\u548C\u6574\u7406",scanHint:"\u70B9\u300C\u{1F50D} \u4E00\u952E\u641C\u7D22\u548C\u6574\u7406\u300D\u626B\u63CF\u76F8\u4F3C\u5361/\u9648\u65E7\u5361\uFF0C\u518D\u7528\u300C\u26A1 \u4E00\u952E\u4F18\u5316\u300D\u6267\u884C\u3002",mergeNow:"\u5408\u5E76",delete:"\u5220\u9664",captureAlert:"\u81EA\u52A8\u6C89\u6DC0\u5F02\u5E38",captureAlertHint:"\u6253\u5F00\u5DE6\u680F\u300C\u7528\u91CF/\u4ECA\u65E5\u300D\u770B\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7\uFF1B\u82E5\u662F\u63A5\u53E3/\u7248\u672C\u4E0D\u5339\u914D\uFF0C\u9700\u66F4\u65B0 memory-eternal \u63D2\u4EF6\u3002",captureLog:"\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7",captureLogHint:"\u6BCF\u8F6E\u5BF9\u8BDD\u7ED3\u675F\u540E\u81EA\u52A8\u8DD1\uFF1A\u76D1\u542C \u2192 \u5224\u5B9A \u2192 \u5199\u5361\u3002\u8FD9\u91CC\u663E\u793A\u6700\u8FD1 100 \u6761\uFF0C\u7528\u6765\u6392\u67E5\u300C\u4E3A\u4EC0\u4E48\u6CA1\u5199\u5361\u300D\u3002",captureLogEmpty:"\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002\u8DDF Agent \u804A\u4E00\u8F6E\uFF08> \u6355\u83B7\u6700\u5C0F\u957F\u5EA6\uFF09\u540E\u518D\u56DE\u6765\u770B\u3002",captureLogUnavailable:"\u65E5\u5FD7\u4EC5\u5728 DSH \u5BBF\u4E3B\u5185\u53EF\u7528\uFF08\u72EC\u7ACB Web \u9875\u6CA1\u6709 host \u8FD0\u884C\u65F6\uFF09\u3002",captureAgentCards:"Agent \u81EA\u52A8\u6C89\u6DC0\u7684\u5361",noCards:"\u6682\u65E0",loadMore:"\u52A0\u8F7D\u66F4\u591A",batchMerge:"\u4E00\u952E\u667A\u80FD\u5408\u5E76",mergeAllConfirm:"\u5C06\u6309\u76F8\u4F3C\u5EA6\u5206\u7EC4\u7684\u5361\u7247\u5404\u5408\u5E76\u4E3A\u4E00\u5F20\uFF08\u4FDD\u7559\u5404\u81EA kind\uFF09\uFF0C\u539F\u5361\u5220\u9664\uFF1F",crossVault:"\u8DE8\u5E93\u805A\u5408",deleteConfirm:"\u786E\u5B9A\u5220\u9664\u8BE5\u8BB0\u5FC6\u5361\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002",deleted:"\u5DF2\u5220\u9664",deleteFail:"\u5220\u9664\u5931\u8D25",deleteSelected:"\u5220\u9664\u9009\u4E2D",deletedSelected:"\u5F20\u5361\u5DF2\u5220\u9664",merge:"\u5408\u5E76",mergeNeed:"\u81F3\u5C11\u9009 2 \u5F20\u5361",mergeConfirm:"\u5C06\u6240\u9009\u5361\u7247\u5408\u5E76\u4E3A\u4E00\u5F20\u5E76\u5220\u9664\u539F\u5361\uFF1F",merged:"\u5DF2\u5408\u5E76",mergeFail:"\u5408\u5E76\u5931\u8D25",mcpInstalled:"\u2705 {agent} MCP \u5DF2\u5B89\u88C5",mcpUninstalled:"\u2705 {agent} MCP \u5DF2\u5378\u8F7D",mcpActionFail:"\u274C {agent} MCP \u64CD\u4F5C\u5931\u8D25\uFF1A{error}",dshHostLabel:"DeepSeek Harness\uFF08\u5F53\u524D\u5BBF\u4E3B\uFF09",restartHint:"\u5DF2\u4FDD\u5B58\u3002autoWebMode/watchdogAutoSpawn \u7B49\u9700\u91CD\u542F DSH \u751F\u6548",conflictRefresh:"\u914D\u7F6E\u5DF2\u88AB\u5916\u90E8\u4FEE\u6539\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5",untitled:"\u65E0\u6807\u9898",tplBlank:"\u{1F4C4} \u7A7A\u767D",tagsHint:"\u6807\u7B7E\uFF08\u9017\u53F7\u5206\u9694\uFF09",connCount:"{n} \u8FDE\u63A5",tplDecisionTags:"\u51B3\u7B56, \u65B9\u6848",tplBugTags:"\u8E29\u5751, \u6559\u8BAD",tplMeetingTags:"\u4F1A\u8BAE, \u7EAA\u8981",tplWeeklyTags:"\u5468\u62A5",tplDecisionBody:`# \u6280\u672F\u51B3\u7B56\uFF1A[\u6807\u9898]
|
|
6
|
+
var ea=Object.create;var xt=Object.defineProperty;var ta=Object.getOwnPropertyDescriptor;var aa=Object.getOwnPropertyNames;var na=Object.getPrototypeOf,oa=Object.prototype.hasOwnProperty;var ia=(t,o)=>{for(var i in o)xt(t,i,{get:o[i],enumerable:!0})},Et=(t,o,i,g)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of aa(o))!oa.call(t,p)&&p!==i&&xt(t,p,{get:()=>o[p],enumerable:!(g=ta(o,p))||g.enumerable});return t};var la=(t,o,i)=>(i=t!=null?ea(na(t)):{},Et(o||!t||!t.__esModule?xt(i,"default",{value:t,enumerable:!0}):i,t)),ra=t=>Et(xt({},"__esModule",{value:!0}),t);var Oa={};ia(Oa,{EN:()=>Xt,MemoryLibrary:()=>Na,ZH:()=>qt,apply:()=>va,inject:()=>ya});module.exports=ra(Oa);var n=la(require("react"),1);var sa={"&":"&","<":"<",">":">"},St=t=>String(t).replace(/[&<>]/g,o=>sa[o]),da=[[/结论|总结|tl;?dr|summary|takeaway/i,"\u2705","ok"],[/风险|注意|警告|禁止|坑|踩坑|务必/i,"\u26A0\uFE0F","warn"],[/根因|原因|为什么|定位|复现/i,"\u{1F50D}","info"],[/修复|解决|变更|fix/i,"\u{1F527}","ok"],[/验证|测试|实测|回归/i,"\u{1F9EA}","ok"],[/方案|做法|实现|设计|思路|架构/i,"\u{1F6E0}\uFE0F","plan"],[/步骤|流程|操作|用法|命令/i,"\u{1F9E9}","plan"],[/背景|由来|context/i,"\u{1F9ED}","info"],[/目标|需求|要解决/i,"\u{1F3AF}","plan"],[/环境|依赖|前置|安装/i,"\u{1F4E6}","info"],[/收益|效果|性能|指标|数据|统计/i,"\u{1F4C8}","ok"],[/示例|例子|样例|demo/i,"\u{1F4A1}","idea"],[/参考|链接|相关/i,"\u{1F517}","info"]],ca=["\u2728","info"],pa=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],ua=t=>{let o=String(t);for(let[i,g,p]of da)if(i.test(o))return[g,p];return ca},ma=t=>{let o=t.join(" ");for(let[i,g,p]of pa)if(i.test(o))return[g,p];return["\u{1F4CC}","info"]};function at(t){let o=String(t),i=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(o);if(i&&!/[是为有了吗呢着过把被和与或于]/.test(i[1]))return'<span class="md-kv"><span class="md-k">'+St(i[1])+'</span><span class="md-v">'+at(i[2])+"</span></span>";let g=St(o);return g=g.replace(/^\[([ xX])\](?=\s|$)\s*/,(p,l)=>'<span class="md-task">'+(l.toLowerCase()==="x"?"\u2611":"\u2610")+"</span> "),g=g.replace(/`([^`\n]+)`/g,'<code class="md-code">$1</code>'),g=g.replace(/\*\*([^*]+)\*\*/g,'<strong class="md-b">$1</strong>'),g=g.replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>"),g=g.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(p,l,v)=>/^(https?:|\/|#)/i.test(v)?'<a class="md-link" href="'+v+'" target="_blank" rel="noopener noreferrer">'+l+"</a>":l),g}function Nt(t){let o=String(t||"").replace(/\r\n?/g,`
|
|
7
|
+
`),i=/^---\n([\s\S]*?)\n---\n?/.exec(o);if(!i)return{meta:[],body:o};let g=[];for(let p of i[1].split(`
|
|
8
|
+
`)){let l=p.indexOf(":");if(l<=0)continue;let v=p.slice(0,l).trim(),S=p.slice(l+1).trim().replace(/^["']|["']$/g,"");v&&g.push([v,S])}return{meta:g,body:o.slice(i[0].length)}}function Ft(t){let o=String(t||"").trim().replace(/^\[|\]$/g,"");return o?o.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function jt(t){let o=Nt(String(t||"").replace(/\r\n?/g,`
|
|
9
|
+
`)).body;if(!o.trim())return"";let i=[],g=o.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(m,M,z)=>(i.push('<pre class="md-pre"><code>'+St(z.replace(/\n$/,""))+"</code></pre>"),"\0F"+(i.length-1)+"\0")),p=[],l=[],v=null,S=null,x=()=>{l.length&&(p.push('<p class="md-p">'+l.join("<br/>")+"</p>"),l=[])},A=()=>{if(!v)return;let m=v.type;p.push("<"+m+' class="md-'+m+'">'+v.items.map(M=>"<li>"+M+"</li>").join("")+"</"+m+">"),v=null},k=()=>{if(!S)return;let[m,M]=ma(S);p.push('<div class="md-callout md-c-'+M+'"><span class="md-ico">'+m+"</span>"+S.join("<br/>")+"</div>"),S=null},y=()=>{x(),A(),k()};for(let m of g.split(`
|
|
10
|
+
`)){let M=m.trim();if(!M){y();continue}let z=/^\u0000F(\d+)\u0000$/.exec(M);if(z){y(),p.push(i[Number(z[1])]);continue}let w;if(w=/^(#{1,6})\s+(.+)$/.exec(M)){y();let[L,N]=ua(w[2]);p.push('<div class="md-h md-h-'+(w[1].length<=2?"h1":"h2")+" md-c-"+N+'"><span class="md-ico">'+L+'</span><span class="md-hx">'+at(w[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(M)){y(),p.push('<hr class="md-hr"/>');continue}if(w=/^>\s?(.*)$/.exec(M)){x(),A(),S=S||[],S.push(at(w[1]));continue}if(w=/^[-*+]\s+(.+)$/.exec(M)){x(),k(),(!v||v.type!=="ul")&&(A(),v={type:"ul",items:[]}),v.items.push(at(w[1]));continue}if(w=/^\d+[.)]\s+(.+)$/.exec(M)){x(),k(),(!v||v.type!=="ol")&&(A(),v={type:"ol",items:[]}),v.items.push(at(w[1]));continue}A(),k(),l.push(at(M))}return y(),p.join(`
|
|
11
|
+
`)}function Ot(t={}){let o=t.repo||"EternalNight996/memory-eternal",i=String(t.title||"[Bug] ").slice(0,120),g=Array.isArray(t.labels)?t.labels:["bug"],p=Number(t.maxLength)>500?Number(t.maxLength):7e3,l=x=>{let A=new URLSearchParams;return A.set("title",i),A.set("body",x),g.length&&A.set("labels",g.join(",")),"https://github.com/"+o+"/issues/new?"+A.toString()},v=String(t.body||""),S=l(v);if(S.length>p){let x=`
|
|
12
|
+
|
|
13
|
+
> \u5185\u5BB9\u8FC7\u957F\u5DF2\u622A\u65AD\uFF1A\u5B8C\u6574\u8BCA\u65AD\u8BF7\u5728\u63D2\u4EF6\u91CC\u70B9\u300C\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u300D\uFF0C\u518D\u8865\u5230 issue \u8BC4\u8BBA\u91CC\u3002`,A=k=>l(v.slice(0,k)+x);if(A(0).length>p)v=x;else{let k=0,y=v.length;for(;k<y;){let m=Math.ceil((k+y)/2);A(m).length<=p?k=m:y=m-1}v=v.slice(0,k)+x}S=l(v)}return S}function Ht(t={}){return["## \u73B0\u8C61",String(t.description||"").trim()||"\uFF08\u8BF7\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF09","","## \u590D\u73B0\u6B65\u9AA4","1. ","2. ","","## \u671F\u671B\u884C\u4E3A","","## \u5B9E\u9645\u884C\u4E3A","","## \u73AF\u5883","- \u63D2\u4EF6\u7248\u672C: "+(t.version||"\uFF08\u89C1\u8BCA\u65AD\u4FE1\u606F\uFF09"),"",t.diagnostics||"","","---","> \u7531 memory-eternal \u63D2\u4EF6\u5185\u300C\u53CD\u9988\u5F02\u5E38\u300D\u751F\u6210\uFF08\u8BCA\u65AD\u4FE1\u606F\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E\u5404\u7C7B key/token \u5DF2\u66FF\u6362\uFF09\u3002"].join(`
|
|
14
|
+
`)}var Mt="https://github.com/EternalNight996/memory-eternal",ga=["\u6211\u5728\u4F7F\u7528 memory-eternal\uFF08DeepSeek Harness \u7684\u8BB0\u5FC6\u63D2\u4EF6\uFF09\u65F6\u9047\u5230\u4E86\u95EE\u9898\uFF0C\u8BF7\u4F60\u5E2E\u6211\u628A\u8FD9\u4E2A\u95EE\u9898\u63D0\u4EA4\u5230 GitHub\u3002","","\u4ED3\u5E93\uFF1A"+Mt,"","\u8BF7\u6309\u8FD9\u4E2A\u6D41\u7A0B\u505A\uFF1A","","1. \u5148\u8DD1 `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50`\uFF0C\u770B\u662F\u5426\u5DF2\u6709\u76F8\u540C\u95EE\u9898\uFF1A"," - \u5DF2\u6709 \u2192 \u7528 `gh issue comment <\u7F16\u53F7> --body-file <\u6587\u4EF6>` \u8865\u5145\u73B0\u8C61\uFF0C\u4E0D\u8981\u91CD\u590D\u5F00\u65B0 issue\uFF1B"," - \u6CA1\u6709 \u2192 \u7EE7\u7EED\u7B2C 2 \u6B65\u3002",'2. \u628A\u6B63\u6587\u5199\u6210\u6587\u4EF6\uFF0C\u7136\u540E `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <\u4E00\u53E5\u8BDD\u6982\u62EC>" --body-file <\u6587\u4EF6>`\uFF1B\u6B63\u6587\u7528\u8FD9\u4E2A\u7ED3\u6784\uFF1A'," \u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A / \u5B9E\u9645\u884C\u4E3A / \u73AF\u5883\uFF08\u63D2\u4EF6\u7248\u672C / DSH \u7248\u672C / \u64CD\u4F5C\u7CFB\u7EDF / Node\uFF09/ \u8BCA\u65AD\u4FE1\u606F\u3002","3. \u5982\u679C `gh` \u6CA1\u767B\u5F55\u6216\u4E0D\u53EF\u7528\uFF0C\u4E0D\u8981\u5C1D\u8BD5\u63D0\u4EA4\uFF0C\u6539\u4E3A\u8F93\u51FA\u4E00\u6761\u300C\u6807\u9898\u4E0E\u6B63\u6587\u90FD\u5DF2\u9884\u586B\u300D\u7684 GitHub \u65B0\u5EFA issue \u94FE\u63A5\u7ED9\u6211\uFF0C\u6211\u81EA\u5DF1\u70B9\u63D0\u4EA4\u3002","4. \u63D0\u4EA4\u6210\u529F\u540E\uFF0C\u628A issue \u94FE\u63A5\u53D1\u7ED9\u6211\u3002","","\u6CE8\u610F\uFF1A\u6211\u7684\u95EE\u9898\u63CF\u8FF0\u8BF7\u539F\u6837\u7167\u5F55\uFF0C\u4E0D\u8981\u66FF\u6211\u7F8E\u5316\u6216\u7701\u7565\u7EC6\u8282\uFF1B\u8BCA\u65AD\u4FE1\u606F\u539F\u6837\u653E\u8FDB\u300C\u8BCA\u65AD\u4FE1\u606F\u300D\u4E00\u8282\u3002","","\u6211\u7684\u95EE\u9898\u63CF\u8FF0\uFF1A","<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>","","\u8BCA\u65AD\u4FE1\u606F\uFF1A","<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>"].join(`
|
|
15
|
+
`),fa=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+Mt,"","Workflow:","","1. Run `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50` first: if a matching issue exists, add a comment with `gh issue comment <n> --body-file <file>` instead of opening a duplicate.",'2. Otherwise create it with `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <one-line summary>" --body-file <file>`, using sections: Symptoms / Steps to reproduce / Expected / Actual / Environment (plugin, DSH, OS, Node) / Diagnostics.',"3. If `gh` is not authenticated or unavailable, do NOT try to submit: output a GitHub new-issue link with the title and body pre-filled instead, and I will click submit myself.","4. Report the resulting issue URL back to me.","","Keep my description verbatim - do not rewrite or summarise it. Put the diagnostics under the Diagnostics section as-is.","","My description:","<write your problem here>","","Diagnostics:","<paste the diagnostics copied from the in-app Report-a-bug dialog>"].join(`
|
|
16
|
+
`);function Wt(t={}){let o=t.lang==="en"?"en":"zh",i=o==="en"?fa:ga,g=t.repo||"EternalNight996/memory-eternal";return i=i.split(Mt).join("https://github.com/"+g),t.description&&(i=i.replace(o==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(i=i.replace(o==="en"?"<paste the diagnostics copied from the in-app Report-a-bug dialog>":"<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>",String(t.diagnostics).trim())),i}function $t({panX:t=0,panY:o=0,zoom:i=1,w:g=0,h:p=0,margin:l=60}={}){let v=i||1;return{x0:(0-t)/v-l,y0:(0-o)/v-l,x1:(g-t)/v+l,y1:(p-o)/v+l}}function vt(t,o,i,g){return g?t+i>=g.x0&&t-i<=g.x1&&o+i>=g.y0&&o-i<=g.y1:!0}function _t(t){let o=Number(t)||0;return o<=120?1/0:o<=300?160:o<=600?90:60}function Ut(t,o={}){let i=Number.isFinite(o.limit)?o.limit:1/0,g=new Set,p=x=>{x&&g.size<i&&g.add(x)};if(p(o.focusId),p(o.hoverId),o.searchHits)for(let x of o.searchHits){if(g.size>=i)break;g.add(x)}let l=o.degree||{},v=x=>Number(l[x])||0,S=[];for(let x of Array.isArray(t)?t:[])x&&x.id&&!g.has(x.id)&&S.push(x);S.sort((x,A)=>v(A.id)-v(x.id));for(let x of S){if(g.size>=i)break;g.add(x.id)}return g}var e=require("react/jsx-runtime"),nt="memory-eternal",Y="/memory-eternal/api",ba=100,ya=["slots","locale"],qt={nav:"\u8BB0\u5FC6",loading:"\u52A0\u8F7D\u4E2D\u2026",refresh:"\u5237\u65B0",overview:"\u8BB0\u5FC6\u5E93\u6982\u89C8",total:"\u77E5\u8BC6\u5361",recent:"\u8FD1 7 \u5929\u65B0\u589E",tags:"\u6807\u7B7E",searchPlaceholder:"\u641C\u7D22\u8BB0\u5FC6\uFF08\u652F\u6301\u4E2D\u6587\u7247\u6BB5\uFF09\u2026",search:"\u641C\u7D22",all:"\u5168\u90E8",kindProject:"\u9879\u76EE",kindKnowledge:"\u77E5\u8BC6",kindContent:"\u5185\u5BB9",kindPrompt:"\u63D0\u793A\u8BCD",kindBusiness:"\u4E1A\u52A1",kindTool:"\u5DE5\u5177",kindMistake:"\u6559\u8BAD",cardsTab:"\u77E5\u8BC6\u5361",graphTab:"\u77E5\u8BC6\u56FE\u8C31",graph:"\u77E5\u8BC6\u56FE\u8C31",graphHint:"\u8282\u70B9=\u77E5\u8BC6\u5361\uFF1B\u8FDE\u7EBF=[[\u94FE\u63A5]] \u6216\u5171\u4EAB\u6807\u7B7E\u3002\u70B9\u51FB\u8282\u70B9\u9605\u8BFB\u5361\u7247\u3002",graphTip:"\u5DE6\u952E\u51F8\u663E \xB7 Shift+\u62D6\u62FD\u6846\u9009 \xB7 \u53F3\u952E\u83DC\u5355 \xB7 \u6EDA\u8F6E\u7F29\u653E \xB7 \u62D6\u62FD\u5E73\u79FB",rebuild:"\u91CD\u5EFA",reset:"\u91CD\u7F6E",expandAll:"\u5168\u90E8\u5C55\u5F00",capped:"\u5DF2\u5C55\u793A\u6700\u6838\u5FC3\u7684",clearFocus:"\u53D6\u6D88\u9AD8\u4EAE",empty:"\u8BB0\u5FC6\u5E93\u8FD8\u662F\u7A7A\u7684\u3002\u591A\u804A\u51E0\u8F6E\u540E\uFF0C\u503C\u5F97\u4FDD\u5B58\u7684\u5185\u5BB9\u4F1A\u81EA\u52A8\u6C89\u6DC0\u6210\u77E5\u8BC6\u5361\u3002",emptyGraph:"\u56FE\u8C31\u6682\u65E0\u6570\u636E\u3002",open:"\u9605\u8BFB",updated:"\u66F4\u65B0\u4E8E",created:"\u521B\u5EFA\u4E8E",source:"\u6765\u6E90",close:"\u5173\u95ED",vaultDir:"\u8BB0\u5FC6\u5E93\u76EE\u5F55",capture:"\u81EA\u52A8\u6C89\u6DC0",recall:"\u81EA\u52A8\u53EC\u56DE",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u7981\u7528",error:"\u52A0\u8F7D\u5931\u8D25",back:"\u8FD4\u56DE\u5217\u8868",cardCount:"\u5F20\u5361",nodes:"\u8282\u70B9",edges:"\u8FDE\u7EBF",memoryTitle:"\u8BB0\u5FC6\u5E93",memoryHint:"\u4F60\u7684\u672C\u5730\u7B2C\u4E8C\u5927\u8111",zoomIn:"\u653E\u5927",zoomOut:"\u7F29\u5C0F",fit:"\u9002\u5E94",enterFullscreen:"\u5168\u5C4F",exitFullscreen:"\u9000\u51FA\u5168\u5C4F",exportGraph:"\u5BFC\u51FA",openCard:"\u6253\u5F00\u5361\u7247",focusNeighbors:"\u51F8\u663E\u5173\u8054",copyName:"\u590D\u5236\u540D\u79F0",noMatch:"\u6CA1\u6709\u5339\u914D\u7684\u8BB0\u5FC6",clearFilter:"\u6E05\u9664\u8FC7\u6EE4",filterLabel:"\u7B5B\u9009",sortRecent:"\u6700\u8FD1",sortTitle:"\u6807\u9898",sortHot:"\u70ED\u70B9",exportSel:"\u5BFC\u51FA\u9009\u4E2D",clearSelection:"\u6E05\u7A7A\u9009\u62E9",download:"\u4E0B\u8F7D",openNewTab:"\u65B0\u6807\u7B7E\u6253\u5F00",copyImage:"\u590D\u5236\u56FE\u7247",done:"\u5B8C\u6210",downloaded:"\u5DF2\u5F00\u59CB\u4E0B\u8F7D",openedTab:"\u5DF2\u5728\u65B0\u6807\u7B7E\u6253\u5F00",copied:"\u5DF2\u590D\u5236",exportedSel:"\u4E2A\u8282\u70B9\u5DF2\u5BFC\u51FA",fullscreen:"\u5168\u5C4F",exitFull:"\u9000\u51FA\u5168\u5C4F",copyFail:"\u590D\u5236\u5931\u8D25",timeDim:"\u65F6\u95F4\u7EF4",timeNew:"3 \u5929\u5185",timeRecent:"2 \u5468\u5185",timeMonth:"1 \u6708\u5185",timeOld:"\u66F4\u65E9",newBadge:"\u65B0",expand:"\u5C55\u5F00\u5168\u90E8",collapse:"\u6536\u8D77",exportVault:"\u5BFC\u51FAMD",exportJson:"\u5BFC\u51FAJSON",exporting:"\u5BFC\u51FA\u4E2D\u2026",exportedVault:"\u8BB0\u5FC6\u5E93\u5DF2\u5BFC\u51FA",exportFail:"\u5BFC\u51FA\u5931\u8D25",importVault:"\u5BFC\u5165",importedVault:"\u5BFC\u5165\u5B8C\u6210",importedSkipped:"\uFF08\u8DF3\u8FC7\u91CD\u590D ",importFail:"\u5BFC\u5165\u5931\u8D25",location:"\u81EA\u9009\u4F4D\u7F6E",saveAs:"\u53E6\u5B58\u4E3A",saveAsUnsupported:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u9009\u62E9\u4FDD\u5B58\u4F4D\u7F6E",exportedTo:"\u5DF2\u5BFC\u51FA\u5230",defaultDownloads:"\u9ED8\u8BA4\u4E0B\u8F7D\u6587\u4EF6\u5939",exportCancel:"\u5DF2\u53D6\u6D88\u5BFC\u51FA",manage:"\u7BA1\u7406",tabUsage:"\u7528\u91CF/\u4ECA\u65E5",tabOptimize:"\u6574\u7406\u5EFA\u8BAE",adminLoadFail:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF1A\u8BF7\u5F7B\u5E95\u91CD\u542F dsh-desktop\uFF08host \u9700\u52A0\u8F7D\u65B0\u7248 /memory-eternal \u8DEF\u7531\uFF09",retry:"\u91CD\u8BD5",mergeSimilar:"\u4E00\u952E\u5408\u5E76\u76F8\u4F3C",trendLabel:"\u8FD1 30 \u5929\u8D8B\u52BF",cleanStale:"\u{1F5D1}\uFE0F \u4E00\u952E\u6E05\u7406\u9648\u65E7",deletedStale:"\u4E2A\u9648\u65E7\u5361\u5DF2\u6E05\u7406",newCard:"\u65B0\u5EFA",tplDecision:"\u{1F4DD} \u6280\u672F\u51B3\u7B56",tplBug:"\u{1F41B} \u8E29\u5751",tplMeeting:"\u{1F4CB} \u4F1A\u8BAE\u7EAA\u8981",tplWeekly:"\u{1F4CA} \u5468\u62A5",createCard:"\u521B\u5EFA",cardTitle:"\u6807\u9898",cardBody:"\u6B63\u6587",fbUseful:"\u6709\u7528",fbIrr:"\u65E0\u5173",todayAdd:"\u4ECA\u65E5\u65B0\u589E",weekAdd:"\u8FD1 7 \u5929",byKind:"\u5206\u7C7B\u7EDF\u8BA1",todayList:"\u4ECA\u65E5\u6C89\u6DC0",budgetLabel:"\u4F1A\u8BDD\u9884\u7B97",budgetChars:"\u9884\u7B97\u5B57\u7B26",recallLimitLabel:"\u53EC\u56DE\u6761\u6570",embeddingLabel:"\u8BED\u4E49\u53EC\u56DE",mergePairs:"\u76F8\u4F3C\u5361\u5BF9\uFF08\u53EF\u5408\u5E76\uFF09",staleCards:"\u9648\u65E7\u5361\uFF08>90 \u5929\u672A\u66F4\u65B0\uFF09",noOptimize:"\u6682\u65E0\u53EF\u6574\u7406\u9879\uFF0C\u5F88\u5065\u5EB7 \u{1F389}",oneClickOptimize:"\u4E00\u952E\u4F18\u5316",oneClickOptimizeConfirm:"\u786E\u8BA4\u4E00\u952E\u4F18\u5316\uFF1F\u5C06\u5408\u5E76\u6240\u6709\u76F8\u4F3C\u5361\u5BF9\uFF08\u9ED8\u8BA4\u4E0D\u6E05\u7406\u9648\u65E7\u5361\uFF09\u3002",oneClickAlsoStale:"\u540C\u65F6\u6E05\u7406\u9648\u65E7\u5361",oneClickOptimizeDone:"\u4E00\u952E\u4F18\u5316\u5B8C\u6210",optimizedMerged:"\u5BF9\u5DF2\u5408\u5E76",optimizedStaleDeleted:"\u5F20\u9648\u65E7\u5361\u5DF2\u6E05\u7406",mcpSetupStatus:"Agent MCP \u6302\u8F7D\u72B6\u6001",rerunSetup:"\u8865\u5168 MCP",notInstalled:"\u672A\u5B89\u88C5",noMcpEntry:"\u914D\u7F6E\u7F3A\u5931",nodePathMismatch:"node \u8DEF\u5F84\u4E0D\u4E00\u81F4\uFF0C\u5EFA\u8BAE\u91CD\u8DD1 setup",nodePathNote:"node \u73AF\u5883\u4E0D\u540C\uFF08\u53EF\u7528\uFF09",healthy:"\u914D\u7F6E\u6B63\u5E38",mcpSetupHint:"\u300C\u81EA\u52A8\u6302\u8F7D MCP\u300D= \u8BA9 Claude Code / Codex / Cursor \u8FD9\u4E9B\u5DE5\u5177\u80FD\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002\u5F00\u542F\u540E\u81EA\u52A8\u628A\u5B83\u4EEC\u914D\u7F6E\u597D\uFF1B\u5173\u6389\u5C31\u4E0D\u52A8\u4F60\u7535\u8111\u4E0A\u4EFB\u4F55\u914D\u7F6E\u6587\u4EF6\uFF0C\u9700\u8981\u65F6\u624B\u52A8\u8DD1 dsh-memory setup\u3002",mcpManageHint:"\u6BCF\u4E2A agent \u7528\u4E0B\u65B9\u6309\u94AE\u5355\u72EC\u5B89\u88C5/\u5378\u8F7D MCP",tabConfig:"\u8BB0\u5FC6\u914D\u7F6E",tabAudit:"\u5BA1\u6838\u4E2D\u5FC3",statusApproved:"\u5DF2\u5BA1\u6838",statusPending:"\u5F85\u5BA1\u6838",statusRejected:"\u5DF2\u9A73\u56DE",allStatus:"\u5168\u90E8\u72B6\u6001",tabRecycle:"\u56DE\u6536\u4E2D\u5FC3",pending:"\u5F85\u5BA1\u6838",rejected:"\u5DF2\u9A73\u56DE",selectAll:"\u5168\u9009",approve:"\u6279\u51C6",reject:"\u9A73\u56DE",allAgents:"\u5168\u90E8\u667A\u80FD\u4F53",noAuditItems:"\u6682\u65E0\u5BA1\u6838\u9879\u76EE",deletedAt:"\u5220\u9664\u4E8E",restore:"\u6062\u590D",restoreDelete:"\u5220\u9664\u8FDB\u56DE\u6536\u7AD9",purge:"\u6C38\u4E45\u5220\u9664",emptyRecycle:"\u56DE\u6536\u7AD9\u4E3A\u7A7A",recycleHint:"\u5220\u9664\u7684\u5361\u7247\u5148\u8FDB\u56DE\u6536\u7AD9\uFF0C30 \u5929\u5185\u53EF\u6062\u590D\uFF0C\u8D85\u671F\u81EA\u52A8\u6C38\u4E45\u5220\u9664",purgeConfirm:"\u786E\u5B9A\u6C38\u4E45\u5220\u9664\uFF1F\u4E0D\u53EF\u6062\u590D\u3002",recycleDeleteConfirm:"\u786E\u5B9A\u5220\u9664\u8FDB\u56DE\u6536\u7AD9\uFF1F30 \u5929\u5185\u53EF\u6062\u590D\u3002",modeInit:"\u542F\u52A8\u65F6\u62C9\u4E00\u6B21",modeInterval:"\u5468\u671F\u4FDD\u6D3B",modeManual:"\u4EC5\u624B\u52A8",serviceConfig:"\u670D\u52A1\u81EA\u7BA1\u7406\u914D\u7F6E",auditConfig:"\u81EA\u52A8\u5BA1\u6838\u914D\u7F6E",auditHint:"\u547D\u4E2D\u514D\u5BA1\u7684\u65B0\u5361\u76F4\u63A5\u5165\u5E93\uFF0C\u5176\u4F59\u8FDB\u5F85\u5BA1\u6838",auditMode:"\u5BA1\u6838\u6A21\u5F0F",auditAll:"\u5168\u90E8\u8981\u5BA1\u6838",auditNone:"\u5168\u90E8\u514D\u5BA1",auditExemptAgents:"\u514D\u5BA1\u667A\u80FD\u4F53",auditExemptKinds:"\u514D\u5BA1\u7C7B\u578B",allExempt:"\u5168\u90E8\u514D\u5BA1",recycleDays:"\u56DE\u6536\u4FDD\u7559\u5929\u6570",editInSetting:"\u7F16\u8F91\u8BF7\u5230 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6",setupRunInTerminal:"\u8BF7\u590D\u5236\u4EE5\u4E0B\u547D\u4EE4\u5230\u7EC8\u7AEF\u6267\u884C\uFF1A",dshMemoryConfig:"DSH \u8BB0\u5FC6\u914D\u7F6E",autoCapture:"\u81EA\u52A8\u6C89\u6DC0",autoRecall:"\u81EA\u52A8\u53EC\u56DE",captureMinChars:"\u6355\u83B7\u6700\u5C0F\u957F\u5EA6",maxCardsPerDay:"\u65E5\u914D\u989D",dedupThreshold:"\u53BB\u91CD\u9608\u503C",recallLimit:"\u53EC\u56DE\u6761\u6570",vaultMulti:"\u591A\u5E93\uFF08\u6309\u9879\u76EE\u9694\u79BB\uFF09",vaultMultiHint:"\u7559\u7A7A\u5373\u5355\u5E93\uFF0C\u8001\u914D\u7F6E\u4E0D\u53D7\u5F71\u54CD",vaultNow:"\u5F53\u524D\u751F\u6548",vaultSource:"\u6765\u6E90",vaultWorkspace:"\u5F53\u524D workspace",vaultNamePh:"\u5E93\u540D\uFF0C\u5982 work",vaultPathPh:"\u76EE\u5F55\uFF0C\u5982 D:/vaults/work",vaultMatchPh:"\u9879\u76EE\u76EE\u5F55\uFF08\u53EF\u9009\uFF0C\u6309 workspace \u81EA\u52A8\u9009\u5E93\uFF09",vaultAdd:"\u6DFB\u52A0\u4E00\u4E2A\u5E93",vaultActive:"\u6FC0\u6D3B\u5E93",vaultActiveNone:"\u9ED8\u8BA4\u5E93\uFF08\u4E0D\u6307\u5B9A\uFF09",vaultSrcEnv:"\u73AF\u5883\u53D8\u91CF MEMORY_VAULT_DIR",vaultSrcProfile:"\u6FC0\u6D3B\u5E93\u914D\u7F6E",vaultSrcWorkspace:"\u6309\u9879\u76EE\u76EE\u5F55\u81EA\u52A8\u547D\u4E2D",vaultSrcVaultDir:"\u5355\u5E93\u914D\u7F6E vaultDir",vaultSrcDefault:"\u9ED8\u8BA4\u76EE\u5F55",fbNav:"\u53CD\u9988\u5F02\u5E38",fbTitle:"\u53CD\u9988\u5F02\u5E38\uFF08\u63D0\u4EA4\u5230 GitHub\uFF09",fbDesc:"\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF08\u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A\uFF09",fbDiag:"\u8BCA\u65AD\u4FE1\u606F\uFF08\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E key/token \u5DF2\u66FF\u6362\uFF09",fbCopyDiag:"\u590D\u5236\u8BCA\u65AD\u4FE1\u606F",fbOpenIssue:"\u5728 GitHub \u63D0\u4EA4\uFF08\u5DF2\u9884\u586B\uFF09",fbCopyPrompt:"\u590D\u5236\u7ED9 AI \u7684\u63D0\u793A\u8BCD",fbCopiedDiag:"\u8BCA\u65AD\u4FE1\u606F\u5DF2\u590D\u5236",fbCopiedPrompt:"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\uFF0C\u7C98\u8FDB AI \u5BF9\u8BDD\u6846\u5373\u53EF",fbCopyFail:"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u590D\u5236",fbWhy:"GitHub \u4E0D\u5141\u8BB8\u533F\u540D\u521B\u5EFA issue\uFF0C\u63D2\u4EF6\u91CC\u4E5F\u4E0D\u5E94\u5185\u7F6E token\uFF1A\u6240\u4EE5\u8FD9\u91CC\u628A\u6807\u9898 / \u6B63\u6587 / \u8BCA\u65AD\u90FD\u9884\u586B\u597D\uFF0C\u4F60\u53EA\u9700\u518D\u70B9\u4E00\u6B21 Submit\u3002",fbNeedDesc:"\u8BF7\u5148\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898",fbLoading:"\u6B63\u5728\u6536\u96C6\u8BCA\u65AD\u4FE1\u606F\u2026",fbDiagFail:"\u8BCA\u65AD\u63A5\u53E3\u4E0D\u53EF\u7528\uFF08\u72EC\u7ACB web \u6216\u65E7\u7248\u5BBF\u4E3B\uFF09\uFF0C\u8BF7\u624B\u52A8\u8865\u5145\u73AF\u5883\u4FE1\u606F",fbOr:"\u6216\u8005",fbSelectAll:"\u5168\u9009",toastApproved:"\u5DF2\u6279\u51C6",toastRejected:"\u5DF2\u9A73\u56DE",toastCardDeleted:"\u5DF2\u5220\u9664",toastRestored:"\u5DF2\u6062\u590D",toastPurged:"\u5DF2\u5F7B\u5E95\u5220\u9664",toastPurgedExpired:"\u5DF2\u6E05\u7406\u8FC7\u671F\u56DE\u6536\u7AD9",toastFailed:"\u64CD\u4F5C\u5931\u8D25",noSelection:"\u8BF7\u5148\u9009\u62E9\u8981\u5904\u7406\u7684\u5361\u7247",actionRunning:"\u5904\u7406\u4E2D\u2026",recycleEmptyHint:"\u56DE\u6536\u7AD9\u4E3A\u7A7A\uFF1A\u5220\u6389\u7684\u5361\u7247\u4F1A\u5148\u653E\u5230\u8FD9\u91CC\uFF0C\u4FDD\u7559 {days} \u5929\u540E\u81EA\u52A8\u6E05\u7406\u3002",recyclePurgeAll:"\u6E05\u7A7A\u56DE\u6536\u7AD9",fbCopyManual:"\u81EA\u52A8\u590D\u5236\u88AB\u6D4F\u89C8\u5668\u62E6\u622A\uFF0C\u5DF2\u628A\u5185\u5BB9\u653E\u5728\u4E0B\u9762\uFF1A\u70B9\u300C\u5168\u9009\u300D\u518D\u6309 Ctrl+C",vcLoaded:"\u8FD0\u884C\u4E2D\uFF08\u5BBF\u4E3B\u52A0\u8F7D\uFF09",vcOnDisk:"\u78C1\u76D8\u5B89\u88C5",vcLatest:"npm \u6700\u65B0",vcStale:"\u78C1\u76D8\u5DF2\u5B89\u88C5 {disk}\uFF0C\u4F46\u5F53\u524D DSH \u8FDB\u7A0B\u4ECD\u52A0\u8F7D {loaded} \u2014\u2014 \u91CD\u542F\u684C\u9762\u7248 / DSH \u540E\u624D\u751F\u6548",vcOutdated:"\u6709\u65B0\u7248\u672C",vcUpToDate:"\u5DF2\u662F\u6700\u65B0",vcCheck:"\u68C0\u67E5\u66F4\u65B0",checking:"\u68C0\u67E5\u4E2D\u2026",vcCheckFail:"\u68C0\u67E5\u66F4\u65B0\u5931\u8D25",saving:"\u4FDD\u5B58\u4E2D\u2026",recallSummaryLen:"\u53EC\u56DE\u6458\u8981\u957F\u5EA6",recallBody:"\u53EC\u56DE\u542B\u6B63\u6587",autoWeb:"Web server",autoWebMode:"\u4FDD\u6D3B\u6A21\u5F0F",webPort:"Web \u7AEF\u53E3",webCheckIntervalMs:"\u63A2\u6D3B\u95F4\u9694(ms)",webMaxRestart:"\u6700\u5927\u91CD\u542F\u6B21\u6570",watchdogAutoSpawn:"\u770B\u95E8\u72D7\u8FDB\u7A0B",autoMcpSetup:"\u81EA\u52A8\u6302\u8F7D MCP",saveConfig:"\u4FDD\u5B58\u914D\u7F6E",saveFail:"\u4FDD\u5B58\u5931\u8D25",savedOk:"\u5DF2\u4FDD\u5B58",recallTool:"recall \u5DE5\u5177",costControl:"\u6210\u672C\u63A7\u5236",costHint:"\u7701 token\u3001\u63A7 LLM \u6D88\u8017",distillEnabled:"\u84B8\u998F\u77E5\u8BC6\u5361(\u5F00=LLM \u538B\u7F29, \u5173=\u539F\u6587\u5361\u96F6 LLM)",dedupByLLM:"\u8BED\u4E49\u53BB\u91CD\u5582 LLM(\u5173=\u7EAF\u8BCD\u6CD5\u66F4\u7701)",captureMaxTokens:"\u84B8\u998F\u8F93\u51FA\u4E0A\u9650(token)",recallMinScore:"\u53EC\u56DE\u76F8\u5173\u6027\u9608\u503C(\u8D8A\u9AD8\u8D8A\u7701)",configNeedsDsh:"\u914D\u7F6E\u7F16\u8F91\u9700\u5728 DSH \u5185\u6253\u5F00\uFF08\u672C\u9875\u53EF\u80FD\u53EA\u8BFB\u6216\u6709\u90E8\u5206\u7F3A\u5931\uFF09",installMcp:"\u5B89\u88C5 MCP",uninstallMcp:"\u5378\u8F7D MCP",uninstallConfirm:"\u786E\u8BA4\u5378\u8F7D\u8BE5\u667A\u80FD\u4F53\u7684 MCP\uFF1FClaude Code/Codex \u5C06\u65E0\u6CD5\u518D\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002",presetConfig:"\u4E00\u952E\u63A8\u8350\u914D\u7F6E",presetHint:"\u70B9\u51FB\u586B\u5145\u5BF9\u5E94\u65B9\u6848\uFF0C\u70B9\u4FDD\u5B58\u751F\u6548",planA:"A \u8F7B\u91CF\u7701\u5FC3",planB:"B \u6781\u81F4\u7701\u94B1",planC:"C \u9AD8\u8D28\u91CF",pluginInfo:"\u63D2\u4EF6\u4FE1\u606F",organizeTitle:"\u6574\u7406\u5EFA\u8BAE",scanAndOrganize:"\u4E00\u952E\u641C\u7D22\u548C\u6574\u7406",scanHint:"\u70B9\u300C\u{1F50D} \u4E00\u952E\u641C\u7D22\u548C\u6574\u7406\u300D\u626B\u63CF\u76F8\u4F3C\u5361/\u9648\u65E7\u5361\uFF0C\u518D\u7528\u300C\u26A1 \u4E00\u952E\u4F18\u5316\u300D\u6267\u884C\u3002",mergeNow:"\u5408\u5E76",delete:"\u5220\u9664",captureAlert:"\u81EA\u52A8\u6C89\u6DC0\u5F02\u5E38",captureAlertHint:"\u6253\u5F00\u5DE6\u680F\u300C\u7528\u91CF/\u4ECA\u65E5\u300D\u770B\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7\uFF1B\u82E5\u662F\u63A5\u53E3/\u7248\u672C\u4E0D\u5339\u914D\uFF0C\u9700\u66F4\u65B0 memory-eternal \u63D2\u4EF6\u3002",captureLog:"\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7",captureLogHint:"\u6BCF\u8F6E\u5BF9\u8BDD\u7ED3\u675F\u540E\u81EA\u52A8\u8DD1\uFF1A\u76D1\u542C \u2192 \u5224\u5B9A \u2192 \u5199\u5361\u3002\u8FD9\u91CC\u663E\u793A\u6700\u8FD1 100 \u6761\uFF0C\u7528\u6765\u6392\u67E5\u300C\u4E3A\u4EC0\u4E48\u6CA1\u5199\u5361\u300D\u3002",captureLogEmpty:"\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002\u8DDF Agent \u804A\u4E00\u8F6E\uFF08> \u6355\u83B7\u6700\u5C0F\u957F\u5EA6\uFF09\u540E\u518D\u56DE\u6765\u770B\u3002",captureLogUnavailable:"\u65E5\u5FD7\u4EC5\u5728 DSH \u5BBF\u4E3B\u5185\u53EF\u7528\uFF08\u72EC\u7ACB Web \u9875\u6CA1\u6709 host \u8FD0\u884C\u65F6\uFF09\u3002",captureAgentCards:"Agent \u81EA\u52A8\u6C89\u6DC0\u7684\u5361",noCards:"\u6682\u65E0",loadMore:"\u52A0\u8F7D\u66F4\u591A",batchMerge:"\u4E00\u952E\u667A\u80FD\u5408\u5E76",mergeAllConfirm:"\u5C06\u6309\u76F8\u4F3C\u5EA6\u5206\u7EC4\u7684\u5361\u7247\u5404\u5408\u5E76\u4E3A\u4E00\u5F20\uFF08\u4FDD\u7559\u5404\u81EA kind\uFF09\uFF0C\u539F\u5361\u5220\u9664\uFF1F",crossVault:"\u8DE8\u5E93\u805A\u5408",deleteConfirm:"\u786E\u5B9A\u5220\u9664\u8BE5\u8BB0\u5FC6\u5361\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002",deleted:"\u5DF2\u5220\u9664",deleteFail:"\u5220\u9664\u5931\u8D25",deleteSelected:"\u5220\u9664\u9009\u4E2D",deletedSelected:"\u5F20\u5361\u5DF2\u5220\u9664",merge:"\u5408\u5E76",mergeNeed:"\u81F3\u5C11\u9009 2 \u5F20\u5361",mergeConfirm:"\u5C06\u6240\u9009\u5361\u7247\u5408\u5E76\u4E3A\u4E00\u5F20\u5E76\u5220\u9664\u539F\u5361\uFF1F",merged:"\u5DF2\u5408\u5E76",mergeFail:"\u5408\u5E76\u5931\u8D25",mcpInstalled:"\u2705 {agent} MCP \u5DF2\u5B89\u88C5",mcpUninstalled:"\u2705 {agent} MCP \u5DF2\u5378\u8F7D",mcpActionFail:"\u274C {agent} MCP \u64CD\u4F5C\u5931\u8D25\uFF1A{error}",dshHostLabel:"DeepSeek Harness\uFF08\u5F53\u524D\u5BBF\u4E3B\uFF09",restartHint:"\u5DF2\u4FDD\u5B58\u3002autoWebMode/watchdogAutoSpawn \u7B49\u9700\u91CD\u542F DSH \u751F\u6548",conflictRefresh:"\u914D\u7F6E\u5DF2\u88AB\u5916\u90E8\u4FEE\u6539\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5",untitled:"\u65E0\u6807\u9898",tplBlank:"\u{1F4C4} \u7A7A\u767D",tagsHint:"\u6807\u7B7E\uFF08\u9017\u53F7\u5206\u9694\uFF09",connCount:"{n} \u8FDE\u63A5",tplDecisionTags:"\u51B3\u7B56, \u65B9\u6848",tplBugTags:"\u8E29\u5751, \u6559\u8BAD",tplMeetingTags:"\u4F1A\u8BAE, \u7EAA\u8981",tplWeeklyTags:"\u5468\u62A5",tplDecisionBody:`# \u6280\u672F\u51B3\u7B56\uFF1A[\u6807\u9898]
|
|
12
17
|
|
|
13
18
|
## \u80CC\u666F
|
|
14
19
|
- \u95EE\u9898\u63CF\u8FF0
|
|
@@ -53,7 +58,7 @@ var Ft=Object.create;var ut=Object.defineProperty;var $t=Object.getOwnPropertyDe
|
|
|
53
58
|
-
|
|
54
59
|
|
|
55
60
|
## \u98CE\u9669/\u963B\u585E
|
|
56
|
-
- `},Rt={nav:"Memory",loading:"Loading\u2026",refresh:"Refresh",overview:"Memory Overview",total:"Cards",recent:"Added (7d)",tags:"Tags",searchPlaceholder:"Search memory\u2026",search:"Search",all:"All",kindProject:"Projects",kindKnowledge:"Knowledge",kindContent:"Content",kindPrompt:"Prompts",kindBusiness:"Business",kindTool:"Tools",kindMistake:"Mistakes",cardsTab:"Cards",graphTab:"Graph",graph:"Knowledge Graph",graphHint:"Nodes = cards; edges = [[links]] or shared tags. Click a node to read.",graphTip:"Left-click highlights \xB7 Shift+drag box-select \xB7 right-click menu \xB7 scroll zoom \xB7 drag to pan",rebuild:"Rebuild",reset:"Reset",expandAll:"Expand all",capped:"Showing the",clearFocus:"Clear highlight",empty:"Memory is empty. After a few conversations, valuable content is auto-captured.",emptyGraph:"No graph data yet.",open:"Read",updated:"Updated",created:"Created",source:"Source",close:"Close",vaultDir:"Vault directory",capture:"Auto capture",recall:"Auto recall",enabled:"on",disabled:"off",error:"Load failed",back:"Back to list",cardCount:"cards",nodes:"nodes",edges:"edges",memoryTitle:"Memory Library",memoryHint:"Your local second brain",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",enterFullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",exportGraph:"Export",openCard:"Open card",focusNeighbors:"Highlight links",copyName:"Copy name",noMatch:"No matching memory",clearFilter:"Clear filter",filterLabel:"Filter",sortRecent:"Recent",sortTitle:"Title",sortHot:"Hot",exportSel:"Export selected",clearSelection:"Clear selection",download:"Download",openNewTab:"Open in new tab",copyImage:"Copy image",done:"Done",downloaded:"Download started",openedTab:"Opened in new tab",copied:"Copied",exportedSel:" nodes exported",fullscreen:"Fullscreen",exitFull:"Exit fullscreen",copyFail:"Copy failed",timeDim:"Time",timeNew:"\u22643 days",timeRecent:"\u22642 weeks",timeMonth:"\u22641 month",timeOld:"Older",newBadge:"NEW",expand:"Expand",collapse:"Collapse",exportVault:"Export MD",exportJson:"Export JSON",exporting:"Exporting\u2026",exportedVault:"Vault exported",exportFail:"Export failed",importVault:"Import",importedVault:"Import complete",importedSkipped:" (skipped dup ",importFail:"Import failed",location:"Choose location",saveAs:"Save as",saveAsUnsupported:"Choose-save-location not supported here",exportedTo:"Exported to",defaultDownloads:"default Downloads folder",exportCancel:"Export cancelled",manage:"Manage",tabUsage:"Usage / Today",tabOptimize:"Optimize",adminLoadFail:"Load failed: fully restart dsh-desktop so the host picks up the new /memory-eternal routes",retry:"Retry",mergeSimilar:"Merge similar",trendLabel:"Last 30 days trend",cleanStale:"\u{1F5D1}\uFE0F Clean stale",deletedStale:" stale cards cleaned",newCard:"New",tplDecision:"\u{1F4DD} Decision",tplBug:"\u{1F41B} Bug",tplMeeting:"\u{1F4CB} Meeting",tplWeekly:"\u{1F4CA} Weekly",createCard:"Create",cardTitle:"Title",cardBody:"Body",fbUseful:"Useful",fbIrr:"Irrelevant",todayAdd:"Added today",weekAdd:"Last 7d",byKind:"By kind",todayList:"Captured today",budgetLabel:"Session budget",budgetChars:"Budget chars",recallLimitLabel:"Recall limit",embeddingLabel:"Semantic recall",mergePairs:"Similar pairs (mergeable)",staleCards:"Stale (>90d)",noOptimize:"Nothing to organize, healthy \u{1F389}",oneClickOptimize:"One-click optimize",oneClickOptimizeConfirm:"Confirm one-click optimize? This will merge all similar pairs (stale cards are NOT deleted by default).",oneClickAlsoStale:"Also clean stale cards",oneClickOptimizeDone:"One-click optimize done",optimizedMerged:"pairs merged",optimizedStaleDeleted:"stale cards cleaned",mcpSetupStatus:"Agent MCP mount status",rerunSetup:"Re-run setup",notInstalled:"not installed",noMcpEntry:"no MCP entry",nodePathMismatch:"node path mismatch, consider re-running setup",nodePathNote:"different node env (usable)",healthy:"healthy",mcpSetupHint:'"Auto-mount MCP" = lets Claude Code / Codex / Cursor use the memory vault. On = auto-configures them; Off = never touches your machine config, run dsh-memory setup manually when needed.',mcpManageHint:"Use each agent row to install/uninstall MCP individually",tabConfig:"Memory Config",tabAudit:"Audit Center",statusApproved:"Approved",statusPending:"Pending",statusRejected:"Rejected",allStatus:"All statuses",tabRecycle:"Recycle Bin",pending:"Pending",rejected:"Rejected",selectAll:"Select all",approve:"Approve",reject:"Reject",allAgents:"All agents",noAuditItems:"No items to review",deletedAt:"deleted",restore:"Restore",restoreDelete:"Delete to recycle",purge:"Purge",emptyRecycle:"Recycle bin is empty",recycleHint:"Deleted cards go to the recycle bin \u2014 recover within 30 days, else auto-purged",purgeConfirm:"Permanently delete? This cannot be undone.",recycleDeleteConfirm:"Delete to recycle? Recoverable within 30 days.",modeInit:"Init once",modeInterval:"Interval keep-alive",modeManual:"Manual only",serviceConfig:"Service self-hosting config",auditConfig:"Auto-audit config",auditHint:"Cards matching an exemption go straight in; others await audit",auditMode:"Audit mode",auditAll:"Audit all",auditNone:"Skip all",auditExemptAgents:"Exempt agents",auditExemptKinds:"Exempt kinds",allExempt:"Exempt all",recycleDays:"Recycle retention days",editInSetting:"Edit in DSH Settings \u2192 Memory",setupRunInTerminal:"Copy this command to your terminal:",dshMemoryConfig:"DSH Memory Config",autoCapture:"Auto capture",autoRecall:"Auto recall",captureMinChars:"Min capture chars",maxCardsPerDay:"Daily quota",dedupThreshold:"Dedup threshold",recallLimit:"Recall limit",vaultMulti:"Multiple vaults (per project)",vaultMultiHint:"Empty = single vault; existing setups unaffected",vaultNow:"Active now",vaultSource:"Source",vaultWorkspace:"Current workspace",vaultNamePh:"Name, e.g. work",vaultPathPh:"Directory, e.g. D:/vaults/work",vaultMatchPh:"Project dir (optional, auto-select by workspace)",vaultAdd:"Add a vault",vaultActive:"Active vault",vaultActiveNone:"Default vault (unset)",vaultSrcEnv:"env MEMORY_VAULT_DIR",vaultSrcProfile:"activeVault profile",vaultSrcWorkspace:"matched by project dir",vaultSrcVaultDir:"vaultDir setting",vaultSrcDefault:"default directory",recallSummaryLen:"Recall summary len",recallBody:"Recall with body",autoWeb:"Web server",autoWebMode:"Keep-alive mode",webPort:"Web port",webCheckIntervalMs:"Probe interval (ms)",webMaxRestart:"Max restart",watchdogAutoSpawn:"Watchdog process",autoMcpSetup:"Auto-mount MCP",saveConfig:"Save config",saveFail:"Save failed",savedOk:"Saved",recallTool:"recall tool",costControl:"Cost control",costHint:"save tokens, control LLM usage",distillEnabled:"Distill cards (on=LLM compress, off=raw cards zero LLM)",dedupByLLM:"Dedup feeds LLM (off=pure lexical, cheaper)",captureMaxTokens:"Distill output cap (tokens)",recallMinScore:"Recall min score (higher = cheaper)",configNeedsDsh:"Edit config inside DSH (this page may be read-only or partially missing)",installMcp:"Install MCP",uninstallMcp:"Uninstall MCP",uninstallConfirm:"Confirm uninstall MCP for this agent? Claude Code/Codex will lose access to the memory vault.",presetConfig:"One-click preset config",presetHint:"Click to fill a plan, then hit Save",planA:"A Light",planB:"B Budget",planC:"C Premium",pluginInfo:"Plugin info",organizeTitle:"Organize",scanAndOrganize:"Scan & organize",scanHint:'Click "\u{1F50D} Scan & organize" to find similar/stale cards, then "\u26A1 One-click optimize" to run.',mergeNow:"Merge",delete:"Delete",captureAlert:"Auto-capture failed",captureAlertHint:'Open "Usage / Today" for the capture log; if the cause is an API/version mismatch, update the memory-eternal plugin.',captureLog:"Auto-capture log",captureLogHint:"Runs after every turn: listen \u2192 judge \u2192 write. Last 100 entries, so you can see why a card was not written.",captureLogEmpty:"No entries yet. Chat one turn (> min capture chars) and come back.",captureLogUnavailable:"Log is available only inside the DSH host (the standalone web page has no host runtime).",captureAgentCards:"Cards auto-captured by the agent",noCards:"none",loadMore:"Load more",batchMerge:"Smart batch merge",mergeAllConfirm:"Merge similar-grouped cards into one each (keep kind), delete originals?",crossVault:"All vaults",deleteConfirm:"Delete this memory card? This cannot be undone.",deleted:"Deleted",deleteFail:"Delete failed",deleteSelected:"Delete selected",deletedSelected:" cards deleted",merge:"Merge",mergeNeed:"Select at least 2 cards",mergeConfirm:"Merge the selected cards into one and delete the originals?",merged:"Merged",mergeFail:"Merge failed",mcpInstalled:"\u2705 {agent} MCP installed",mcpUninstalled:"\u2705 {agent} MCP uninstalled",mcpActionFail:"\u274C {agent} MCP action failed: {error}",dshHostLabel:"DeepSeek Harness (current host)",restartHint:"Saved. autoWebMode/watchdogAutoSpawn take effect after restarting DSH",conflictRefresh:"Config changed elsewhere \u2014 refresh and retry",untitled:"Untitled",tplBlank:"\u{1F4C4} Blank",tagsHint:"Tags (comma-separated)",connCount:"{n} connections",tplDecisionTags:"decision, plan",tplBugTags:"pitfall, lesson",tplMeetingTags:"meeting, minutes",tplWeeklyTags:"weekly report",tplDecisionBody:`# Tech decision: [title]
|
|
61
|
+
- `},Xt={nav:"Memory",loading:"Loading\u2026",refresh:"Refresh",overview:"Memory Overview",total:"Cards",recent:"Added (7d)",tags:"Tags",searchPlaceholder:"Search memory\u2026",search:"Search",all:"All",kindProject:"Projects",kindKnowledge:"Knowledge",kindContent:"Content",kindPrompt:"Prompts",kindBusiness:"Business",kindTool:"Tools",kindMistake:"Mistakes",cardsTab:"Cards",graphTab:"Graph",graph:"Knowledge Graph",graphHint:"Nodes = cards; edges = [[links]] or shared tags. Click a node to read.",graphTip:"Left-click highlights \xB7 Shift+drag box-select \xB7 right-click menu \xB7 scroll zoom \xB7 drag to pan",rebuild:"Rebuild",reset:"Reset",expandAll:"Expand all",capped:"Showing the",clearFocus:"Clear highlight",empty:"Memory is empty. After a few conversations, valuable content is auto-captured.",emptyGraph:"No graph data yet.",open:"Read",updated:"Updated",created:"Created",source:"Source",close:"Close",vaultDir:"Vault directory",capture:"Auto capture",recall:"Auto recall",enabled:"on",disabled:"off",error:"Load failed",back:"Back to list",cardCount:"cards",nodes:"nodes",edges:"edges",memoryTitle:"Memory Library",memoryHint:"Your local second brain",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",enterFullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",exportGraph:"Export",openCard:"Open card",focusNeighbors:"Highlight links",copyName:"Copy name",noMatch:"No matching memory",clearFilter:"Clear filter",filterLabel:"Filter",sortRecent:"Recent",sortTitle:"Title",sortHot:"Hot",exportSel:"Export selected",clearSelection:"Clear selection",download:"Download",openNewTab:"Open in new tab",copyImage:"Copy image",done:"Done",downloaded:"Download started",openedTab:"Opened in new tab",copied:"Copied",exportedSel:" nodes exported",fullscreen:"Fullscreen",exitFull:"Exit fullscreen",copyFail:"Copy failed",timeDim:"Time",timeNew:"\u22643 days",timeRecent:"\u22642 weeks",timeMonth:"\u22641 month",timeOld:"Older",newBadge:"NEW",expand:"Expand",collapse:"Collapse",exportVault:"Export MD",exportJson:"Export JSON",exporting:"Exporting\u2026",exportedVault:"Vault exported",exportFail:"Export failed",importVault:"Import",importedVault:"Import complete",importedSkipped:" (skipped dup ",importFail:"Import failed",location:"Choose location",saveAs:"Save as",saveAsUnsupported:"Choose-save-location not supported here",exportedTo:"Exported to",defaultDownloads:"default Downloads folder",exportCancel:"Export cancelled",manage:"Manage",tabUsage:"Usage / Today",tabOptimize:"Optimize",adminLoadFail:"Load failed: fully restart dsh-desktop so the host picks up the new /memory-eternal routes",retry:"Retry",mergeSimilar:"Merge similar",trendLabel:"Last 30 days trend",cleanStale:"\u{1F5D1}\uFE0F Clean stale",deletedStale:" stale cards cleaned",newCard:"New",tplDecision:"\u{1F4DD} Decision",tplBug:"\u{1F41B} Bug",tplMeeting:"\u{1F4CB} Meeting",tplWeekly:"\u{1F4CA} Weekly",createCard:"Create",cardTitle:"Title",cardBody:"Body",fbUseful:"Useful",fbIrr:"Irrelevant",todayAdd:"Added today",weekAdd:"Last 7d",byKind:"By kind",todayList:"Captured today",budgetLabel:"Session budget",budgetChars:"Budget chars",recallLimitLabel:"Recall limit",embeddingLabel:"Semantic recall",mergePairs:"Similar pairs (mergeable)",staleCards:"Stale (>90d)",noOptimize:"Nothing to organize, healthy \u{1F389}",oneClickOptimize:"One-click optimize",oneClickOptimizeConfirm:"Confirm one-click optimize? This will merge all similar pairs (stale cards are NOT deleted by default).",oneClickAlsoStale:"Also clean stale cards",oneClickOptimizeDone:"One-click optimize done",optimizedMerged:"pairs merged",optimizedStaleDeleted:"stale cards cleaned",mcpSetupStatus:"Agent MCP mount status",rerunSetup:"Re-run setup",notInstalled:"not installed",noMcpEntry:"no MCP entry",nodePathMismatch:"node path mismatch, consider re-running setup",nodePathNote:"different node env (usable)",healthy:"healthy",mcpSetupHint:'"Auto-mount MCP" = lets Claude Code / Codex / Cursor use the memory vault. On = auto-configures them; Off = never touches your machine config, run dsh-memory setup manually when needed.',mcpManageHint:"Use each agent row to install/uninstall MCP individually",tabConfig:"Memory Config",tabAudit:"Audit Center",statusApproved:"Approved",statusPending:"Pending",statusRejected:"Rejected",allStatus:"All statuses",tabRecycle:"Recycle Bin",pending:"Pending",rejected:"Rejected",selectAll:"Select all",approve:"Approve",reject:"Reject",allAgents:"All agents",noAuditItems:"No items to review",deletedAt:"deleted",restore:"Restore",restoreDelete:"Delete to recycle",purge:"Purge",emptyRecycle:"Recycle bin is empty",recycleHint:"Deleted cards go to the recycle bin \u2014 recover within 30 days, else auto-purged",purgeConfirm:"Permanently delete? This cannot be undone.",recycleDeleteConfirm:"Delete to recycle? Recoverable within 30 days.",modeInit:"Init once",modeInterval:"Interval keep-alive",modeManual:"Manual only",serviceConfig:"Service self-hosting config",auditConfig:"Auto-audit config",auditHint:"Cards matching an exemption go straight in; others await audit",auditMode:"Audit mode",auditAll:"Audit all",auditNone:"Skip all",auditExemptAgents:"Exempt agents",auditExemptKinds:"Exempt kinds",allExempt:"Exempt all",recycleDays:"Recycle retention days",editInSetting:"Edit in DSH Settings \u2192 Memory",setupRunInTerminal:"Copy this command to your terminal:",dshMemoryConfig:"DSH Memory Config",autoCapture:"Auto capture",autoRecall:"Auto recall",captureMinChars:"Min capture chars",maxCardsPerDay:"Daily quota",dedupThreshold:"Dedup threshold",recallLimit:"Recall limit",vaultMulti:"Multiple vaults (per project)",vaultMultiHint:"Empty = single vault; existing setups unaffected",vaultNow:"Active now",vaultSource:"Source",vaultWorkspace:"Current workspace",vaultNamePh:"Name, e.g. work",vaultPathPh:"Directory, e.g. D:/vaults/work",vaultMatchPh:"Project dir (optional, auto-select by workspace)",vaultAdd:"Add a vault",vaultActive:"Active vault",vaultActiveNone:"Default vault (unset)",vaultSrcEnv:"env MEMORY_VAULT_DIR",vaultSrcProfile:"activeVault profile",vaultSrcWorkspace:"matched by project dir",vaultSrcVaultDir:"vaultDir setting",vaultSrcDefault:"default directory",fbNav:"Report a bug",fbTitle:"Report a bug (files on GitHub)",fbDesc:"Describe the problem (symptoms / steps / expected)",fbDiag:"Diagnostics (auto-redacted: home dir and keys/tokens replaced)",fbCopyDiag:"Copy diagnostics",fbOpenIssue:"Open prefilled issue on GitHub",fbCopyPrompt:"Copy AI prompt",fbCopiedDiag:"Diagnostics copied",fbCopiedPrompt:"Prompt copied \u2014 paste it into your AI chat",fbCopyFail:"Copy failed; please select and copy manually",fbWhy:"GitHub does not allow anonymous issue creation and the plugin must not ship a token: so the title, body and diagnostics are pre-filled \u2014 you just click Submit.",fbNeedDesc:"Please describe the problem first",fbLoading:"Collecting diagnostics\u2026",fbDiagFail:"Diagnostics endpoint unavailable (standalone web or older host); please add environment info manually",fbOr:"or",fbSelectAll:"Select all",toastApproved:"approved",toastRejected:"rejected",toastCardDeleted:"deleted",toastRestored:"restored",toastPurged:"permanently deleted",toastPurgedExpired:"expired recycle entries purged",toastFailed:"Action failed",noSelection:"Select the cards to act on first",actionRunning:"Working\u2026",recycleEmptyHint:"Recycle bin is empty: deleted cards land here first and are purged automatically after {days} days.",recyclePurgeAll:"Empty recycle bin",fbCopyManual:"Auto-copy was blocked by the browser \u2014 the text is below: click Select all, then Ctrl+C",vcLoaded:"running (loaded by host)",vcOnDisk:"on disk",vcLatest:"npm latest",vcStale:"{disk} is installed on disk but the running DSH process still has {loaded} loaded \u2014 restart the desktop app / DSH to apply",vcOutdated:"update available",vcUpToDate:"up to date",vcCheck:"Check for updates",checking:"Checking\u2026",vcCheckFail:"Update check failed",saving:"Saving\u2026",recallSummaryLen:"Recall summary len",recallBody:"Recall with body",autoWeb:"Web server",autoWebMode:"Keep-alive mode",webPort:"Web port",webCheckIntervalMs:"Probe interval (ms)",webMaxRestart:"Max restart",watchdogAutoSpawn:"Watchdog process",autoMcpSetup:"Auto-mount MCP",saveConfig:"Save config",saveFail:"Save failed",savedOk:"Saved",recallTool:"recall tool",costControl:"Cost control",costHint:"save tokens, control LLM usage",distillEnabled:"Distill cards (on=LLM compress, off=raw cards zero LLM)",dedupByLLM:"Dedup feeds LLM (off=pure lexical, cheaper)",captureMaxTokens:"Distill output cap (tokens)",recallMinScore:"Recall min score (higher = cheaper)",configNeedsDsh:"Edit config inside DSH (this page may be read-only or partially missing)",installMcp:"Install MCP",uninstallMcp:"Uninstall MCP",uninstallConfirm:"Confirm uninstall MCP for this agent? Claude Code/Codex will lose access to the memory vault.",presetConfig:"One-click preset config",presetHint:"Click to fill a plan, then hit Save",planA:"A Light",planB:"B Budget",planC:"C Premium",pluginInfo:"Plugin info",organizeTitle:"Organize",scanAndOrganize:"Scan & organize",scanHint:'Click "\u{1F50D} Scan & organize" to find similar/stale cards, then "\u26A1 One-click optimize" to run.',mergeNow:"Merge",delete:"Delete",captureAlert:"Auto-capture failed",captureAlertHint:'Open "Usage / Today" for the capture log; if the cause is an API/version mismatch, update the memory-eternal plugin.',captureLog:"Auto-capture log",captureLogHint:"Runs after every turn: listen \u2192 judge \u2192 write. Last 100 entries, so you can see why a card was not written.",captureLogEmpty:"No entries yet. Chat one turn (> min capture chars) and come back.",captureLogUnavailable:"Log is available only inside the DSH host (the standalone web page has no host runtime).",captureAgentCards:"Cards auto-captured by the agent",noCards:"none",loadMore:"Load more",batchMerge:"Smart batch merge",mergeAllConfirm:"Merge similar-grouped cards into one each (keep kind), delete originals?",crossVault:"All vaults",deleteConfirm:"Delete this memory card? This cannot be undone.",deleted:"Deleted",deleteFail:"Delete failed",deleteSelected:"Delete selected",deletedSelected:" cards deleted",merge:"Merge",mergeNeed:"Select at least 2 cards",mergeConfirm:"Merge the selected cards into one and delete the originals?",merged:"Merged",mergeFail:"Merge failed",mcpInstalled:"\u2705 {agent} MCP installed",mcpUninstalled:"\u2705 {agent} MCP uninstalled",mcpActionFail:"\u274C {agent} MCP action failed: {error}",dshHostLabel:"DeepSeek Harness (current host)",restartHint:"Saved. autoWebMode/watchdogAutoSpawn take effect after restarting DSH",conflictRefresh:"Config changed elsewhere \u2014 refresh and retry",untitled:"Untitled",tplBlank:"\u{1F4C4} Blank",tagsHint:"Tags (comma-separated)",connCount:"{n} connections",tplDecisionTags:"decision, plan",tplBugTags:"pitfall, lesson",tplMeetingTags:"meeting, minutes",tplWeeklyTags:"weekly report",tplDecisionBody:`# Tech decision: [title]
|
|
57
62
|
|
|
58
63
|
## Background
|
|
59
64
|
- Problem
|
|
@@ -98,7 +103,7 @@ Option A, because:
|
|
|
98
103
|
-
|
|
99
104
|
|
|
100
105
|
## Risks/blockers
|
|
101
|
-
- `},
|
|
106
|
+
- `},It=["all","project","knowledge","content","prompt","business","tool","mistake"],Ue={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},wt={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},Ee={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},ut="deepseek-harness",rt=t=>{let o=String(t||""),i=o.toLowerCase();return!o||o==="agent"||o==="unknown"||o.startsWith("session:")||i.startsWith("claude-code")?i.startsWith("claude-code")?"claude":ut:i==="deepseek harness"?ut:o.split(":")[0]||ut},ha=[ut,"claude","codex","cursor","codex-desktop"],Gt=(t=[])=>[...new Set([...ha,...(t||[]).map(rt)])],xa={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],fail:["\u274C","#ef4444"]},Ie=`
|
|
102
107
|
.memory-eternal-root { font-family: inherit; color: var(--dsw-alias-label-primary, #1f2937); }
|
|
103
108
|
.mc-card { background: var(--dsw-alias-bg-layer-1, #fff); border: 1px solid var(--dsw-alias-border-l1, #e5e7eb); border-radius: 12px; padding: 14px 16px; }
|
|
104
109
|
.mc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
|
|
@@ -290,12 +295,13 @@ Option A, because:
|
|
|
290
295
|
height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
|
|
291
296
|
max-height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
|
|
292
297
|
}
|
|
293
|
-
`;function
|
|
298
|
+
`;function va(t){t.effect(()=>t.locale.register(nt,{zh:qt,en:Xt}),"memory-eternal: locale");let o=t.locale.bind(nt);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:nt,order:25,label:()=>o("nav"),locale:nt,inject:()=>({})},()=>n.default.createElement(ka,{t:o}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${nt}:footer`,order:100,label:()=>o("nav"),locale:nt,inject:()=>({})},i=>n.default.createElement(Ca,{t:o,locale:t.locale,wide:!(i&&i.wide===!1)}))),"memory-eternal: sidebar footer action")}function wa(){let[t,o]=(0,n.useState)("http://127.0.0.1:7999/");return(0,n.useEffect)(()=>{fetch("/memory-eternal/api/web-info").then(i=>i.json()).then(i=>{i&&i.ok&&i.url&&o(i.url.endsWith("/")?i.url:i.url+"/")}).catch(()=>{})},[]),t}function ka({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsx)(Qt,{t,onReload:()=>{},version:0})]})}function Ca({t,locale:o,wide:i}){let[g,p]=(0,n.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${i?"":" rail"}`,children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("button",{type:"button",className:"me-footer-btn",onClick:()=>p(!0),"aria-label":t("nav"),title:t("nav"),children:[(0,e.jsx)("span",{className:"me-footer-ico","aria-hidden":"true",children:(0,e.jsx)(Jt,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),g&&(0,e.jsx)(Sa,{t,locale:o,onClose:()=>p(!1)})]})}function Sa({t,locale:o,onClose:i,tab:g}){let[p,l]=(0,n.useState)(!1),v=(0,n.useRef)(null),S=wa(),x=(0,n.useCallback)(z=>o&&typeof o.subscribe=="function"?o.subscribe(z):()=>{},[o]),A=(0,n.useCallback)(()=>o&&typeof o.getSnapshot=="function"?o.getSnapshot():null,[o]),k=(0,n.useSyncExternalStore)(x,A),y=k&&(k.active==="zh"||k.active==="en")?k.active:null,m=(0,n.useRef)(null);m.current===null&&y&&(m.current=y);let M=(0,n.useMemo)(()=>{let z=m.current?`lang=${m.current}`:"";return g==="config"?`${Y}/ui/config?tab=config${z?`&${z}`:""}`:g?`${S.replace(/\/$/,"")}/?tab=${g}${z?`&${z}`:""}`:z?`${S}${S.endsWith("/")?"":"/"}?${z}`:S},[S,g]);return(0,n.useEffect)(()=>{let z=v.current&&v.current.contentWindow;z&&y&&z.postMessage({source:"memory-eternal",type:"locale",lang:y},"*")},[y]),(0,n.useEffect)(()=>{let z=w=>{w.key==="Escape"&&i()};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[i]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:i,children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsx)("div",{className:"me-modal"+(p?" me-modal-full":""),onClick:z=>z.stopPropagation(),children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,position:"relative"},children:[(0,e.jsxs)("div",{style:{position:"absolute",top:8,right:8,zIndex:10,display:"flex",gap:4,padding:"4px 6px",background:"var(--dsw-alias-bg-overlay, rgba(17,24,39,0.45))",borderRadius:8,backdropFilter:"blur(4px)"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>l(z=>!z),"aria-label":t(p?"exitFullscreen":"enterFullscreen"),title:t(p?"exitFullscreen":"enterFullscreen"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:14,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:p?"\u2921":"\u2922"}),(0,e.jsx)("button",{type:"button",onClick:i,"aria-label":t("close"),title:t("close"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:16,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,e.jsx)("iframe",{ref:v,src:M,title:"memory-eternal",allow:"clipboard-write; clipboard-read",style:{width:"100%",flex:1,border:0,borderRadius:"inherit",background:"var(--dsw-alias-bg-base, #fff)"}})]})})]})}function Jt(){return(0,e.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,e.jsx)("defs",{children:(0,e.jsxs)("linearGradient",{id:"mg-brain",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,e.jsx)("stop",{offset:"0%",stopColor:"#FFC46B"}),(0,e.jsx)("stop",{offset:"50%",stopColor:"#F97316"}),(0,e.jsx)("stop",{offset:"100%",stopColor:"#EA580C"})]})}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 0-6.4.1 4.1 4.1 0 0 0-2.7 5.9 4.1 4.1 0 0 0 .6 6.7A4.2 4.2 0 0 0 12 18.2Z"}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 1 6.4.1 4.1 4.1 0 0 1 2.7 5.9 4.1 4.1 0 0 1-.6 6.7A4.2 4.2 0 0 1 12 18.2Z"}),(0,e.jsx)("path",{d:"M12 9.2c-.8-1.4-1.7-2-3.1-2.2M12 9.2c.8-1.4 1.7-2 3.1-2.2M12 12.4c-1.2 1-3.2 1.6-5 1.4M12 12.4c1.2 1 3.2 1.6 5 1.4M12 13.2v4",fill:"none",stroke:"rgba(255,255,255,0.62)",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"8.6",r:"1.1",fill:"rgba(255,255,255,0.85)"})]})}function Na({t,inModal:o,onClose:i,onFull:g,full:p}){let[l,v]=(0,n.useState)(null),[S,x]=(0,n.useState)([]),[A,k]=(0,n.useState)(!0),[y,m]=(0,n.useState)(null),[M,z]=(0,n.useState)(""),[w,L]=(0,n.useState)("all"),[N,O]=(0,n.useState)(""),[G,te]=(0,n.useState)("all"),[H,ye]=(0,n.useState)("all"),[$,J]=(0,n.useState)(()=>{try{let h=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),F={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(h&&F[h])return F[h]}catch{}return"cards"}),[be,W]=(0,n.useState)(()=>new Set([$])),b=(0,n.useCallback)(h=>{W(F=>F.has(h)?F:new Set(F).add(h)),J(h)},[]),[f,E]=(0,n.useState)("recent"),[K,_]=(0,n.useState)(null),B=(0,n.useRef)(null),ee=(0,n.useRef)(null),[Q,le]=(0,n.useState)(!1),[Ve,qe]=(0,n.useState)(null),[De,Be]=(0,n.useState)(!1),[he,xe]=(0,n.useState)(!1),[me,Ce]=(0,n.useState)(!0),[Fe,Se]=(0,n.useState)(null),[Re,Xe]=(0,n.useState)(0),We=(0,n.useCallback)(()=>Xe(h=>h+1),[]),re=(0,n.useRef)(null),[ce,d]=(0,n.useState)(0),[R,P]=(0,n.useState)(!1),s=(0,n.useRef)(null),r=(0,n.useRef)(null),D=(0,n.useCallback)(async(h=w,F=N,Z=H,Ne={})=>{let pe=Ne.append===!0;try{pe?P(!0):(k(!0),z(""));let ue=new URLSearchParams;h&&h!=="all"&&ue.set("kind",h),F.trim()&&ue.set("q",F.trim()),ue.set("status",Z||"all"),ue.set("limit",String(ba)),ue.set("offset",String(Ne.offset||0)),f==="title"&&ue.set("sort","title");let Ke=await(await fetch(`${Y}/cards?${ue.toString()}`)).json();if(Ke.ok){let $e=Ke.cards||[];x(ve=>pe?[...ve,...$e.filter(Qe=>!ve.some(et=>et.path===Qe.path))]:$e),d(Number(Ke.total)||$e.length)}}catch(ue){z(String(ue&&ue.message?ue.message:ue))}finally{pe?P(!1):k(!1)}},[w,N,H,f]),U=(0,n.useCallback)(async()=>{try{let[h,F]=await Promise.all([fetch(`${Y}/overview`).then(Z=>Z.json()),fetch(`${Y}/capture-log`).then(Z=>Z.json()).catch(()=>null)]);h.ok&&v(h),m(F&&F.ok&&F.available&&F.health||null)}catch(h){z(String(h&&h.message?h.message:h))}finally{k(!1)}},[]),se=async h=>{try{let Z=await(await fetch(`${Y}/delete?path=${encodeURIComponent(h)}`)).json();Z.ok?(_({ok:!0,msg:t("deleted")}),await U(),We()):_({ok:!1,msg:Z.error||t("deleteFail")})}catch{_({ok:!1,msg:t("deleteFail")})}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2e3)};(0,n.useEffect)(()=>(U(),()=>{re.current&&clearTimeout(re.current)}),[U]);let we=h=>{O(h),re.current&&clearTimeout(re.current),re.current=setTimeout(()=>D(w,h,H),280)},a=h=>{L(h),D(h,N,H)};(0,n.useEffect)(()=>{$==="cards"&&D(w,N,H)},[H,$,Re,f]),(0,n.useEffect)(()=>{if($!=="cards"||A||R||S.length>=ce)return;let h=s.current,F=r.current;if(!h)return;let Z=new IntersectionObserver(Ne=>{Ne[0]&&Ne[0].isIntersecting&&D(w,N,H,{append:!0,offset:S.length})},{root:F||null,rootMargin:"400px"});return Z.observe(h),()=>Z.disconnect()},[$,S,ce,A,R,w,N,H,D]);let Ze=async h=>{try{let Z=await(await fetch(`${Y}/card?path=${encodeURIComponent(h.path||h.id)}`)).json();Z.ok&&qe({path:Z.path,title:h.title,text:Z.text})}catch(F){z(String(F&&F.message?F.message:F))}},st=async(h,F)=>{le(!0);try{let Z=await fetch(`${Y}/export`);if(!Z.ok)throw new Error("HTTP "+Z.status);let Ne=await Z.json();if(!Ne.ok)throw new Error(Ne.error||"export failed");let pe,ue,ge;h==="json"?(ue="memory-vault.json",ge="application/json",pe=JSON.stringify(Ne.cards.map(ve=>({path:ve.path,title:ve.title,kind:ve.kind,text:ve.text})),null,2)):(ue="memory-vault.md",ge="text/markdown;charset=utf-8",pe=Ne.cards.map(ve=>ve.text.trim()).filter(Boolean).join(`
|
|
294
299
|
|
|
295
300
|
---
|
|
296
301
|
|
|
297
|
-
`));let Ke=new Blob([ve],{type:Ee}),me=await xa(Ke,ge,!1);if(!me.ok){O({ok:!1,msg:t("exportFail")}),he(!1);return}O({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+me.name})}catch(X){O({ok:!1,msg:t("exportFail")+" \xB7 "+(X.message||"")})}finally{he(!1)}H.current&&clearTimeout(H.current),H.current=setTimeout(()=>O(null),2600)},nt=async m=>{let j=m.target.files&&m.target.files[0];if(m.target.value="",!!j){try{let X=await j.text(),ve=await(await fetch(`${U}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:X})).json();ve.ok?(await o(),O({ok:!0,msg:t("importedVault")+"\uFF1A"+(ve.imported||0)+(ve.skipped?t("importedSkipped")+ve.skipped:"")})):O({ok:!1,msg:ve.error||t("importFail")})}catch{O({ok:!1,msg:t("importFail")})}H.current&&clearTimeout(H.current),H.current=setTimeout(()=>O(null),2400)}},rt=(0,n.useMemo)(()=>{let m=w.slice();return ie!=="all"&&(m=m.filter(j=>at(j.submittedBy)===ie)),W!=="all"&&(m=m.filter(j=>(j.status||"approved")===W)),D==="title"?m.sort((j,X)=>String(j.title||"").localeCompare(String(X.title||""))):D==="hot"?m.sort((j,X)=>(X.weight||X.links||0)-(j.weight||j.links||0)):m.sort((j,X)=>new Date(X.updated||0).getTime()-new Date(j.updated||0).getTime()),m},[w,D,ie,W]),st=(0,n.useMemo)(()=>[...new Set(w.map(m=>at(m.submittedBy)))],[w]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Be}),J&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(J.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:J.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:J.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:J.msg})]}),l&&(0,e.jsxs)("div",{className:"me-modal-head",children:[(0,e.jsxs)("div",{className:"me-modal-title",children:[(0,e.jsx)("span",{className:"me-wicon",children:(0,e.jsx)(Et,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),y&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:y,"aria-label":t(u?"exitFull":"fullscreen"),children:u?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:c,"aria-label":t("close"),children:"\u2715"})]}),b&&b.ok===!1&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,margin:"0 0 8px",padding:"9px 14px",borderRadius:10,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.45)",borderLeft:"4px solid #ef4444",color:"var(--dsw-alias-label-primary, #e5e7eb)",fontSize:12.5,lineHeight:1.6},children:[(0,e.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",t("captureAlert")]}),(0,e.jsxs)("span",{style:{flex:1},children:[b.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:b.since?tt(new Date(b.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${de?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>ke(m=>!m),"aria-label":t(de?"collapse":"expand"),title:t(de?"collapse":"expand"),children:de?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="cards"?" active":""}`,onClick:()=>g("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),de&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="graph"?" active":""}`,onClick:()=>g("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),de&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="stats"?" active":""}`,onClick:()=>g("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),de&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="audit"?" active":""}`,onClick:()=>g("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),de&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="optimize"?" active":""}`,onClick:()=>g("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),de&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="config"?" active":""}`,onClick:()=>g("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),de&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:ue,children:[P==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(Qe,{label:t("total"),value:i?i.total:"\u2014"}),(0,e.jsx)(Qe,{label:t("recent"),value:i?i.recent:"\u2014"}),(0,e.jsx)(Qe,{label:t("tags"),value:i?i.tags:"\u2014"}),(0,e.jsx)(Qe,{label:t("pending"),value:i?.status?.pending??0}),(0,e.jsx)(Qe,{label:t("rejected"),value:i?.status?.rejected??0}),(0,e.jsx)(Qe,{label:t("cardCount"),value:i?i.byKind?.knowledge??0:"\u2014"})]}),P==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:M,onChange:m=>ae(m.target.value)}),(0,e.jsx)("input",{ref:ee,type:"file",accept:".json,application/json",style:{display:"none"},onChange:nt}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ee.current&&ee.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>ze({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:Q,onClick:()=>a("md"),children:t(Q?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:Q,onClick:()=>a("json"),children:t(Q?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>o(),children:t("refresh")})]}),P==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[vt.map(m=>(0,e.jsx)("button",{type:"button",className:`mc-chip${k===m?" active":""}`,onClick:()=>ce(m),children:t(m==="all"?"all":$e[m])},m)),(0,e.jsxs)("select",{value:ie,onChange:m=>te(m.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsxs)("option",{value:"all",children:["\u{1F916} ",t("allAgents")]}),Pt(st).map(m=>(0,e.jsx)("option",{value:m,children:m},m))]}),(0,e.jsxs)("select",{value:W,onChange:m=>Te(m.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allStatus")}),(0,e.jsx)("option",{value:"approved",children:t("statusApproved")}),(0,e.jsx)("option",{value:"pending",children:t("statusPending")}),(0,e.jsx)("option",{value:"rejected",children:t("statusRejected")})]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:t("sortRecent")},{key:"title",label:t("sortTitle")},{key:"hot",label:t("sortHot")}].map(m=>(0,e.jsx)("button",{type:"button",className:`mc-chip${D===m.key?" active":""}`,onClick:()=>K(m.key),children:m.label},m.key))]}),T&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",T]}),(0,e.jsx)("div",{style:{display:P==="cards"?"contents":"none"},children:B?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):T?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",T," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>o(),children:t("retry")})]}):w.length===0?(0,e.jsx)("div",{className:"mc-empty",children:t("empty")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"mc-grid",children:rt.map(m=>(0,e.jsx)(ca,{card:m,t,query:M.trim(),onOpen:Se,onDelete:A},m.path))}),w.length<E&&(0,e.jsx)("div",{ref:xe,style:{height:1}}),Y&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",w.length," / ",E,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:P==="graph"?"flex":"none",flex:1,minHeight:0},children:C.has("graph")&&(0,e.jsx)(ga,{t,onOpen:Se,all:Ne,onAllChange:De,onMutate:Ce,active:P==="graph",visible:P==="graph"})}),(0,e.jsx)("div",{style:{display:P==="config"?"contents":"none"},children:C.has("config")&&(0,e.jsx)(jt,{t,onReload:()=>o(),version:Ie})}),(0,e.jsx)("div",{style:{display:P==="stats"?"contents":"none"},children:C.has("stats")&&(0,e.jsx)(pa,{t,tab:"stats",onReload:()=>o(),version:Ie})}),(0,e.jsx)("div",{style:{display:P==="audit"?"contents":"none"},children:C.has("audit")&&(0,e.jsx)(sa,{t,onReload:()=>o(),version:Ie})}),(0,e.jsx)("div",{style:{display:P==="optimize"?"contents":"none"},children:C.has("optimize")&&(0,e.jsx)(da,{t,onReload:()=>o(),version:Ie})}),_e&&(0,e.jsx)(ma,{t,card:_e,query:M.trim(),onClose:()=>Ae(null),onDelete:m=>{Ae(null),A(m)},onFeedback:m=>{let j=_e.path;fetch(`${U}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:M.trim(),path:j,useful:m})}).then(()=>O({ok:!0,msg:t(m?"fbUseful":"fbIrr")})).catch(()=>{}),H.current&&clearTimeout(H.current),H.current=setTimeout(()=>O(null),2e3)}}),(0,e.jsx)(ua,{t,newCard:Ue,setNewCard:ze,onCreated:()=>{o(),Ce(),O({ok:!0,msg:t("created")}),H.current&&clearTimeout(H.current),H.current=setTimeout(()=>O(null),2e3)}})]})]})]})}var Qe=({label:t,value:l})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:l}),(0,e.jsx)("span",{children:t})]});function jt({t,onReload:l,version:c,compact:y}){let[u,i]=(0,n.useState)(null),[S,w]=(0,n.useState)(0),[z,B]=(0,n.useState)(null),[v,b]=(0,n.useState)(null),[f,T]=(0,n.useState)(!1),[N,k]=(0,n.useState)(null),[L,M]=(0,n.useState)(null),[$,ie]=(0,n.useState)(""),[te,W]=(0,n.useState)(""),[Te,P]=(0,n.useState)(""),[ye,C]=(0,n.useState)(""),[ne,g]=(0,n.useState)(null),D=(0,n.useRef)(null),K=(s,E=!0)=>{D.current&&clearTimeout(D.current),g({msg:s,ok:E}),D.current=setTimeout(()=>g(null),1900)},J=(s,E)=>Object.keys(E).reduce((_,Y)=>_.split("{"+Y+"}").join(E[Y]),t(s)),O=(0,n.useCallback)(async()=>{try{let[s,E,_]=await Promise.all([fetch(`${U}/config`).then(Y=>Y.json()).catch(()=>null),fetch(`${U}/setup-status`).then(Y=>Y.json()).catch(()=>null),fetch(`${U}/budget`).then(Y=>Y.json()).catch(()=>null)]);s&&s.ok?(i(s),w(s.revision??0),B(s.schema??null),b({...s.config??{}}),k(s.dsh??null),T(s.writable===!1),ie("")):_&&_.ok?(b({..._}),T(!0),ie(t("configNeedsDsh"))):ie(t("adminLoadFail")),E&&E.ok&&M(E),P("")}catch{ie(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{O()},[c,O]);let H=(s,E)=>b(_=>({..._??{},[s]:E})),ee=s=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[s]||s,Q=async()=>{if(v){if(f){K(t("editInSetting"),!1);return}W("save");try{let s={...v};Array.isArray(s.vaultProfiles)&&(s.vaultProfiles=s.vaultProfiles.filter(Y=>Y&&(String(Y.name||"").trim()||String(Y.path||"").trim())));let E=await fetch(`${U}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:s,expectedRevision:S})}),_=await E.json();if(_&&_.ok)P(t("savedOk")+(_.note?` \xB7 ${t("restartHint")}`:"")),K(t("savedOk")),await O();else{let Y=E.status===409?t("conflictRefresh"):_?.error||t("saveFail");ie(Y),K(Y,!1)}}catch{ie(t("saveFail")),K(t("saveFail"),!1)}finally{W("")}}},he=()=>{b({...u?.config??{}}),P("")},_e={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},Ae=s=>Array.isArray(s?.vaultProfiles)?s.vaultProfiles:[],Ne=(s,E,_)=>b(Y=>{let q=Ae(Y).map(ue=>({...ue||{}})),xe={...q[s]||{}};return E==="match"?String(_).trim()?xe.match={...xe.match||{},workspace:_}:delete xe.match:xe[E]=_,q[s]=xe,{...Y??{},vaultProfiles:q}}),De=()=>b(s=>({...s??{},vaultProfiles:[...Ae(s),{name:"",path:""}]})),de=s=>b(E=>({...E??{},vaultProfiles:Ae(E).filter((_,Y)=>Y!==s)})),ke={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},Ue={A:{label:t("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:900,recallMinScore:2,recallLimit:5,recallSummaryLen:130,recallIncludeBody:!1,captureCooldownMs:3e5},B:{label:t("planB"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!1,dedupByLLM:!1,captureMaxTokens:500,recallMinScore:3,recallLimit:3,recallSummaryLen:80,recallIncludeBody:!1,captureMinChars:300,maxCardsPerDay:40,captureCooldownMs:3e5},C:{label:t("planC"),autoWebMode:"interval",watchdogAutoSpawn:!0,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:1200,recallMinScore:1,recallLimit:8,recallSummaryLen:200,recallIncludeBody:!0,captureCooldownMs:12e4}},ze=async s=>{let E=Ue[s];E&&b(_=>({..._??{},...E}))},Ie=async(s,E)=>{W(s+E);try{let Y=await(await fetch(`${U}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:s,action:E})})).json();Y&&Y.ok?K(J(E==="install"?"mcpInstalled":"mcpUninstalled",{agent:s})):K(J("mcpActionFail",{agent:s,error:Y?.error||""}),!1);try{let q=await fetch(`${U}/setup-status`).then(xe=>xe.json());q&&q.ok&&M(q)}catch{}}catch{K(t("mergeFail"),!1)}finally{W("")}},pe=({k:s,label:E,type:_="text",step:Y,min:q,max:xe})=>(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:E||s}),(0,e.jsx)("input",{type:_,step:Y,min:q,max:xe,value:v?v[s]??"":"",onChange:ue=>H(s,_==="number"?Number(ue.target.value):ue.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12}})]}),Ce=({k:s,label:E})=>(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:!!(v&&v[s]),onChange:_=>H(s,_.target.checked)}),(0,e.jsx)("span",{children:E||s})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:y?"0 0 auto":1,minHeight:0,maxHeight:y?"52vh":void 0},children:[(0,e.jsx)("style",{children:Be}),ne&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(ne.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:ne.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:ne.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:ne.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[$&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",$]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:O,children:["\u21BB ",t("retry")]})]}),f&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #f59e0b",background:"rgba(245,158,11,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#b45309"},children:["\u2139\uFE0F ",t("configNeedsDsh")," \u2014\u2014 ",t("editInSetting")]}),Te&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #10b981",background:"rgba(16,185,129,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#059669"},children:["\u2713 ",Te]}),u&&(u.version||u.dsh?.vaultDir)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px",display:"flex",gap:14,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",t("pluginInfo")]}),(0,e.jsx)("span",{style:{fontSize:12,opacity:.7},children:t("dshHostLabel")}),u.version&&(0,e.jsxs)("code",{style:{fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},children:["v",u.version]}),u.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",u.dsh.vaultDir]})]}),L&&L.agents&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F50C} ",t("mcpSetupStatus")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("mcpManageHint")})]}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:L.agents.map(s=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1},children:[(0,e.jsx)("b",{children:s.isDsh?t("dshHostLabel"):s.name}),s.isDsh&&s.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",s.version]}),!s.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),s.installed&&s.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),s.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),s.mcpConfigured===!0&&s.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),s.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",s.recallTool?t("enabled"):t("disabled"),")"]})]}),s.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",s.hook]}),!s.isDsh&&s.installed&&s.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!te,onClick:()=>Ie(s.name,"install"),children:t("installMcp")}),!s.isDsh&&s.installed&&s.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!te,onClick:()=>{window.confirm(t("uninstallConfirm"))&&Ie(s.name,"uninstall")},children:t("uninstallMcp")})]},s.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),ye&&(0,e.jsx)("div",{style:{fontSize:11,marginTop:6},children:(0,e.jsx)("code",{style:{padding:"2px 6px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:4},children:ye})})]}),v?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("presetConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("presetHint")})]}),(0,e.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(s=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>ze(s),disabled:!!te,children:[s==="A"?"\u{1F7E2} ":s==="B"?"\u{1F4B0} ":"\u2B50 ",Ue[s].label]},s))})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9E0} ",t("dshMemoryConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:8},children:[(0,e.jsx)(Ce,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(Ce,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(pe,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(pe,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(pe,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(pe,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(pe,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(Ce,{k:"recallIncludeBody",label:t("recallBody")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #06b6d4"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5C2}\uFE0F ",t("vaultMulti")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("vaultMultiHint")})]}),(0,e.jsxs)("div",{style:{fontSize:11.5,opacity:.85,marginBottom:8,lineHeight:1.7},children:[t("vaultNow"),"\uFF1A",(0,e.jsx)("code",{children:N?.vaultDir||"\u2014"}),N?.vaultName?`\uFF08${N.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(_e[N?.vaultSource]||"vaultSrcDefault"),N?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:N.workspace})]}):null]}),Ae(v).map((s,E)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:s.name||"",placeholder:t("vaultNamePh"),onChange:_=>Ne(E,"name",_.target.value),style:ke,disabled:f}),(0,e.jsx)("input",{value:s.path||"",placeholder:t("vaultPathPh"),onChange:_=>Ne(E,"path",_.target.value),style:ke,disabled:f}),(0,e.jsx)("input",{value:s.match&&s.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:_=>Ne(E,"match",_.target.value),style:ke,disabled:f}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>de(E),disabled:f,title:t("delete"),children:"\u2715"})]},E)),(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:De,disabled:f,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:v.activeVault||"",onChange:s=>H("activeVault",s.target.value),disabled:f,style:ke,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),Ae(v).filter(s=>s&&s.name).map(s=>(0,e.jsx)("option",{value:s.name,children:s.name},s.name))]})]})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #f59e0b"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4B0} ",t("costControl")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("costHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))",gap:8,marginTop:6},children:[(0,e.jsx)(Ce,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(Ce,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(pe,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(pe,{k:"recallMinScore",label:t("recallMinScore"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("auditConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("auditHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))",gap:8},children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("auditMode")}),(0,e.jsxs)("select",{value:v.auditMode??"all",onChange:s=>H("auditMode",s.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"all",children:t("auditAll")}),(0,e.jsx)("option",{value:"none",children:t("auditNone")})]})]}),(0,e.jsx)(Tt,{label:t("auditExemptAgents"),value:v.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(L?.agents||[]).filter(s=>!s.isDsh).map(s=>({value:s.name,label:s.name}))],onChange:s=>H("auditExemptAgents",s)}),(0,e.jsx)(Tt,{label:t("auditExemptKinds"),value:v.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...vt.filter(s=>s!=="all").map(s=>({value:s,label:t($e[s])}))],onChange:s=>H("auditExemptKinds",s)}),(0,e.jsx)(pe,{k:"recycleRetentionDays",label:t("recycleDays"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E0} ",t("serviceConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:8},children:[(0,e.jsx)(Ce,{k:"autoWeb",label:t("autoWeb")}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("autoWebMode")}),(0,e.jsxs)("select",{value:v.autoWebMode??"init",onChange:s=>H("autoWebMode",s.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"init",children:t("modeInit")}),(0,e.jsx)("option",{value:"interval",children:t("modeInterval")}),(0,e.jsx)("option",{value:"manual",children:t("modeManual")})]})]}),(0,e.jsx)(pe,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(pe,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(pe,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(Ce,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(Ce,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginBottom:10},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:he,disabled:!!te,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:Q,disabled:!!te||te==="save"||f,children:te==="save"?t("exporting"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function sa({t,onReload:l,version:c}){let[y,u]=(0,n.useState)([]),[i,S]=(0,n.useState)([]),[w,z]=(0,n.useState)("all"),[B,v]=(0,n.useState)("all"),[b,f]=(0,n.useState)(""),[T,N]=(0,n.useState)(new Set),[k,L]=(0,n.useState)(""),[M,$]=(0,n.useState)("pending"),ie=[...new Set([...y,...i].map(C=>C.submittedBy).filter(Boolean))],te=(0,n.useCallback)(async()=>{try{let C=await fetch(`${U}/audit/list`).then(ne=>ne.json());C.ok&&(u(C.pending||[]),S(C.rejected||[]),N(new Set))}catch{}},[]);(0,n.useEffect)(()=>{te()},[c,te]);let W=(M==="pending"?y:i).filter(C=>{if(w!=="all"&&C.kind!==w||B!=="all"&&at(C.submittedBy)!==B)return!1;if(b){let ne=(C.created||"").slice(0,10);if(ne&&ne!==b)return!1}return!0}),Te=C=>N(ne=>{let g=new Set(ne);return g.has(C)?g.delete(C):g.add(C),g}),P=async(C,ne)=>{L("apply");try{for(let g of ne||[...T])await fetch(`${U}/${C==="approved"?"audit/approve":C==="rejected"?"audit/reject":"delete"}?path=${encodeURIComponent(g)}${C==="delete"?"&permanent=0":""}`);await te(),l&&l()}catch{}finally{L("")}},ye=[...T];return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Be}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("tabAudit")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("select",{value:w,onChange:C=>z(C.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("all")}),vt.filter(C=>C!=="all").map(C=>(0,e.jsx)("option",{value:C,children:t($e[C])},C))]}),(0,e.jsxs)("select",{value:B,onChange:C=>v(C.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allAgents")}),Pt(ie).map(C=>(0,e.jsx)("option",{value:C,children:C},C))]}),(0,e.jsx)("input",{type:"date",value:b,onChange:C=>f(C.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"}})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("button",{type:"button",className:`mc-btn${M==="pending"?" me-on":""}`,onClick:()=>$("pending"),children:[t("pending"),"\uFF08",y.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${M==="rejected"?" me-on":""}`,onClick:()=>$("rejected"),children:[t("rejected"),"\uFF08",i.length,"\uFF09"]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("label",{style:{fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:W.length>0&&ye.length===W.length,onChange:C=>{C.target.checked?N(new Set(W.map(ne=>ne.path))):N(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!ye.length||!!k,onClick:()=>P("approved"),children:["\u2713 ",t(M==="rejected"?"restore":"approve")]}),M==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!ye.length||!!k,onClick:()=>P("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!ye.length||!!k,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&P("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),W.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:W.map(C=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:T.has(C.path),onChange:()=>Te(C.path)}),(0,e.jsx)("span",{className:"mc-kind",style:{background:He[C.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:at(C.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:C.created?C.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:C.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:C.severity==="high"?"#f87171":"#9ca3af"},children:C.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C.reason||"-"}),M==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>P("approved",[C.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>P("rejected",[C.path]),children:"\u2715"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},title:t("restore"),onClick:()=>P("approved",[C.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},title:t("restoreDelete"),onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&P("delete",[C.path])},children:"\u{1F5D1}"})]})]},C.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function da({t,onReload:l,version:c}){let[y,u]=(0,n.useState)([]),[i,S]=(0,n.useState)(""),w=(0,n.useCallback)(async()=>{try{let B=await fetch(`${U}/recycle/list`).then(v=>v.json());B.ok&&u(B.items||[])}catch{}},[]);(0,n.useEffect)(()=>{w()},[c,w]);let z=async(B,v)=>{S(B+v);try{B==="restore"?await fetch(`${U}/recycle/restore?path=${encodeURIComponent(v)}`):B==="purge"&&await fetch(`${U}/recycle/purge?path=${encodeURIComponent(v)}`),await w(),l&&l()}catch{}finally{S("")}};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Be}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",t("tabRecycle")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("recycleHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!i,onClick:async()=>{S("purgeAll");try{await fetch(`${U}/recycle/purge-expired?days=0`),await w()}catch{}finally{S("")}},children:t("emptyRecycle")})]}),y.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:y.map(B=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:He[B.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:B.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(B.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!i,onClick:()=>z("restore",B.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!i,onClick:()=>{window.confirm(t("purgeConfirm"))&&z("purge",B.path)},children:t("purge")})]},B.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("emptyRecycle")})]})]})}var ca=({card:t,t:l,onOpen:c,query:y,onDelete:u})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>c(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:He[t.kind]||He.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:mt[t.kind]||"\u{1F4CE}"}),y?At(t.title,y):t.title,ha(t.updated)&&(0,e.jsx)("span",{className:"mc-new",children:l("newBadge")}),t.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",l("statusPending")]}),t.status==="rejected"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",l("statusRejected")]}),(!t.status||t.status==="approved")&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",l("statusApproved")]})]}),(0,e.jsx)("p",{children:y?At(t.summary||"",y):t.summary||""}),t.tags.length>0&&(0,e.jsx)("div",{className:"mc-tags",children:t.tags.slice(0,4).map(i=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",i]},i))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[mt[t.kind]||"\u{1F4CE}"," ",l($e[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",at(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",tt(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:l("delete"),onClick:i=>{i.stopPropagation(),window.confirm(l("deleteConfirm"))&&u&&u(t.path)},children:"\u{1F5D1}"})]})]});function pa({t,tab:l,onReload:c,version:y}){let[u,i]=(0,n.useState)(null),[S,w]=(0,n.useState)(""),[z,B]=(0,n.useState)(null),[v,b]=(0,n.useState)(null),[f,T]=(0,n.useState)(null),[N,k]=(0,n.useState)([]),[L,M]=(0,n.useState)(""),[$,ie]=(0,n.useState)(!1),te=(0,n.useCallback)(async()=>{if(!(!z||!z.merge||!z.merge.length)&&window.confirm(t("mergeAllConfirm"))){M("merge");try{let g={},D=ee=>g[ee]===void 0?ee:g[ee]=D(g[ee]),K=(ee,Q)=>{g[D(ee)]=D(Q)},J=new Set;for(let ee of z.merge)J.add(ee.a.path),J.add(ee.b.path),K(ee.a.path,ee.b.path);let O={};for(let ee of J){let Q=D(ee);(O[Q]=O[Q]||[]).push(ee)}let H=0;for(let ee of Object.values(O)){if(ee.length<2)continue;(await fetch(`${U}/merge?paths=${encodeURIComponent(ee.join(","))}`).then(he=>he.json())).ok&&H++}await W(),c&&c()}catch{}M("")}},[z,W,c,t]);async function W(){try{let g=await Promise.all([fetch(`${U}/stats`),fetch(`${U}/budget`),fetch(`${U}/capture-log`),fetch(`${U}/cards?status=all&limit=30&agent=${lt}`)]),[D,K,J,O]=await Promise.all(g.map(H=>H.json()));D&&D.ok&&i(D),K&&K.ok&&b(K),J&&J.ok&&T(J),O&&O.ok&&k(O.cards||[]),w(!D||!D.ok?t("adminLoadFail"):"")}catch{w(t("adminLoadFail"))}}let Te=(0,n.useCallback)(async()=>{M("scan");try{let g=await fetch(`${U}/optimize`).then(D=>D.json());g.ok&&B(g)}catch{w(t("adminLoadFail"))}finally{M("")}},[t]);(0,n.useEffect)(()=>{W()},[y]);let P=async(g,D)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${U}/merge?paths=${encodeURIComponent(g+","+D)}`).then(J=>J.json())).ok&&(await W(),c&&c())}catch{}},ye=async g=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${U}/delete?path=${encodeURIComponent(g)}`).then(K=>K.json())).ok&&(await W(),c&&c())}catch{}},C=["project","knowledge","content","prompt","business","tool","mistake"],ne=({title:g,kind:D,updated:K,path:J})=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:et.colors[D]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:tt(K)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>ye(J),children:[t("delete")," \u2715"]})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Be}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[S&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",S]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:W,children:["\u21BB ",t("retry")]})]}),l==="stats"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1FAB5} ",t("captureLog")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("captureLogHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>W(),children:["\u21BB ",t("refresh")]})]}),f?f.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(f.entries||[]).length===0?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogEmpty")}):(0,e.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,e.jsx)("tbody",{children:(f.entries||[]).map((g,D)=>{let K=ta[g.action]||["\u2022","inherit"];return(0,e.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:tt(g.time?new Date(g.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:K[1],fontWeight:600},children:[K[0]," ",g.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:g.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:g.preview||"",children:g.preview||""})]},D)})})})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("loading")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:["\u{1F916} ",t("captureAgentCards"),"\uFF08",N.length,"\uFF09"]}),N.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:N.map(g=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:He[g.kind]||He.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.title}),g.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:tt(g.updated)})]},g.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),u&&(0,e.jsxs)(e.Fragment,{children:[u.trend&&u.trend.length>0&&(()=>{let g=u.trend,D=Math.max(...g.map(H=>H.count),1),K=260,J=50,O=K/g.length;return(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["\u{1F4C8} ",t("trendLabel")]}),(0,e.jsx)("svg",{width:K,height:J,style:{display:"block",width:"100%",height:50},children:g.map((H,ee)=>{let Q=Math.round(H.count/D*(J-4));return(0,e.jsx)("rect",{x:ee*O+1,y:J-Q,width:Math.max(O-2,2),height:Q,rx:1.5,fill:H.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:H.count>0?.85:.35},H.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:u.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:u.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:u.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:u.tags}),(0,e.jsx)("span",{children:t("tags")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("byKind")}),(0,e.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:C.map(g=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:et.colors[g]||"#666"}}),t($e[g]),": ",u.byKind?.[g]||0]},g))})]}),v&&(v.budgetChars||v.recallLimit||v.embedding)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,e.jsx)("b",{children:t("budgetLabel")}),"\uFF1A",t("budgetChars")," ",(0,e.jsx)("b",{children:v.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:v.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",v.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",u.todayCards?.length||0,"\uFF09"]}),u.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:u.todayCards.map(g=>(0,e.jsx)(ne,{title:g.title,kind:g.kind,updated:g.updated,path:g.path},g.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})]})]}),l==="optimize"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("organizeTitle")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!L,onClick:Te,children:L==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),z&&z.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!L,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){M("oneclick");try{let g=JSON.stringify({cleanupStale:$}),K=await(await fetch(`${U}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:g})).json();K&&K.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${K.plan.merged} ${t("optimizedMerged")}${$?` \xB7 ${K.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await W(),c&&c(),B(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{M("")}}},children:L==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),z&&z.merge?.length>0&&(0,e.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,e.jsx)("input",{type:"checkbox",checked:$,onChange:g=>ie(g.target.checked)}),t("oneClickAlsoStale")]})]}),!z&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),z&&(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",flexDirection:"column",gap:8},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("mergePairs")}),(0,e.jsx)("div",{className:"spacer",style:{flex:1}}),z.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!L,onClick:te,children:t(L==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),z.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:z.merge.map((g,D)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[g.a.title," \u21C4 ",g.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(g.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>P(g.a.path,g.b.path),children:t("mergeNow")})]},D))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:12},children:t("noOptimize")}),(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("staleCards"),"\uFF08",z.stale?.length||0,"\uFF09"]}),z.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!L,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;M("clean");let g=0;for(let D of z.stale)try{await fetch(`${U}/delete?path=${encodeURIComponent(D.path)}`),g++}catch{}M(""),notify(`${g} ${t("deletedStale")}`),await W(),c&&c()},children:t("cleanStale")})}),z.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:z.stale.map(g=>(0,e.jsx)(ne,{title:g.title,kind:"other",updated:g.updated,path:g.path},g.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})})]})]})]})}var xt=[{key:"decision",label:"tplDecision",kind:"knowledge",tagKey:"tplDecisionTags",bodyKey:"tplDecisionBody"},{key:"bug",label:"tplBug",kind:"mistake",tagKey:"tplBugTags",bodyKey:"tplBugBody"},{key:"meeting",label:"tplMeeting",kind:"content",tagKey:"tplMeetingTags",bodyKey:"tplMeetingBody"},{key:"weekly",label:"tplWeekly",kind:"content",tagKey:"tplWeeklyTags",bodyKey:"tplWeeklyBody"}];function ua({t,newCard:l,setNewCard:c,onCreated:y}){if(!l)return null;let u=xt.find(b=>b.key===l.template),i=l.body||(u?t(u.bodyKey):""),S=l.kind||(u?u.kind:"knowledge"),w=l.tags||(u?t(u.tagKey):""),z=l._creating,B=b=>{let f=xt.find(T=>T.key===b);c(T=>({...T,template:b,kind:f?f.kind:T.kind,body:f?t(f.bodyKey):T.body,tags:f?t(f.tagKey):T.tags}))},v=async()=>{if(!(!l.title&&!i)){c(b=>({...b,_creating:!0}));try{(await fetch(`${U}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:l.title||t("untitled"),kind:S,tags:w.split(",").map(f=>f.trim()).filter(Boolean),body:i,source:"manual"})}).then(f=>f.json())).ok?(c(null),y&&y()):c(f=>({...f,_creating:!1}))}catch{c(f=>({...f,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>c(null),children:[(0,e.jsx)("style",{children:Be}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:b=>b.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:t("newCard")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>c(null),children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[xt.map(b=>(0,e.jsx)("button",{type:"button",className:`mc-btn${l.template===b.key?" me-on":""}`,onClick:()=>B(b.key),children:t(b.label)},b.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${l.template===""?" me-on":""}`,onClick:()=>c(b=>({...b,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:S,onChange:b=>c(f=>({...f,kind:b.target.value})),style:{maxWidth:180,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:["project","knowledge","content","prompt","business","tool","mistake"].map(b=>(0,e.jsx)("option",{value:b,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:b},b))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:l.title||"",onChange:b=>c(f=>({...f,title:b.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:w,onChange:b=>c(f=>({...f,tags:b.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:i,onChange:b=>c(f=>({...f,body:b.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,e.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:z,onClick:v,children:t(z?"exporting":"createCard")})})]})]})]})}function ma({t,card:l,query:c,onClose:y,onDelete:u,onFeedback:i}){(0,n.useEffect)(()=>{let L=M=>{M.key==="Escape"&&y()};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[y]);let{meta:S,body:w}=(0,n.useMemo)(()=>ht(l.text||""),[l.text]),z=L=>{let M=S.find(([$])=>String($).toLowerCase()===L);return M?M[1]:""},B=Lt(z("tags")),v=z("kind")||"knowledge",b=(z("status")||"approved").toLowerCase(),f=He[v]||"#6B7280",T=(w||"").length>460,[N,k]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:y,children:[(0,e.jsx)("style",{children:Be}),(0,e.jsxs)("div",{className:"me-dialog",onClick:L=>L.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:mt[v]||"\u{1F4CE}"}),l.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[c&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),T&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":N,onClick:()=>k(L=>!L),children:t(N?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&u&&u(l.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:y,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:f,borderColor:f+"59",background:f+"1a"},children:[mt[v]||"\u{1F4CE}"," ",t($e[v]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(b==="approved"?"md-chip-st-ok":b==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[b==="approved"?"\u2705":b==="pending"?"\u23F3":"\u26D4"," ",t(b==="approved"?"statusApproved":b==="pending"?"statusPending":"statusRejected")]}),B.slice(0,8).map(L=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",L]},L)),!!z("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",tt(z("updated"))]}),!!z("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",z("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:N?{}:{maxHeight:300,overflow:"hidden"},onClick:N?void 0:L=>{L.stopPropagation(),k(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Bt(w)}})}),!N&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:L=>{L.stopPropagation(),k(!0)},children:[t("expand")," \u2304"]})]})]})}function ga({t,onOpen:l,all:c,onAllChange:y,onMutate:u,active:i,visible:S}){let[w,z]=(0,n.useState)(null),[B,v]=(0,n.useState)(""),b=(0,n.useRef)(!1),f=(0,n.useRef)(0),T=(0,n.useRef)(t);T.current=t;let N=(0,n.useCallback)(async()=>{try{b.current=!1;let $=await(await fetch(`${U}/graph${c?"?all=1":""}`)).json();$.ok?(z($),v(""),b.current=!0):(z(null),v($.error||t("error")))}catch(M){v(String(M&&M.message?M.message:M))}},[c,t]);(0,n.useEffect)(()=>{if(!i||b.current)return;let M=!0;return fetch(`${U}/graph${c?"?all=1":""}`).then($=>$.json()).then($=>{M&&($.ok?(z($),v(""),b.current=!0):(z(null),v($.error||t("error"))))}).catch($=>{M&&v(String($&&$.message?$.message:$))}),()=>{M=!1}},[c,t,i]),(0,n.useEffect)(()=>{S&&w&&f.current++},[S,w]);let k=(0,n.useCallback)(async M=>{try{let ie=await(await fetch(`${U}/delete?path=${encodeURIComponent(M)}`)).json();return ie&&ie.ok?(await N(),u&&u(),!0):!1}catch{return!1}},[N]),L=(0,n.useCallback)(async M=>{if(!M||M.length<2)return!1;try{let $=await fetch(`${U}/merge?paths=${encodeURIComponent(M.join(","))}`).then(ie=>ie.json());return $&&$.ok?(await N(),u&&u(),!0):!1}catch{return!1}},[N,u]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Be}),B&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",B]}),!w&&!B&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),w&&w.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),w&&w.nodes.length>0&&(0,e.jsx)(ba,{nodes:w.nodes,edges:w.edges,onOpen:l,onDelete:k,onMerge:L,t,all:c,onAllChange:y,countLabel:`${w.nodes.length} ${t("nodes")} \xB7 ${fa(w.edges)} ${t("edges")}`,fitTrigger:f.current})]})}function fa(t){let l=new Set;for(let c of t||[])l.add([c.source,c.target].sort().join("|"));return l.size}var et={colors:{project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},shapes:{project:"circle",knowledge:"circle",content:"rect",prompt:"diamond",business:"hexagon",tool:"circle",mistake:"diamond",other:"circle"}};function ba({nodes:t,edges:l,onOpen:c,onDelete:y,onMerge:u,t:i,countLabel:S,all:w,onAllChange:z,fitTrigger:B}){let v=(0,n.useRef)(null),b=(0,n.useRef)(null),f=(0,n.useRef)(null),T=(0,n.useRef)(null),N=(0,n.useRef)(null),k=(0,n.useRef)(c);(0,n.useEffect)(()=>{k.current=c},[c]);let L=(0,n.useRef)(y);(0,n.useEffect)(()=>{L.current=y},[y]);let M=(0,n.useRef)(u);(0,n.useEffect)(()=>{M.current=u},[u]);let[$,ie]=(0,n.useState)(""),[te,W]=(0,n.useState)(null),Te=(0,n.useRef)("");(0,n.useEffect)(()=>{Te.current=$.trim().toLowerCase()},[$]),(0,n.useEffect)(()=>{let r=f.current;if(!r)return;let o=$.trim().toLowerCase();if(!o)return;let A=r.nodes.find(ae=>(ae.name||"").toLowerCase().includes(o));A&&(f.current.selectedId=A.id,W(A.id),r.panX=r.w/2-A.x*r.zoom,r.panY=r.h/2-A.y*r.zoom,r.render&&r.render())},[$]);let[P,ye]=(0,n.useState)("all"),[C,ne]=(0,n.useState)(!1),g=(0,n.useRef)("all"),[D,K]=(0,n.useState)(""),J=(0,n.useRef)(""),[O,H]=(0,n.useState)(!1),ee=(0,n.useRef)(!1),[Q,he]=(0,n.useState)(null);(0,n.useEffect)(()=>{g.current=P},[P]),(0,n.useEffect)(()=>{J.current=D},[D]),(0,n.useEffect)(()=>{ee.current=O},[O]);let _e=(0,n.useMemo)(()=>{let r=new Map;for(let o of t)for(let A of o.tags||[]){let ae=String(A).trim();ae&&r.set(ae,(r.get(ae)||0)+1)}return[...r.entries()].sort((o,A)=>A[1]-o[1]).slice(0,24).map(([o,A])=>({tag:o,n:A}))},[t]),Ae=(()=>{let r=$.trim().toLowerCase();return!!r&&!t.some(o=>(o.title||o.name||"").toLowerCase().includes(r)||String(o.kind||"").toLowerCase().includes(r)||String($e[o.kind]||"").toLowerCase().includes(r))})();(0,n.useEffect)(()=>{let r=f.current;r&&r.wake&&r.wake()},[$]),(0,n.useEffect)(()=>{let r=f.current;r&&r.render&&r.render()},[P,D,O]);let Ne=(0,n.useRef)(null),[De,de]=(0,n.useState)([]),[ke,Ue]=(0,n.useState)(null),[ze,Ie]=(0,n.useState)(!1),[pe,Ce]=(0,n.useState)(null),[s,E]=(0,n.useState)(""),_=(0,n.useRef)(null),Y=(0,n.useRef)(null),q=(r,o=!0)=>{_.current&&clearTimeout(_.current),Ce({msg:r,ok:o}),_.current=setTimeout(()=>Ce(null),1900)},xe=r=>{E(r),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>E(""),1600)};(0,n.useEffect)(()=>()=>{_.current&&clearTimeout(_.current),Y.current&&clearTimeout(Y.current)},[]);let ue=(0,n.useMemo)(()=>t.reduce((r,o)=>(r[o.id]=o,r),{}),[t]);return(0,n.useEffect)(()=>{let r=v.current;if(!r||t.length===0)return;let o=r.getContext("2d");if(!o)return;let A=Math.max(1,window.devicePixelRatio||1),ae=()=>document.documentElement.getAttribute("data-theme")==="dark",ce={};l.forEach(d=>{ce[d.source]=(ce[d.source]||0)+1,ce[d.target]=(ce[d.target]||0)+1});let Se=Math.max(1,...Object.values(ce)),a={nodes:t.map(d=>({id:d.id,name:d.title||"",type:d.kind||"other",r:9+Math.min(10,(ce[d.id]||0)/Se*8),x:0,y:0,vx:0,vy:0})),edges:l.map(d=>({sourceNodeId:d.source,targetNodeId:d.target,weight:1})),panX:0,panY:0,zoom:1,running:!0,raf:0,tickCount:0,quietTicks:0,dragNode:null,selectedId:null,mouseX:0,mouseY:0,w:0,h:0,dpr:A,ctx:o,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((d,x)=>(d[x.id]=x,d),{}),a.nodes.forEach((d,x)=>{let h=x/a.nodes.length*Math.PI*2-Math.PI/2;d.x=Math.cos(h)*60,d.y=Math.sin(h)*60});let nt=[...new Set(a.nodes.map(d=>d.type))];a.clustered=nt.length>1,a.typeCenters={},nt.forEach((d,x)=>{let h=x/nt.length*Math.PI*2-Math.PI/2;a.typeCenters[d]={x:Math.cos(h)*160,y:Math.sin(h)*160}}),f.current=a;let rt=0,st=0,m=()=>{let d=r.clientWidth,x=r.clientHeight;a.w=d,a.h=x,r.width=d*A,r.height=x*A,o.setTransform(A,0,0,A,0,0),(rt===0||st===0)&&d>0&&x>0&&a.tickCount>0&&requestAnimationFrame(()=>Ee()),rt=d,st=x};m();let j=new ResizeObserver(m);j.observe(r.parentElement);let X=(d,x)=>d&&d.length>x?d.slice(0,x)+"\u2026":d,fe=(d,x,h,I)=>{if(o.beginPath(),I==="rect")o.rect(d-h,x-h*.75,h*2,h*1.5);else if(I==="diamond")o.moveTo(d,x-h),o.lineTo(d+h,x),o.lineTo(d,x+h),o.lineTo(d-h,x),o.closePath();else if(I==="hexagon"){for(let R=0;R<6;R++){let Z=Math.PI/3*R-Math.PI/2,V=d+h*Math.cos(Z),be=x+h*Math.sin(Z);R===0?o.moveTo(V,be):o.lineTo(V,be)}o.closePath()}else o.arc(d,x,h,0,Math.PI*2)},ve=new Map,ge=(d,x)=>{let h=d+"|"+Math.round(x),I=ve.get(h);if(!I){let R=parseInt(d.slice(1,3),16),Z=parseInt(d.slice(3,5),16),V=parseInt(d.slice(5,7),16);I=o.createRadialGradient(-x*.3,-x*.3,0,0,0,x*1.2),I.addColorStop(0,"rgba("+Math.min(255,R+70)+","+Math.min(255,Z+70)+","+Math.min(255,V+70)+",0.95)"),I.addColorStop(1,d),ve.set(h,I)}return I},Ee=()=>{if(!a.nodes.length)return;let d=1/0,x=-1/0,h=1/0,I=-1/0;a.nodes.forEach(we=>{d=Math.min(d,we.x),x=Math.max(x,we.x),h=Math.min(h,we.y),I=Math.max(I,we.y)});let R=20,Z=x-d+R*2,V=I-h+R*2,be=Math.min(a.w/Z,a.h/V);a.zoom=Math.max(.35,Math.min(1.8,be)),a.panX=a.w/2-(d+x)/2*a.zoom,a.panY=a.h/2-(h+I)/2*a.zoom};T.current=Ee;let Ke=()=>{o.clearRect(0,0,a.w,a.h),a.searchTerm=Te.current,a.kindFilter=g.current,a.timeMode=ee.current,a.tagFilter=J.current;let d=a.tagFilter,x=a.kindFilter,h=p=>String(p||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");o.save(),o.strokeStyle=ae()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",o.lineWidth=.5;for(let p=0;p<a.w;p+=24)o.beginPath(),o.moveTo(p,0),o.lineTo(p,a.h),o.stroke();for(let p=0;p<a.h;p+=24)o.beginPath(),o.moveTo(0,p),o.lineTo(a.w,p),o.stroke();o.restore(),o.save(),o.translate(a.panX,a.panY),o.scale(a.zoom,a.zoom);let I={};a.nodes.forEach(p=>I[p.id]=p);let R=a.nodes.length>40,Z=R?1.5:.55,V=a.selectedId||a.hoverId,be=new Map;a.edges.forEach(p=>{let F=I[p.sourceNodeId],G=I[p.targetNodeId];if(!F||!G)return;if(x!=="all"){let Fe=a.domainById[p.sourceNodeId]&&a.domainById[p.sourceNodeId].kind,bt=a.domainById[p.targetNodeId]&&a.domainById[p.targetNodeId].kind;if(Fe!==x&&bt!==x)return}if(d){let Fe=a.domainById[p.sourceNodeId]&&(a.domainById[p.sourceNodeId].tags||[]).includes(d),bt=a.domainById[p.targetNodeId]&&(a.domainById[p.targetNodeId].tags||[]).includes(d);if(!Fe&&!bt)return}let oe=G.x-F.x,le=G.y-F.y,re=Math.sqrt(oe*oe+le*le)||1,se=R?12:18,Me=-le/re*se,Re=oe/re*se,Oe=(F.x+G.x)/2+Me,Xe=(F.y+G.y)/2+Re,ot=et.colors[a.domainById[F.id]&&a.domainById[F.id].kind||"other"],it=V&&(p.sourceNodeId===V||p.targetNodeId===V),gt=V?it?.6:.08:R?.14:.24,je=parseInt(ot.slice(1,3),16),ft=parseInt(ot.slice(3,5),16),Pe=parseInt(ot.slice(5,7),16),Ge=it?1.6+(p.weight||1):.8+(p.weight||1)*.5,We=je+","+ft+","+Pe+","+gt+","+Ge,Ve=be.get(We);Ve||(Ve={path:new Path2D,stroke:"rgba("+je+","+ft+","+Pe+","+gt+")",width:Ge},be.set(We,Ve)),Ve.path.moveTo(F.x,F.y),Ve.path.quadraticCurveTo(Oe,Xe,G.x,G.y)}),be.forEach(p=>{o.strokeStyle=p.stroke,o.lineWidth=p.width,o.stroke(p.path)});let we=null;V&&(we=new Set,a.edges.forEach(p=>{p.sourceNodeId===V?we.add(p.targetNodeId):p.targetNodeId===V&&we.add(p.sourceNodeId)}));let Ye=[];if(a.nodes.forEach(p=>{let F=a.domainById[p.id]||{},G=F.kind||"other",oe=a.timeMode?ya(F.updated):et.colors[G],le=et.shapes[G],re=a.selectedId===p.id,se=a.hoverId===p.id,Me=a.searchTerm||"",Re=!Me||(p.name||"").toLowerCase().includes(Me)||String($e[G]||"").toLowerCase().includes(Me)||String(G).toLowerCase().includes(Me),Oe=x==="all"||G===x,Xe=!d||(F.tags||[]).includes(d),ot=V&&p.id!==V&&!(we&&we.has(p.id))||Me&&!Re||!Oe||!Xe;o.save(),o.globalAlpha=ot?.08:1,(re||se)&&(o.shadowColor=oe,o.shadowBlur=re?20:14),o.translate(p.x,p.y),fe(0,0,p.r,le),o.fillStyle=ge(oe,p.r),o.fill(),o.restore(),re?(o.save(),fe(p.x,p.y,p.r+3,le),o.strokeStyle=oe,o.lineWidth=3,o.shadowColor=oe,o.shadowBlur=12,o.stroke(),o.restore()):se?(o.save(),fe(p.x,p.y,p.r+2,le),o.strokeStyle=oe,o.lineWidth=2,o.stroke(),o.restore()):Me&&Re?(o.save(),fe(p.x,p.y,p.r+2,le),o.strokeStyle="#e11d48",o.lineWidth=2,o.stroke(),o.restore()):a.multi.indexOf(p.id)>=0&&(o.save(),fe(p.x,p.y,p.r+2,le),o.strokeStyle="#60a5fa",o.lineWidth=2,o.shadowColor="#60a5fa",o.shadowBlur=8,o.stroke(),o.restore());let it=X(p.name,16);if((re||se||a.zoom>Z||!R&&a.zoom>.6)&&Oe&&Xe){let je=1/a.zoom;o.font="500 "+(12*je).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";let Pe=o.measureText(it).width+16*je,Ge=18*je,We=p.y+p.r+8*je,Ve=!0;for(let Fe of Ye)if(p.x-Pe/2<Fe.x+Fe.w&&p.x+Pe/2>Fe.x&&We<Fe.y+Fe.h&&We+Ge>Fe.y){Ve=!1;break}if(!Ve&&!re&&!se)return;Ye.push({x:p.x-Pe/2,y:We,w:Pe,h:Ge}),o.fillStyle=ae()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",o.beginPath(),o.roundRect?o.roundRect(p.x-Pe/2,We,Pe,Ge,4*je):o.rect(p.x-Pe/2,We,Pe,Ge),o.fill(),o.strokeStyle=ae()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",o.lineWidth=1*je,o.stroke(),o.fillStyle=ae()?re||se?"#eee":"#bbb":re||se?"#111":"#444",o.textAlign="center",o.fillText(it,p.x,We+13*je)}}),o.restore(),a.marquee){let p=a.marquee,F=Math.min(p.sx,p.ex),G=Math.min(p.sy,p.ey),oe=Math.abs(p.ex-p.sx),le=Math.abs(p.ey-p.sy);o.save(),o.setLineDash([4,4]),o.strokeStyle="rgba(96,165,250,0.9)",o.lineWidth=1,o.fillStyle="rgba(96,165,250,0.12)",o.fillRect(F,G,oe,le),o.strokeRect(F,G,oe,le),o.restore()}if(a.hoverId&&Ne.current){let p=a.domainById[a.hoverId],F=a.nodes.find(function(G){return G.id===a.hoverId});if(p&&F){let G=a.edges.filter(function(re){return re.sourceNodeId===p.id||re.targetNodeId===p.id}).length,oe=F.x*a.zoom+a.panX,le=F.y*a.zoom+a.panY;Ne.current.style.display="block",Ne.current.style.left=oe+14+"px",Ne.current.style.top=le-6+"px",Ne.current.innerHTML="<b>"+h(p.title||p.name||"")+'</b><br/><span style="opacity:.8">'+h(p.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",G)+"</span>"}}else Ne.current&&(Ne.current.style.display="none")},me=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(dt))};a.wake=me,a.render=Ke;let Le=()=>{let d=a.nodes.length;a.tickCount++;let h=.9-Math.min(.4,a.tickCount/1500),I=d>1e3?3e3:d>100?2e3:d>50?1200:800,R=d>100?.002:.005,Z=d>1e3?.012:d>100?.005:.01,V=d>1e3?6:d>200?12:24,be={};a.nodes.forEach(p=>be[p.id]=p);for(let p=0;p<d;p++){if(a.dragNode===a.nodes[p])continue;let F=a.nodes[p],G=0,oe=0;for(let se=0;se<d;se++){if(p===se)continue;let Me=F.x-a.nodes[se].x,Re=F.y-a.nodes[se].y,Oe=Math.sqrt(Me*Me+Re*Re)||1,Xe=I/(Oe*Oe);G+=Me/Oe*Xe,oe+=Re/Oe*Xe}if(a.clustered&&a.typeCenters[F.type]){let se=a.typeCenters[F.type];G+=(se.x-F.x)*.006,oe+=(se.y-F.y)*.006}else G-=F.x*Z,oe-=F.y*Z;let le=(F.vx+G)*h,re=(F.vy+oe)*h;le=Math.max(-V,Math.min(V,le)),re=Math.max(-V,Math.min(V,re)),F.vx=le,F.vy=re}a.edges.forEach(p=>{let F=be[p.sourceNodeId],G=be[p.targetNodeId];if(!F||!G)return;let oe=G.x-F.x,le=G.y-F.y,re=Math.sqrt(oe*oe+le*le)||1,se=(re-100)*R,Me=oe/re*se,Re=le/re*se;a.dragNode!==F&&(F.vx+=Me,F.vy+=Re),a.dragNode!==G&&(G.vx-=Me,G.vy-=Re)});let we=0;a.nodes.forEach(p=>{a.dragNode!==p&&(p.x+=p.vx,p.y+=p.vy,we+=p.vx*p.vx+p.vy*p.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,Ee()),(d?Math.sqrt(we/d):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},dt=()=>{if(a.running){try{Le(),Ke()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(dt)}},qe=(d,x)=>{let h=r.getBoundingClientRect();return{x:(d-h.left-a.panX)/a.zoom,y:(x-h.top-a.panY)/a.zoom}},ct=d=>{let x=a.domainById[d];return!(!x||g.current!=="all"&&x.kind!==g.current||J.current&&!(x.tags||[]).includes(J.current))},pt=(d,x,h)=>Math.max(x,Math.min(h,d)),wt=d=>{a.mouseX=d.clientX,a.mouseY=d.clientY;let x=qe(d.clientX,d.clientY),h=null;for(let I=a.nodes.length-1;I>=0;I--){let R=a.nodes[I];if(!ct(R.id))continue;let Z=R.x-x.x,V=R.y-x.y;if(Z*Z+V*V<R.r*R.r+36){h=R.id;break}}h!==a.hoverId&&(a.hoverId=h,me())},kt=d=>{if(d.button!==0)return;let x=qe(d.clientX,d.clientY),h=null;for(let I=a.nodes.length-1;I>=0;I--){let R=a.nodes[I];if(!ct(R.id))continue;let Z=R.x-x.x,V=R.y-x.y;if(Z*Z+V*V<R.r*R.r+25){h=R;break}}if(d.shiftKey){if(h){a.shiftClick=h.id;return}a.marquee={sx:d.clientX,sy:d.clientY,ex:d.clientX,ey:d.clientY};return}a.dragStart={x:d.clientX,y:d.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=h||null,h&&(a.dragOffset={dx:h.x-x.x,dy:h.y-x.y})},Ct=d=>{if(a.marquee){a.marquee.ex=d.clientX,a.marquee.ey=d.clientY,me();return}if(!a.dragStart)return;let x=d.clientX-a.dragStart.x,h=d.clientY-a.dragStart.y;if(Math.abs(x)+Math.abs(h)>3&&(a.dragging=!0),a.dragNode){let I=qe(d.clientX,d.clientY);a.dragNode.x=I.x+a.dragOffset.dx,a.dragNode.y=I.y+a.dragOffset.dy,me()}else a.dragging&&(a.panX=pt(a.dragStart.px+x,-1e5,1e5),a.panY=pt(a.dragStart.py+h,-1e5,1e5),me())},St=d=>{if(a.marquee){let h=a.marquee;a.marquee=null;let I=r.getBoundingClientRect(),R=Math.min(h.sx,h.ex)-I.left,Z=Math.max(h.sx,h.ex)-I.left,V=Math.min(h.sy,h.ey)-I.top,be=Math.max(h.sy,h.ey)-I.top,we=a.nodes.filter(Ye=>{let p=Ye.x*a.zoom+a.panX,F=Ye.y*a.zoom+a.panY;return p>=R&&p<=Z&&F>=V&&F<=be}).map(Ye=>Ye.id);a.multi=we,de(we),me();return}let x=a.dragStart&&!a.dragging;if(a.shiftClick){let h=a.shiftClick;a.shiftClick=null;let I=Array.isArray(a.multi)?a.multi.slice():[];I.includes(h)||I.push(h),a.multi=I,de(I),me();return}if(x){let h=qe(d.clientX,d.clientY),I=null;for(let R=a.nodes.length-1;R>=0;R--){let Z=a.nodes[R];if(!ct(Z.id))continue;let V=Z.x-h.x,be=Z.y-h.y;if(V*V+be*be<Z.r*Z.r+20){I=Z;break}}I?(a.selectedId=I.id,W(I.id),me()):(a.selectedId=null,a.hoverId=null,d.shiftKey||(a.multi=[],de([])),W(null),me())}a.dragStart=null,a.dragging=!1,a.dragNode=null},Mt=d=>{d.preventDefault();let x=qe(d.clientX,d.clientY),h=null;for(let I=a.nodes.length-1;I>=0;I--){let R=a.nodes[I];if(!ct(R.id))continue;let Z=R.x-x.x,V=R.y-x.y;if(Z*Z+V*V<R.r*R.r+25){h=R;break}}if(h){let I=a.domainById[h.id];I&&he({x:d.clientX,y:d.clientY,id:h.id,path:I.id,title:I.title})}else he(null)},Nt=d=>{d.preventDefault();let x=r.getBoundingClientRect(),h=(d.clientX-x.left-a.panX)/a.zoom,I=(d.clientY-x.top-a.panY)/a.zoom,R=Math.max(.3,Math.min(3,a.zoom*(d.deltaY<0?1.1:1/1.1)));a.panX=pt(a.panX+h*(a.zoom-R),-1e5,1e5),a.panY=pt(a.panY+I*(a.zoom-R),-1e5,1e5),a.zoom=R,me()};r.addEventListener("mousemove",wt),r.addEventListener("mousedown",kt),window.addEventListener("mousemove",Ct),window.addEventListener("mouseup",St),r.addEventListener("wheel",Nt,{passive:!1}),r.addEventListener("contextmenu",Mt),N.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],de([]),Ee(),me()};for(let d=0;d<200;d++)Le();Ee(),me();let zt=()=>ne(!1);return window.addEventListener("mousedown",zt),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),j.disconnect(),r.removeEventListener("mousemove",wt),r.removeEventListener("mousedown",kt),window.removeEventListener("mousemove",Ct),window.removeEventListener("mouseup",St),r.removeEventListener("wheel",Nt),r.removeEventListener("contextmenu",Mt),window.removeEventListener("mousedown",zt)}},[t,l]),(0,n.useEffect)(()=>{B!==void 0&&T.current&&requestAnimationFrame(()=>T.current())},[B]),(0,e.jsxs)("div",{className:"me-graph",ref:b,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",i("nodes")," \xB7 ",l.length," ",i("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:i("search"),value:$,onChange:r=>ie(r.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>ne(r=>!r),"aria-expanded":C,title:i("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",i("filterLabel")," ",P!=="all"||O||D?"\u25CF":"\u25BE"]}),C&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:r=>r.stopPropagation(),style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:50,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,padding:8,minWidth:240,boxShadow:"0 12px 34px rgba(0,0,0,.35)"},children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,e.jsx)("button",{type:"button",className:`lg${P==="all"&&!O?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{ye("all"),H(!1)},children:i("all")}),Object.keys(He).map(r=>(0,e.jsxs)("button",{type:"button",className:`lg${P===r?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>ye(o=>o===r?"all":r),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:et.colors[r]||He[r]}}),i($e[r])]},r)),(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsxs)("button",{type:"button",className:`lg${O?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>H(r=>!r),children:["\u23F1 ",i("timeDim")]}),_e.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsx)("div",{style:{maxHeight:130,overflow:"auto",display:"flex",flexWrap:"wrap",gap:4},children:_e.map(r=>(0,e.jsxs)("button",{type:"button",className:`lg${D===r.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>K(o=>o===r.tag?"":r.tag),title:r.tag,children:["#",r.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:r.n})]},r.tag))})]}),(P!=="all"||O||D)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{ye("all"),H(!1),K("")},children:[i("clearFilter")," \u2715"]})]})})]}),(0,e.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:i("crossVault"),children:[(0,e.jsx)("input",{type:"checkbox",checked:!!w,onChange:r=>z&&z(r.target.checked)}),i("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${O?" me-on":""}`,onClick:()=>H(r=>!r),children:i("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let r=v.current;if(r)try{r.toBlob(o=>{o&&Ue({url:URL.createObjectURL(o),blob:o})},"image/png")}catch{}},children:i("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>T.current&&T.current(),children:i("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{W(null),ye("all"),N.current&&N.current()},children:i("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:v,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:Ne,style:{display:"none",position:"absolute",zIndex:4,pointerEvents:"none",background:"rgba(28,28,32,0.88)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:8,padding:"7px 10px",fontSize:12,maxWidth:220,boxShadow:"0 8px 24px rgba(0,0,0,.2)"}}),Ae&&(0,e.jsx)("div",{className:"mc-empty",style:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)"},children:i("noMatch")}),Q&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>he(null)}),Q&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:Q.x,top:Q.y,zIndex:31},onMouseDown:r=>r.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{k.current({path:Q.path,title:Q.title}),he(null)},children:i("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{Q.id&&(f.current.selectedId=Q.id,W(Q.id)),he(null);let r=f.current;r&&r.wake&&r.wake()},children:i("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(Q.title||"")}catch{}he(null),q(i("copied"))},children:i("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let r=f.current,o=r&&Array.isArray(r.multi)?r.multi.slice():[],A=Q.id;if(A&&!o.includes(A)&&o.push(A),he(null),o.length<2){q(i("mergeNeed"),!1);return}if(!window.confirm(i("mergeConfirm")))return;let ae=M.current&&M.current(o);ae&&ae.then?ae.then(ce=>ce?q(i("merged")):q(i("mergeFail"),!1)).catch(()=>q(i("mergeFail"),!1)):ae&&q(i("merged"))},children:i("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let r=Q.path;he(null),window.confirm(i("deleteConfirm"))&&(async()=>{try{(L.current?await L.current(r):!1)?q(i("deleted")):q(i("deleteFail"),!1)}catch{q(i("deleteFail"),!1)}})()},children:i("delete")})]}),De.length>0&&(0,e.jsxs)("div",{style:{position:"absolute",left:10,top:10,zIndex:3,display:"flex",gap:8,alignItems:"center",background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:"6px 10px",fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsxs)("span",{style:{fontWeight:700},children:[De.length," ",i("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let o=De.map(Se=>ue[Se]).filter(Boolean).map(Se=>Se.title||Se.name).join(`
|
|
298
|
-
`),A=new Blob([o],{type:"text/plain;charset=utf-8"}),ae=URL.createObjectURL(A),ce=document.createElement("a");ce.href=ae,ce.download="memory-selected.txt",document.body.appendChild(ce),ce.click(),document.body.removeChild(ce),setTimeout(()=>URL.revokeObjectURL(ae),1e3),q(De.length+i("exportedSel"))},children:i("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(De.length<2){q(i("mergeNeed"),!1);return}let r=De.map(A=>ue[A]?ue[A].id:A);if(!window.confirm(i("mergeConfirm")))return;de([]);let o=f.current;o&&(o.multi=[]),fetch(`${U}/merge?paths=${encodeURIComponent(r.join(","))}`).then(A=>A.json()).then(A=>{A&&A.ok?q(i("merged")):q(i("mergeFail"),!1)}).catch(()=>q(i("mergeFail"),!1))},children:i("merge")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(i("deleteConfirm")))return;let r=De.map(A=>ue[A]?ue[A].id:A);de([]);let o=f.current;o&&(o.multi=[]),(async()=>{let A=0;for(let ae of r)try{(L.current?await L.current(ae):!1)&&A++}catch{}q(A+i("deletedSelected"),A>0)})()},children:i("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let r=f.current;r&&(r.multi=[]),de([]);let o=f.current;o&&o.render&&o.render()},children:i("clearSelection")})]}),te&&(0,e.jsxs)("div",{className:"me-graph-sidebar",style:{position:"absolute",right:10,top:10,zIndex:3,maxWidth:240,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:12,fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsx)("div",{style:{fontWeight:700,fontSize:13,marginBottom:4},children:ue[te]?ue[te].title||ue[te].name:te}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:ue[te]?i($e[ue[te].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:i("graphHint")}),(l.filter(r=>r.source===te||r.target===te)||[]).slice(0,8).map((r,o)=>{let A=r.source===te?r.target:r.source,ae=ue[A];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:ce=>{ce.preventDefault();let Se=f.current;Se&&(Se.selectedId=A,Se.hoverId=A,Se.wake&&Se.wake()),W(A)},children:ae?(ae.title||ae.name).slice(0,28):A},o)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:i("graphTip")}),pe&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(pe.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:pe.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:pe.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:pe.msg})]}),ke&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{ke.url&&URL.revokeObjectURL(ke.url),Ue(null),Ie(!1)},children:[(0,e.jsx)("style",{children:Be}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:ze?"100vw":900,width:ze?"100vw":"92vw",maxHeight:ze?"100%":"90vh",height:ze?"100%":void 0,borderRadius:ze?0:14},onClick:r=>r.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:i("exportGraph")}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("a",{className:"mc-btn",href:ke.url,download:"memory-graph.png",onClick:()=>{xe("download"),q(i("downloaded")+" \xB7 "+i("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:i(s==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{xe("full"),Ie(r=>!r),q(i("fullscreen"))},children:i(s==="full"?"done":ze?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let r=ke.blob;r&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":r})]).then(()=>{xe("copy"),q(i("copied"))}).catch(()=>{q(i("copyFail"),!1)}):q(i("copyFail"),!1)},children:i(s==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{ke.url&&URL.revokeObjectURL(ke.url),Ue(null),Ie(!1)},children:i("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:ze?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,e.jsx)("img",{src:ke.url,alt:i("exportGraph"),style:{maxWidth:"100%",maxHeight:ze?"calc(100% - 64px)":"70vh",borderRadius:ze?0:8,cursor:"zoom-in"},onClick:()=>Ie(r=>!r)})})]})]})]})}function ya(t){let l=new Date(t||0).getTime();if(!l)return"#94a3b8";let c=(Date.now()-l)/864e5;return c<3?"#10b981":c<14?"#f59e0b":c<30?"#f97316":"#94a3b8"}function Tt({label:t,value:l=[],options:c,onChange:y,placeholder:u,z:i=20}){let[S,w]=(0,n.useState)(!1),z=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!S)return;let k=L=>{z.current&&!z.current.contains(L.target)&&w(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[S]);let B=Array.isArray(l)?l:[],v=B.includes("__all__"),b=v?c.find(k=>k.value==="__all__")?.label||"":B.length?B.map(k=>c.find(L=>L.value===k)?.label||k).join("\u3001"):"",f=(k,L)=>{if(k.value==="__all__"){y(L?["__all__"]:[]);return}let M=new Set(B);M.has("__all__")&&M.delete("__all__"),L?M.add(k.value):M.delete(k.value),y([...M])},T=c.find(k=>k.value==="__all__"),N=c.filter(k=>k.value!=="__all__");return(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t}),(0,e.jsxs)("div",{ref:z,style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>w(k=>!k),style:{width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[(0,e.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b||u||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),S&&(0,e.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:i,marginTop:2,borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",boxShadow:"0 6px 20px rgba(0,0,0,0.14)",maxHeight:180,overflow:"auto"},children:[T&&(0,e.jsxs)("label",{onClick:k=>k.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("input",{type:"checkbox",checked:v,onChange:k=>f(T,k.target.checked)}),(0,e.jsx)("span",{children:T.label})]}),N.map(k=>(0,e.jsxs)("label",{onClick:L=>L.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:B.includes(k.value),onChange:L=>f(k,L.target.checked)}),(0,e.jsx)("span",{children:k.label})]},k.value))]})]})]})}function ha(t){let l=new Date(t||0).getTime();return!!l&&(Date.now()-l)/864e5<3}async function xa(t,l,c){if(c&&typeof window.showSaveFilePicker=="function")try{let i=await window.showSaveFilePicker({suggestedName:l}),S=await i.createWritable();return await S.write(t),await S.close(),{ok:!0,picked:!0,name:i.name}}catch(i){return i&&i.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(i.message||i)}}let y=URL.createObjectURL(t),u=document.createElement("a");return u.href=y,u.download=l,document.body.appendChild(u),u.click(),document.body.removeChild(u),setTimeout(()=>URL.revokeObjectURL(y),1e3),{ok:!0,picked:!1,name:l}}function At(t,l){if(!l||!t)return t;let c=t.toLowerCase(),y=l.toLowerCase(),u=[],i=0;for(;i<t.length;){let S=c.indexOf(y,i);if(S<0){u.push(t.slice(i));break}S>i&&u.push(t.slice(i,S)),u.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(S,S+y.length)},S)),i=S+y.length}return u}function tt(t){if(!t)return"";let l=new Date(t);if(Number.isNaN(l.getTime()))return"";let c=new Date,y=l.toDateString()===c.toDateString(),u=S=>String(S).padStart(2,"0"),i=`${u(l.getHours())}:${u(l.getMinutes())}`;return y?i:`${l.getMonth()+1}-${l.getDate()} ${i}`}
|
|
302
|
+
`));let Ke=new Blob([pe],{type:ge}),$e=await ja(Ke,ue,!1);if(!$e.ok){_({ok:!1,msg:t("exportFail")}),le(!1);return}_({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+$e.name})}catch(Z){_({ok:!1,msg:t("exportFail")+" \xB7 "+(Z.message||"")})}finally{le(!1)}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2600)},mt=async h=>{let F=h.target.files&&h.target.files[0];if(h.target.value="",!!F){try{let Z=await F.text(),pe=await(await fetch(`${Y}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:Z})).json();pe.ok?(await U(),_({ok:!0,msg:t("importedVault")+"\uFF1A"+(pe.imported||0)+(pe.skipped?t("importedSkipped")+pe.skipped:"")})):_({ok:!1,msg:pe.error||t("importFail")})}catch{_({ok:!1,msg:t("importFail")})}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2400)}},gt=(0,n.useMemo)(()=>{let h=S.slice();return G!=="all"&&(h=h.filter(F=>rt(F.submittedBy)===G)),H!=="all"&&(h=h.filter(F=>(F.status||"approved")===H)),f==="title"?h.sort((F,Z)=>String(F.title||"").localeCompare(String(Z.title||""))):f==="hot"?h.sort((F,Z)=>(Z.weight||Z.links||0)-(F.weight||F.links||0)):h.sort((F,Z)=>new Date(Z.updated||0).getTime()-new Date(F.updated||0).getTime()),h},[S,f,G,H]),ft=(0,n.useMemo)(()=>[...new Set(S.map(h=>rt(h.submittedBy)))],[S]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Ie}),K&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(K.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:K.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:K.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:K.msg})]}),o&&(0,e.jsxs)("div",{className:"me-modal-head",children:[(0,e.jsxs)("div",{className:"me-modal-title",children:[(0,e.jsx)("span",{className:"me-wicon",children:(0,e.jsx)(Jt,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),g&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:g,"aria-label":t(p?"exitFull":"fullscreen"),children:p?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:i,"aria-label":t("close"),children:"\u2715"})]}),y&&y.ok===!1&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,margin:"0 0 8px",padding:"9px 14px",borderRadius:10,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.45)",borderLeft:"4px solid #ef4444",color:"var(--dsw-alias-label-primary, #e5e7eb)",fontSize:12.5,lineHeight:1.6},children:[(0,e.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",t("captureAlert")]}),(0,e.jsxs)("span",{style:{flex:1},children:[y.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:y.since?lt(new Date(y.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${me?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Ce(h=>!h),"aria-label":t(me?"collapse":"expand"),title:t(me?"collapse":"expand"),children:me?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="cards"?" active":""}`,onClick:()=>b("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="graph"?" active":""}`,onClick:()=>b("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="stats"?" active":""}`,onClick:()=>b("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="audit"?" active":""}`,onClick:()=>b("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="optimize"?" active":""}`,onClick:()=>b("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="config"?" active":""}`,onClick:()=>b("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>xe(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:r,children:[$==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(ot,{label:t("total"),value:l?l.total:"\u2014"}),(0,e.jsx)(ot,{label:t("recent"),value:l?l.recent:"\u2014"}),(0,e.jsx)(ot,{label:t("tags"),value:l?l.tags:"\u2014"}),(0,e.jsx)(ot,{label:t("pending"),value:l?.status?.pending??0}),(0,e.jsx)(ot,{label:t("rejected"),value:l?.status?.rejected??0}),(0,e.jsx)(ot,{label:t("cardCount"),value:l?l.byKind?.knowledge??0:"\u2014"})]}),$==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:N,onChange:h=>we(h.target.value)}),(0,e.jsx)("input",{ref:ee,type:"file",accept:".json,application/json",style:{display:"none"},onChange:mt}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ee.current&&ee.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>Se({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:Q,onClick:()=>st("md"),children:t(Q?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:Q,onClick:()=>st("json"),children:t(Q?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>U(),children:t("refresh")})]}),$==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[It.map(h=>(0,e.jsx)("button",{type:"button",className:`mc-chip${w===h?" active":""}`,onClick:()=>a(h),children:t(h==="all"?"all":Ee[h])},h)),(0,e.jsxs)("select",{value:G,onChange:h=>te(h.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsxs)("option",{value:"all",children:["\u{1F916} ",t("allAgents")]}),Gt(ft).map(h=>(0,e.jsx)("option",{value:h,children:h},h))]}),(0,e.jsxs)("select",{value:H,onChange:h=>ye(h.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allStatus")}),(0,e.jsx)("option",{value:"approved",children:t("statusApproved")}),(0,e.jsx)("option",{value:"pending",children:t("statusPending")}),(0,e.jsx)("option",{value:"rejected",children:t("statusRejected")})]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:t("sortRecent")},{key:"title",label:t("sortTitle")},{key:"hot",label:t("sortHot")}].map(h=>(0,e.jsx)("button",{type:"button",className:`mc-chip${f===h.key?" active":""}`,onClick:()=>E(h.key),children:h.label},h.key))]}),M&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",M]}),(0,e.jsx)("div",{style:{display:$==="cards"?"contents":"none"},children:A?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):M?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",M," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>U(),children:t("retry")})]}):S.length===0?(0,e.jsx)("div",{className:"mc-empty",children:t("empty")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"mc-grid",children:gt.map(h=>(0,e.jsx)(Ia,{card:h,t,query:N.trim(),onOpen:Ze,onDelete:se},h.path))}),S.length<ce&&(0,e.jsx)("div",{ref:s,style:{height:1}}),R&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",S.length," / ",ce,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:$==="graph"?"flex":"none",flex:1,minHeight:0},children:be.has("graph")&&(0,e.jsx)(Ba,{t,onOpen:Ze,all:De,onAllChange:Be,onMutate:We,active:$==="graph",visible:$==="graph"})}),(0,e.jsx)("div",{style:{display:$==="config"?"contents":"none"},children:be.has("config")&&(0,e.jsx)(Qt,{t,onReload:()=>U(),version:Re})}),(0,e.jsx)("div",{style:{display:$==="stats"?"contents":"none"},children:be.has("stats")&&(0,e.jsx)(Da,{t,tab:"stats",onReload:()=>U(),version:Re})}),(0,e.jsx)("div",{style:{display:$==="audit"?"contents":"none"},children:be.has("audit")&&(0,e.jsx)(Ma,{t,onReload:()=>U(),version:Re})}),(0,e.jsx)("div",{style:{display:$==="optimize"?"contents":"none"},children:be.has("optimize")&&(0,e.jsx)(za,{t,onReload:()=>U(),version:Re})}),he&&(0,e.jsx)(Ta,{t,onClose:()=>xe(!1)}),Ve&&(0,e.jsx)(Aa,{t,card:Ve,query:N.trim(),onClose:()=>qe(null),onDelete:h=>{qe(null),se(h)},onFeedback:h=>{let F=Ve.path;fetch(`${Y}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:N.trim(),path:F,useful:h})}).then(()=>_({ok:!0,msg:t(h?"fbUseful":"fbIrr")})).catch(()=>{}),B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2e3)}}),(0,e.jsx)(La,{t,newCard:Fe,setNewCard:Se,onCreated:()=>{U(),We(),_({ok:!0,msg:t("created")}),B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2e3)}})]})]})]})}var Zt=({toast:t})=>t?(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"8px 12px",fontSize:12,borderLeft:"4px solid "+(t.ok?"#10b981":"#ef4444"),background:t.ok?"rgba(16,185,129,0.08)":"rgba(239,68,68,0.08)"},children:[t.ok?"\u2705":"\u26A0"," ",t.msg]}):null,ot=({label:t,value:o})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:o}),(0,e.jsx)("span",{children:t})]});function Qt({t,onReload:o,version:i,compact:g}){let[p,l]=(0,n.useState)(null),[v,S]=(0,n.useState)(0),[x,A]=(0,n.useState)(null),[k,y]=(0,n.useState)(null),[m,M]=(0,n.useState)(!1),[z,w]=(0,n.useState)(null),[L,N]=(0,n.useState)(null),[O,G]=(0,n.useState)(""),[te,H]=(0,n.useState)(""),[ye,$]=(0,n.useState)(""),[J,be]=(0,n.useState)(null),W=(0,n.useCallback)(async d=>{H("version");try{let R=await fetch(Y+"/version-check"+(d?"?force=1":"")).then(P=>P.json());R&&R.ok?(be(R),d&&B(R.updateAvailable?t("vcLatest")+" v"+R.latest:t("vcUpToDate"))):d&&B(t("vcCheckFail"),!1)}catch{d&&B(t("vcCheckFail"),!1)}finally{H("")}},[t]);(0,n.useEffect)(()=>{W(!1)},[i,W]);let[b,f]=(0,n.useState)(""),[E,K]=(0,n.useState)(null),_=(0,n.useRef)(null),B=(d,R=!0)=>{_.current&&clearTimeout(_.current),K({msg:d,ok:R}),_.current=setTimeout(()=>K(null),1900)},ee=(d,R)=>Object.keys(R).reduce((P,s)=>P.split("{"+s+"}").join(R[s]),t(d)),Q=(0,n.useCallback)(async()=>{try{let[d,R,P]=await Promise.all([fetch(`${Y}/config`).then(s=>s.json()).catch(()=>null),fetch(`${Y}/setup-status`).then(s=>s.json()).catch(()=>null),fetch(`${Y}/budget`).then(s=>s.json()).catch(()=>null)]);d&&d.ok?(l(d),S(d.revision??0),A(d.schema??null),y({...d.config??{}}),w(d.dsh??null),M(d.writable===!1),G("")):P&&P.ok?(y({...P}),M(!0),G(t("configNeedsDsh"))):G(t("adminLoadFail")),R&&R.ok&&N(R),$("")}catch{G(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{Q()},[i,Q]);let le=(d,R)=>y(P=>({...P??{},[d]:R})),Ve=d=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[d]||d,qe=async()=>{if(k){if(m){B(t("editInSetting"),!1);return}H("save");try{let d={...k};Array.isArray(d.vaultProfiles)&&(d.vaultProfiles=d.vaultProfiles.filter(s=>s&&(String(s.name||"").trim()||String(s.path||"").trim())));let R=await fetch(`${Y}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:d,expectedRevision:v})}),P=await R.json();if(P&&P.ok)$(t("savedOk")+(P.note?` \xB7 ${t("restartHint")}`:"")),B(t("savedOk")),await Q();else{let s=R.status===409?t("conflictRefresh"):P?.error||t("saveFail");G(s),B(s,!1)}}catch{G(t("saveFail")),B(t("saveFail"),!1)}finally{H("")}}},De=()=>{y({...p?.config??{}}),$("")},Be={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},he=d=>Array.isArray(d?.vaultProfiles)?d.vaultProfiles:[],xe=(d,R,P)=>y(s=>{let r=he(s).map(U=>({...U||{}})),D={...r[d]||{}};return R==="match"?String(P).trim()?D.match={...D.match||{},workspace:P}:delete D.match:D[R]=P,r[d]=D,{...s??{},vaultProfiles:r}}),me=()=>y(d=>({...d??{},vaultProfiles:[...he(d),{name:"",path:""}]})),Ce=d=>y(R=>({...R??{},vaultProfiles:he(R).filter((P,s)=>s!==d)})),Fe={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},Se={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},Re={A:{label:t("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:900,recallMinScore:2,recallLimit:5,recallSummaryLen:130,recallIncludeBody:!1,captureCooldownMs:3e5},B:{label:t("planB"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!1,dedupByLLM:!1,captureMaxTokens:500,recallMinScore:3,recallLimit:3,recallSummaryLen:80,recallIncludeBody:!1,captureMinChars:300,maxCardsPerDay:40,captureCooldownMs:3e5},C:{label:t("planC"),autoWebMode:"interval",watchdogAutoSpawn:!0,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:1200,recallMinScore:1,recallLimit:8,recallSummaryLen:200,recallIncludeBody:!0,captureCooldownMs:12e4}},Xe=async d=>{let R=Re[d];R&&y(P=>({...P??{},...R}))},We=async(d,R)=>{H(d+R);try{let s=await(await fetch(`${Y}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:d,action:R})})).json();s&&s.ok?B(ee(R==="install"?"mcpInstalled":"mcpUninstalled",{agent:d})):B(ee("mcpActionFail",{agent:d,error:s?.error||""}),!1);try{let r=await fetch(`${Y}/setup-status`).then(D=>D.json());r&&r.ok&&N(r)}catch{}}catch{B(t("mergeFail"),!1)}finally{H("")}},re=({k:d,label:R,type:P="text",step:s,min:r,max:D})=>(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:R||d}),(0,e.jsx)("input",{type:P,step:s,min:r,max:D,value:k?k[d]??"":"",onChange:U=>le(d,P==="number"?Number(U.target.value):U.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12}})]}),ce=({k:d,label:R})=>(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:!!(k&&k[d]),onChange:P=>le(d,P.target.checked)}),(0,e.jsx)("span",{children:R||d})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:g?"0 0 auto":1,minHeight:0,maxHeight:g?"52vh":void 0},children:[(0,e.jsx)("style",{children:Ie}),E&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(E.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:E.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:E.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:E.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[O&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",O]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:Q,children:["\u21BB ",t("retry")]})]}),m&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #f59e0b",background:"rgba(245,158,11,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#b45309"},children:["\u2139\uFE0F ",t("configNeedsDsh")," \u2014\u2014 ",t("editInSetting")]}),ye&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #10b981",background:"rgba(16,185,129,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#059669"},children:["\u2713 ",ye]}),p&&(p.version||p.dsh?.vaultDir)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",t("pluginInfo")]}),(0,e.jsx)("span",{style:{fontSize:12,opacity:.7},children:t("dshHostLabel")}),p.version&&(0,e.jsxs)("code",{style:Fe,children:[t("vcLoaded")," v",p.version]}),J&&J.onDisk&&(0,e.jsxs)("code",{style:Fe,children:[t("vcOnDisk")," v",J.onDisk]}),J&&J.latest&&(0,e.jsxs)("code",{style:Fe,children:[t("vcLatest")," v",J.latest]}),p.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",p.dsh.vaultDir]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:te==="version",onClick:()=>W(!0),children:te==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),J&&J.stale&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px"},children:["\u26A0\uFE0F ",ee("vcStale",{disk:J.onDisk,loaded:J.loaded})]}),J&&J.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:J.updateCommand})]}),J&&J.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",J.checkError]})]}),L&&L.agents&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F50C} ",t("mcpSetupStatus")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("mcpManageHint")})]}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:L.agents.map(d=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1},children:[(0,e.jsx)("b",{children:d.isDsh?t("dshHostLabel"):d.name}),d.isDsh&&d.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",d.version]}),!d.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),d.installed&&d.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),d.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),d.mcpConfigured===!0&&d.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),d.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",d.recallTool?t("enabled"):t("disabled"),")"]})]}),d.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",d.hook]}),!d.isDsh&&d.installed&&d.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!te,onClick:()=>We(d.name,"install"),children:t("installMcp")}),!d.isDsh&&d.installed&&d.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!te,onClick:()=>{window.confirm(t("uninstallConfirm"))&&We(d.name,"uninstall")},children:t("uninstallMcp")})]},d.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),b&&(0,e.jsx)("div",{style:{fontSize:11,marginTop:6},children:(0,e.jsx)("code",{style:{padding:"2px 6px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:4},children:b})})]}),k?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("presetConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("presetHint")})]}),(0,e.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(d=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>Xe(d),disabled:!!te,children:[d==="A"?"\u{1F7E2} ":d==="B"?"\u{1F4B0} ":"\u2B50 ",Re[d].label]},d))})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9E0} ",t("dshMemoryConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:8},children:[(0,e.jsx)(ce,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(ce,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(re,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(re,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(re,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(re,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(re,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(ce,{k:"recallIncludeBody",label:t("recallBody")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #06b6d4"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5C2}\uFE0F ",t("vaultMulti")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("vaultMultiHint")})]}),(0,e.jsxs)("div",{style:{fontSize:11.5,opacity:.85,marginBottom:8,lineHeight:1.7},children:[t("vaultNow"),"\uFF1A",(0,e.jsx)("code",{children:z?.vaultDir||"\u2014"}),z?.vaultName?`\uFF08${z.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(Be[z?.vaultSource]||"vaultSrcDefault"),z?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:z.workspace})]}):null]}),he(k).map((d,R)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:d.name||"",placeholder:t("vaultNamePh"),onChange:P=>xe(R,"name",P.target.value),style:Se,disabled:m}),(0,e.jsx)("input",{value:d.path||"",placeholder:t("vaultPathPh"),onChange:P=>xe(R,"path",P.target.value),style:Se,disabled:m}),(0,e.jsx)("input",{value:d.match&&d.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:P=>xe(R,"match",P.target.value),style:Se,disabled:m}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Ce(R),disabled:m,title:t("delete"),children:"\u2715"})]},R)),(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:me,disabled:m,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:k.activeVault||"",onChange:d=>le("activeVault",d.target.value),disabled:m,style:Se,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),he(k).filter(d=>d&&d.name).map(d=>(0,e.jsx)("option",{value:d.name,children:d.name},d.name))]})]})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #f59e0b"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4B0} ",t("costControl")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("costHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))",gap:8,marginTop:6},children:[(0,e.jsx)(ce,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(ce,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(re,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(re,{k:"recallMinScore",label:t("recallMinScore"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("auditConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("auditHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))",gap:8},children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("auditMode")}),(0,e.jsxs)("select",{value:k.auditMode??"all",onChange:d=>le("auditMode",d.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"all",children:t("auditAll")}),(0,e.jsx)("option",{value:"none",children:t("auditNone")})]})]}),(0,e.jsx)(Yt,{label:t("auditExemptAgents"),value:k.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(L?.agents||[]).filter(d=>!d.isDsh).map(d=>({value:d.name,label:d.name}))],onChange:d=>le("auditExemptAgents",d)}),(0,e.jsx)(Yt,{label:t("auditExemptKinds"),value:k.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...It.filter(d=>d!=="all").map(d=>({value:d,label:t(Ee[d])}))],onChange:d=>le("auditExemptKinds",d)}),(0,e.jsx)(re,{k:"recycleRetentionDays",label:t("recycleDays"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E0} ",t("serviceConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:8},children:[(0,e.jsx)(ce,{k:"autoWeb",label:t("autoWeb")}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("autoWebMode")}),(0,e.jsxs)("select",{value:k.autoWebMode??"init",onChange:d=>le("autoWebMode",d.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"init",children:t("modeInit")}),(0,e.jsx)("option",{value:"interval",children:t("modeInterval")}),(0,e.jsx)("option",{value:"manual",children:t("modeManual")})]})]}),(0,e.jsx)(re,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(re,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(re,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(ce,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(ce,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[te==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),ye&&te!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",ye]}),O&&te!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",O]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:De,disabled:!!te,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:qe,disabled:!!te||m,children:te==="save"?"\u23F3 "+t("saving"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function Ma({t,onReload:o,version:i}){let[g,p]=(0,n.useState)([]),[l,v]=(0,n.useState)([]),[S,x]=(0,n.useState)("all"),[A,k]=(0,n.useState)("all"),[y,m]=(0,n.useState)(""),[M,z]=(0,n.useState)(new Set),[w,L]=(0,n.useState)(""),[N,O]=(0,n.useState)(null),[G,te]=(0,n.useState)("pending"),H=(f,E=!0)=>{O({msg:f,ok:E}),setTimeout(()=>O(null),3e3)},ye=[...new Set([...g,...l].map(f=>f.submittedBy).filter(Boolean))],$=(0,n.useCallback)(async()=>{try{let f=await fetch(`${Y}/audit/list`).then(E=>E.json());f.ok&&(p(f.pending||[]),v(f.rejected||[]),z(new Set))}catch{}},[]);(0,n.useEffect)(()=>{$()},[i,$]);let J=(G==="pending"?g:l).filter(f=>{if(S!=="all"&&f.kind!==S||A!=="all"&&rt(f.submittedBy)!==A)return!1;if(y){let E=(f.created||"").slice(0,10);if(E&&E!==y)return!1}return!0}),be=f=>z(E=>{let K=new Set(E);return K.has(f)?K.delete(f):K.add(f),K}),W=async(f,E)=>{let K=E||[...M];if(!K.length){H(t("noSelection"),!1);return}L("apply");let _=t(f==="approved"?"toastApproved":f==="rejected"?"toastRejected":"toastCardDeleted");try{let B=0;for(let ee of K){let Q=f==="approved"?"audit/approve":f==="rejected"?"audit/reject":"delete";try{(await fetch(Y+"/"+Q+"?path="+encodeURIComponent(ee)+(f==="delete"?"&permanent=0":""))).ok||B++}catch{B++}}await $(),o&&o(),B?H(t("toastFailed")+"\uFF08"+B+"/"+K.length+"\uFF09",!1):H(_+" "+K.length+" \u5F20")}catch(B){H(t("toastFailed")+": "+String(B&&B.message||B),!1)}finally{L("")}},b=[...M];return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(Zt,{toast:N}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("tabAudit")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("select",{value:S,onChange:f=>x(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("all")}),It.filter(f=>f!=="all").map(f=>(0,e.jsx)("option",{value:f,children:t(Ee[f])},f))]}),(0,e.jsxs)("select",{value:A,onChange:f=>k(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allAgents")}),Gt(ye).map(f=>(0,e.jsx)("option",{value:f,children:f},f))]}),(0,e.jsx)("input",{type:"date",value:y,onChange:f=>m(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"}})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("button",{type:"button",className:`mc-btn${G==="pending"?" me-on":""}`,onClick:()=>te("pending"),children:[t("pending"),"\uFF08",g.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${G==="rejected"?" me-on":""}`,onClick:()=>te("rejected"),children:[t("rejected"),"\uFF08",l.length,"\uFF09"]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("label",{style:{fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:J.length>0&&b.length===J.length,onChange:f=>{f.target.checked?z(new Set(J.map(E=>E.path))):z(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!b.length||!!w,onClick:()=>W("approved"),children:["\u2713 ",t(G==="rejected"?"restore":"approve")]}),G==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!b.length||!!w,onClick:()=>W("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!b.length||!!w,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&W("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),J.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:J.map(f=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:M.has(f.path),onChange:()=>be(f.path)}),(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[f.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:rt(f.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:f.created?f.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:f.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:f.severity==="high"?"#f87171":"#9ca3af"},children:f.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.reason||"-"}),G==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>W("approved",[f.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>W("rejected",[f.path]),children:"\u2715"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},title:t("restore"),onClick:()=>W("approved",[f.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},title:t("restoreDelete"),onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&W("delete",[f.path])},children:"\u{1F5D1}"})]})]},f.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function za({t,onReload:o,version:i}){let[g,p]=(0,n.useState)([]),[l,v]=(0,n.useState)(""),[S,x]=(0,n.useState)(null),A=(m,M=!0)=>{x({msg:m,ok:M}),setTimeout(()=>x(null),3200)},k=(0,n.useCallback)(async()=>{try{let m=await fetch(`${Y}/recycle/list`).then(M=>M.json());m.ok&&p(m.items||[])}catch{}},[]);(0,n.useEffect)(()=>{k()},[i,k]);let y=async(m,M)=>{let z=(g.find(w=>w.path===M)||{}).title||M;v(m+M);try{let L=await fetch(Y+(m==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(M)),N=await L.json().catch(()=>null);await k(),o&&o(),L.ok&&(!N||N.ok!==!1)?A(t(m==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+z):A(t("toastFailed")+"\uFF1A"+(N&&N.error||"HTTP "+L.status),!1)}catch(w){A(t("toastFailed")+"\uFF1A"+String(w&&w.message||w),!1)}finally{v("")}};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(Zt,{toast:S}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",t("tabRecycle")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("recycleHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!l||g.length===0,title:g.length?"":t("emptyRecycle"),onClick:async()=>{v("purgeAll");try{let m=await fetch(Y+"/recycle/purge-expired?days=0"),M=await m.json().catch(()=>null);await k(),A(m.ok?t("toastPurgedExpired")+(M&&M.purged!=null?"\uFF08"+M.purged+"\uFF09":""):t("toastFailed"),m.ok)}catch(m){A(t("toastFailed")+"\uFF1A"+String(m&&m.message||m),!1)}finally{v("")}},children:t("emptyRecycle")})]}),g.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:g.map(m=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[m.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(m.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!l,onClick:()=>y("restore",m.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!l,onClick:()=>{window.confirm(t("purgeConfirm"))&&y("purge",m.path)},children:t("purge")})]},m.path))}):(0,e.jsxs)("div",{className:"mc-card",style:{padding:18,fontSize:12.5,opacity:.78,textAlign:"center",lineHeight:1.9},children:["\u{1F5D1}\uFE0F ",t("emptyRecycle"),(0,e.jsx)("br",{}),(0,e.jsx)("span",{style:{fontSize:11.5},children:t("recycleEmptyHint").split("{days}").join("30")})]})]})]})}var Ia=({card:t,t:o,onOpen:i,query:g,onDelete:p})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>i(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[t.kind]||Ue.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:wt[t.kind]||"\u{1F4CE}"}),g?Vt(t.title,g):t.title,Fa(t.updated)&&(0,e.jsx)("span",{className:"mc-new",children:o("newBadge")}),t.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",o("statusPending")]}),t.status==="rejected"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",o("statusRejected")]}),(!t.status||t.status==="approved")&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",o("statusApproved")]})]}),(0,e.jsx)("p",{children:g?Vt(t.summary||"",g):t.summary||""}),t.tags.length>0&&(0,e.jsx)("div",{className:"mc-tags",children:t.tags.slice(0,4).map(l=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",l]},l))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[wt[t.kind]||"\u{1F4CE}"," ",o(Ee[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",rt(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",lt(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:o("delete"),onClick:l=>{l.stopPropagation(),window.confirm(o("deleteConfirm"))&&p&&p(t.path)},children:"\u{1F5D1}"})]})]});function Da({t,tab:o,onReload:i,version:g}){let[p,l]=(0,n.useState)(null),[v,S]=(0,n.useState)(""),[x,A]=(0,n.useState)(null),[k,y]=(0,n.useState)(null),[m,M]=(0,n.useState)(null),[z,w]=(0,n.useState)([]),[L,N]=(0,n.useState)(""),[O,G]=(0,n.useState)(!1),te=(0,n.useCallback)(async()=>{if(!(!x||!x.merge||!x.merge.length)&&window.confirm(t("mergeAllConfirm"))){N("merge");try{let b={},f=ee=>b[ee]===void 0?ee:b[ee]=f(b[ee]),E=(ee,Q)=>{b[f(ee)]=f(Q)},K=new Set;for(let ee of x.merge)K.add(ee.a.path),K.add(ee.b.path),E(ee.a.path,ee.b.path);let _={};for(let ee of K){let Q=f(ee);(_[Q]=_[Q]||[]).push(ee)}let B=0;for(let ee of Object.values(_)){if(ee.length<2)continue;(await fetch(`${Y}/merge?paths=${encodeURIComponent(ee.join(","))}`).then(le=>le.json())).ok&&B++}await H(),i&&i()}catch{}N("")}},[x,H,i,t]);async function H(){try{let b=await Promise.all([fetch(`${Y}/stats`),fetch(`${Y}/budget`),fetch(`${Y}/capture-log`),fetch(`${Y}/cards?status=all&limit=30&agent=${ut}`)]),[f,E,K,_]=await Promise.all(b.map(B=>B.json()));f&&f.ok&&l(f),E&&E.ok&&y(E),K&&K.ok&&M(K),_&&_.ok&&w(_.cards||[]),S(!f||!f.ok?t("adminLoadFail"):"")}catch{S(t("adminLoadFail"))}}let ye=(0,n.useCallback)(async()=>{N("scan");try{let b=await fetch(`${Y}/optimize`).then(f=>f.json());b.ok&&A(b)}catch{S(t("adminLoadFail"))}finally{N("")}},[t]);(0,n.useEffect)(()=>{H()},[g]);let $=async(b,f)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${Y}/merge?paths=${encodeURIComponent(b+","+f)}`).then(K=>K.json())).ok&&(await H(),i&&i())}catch{}},J=async b=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${Y}/delete?path=${encodeURIComponent(b)}`).then(E=>E.json())).ok&&(await H(),i&&i())}catch{}},be=["project","knowledge","content","prompt","business","tool","mistake"],W=({title:b,kind:f,updated:E,path:K})=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:it.colors[f]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:lt(E)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>J(K),children:[t("delete")," \u2715"]})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[v&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",v]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:H,children:["\u21BB ",t("retry")]})]}),o==="stats"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1FAB5} ",t("captureLog")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("captureLogHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>H(),children:["\u21BB ",t("refresh")]})]}),m?m.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(m.entries||[]).length===0?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogEmpty")}):(0,e.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,e.jsx)("tbody",{children:(m.entries||[]).map((b,f)=>{let E=xa[b.action]||["\u2022","inherit"];return(0,e.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:lt(b.time?new Date(b.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:E[1],fontWeight:600},children:[E[0]," ",b.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:b.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b.preview||"",children:b.preview||""})]},f)})})})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("loading")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:["\u{1F916} ",t("captureAgentCards"),"\uFF08",z.length,"\uFF09"]}),z.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:z.map(b=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[b.kind]||Ue.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.title}),b.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:lt(b.updated)})]},b.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),p&&(0,e.jsxs)(e.Fragment,{children:[p.trend&&p.trend.length>0&&(()=>{let b=p.trend,f=Math.max(...b.map(B=>B.count),1),E=260,K=50,_=E/b.length;return(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["\u{1F4C8} ",t("trendLabel")]}),(0,e.jsx)("svg",{width:E,height:K,style:{display:"block",width:"100%",height:50},children:b.map((B,ee)=>{let Q=Math.round(B.count/f*(K-4));return(0,e.jsx)("rect",{x:ee*_+1,y:K-Q,width:Math.max(_-2,2),height:Q,rx:1.5,fill:B.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:B.count>0?.85:.35},B.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.tags}),(0,e.jsx)("span",{children:t("tags")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("byKind")}),(0,e.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:be.map(b=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:it.colors[b]||"#666"}}),t(Ee[b]),": ",p.byKind?.[b]||0]},b))})]}),k&&(k.budgetChars||k.recallLimit||k.embedding)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,e.jsx)("b",{children:t("budgetLabel")}),"\uFF1A",t("budgetChars")," ",(0,e.jsx)("b",{children:k.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:k.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",k.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",p.todayCards?.length||0,"\uFF09"]}),p.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:p.todayCards.map(b=>(0,e.jsx)(W,{title:b.title,kind:b.kind,updated:b.updated,path:b.path},b.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})]})]}),o==="optimize"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("organizeTitle")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!L,onClick:ye,children:L==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),x&&x.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!L,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){N("oneclick");try{let b=JSON.stringify({cleanupStale:O}),E=await(await fetch(`${Y}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:b})).json();E&&E.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${E.plan.merged} ${t("optimizedMerged")}${O?` \xB7 ${E.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await H(),i&&i(),A(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{N("")}}},children:L==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),x&&x.merge?.length>0&&(0,e.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,e.jsx)("input",{type:"checkbox",checked:O,onChange:b=>G(b.target.checked)}),t("oneClickAlsoStale")]})]}),!x&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),x&&(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",flexDirection:"column",gap:8},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("mergePairs")}),(0,e.jsx)("div",{className:"spacer",style:{flex:1}}),x.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!L,onClick:te,children:t(L==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),x.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:x.merge.map((b,f)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[b.a.title," \u21C4 ",b.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(b.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>$(b.a.path,b.b.path),children:t("mergeNow")})]},f))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:12},children:t("noOptimize")}),(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("staleCards"),"\uFF08",x.stale?.length||0,"\uFF09"]}),x.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!L,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;N("clean");let b=0;for(let f of x.stale)try{await fetch(`${Y}/delete?path=${encodeURIComponent(f.path)}`),b++}catch{}N(""),notify(`${b} ${t("deletedStale")}`),await H(),i&&i()},children:t("cleanStale")})}),x.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:x.stale.map(b=>(0,e.jsx)(W,{title:b.title,kind:"other",updated:b.updated,path:b.path},b.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})})]})]})]})}var zt=[{key:"decision",label:"tplDecision",kind:"knowledge",tagKey:"tplDecisionTags",bodyKey:"tplDecisionBody"},{key:"bug",label:"tplBug",kind:"mistake",tagKey:"tplBugTags",bodyKey:"tplBugBody"},{key:"meeting",label:"tplMeeting",kind:"content",tagKey:"tplMeetingTags",bodyKey:"tplMeetingBody"},{key:"weekly",label:"tplWeekly",kind:"content",tagKey:"tplWeeklyTags",bodyKey:"tplWeeklyBody"}];function La({t,newCard:o,setNewCard:i,onCreated:g}){if(!o)return null;let p=zt.find(y=>y.key===o.template),l=o.body||(p?t(p.bodyKey):""),v=o.kind||(p?p.kind:"knowledge"),S=o.tags||(p?t(p.tagKey):""),x=o._creating,A=y=>{let m=zt.find(M=>M.key===y);i(M=>({...M,template:y,kind:m?m.kind:M.kind,body:m?t(m.bodyKey):M.body,tags:m?t(m.tagKey):M.tags}))},k=async()=>{if(!(!o.title&&!l)){i(y=>({...y,_creating:!0}));try{(await fetch(`${Y}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.title||t("untitled"),kind:v,tags:S.split(",").map(m=>m.trim()).filter(Boolean),body:l,source:"manual"})}).then(m=>m.json())).ok?(i(null),g&&g()):i(m=>({...m,_creating:!1}))}catch{i(m=>({...m,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>i(null),children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:y=>y.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:t("newCard")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>i(null),children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[zt.map(y=>(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===y.key?" me-on":""}`,onClick:()=>A(y.key),children:t(y.label)},y.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===""?" me-on":""}`,onClick:()=>i(y=>({...y,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:v,onChange:y=>i(m=>({...m,kind:y.target.value})),style:{maxWidth:180,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:["project","knowledge","content","prompt","business","tool","mistake"].map(y=>(0,e.jsx)("option",{value:y,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:y},y))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:o.title||"",onChange:y=>i(m=>({...m,title:y.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:S,onChange:y=>i(m=>({...m,tags:y.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:l,onChange:y=>i(m=>({...m,body:y.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,e.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:x,onClick:k,children:t(x?"exporting":"createCard")})})]})]})]})}async function Kt(t){let o=String(t||"");if(!o)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(o),!0}catch{}try{let i=document.createElement("textarea");i.value=o,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",i.style.top="0",document.body.appendChild(i),i.focus(),i.select();let g=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(i),g}catch{return!1}}function Ta({t,onClose:o}){let[i,g]=(0,n.useState)(""),[p,l]=(0,n.useState)(""),[v,S]=(0,n.useState)(""),[x,A]=(0,n.useState)(!0),[k,y]=(0,n.useState)(!1),[m,M]=(0,n.useState)(""),[z,w]=(0,n.useState)(""),L=(0,n.useRef)(null),N=(0,n.useRef)(null),O=()=>{let W=L.current;if(W)try{W.focus(),W.select()}catch{}},G=W=>{M(W),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>M(""),2400)};(0,n.useEffect)(()=>{let W=!0;return fetch(Y+"/diagnostics").then(b=>b.json()).then(b=>{W&&(b&&b.ok?(l(String(b.diagnostics||"")),S(String(b.version||""))):y(!0))}).catch(()=>{W&&y(!0)}).finally(()=>{W&&A(!1)}),()=>{W=!1}},[]),(0,n.useEffect)(()=>{let W=b=>{b.key==="Escape"&&o()};return window.addEventListener("keydown",W),()=>{window.removeEventListener("keydown",W),N.current&&clearTimeout(N.current)}},[o]);let te=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),H=()=>{let W=i.trim().split(`
|
|
303
|
+
`)[0]||"",b=Ot({title:"[Bug] "+(W.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Ht({description:i,diagnostics:p,version:v})});try{window.open(b,"_blank","noopener")}catch{G(t("fbCopyFail"))}},ye=async()=>{await Kt(p)?(w(""),G(t("fbCopiedDiag"))):(w(p),G(t("fbCopyManual")))},$=async()=>{let W=Wt({lang:te,description:i,diagnostics:p});await Kt(W)?(w(""),G(t("fbCopiedPrompt"))):(w(W),G(t("fbCopyManual")))},J={width:"100%",resize:"vertical",padding:"8px 10px",borderRadius:10,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:13},be={margin:0,maxHeight:170,overflow:"auto",fontSize:11.5,lineHeight:1.55,padding:"8px 10px",borderRadius:10,background:"var(--dsw-alias-bg-layer-1, rgba(127,127,127,0.08))",whiteSpace:"pre-wrap"};return(0,e.jsxs)("div",{className:"me-overlay",onClick:o,children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:W=>W.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:["\u{1F41E} ",t("fbTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:o,children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10},children:[(0,e.jsx)("div",{style:{fontSize:12,opacity:.72,lineHeight:1.6},children:t("fbWhy")}),(0,e.jsx)("textarea",{value:i,onChange:W=>g(W.target.value),placeholder:t("fbDesc"),rows:5,style:J}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("fbDiag")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:ye,disabled:!p,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:be,children:x?t("fbLoading"):k?t("fbDiagFail"):p})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!i.trim()){G(t("fbNeedDesc"));return}H()},style:{borderColor:"var(--dsw-alias-brand-primary, #3b82f6)",color:"var(--dsw-alias-brand-primary, #3b82f6)",fontWeight:600},children:["\u{1F680} ",t("fbOpenIssue")]}),(0,e.jsx)("span",{style:{opacity:.5,fontSize:12},children:t("fbOr")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:$,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),m&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:m}),z&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12,color:"#b45309"},children:["\u26A0 ",t("fbCopyFail")]}),(0,e.jsx)("span",{style:{fontSize:11.5,opacity:.75},children:t("fbCopyManual")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:O,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:L,readOnly:!0,value:z,rows:7,style:J})]})]})]})]})}function Aa({t,card:o,query:i,onClose:g,onDelete:p,onFeedback:l}){(0,n.useEffect)(()=>{let L=N=>{N.key==="Escape"&&g()};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[g]);let{meta:v,body:S}=(0,n.useMemo)(()=>Nt(o.text||""),[o.text]),x=L=>{let N=v.find(([O])=>String(O).toLowerCase()===L);return N?N[1]:""},A=Ft(x("tags")),k=x("kind")||"knowledge",y=(x("status")||"approved").toLowerCase(),m=Ue[k]||"#6B7280",M=(S||"").length>460,[z,w]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:g,children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{className:"me-dialog",onClick:L=>L.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:wt[k]||"\u{1F4CE}"}),o.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[i&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>l&&l(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>l&&l(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),M&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":z,onClick:()=>w(L=>!L),children:t(z?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&p&&p(o.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:g,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:m,borderColor:m+"59",background:m+"1a"},children:[wt[k]||"\u{1F4CE}"," ",t(Ee[k]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(y==="approved"?"md-chip-st-ok":y==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[y==="approved"?"\u2705":y==="pending"?"\u23F3":"\u26D4"," ",t(y==="approved"?"statusApproved":y==="pending"?"statusPending":"statusRejected")]}),A.slice(0,8).map(L=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",L]},L)),!!x("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",lt(x("updated"))]}),!!x("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",x("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:z?{}:{maxHeight:300,overflow:"hidden"},onClick:z?void 0:L=>{L.stopPropagation(),w(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:jt(S)}})}),!z&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:L=>{L.stopPropagation(),w(!0)},children:[t("expand")," \u2304"]})]})]})}function Ba({t,onOpen:o,all:i,onAllChange:g,onMutate:p,active:l,visible:v}){let[S,x]=(0,n.useState)(null),[A,k]=(0,n.useState)(""),y=(0,n.useRef)(!1),m=(0,n.useRef)(0),M=(0,n.useRef)(t);M.current=t;let z=(0,n.useCallback)(async()=>{try{y.current=!1;let O=await(await fetch(`${Y}/graph${i?"?all=1":""}`)).json();O.ok?(x(O),k(""),y.current=!0):(x(null),k(O.error||t("error")))}catch(N){k(String(N&&N.message?N.message:N))}},[i,t]);(0,n.useEffect)(()=>{if(!l||y.current)return;let N=!0;return fetch(`${Y}/graph${i?"?all=1":""}`).then(O=>O.json()).then(O=>{N&&(O.ok?(x(O),k(""),y.current=!0):(x(null),k(O.error||t("error"))))}).catch(O=>{N&&k(String(O&&O.message?O.message:O))}),()=>{N=!1}},[i,t,l]),(0,n.useEffect)(()=>{v&&S&&m.current++},[v,S]);let w=(0,n.useCallback)(async N=>{try{let G=await(await fetch(`${Y}/delete?path=${encodeURIComponent(N)}`)).json();return G&&G.ok?(await z(),p&&p(),!0):!1}catch{return!1}},[z]),L=(0,n.useCallback)(async N=>{if(!N||N.length<2)return!1;try{let O=await fetch(`${Y}/merge?paths=${encodeURIComponent(N.join(","))}`).then(G=>G.json());return O&&O.ok?(await z(),p&&p(),!0):!1}catch{return!1}},[z,p]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Ie}),A&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",A]}),!S&&!A&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),S&&S.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),S&&S.nodes.length>0&&(0,e.jsx)(Pa,{nodes:S.nodes,edges:S.edges,onOpen:o,onDelete:w,onMerge:L,t,all:i,onAllChange:g,countLabel:`${S.nodes.length} ${t("nodes")} \xB7 ${Ra(S.edges)} ${t("edges")}`,fitTrigger:m.current})]})}function Ra(t){let o=new Set;for(let i of t||[])o.add([i.source,i.target].sort().join("|"));return o.size}var it={colors:{project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},shapes:{project:"circle",knowledge:"circle",content:"rect",prompt:"diamond",business:"hexagon",tool:"circle",mistake:"diamond",other:"circle"}};function Pa({nodes:t,edges:o,onOpen:i,onDelete:g,onMerge:p,t:l,countLabel:v,all:S,onAllChange:x,fitTrigger:A}){let k=(0,n.useRef)(null),y=(0,n.useRef)(null),m=(0,n.useRef)(null),M=(0,n.useRef)(null),z=(0,n.useRef)(null),w=(0,n.useRef)(i);(0,n.useEffect)(()=>{w.current=i},[i]);let L=(0,n.useRef)(g);(0,n.useEffect)(()=>{L.current=g},[g]);let N=(0,n.useRef)(p);(0,n.useEffect)(()=>{N.current=p},[p]);let[O,G]=(0,n.useState)(""),[te,H]=(0,n.useState)(null),ye=(0,n.useRef)("");(0,n.useEffect)(()=>{ye.current=O.trim().toLowerCase()},[O]),(0,n.useEffect)(()=>{let s=m.current;if(!s)return;let r=O.trim().toLowerCase();if(!r)return;let D=s.nodes.find(U=>(U.name||"").toLowerCase().includes(r));D&&(m.current.selectedId=D.id,H(D.id),s.panX=s.w/2-D.x*s.zoom,s.panY=s.h/2-D.y*s.zoom,s.render&&s.render())},[O]);let[$,J]=(0,n.useState)("all"),[be,W]=(0,n.useState)(!1),b=(0,n.useRef)("all"),[f,E]=(0,n.useState)(""),K=(0,n.useRef)(""),[_,B]=(0,n.useState)(!1),ee=(0,n.useRef)(!1),[Q,le]=(0,n.useState)(null);(0,n.useEffect)(()=>{b.current=$},[$]),(0,n.useEffect)(()=>{K.current=f},[f]),(0,n.useEffect)(()=>{ee.current=_},[_]);let Ve=(0,n.useMemo)(()=>{let s=new Map;for(let r of t)for(let D of r.tags||[]){let U=String(D).trim();U&&s.set(U,(s.get(U)||0)+1)}return[...s.entries()].sort((r,D)=>D[1]-r[1]).slice(0,24).map(([r,D])=>({tag:r,n:D}))},[t]),qe=(()=>{let s=O.trim().toLowerCase();return!!s&&!t.some(r=>(r.title||r.name||"").toLowerCase().includes(s)||String(r.kind||"").toLowerCase().includes(s)||String(Ee[r.kind]||"").toLowerCase().includes(s))})();(0,n.useEffect)(()=>{let s=m.current;s&&s.wake&&s.wake()},[O]),(0,n.useEffect)(()=>{let s=m.current;s&&s.render&&s.render()},[$,f,_]);let De=(0,n.useRef)(null),[Be,he]=(0,n.useState)([]),[xe,me]=(0,n.useState)(null),[Ce,Fe]=(0,n.useState)(!1),[Se,Re]=(0,n.useState)(null),[Xe,We]=(0,n.useState)(""),re=(0,n.useRef)(null),ce=(0,n.useRef)(null),d=(s,r=!0)=>{re.current&&clearTimeout(re.current),Re({msg:s,ok:r}),re.current=setTimeout(()=>Re(null),1900)},R=s=>{We(s),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>We(""),1600)};(0,n.useEffect)(()=>()=>{re.current&&clearTimeout(re.current),ce.current&&clearTimeout(ce.current)},[]);let P=(0,n.useMemo)(()=>t.reduce((s,r)=>(s[r.id]=r,s),{}),[t]);return(0,n.useEffect)(()=>{let s=k.current;if(!s||t.length===0)return;let r=s.getContext("2d");if(!r)return;let D=Math.max(1,window.devicePixelRatio||1),U=()=>document.documentElement.getAttribute("data-theme")==="dark",se={};o.forEach(c=>{se[c.source]=(se[c.source]||0)+1,se[c.target]=(se[c.target]||0)+1});let we=Math.max(1,...Object.values(se)),a={nodes:t.map(c=>({id:c.id,name:c.title||"",type:c.kind||"other",r:9+Math.min(10,(se[c.id]||0)/we*8),x:0,y:0,vx:0,vy:0})),edges:o.map(c=>({sourceNodeId:c.source,targetNodeId:c.target,weight:1})),panX:0,panY:0,zoom:1,running:!0,raf:0,tickCount:0,quietTicks:0,dragNode:null,selectedId:null,mouseX:0,mouseY:0,w:0,h:0,dpr:D,ctx:r,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((c,I)=>(c[I.id]=I,c),{}),a.nodes.forEach((c,I)=>{let C=I/a.nodes.length*Math.PI*2-Math.PI/2;c.x=Math.cos(C)*60,c.y=Math.sin(C)*60});let Ze=[...new Set(a.nodes.map(c=>c.type))];a.clustered=Ze.length>1,a.typeCenters={},Ze.forEach((c,I)=>{let C=I/Ze.length*Math.PI*2-Math.PI/2;a.typeCenters[c]={x:Math.cos(C)*160,y:Math.sin(C)*160}}),m.current=a;let st=0,mt=0,gt=()=>{let c=s.clientWidth,I=s.clientHeight;a.w=c,a.h=I,s.width=c*D,s.height=I*D,r.setTransform(D,0,0,D,0,0),(st===0||mt===0)&&c>0&&I>0&&a.tickCount>0&&requestAnimationFrame(()=>pe()),st=c,mt=I};gt();let ft=new ResizeObserver(gt);ft.observe(s.parentElement);let h=(c,I)=>c&&c.length>I?c.slice(0,I)+"\u2026":c,F=(c,I,C,T)=>{if(r.beginPath(),T==="rect")r.rect(c-C,I-C*.75,C*2,C*1.5);else if(T==="diamond")r.moveTo(c,I-C),r.lineTo(c+C,I),r.lineTo(c,I+C),r.lineTo(c-C,I),r.closePath();else if(T==="hexagon"){for(let j=0;j<6;j++){let ae=Math.PI/3*j-Math.PI/2,V=c+C*Math.cos(ae),fe=I+C*Math.sin(ae);j===0?r.moveTo(V,fe):r.lineTo(V,fe)}r.closePath()}else r.arc(c,I,C,0,Math.PI*2)},Z=new Map,Ne=(c,I)=>{let C=c+"|"+Math.round(I),T=Z.get(C);if(!T){let j=parseInt(c.slice(1,3),16),ae=parseInt(c.slice(3,5),16),V=parseInt(c.slice(5,7),16);T=r.createRadialGradient(-I*.3,-I*.3,0,0,0,I*1.2),T.addColorStop(0,"rgba("+Math.min(255,j+70)+","+Math.min(255,ae+70)+","+Math.min(255,V+70)+",0.95)"),T.addColorStop(1,c),Z.set(C,T)}return T},pe=()=>{if(!a.nodes.length)return;let c=1/0,I=-1/0,C=1/0,T=-1/0;a.nodes.forEach(Le=>{c=Math.min(c,Le.x),I=Math.max(I,Le.x),C=Math.min(C,Le.y),T=Math.max(T,Le.y)});let j=20,ae=I-c+j*2,V=T-C+j*2,fe=Math.min(a.w/ae,a.h/V);a.zoom=Math.max(.35,Math.min(1.8,fe)),a.panX=a.w/2-(c+I)/2*a.zoom,a.panY=a.h/2-(C+T)/2*a.zoom};M.current=pe;let ue=()=>{r.clearRect(0,0,a.w,a.h),a.searchTerm=ye.current,a.kindFilter=b.current,a.timeMode=ee.current,a.tagFilter=K.current;let c=a.tagFilter,I=a.kindFilter,C=u=>String(u||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");r.save(),r.strokeStyle=U()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",r.lineWidth=.5;for(let u=0;u<a.w;u+=24)r.beginPath(),r.moveTo(u,0),r.lineTo(u,a.h),r.stroke();for(let u=0;u<a.h;u+=24)r.beginPath(),r.moveTo(0,u),r.lineTo(a.w,u),r.stroke();r.restore(),r.save(),r.translate(a.panX,a.panY),r.scale(a.zoom,a.zoom);let T={};a.nodes.forEach(u=>T[u.id]=u);let j=a.nodes.length>40,ae=j?1.5:.55,V=a.selectedId||a.hoverId,fe=$t({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),Le=(()=>{let u=(a.searchTerm||"").toLowerCase();if(!u)return null;let q=[];for(let X of a.nodes){let de=(a.domainById[X.id]||{}).kind||"other";if(((X.name||"").toLowerCase().includes(u)||String(Ee[de]||"").toLowerCase().includes(u)||String(de).toLowerCase().includes(u))&&q.push(X.id),q.length>200)break}return q})(),Ge=Ut(a.nodes,{limit:_t(a.nodes.length),focusId:V,hoverId:a.hoverId,searchHits:Le,degree:se}),ne=new Map,ie=(u,q)=>{let X=u+"|"+q,oe=ne.get(X);return oe===void 0&&(r.font=u,oe=r.measureText(q).width,ne.set(X,oe)),oe},Me=a.nodes.length<=250,Te=new Map;a.edges.forEach(u=>{let q=T[u.sourceNodeId],X=T[u.targetNodeId];if(!q||!X||!vt(q.x,q.y,10,fe)&&!vt(X.x,X.y,10,fe))return;if(I!=="all"){let tt=a.domainById[u.sourceNodeId]&&a.domainById[u.sourceNodeId].kind,He=a.domainById[u.targetNodeId]&&a.domainById[u.targetNodeId].kind;if(tt!==I&&He!==I)return}if(c){let tt=a.domainById[u.sourceNodeId]&&(a.domainById[u.sourceNodeId].tags||[]).includes(c),He=a.domainById[u.targetNodeId]&&(a.domainById[u.targetNodeId].tags||[]).includes(c);if(!tt&&!He)return}let oe=X.x-q.x,de=X.y-q.y,ke=Math.sqrt(oe*oe+de*de)||1,_e=j?12:18,Ye=-de/ke*_e,bt=oe/ke*_e,yt=(q.x+X.x)/2+Ye,ht=(q.y+X.y)/2+bt,dt=it.colors[a.domainById[q.id]&&a.domainById[q.id].kind||"other"],ct=V&&(u.sourceNodeId===V||u.targetNodeId===V),kt=V?ct?.6:.08:j?.14:.24,Oe=parseInt(dt.slice(1,3),16),pt=parseInt(dt.slice(3,5),16),Ct=parseInt(dt.slice(5,7),16),Pe=ct?1.6+(u.weight||1):.8+(u.weight||1)*.5,Je=Oe+","+pt+","+Ct+","+kt+","+Pe,Ae=Te.get(Je);Ae||(Ae={path:new Path2D,stroke:"rgba("+Oe+","+pt+","+Ct+","+kt+")",width:Pe},Te.set(Je,Ae)),Ae.path.moveTo(q.x,q.y),Ae.path.quadraticCurveTo(yt,ht,X.x,X.y)}),Te.forEach(u=>{r.strokeStyle=u.stroke,r.lineWidth=u.width,r.stroke(u.path)});let ze=null;V&&(ze=new Set,a.edges.forEach(u=>{u.sourceNodeId===V?ze.add(u.targetNodeId):u.targetNodeId===V&&ze.add(u.sourceNodeId)}));let je=[];if(a.nodes.forEach(u=>{if(!vt(u.x,u.y,u.r+2,fe))return;let q=a.domainById[u.id]||{},X=q.kind||"other",oe=a.timeMode?Ea(q.updated):it.colors[X],de=it.shapes[X],ke=a.selectedId===u.id,_e=a.hoverId===u.id,Ye=a.searchTerm||"",bt=!Ye||(u.name||"").toLowerCase().includes(Ye)||String(Ee[X]||"").toLowerCase().includes(Ye)||String(X).toLowerCase().includes(Ye),yt=I==="all"||X===I,ht=!c||(q.tags||[]).includes(c),dt=V&&u.id!==V&&!(ze&&ze.has(u.id))||Ye&&!bt||!yt||!ht;r.save(),r.globalAlpha=dt?.08:1,(ke||_e)&&Me&&(r.shadowColor=oe,r.shadowBlur=ke?20:14),r.translate(u.x,u.y),F(0,0,u.r,de),r.fillStyle=Ne(oe,u.r),r.fill(),r.restore(),ke?(r.save(),F(u.x,u.y,u.r+3,de),r.strokeStyle=oe,r.lineWidth=3,r.shadowColor=oe,r.shadowBlur=12,r.stroke(),r.restore()):_e?(r.save(),F(u.x,u.y,u.r+2,de),r.strokeStyle=oe,r.lineWidth=2,r.stroke(),r.restore()):Ye&&bt?(r.save(),F(u.x,u.y,u.r+2,de),r.strokeStyle="#e11d48",r.lineWidth=2,r.stroke(),r.restore()):a.multi.indexOf(u.id)>=0&&(r.save(),F(u.x,u.y,u.r+2,de),r.strokeStyle="#60a5fa",r.lineWidth=2,r.shadowColor="#60a5fa",r.shadowBlur=8,r.stroke(),r.restore());let ct=h(u.name,16);if((ke||_e||Ge.has(u.id)&&a.zoom>ae||!j&&a.zoom>.6)&&yt&&ht){let Oe=1/a.zoom,pt="500 "+(12*Oe).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";r.font=pt;let Pe=ie(pt,ct)+16*Oe,Je=18*Oe,Ae=u.y+u.r+8*Oe,tt=!0;for(let He of je)if(u.x-Pe/2<He.x+He.w&&u.x+Pe/2>He.x&&Ae<He.y+He.h&&Ae+Je>He.y){tt=!1;break}if(!tt&&!ke&&!_e)return;je.push({x:u.x-Pe/2,y:Ae,w:Pe,h:Je}),r.fillStyle=U()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",r.beginPath(),r.roundRect?r.roundRect(u.x-Pe/2,Ae,Pe,Je,4*Oe):r.rect(u.x-Pe/2,Ae,Pe,Je),r.fill(),r.strokeStyle=U()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",r.lineWidth=1*Oe,r.stroke(),r.fillStyle=U()?ke||_e?"#eee":"#bbb":ke||_e?"#111":"#444",r.textAlign="center",r.fillText(ct,u.x,Ae+13*Oe)}}),r.restore(),a.marquee){let u=a.marquee,q=Math.min(u.sx,u.ex),X=Math.min(u.sy,u.ey),oe=Math.abs(u.ex-u.sx),de=Math.abs(u.ey-u.sy);r.save(),r.setLineDash([4,4]),r.strokeStyle="rgba(96,165,250,0.9)",r.lineWidth=1,r.fillStyle="rgba(96,165,250,0.12)",r.fillRect(q,X,oe,de),r.strokeRect(q,X,oe,de),r.restore()}if(a.hoverId&&De.current){let u=a.domainById[a.hoverId],q=a.nodes.find(function(X){return X.id===a.hoverId});if(u&&q){let X=a.edges.filter(function(ke){return ke.sourceNodeId===u.id||ke.targetNodeId===u.id}).length,oe=q.x*a.zoom+a.panX,de=q.y*a.zoom+a.panY;De.current.style.display="block",De.current.style.left=oe+14+"px",De.current.style.top=de-6+"px",De.current.innerHTML="<b>"+C(u.title||u.name||"")+'</b><br/><span style="opacity:.8">'+C(u.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",X)+"</span>"}}else De.current&&(De.current.style.display="none")},ge=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame($e))};a.wake=ge,a.render=ue;let Ke=()=>{let c=a.nodes.length;a.tickCount++;let C=.9-Math.min(.4,a.tickCount/1500),T=c>1e3?3e3:c>100?2e3:c>50?1200:800,j=c>100?.002:.005,ae=c>1e3?.012:c>100?.005:.01,V=c>1e3?6:c>200?12:24,fe={};a.nodes.forEach(ne=>fe[ne.id]=ne);for(let ne=0;ne<c;ne++){if(a.dragNode===a.nodes[ne])continue;let ie=a.nodes[ne],Me=0,Te=0;for(let u=0;u<c;u++){if(ne===u)continue;let q=ie.x-a.nodes[u].x,X=ie.y-a.nodes[u].y,oe=Math.sqrt(q*q+X*X)||1,de=T/(oe*oe);Me+=q/oe*de,Te+=X/oe*de}if(a.clustered&&a.typeCenters[ie.type]){let u=a.typeCenters[ie.type];Me+=(u.x-ie.x)*.006,Te+=(u.y-ie.y)*.006}else Me-=ie.x*ae,Te-=ie.y*ae;let ze=(ie.vx+Me)*C,je=(ie.vy+Te)*C;ze=Math.max(-V,Math.min(V,ze)),je=Math.max(-V,Math.min(V,je)),ie.vx=ze,ie.vy=je}a.edges.forEach(ne=>{let ie=fe[ne.sourceNodeId],Me=fe[ne.targetNodeId];if(!ie||!Me)return;let Te=Me.x-ie.x,ze=Me.y-ie.y,je=Math.sqrt(Te*Te+ze*ze)||1,u=(je-100)*j,q=Te/je*u,X=ze/je*u;a.dragNode!==ie&&(ie.vx+=q,ie.vy+=X),a.dragNode!==Me&&(Me.vx-=q,Me.vy-=X)});let Le=0;a.nodes.forEach(ne=>{a.dragNode!==ne&&(ne.x+=ne.vx,ne.y+=ne.vy,Le+=ne.vx*ne.vx+ne.vy*ne.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,pe()),(c?Math.sqrt(Le/c):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},$e=()=>{if(a.running){try{Ke(),ue()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame($e)}},ve=(c,I)=>{let C=s.getBoundingClientRect();return{x:(c-C.left-a.panX)/a.zoom,y:(I-C.top-a.panY)/a.zoom}},Qe=c=>{let I=a.domainById[c];return!(!I||b.current!=="all"&&I.kind!==b.current||K.current&&!(I.tags||[]).includes(K.current))},et=(c,I,C)=>Math.max(I,Math.min(C,c)),Dt=c=>{a.mouseX=c.clientX,a.mouseY=c.clientY;let I=ve(c.clientX,c.clientY),C=null;for(let T=a.nodes.length-1;T>=0;T--){let j=a.nodes[T];if(!Qe(j.id))continue;let ae=j.x-I.x,V=j.y-I.y;if(ae*ae+V*V<j.r*j.r+36){C=j.id;break}}C!==a.hoverId&&(a.hoverId=C,ge())},Lt=c=>{if(c.button!==0)return;let I=ve(c.clientX,c.clientY),C=null;for(let T=a.nodes.length-1;T>=0;T--){let j=a.nodes[T];if(!Qe(j.id))continue;let ae=j.x-I.x,V=j.y-I.y;if(ae*ae+V*V<j.r*j.r+25){C=j;break}}if(c.shiftKey){if(C){a.shiftClick=C.id;return}a.marquee={sx:c.clientX,sy:c.clientY,ex:c.clientX,ey:c.clientY};return}a.dragStart={x:c.clientX,y:c.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=C||null,C&&(a.dragOffset={dx:C.x-I.x,dy:C.y-I.y})},Tt=c=>{if(a.marquee){a.marquee.ex=c.clientX,a.marquee.ey=c.clientY,ge();return}if(!a.dragStart)return;let I=c.clientX-a.dragStart.x,C=c.clientY-a.dragStart.y;if(Math.abs(I)+Math.abs(C)>3&&(a.dragging=!0),a.dragNode){let T=ve(c.clientX,c.clientY);a.dragNode.x=T.x+a.dragOffset.dx,a.dragNode.y=T.y+a.dragOffset.dy,ge()}else a.dragging&&(a.panX=et(a.dragStart.px+I,-1e5,1e5),a.panY=et(a.dragStart.py+C,-1e5,1e5),ge())},At=c=>{if(a.marquee){let C=a.marquee;a.marquee=null;let T=s.getBoundingClientRect(),j=Math.min(C.sx,C.ex)-T.left,ae=Math.max(C.sx,C.ex)-T.left,V=Math.min(C.sy,C.ey)-T.top,fe=Math.max(C.sy,C.ey)-T.top,Le=a.nodes.filter(Ge=>{let ne=Ge.x*a.zoom+a.panX,ie=Ge.y*a.zoom+a.panY;return ne>=j&&ne<=ae&&ie>=V&&ie<=fe}).map(Ge=>Ge.id);a.multi=Le,he(Le),ge();return}let I=a.dragStart&&!a.dragging;if(a.shiftClick){let C=a.shiftClick;a.shiftClick=null;let T=Array.isArray(a.multi)?a.multi.slice():[];T.includes(C)||T.push(C),a.multi=T,he(T),ge();return}if(I){let C=ve(c.clientX,c.clientY),T=null;for(let j=a.nodes.length-1;j>=0;j--){let ae=a.nodes[j];if(!Qe(ae.id))continue;let V=ae.x-C.x,fe=ae.y-C.y;if(V*V+fe*fe<ae.r*ae.r+20){T=ae;break}}T?(a.selectedId=T.id,H(T.id),ge()):(a.selectedId=null,a.hoverId=null,c.shiftKey||(a.multi=[],he([])),H(null),ge())}a.dragStart=null,a.dragging=!1,a.dragNode=null},Bt=c=>{c.preventDefault();let I=ve(c.clientX,c.clientY),C=null;for(let T=a.nodes.length-1;T>=0;T--){let j=a.nodes[T];if(!Qe(j.id))continue;let ae=j.x-I.x,V=j.y-I.y;if(ae*ae+V*V<j.r*j.r+25){C=j;break}}if(C){let T=a.domainById[C.id];T&&le({x:c.clientX,y:c.clientY,id:C.id,path:T.id,title:T.title})}else le(null)},Rt=c=>{c.preventDefault();let I=s.getBoundingClientRect(),C=(c.clientX-I.left-a.panX)/a.zoom,T=(c.clientY-I.top-a.panY)/a.zoom,j=Math.max(.3,Math.min(3,a.zoom*(c.deltaY<0?1.1:1/1.1)));a.panX=et(a.panX+C*(a.zoom-j),-1e5,1e5),a.panY=et(a.panY+T*(a.zoom-j),-1e5,1e5),a.zoom=j,ge()};s.addEventListener("mousemove",Dt),s.addEventListener("mousedown",Lt),window.addEventListener("mousemove",Tt),window.addEventListener("mouseup",At),s.addEventListener("wheel",Rt,{passive:!1}),s.addEventListener("contextmenu",Bt),z.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],he([]),pe(),ge()};for(let c=0;c<200;c++)Ke();pe(),ge();let Pt=()=>W(!1);return window.addEventListener("mousedown",Pt),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),ft.disconnect(),s.removeEventListener("mousemove",Dt),s.removeEventListener("mousedown",Lt),window.removeEventListener("mousemove",Tt),window.removeEventListener("mouseup",At),s.removeEventListener("wheel",Rt),s.removeEventListener("contextmenu",Bt),window.removeEventListener("mousedown",Pt)}},[t,o]),(0,n.useEffect)(()=>{A!==void 0&&M.current&&requestAnimationFrame(()=>M.current())},[A]),(0,e.jsxs)("div",{className:"me-graph",ref:y,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",l("nodes")," \xB7 ",o.length," ",l("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:l("search"),value:O,onChange:s=>G(s.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>W(s=>!s),"aria-expanded":be,title:l("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",l("filterLabel")," ",$!=="all"||_||f?"\u25CF":"\u25BE"]}),be&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:s=>s.stopPropagation(),style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:50,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,padding:8,minWidth:240,boxShadow:"0 12px 34px rgba(0,0,0,.35)"},children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,e.jsx)("button",{type:"button",className:`lg${$==="all"&&!_?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{J("all"),B(!1)},children:l("all")}),Object.keys(Ue).map(s=>(0,e.jsxs)("button",{type:"button",className:`lg${$===s?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>J(r=>r===s?"all":s),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:it.colors[s]||Ue[s]}}),l(Ee[s])]},s)),(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsxs)("button",{type:"button",className:`lg${_?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>B(s=>!s),children:["\u23F1 ",l("timeDim")]}),Ve.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsx)("div",{style:{maxHeight:130,overflow:"auto",display:"flex",flexWrap:"wrap",gap:4},children:Ve.map(s=>(0,e.jsxs)("button",{type:"button",className:`lg${f===s.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>E(r=>r===s.tag?"":s.tag),title:s.tag,children:["#",s.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:s.n})]},s.tag))})]}),($!=="all"||_||f)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{J("all"),B(!1),E("")},children:[l("clearFilter")," \u2715"]})]})})]}),(0,e.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:l("crossVault"),children:[(0,e.jsx)("input",{type:"checkbox",checked:!!S,onChange:s=>x&&x(s.target.checked)}),l("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${_?" me-on":""}`,onClick:()=>B(s=>!s),children:l("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=k.current;if(s)try{s.toBlob(r=>{r&&me({url:URL.createObjectURL(r),blob:r})},"image/png")}catch{}},children:l("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>M.current&&M.current(),children:l("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{H(null),J("all"),z.current&&z.current()},children:l("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:k,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:De,style:{display:"none",position:"absolute",zIndex:4,pointerEvents:"none",background:"rgba(28,28,32,0.88)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:8,padding:"7px 10px",fontSize:12,maxWidth:220,boxShadow:"0 8px 24px rgba(0,0,0,.2)"}}),qe&&(0,e.jsx)("div",{className:"mc-empty",style:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)"},children:l("noMatch")}),Q&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>le(null)}),Q&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:Q.x,top:Q.y,zIndex:31},onMouseDown:s=>s.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{w.current({path:Q.path,title:Q.title}),le(null)},children:l("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{Q.id&&(m.current.selectedId=Q.id,H(Q.id)),le(null);let s=m.current;s&&s.wake&&s.wake()},children:l("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(Q.title||"")}catch{}le(null),d(l("copied"))},children:l("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let s=m.current,r=s&&Array.isArray(s.multi)?s.multi.slice():[],D=Q.id;if(D&&!r.includes(D)&&r.push(D),le(null),r.length<2){d(l("mergeNeed"),!1);return}if(!window.confirm(l("mergeConfirm")))return;let U=N.current&&N.current(r);U&&U.then?U.then(se=>se?d(l("merged")):d(l("mergeFail"),!1)).catch(()=>d(l("mergeFail"),!1)):U&&d(l("merged"))},children:l("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let s=Q.path;le(null),window.confirm(l("deleteConfirm"))&&(async()=>{try{(L.current?await L.current(s):!1)?d(l("deleted")):d(l("deleteFail"),!1)}catch{d(l("deleteFail"),!1)}})()},children:l("delete")})]}),Be.length>0&&(0,e.jsxs)("div",{style:{position:"absolute",left:10,top:10,zIndex:3,display:"flex",gap:8,alignItems:"center",background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:"6px 10px",fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsxs)("span",{style:{fontWeight:700},children:[Be.length," ",l("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let r=Be.map(we=>P[we]).filter(Boolean).map(we=>we.title||we.name).join(`
|
|
304
|
+
`),D=new Blob([r],{type:"text/plain;charset=utf-8"}),U=URL.createObjectURL(D),se=document.createElement("a");se.href=U,se.download="memory-selected.txt",document.body.appendChild(se),se.click(),document.body.removeChild(se),setTimeout(()=>URL.revokeObjectURL(U),1e3),d(Be.length+l("exportedSel"))},children:l("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(Be.length<2){d(l("mergeNeed"),!1);return}let s=Be.map(D=>P[D]?P[D].id:D);if(!window.confirm(l("mergeConfirm")))return;he([]);let r=m.current;r&&(r.multi=[]),fetch(`${Y}/merge?paths=${encodeURIComponent(s.join(","))}`).then(D=>D.json()).then(D=>{D&&D.ok?d(l("merged")):d(l("mergeFail"),!1)}).catch(()=>d(l("mergeFail"),!1))},children:l("merge")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(l("deleteConfirm")))return;let s=Be.map(D=>P[D]?P[D].id:D);he([]);let r=m.current;r&&(r.multi=[]),(async()=>{let D=0;for(let U of s)try{(L.current?await L.current(U):!1)&&D++}catch{}d(D+l("deletedSelected"),D>0)})()},children:l("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=m.current;s&&(s.multi=[]),he([]);let r=m.current;r&&r.render&&r.render()},children:l("clearSelection")})]}),te&&(0,e.jsxs)("div",{className:"me-graph-sidebar",style:{position:"absolute",right:10,top:10,zIndex:3,maxWidth:240,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:12,fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsx)("div",{style:{fontWeight:700,fontSize:13,marginBottom:4},children:P[te]?P[te].title||P[te].name:te}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:P[te]?l(Ee[P[te].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:l("graphHint")}),(o.filter(s=>s.source===te||s.target===te)||[]).slice(0,8).map((s,r)=>{let D=s.source===te?s.target:s.source,U=P[D];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:se=>{se.preventDefault();let we=m.current;we&&(we.selectedId=D,we.hoverId=D,we.wake&&we.wake()),H(D)},children:U?(U.title||U.name).slice(0,28):D},r)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:l("graphTip")}),Se&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(Se.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:Se.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:Se.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:Se.msg})]}),xe&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{xe.url&&URL.revokeObjectURL(xe.url),me(null),Fe(!1)},children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:Ce?"100vw":900,width:Ce?"100vw":"92vw",maxHeight:Ce?"100%":"90vh",height:Ce?"100%":void 0,borderRadius:Ce?0:14},onClick:s=>s.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:l("exportGraph")}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("a",{className:"mc-btn",href:xe.url,download:"memory-graph.png",onClick:()=>{R("download"),d(l("downloaded")+" \xB7 "+l("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:l(Xe==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{R("full"),Fe(s=>!s),d(l("fullscreen"))},children:l(Xe==="full"?"done":Ce?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=xe.blob;s&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":s})]).then(()=>{R("copy"),d(l("copied"))}).catch(()=>{d(l("copyFail"),!1)}):d(l("copyFail"),!1)},children:l(Xe==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{xe.url&&URL.revokeObjectURL(xe.url),me(null),Fe(!1)},children:l("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Ce?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,e.jsx)("img",{src:xe.url,alt:l("exportGraph"),style:{maxWidth:"100%",maxHeight:Ce?"calc(100% - 64px)":"70vh",borderRadius:Ce?0:8,cursor:"zoom-in"},onClick:()=>Fe(s=>!s)})})]})]})]})}function Ea(t){let o=new Date(t||0).getTime();if(!o)return"#94a3b8";let i=(Date.now()-o)/864e5;return i<3?"#10b981":i<14?"#f59e0b":i<30?"#f97316":"#94a3b8"}function Yt({label:t,value:o=[],options:i,onChange:g,placeholder:p,z:l=20}){let[v,S]=(0,n.useState)(!1),x=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!v)return;let w=L=>{x.current&&!x.current.contains(L.target)&&S(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[v]);let A=Array.isArray(o)?o:[],k=A.includes("__all__"),y=k?i.find(w=>w.value==="__all__")?.label||"":A.length?A.map(w=>i.find(L=>L.value===w)?.label||w).join("\u3001"):"",m=(w,L)=>{if(w.value==="__all__"){g(L?["__all__"]:[]);return}let N=new Set(A);N.has("__all__")&&N.delete("__all__"),L?N.add(w.value):N.delete(w.value),g([...N])},M=i.find(w=>w.value==="__all__"),z=i.filter(w=>w.value!=="__all__");return(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t}),(0,e.jsxs)("div",{ref:x,style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>S(w=>!w),style:{width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[(0,e.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y||p||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),v&&(0,e.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:l,marginTop:2,borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",boxShadow:"0 6px 20px rgba(0,0,0,0.14)",maxHeight:180,overflow:"auto"},children:[M&&(0,e.jsxs)("label",{onClick:w=>w.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("input",{type:"checkbox",checked:k,onChange:w=>m(M,w.target.checked)}),(0,e.jsx)("span",{children:M.label})]}),z.map(w=>(0,e.jsxs)("label",{onClick:L=>L.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:A.includes(w.value),onChange:L=>m(w,L.target.checked)}),(0,e.jsx)("span",{children:w.label})]},w.value))]})]})]})}function Fa(t){let o=new Date(t||0).getTime();return!!o&&(Date.now()-o)/864e5<3}async function ja(t,o,i){if(i&&typeof window.showSaveFilePicker=="function")try{let l=await window.showSaveFilePicker({suggestedName:o}),v=await l.createWritable();return await v.write(t),await v.close(),{ok:!0,picked:!0,name:l.name}}catch(l){return l&&l.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(l.message||l)}}let g=URL.createObjectURL(t),p=document.createElement("a");return p.href=g,p.download=o,document.body.appendChild(p),p.click(),document.body.removeChild(p),setTimeout(()=>URL.revokeObjectURL(g),1e3),{ok:!0,picked:!1,name:o}}function Vt(t,o){if(!o||!t)return t;let i=t.toLowerCase(),g=o.toLowerCase(),p=[],l=0;for(;l<t.length;){let v=i.indexOf(g,l);if(v<0){p.push(t.slice(l));break}v>l&&p.push(t.slice(l,v)),p.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(v,v+g.length)},v)),l=v+g.length}return p}function lt(t){if(!t)return"";let o=new Date(t);if(Number.isNaN(o.getTime()))return"";let i=new Date,g=o.toDateString()===i.toDateString(),p=v=>String(v).padStart(2,"0"),l=`${p(o.getHours())}:${p(o.getMinutes())}`;return g?l:`${o.getMonth()+1}-${o.getDate()} ${l}`}
|
|
299
305
|
|
|
300
306
|
return module.exports;
|
|
301
307
|
},
|