memory-eternal 0.9.13 → 0.9.14
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 +1 -0
- package/README.md +1 -0
- package/lib/client.js +17 -17
- package/lib/minhash.js +99 -0
- package/lib/vault.js +122 -27
- package/package.json +2 -2
- package/web/app.js +19 -19
package/lib/client.js
CHANGED
|
@@ -3,17 +3,17 @@ window.__ModuleLoader__.load({
|
|
|
3
3
|
factory: (require) => {
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
|
-
var
|
|
7
|
-
`),i=/^---\n([\s\S]*?)\n---\n?/.exec(
|
|
8
|
-
`)){let l=p.indexOf(":");if(l<=0)continue;let
|
|
9
|
-
`)).body;if(!
|
|
10
|
-
`)){let
|
|
11
|
-
`)}function
|
|
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=
|
|
14
|
-
`)}var
|
|
15
|
-
`),
|
|
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]
|
|
6
|
+
var Da=Object.create;var Ft=Object.defineProperty;var Ta=Object.getOwnPropertyDescriptor;var La=Object.getOwnPropertyNames;var Aa=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty;var Ra=(t,n)=>{for(var i in n)Ft(t,i,{get:n[i],enumerable:!0})},la=(t,n,i,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let p of La(n))!Ba.call(t,p)&&p!==i&&Ft(t,p,{get:()=>n[p],enumerable:!(u=Ta(n,p))||u.enumerable});return t};var Pa=(t,n,i)=>(i=t!=null?Da(Aa(t)):{},la(n||!t||!t.__esModule?Ft(i,"default",{value:t,enumerable:!0}):i,t)),Ea=t=>la(Ft({},"__esModule",{value:!0}),t);var hn={};Ra(hn,{EN:()=>ka,MemoryLibrary:()=>nn,ZH:()=>wa,apply:()=>Za,inject:()=>Xa});module.exports=Ea(hn);var o=Pa(require("react"),1);var Fa={"&":"&","<":"<",">":">"},_t=t=>String(t).replace(/[&<>]/g,n=>Fa[n]),ja=[[/结论|总结|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"]],Oa=["\u2728","info"],Ha=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],Wa=t=>{let n=String(t);for(let[i,u,p]of ja)if(i.test(n))return[u,p];return Oa},$a=t=>{let n=t.join(" ");for(let[i,u,p]of Ha)if(i.test(n))return[u,p];return["\u{1F4CC}","info"]};function gt(t){let n=String(t),i=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(n);if(i&&!/[是为有了吗呢着过把被和与或于]/.test(i[1]))return'<span class="md-kv"><span class="md-k">'+_t(i[1])+'</span><span class="md-v">'+gt(i[2])+"</span></span>";let u=_t(n);return u=u.replace(/^\[([ xX])\](?=\s|$)\s*/,(p,l)=>'<span class="md-task">'+(l.toLowerCase()==="x"?"\u2611":"\u2610")+"</span> "),u=u.replace(/`([^`\n]+)`/g,'<code class="md-code">$1</code>'),u=u.replace(/\*\*([^*]+)\*\*/g,'<strong class="md-b">$1</strong>'),u=u.replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>"),u=u.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(p,l,h)=>/^(https?:|\/|#)/i.test(h)?'<a class="md-link" href="'+h+'" target="_blank" rel="noopener noreferrer">'+l+"</a>":l),u}function Ut(t){let n=String(t||"").replace(/\r\n?/g,`
|
|
7
|
+
`),i=/^---\n([\s\S]*?)\n---\n?/.exec(n);if(!i)return{meta:[],body:n};let u=[];for(let p of i[1].split(`
|
|
8
|
+
`)){let l=p.indexOf(":");if(l<=0)continue;let h=p.slice(0,l).trim(),w=p.slice(l+1).trim().replace(/^["']|["']$/g,"");h&&u.push([h,w])}return{meta:u,body:n.slice(i[0].length)}}function ra(t){let n=String(t||"").trim().replace(/^\[|\]$/g,"");return n?n.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function sa(t){let n=Ut(String(t||"").replace(/\r\n?/g,`
|
|
9
|
+
`)).body;if(!n.trim())return"";let i=[],u=n.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(g,D,T)=>(i.push('<pre class="md-pre"><code>'+_t(T.replace(/\n$/,""))+"</code></pre>"),"\0F"+(i.length-1)+"\0")),p=[],l=[],h=null,w=null,x=()=>{l.length&&(p.push('<p class="md-p">'+l.join("<br/>")+"</p>"),l=[])},A=()=>{if(!h)return;let g=h.type;p.push("<"+g+' class="md-'+g+'">'+h.items.map(D=>"<li>"+D+"</li>").join("")+"</"+g+">"),h=null},S=()=>{if(!w)return;let[g,D]=$a(w);p.push('<div class="md-callout md-c-'+D+'"><span class="md-ico">'+g+"</span>"+w.join("<br/>")+"</div>"),w=null},y=()=>{x(),A(),S()};for(let g of u.split(`
|
|
10
|
+
`)){let D=g.trim();if(!D){y();continue}let T=/^\u0000F(\d+)\u0000$/.exec(D);if(T){y(),p.push(i[Number(T[1])]);continue}let k;if(k=/^(#{1,6})\s+(.+)$/.exec(D)){y();let[L,I]=Wa(k[2]);p.push('<div class="md-h md-h-'+(k[1].length<=2?"h1":"h2")+" md-c-"+I+'"><span class="md-ico">'+L+'</span><span class="md-hx">'+gt(k[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(D)){y(),p.push('<hr class="md-hr"/>');continue}if(k=/^>\s?(.*)$/.exec(D)){x(),A(),w=w||[],w.push(gt(k[1]));continue}if(k=/^[-*+]\s+(.+)$/.exec(D)){x(),S(),(!h||h.type!=="ul")&&(A(),h={type:"ul",items:[]}),h.items.push(gt(k[1]));continue}if(k=/^\d+[.)]\s+(.+)$/.exec(D)){x(),S(),(!h||h.type!=="ol")&&(A(),h={type:"ol",items:[]}),h.items.push(gt(k[1]));continue}A(),S(),l.push(gt(D))}return y(),p.join(`
|
|
11
|
+
`)}function da(t={}){let n=t.repo||"EternalNight996/memory-eternal",i=String(t.title||"[Bug] ").slice(0,120),u=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),u.length&&A.set("labels",u.join(",")),"https://github.com/"+n+"/issues/new?"+A.toString()},h=String(t.body||""),w=l(h);if(w.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=S=>l(h.slice(0,S)+x);if(A(0).length>p)h=x;else{let S=0,y=h.length;for(;S<y;){let g=Math.ceil((S+y)/2);A(g).length<=p?S=g:y=g-1}h=h.slice(0,S)+x}w=l(h)}return w}function ca(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 Kt="https://github.com/EternalNight996/memory-eternal",_a=["\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"+Kt,"","\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
|
+
`),Ua=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+Kt,"","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 pa(t={}){let n=t.lang==="en"?"en":"zh",i=n==="en"?Ua:_a,u=t.repo||"EternalNight996/memory-eternal";return i=i.split(Kt).join("https://github.com/"+u),t.description&&(i=i.replace(n==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(i=i.replace(n==="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 ua({panX:t=0,panY:n=0,zoom:i=1,w:u=0,h:p=0,margin:l=60}={}){let h=i||1;return{x0:(0-t)/h-l,y0:(0-n)/h-l,x1:(u-t)/h+l,y1:(p-n)/h+l}}function jt(t,n,i,u){return u?t+i>=u.x0&&t-i<=u.x1&&n+i>=u.y0&&n-i<=u.y1:!0}function ma(t){let n=Number(t)||0;return n<=120?1/0:n<=300?160:n<=600?90:60}function ga(t,n={}){let i=Number.isFinite(n.limit)?n.limit:1/0,u=new Set,p=x=>{x&&u.size<i&&u.add(x)};if(p(n.focusId),p(n.hoverId),n.searchHits)for(let x of n.searchHits){if(u.size>=i)break;u.add(x)}let l=n.degree||{},h=x=>Number(l[x])||0,w=[];for(let x of Array.isArray(t)?t:[])x&&x.id&&!u.has(x.id)&&w.push(x);w.sort((x,A)=>h(A.id)-h(x.id));for(let x of w){if(u.size>=i)break;u.add(x.id)}return u}var Ka=Math.SQRT2;function Ya(t,n=Ka){let i=Number(t)>0?Number(t):1;return Math.max(0,Math.round(Math.log(i)/Math.log(n)))}function Va(t){return Math.max(1,Math.round(Number(t)||1))}function fa({kind:t="other",radius:n=9,zoom:i=1,dark:u=!1}={}){return t+"|"+Va(n)+"|"+Ya(i)+"|"+(u?"d":"l")}function ba({text:t="",fontPx:n=12,dark:i=!1}={}){return t+"|"+Math.round(Number(n)||12)+"|"+(i?"d":"l")}var Mt=class{constructor({createCanvas:n,max:i=400}={}){this.createCanvas=n,this.max=i,this.map=new Map,this.hits=0,this.misses=0}get(n,i,u,p){let l=this.map.get(n);if(l&&l.w===i&&l.h===u)return this.hits++,this.map.delete(n),this.map.set(n,l),l;this.misses++;let h=this.createCanvas(Math.max(1,Math.ceil(i)),Math.max(1,Math.ceil(u))),w=h.getContext("2d");p(w,h.width,h.height);let x={canvas:h,w:i,h:u,ctx:w};if(this.map.delete(n),this.map.set(n,x),this.map.size>this.max){let A=this.map.keys().next().value;this.map.delete(A)}return x}clear(){this.map.clear(),this.hits=0,this.misses=0}get size(){return this.map.size}};function ya({panX:t=0,panY:n=0,zoom:i=1,w:u=0,h:p=0,dpr:l=1,tick:h=0,filter:w="",dark:x=!1,dataVersion:A=0}={}){return[t,n,i,u,p,l,h,w,x?"d":"l",A].join("|")}var e=require("react/jsx-runtime"),ft="memory-eternal",q="/memory-eternal/api",qa=100,Xa=["slots","locale"],wa={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]
|
|
17
17
|
|
|
18
18
|
## \u80CC\u666F
|
|
19
19
|
- \u95EE\u9898\u63CF\u8FF0
|
|
@@ -58,7 +58,7 @@ var ea=Object.create;var xt=Object.defineProperty;var ta=Object.getOwnPropertyDe
|
|
|
58
58
|
-
|
|
59
59
|
|
|
60
60
|
## \u98CE\u9669/\u963B\u585E
|
|
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]
|
|
61
|
+
- `},ka={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]
|
|
62
62
|
|
|
63
63
|
## Background
|
|
64
64
|
- Problem
|
|
@@ -103,7 +103,7 @@ Option A, because:
|
|
|
103
103
|
-
|
|
104
104
|
|
|
105
105
|
## Risks/blockers
|
|
106
|
-
- `},
|
|
106
|
+
- `},Vt=["all","project","knowledge","content","prompt","business","tool","mistake"],Ze={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},Ot={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},We={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},Nt="deepseek-harness",xt=t=>{let n=String(t||""),i=n.toLowerCase();return!n||n==="agent"||n==="unknown"||n.startsWith("session:")||i.startsWith("claude-code")?i.startsWith("claude-code")?"claude":Nt:i==="deepseek harness"?Nt:n.split(":")[0]||Nt},Ga=[Nt,"claude","codex","cursor","codex-desktop"],Ca=(t=[])=>[...new Set([...Ga,...(t||[]).map(xt)])],Ja={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],fail:["\u274C","#ef4444"]},Ae=`
|
|
107
107
|
.memory-eternal-root { font-family: inherit; color: var(--dsw-alias-label-primary, #1f2937); }
|
|
108
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; }
|
|
109
109
|
.mc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
|
|
@@ -295,13 +295,13 @@ Option A, because:
|
|
|
295
295
|
height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
|
|
296
296
|
max-height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
|
|
297
297
|
}
|
|
298
|
-
`;function
|
|
298
|
+
`;function Za(t){t.effect(()=>t.locale.register(ft,{zh:wa,en:ka}),"memory-eternal: locale");let n=t.locale.bind(ft);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:ft,order:25,label:()=>n("nav"),locale:ft,inject:()=>({})},()=>o.default.createElement(en,{t:n}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${ft}:footer`,order:100,label:()=>n("nav"),locale:ft,inject:()=>({})},i=>o.default.createElement(tn,{t:n,locale:t.locale,wide:!(i&&i.wide===!1)}))),"memory-eternal: sidebar footer action")}function Qa(){let[t,n]=(0,o.useState)("http://127.0.0.1:7999/");return(0,o.useEffect)(()=>{fetch("/memory-eternal/api/web-info").then(i=>i.json()).then(i=>{i&&i.ok&&i.url&&n(i.url.endsWith("/")?i.url:i.url+"/")}).catch(()=>{})},[]),t}function en({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsx)(Na,{t,onReload:()=>{},version:0})]})}function tn({t,locale:n,wide:i}){let[u,p]=(0,o.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${i?"":" rail"}`,children:[(0,e.jsx)("style",{children:Ae}),(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)(Sa,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),u&&(0,e.jsx)(an,{t,locale:n,onClose:()=>p(!1)})]})}function an({t,locale:n,onClose:i,tab:u}){let[p,l]=(0,o.useState)(!1),h=(0,o.useRef)(null),w=Qa(),x=(0,o.useCallback)(T=>n&&typeof n.subscribe=="function"?n.subscribe(T):()=>{},[n]),A=(0,o.useCallback)(()=>n&&typeof n.getSnapshot=="function"?n.getSnapshot():null,[n]),S=(0,o.useSyncExternalStore)(x,A),y=S&&(S.active==="zh"||S.active==="en")?S.active:null,g=(0,o.useRef)(null);g.current===null&&y&&(g.current=y);let D=(0,o.useMemo)(()=>{let T=g.current?`lang=${g.current}`:"";return u==="config"?`${q}/ui/config?tab=config${T?`&${T}`:""}`:u?`${w.replace(/\/$/,"")}/?tab=${u}${T?`&${T}`:""}`:T?`${w}${w.endsWith("/")?"":"/"}?${T}`:w},[w,u]);return(0,o.useEffect)(()=>{let T=h.current&&h.current.contentWindow;T&&y&&T.postMessage({source:"memory-eternal",type:"locale",lang:y},"*")},[y]),(0,o.useEffect)(()=>{let T=k=>{k.key==="Escape"&&i()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[i]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:i,children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsx)("div",{className:"me-modal"+(p?" me-modal-full":""),onClick:T=>T.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(T=>!T),"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:h,src:D,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 Sa(){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 nn({t,inModal:n,onClose:i,onFull:u,full:p}){let[l,h]=(0,o.useState)(null),[w,x]=(0,o.useState)([]),[A,S]=(0,o.useState)(!0),[y,g]=(0,o.useState)(null),[D,T]=(0,o.useState)(""),[k,L]=(0,o.useState)("all"),[I,j]=(0,o.useState)(""),[J,ne]=(0,o.useState)("all"),[H,ye]=(0,o.useState)("all"),[$,Z]=(0,o.useState)(()=>{try{let v=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),O={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(v&&O[v])return O[v]}catch{}return"cards"}),[be,W]=(0,o.useState)(()=>new Set([$])),b=(0,o.useCallback)(v=>{W(O=>O.has(v)?O:new Set(O).add(v)),Z(v)},[]),[f,E]=(0,o.useState)("recent"),[K,_]=(0,o.useState)(null),B=(0,o.useRef)(null),te=(0,o.useRef)(null),[Q,le]=(0,o.useState)(!1),[tt,at]=(0,o.useState)(null),[Be,Ee]=(0,o.useState)(!1),[he,xe]=(0,o.useState)(!1),[me,Ne]=(0,o.useState)(!0),[$e,ze]=(0,o.useState)(null),[Fe,nt]=(0,o.useState)(0),Ye=(0,o.useCallback)(()=>nt(v=>v+1),[]),re=(0,o.useRef)(null),[ue,d]=(0,o.useState)(0),[R,P]=(0,o.useState)(!1),r=(0,o.useRef)(null),s=(0,o.useRef)(null),M=(0,o.useCallback)(async(v=k,O=I,X=H,Se={})=>{let ve=Se.append===!0;try{ve?P(!0):(S(!0),T(""));let ce=new URLSearchParams;v&&v!=="all"&&ce.set("kind",v),O.trim()&&ce.set("q",O.trim()),ce.set("status",X||"all"),ce.set("limit",String(qa)),ce.set("offset",String(Se.offset||0)),f==="title"&&ce.set("sort","title");let ot=await(await fetch(`${q}/cards?${ce.toString()}`)).json();if(ot.ok){let Qe=ot.cards||[];x(Re=>ve?[...Re,...Qe.filter(qe=>!Re.some(Tt=>Tt.path===qe.path))]:Qe),d(Number(ot.total)||Qe.length)}}catch(ce){T(String(ce&&ce.message?ce.message:ce))}finally{ve?P(!1):S(!1)}},[k,I,H,f]),Y=(0,o.useCallback)(async()=>{try{let[v,O]=await Promise.all([fetch(`${q}/overview`).then(X=>X.json()),fetch(`${q}/capture-log`).then(X=>X.json()).catch(()=>null)]);v.ok&&h(v),g(O&&O.ok&&O.available&&O.health||null)}catch(v){T(String(v&&v.message?v.message:v))}finally{S(!1)}},[]),de=async v=>{try{let X=await(await fetch(`${q}/delete?path=${encodeURIComponent(v)}`)).json();X.ok?(_({ok:!0,msg:t("deleted")}),await Y(),Ye()):_({ok:!1,msg:X.error||t("deleteFail")})}catch{_({ok:!1,msg:t("deleteFail")})}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2e3)};(0,o.useEffect)(()=>(Y(),()=>{re.current&&clearTimeout(re.current)}),[Y]);let Ce=v=>{j(v),re.current&&clearTimeout(re.current),re.current=setTimeout(()=>M(k,v,H),280)},a=v=>{L(v),M(v,I,H)};(0,o.useEffect)(()=>{$==="cards"&&M(k,I,H)},[H,$,Fe,f]),(0,o.useEffect)(()=>{if($!=="cards"||A||R||w.length>=ue)return;let v=r.current,O=s.current;if(!v)return;let X=new IntersectionObserver(Se=>{Se[0]&&Se[0].isIntersecting&&M(k,I,H,{append:!0,offset:w.length})},{root:O||null,rootMargin:"400px"});return X.observe(v),()=>X.disconnect()},[$,w,ue,A,R,k,I,H,M]);let ct=async v=>{try{let X=await(await fetch(`${q}/card?path=${encodeURIComponent(v.path||v.id)}`)).json();X.ok&&at({path:X.path,title:v.title,text:X.text})}catch(O){T(String(O&&O.message?O.message:O))}},vt=async(v,O)=>{le(!0);try{let X=await fetch(`${q}/export`);if(!X.ok)throw new Error("HTTP "+X.status);let Se=await X.json();if(!Se.ok)throw new Error(Se.error||"export failed");let ve,ce,Ve;v==="json"?(ce="memory-vault.json",Ve="application/json",ve=JSON.stringify(Se.cards.map(Re=>({path:Re.path,title:Re.title,kind:Re.kind,text:Re.text})),null,2)):(ce="memory-vault.md",Ve="text/markdown;charset=utf-8",ve=Se.cards.map(Re=>Re.text.trim()).filter(Boolean).join(`
|
|
299
299
|
|
|
300
300
|
---
|
|
301
301
|
|
|
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
|
-
`),
|
|
302
|
+
`));let ot=new Blob([ve],{type:Ve}),Qe=await yn(ot,ce,!1);if(!Qe.ok){_({ok:!1,msg:t("exportFail")}),le(!1);return}_({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+Qe.name})}catch(X){_({ok:!1,msg:t("exportFail")+" \xB7 "+(X.message||"")})}finally{le(!1)}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2600)},zt=async v=>{let O=v.target.files&&v.target.files[0];if(v.target.value="",!!O){try{let X=await O.text(),ve=await(await fetch(`${q}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:X})).json();ve.ok?(await Y(),_({ok:!0,msg:t("importedVault")+"\uFF1A"+(ve.imported||0)+(ve.skipped?t("importedSkipped")+ve.skipped:"")})):_({ok:!1,msg:ve.error||t("importFail")})}catch{_({ok:!1,msg:t("importFail")})}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2400)}},It=(0,o.useMemo)(()=>{let v=w.slice();return J!=="all"&&(v=v.filter(O=>xt(O.submittedBy)===J)),H!=="all"&&(v=v.filter(O=>(O.status||"approved")===H)),f==="title"?v.sort((O,X)=>String(O.title||"").localeCompare(String(X.title||""))):f==="hot"?v.sort((O,X)=>(X.weight||X.links||0)-(O.weight||O.links||0)):v.sort((O,X)=>new Date(X.updated||0).getTime()-new Date(O.updated||0).getTime()),v},[w,f,J,H]),Dt=(0,o.useMemo)(()=>[...new Set(w.map(v=>xt(v.submittedBy)))],[w]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Ae}),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})]}),n&&(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)(Sa,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),u&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:u,"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?ht(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:()=>Ne(v=>!v),"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:s,children:[$==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(bt,{label:t("total"),value:l?l.total:"\u2014"}),(0,e.jsx)(bt,{label:t("recent"),value:l?l.recent:"\u2014"}),(0,e.jsx)(bt,{label:t("tags"),value:l?l.tags:"\u2014"}),(0,e.jsx)(bt,{label:t("pending"),value:l?.status?.pending??0}),(0,e.jsx)(bt,{label:t("rejected"),value:l?.status?.rejected??0}),(0,e.jsx)(bt,{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:I,onChange:v=>Ce(v.target.value)}),(0,e.jsx)("input",{ref:te,type:"file",accept:".json,application/json",style:{display:"none"},onChange:zt}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>te.current&&te.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:()=>vt("md"),children:t(Q?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:Q,onClick:()=>vt("json"),children:t(Q?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Y(),children:t("refresh")})]}),$==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[Vt.map(v=>(0,e.jsx)("button",{type:"button",className:`mc-chip${k===v?" active":""}`,onClick:()=>a(v),children:t(v==="all"?"all":We[v])},v)),(0,e.jsxs)("select",{value:J,onChange:v=>ne(v.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")]}),Ca(Dt).map(v=>(0,e.jsx)("option",{value:v,children:v},v))]}),(0,e.jsxs)("select",{value:H,onChange:v=>ye(v.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(v=>(0,e.jsx)("button",{type:"button",className:`mc-chip${f===v.key?" active":""}`,onClick:()=>E(v.key),children:v.label},v.key))]}),D&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",D]}),(0,e.jsx)("div",{style:{display:$==="cards"?"contents":"none"},children:A?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):D?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",D," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Y(),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:It.map(v=>(0,e.jsx)(rn,{card:v,t,query:I.trim(),onOpen:ct,onDelete:de},v.path))}),w.length<ue&&(0,e.jsx)("div",{ref:r,style:{height:1}}),R&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",w.length," / ",ue,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:$==="graph"?"flex":"none",flex:1,minHeight:0},children:be.has("graph")&&(0,e.jsx)(un,{t,onOpen:ct,all:Be,onAllChange:Ee,onMutate:Ye,active:$==="graph",visible:$==="graph"})}),(0,e.jsx)("div",{style:{display:$==="config"?"contents":"none"},children:be.has("config")&&(0,e.jsx)(Na,{t,onReload:()=>Y(),version:Fe})}),(0,e.jsx)("div",{style:{display:$==="stats"?"contents":"none"},children:be.has("stats")&&(0,e.jsx)(sn,{t,tab:"stats",onReload:()=>Y(),version:Fe})}),(0,e.jsx)("div",{style:{display:$==="audit"?"contents":"none"},children:be.has("audit")&&(0,e.jsx)(on,{t,onReload:()=>Y(),version:Fe})}),(0,e.jsx)("div",{style:{display:$==="optimize"?"contents":"none"},children:be.has("optimize")&&(0,e.jsx)(ln,{t,onReload:()=>Y(),version:Fe})}),he&&(0,e.jsx)(cn,{t,onClose:()=>xe(!1)}),tt&&(0,e.jsx)(pn,{t,card:tt,query:I.trim(),onClose:()=>at(null),onDelete:v=>{at(null),de(v)},onFeedback:v=>{let O=tt.path;fetch(`${q}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:I.trim(),path:O,useful:v})}).then(()=>_({ok:!0,msg:t(v?"fbUseful":"fbIrr")})).catch(()=>{}),B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2e3)}}),(0,e.jsx)(dn,{t,newCard:$e,setNewCard:ze,onCreated:()=>{Y(),Ye(),_({ok:!0,msg:t("created")}),B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2e3)}})]})]})]})}var Ma=({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,bt=({label:t,value:n})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:n}),(0,e.jsx)("span",{children:t})]});function Na({t,onReload:n,version:i,compact:u}){let[p,l]=(0,o.useState)(null),[h,w]=(0,o.useState)(0),[x,A]=(0,o.useState)(null),[S,y]=(0,o.useState)(null),[g,D]=(0,o.useState)(!1),[T,k]=(0,o.useState)(null),[L,I]=(0,o.useState)(null),[j,J]=(0,o.useState)(""),[ne,H]=(0,o.useState)(""),[ye,$]=(0,o.useState)(""),[Z,be]=(0,o.useState)(null),W=(0,o.useCallback)(async d=>{H("version");try{let R=await fetch(q+"/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,o.useEffect)(()=>{W(!1)},[i,W]);let[b,f]=(0,o.useState)(""),[E,K]=(0,o.useState)(null),_=(0,o.useRef)(null),B=(d,R=!0)=>{_.current&&clearTimeout(_.current),K({msg:d,ok:R}),_.current=setTimeout(()=>K(null),1900)},te=(d,R)=>Object.keys(R).reduce((P,r)=>P.split("{"+r+"}").join(R[r]),t(d)),Q=(0,o.useCallback)(async()=>{try{let[d,R,P]=await Promise.all([fetch(`${q}/config`).then(r=>r.json()).catch(()=>null),fetch(`${q}/setup-status`).then(r=>r.json()).catch(()=>null),fetch(`${q}/budget`).then(r=>r.json()).catch(()=>null)]);d&&d.ok?(l(d),w(d.revision??0),A(d.schema??null),y({...d.config??{}}),k(d.dsh??null),D(d.writable===!1),J("")):P&&P.ok?(y({...P}),D(!0),J(t("configNeedsDsh"))):J(t("adminLoadFail")),R&&R.ok&&I(R),$("")}catch{J(t("adminLoadFail"))}},[t]);(0,o.useEffect)(()=>{Q()},[i,Q]);let le=(d,R)=>y(P=>({...P??{},[d]:R})),tt=d=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[d]||d,at=async()=>{if(S){if(g){B(t("editInSetting"),!1);return}H("save");try{let d={...S};Array.isArray(d.vaultProfiles)&&(d.vaultProfiles=d.vaultProfiles.filter(r=>r&&(String(r.name||"").trim()||String(r.path||"").trim())));let R=await fetch(`${q}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:d,expectedRevision:h})}),P=await R.json();if(P&&P.ok)$(t("savedOk")+(P.note?` \xB7 ${t("restartHint")}`:"")),B(t("savedOk")),await Q();else{let r=R.status===409?t("conflictRefresh"):P?.error||t("saveFail");J(r),B(r,!1)}}catch{J(t("saveFail")),B(t("saveFail"),!1)}finally{H("")}}},Be=()=>{y({...p?.config??{}}),$("")},Ee={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},he=d=>Array.isArray(d?.vaultProfiles)?d.vaultProfiles:[],xe=(d,R,P)=>y(r=>{let s=he(r).map(Y=>({...Y||{}})),M={...s[d]||{}};return R==="match"?String(P).trim()?M.match={...M.match||{},workspace:P}:delete M.match:M[R]=P,s[d]=M,{...r??{},vaultProfiles:s}}),me=()=>y(d=>({...d??{},vaultProfiles:[...he(d),{name:"",path:""}]})),Ne=d=>y(R=>({...R??{},vaultProfiles:he(R).filter((P,r)=>r!==d)})),$e={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},ze={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},Fe={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}},nt=async d=>{let R=Fe[d];R&&y(P=>({...P??{},...R}))},Ye=async(d,R)=>{H(d+R);try{let r=await(await fetch(`${q}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:d,action:R})})).json();r&&r.ok?B(te(R==="install"?"mcpInstalled":"mcpUninstalled",{agent:d})):B(te("mcpActionFail",{agent:d,error:r?.error||""}),!1);try{let s=await fetch(`${q}/setup-status`).then(M=>M.json());s&&s.ok&&I(s)}catch{}}catch{B(t("mergeFail"),!1)}finally{H("")}},re=({k:d,label:R,type:P="text",step:r,min:s,max:M})=>(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:r,min:s,max:M,value:S?S[d]??"":"",onChange:Y=>le(d,P==="number"?Number(Y.target.value):Y.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}})]}),ue=({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:!!(S&&S[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:u?"0 0 auto":1,minHeight:0,maxHeight:u?"52vh":void 0},children:[(0,e.jsx)("style",{children:Ae}),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:[j&&(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 ",j]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:Q,children:["\u21BB ",t("retry")]})]}),g&&(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:$e,children:[t("vcLoaded")," v",p.version]}),Z&&Z.onDisk&&(0,e.jsxs)("code",{style:$e,children:[t("vcOnDisk")," v",Z.onDisk]}),Z&&Z.latest&&(0,e.jsxs)("code",{style:$e,children:[t("vcLatest")," v",Z.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:ne==="version",onClick:()=>W(!0),children:ne==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),Z&&Z.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 ",te("vcStale",{disk:Z.onDisk,loaded:Z.loaded})]}),Z&&Z.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:Z.updateCommand})]}),Z&&Z.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",Z.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:!!ne,onClick:()=>Ye(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:!!ne,onClick:()=>{window.confirm(t("uninstallConfirm"))&&Ye(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})})]}),S?(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:()=>nt(d),disabled:!!ne,children:[d==="A"?"\u{1F7E2} ":d==="B"?"\u{1F4B0} ":"\u2B50 ",Fe[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)(ue,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(ue,{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)(ue,{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:T?.vaultDir||"\u2014"}),T?.vaultName?`\uFF08${T.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(Ee[T?.vaultSource]||"vaultSrcDefault"),T?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:T.workspace})]}):null]}),he(S).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:ze,disabled:g}),(0,e.jsx)("input",{value:d.path||"",placeholder:t("vaultPathPh"),onChange:P=>xe(R,"path",P.target.value),style:ze,disabled:g}),(0,e.jsx)("input",{value:d.match&&d.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:P=>xe(R,"match",P.target.value),style:ze,disabled:g}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Ne(R),disabled:g,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:g,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:S.activeVault||"",onChange:d=>le("activeVault",d.target.value),disabled:g,style:ze,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),he(S).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)(ue,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(ue,{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:S.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)(xa,{label:t("auditExemptAgents"),value:S.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)(xa,{label:t("auditExemptKinds"),value:S.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...Vt.filter(d=>d!=="all").map(d=>({value:d,label:t(We[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)(ue,{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:S.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)(ue,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(ue,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[ne==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),ye&&ne!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",ye]}),j&&ne!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",j]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:Be,disabled:!!ne,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:at,disabled:!!ne||g,children:ne==="save"?"\u23F3 "+t("saving"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function on({t,onReload:n,version:i}){let[u,p]=(0,o.useState)([]),[l,h]=(0,o.useState)([]),[w,x]=(0,o.useState)("all"),[A,S]=(0,o.useState)("all"),[y,g]=(0,o.useState)(""),[D,T]=(0,o.useState)(new Set),[k,L]=(0,o.useState)(""),[I,j]=(0,o.useState)(null),[J,ne]=(0,o.useState)("pending"),H=(f,E=!0)=>{j({msg:f,ok:E}),setTimeout(()=>j(null),3e3)},ye=[...new Set([...u,...l].map(f=>f.submittedBy).filter(Boolean))],$=(0,o.useCallback)(async()=>{try{let f=await fetch(`${q}/audit/list`).then(E=>E.json());f.ok&&(p(f.pending||[]),h(f.rejected||[]),T(new Set))}catch{}},[]);(0,o.useEffect)(()=>{$()},[i,$]);let Z=(J==="pending"?u:l).filter(f=>{if(w!=="all"&&f.kind!==w||A!=="all"&&xt(f.submittedBy)!==A)return!1;if(y){let E=(f.created||"").slice(0,10);if(E&&E!==y)return!1}return!0}),be=f=>T(E=>{let K=new Set(E);return K.has(f)?K.delete(f):K.add(f),K}),W=async(f,E)=>{let K=E||[...D];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 te of K){let Q=f==="approved"?"audit/approve":f==="rejected"?"audit/reject":"delete";try{(await fetch(q+"/"+Q+"?path="+encodeURIComponent(te)+(f==="delete"?"&permanent=0":""))).ok||B++}catch{B++}}await $(),n&&n(),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=[...D];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:Ae}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(Ma,{toast:I}),(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: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")}),Vt.filter(f=>f!=="all").map(f=>(0,e.jsx)("option",{value:f,children:t(We[f])},f))]}),(0,e.jsxs)("select",{value:A,onChange:f=>S(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")}),Ca(ye).map(f=>(0,e.jsx)("option",{value:f,children:f},f))]}),(0,e.jsx)("input",{type:"date",value:y,onChange:f=>g(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${J==="pending"?" me-on":""}`,onClick:()=>ne("pending"),children:[t("pending"),"\uFF08",u.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${J==="rejected"?" me-on":""}`,onClick:()=>ne("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:Z.length>0&&b.length===Z.length,onChange:f=>{f.target.checked?T(new Set(Z.map(E=>E.path))):T(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!b.length||!!k,onClick:()=>W("approved"),children:["\u2713 ",t(J==="rejected"?"restore":"approve")]}),J==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!b.length||!!k,onClick:()=>W("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!b.length||!!k,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&W("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),Z.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:Z.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:D.has(f.path),onChange:()=>be(f.path)}),(0,e.jsx)("span",{className:"mc-kind",style:{background:Ze[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:xt(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||"-"}),J==="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 ln({t,onReload:n,version:i}){let[u,p]=(0,o.useState)([]),[l,h]=(0,o.useState)(""),[w,x]=(0,o.useState)(null),A=(g,D=!0)=>{x({msg:g,ok:D}),setTimeout(()=>x(null),3200)},S=(0,o.useCallback)(async()=>{try{let g=await fetch(`${q}/recycle/list`).then(D=>D.json());g.ok&&p(g.items||[])}catch{}},[]);(0,o.useEffect)(()=>{S()},[i,S]);let y=async(g,D)=>{let T=(u.find(k=>k.path===D)||{}).title||D;h(g+D);try{let L=await fetch(q+(g==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(D)),I=await L.json().catch(()=>null);await S(),n&&n(),L.ok&&(!I||I.ok!==!1)?A(t(g==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+T):A(t("toastFailed")+"\uFF1A"+(I&&I.error||"HTTP "+L.status),!1)}catch(k){A(t("toastFailed")+"\uFF1A"+String(k&&k.message||k),!1)}finally{h("")}};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:Ae}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(Ma,{toast:w}),(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||u.length===0,title:u.length?"":t("emptyRecycle"),onClick:async()=>{h("purgeAll");try{let g=await fetch(q+"/recycle/purge-expired?days=0"),D=await g.json().catch(()=>null);await S(),A(g.ok?t("toastPurgedExpired")+(D&&D.purged!=null?"\uFF08"+D.purged+"\uFF09":""):t("toastFailed"),g.ok)}catch(g){A(t("toastFailed")+"\uFF1A"+String(g&&g.message||g),!1)}finally{h("")}},children:t("emptyRecycle")})]}),u.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:u.map(g=>(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:Ze[g.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(g.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!l,onClick:()=>y("restore",g.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",g.path)},children:t("purge")})]},g.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 rn=({card:t,t:n,onOpen:i,query:u,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:Ze[t.kind]||Ze.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:Ot[t.kind]||"\u{1F4CE}"}),u?va(t.title,u):t.title,bn(t.updated)&&(0,e.jsx)("span",{className:"mc-new",children:n("newBadge")}),t.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",n("statusPending")]}),t.status==="rejected"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",n("statusRejected")]}),(!t.status||t.status==="approved")&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",n("statusApproved")]})]}),(0,e.jsx)("p",{children:u?va(t.summary||"",u):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:[Ot[t.kind]||"\u{1F4CE}"," ",n(We[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",xt(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",ht(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:n("delete"),onClick:l=>{l.stopPropagation(),window.confirm(n("deleteConfirm"))&&p&&p(t.path)},children:"\u{1F5D1}"})]})]});function sn({t,tab:n,onReload:i,version:u}){let[p,l]=(0,o.useState)(null),[h,w]=(0,o.useState)(""),[x,A]=(0,o.useState)(null),[S,y]=(0,o.useState)(null),[g,D]=(0,o.useState)(null),[T,k]=(0,o.useState)([]),[L,I]=(0,o.useState)(""),[j,J]=(0,o.useState)(!1),ne=(0,o.useCallback)(async()=>{if(!(!x||!x.merge||!x.merge.length)&&window.confirm(t("mergeAllConfirm"))){I("merge");try{let b={},f=te=>b[te]===void 0?te:b[te]=f(b[te]),E=(te,Q)=>{b[f(te)]=f(Q)},K=new Set;for(let te of x.merge)K.add(te.a.path),K.add(te.b.path),E(te.a.path,te.b.path);let _={};for(let te of K){let Q=f(te);(_[Q]=_[Q]||[]).push(te)}let B=0;for(let te of Object.values(_)){if(te.length<2)continue;(await fetch(`${q}/merge?paths=${encodeURIComponent(te.join(","))}`).then(le=>le.json())).ok&&B++}await H(),i&&i()}catch{}I("")}},[x,H,i,t]);async function H(){try{let b=await Promise.all([fetch(`${q}/stats`),fetch(`${q}/budget`),fetch(`${q}/capture-log`),fetch(`${q}/cards?status=all&limit=30&agent=${Nt}`)]),[f,E,K,_]=await Promise.all(b.map(B=>B.json()));f&&f.ok&&l(f),E&&E.ok&&y(E),K&&K.ok&&D(K),_&&_.ok&&k(_.cards||[]),w(!f||!f.ok?t("adminLoadFail"):"")}catch{w(t("adminLoadFail"))}}let ye=(0,o.useCallback)(async()=>{I("scan");try{let b=await fetch(`${q}/optimize`).then(f=>f.json());b.ok&&A(b)}catch{w(t("adminLoadFail"))}finally{I("")}},[t]);(0,o.useEffect)(()=>{H()},[u]);let $=async(b,f)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${q}/merge?paths=${encodeURIComponent(b+","+f)}`).then(K=>K.json())).ok&&(await H(),i&&i())}catch{}},Z=async b=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${q}/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:yt.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:ht(E)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Z(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:Ae}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[h&&(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 ",h]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:H,children:["\u21BB ",t("retry")]})]}),n==="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")]})]}),g?g.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(g.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:(g.entries||[]).map((b,f)=>{let E=Ja[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:ht(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",T.length,"\uFF09"]}),T.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:T.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:Ze[b.kind]||Ze.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:ht(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,te)=>{let Q=Math.round(B.count/f*(K-4));return(0,e.jsx)("rect",{x:te*_+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:yt.colors[b]||"#666"}}),t(We[b]),": ",p.byKind?.[b]||0]},b))})]}),S&&(S.budgetChars||S.recallLimit||S.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:S.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:S.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",S.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")})]})]})]}),n==="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"))){I("oneclick");try{let b=JSON.stringify({cleanupStale:j}),E=await(await fetch(`${q}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:b})).json();E&&E.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${E.plan.merged} ${t("optimizedMerged")}${j?` \xB7 ${E.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await H(),i&&i(),A(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{I("")}}},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:j,onChange:b=>J(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:ne,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;I("clean");let b=0;for(let f of x.stale)try{await fetch(`${q}/delete?path=${encodeURIComponent(f.path)}`),b++}catch{}I(""),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 Yt=[{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 dn({t,newCard:n,setNewCard:i,onCreated:u}){if(!n)return null;let p=Yt.find(y=>y.key===n.template),l=n.body||(p?t(p.bodyKey):""),h=n.kind||(p?p.kind:"knowledge"),w=n.tags||(p?t(p.tagKey):""),x=n._creating,A=y=>{let g=Yt.find(D=>D.key===y);i(D=>({...D,template:y,kind:g?g.kind:D.kind,body:g?t(g.bodyKey):D.body,tags:g?t(g.tagKey):D.tags}))},S=async()=>{if(!(!n.title&&!l)){i(y=>({...y,_creating:!0}));try{(await fetch(`${q}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n.title||t("untitled"),kind:h,tags:w.split(",").map(g=>g.trim()).filter(Boolean),body:l,source:"manual"})}).then(g=>g.json())).ok?(i(null),u&&u()):i(g=>({...g,_creating:!1}))}catch{i(g=>({...g,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>i(null),children:[(0,e.jsx)("style",{children:Ae}),(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:[Yt.map(y=>(0,e.jsx)("button",{type:"button",className:`mc-btn${n.template===y.key?" me-on":""}`,onClick:()=>A(y.key),children:t(y.label)},y.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${n.template===""?" me-on":""}`,onClick:()=>i(y=>({...y,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:h,onChange:y=>i(g=>({...g,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:n.title||"",onChange:y=>i(g=>({...g,title:y.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:w,onChange:y=>i(g=>({...g,tags:y.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:l,onChange:y=>i(g=>({...g,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:S,children:t(x?"exporting":"createCard")})})]})]})]})}async function ha(t){let n=String(t||"");if(!n)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(n),!0}catch{}try{let i=document.createElement("textarea");i.value=n,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",i.style.top="0",document.body.appendChild(i),i.focus(),i.select();let u=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(i),u}catch{return!1}}function cn({t,onClose:n}){let[i,u]=(0,o.useState)(""),[p,l]=(0,o.useState)(""),[h,w]=(0,o.useState)(""),[x,A]=(0,o.useState)(!0),[S,y]=(0,o.useState)(!1),[g,D]=(0,o.useState)(""),[T,k]=(0,o.useState)(""),L=(0,o.useRef)(null),I=(0,o.useRef)(null),j=()=>{let W=L.current;if(W)try{W.focus(),W.select()}catch{}},J=W=>{D(W),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>D(""),2400)};(0,o.useEffect)(()=>{let W=!0;return fetch(q+"/diagnostics").then(b=>b.json()).then(b=>{W&&(b&&b.ok?(l(String(b.diagnostics||"")),w(String(b.version||""))):y(!0))}).catch(()=>{W&&y(!0)}).finally(()=>{W&&A(!1)}),()=>{W=!1}},[]),(0,o.useEffect)(()=>{let W=b=>{b.key==="Escape"&&n()};return window.addEventListener("keydown",W),()=>{window.removeEventListener("keydown",W),I.current&&clearTimeout(I.current)}},[n]);let ne=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),H=()=>{let W=i.trim().split(`
|
|
303
|
+
`)[0]||"",b=da({title:"[Bug] "+(W.slice(0,60)||"memory-eternal \u95EE\u9898"),body:ca({description:i,diagnostics:p,version:h})});try{window.open(b,"_blank","noopener")}catch{J(t("fbCopyFail"))}},ye=async()=>{await ha(p)?(k(""),J(t("fbCopiedDiag"))):(k(p),J(t("fbCopyManual")))},$=async()=>{let W=pa({lang:ne,description:i,diagnostics:p});await ha(W)?(k(""),J(t("fbCopiedPrompt"))):(k(W),J(t("fbCopyManual")))},Z={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:n,children:[(0,e.jsx)("style",{children:Ae}),(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:n,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=>u(W.target.value),placeholder:t("fbDesc"),rows:5,style:Z}),(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"):S?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()){J(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")]})]}),g&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:g}),T&&(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:j,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:L,readOnly:!0,value:T,rows:7,style:Z})]})]})]})]})}function pn({t,card:n,query:i,onClose:u,onDelete:p,onFeedback:l}){(0,o.useEffect)(()=>{let L=I=>{I.key==="Escape"&&u()};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[u]);let{meta:h,body:w}=(0,o.useMemo)(()=>Ut(n.text||""),[n.text]),x=L=>{let I=h.find(([j])=>String(j).toLowerCase()===L);return I?I[1]:""},A=ra(x("tags")),S=x("kind")||"knowledge",y=(x("status")||"approved").toLowerCase(),g=Ze[S]||"#6B7280",D=(w||"").length>460,[T,k]=(0,o.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:u,children:[(0,e.jsx)("style",{children:Ae}),(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:Ot[S]||"\u{1F4CE}"}),n.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")]})]}),D&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":T,onClick:()=>k(L=>!L),children:t(T?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&p&&p(n.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:u,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:g,borderColor:g+"59",background:g+"1a"},children:[Ot[S]||"\u{1F4CE}"," ",t(We[S]||"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")," ",ht(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:T?{}:{maxHeight:300,overflow:"hidden"},onClick:T?void 0:L=>{L.stopPropagation(),k(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:sa(w)}})}),!T&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:L=>{L.stopPropagation(),k(!0)},children:[t("expand")," \u2304"]})]})]})}function un({t,onOpen:n,all:i,onAllChange:u,onMutate:p,active:l,visible:h}){let[w,x]=(0,o.useState)(null),[A,S]=(0,o.useState)(""),y=(0,o.useRef)(!1),g=(0,o.useRef)(0),D=(0,o.useRef)(t);D.current=t;let T=(0,o.useCallback)(async()=>{try{y.current=!1;let j=await(await fetch(`${q}/graph${i?"?all=1":""}`)).json();j.ok?(x(j),S(""),y.current=!0):(x(null),S(j.error||t("error")))}catch(I){S(String(I&&I.message?I.message:I))}},[i,t]);(0,o.useEffect)(()=>{if(!l||y.current)return;let I=!0;return fetch(`${q}/graph${i?"?all=1":""}`).then(j=>j.json()).then(j=>{I&&(j.ok?(x(j),S(""),y.current=!0):(x(null),S(j.error||t("error"))))}).catch(j=>{I&&S(String(j&&j.message?j.message:j))}),()=>{I=!1}},[i,t,l]),(0,o.useEffect)(()=>{h&&w&&g.current++},[h,w]);let k=(0,o.useCallback)(async I=>{try{let J=await(await fetch(`${q}/delete?path=${encodeURIComponent(I)}`)).json();return J&&J.ok?(await T(),p&&p(),!0):!1}catch{return!1}},[T]),L=(0,o.useCallback)(async I=>{if(!I||I.length<2)return!1;try{let j=await fetch(`${q}/merge?paths=${encodeURIComponent(I.join(","))}`).then(J=>J.json());return j&&j.ok?(await T(),p&&p(),!0):!1}catch{return!1}},[T,p]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Ae}),A&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",A]}),!w&&!A&&(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)(gn,{nodes:w.nodes,edges:w.edges,onOpen:n,onDelete:k,onMerge:L,t,all:i,onAllChange:u,countLabel:`${w.nodes.length} ${t("nodes")} \xB7 ${mn(w.edges)} ${t("edges")}`,fitTrigger:g.current})]})}function mn(t){let n=new Set;for(let i of t||[])n.add([i.source,i.target].sort().join("|"));return n.size}var yt={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 gn({nodes:t,edges:n,onOpen:i,onDelete:u,onMerge:p,t:l,countLabel:h,all:w,onAllChange:x,fitTrigger:A}){let S=(0,o.useRef)(null),y=(0,o.useRef)(null),g=(0,o.useRef)(null),D=(0,o.useRef)(null),T=(0,o.useRef)(null),k=(0,o.useRef)(i);(0,o.useEffect)(()=>{k.current=i},[i]);let L=(0,o.useRef)(u);(0,o.useEffect)(()=>{L.current=u},[u]);let I=(0,o.useRef)(p);(0,o.useEffect)(()=>{I.current=p},[p]);let[j,J]=(0,o.useState)(""),[ne,H]=(0,o.useState)(null),ye=(0,o.useRef)("");(0,o.useEffect)(()=>{ye.current=j.trim().toLowerCase()},[j]),(0,o.useEffect)(()=>{let r=g.current;if(!r)return;let s=j.trim().toLowerCase();if(!s)return;let M=r.nodes.find(Y=>(Y.name||"").toLowerCase().includes(s));M&&(g.current.selectedId=M.id,H(M.id),r.panX=r.w/2-M.x*r.zoom,r.panY=r.h/2-M.y*r.zoom,r.render&&r.render())},[j]);let[$,Z]=(0,o.useState)("all"),[be,W]=(0,o.useState)(!1),b=(0,o.useRef)("all"),[f,E]=(0,o.useState)(""),K=(0,o.useRef)(""),[_,B]=(0,o.useState)(!1),te=(0,o.useRef)(!1),[Q,le]=(0,o.useState)(null);(0,o.useEffect)(()=>{b.current=$},[$]),(0,o.useEffect)(()=>{K.current=f},[f]),(0,o.useEffect)(()=>{te.current=_},[_]);let tt=(0,o.useMemo)(()=>{let r=new Map;for(let s of t)for(let M of s.tags||[]){let Y=String(M).trim();Y&&r.set(Y,(r.get(Y)||0)+1)}return[...r.entries()].sort((s,M)=>M[1]-s[1]).slice(0,24).map(([s,M])=>({tag:s,n:M}))},[t]),at=(()=>{let r=j.trim().toLowerCase();return!!r&&!t.some(s=>(s.title||s.name||"").toLowerCase().includes(r)||String(s.kind||"").toLowerCase().includes(r)||String(We[s.kind]||"").toLowerCase().includes(r))})();(0,o.useEffect)(()=>{let r=g.current;r&&r.wake&&r.wake()},[j]),(0,o.useEffect)(()=>{let r=g.current;r&&r.render&&r.render()},[$,f,_]);let Be=(0,o.useRef)(null),[Ee,he]=(0,o.useState)([]),[xe,me]=(0,o.useState)(null),[Ne,$e]=(0,o.useState)(!1),[ze,Fe]=(0,o.useState)(null),[nt,Ye]=(0,o.useState)(""),re=(0,o.useRef)(null),ue=(0,o.useRef)(null),d=(r,s=!0)=>{re.current&&clearTimeout(re.current),Fe({msg:r,ok:s}),re.current=setTimeout(()=>Fe(null),1900)},R=r=>{Ye(r),ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>Ye(""),1600)};(0,o.useEffect)(()=>()=>{re.current&&clearTimeout(re.current),ue.current&&clearTimeout(ue.current)},[]);let P=(0,o.useMemo)(()=>t.reduce((r,s)=>(r[s.id]=s,r),{}),[t]);return(0,o.useEffect)(()=>{let r=S.current;if(!r||t.length===0)return;let s=r.getContext("2d");if(!s)return;let M=Math.max(1,window.devicePixelRatio||1),Y=()=>document.documentElement.getAttribute("data-theme")==="dark",de={};n.forEach(c=>{de[c.source]=(de[c.source]||0)+1,de[c.target]=(de[c.target]||0)+1});let Ce=Math.max(1,...Object.values(de)),a={nodes:t.map(c=>({id:c.id,name:c.title||"",type:c.kind||"other",r:9+Math.min(10,(de[c.id]||0)/Ce*8),x:0,y:0,vx:0,vy:0})),edges:n.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:M,ctx:s,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((c,N)=>(c[N.id]=N,c),{}),a.nodes.forEach((c,N)=>{let C=N/a.nodes.length*Math.PI*2-Math.PI/2;c.x=Math.cos(C)*60,c.y=Math.sin(C)*60});let ct=[...new Set(a.nodes.map(c=>c.type))];a.clustered=ct.length>1,a.typeCenters={},ct.forEach((c,N)=>{let C=N/ct.length*Math.PI*2-Math.PI/2;a.typeCenters[c]={x:Math.cos(C)*160,y:Math.sin(C)*160}}),g.current=a;let vt=0,zt=0,It=()=>{let c=r.clientWidth,N=r.clientHeight;a.w=c,a.h=N,r.width=c*M,r.height=N*M,s.setTransform(M,0,0,M,0,0),(vt===0||zt===0)&&c>0&&N>0&&a.tickCount>0&&requestAnimationFrame(()=>ce()),vt=c,zt=N};It();let Dt=new ResizeObserver(It);Dt.observe(r.parentElement);let v=(c,N)=>c&&c.length>N?c.slice(0,N)+"\u2026":c,O=(c,N,C,z,F)=>{if(c.beginPath(),F==="rect")c.rect(N-z,C-z*.75,z*2,z*1.5);else if(F==="diamond")c.moveTo(N,C-z),c.lineTo(N+z,C),c.lineTo(N,C+z),c.lineTo(N-z,C),c.closePath();else if(F==="hexagon"){for(let oe=0;oe<6;oe++){let V=Math.PI/3*oe-Math.PI/2,ge=N+z*Math.cos(V),we=C+z*Math.sin(V);oe===0?c.moveTo(ge,we):c.lineTo(ge,we)}c.closePath()}else c.arc(N,C,z,0,Math.PI*2)},X=(c,N,C,z)=>O(s,c,N,C,z),Se=new Map,ve=(c,N)=>{let C=c+"|"+Math.round(N),z=Se.get(C);if(!z){let F=parseInt(c.slice(1,3),16),oe=parseInt(c.slice(3,5),16),V=parseInt(c.slice(5,7),16);z=s.createRadialGradient(-N*.3,-N*.3,0,0,0,N*1.2),z.addColorStop(0,"rgba("+Math.min(255,F+70)+","+Math.min(255,oe+70)+","+Math.min(255,V+70)+",0.95)"),z.addColorStop(1,c),Se.set(C,z)}return z},ce=()=>{if(!a.nodes.length)return;let c=1/0,N=-1/0,C=1/0,z=-1/0;a.nodes.forEach(we=>{c=Math.min(c,we.x),N=Math.max(N,we.x),C=Math.min(C,we.y),z=Math.max(z,we.y)});let F=20,oe=N-c+F*2,V=z-C+F*2,ge=Math.min(a.w/oe,a.h/V);a.zoom=Math.max(.35,Math.min(1.8,ge)),a.panX=a.w/2-(c+N)/2*a.zoom,a.panY=a.h/2-(C+z)/2*a.zoom};D.current=ce;let Ve=(c,N)=>{let C=document.createElement("canvas");return C.width=Math.max(1,Math.ceil(c)),C.height=Math.max(1,Math.ceil(N)),C},ot=new Mt({createCanvas:Ve,max:400}),Qe=new Mt({createCanvas:Ve,max:600}),Re=new Map,qe=Ve(1,1),Tt="";a.wheelUntil=0,a.createdAt=Date.now();let qt=()=>{s.clearRect(0,0,a.w,a.h),a.searchTerm=ye.current,a.kindFilter=b.current,a.timeMode=te.current,a.tagFilter=K.current;let c=a.tagFilter,N=a.kindFilter,C=m=>String(m||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");s.save(),s.strokeStyle=Y()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",s.lineWidth=.5;for(let m=0;m<a.w;m+=24)s.beginPath(),s.moveTo(m,0),s.lineTo(m,a.h),s.stroke();for(let m=0;m<a.h;m+=24)s.beginPath(),s.moveTo(0,m),s.lineTo(a.w,m),s.stroke();s.restore(),s.save(),s.translate(a.panX,a.panY),s.scale(a.zoom,a.zoom);let z={};a.nodes.forEach(m=>z[m.id]=m);let F=a.nodes.length>40,oe=F?1.5:.55,V=a.selectedId||a.hoverId,ge=ua({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),we=(()=>{let m=(a.searchTerm||"").toLowerCase();if(!m)return null;let G=[];for(let U of a.nodes){let pe=(a.domainById[U.id]||{}).kind||"other";if(((U.name||"").toLowerCase().includes(m)||String(We[pe]||"").toLowerCase().includes(m)||String(pe).toLowerCase().includes(m))&&G.push(U.id),G.length>200)break}return G})(),it=ga(a.nodes,{limit:ma(a.nodes.length),focusId:V,hoverId:a.hoverId,searchHits:we,degree:de}),ae=Date.now()-a.createdAt<800||a.dragging===!0||(a.wheelUntil||0)>Date.now(),ie=Y(),Ie=!a.timeMode&&!ae,_e=m=>{let G=parseInt(m.slice(1,3),16),U=parseInt(m.slice(3,5),16),ee=parseInt(m.slice(5,7),16);return"rgba("+Math.min(255,G+70)+","+Math.min(255,U+70)+","+Math.min(255,ee+70)+",0.95)"},Ue=new Map,et=(m,G)=>{let U=m+"|"+G,ee=Ue.get(U);return ee===void 0&&(s.font=m,ee=s.measureText(G).width,Ue.set(U,ee)),ee},De=a.nodes.length<=250,Xe=ya({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,dpr:M,tick:a.tickCount,filter:N+"|"+(c||"")+"|"+(a.timeMode?"t":"")+"|"+(ae?"fast":"full"),dark:ie,dataVersion:0}),Ge=qe.width!==Math.ceil(a.w*M)||qe.height!==Math.ceil(a.h*M),lt=ae||Ge||Xe!==Tt;lt&&(Tt=Xe,Ge&&(qe=Ve(a.w*M,a.h*M)));let Te=lt?qe.getContext("2d"):null;Te&&(Te.setTransform(1,0,0,1,0,0),Te.clearRect(0,0,qe.width,qe.height),Te.setTransform(M,0,0,M,0,0),Te.translate(a.panX,a.panY),Te.scale(a.zoom,a.zoom));let Ht=new Map,za=0;if(a.edges.forEach(m=>{let G=z[m.sourceNodeId],U=z[m.targetNodeId];if(!G||!U||ae&&za++%3!==0||!jt(G.x,G.y,10,ge)&&!jt(U.x,U.y,10,ge))return;if(N!=="all"){let Je=a.domainById[m.sourceNodeId]&&a.domainById[m.sourceNodeId].kind,Ke=a.domainById[m.targetNodeId]&&a.domainById[m.targetNodeId].kind;if(Je!==N&&Ke!==N)return}if(c){let Je=a.domainById[m.sourceNodeId]&&(a.domainById[m.sourceNodeId].tags||[]).includes(c),Ke=a.domainById[m.targetNodeId]&&(a.domainById[m.targetNodeId].tags||[]).includes(c);if(!Je&&!Ke)return}let ee=U.x-G.x,pe=U.y-G.y,fe=Math.sqrt(ee*ee+pe*pe)||1,je=F?12:18,Oe=-pe/fe*je,pt=ee/fe*je,ut=(G.x+U.x)/2+Oe,Bt=(G.y+U.y)/2+pt,Ct=yt.colors[a.domainById[G.id]&&a.domainById[G.id].kind||"other"],rt=V&&(m.sourceNodeId===V||m.targetNodeId===V),Wt=V?rt?.6:.08:F?.14:.24,ke=parseInt(Ct.slice(1,3),16),Me=parseInt(Ct.slice(3,5),16),st=parseInt(Ct.slice(5,7),16),dt=rt?1.6+(m.weight||1):.8+(m.weight||1)*.5,Le=ke+","+Me+","+st+","+Wt+","+dt,He=Ht.get(Le);He||(He={path:new Path2D,stroke:"rgba("+ke+","+Me+","+st+","+Wt+")",width:dt},Ht.set(Le,He)),He.path.moveTo(G.x,G.y),He.path.quadraticCurveTo(ut,Bt,U.x,U.y)}),Te&&Ht.forEach(m=>{Te.strokeStyle=m.stroke,Te.lineWidth=m.width,Te.stroke(m.path)}),s.setTransform(1,0,0,1,0,0),s.drawImage(qe,0,0),s.setTransform(M,0,0,M,0,0),V&&!ae){s.fillStyle=ie?"rgba(18,18,22,0.55)":"rgba(255,255,255,0.55)",s.fillRect(0,0,a.w,a.h);let m=new Path2D;a.edges.forEach(G=>{if(G.sourceNodeId!==V&&G.targetNodeId!==V)return;let U=z[G.sourceNodeId],ee=z[G.targetNodeId];if(!U||!ee)return;let pe=ee.x-U.x,fe=ee.y-U.y,je=Math.sqrt(pe*pe+fe*fe)||1,Oe=F?12:18,pt=-fe/je*Oe,ut=pe/je*Oe;m.moveTo(U.x,U.y),m.quadraticCurveTo((U.x+ee.x)/2+pt,(U.y+ee.y)/2+ut,ee.x,ee.y)}),s.save(),s.translate(a.panX,a.panY),s.scale(a.zoom,a.zoom),s.strokeStyle="rgba(96,165,250,0.65)",s.lineWidth=1.8,s.stroke(m),s.restore()}s.translate(a.panX,a.panY),s.scale(a.zoom,a.zoom);let kt=null;V&&(kt=new Set,a.edges.forEach(m=>{m.sourceNodeId===V?kt.add(m.targetNodeId):m.targetNodeId===V&&kt.add(m.sourceNodeId)}));let oa=[];if(a.nodes.forEach(m=>{if(!jt(m.x,m.y,m.r+2,ge))return;let G=a.domainById[m.id]||{},U=G.kind||"other",ee=a.timeMode?fn(G.updated):yt.colors[U],pe=yt.shapes[U],fe=a.selectedId===m.id,je=a.hoverId===m.id,Oe=a.searchTerm||"",pt=!Oe||(m.name||"").toLowerCase().includes(Oe)||String(We[U]||"").toLowerCase().includes(Oe)||String(U).toLowerCase().includes(Oe),ut=N==="all"||U===N,Bt=!c||(G.tags||[]).includes(c),Ct=V&&m.id!==V&&!(kt&&kt.has(m.id))||Oe&&!pt||!ut||!Bt;if(s.save(),s.globalAlpha=Ct?.08:1,(fe||je)&&De&&(s.shadowColor=ee,s.shadowBlur=fe?20:14),s.translate(m.x,m.y),ae)s.fillStyle=ee,s.beginPath(),s.arc(0,0,Math.max(2,m.r*.55),0,Math.PI*2),s.fill();else if(Ie){let ke=Math.ceil(m.r*2+6),Me=Math.max(1,Math.min(3,Math.round(a.zoom*M))),st=fa({kind:U,radius:m.r,zoom:a.zoom,dark:ie}),dt=ot.get(st,ke*Me,ke*Me,(Le,He)=>{let Je=He/ke,Ke=He/2;Le.setTransform(Je,0,0,Je,Ke,Ke),O(Le,0,0,m.r,pe);let St=Le.createRadialGradient(-m.r*.3,-m.r*.3,0,0,0,m.r*1.2);St.addColorStop(0,_e(ee)),St.addColorStop(1,ee),Le.fillStyle=St,Le.fill()});s.drawImage(dt.canvas,-ke/2,-ke/2,ke,ke)}else X(0,0,m.r,pe),s.fillStyle=ve(ee,m.r),s.fill();s.restore(),fe?(s.save(),X(m.x,m.y,m.r+3,pe),s.strokeStyle=ee,s.lineWidth=3,s.shadowColor=ee,s.shadowBlur=12,s.stroke(),s.restore()):je?(s.save(),X(m.x,m.y,m.r+2,pe),s.strokeStyle=ee,s.lineWidth=2,s.stroke(),s.restore()):Oe&&pt?(s.save(),X(m.x,m.y,m.r+2,pe),s.strokeStyle="#e11d48",s.lineWidth=2,s.stroke(),s.restore()):a.multi.indexOf(m.id)>=0&&(s.save(),X(m.x,m.y,m.r+2,pe),s.strokeStyle="#60a5fa",s.lineWidth=2,s.shadowColor="#60a5fa",s.shadowBlur=8,s.stroke(),s.restore());let rt=v(m.name,16);if(!ae&&(fe||je||it.has(m.id)&&a.zoom>oe||!F&&a.zoom>.6)&&ut&&Bt){let ke=1/a.zoom,Me=Math.max(1,Math.min(4,Math.round(ke*M))),st="500 "+(12*Me).toFixed(0)+"px -apple-system,Segoe UI,sans-serif",dt=rt+"|"+Me,Le=Re.get(dt);Le===void 0&&(s.font=st,Le=s.measureText(rt).width,Re.set(dt,Le));let He=Math.ceil(Le+16*Me),Je=Math.ceil(18*Me),Ke=fe||je,St=ba({text:rt,fontPx:12,dark:ie})+(Ke?"|sel":""),Ia=Qe.get(St,He,Je,(se,Pt,Et)=>{se.setTransform(1,0,0,1,0,0),se.clearRect(0,0,Pt,Et),se.font=st,se.textAlign="center",se.textBaseline="middle",se.fillStyle=ie?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",se.beginPath(),se.roundRect?se.roundRect(.5,.5,Pt-1,Et-1,4*Me):se.rect(.5,.5,Pt-1,Et-1),se.fill(),se.strokeStyle=ie?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",se.lineWidth=Math.max(1,Me),se.stroke(),se.fillStyle=ie?Ke?"#eee":"#bbb":Ke?"#111":"#444",se.fillText(rt,Pt/2,Et/2+.5)}),mt=He/Me*ke,$t=Je/Me*ke,Rt=m.y+m.r+8*ke,ia=!0;for(let se of oa)if(m.x-mt/2<se.x+se.w&&m.x+mt/2>se.x&&Rt<se.y+se.h&&Rt+$t>se.y){ia=!1;break}if(!ia&&!fe&&!je)return;oa.push({x:m.x-mt/2,y:Rt,w:mt,h:$t}),s.drawImage(Ia.canvas,m.x-mt/2,Rt,mt,$t)}}),s.restore(),a.marquee){let m=a.marquee,G=Math.min(m.sx,m.ex),U=Math.min(m.sy,m.ey),ee=Math.abs(m.ex-m.sx),pe=Math.abs(m.ey-m.sy);s.save(),s.setLineDash([4,4]),s.strokeStyle="rgba(96,165,250,0.9)",s.lineWidth=1,s.fillStyle="rgba(96,165,250,0.12)",s.fillRect(G,U,ee,pe),s.strokeRect(G,U,ee,pe),s.restore()}if(a.hoverId&&Be.current){let m=a.domainById[a.hoverId],G=a.nodes.find(function(U){return U.id===a.hoverId});if(m&&G){let U=a.edges.filter(function(fe){return fe.sourceNodeId===m.id||fe.targetNodeId===m.id}).length,ee=G.x*a.zoom+a.panX,pe=G.y*a.zoom+a.panY;Be.current.style.display="block",Be.current.style.left=ee+14+"px",Be.current.style.top=pe-6+"px",Be.current.innerHTML="<b>"+C(m.title||m.name||"")+'</b><br/><span style="opacity:.8">'+C(m.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",U)+"</span>"}}else Be.current&&(Be.current.style.display="none")},Pe=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(Gt))};a.wake=Pe,a.render=qt;let Xt=()=>{let c=a.nodes.length;a.tickCount++;let C=.9-Math.min(.4,a.tickCount/1500),z=c>1e3?3e3:c>100?2e3:c>50?1200:800,F=c>100?.002:.005,oe=c>1e3?.012:c>100?.005:.01,V=c>1e3?6:c>200?12:24,ge={};a.nodes.forEach(ae=>ge[ae.id]=ae);for(let ae=0;ae<c;ae++){if(a.dragNode===a.nodes[ae])continue;let ie=a.nodes[ae],Ie=0,_e=0;for(let De=0;De<c;De++){if(ae===De)continue;let Xe=ie.x-a.nodes[De].x,Ge=ie.y-a.nodes[De].y,lt=Math.sqrt(Xe*Xe+Ge*Ge)||1,Te=z/(lt*lt);Ie+=Xe/lt*Te,_e+=Ge/lt*Te}if(a.clustered&&a.typeCenters[ie.type]){let De=a.typeCenters[ie.type];Ie+=(De.x-ie.x)*.006,_e+=(De.y-ie.y)*.006}else Ie-=ie.x*oe,_e-=ie.y*oe;let Ue=(ie.vx+Ie)*C,et=(ie.vy+_e)*C;Ue=Math.max(-V,Math.min(V,Ue)),et=Math.max(-V,Math.min(V,et)),ie.vx=Ue,ie.vy=et}a.edges.forEach(ae=>{let ie=ge[ae.sourceNodeId],Ie=ge[ae.targetNodeId];if(!ie||!Ie)return;let _e=Ie.x-ie.x,Ue=Ie.y-ie.y,et=Math.sqrt(_e*_e+Ue*Ue)||1,De=(et-100)*F,Xe=_e/et*De,Ge=Ue/et*De;a.dragNode!==ie&&(ie.vx+=Xe,ie.vy+=Ge),a.dragNode!==Ie&&(Ie.vx-=Xe,Ie.vy-=Ge)});let we=0;a.nodes.forEach(ae=>{a.dragNode!==ae&&(ae.x+=ae.vx,ae.y+=ae.vy,we+=ae.vx*ae.vx+ae.vy*ae.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,ce()),(c?Math.sqrt(we/c):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},Gt=()=>{if(a.running){try{Xt(),qt()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(Gt)}},wt=(c,N)=>{let C=r.getBoundingClientRect();return{x:(c-C.left-a.panX)/a.zoom,y:(N-C.top-a.panY)/a.zoom}},Lt=c=>{let N=a.domainById[c];return!(!N||b.current!=="all"&&N.kind!==b.current||K.current&&!(N.tags||[]).includes(K.current))},At=(c,N,C)=>Math.max(N,Math.min(C,c)),Jt=c=>{a.mouseX=c.clientX,a.mouseY=c.clientY;let N=wt(c.clientX,c.clientY),C=null;for(let z=a.nodes.length-1;z>=0;z--){let F=a.nodes[z];if(!Lt(F.id))continue;let oe=F.x-N.x,V=F.y-N.y;if(oe*oe+V*V<F.r*F.r+36){C=F.id;break}}C!==a.hoverId&&(a.hoverId=C,Pe())},Zt=c=>{if(c.button!==0)return;let N=wt(c.clientX,c.clientY),C=null;for(let z=a.nodes.length-1;z>=0;z--){let F=a.nodes[z];if(!Lt(F.id))continue;let oe=F.x-N.x,V=F.y-N.y;if(oe*oe+V*V<F.r*F.r+25){C=F;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-N.x,dy:C.y-N.y})},Qt=c=>{if(a.marquee){a.marquee.ex=c.clientX,a.marquee.ey=c.clientY,Pe();return}if(!a.dragStart)return;let N=c.clientX-a.dragStart.x,C=c.clientY-a.dragStart.y;if(Math.abs(N)+Math.abs(C)>3&&(a.dragging=!0),a.dragNode){let z=wt(c.clientX,c.clientY);a.dragNode.x=z.x+a.dragOffset.dx,a.dragNode.y=z.y+a.dragOffset.dy,Pe()}else a.dragging&&(a.panX=At(a.dragStart.px+N,-1e5,1e5),a.panY=At(a.dragStart.py+C,-1e5,1e5),Pe())},ea=c=>{if(a.marquee){let C=a.marquee;a.marquee=null;let z=r.getBoundingClientRect(),F=Math.min(C.sx,C.ex)-z.left,oe=Math.max(C.sx,C.ex)-z.left,V=Math.min(C.sy,C.ey)-z.top,ge=Math.max(C.sy,C.ey)-z.top,we=a.nodes.filter(it=>{let ae=it.x*a.zoom+a.panX,ie=it.y*a.zoom+a.panY;return ae>=F&&ae<=oe&&ie>=V&&ie<=ge}).map(it=>it.id);a.multi=we,he(we),Pe();return}let N=a.dragStart&&!a.dragging;if(a.shiftClick){let C=a.shiftClick;a.shiftClick=null;let z=Array.isArray(a.multi)?a.multi.slice():[];z.includes(C)||z.push(C),a.multi=z,he(z),Pe();return}if(N){let C=wt(c.clientX,c.clientY),z=null;for(let F=a.nodes.length-1;F>=0;F--){let oe=a.nodes[F];if(!Lt(oe.id))continue;let V=oe.x-C.x,ge=oe.y-C.y;if(V*V+ge*ge<oe.r*oe.r+20){z=oe;break}}z?(a.selectedId=z.id,H(z.id),Pe()):(a.selectedId=null,a.hoverId=null,c.shiftKey||(a.multi=[],he([])),H(null),Pe())}a.dragStart=null,a.dragging=!1,a.dragNode=null},ta=c=>{c.preventDefault();let N=wt(c.clientX,c.clientY),C=null;for(let z=a.nodes.length-1;z>=0;z--){let F=a.nodes[z];if(!Lt(F.id))continue;let oe=F.x-N.x,V=F.y-N.y;if(oe*oe+V*V<F.r*F.r+25){C=F;break}}if(C){let z=a.domainById[C.id];z&&le({x:c.clientX,y:c.clientY,id:C.id,path:z.id,title:z.title})}else le(null)},aa=c=>{c.preventDefault(),a.wheelUntil=Date.now()+160;let N=r.getBoundingClientRect(),C=(c.clientX-N.left-a.panX)/a.zoom,z=(c.clientY-N.top-a.panY)/a.zoom,F=Math.max(.3,Math.min(3,a.zoom*(c.deltaY<0?1.1:1/1.1)));a.panX=At(a.panX+C*(a.zoom-F),-1e5,1e5),a.panY=At(a.panY+z*(a.zoom-F),-1e5,1e5),a.zoom=F,Pe()};r.addEventListener("mousemove",Jt),r.addEventListener("mousedown",Zt),window.addEventListener("mousemove",Qt),window.addEventListener("mouseup",ea),r.addEventListener("wheel",aa,{passive:!1}),r.addEventListener("contextmenu",ta),T.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],he([]),ce(),Pe()};for(let c=0;c<200;c++)Xt();ce(),Pe();let na=()=>W(!1);return window.addEventListener("mousedown",na),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),Dt.disconnect(),r.removeEventListener("mousemove",Jt),r.removeEventListener("mousedown",Zt),window.removeEventListener("mousemove",Qt),window.removeEventListener("mouseup",ea),r.removeEventListener("wheel",aa),r.removeEventListener("contextmenu",ta),window.removeEventListener("mousedown",na)}},[t,n]),(0,o.useEffect)(()=>{A!==void 0&&D.current&&requestAnimationFrame(()=>D.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 ",n.length," ",l("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:l("search"),value:j,onChange:r=>J(r.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>W(r=>!r),"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: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${$==="all"&&!_?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{Z("all"),B(!1)},children:l("all")}),Object.keys(Ze).map(r=>(0,e.jsxs)("button",{type:"button",className:`lg${$===r?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>Z(s=>s===r?"all":r),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:yt.colors[r]||Ze[r]}}),l(We[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${_?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>B(r=>!r),children:["\u23F1 ",l("timeDim")]}),tt.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:tt.map(r=>(0,e.jsxs)("button",{type:"button",className:`lg${f===r.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>E(s=>s===r.tag?"":r.tag),title:r.tag,children:["#",r.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:r.n})]},r.tag))})]}),($!=="all"||_||f)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{Z("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:!!w,onChange:r=>x&&x(r.target.checked)}),l("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${_?" me-on":""}`,onClick:()=>B(r=>!r),children:l("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let r=S.current;if(r)try{r.toBlob(s=>{s&&me({url:URL.createObjectURL(s),blob:s})},"image/png")}catch{}},children:l("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>D.current&&D.current(),children:l("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{H(null),Z("all"),T.current&&T.current()},children:l("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:S,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:Be,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)"}}),at&&(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:r=>r.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{k.current({path:Q.path,title:Q.title}),le(null)},children:l("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{Q.id&&(g.current.selectedId=Q.id,H(Q.id)),le(null);let r=g.current;r&&r.wake&&r.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 r=g.current,s=r&&Array.isArray(r.multi)?r.multi.slice():[],M=Q.id;if(M&&!s.includes(M)&&s.push(M),le(null),s.length<2){d(l("mergeNeed"),!1);return}if(!window.confirm(l("mergeConfirm")))return;let Y=I.current&&I.current(s);Y&&Y.then?Y.then(de=>de?d(l("merged")):d(l("mergeFail"),!1)).catch(()=>d(l("mergeFail"),!1)):Y&&d(l("merged"))},children:l("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let r=Q.path;le(null),window.confirm(l("deleteConfirm"))&&(async()=>{try{(L.current?await L.current(r):!1)?d(l("deleted")):d(l("deleteFail"),!1)}catch{d(l("deleteFail"),!1)}})()},children:l("delete")})]}),Ee.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:[Ee.length," ",l("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=Ee.map(Ce=>P[Ce]).filter(Boolean).map(Ce=>Ce.title||Ce.name).join(`
|
|
304
|
+
`),M=new Blob([s],{type:"text/plain;charset=utf-8"}),Y=URL.createObjectURL(M),de=document.createElement("a");de.href=Y,de.download="memory-selected.txt",document.body.appendChild(de),de.click(),document.body.removeChild(de),setTimeout(()=>URL.revokeObjectURL(Y),1e3),d(Ee.length+l("exportedSel"))},children:l("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(Ee.length<2){d(l("mergeNeed"),!1);return}let r=Ee.map(M=>P[M]?P[M].id:M);if(!window.confirm(l("mergeConfirm")))return;he([]);let s=g.current;s&&(s.multi=[]),fetch(`${q}/merge?paths=${encodeURIComponent(r.join(","))}`).then(M=>M.json()).then(M=>{M&&M.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 r=Ee.map(M=>P[M]?P[M].id:M);he([]);let s=g.current;s&&(s.multi=[]),(async()=>{let M=0;for(let Y of r)try{(L.current?await L.current(Y):!1)&&M++}catch{}d(M+l("deletedSelected"),M>0)})()},children:l("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let r=g.current;r&&(r.multi=[]),he([]);let s=g.current;s&&s.render&&s.render()},children:l("clearSelection")})]}),ne&&(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[ne]?P[ne].title||P[ne].name:ne}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:P[ne]?l(We[P[ne].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:l("graphHint")}),(n.filter(r=>r.source===ne||r.target===ne)||[]).slice(0,8).map((r,s)=>{let M=r.source===ne?r.target:r.source,Y=P[M];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:de=>{de.preventDefault();let Ce=g.current;Ce&&(Ce.selectedId=M,Ce.hoverId=M,Ce.wake&&Ce.wake()),H(M)},children:Y?(Y.title||Y.name).slice(0,28):M},s)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:l("graphTip")}),ze&&(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 "+(ze.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:ze.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:ze.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:ze.msg})]}),xe&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{xe.url&&URL.revokeObjectURL(xe.url),me(null),$e(!1)},children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:Ne?"100vw":900,width:Ne?"100vw":"92vw",maxHeight:Ne?"100%":"90vh",height:Ne?"100%":void 0,borderRadius:Ne?0:14},onClick:r=>r.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(nt==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{R("full"),$e(r=>!r),d(l("fullscreen"))},children:l(nt==="full"?"done":Ne?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let r=xe.blob;r&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":r})]).then(()=>{R("copy"),d(l("copied"))}).catch(()=>{d(l("copyFail"),!1)}):d(l("copyFail"),!1)},children:l(nt==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{xe.url&&URL.revokeObjectURL(xe.url),me(null),$e(!1)},children:l("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Ne?"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:Ne?"calc(100% - 64px)":"70vh",borderRadius:Ne?0:8,cursor:"zoom-in"},onClick:()=>$e(r=>!r)})})]})]})]})}function fn(t){let n=new Date(t||0).getTime();if(!n)return"#94a3b8";let i=(Date.now()-n)/864e5;return i<3?"#10b981":i<14?"#f59e0b":i<30?"#f97316":"#94a3b8"}function xa({label:t,value:n=[],options:i,onChange:u,placeholder:p,z:l=20}){let[h,w]=(0,o.useState)(!1),x=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!h)return;let k=L=>{x.current&&!x.current.contains(L.target)&&w(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[h]);let A=Array.isArray(n)?n:[],S=A.includes("__all__"),y=S?i.find(k=>k.value==="__all__")?.label||"":A.length?A.map(k=>i.find(L=>L.value===k)?.label||k).join("\u3001"):"",g=(k,L)=>{if(k.value==="__all__"){u(L?["__all__"]:[]);return}let I=new Set(A);I.has("__all__")&&I.delete("__all__"),L?I.add(k.value):I.delete(k.value),u([...I])},D=i.find(k=>k.value==="__all__"),T=i.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:x,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:y||p||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),h&&(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:[D&&(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:S,onChange:k=>g(D,k.target.checked)}),(0,e.jsx)("span",{children:D.label})]}),T.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:A.includes(k.value),onChange:L=>g(k,L.target.checked)}),(0,e.jsx)("span",{children:k.label})]},k.value))]})]})]})}function bn(t){let n=new Date(t||0).getTime();return!!n&&(Date.now()-n)/864e5<3}async function yn(t,n,i){if(i&&typeof window.showSaveFilePicker=="function")try{let l=await window.showSaveFilePicker({suggestedName:n}),h=await l.createWritable();return await h.write(t),await h.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 u=URL.createObjectURL(t),p=document.createElement("a");return p.href=u,p.download=n,document.body.appendChild(p),p.click(),document.body.removeChild(p),setTimeout(()=>URL.revokeObjectURL(u),1e3),{ok:!0,picked:!1,name:n}}function va(t,n){if(!n||!t)return t;let i=t.toLowerCase(),u=n.toLowerCase(),p=[],l=0;for(;l<t.length;){let h=i.indexOf(u,l);if(h<0){p.push(t.slice(l));break}h>l&&p.push(t.slice(l,h)),p.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(h,h+u.length)},h)),l=h+u.length}return p}function ht(t){if(!t)return"";let n=new Date(t);if(Number.isNaN(n.getTime()))return"";let i=new Date,u=n.toDateString()===i.toDateString(),p=h=>String(h).padStart(2,"0"),l=`${p(n.getHours())}:${p(n.getMinutes())}`;return u?l:`${n.getMonth()+1}-${n.getDate()} ${l}`}
|
|
305
305
|
|
|
306
306
|
return module.exports;
|
|
307
307
|
},
|