memory-eternal 0.10.7 → 0.10.8

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/web/app.js CHANGED
@@ -15,7 +15,7 @@ Error generating stack: `+o.message+`
15
15
  > \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`,f=y=>o(a.slice(0,y)+u);if(f(0).length>l)a=u;else{let y=0,h=a.length;for(;y<h;){let m=Math.ceil((y+h)/2);f(m).length<=l?y=m:h=m-1}a=a.slice(0,y)+u}s=o(a)}return s}function Bp(e={}){return["## \u73B0\u8C61",String(e.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: "+(e.version||"\uFF08\u89C1\u8BCA\u65AD\u4FE1\u606F\uFF09"),"",e.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(`
16
16
  `)}var Ks="https://github.com/EternalNight996/memory-eternal",Rg=["\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"+Ks,"","\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(`
17
17
  `),_g=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+Ks,"","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(`
18
- `);function Hp(e={}){let t=e.lang==="en"?"en":"zh",n=t==="en"?_g:Rg,r=e.repo||"EternalNight996/memory-eternal";return n=n.split(Ks).join("https://github.com/"+r),e.description&&(n=n.replace(t==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(e.description).trim())),e.diagnostics&&(n=n.replace(t==="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(e.diagnostics).trim())),n}function Wp({panX:e=0,panY:t=0,zoom:n=1,w:r=0,h:l=0,margin:o=60}={}){let a=n||1;return{x0:(0-e)/a-o,y0:(0-t)/a-o,x1:(r-e)/a+o,y1:(l-t)/a+o}}function wi(e,t,n,r){return r?e+n>=r.x0&&e-n<=r.x1&&t+n>=r.y0&&t-n<=r.y1:!0}function $p(e){let t=Number(e)||0;return t<=120?1/0:t<=300?160:t<=600?90:60}function Up(e,t={}){let n=Number.isFinite(t.limit)?t.limit:1/0,r=new Set,l=u=>{u&&r.size<n&&r.add(u)};if(l(t.focusId),l(t.hoverId),t.searchHits)for(let u of t.searchHits){if(r.size>=n)break;r.add(u)}let o=t.degree||{},a=u=>Number(o[u])||0,s=[];for(let u of Array.isArray(e)?e:[])u&&u.id&&!r.has(u.id)&&s.push(u);s.sort((u,f)=>a(f.id)-a(u.id));for(let u of s){if(r.size>=n)break;r.add(u.id)}return r}function Ig(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0||typeof e!="object"&&typeof t!="object")return e===t;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function Vp(e,t){let n={...e||{}},r={};for(let[l,o]of Object.entries(t||{}))Ig(e?e[l]:void 0,o)||(n[l]=o,r[l]=o);return{values:n,overlay:r}}var i=Xn(Ul(),1);var Z="/memory-eternal/api",Wg=100;var Ys={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",importedTotal:" \u5F20 / \u6587\u4EF6\u5171 ",importedTotalTail:" \u5F20",importedQuarantine:" \xB7 \u5F85\u5BA1\u6838 ",importedQuarantineTail:" \u5F20\uFF08\u9694\u79BB\u533A\uFF0C\u6279\u51C6\u540E\u624D\u53C2\u4E0E\u53EC\u56DE\uFF09",importedSkipped:" \xB7 \u8DF3\u8FC7 ",importedSkippedTail:" \u5F20\uFF08\u91CD\u590D\u6216\u7A7A\uFF09",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",pendingSyncNote:"\u6B64\u9875\u662F\u72EC\u7ACB Web \u9875\uFF1A\u4FDD\u5B58\u4F1A\u5199\u300C\u5F85\u5E94\u7528\u300D\u6587\u4EF6\u4EA4\u7ED9 DSH \u5BBF\u4E3B\u540C\u6B65\uFF1B\u82E5\u672C\u673A\u6CA1\u6709 DSH \u5BBF\u4E3B\u5728\u8FD0\u884C\uFF0C\u5219\u76F4\u63A5\u5199\u5165\u5171\u4EAB\u914D\u7F6E\u3001\u7ACB\u5373\u751F\u6548\u3002\u5BBF\u4E3B\u4FA7\u4E0D\u751F\u6548\u65F6\u53EF\u5728 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u91CC\u6539\u540C\u4E00\u9879\u3002",readonlyTitle:"\u5F53\u524D\u9875\u9762\u53EA\u8BFB\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u914D\u7F6E",readonlyBody:"\u8FD9\u4E2A\u8FDB\u7A0B\u6CA1\u6709 DSH \u7684\u8BBE\u7F6E\u670D\u52A1\uFF08settings.update \u4E0D\u5B58\u5728\uFF09\uFF0C\u914D\u7F6E\u53EA\u80FD\u5728\u672C\u673A DSH \u91CC\u4FEE\u6539\uFF1A\u684C\u9762\u7248 \u2192 \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u3002",readonlyBtn:"\u53EA\u8BFB",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",enabledLabel:"\u542F\u7528\u8BB0\u5FC6\u6838\u5FC3",vaultDirLabel:"\u8BB0\u5FC6\u5E93\u76EE\u5F55\uFF08\u5355\u5E93\uFF09",captureCooldownMs:"\u6C89\u6DC0\u51B7\u5374 (ms)",captureProvider:"\u84B8\u998F provider\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",captureModel:"\u84B8\u998F model\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",recallEmbedding:"\u8BED\u4E49\u53EC\u56DE provider\uFF08\u53EF\u9009\uFF09",sessionBudgetChars:"\u4F1A\u8BDD\u9884\u7B97 (\u5B57\u7B26)",saving:"\u4FDD\u5B58\u4E2D\u2026",savePending:"\u5DF2\u5199\u5165\u914D\u7F6E\u6587\u4EF6\uFF1B\u5BBF\u4E3B\u4ECD\u662F\u65E7\u7248\uFF0C\u91CD\u542F DSH \u540E\u5373\u4EE5\u65B0\u503C\u4E3A\u51C6\uFF08\u672C\u9762\u677F\u5DF2\u751F\u6548\uFF09",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",vcPage:"\u9875\u9762\u811A\u672C",vcPageStale:"\u26A0 \u5F53\u524D\u9875\u9762\u4ECD\u5728\u8FD0\u884C\u65E7\u7248\u811A\u672C\uFF08\u9875\u9762 v{page} / \u78C1\u76D8 v{disk}\uFF09\uFF1A\u6309 Ctrl+F5 \u5237\u65B0\u9875\u9762\u5373\u751F\u6548\uFF1B\u82E5\u300C\u8FD0\u884C\u4E2D\u300D\u4ECD\u662F\u65E7\u7248\u53F7\uFF0C\u5219\u8FD8\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",vcLoaded:"\u8FD0\u884C\u4E2D\uFF08\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF09",vcResident:"\u5E38\u9A7B\u5B9E\u4F8B",vcOnDisk:"\u78C1\u76D8\u5B89\u88C5",vcLatest:"npm \u6700\u65B0",vcStale:"\u78C1\u76D8\u5DF2\u5B89\u88C5 v{disk}\uFF0C\u4F46\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\u4ECD\u52A0\u8F7D v{loaded} \u2014\u2014 \u70B9\u300C\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\u300D\u5373\u53EF\u7528\u65B0\u4EE3\u7801\u91CD\u542F\u5B83\uFF08\u4E0D\u7528\u91CD\u542F DSH\uFF09",vcRestart:"\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B",vcRestarting:"\u91CD\u542F\u4E2D\u2026",vcRestartSent:"\u5DF2\u8C03\u5EA6\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\uFF1A\u7EA6 3-8 \u79D2\u540E\u65B0\u8FDB\u7A0B\u63A5\u7BA1\uFF0C\u8BF7\u7A0D\u7B49\u518D\u5237\u65B0\u9875\u9762\uFF08Ctrl+F5\uFF09",vcRestartCurrent:"\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u7ECF\u662F\u6700\u65B0\u7248\uFF0C\u65E0\u9700\u91CD\u542F",vcRestartFail:"\u91CD\u542F\u8BF7\u6C42\u5931\u8D25",vcRestartNoRoute:"\u5F53\u524D\u9875\u9762\u5BF9\u63A5\u7684\u8FDB\u7A0B\u8FD8\u662F\u65E7\u7248\uFF08\u6CA1\u6709\u8FD9\u4E2A\u63A5\u53E3\uFF09\uFF1A\u8BF7\u91CD\u542F\u684C\u9762\u7248 / DSH \u540E\u518D\u8BD5\uFF0C\u6216\u6267\u884C {cmd}",vcHostStale:"\u4E0A\u65B9\u7684\u300C\u8FD0\u884C\u4E2D\u300D\u6765\u81EA\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF1B\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u662F\u65B0\u7248 \u2014\u2014 \u8981\u8BA9\u5B83\u4E5F\u53D8\u6210\u65B0\u7248\u53F7\uFF0C\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",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",recallSummaryLen:"\u53EC\u56DE\u6458\u8981\u957F\u5EA6",recallBody:"\u53EC\u56DE\u542B\u6B63\u6587",secretHint:"\u51ED\u8BC1\u53D6\u7528\u63D0\u793A\uFF08\u6CE8\u5165\u6BCF\u4E2A\u4F1A\u8BDD\uFF09",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",autoRestartOnDrift:"\u7248\u672C\u6F02\u79FB\u81EA\u52A8\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B",autoMcpSetup:"\u81EA\u52A8\u6302\u8F7D MCP",saveConfig:"\u4FDD\u5B58\u914D\u7F6E",saveFail:"\u4FDD\u5B58\u5931\u8D25",savedOk:"\u5DF2\u4FDD\u5B58",savedDirect:"\u672C\u673A\u6CA1\u6709 DSH \u5BBF\u4E3B\u5728\u8FD0\u884C\uFF0C\u5DF2\u76F4\u63A5\u5199\u5165\u5171\u4EAB\u914D\u7F6E\uFF08hooks / MCP / \u72EC\u7ACB\u9875\u7ACB\u5373\u751F\u6548\uFF09",saveQueued:"\u5DF2\u4EA4\u7ED9 DSH \u5BBF\u4E3B\u540C\u6B65\uFF0C\u5C1A\u672A\u786E\u8BA4\u751F\u6548",saveHostGuard:"\u8BE5\u5BBF\u4E3B\u4E0D\u5141\u8BB8\u63D2\u4EF6\u4ECE\u81EA\u5DF1\u7684\u56DE\u8C03\u4E0A\u4E0B\u6587\u91CC\u5199\u914D\u7F6E\uFF1B\u8BF7\u5728\u300CDSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u300D\u91CC\u6539\u540C\u4E00\u9879\uFF0C\u6216\u7F16\u8F91 profile \u7684\u914D\u7F6E\u8865\u4E01\u5C42",saveFailHint:"\u5BBF\u4E3B\u4FA7\u672A\u5E94\u7528\uFF0C\u8BE6\u89C1\u300C\u53CD\u9988\u5F02\u5E38\u300D\u91CC\u7684\u8BCA\u65AD\u4FE1\u606F",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\uFF1B\u5DF2\u6709\u5E38\u9A7B watchdog \u4E0D\u4F1A\u88AB\u81EA\u52A8\u505C\u6389\uFF0C\u9700 dsh-memory stop / restart\uFF08#19\uFF09",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]
18
+ `);function Hp(e={}){let t=e.lang==="en"?"en":"zh",n=t==="en"?_g:Rg,r=e.repo||"EternalNight996/memory-eternal";return n=n.split(Ks).join("https://github.com/"+r),e.description&&(n=n.replace(t==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(e.description).trim())),e.diagnostics&&(n=n.replace(t==="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(e.diagnostics).trim())),n}function Wp({panX:e=0,panY:t=0,zoom:n=1,w:r=0,h:l=0,margin:o=60}={}){let a=n||1;return{x0:(0-e)/a-o,y0:(0-t)/a-o,x1:(r-e)/a+o,y1:(l-t)/a+o}}function wi(e,t,n,r){return r?e+n>=r.x0&&e-n<=r.x1&&t+n>=r.y0&&t-n<=r.y1:!0}function $p(e){let t=Number(e)||0;return t<=120?1/0:t<=300?160:t<=600?90:60}function Up(e,t={}){let n=Number.isFinite(t.limit)?t.limit:1/0,r=new Set,l=u=>{u&&r.size<n&&r.add(u)};if(l(t.focusId),l(t.hoverId),t.searchHits)for(let u of t.searchHits){if(r.size>=n)break;r.add(u)}let o=t.degree||{},a=u=>Number(o[u])||0,s=[];for(let u of Array.isArray(e)?e:[])u&&u.id&&!r.has(u.id)&&s.push(u);s.sort((u,f)=>a(f.id)-a(u.id));for(let u of s){if(r.size>=n)break;r.add(u.id)}return r}function Ig(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0||typeof e!="object"&&typeof t!="object")return e===t;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function Vp(e,t){let n={...e||{}},r={};for(let[l,o]of Object.entries(t||{}))Ig(e?e[l]:void 0,o)||(n[l]=o,r[l]=o);return{values:n,overlay:r}}var i=Xn(Ul(),1);var J="/memory-eternal/api",Wg=100;var Ys={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",importedTotal:" \u5F20 / \u6587\u4EF6\u5171 ",importedTotalTail:" \u5F20",importedQuarantine:" \xB7 \u5F85\u5BA1\u6838 ",importedQuarantineTail:" \u5F20\uFF08\u9694\u79BB\u533A\uFF0C\u6279\u51C6\u540E\u624D\u53C2\u4E0E\u53EC\u56DE\uFF09",importedSkipped:" \xB7 \u8DF3\u8FC7 ",importedSkippedTail:" \u5F20\uFF08\u91CD\u590D\u6216\u7A7A\uFF09",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",pendingSyncNote:"\u6B64\u9875\u662F\u72EC\u7ACB Web \u9875\uFF1A\u4FDD\u5B58\u540E\u7531 DSH \u5BBF\u4E3B\u5E94\u7528\uFF08\u65B0\u7248\u5BBF\u4E3B\u4F1A\u88AB\u76F4\u63A5\u53EB\u9192\u3001\u5728\u8BF7\u6C42\u4E0A\u4E0B\u6587\u91CC\u5E94\u7528\uFF0C\u70B9\u4FDD\u5B58\u5373\u751F\u6548\uFF09\uFF1B\u82E5\u672C\u673A\u6CA1\u6709 DSH \u5BBF\u4E3B\u5728\u8FD0\u884C\uFF0C\u5219\u76F4\u63A5\u5199\u5165\u5171\u4EAB\u914D\u7F6E\u3001\u7ACB\u5373\u751F\u6548\u3002\u53EA\u6709\u5728\u5BF9\u63A5\u65E7\u7248\u5BBF\u4E3B\u65F6\u624D\u4F1A\u9000\u56DE\u300C\u6392\u961F\u7B49\u5B83\u81EA\u5DF1\u540C\u6B65\u300D\uFF0C\u90A3\u65F6\u53EF\u5728 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u91CC\u6539\u540C\u4E00\u9879\u3002",readonlyTitle:"\u5F53\u524D\u9875\u9762\u53EA\u8BFB\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u914D\u7F6E",readonlyBody:"\u8FD9\u4E2A\u8FDB\u7A0B\u6CA1\u6709 DSH \u7684\u8BBE\u7F6E\u670D\u52A1\uFF08settings.update \u4E0D\u5B58\u5728\uFF09\uFF0C\u914D\u7F6E\u53EA\u80FD\u5728\u672C\u673A DSH \u91CC\u4FEE\u6539\uFF1A\u684C\u9762\u7248 \u2192 \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u3002",readonlyBtn:"\u53EA\u8BFB",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",enabledLabel:"\u542F\u7528\u8BB0\u5FC6\u6838\u5FC3",vaultDirLabel:"\u8BB0\u5FC6\u5E93\u76EE\u5F55\uFF08\u5355\u5E93\uFF09",captureCooldownMs:"\u6C89\u6DC0\u51B7\u5374 (ms)",captureProvider:"\u84B8\u998F provider\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",captureModel:"\u84B8\u998F model\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",recallEmbedding:"\u8BED\u4E49\u53EC\u56DE provider\uFF08\u53EF\u9009\uFF09",sessionBudgetChars:"\u4F1A\u8BDD\u9884\u7B97 (\u5B57\u7B26)",saving:"\u4FDD\u5B58\u4E2D\u2026",savePending:"\u5DF2\u5199\u5165\u914D\u7F6E\u6587\u4EF6\uFF1B\u5BBF\u4E3B\u4ECD\u662F\u65E7\u7248\uFF0C\u91CD\u542F DSH \u540E\u5373\u4EE5\u65B0\u503C\u4E3A\u51C6\uFF08\u672C\u9762\u677F\u5DF2\u751F\u6548\uFF09",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",vcPage:"\u9875\u9762\u811A\u672C",vcPageStale:"\u26A0 \u5F53\u524D\u9875\u9762\u4ECD\u5728\u8FD0\u884C\u65E7\u7248\u811A\u672C\uFF08\u9875\u9762 v{page} / \u78C1\u76D8 v{disk}\uFF09\uFF1A\u6309 Ctrl+F5 \u5237\u65B0\u9875\u9762\u5373\u751F\u6548\uFF1B\u82E5\u300C\u8FD0\u884C\u4E2D\u300D\u4ECD\u662F\u65E7\u7248\u53F7\uFF0C\u5219\u8FD8\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",vcLoaded:"\u8FD0\u884C\u4E2D\uFF08\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF09",vcResident:"\u5E38\u9A7B\u5B9E\u4F8B",vcOnDisk:"\u78C1\u76D8\u5B89\u88C5",vcLatest:"npm \u6700\u65B0",vcStale:"\u78C1\u76D8\u5DF2\u5B89\u88C5 v{disk}\uFF0C\u4F46\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\u4ECD\u52A0\u8F7D v{loaded} \u2014\u2014 \u70B9\u300C\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\u300D\u5373\u53EF\u7528\u65B0\u4EE3\u7801\u91CD\u542F\u5B83\uFF08\u4E0D\u7528\u91CD\u542F DSH\uFF09",vcRestart:"\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B",vcRestarting:"\u91CD\u542F\u4E2D\u2026",vcRestartSent:"\u5DF2\u8C03\u5EA6\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\uFF1A\u7EA6 3-8 \u79D2\u540E\u65B0\u8FDB\u7A0B\u63A5\u7BA1\uFF0C\u8BF7\u7A0D\u7B49\u518D\u5237\u65B0\u9875\u9762\uFF08Ctrl+F5\uFF09",vcRestartCurrent:"\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u7ECF\u662F\u6700\u65B0\u7248\uFF0C\u65E0\u9700\u91CD\u542F",vcRestartFail:"\u91CD\u542F\u8BF7\u6C42\u5931\u8D25",vcRestartNoRoute:"\u5F53\u524D\u9875\u9762\u5BF9\u63A5\u7684\u8FDB\u7A0B\u8FD8\u662F\u65E7\u7248\uFF08\u6CA1\u6709\u8FD9\u4E2A\u63A5\u53E3\uFF09\uFF1A\u8BF7\u91CD\u542F\u684C\u9762\u7248 / DSH \u540E\u518D\u8BD5\uFF0C\u6216\u6267\u884C {cmd}",vcHostStale:"\u4E0A\u65B9\u7684\u300C\u8FD0\u884C\u4E2D\u300D\u6765\u81EA\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF1B\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u662F\u65B0\u7248 \u2014\u2014 \u8981\u8BA9\u5B83\u4E5F\u53D8\u6210\u65B0\u7248\u53F7\uFF0C\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",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",recallSummaryLen:"\u53EC\u56DE\u6458\u8981\u957F\u5EA6",recallBody:"\u53EC\u56DE\u542B\u6B63\u6587",secretHint:"\u51ED\u8BC1\u53D6\u7528\u63D0\u793A\uFF08\u6CE8\u5165\u6BCF\u4E2A\u4F1A\u8BDD\uFF09",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",autoRestartOnDrift:"\u7248\u672C\u6F02\u79FB\u81EA\u52A8\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B",autoMcpSetup:"\u81EA\u52A8\u6302\u8F7D MCP",saveConfig:"\u4FDD\u5B58\u914D\u7F6E",saveFail:"\u4FDD\u5B58\u5931\u8D25",savedOk:"\u5DF2\u4FDD\u5B58",savedDirect:"\u672C\u673A\u6CA1\u6709 DSH \u5BBF\u4E3B\u5728\u8FD0\u884C\uFF0C\u5DF2\u76F4\u63A5\u5199\u5165\u5171\u4EAB\u914D\u7F6E\uFF08hooks / MCP / \u72EC\u7ACB\u9875\u7ACB\u5373\u751F\u6548\uFF09",savedApplied:"\u5DF2\u4FDD\u5B58\u5E76\u751F\u6548\uFF08\u5BBF\u4E3B\u5DF2\u5728\u8BF7\u6C42\u4E0A\u4E0B\u6587\u91CC\u5E94\u7528\uFF09",saveQueued:"\u5DF2\u4EA4\u7ED9 DSH \u5BBF\u4E3B\u540C\u6B65\uFF0C\u5C1A\u672A\u786E\u8BA4\u751F\u6548",saveHostGuard:"\u8BE5\u5BBF\u4E3B\u4E0D\u5141\u8BB8\u63D2\u4EF6\u4ECE\u81EA\u5DF1\u7684\u56DE\u8C03\u4E0A\u4E0B\u6587\u91CC\u5199\u914D\u7F6E\uFF1B\u8BF7\u5728\u300CDSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u300D\u91CC\u6539\u540C\u4E00\u9879\uFF0C\u6216\u7F16\u8F91 profile \u7684\u914D\u7F6E\u8865\u4E01\u5C42",saveFailHint:"\u5BBF\u4E3B\u4FA7\u672A\u5E94\u7528\uFF0C\u8BE6\u89C1\u300C\u53CD\u9988\u5F02\u5E38\u300D\u91CC\u7684\u8BCA\u65AD\u4FE1\u606F",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\uFF1B\u5DF2\u6709\u5E38\u9A7B watchdog \u4E0D\u4F1A\u88AB\u81EA\u52A8\u505C\u6389\uFF0C\u9700 dsh-memory stop / restart\uFF08#19\uFF09",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]
19
19
 
20
20
  ## \u80CC\u666F
21
21
  - \u95EE\u9898\u63CF\u8FF0
@@ -60,7 +60,7 @@ Error generating stack: `+o.message+`
60
60
  -
61
61
 
62
62
  ## \u98CE\u9669/\u963B\u585E
63
- - `},Zp={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",importedTotal:" / of ",importedTotalTail:"",importedQuarantine:" \xB7 pending review ",importedQuarantineTail:" (quarantined until approved)",importedSkipped:" \xB7 skipped ",importedSkippedTail:" (duplicate or empty)",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",pendingSyncNote:'This is the standalone web page: saving writes a "pending" file that the DSH host applies; when no DSH host is running here the change is written straight into the shared config and takes effect immediately. If the host will not apply it, change the same option under DSH Settings \u2192 Memory.',readonlyTitle:"This page is read-only; config cannot be saved here",readonlyBody:"This process has no DSH settings service (settings.update is unavailable). Edit the config in DSH: desktop app \u2192 Settings \u2192 Memory.",readonlyBtn:"Read-only",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",enabledLabel:"Enable memory core",vaultDirLabel:"Vault directory (single)",captureCooldownMs:"Capture cooldown (ms)",captureProvider:"Distill provider (auto if empty)",captureModel:"Distill model (auto if empty)",recallEmbedding:"Semantic recall provider (optional)",sessionBudgetChars:"Session budget (chars)",saving:"Saving\u2026",savePending:"Saved to the config file; the host half is still the old build, so restart DSH to make it effective (already applied in this panel)",saveInvalid:"Some field values are invalid; nothing was submitted",invalidField:'"{field}" must be a number between {min} and {max} (now: {value})',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 (process serving this page)",vcResident:"resident instance",vcOnDisk:"on disk",vcLatest:"npm latest",vcStale:'v{disk} is installed on disk but the process serving this page still has v{loaded} loaded \u2014 click "Restart resident instance" to restart it on the new code (no DSH restart needed)',vcRestart:"Restart resident instance",vcRestarting:"Restarting\u2026",vcRestartSent:"Resident restart scheduled: the new process takes over in ~3-8s \u2014 refresh the page (Ctrl+F5) shortly",vcRestartCurrent:"The resident instance is already up to date \u2014 no restart needed",vcRestartFail:"Restart request failed",vcRestartNoRoute:"The process serving this page is still the old build (no such endpoint): restart the desktop app / DSH and retry, or run {cmd}",vcHostStale:'The "running" chip above comes from the process serving this page; the resident instance is already current \u2014 restart the desktop app / DSH to refresh that chip',vcPage:"Page script",vcPageStale:"\u26A0 This page is still running an older script (page v{page} / disk v{disk}): press Ctrl+F5 to refresh. If the running version is still old, restart the desktop app / DSH as well",vcOutdated:"update available",vcUpToDate:"up to date",vcCheck:"Check for updates",checking:"Checking\u2026",vcCheckFail:"Update check failed",recallSummaryLen:"Recall summary len",recallBody:"Recall with body",secretHint:"Credential hint (injected into every session)",autoWeb:"Web server",autoWebMode:"Keep-alive mode",webPort:"Web port",webCheckIntervalMs:"Probe interval (ms)",webMaxRestart:"Max restart",watchdogAutoSpawn:"Watchdog process",autoRestartOnDrift:"Auto-restart resident on version drift",autoMcpSetup:"Auto-mount MCP",saveConfig:"Save config",saveFail:"Save failed",savedOk:"Saved",savedDirect:"No DSH host is running here, so the change went straight into the shared config (hooks / MCP / the standalone page pick it up immediately)",saveQueued:"Handed to the DSH host for sync \u2014 not confirmed applied yet",saveHostGuard:"This host does not let a plugin write config from its own callback context; change the same option under DSH Settings \u2192 Memory, or edit the profile patch layer",saveFailHint:"the host did not apply it \u2014 see Diagnostics under Report a bug",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; a resident watchdog is never stopped automatically \u2014 use dsh-memory stop / restart (#19)",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]
63
+ - `},Zp={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",importedTotal:" / of ",importedTotalTail:"",importedQuarantine:" \xB7 pending review ",importedQuarantineTail:" (quarantined until approved)",importedSkipped:" \xB7 skipped ",importedSkippedTail:" (duplicate or empty)",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",pendingSyncNote:'This is the standalone web page: the DSH host applies a save (a current host is woken up and applies it in a request context, so saving takes effect immediately); when no DSH host is running here the change goes straight into the shared config. Only an older host falls back to "queued until it syncs on its own" \u2014 in that case change the same option under DSH Settings \u2192 Memory.',readonlyTitle:"This page is read-only; config cannot be saved here",readonlyBody:"This process has no DSH settings service (settings.update is unavailable). Edit the config in DSH: desktop app \u2192 Settings \u2192 Memory.",readonlyBtn:"Read-only",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",enabledLabel:"Enable memory core",vaultDirLabel:"Vault directory (single)",captureCooldownMs:"Capture cooldown (ms)",captureProvider:"Distill provider (auto if empty)",captureModel:"Distill model (auto if empty)",recallEmbedding:"Semantic recall provider (optional)",sessionBudgetChars:"Session budget (chars)",saving:"Saving\u2026",savePending:"Saved to the config file; the host half is still the old build, so restart DSH to make it effective (already applied in this panel)",saveInvalid:"Some field values are invalid; nothing was submitted",invalidField:'"{field}" must be a number between {min} and {max} (now: {value})',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 (process serving this page)",vcResident:"resident instance",vcOnDisk:"on disk",vcLatest:"npm latest",vcStale:'v{disk} is installed on disk but the process serving this page still has v{loaded} loaded \u2014 click "Restart resident instance" to restart it on the new code (no DSH restart needed)',vcRestart:"Restart resident instance",vcRestarting:"Restarting\u2026",vcRestartSent:"Resident restart scheduled: the new process takes over in ~3-8s \u2014 refresh the page (Ctrl+F5) shortly",vcRestartCurrent:"The resident instance is already up to date \u2014 no restart needed",vcRestartFail:"Restart request failed",vcRestartNoRoute:"The process serving this page is still the old build (no such endpoint): restart the desktop app / DSH and retry, or run {cmd}",vcHostStale:'The "running" chip above comes from the process serving this page; the resident instance is already current \u2014 restart the desktop app / DSH to refresh that chip',vcPage:"Page script",vcPageStale:"\u26A0 This page is still running an older script (page v{page} / disk v{disk}): press Ctrl+F5 to refresh. If the running version is still old, restart the desktop app / DSH as well",vcOutdated:"update available",vcUpToDate:"up to date",vcCheck:"Check for updates",checking:"Checking\u2026",vcCheckFail:"Update check failed",recallSummaryLen:"Recall summary len",recallBody:"Recall with body",secretHint:"Credential hint (injected into every session)",autoWeb:"Web server",autoWebMode:"Keep-alive mode",webPort:"Web port",webCheckIntervalMs:"Probe interval (ms)",webMaxRestart:"Max restart",watchdogAutoSpawn:"Watchdog process",autoRestartOnDrift:"Auto-restart resident on version drift",autoMcpSetup:"Auto-mount MCP",saveConfig:"Save config",saveFail:"Save failed",savedOk:"Saved",savedDirect:"No DSH host is running here, so the change went straight into the shared config (hooks / MCP / the standalone page pick it up immediately)",savedApplied:"Saved and applied (the host applied it in a request context)",saveQueued:"Handed to the DSH host for sync \u2014 not confirmed applied yet",saveHostGuard:"This host does not let a plugin write config from its own callback context; change the same option under DSH Settings \u2192 Memory, or edit the profile patch layer",saveFailHint:"the host did not apply it \u2014 see Diagnostics under Report a bug",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; a resident watchdog is never stopped automatically \u2014 use dsh-memory stop / restart (#19)",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]
64
64
 
65
65
  ## Background
66
66
  - Problem
@@ -300,13 +300,13 @@ Option A, because:
300
300
  height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
301
301
  max-height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
302
302
  }
303
- `;function Vg(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,i.jsx)("defs",{children:(0,i.jsxs)("linearGradient",{id:"mg-brain",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,i.jsx)("stop",{offset:"0%",stopColor:"#FFC46B"}),(0,i.jsx)("stop",{offset:"50%",stopColor:"#F97316"}),(0,i.jsx)("stop",{offset:"100%",stopColor:"#EA580C"})]})}),(0,i.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,i.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,i.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,i.jsx)("circle",{cx:"12",cy:"8.6",r:"1.1",fill:"rgba(255,255,255,0.85)"})]})}var Vl="0.10.7";function ef({t:e,inModal:t,onClose:n,onFull:r,full:l}){let[o,a]=(0,v.useState)(null),[s,u]=(0,v.useState)([]),[f,y]=(0,v.useState)(!0),[h,m]=(0,v.useState)(null),[k,z]=(0,v.useState)(""),[w,_]=(0,v.useState)("all"),[d,c]=(0,v.useState)(""),[g,N]=(0,v.useState)("all"),[P,j]=(0,v.useState)("all"),[D,F]=(0,v.useState)(()=>{try{let L=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),V={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(L&&V[L])return V[L]}catch{}return"cards"}),[Q,I]=(0,v.useState)(()=>new Set([D])),M=(0,v.useCallback)(L=>{I(V=>V.has(L)?V:new Set(V).add(L)),F(L)},[]),[T,O]=(0,v.useState)("recent"),[J,G]=(0,v.useState)(null),q=(0,v.useRef)(null),pe=(0,v.useRef)(null),[se,He]=(0,v.useState)(!1),[Yt,Se]=(0,v.useState)(null),[bt,St]=(0,v.useState)(!1),[It,Ye]=(0,v.useState)(!1),[Pe,Fe]=(0,v.useState)(!0),[bn,sn]=(0,v.useState)(null),[Xt,Kn]=(0,v.useState)(0),Sn=(0,v.useCallback)(()=>Kn(L=>L+1),[]),tt=o?.quarantine?.pending??0,ft=o?.quarantine?.deleted??0,ge=(0,v.useRef)(null),[Gt,Ae]=(0,v.useState)(0),[S,x]=(0,v.useState)(!1),K=(0,v.useRef)(null),de=(0,v.useRef)(null),X=(0,v.useCallback)(async(L=w,V=d,re=P,_e={})=>{let ee=_e.append===!0;try{ee?x(!0):(y(!0),z(""));let ze=new URLSearchParams;L&&L!=="all"&&ze.set("kind",L),V.trim()&&ze.set("q",V.trim()),ze.set("status",re||"all"),ze.set("limit",String(Wg)),ze.set("offset",String(_e.offset||0)),T==="title"&&ze.set("sort","title");let nt=await(await fetch(`${Z}/cards?${ze.toString()}`)).json();if(nt.ok){let Ot=nt.cards||[];u(Ct=>ee?[...Ct,...Ot.filter(Ft=>!Ct.some(Ql=>Ql.path===Ft.path))]:Ot),Ae(Number(nt.total)||Ot.length)}}catch(ze){z(String(ze&&ze.message?ze.message:ze))}finally{ee?x(!1):y(!1)}},[w,d,P,T]),ye=(0,v.useCallback)(async()=>{try{let[L,V]=await Promise.all([fetch(`${Z}/overview`).then(re=>re.json()),fetch(`${Z}/capture-log`).then(re=>re.json()).catch(()=>null)]);L.ok&&a(L),m(V&&V.ok&&V.available&&V.health||null)}catch(L){z(String(L&&L.message?L.message:L))}finally{y(!1)}},[]),p=async L=>{try{let re=await(await fetch(`${Z}/delete?path=${encodeURIComponent(L)}`)).json();re.ok?(G({ok:!0,msg:e("deleted")}),await ye(),Sn()):G({ok:!1,msg:re.error||e("deleteFail")})}catch{G({ok:!1,msg:e("deleteFail")})}q.current&&clearTimeout(q.current),q.current=setTimeout(()=>G(null),2e3)};(0,v.useEffect)(()=>(ye(),()=>{ge.current&&clearTimeout(ge.current)}),[ye]);let b=L=>{c(L),ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>X(w,L,P),280)},W=L=>{_(L),X(L,d,P)};(0,v.useEffect)(()=>{D==="cards"&&X(w,d,P)},[P,D,Xt,T]),(0,v.useEffect)(()=>{if(D!=="cards"||f||S||s.length>=Gt)return;let L=K.current,V=de.current;if(!L)return;let re=new IntersectionObserver(_e=>{_e[0]&&_e[0].isIntersecting&&X(w,d,P,{append:!0,offset:s.length})},{root:V||null,rootMargin:"400px"});return re.observe(L),()=>re.disconnect()},[D,s,Gt,f,S,w,d,P,X]);let U=async L=>{try{let V=L.status;if(!V&&L.path)try{let Xe=((await fetch(`${Z}/cards?status=all&q=${encodeURIComponent(L.title||"")}&limit=50`).then(nt=>nt.json())).cards||[]).find(nt=>nt.path===L.path);Xe&&(V=Xe.status)}catch{}let re=V&&V!=="approved"?`&status=${encodeURIComponent(V)}`:"",_e=await fetch(`${Z}/card?path=${encodeURIComponent(L.path||L.id)}${re}`),ee=await _e.json();ee.ok?Se({path:ee.path,title:L.title,text:ee.text}):z(ee.error||`HTTP ${_e.status}`)}catch(V){z(String(V&&V.message?V.message:V))}},te=async(L,V)=>{He(!0);try{let re=await fetch(`${Z}/export`);if(!re.ok)throw new Error("HTTP "+re.status);let _e=await re.json();if(!_e.ok)throw new Error(_e.error||"export failed");let ee,ze,Xe;if(L==="json"){ze="memory-vault.json",Xe="application/json";let Ct=_e.cards.map(Ft=>({path:Ft.path,title:Ft.title,kind:Ft.kind,status:Ft.status,store:Ft.store,text:Ft.text}));ee=JSON.stringify({format:_e.format||"memory-eternal-vault",formatVersion:_e.formatVersion||1,exportedAt:_e.exportedAt||new Date().toISOString(),count:Ct.length,cards:Ct},null,2)}else ze="memory-vault.md",Xe="text/markdown;charset=utf-8",ee=_e.cards.map(Ct=>Ct.text.trim()).filter(Boolean).join(`
303
+ `;function Vg(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,i.jsx)("defs",{children:(0,i.jsxs)("linearGradient",{id:"mg-brain",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,i.jsx)("stop",{offset:"0%",stopColor:"#FFC46B"}),(0,i.jsx)("stop",{offset:"50%",stopColor:"#F97316"}),(0,i.jsx)("stop",{offset:"100%",stopColor:"#EA580C"})]})}),(0,i.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,i.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,i.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,i.jsx)("circle",{cx:"12",cy:"8.6",r:"1.1",fill:"rgba(255,255,255,0.85)"})]})}var Vl="0.10.8";function ef({t:e,inModal:t,onClose:n,onFull:r,full:l}){let[o,a]=(0,v.useState)(null),[s,u]=(0,v.useState)([]),[f,y]=(0,v.useState)(!0),[h,m]=(0,v.useState)(null),[k,z]=(0,v.useState)(""),[w,_]=(0,v.useState)("all"),[d,c]=(0,v.useState)(""),[g,N]=(0,v.useState)("all"),[P,j]=(0,v.useState)("all"),[D,F]=(0,v.useState)(()=>{try{let L=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),V={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(L&&V[L])return V[L]}catch{}return"cards"}),[Q,I]=(0,v.useState)(()=>new Set([D])),M=(0,v.useCallback)(L=>{I(V=>V.has(L)?V:new Set(V).add(L)),F(L)},[]),[T,O]=(0,v.useState)("recent"),[ee,G]=(0,v.useState)(null),q=(0,v.useRef)(null),pe=(0,v.useRef)(null),[se,He]=(0,v.useState)(!1),[Yt,Se]=(0,v.useState)(null),[bt,St]=(0,v.useState)(!1),[It,Ye]=(0,v.useState)(!1),[Pe,Fe]=(0,v.useState)(!0),[bn,sn]=(0,v.useState)(null),[Xt,Kn]=(0,v.useState)(0),Sn=(0,v.useCallback)(()=>Kn(L=>L+1),[]),tt=o?.quarantine?.pending??0,ft=o?.quarantine?.deleted??0,ge=(0,v.useRef)(null),[Gt,Ae]=(0,v.useState)(0),[S,x]=(0,v.useState)(!1),K=(0,v.useRef)(null),de=(0,v.useRef)(null),X=(0,v.useCallback)(async(L=w,V=d,re=P,_e={})=>{let te=_e.append===!0;try{te?x(!0):(y(!0),z(""));let ze=new URLSearchParams;L&&L!=="all"&&ze.set("kind",L),V.trim()&&ze.set("q",V.trim()),ze.set("status",re||"all"),ze.set("limit",String(Wg)),ze.set("offset",String(_e.offset||0)),T==="title"&&ze.set("sort","title");let nt=await(await fetch(`${J}/cards?${ze.toString()}`)).json();if(nt.ok){let Ot=nt.cards||[];u(Ct=>te?[...Ct,...Ot.filter(Ft=>!Ct.some(Ql=>Ql.path===Ft.path))]:Ot),Ae(Number(nt.total)||Ot.length)}}catch(ze){z(String(ze&&ze.message?ze.message:ze))}finally{te?x(!1):y(!1)}},[w,d,P,T]),ye=(0,v.useCallback)(async()=>{try{let[L,V]=await Promise.all([fetch(`${J}/overview`).then(re=>re.json()),fetch(`${J}/capture-log`).then(re=>re.json()).catch(()=>null)]);L.ok&&a(L),m(V&&V.ok&&V.available&&V.health||null)}catch(L){z(String(L&&L.message?L.message:L))}finally{y(!1)}},[]),p=async L=>{try{let re=await(await fetch(`${J}/delete?path=${encodeURIComponent(L)}`)).json();re.ok?(G({ok:!0,msg:e("deleted")}),await ye(),Sn()):G({ok:!1,msg:re.error||e("deleteFail")})}catch{G({ok:!1,msg:e("deleteFail")})}q.current&&clearTimeout(q.current),q.current=setTimeout(()=>G(null),2e3)};(0,v.useEffect)(()=>(ye(),()=>{ge.current&&clearTimeout(ge.current)}),[ye]);let b=L=>{c(L),ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>X(w,L,P),280)},W=L=>{_(L),X(L,d,P)};(0,v.useEffect)(()=>{D==="cards"&&X(w,d,P)},[P,D,Xt,T]),(0,v.useEffect)(()=>{if(D!=="cards"||f||S||s.length>=Gt)return;let L=K.current,V=de.current;if(!L)return;let re=new IntersectionObserver(_e=>{_e[0]&&_e[0].isIntersecting&&X(w,d,P,{append:!0,offset:s.length})},{root:V||null,rootMargin:"400px"});return re.observe(L),()=>re.disconnect()},[D,s,Gt,f,S,w,d,P,X]);let U=async L=>{try{let V=L.status;if(!V&&L.path)try{let Xe=((await fetch(`${J}/cards?status=all&q=${encodeURIComponent(L.title||"")}&limit=50`).then(nt=>nt.json())).cards||[]).find(nt=>nt.path===L.path);Xe&&(V=Xe.status)}catch{}let re=V&&V!=="approved"?`&status=${encodeURIComponent(V)}`:"",_e=await fetch(`${J}/card?path=${encodeURIComponent(L.path||L.id)}${re}`),te=await _e.json();te.ok?Se({path:te.path,title:L.title,text:te.text}):z(te.error||`HTTP ${_e.status}`)}catch(V){z(String(V&&V.message?V.message:V))}},ne=async(L,V)=>{He(!0);try{let re=await fetch(`${J}/export`);if(!re.ok)throw new Error("HTTP "+re.status);let _e=await re.json();if(!_e.ok)throw new Error(_e.error||"export failed");let te,ze,Xe;if(L==="json"){ze="memory-vault.json",Xe="application/json";let Ct=_e.cards.map(Ft=>({path:Ft.path,title:Ft.title,kind:Ft.kind,status:Ft.status,store:Ft.store,text:Ft.text}));te=JSON.stringify({format:_e.format||"memory-eternal-vault",formatVersion:_e.formatVersion||1,exportedAt:_e.exportedAt||new Date().toISOString(),count:Ct.length,cards:Ct},null,2)}else ze="memory-vault.md",Xe="text/markdown;charset=utf-8",te=_e.cards.map(Ct=>Ct.text.trim()).filter(Boolean).join(`
304
304
 
305
305
  ---
306
306
 
307
- `);let nt=new Blob([ee],{type:Xe}),Ot=await oh(nt,ze,!1);if(!Ot.ok){G({ok:!1,msg:e("exportFail")}),He(!1);return}G({ok:!0,msg:e("exportedTo")+"\uFF1A"+e("defaultDownloads")+" \xB7 "+Ot.name})}catch(re){G({ok:!1,msg:e("exportFail")+" \xB7 "+(re.message||"")})}finally{He(!1)}q.current&&clearTimeout(q.current),q.current=setTimeout(()=>G(null),2600)},Ce=async L=>{let V=L.target.files&&L.target.files[0];if(L.target.value="",!!V){try{let re=await V.text(),ee=await(await fetch(`${Z}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:re})).json();if(ee.ok){await ye();let ze=ee.imported||0,Xe=e("importedVault")+"\uFF1A"+ze;ee.total&&(Xe+=e("importedTotal")+ee.total+e("importedTotalTail")),ee.quarantined&&(Xe+=e("importedQuarantine")+ee.quarantined+e("importedQuarantineTail")),ee.skipped&&(Xe+=e("importedSkipped")+ee.skipped+e("importedSkippedTail")),ee.warning&&(Xe+=" \xB7 "+ee.warning),G({ok:ze>0||!ee.total,msg:Xe})}else G({ok:!1,msg:ee.error||e("importFail")})}catch{G({ok:!1,msg:e("importFail")})}q.current&&clearTimeout(q.current),q.current=setTimeout(()=>G(null),2400)}},ne=(0,v.useMemo)(()=>{let L=s.slice();return g!=="all"&&(L=L.filter(V=>Kr(V.submittedBy)===g)),P!=="all"&&(L=L.filter(V=>(V.status||"approved")===P)),T==="title"?L.sort((V,re)=>String(V.title||"").localeCompare(String(re.title||""))):T==="hot"?L.sort((V,re)=>(re.weight||re.links||0)-(V.weight||V.links||0)):L.sort((V,re)=>new Date(re.updated||0).getTime()-new Date(V.updated||0).getTime()),L},[s,T,g,P]),ue=(0,v.useMemo)(()=>[...new Set(s.map(L=>Kr(L.submittedBy)))],[s]);return(0,i.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,i.jsx)("style",{children:an}),J&&(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(J.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,i.jsx)("span",{style:{color:J.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:J.ok?"\u2713":"\u2715"}),(0,i.jsx)("span",{children:J.msg})]}),t&&(0,i.jsxs)("div",{className:"me-modal-head",children:[(0,i.jsxs)("div",{className:"me-modal-title",children:[(0,i.jsx)("span",{className:"me-wicon",children:(0,i.jsx)(Vg,{})}),(0,i.jsx)("h2",{children:e("memoryTitle")}),(0,i.jsx)("span",{children:e("memoryHint")})]}),(0,i.jsx)("div",{className:"spacer"}),r&&(0,i.jsx)("button",{type:"button",className:"me-modal-close",onClick:r,"aria-label":e(l?"exitFull":"fullscreen"),children:l?"\u2750":"\u26F6"}),(0,i.jsx)("button",{type:"button",className:"me-modal-close",onClick:n,"aria-label":e("close"),children:"\u2715"})]}),h&&h.ok===!1&&(0,i.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,i.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",e("captureAlert")]}),(0,i.jsxs)("span",{style:{flex:1},children:[h.reason,(0,i.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:e("captureAlertHint")})]}),(0,i.jsx)("span",{style:{opacity:.7},children:h.since?Vr(new Date(h.since).toISOString()):""})]}),(0,i.jsxs)("div",{className:"me-modal-body",children:[(0,i.jsxs)("div",{className:`mc-rail${Pe?" open":""}`,children:[(0,i.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Fe(L=>!L),"aria-label":e(Pe?"collapse":"expand"),title:e(Pe?"collapse":"expand"),children:Pe?"\xAB":"\xBB"}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="cards"?" active":""}`,onClick:()=>M("cards"),title:e("cardsTab"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("cardsTab")})]}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="graph"?" active":""}`,onClick:()=>M("graph"),title:e("graphTab"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("graphTab")})]}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="stats"?" active":""}`,onClick:()=>M("stats"),title:e("tabUsage"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("tabUsage")})]}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="audit"?" active":""}`,onClick:()=>M("audit"),title:e("tabAudit"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("tabAudit")}),tt>0&&(0,i.jsx)("span",{className:"mc-dot",children:tt>99?"99+":tt})]}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="optimize"?" active":""}`,onClick:()=>M("optimize"),title:e("tabRecycle"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("tabRecycle")}),ft>0&&(0,i.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:ft>99?"99+":ft})]}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="config"?" active":""}`,onClick:()=>M("config"),title:e("tabConfig"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("tabConfig")})]}),(0,i.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Ye(!0),title:e("fbNav"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("fbNav")})]})]}),(0,i.jsxs)("div",{className:"mc-main",ref:de,children:[D==="cards"&&(0,i.jsxs)("div",{className:"mc-stats",children:[(0,i.jsx)($r,{label:e("total"),value:o?o.total:"\u2014"}),(0,i.jsx)($r,{label:e("recent"),value:o?o.recent:"\u2014"}),(0,i.jsx)($r,{label:e("tags"),value:o?o.tags:"\u2014"}),(0,i.jsx)($r,{label:e("pending"),value:o?.quarantine?.pending??o?.status?.pending??0}),(0,i.jsx)($r,{label:e("rejected"),value:o?.quarantine?.rejected??o?.status?.rejected??0}),(0,i.jsx)($r,{label:e("cardCount"),value:o?o.byKind?.knowledge??0:"\u2014"})]}),D==="cards"&&(0,i.jsxs)("div",{className:"mc-toolbar",children:[(0,i.jsx)("input",{type:"text",placeholder:e("searchPlaceholder"),value:d,onChange:L=>b(L.target.value)}),(0,i.jsx)("input",{ref:pe,type:"file",accept:".json,application/json",style:{display:"none"},onChange:Ce}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>pe.current&&pe.current.click(),children:e("importVault")}),(0,i.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>sn({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",e("newCard")]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",disabled:se,onClick:()=>te("md"),children:e(se?"exporting":"exportVault")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",disabled:se,onClick:()=>te("json"),children:e(se?"exporting":"exportJson")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ye(),children:e("refresh")})]}),D==="cards"&&(0,i.jsxs)("div",{className:"mc-chips",children:[Xs.map(L=>(0,i.jsx)("button",{type:"button",className:`mc-chip${w===L?" active":""}`,onClick:()=>W(L),children:e(L==="all"?"all":Qt[L])},L)),(0,i.jsxs)("select",{value:g,onChange:L=>N(L.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,i.jsxs)("option",{value:"all",children:["\u{1F916} ",e("allAgents")]}),Jp(ue).map(L=>(0,i.jsx)("option",{value:L,children:L},L))]}),(0,i.jsxs)("select",{value:P,onChange:L=>j(L.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,i.jsx)("option",{value:"all",children:e("allStatus")}),(0,i.jsx)("option",{value:"approved",children:e("statusApproved")}),(0,i.jsx)("option",{value:"pending",children:e("statusPending")}),(0,i.jsx)("option",{value:"rejected",children:e("statusRejected")})]}),(0,i.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:e("sortRecent")},{key:"title",label:e("sortTitle")},{key:"hot",label:e("sortHot")}].map(L=>(0,i.jsx)("button",{type:"button",className:`mc-chip${T===L.key?" active":""}`,onClick:()=>O(L.key),children:L.label},L.key))]}),k&&(0,i.jsxs)("div",{className:"mc-empty",children:[e("error"),"\uFF1A",k]}),(0,i.jsx)("div",{style:{display:D==="cards"?"contents":"none"},children:f?(0,i.jsx)("div",{className:"mc-empty",children:e("loading")}):k?(0,i.jsxs)("div",{className:"mc-empty",children:[e("error"),"\uFF1A",k," ",(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ye(),children:e("retry")})]}):s.length===0?(0,i.jsx)("div",{className:"mc-empty",children:e("empty")}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"mc-grid",children:ne.map(L=>(0,i.jsx)(Xg,{card:L,t:e,query:d.trim(),onOpen:U,onDelete:p},L.path))}),s.length<Gt&&(0,i.jsx)("div",{ref:K,style:{height:1}}),S&&(0,i.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[e("loading"),"\uFF08",s.length," / ",Gt,"\uFF09"]})]})}),(0,i.jsx)("div",{style:{display:D==="graph"?"flex":"none",flex:1,minHeight:0},children:Q.has("graph")&&(0,i.jsx)(eh,{t:e,onOpen:U,all:bt,onAllChange:St,onMutate:Sn,active:D==="graph",visible:D==="graph"})}),(0,i.jsx)("div",{style:{display:D==="config"?"contents":"none"},children:Q.has("config")&&(0,i.jsx)(Kg,{t:e,onReload:()=>ye(),version:Xt})}),(0,i.jsx)("div",{style:{display:D==="stats"?"contents":"none"},children:Q.has("stats")&&(0,i.jsx)(Gg,{t:e,tab:"stats",onReload:()=>ye(),version:Xt})}),(0,i.jsx)("div",{style:{display:D==="audit"?"contents":"none"},children:Q.has("audit")&&(0,i.jsx)(Qg,{t:e,onReload:()=>ye(),version:Xt})}),(0,i.jsx)("div",{style:{display:D==="optimize"?"contents":"none"},children:Q.has("optimize")&&(0,i.jsx)(Yg,{t:e,onReload:()=>ye(),version:Xt})}),It&&(0,i.jsx)(Zg,{t:e,onClose:()=>Ye(!1)}),Yt&&(0,i.jsx)(Jg,{t:e,card:Yt,query:d.trim(),onClose:()=>Se(null),onDelete:L=>{Se(null),p(L)},onFeedback:L=>{let V=Yt.path;fetch(`${Z}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:d.trim(),path:V,useful:L})}).then(()=>G({ok:!0,msg:e(L?"fbUseful":"fbIrr")})).catch(()=>{}),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>G(null),2e3)}}),(0,i.jsx)(qg,{t:e,newCard:bn,setNewCard:sn,onCreated:()=>{ye(),Sn(),G({ok:!0,msg:e("created")}),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>G(null),2e3)}})]})]})]})}var tf=({toast:e})=>e?(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"8px 12px",fontSize:12,borderLeft:"4px solid "+(e.ok?"#10b981":"#ef4444"),background:e.ok?"rgba(16,185,129,0.08)":"rgba(239,68,68,0.08)"},children:[e.ok?"\u2705":"\u26A0"," ",e.msg]}):null,$r=({label:e,value:t})=>(0,i.jsxs)("div",{className:"mc-stat mc-card",children:[(0,i.jsx)("b",{children:t}),(0,i.jsx)("span",{children:e})]});function Kg({t:e,onReload:t,version:n,compact:r}){let[l,o]=(0,v.useState)(null),[a,s]=(0,v.useState)(0),[u,f]=(0,v.useState)(null),[y,h]=(0,v.useState)(null),[m,k]=(0,v.useState)(!1),[z,w]=(0,v.useState)(!1),_=(0,v.useRef)(!1),d=(0,v.useRef)(null),c=(0,v.useRef)({}),[g,N]=(0,v.useState)(null),[P,j]=(0,v.useState)(null),[D,F]=(0,v.useState)(""),[Q,I]=(0,v.useState)(""),[M,T]=(0,v.useState)(""),[O,J]=(0,v.useState)(null),G=(0,v.useCallback)(async b=>{I("version");try{let W=await fetch(Z+"/version-check"+(b?"?force=1":"")).then(U=>U.json());W&&W.ok?(J(W),b&&Se(W.updateAvailable?e("vcLatest")+" v"+W.latest:e("vcUpToDate"))):b&&Se(e("vcCheckFail"),!1)}catch{b&&Se(e("vcCheckFail"),!1)}finally{I("")}},[e]);(0,v.useEffect)(()=>{G(!1)},[n,G]);let[q,pe]=(0,v.useState)(""),[se,He]=(0,v.useState)(null),Yt=(0,v.useRef)(null),Se=(b,W=!0)=>{Yt.current&&clearTimeout(Yt.current),He({msg:b,ok:W}),Yt.current=setTimeout(()=>He(null),1900)},bt=async()=>{if(!Q){I("restart");try{let b=await fetch(Z+"/restart-self",{method:"POST"});if(b.status===404||b.status===405){Se(Ye("vcRestartNoRoute",{cmd:O&&O.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let W=await b.json().catch(()=>null);if(!W){Se(e("vcRestartFail")+"\uFF08HTTP "+b.status+"\uFF09",!1);return}if(!W.ok){Se(W.error||e("vcRestartFail"),!1);return}if(W.alreadyCurrent){Se(W.note||e("vcRestartCurrent"));return}Se(W.note||e("vcRestartSent")),W.alreadyRunning||setTimeout(()=>{G(!0)},6e3)}catch(b){Se(e("vcRestartFail")+"\uFF1A"+String(b&&b.message||b),!1)}finally{I("")}}},St=O&&O.resident?String(O.resident.served||""):"",It=!!(O&&O.onDisk&&St&&St!==O.onDisk),Ye=(b,W)=>Object.keys(W).reduce((U,te)=>U.split("{"+te+"}").join(W[te]),e(b)),Pe=(0,v.useCallback)(async()=>{try{let[b,W,U]=await Promise.all([fetch(`${Z}/config`).then(te=>te.json()).catch(()=>null),fetch(`${Z}/setup-status`).then(te=>te.json()).catch(()=>null),fetch(`${Z}/budget`).then(te=>te.json()).catch(()=>null)]);if(b&&b.ok){o(b),s(b.revision??0),f(b.schema??null);let te=Vp(b.config??{},c.current);c.current=te.overlay,h({...te.values}),N(b.dsh??null),k(b.writable===!1),w(b.viaPending===!0),F(""),_.current=!1}else U&&U.ok?(h({...U}),k(!0),F(e("configNeedsDsh"))):F(e("adminLoadFail"));W&&W.ok&&j(W),T("")}catch{F(e("adminLoadFail"))}},[e]);(0,v.useEffect)(()=>{Pe()},[n,Pe]);let Fe=(b,W)=>{_.current=!0,h(U=>({...U??{},[b]:W}))};(0,v.useEffect)(()=>{d.current=Pe},[Pe]),(0,v.useEffect)(()=>{if(typeof EventSource>"u")return;let b=null;try{b=new EventSource(Z+"/events")}catch{return}let W=()=>{!_.current&&typeof d.current=="function"&&d.current()};try{b.addEventListener("config",W)}catch{}return()=>{try{b.close()}catch{}}},[]);let bn=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),sn=b=>({init:e("modeInit"),interval:e("modeInterval"),manual:e("modeManual")})[b]||b,Xt=async()=>{if(!y)return;if(m){Se(e("editInSetting"),!1);return}let b={dedupThreshold:[0,1],captureMinChars:[0,1e6],captureCooldownMs:[0,1e9],maxCardsPerDay:[0,1e6],captureMaxTokens:[100,4e3],recallMinScore:[0,50],recallLimit:[1,20],recallSummaryLen:[40,400],recycleRetentionDays:[1,3650],webPort:[1,65535],webCheckIntervalMs:[1e3,6e5],webMaxRestart:[1,1e3],sessionBudgetChars:[0,1e9]},W=[];for(let[U,[te,Ce]]of Object.entries(b)){if(!(U in y))continue;let ne=y[U],ue=typeof ne=="number"?ne:Number(ne);(ne===""||ne===null||ne===void 0||!Number.isFinite(ue)||ue<te||ue>Ce)&&W.push(e("invalidField",{field:U,min:te,max:Ce,value:String(ne===""?"\u7A7A":ne)}))}if(W.length){let U=e("saveInvalid")+"\uFF1A"+W.join("\uFF1B");F(U),Se(U,!1);return}I("save");try{let U={...y};for(let ue of Object.keys(y))ue in U&&typeof U[ue]=="string"&&U[ue].trim()!==""&&bn.has(ue)&&(U[ue]=Number(U[ue]));Array.isArray(U.vaultProfiles)&&(U.vaultProfiles=U.vaultProfiles.filter(ue=>ue&&(String(ue.name||"").trim()||String(ue.path||"").trim())));let te=await fetch(`${Z}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:U,expectedRevision:a})}),Ce=await te.text(),ne=null;try{ne=Ce?JSON.parse(Ce):null}catch{ne=null}if(ne||(ne={error:"HTTP "+te.status+(Ce?"\uFF1A"+Ce.slice(0,200):"\uFF08\u5BBF\u4E3B\u672A\u8FD4\u56DE\u539F\u56E0\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u6709\u6570\u5B57\u5B57\u6BB5\u4E3A\u7A7A\u6216\u8D85\u51FA\u8303\u56F4\uFF09")}),ne&&ne.ok){let ue=typeof ne.pendingOutcome=="string"?ne.pendingOutcome:"",L,V=!0;if(ue==="queued")V=!1,L=e("saveQueued");else if(ue==="failed")V=!1,L=e("saveFail")+" \xB7 "+(ne.hostGuard?e("saveHostGuard"):e("saveFailHint"));else if(ue==="applied-direct")L=e("savedOk")+" \xB7 "+e("savedDirect");else{let re=Array.isArray(ne.pending)&&ne.pending.length?" \xB7 "+e("savePending"):ne.note?" \xB7 "+e("restartHint"):"";L=(ne.retried?"\u267B ":"")+e("savedOk")+re}c.current={...c.current,...U},V?T(L):F(L),Se(L,V),await Pe()}else{let ue=te.status===409?e("conflictRefresh"):ne?.error||e("saveFail");F(ue),Se(ue,!1)}}catch{F(e("saveFail")),Se(e("saveFail"),!1)}finally{I("")}},Kn=()=>{c.current={},h({...l?.config??{}}),T("")},Sn={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},tt=b=>Array.isArray(b?.vaultProfiles)?b.vaultProfiles:[],ft=(b,W,U)=>h(te=>{let Ce=tt(te).map(ue=>({...ue||{}})),ne={...Ce[b]||{}};return W==="match"?String(U).trim()?ne.match={...ne.match||{},workspace:U}:delete ne.match:ne[W]=U,Ce[b]=ne,{...te??{},vaultProfiles:Ce}}),ge=()=>h(b=>({...b??{},vaultProfiles:[...tt(b),{name:"",path:""}]})),Gt=b=>h(W=>({...W??{},vaultProfiles:tt(W).filter((U,te)=>te!==b)})),Ae={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},S={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},x={A:{label:e("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:2e3,recallMinScore:2,recallLimit:5,recallSummaryLen:130,recallIncludeBody:!1,captureCooldownMs:3e5},B:{label:e("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:e("planC"),autoWebMode:"interval",watchdogAutoSpawn:!0,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:1200,recallMinScore:1,recallLimit:8,recallSummaryLen:200,recallIncludeBody:!0,captureCooldownMs:12e4}},K=async b=>{let W=x[b];W&&h(U=>({...U??{},...W}))},de=async(b,W)=>{I(b+W);try{let te=await(await fetch(`${Z}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:b,action:W})})).json();te&&te.ok?Se(Ye(W==="install"?"mcpInstalled":"mcpUninstalled",{agent:b})):Se(Ye("mcpActionFail",{agent:b,error:te?.error||""}),!1);try{let Ce=await fetch(`${Z}/setup-status`).then(ne=>ne.json());Ce&&Ce.ok&&j(Ce)}catch{}}catch{Se(e("mergeFail"),!1)}finally{I("")}},X=({k:b,label:W,type:U="text",step:te,min:Ce,max:ne})=>(0,i.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,i.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:W||b}),(0,i.jsx)("input",{type:U,step:te,min:Ce,max:ne,value:y?y[b]??"":"",onChange:ue=>{let L=ue.target.value;Fe(b,U==="number"?L===""?"":Number(L):L)},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}})]}),ye=new Set(["autoRestartOnDrift"]),p=({k:b,label:W})=>{let U=y?y[b]:void 0,te=U===void 0?ye.has(b):!!U;return(0,i.jsxs)("label",{style:{display:"flex",alignItems:"flex-start",gap:6,fontSize:12,minWidth:0,lineHeight:1.5},children:[(0,i.jsx)("input",{type:"checkbox",checked:te,onChange:Ce=>Fe(b,Ce.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,i.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:W||b})]})};return(0,i.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:r?"0 0 auto":1,minHeight:0,maxHeight:r?"52vh":void 0},children:[(0,i.jsx)("style",{children:an}),se&&(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(se.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,i.jsx)("span",{style:{color:se.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:se.ok?"\u2713":"\u2715"}),(0,i.jsx)("span",{style:{wordBreak:"break-all"},children:se.msg})]}),(0,i.jsxs)("div",{style:{overflow:"auto",padding:4},children:[D&&(0,i.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,i.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",D]}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:Pe,children:["\u21BB ",e("retry")]})]}),z&&(0,i.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #3b82f6",background:"rgba(59,130,246,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#1d4ed8",lineHeight:1.7},children:["\u2139 ",e("pendingSyncNote")]}),m&&(0,i.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 ",e("configNeedsDsh")," \u2014\u2014 ",e("editInSetting")]}),M&&(0,i.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 ",M]}),l&&(l.version||l.dsh?.vaultDir)&&(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,i.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",e("pluginInfo")]}),(0,i.jsx)("span",{style:{fontSize:12,opacity:.7},children:e("dshHostLabel")}),l.version&&(0,i.jsxs)("code",{style:Ae,children:[e("vcLoaded")," v",l.version]}),O&&O.resident&&O.resident.served&&O.resident.served!==l.version&&(0,i.jsxs)("code",{style:Ae,children:[e("vcResident")," v",O.resident.served]}),Vl&&(0,i.jsxs)("code",{style:Ae,children:[e("vcPage")," v",Vl]}),O&&O.onDisk&&(0,i.jsxs)("code",{style:Ae,children:[e("vcOnDisk")," v",O.onDisk]}),O&&O.latest&&(0,i.jsxs)("code",{style:Ae,children:[e("vcLatest")," v",O.latest]}),l.dsh?.vaultDir&&(0,i.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",l.dsh.vaultDir]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-btn",disabled:Q==="version",onClick:()=>G(!0),children:Q==="version"?e("checking"):"\u{1F504} "+e("vcCheck")})]}),O&&O.stale&&(0,i.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:[(0,i.jsxs)("div",{children:["\u26A0\uFE0F ",Ye("vcStale",{disk:O.onDisk,loaded:O.loaded})]}),It?(0,i.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:6,flexWrap:"wrap"},children:[(0,i.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!Q,onClick:bt,children:Q==="restart"?"\u23F3 "+e("vcRestarting"):"\u{1F504} "+e("vcRestart")}),O.restartCommand&&(0,i.jsx)("code",{style:{fontSize:11,opacity:.75},children:O.restartCommand})]}):(0,i.jsxs)("div",{style:{marginTop:6,lineHeight:1.7},children:["\u2139\uFE0F ",e("vcHostStale"),O.restartCommand&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsx)("code",{style:{fontSize:11,opacity:.75},children:O.restartCommand})]})]})]}),Vl&&O&&O.onDisk&&Vl!==O.onDisk&&(0,i.jsx)("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",lineHeight:1.7},children:e("vcPageStale",{page:Vl,disk:O.onDisk})}),O&&O.updateAvailable&&(0,i.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",e("vcOutdated")," \u2192 ",(0,i.jsx)("code",{children:O.updateCommand})]}),O&&O.checkError&&(0,i.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[e("vcCheckFail"),"\uFF1A",O.checkError]})]}),P&&P.agents&&(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F50C} ",e("mcpSetupStatus")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("mcpManageHint")})]}),(0,i.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:P.agents.map(b=>(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[(0,i.jsxs)("span",{style:{flex:1},children:[(0,i.jsx)("b",{children:b.isDsh?e("dshHostLabel"):b.name}),b.isDsh&&b.version&&(0,i.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",b.version]}),!b.installed&&(0,i.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",e("notInstalled"),")"]}),b.installed&&b.mcpConfigured===!1&&(0,i.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",e("noMcpEntry"),")"]}),b.mcpConfigured===!0&&(0,i.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",e("healthy")]}),b.mcpConfigured===!0&&b.mcpMatchesCurrentNode===!1&&(0,i.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",e("nodePathNote"),")"]}),b.isDsh&&(0,i.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",e("recallTool"),": ",b.recallTool?e("enabled"):e("disabled"),")"]})]}),b.hook&&(0,i.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",b.hook]}),!b.isDsh&&b.installed&&b.mcpConfigured===!1&&(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!Q,onClick:()=>de(b.name,"install"),children:e("installMcp")}),!b.isDsh&&b.installed&&b.mcpConfigured===!0&&(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!Q,onClick:()=>{window.confirm(e("uninstallConfirm"))&&de(b.name,"uninstall")},children:e("uninstallMcp")})]},b.name))}),(0,i.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:e("mcpSetupHint")}),q&&(0,i.jsx)("div",{style:{fontSize:11,marginTop:6},children:(0,i.jsx)("code",{style:{padding:"2px 6px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:4},children:q})})]}),y?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",e("presetConfig")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("presetHint")})]}),(0,i.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(b=>(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>K(b),disabled:!!Q,children:[b==="A"?"\u{1F7E2} ":b==="B"?"\u{1F4B0} ":"\u2B50 ",x[b].label]},b))})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,i.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F9E0} ",e("dshMemoryConfig")]})}),(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,i.jsx)(p,{k:"autoCapture",label:e("autoCapture")}),(0,i.jsx)(p,{k:"autoRecall",label:e("autoRecall")}),(0,i.jsx)(X,{k:"captureMinChars",label:e("captureMinChars"),type:"number"}),(0,i.jsx)(X,{k:"maxCardsPerDay",label:e("maxCardsPerDay"),type:"number"}),(0,i.jsx)(X,{k:"dedupThreshold",label:e("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,i.jsx)(X,{k:"recallLimit",label:e("recallLimit"),type:"number"}),(0,i.jsx)(X,{k:"recallSummaryLen",label:e("recallSummaryLen"),type:"number"}),(0,i.jsx)(p,{k:"recallIncludeBody",label:e("recallBody")}),(0,i.jsx)(X,{k:"secretHint",label:e("secretHint")}),(0,i.jsx)(X,{k:"recallEmbedding",label:e("recallEmbedding")})]})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #06b6d4"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F5C2}\uFE0F ",e("vaultMulti")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("vaultMultiHint")})]}),(0,i.jsxs)("div",{style:{fontSize:11.5,opacity:.85,marginBottom:8,lineHeight:1.7},children:[e("vaultNow"),"\uFF1A",(0,i.jsx)("code",{children:g?.vaultDir||"\u2014"}),g?.vaultName?`\uFF08${g.vaultName}\uFF09`:""," \xB7 ",e("vaultSource"),"\uFF1A",e(Sn[g?.vaultSource]||"vaultSrcDefault"),g?.workspace?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("br",{}),e("vaultWorkspace"),"\uFF1A",(0,i.jsx)("code",{children:g.workspace})]}):null]}),tt(y).map((b,W)=>(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,i.jsx)("input",{value:b.name||"",placeholder:e("vaultNamePh"),onChange:U=>ft(W,"name",U.target.value),style:S,disabled:m}),(0,i.jsx)("input",{value:b.path||"",placeholder:e("vaultPathPh"),onChange:U=>ft(W,"path",U.target.value),style:S,disabled:m}),(0,i.jsx)("input",{value:b.match&&b.match.workspace||"",placeholder:e("vaultMatchPh"),onChange:U=>ft(W,"match",U.target.value),style:S,disabled:m}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Gt(W),disabled:m,title:e("delete"),children:"\u2715"})]},W)),(0,i.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:ge,disabled:m,children:["\uFF0B ",e("vaultAdd")]}),(0,i.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,i.jsx)("span",{style:{opacity:.6},children:e("vaultActive")}),(0,i.jsxs)("select",{value:y.activeVault||"",onChange:b=>Fe("activeVault",b.target.value),disabled:m,style:S,children:[(0,i.jsx)("option",{value:"",children:e("vaultActiveNone")}),tt(y).filter(b=>b&&b.name).map(b=>(0,i.jsx)("option",{value:b.name,children:b.name},b.name))]})]})]})]}),(0,i.jsx)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,i.jsx)(p,{k:"enabled",label:e("enabledLabel")}),(0,i.jsx)(X,{k:"vaultDir",label:e("vaultDirLabel")})]})}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #f59e0b"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F4B0} ",e("costControl")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("costHint")})]}),(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8,marginTop:6},children:[(0,i.jsx)(p,{k:"distillEnabled",label:e("distillEnabled")}),(0,i.jsx)(p,{k:"dedupByLLM",label:e("dedupByLLM")}),(0,i.jsx)(X,{k:"captureMaxTokens",label:e("captureMaxTokens"),type:"number"}),(0,i.jsx)(X,{k:"recallMinScore",label:e("recallMinScore"),type:"number"}),(0,i.jsx)(X,{k:"captureCooldownMs",label:e("captureCooldownMs"),type:"number"}),(0,i.jsx)(X,{k:"captureProvider",label:e("captureProvider")}),(0,i.jsx)(X,{k:"captureModel",label:e("captureModel")}),(0,i.jsx)(X,{k:"sessionBudgetChars",label:e("sessionBudgetChars"),type:"number"})]})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",e("auditConfig")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("auditHint")})]}),(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,i.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,i.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:e("auditMode")}),(0,i.jsxs)("select",{value:y.auditMode??"all",onChange:b=>Fe("auditMode",b.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,i.jsx)("option",{value:"all",children:e("auditAll")}),(0,i.jsx)("option",{value:"none",children:e("auditNone")})]})]}),(0,i.jsx)(Gp,{label:e("auditExemptAgents"),value:y.auditExemptAgents||[],options:[{value:"__all__",label:e("allExempt")},...(P?.agents||[]).filter(b=>!b.isDsh).map(b=>({value:b.name,label:b.name}))],onChange:b=>Fe("auditExemptAgents",b)}),(0,i.jsx)(Gp,{label:e("auditExemptKinds"),value:y.auditExemptKinds||[],options:[{value:"__all__",label:e("allExempt")},...Xs.filter(b=>b!=="all").map(b=>({value:b,label:e(Qt[b])}))],onChange:b=>Fe("auditExemptKinds",b)}),(0,i.jsx)(X,{k:"recycleRetentionDays",label:e("recycleDays"),type:"number"})]})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,i.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E0} ",e("serviceConfig")]})}),(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,i.jsx)(p,{k:"autoWeb",label:e("autoWeb")}),(0,i.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,i.jsx)("span",{style:{opacity:.6},children:e("autoWebMode")}),(0,i.jsxs)("select",{value:y.autoWebMode??"init",onChange:b=>Fe("autoWebMode",b.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,i.jsx)("option",{value:"init",children:e("modeInit")}),(0,i.jsx)("option",{value:"interval",children:e("modeInterval")}),(0,i.jsx)("option",{value:"manual",children:e("modeManual")})]})]}),(0,i.jsx)(X,{k:"webPort",label:e("webPort"),type:"number"}),(0,i.jsx)(X,{k:"webCheckIntervalMs",label:e("webCheckIntervalMs"),type:"number"}),(0,i.jsx)(X,{k:"webMaxRestart",label:e("webMaxRestart"),type:"number"}),(0,i.jsx)(p,{k:"watchdogAutoSpawn",label:e("watchdogAutoSpawn")}),(0,i.jsx)(p,{k:"autoRestartOnDrift",label:e("autoRestartOnDrift")}),(0,i.jsx)(p,{k:"autoMcpSetup",label:e("autoMcpSetup")})]})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[Q==="save"&&(0,i.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",e("saving")]}),M&&Q!=="save"&&(0,i.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",M]}),D&&Q!=="save"&&(0,i.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",D]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:Kn,disabled:!!Q,children:e("reset")}),(0,i.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:m?()=>Se(e("readonlyTitle")+"\uFF1A"+e("readonlyBody"),!1):Xt,disabled:Q==="save",title:e(m?"readonlyBody":"saveConfig"),children:Q==="save"?"\u23F3 "+e("saving"):m?"\u{1F512} "+e("readonlyBtn"):"\u{1F4BE} "+e("saveConfig")})]})]}):(0,i.jsx)("div",{style:{fontSize:12,opacity:.6},children:e("loading")})]})]})}function Qg({t:e,onReload:t,version:n}){let[r,l]=(0,v.useState)([]),[o,a]=(0,v.useState)([]),[s,u]=(0,v.useState)("all"),[f,y]=(0,v.useState)("all"),[h,m]=(0,v.useState)(""),[k,z]=(0,v.useState)(new Set),[w,_]=(0,v.useState)(""),[d,c]=(0,v.useState)(null),[g,N]=(0,v.useState)("pending"),P=(T,O=!0)=>{c({msg:T,ok:O}),setTimeout(()=>c(null),3e3)},j=[...new Set([...r,...o].map(T=>T.submittedBy).filter(Boolean))],D=(0,v.useCallback)(async()=>{try{let T=await fetch(`${Z}/audit/list`).then(O=>O.json());T.ok&&(l(T.pending||[]),a(T.rejected||[]),z(new Set))}catch{}},[]);(0,v.useEffect)(()=>{D()},[n,D]);let F=(g==="pending"?r:o).filter(T=>{if(s!=="all"&&T.kind!==s||f!=="all"&&Kr(T.submittedBy)!==f)return!1;if(h){let O=(T.created||"").slice(0,10);if(O&&O!==h)return!1}return!0}),Q=T=>z(O=>{let J=new Set(O);return J.has(T)?J.delete(T):J.add(T),J}),I=async(T,O)=>{let J=O||[...k];if(!J.length){P(e("noSelection"),!1);return}_("apply");let G=e(T==="approved"?"toastApproved":T==="rejected"?"toastRejected":"toastCardDeleted");try{let q=0;for(let pe of J){let se=T==="approved"?"audit/approve":T==="rejected"?"audit/reject":"delete";try{(await fetch(Z+"/"+se+"?path="+encodeURIComponent(pe)+(T==="delete"?"&permanent=0":""))).ok||q++}catch{q++}}await D(),t&&t(),q?P(e("toastFailed")+"\uFF08"+q+"/"+J.length+"\uFF09",!1):P(G+" "+J.length+" \u5F20")}catch(q){P(e("toastFailed")+": "+String(q&&q.message||q),!1)}finally{_("")}},M=[...k];return(0,i.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,i.jsx)(tf,{toast:d}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",e("tabAudit")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsxs)("select",{value:s,onChange:T=>u(T.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,i.jsx)("option",{value:"all",children:e("all")}),Xs.filter(T=>T!=="all").map(T=>(0,i.jsx)("option",{value:T,children:e(Qt[T])},T))]}),(0,i.jsxs)("select",{value:f,onChange:T=>y(T.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,i.jsx)("option",{value:"all",children:e("allAgents")}),Jp(j).map(T=>(0,i.jsx)("option",{value:T,children:T},T))]}),(0,i.jsx)("input",{type:"date",value:h,onChange:T=>m(T.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,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsxs)("button",{type:"button",className:`mc-btn${g==="pending"?" me-on":""}`,onClick:()=>N("pending"),children:[e("pending"),"\uFF08",r.length,"\uFF09"]}),(0,i.jsxs)("button",{type:"button",className:`mc-btn${g==="rejected"?" me-on":""}`,onClick:()=>N("rejected"),children:[e("rejected"),"\uFF08",o.length,"\uFF09"]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsxs)("label",{style:{fontSize:12},children:[(0,i.jsx)("input",{type:"checkbox",checked:F.length>0&&M.length===F.length,onChange:T=>{T.target.checked?z(new Set(F.map(O=>O.path))):z(new Set)}})," ",e("selectAll")]}),(0,i.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!M.length||!!w,onClick:()=>I("approved"),children:["\u2713 ",e(g==="rejected"?"restore":"approve")]}),g==="pending"?(0,i.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!M.length||!!w,onClick:()=>I("rejected"),children:["\u2715 ",e("reject")]}):(0,i.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!M.length||!!w,onClick:()=>{window.confirm(e("recycleDeleteConfirm"))&&I("delete")},children:["\u{1F5D1} ",e("restoreDelete")]})]}),F.length?(0,i.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:F.map(T=>(0,i.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,i.jsx)("input",{type:"checkbox",checked:k.has(T.path),onChange:()=>Q(T.path)}),(0,i.jsx)("span",{className:"mc-kind",style:{background:kn[T.kind]||"#999"}}),(0,i.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:T.title}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.6},children:Kr(T.submittedBy)}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.6},children:T.created?T.created.slice(0,16).replace("T"," "):"-"}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.6},children:T.kind}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.6,color:T.severity==="high"?"#f87171":"#9ca3af"},children:T.severity}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:T.reason||"-"}),g==="pending"?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>I("approved",[T.path]),children:"\u2713"}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>I("rejected",[T.path]),children:"\u2715"})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},title:e("restore"),onClick:()=>I("approved",[T.path]),children:"\u2713"}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},title:e("restoreDelete"),onClick:()=>{window.confirm(e("recycleDeleteConfirm"))&&I("delete",[T.path])},children:"\u{1F5D1}"})]})]},T.path))}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:e("noAuditItems")})]})]})}function Yg({t:e,onReload:t,version:n}){let[r,l]=(0,v.useState)([]),[o,a]=(0,v.useState)(""),[s,u]=(0,v.useState)(null),f=(m,k=!0)=>{u({msg:m,ok:k}),setTimeout(()=>u(null),3200)},y=(0,v.useCallback)(async()=>{try{let m=await fetch(`${Z}/recycle/list`).then(k=>k.json());m.ok&&l(m.items||[])}catch{}},[]);(0,v.useEffect)(()=>{y()},[n,y]);let h=async(m,k)=>{let z=(r.find(w=>w.path===k)||{}).title||k;a(m+k);try{let _=await fetch(Z+(m==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(k)),d=await _.json().catch(()=>null);await y(),t&&t(),_.ok&&(!d||d.ok!==!1)?f(e(m==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+z):f(e("toastFailed")+"\uFF1A"+(d&&d.error||"HTTP "+_.status),!1)}catch(w){f(e("toastFailed")+"\uFF1A"+String(w&&w.message||w),!1)}finally{a("")}};return(0,i.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,i.jsx)(tf,{toast:s}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",e("tabRecycle")]}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("recycleHint")}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-btn",disabled:!!o||r.length===0,title:r.length?"":e("emptyRecycle"),onClick:async()=>{a("purgeAll");try{let m=await fetch(Z+"/recycle/purge-expired?days=0"),k=await m.json().catch(()=>null);await y(),f(m.ok?e("toastPurgedExpired")+(k&&k.purged!=null?"\uFF08"+k.purged+"\uFF09":""):e("toastFailed"),m.ok)}catch(m){f(e("toastFailed")+"\uFF1A"+String(m&&m.message||m),!1)}finally{a("")}},children:e("emptyRecycle")})]}),r.length?(0,i.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:r.map(m=>(0,i.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,i.jsx)("span",{className:"mc-kind",style:{background:kn[m.kind]||"#999"}}),(0,i.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.title}),(0,i.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[e("deletedAt")," ",(m.deletedAt||"").slice(0,10)]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!o,onClick:()=>h("restore",m.path),children:e("restore")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!o,onClick:()=>{window.confirm(e("purgeConfirm"))&&h("purge",m.path)},children:e("purge")})]},m.path))}):(0,i.jsxs)("div",{className:"mc-card",style:{padding:18,fontSize:12.5,opacity:.78,textAlign:"center",lineHeight:1.9},children:["\u{1F5D1}\uFE0F ",e("emptyRecycle"),(0,i.jsx)("br",{}),(0,i.jsx)("span",{style:{fontSize:11.5},children:e("recycleEmptyHint").split("{days}").join("30")})]})]})]})}var Xg=({card:e,t,onOpen:n,query:r,onDelete:l})=>(0,i.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>n(e),children:[(0,i.jsxs)("h4",{children:[(0,i.jsx)("span",{className:"mc-kind",style:{background:kn[e.kind]||kn.other}}),(0,i.jsx)("span",{style:{marginRight:4},children:bi[e.kind]||"\u{1F4CE}"}),r?qp(e.title,r):e.title,lh(e.updated)&&(0,i.jsx)("span",{className:"mc-new",children:t("newBadge")}),e.status==="pending"&&(0,i.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),e.status==="rejected"&&(0,i.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",t("statusRejected")]}),(!e.status||e.status==="approved")&&(0,i.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",t("statusApproved")]})]}),(0,i.jsx)("p",{children:r?qp(e.summary||"",r):e.summary||""}),e.tags.length>0&&(0,i.jsx)("div",{className:"mc-tags",children:e.tags.slice(0,4).map(o=>(0,i.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",o]},o))}),(0,i.jsxs)("footer",{children:[(0,i.jsxs)("span",{children:[bi[e.kind]||"\u{1F4CE}"," ",t(Qt[e.kind])]}),(0,i.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",Kr(e.submittedBy)]}),(0,i.jsxs)("span",{children:["\u{1F4C5} ",Vr(e.updated)]}),(0,i.jsx)("span",{className:"spacer",style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-card-del",title:t("delete"),onClick:o=>{o.stopPropagation(),window.confirm(t("deleteConfirm"))&&l&&l(e.path)},children:"\u{1F5D1}"})]})]});function Gg({t:e,tab:t,onReload:n,version:r}){let[l,o]=(0,v.useState)(null),[a,s]=(0,v.useState)(""),[u,f]=(0,v.useState)(null),[y,h]=(0,v.useState)(null),[m,k]=(0,v.useState)(null),[z,w]=(0,v.useState)([]),[_,d]=(0,v.useState)(""),[c,g]=(0,v.useState)(!1),N=(0,v.useCallback)(async()=>{if(!(!u||!u.merge||!u.merge.length)&&window.confirm(e("mergeAllConfirm"))){d("merge");try{let M={},T=pe=>M[pe]===void 0?pe:M[pe]=T(M[pe]),O=(pe,se)=>{M[T(pe)]=T(se)},J=new Set;for(let pe of u.merge)J.add(pe.a.path),J.add(pe.b.path),O(pe.a.path,pe.b.path);let G={};for(let pe of J){let se=T(pe);(G[se]=G[se]||[]).push(pe)}let q=0;for(let pe of Object.values(G)){if(pe.length<2)continue;(await fetch(`${Z}/merge?paths=${encodeURIComponent(pe.join(","))}`).then(He=>He.json())).ok&&q++}await P(),n&&n()}catch{}d("")}},[u,P,n,e]);async function P(){try{let M=await Promise.all([fetch(`${Z}/stats`),fetch(`${Z}/budget`),fetch(`${Z}/capture-log`),fetch(`${Z}/cards?status=all&limit=30&agent=${Kl}`)]),[T,O,J,G]=await Promise.all(M.map(q=>q.json()));T&&T.ok&&o(T),O&&O.ok&&h(O),J&&J.ok&&k(J),G&&G.ok&&w(G.cards||[]),s(!T||!T.ok?e("adminLoadFail"):"")}catch{s(e("adminLoadFail"))}}let j=(0,v.useCallback)(async()=>{d("scan");try{let M=await fetch(`${Z}/optimize`).then(T=>T.json());M.ok&&f(M)}catch{s(e("adminLoadFail"))}finally{d("")}},[e]);(0,v.useEffect)(()=>{P()},[r]);let D=async(M,T)=>{if(window.confirm(e("mergeConfirm")))try{(await fetch(`${Z}/merge?paths=${encodeURIComponent(M+","+T)}`).then(J=>J.json())).ok&&(await P(),n&&n())}catch{}},F=async M=>{if(window.confirm(e("deleteConfirm")))try{(await fetch(`${Z}/delete?path=${encodeURIComponent(M)}`).then(O=>O.json())).ok&&(await P(),n&&n())}catch{}},Q=["project","knowledge","content","prompt","business","tool","mistake"],I=({title:M,kind:T,updated:O,path:J})=>(0,i.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,i.jsx)("span",{className:"mc-kind",style:{background:Ur.colors[T]||"#666"}}),(0,i.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M}),(0,i.jsx)("span",{style:{opacity:.55,fontSize:11},children:Vr(O)}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>F(J),children:[e("delete")," \u2715"]})]});return(0,i.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{style:{overflow:"auto"},children:[a&&(0,i.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,i.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",a]}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:P,children:["\u21BB ",e("retry")]})]}),t==="stats"&&(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,i.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1FAB5} ",e("captureLog")]}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("captureLogHint")}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>P(),children:["\u21BB ",e("refresh")]})]}),m?m.available===!1?(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:e("captureLogUnavailable")}):(m.entries||[]).length===0?(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:e("captureLogEmpty")}):(0,i.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,i.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,i.jsx)("tbody",{children:(m.entries||[]).map((M,T)=>{let O=Ug[M.action]||["\u2022","inherit"];return(0,i.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,i.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:Vr(M.time?new Date(M.time).toISOString():"")}),(0,i.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:O[1],fontWeight:600},children:[O[0]," ",M.action]}),(0,i.jsx)("td",{style:{padding:"4px 6px"},children:M.reason||""}),(0,i.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:M.preview||"",children:M.preview||""})]},T)})})})}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:e("loading")})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,i.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:["\u{1F916} ",e("captureAgentCards"),"\uFF08",z.length,"\uFF09"]}),z.length?(0,i.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:z.map(M=>(0,i.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,i.jsx)("span",{className:"mc-kind",style:{background:kn[M.kind]||kn.other}}),(0,i.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M.title}),M.status==="pending"&&(0,i.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",e("statusPending")]}),(0,i.jsx)("span",{style:{opacity:.55,fontSize:11},children:Vr(M.updated)})]},M.path))}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12},children:e("noCards")})]}),l&&(0,i.jsxs)(i.Fragment,{children:[l.trend&&l.trend.length>0&&(()=>{let M=l.trend,T=Math.max(...M.map(q=>q.count),1),O=260,J=50,G=O/M.length;return(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,i.jsxs)("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["\u{1F4C8} ",e("trendLabel")]}),(0,i.jsx)("svg",{width:O,height:J,style:{display:"block",width:"100%",height:50},children:M.map((q,pe)=>{let se=Math.round(q.count/T*(J-4));return(0,i.jsx)("rect",{x:pe*G+1,y:J-se,width:Math.max(G-2,2),height:se,rx:1.5,fill:q.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:q.count>0?.85:.35},q.date)})})]})})(),(0,i.jsxs)("div",{className:"mc-stats",children:[(0,i.jsxs)("div",{className:"mc-stat mc-card",children:[(0,i.jsx)("b",{children:l.total}),(0,i.jsx)("span",{children:e("total")})]}),(0,i.jsxs)("div",{className:"mc-stat mc-card",children:[(0,i.jsx)("b",{children:l.today}),(0,i.jsx)("span",{children:e("todayAdd")})]}),(0,i.jsxs)("div",{className:"mc-stat mc-card",children:[(0,i.jsx)("b",{children:l.week}),(0,i.jsx)("span",{children:e("weekAdd")})]}),(0,i.jsxs)("div",{className:"mc-stat mc-card",children:[(0,i.jsx)("b",{children:l.tags}),(0,i.jsx)("span",{children:e("tags")})]})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,i.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:e("byKind")}),(0,i.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:Q.map(M=>(0,i.jsxs)("span",{style:{fontSize:12},children:[(0,i.jsx)("span",{className:"mc-kind",style:{background:Ur.colors[M]||"#666"}}),e(Qt[M]),": ",l.byKind?.[M]||0]},M))})]}),y&&(y.budgetChars||y.recallLimit||y.embedding)&&(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,i.jsx)("b",{children:e("budgetLabel")}),"\uFF1A",e("budgetChars")," ",(0,i.jsx)("b",{children:y.budgetChars||8e4})," \xB7 ",e("recallLimitLabel")," ",(0,i.jsx)("b",{children:y.recallLimit||5})," \xB7 ",e("embeddingLabel")," ",y.embedding?"ON":"OFF"]}),(0,i.jsxs)("div",{className:"mc-card",children:[(0,i.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[e("todayList"),"\uFF08",l.todayCards?.length||0,"\uFF09"]}),l.todayCards?.length?(0,i.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:l.todayCards.map(M=>(0,i.jsx)(I,{title:M.title,kind:M.kind,updated:M.updated,path:M.path},M.path))}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12},children:e("noOptimize")})]})]})]}),t==="optimize"&&(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsx)("b",{style:{fontSize:12},children:e("organizeTitle")}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-btn",disabled:!!_,onClick:j,children:_==="scan"?e("exporting"):"\u{1F50D} "+e("scanAndOrganize")}),u&&u.merge?.length>0&&(0,i.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!_,onClick:async()=>{if(window.confirm(e("oneClickOptimizeConfirm"))){d("oneclick");try{let M=JSON.stringify({cleanupStale:c}),O=await(await fetch(`${Z}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:M})).json();O&&O.ok?(notify(`${e("oneClickOptimizeDone")}\uFF1A${O.plan.merged} ${e("optimizedMerged")}${c?` \xB7 ${O.plan.staleDeleted} ${e("optimizedStaleDeleted")}`:""}`),await P(),n&&n(),f(null)):notify(e("mergeFail"),!1)}catch{notify(e("mergeFail"),!1)}finally{d("")}}},children:_==="oneclick"?e("exporting"):"\u26A1 "+e("oneClickOptimize")}),u&&u.merge?.length>0&&(0,i.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,i.jsx)("input",{type:"checkbox",checked:c,onChange:M=>g(M.target.checked)}),e("oneClickAlsoStale")]})]}),!u&&(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:e("scanHint")}),u&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",flexDirection:"column",gap:8},children:[(0,i.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,i.jsx)("b",{style:{fontSize:12},children:e("mergePairs")}),(0,i.jsx)("div",{className:"spacer",style:{flex:1}}),u.merge?.length>0&&(0,i.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!_,onClick:N,children:e(_==="merge"?"exporting":"batchMerge")})]}),(0,i.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:e("mergePairs")}),u.merge?.length?(0,i.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:u.merge.map((M,T)=>(0,i.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,i.jsxs)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[M.a.title," \u21C4 ",M.b.title]}),(0,i.jsxs)("span",{style:{opacity:.6},children:[Math.round(M.sim*100),"%"]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>D(M.a.path,M.b.path),children:e("mergeNow")})]},T))}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:12},children:e("noOptimize")}),(0,i.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[e("staleCards"),"\uFF08",u.stale?.length||0,"\uFF09"]}),u.stale?.length>0&&(0,i.jsx)("div",{style:{marginBottom:6},children:(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!_,onClick:async()=>{if(!window.confirm(e("deleteConfirm")))return;d("clean");let M=0;for(let T of u.stale)try{await fetch(`${Z}/delete?path=${encodeURIComponent(T.path)}`),M++}catch{}d(""),notify(`${M} ${e("deletedStale")}`),await P(),n&&n()},children:e("cleanStale")})}),u.stale?.length?(0,i.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:u.stale.map(M=>(0,i.jsx)(I,{title:M.title,kind:"other",updated:M.updated,path:M.path},M.path))}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12},children:e("noOptimize")})]})})]})]})]})}var Qs=[{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 qg({t:e,newCard:t,setNewCard:n,onCreated:r}){if(!t)return null;let l=Qs.find(h=>h.key===t.template),o=t.body||(l?e(l.bodyKey):""),a=t.kind||(l?l.kind:"knowledge"),s=t.tags||(l?e(l.tagKey):""),u=t._creating,f=h=>{let m=Qs.find(k=>k.key===h);n(k=>({...k,template:h,kind:m?m.kind:k.kind,body:m?e(m.bodyKey):k.body,tags:m?e(m.tagKey):k.tags}))},y=async()=>{if(!(!t.title&&!o)){n(h=>({...h,_creating:!0}));try{(await fetch(`${Z}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t.title||e("untitled"),kind:a,tags:s.split(",").map(m=>m.trim()).filter(Boolean),body:o,source:"manual"})}).then(m=>m.json())).ok?(n(null),r&&r()):n(m=>({...m,_creating:!1}))}catch{n(m=>({...m,_creating:!1}))}}};return(0,i.jsxs)("div",{className:"me-overlay",onClick:()=>n(null),children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:h=>h.stopPropagation(),children:[(0,i.jsxs)("div",{className:"me-dialog-head",children:[(0,i.jsx)("h3",{children:e("newCard")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>n(null),children:e("close")})]}),(0,i.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,i.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[Qs.map(h=>(0,i.jsx)("button",{type:"button",className:`mc-btn${t.template===h.key?" me-on":""}`,onClick:()=>f(h.key),children:e(h.label)},h.key)),(0,i.jsx)("button",{type:"button",className:`mc-btn${t.template===""?" me-on":""}`,onClick:()=>n(h=>({...h,template:"",body:"",tags:"",kind:"knowledge"})),children:e("tplBlank")})]}),(0,i.jsx)("select",{className:"mc-btn",value:a,onChange:h=>n(m=>({...m,kind:h.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(h=>(0,i.jsx)("option",{value:h,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:h},h))}),(0,i.jsx)("input",{type:"text",className:"mc-btn",placeholder:e("cardTitle"),value:t.title||"",onChange:h=>n(m=>({...m,title:h.target.value}))}),(0,i.jsx)("input",{type:"text",className:"mc-btn",placeholder:e("tagsHint"),value:s,onChange:h=>n(m=>({...m,tags:h.target.value}))}),(0,i.jsx)("textarea",{className:"mc-btn",placeholder:e("cardBody"),value:o,onChange:h=>n(m=>({...m,body:h.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,i.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:u,onClick:y,children:e(u?"exporting":"createCard")})})]})]})]})}async function Xp(e){let t=String(e||"");if(!t)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{let n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),n.style.position="fixed",n.style.left="-9999px",n.style.top="0",document.body.appendChild(n),n.focus(),n.select();let r=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(n),r}catch{return!1}}function Zg({t:e,onClose:t}){let[n,r]=(0,v.useState)(""),[l,o]=(0,v.useState)(""),[a,s]=(0,v.useState)(""),[u,f]=(0,v.useState)(!0),[y,h]=(0,v.useState)(!1),[m,k]=(0,v.useState)(""),[z,w]=(0,v.useState)(""),_=(0,v.useRef)(null),d=(0,v.useRef)(null),c=()=>{let I=_.current;if(I)try{I.focus(),I.select()}catch{}},g=I=>{k(I),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>k(""),2400)};(0,v.useEffect)(()=>{let I=!0;return fetch(Z+"/diagnostics").then(M=>M.json()).then(M=>{I&&(M&&M.ok?(o(String(M.diagnostics||"")),s(String(M.version||""))):h(!0))}).catch(()=>{I&&h(!0)}).finally(()=>{I&&f(!1)}),()=>{I=!1}},[]),(0,v.useEffect)(()=>{let I=M=>{M.key==="Escape"&&t()};return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I),d.current&&clearTimeout(d.current)}},[t]);let N=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),P=()=>{let I=n.trim().split(`
308
- `)[0]||"",M=jp({title:"[Bug] "+(I.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Bp({description:n,diagnostics:l,version:a})});try{window.open(M,"_blank","noopener")}catch{g(e("fbCopyFail"))}},j=async()=>{await Xp(l)?(w(""),g(e("fbCopiedDiag"))):(w(l),g(e("fbCopyManual")))},D=async()=>{let I=Hp({lang:N,description:n,diagnostics:l});await Xp(I)?(w(""),g(e("fbCopiedPrompt"))):(w(I),g(e("fbCopyManual")))},F={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},Q={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,i.jsxs)("div",{className:"me-overlay",onClick:t,children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:I=>I.stopPropagation(),children:[(0,i.jsxs)("div",{className:"me-dialog-head",children:[(0,i.jsxs)("h3",{children:["\u{1F41E} ",e("fbTitle")]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:t,children:e("close")})]}),(0,i.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10},children:[(0,i.jsx)("div",{style:{fontSize:12,opacity:.72,lineHeight:1.6},children:e("fbWhy")}),(0,i.jsx)("textarea",{value:n,onChange:I=>r(I.target.value),placeholder:e("fbDesc"),rows:5,style:F}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,i.jsx)("b",{style:{fontSize:12},children:e("fbDiag")}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:j,disabled:!l,children:e("fbCopyDiag")})]}),(0,i.jsx)("pre",{style:Q,children:u?e("fbLoading"):y?e("fbDiagFail"):l})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!n.trim()){g(e("fbNeedDesc"));return}P()},style:{borderColor:"var(--dsw-alias-brand-primary, #3b82f6)",color:"var(--dsw-alias-brand-primary, #3b82f6)",fontWeight:600},children:["\u{1F680} ",e("fbOpenIssue")]}),(0,i.jsx)("span",{style:{opacity:.5,fontSize:12},children:e("fbOr")}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:D,children:["\u{1F916} ",e("fbCopyPrompt")]})]}),m&&(0,i.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:m}),z&&(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,i.jsxs)("b",{style:{fontSize:12,color:"#b45309"},children:["\u26A0 ",e("fbCopyFail")]}),(0,i.jsx)("span",{style:{fontSize:11.5,opacity:.75},children:e("fbCopyManual")}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:c,children:e("fbSelectAll")})]}),(0,i.jsx)("textarea",{ref:_,readOnly:!0,value:z,rows:7,style:F})]})]})]})]})}function Jg({t:e,card:t,query:n,onClose:r,onDelete:l,onFeedback:o}){(0,v.useEffect)(()=>{let _=d=>{d.key==="Escape"&&r()};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[r]);let{meta:a,body:s}=(0,v.useMemo)(()=>Vs(t.text||""),[t.text]),u=_=>{let d=a.find(([c])=>String(c).toLowerCase()===_);return d?d[1]:""},f=Fp(u("tags")),y=u("kind")||"knowledge",h=(u("status")||"approved").toLowerCase(),m=kn[y]||"#6B7280",k=(s||"").length>460,[z,w]=(0,v.useState)(!0);return(0,i.jsxs)("div",{className:"me-overlay",onClick:r,children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{className:"me-dialog",onClick:_=>_.stopPropagation(),children:[(0,i.jsxs)("div",{className:"me-dialog-head",children:[(0,i.jsxs)("h3",{children:[(0,i.jsx)("span",{style:{marginRight:6},children:bi[y]||"\u{1F4CE}"}),t.title]}),(0,i.jsxs)("div",{style:{display:"flex",gap:8},children:[n&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>o&&o(!0),children:["\u{1F44D} ",e("fbUseful")]}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>o&&o(!1),children:["\u{1F44E} ",e("fbNotUseful")]})]}),k&&(0,i.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":z,onClick:()=>w(_=>!_),children:e(z?"collapse":"expand")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(e("deleteConfirm"))&&l&&l(t.path)},children:e("delete")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:r,children:e("close")})]})]}),(0,i.jsxs)("div",{className:"md-meta",children:[(0,i.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:m,borderColor:m+"59",background:m+"1a"},children:[bi[y]||"\u{1F4CE}"," ",e(Qt[y]||"kindKnowledge")]}),(0,i.jsxs)("span",{className:"md-chip "+(h==="approved"?"md-chip-st-ok":h==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[h==="approved"?"\u2705":h==="pending"?"\u23F3":"\u26D4"," ",e(h==="approved"?"statusApproved":h==="pending"?"statusPending":"statusRejected")]}),f.slice(0,8).map(_=>(0,i.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",_]},_)),!!u("updated")&&(0,i.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",e("updated")," ",Vr(u("updated"))]}),!!u("source")&&(0,i.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",u("source")]})]}),(0,i.jsx)("div",{className:"me-dialog-body",style:z?{}:{maxHeight:300,overflow:"hidden"},onClick:z?void 0:_=>{_.stopPropagation(),w(!0)},children:(0,i.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Ap(s)}})}),!z&&(0,i.jsxs)("div",{className:"md-collapsed-hint",onClick:_=>{_.stopPropagation(),w(!0)},children:[e("expand")," \u2304"]})]})]})}function eh({t:e,onOpen:t,all:n,onAllChange:r,onMutate:l,active:o,visible:a}){let[s,u]=(0,v.useState)(null),[f,y]=(0,v.useState)(""),h=(0,v.useRef)(!1),m=(0,v.useRef)(0),k=(0,v.useRef)(e);k.current=e;let z=(0,v.useCallback)(async()=>{try{h.current=!1;let c=await(await fetch(`${Z}/graph${n?"?all=1":""}`)).json();c.ok?(u(c),y(""),h.current=!0):(u(null),y(c.error||e("error")))}catch(d){y(String(d&&d.message?d.message:d))}},[n,e]);(0,v.useEffect)(()=>{if(!o||h.current)return;let d=!0;return fetch(`${Z}/graph${n?"?all=1":""}`).then(c=>c.json()).then(c=>{d&&(c.ok?(u(c),y(""),h.current=!0):(u(null),y(c.error||e("error"))))}).catch(c=>{d&&y(String(c&&c.message?c.message:c))}),()=>{d=!1}},[n,e,o]),(0,v.useEffect)(()=>{a&&s&&m.current++},[a,s]);let w=(0,v.useCallback)(async d=>{try{let g=await(await fetch(`${Z}/delete?path=${encodeURIComponent(d)}`)).json();return g&&g.ok?(await z(),l&&l(),!0):!1}catch{return!1}},[z]),_=(0,v.useCallback)(async d=>{if(!d||d.length<2)return!1;try{let c=await fetch(`${Z}/merge?paths=${encodeURIComponent(d.join(","))}`).then(g=>g.json());return c&&c.ok?(await z(),l&&l(),!0):!1}catch{return!1}},[z,l]);return(0,i.jsxs)("div",{className:"me-graph",children:[(0,i.jsx)("style",{children:an}),f&&(0,i.jsxs)("div",{className:"mc-empty",children:[e("error"),"\uFF1A",f]}),!s&&!f&&(0,i.jsx)("div",{className:"mc-empty",children:e("loading")}),s&&s.nodes.length===0&&(0,i.jsx)("div",{className:"mc-empty",children:e("emptyGraph")}),s&&s.nodes.length>0&&(0,i.jsx)(nh,{nodes:s.nodes,edges:s.edges,onOpen:t,onDelete:w,onMerge:_,t:e,all:n,onAllChange:r,countLabel:`${s.nodes.length} ${e("nodes")} \xB7 ${th(s.edges)} ${e("edges")}`,fitTrigger:m.current})]})}function th(e){let t=new Set;for(let n of e||[])t.add([n.source,n.target].sort().join("|"));return t.size}var Ur={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 nh({nodes:e,edges:t,onOpen:n,onDelete:r,onMerge:l,t:o,countLabel:a,all:s,onAllChange:u,fitTrigger:f}){let y=(0,v.useRef)(null),h=(0,v.useRef)(null),m=(0,v.useRef)(null),k=(0,v.useRef)(null),z=(0,v.useRef)(null),w=(0,v.useRef)(n);(0,v.useEffect)(()=>{w.current=n},[n]);let _=(0,v.useRef)(r);(0,v.useEffect)(()=>{_.current=r},[r]);let d=(0,v.useRef)(l);(0,v.useEffect)(()=>{d.current=l},[l]);let[c,g]=(0,v.useState)(""),[N,P]=(0,v.useState)(null),j=(0,v.useRef)("");(0,v.useEffect)(()=>{j.current=c.trim().toLowerCase()},[c]),(0,v.useEffect)(()=>{let S=m.current;if(!S)return;let x=c.trim().toLowerCase();if(!x)return;let K=S.nodes.find(de=>(de.name||"").toLowerCase().includes(x));K&&(m.current.selectedId=K.id,P(K.id),S.panX=S.w/2-K.x*S.zoom,S.panY=S.h/2-K.y*S.zoom,S.render&&S.render())},[c]);let[D,F]=(0,v.useState)("all"),[Q,I]=(0,v.useState)(!1),M=(0,v.useRef)("all"),[T,O]=(0,v.useState)(""),J=(0,v.useRef)(""),[G,q]=(0,v.useState)(!1),pe=(0,v.useRef)(!1),[se,He]=(0,v.useState)(null);(0,v.useEffect)(()=>{M.current=D},[D]),(0,v.useEffect)(()=>{J.current=T},[T]),(0,v.useEffect)(()=>{pe.current=G},[G]);let Yt=(0,v.useMemo)(()=>{let S=new Map;for(let x of e)for(let K of x.tags||[]){let de=String(K).trim();de&&S.set(de,(S.get(de)||0)+1)}return[...S.entries()].sort((x,K)=>K[1]-x[1]).slice(0,24).map(([x,K])=>({tag:x,n:K}))},[e]),Se=(()=>{let S=c.trim().toLowerCase();return!!S&&!e.some(x=>(x.title||x.name||"").toLowerCase().includes(S)||String(x.kind||"").toLowerCase().includes(S)||String(Qt[x.kind]||"").toLowerCase().includes(S))})();(0,v.useEffect)(()=>{let S=m.current;S&&S.wake&&S.wake()},[c]),(0,v.useEffect)(()=>{let S=m.current;S&&S.render&&S.render()},[D,T,G]);let bt=(0,v.useRef)(null),[St,It]=(0,v.useState)([]),[Ye,Pe]=(0,v.useState)(null),[Fe,bn]=(0,v.useState)(!1),[sn,Xt]=(0,v.useState)(null),[Kn,Sn]=(0,v.useState)(""),tt=(0,v.useRef)(null),ft=(0,v.useRef)(null),ge=(S,x=!0)=>{tt.current&&clearTimeout(tt.current),Xt({msg:S,ok:x}),tt.current=setTimeout(()=>Xt(null),1900)},Gt=S=>{Sn(S),ft.current&&clearTimeout(ft.current),ft.current=setTimeout(()=>Sn(""),1600)};(0,v.useEffect)(()=>()=>{tt.current&&clearTimeout(tt.current),ft.current&&clearTimeout(ft.current)},[]);let Ae=(0,v.useMemo)(()=>e.reduce((S,x)=>(S[x.id]=x,S),{}),[e]);return(0,v.useEffect)(()=>{let S=y.current;if(!S||e.length===0)return;let x=S.getContext("2d");if(!x)return;let K=Math.max(1,window.devicePixelRatio||1),de=()=>document.documentElement.getAttribute("data-theme")==="dark",X={};t.forEach(C=>{X[C.source]=(X[C.source]||0)+1,X[C.target]=(X[C.target]||0)+1});let ye=Math.max(1,...Object.values(X)),p={nodes:e.map(C=>({id:C.id,name:C.title||"",type:C.kind||"other",r:9+Math.min(10,(X[C.id]||0)/ye*8),x:0,y:0,vx:0,vy:0})),edges:t.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:K,ctx:x,multi:[],marquee:null};p.domain=e,p.domainById=e.reduce((C,B)=>(C[B.id]=B,C),{}),p.nodes.forEach((C,B)=>{let A=B/p.nodes.length*Math.PI*2-Math.PI/2;C.x=Math.cos(A)*60,C.y=Math.sin(A)*60});let b=[...new Set(p.nodes.map(C=>C.type))];p.clustered=b.length>1,p.typeCenters={},b.forEach((C,B)=>{let A=B/b.length*Math.PI*2-Math.PI/2;p.typeCenters[C]={x:Math.cos(A)*160,y:Math.sin(A)*160}}),m.current=p;let W=0,U=0,te=()=>{let C=S.clientWidth,B=S.clientHeight;p.w=C,p.h=B,S.width=C*K,S.height=B*K,x.setTransform(K,0,0,K,0,0),(W===0||U===0)&&C>0&&B>0&&p.tickCount>0&&requestAnimationFrame(()=>re()),W=C,U=B};te();let Ce=new ResizeObserver(te);Ce.observe(S.parentElement);let ne=(C,B)=>C&&C.length>B?C.slice(0,B)+"\u2026":C,ue=(C,B,A,$)=>{if(x.beginPath(),$==="rect")x.rect(C-A,B-A*.75,A*2,A*1.5);else if($==="diamond")x.moveTo(C,B-A),x.lineTo(C+A,B),x.lineTo(C,B+A),x.lineTo(C-A,B),x.closePath();else if($==="hexagon"){for(let Y=0;Y<6;Y++){let fe=Math.PI/3*Y-Math.PI/2,oe=C+A*Math.cos(fe),Ue=B+A*Math.sin(fe);Y===0?x.moveTo(oe,Ue):x.lineTo(oe,Ue)}x.closePath()}else x.arc(C,B,A,0,Math.PI*2)},L=new Map,V=(C,B)=>{let A=C+"|"+Math.round(B),$=L.get(A);if(!$){let Y=parseInt(C.slice(1,3),16),fe=parseInt(C.slice(3,5),16),oe=parseInt(C.slice(5,7),16);$=x.createRadialGradient(-B*.3,-B*.3,0,0,0,B*1.2),$.addColorStop(0,"rgba("+Math.min(255,Y+70)+","+Math.min(255,fe+70)+","+Math.min(255,oe+70)+",0.95)"),$.addColorStop(1,C),L.set(A,$)}return $},re=()=>{if(!p.nodes.length)return;let C=1/0,B=-1/0,A=1/0,$=-1/0;p.nodes.forEach(Nt=>{C=Math.min(C,Nt.x),B=Math.max(B,Nt.x),A=Math.min(A,Nt.y),$=Math.max($,Nt.y)});let Y=20,fe=B-C+Y*2,oe=$-A+Y*2,Ue=Math.min(p.w/fe,p.h/oe);p.zoom=Math.max(.35,Math.min(1.8,Ue)),p.panX=p.w/2-(C+B)/2*p.zoom,p.panY=p.h/2-(A+$)/2*p.zoom};k.current=re;let _e=()=>{x.clearRect(0,0,p.w,p.h),p.searchTerm=j.current,p.kindFilter=M.current,p.timeMode=pe.current,p.tagFilter=J.current;let C=p.tagFilter,B=p.kindFilter,A=E=>String(E||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");x.save(),x.strokeStyle=de()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",x.lineWidth=.5;for(let E=0;E<p.w;E+=24)x.beginPath(),x.moveTo(E,0),x.lineTo(E,p.h),x.stroke();for(let E=0;E<p.h;E+=24)x.beginPath(),x.moveTo(0,E),x.lineTo(p.w,E),x.stroke();x.restore(),x.save(),x.translate(p.panX,p.panY),x.scale(p.zoom,p.zoom);let $={};p.nodes.forEach(E=>$[E.id]=E);let Y=p.nodes.length>40,fe=Y?1.5:.55,oe=p.selectedId||p.hoverId,Ue=Wp({panX:p.panX,panY:p.panY,zoom:p.zoom,w:p.w,h:p.h,margin:80}),Nt=(()=>{let E=(p.searchTerm||"").toLowerCase();if(!E)return null;let ie=[];for(let ae of p.nodes){let Ie=(p.domainById[ae.id]||{}).kind||"other";if(((ae.name||"").toLowerCase().includes(E)||String(Qt[Ie]||"").toLowerCase().includes(E)||String(Ie).toLowerCase().includes(E))&&ie.push(ae.id),ie.length>200)break}return ie})(),Qn=Up(p.nodes,{limit:$p(p.nodes.length),focusId:oe,hoverId:p.hoverId,searchHits:Nt,degree:X}),he=new Map,Ne=(E,ie)=>{let ae=E+"|"+ie,we=he.get(ae);return we===void 0&&(x.font=E,we=x.measureText(ie).width,he.set(ae,we)),we},mt=p.nodes.length<=250,Et=new Map;p.edges.forEach(E=>{let ie=$[E.sourceNodeId],ae=$[E.targetNodeId];if(!ie||!ae||!wi(ie.x,ie.y,10,Ue)&&!wi(ae.x,ae.y,10,Ue))return;if(B!=="all"){let dr=p.domainById[E.sourceNodeId]&&p.domainById[E.sourceNodeId].kind,Jt=p.domainById[E.targetNodeId]&&p.domainById[E.targetNodeId].kind;if(dr!==B&&Jt!==B)return}if(C){let dr=p.domainById[E.sourceNodeId]&&(p.domainById[E.sourceNodeId].tags||[]).includes(C),Jt=p.domainById[E.targetNodeId]&&(p.domainById[E.targetNodeId].tags||[]).includes(C);if(!dr&&!Jt)return}let we=ae.x-ie.x,Ie=ae.y-ie.y,at=Math.sqrt(we*we+Ie*Ie)||1,un=Y?12:18,Cn=-Ie/at*un,Yl=we/at*un,Xl=(ie.x+ae.x)/2+Cn,Gl=(ie.y+ae.y)/2+Yl,Yr=Ur.colors[p.domainById[ie.id]&&p.domainById[ie.id].kind||"other"],Xr=oe&&(E.sourceNodeId===oe||E.targetNodeId===oe),Si=oe?Xr?.6:.08:Y?.14:.24,Zt=parseInt(Yr.slice(1,3),16),Gr=parseInt(Yr.slice(3,5),16),Ci=parseInt(Yr.slice(5,7),16),At=Xr?1.6+(E.weight||1):.8+(E.weight||1)*.5,Yn=Zt+","+Gr+","+Ci+","+Si+","+At,zt=Et.get(Yn);zt||(zt={path:new Path2D,stroke:"rgba("+Zt+","+Gr+","+Ci+","+Si+")",width:At},Et.set(Yn,zt)),zt.path.moveTo(ie.x,ie.y),zt.path.quadraticCurveTo(Xl,Gl,ae.x,ae.y)}),Et.forEach(E=>{x.strokeStyle=E.stroke,x.lineWidth=E.width,x.stroke(E.path)});let gt=null;oe&&(gt=new Set,p.edges.forEach(E=>{E.sourceNodeId===oe?gt.add(E.targetNodeId):E.targetNodeId===oe&&gt.add(E.sourceNodeId)}));let qt=[];if(p.nodes.forEach(E=>{if(!wi(E.x,E.y,E.r+2,Ue))return;let ie=p.domainById[E.id]||{},ae=ie.kind||"other",we=p.timeMode?rh(ie.updated):Ur.colors[ae],Ie=Ur.shapes[ae],at=p.selectedId===E.id,un=p.hoverId===E.id,Cn=p.searchTerm||"",Yl=!Cn||(E.name||"").toLowerCase().includes(Cn)||String(Qt[ae]||"").toLowerCase().includes(Cn)||String(ae).toLowerCase().includes(Cn),Xl=B==="all"||ae===B,Gl=!C||(ie.tags||[]).includes(C),Yr=oe&&E.id!==oe&&!(gt&&gt.has(E.id))||Cn&&!Yl||!Xl||!Gl;x.save(),x.globalAlpha=Yr?.08:1,(at||un)&&mt&&(x.shadowColor=we,x.shadowBlur=at?20:14),x.translate(E.x,E.y),ue(0,0,E.r,Ie),x.fillStyle=V(we,E.r),x.fill(),x.restore(),at?(x.save(),ue(E.x,E.y,E.r+3,Ie),x.strokeStyle=we,x.lineWidth=3,x.shadowColor=we,x.shadowBlur=12,x.stroke(),x.restore()):un?(x.save(),ue(E.x,E.y,E.r+2,Ie),x.strokeStyle=we,x.lineWidth=2,x.stroke(),x.restore()):Cn&&Yl?(x.save(),ue(E.x,E.y,E.r+2,Ie),x.strokeStyle="#e11d48",x.lineWidth=2,x.stroke(),x.restore()):p.multi.indexOf(E.id)>=0&&(x.save(),ue(E.x,E.y,E.r+2,Ie),x.strokeStyle="#60a5fa",x.lineWidth=2,x.shadowColor="#60a5fa",x.shadowBlur=8,x.stroke(),x.restore());let Xr=ne(E.name,16);if((at||un||Qn.has(E.id)&&p.zoom>fe||!Y&&p.zoom>.6)&&Xl&&Gl){let Zt=1/p.zoom,Gr="500 "+(12*Zt).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";x.font=Gr;let At=Ne(Gr,Xr)+16*Zt,Yn=18*Zt,zt=E.y+E.r+8*Zt,dr=!0;for(let Jt of qt)if(E.x-At/2<Jt.x+Jt.w&&E.x+At/2>Jt.x&&zt<Jt.y+Jt.h&&zt+Yn>Jt.y){dr=!1;break}if(!dr&&!at&&!un)return;qt.push({x:E.x-At/2,y:zt,w:At,h:Yn}),x.fillStyle=de()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",x.beginPath(),x.roundRect?x.roundRect(E.x-At/2,zt,At,Yn,4*Zt):x.rect(E.x-At/2,zt,At,Yn),x.fill(),x.strokeStyle=de()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",x.lineWidth=1*Zt,x.stroke(),x.fillStyle=de()?at||un?"#eee":"#bbb":at||un?"#111":"#444",x.textAlign="center",x.fillText(Xr,E.x,zt+13*Zt)}}),x.restore(),p.marquee){let E=p.marquee,ie=Math.min(E.sx,E.ex),ae=Math.min(E.sy,E.ey),we=Math.abs(E.ex-E.sx),Ie=Math.abs(E.ey-E.sy);x.save(),x.setLineDash([4,4]),x.strokeStyle="rgba(96,165,250,0.9)",x.lineWidth=1,x.fillStyle="rgba(96,165,250,0.12)",x.fillRect(ie,ae,we,Ie),x.strokeRect(ie,ae,we,Ie),x.restore()}if(p.hoverId&&bt.current){let E=p.domainById[p.hoverId],ie=p.nodes.find(function(ae){return ae.id===p.hoverId});if(E&&ie){let ae=p.edges.filter(function(at){return at.sourceNodeId===E.id||at.targetNodeId===E.id}).length,we=ie.x*p.zoom+p.panX,Ie=ie.y*p.zoom+p.panY;bt.current.style.display="block",bt.current.style.left=we+14+"px",bt.current.style.top=Ie-6+"px",bt.current.innerHTML="<b>"+A(E.title||E.name||"")+'</b><br/><span style="opacity:.8">'+A(E.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",ae)+"</span>"}}else bt.current&&(bt.current.style.display="none")},ee=()=>{p.running=!0,p.raf||(p.raf=requestAnimationFrame(Xe))};p.wake=ee,p.render=_e;let ze=()=>{let C=p.nodes.length;p.tickCount++;let A=.9-Math.min(.4,p.tickCount/1500),$=C>1e3?3e3:C>100?2e3:C>50?1200:800,Y=C>100?.002:.005,fe=C>1e3?.012:C>100?.005:.01,oe=C>1e3?6:C>200?12:24,Ue={};p.nodes.forEach(he=>Ue[he.id]=he);for(let he=0;he<C;he++){if(p.dragNode===p.nodes[he])continue;let Ne=p.nodes[he],mt=0,Et=0;for(let E=0;E<C;E++){if(he===E)continue;let ie=Ne.x-p.nodes[E].x,ae=Ne.y-p.nodes[E].y,we=Math.sqrt(ie*ie+ae*ae)||1,Ie=$/(we*we);mt+=ie/we*Ie,Et+=ae/we*Ie}if(p.clustered&&p.typeCenters[Ne.type]){let E=p.typeCenters[Ne.type];mt+=(E.x-Ne.x)*.006,Et+=(E.y-Ne.y)*.006}else mt-=Ne.x*fe,Et-=Ne.y*fe;let gt=(Ne.vx+mt)*A,qt=(Ne.vy+Et)*A;gt=Math.max(-oe,Math.min(oe,gt)),qt=Math.max(-oe,Math.min(oe,qt)),Ne.vx=gt,Ne.vy=qt}p.edges.forEach(he=>{let Ne=Ue[he.sourceNodeId],mt=Ue[he.targetNodeId];if(!Ne||!mt)return;let Et=mt.x-Ne.x,gt=mt.y-Ne.y,qt=Math.sqrt(Et*Et+gt*gt)||1,E=(qt-100)*Y,ie=Et/qt*E,ae=gt/qt*E;p.dragNode!==Ne&&(Ne.vx+=ie,Ne.vy+=ae),p.dragNode!==mt&&(mt.vx-=ie,mt.vy-=ae)});let Nt=0;p.nodes.forEach(he=>{p.dragNode!==he&&(he.x+=he.vx,he.y+=he.vy,Nt+=he.vx*he.vx+he.vy*he.vy)}),p.autoFitPending&&p.tickCount>45&&(p.autoFitPending=!1,re()),(C?Math.sqrt(Nt/C):0)<.05&&p.tickCount>60&&!p.dragNode?p.quietTicks=(p.quietTicks|0)+1:p.quietTicks=0},Xe=()=>{if(p.running){try{ze(),_e()}catch{}if(p.quietTicks>30){p.raf=0;return}p.raf=requestAnimationFrame(Xe)}},nt=(C,B)=>{let A=S.getBoundingClientRect();return{x:(C-A.left-p.panX)/p.zoom,y:(B-A.top-p.panY)/p.zoom}},Ot=C=>{let B=p.domainById[C];return!(!B||M.current!=="all"&&B.kind!==M.current||J.current&&!(B.tags||[]).includes(J.current))},Ct=(C,B,A)=>Math.max(B,Math.min(A,C)),Ft=C=>{p.mouseX=C.clientX,p.mouseY=C.clientY;let B=nt(C.clientX,C.clientY),A=null;for(let $=p.nodes.length-1;$>=0;$--){let Y=p.nodes[$];if(!Ot(Y.id))continue;let fe=Y.x-B.x,oe=Y.y-B.y;if(fe*fe+oe*oe<Y.r*Y.r+36){A=Y.id;break}}A!==p.hoverId&&(p.hoverId=A,ee())},Ql=C=>{if(C.button!==0)return;let B=nt(C.clientX,C.clientY),A=null;for(let $=p.nodes.length-1;$>=0;$--){let Y=p.nodes[$];if(!Ot(Y.id))continue;let fe=Y.x-B.x,oe=Y.y-B.y;if(fe*fe+oe*oe<Y.r*Y.r+25){A=Y;break}}if(C.shiftKey){if(A){p.shiftClick=A.id;return}p.marquee={sx:C.clientX,sy:C.clientY,ex:C.clientX,ey:C.clientY};return}p.dragStart={x:C.clientX,y:C.clientY,px:p.panX,py:p.panY},p.dragging=!1,p.dragNode=A||null,A&&(p.dragOffset={dx:A.x-B.x,dy:A.y-B.y})},qs=C=>{if(p.marquee){p.marquee.ex=C.clientX,p.marquee.ey=C.clientY,ee();return}if(!p.dragStart)return;let B=C.clientX-p.dragStart.x,A=C.clientY-p.dragStart.y;if(Math.abs(B)+Math.abs(A)>3&&(p.dragging=!0),p.dragNode){let $=nt(C.clientX,C.clientY);p.dragNode.x=$.x+p.dragOffset.dx,p.dragNode.y=$.y+p.dragOffset.dy,ee()}else p.dragging&&(p.panX=Ct(p.dragStart.px+B,-1e5,1e5),p.panY=Ct(p.dragStart.py+A,-1e5,1e5),ee())},Zs=C=>{if(p.marquee){let A=p.marquee;p.marquee=null;let $=S.getBoundingClientRect(),Y=Math.min(A.sx,A.ex)-$.left,fe=Math.max(A.sx,A.ex)-$.left,oe=Math.min(A.sy,A.ey)-$.top,Ue=Math.max(A.sy,A.ey)-$.top,Nt=p.nodes.filter(Qn=>{let he=Qn.x*p.zoom+p.panX,Ne=Qn.y*p.zoom+p.panY;return he>=Y&&he<=fe&&Ne>=oe&&Ne<=Ue}).map(Qn=>Qn.id);p.multi=Nt,It(Nt),ee();return}let B=p.dragStart&&!p.dragging;if(p.shiftClick){let A=p.shiftClick;p.shiftClick=null;let $=Array.isArray(p.multi)?p.multi.slice():[];$.includes(A)||$.push(A),p.multi=$,It($),ee();return}if(B){let A=nt(C.clientX,C.clientY),$=null;for(let Y=p.nodes.length-1;Y>=0;Y--){let fe=p.nodes[Y];if(!Ot(fe.id))continue;let oe=fe.x-A.x,Ue=fe.y-A.y;if(oe*oe+Ue*Ue<fe.r*fe.r+20){$=fe;break}}$?(p.selectedId=$.id,P($.id),ee()):(p.selectedId=null,p.hoverId=null,C.shiftKey||(p.multi=[],It([])),P(null),ee())}p.dragStart=null,p.dragging=!1,p.dragNode=null},Js=C=>{C.preventDefault();let B=nt(C.clientX,C.clientY),A=null;for(let $=p.nodes.length-1;$>=0;$--){let Y=p.nodes[$];if(!Ot(Y.id))continue;let fe=Y.x-B.x,oe=Y.y-B.y;if(fe*fe+oe*oe<Y.r*Y.r+25){A=Y;break}}if(A){let $=p.domainById[A.id];$&&He({x:C.clientX,y:C.clientY,id:A.id,path:$.id,title:$.title})}else He(null)},eu=C=>{C.preventDefault();let B=S.getBoundingClientRect(),A=(C.clientX-B.left-p.panX)/p.zoom,$=(C.clientY-B.top-p.panY)/p.zoom,Y=Math.max(.3,Math.min(3,p.zoom*(C.deltaY<0?1.1:1/1.1)));p.panX=Ct(p.panX+A*(p.zoom-Y),-1e5,1e5),p.panY=Ct(p.panY+$*(p.zoom-Y),-1e5,1e5),p.zoom=Y,ee()};S.addEventListener("mousemove",Ft),S.addEventListener("mousedown",Ql),window.addEventListener("mousemove",qs),window.addEventListener("mouseup",Zs),S.addEventListener("wheel",eu,{passive:!1}),S.addEventListener("contextmenu",Js),z.current=()=>{p.selectedId=null,p.hoverId=null,p.multi=[],It([]),re(),ee()};for(let C=0;C<200;C++)ze();re(),ee();let tu=()=>I(!1);return window.addEventListener("mousedown",tu),()=>{p.running=!1,p.raf&&cancelAnimationFrame(p.raf),Ce.disconnect(),S.removeEventListener("mousemove",Ft),S.removeEventListener("mousedown",Ql),window.removeEventListener("mousemove",qs),window.removeEventListener("mouseup",Zs),S.removeEventListener("wheel",eu),S.removeEventListener("contextmenu",Js),window.removeEventListener("mousedown",tu)}},[e,t]),(0,v.useEffect)(()=>{f!==void 0&&k.current&&requestAnimationFrame(()=>k.current())},[f]),(0,i.jsxs)("div",{className:"me-graph",ref:h,children:[(0,i.jsxs)("div",{className:"me-graph-toolbar",children:[(0,i.jsxs)("span",{className:"me-graph-count",children:[e.length," ",o("nodes")," \xB7 ",t.length," ",o("edges")]}),(0,i.jsx)("span",{className:"spacer",style:{flex:1}}),(0,i.jsx)("input",{type:"text",placeholder:o("search"),value:c,onChange:S=>g(S.target.value)}),(0,i.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>I(S=>!S),"aria-expanded":Q,title:o("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",o("filterLabel")," ",D!=="all"||G||T?"\u25CF":"\u25BE"]}),Q&&(0,i.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,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,i.jsx)("button",{type:"button",className:`lg${D==="all"&&!G?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{F("all"),q(!1)},children:o("all")}),Object.keys(kn).map(S=>(0,i.jsxs)("button",{type:"button",className:`lg${D===S?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>F(x=>x===S?"all":S),children:[(0,i.jsx)("span",{className:"mc-kind",style:{background:Ur.colors[S]||kn[S]}}),o(Qt[S])]},S)),(0,i.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,i.jsxs)("button",{type:"button",className:`lg${G?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>q(S=>!S),children:["\u23F1 ",o("timeDim")]}),Yt.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,i.jsx)("div",{style:{maxHeight:130,overflow:"auto",display:"flex",flexWrap:"wrap",gap:4},children:Yt.map(S=>(0,i.jsxs)("button",{type:"button",className:`lg${T===S.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>O(x=>x===S.tag?"":S.tag),title:S.tag,children:["#",S.tag," ",(0,i.jsx)("span",{style:{opacity:.55},children:S.n})]},S.tag))})]}),(D!=="all"||G||T)&&(0,i.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{F("all"),q(!1),O("")},children:[o("clearFilter")," \u2715"]})]})})]}),(0,i.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:o("crossVault"),children:[(0,i.jsx)("input",{type:"checkbox",checked:!!s,onChange:S=>u&&u(S.target.checked)}),o("crossVault")]}),(0,i.jsx)("button",{type:"button",className:`mc-btn${G?" me-on":""}`,onClick:()=>q(S=>!S),children:o("timeDim")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let S=y.current;if(S)try{S.toBlob(x=>{x&&Pe({url:URL.createObjectURL(x),blob:x})},"image/png")}catch{}},children:o("exportGraph")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>k.current&&k.current(),children:o("fit")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{P(null),F("all"),z.current&&z.current()},children:o("reset")})]}),(0,i.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,i.jsx)("canvas",{ref:y,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,i.jsx)("div",{className:"me-graph-tooltip",ref:bt,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)"}}),Se&&(0,i.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:o("noMatch")}),se&&(0,i.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>He(null)}),se&&(0,i.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:se.x,top:se.y,zIndex:31},onMouseDown:S=>S.stopPropagation(),children:[(0,i.jsx)("button",{type:"button",onClick:()=>{w.current({path:se.path,title:se.title}),He(null)},children:o("openCard")}),(0,i.jsx)("button",{type:"button",onClick:()=>{se.id&&(m.current.selectedId=se.id,P(se.id)),He(null);let S=m.current;S&&S.wake&&S.wake()},children:o("focusNeighbors")}),(0,i.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(se.title||"")}catch{}He(null),ge(o("copied"))},children:o("copyName")}),(0,i.jsx)("button",{type:"button",onClick:()=>{let S=m.current,x=S&&Array.isArray(S.multi)?S.multi.slice():[],K=se.id;if(K&&!x.includes(K)&&x.push(K),He(null),x.length<2){ge(o("mergeNeed"),!1);return}if(!window.confirm(o("mergeConfirm")))return;let de=d.current&&d.current(x);de&&de.then?de.then(X=>X?ge(o("merged")):ge(o("mergeFail"),!1)).catch(()=>ge(o("mergeFail"),!1)):de&&ge(o("merged"))},children:o("merge")}),(0,i.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let S=se.path;He(null),window.confirm(o("deleteConfirm"))&&(async()=>{try{(_.current?await _.current(S):!1)?ge(o("deleted")):ge(o("deleteFail"),!1)}catch{ge(o("deleteFail"),!1)}})()},children:o("delete")})]}),St.length>0&&(0,i.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,i.jsxs)("span",{style:{fontWeight:700},children:[St.length," ",o("nodes")]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let x=St.map(ye=>Ae[ye]).filter(Boolean).map(ye=>ye.title||ye.name).join(`
309
- `),K=new Blob([x],{type:"text/plain;charset=utf-8"}),de=URL.createObjectURL(K),X=document.createElement("a");X.href=de,X.download="memory-selected.txt",document.body.appendChild(X),X.click(),document.body.removeChild(X),setTimeout(()=>URL.revokeObjectURL(de),1e3),ge(St.length+o("exportedSel"))},children:o("exportSel")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(St.length<2){ge(o("mergeNeed"),!1);return}let S=St.map(K=>Ae[K]?Ae[K].id:K);if(!window.confirm(o("mergeConfirm")))return;It([]);let x=m.current;x&&(x.multi=[]),fetch(`${Z}/merge?paths=${encodeURIComponent(S.join(","))}`).then(K=>K.json()).then(K=>{K&&K.ok?ge(o("merged")):ge(o("mergeFail"),!1)}).catch(()=>ge(o("mergeFail"),!1))},children:o("merge")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(o("deleteConfirm")))return;let S=St.map(K=>Ae[K]?Ae[K].id:K);It([]);let x=m.current;x&&(x.multi=[]),(async()=>{let K=0;for(let de of S)try{(_.current?await _.current(de):!1)&&K++}catch{}ge(K+o("deletedSelected"),K>0)})()},children:o("deleteSelected")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let S=m.current;S&&(S.multi=[]),It([]);let x=m.current;x&&x.render&&x.render()},children:o("clearSelection")})]}),N&&(0,i.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,i.jsx)("div",{style:{fontWeight:700,fontSize:13,marginBottom:4},children:Ae[N]?Ae[N].title||Ae[N].name:N}),(0,i.jsx)("div",{style:{opacity:.8,marginBottom:8},children:Ae[N]?o(Qt[Ae[N].kind]||"kindKnowledge"):"\u2014"}),(0,i.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:o("graphHint")}),(t.filter(S=>S.source===N||S.target===N)||[]).slice(0,8).map((S,x)=>{let K=S.source===N?S.target:S.source,de=Ae[K];return(0,i.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:X=>{X.preventDefault();let ye=m.current;ye&&(ye.selectedId=K,ye.hoverId=K,ye.wake&&ye.wake()),P(K)},children:de?(de.title||de.name).slice(0,28):K},x)})]})]}),(0,i.jsx)("div",{className:"me-graph-tip",children:o("graphTip")}),sn&&(0,i.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 "+(sn.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,i.jsx)("span",{style:{color:sn.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:sn.ok?"\u2713":"\u2715"}),(0,i.jsx)("span",{style:{wordBreak:"break-all"},children:sn.msg})]}),Ye&&(0,i.jsxs)("div",{className:"me-overlay",onClick:()=>{Ye.url&&URL.revokeObjectURL(Ye.url),Pe(null),bn(!1)},children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{className:"me-dialog",style:{maxWidth:Fe?"100vw":900,width:Fe?"100vw":"92vw",maxHeight:Fe?"100%":"90vh",height:Fe?"100%":void 0,borderRadius:Fe?0:14},onClick:S=>S.stopPropagation(),children:[(0,i.jsxs)("div",{className:"me-dialog-head",children:[(0,i.jsx)("h3",{children:o("exportGraph")}),(0,i.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,i.jsx)("a",{className:"mc-btn",href:Ye.url,download:"memory-graph.png",onClick:()=>{Gt("download"),ge(o("downloaded")+" \xB7 "+o("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:o(Kn==="download"?"done":"download")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Gt("full"),bn(S=>!S),ge(o("fullscreen"))},children:o(Kn==="full"?"done":Fe?"exitFull":"fullscreen")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let S=Ye.blob;S&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":S})]).then(()=>{Gt("copy"),ge(o("copied"))}).catch(()=>{ge(o("copyFail"),!1)}):ge(o("copyFail"),!1)},children:o(Kn==="copy"?"done":"copyImage")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ye.url&&URL.revokeObjectURL(Ye.url),Pe(null),bn(!1)},children:o("close")})]})]}),(0,i.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Fe?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,i.jsx)("img",{src:Ye.url,alt:o("exportGraph"),style:{maxWidth:"100%",maxHeight:Fe?"calc(100% - 64px)":"70vh",borderRadius:Fe?0:8,cursor:"zoom-in"},onClick:()=>bn(S=>!S)})})]})]})]})}function rh(e){let t=new Date(e||0).getTime();if(!t)return"#94a3b8";let n=(Date.now()-t)/864e5;return n<3?"#10b981":n<14?"#f59e0b":n<30?"#f97316":"#94a3b8"}function Gp({label:e,value:t=[],options:n,onChange:r,placeholder:l,z:o=20}){let[a,s]=(0,v.useState)(!1),u=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!a)return;let w=_=>{u.current&&!u.current.contains(_.target)&&s(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[a]);let f=Array.isArray(t)?t:[],y=f.includes("__all__"),h=y?n.find(w=>w.value==="__all__")?.label||"":f.length?f.map(w=>n.find(_=>_.value===w)?.label||w).join("\u3001"):"",m=(w,_)=>{if(w.value==="__all__"){r(_?["__all__"]:[]);return}let d=new Set(f);d.has("__all__")&&d.delete("__all__"),_?d.add(w.value):d.delete(w.value),r([...d])},k=n.find(w=>w.value==="__all__"),z=n.filter(w=>w.value!=="__all__");return(0,i.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,i.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:e}),(0,i.jsxs)("div",{ref:u,style:{position:"relative",minWidth:0},children:[(0,i.jsxs)("button",{type:"button",onClick:()=>s(w=>!w),style:{width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[(0,i.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h||l||"\u2014"}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),a&&(0,i.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:o,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:[k&&(0,i.jsxs)("label",{onClick:w=>w.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,i.jsx)("input",{type:"checkbox",checked:y,onChange:w=>m(k,w.target.checked)}),(0,i.jsx)("span",{children:k.label})]}),z.map(w=>(0,i.jsxs)("label",{onClick:_=>_.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,i.jsx)("input",{type:"checkbox",checked:f.includes(w.value),onChange:_=>m(w,_.target.checked)}),(0,i.jsx)("span",{children:w.label})]},w.value))]})]})]})}function lh(e){let t=new Date(e||0).getTime();return!!t&&(Date.now()-t)/864e5<3}async function oh(e,t,n){if(n&&typeof window.showSaveFilePicker=="function")try{let o=await window.showSaveFilePicker({suggestedName:t}),a=await o.createWritable();return await a.write(e),await a.close(),{ok:!0,picked:!0,name:o.name}}catch(o){return o&&o.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(o.message||o)}}let r=URL.createObjectURL(e),l=document.createElement("a");return l.href=r,l.download=t,document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(r),1e3),{ok:!0,picked:!1,name:t}}function qp(e,t){if(!t||!e)return e;let n=e.toLowerCase(),r=t.toLowerCase(),l=[],o=0;for(;o<e.length;){let a=n.indexOf(r,o);if(a<0){l.push(e.slice(o));break}a>o&&l.push(e.slice(o,a)),l.push((0,i.jsx)("mark",{className:"mc-hl",children:e.slice(a,a+r.length)},a)),o=a+r.length}return l}function Vr(e){if(!e)return"";let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let n=new Date,r=t.toDateString()===n.toDateString(),l=a=>String(a).padStart(2,"0"),o=`${l(t.getHours())}:${l(t.getMinutes())}`;return r?o:`${t.getMonth()+1}-${t.getDate()} ${o}`}var Gs=Xn(Ul(),1);function ih(){try{let e=new URLSearchParams(window.location.search).get("lang");if(e==="zh"||e==="en")return e}catch{}return typeof navigator<"u"&&String(navigator.language||"").toLowerCase().startsWith("zh")?"zh":"en"}function ah(){let[e,t]=(0,Qr.useState)(ih);(0,Qr.useEffect)(()=>{let r=l=>{let o=l&&l.data;o&&o.source==="memory-eternal"&&o.type==="locale"&&(o.lang==="zh"||o.lang==="en")&&t(o.lang)};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)},[]);let n=(0,Qr.useMemo)(()=>r=>(e==="zh"?Ys:Zp)[r]??Ys[r]??r,[e]);return document.documentElement.lang=e==="zh"?"zh-CN":"en",(0,Gs.jsx)(ef,{t:n,inModal:!1})}var sh=(0,nf.createRoot)(document.getElementById("root"));sh.render((0,Gs.jsx)(ah,{}));})();
307
+ `);let nt=new Blob([te],{type:Xe}),Ot=await oh(nt,ze,!1);if(!Ot.ok){G({ok:!1,msg:e("exportFail")}),He(!1);return}G({ok:!0,msg:e("exportedTo")+"\uFF1A"+e("defaultDownloads")+" \xB7 "+Ot.name})}catch(re){G({ok:!1,msg:e("exportFail")+" \xB7 "+(re.message||"")})}finally{He(!1)}q.current&&clearTimeout(q.current),q.current=setTimeout(()=>G(null),2600)},Ce=async L=>{let V=L.target.files&&L.target.files[0];if(L.target.value="",!!V){try{let re=await V.text(),te=await(await fetch(`${J}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:re})).json();if(te.ok){await ye();let ze=te.imported||0,Xe=e("importedVault")+"\uFF1A"+ze;te.total&&(Xe+=e("importedTotal")+te.total+e("importedTotalTail")),te.quarantined&&(Xe+=e("importedQuarantine")+te.quarantined+e("importedQuarantineTail")),te.skipped&&(Xe+=e("importedSkipped")+te.skipped+e("importedSkippedTail")),te.warning&&(Xe+=" \xB7 "+te.warning),G({ok:ze>0||!te.total,msg:Xe})}else G({ok:!1,msg:te.error||e("importFail")})}catch{G({ok:!1,msg:e("importFail")})}q.current&&clearTimeout(q.current),q.current=setTimeout(()=>G(null),2400)}},Z=(0,v.useMemo)(()=>{let L=s.slice();return g!=="all"&&(L=L.filter(V=>Kr(V.submittedBy)===g)),P!=="all"&&(L=L.filter(V=>(V.status||"approved")===P)),T==="title"?L.sort((V,re)=>String(V.title||"").localeCompare(String(re.title||""))):T==="hot"?L.sort((V,re)=>(re.weight||re.links||0)-(V.weight||V.links||0)):L.sort((V,re)=>new Date(re.updated||0).getTime()-new Date(V.updated||0).getTime()),L},[s,T,g,P]),ue=(0,v.useMemo)(()=>[...new Set(s.map(L=>Kr(L.submittedBy)))],[s]);return(0,i.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,i.jsx)("style",{children:an}),ee&&(0,i.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 "+(ee.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,i.jsx)("span",{style:{color:ee.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:ee.ok?"\u2713":"\u2715"}),(0,i.jsx)("span",{children:ee.msg})]}),t&&(0,i.jsxs)("div",{className:"me-modal-head",children:[(0,i.jsxs)("div",{className:"me-modal-title",children:[(0,i.jsx)("span",{className:"me-wicon",children:(0,i.jsx)(Vg,{})}),(0,i.jsx)("h2",{children:e("memoryTitle")}),(0,i.jsx)("span",{children:e("memoryHint")})]}),(0,i.jsx)("div",{className:"spacer"}),r&&(0,i.jsx)("button",{type:"button",className:"me-modal-close",onClick:r,"aria-label":e(l?"exitFull":"fullscreen"),children:l?"\u2750":"\u26F6"}),(0,i.jsx)("button",{type:"button",className:"me-modal-close",onClick:n,"aria-label":e("close"),children:"\u2715"})]}),h&&h.ok===!1&&(0,i.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,i.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",e("captureAlert")]}),(0,i.jsxs)("span",{style:{flex:1},children:[h.reason,(0,i.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:e("captureAlertHint")})]}),(0,i.jsx)("span",{style:{opacity:.7},children:h.since?Vr(new Date(h.since).toISOString()):""})]}),(0,i.jsxs)("div",{className:"me-modal-body",children:[(0,i.jsxs)("div",{className:`mc-rail${Pe?" open":""}`,children:[(0,i.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Fe(L=>!L),"aria-label":e(Pe?"collapse":"expand"),title:e(Pe?"collapse":"expand"),children:Pe?"\xAB":"\xBB"}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="cards"?" active":""}`,onClick:()=>M("cards"),title:e("cardsTab"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("cardsTab")})]}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="graph"?" active":""}`,onClick:()=>M("graph"),title:e("graphTab"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("graphTab")})]}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="stats"?" active":""}`,onClick:()=>M("stats"),title:e("tabUsage"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("tabUsage")})]}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="audit"?" active":""}`,onClick:()=>M("audit"),title:e("tabAudit"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("tabAudit")}),tt>0&&(0,i.jsx)("span",{className:"mc-dot",children:tt>99?"99+":tt})]}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="optimize"?" active":""}`,onClick:()=>M("optimize"),title:e("tabRecycle"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("tabRecycle")}),ft>0&&(0,i.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:ft>99?"99+":ft})]}),(0,i.jsxs)("button",{type:"button",className:`mc-railbtn${D==="config"?" active":""}`,onClick:()=>M("config"),title:e("tabConfig"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("tabConfig")})]}),(0,i.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Ye(!0),title:e("fbNav"),children:[(0,i.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),Pe&&(0,i.jsx)("span",{className:"mc-rail-label",children:e("fbNav")})]})]}),(0,i.jsxs)("div",{className:"mc-main",ref:de,children:[D==="cards"&&(0,i.jsxs)("div",{className:"mc-stats",children:[(0,i.jsx)($r,{label:e("total"),value:o?o.total:"\u2014"}),(0,i.jsx)($r,{label:e("recent"),value:o?o.recent:"\u2014"}),(0,i.jsx)($r,{label:e("tags"),value:o?o.tags:"\u2014"}),(0,i.jsx)($r,{label:e("pending"),value:o?.quarantine?.pending??o?.status?.pending??0}),(0,i.jsx)($r,{label:e("rejected"),value:o?.quarantine?.rejected??o?.status?.rejected??0}),(0,i.jsx)($r,{label:e("cardCount"),value:o?o.byKind?.knowledge??0:"\u2014"})]}),D==="cards"&&(0,i.jsxs)("div",{className:"mc-toolbar",children:[(0,i.jsx)("input",{type:"text",placeholder:e("searchPlaceholder"),value:d,onChange:L=>b(L.target.value)}),(0,i.jsx)("input",{ref:pe,type:"file",accept:".json,application/json",style:{display:"none"},onChange:Ce}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>pe.current&&pe.current.click(),children:e("importVault")}),(0,i.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>sn({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",e("newCard")]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",disabled:se,onClick:()=>ne("md"),children:e(se?"exporting":"exportVault")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",disabled:se,onClick:()=>ne("json"),children:e(se?"exporting":"exportJson")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ye(),children:e("refresh")})]}),D==="cards"&&(0,i.jsxs)("div",{className:"mc-chips",children:[Xs.map(L=>(0,i.jsx)("button",{type:"button",className:`mc-chip${w===L?" active":""}`,onClick:()=>W(L),children:e(L==="all"?"all":Qt[L])},L)),(0,i.jsxs)("select",{value:g,onChange:L=>N(L.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,i.jsxs)("option",{value:"all",children:["\u{1F916} ",e("allAgents")]}),Jp(ue).map(L=>(0,i.jsx)("option",{value:L,children:L},L))]}),(0,i.jsxs)("select",{value:P,onChange:L=>j(L.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,i.jsx)("option",{value:"all",children:e("allStatus")}),(0,i.jsx)("option",{value:"approved",children:e("statusApproved")}),(0,i.jsx)("option",{value:"pending",children:e("statusPending")}),(0,i.jsx)("option",{value:"rejected",children:e("statusRejected")})]}),(0,i.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:e("sortRecent")},{key:"title",label:e("sortTitle")},{key:"hot",label:e("sortHot")}].map(L=>(0,i.jsx)("button",{type:"button",className:`mc-chip${T===L.key?" active":""}`,onClick:()=>O(L.key),children:L.label},L.key))]}),k&&(0,i.jsxs)("div",{className:"mc-empty",children:[e("error"),"\uFF1A",k]}),(0,i.jsx)("div",{style:{display:D==="cards"?"contents":"none"},children:f?(0,i.jsx)("div",{className:"mc-empty",children:e("loading")}):k?(0,i.jsxs)("div",{className:"mc-empty",children:[e("error"),"\uFF1A",k," ",(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ye(),children:e("retry")})]}):s.length===0?(0,i.jsx)("div",{className:"mc-empty",children:e("empty")}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"mc-grid",children:Z.map(L=>(0,i.jsx)(Xg,{card:L,t:e,query:d.trim(),onOpen:U,onDelete:p},L.path))}),s.length<Gt&&(0,i.jsx)("div",{ref:K,style:{height:1}}),S&&(0,i.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[e("loading"),"\uFF08",s.length," / ",Gt,"\uFF09"]})]})}),(0,i.jsx)("div",{style:{display:D==="graph"?"flex":"none",flex:1,minHeight:0},children:Q.has("graph")&&(0,i.jsx)(eh,{t:e,onOpen:U,all:bt,onAllChange:St,onMutate:Sn,active:D==="graph",visible:D==="graph"})}),(0,i.jsx)("div",{style:{display:D==="config"?"contents":"none"},children:Q.has("config")&&(0,i.jsx)(Kg,{t:e,onReload:()=>ye(),version:Xt})}),(0,i.jsx)("div",{style:{display:D==="stats"?"contents":"none"},children:Q.has("stats")&&(0,i.jsx)(Gg,{t:e,tab:"stats",onReload:()=>ye(),version:Xt})}),(0,i.jsx)("div",{style:{display:D==="audit"?"contents":"none"},children:Q.has("audit")&&(0,i.jsx)(Qg,{t:e,onReload:()=>ye(),version:Xt})}),(0,i.jsx)("div",{style:{display:D==="optimize"?"contents":"none"},children:Q.has("optimize")&&(0,i.jsx)(Yg,{t:e,onReload:()=>ye(),version:Xt})}),It&&(0,i.jsx)(Zg,{t:e,onClose:()=>Ye(!1)}),Yt&&(0,i.jsx)(Jg,{t:e,card:Yt,query:d.trim(),onClose:()=>Se(null),onDelete:L=>{Se(null),p(L)},onFeedback:L=>{let V=Yt.path;fetch(`${J}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:d.trim(),path:V,useful:L})}).then(()=>G({ok:!0,msg:e(L?"fbUseful":"fbIrr")})).catch(()=>{}),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>G(null),2e3)}}),(0,i.jsx)(qg,{t:e,newCard:bn,setNewCard:sn,onCreated:()=>{ye(),Sn(),G({ok:!0,msg:e("created")}),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>G(null),2e3)}})]})]})]})}var tf=({toast:e})=>e?(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"8px 12px",fontSize:12,borderLeft:"4px solid "+(e.ok?"#10b981":"#ef4444"),background:e.ok?"rgba(16,185,129,0.08)":"rgba(239,68,68,0.08)"},children:[e.ok?"\u2705":"\u26A0"," ",e.msg]}):null,$r=({label:e,value:t})=>(0,i.jsxs)("div",{className:"mc-stat mc-card",children:[(0,i.jsx)("b",{children:t}),(0,i.jsx)("span",{children:e})]});function Kg({t:e,onReload:t,version:n,compact:r}){let[l,o]=(0,v.useState)(null),[a,s]=(0,v.useState)(0),[u,f]=(0,v.useState)(null),[y,h]=(0,v.useState)(null),[m,k]=(0,v.useState)(!1),[z,w]=(0,v.useState)(!1),_=(0,v.useRef)(!1),d=(0,v.useRef)(null),c=(0,v.useRef)({}),[g,N]=(0,v.useState)(null),[P,j]=(0,v.useState)(null),[D,F]=(0,v.useState)(""),[Q,I]=(0,v.useState)(""),[M,T]=(0,v.useState)(""),[O,ee]=(0,v.useState)(null),G=(0,v.useCallback)(async b=>{I("version");try{let W=await fetch(J+"/version-check"+(b?"?force=1":"")).then(U=>U.json());W&&W.ok?(ee(W),b&&Se(W.updateAvailable?e("vcLatest")+" v"+W.latest:e("vcUpToDate"))):b&&Se(e("vcCheckFail"),!1)}catch{b&&Se(e("vcCheckFail"),!1)}finally{I("")}},[e]);(0,v.useEffect)(()=>{G(!1)},[n,G]);let[q,pe]=(0,v.useState)(""),[se,He]=(0,v.useState)(null),Yt=(0,v.useRef)(null),Se=(b,W=!0)=>{Yt.current&&clearTimeout(Yt.current),He({msg:b,ok:W}),Yt.current=setTimeout(()=>He(null),1900)},bt=async()=>{if(!Q){I("restart");try{let b=await fetch(J+"/restart-self",{method:"POST"});if(b.status===404||b.status===405){Se(Ye("vcRestartNoRoute",{cmd:O&&O.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let W=await b.json().catch(()=>null);if(!W){Se(e("vcRestartFail")+"\uFF08HTTP "+b.status+"\uFF09",!1);return}if(!W.ok){Se(W.error||e("vcRestartFail"),!1);return}if(W.alreadyCurrent){Se(W.note||e("vcRestartCurrent"));return}Se(W.note||e("vcRestartSent")),W.alreadyRunning||setTimeout(()=>{G(!0)},6e3)}catch(b){Se(e("vcRestartFail")+"\uFF1A"+String(b&&b.message||b),!1)}finally{I("")}}},St=O&&O.resident?String(O.resident.served||""):"",It=!!(O&&O.onDisk&&St&&St!==O.onDisk),Ye=(b,W)=>Object.keys(W).reduce((U,ne)=>U.split("{"+ne+"}").join(W[ne]),e(b)),Pe=(0,v.useCallback)(async()=>{try{let[b,W,U]=await Promise.all([fetch(`${J}/config`).then(ne=>ne.json()).catch(()=>null),fetch(`${J}/setup-status`).then(ne=>ne.json()).catch(()=>null),fetch(`${J}/budget`).then(ne=>ne.json()).catch(()=>null)]);if(b&&b.ok){o(b),s(b.revision??0),f(b.schema??null);let ne=Vp(b.config??{},c.current);c.current=ne.overlay,h({...ne.values}),N(b.dsh??null),k(b.writable===!1),w(b.viaPending===!0),F(""),_.current=!1}else U&&U.ok?(h({...U}),k(!0),F(e("configNeedsDsh"))):F(e("adminLoadFail"));W&&W.ok&&j(W),T("")}catch{F(e("adminLoadFail"))}},[e]);(0,v.useEffect)(()=>{Pe()},[n,Pe]);let Fe=(b,W)=>{_.current=!0,h(U=>({...U??{},[b]:W}))};(0,v.useEffect)(()=>{d.current=Pe},[Pe]),(0,v.useEffect)(()=>{if(typeof EventSource>"u")return;let b=null;try{b=new EventSource(J+"/events")}catch{return}let W=()=>{!_.current&&typeof d.current=="function"&&d.current()};try{b.addEventListener("config",W)}catch{}return()=>{try{b.close()}catch{}}},[]);let bn=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),sn=b=>({init:e("modeInit"),interval:e("modeInterval"),manual:e("modeManual")})[b]||b,Xt=async()=>{if(!y)return;if(m){Se(e("editInSetting"),!1);return}let b={dedupThreshold:[0,1],captureMinChars:[0,1e6],captureCooldownMs:[0,1e9],maxCardsPerDay:[0,1e6],captureMaxTokens:[100,4e3],recallMinScore:[0,50],recallLimit:[1,20],recallSummaryLen:[40,400],recycleRetentionDays:[1,3650],webPort:[1,65535],webCheckIntervalMs:[1e3,6e5],webMaxRestart:[1,1e3],sessionBudgetChars:[0,1e9]},W=[];for(let[U,[ne,Ce]]of Object.entries(b)){if(!(U in y))continue;let Z=y[U],ue=typeof Z=="number"?Z:Number(Z);(Z===""||Z===null||Z===void 0||!Number.isFinite(ue)||ue<ne||ue>Ce)&&W.push(e("invalidField",{field:U,min:ne,max:Ce,value:String(Z===""?"\u7A7A":Z)}))}if(W.length){let U=e("saveInvalid")+"\uFF1A"+W.join("\uFF1B");F(U),Se(U,!1);return}I("save");try{let U={...y};for(let ue of Object.keys(y))ue in U&&typeof U[ue]=="string"&&U[ue].trim()!==""&&bn.has(ue)&&(U[ue]=Number(U[ue]));Array.isArray(U.vaultProfiles)&&(U.vaultProfiles=U.vaultProfiles.filter(ue=>ue&&(String(ue.name||"").trim()||String(ue.path||"").trim())));let ne=await fetch(`${J}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:U,expectedRevision:a})}),Ce=await ne.text(),Z=null;try{Z=Ce?JSON.parse(Ce):null}catch{Z=null}if(Z||(Z={error:"HTTP "+ne.status+(Ce?"\uFF1A"+Ce.slice(0,200):"\uFF08\u5BBF\u4E3B\u672A\u8FD4\u56DE\u539F\u56E0\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u6709\u6570\u5B57\u5B57\u6BB5\u4E3A\u7A7A\u6216\u8D85\u51FA\u8303\u56F4\uFF09")}),Z&&Z.ok){let ue=typeof Z.pendingOutcome=="string"?Z.pendingOutcome:"",L,V=!0;if(ue==="applied")L=e("savedApplied")+(Array.isArray(Z.applied)&&Z.applied.length?" \xB7 "+Z.applied.join("\u3001"):"");else if(ue==="queued")V=!1,L=e("saveQueued");else if(ue==="failed")V=!1,L=e("saveFail")+" \xB7 "+(Z.hostGuard?e("saveHostGuard"):e("saveFailHint"));else if(ue==="applied-direct")L=e("savedOk")+" \xB7 "+e("savedDirect");else{let re=Array.isArray(Z.pending)&&Z.pending.length?" \xB7 "+e("savePending"):Z.note?" \xB7 "+e("restartHint"):"";L=(Z.retried?"\u267B ":"")+e("savedOk")+re}c.current={...c.current,...U},V?T(L):F(L),Se(L,V),await Pe()}else{let ue=ne.status===409?e("conflictRefresh"):Z?.error||e("saveFail");F(ue),Se(ue,!1)}}catch{F(e("saveFail")),Se(e("saveFail"),!1)}finally{I("")}},Kn=()=>{c.current={},h({...l?.config??{}}),T("")},Sn={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},tt=b=>Array.isArray(b?.vaultProfiles)?b.vaultProfiles:[],ft=(b,W,U)=>h(ne=>{let Ce=tt(ne).map(ue=>({...ue||{}})),Z={...Ce[b]||{}};return W==="match"?String(U).trim()?Z.match={...Z.match||{},workspace:U}:delete Z.match:Z[W]=U,Ce[b]=Z,{...ne??{},vaultProfiles:Ce}}),ge=()=>h(b=>({...b??{},vaultProfiles:[...tt(b),{name:"",path:""}]})),Gt=b=>h(W=>({...W??{},vaultProfiles:tt(W).filter((U,ne)=>ne!==b)})),Ae={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},S={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},x={A:{label:e("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:2e3,recallMinScore:2,recallLimit:5,recallSummaryLen:130,recallIncludeBody:!1,captureCooldownMs:3e5},B:{label:e("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:e("planC"),autoWebMode:"interval",watchdogAutoSpawn:!0,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:1200,recallMinScore:1,recallLimit:8,recallSummaryLen:200,recallIncludeBody:!0,captureCooldownMs:12e4}},K=async b=>{let W=x[b];W&&h(U=>({...U??{},...W}))},de=async(b,W)=>{I(b+W);try{let ne=await(await fetch(`${J}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:b,action:W})})).json();ne&&ne.ok?Se(Ye(W==="install"?"mcpInstalled":"mcpUninstalled",{agent:b})):Se(Ye("mcpActionFail",{agent:b,error:ne?.error||""}),!1);try{let Ce=await fetch(`${J}/setup-status`).then(Z=>Z.json());Ce&&Ce.ok&&j(Ce)}catch{}}catch{Se(e("mergeFail"),!1)}finally{I("")}},X=({k:b,label:W,type:U="text",step:ne,min:Ce,max:Z})=>(0,i.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,i.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:W||b}),(0,i.jsx)("input",{type:U,step:ne,min:Ce,max:Z,value:y?y[b]??"":"",onChange:ue=>{let L=ue.target.value;Fe(b,U==="number"?L===""?"":Number(L):L)},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}})]}),ye=new Set(["autoRestartOnDrift"]),p=({k:b,label:W})=>{let U=y?y[b]:void 0,ne=U===void 0?ye.has(b):!!U;return(0,i.jsxs)("label",{style:{display:"flex",alignItems:"flex-start",gap:6,fontSize:12,minWidth:0,lineHeight:1.5},children:[(0,i.jsx)("input",{type:"checkbox",checked:ne,onChange:Ce=>Fe(b,Ce.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,i.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:W||b})]})};return(0,i.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:r?"0 0 auto":1,minHeight:0,maxHeight:r?"52vh":void 0},children:[(0,i.jsx)("style",{children:an}),se&&(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(se.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,i.jsx)("span",{style:{color:se.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:se.ok?"\u2713":"\u2715"}),(0,i.jsx)("span",{style:{wordBreak:"break-all"},children:se.msg})]}),(0,i.jsxs)("div",{style:{overflow:"auto",padding:4},children:[D&&(0,i.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,i.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",D]}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:Pe,children:["\u21BB ",e("retry")]})]}),z&&(0,i.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #3b82f6",background:"rgba(59,130,246,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#1d4ed8",lineHeight:1.7},children:["\u2139 ",e("pendingSyncNote")]}),m&&(0,i.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 ",e("configNeedsDsh")," \u2014\u2014 ",e("editInSetting")]}),M&&(0,i.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 ",M]}),l&&(l.version||l.dsh?.vaultDir)&&(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,i.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",e("pluginInfo")]}),(0,i.jsx)("span",{style:{fontSize:12,opacity:.7},children:e("dshHostLabel")}),l.version&&(0,i.jsxs)("code",{style:Ae,children:[e("vcLoaded")," v",l.version]}),O&&O.resident&&O.resident.served&&O.resident.served!==l.version&&(0,i.jsxs)("code",{style:Ae,children:[e("vcResident")," v",O.resident.served]}),Vl&&(0,i.jsxs)("code",{style:Ae,children:[e("vcPage")," v",Vl]}),O&&O.onDisk&&(0,i.jsxs)("code",{style:Ae,children:[e("vcOnDisk")," v",O.onDisk]}),O&&O.latest&&(0,i.jsxs)("code",{style:Ae,children:[e("vcLatest")," v",O.latest]}),l.dsh?.vaultDir&&(0,i.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",l.dsh.vaultDir]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-btn",disabled:Q==="version",onClick:()=>G(!0),children:Q==="version"?e("checking"):"\u{1F504} "+e("vcCheck")})]}),O&&O.stale&&(0,i.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:[(0,i.jsxs)("div",{children:["\u26A0\uFE0F ",Ye("vcStale",{disk:O.onDisk,loaded:O.loaded})]}),It?(0,i.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:6,flexWrap:"wrap"},children:[(0,i.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!Q,onClick:bt,children:Q==="restart"?"\u23F3 "+e("vcRestarting"):"\u{1F504} "+e("vcRestart")}),O.restartCommand&&(0,i.jsx)("code",{style:{fontSize:11,opacity:.75},children:O.restartCommand})]}):(0,i.jsxs)("div",{style:{marginTop:6,lineHeight:1.7},children:["\u2139\uFE0F ",e("vcHostStale"),O.restartCommand&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsx)("code",{style:{fontSize:11,opacity:.75},children:O.restartCommand})]})]})]}),Vl&&O&&O.onDisk&&Vl!==O.onDisk&&(0,i.jsx)("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",lineHeight:1.7},children:e("vcPageStale",{page:Vl,disk:O.onDisk})}),O&&O.updateAvailable&&(0,i.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",e("vcOutdated")," \u2192 ",(0,i.jsx)("code",{children:O.updateCommand})]}),O&&O.checkError&&(0,i.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[e("vcCheckFail"),"\uFF1A",O.checkError]})]}),P&&P.agents&&(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F50C} ",e("mcpSetupStatus")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("mcpManageHint")})]}),(0,i.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:P.agents.map(b=>(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[(0,i.jsxs)("span",{style:{flex:1},children:[(0,i.jsx)("b",{children:b.isDsh?e("dshHostLabel"):b.name}),b.isDsh&&b.version&&(0,i.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",b.version]}),!b.installed&&(0,i.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",e("notInstalled"),")"]}),b.installed&&b.mcpConfigured===!1&&(0,i.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",e("noMcpEntry"),")"]}),b.mcpConfigured===!0&&(0,i.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",e("healthy")]}),b.mcpConfigured===!0&&b.mcpMatchesCurrentNode===!1&&(0,i.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",e("nodePathNote"),")"]}),b.isDsh&&(0,i.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",e("recallTool"),": ",b.recallTool?e("enabled"):e("disabled"),")"]})]}),b.hook&&(0,i.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",b.hook]}),!b.isDsh&&b.installed&&b.mcpConfigured===!1&&(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!Q,onClick:()=>de(b.name,"install"),children:e("installMcp")}),!b.isDsh&&b.installed&&b.mcpConfigured===!0&&(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!Q,onClick:()=>{window.confirm(e("uninstallConfirm"))&&de(b.name,"uninstall")},children:e("uninstallMcp")})]},b.name))}),(0,i.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:e("mcpSetupHint")}),q&&(0,i.jsx)("div",{style:{fontSize:11,marginTop:6},children:(0,i.jsx)("code",{style:{padding:"2px 6px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:4},children:q})})]}),y?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",e("presetConfig")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("presetHint")})]}),(0,i.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(b=>(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>K(b),disabled:!!Q,children:[b==="A"?"\u{1F7E2} ":b==="B"?"\u{1F4B0} ":"\u2B50 ",x[b].label]},b))})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,i.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F9E0} ",e("dshMemoryConfig")]})}),(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,i.jsx)(p,{k:"autoCapture",label:e("autoCapture")}),(0,i.jsx)(p,{k:"autoRecall",label:e("autoRecall")}),(0,i.jsx)(X,{k:"captureMinChars",label:e("captureMinChars"),type:"number"}),(0,i.jsx)(X,{k:"maxCardsPerDay",label:e("maxCardsPerDay"),type:"number"}),(0,i.jsx)(X,{k:"dedupThreshold",label:e("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,i.jsx)(X,{k:"recallLimit",label:e("recallLimit"),type:"number"}),(0,i.jsx)(X,{k:"recallSummaryLen",label:e("recallSummaryLen"),type:"number"}),(0,i.jsx)(p,{k:"recallIncludeBody",label:e("recallBody")}),(0,i.jsx)(X,{k:"secretHint",label:e("secretHint")}),(0,i.jsx)(X,{k:"recallEmbedding",label:e("recallEmbedding")})]})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #06b6d4"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F5C2}\uFE0F ",e("vaultMulti")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("vaultMultiHint")})]}),(0,i.jsxs)("div",{style:{fontSize:11.5,opacity:.85,marginBottom:8,lineHeight:1.7},children:[e("vaultNow"),"\uFF1A",(0,i.jsx)("code",{children:g?.vaultDir||"\u2014"}),g?.vaultName?`\uFF08${g.vaultName}\uFF09`:""," \xB7 ",e("vaultSource"),"\uFF1A",e(Sn[g?.vaultSource]||"vaultSrcDefault"),g?.workspace?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("br",{}),e("vaultWorkspace"),"\uFF1A",(0,i.jsx)("code",{children:g.workspace})]}):null]}),tt(y).map((b,W)=>(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,i.jsx)("input",{value:b.name||"",placeholder:e("vaultNamePh"),onChange:U=>ft(W,"name",U.target.value),style:S,disabled:m}),(0,i.jsx)("input",{value:b.path||"",placeholder:e("vaultPathPh"),onChange:U=>ft(W,"path",U.target.value),style:S,disabled:m}),(0,i.jsx)("input",{value:b.match&&b.match.workspace||"",placeholder:e("vaultMatchPh"),onChange:U=>ft(W,"match",U.target.value),style:S,disabled:m}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Gt(W),disabled:m,title:e("delete"),children:"\u2715"})]},W)),(0,i.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:ge,disabled:m,children:["\uFF0B ",e("vaultAdd")]}),(0,i.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,i.jsx)("span",{style:{opacity:.6},children:e("vaultActive")}),(0,i.jsxs)("select",{value:y.activeVault||"",onChange:b=>Fe("activeVault",b.target.value),disabled:m,style:S,children:[(0,i.jsx)("option",{value:"",children:e("vaultActiveNone")}),tt(y).filter(b=>b&&b.name).map(b=>(0,i.jsx)("option",{value:b.name,children:b.name},b.name))]})]})]})]}),(0,i.jsx)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,i.jsx)(p,{k:"enabled",label:e("enabledLabel")}),(0,i.jsx)(X,{k:"vaultDir",label:e("vaultDirLabel")})]})}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #f59e0b"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F4B0} ",e("costControl")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("costHint")})]}),(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8,marginTop:6},children:[(0,i.jsx)(p,{k:"distillEnabled",label:e("distillEnabled")}),(0,i.jsx)(p,{k:"dedupByLLM",label:e("dedupByLLM")}),(0,i.jsx)(X,{k:"captureMaxTokens",label:e("captureMaxTokens"),type:"number"}),(0,i.jsx)(X,{k:"recallMinScore",label:e("recallMinScore"),type:"number"}),(0,i.jsx)(X,{k:"captureCooldownMs",label:e("captureCooldownMs"),type:"number"}),(0,i.jsx)(X,{k:"captureProvider",label:e("captureProvider")}),(0,i.jsx)(X,{k:"captureModel",label:e("captureModel")}),(0,i.jsx)(X,{k:"sessionBudgetChars",label:e("sessionBudgetChars"),type:"number"})]})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",e("auditConfig")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("auditHint")})]}),(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,i.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,i.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:e("auditMode")}),(0,i.jsxs)("select",{value:y.auditMode??"all",onChange:b=>Fe("auditMode",b.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,i.jsx)("option",{value:"all",children:e("auditAll")}),(0,i.jsx)("option",{value:"none",children:e("auditNone")})]})]}),(0,i.jsx)(Gp,{label:e("auditExemptAgents"),value:y.auditExemptAgents||[],options:[{value:"__all__",label:e("allExempt")},...(P?.agents||[]).filter(b=>!b.isDsh).map(b=>({value:b.name,label:b.name}))],onChange:b=>Fe("auditExemptAgents",b)}),(0,i.jsx)(Gp,{label:e("auditExemptKinds"),value:y.auditExemptKinds||[],options:[{value:"__all__",label:e("allExempt")},...Xs.filter(b=>b!=="all").map(b=>({value:b,label:e(Qt[b])}))],onChange:b=>Fe("auditExemptKinds",b)}),(0,i.jsx)(X,{k:"recycleRetentionDays",label:e("recycleDays"),type:"number"})]})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,i.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E0} ",e("serviceConfig")]})}),(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,i.jsx)(p,{k:"autoWeb",label:e("autoWeb")}),(0,i.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,i.jsx)("span",{style:{opacity:.6},children:e("autoWebMode")}),(0,i.jsxs)("select",{value:y.autoWebMode??"init",onChange:b=>Fe("autoWebMode",b.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,i.jsx)("option",{value:"init",children:e("modeInit")}),(0,i.jsx)("option",{value:"interval",children:e("modeInterval")}),(0,i.jsx)("option",{value:"manual",children:e("modeManual")})]})]}),(0,i.jsx)(X,{k:"webPort",label:e("webPort"),type:"number"}),(0,i.jsx)(X,{k:"webCheckIntervalMs",label:e("webCheckIntervalMs"),type:"number"}),(0,i.jsx)(X,{k:"webMaxRestart",label:e("webMaxRestart"),type:"number"}),(0,i.jsx)(p,{k:"watchdogAutoSpawn",label:e("watchdogAutoSpawn")}),(0,i.jsx)(p,{k:"autoRestartOnDrift",label:e("autoRestartOnDrift")}),(0,i.jsx)(p,{k:"autoMcpSetup",label:e("autoMcpSetup")})]})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[Q==="save"&&(0,i.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",e("saving")]}),M&&Q!=="save"&&(0,i.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",M]}),D&&Q!=="save"&&(0,i.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",D]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:Kn,disabled:!!Q,children:e("reset")}),(0,i.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:m?()=>Se(e("readonlyTitle")+"\uFF1A"+e("readonlyBody"),!1):Xt,disabled:Q==="save",title:e(m?"readonlyBody":"saveConfig"),children:Q==="save"?"\u23F3 "+e("saving"):m?"\u{1F512} "+e("readonlyBtn"):"\u{1F4BE} "+e("saveConfig")})]})]}):(0,i.jsx)("div",{style:{fontSize:12,opacity:.6},children:e("loading")})]})]})}function Qg({t:e,onReload:t,version:n}){let[r,l]=(0,v.useState)([]),[o,a]=(0,v.useState)([]),[s,u]=(0,v.useState)("all"),[f,y]=(0,v.useState)("all"),[h,m]=(0,v.useState)(""),[k,z]=(0,v.useState)(new Set),[w,_]=(0,v.useState)(""),[d,c]=(0,v.useState)(null),[g,N]=(0,v.useState)("pending"),P=(T,O=!0)=>{c({msg:T,ok:O}),setTimeout(()=>c(null),3e3)},j=[...new Set([...r,...o].map(T=>T.submittedBy).filter(Boolean))],D=(0,v.useCallback)(async()=>{try{let T=await fetch(`${J}/audit/list`).then(O=>O.json());T.ok&&(l(T.pending||[]),a(T.rejected||[]),z(new Set))}catch{}},[]);(0,v.useEffect)(()=>{D()},[n,D]);let F=(g==="pending"?r:o).filter(T=>{if(s!=="all"&&T.kind!==s||f!=="all"&&Kr(T.submittedBy)!==f)return!1;if(h){let O=(T.created||"").slice(0,10);if(O&&O!==h)return!1}return!0}),Q=T=>z(O=>{let ee=new Set(O);return ee.has(T)?ee.delete(T):ee.add(T),ee}),I=async(T,O)=>{let ee=O||[...k];if(!ee.length){P(e("noSelection"),!1);return}_("apply");let G=e(T==="approved"?"toastApproved":T==="rejected"?"toastRejected":"toastCardDeleted");try{let q=0;for(let pe of ee){let se=T==="approved"?"audit/approve":T==="rejected"?"audit/reject":"delete";try{(await fetch(J+"/"+se+"?path="+encodeURIComponent(pe)+(T==="delete"?"&permanent=0":""))).ok||q++}catch{q++}}await D(),t&&t(),q?P(e("toastFailed")+"\uFF08"+q+"/"+ee.length+"\uFF09",!1):P(G+" "+ee.length+" \u5F20")}catch(q){P(e("toastFailed")+": "+String(q&&q.message||q),!1)}finally{_("")}},M=[...k];return(0,i.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,i.jsx)(tf,{toast:d}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",e("tabAudit")]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsxs)("select",{value:s,onChange:T=>u(T.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,i.jsx)("option",{value:"all",children:e("all")}),Xs.filter(T=>T!=="all").map(T=>(0,i.jsx)("option",{value:T,children:e(Qt[T])},T))]}),(0,i.jsxs)("select",{value:f,onChange:T=>y(T.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,i.jsx)("option",{value:"all",children:e("allAgents")}),Jp(j).map(T=>(0,i.jsx)("option",{value:T,children:T},T))]}),(0,i.jsx)("input",{type:"date",value:h,onChange:T=>m(T.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,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsxs)("button",{type:"button",className:`mc-btn${g==="pending"?" me-on":""}`,onClick:()=>N("pending"),children:[e("pending"),"\uFF08",r.length,"\uFF09"]}),(0,i.jsxs)("button",{type:"button",className:`mc-btn${g==="rejected"?" me-on":""}`,onClick:()=>N("rejected"),children:[e("rejected"),"\uFF08",o.length,"\uFF09"]}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsxs)("label",{style:{fontSize:12},children:[(0,i.jsx)("input",{type:"checkbox",checked:F.length>0&&M.length===F.length,onChange:T=>{T.target.checked?z(new Set(F.map(O=>O.path))):z(new Set)}})," ",e("selectAll")]}),(0,i.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!M.length||!!w,onClick:()=>I("approved"),children:["\u2713 ",e(g==="rejected"?"restore":"approve")]}),g==="pending"?(0,i.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!M.length||!!w,onClick:()=>I("rejected"),children:["\u2715 ",e("reject")]}):(0,i.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!M.length||!!w,onClick:()=>{window.confirm(e("recycleDeleteConfirm"))&&I("delete")},children:["\u{1F5D1} ",e("restoreDelete")]})]}),F.length?(0,i.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:F.map(T=>(0,i.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,i.jsx)("input",{type:"checkbox",checked:k.has(T.path),onChange:()=>Q(T.path)}),(0,i.jsx)("span",{className:"mc-kind",style:{background:kn[T.kind]||"#999"}}),(0,i.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:T.title}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.6},children:Kr(T.submittedBy)}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.6},children:T.created?T.created.slice(0,16).replace("T"," "):"-"}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.6},children:T.kind}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.6,color:T.severity==="high"?"#f87171":"#9ca3af"},children:T.severity}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:T.reason||"-"}),g==="pending"?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>I("approved",[T.path]),children:"\u2713"}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>I("rejected",[T.path]),children:"\u2715"})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},title:e("restore"),onClick:()=>I("approved",[T.path]),children:"\u2713"}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},title:e("restoreDelete"),onClick:()=>{window.confirm(e("recycleDeleteConfirm"))&&I("delete",[T.path])},children:"\u{1F5D1}"})]})]},T.path))}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:e("noAuditItems")})]})]})}function Yg({t:e,onReload:t,version:n}){let[r,l]=(0,v.useState)([]),[o,a]=(0,v.useState)(""),[s,u]=(0,v.useState)(null),f=(m,k=!0)=>{u({msg:m,ok:k}),setTimeout(()=>u(null),3200)},y=(0,v.useCallback)(async()=>{try{let m=await fetch(`${J}/recycle/list`).then(k=>k.json());m.ok&&l(m.items||[])}catch{}},[]);(0,v.useEffect)(()=>{y()},[n,y]);let h=async(m,k)=>{let z=(r.find(w=>w.path===k)||{}).title||k;a(m+k);try{let _=await fetch(J+(m==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(k)),d=await _.json().catch(()=>null);await y(),t&&t(),_.ok&&(!d||d.ok!==!1)?f(e(m==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+z):f(e("toastFailed")+"\uFF1A"+(d&&d.error||"HTTP "+_.status),!1)}catch(w){f(e("toastFailed")+"\uFF1A"+String(w&&w.message||w),!1)}finally{a("")}};return(0,i.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,i.jsx)(tf,{toast:s}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",e("tabRecycle")]}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("recycleHint")}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-btn",disabled:!!o||r.length===0,title:r.length?"":e("emptyRecycle"),onClick:async()=>{a("purgeAll");try{let m=await fetch(J+"/recycle/purge-expired?days=0"),k=await m.json().catch(()=>null);await y(),f(m.ok?e("toastPurgedExpired")+(k&&k.purged!=null?"\uFF08"+k.purged+"\uFF09":""):e("toastFailed"),m.ok)}catch(m){f(e("toastFailed")+"\uFF1A"+String(m&&m.message||m),!1)}finally{a("")}},children:e("emptyRecycle")})]}),r.length?(0,i.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:r.map(m=>(0,i.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,i.jsx)("span",{className:"mc-kind",style:{background:kn[m.kind]||"#999"}}),(0,i.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.title}),(0,i.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[e("deletedAt")," ",(m.deletedAt||"").slice(0,10)]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!o,onClick:()=>h("restore",m.path),children:e("restore")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!o,onClick:()=>{window.confirm(e("purgeConfirm"))&&h("purge",m.path)},children:e("purge")})]},m.path))}):(0,i.jsxs)("div",{className:"mc-card",style:{padding:18,fontSize:12.5,opacity:.78,textAlign:"center",lineHeight:1.9},children:["\u{1F5D1}\uFE0F ",e("emptyRecycle"),(0,i.jsx)("br",{}),(0,i.jsx)("span",{style:{fontSize:11.5},children:e("recycleEmptyHint").split("{days}").join("30")})]})]})]})}var Xg=({card:e,t,onOpen:n,query:r,onDelete:l})=>(0,i.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>n(e),children:[(0,i.jsxs)("h4",{children:[(0,i.jsx)("span",{className:"mc-kind",style:{background:kn[e.kind]||kn.other}}),(0,i.jsx)("span",{style:{marginRight:4},children:bi[e.kind]||"\u{1F4CE}"}),r?qp(e.title,r):e.title,lh(e.updated)&&(0,i.jsx)("span",{className:"mc-new",children:t("newBadge")}),e.status==="pending"&&(0,i.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),e.status==="rejected"&&(0,i.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",t("statusRejected")]}),(!e.status||e.status==="approved")&&(0,i.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",t("statusApproved")]})]}),(0,i.jsx)("p",{children:r?qp(e.summary||"",r):e.summary||""}),e.tags.length>0&&(0,i.jsx)("div",{className:"mc-tags",children:e.tags.slice(0,4).map(o=>(0,i.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",o]},o))}),(0,i.jsxs)("footer",{children:[(0,i.jsxs)("span",{children:[bi[e.kind]||"\u{1F4CE}"," ",t(Qt[e.kind])]}),(0,i.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",Kr(e.submittedBy)]}),(0,i.jsxs)("span",{children:["\u{1F4C5} ",Vr(e.updated)]}),(0,i.jsx)("span",{className:"spacer",style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-card-del",title:t("delete"),onClick:o=>{o.stopPropagation(),window.confirm(t("deleteConfirm"))&&l&&l(e.path)},children:"\u{1F5D1}"})]})]});function Gg({t:e,tab:t,onReload:n,version:r}){let[l,o]=(0,v.useState)(null),[a,s]=(0,v.useState)(""),[u,f]=(0,v.useState)(null),[y,h]=(0,v.useState)(null),[m,k]=(0,v.useState)(null),[z,w]=(0,v.useState)([]),[_,d]=(0,v.useState)(""),[c,g]=(0,v.useState)(!1),N=(0,v.useCallback)(async()=>{if(!(!u||!u.merge||!u.merge.length)&&window.confirm(e("mergeAllConfirm"))){d("merge");try{let M={},T=pe=>M[pe]===void 0?pe:M[pe]=T(M[pe]),O=(pe,se)=>{M[T(pe)]=T(se)},ee=new Set;for(let pe of u.merge)ee.add(pe.a.path),ee.add(pe.b.path),O(pe.a.path,pe.b.path);let G={};for(let pe of ee){let se=T(pe);(G[se]=G[se]||[]).push(pe)}let q=0;for(let pe of Object.values(G)){if(pe.length<2)continue;(await fetch(`${J}/merge?paths=${encodeURIComponent(pe.join(","))}`).then(He=>He.json())).ok&&q++}await P(),n&&n()}catch{}d("")}},[u,P,n,e]);async function P(){try{let M=await Promise.all([fetch(`${J}/stats`),fetch(`${J}/budget`),fetch(`${J}/capture-log`),fetch(`${J}/cards?status=all&limit=30&agent=${Kl}`)]),[T,O,ee,G]=await Promise.all(M.map(q=>q.json()));T&&T.ok&&o(T),O&&O.ok&&h(O),ee&&ee.ok&&k(ee),G&&G.ok&&w(G.cards||[]),s(!T||!T.ok?e("adminLoadFail"):"")}catch{s(e("adminLoadFail"))}}let j=(0,v.useCallback)(async()=>{d("scan");try{let M=await fetch(`${J}/optimize`).then(T=>T.json());M.ok&&f(M)}catch{s(e("adminLoadFail"))}finally{d("")}},[e]);(0,v.useEffect)(()=>{P()},[r]);let D=async(M,T)=>{if(window.confirm(e("mergeConfirm")))try{(await fetch(`${J}/merge?paths=${encodeURIComponent(M+","+T)}`).then(ee=>ee.json())).ok&&(await P(),n&&n())}catch{}},F=async M=>{if(window.confirm(e("deleteConfirm")))try{(await fetch(`${J}/delete?path=${encodeURIComponent(M)}`).then(O=>O.json())).ok&&(await P(),n&&n())}catch{}},Q=["project","knowledge","content","prompt","business","tool","mistake"],I=({title:M,kind:T,updated:O,path:ee})=>(0,i.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,i.jsx)("span",{className:"mc-kind",style:{background:Ur.colors[T]||"#666"}}),(0,i.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M}),(0,i.jsx)("span",{style:{opacity:.55,fontSize:11},children:Vr(O)}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>F(ee),children:[e("delete")," \u2715"]})]});return(0,i.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{style:{overflow:"auto"},children:[a&&(0,i.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,i.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",a]}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:P,children:["\u21BB ",e("retry")]})]}),t==="stats"&&(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,i.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsxs)("b",{style:{fontSize:12},children:["\u{1FAB5} ",e("captureLog")]}),(0,i.jsx)("span",{style:{fontSize:11,opacity:.6},children:e("captureLogHint")}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>P(),children:["\u21BB ",e("refresh")]})]}),m?m.available===!1?(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:e("captureLogUnavailable")}):(m.entries||[]).length===0?(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:e("captureLogEmpty")}):(0,i.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,i.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,i.jsx)("tbody",{children:(m.entries||[]).map((M,T)=>{let O=Ug[M.action]||["\u2022","inherit"];return(0,i.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,i.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:Vr(M.time?new Date(M.time).toISOString():"")}),(0,i.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:O[1],fontWeight:600},children:[O[0]," ",M.action]}),(0,i.jsx)("td",{style:{padding:"4px 6px"},children:M.reason||""}),(0,i.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:M.preview||"",children:M.preview||""})]},T)})})})}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:e("loading")})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,i.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:["\u{1F916} ",e("captureAgentCards"),"\uFF08",z.length,"\uFF09"]}),z.length?(0,i.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:z.map(M=>(0,i.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,i.jsx)("span",{className:"mc-kind",style:{background:kn[M.kind]||kn.other}}),(0,i.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M.title}),M.status==="pending"&&(0,i.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",e("statusPending")]}),(0,i.jsx)("span",{style:{opacity:.55,fontSize:11},children:Vr(M.updated)})]},M.path))}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12},children:e("noCards")})]}),l&&(0,i.jsxs)(i.Fragment,{children:[l.trend&&l.trend.length>0&&(()=>{let M=l.trend,T=Math.max(...M.map(q=>q.count),1),O=260,ee=50,G=O/M.length;return(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,i.jsxs)("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["\u{1F4C8} ",e("trendLabel")]}),(0,i.jsx)("svg",{width:O,height:ee,style:{display:"block",width:"100%",height:50},children:M.map((q,pe)=>{let se=Math.round(q.count/T*(ee-4));return(0,i.jsx)("rect",{x:pe*G+1,y:ee-se,width:Math.max(G-2,2),height:se,rx:1.5,fill:q.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:q.count>0?.85:.35},q.date)})})]})})(),(0,i.jsxs)("div",{className:"mc-stats",children:[(0,i.jsxs)("div",{className:"mc-stat mc-card",children:[(0,i.jsx)("b",{children:l.total}),(0,i.jsx)("span",{children:e("total")})]}),(0,i.jsxs)("div",{className:"mc-stat mc-card",children:[(0,i.jsx)("b",{children:l.today}),(0,i.jsx)("span",{children:e("todayAdd")})]}),(0,i.jsxs)("div",{className:"mc-stat mc-card",children:[(0,i.jsx)("b",{children:l.week}),(0,i.jsx)("span",{children:e("weekAdd")})]}),(0,i.jsxs)("div",{className:"mc-stat mc-card",children:[(0,i.jsx)("b",{children:l.tags}),(0,i.jsx)("span",{children:e("tags")})]})]}),(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,i.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:e("byKind")}),(0,i.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:Q.map(M=>(0,i.jsxs)("span",{style:{fontSize:12},children:[(0,i.jsx)("span",{className:"mc-kind",style:{background:Ur.colors[M]||"#666"}}),e(Qt[M]),": ",l.byKind?.[M]||0]},M))})]}),y&&(y.budgetChars||y.recallLimit||y.embedding)&&(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,i.jsx)("b",{children:e("budgetLabel")}),"\uFF1A",e("budgetChars")," ",(0,i.jsx)("b",{children:y.budgetChars||8e4})," \xB7 ",e("recallLimitLabel")," ",(0,i.jsx)("b",{children:y.recallLimit||5})," \xB7 ",e("embeddingLabel")," ",y.embedding?"ON":"OFF"]}),(0,i.jsxs)("div",{className:"mc-card",children:[(0,i.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[e("todayList"),"\uFF08",l.todayCards?.length||0,"\uFF09"]}),l.todayCards?.length?(0,i.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:l.todayCards.map(M=>(0,i.jsx)(I,{title:M.title,kind:M.kind,updated:M.updated,path:M.path},M.path))}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12},children:e("noOptimize")})]})]})]}),t==="optimize"&&(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,i.jsx)("b",{style:{fontSize:12},children:e("organizeTitle")}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-btn",disabled:!!_,onClick:j,children:_==="scan"?e("exporting"):"\u{1F50D} "+e("scanAndOrganize")}),u&&u.merge?.length>0&&(0,i.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!_,onClick:async()=>{if(window.confirm(e("oneClickOptimizeConfirm"))){d("oneclick");try{let M=JSON.stringify({cleanupStale:c}),O=await(await fetch(`${J}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:M})).json();O&&O.ok?(notify(`${e("oneClickOptimizeDone")}\uFF1A${O.plan.merged} ${e("optimizedMerged")}${c?` \xB7 ${O.plan.staleDeleted} ${e("optimizedStaleDeleted")}`:""}`),await P(),n&&n(),f(null)):notify(e("mergeFail"),!1)}catch{notify(e("mergeFail"),!1)}finally{d("")}}},children:_==="oneclick"?e("exporting"):"\u26A1 "+e("oneClickOptimize")}),u&&u.merge?.length>0&&(0,i.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,i.jsx)("input",{type:"checkbox",checked:c,onChange:M=>g(M.target.checked)}),e("oneClickAlsoStale")]})]}),!u&&(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:e("scanHint")}),u&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",flexDirection:"column",gap:8},children:[(0,i.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,i.jsx)("b",{style:{fontSize:12},children:e("mergePairs")}),(0,i.jsx)("div",{className:"spacer",style:{flex:1}}),u.merge?.length>0&&(0,i.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!_,onClick:N,children:e(_==="merge"?"exporting":"batchMerge")})]}),(0,i.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:e("mergePairs")}),u.merge?.length?(0,i.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:u.merge.map((M,T)=>(0,i.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,i.jsxs)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[M.a.title," \u21C4 ",M.b.title]}),(0,i.jsxs)("span",{style:{opacity:.6},children:[Math.round(M.sim*100),"%"]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>D(M.a.path,M.b.path),children:e("mergeNow")})]},T))}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:12},children:e("noOptimize")}),(0,i.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[e("staleCards"),"\uFF08",u.stale?.length||0,"\uFF09"]}),u.stale?.length>0&&(0,i.jsx)("div",{style:{marginBottom:6},children:(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!_,onClick:async()=>{if(!window.confirm(e("deleteConfirm")))return;d("clean");let M=0;for(let T of u.stale)try{await fetch(`${J}/delete?path=${encodeURIComponent(T.path)}`),M++}catch{}d(""),notify(`${M} ${e("deletedStale")}`),await P(),n&&n()},children:e("cleanStale")})}),u.stale?.length?(0,i.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:u.stale.map(M=>(0,i.jsx)(I,{title:M.title,kind:"other",updated:M.updated,path:M.path},M.path))}):(0,i.jsx)("div",{style:{opacity:.6,fontSize:12},children:e("noOptimize")})]})})]})]})]})}var Qs=[{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 qg({t:e,newCard:t,setNewCard:n,onCreated:r}){if(!t)return null;let l=Qs.find(h=>h.key===t.template),o=t.body||(l?e(l.bodyKey):""),a=t.kind||(l?l.kind:"knowledge"),s=t.tags||(l?e(l.tagKey):""),u=t._creating,f=h=>{let m=Qs.find(k=>k.key===h);n(k=>({...k,template:h,kind:m?m.kind:k.kind,body:m?e(m.bodyKey):k.body,tags:m?e(m.tagKey):k.tags}))},y=async()=>{if(!(!t.title&&!o)){n(h=>({...h,_creating:!0}));try{(await fetch(`${J}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t.title||e("untitled"),kind:a,tags:s.split(",").map(m=>m.trim()).filter(Boolean),body:o,source:"manual"})}).then(m=>m.json())).ok?(n(null),r&&r()):n(m=>({...m,_creating:!1}))}catch{n(m=>({...m,_creating:!1}))}}};return(0,i.jsxs)("div",{className:"me-overlay",onClick:()=>n(null),children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:h=>h.stopPropagation(),children:[(0,i.jsxs)("div",{className:"me-dialog-head",children:[(0,i.jsx)("h3",{children:e("newCard")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>n(null),children:e("close")})]}),(0,i.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,i.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[Qs.map(h=>(0,i.jsx)("button",{type:"button",className:`mc-btn${t.template===h.key?" me-on":""}`,onClick:()=>f(h.key),children:e(h.label)},h.key)),(0,i.jsx)("button",{type:"button",className:`mc-btn${t.template===""?" me-on":""}`,onClick:()=>n(h=>({...h,template:"",body:"",tags:"",kind:"knowledge"})),children:e("tplBlank")})]}),(0,i.jsx)("select",{className:"mc-btn",value:a,onChange:h=>n(m=>({...m,kind:h.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(h=>(0,i.jsx)("option",{value:h,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:h},h))}),(0,i.jsx)("input",{type:"text",className:"mc-btn",placeholder:e("cardTitle"),value:t.title||"",onChange:h=>n(m=>({...m,title:h.target.value}))}),(0,i.jsx)("input",{type:"text",className:"mc-btn",placeholder:e("tagsHint"),value:s,onChange:h=>n(m=>({...m,tags:h.target.value}))}),(0,i.jsx)("textarea",{className:"mc-btn",placeholder:e("cardBody"),value:o,onChange:h=>n(m=>({...m,body:h.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,i.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,i.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:u,onClick:y,children:e(u?"exporting":"createCard")})})]})]})]})}async function Xp(e){let t=String(e||"");if(!t)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{let n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),n.style.position="fixed",n.style.left="-9999px",n.style.top="0",document.body.appendChild(n),n.focus(),n.select();let r=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(n),r}catch{return!1}}function Zg({t:e,onClose:t}){let[n,r]=(0,v.useState)(""),[l,o]=(0,v.useState)(""),[a,s]=(0,v.useState)(""),[u,f]=(0,v.useState)(!0),[y,h]=(0,v.useState)(!1),[m,k]=(0,v.useState)(""),[z,w]=(0,v.useState)(""),_=(0,v.useRef)(null),d=(0,v.useRef)(null),c=()=>{let I=_.current;if(I)try{I.focus(),I.select()}catch{}},g=I=>{k(I),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>k(""),2400)};(0,v.useEffect)(()=>{let I=!0;return fetch(J+"/diagnostics").then(M=>M.json()).then(M=>{I&&(M&&M.ok?(o(String(M.diagnostics||"")),s(String(M.version||""))):h(!0))}).catch(()=>{I&&h(!0)}).finally(()=>{I&&f(!1)}),()=>{I=!1}},[]),(0,v.useEffect)(()=>{let I=M=>{M.key==="Escape"&&t()};return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I),d.current&&clearTimeout(d.current)}},[t]);let N=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),P=()=>{let I=n.trim().split(`
308
+ `)[0]||"",M=jp({title:"[Bug] "+(I.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Bp({description:n,diagnostics:l,version:a})});try{window.open(M,"_blank","noopener")}catch{g(e("fbCopyFail"))}},j=async()=>{await Xp(l)?(w(""),g(e("fbCopiedDiag"))):(w(l),g(e("fbCopyManual")))},D=async()=>{let I=Hp({lang:N,description:n,diagnostics:l});await Xp(I)?(w(""),g(e("fbCopiedPrompt"))):(w(I),g(e("fbCopyManual")))},F={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},Q={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,i.jsxs)("div",{className:"me-overlay",onClick:t,children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:I=>I.stopPropagation(),children:[(0,i.jsxs)("div",{className:"me-dialog-head",children:[(0,i.jsxs)("h3",{children:["\u{1F41E} ",e("fbTitle")]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:t,children:e("close")})]}),(0,i.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10},children:[(0,i.jsx)("div",{style:{fontSize:12,opacity:.72,lineHeight:1.6},children:e("fbWhy")}),(0,i.jsx)("textarea",{value:n,onChange:I=>r(I.target.value),placeholder:e("fbDesc"),rows:5,style:F}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,i.jsx)("b",{style:{fontSize:12},children:e("fbDiag")}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:j,disabled:!l,children:e("fbCopyDiag")})]}),(0,i.jsx)("pre",{style:Q,children:u?e("fbLoading"):y?e("fbDiagFail"):l})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!n.trim()){g(e("fbNeedDesc"));return}P()},style:{borderColor:"var(--dsw-alias-brand-primary, #3b82f6)",color:"var(--dsw-alias-brand-primary, #3b82f6)",fontWeight:600},children:["\u{1F680} ",e("fbOpenIssue")]}),(0,i.jsx)("span",{style:{opacity:.5,fontSize:12},children:e("fbOr")}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:D,children:["\u{1F916} ",e("fbCopyPrompt")]})]}),m&&(0,i.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:m}),z&&(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,i.jsxs)("b",{style:{fontSize:12,color:"#b45309"},children:["\u26A0 ",e("fbCopyFail")]}),(0,i.jsx)("span",{style:{fontSize:11.5,opacity:.75},children:e("fbCopyManual")}),(0,i.jsx)("div",{style:{flex:1}}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:c,children:e("fbSelectAll")})]}),(0,i.jsx)("textarea",{ref:_,readOnly:!0,value:z,rows:7,style:F})]})]})]})]})}function Jg({t:e,card:t,query:n,onClose:r,onDelete:l,onFeedback:o}){(0,v.useEffect)(()=>{let _=d=>{d.key==="Escape"&&r()};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[r]);let{meta:a,body:s}=(0,v.useMemo)(()=>Vs(t.text||""),[t.text]),u=_=>{let d=a.find(([c])=>String(c).toLowerCase()===_);return d?d[1]:""},f=Fp(u("tags")),y=u("kind")||"knowledge",h=(u("status")||"approved").toLowerCase(),m=kn[y]||"#6B7280",k=(s||"").length>460,[z,w]=(0,v.useState)(!0);return(0,i.jsxs)("div",{className:"me-overlay",onClick:r,children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{className:"me-dialog",onClick:_=>_.stopPropagation(),children:[(0,i.jsxs)("div",{className:"me-dialog-head",children:[(0,i.jsxs)("h3",{children:[(0,i.jsx)("span",{style:{marginRight:6},children:bi[y]||"\u{1F4CE}"}),t.title]}),(0,i.jsxs)("div",{style:{display:"flex",gap:8},children:[n&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>o&&o(!0),children:["\u{1F44D} ",e("fbUseful")]}),(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>o&&o(!1),children:["\u{1F44E} ",e("fbNotUseful")]})]}),k&&(0,i.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":z,onClick:()=>w(_=>!_),children:e(z?"collapse":"expand")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(e("deleteConfirm"))&&l&&l(t.path)},children:e("delete")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:r,children:e("close")})]})]}),(0,i.jsxs)("div",{className:"md-meta",children:[(0,i.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:m,borderColor:m+"59",background:m+"1a"},children:[bi[y]||"\u{1F4CE}"," ",e(Qt[y]||"kindKnowledge")]}),(0,i.jsxs)("span",{className:"md-chip "+(h==="approved"?"md-chip-st-ok":h==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[h==="approved"?"\u2705":h==="pending"?"\u23F3":"\u26D4"," ",e(h==="approved"?"statusApproved":h==="pending"?"statusPending":"statusRejected")]}),f.slice(0,8).map(_=>(0,i.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",_]},_)),!!u("updated")&&(0,i.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",e("updated")," ",Vr(u("updated"))]}),!!u("source")&&(0,i.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",u("source")]})]}),(0,i.jsx)("div",{className:"me-dialog-body",style:z?{}:{maxHeight:300,overflow:"hidden"},onClick:z?void 0:_=>{_.stopPropagation(),w(!0)},children:(0,i.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Ap(s)}})}),!z&&(0,i.jsxs)("div",{className:"md-collapsed-hint",onClick:_=>{_.stopPropagation(),w(!0)},children:[e("expand")," \u2304"]})]})]})}function eh({t:e,onOpen:t,all:n,onAllChange:r,onMutate:l,active:o,visible:a}){let[s,u]=(0,v.useState)(null),[f,y]=(0,v.useState)(""),h=(0,v.useRef)(!1),m=(0,v.useRef)(0),k=(0,v.useRef)(e);k.current=e;let z=(0,v.useCallback)(async()=>{try{h.current=!1;let c=await(await fetch(`${J}/graph${n?"?all=1":""}`)).json();c.ok?(u(c),y(""),h.current=!0):(u(null),y(c.error||e("error")))}catch(d){y(String(d&&d.message?d.message:d))}},[n,e]);(0,v.useEffect)(()=>{if(!o||h.current)return;let d=!0;return fetch(`${J}/graph${n?"?all=1":""}`).then(c=>c.json()).then(c=>{d&&(c.ok?(u(c),y(""),h.current=!0):(u(null),y(c.error||e("error"))))}).catch(c=>{d&&y(String(c&&c.message?c.message:c))}),()=>{d=!1}},[n,e,o]),(0,v.useEffect)(()=>{a&&s&&m.current++},[a,s]);let w=(0,v.useCallback)(async d=>{try{let g=await(await fetch(`${J}/delete?path=${encodeURIComponent(d)}`)).json();return g&&g.ok?(await z(),l&&l(),!0):!1}catch{return!1}},[z]),_=(0,v.useCallback)(async d=>{if(!d||d.length<2)return!1;try{let c=await fetch(`${J}/merge?paths=${encodeURIComponent(d.join(","))}`).then(g=>g.json());return c&&c.ok?(await z(),l&&l(),!0):!1}catch{return!1}},[z,l]);return(0,i.jsxs)("div",{className:"me-graph",children:[(0,i.jsx)("style",{children:an}),f&&(0,i.jsxs)("div",{className:"mc-empty",children:[e("error"),"\uFF1A",f]}),!s&&!f&&(0,i.jsx)("div",{className:"mc-empty",children:e("loading")}),s&&s.nodes.length===0&&(0,i.jsx)("div",{className:"mc-empty",children:e("emptyGraph")}),s&&s.nodes.length>0&&(0,i.jsx)(nh,{nodes:s.nodes,edges:s.edges,onOpen:t,onDelete:w,onMerge:_,t:e,all:n,onAllChange:r,countLabel:`${s.nodes.length} ${e("nodes")} \xB7 ${th(s.edges)} ${e("edges")}`,fitTrigger:m.current})]})}function th(e){let t=new Set;for(let n of e||[])t.add([n.source,n.target].sort().join("|"));return t.size}var Ur={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 nh({nodes:e,edges:t,onOpen:n,onDelete:r,onMerge:l,t:o,countLabel:a,all:s,onAllChange:u,fitTrigger:f}){let y=(0,v.useRef)(null),h=(0,v.useRef)(null),m=(0,v.useRef)(null),k=(0,v.useRef)(null),z=(0,v.useRef)(null),w=(0,v.useRef)(n);(0,v.useEffect)(()=>{w.current=n},[n]);let _=(0,v.useRef)(r);(0,v.useEffect)(()=>{_.current=r},[r]);let d=(0,v.useRef)(l);(0,v.useEffect)(()=>{d.current=l},[l]);let[c,g]=(0,v.useState)(""),[N,P]=(0,v.useState)(null),j=(0,v.useRef)("");(0,v.useEffect)(()=>{j.current=c.trim().toLowerCase()},[c]),(0,v.useEffect)(()=>{let S=m.current;if(!S)return;let x=c.trim().toLowerCase();if(!x)return;let K=S.nodes.find(de=>(de.name||"").toLowerCase().includes(x));K&&(m.current.selectedId=K.id,P(K.id),S.panX=S.w/2-K.x*S.zoom,S.panY=S.h/2-K.y*S.zoom,S.render&&S.render())},[c]);let[D,F]=(0,v.useState)("all"),[Q,I]=(0,v.useState)(!1),M=(0,v.useRef)("all"),[T,O]=(0,v.useState)(""),ee=(0,v.useRef)(""),[G,q]=(0,v.useState)(!1),pe=(0,v.useRef)(!1),[se,He]=(0,v.useState)(null);(0,v.useEffect)(()=>{M.current=D},[D]),(0,v.useEffect)(()=>{ee.current=T},[T]),(0,v.useEffect)(()=>{pe.current=G},[G]);let Yt=(0,v.useMemo)(()=>{let S=new Map;for(let x of e)for(let K of x.tags||[]){let de=String(K).trim();de&&S.set(de,(S.get(de)||0)+1)}return[...S.entries()].sort((x,K)=>K[1]-x[1]).slice(0,24).map(([x,K])=>({tag:x,n:K}))},[e]),Se=(()=>{let S=c.trim().toLowerCase();return!!S&&!e.some(x=>(x.title||x.name||"").toLowerCase().includes(S)||String(x.kind||"").toLowerCase().includes(S)||String(Qt[x.kind]||"").toLowerCase().includes(S))})();(0,v.useEffect)(()=>{let S=m.current;S&&S.wake&&S.wake()},[c]),(0,v.useEffect)(()=>{let S=m.current;S&&S.render&&S.render()},[D,T,G]);let bt=(0,v.useRef)(null),[St,It]=(0,v.useState)([]),[Ye,Pe]=(0,v.useState)(null),[Fe,bn]=(0,v.useState)(!1),[sn,Xt]=(0,v.useState)(null),[Kn,Sn]=(0,v.useState)(""),tt=(0,v.useRef)(null),ft=(0,v.useRef)(null),ge=(S,x=!0)=>{tt.current&&clearTimeout(tt.current),Xt({msg:S,ok:x}),tt.current=setTimeout(()=>Xt(null),1900)},Gt=S=>{Sn(S),ft.current&&clearTimeout(ft.current),ft.current=setTimeout(()=>Sn(""),1600)};(0,v.useEffect)(()=>()=>{tt.current&&clearTimeout(tt.current),ft.current&&clearTimeout(ft.current)},[]);let Ae=(0,v.useMemo)(()=>e.reduce((S,x)=>(S[x.id]=x,S),{}),[e]);return(0,v.useEffect)(()=>{let S=y.current;if(!S||e.length===0)return;let x=S.getContext("2d");if(!x)return;let K=Math.max(1,window.devicePixelRatio||1),de=()=>document.documentElement.getAttribute("data-theme")==="dark",X={};t.forEach(C=>{X[C.source]=(X[C.source]||0)+1,X[C.target]=(X[C.target]||0)+1});let ye=Math.max(1,...Object.values(X)),p={nodes:e.map(C=>({id:C.id,name:C.title||"",type:C.kind||"other",r:9+Math.min(10,(X[C.id]||0)/ye*8),x:0,y:0,vx:0,vy:0})),edges:t.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:K,ctx:x,multi:[],marquee:null};p.domain=e,p.domainById=e.reduce((C,B)=>(C[B.id]=B,C),{}),p.nodes.forEach((C,B)=>{let A=B/p.nodes.length*Math.PI*2-Math.PI/2;C.x=Math.cos(A)*60,C.y=Math.sin(A)*60});let b=[...new Set(p.nodes.map(C=>C.type))];p.clustered=b.length>1,p.typeCenters={},b.forEach((C,B)=>{let A=B/b.length*Math.PI*2-Math.PI/2;p.typeCenters[C]={x:Math.cos(A)*160,y:Math.sin(A)*160}}),m.current=p;let W=0,U=0,ne=()=>{let C=S.clientWidth,B=S.clientHeight;p.w=C,p.h=B,S.width=C*K,S.height=B*K,x.setTransform(K,0,0,K,0,0),(W===0||U===0)&&C>0&&B>0&&p.tickCount>0&&requestAnimationFrame(()=>re()),W=C,U=B};ne();let Ce=new ResizeObserver(ne);Ce.observe(S.parentElement);let Z=(C,B)=>C&&C.length>B?C.slice(0,B)+"\u2026":C,ue=(C,B,A,$)=>{if(x.beginPath(),$==="rect")x.rect(C-A,B-A*.75,A*2,A*1.5);else if($==="diamond")x.moveTo(C,B-A),x.lineTo(C+A,B),x.lineTo(C,B+A),x.lineTo(C-A,B),x.closePath();else if($==="hexagon"){for(let Y=0;Y<6;Y++){let fe=Math.PI/3*Y-Math.PI/2,oe=C+A*Math.cos(fe),Ue=B+A*Math.sin(fe);Y===0?x.moveTo(oe,Ue):x.lineTo(oe,Ue)}x.closePath()}else x.arc(C,B,A,0,Math.PI*2)},L=new Map,V=(C,B)=>{let A=C+"|"+Math.round(B),$=L.get(A);if(!$){let Y=parseInt(C.slice(1,3),16),fe=parseInt(C.slice(3,5),16),oe=parseInt(C.slice(5,7),16);$=x.createRadialGradient(-B*.3,-B*.3,0,0,0,B*1.2),$.addColorStop(0,"rgba("+Math.min(255,Y+70)+","+Math.min(255,fe+70)+","+Math.min(255,oe+70)+",0.95)"),$.addColorStop(1,C),L.set(A,$)}return $},re=()=>{if(!p.nodes.length)return;let C=1/0,B=-1/0,A=1/0,$=-1/0;p.nodes.forEach(Nt=>{C=Math.min(C,Nt.x),B=Math.max(B,Nt.x),A=Math.min(A,Nt.y),$=Math.max($,Nt.y)});let Y=20,fe=B-C+Y*2,oe=$-A+Y*2,Ue=Math.min(p.w/fe,p.h/oe);p.zoom=Math.max(.35,Math.min(1.8,Ue)),p.panX=p.w/2-(C+B)/2*p.zoom,p.panY=p.h/2-(A+$)/2*p.zoom};k.current=re;let _e=()=>{x.clearRect(0,0,p.w,p.h),p.searchTerm=j.current,p.kindFilter=M.current,p.timeMode=pe.current,p.tagFilter=ee.current;let C=p.tagFilter,B=p.kindFilter,A=E=>String(E||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");x.save(),x.strokeStyle=de()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",x.lineWidth=.5;for(let E=0;E<p.w;E+=24)x.beginPath(),x.moveTo(E,0),x.lineTo(E,p.h),x.stroke();for(let E=0;E<p.h;E+=24)x.beginPath(),x.moveTo(0,E),x.lineTo(p.w,E),x.stroke();x.restore(),x.save(),x.translate(p.panX,p.panY),x.scale(p.zoom,p.zoom);let $={};p.nodes.forEach(E=>$[E.id]=E);let Y=p.nodes.length>40,fe=Y?1.5:.55,oe=p.selectedId||p.hoverId,Ue=Wp({panX:p.panX,panY:p.panY,zoom:p.zoom,w:p.w,h:p.h,margin:80}),Nt=(()=>{let E=(p.searchTerm||"").toLowerCase();if(!E)return null;let ie=[];for(let ae of p.nodes){let Ie=(p.domainById[ae.id]||{}).kind||"other";if(((ae.name||"").toLowerCase().includes(E)||String(Qt[Ie]||"").toLowerCase().includes(E)||String(Ie).toLowerCase().includes(E))&&ie.push(ae.id),ie.length>200)break}return ie})(),Qn=Up(p.nodes,{limit:$p(p.nodes.length),focusId:oe,hoverId:p.hoverId,searchHits:Nt,degree:X}),he=new Map,Ne=(E,ie)=>{let ae=E+"|"+ie,we=he.get(ae);return we===void 0&&(x.font=E,we=x.measureText(ie).width,he.set(ae,we)),we},mt=p.nodes.length<=250,Et=new Map;p.edges.forEach(E=>{let ie=$[E.sourceNodeId],ae=$[E.targetNodeId];if(!ie||!ae||!wi(ie.x,ie.y,10,Ue)&&!wi(ae.x,ae.y,10,Ue))return;if(B!=="all"){let dr=p.domainById[E.sourceNodeId]&&p.domainById[E.sourceNodeId].kind,Jt=p.domainById[E.targetNodeId]&&p.domainById[E.targetNodeId].kind;if(dr!==B&&Jt!==B)return}if(C){let dr=p.domainById[E.sourceNodeId]&&(p.domainById[E.sourceNodeId].tags||[]).includes(C),Jt=p.domainById[E.targetNodeId]&&(p.domainById[E.targetNodeId].tags||[]).includes(C);if(!dr&&!Jt)return}let we=ae.x-ie.x,Ie=ae.y-ie.y,at=Math.sqrt(we*we+Ie*Ie)||1,un=Y?12:18,Cn=-Ie/at*un,Yl=we/at*un,Xl=(ie.x+ae.x)/2+Cn,Gl=(ie.y+ae.y)/2+Yl,Yr=Ur.colors[p.domainById[ie.id]&&p.domainById[ie.id].kind||"other"],Xr=oe&&(E.sourceNodeId===oe||E.targetNodeId===oe),Si=oe?Xr?.6:.08:Y?.14:.24,Zt=parseInt(Yr.slice(1,3),16),Gr=parseInt(Yr.slice(3,5),16),Ci=parseInt(Yr.slice(5,7),16),At=Xr?1.6+(E.weight||1):.8+(E.weight||1)*.5,Yn=Zt+","+Gr+","+Ci+","+Si+","+At,zt=Et.get(Yn);zt||(zt={path:new Path2D,stroke:"rgba("+Zt+","+Gr+","+Ci+","+Si+")",width:At},Et.set(Yn,zt)),zt.path.moveTo(ie.x,ie.y),zt.path.quadraticCurveTo(Xl,Gl,ae.x,ae.y)}),Et.forEach(E=>{x.strokeStyle=E.stroke,x.lineWidth=E.width,x.stroke(E.path)});let gt=null;oe&&(gt=new Set,p.edges.forEach(E=>{E.sourceNodeId===oe?gt.add(E.targetNodeId):E.targetNodeId===oe&&gt.add(E.sourceNodeId)}));let qt=[];if(p.nodes.forEach(E=>{if(!wi(E.x,E.y,E.r+2,Ue))return;let ie=p.domainById[E.id]||{},ae=ie.kind||"other",we=p.timeMode?rh(ie.updated):Ur.colors[ae],Ie=Ur.shapes[ae],at=p.selectedId===E.id,un=p.hoverId===E.id,Cn=p.searchTerm||"",Yl=!Cn||(E.name||"").toLowerCase().includes(Cn)||String(Qt[ae]||"").toLowerCase().includes(Cn)||String(ae).toLowerCase().includes(Cn),Xl=B==="all"||ae===B,Gl=!C||(ie.tags||[]).includes(C),Yr=oe&&E.id!==oe&&!(gt&&gt.has(E.id))||Cn&&!Yl||!Xl||!Gl;x.save(),x.globalAlpha=Yr?.08:1,(at||un)&&mt&&(x.shadowColor=we,x.shadowBlur=at?20:14),x.translate(E.x,E.y),ue(0,0,E.r,Ie),x.fillStyle=V(we,E.r),x.fill(),x.restore(),at?(x.save(),ue(E.x,E.y,E.r+3,Ie),x.strokeStyle=we,x.lineWidth=3,x.shadowColor=we,x.shadowBlur=12,x.stroke(),x.restore()):un?(x.save(),ue(E.x,E.y,E.r+2,Ie),x.strokeStyle=we,x.lineWidth=2,x.stroke(),x.restore()):Cn&&Yl?(x.save(),ue(E.x,E.y,E.r+2,Ie),x.strokeStyle="#e11d48",x.lineWidth=2,x.stroke(),x.restore()):p.multi.indexOf(E.id)>=0&&(x.save(),ue(E.x,E.y,E.r+2,Ie),x.strokeStyle="#60a5fa",x.lineWidth=2,x.shadowColor="#60a5fa",x.shadowBlur=8,x.stroke(),x.restore());let Xr=Z(E.name,16);if((at||un||Qn.has(E.id)&&p.zoom>fe||!Y&&p.zoom>.6)&&Xl&&Gl){let Zt=1/p.zoom,Gr="500 "+(12*Zt).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";x.font=Gr;let At=Ne(Gr,Xr)+16*Zt,Yn=18*Zt,zt=E.y+E.r+8*Zt,dr=!0;for(let Jt of qt)if(E.x-At/2<Jt.x+Jt.w&&E.x+At/2>Jt.x&&zt<Jt.y+Jt.h&&zt+Yn>Jt.y){dr=!1;break}if(!dr&&!at&&!un)return;qt.push({x:E.x-At/2,y:zt,w:At,h:Yn}),x.fillStyle=de()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",x.beginPath(),x.roundRect?x.roundRect(E.x-At/2,zt,At,Yn,4*Zt):x.rect(E.x-At/2,zt,At,Yn),x.fill(),x.strokeStyle=de()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",x.lineWidth=1*Zt,x.stroke(),x.fillStyle=de()?at||un?"#eee":"#bbb":at||un?"#111":"#444",x.textAlign="center",x.fillText(Xr,E.x,zt+13*Zt)}}),x.restore(),p.marquee){let E=p.marquee,ie=Math.min(E.sx,E.ex),ae=Math.min(E.sy,E.ey),we=Math.abs(E.ex-E.sx),Ie=Math.abs(E.ey-E.sy);x.save(),x.setLineDash([4,4]),x.strokeStyle="rgba(96,165,250,0.9)",x.lineWidth=1,x.fillStyle="rgba(96,165,250,0.12)",x.fillRect(ie,ae,we,Ie),x.strokeRect(ie,ae,we,Ie),x.restore()}if(p.hoverId&&bt.current){let E=p.domainById[p.hoverId],ie=p.nodes.find(function(ae){return ae.id===p.hoverId});if(E&&ie){let ae=p.edges.filter(function(at){return at.sourceNodeId===E.id||at.targetNodeId===E.id}).length,we=ie.x*p.zoom+p.panX,Ie=ie.y*p.zoom+p.panY;bt.current.style.display="block",bt.current.style.left=we+14+"px",bt.current.style.top=Ie-6+"px",bt.current.innerHTML="<b>"+A(E.title||E.name||"")+'</b><br/><span style="opacity:.8">'+A(E.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",ae)+"</span>"}}else bt.current&&(bt.current.style.display="none")},te=()=>{p.running=!0,p.raf||(p.raf=requestAnimationFrame(Xe))};p.wake=te,p.render=_e;let ze=()=>{let C=p.nodes.length;p.tickCount++;let A=.9-Math.min(.4,p.tickCount/1500),$=C>1e3?3e3:C>100?2e3:C>50?1200:800,Y=C>100?.002:.005,fe=C>1e3?.012:C>100?.005:.01,oe=C>1e3?6:C>200?12:24,Ue={};p.nodes.forEach(he=>Ue[he.id]=he);for(let he=0;he<C;he++){if(p.dragNode===p.nodes[he])continue;let Ne=p.nodes[he],mt=0,Et=0;for(let E=0;E<C;E++){if(he===E)continue;let ie=Ne.x-p.nodes[E].x,ae=Ne.y-p.nodes[E].y,we=Math.sqrt(ie*ie+ae*ae)||1,Ie=$/(we*we);mt+=ie/we*Ie,Et+=ae/we*Ie}if(p.clustered&&p.typeCenters[Ne.type]){let E=p.typeCenters[Ne.type];mt+=(E.x-Ne.x)*.006,Et+=(E.y-Ne.y)*.006}else mt-=Ne.x*fe,Et-=Ne.y*fe;let gt=(Ne.vx+mt)*A,qt=(Ne.vy+Et)*A;gt=Math.max(-oe,Math.min(oe,gt)),qt=Math.max(-oe,Math.min(oe,qt)),Ne.vx=gt,Ne.vy=qt}p.edges.forEach(he=>{let Ne=Ue[he.sourceNodeId],mt=Ue[he.targetNodeId];if(!Ne||!mt)return;let Et=mt.x-Ne.x,gt=mt.y-Ne.y,qt=Math.sqrt(Et*Et+gt*gt)||1,E=(qt-100)*Y,ie=Et/qt*E,ae=gt/qt*E;p.dragNode!==Ne&&(Ne.vx+=ie,Ne.vy+=ae),p.dragNode!==mt&&(mt.vx-=ie,mt.vy-=ae)});let Nt=0;p.nodes.forEach(he=>{p.dragNode!==he&&(he.x+=he.vx,he.y+=he.vy,Nt+=he.vx*he.vx+he.vy*he.vy)}),p.autoFitPending&&p.tickCount>45&&(p.autoFitPending=!1,re()),(C?Math.sqrt(Nt/C):0)<.05&&p.tickCount>60&&!p.dragNode?p.quietTicks=(p.quietTicks|0)+1:p.quietTicks=0},Xe=()=>{if(p.running){try{ze(),_e()}catch{}if(p.quietTicks>30){p.raf=0;return}p.raf=requestAnimationFrame(Xe)}},nt=(C,B)=>{let A=S.getBoundingClientRect();return{x:(C-A.left-p.panX)/p.zoom,y:(B-A.top-p.panY)/p.zoom}},Ot=C=>{let B=p.domainById[C];return!(!B||M.current!=="all"&&B.kind!==M.current||ee.current&&!(B.tags||[]).includes(ee.current))},Ct=(C,B,A)=>Math.max(B,Math.min(A,C)),Ft=C=>{p.mouseX=C.clientX,p.mouseY=C.clientY;let B=nt(C.clientX,C.clientY),A=null;for(let $=p.nodes.length-1;$>=0;$--){let Y=p.nodes[$];if(!Ot(Y.id))continue;let fe=Y.x-B.x,oe=Y.y-B.y;if(fe*fe+oe*oe<Y.r*Y.r+36){A=Y.id;break}}A!==p.hoverId&&(p.hoverId=A,te())},Ql=C=>{if(C.button!==0)return;let B=nt(C.clientX,C.clientY),A=null;for(let $=p.nodes.length-1;$>=0;$--){let Y=p.nodes[$];if(!Ot(Y.id))continue;let fe=Y.x-B.x,oe=Y.y-B.y;if(fe*fe+oe*oe<Y.r*Y.r+25){A=Y;break}}if(C.shiftKey){if(A){p.shiftClick=A.id;return}p.marquee={sx:C.clientX,sy:C.clientY,ex:C.clientX,ey:C.clientY};return}p.dragStart={x:C.clientX,y:C.clientY,px:p.panX,py:p.panY},p.dragging=!1,p.dragNode=A||null,A&&(p.dragOffset={dx:A.x-B.x,dy:A.y-B.y})},qs=C=>{if(p.marquee){p.marquee.ex=C.clientX,p.marquee.ey=C.clientY,te();return}if(!p.dragStart)return;let B=C.clientX-p.dragStart.x,A=C.clientY-p.dragStart.y;if(Math.abs(B)+Math.abs(A)>3&&(p.dragging=!0),p.dragNode){let $=nt(C.clientX,C.clientY);p.dragNode.x=$.x+p.dragOffset.dx,p.dragNode.y=$.y+p.dragOffset.dy,te()}else p.dragging&&(p.panX=Ct(p.dragStart.px+B,-1e5,1e5),p.panY=Ct(p.dragStart.py+A,-1e5,1e5),te())},Zs=C=>{if(p.marquee){let A=p.marquee;p.marquee=null;let $=S.getBoundingClientRect(),Y=Math.min(A.sx,A.ex)-$.left,fe=Math.max(A.sx,A.ex)-$.left,oe=Math.min(A.sy,A.ey)-$.top,Ue=Math.max(A.sy,A.ey)-$.top,Nt=p.nodes.filter(Qn=>{let he=Qn.x*p.zoom+p.panX,Ne=Qn.y*p.zoom+p.panY;return he>=Y&&he<=fe&&Ne>=oe&&Ne<=Ue}).map(Qn=>Qn.id);p.multi=Nt,It(Nt),te();return}let B=p.dragStart&&!p.dragging;if(p.shiftClick){let A=p.shiftClick;p.shiftClick=null;let $=Array.isArray(p.multi)?p.multi.slice():[];$.includes(A)||$.push(A),p.multi=$,It($),te();return}if(B){let A=nt(C.clientX,C.clientY),$=null;for(let Y=p.nodes.length-1;Y>=0;Y--){let fe=p.nodes[Y];if(!Ot(fe.id))continue;let oe=fe.x-A.x,Ue=fe.y-A.y;if(oe*oe+Ue*Ue<fe.r*fe.r+20){$=fe;break}}$?(p.selectedId=$.id,P($.id),te()):(p.selectedId=null,p.hoverId=null,C.shiftKey||(p.multi=[],It([])),P(null),te())}p.dragStart=null,p.dragging=!1,p.dragNode=null},Js=C=>{C.preventDefault();let B=nt(C.clientX,C.clientY),A=null;for(let $=p.nodes.length-1;$>=0;$--){let Y=p.nodes[$];if(!Ot(Y.id))continue;let fe=Y.x-B.x,oe=Y.y-B.y;if(fe*fe+oe*oe<Y.r*Y.r+25){A=Y;break}}if(A){let $=p.domainById[A.id];$&&He({x:C.clientX,y:C.clientY,id:A.id,path:$.id,title:$.title})}else He(null)},eu=C=>{C.preventDefault();let B=S.getBoundingClientRect(),A=(C.clientX-B.left-p.panX)/p.zoom,$=(C.clientY-B.top-p.panY)/p.zoom,Y=Math.max(.3,Math.min(3,p.zoom*(C.deltaY<0?1.1:1/1.1)));p.panX=Ct(p.panX+A*(p.zoom-Y),-1e5,1e5),p.panY=Ct(p.panY+$*(p.zoom-Y),-1e5,1e5),p.zoom=Y,te()};S.addEventListener("mousemove",Ft),S.addEventListener("mousedown",Ql),window.addEventListener("mousemove",qs),window.addEventListener("mouseup",Zs),S.addEventListener("wheel",eu,{passive:!1}),S.addEventListener("contextmenu",Js),z.current=()=>{p.selectedId=null,p.hoverId=null,p.multi=[],It([]),re(),te()};for(let C=0;C<200;C++)ze();re(),te();let tu=()=>I(!1);return window.addEventListener("mousedown",tu),()=>{p.running=!1,p.raf&&cancelAnimationFrame(p.raf),Ce.disconnect(),S.removeEventListener("mousemove",Ft),S.removeEventListener("mousedown",Ql),window.removeEventListener("mousemove",qs),window.removeEventListener("mouseup",Zs),S.removeEventListener("wheel",eu),S.removeEventListener("contextmenu",Js),window.removeEventListener("mousedown",tu)}},[e,t]),(0,v.useEffect)(()=>{f!==void 0&&k.current&&requestAnimationFrame(()=>k.current())},[f]),(0,i.jsxs)("div",{className:"me-graph",ref:h,children:[(0,i.jsxs)("div",{className:"me-graph-toolbar",children:[(0,i.jsxs)("span",{className:"me-graph-count",children:[e.length," ",o("nodes")," \xB7 ",t.length," ",o("edges")]}),(0,i.jsx)("span",{className:"spacer",style:{flex:1}}),(0,i.jsx)("input",{type:"text",placeholder:o("search"),value:c,onChange:S=>g(S.target.value)}),(0,i.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,i.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>I(S=>!S),"aria-expanded":Q,title:o("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",o("filterLabel")," ",D!=="all"||G||T?"\u25CF":"\u25BE"]}),Q&&(0,i.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,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,i.jsx)("button",{type:"button",className:`lg${D==="all"&&!G?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{F("all"),q(!1)},children:o("all")}),Object.keys(kn).map(S=>(0,i.jsxs)("button",{type:"button",className:`lg${D===S?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>F(x=>x===S?"all":S),children:[(0,i.jsx)("span",{className:"mc-kind",style:{background:Ur.colors[S]||kn[S]}}),o(Qt[S])]},S)),(0,i.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,i.jsxs)("button",{type:"button",className:`lg${G?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>q(S=>!S),children:["\u23F1 ",o("timeDim")]}),Yt.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,i.jsx)("div",{style:{maxHeight:130,overflow:"auto",display:"flex",flexWrap:"wrap",gap:4},children:Yt.map(S=>(0,i.jsxs)("button",{type:"button",className:`lg${T===S.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>O(x=>x===S.tag?"":S.tag),title:S.tag,children:["#",S.tag," ",(0,i.jsx)("span",{style:{opacity:.55},children:S.n})]},S.tag))})]}),(D!=="all"||G||T)&&(0,i.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{F("all"),q(!1),O("")},children:[o("clearFilter")," \u2715"]})]})})]}),(0,i.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:o("crossVault"),children:[(0,i.jsx)("input",{type:"checkbox",checked:!!s,onChange:S=>u&&u(S.target.checked)}),o("crossVault")]}),(0,i.jsx)("button",{type:"button",className:`mc-btn${G?" me-on":""}`,onClick:()=>q(S=>!S),children:o("timeDim")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let S=y.current;if(S)try{S.toBlob(x=>{x&&Pe({url:URL.createObjectURL(x),blob:x})},"image/png")}catch{}},children:o("exportGraph")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>k.current&&k.current(),children:o("fit")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{P(null),F("all"),z.current&&z.current()},children:o("reset")})]}),(0,i.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,i.jsx)("canvas",{ref:y,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,i.jsx)("div",{className:"me-graph-tooltip",ref:bt,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)"}}),Se&&(0,i.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:o("noMatch")}),se&&(0,i.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>He(null)}),se&&(0,i.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:se.x,top:se.y,zIndex:31},onMouseDown:S=>S.stopPropagation(),children:[(0,i.jsx)("button",{type:"button",onClick:()=>{w.current({path:se.path,title:se.title}),He(null)},children:o("openCard")}),(0,i.jsx)("button",{type:"button",onClick:()=>{se.id&&(m.current.selectedId=se.id,P(se.id)),He(null);let S=m.current;S&&S.wake&&S.wake()},children:o("focusNeighbors")}),(0,i.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(se.title||"")}catch{}He(null),ge(o("copied"))},children:o("copyName")}),(0,i.jsx)("button",{type:"button",onClick:()=>{let S=m.current,x=S&&Array.isArray(S.multi)?S.multi.slice():[],K=se.id;if(K&&!x.includes(K)&&x.push(K),He(null),x.length<2){ge(o("mergeNeed"),!1);return}if(!window.confirm(o("mergeConfirm")))return;let de=d.current&&d.current(x);de&&de.then?de.then(X=>X?ge(o("merged")):ge(o("mergeFail"),!1)).catch(()=>ge(o("mergeFail"),!1)):de&&ge(o("merged"))},children:o("merge")}),(0,i.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let S=se.path;He(null),window.confirm(o("deleteConfirm"))&&(async()=>{try{(_.current?await _.current(S):!1)?ge(o("deleted")):ge(o("deleteFail"),!1)}catch{ge(o("deleteFail"),!1)}})()},children:o("delete")})]}),St.length>0&&(0,i.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,i.jsxs)("span",{style:{fontWeight:700},children:[St.length," ",o("nodes")]}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let x=St.map(ye=>Ae[ye]).filter(Boolean).map(ye=>ye.title||ye.name).join(`
309
+ `),K=new Blob([x],{type:"text/plain;charset=utf-8"}),de=URL.createObjectURL(K),X=document.createElement("a");X.href=de,X.download="memory-selected.txt",document.body.appendChild(X),X.click(),document.body.removeChild(X),setTimeout(()=>URL.revokeObjectURL(de),1e3),ge(St.length+o("exportedSel"))},children:o("exportSel")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(St.length<2){ge(o("mergeNeed"),!1);return}let S=St.map(K=>Ae[K]?Ae[K].id:K);if(!window.confirm(o("mergeConfirm")))return;It([]);let x=m.current;x&&(x.multi=[]),fetch(`${J}/merge?paths=${encodeURIComponent(S.join(","))}`).then(K=>K.json()).then(K=>{K&&K.ok?ge(o("merged")):ge(o("mergeFail"),!1)}).catch(()=>ge(o("mergeFail"),!1))},children:o("merge")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(o("deleteConfirm")))return;let S=St.map(K=>Ae[K]?Ae[K].id:K);It([]);let x=m.current;x&&(x.multi=[]),(async()=>{let K=0;for(let de of S)try{(_.current?await _.current(de):!1)&&K++}catch{}ge(K+o("deletedSelected"),K>0)})()},children:o("deleteSelected")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let S=m.current;S&&(S.multi=[]),It([]);let x=m.current;x&&x.render&&x.render()},children:o("clearSelection")})]}),N&&(0,i.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,i.jsx)("div",{style:{fontWeight:700,fontSize:13,marginBottom:4},children:Ae[N]?Ae[N].title||Ae[N].name:N}),(0,i.jsx)("div",{style:{opacity:.8,marginBottom:8},children:Ae[N]?o(Qt[Ae[N].kind]||"kindKnowledge"):"\u2014"}),(0,i.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:o("graphHint")}),(t.filter(S=>S.source===N||S.target===N)||[]).slice(0,8).map((S,x)=>{let K=S.source===N?S.target:S.source,de=Ae[K];return(0,i.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:X=>{X.preventDefault();let ye=m.current;ye&&(ye.selectedId=K,ye.hoverId=K,ye.wake&&ye.wake()),P(K)},children:de?(de.title||de.name).slice(0,28):K},x)})]})]}),(0,i.jsx)("div",{className:"me-graph-tip",children:o("graphTip")}),sn&&(0,i.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 "+(sn.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,i.jsx)("span",{style:{color:sn.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:sn.ok?"\u2713":"\u2715"}),(0,i.jsx)("span",{style:{wordBreak:"break-all"},children:sn.msg})]}),Ye&&(0,i.jsxs)("div",{className:"me-overlay",onClick:()=>{Ye.url&&URL.revokeObjectURL(Ye.url),Pe(null),bn(!1)},children:[(0,i.jsx)("style",{children:an}),(0,i.jsxs)("div",{className:"me-dialog",style:{maxWidth:Fe?"100vw":900,width:Fe?"100vw":"92vw",maxHeight:Fe?"100%":"90vh",height:Fe?"100%":void 0,borderRadius:Fe?0:14},onClick:S=>S.stopPropagation(),children:[(0,i.jsxs)("div",{className:"me-dialog-head",children:[(0,i.jsx)("h3",{children:o("exportGraph")}),(0,i.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,i.jsx)("a",{className:"mc-btn",href:Ye.url,download:"memory-graph.png",onClick:()=>{Gt("download"),ge(o("downloaded")+" \xB7 "+o("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:o(Kn==="download"?"done":"download")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Gt("full"),bn(S=>!S),ge(o("fullscreen"))},children:o(Kn==="full"?"done":Fe?"exitFull":"fullscreen")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let S=Ye.blob;S&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":S})]).then(()=>{Gt("copy"),ge(o("copied"))}).catch(()=>{ge(o("copyFail"),!1)}):ge(o("copyFail"),!1)},children:o(Kn==="copy"?"done":"copyImage")}),(0,i.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ye.url&&URL.revokeObjectURL(Ye.url),Pe(null),bn(!1)},children:o("close")})]})]}),(0,i.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Fe?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,i.jsx)("img",{src:Ye.url,alt:o("exportGraph"),style:{maxWidth:"100%",maxHeight:Fe?"calc(100% - 64px)":"70vh",borderRadius:Fe?0:8,cursor:"zoom-in"},onClick:()=>bn(S=>!S)})})]})]})]})}function rh(e){let t=new Date(e||0).getTime();if(!t)return"#94a3b8";let n=(Date.now()-t)/864e5;return n<3?"#10b981":n<14?"#f59e0b":n<30?"#f97316":"#94a3b8"}function Gp({label:e,value:t=[],options:n,onChange:r,placeholder:l,z:o=20}){let[a,s]=(0,v.useState)(!1),u=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!a)return;let w=_=>{u.current&&!u.current.contains(_.target)&&s(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[a]);let f=Array.isArray(t)?t:[],y=f.includes("__all__"),h=y?n.find(w=>w.value==="__all__")?.label||"":f.length?f.map(w=>n.find(_=>_.value===w)?.label||w).join("\u3001"):"",m=(w,_)=>{if(w.value==="__all__"){r(_?["__all__"]:[]);return}let d=new Set(f);d.has("__all__")&&d.delete("__all__"),_?d.add(w.value):d.delete(w.value),r([...d])},k=n.find(w=>w.value==="__all__"),z=n.filter(w=>w.value!=="__all__");return(0,i.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,i.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:e}),(0,i.jsxs)("div",{ref:u,style:{position:"relative",minWidth:0},children:[(0,i.jsxs)("button",{type:"button",onClick:()=>s(w=>!w),style:{width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[(0,i.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h||l||"\u2014"}),(0,i.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),a&&(0,i.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:o,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:[k&&(0,i.jsxs)("label",{onClick:w=>w.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,i.jsx)("input",{type:"checkbox",checked:y,onChange:w=>m(k,w.target.checked)}),(0,i.jsx)("span",{children:k.label})]}),z.map(w=>(0,i.jsxs)("label",{onClick:_=>_.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,i.jsx)("input",{type:"checkbox",checked:f.includes(w.value),onChange:_=>m(w,_.target.checked)}),(0,i.jsx)("span",{children:w.label})]},w.value))]})]})]})}function lh(e){let t=new Date(e||0).getTime();return!!t&&(Date.now()-t)/864e5<3}async function oh(e,t,n){if(n&&typeof window.showSaveFilePicker=="function")try{let o=await window.showSaveFilePicker({suggestedName:t}),a=await o.createWritable();return await a.write(e),await a.close(),{ok:!0,picked:!0,name:o.name}}catch(o){return o&&o.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(o.message||o)}}let r=URL.createObjectURL(e),l=document.createElement("a");return l.href=r,l.download=t,document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(r),1e3),{ok:!0,picked:!1,name:t}}function qp(e,t){if(!t||!e)return e;let n=e.toLowerCase(),r=t.toLowerCase(),l=[],o=0;for(;o<e.length;){let a=n.indexOf(r,o);if(a<0){l.push(e.slice(o));break}a>o&&l.push(e.slice(o,a)),l.push((0,i.jsx)("mark",{className:"mc-hl",children:e.slice(a,a+r.length)},a)),o=a+r.length}return l}function Vr(e){if(!e)return"";let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let n=new Date,r=t.toDateString()===n.toDateString(),l=a=>String(a).padStart(2,"0"),o=`${l(t.getHours())}:${l(t.getMinutes())}`;return r?o:`${t.getMonth()+1}-${t.getDate()} ${o}`}var Gs=Xn(Ul(),1);function ih(){try{let e=new URLSearchParams(window.location.search).get("lang");if(e==="zh"||e==="en")return e}catch{}return typeof navigator<"u"&&String(navigator.language||"").toLowerCase().startsWith("zh")?"zh":"en"}function ah(){let[e,t]=(0,Qr.useState)(ih);(0,Qr.useEffect)(()=>{let r=l=>{let o=l&&l.data;o&&o.source==="memory-eternal"&&o.type==="locale"&&(o.lang==="zh"||o.lang==="en")&&t(o.lang)};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)},[]);let n=(0,Qr.useMemo)(()=>r=>(e==="zh"?Ys:Zp)[r]??Ys[r]??r,[e]);return document.documentElement.lang=e==="zh"?"zh-CN":"en",(0,Gs.jsx)(ef,{t:n,inModal:!1})}var sh=(0,nf.createRoot)(document.getElementById("root"));sh.render((0,Gs.jsx)(ah,{}));})();
310
310
  /*! Bundled license information:
311
311
 
312
312
  react/cjs/react.production.min.js: