memory-eternal 0.10.8 → 0.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/README.en.md +11 -7
- package/README.md +10 -7
- package/index.js +40 -4
- package/lib/client.js +13 -13
- package/lib/config-sync.js +5 -1
- package/lib/watchdog.js +9 -2
- package/lib/web.js +40 -3
- package/package.json +2 -2
- package/web/app.js +1 -1
package/lib/client.js
CHANGED
|
@@ -3,17 +3,17 @@ window.__ModuleLoader__.load({
|
|
|
3
3
|
factory: (require) => {
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
|
-
var aa=Object.create;var kt=Object.defineProperty;var na=Object.getOwnPropertyDescriptor;var oa=Object.getOwnPropertyNames;var ia=Object.getPrototypeOf,ra=Object.prototype.hasOwnProperty;var sa=(t,o)=>{for(var r in o)kt(t,r,{get:o[r],enumerable:!0})},Ft=(t,o,r,
|
|
7
|
-
`),r=/^---\n([\s\S]*?)\n---\n?/.exec(o);if(!r)return{meta:[],body:o};let
|
|
8
|
-
`)){let i=
|
|
9
|
-
`)).body;if(!o.trim())return"";let r=[],
|
|
10
|
-
`)){let D=u.trim();if(!D){h();continue}let
|
|
11
|
-
`)}function Ot(t={}){let o=t.repo||"EternalNight996/memory-eternal",r=String(t.title||"[Bug] ").slice(0,120),
|
|
12
|
-
|
|
13
|
-
> \u5185\u5BB9\u8FC7\u957F\u5DF2\u622A\u65AD\uFF1A\u5B8C\u6574\u8BCA\u65AD\u8BF7\u5728\u63D2\u4EF6\u91CC\u70B9\u300C\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u300D\uFF0C\u518D\u8865\u5230 issue \u8BC4\u8BBA\u91CC\u3002`,A=
|
|
6
|
+
var aa=Object.create;var kt=Object.defineProperty;var na=Object.getOwnPropertyDescriptor;var oa=Object.getOwnPropertyNames;var ia=Object.getPrototypeOf,ra=Object.prototype.hasOwnProperty;var sa=(t,o)=>{for(var r in o)kt(t,r,{get:o[r],enumerable:!0})},Ft=(t,o,r,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of oa(o))!ra.call(t,d)&&d!==r&&kt(t,d,{get:()=>o[d],enumerable:!(m=na(o,d))||m.enumerable});return t};var la=(t,o,r)=>(r=t!=null?aa(ia(t)):{},Ft(o||!t||!t.__esModule?kt(r,"default",{value:t,enumerable:!0}):r,t)),da=t=>Ft(kt({},"__esModule",{value:!0}),t);var $a={};sa($a,{EN:()=>Jt,MemoryLibrary:()=>za,ZH:()=>Xt,apply:()=>Sa,inject:()=>xa});module.exports=da($a);var n=la(require("react"),1);var ca={"&":"&","<":"<",">":">"},Dt=t=>String(t).replace(/[&<>]/g,o=>ca[o]),pa=[[/结论|总结|tl;?dr|summary|takeaway/i,"\u2705","ok"],[/风险|注意|警告|禁止|坑|踩坑|务必/i,"\u26A0\uFE0F","warn"],[/根因|原因|为什么|定位|复现/i,"\u{1F50D}","info"],[/修复|解决|变更|fix/i,"\u{1F527}","ok"],[/验证|测试|实测|回归/i,"\u{1F9EA}","ok"],[/方案|做法|实现|设计|思路|架构/i,"\u{1F6E0}\uFE0F","plan"],[/步骤|流程|操作|用法|命令/i,"\u{1F9E9}","plan"],[/背景|由来|context/i,"\u{1F9ED}","info"],[/目标|需求|要解决/i,"\u{1F3AF}","plan"],[/环境|依赖|前置|安装/i,"\u{1F4E6}","info"],[/收益|效果|性能|指标|数据|统计/i,"\u{1F4C8}","ok"],[/示例|例子|样例|demo/i,"\u{1F4A1}","idea"],[/参考|链接|相关/i,"\u{1F517}","info"]],ua=["\u2728","info"],ma=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],ga=t=>{let o=String(t);for(let[r,m,d]of pa)if(r.test(o))return[m,d];return ua},fa=t=>{let o=t.join(" ");for(let[r,m,d]of ma)if(r.test(o))return[m,d];return["\u{1F4CC}","info"]};function st(t){let o=String(t),r=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(o);if(r&&!/[是为有了吗呢着过把被和与或于]/.test(r[1]))return'<span class="md-kv"><span class="md-k">'+Dt(r[1])+'</span><span class="md-v">'+st(r[2])+"</span></span>";let m=Dt(o);return m=m.replace(/^\[([ xX])\](?=\s|$)\s*/,(d,i)=>'<span class="md-task">'+(i.toLowerCase()==="x"?"\u2611":"\u2610")+"</span> "),m=m.replace(/`([^`\n]+)`/g,'<code class="md-code">$1</code>'),m=m.replace(/\*\*([^*]+)\*\*/g,'<strong class="md-b">$1</strong>'),m=m.replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>"),m=m.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(d,i,x)=>/^(https?:|\/|#)/i.test(x)?'<a class="md-link" href="'+x+'" target="_blank" rel="noopener noreferrer">'+i+"</a>":i),m}function zt(t){let o=String(t||"").replace(/\r\n?/g,`
|
|
7
|
+
`),r=/^---\n([\s\S]*?)\n---\n?/.exec(o);if(!r)return{meta:[],body:o};let m=[];for(let d of r[1].split(`
|
|
8
|
+
`)){let i=d.indexOf(":");if(i<=0)continue;let x=d.slice(0,i).trim(),N=d.slice(i+1).trim().replace(/^["']|["']$/g,"");x&&m.push([x,N])}return{meta:m,body:o.slice(r[0].length)}}function Ht(t){let o=String(t||"").trim().replace(/^\[|\]$/g,"");return o?o.split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function jt(t){let o=zt(String(t||"").replace(/\r\n?/g,`
|
|
9
|
+
`)).body;if(!o.trim())return"";let r=[],m=o.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(u,D,I)=>(r.push('<pre class="md-pre"><code>'+Dt(I.replace(/\n$/,""))+"</code></pre>"),"\0F"+(r.length-1)+"\0")),d=[],i=[],x=null,N=null,v=()=>{i.length&&(d.push('<p class="md-p">'+i.join("<br/>")+"</p>"),i=[])},A=()=>{if(!x)return;let u=x.type;d.push("<"+u+' class="md-'+u+'">'+x.items.map(D=>"<li>"+D+"</li>").join("")+"</"+u+">"),x=null},S=()=>{if(!N)return;let[u,D]=fa(N);d.push('<div class="md-callout md-c-'+D+'"><span class="md-ico">'+u+"</span>"+N.join("<br/>")+"</div>"),N=null},h=()=>{v(),A(),S()};for(let u of m.split(`
|
|
10
|
+
`)){let D=u.trim();if(!D){h();continue}let I=/^\u0000F(\d+)\u0000$/.exec(D);if(I){h(),d.push(r[Number(I[1])]);continue}let w;if(w=/^(#{1,6})\s+(.+)$/.exec(D)){h();let[T,M]=ga(w[2]);d.push('<div class="md-h md-h-'+(w[1].length<=2?"h1":"h2")+" md-c-"+M+'"><span class="md-ico">'+T+'</span><span class="md-hx">'+st(w[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(D)){h(),d.push('<hr class="md-hr"/>');continue}if(w=/^>\s?(.*)$/.exec(D)){v(),A(),N=N||[],N.push(st(w[1]));continue}if(w=/^[-*+]\s+(.+)$/.exec(D)){v(),S(),(!x||x.type!=="ul")&&(A(),x={type:"ul",items:[]}),x.items.push(st(w[1]));continue}if(w=/^\d+[.)]\s+(.+)$/.exec(D)){v(),S(),(!x||x.type!=="ol")&&(A(),x={type:"ol",items:[]}),x.items.push(st(w[1]));continue}A(),S(),i.push(st(D))}return h(),d.join(`
|
|
11
|
+
`)}function Ot(t={}){let o=t.repo||"EternalNight996/memory-eternal",r=String(t.title||"[Bug] ").slice(0,120),m=Array.isArray(t.labels)?t.labels:["bug"],d=Number(t.maxLength)>500?Number(t.maxLength):7e3,i=v=>{let A=new URLSearchParams;return A.set("title",r),A.set("body",v),m.length&&A.set("labels",m.join(",")),"https://github.com/"+o+"/issues/new?"+A.toString()},x=String(t.body||""),N=i(x);if(N.length>d){let v=`
|
|
12
|
+
|
|
13
|
+
> \u5185\u5BB9\u8FC7\u957F\u5DF2\u622A\u65AD\uFF1A\u5B8C\u6574\u8BCA\u65AD\u8BF7\u5728\u63D2\u4EF6\u91CC\u70B9\u300C\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u300D\uFF0C\u518D\u8865\u5230 issue \u8BC4\u8BBA\u91CC\u3002`,A=S=>i(x.slice(0,S)+v);if(A(0).length>d)x=v;else{let S=0,h=x.length;for(;S<h;){let u=Math.ceil((S+h)/2);A(u).length<=d?S=u:h=u-1}x=x.slice(0,S)+v}N=i(x)}return N}function Wt(t={}){return["## \u73B0\u8C61",String(t.description||"").trim()||"\uFF08\u8BF7\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF09","","## \u590D\u73B0\u6B65\u9AA4","1. ","2. ","","## \u671F\u671B\u884C\u4E3A","","## \u5B9E\u9645\u884C\u4E3A","","## \u73AF\u5883","- \u63D2\u4EF6\u7248\u672C: "+(t.version||"\uFF08\u89C1\u8BCA\u65AD\u4FE1\u606F\uFF09"),"",t.diagnostics||"","","---","> \u7531 memory-eternal \u63D2\u4EF6\u5185\u300C\u53CD\u9988\u5F02\u5E38\u300D\u751F\u6210\uFF08\u8BCA\u65AD\u4FE1\u606F\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E\u5404\u7C7B key/token \u5DF2\u66FF\u6362\uFF09\u3002"].join(`
|
|
14
14
|
`)}var Tt="https://github.com/EternalNight996/memory-eternal",ba=["\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"+Tt,"","\u8BF7\u6309\u8FD9\u4E2A\u6D41\u7A0B\u505A\uFF1A","","1. \u5148\u8DD1 `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50`\uFF0C\u770B\u662F\u5426\u5DF2\u6709\u76F8\u540C\u95EE\u9898\uFF1A"," - \u5DF2\u6709 \u2192 \u7528 `gh issue comment <\u7F16\u53F7> --body-file <\u6587\u4EF6>` \u8865\u5145\u73B0\u8C61\uFF0C\u4E0D\u8981\u91CD\u590D\u5F00\u65B0 issue\uFF1B"," - \u6CA1\u6709 \u2192 \u7EE7\u7EED\u7B2C 2 \u6B65\u3002",'2. \u628A\u6B63\u6587\u5199\u6210\u6587\u4EF6\uFF0C\u7136\u540E `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <\u4E00\u53E5\u8BDD\u6982\u62EC>" --body-file <\u6587\u4EF6>`\uFF1B\u6B63\u6587\u7528\u8FD9\u4E2A\u7ED3\u6784\uFF1A'," \u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A / \u5B9E\u9645\u884C\u4E3A / \u73AF\u5883\uFF08\u63D2\u4EF6\u7248\u672C / DSH \u7248\u672C / \u64CD\u4F5C\u7CFB\u7EDF / Node\uFF09/ \u8BCA\u65AD\u4FE1\u606F\u3002","3. \u5982\u679C `gh` \u6CA1\u767B\u5F55\u6216\u4E0D\u53EF\u7528\uFF0C\u4E0D\u8981\u5C1D\u8BD5\u63D0\u4EA4\uFF0C\u6539\u4E3A\u8F93\u51FA\u4E00\u6761\u300C\u6807\u9898\u4E0E\u6B63\u6587\u90FD\u5DF2\u9884\u586B\u300D\u7684 GitHub \u65B0\u5EFA issue \u94FE\u63A5\u7ED9\u6211\uFF0C\u6211\u81EA\u5DF1\u70B9\u63D0\u4EA4\u3002","4. \u63D0\u4EA4\u6210\u529F\u540E\uFF0C\u628A issue \u94FE\u63A5\u53D1\u7ED9\u6211\u3002","","\u6CE8\u610F\uFF1A\u6211\u7684\u95EE\u9898\u63CF\u8FF0\u8BF7\u539F\u6837\u7167\u5F55\uFF0C\u4E0D\u8981\u66FF\u6211\u7F8E\u5316\u6216\u7701\u7565\u7EC6\u8282\uFF1B\u8BCA\u65AD\u4FE1\u606F\u539F\u6837\u653E\u8FDB\u300C\u8BCA\u65AD\u4FE1\u606F\u300D\u4E00\u8282\u3002","","\u6211\u7684\u95EE\u9898\u63CF\u8FF0\uFF1A","<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>","","\u8BCA\u65AD\u4FE1\u606F\uFF1A","<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>"].join(`
|
|
15
15
|
`),ya=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+Tt,"","Workflow:","","1. Run `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50` first: if a matching issue exists, add a comment with `gh issue comment <n> --body-file <file>` instead of opening a duplicate.",'2. Otherwise create it with `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <one-line summary>" --body-file <file>`, using sections: Symptoms / Steps to reproduce / Expected / Actual / Environment (plugin, DSH, OS, Node) / Diagnostics.',"3. If `gh` is not authenticated or unavailable, do NOT try to submit: output a GitHub new-issue link with the title and body pre-filled instead, and I will click submit myself.","4. Report the resulting issue URL back to me.","","Keep my description verbatim - do not rewrite or summarise it. Put the diagnostics under the Diagnostics section as-is.","","My description:","<write your problem here>","","Diagnostics:","<paste the diagnostics copied from the in-app Report-a-bug dialog>"].join(`
|
|
16
|
-
`);function $t(t={}){let o=t.lang==="en"?"en":"zh",r=o==="en"?ya:ba,g=t.repo||"EternalNight996/memory-eternal";return r=r.split(Tt).join("https://github.com/"+g),t.description&&(r=r.replace(o==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(r=r.replace(o==="en"?"<paste the diagnostics copied from the in-app Report-a-bug dialog>":"<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>",String(t.diagnostics).trim())),r}function _t({panX:t=0,panY:o=0,zoom:r=1,w:g=0,h:c=0,margin:i=60}={}){let x=r||1;return{x0:(0-t)/x-i,y0:(0-o)/x-i,x1:(g-t)/x+i,y1:(c-o)/x+i}}function St(t,o,r,g){return g?t+r>=g.x0&&t-r<=g.x1&&o+r>=g.y0&&o-r<=g.y1:!0}function Ut(t){let o=Number(t)||0;return o<=120?1/0:o<=300?160:o<=600?90:60}function Kt(t,o={}){let r=Number.isFinite(o.limit)?o.limit:1/0,g=new Set,c=v=>{v&&g.size<r&&g.add(v)};if(c(o.focusId),c(o.hoverId),o.searchHits)for(let v of o.searchHits){if(g.size>=r)break;g.add(v)}let i=o.degree||{},x=v=>Number(i[v])||0,N=[];for(let v of Array.isArray(t)?t:[])v&&v.id&&!g.has(v.id)&&N.push(v);N.sort((v,A)=>x(A.id)-x(v.id));for(let v of N){if(g.size>=r)break;g.add(v.id)}return g}function ha(t,o){if(t===o)return!0;if(t===null||o===null||t===void 0||o===void 0||typeof t!="object"&&typeof o!="object")return t===o;try{return JSON.stringify(t)===JSON.stringify(o)}catch{return!1}}function qt(t,o){let r={...t||{}},g={};for(let[c,i]of Object.entries(o||{}))ha(t?t[c]:void 0,i)||(r[c]=i,g[c]=i);return{values:r,overlay:g}}var e=require("react/jsx-runtime"),lt="memory-eternal",K="/memory-eternal/api",va=100,xa=["slots","locale"],Xt={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]
|
|
16
|
+
`);function $t(t={}){let o=t.lang==="en"?"en":"zh",r=o==="en"?ya:ba,m=t.repo||"EternalNight996/memory-eternal";return r=r.split(Tt).join("https://github.com/"+m),t.description&&(r=r.replace(o==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(r=r.replace(o==="en"?"<paste the diagnostics copied from the in-app Report-a-bug dialog>":"<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>",String(t.diagnostics).trim())),r}function _t({panX:t=0,panY:o=0,zoom:r=1,w:m=0,h:d=0,margin:i=60}={}){let x=r||1;return{x0:(0-t)/x-i,y0:(0-o)/x-i,x1:(m-t)/x+i,y1:(d-o)/x+i}}function St(t,o,r,m){return m?t+r>=m.x0&&t-r<=m.x1&&o+r>=m.y0&&o-r<=m.y1:!0}function Ut(t){let o=Number(t)||0;return o<=120?1/0:o<=300?160:o<=600?90:60}function Kt(t,o={}){let r=Number.isFinite(o.limit)?o.limit:1/0,m=new Set,d=v=>{v&&m.size<r&&m.add(v)};if(d(o.focusId),d(o.hoverId),o.searchHits)for(let v of o.searchHits){if(m.size>=r)break;m.add(v)}let i=o.degree||{},x=v=>Number(i[v])||0,N=[];for(let v of Array.isArray(t)?t:[])v&&v.id&&!m.has(v.id)&&N.push(v);N.sort((v,A)=>x(A.id)-x(v.id));for(let v of N){if(m.size>=r)break;m.add(v.id)}return m}function ha(t,o){if(t===o)return!0;if(t===null||o===null||t===void 0||o===void 0||typeof t!="object"&&typeof o!="object")return t===o;try{return JSON.stringify(t)===JSON.stringify(o)}catch{return!1}}function qt(t,o){let r={...t||{}},m={};for(let[d,i]of Object.entries(o||{}))ha(t?t[d]:void 0,i)||(r[d]=i,m[d]=i);return{values:r,overlay:m}}var e=require("react/jsx-runtime"),lt="memory-eternal",U="/memory-eternal/api",va=100,xa=["slots","locale"],Xt={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]
|
|
17
17
|
|
|
18
18
|
## \u80CC\u666F
|
|
19
19
|
- \u95EE\u9898\u63CF\u8FF0
|
|
@@ -298,13 +298,13 @@ Option A, because:
|
|
|
298
298
|
height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
|
|
299
299
|
max-height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
|
|
300
300
|
}
|
|
301
|
-
`;function Sa(t){t.effect(()=>t.locale.register(lt,{zh:Xt,en:Jt}),"memory-eternal: locale");let o=t.locale.bind(lt);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:lt,order:25,label:()=>o("nav"),locale:lt,inject:()=>({})},()=>n.default.createElement(Na,{t:o}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${lt}:footer`,order:100,label:()=>o("nav"),locale:lt,inject:()=>({})},r=>n.default.createElement(Ma,{t:o,locale:t.locale,wide:!(r&&r.wide===!1)}))),"memory-eternal: sidebar footer action")}function Ca(){let[t,o]=(0,n.useState)("
|
|
301
|
+
`;function Sa(t){t.effect(()=>t.locale.register(lt,{zh:Xt,en:Jt}),"memory-eternal: locale");let o=t.locale.bind(lt);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:lt,order:25,label:()=>o("nav"),locale:lt,inject:()=>({})},()=>n.default.createElement(Na,{t:o}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${lt}:footer`,order:100,label:()=>o("nav"),locale:lt,inject:()=>({})},r=>n.default.createElement(Ma,{t:o,locale:t.locale,wide:!(r&&r.wide===!1)}))),"memory-eternal: sidebar footer action")}function Ca(){let[t,o]=(0,n.useState)(U+"/ui/app");return(0,n.useEffect)(()=>{let r=!0,m=()=>fetch("/memory-eternal/api/web-info").then(d=>d.json()).then(d=>{r&&d&&d.ok&&d.alive!==!1&&d.url&&o(d.url.endsWith("/")?d.url:d.url+"/")}).catch(()=>{});return fetch(U+"/ui/app",{method:"HEAD"}).then(d=>{if(r&&!d.ok)return m()}).catch(()=>r?m():void 0),()=>{r=!1}},[]),t}function Na({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsx)(ta,{t,onReload:()=>{},version:0})]})}function Ma({t,locale:o,wide:r}){let[m,d]=(0,n.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${r?"":" rail"}`,children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("button",{type:"button",className:"me-footer-btn",onClick:()=>d(!0),"aria-label":t("nav"),title:t("nav"),children:[(0,e.jsx)("span",{className:"me-footer-ico","aria-hidden":"true",children:(0,e.jsx)(Qt,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),m&&(0,e.jsx)(Da,{t,locale:o,onClose:()=>d(!1)})]})}function Da({t,locale:o,onClose:r,tab:m}){let[d,i]=(0,n.useState)(!1),x=(0,n.useRef)(null),N=Ca(),v=(0,n.useCallback)(I=>o&&typeof o.subscribe=="function"?o.subscribe(I):()=>{},[o]),A=(0,n.useCallback)(()=>o&&typeof o.getSnapshot=="function"?o.getSnapshot():null,[o]),S=(0,n.useSyncExternalStore)(v,A),h=S&&(S.active==="zh"||S.active==="en")?S.active:null,u=(0,n.useRef)(null);u.current===null&&h&&(u.current=h);let D=(0,n.useMemo)(()=>{let I=u.current?`lang=${u.current}`:"";if(m==="config")return`${U}/ui/config?tab=config${I?`&${I}`:""}`;let w=N.replace(/\/$/,""),T=w.endsWith("/ui/app")?"?":"/?";return m?`${w}${T}tab=${m}${I?`&${I}`:""}`:I?`${w}${T}${I}`:N},[N,m]);return(0,n.useEffect)(()=>{let I=x.current&&x.current.contentWindow;I&&h&&I.postMessage({source:"memory-eternal",type:"locale",lang:h},"*")},[h]),(0,n.useEffect)(()=>{let I=w=>{w.key==="Escape"&&r()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[r]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:r,children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsx)("div",{className:"me-modal"+(d?" me-modal-full":""),onClick:I=>I.stopPropagation(),children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,position:"relative"},children:[(0,e.jsxs)("div",{style:{position:"absolute",top:8,right:8,zIndex:10,display:"flex",gap:4,padding:"4px 6px",background:"var(--dsw-alias-bg-overlay, rgba(17,24,39,0.45))",borderRadius:8,backdropFilter:"blur(4px)"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>i(I=>!I),"aria-label":t(d?"exitFullscreen":"enterFullscreen"),title:t(d?"exitFullscreen":"enterFullscreen"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:14,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:d?"\u2921":"\u2922"}),(0,e.jsx)("button",{type:"button",onClick:r,"aria-label":t("close"),title:t("close"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:16,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,e.jsx)("iframe",{ref:x,src:D,title:"memory-eternal",allow:"clipboard-write; clipboard-read",style:{width:"100%",flex:1,border:0,borderRadius:"inherit",background:"var(--dsw-alias-bg-base, #fff)"}})]})})]})}function Qt(){return(0,e.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,e.jsx)("defs",{children:(0,e.jsxs)("linearGradient",{id:"mg-brain",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,e.jsx)("stop",{offset:"0%",stopColor:"#FFC46B"}),(0,e.jsx)("stop",{offset:"50%",stopColor:"#F97316"}),(0,e.jsx)("stop",{offset:"100%",stopColor:"#EA580C"})]})}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 0-6.4.1 4.1 4.1 0 0 0-2.7 5.9 4.1 4.1 0 0 0 .6 6.7A4.2 4.2 0 0 0 12 18.2Z"}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 1 6.4.1 4.1 4.1 0 0 1 2.7 5.9 4.1 4.1 0 0 1-.6 6.7A4.2 4.2 0 0 1 12 18.2Z"}),(0,e.jsx)("path",{d:"M12 9.2c-.8-1.4-1.7-2-3.1-2.2M12 9.2c.8-1.4 1.7-2 3.1-2.2M12 12.4c-1.2 1-3.2 1.6-5 1.4M12 12.4c1.2 1 3.2 1.6 5 1.4M12 13.2v4",fill:"none",stroke:"rgba(255,255,255,0.62)",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"8.6",r:"1.1",fill:"rgba(255,255,255,0.85)"})]})}var bt="0.10.9";function za({t,inModal:o,onClose:r,onFull:m,full:d}){let[i,x]=(0,n.useState)(null),[N,v]=(0,n.useState)([]),[A,S]=(0,n.useState)(!0),[h,u]=(0,n.useState)(null),[D,I]=(0,n.useState)(""),[w,T]=(0,n.useState)("all"),[M,H]=(0,n.useState)(""),[ee,ye]=(0,n.useState)("all"),[K,Te]=(0,n.useState)("all"),[W,de]=(0,n.useState)(()=>{try{let f=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),P={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(f&&P[f])return P[f]}catch{}return"cards"}),[oe,F]=(0,n.useState)(()=>new Set([W])),y=(0,n.useCallback)(f=>{F(P=>P.has(f)?P:new Set(P).add(f)),de(f)},[]),[b,k]=(0,n.useState)("recent"),[V,$]=(0,n.useState)(null),_=(0,n.useRef)(null),ie=(0,n.useRef)(null),[te,ke]=(0,n.useState)(!1),[Ke,ue]=(0,n.useState)(null),[Be,Pe]=(0,n.useState)(!1),[Oe,Ce]=(0,n.useState)(!1),[be,xe]=(0,n.useState)(!0),[et,Je]=(0,n.useState)(null),[qe,nt]=(0,n.useState)(0),tt=(0,n.useCallback)(()=>nt(f=>f+1),[]),Me=i?.quarantine?.pending??0,Ie=i?.quarantine?.deleted??0,se=(0,n.useRef)(null),[Ve,we]=(0,n.useState)(0),[c,s]=(0,n.useState)(!1),E=(0,n.useRef)(null),ne=(0,n.useRef)(null),O=(0,n.useCallback)(async(f=w,P=M,X=K,he={})=>{let Y=he.append===!0;try{Y?s(!0):(S(!0),I(""));let fe=new URLSearchParams;f&&f!=="all"&&fe.set("kind",f),P.trim()&&fe.set("q",P.trim()),fe.set("status",X||"all"),fe.set("limit",String(va)),fe.set("offset",String(he.offset||0)),b==="title"&&fe.set("sort","title");let De=await(await fetch(`${U}/cards?${fe.toString()}`)).json();if(De.ok){let We=De.cards||[];v(Ee=>Y?[...Ee,...We.filter($e=>!Ee.some(ht=>ht.path===$e.path))]:We),we(Number(De.total)||We.length)}}catch(fe){I(String(fe&&fe.message?fe.message:fe))}finally{Y?s(!1):S(!1)}},[w,M,K,b]),ce=(0,n.useCallback)(async()=>{try{let[f,P]=await Promise.all([fetch(`${U}/overview`).then(X=>X.json()),fetch(`${U}/capture-log`).then(X=>X.json()).catch(()=>null)]);f.ok&&x(f),u(P&&P.ok&&P.available&&P.health||null)}catch(f){I(String(f&&f.message?f.message:f))}finally{S(!1)}},[]),a=async f=>{try{let X=await(await fetch(`${U}/delete?path=${encodeURIComponent(f)}`)).json();X.ok?($({ok:!0,msg:t("deleted")}),await ce(),tt()):$({ok:!1,msg:X.error||t("deleteFail")})}catch{$({ok:!1,msg:t("deleteFail")})}_.current&&clearTimeout(_.current),_.current=setTimeout(()=>$(null),2e3)};(0,n.useEffect)(()=>(ce(),()=>{se.current&&clearTimeout(se.current)}),[ce]);let l=f=>{H(f),se.current&&clearTimeout(se.current),se.current=setTimeout(()=>O(w,f,K),280)},L=f=>{T(f),O(f,M,K)};(0,n.useEffect)(()=>{W==="cards"&&O(w,M,K)},[K,W,qe,b]),(0,n.useEffect)(()=>{if(W!=="cards"||A||c||N.length>=Ve)return;let f=E.current,P=ne.current;if(!f)return;let X=new IntersectionObserver(he=>{he[0]&&he[0].isIntersecting&&O(w,M,K,{append:!0,offset:N.length})},{root:P||null,rootMargin:"400px"});return X.observe(f),()=>X.disconnect()},[W,N,Ve,A,c,w,M,K,O]);let B=async f=>{try{let P=f.status;if(!P&&f.path)try{let Ne=((await fetch(`${U}/cards?status=all&q=${encodeURIComponent(f.title||"")}&limit=50`).then(De=>De.json())).cards||[]).find(De=>De.path===f.path);Ne&&(P=Ne.status)}catch{}let X=P&&P!=="approved"?`&status=${encodeURIComponent(P)}`:"",he=await fetch(`${U}/card?path=${encodeURIComponent(f.path||f.id)}${X}`),Y=await he.json();Y.ok?ue({path:Y.path,title:f.title,text:Y.text}):I(Y.error||`HTTP ${he.status}`)}catch(P){I(String(P&&P.message?P.message:P))}},G=async(f,P)=>{ke(!0);try{let X=await fetch(`${U}/export`);if(!X.ok)throw new Error("HTTP "+X.status);let he=await X.json();if(!he.ok)throw new Error(he.error||"export failed");let Y,fe,Ne;if(f==="json"){fe="memory-vault.json",Ne="application/json";let Ee=he.cards.map($e=>({path:$e.path,title:$e.title,kind:$e.kind,status:$e.status,store:$e.store,text:$e.text}));Y=JSON.stringify({format:he.format||"memory-eternal-vault",formatVersion:he.formatVersion||1,exportedAt:he.exportedAt||new Date().toISOString(),count:Ee.length,cards:Ee},null,2)}else fe="memory-vault.md",Ne="text/markdown;charset=utf-8",Y=he.cards.map(Ee=>Ee.text.trim()).filter(Boolean).join(`
|
|
302
302
|
|
|
303
303
|
---
|
|
304
304
|
|
|
305
|
-
`);let De=new Blob([Y],{type:Ne}),We=await Wa(De,fe,!1);if(!We.ok){$({ok:!1,msg:t("exportFail")}),ke(!1);return}$({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+We.name})}catch(X){$({ok:!1,msg:t("exportFail")+" \xB7 "+(X.message||"")})}finally{ke(!1)}_.current&&clearTimeout(_.current),_.current=setTimeout(()=>$(null),2600)},me=async f=>{let P=f.target.files&&f.target.files[0];if(f.target.value="",!!P){try{let X=await P.text(),Y=await(await fetch(`${K}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:X})).json();if(Y.ok){await ce();let fe=Y.imported||0,Ne=t("importedVault")+"\uFF1A"+fe;Y.total&&(Ne+=t("importedTotal")+Y.total+t("importedTotalTail")),Y.quarantined&&(Ne+=t("importedQuarantine")+Y.quarantined+t("importedQuarantineTail")),Y.skipped&&(Ne+=t("importedSkipped")+Y.skipped+t("importedSkippedTail")),Y.warning&&(Ne+=" \xB7 "+Y.warning),$({ok:fe>0||!Y.total,msg:Ne})}else $({ok:!1,msg:Y.error||t("importFail")})}catch{$({ok:!1,msg:t("importFail")})}_.current&&clearTimeout(_.current),_.current=setTimeout(()=>$(null),2400)}},q=(0,n.useMemo)(()=>{let f=N.slice();return ee!=="all"&&(f=f.filter(P=>ut(P.submittedBy)===ee)),U!=="all"&&(f=f.filter(P=>(P.status||"approved")===U)),b==="title"?f.sort((P,X)=>String(P.title||"").localeCompare(String(X.title||""))):b==="hot"?f.sort((P,X)=>(X.weight||X.links||0)-(P.weight||P.links||0)):f.sort((P,X)=>new Date(X.updated||0).getTime()-new Date(P.updated||0).getTime()),f},[N,b,ee,U]),ae=(0,n.useMemo)(()=>[...new Set(N.map(f=>ut(f.submittedBy)))],[N]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Ae}),V&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(V.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:V.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:V.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:V.msg})]}),o&&(0,e.jsxs)("div",{className:"me-modal-head",children:[(0,e.jsxs)("div",{className:"me-modal-title",children:[(0,e.jsx)("span",{className:"me-wicon",children:(0,e.jsx)(Qt,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),g&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:g,"aria-label":t(c?"exitFull":"fullscreen"),children:c?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:r,"aria-label":t("close"),children:"\u2715"})]}),h&&h.ok===!1&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,margin:"0 0 8px",padding:"9px 14px",borderRadius:10,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.45)",borderLeft:"4px solid #ef4444",color:"var(--dsw-alias-label-primary, #e5e7eb)",fontSize:12.5,lineHeight:1.6},children:[(0,e.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",t("captureAlert")]}),(0,e.jsxs)("span",{style:{flex:1},children:[h.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:h.since?pt(new Date(h.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${be?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>xe(f=>!f),"aria-label":t(be?"collapse":"expand"),title:t(be?"collapse":"expand"),children:be?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="cards"?" active":""}`,onClick:()=>y("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="graph"?" active":""}`,onClick:()=>y("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="stats"?" active":""}`,onClick:()=>y("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="audit"?" active":""}`,onClick:()=>y("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")}),Me>0&&(0,e.jsx)("span",{className:"mc-dot",children:Me>99?"99+":Me})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="optimize"?" active":""}`,onClick:()=>y("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")}),Ie>0&&(0,e.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:Ie>99?"99+":Ie})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="config"?" active":""}`,onClick:()=>y("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Ce(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:ne,children:[W==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(dt,{label:t("total"),value:i?i.total:"\u2014"}),(0,e.jsx)(dt,{label:t("recent"),value:i?i.recent:"\u2014"}),(0,e.jsx)(dt,{label:t("tags"),value:i?i.tags:"\u2014"}),(0,e.jsx)(dt,{label:t("pending"),value:i?.quarantine?.pending??i?.status?.pending??0}),(0,e.jsx)(dt,{label:t("rejected"),value:i?.quarantine?.rejected??i?.status?.rejected??0}),(0,e.jsx)(dt,{label:t("cardCount"),value:i?i.byKind?.knowledge??0:"\u2014"})]}),W==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:M,onChange:f=>l(f.target.value)}),(0,e.jsx)("input",{ref:ie,type:"file",accept:".json,application/json",style:{display:"none"},onChange:me}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ie.current&&ie.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>Je({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:te,onClick:()=>G("md"),children:t(te?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:te,onClick:()=>G("json"),children:t(te?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ce(),children:t("refresh")})]}),W==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[Lt.map(f=>(0,e.jsx)("button",{type:"button",className:`mc-chip${S===f?" active":""}`,onClick:()=>L(f),children:t(f==="all"?"all":Ue[f])},f)),(0,e.jsxs)("select",{value:ee,onChange:f=>ye(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsxs)("option",{value:"all",children:["\u{1F916} ",t("allAgents")]}),Zt(ae).map(f=>(0,e.jsx)("option",{value:f,children:f},f))]}),(0,e.jsxs)("select",{value:U,onChange:f=>Te(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allStatus")}),(0,e.jsx)("option",{value:"approved",children:t("statusApproved")}),(0,e.jsx)("option",{value:"pending",children:t("statusPending")}),(0,e.jsx)("option",{value:"rejected",children:t("statusRejected")})]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:t("sortRecent")},{key:"title",label:t("sortTitle")},{key:"hot",label:t("sortHot")}].map(f=>(0,e.jsx)("button",{type:"button",className:`mc-chip${b===f.key?" active":""}`,onClick:()=>w(f.key),children:f.label},f.key))]}),D&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",D]}),(0,e.jsx)("div",{style:{display:W==="cards"?"contents":"none"},children:A?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):D?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",D," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ce(),children:t("retry")})]}):N.length===0?(0,e.jsx)("div",{className:"mc-empty",children:t("empty")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"mc-grid",children:q.map(f=>(0,e.jsx)(La,{card:f,t,query:M.trim(),onOpen:B,onDelete:a},f.path))}),N.length<Ve&&(0,e.jsx)("div",{ref:E,style:{height:1}}),d&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",N.length," / ",Ve,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:W==="graph"?"flex":"none",flex:1,minHeight:0},children:oe.has("graph")&&(0,e.jsx)(Ea,{t,onOpen:B,all:Be,onAllChange:Pe,onMutate:tt,active:W==="graph",visible:W==="graph"})}),(0,e.jsx)("div",{style:{display:W==="config"?"contents":"none"},children:oe.has("config")&&(0,e.jsx)(ta,{t,onReload:()=>ce(),version:qe})}),(0,e.jsx)("div",{style:{display:W==="stats"?"contents":"none"},children:oe.has("stats")&&(0,e.jsx)(Ra,{t,tab:"stats",onReload:()=>ce(),version:qe})}),(0,e.jsx)("div",{style:{display:W==="audit"?"contents":"none"},children:oe.has("audit")&&(0,e.jsx)(Ta,{t,onReload:()=>ce(),version:qe})}),(0,e.jsx)("div",{style:{display:W==="optimize"?"contents":"none"},children:oe.has("optimize")&&(0,e.jsx)(Ia,{t,onReload:()=>ce(),version:qe})}),Oe&&(0,e.jsx)(Ba,{t,onClose:()=>Ce(!1)}),Ke&&(0,e.jsx)(Pa,{t,card:Ke,query:M.trim(),onClose:()=>ue(null),onDelete:f=>{ue(null),a(f)},onFeedback:f=>{let P=Ke.path;fetch(`${K}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:M.trim(),path:P,useful:f})}).then(()=>$({ok:!0,msg:t(f?"fbUseful":"fbIrr")})).catch(()=>{}),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>$(null),2e3)}}),(0,e.jsx)(Aa,{t,newCard:et,setNewCard:Je,onCreated:()=>{ce(),tt(),$({ok:!0,msg:t("created")}),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>$(null),2e3)}})]})]})]})}var ea=({toast:t})=>t?(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"8px 12px",fontSize:12,borderLeft:"4px solid "+(t.ok?"#10b981":"#ef4444"),background:t.ok?"rgba(16,185,129,0.08)":"rgba(239,68,68,0.08)"},children:[t.ok?"\u2705":"\u26A0"," ",t.msg]}):null,dt=({label:t,value:o})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:o}),(0,e.jsx)("span",{children:t})]});function ta({t,onReload:o,version:r,compact:g}){let[c,i]=(0,n.useState)(null),[x,N]=(0,n.useState)(0),[v,A]=(0,n.useState)(null),[k,h]=(0,n.useState)(null),[u,D]=(0,n.useState)(!1),[T,S]=(0,n.useState)(!1),I=(0,n.useRef)(!1),M=(0,n.useRef)(null),H=(0,n.useRef)({}),[ee,ye]=(0,n.useState)(null),[U,Te]=(0,n.useState)(null),[W,de]=(0,n.useState)(""),[oe,F]=(0,n.useState)(""),[y,b]=(0,n.useState)(""),[w,V]=(0,n.useState)(null),$=(0,n.useCallback)(async l=>{F("version");try{let L=await fetch(K+"/version-check"+(l?"?force=1":"")).then(B=>B.json());L&&L.ok?(V(L),l&&ue(L.updateAvailable?t("vcLatest")+" v"+L.latest:t("vcUpToDate"))):l&&ue(t("vcCheckFail"),!1)}catch{l&&ue(t("vcCheckFail"),!1)}finally{F("")}},[t]);(0,n.useEffect)(()=>{$(!1)},[r,$]);let[_,ie]=(0,n.useState)(""),[te,ke]=(0,n.useState)(null),Ke=(0,n.useRef)(null),ue=(l,L=!0)=>{Ke.current&&clearTimeout(Ke.current),ke({msg:l,ok:L}),Ke.current=setTimeout(()=>ke(null),1900)},Be=async()=>{if(!oe){F("restart");try{let l=await fetch(K+"/restart-self",{method:"POST"});if(l.status===404||l.status===405){ue(Ce("vcRestartNoRoute",{cmd:w&&w.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let L=await l.json().catch(()=>null);if(!L){ue(t("vcRestartFail")+"\uFF08HTTP "+l.status+"\uFF09",!1);return}if(!L.ok){ue(L.error||t("vcRestartFail"),!1);return}if(L.alreadyCurrent){ue(L.note||t("vcRestartCurrent"));return}ue(L.note||t("vcRestartSent")),L.alreadyRunning||setTimeout(()=>{$(!0)},6e3)}catch(l){ue(t("vcRestartFail")+"\uFF1A"+String(l&&l.message||l),!1)}finally{F("")}}},Pe=w&&w.resident?String(w.resident.served||""):"",Oe=!!(w&&w.onDisk&&Pe&&Pe!==w.onDisk),Ce=(l,L)=>Object.keys(L).reduce((B,G)=>B.split("{"+G+"}").join(L[G]),t(l)),be=(0,n.useCallback)(async()=>{try{let[l,L,B]=await Promise.all([fetch(`${K}/config`).then(G=>G.json()).catch(()=>null),fetch(`${K}/setup-status`).then(G=>G.json()).catch(()=>null),fetch(`${K}/budget`).then(G=>G.json()).catch(()=>null)]);if(l&&l.ok){i(l),N(l.revision??0),A(l.schema??null);let G=qt(l.config??{},H.current);H.current=G.overlay,h({...G.values}),ye(l.dsh??null),D(l.writable===!1),S(l.viaPending===!0),de(""),I.current=!1}else B&&B.ok?(h({...B}),D(!0),de(t("configNeedsDsh"))):de(t("adminLoadFail"));L&&L.ok&&Te(L),b("")}catch{de(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{be()},[r,be]);let xe=(l,L)=>{I.current=!0,h(B=>({...B??{},[l]:L}))};(0,n.useEffect)(()=>{M.current=be},[be]),(0,n.useEffect)(()=>{if(typeof EventSource>"u")return;let l=null;try{l=new EventSource(K+"/events")}catch{return}let L=()=>{!I.current&&typeof M.current=="function"&&M.current()};try{l.addEventListener("config",L)}catch{}return()=>{try{l.close()}catch{}}},[]);let et=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),Je=l=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[l]||l,qe=async()=>{if(!k)return;if(u){ue(t("editInSetting"),!1);return}let l={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]},L=[];for(let[B,[G,me]]of Object.entries(l)){if(!(B in k))continue;let q=k[B],ae=typeof q=="number"?q:Number(q);(q===""||q===null||q===void 0||!Number.isFinite(ae)||ae<G||ae>me)&&L.push(t("invalidField",{field:B,min:G,max:me,value:String(q===""?"\u7A7A":q)}))}if(L.length){let B=t("saveInvalid")+"\uFF1A"+L.join("\uFF1B");de(B),ue(B,!1);return}F("save");try{let B={...k};for(let ae of Object.keys(k))ae in B&&typeof B[ae]=="string"&&B[ae].trim()!==""&&et.has(ae)&&(B[ae]=Number(B[ae]));Array.isArray(B.vaultProfiles)&&(B.vaultProfiles=B.vaultProfiles.filter(ae=>ae&&(String(ae.name||"").trim()||String(ae.path||"").trim())));let G=await fetch(`${K}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:B,expectedRevision:x})}),me=await G.text(),q=null;try{q=me?JSON.parse(me):null}catch{q=null}if(q||(q={error:"HTTP "+G.status+(me?"\uFF1A"+me.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")}),q&&q.ok){let ae=typeof q.pendingOutcome=="string"?q.pendingOutcome:"",f,P=!0;if(ae==="applied")f=t("savedApplied")+(Array.isArray(q.applied)&&q.applied.length?" \xB7 "+q.applied.join("\u3001"):"");else if(ae==="queued")P=!1,f=t("saveQueued");else if(ae==="failed")P=!1,f=t("saveFail")+" \xB7 "+(q.hostGuard?t("saveHostGuard"):t("saveFailHint"));else if(ae==="applied-direct")f=t("savedOk")+" \xB7 "+t("savedDirect");else{let X=Array.isArray(q.pending)&&q.pending.length?" \xB7 "+t("savePending"):q.note?" \xB7 "+t("restartHint"):"";f=(q.retried?"\u267B ":"")+t("savedOk")+X}H.current={...H.current,...B},P?b(f):de(f),ue(f,P),await be()}else{let ae=G.status===409?t("conflictRefresh"):q?.error||t("saveFail");de(ae),ue(ae,!1)}}catch{de(t("saveFail")),ue(t("saveFail"),!1)}finally{F("")}},nt=()=>{H.current={},h({...c?.config??{}}),b("")},tt={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},Me=l=>Array.isArray(l?.vaultProfiles)?l.vaultProfiles:[],Ie=(l,L,B)=>h(G=>{let me=Me(G).map(ae=>({...ae||{}})),q={...me[l]||{}};return L==="match"?String(B).trim()?q.match={...q.match||{},workspace:B}:delete q.match:q[L]=B,me[l]=q,{...G??{},vaultProfiles:me}}),se=()=>h(l=>({...l??{},vaultProfiles:[...Me(l),{name:"",path:""}]})),Ve=l=>h(L=>({...L??{},vaultProfiles:Me(L).filter((B,G)=>G!==l)})),we={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},d={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},s={A:{label:t("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:2e3,recallMinScore:2,recallLimit:5,recallSummaryLen:130,recallIncludeBody:!1,captureCooldownMs:3e5},B:{label:t("planB"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!1,dedupByLLM:!1,captureMaxTokens:500,recallMinScore:3,recallLimit:3,recallSummaryLen:80,recallIncludeBody:!1,captureMinChars:300,maxCardsPerDay:40,captureCooldownMs:3e5},C:{label:t("planC"),autoWebMode:"interval",watchdogAutoSpawn:!0,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:1200,recallMinScore:1,recallLimit:8,recallSummaryLen:200,recallIncludeBody:!0,captureCooldownMs:12e4}},E=async l=>{let L=s[l];L&&h(B=>({...B??{},...L}))},ne=async(l,L)=>{F(l+L);try{let G=await(await fetch(`${K}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:l,action:L})})).json();G&&G.ok?ue(Ce(L==="install"?"mcpInstalled":"mcpUninstalled",{agent:l})):ue(Ce("mcpActionFail",{agent:l,error:G?.error||""}),!1);try{let me=await fetch(`${K}/setup-status`).then(q=>q.json());me&&me.ok&&Te(me)}catch{}}catch{ue(t("mergeFail"),!1)}finally{F("")}},O=({k:l,label:L,type:B="text",step:G,min:me,max:q})=>(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:L||l}),(0,e.jsx)("input",{type:B,step:G,min:me,max:q,value:k?k[l]??"":"",onChange:ae=>{let f=ae.target.value;xe(l,B==="number"?f===""?"":Number(f):f)},style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12}})]}),ce=new Set(["autoRestartOnDrift"]),a=({k:l,label:L})=>{let B=k?k[l]:void 0,G=B===void 0?ce.has(l):!!B;return(0,e.jsxs)("label",{style:{display:"flex",alignItems:"flex-start",gap:6,fontSize:12,minWidth:0,lineHeight:1.5},children:[(0,e.jsx)("input",{type:"checkbox",checked:G,onChange:me=>xe(l,me.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,e.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:L||l})]})};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:g?"0 0 auto":1,minHeight:0,maxHeight:g?"52vh":void 0},children:[(0,e.jsx)("style",{children:Ae}),te&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(te.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:te.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:te.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:te.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[W&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",W]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:be,children:["\u21BB ",t("retry")]})]}),T&&(0,e.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 ",t("pendingSyncNote")]}),u&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #f59e0b",background:"rgba(245,158,11,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#b45309"},children:["\u2139\uFE0F ",t("configNeedsDsh")," \u2014\u2014 ",t("editInSetting")]}),y&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #10b981",background:"rgba(16,185,129,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#059669"},children:["\u2713 ",y]}),c&&(c.version||c.dsh?.vaultDir)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",t("pluginInfo")]}),(0,e.jsx)("span",{style:{fontSize:12,opacity:.7},children:t("dshHostLabel")}),c.version&&(0,e.jsxs)("code",{style:we,children:[t("vcLoaded")," v",c.version]}),w&&w.resident&&w.resident.served&&w.resident.served!==c.version&&(0,e.jsxs)("code",{style:we,children:[t("vcResident")," v",w.resident.served]}),bt&&(0,e.jsxs)("code",{style:we,children:[t("vcPage")," v",bt]}),w&&w.onDisk&&(0,e.jsxs)("code",{style:we,children:[t("vcOnDisk")," v",w.onDisk]}),w&&w.latest&&(0,e.jsxs)("code",{style:we,children:[t("vcLatest")," v",w.latest]}),c.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",c.dsh.vaultDir]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:oe==="version",onClick:()=>$(!0),children:oe==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),w&&w.stale&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px"},children:[(0,e.jsxs)("div",{children:["\u26A0\uFE0F ",Ce("vcStale",{disk:w.onDisk,loaded:w.loaded})]}),Oe?(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!oe,onClick:Be,children:oe==="restart"?"\u23F3 "+t("vcRestarting"):"\u{1F504} "+t("vcRestart")}),w.restartCommand&&(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:w.restartCommand})]}):(0,e.jsxs)("div",{style:{marginTop:6,lineHeight:1.7},children:["\u2139\uFE0F ",t("vcHostStale"),w.restartCommand&&(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:w.restartCommand})]})]})]}),bt&&w&&w.onDisk&&bt!==w.onDisk&&(0,e.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:t("vcPageStale",{page:bt,disk:w.onDisk})}),w&&w.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:w.updateCommand})]}),w&&w.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",w.checkError]})]}),U&&U.agents&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F50C} ",t("mcpSetupStatus")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("mcpManageHint")})]}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:U.agents.map(l=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1},children:[(0,e.jsx)("b",{children:l.isDsh?t("dshHostLabel"):l.name}),l.isDsh&&l.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",l.version]}),!l.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),l.installed&&l.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),l.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),l.mcpConfigured===!0&&l.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),l.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",l.recallTool?t("enabled"):t("disabled"),")"]})]}),l.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",l.hook]}),!l.isDsh&&l.installed&&l.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!oe,onClick:()=>ne(l.name,"install"),children:t("installMcp")}),!l.isDsh&&l.installed&&l.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!oe,onClick:()=>{window.confirm(t("uninstallConfirm"))&&ne(l.name,"uninstall")},children:t("uninstallMcp")})]},l.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),_&&(0,e.jsx)("div",{style:{fontSize:11,marginTop:6},children:(0,e.jsx)("code",{style:{padding:"2px 6px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:4},children:_})})]}),k?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("presetConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("presetHint")})]}),(0,e.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(l=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>E(l),disabled:!!oe,children:[l==="A"?"\u{1F7E2} ":l==="B"?"\u{1F4B0} ":"\u2B50 ",s[l].label]},l))})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9E0} ",t("dshMemoryConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,e.jsx)(a,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(a,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(O,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(O,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(O,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(O,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(O,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(a,{k:"recallIncludeBody",label:t("recallBody")}),(0,e.jsx)(O,{k:"secretHint",label:t("secretHint")}),(0,e.jsx)(O,{k:"recallEmbedding",label:t("recallEmbedding")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #06b6d4"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5C2}\uFE0F ",t("vaultMulti")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("vaultMultiHint")})]}),(0,e.jsxs)("div",{style:{fontSize:11.5,opacity:.85,marginBottom:8,lineHeight:1.7},children:[t("vaultNow"),"\uFF1A",(0,e.jsx)("code",{children:ee?.vaultDir||"\u2014"}),ee?.vaultName?`\uFF08${ee.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(tt[ee?.vaultSource]||"vaultSrcDefault"),ee?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:ee.workspace})]}):null]}),Me(k).map((l,L)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:l.name||"",placeholder:t("vaultNamePh"),onChange:B=>Ie(L,"name",B.target.value),style:d,disabled:u}),(0,e.jsx)("input",{value:l.path||"",placeholder:t("vaultPathPh"),onChange:B=>Ie(L,"path",B.target.value),style:d,disabled:u}),(0,e.jsx)("input",{value:l.match&&l.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:B=>Ie(L,"match",B.target.value),style:d,disabled:u}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Ve(L),disabled:u,title:t("delete"),children:"\u2715"})]},L)),(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:se,disabled:u,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:k.activeVault||"",onChange:l=>xe("activeVault",l.target.value),disabled:u,style:d,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),Me(k).filter(l=>l&&l.name).map(l=>(0,e.jsx)("option",{value:l.name,children:l.name},l.name))]})]})]})]}),(0,e.jsx)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,e.jsx)(a,{k:"enabled",label:t("enabledLabel")}),(0,e.jsx)(O,{k:"vaultDir",label:t("vaultDirLabel")})]})}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #f59e0b"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4B0} ",t("costControl")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("costHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8,marginTop:6},children:[(0,e.jsx)(a,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(a,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(O,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(O,{k:"recallMinScore",label:t("recallMinScore"),type:"number"}),(0,e.jsx)(O,{k:"captureCooldownMs",label:t("captureCooldownMs"),type:"number"}),(0,e.jsx)(O,{k:"captureProvider",label:t("captureProvider")}),(0,e.jsx)(O,{k:"captureModel",label:t("captureModel")}),(0,e.jsx)(O,{k:"sessionBudgetChars",label:t("sessionBudgetChars"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("auditConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("auditHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t("auditMode")}),(0,e.jsxs)("select",{value:k.auditMode??"all",onChange:l=>xe("auditMode",l.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"all",children:t("auditAll")}),(0,e.jsx)("option",{value:"none",children:t("auditNone")})]})]}),(0,e.jsx)(Yt,{label:t("auditExemptAgents"),value:k.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(U?.agents||[]).filter(l=>!l.isDsh).map(l=>({value:l.name,label:l.name}))],onChange:l=>xe("auditExemptAgents",l)}),(0,e.jsx)(Yt,{label:t("auditExemptKinds"),value:k.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...Lt.filter(l=>l!=="all").map(l=>({value:l,label:t(Ue[l])}))],onChange:l=>xe("auditExemptKinds",l)}),(0,e.jsx)(O,{k:"recycleRetentionDays",label:t("recycleDays"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E0} ",t("serviceConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,e.jsx)(a,{k:"autoWeb",label:t("autoWeb")}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("autoWebMode")}),(0,e.jsxs)("select",{value:k.autoWebMode??"init",onChange:l=>xe("autoWebMode",l.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"init",children:t("modeInit")}),(0,e.jsx)("option",{value:"interval",children:t("modeInterval")}),(0,e.jsx)("option",{value:"manual",children:t("modeManual")})]})]}),(0,e.jsx)(O,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(O,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(O,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(a,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(a,{k:"autoRestartOnDrift",label:t("autoRestartOnDrift")}),(0,e.jsx)(a,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[oe==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),y&&oe!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",y]}),W&&oe!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",W]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:nt,disabled:!!oe,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:u?()=>ue(t("readonlyTitle")+"\uFF1A"+t("readonlyBody"),!1):qe,disabled:oe==="save",title:t(u?"readonlyBody":"saveConfig"),children:oe==="save"?"\u23F3 "+t("saving"):u?"\u{1F512} "+t("readonlyBtn"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function Ta({t,onReload:o,version:r}){let[g,c]=(0,n.useState)([]),[i,x]=(0,n.useState)([]),[N,v]=(0,n.useState)("all"),[A,k]=(0,n.useState)("all"),[h,u]=(0,n.useState)(""),[D,T]=(0,n.useState)(new Set),[S,I]=(0,n.useState)(""),[M,H]=(0,n.useState)(null),[ee,ye]=(0,n.useState)("pending"),U=(b,w=!0)=>{H({msg:b,ok:w}),setTimeout(()=>H(null),3e3)},Te=[...new Set([...g,...i].map(b=>b.submittedBy).filter(Boolean))],W=(0,n.useCallback)(async()=>{try{let b=await fetch(`${K}/audit/list`).then(w=>w.json());b.ok&&(c(b.pending||[]),x(b.rejected||[]),T(new Set))}catch{}},[]);(0,n.useEffect)(()=>{W()},[r,W]);let de=(ee==="pending"?g:i).filter(b=>{if(N!=="all"&&b.kind!==N||A!=="all"&&ut(b.submittedBy)!==A)return!1;if(h){let w=(b.created||"").slice(0,10);if(w&&w!==h)return!1}return!0}),oe=b=>T(w=>{let V=new Set(w);return V.has(b)?V.delete(b):V.add(b),V}),F=async(b,w)=>{let V=w||[...D];if(!V.length){U(t("noSelection"),!1);return}I("apply");let $=t(b==="approved"?"toastApproved":b==="rejected"?"toastRejected":"toastCardDeleted");try{let _=0;for(let ie of V){let te=b==="approved"?"audit/approve":b==="rejected"?"audit/reject":"delete";try{(await fetch(K+"/"+te+"?path="+encodeURIComponent(ie)+(b==="delete"?"&permanent=0":""))).ok||_++}catch{_++}}await W(),o&&o(),_?U(t("toastFailed")+"\uFF08"+_+"/"+V.length+"\uFF09",!1):U($+" "+V.length+" \u5F20")}catch(_){U(t("toastFailed")+": "+String(_&&_.message||_),!1)}finally{I("")}},y=[...D];return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ea,{toast:M}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("tabAudit")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("select",{value:N,onChange:b=>v(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("all")}),Lt.filter(b=>b!=="all").map(b=>(0,e.jsx)("option",{value:b,children:t(Ue[b])},b))]}),(0,e.jsxs)("select",{value:A,onChange:b=>k(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allAgents")}),Zt(Te).map(b=>(0,e.jsx)("option",{value:b,children:b},b))]}),(0,e.jsx)("input",{type:"date",value:h,onChange:b=>u(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"}})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("button",{type:"button",className:`mc-btn${ee==="pending"?" me-on":""}`,onClick:()=>ye("pending"),children:[t("pending"),"\uFF08",g.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${ee==="rejected"?" me-on":""}`,onClick:()=>ye("rejected"),children:[t("rejected"),"\uFF08",i.length,"\uFF09"]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("label",{style:{fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:de.length>0&&y.length===de.length,onChange:b=>{b.target.checked?T(new Set(de.map(w=>w.path))):T(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!y.length||!!S,onClick:()=>F("approved"),children:["\u2713 ",t(ee==="rejected"?"restore":"approve")]}),ee==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!y.length||!!S,onClick:()=>F("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!y.length||!!S,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&F("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),de.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:de.map(b=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:D.has(b.path),onChange:()=>oe(b.path)}),(0,e.jsx)("span",{className:"mc-kind",style:{background:Qe[b.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:ut(b.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:b.created?b.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:b.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:b.severity==="high"?"#f87171":"#9ca3af"},children:b.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.reason||"-"}),ee==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>F("approved",[b.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>F("rejected",[b.path]),children:"\u2715"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},title:t("restore"),onClick:()=>F("approved",[b.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},title:t("restoreDelete"),onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&F("delete",[b.path])},children:"\u{1F5D1}"})]})]},b.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function Ia({t,onReload:o,version:r}){let[g,c]=(0,n.useState)([]),[i,x]=(0,n.useState)(""),[N,v]=(0,n.useState)(null),A=(u,D=!0)=>{v({msg:u,ok:D}),setTimeout(()=>v(null),3200)},k=(0,n.useCallback)(async()=>{try{let u=await fetch(`${K}/recycle/list`).then(D=>D.json());u.ok&&c(u.items||[])}catch{}},[]);(0,n.useEffect)(()=>{k()},[r,k]);let h=async(u,D)=>{let T=(g.find(S=>S.path===D)||{}).title||D;x(u+D);try{let I=await fetch(K+(u==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(D)),M=await I.json().catch(()=>null);await k(),o&&o(),I.ok&&(!M||M.ok!==!1)?A(t(u==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+T):A(t("toastFailed")+"\uFF1A"+(M&&M.error||"HTTP "+I.status),!1)}catch(S){A(t("toastFailed")+"\uFF1A"+String(S&&S.message||S),!1)}finally{x("")}};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ea,{toast:N}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",t("tabRecycle")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("recycleHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!i||g.length===0,title:g.length?"":t("emptyRecycle"),onClick:async()=>{x("purgeAll");try{let u=await fetch(K+"/recycle/purge-expired?days=0"),D=await u.json().catch(()=>null);await k(),A(u.ok?t("toastPurgedExpired")+(D&&D.purged!=null?"\uFF08"+D.purged+"\uFF09":""):t("toastFailed"),u.ok)}catch(u){A(t("toastFailed")+"\uFF1A"+String(u&&u.message||u),!1)}finally{x("")}},children:t("emptyRecycle")})]}),g.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:g.map(u=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Qe[u.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(u.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!i,onClick:()=>h("restore",u.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!i,onClick:()=>{window.confirm(t("purgeConfirm"))&&h("purge",u.path)},children:t("purge")})]},u.path))}):(0,e.jsxs)("div",{className:"mc-card",style:{padding:18,fontSize:12.5,opacity:.78,textAlign:"center",lineHeight:1.9},children:["\u{1F5D1}\uFE0F ",t("emptyRecycle"),(0,e.jsx)("br",{}),(0,e.jsx)("span",{style:{fontSize:11.5},children:t("recycleEmptyHint").split("{days}").join("30")})]})]})]})}var La=({card:t,t:o,onOpen:r,query:g,onDelete:c})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>r(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Qe[t.kind]||Qe.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:Ct[t.kind]||"\u{1F4CE}"}),g?Gt(t.title,g):t.title,Oa(t.updated)&&(0,e.jsx)("span",{className:"mc-new",children:o("newBadge")}),t.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",o("statusPending")]}),t.status==="rejected"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",o("statusRejected")]}),(!t.status||t.status==="approved")&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",o("statusApproved")]})]}),(0,e.jsx)("p",{children:g?Gt(t.summary||"",g):t.summary||""}),t.tags.length>0&&(0,e.jsx)("div",{className:"mc-tags",children:t.tags.slice(0,4).map(i=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",i]},i))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[Ct[t.kind]||"\u{1F4CE}"," ",o(Ue[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",ut(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",pt(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:o("delete"),onClick:i=>{i.stopPropagation(),window.confirm(o("deleteConfirm"))&&c&&c(t.path)},children:"\u{1F5D1}"})]})]});function Ra({t,tab:o,onReload:r,version:g}){let[c,i]=(0,n.useState)(null),[x,N]=(0,n.useState)(""),[v,A]=(0,n.useState)(null),[k,h]=(0,n.useState)(null),[u,D]=(0,n.useState)(null),[T,S]=(0,n.useState)([]),[I,M]=(0,n.useState)(""),[H,ee]=(0,n.useState)(!1),ye=(0,n.useCallback)(async()=>{if(!(!v||!v.merge||!v.merge.length)&&window.confirm(t("mergeAllConfirm"))){M("merge");try{let y={},b=ie=>y[ie]===void 0?ie:y[ie]=b(y[ie]),w=(ie,te)=>{y[b(ie)]=b(te)},V=new Set;for(let ie of v.merge)V.add(ie.a.path),V.add(ie.b.path),w(ie.a.path,ie.b.path);let $={};for(let ie of V){let te=b(ie);($[te]=$[te]||[]).push(ie)}let _=0;for(let ie of Object.values($)){if(ie.length<2)continue;(await fetch(`${K}/merge?paths=${encodeURIComponent(ie.join(","))}`).then(ke=>ke.json())).ok&&_++}await U(),r&&r()}catch{}M("")}},[v,U,r,t]);async function U(){try{let y=await Promise.all([fetch(`${K}/stats`),fetch(`${K}/budget`),fetch(`${K}/capture-log`),fetch(`${K}/cards?status=all&limit=30&agent=${yt}`)]),[b,w,V,$]=await Promise.all(y.map(_=>_.json()));b&&b.ok&&i(b),w&&w.ok&&h(w),V&&V.ok&&D(V),$&&$.ok&&S($.cards||[]),N(!b||!b.ok?t("adminLoadFail"):"")}catch{N(t("adminLoadFail"))}}let Te=(0,n.useCallback)(async()=>{M("scan");try{let y=await fetch(`${K}/optimize`).then(b=>b.json());y.ok&&A(y)}catch{N(t("adminLoadFail"))}finally{M("")}},[t]);(0,n.useEffect)(()=>{U()},[g]);let W=async(y,b)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${K}/merge?paths=${encodeURIComponent(y+","+b)}`).then(V=>V.json())).ok&&(await U(),r&&r())}catch{}},de=async y=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${K}/delete?path=${encodeURIComponent(y)}`).then(w=>w.json())).ok&&(await U(),r&&r())}catch{}},oe=["project","knowledge","content","prompt","business","tool","mistake"],F=({title:y,kind:b,updated:w,path:V})=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[b]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(w)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>de(V),children:[t("delete")," \u2715"]})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[x&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",x]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:U,children:["\u21BB ",t("retry")]})]}),o==="stats"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1FAB5} ",t("captureLog")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("captureLogHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>U(),children:["\u21BB ",t("refresh")]})]}),u?u.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(u.entries||[]).length===0?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogEmpty")}):(0,e.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,e.jsx)("tbody",{children:(u.entries||[]).map((y,b)=>{let w=ka[y.action]||["\u2022","inherit"];return(0,e.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:pt(y.time?new Date(y.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:w[1],fontWeight:600},children:[w[0]," ",y.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:y.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:y.preview||"",children:y.preview||""})]},b)})})})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("loading")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:["\u{1F916} ",t("captureAgentCards"),"\uFF08",T.length,"\uFF09"]}),T.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:T.map(y=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Qe[y.kind]||Qe.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.title}),y.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(y.updated)})]},y.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),c&&(0,e.jsxs)(e.Fragment,{children:[c.trend&&c.trend.length>0&&(()=>{let y=c.trend,b=Math.max(...y.map(_=>_.count),1),w=260,V=50,$=w/y.length;return(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["\u{1F4C8} ",t("trendLabel")]}),(0,e.jsx)("svg",{width:w,height:V,style:{display:"block",width:"100%",height:50},children:y.map((_,ie)=>{let te=Math.round(_.count/b*(V-4));return(0,e.jsx)("rect",{x:ie*$+1,y:V-te,width:Math.max($-2,2),height:te,rx:1.5,fill:_.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:_.count>0?.85:.35},_.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:c.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:c.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:c.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:c.tags}),(0,e.jsx)("span",{children:t("tags")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("byKind")}),(0,e.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:oe.map(y=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[y]||"#666"}}),t(Ue[y]),": ",c.byKind?.[y]||0]},y))})]}),k&&(k.budgetChars||k.recallLimit||k.embedding)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,e.jsx)("b",{children:t("budgetLabel")}),"\uFF1A",t("budgetChars")," ",(0,e.jsx)("b",{children:k.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:k.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",k.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",c.todayCards?.length||0,"\uFF09"]}),c.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:c.todayCards.map(y=>(0,e.jsx)(F,{title:y.title,kind:y.kind,updated:y.updated,path:y.path},y.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})]})]}),o==="optimize"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("organizeTitle")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!I,onClick:Te,children:I==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),v&&v.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!I,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){M("oneclick");try{let y=JSON.stringify({cleanupStale:H}),w=await(await fetch(`${K}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:y})).json();w&&w.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${w.plan.merged} ${t("optimizedMerged")}${H?` \xB7 ${w.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await U(),r&&r(),A(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{M("")}}},children:I==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),v&&v.merge?.length>0&&(0,e.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,e.jsx)("input",{type:"checkbox",checked:H,onChange:y=>ee(y.target.checked)}),t("oneClickAlsoStale")]})]}),!v&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),v&&(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",flexDirection:"column",gap:8},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("mergePairs")}),(0,e.jsx)("div",{className:"spacer",style:{flex:1}}),v.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!I,onClick:ye,children:t(I==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),v.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:v.merge.map((y,b)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[y.a.title," \u21C4 ",y.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(y.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>W(y.a.path,y.b.path),children:t("mergeNow")})]},b))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:12},children:t("noOptimize")}),(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("staleCards"),"\uFF08",v.stale?.length||0,"\uFF09"]}),v.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!I,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;M("clean");let y=0;for(let b of v.stale)try{await fetch(`${K}/delete?path=${encodeURIComponent(b.path)}`),y++}catch{}M(""),notify(`${y} ${t("deletedStale")}`),await U(),r&&r()},children:t("cleanStale")})}),v.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:v.stale.map(y=>(0,e.jsx)(F,{title:y.title,kind:"other",updated:y.updated,path:y.path},y.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})})]})]})]})}var It=[{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 Aa({t,newCard:o,setNewCard:r,onCreated:g}){if(!o)return null;let c=It.find(h=>h.key===o.template),i=o.body||(c?t(c.bodyKey):""),x=o.kind||(c?c.kind:"knowledge"),N=o.tags||(c?t(c.tagKey):""),v=o._creating,A=h=>{let u=It.find(D=>D.key===h);r(D=>({...D,template:h,kind:u?u.kind:D.kind,body:u?t(u.bodyKey):D.body,tags:u?t(u.tagKey):D.tags}))},k=async()=>{if(!(!o.title&&!i)){r(h=>({...h,_creating:!0}));try{(await fetch(`${K}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.title||t("untitled"),kind:x,tags:N.split(",").map(u=>u.trim()).filter(Boolean),body:i,source:"manual"})}).then(u=>u.json())).ok?(r(null),g&&g()):r(u=>({...u,_creating:!1}))}catch{r(u=>({...u,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>r(null),children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:h=>h.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:t("newCard")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>r(null),children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[It.map(h=>(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===h.key?" me-on":""}`,onClick:()=>A(h.key),children:t(h.label)},h.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===""?" me-on":""}`,onClick:()=>r(h=>({...h,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:x,onChange:h=>r(u=>({...u,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,e.jsx)("option",{value:h,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:h},h))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:o.title||"",onChange:h=>r(u=>({...u,title:h.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:N,onChange:h=>r(u=>({...u,tags:h.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:i,onChange:h=>r(u=>({...u,body:h.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,e.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:v,onClick:k,children:t(v?"exporting":"createCard")})})]})]})]})}async function Vt(t){let o=String(t||"");if(!o)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(o),!0}catch{}try{let r=document.createElement("textarea");r.value=o,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();let g=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(r),g}catch{return!1}}function Ba({t,onClose:o}){let[r,g]=(0,n.useState)(""),[c,i]=(0,n.useState)(""),[x,N]=(0,n.useState)(""),[v,A]=(0,n.useState)(!0),[k,h]=(0,n.useState)(!1),[u,D]=(0,n.useState)(""),[T,S]=(0,n.useState)(""),I=(0,n.useRef)(null),M=(0,n.useRef)(null),H=()=>{let F=I.current;if(F)try{F.focus(),F.select()}catch{}},ee=F=>{D(F),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>D(""),2400)};(0,n.useEffect)(()=>{let F=!0;return fetch(K+"/diagnostics").then(y=>y.json()).then(y=>{F&&(y&&y.ok?(i(String(y.diagnostics||"")),N(String(y.version||""))):h(!0))}).catch(()=>{F&&h(!0)}).finally(()=>{F&&A(!1)}),()=>{F=!1}},[]),(0,n.useEffect)(()=>{let F=y=>{y.key==="Escape"&&o()};return window.addEventListener("keydown",F),()=>{window.removeEventListener("keydown",F),M.current&&clearTimeout(M.current)}},[o]);let ye=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),U=()=>{let F=r.trim().split(`
|
|
306
|
-
`)[0]||"",y=Ot({title:"[Bug] "+(F.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Wt({description:r,diagnostics:c,version:x})});try{window.open(y,"_blank","noopener")}catch{ee(t("fbCopyFail"))}},Te=async()=>{await Vt(c)?(S(""),ee(t("fbCopiedDiag"))):(S(c),ee(t("fbCopyManual")))},W=async()=>{let F=$t({lang:ye,description:r,diagnostics:c});await Vt(F)?(S(""),ee(t("fbCopiedPrompt"))):(S(F),ee(t("fbCopyManual")))},de={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},oe={margin:0,maxHeight:170,overflow:"auto",fontSize:11.5,lineHeight:1.55,padding:"8px 10px",borderRadius:10,background:"var(--dsw-alias-bg-layer-1, rgba(127,127,127,0.08))",whiteSpace:"pre-wrap"};return(0,e.jsxs)("div",{className:"me-overlay",onClick:o,children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:F=>F.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:["\u{1F41E} ",t("fbTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:o,children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10},children:[(0,e.jsx)("div",{style:{fontSize:12,opacity:.72,lineHeight:1.6},children:t("fbWhy")}),(0,e.jsx)("textarea",{value:r,onChange:F=>g(F.target.value),placeholder:t("fbDesc"),rows:5,style:de}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("fbDiag")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:Te,disabled:!c,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:oe,children:v?t("fbLoading"):k?t("fbDiagFail"):c})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!r.trim()){ee(t("fbNeedDesc"));return}U()},style:{borderColor:"var(--dsw-alias-brand-primary, #3b82f6)",color:"var(--dsw-alias-brand-primary, #3b82f6)",fontWeight:600},children:["\u{1F680} ",t("fbOpenIssue")]}),(0,e.jsx)("span",{style:{opacity:.5,fontSize:12},children:t("fbOr")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:W,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),u&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:u}),T&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12,color:"#b45309"},children:["\u26A0 ",t("fbCopyFail")]}),(0,e.jsx)("span",{style:{fontSize:11.5,opacity:.75},children:t("fbCopyManual")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:H,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:I,readOnly:!0,value:T,rows:7,style:de})]})]})]})]})}function Pa({t,card:o,query:r,onClose:g,onDelete:c,onFeedback:i}){(0,n.useEffect)(()=>{let I=M=>{M.key==="Escape"&&g()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[g]);let{meta:x,body:N}=(0,n.useMemo)(()=>zt(o.text||""),[o.text]),v=I=>{let M=x.find(([H])=>String(H).toLowerCase()===I);return M?M[1]:""},A=Ht(v("tags")),k=v("kind")||"knowledge",h=(v("status")||"approved").toLowerCase(),u=Qe[k]||"#6B7280",D=(N||"").length>460,[T,S]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:g,children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{className:"me-dialog",onClick:I=>I.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:Ct[k]||"\u{1F4CE}"}),o.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[r&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),D&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":T,onClick:()=>S(I=>!I),children:t(T?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&c&&c(o.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:g,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:u,borderColor:u+"59",background:u+"1a"},children:[Ct[k]||"\u{1F4CE}"," ",t(Ue[k]||"kindKnowledge")]}),(0,e.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"," ",t(h==="approved"?"statusApproved":h==="pending"?"statusPending":"statusRejected")]}),A.slice(0,8).map(I=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",I]},I)),!!v("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",pt(v("updated"))]}),!!v("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",v("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:T?{}:{maxHeight:300,overflow:"hidden"},onClick:T?void 0:I=>{I.stopPropagation(),S(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:jt(N)}})}),!T&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:I=>{I.stopPropagation(),S(!0)},children:[t("expand")," \u2304"]})]})]})}function Ea({t,onOpen:o,all:r,onAllChange:g,onMutate:c,active:i,visible:x}){let[N,v]=(0,n.useState)(null),[A,k]=(0,n.useState)(""),h=(0,n.useRef)(!1),u=(0,n.useRef)(0),D=(0,n.useRef)(t);D.current=t;let T=(0,n.useCallback)(async()=>{try{h.current=!1;let H=await(await fetch(`${K}/graph${r?"?all=1":""}`)).json();H.ok?(v(H),k(""),h.current=!0):(v(null),k(H.error||t("error")))}catch(M){k(String(M&&M.message?M.message:M))}},[r,t]);(0,n.useEffect)(()=>{if(!i||h.current)return;let M=!0;return fetch(`${K}/graph${r?"?all=1":""}`).then(H=>H.json()).then(H=>{M&&(H.ok?(v(H),k(""),h.current=!0):(v(null),k(H.error||t("error"))))}).catch(H=>{M&&k(String(H&&H.message?H.message:H))}),()=>{M=!1}},[r,t,i]),(0,n.useEffect)(()=>{x&&N&&u.current++},[x,N]);let S=(0,n.useCallback)(async M=>{try{let ee=await(await fetch(`${K}/delete?path=${encodeURIComponent(M)}`)).json();return ee&&ee.ok?(await T(),c&&c(),!0):!1}catch{return!1}},[T]),I=(0,n.useCallback)(async M=>{if(!M||M.length<2)return!1;try{let H=await fetch(`${K}/merge?paths=${encodeURIComponent(M.join(","))}`).then(ee=>ee.json());return H&&H.ok?(await T(),c&&c(),!0):!1}catch{return!1}},[T,c]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Ae}),A&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",A]}),!N&&!A&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),N&&N.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),N&&N.nodes.length>0&&(0,e.jsx)(Ha,{nodes:N.nodes,edges:N.edges,onOpen:o,onDelete:S,onMerge:I,t,all:r,onAllChange:g,countLabel:`${N.nodes.length} ${t("nodes")} \xB7 ${Fa(N.edges)} ${t("edges")}`,fitTrigger:u.current})]})}function Fa(t){let o=new Set;for(let r of t||[])o.add([r.source,r.target].sort().join("|"));return o.size}var ct={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 Ha({nodes:t,edges:o,onOpen:r,onDelete:g,onMerge:c,t:i,countLabel:x,all:N,onAllChange:v,fitTrigger:A}){let k=(0,n.useRef)(null),h=(0,n.useRef)(null),u=(0,n.useRef)(null),D=(0,n.useRef)(null),T=(0,n.useRef)(null),S=(0,n.useRef)(r);(0,n.useEffect)(()=>{S.current=r},[r]);let I=(0,n.useRef)(g);(0,n.useEffect)(()=>{I.current=g},[g]);let M=(0,n.useRef)(c);(0,n.useEffect)(()=>{M.current=c},[c]);let[H,ee]=(0,n.useState)(""),[ye,U]=(0,n.useState)(null),Te=(0,n.useRef)("");(0,n.useEffect)(()=>{Te.current=H.trim().toLowerCase()},[H]),(0,n.useEffect)(()=>{let d=u.current;if(!d)return;let s=H.trim().toLowerCase();if(!s)return;let E=d.nodes.find(ne=>(ne.name||"").toLowerCase().includes(s));E&&(u.current.selectedId=E.id,U(E.id),d.panX=d.w/2-E.x*d.zoom,d.panY=d.h/2-E.y*d.zoom,d.render&&d.render())},[H]);let[W,de]=(0,n.useState)("all"),[oe,F]=(0,n.useState)(!1),y=(0,n.useRef)("all"),[b,w]=(0,n.useState)(""),V=(0,n.useRef)(""),[$,_]=(0,n.useState)(!1),ie=(0,n.useRef)(!1),[te,ke]=(0,n.useState)(null);(0,n.useEffect)(()=>{y.current=W},[W]),(0,n.useEffect)(()=>{V.current=b},[b]),(0,n.useEffect)(()=>{ie.current=$},[$]);let Ke=(0,n.useMemo)(()=>{let d=new Map;for(let s of t)for(let E of s.tags||[]){let ne=String(E).trim();ne&&d.set(ne,(d.get(ne)||0)+1)}return[...d.entries()].sort((s,E)=>E[1]-s[1]).slice(0,24).map(([s,E])=>({tag:s,n:E}))},[t]),ue=(()=>{let d=H.trim().toLowerCase();return!!d&&!t.some(s=>(s.title||s.name||"").toLowerCase().includes(d)||String(s.kind||"").toLowerCase().includes(d)||String(Ue[s.kind]||"").toLowerCase().includes(d))})();(0,n.useEffect)(()=>{let d=u.current;d&&d.wake&&d.wake()},[H]),(0,n.useEffect)(()=>{let d=u.current;d&&d.render&&d.render()},[W,b,$]);let Be=(0,n.useRef)(null),[Pe,Oe]=(0,n.useState)([]),[Ce,be]=(0,n.useState)(null),[xe,et]=(0,n.useState)(!1),[Je,qe]=(0,n.useState)(null),[nt,tt]=(0,n.useState)(""),Me=(0,n.useRef)(null),Ie=(0,n.useRef)(null),se=(d,s=!0)=>{Me.current&&clearTimeout(Me.current),qe({msg:d,ok:s}),Me.current=setTimeout(()=>qe(null),1900)},Ve=d=>{tt(d),Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>tt(""),1600)};(0,n.useEffect)(()=>()=>{Me.current&&clearTimeout(Me.current),Ie.current&&clearTimeout(Ie.current)},[]);let we=(0,n.useMemo)(()=>t.reduce((d,s)=>(d[s.id]=s,d),{}),[t]);return(0,n.useEffect)(()=>{let d=k.current;if(!d||t.length===0)return;let s=d.getContext("2d");if(!s)return;let E=Math.max(1,window.devicePixelRatio||1),ne=()=>document.documentElement.getAttribute("data-theme")==="dark",O={};o.forEach(p=>{O[p.source]=(O[p.source]||0)+1,O[p.target]=(O[p.target]||0)+1});let ce=Math.max(1,...Object.values(O)),a={nodes:t.map(p=>({id:p.id,name:p.title||"",type:p.kind||"other",r:9+Math.min(10,(O[p.id]||0)/ce*8),x:0,y:0,vx:0,vy:0})),edges:o.map(p=>({sourceNodeId:p.source,targetNodeId:p.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:E,ctx:s,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((p,z)=>(p[z.id]=z,p),{}),a.nodes.forEach((p,z)=>{let C=z/a.nodes.length*Math.PI*2-Math.PI/2;p.x=Math.cos(C)*60,p.y=Math.sin(C)*60});let l=[...new Set(a.nodes.map(p=>p.type))];a.clustered=l.length>1,a.typeCenters={},l.forEach((p,z)=>{let C=z/l.length*Math.PI*2-Math.PI/2;a.typeCenters[p]={x:Math.cos(C)*160,y:Math.sin(C)*160}}),u.current=a;let L=0,B=0,G=()=>{let p=d.clientWidth,z=d.clientHeight;a.w=p,a.h=z,d.width=p*E,d.height=z*E,s.setTransform(E,0,0,E,0,0),(L===0||B===0)&&p>0&&z>0&&a.tickCount>0&&requestAnimationFrame(()=>X()),L=p,B=z};G();let me=new ResizeObserver(G);me.observe(d.parentElement);let q=(p,z)=>p&&p.length>z?p.slice(0,z)+"\u2026":p,ae=(p,z,C,R)=>{if(s.beginPath(),R==="rect")s.rect(p-C,z-C*.75,C*2,C*1.5);else if(R==="diamond")s.moveTo(p,z-C),s.lineTo(p+C,z),s.lineTo(p,z+C),s.lineTo(p-C,z),s.closePath();else if(R==="hexagon"){for(let j=0;j<6;j++){let re=Math.PI/3*j-Math.PI/2,J=p+C*Math.cos(re),Se=z+C*Math.sin(re);j===0?s.moveTo(J,Se):s.lineTo(J,Se)}s.closePath()}else s.arc(p,z,C,0,Math.PI*2)},f=new Map,P=(p,z)=>{let C=p+"|"+Math.round(z),R=f.get(C);if(!R){let j=parseInt(p.slice(1,3),16),re=parseInt(p.slice(3,5),16),J=parseInt(p.slice(5,7),16);R=s.createRadialGradient(-z*.3,-z*.3,0,0,0,z*1.2),R.addColorStop(0,"rgba("+Math.min(255,j+70)+","+Math.min(255,re+70)+","+Math.min(255,J+70)+",0.95)"),R.addColorStop(1,p),f.set(C,R)}return R},X=()=>{if(!a.nodes.length)return;let p=1/0,z=-1/0,C=1/0,R=-1/0;a.nodes.forEach(Fe=>{p=Math.min(p,Fe.x),z=Math.max(z,Fe.x),C=Math.min(C,Fe.y),R=Math.max(R,Fe.y)});let j=20,re=z-p+j*2,J=R-C+j*2,Se=Math.min(a.w/re,a.h/J);a.zoom=Math.max(.35,Math.min(1.8,Se)),a.panX=a.w/2-(p+z)/2*a.zoom,a.panY=a.h/2-(C+R)/2*a.zoom};D.current=X;let he=()=>{s.clearRect(0,0,a.w,a.h),a.searchTerm=Te.current,a.kindFilter=y.current,a.timeMode=ie.current,a.tagFilter=V.current;let p=a.tagFilter,z=a.kindFilter,C=m=>String(m||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");s.save(),s.strokeStyle=ne()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",s.lineWidth=.5;for(let m=0;m<a.w;m+=24)s.beginPath(),s.moveTo(m,0),s.lineTo(m,a.h),s.stroke();for(let m=0;m<a.h;m+=24)s.beginPath(),s.moveTo(0,m),s.lineTo(a.w,m),s.stroke();s.restore(),s.save(),s.translate(a.panX,a.panY),s.scale(a.zoom,a.zoom);let R={};a.nodes.forEach(m=>R[m.id]=m);let j=a.nodes.length>40,re=j?1.5:.55,J=a.selectedId||a.hoverId,Se=_t({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),Fe=(()=>{let m=(a.searchTerm||"").toLowerCase();if(!m)return null;let Z=[];for(let Q of a.nodes){let ve=(a.domainById[Q.id]||{}).kind||"other";if(((Q.name||"").toLowerCase().includes(m)||String(Ue[ve]||"").toLowerCase().includes(m)||String(ve).toLowerCase().includes(m))&&Z.push(Q.id),Z.length>200)break}return Z})(),ot=Kt(a.nodes,{limit:Ut(a.nodes.length),focusId:J,hoverId:a.hoverId,searchHits:Fe,degree:O}),le=new Map,ge=(m,Z)=>{let Q=m+"|"+Z,pe=le.get(Q);return pe===void 0&&(s.font=m,pe=s.measureText(Z).width,le.set(Q,pe)),pe},Le=a.nodes.length<=250,He=new Map;a.edges.forEach(m=>{let Z=R[m.sourceNodeId],Q=R[m.targetNodeId];if(!Z||!Q||!St(Z.x,Z.y,10,Se)&&!St(Q.x,Q.y,10,Se))return;if(z!=="all"){let rt=a.domainById[m.sourceNodeId]&&a.domainById[m.sourceNodeId].kind,Xe=a.domainById[m.targetNodeId]&&a.domainById[m.targetNodeId].kind;if(rt!==z&&Xe!==z)return}if(p){let rt=a.domainById[m.sourceNodeId]&&(a.domainById[m.sourceNodeId].tags||[]).includes(p),Xe=a.domainById[m.targetNodeId]&&(a.domainById[m.targetNodeId].tags||[]).includes(p);if(!rt&&!Xe)return}let pe=Q.x-Z.x,ve=Q.y-Z.y,ze=Math.sqrt(pe*pe+ve*ve)||1,Ze=j?12:18,at=-ve/ze*Ze,vt=pe/ze*Ze,xt=(Z.x+Q.x)/2+at,wt=(Z.y+Q.y)/2+vt,mt=ct.colors[a.domainById[Z.id]&&a.domainById[Z.id].kind||"other"],gt=J&&(m.sourceNodeId===J||m.targetNodeId===J),Nt=J?gt?.6:.08:j?.14:.24,Ge=parseInt(mt.slice(1,3),16),ft=parseInt(mt.slice(3,5),16),Mt=parseInt(mt.slice(5,7),16),_e=gt?1.6+(m.weight||1):.8+(m.weight||1)*.5,it=Ge+","+ft+","+Mt+","+Nt+","+_e,je=He.get(it);je||(je={path:new Path2D,stroke:"rgba("+Ge+","+ft+","+Mt+","+Nt+")",width:_e},He.set(it,je)),je.path.moveTo(Z.x,Z.y),je.path.quadraticCurveTo(xt,wt,Q.x,Q.y)}),He.forEach(m=>{s.strokeStyle=m.stroke,s.lineWidth=m.width,s.stroke(m.path)});let Re=null;J&&(Re=new Set,a.edges.forEach(m=>{m.sourceNodeId===J?Re.add(m.targetNodeId):m.targetNodeId===J&&Re.add(m.sourceNodeId)}));let Ye=[];if(a.nodes.forEach(m=>{if(!St(m.x,m.y,m.r+2,Se))return;let Z=a.domainById[m.id]||{},Q=Z.kind||"other",pe=a.timeMode?ja(Z.updated):ct.colors[Q],ve=ct.shapes[Q],ze=a.selectedId===m.id,Ze=a.hoverId===m.id,at=a.searchTerm||"",vt=!at||(m.name||"").toLowerCase().includes(at)||String(Ue[Q]||"").toLowerCase().includes(at)||String(Q).toLowerCase().includes(at),xt=z==="all"||Q===z,wt=!p||(Z.tags||[]).includes(p),mt=J&&m.id!==J&&!(Re&&Re.has(m.id))||at&&!vt||!xt||!wt;s.save(),s.globalAlpha=mt?.08:1,(ze||Ze)&&Le&&(s.shadowColor=pe,s.shadowBlur=ze?20:14),s.translate(m.x,m.y),ae(0,0,m.r,ve),s.fillStyle=P(pe,m.r),s.fill(),s.restore(),ze?(s.save(),ae(m.x,m.y,m.r+3,ve),s.strokeStyle=pe,s.lineWidth=3,s.shadowColor=pe,s.shadowBlur=12,s.stroke(),s.restore()):Ze?(s.save(),ae(m.x,m.y,m.r+2,ve),s.strokeStyle=pe,s.lineWidth=2,s.stroke(),s.restore()):at&&vt?(s.save(),ae(m.x,m.y,m.r+2,ve),s.strokeStyle="#e11d48",s.lineWidth=2,s.stroke(),s.restore()):a.multi.indexOf(m.id)>=0&&(s.save(),ae(m.x,m.y,m.r+2,ve),s.strokeStyle="#60a5fa",s.lineWidth=2,s.shadowColor="#60a5fa",s.shadowBlur=8,s.stroke(),s.restore());let gt=q(m.name,16);if((ze||Ze||ot.has(m.id)&&a.zoom>re||!j&&a.zoom>.6)&&xt&&wt){let Ge=1/a.zoom,ft="500 "+(12*Ge).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";s.font=ft;let _e=ge(ft,gt)+16*Ge,it=18*Ge,je=m.y+m.r+8*Ge,rt=!0;for(let Xe of Ye)if(m.x-_e/2<Xe.x+Xe.w&&m.x+_e/2>Xe.x&&je<Xe.y+Xe.h&&je+it>Xe.y){rt=!1;break}if(!rt&&!ze&&!Ze)return;Ye.push({x:m.x-_e/2,y:je,w:_e,h:it}),s.fillStyle=ne()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",s.beginPath(),s.roundRect?s.roundRect(m.x-_e/2,je,_e,it,4*Ge):s.rect(m.x-_e/2,je,_e,it),s.fill(),s.strokeStyle=ne()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",s.lineWidth=1*Ge,s.stroke(),s.fillStyle=ne()?ze||Ze?"#eee":"#bbb":ze||Ze?"#111":"#444",s.textAlign="center",s.fillText(gt,m.x,je+13*Ge)}}),s.restore(),a.marquee){let m=a.marquee,Z=Math.min(m.sx,m.ex),Q=Math.min(m.sy,m.ey),pe=Math.abs(m.ex-m.sx),ve=Math.abs(m.ey-m.sy);s.save(),s.setLineDash([4,4]),s.strokeStyle="rgba(96,165,250,0.9)",s.lineWidth=1,s.fillStyle="rgba(96,165,250,0.12)",s.fillRect(Z,Q,pe,ve),s.strokeRect(Z,Q,pe,ve),s.restore()}if(a.hoverId&&Be.current){let m=a.domainById[a.hoverId],Z=a.nodes.find(function(Q){return Q.id===a.hoverId});if(m&&Z){let Q=a.edges.filter(function(ze){return ze.sourceNodeId===m.id||ze.targetNodeId===m.id}).length,pe=Z.x*a.zoom+a.panX,ve=Z.y*a.zoom+a.panY;Be.current.style.display="block",Be.current.style.left=pe+14+"px",Be.current.style.top=ve-6+"px",Be.current.innerHTML="<b>"+C(m.title||m.name||"")+'</b><br/><span style="opacity:.8">'+C(m.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",Q)+"</span>"}}else Be.current&&(Be.current.style.display="none")},Y=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(Ne))};a.wake=Y,a.render=he;let fe=()=>{let p=a.nodes.length;a.tickCount++;let C=.9-Math.min(.4,a.tickCount/1500),R=p>1e3?3e3:p>100?2e3:p>50?1200:800,j=p>100?.002:.005,re=p>1e3?.012:p>100?.005:.01,J=p>1e3?6:p>200?12:24,Se={};a.nodes.forEach(le=>Se[le.id]=le);for(let le=0;le<p;le++){if(a.dragNode===a.nodes[le])continue;let ge=a.nodes[le],Le=0,He=0;for(let m=0;m<p;m++){if(le===m)continue;let Z=ge.x-a.nodes[m].x,Q=ge.y-a.nodes[m].y,pe=Math.sqrt(Z*Z+Q*Q)||1,ve=R/(pe*pe);Le+=Z/pe*ve,He+=Q/pe*ve}if(a.clustered&&a.typeCenters[ge.type]){let m=a.typeCenters[ge.type];Le+=(m.x-ge.x)*.006,He+=(m.y-ge.y)*.006}else Le-=ge.x*re,He-=ge.y*re;let Re=(ge.vx+Le)*C,Ye=(ge.vy+He)*C;Re=Math.max(-J,Math.min(J,Re)),Ye=Math.max(-J,Math.min(J,Ye)),ge.vx=Re,ge.vy=Ye}a.edges.forEach(le=>{let ge=Se[le.sourceNodeId],Le=Se[le.targetNodeId];if(!ge||!Le)return;let He=Le.x-ge.x,Re=Le.y-ge.y,Ye=Math.sqrt(He*He+Re*Re)||1,m=(Ye-100)*j,Z=He/Ye*m,Q=Re/Ye*m;a.dragNode!==ge&&(ge.vx+=Z,ge.vy+=Q),a.dragNode!==Le&&(Le.vx-=Z,Le.vy-=Q)});let Fe=0;a.nodes.forEach(le=>{a.dragNode!==le&&(le.x+=le.vx,le.y+=le.vy,Fe+=le.vx*le.vx+le.vy*le.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,X()),(p?Math.sqrt(Fe/p):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},Ne=()=>{if(a.running){try{fe(),he()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(Ne)}},De=(p,z)=>{let C=d.getBoundingClientRect();return{x:(p-C.left-a.panX)/a.zoom,y:(z-C.top-a.panY)/a.zoom}},We=p=>{let z=a.domainById[p];return!(!z||y.current!=="all"&&z.kind!==y.current||V.current&&!(z.tags||[]).includes(V.current))},Ee=(p,z,C)=>Math.max(z,Math.min(C,p)),$e=p=>{a.mouseX=p.clientX,a.mouseY=p.clientY;let z=De(p.clientX,p.clientY),C=null;for(let R=a.nodes.length-1;R>=0;R--){let j=a.nodes[R];if(!We(j.id))continue;let re=j.x-z.x,J=j.y-z.y;if(re*re+J*J<j.r*j.r+36){C=j.id;break}}C!==a.hoverId&&(a.hoverId=C,Y())},ht=p=>{if(p.button!==0)return;let z=De(p.clientX,p.clientY),C=null;for(let R=a.nodes.length-1;R>=0;R--){let j=a.nodes[R];if(!We(j.id))continue;let re=j.x-z.x,J=j.y-z.y;if(re*re+J*J<j.r*j.r+25){C=j;break}}if(p.shiftKey){if(C){a.shiftClick=C.id;return}a.marquee={sx:p.clientX,sy:p.clientY,ex:p.clientX,ey:p.clientY};return}a.dragStart={x:p.clientX,y:p.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=C||null,C&&(a.dragOffset={dx:C.x-z.x,dy:C.y-z.y})},Rt=p=>{if(a.marquee){a.marquee.ex=p.clientX,a.marquee.ey=p.clientY,Y();return}if(!a.dragStart)return;let z=p.clientX-a.dragStart.x,C=p.clientY-a.dragStart.y;if(Math.abs(z)+Math.abs(C)>3&&(a.dragging=!0),a.dragNode){let R=De(p.clientX,p.clientY);a.dragNode.x=R.x+a.dragOffset.dx,a.dragNode.y=R.y+a.dragOffset.dy,Y()}else a.dragging&&(a.panX=Ee(a.dragStart.px+z,-1e5,1e5),a.panY=Ee(a.dragStart.py+C,-1e5,1e5),Y())},At=p=>{if(a.marquee){let C=a.marquee;a.marquee=null;let R=d.getBoundingClientRect(),j=Math.min(C.sx,C.ex)-R.left,re=Math.max(C.sx,C.ex)-R.left,J=Math.min(C.sy,C.ey)-R.top,Se=Math.max(C.sy,C.ey)-R.top,Fe=a.nodes.filter(ot=>{let le=ot.x*a.zoom+a.panX,ge=ot.y*a.zoom+a.panY;return le>=j&&le<=re&&ge>=J&&ge<=Se}).map(ot=>ot.id);a.multi=Fe,Oe(Fe),Y();return}let z=a.dragStart&&!a.dragging;if(a.shiftClick){let C=a.shiftClick;a.shiftClick=null;let R=Array.isArray(a.multi)?a.multi.slice():[];R.includes(C)||R.push(C),a.multi=R,Oe(R),Y();return}if(z){let C=De(p.clientX,p.clientY),R=null;for(let j=a.nodes.length-1;j>=0;j--){let re=a.nodes[j];if(!We(re.id))continue;let J=re.x-C.x,Se=re.y-C.y;if(J*J+Se*Se<re.r*re.r+20){R=re;break}}R?(a.selectedId=R.id,U(R.id),Y()):(a.selectedId=null,a.hoverId=null,p.shiftKey||(a.multi=[],Oe([])),U(null),Y())}a.dragStart=null,a.dragging=!1,a.dragNode=null},Bt=p=>{p.preventDefault();let z=De(p.clientX,p.clientY),C=null;for(let R=a.nodes.length-1;R>=0;R--){let j=a.nodes[R];if(!We(j.id))continue;let re=j.x-z.x,J=j.y-z.y;if(re*re+J*J<j.r*j.r+25){C=j;break}}if(C){let R=a.domainById[C.id];R&&ke({x:p.clientX,y:p.clientY,id:C.id,path:R.id,title:R.title})}else ke(null)},Pt=p=>{p.preventDefault();let z=d.getBoundingClientRect(),C=(p.clientX-z.left-a.panX)/a.zoom,R=(p.clientY-z.top-a.panY)/a.zoom,j=Math.max(.3,Math.min(3,a.zoom*(p.deltaY<0?1.1:1/1.1)));a.panX=Ee(a.panX+C*(a.zoom-j),-1e5,1e5),a.panY=Ee(a.panY+R*(a.zoom-j),-1e5,1e5),a.zoom=j,Y()};d.addEventListener("mousemove",$e),d.addEventListener("mousedown",ht),window.addEventListener("mousemove",Rt),window.addEventListener("mouseup",At),d.addEventListener("wheel",Pt,{passive:!1}),d.addEventListener("contextmenu",Bt),T.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],Oe([]),X(),Y()};for(let p=0;p<200;p++)fe();X(),Y();let Et=()=>F(!1);return window.addEventListener("mousedown",Et),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),me.disconnect(),d.removeEventListener("mousemove",$e),d.removeEventListener("mousedown",ht),window.removeEventListener("mousemove",Rt),window.removeEventListener("mouseup",At),d.removeEventListener("wheel",Pt),d.removeEventListener("contextmenu",Bt),window.removeEventListener("mousedown",Et)}},[t,o]),(0,n.useEffect)(()=>{A!==void 0&&D.current&&requestAnimationFrame(()=>D.current())},[A]),(0,e.jsxs)("div",{className:"me-graph",ref:h,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",i("nodes")," \xB7 ",o.length," ",i("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:i("search"),value:H,onChange:d=>ee(d.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>F(d=>!d),"aria-expanded":oe,title:i("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",i("filterLabel")," ",W!=="all"||$||b?"\u25CF":"\u25BE"]}),oe&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:d=>d.stopPropagation(),style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:50,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,padding:8,minWidth:240,boxShadow:"0 12px 34px rgba(0,0,0,.35)"},children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,e.jsx)("button",{type:"button",className:`lg${W==="all"&&!$?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{de("all"),_(!1)},children:i("all")}),Object.keys(Qe).map(d=>(0,e.jsxs)("button",{type:"button",className:`lg${W===d?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>de(s=>s===d?"all":d),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[d]||Qe[d]}}),i(Ue[d])]},d)),(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsxs)("button",{type:"button",className:`lg${$?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>_(d=>!d),children:["\u23F1 ",i("timeDim")]}),Ke.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsx)("div",{style:{maxHeight:130,overflow:"auto",display:"flex",flexWrap:"wrap",gap:4},children:Ke.map(d=>(0,e.jsxs)("button",{type:"button",className:`lg${b===d.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>w(s=>s===d.tag?"":d.tag),title:d.tag,children:["#",d.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:d.n})]},d.tag))})]}),(W!=="all"||$||b)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{de("all"),_(!1),w("")},children:[i("clearFilter")," \u2715"]})]})})]}),(0,e.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:i("crossVault"),children:[(0,e.jsx)("input",{type:"checkbox",checked:!!N,onChange:d=>v&&v(d.target.checked)}),i("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${$?" me-on":""}`,onClick:()=>_(d=>!d),children:i("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let d=k.current;if(d)try{d.toBlob(s=>{s&&be({url:URL.createObjectURL(s),blob:s})},"image/png")}catch{}},children:i("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>D.current&&D.current(),children:i("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{U(null),de("all"),T.current&&T.current()},children:i("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:k,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:Be,style:{display:"none",position:"absolute",zIndex:4,pointerEvents:"none",background:"rgba(28,28,32,0.88)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:8,padding:"7px 10px",fontSize:12,maxWidth:220,boxShadow:"0 8px 24px rgba(0,0,0,.2)"}}),ue&&(0,e.jsx)("div",{className:"mc-empty",style:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)"},children:i("noMatch")}),te&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>ke(null)}),te&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:te.x,top:te.y,zIndex:31},onMouseDown:d=>d.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{S.current({path:te.path,title:te.title}),ke(null)},children:i("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{te.id&&(u.current.selectedId=te.id,U(te.id)),ke(null);let d=u.current;d&&d.wake&&d.wake()},children:i("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(te.title||"")}catch{}ke(null),se(i("copied"))},children:i("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let d=u.current,s=d&&Array.isArray(d.multi)?d.multi.slice():[],E=te.id;if(E&&!s.includes(E)&&s.push(E),ke(null),s.length<2){se(i("mergeNeed"),!1);return}if(!window.confirm(i("mergeConfirm")))return;let ne=M.current&&M.current(s);ne&&ne.then?ne.then(O=>O?se(i("merged")):se(i("mergeFail"),!1)).catch(()=>se(i("mergeFail"),!1)):ne&&se(i("merged"))},children:i("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let d=te.path;ke(null),window.confirm(i("deleteConfirm"))&&(async()=>{try{(I.current?await I.current(d):!1)?se(i("deleted")):se(i("deleteFail"),!1)}catch{se(i("deleteFail"),!1)}})()},children:i("delete")})]}),Pe.length>0&&(0,e.jsxs)("div",{style:{position:"absolute",left:10,top:10,zIndex:3,display:"flex",gap:8,alignItems:"center",background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:"6px 10px",fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsxs)("span",{style:{fontWeight:700},children:[Pe.length," ",i("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=Pe.map(ce=>we[ce]).filter(Boolean).map(ce=>ce.title||ce.name).join(`
|
|
307
|
-
`),E=new Blob([s],{type:"text/plain;charset=utf-8"}),ne=URL.createObjectURL(E),O=document.createElement("a");O.href=ne,O.download="memory-selected.txt",document.body.appendChild(O),O.click(),document.body.removeChild(O),setTimeout(()=>URL.revokeObjectURL(ne),1e3),se(Pe.length+i("exportedSel"))},children:i("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(Pe.length<2){se(i("mergeNeed"),!1);return}let
|
|
305
|
+
`);let De=new Blob([Y],{type:Ne}),We=await Wa(De,fe,!1);if(!We.ok){$({ok:!1,msg:t("exportFail")}),ke(!1);return}$({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+We.name})}catch(X){$({ok:!1,msg:t("exportFail")+" \xB7 "+(X.message||"")})}finally{ke(!1)}_.current&&clearTimeout(_.current),_.current=setTimeout(()=>$(null),2600)},me=async f=>{let P=f.target.files&&f.target.files[0];if(f.target.value="",!!P){try{let X=await P.text(),Y=await(await fetch(`${U}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:X})).json();if(Y.ok){await ce();let fe=Y.imported||0,Ne=t("importedVault")+"\uFF1A"+fe;Y.total&&(Ne+=t("importedTotal")+Y.total+t("importedTotalTail")),Y.quarantined&&(Ne+=t("importedQuarantine")+Y.quarantined+t("importedQuarantineTail")),Y.skipped&&(Ne+=t("importedSkipped")+Y.skipped+t("importedSkippedTail")),Y.warning&&(Ne+=" \xB7 "+Y.warning),$({ok:fe>0||!Y.total,msg:Ne})}else $({ok:!1,msg:Y.error||t("importFail")})}catch{$({ok:!1,msg:t("importFail")})}_.current&&clearTimeout(_.current),_.current=setTimeout(()=>$(null),2400)}},q=(0,n.useMemo)(()=>{let f=N.slice();return ee!=="all"&&(f=f.filter(P=>ut(P.submittedBy)===ee)),K!=="all"&&(f=f.filter(P=>(P.status||"approved")===K)),b==="title"?f.sort((P,X)=>String(P.title||"").localeCompare(String(X.title||""))):b==="hot"?f.sort((P,X)=>(X.weight||X.links||0)-(P.weight||P.links||0)):f.sort((P,X)=>new Date(X.updated||0).getTime()-new Date(P.updated||0).getTime()),f},[N,b,ee,K]),ae=(0,n.useMemo)(()=>[...new Set(N.map(f=>ut(f.submittedBy)))],[N]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Ae}),V&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(V.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:V.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:V.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:V.msg})]}),o&&(0,e.jsxs)("div",{className:"me-modal-head",children:[(0,e.jsxs)("div",{className:"me-modal-title",children:[(0,e.jsx)("span",{className:"me-wicon",children:(0,e.jsx)(Qt,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),m&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:m,"aria-label":t(d?"exitFull":"fullscreen"),children:d?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:r,"aria-label":t("close"),children:"\u2715"})]}),h&&h.ok===!1&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,margin:"0 0 8px",padding:"9px 14px",borderRadius:10,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.45)",borderLeft:"4px solid #ef4444",color:"var(--dsw-alias-label-primary, #e5e7eb)",fontSize:12.5,lineHeight:1.6},children:[(0,e.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",t("captureAlert")]}),(0,e.jsxs)("span",{style:{flex:1},children:[h.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:h.since?pt(new Date(h.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${be?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>xe(f=>!f),"aria-label":t(be?"collapse":"expand"),title:t(be?"collapse":"expand"),children:be?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="cards"?" active":""}`,onClick:()=>y("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="graph"?" active":""}`,onClick:()=>y("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="stats"?" active":""}`,onClick:()=>y("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="audit"?" active":""}`,onClick:()=>y("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")}),Me>0&&(0,e.jsx)("span",{className:"mc-dot",children:Me>99?"99+":Me})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="optimize"?" active":""}`,onClick:()=>y("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")}),Ie>0&&(0,e.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:Ie>99?"99+":Ie})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${W==="config"?" active":""}`,onClick:()=>y("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Ce(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),be&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:ne,children:[W==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(dt,{label:t("total"),value:i?i.total:"\u2014"}),(0,e.jsx)(dt,{label:t("recent"),value:i?i.recent:"\u2014"}),(0,e.jsx)(dt,{label:t("tags"),value:i?i.tags:"\u2014"}),(0,e.jsx)(dt,{label:t("pending"),value:i?.quarantine?.pending??i?.status?.pending??0}),(0,e.jsx)(dt,{label:t("rejected"),value:i?.quarantine?.rejected??i?.status?.rejected??0}),(0,e.jsx)(dt,{label:t("cardCount"),value:i?i.byKind?.knowledge??0:"\u2014"})]}),W==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:M,onChange:f=>l(f.target.value)}),(0,e.jsx)("input",{ref:ie,type:"file",accept:".json,application/json",style:{display:"none"},onChange:me}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ie.current&&ie.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>Je({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:te,onClick:()=>G("md"),children:t(te?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:te,onClick:()=>G("json"),children:t(te?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ce(),children:t("refresh")})]}),W==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[Lt.map(f=>(0,e.jsx)("button",{type:"button",className:`mc-chip${w===f?" active":""}`,onClick:()=>L(f),children:t(f==="all"?"all":Ue[f])},f)),(0,e.jsxs)("select",{value:ee,onChange:f=>ye(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsxs)("option",{value:"all",children:["\u{1F916} ",t("allAgents")]}),Zt(ae).map(f=>(0,e.jsx)("option",{value:f,children:f},f))]}),(0,e.jsxs)("select",{value:K,onChange:f=>Te(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allStatus")}),(0,e.jsx)("option",{value:"approved",children:t("statusApproved")}),(0,e.jsx)("option",{value:"pending",children:t("statusPending")}),(0,e.jsx)("option",{value:"rejected",children:t("statusRejected")})]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:t("sortRecent")},{key:"title",label:t("sortTitle")},{key:"hot",label:t("sortHot")}].map(f=>(0,e.jsx)("button",{type:"button",className:`mc-chip${b===f.key?" active":""}`,onClick:()=>k(f.key),children:f.label},f.key))]}),D&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",D]}),(0,e.jsx)("div",{style:{display:W==="cards"?"contents":"none"},children:A?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):D?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",D," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ce(),children:t("retry")})]}):N.length===0?(0,e.jsx)("div",{className:"mc-empty",children:t("empty")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"mc-grid",children:q.map(f=>(0,e.jsx)(La,{card:f,t,query:M.trim(),onOpen:B,onDelete:a},f.path))}),N.length<Ve&&(0,e.jsx)("div",{ref:E,style:{height:1}}),c&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",N.length," / ",Ve,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:W==="graph"?"flex":"none",flex:1,minHeight:0},children:oe.has("graph")&&(0,e.jsx)(Ea,{t,onOpen:B,all:Be,onAllChange:Pe,onMutate:tt,active:W==="graph",visible:W==="graph"})}),(0,e.jsx)("div",{style:{display:W==="config"?"contents":"none"},children:oe.has("config")&&(0,e.jsx)(ta,{t,onReload:()=>ce(),version:qe})}),(0,e.jsx)("div",{style:{display:W==="stats"?"contents":"none"},children:oe.has("stats")&&(0,e.jsx)(Ra,{t,tab:"stats",onReload:()=>ce(),version:qe})}),(0,e.jsx)("div",{style:{display:W==="audit"?"contents":"none"},children:oe.has("audit")&&(0,e.jsx)(Ta,{t,onReload:()=>ce(),version:qe})}),(0,e.jsx)("div",{style:{display:W==="optimize"?"contents":"none"},children:oe.has("optimize")&&(0,e.jsx)(Ia,{t,onReload:()=>ce(),version:qe})}),Oe&&(0,e.jsx)(Ba,{t,onClose:()=>Ce(!1)}),Ke&&(0,e.jsx)(Pa,{t,card:Ke,query:M.trim(),onClose:()=>ue(null),onDelete:f=>{ue(null),a(f)},onFeedback:f=>{let P=Ke.path;fetch(`${U}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:M.trim(),path:P,useful:f})}).then(()=>$({ok:!0,msg:t(f?"fbUseful":"fbIrr")})).catch(()=>{}),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>$(null),2e3)}}),(0,e.jsx)(Aa,{t,newCard:et,setNewCard:Je,onCreated:()=>{ce(),tt(),$({ok:!0,msg:t("created")}),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>$(null),2e3)}})]})]})]})}var ea=({toast:t})=>t?(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"8px 12px",fontSize:12,borderLeft:"4px solid "+(t.ok?"#10b981":"#ef4444"),background:t.ok?"rgba(16,185,129,0.08)":"rgba(239,68,68,0.08)"},children:[t.ok?"\u2705":"\u26A0"," ",t.msg]}):null,dt=({label:t,value:o})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:o}),(0,e.jsx)("span",{children:t})]});function ta({t,onReload:o,version:r,compact:m}){let[d,i]=(0,n.useState)(null),[x,N]=(0,n.useState)(0),[v,A]=(0,n.useState)(null),[S,h]=(0,n.useState)(null),[u,D]=(0,n.useState)(!1),[I,w]=(0,n.useState)(!1),T=(0,n.useRef)(!1),M=(0,n.useRef)(null),H=(0,n.useRef)({}),[ee,ye]=(0,n.useState)(null),[K,Te]=(0,n.useState)(null),[W,de]=(0,n.useState)(""),[oe,F]=(0,n.useState)(""),[y,b]=(0,n.useState)(""),[k,V]=(0,n.useState)(null),$=(0,n.useCallback)(async l=>{F("version");try{let L=await fetch(U+"/version-check"+(l?"?force=1":"")).then(B=>B.json());L&&L.ok?(V(L),l&&ue(L.updateAvailable?t("vcLatest")+" v"+L.latest:t("vcUpToDate"))):l&&ue(t("vcCheckFail"),!1)}catch{l&&ue(t("vcCheckFail"),!1)}finally{F("")}},[t]);(0,n.useEffect)(()=>{$(!1)},[r,$]);let[_,ie]=(0,n.useState)(""),[te,ke]=(0,n.useState)(null),Ke=(0,n.useRef)(null),ue=(l,L=!0)=>{Ke.current&&clearTimeout(Ke.current),ke({msg:l,ok:L}),Ke.current=setTimeout(()=>ke(null),1900)},Be=async()=>{if(!oe){F("restart");try{let l=await fetch(U+"/restart-self",{method:"POST"});if(l.status===404||l.status===405){ue(Ce("vcRestartNoRoute",{cmd:k&&k.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let L=await l.json().catch(()=>null);if(!L){ue(t("vcRestartFail")+"\uFF08HTTP "+l.status+"\uFF09",!1);return}if(!L.ok){ue(L.error||t("vcRestartFail"),!1);return}if(L.alreadyCurrent){ue(L.note||t("vcRestartCurrent"));return}ue(L.note||t("vcRestartSent")),L.alreadyRunning||setTimeout(()=>{$(!0)},6e3)}catch(l){ue(t("vcRestartFail")+"\uFF1A"+String(l&&l.message||l),!1)}finally{F("")}}},Pe=k&&k.resident?String(k.resident.served||""):"",Oe=!!(k&&k.onDisk&&Pe&&Pe!==k.onDisk),Ce=(l,L)=>Object.keys(L).reduce((B,G)=>B.split("{"+G+"}").join(L[G]),t(l)),be=(0,n.useCallback)(async()=>{try{let[l,L,B]=await Promise.all([fetch(`${U}/config`).then(G=>G.json()).catch(()=>null),fetch(`${U}/setup-status`).then(G=>G.json()).catch(()=>null),fetch(`${U}/budget`).then(G=>G.json()).catch(()=>null)]);if(l&&l.ok){i(l),N(l.revision??0),A(l.schema??null);let G=qt(l.config??{},H.current);H.current=G.overlay,h({...G.values}),ye(l.dsh??null),D(l.writable===!1),w(l.viaPending===!0),de(""),T.current=!1}else B&&B.ok?(h({...B}),D(!0),de(t("configNeedsDsh"))):de(t("adminLoadFail"));L&&L.ok&&Te(L),b("")}catch{de(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{be()},[r,be]);let xe=(l,L)=>{T.current=!0,h(B=>({...B??{},[l]:L}))};(0,n.useEffect)(()=>{M.current=be},[be]),(0,n.useEffect)(()=>{if(typeof EventSource>"u")return;let l=null;try{l=new EventSource(U+"/events")}catch{return}let L=()=>{!T.current&&typeof M.current=="function"&&M.current()};try{l.addEventListener("config",L)}catch{}return()=>{try{l.close()}catch{}}},[]);let et=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),Je=l=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[l]||l,qe=async()=>{if(!S)return;if(u){ue(t("editInSetting"),!1);return}let l={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]},L=[];for(let[B,[G,me]]of Object.entries(l)){if(!(B in S))continue;let q=S[B],ae=typeof q=="number"?q:Number(q);(q===""||q===null||q===void 0||!Number.isFinite(ae)||ae<G||ae>me)&&L.push(t("invalidField",{field:B,min:G,max:me,value:String(q===""?"\u7A7A":q)}))}if(L.length){let B=t("saveInvalid")+"\uFF1A"+L.join("\uFF1B");de(B),ue(B,!1);return}F("save");try{let B={...S};for(let ae of Object.keys(S))ae in B&&typeof B[ae]=="string"&&B[ae].trim()!==""&&et.has(ae)&&(B[ae]=Number(B[ae]));Array.isArray(B.vaultProfiles)&&(B.vaultProfiles=B.vaultProfiles.filter(ae=>ae&&(String(ae.name||"").trim()||String(ae.path||"").trim())));let G=await fetch(`${U}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:B,expectedRevision:x})}),me=await G.text(),q=null;try{q=me?JSON.parse(me):null}catch{q=null}if(q||(q={error:"HTTP "+G.status+(me?"\uFF1A"+me.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")}),q&&q.ok){let ae=typeof q.pendingOutcome=="string"?q.pendingOutcome:"",f,P=!0;if(ae==="applied")f=t("savedApplied")+(Array.isArray(q.applied)&&q.applied.length?" \xB7 "+q.applied.join("\u3001"):"");else if(ae==="queued")P=!1,f=t("saveQueued");else if(ae==="failed")P=!1,f=t("saveFail")+" \xB7 "+(q.hostGuard?t("saveHostGuard"):t("saveFailHint"));else if(ae==="applied-direct")f=t("savedOk")+" \xB7 "+t("savedDirect");else{let X=Array.isArray(q.pending)&&q.pending.length?" \xB7 "+t("savePending"):q.note?" \xB7 "+t("restartHint"):"";f=(q.retried?"\u267B ":"")+t("savedOk")+X}H.current={...H.current,...B},P?b(f):de(f),ue(f,P),await be()}else{let ae=G.status===409?t("conflictRefresh"):q?.error||t("saveFail");de(ae),ue(ae,!1)}}catch{de(t("saveFail")),ue(t("saveFail"),!1)}finally{F("")}},nt=()=>{H.current={},h({...d?.config??{}}),b("")},tt={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},Me=l=>Array.isArray(l?.vaultProfiles)?l.vaultProfiles:[],Ie=(l,L,B)=>h(G=>{let me=Me(G).map(ae=>({...ae||{}})),q={...me[l]||{}};return L==="match"?String(B).trim()?q.match={...q.match||{},workspace:B}:delete q.match:q[L]=B,me[l]=q,{...G??{},vaultProfiles:me}}),se=()=>h(l=>({...l??{},vaultProfiles:[...Me(l),{name:"",path:""}]})),Ve=l=>h(L=>({...L??{},vaultProfiles:Me(L).filter((B,G)=>G!==l)})),we={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},c={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},s={A:{label:t("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:2e3,recallMinScore:2,recallLimit:5,recallSummaryLen:130,recallIncludeBody:!1,captureCooldownMs:3e5},B:{label:t("planB"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!1,dedupByLLM:!1,captureMaxTokens:500,recallMinScore:3,recallLimit:3,recallSummaryLen:80,recallIncludeBody:!1,captureMinChars:300,maxCardsPerDay:40,captureCooldownMs:3e5},C:{label:t("planC"),autoWebMode:"interval",watchdogAutoSpawn:!0,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:1200,recallMinScore:1,recallLimit:8,recallSummaryLen:200,recallIncludeBody:!0,captureCooldownMs:12e4}},E=async l=>{let L=s[l];L&&h(B=>({...B??{},...L}))},ne=async(l,L)=>{F(l+L);try{let G=await(await fetch(`${U}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:l,action:L})})).json();G&&G.ok?ue(Ce(L==="install"?"mcpInstalled":"mcpUninstalled",{agent:l})):ue(Ce("mcpActionFail",{agent:l,error:G?.error||""}),!1);try{let me=await fetch(`${U}/setup-status`).then(q=>q.json());me&&me.ok&&Te(me)}catch{}}catch{ue(t("mergeFail"),!1)}finally{F("")}},O=({k:l,label:L,type:B="text",step:G,min:me,max:q})=>(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:L||l}),(0,e.jsx)("input",{type:B,step:G,min:me,max:q,value:S?S[l]??"":"",onChange:ae=>{let f=ae.target.value;xe(l,B==="number"?f===""?"":Number(f):f)},style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12}})]}),ce=new Set(["autoRestartOnDrift"]),a=({k:l,label:L})=>{let B=S?S[l]:void 0,G=B===void 0?ce.has(l):!!B;return(0,e.jsxs)("label",{style:{display:"flex",alignItems:"flex-start",gap:6,fontSize:12,minWidth:0,lineHeight:1.5},children:[(0,e.jsx)("input",{type:"checkbox",checked:G,onChange:me=>xe(l,me.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,e.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:L||l})]})};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:m?"0 0 auto":1,minHeight:0,maxHeight:m?"52vh":void 0},children:[(0,e.jsx)("style",{children:Ae}),te&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(te.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:te.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:te.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:te.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[W&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",W]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:be,children:["\u21BB ",t("retry")]})]}),I&&(0,e.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 ",t("pendingSyncNote")]}),u&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #f59e0b",background:"rgba(245,158,11,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#b45309"},children:["\u2139\uFE0F ",t("configNeedsDsh")," \u2014\u2014 ",t("editInSetting")]}),y&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #10b981",background:"rgba(16,185,129,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#059669"},children:["\u2713 ",y]}),d&&(d.version||d.dsh?.vaultDir)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",t("pluginInfo")]}),(0,e.jsx)("span",{style:{fontSize:12,opacity:.7},children:t("dshHostLabel")}),d.version&&(0,e.jsxs)("code",{style:we,children:[t("vcLoaded")," v",d.version]}),k&&k.resident&&k.resident.served&&k.resident.served!==d.version&&(0,e.jsxs)("code",{style:we,children:[t("vcResident")," v",k.resident.served]}),bt&&(0,e.jsxs)("code",{style:we,children:[t("vcPage")," v",bt]}),k&&k.onDisk&&(0,e.jsxs)("code",{style:we,children:[t("vcOnDisk")," v",k.onDisk]}),k&&k.latest&&(0,e.jsxs)("code",{style:we,children:[t("vcLatest")," v",k.latest]}),d.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",d.dsh.vaultDir]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:oe==="version",onClick:()=>$(!0),children:oe==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),k&&k.stale&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px"},children:[(0,e.jsxs)("div",{children:["\u26A0\uFE0F ",Ce("vcStale",{disk:k.onDisk,loaded:k.loaded})]}),Oe?(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!oe,onClick:Be,children:oe==="restart"?"\u23F3 "+t("vcRestarting"):"\u{1F504} "+t("vcRestart")}),k.restartCommand&&(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:k.restartCommand})]}):(0,e.jsxs)("div",{style:{marginTop:6,lineHeight:1.7},children:["\u2139\uFE0F ",t("vcHostStale"),k.restartCommand&&(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:k.restartCommand})]})]})]}),bt&&k&&k.onDisk&&bt!==k.onDisk&&(0,e.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:t("vcPageStale",{page:bt,disk:k.onDisk})}),k&&k.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:k.updateCommand})]}),k&&k.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",k.checkError]})]}),K&&K.agents&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F50C} ",t("mcpSetupStatus")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("mcpManageHint")})]}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:K.agents.map(l=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1},children:[(0,e.jsx)("b",{children:l.isDsh?t("dshHostLabel"):l.name}),l.isDsh&&l.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",l.version]}),!l.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),l.installed&&l.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),l.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),l.mcpConfigured===!0&&l.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),l.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",l.recallTool?t("enabled"):t("disabled"),")"]})]}),l.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",l.hook]}),!l.isDsh&&l.installed&&l.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!oe,onClick:()=>ne(l.name,"install"),children:t("installMcp")}),!l.isDsh&&l.installed&&l.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!oe,onClick:()=>{window.confirm(t("uninstallConfirm"))&&ne(l.name,"uninstall")},children:t("uninstallMcp")})]},l.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),_&&(0,e.jsx)("div",{style:{fontSize:11,marginTop:6},children:(0,e.jsx)("code",{style:{padding:"2px 6px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:4},children:_})})]}),S?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("presetConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("presetHint")})]}),(0,e.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(l=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>E(l),disabled:!!oe,children:[l==="A"?"\u{1F7E2} ":l==="B"?"\u{1F4B0} ":"\u2B50 ",s[l].label]},l))})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9E0} ",t("dshMemoryConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,e.jsx)(a,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(a,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(O,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(O,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(O,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(O,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(O,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(a,{k:"recallIncludeBody",label:t("recallBody")}),(0,e.jsx)(O,{k:"secretHint",label:t("secretHint")}),(0,e.jsx)(O,{k:"recallEmbedding",label:t("recallEmbedding")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #06b6d4"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5C2}\uFE0F ",t("vaultMulti")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("vaultMultiHint")})]}),(0,e.jsxs)("div",{style:{fontSize:11.5,opacity:.85,marginBottom:8,lineHeight:1.7},children:[t("vaultNow"),"\uFF1A",(0,e.jsx)("code",{children:ee?.vaultDir||"\u2014"}),ee?.vaultName?`\uFF08${ee.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(tt[ee?.vaultSource]||"vaultSrcDefault"),ee?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:ee.workspace})]}):null]}),Me(S).map((l,L)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:l.name||"",placeholder:t("vaultNamePh"),onChange:B=>Ie(L,"name",B.target.value),style:c,disabled:u}),(0,e.jsx)("input",{value:l.path||"",placeholder:t("vaultPathPh"),onChange:B=>Ie(L,"path",B.target.value),style:c,disabled:u}),(0,e.jsx)("input",{value:l.match&&l.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:B=>Ie(L,"match",B.target.value),style:c,disabled:u}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Ve(L),disabled:u,title:t("delete"),children:"\u2715"})]},L)),(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:se,disabled:u,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:S.activeVault||"",onChange:l=>xe("activeVault",l.target.value),disabled:u,style:c,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),Me(S).filter(l=>l&&l.name).map(l=>(0,e.jsx)("option",{value:l.name,children:l.name},l.name))]})]})]})]}),(0,e.jsx)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,e.jsx)(a,{k:"enabled",label:t("enabledLabel")}),(0,e.jsx)(O,{k:"vaultDir",label:t("vaultDirLabel")})]})}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #f59e0b"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4B0} ",t("costControl")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("costHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8,marginTop:6},children:[(0,e.jsx)(a,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(a,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(O,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(O,{k:"recallMinScore",label:t("recallMinScore"),type:"number"}),(0,e.jsx)(O,{k:"captureCooldownMs",label:t("captureCooldownMs"),type:"number"}),(0,e.jsx)(O,{k:"captureProvider",label:t("captureProvider")}),(0,e.jsx)(O,{k:"captureModel",label:t("captureModel")}),(0,e.jsx)(O,{k:"sessionBudgetChars",label:t("sessionBudgetChars"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("auditConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("auditHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t("auditMode")}),(0,e.jsxs)("select",{value:S.auditMode??"all",onChange:l=>xe("auditMode",l.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"all",children:t("auditAll")}),(0,e.jsx)("option",{value:"none",children:t("auditNone")})]})]}),(0,e.jsx)(Yt,{label:t("auditExemptAgents"),value:S.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(K?.agents||[]).filter(l=>!l.isDsh).map(l=>({value:l.name,label:l.name}))],onChange:l=>xe("auditExemptAgents",l)}),(0,e.jsx)(Yt,{label:t("auditExemptKinds"),value:S.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...Lt.filter(l=>l!=="all").map(l=>({value:l,label:t(Ue[l])}))],onChange:l=>xe("auditExemptKinds",l)}),(0,e.jsx)(O,{k:"recycleRetentionDays",label:t("recycleDays"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E0} ",t("serviceConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,e.jsx)(a,{k:"autoWeb",label:t("autoWeb")}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("autoWebMode")}),(0,e.jsxs)("select",{value:S.autoWebMode??"init",onChange:l=>xe("autoWebMode",l.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"init",children:t("modeInit")}),(0,e.jsx)("option",{value:"interval",children:t("modeInterval")}),(0,e.jsx)("option",{value:"manual",children:t("modeManual")})]})]}),(0,e.jsx)(O,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(O,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(O,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(a,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(a,{k:"autoRestartOnDrift",label:t("autoRestartOnDrift")}),(0,e.jsx)(a,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[oe==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),y&&oe!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",y]}),W&&oe!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",W]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:nt,disabled:!!oe,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:u?()=>ue(t("readonlyTitle")+"\uFF1A"+t("readonlyBody"),!1):qe,disabled:oe==="save",title:t(u?"readonlyBody":"saveConfig"),children:oe==="save"?"\u23F3 "+t("saving"):u?"\u{1F512} "+t("readonlyBtn"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function Ta({t,onReload:o,version:r}){let[m,d]=(0,n.useState)([]),[i,x]=(0,n.useState)([]),[N,v]=(0,n.useState)("all"),[A,S]=(0,n.useState)("all"),[h,u]=(0,n.useState)(""),[D,I]=(0,n.useState)(new Set),[w,T]=(0,n.useState)(""),[M,H]=(0,n.useState)(null),[ee,ye]=(0,n.useState)("pending"),K=(b,k=!0)=>{H({msg:b,ok:k}),setTimeout(()=>H(null),3e3)},Te=[...new Set([...m,...i].map(b=>b.submittedBy).filter(Boolean))],W=(0,n.useCallback)(async()=>{try{let b=await fetch(`${U}/audit/list`).then(k=>k.json());b.ok&&(d(b.pending||[]),x(b.rejected||[]),I(new Set))}catch{}},[]);(0,n.useEffect)(()=>{W()},[r,W]);let de=(ee==="pending"?m:i).filter(b=>{if(N!=="all"&&b.kind!==N||A!=="all"&&ut(b.submittedBy)!==A)return!1;if(h){let k=(b.created||"").slice(0,10);if(k&&k!==h)return!1}return!0}),oe=b=>I(k=>{let V=new Set(k);return V.has(b)?V.delete(b):V.add(b),V}),F=async(b,k)=>{let V=k||[...D];if(!V.length){K(t("noSelection"),!1);return}T("apply");let $=t(b==="approved"?"toastApproved":b==="rejected"?"toastRejected":"toastCardDeleted");try{let _=0;for(let ie of V){let te=b==="approved"?"audit/approve":b==="rejected"?"audit/reject":"delete";try{(await fetch(U+"/"+te+"?path="+encodeURIComponent(ie)+(b==="delete"?"&permanent=0":""))).ok||_++}catch{_++}}await W(),o&&o(),_?K(t("toastFailed")+"\uFF08"+_+"/"+V.length+"\uFF09",!1):K($+" "+V.length+" \u5F20")}catch(_){K(t("toastFailed")+": "+String(_&&_.message||_),!1)}finally{T("")}},y=[...D];return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ea,{toast:M}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("tabAudit")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("select",{value:N,onChange:b=>v(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("all")}),Lt.filter(b=>b!=="all").map(b=>(0,e.jsx)("option",{value:b,children:t(Ue[b])},b))]}),(0,e.jsxs)("select",{value:A,onChange:b=>S(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allAgents")}),Zt(Te).map(b=>(0,e.jsx)("option",{value:b,children:b},b))]}),(0,e.jsx)("input",{type:"date",value:h,onChange:b=>u(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"}})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("button",{type:"button",className:`mc-btn${ee==="pending"?" me-on":""}`,onClick:()=>ye("pending"),children:[t("pending"),"\uFF08",m.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${ee==="rejected"?" me-on":""}`,onClick:()=>ye("rejected"),children:[t("rejected"),"\uFF08",i.length,"\uFF09"]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("label",{style:{fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:de.length>0&&y.length===de.length,onChange:b=>{b.target.checked?I(new Set(de.map(k=>k.path))):I(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!y.length||!!w,onClick:()=>F("approved"),children:["\u2713 ",t(ee==="rejected"?"restore":"approve")]}),ee==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!y.length||!!w,onClick:()=>F("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!y.length||!!w,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&F("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),de.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:de.map(b=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:D.has(b.path),onChange:()=>oe(b.path)}),(0,e.jsx)("span",{className:"mc-kind",style:{background:Qe[b.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:ut(b.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:b.created?b.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:b.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:b.severity==="high"?"#f87171":"#9ca3af"},children:b.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.reason||"-"}),ee==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>F("approved",[b.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>F("rejected",[b.path]),children:"\u2715"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},title:t("restore"),onClick:()=>F("approved",[b.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},title:t("restoreDelete"),onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&F("delete",[b.path])},children:"\u{1F5D1}"})]})]},b.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function Ia({t,onReload:o,version:r}){let[m,d]=(0,n.useState)([]),[i,x]=(0,n.useState)(""),[N,v]=(0,n.useState)(null),A=(u,D=!0)=>{v({msg:u,ok:D}),setTimeout(()=>v(null),3200)},S=(0,n.useCallback)(async()=>{try{let u=await fetch(`${U}/recycle/list`).then(D=>D.json());u.ok&&d(u.items||[])}catch{}},[]);(0,n.useEffect)(()=>{S()},[r,S]);let h=async(u,D)=>{let I=(m.find(w=>w.path===D)||{}).title||D;x(u+D);try{let T=await fetch(U+(u==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(D)),M=await T.json().catch(()=>null);await S(),o&&o(),T.ok&&(!M||M.ok!==!1)?A(t(u==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+I):A(t("toastFailed")+"\uFF1A"+(M&&M.error||"HTTP "+T.status),!1)}catch(w){A(t("toastFailed")+"\uFF1A"+String(w&&w.message||w),!1)}finally{x("")}};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ea,{toast:N}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",t("tabRecycle")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("recycleHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!i||m.length===0,title:m.length?"":t("emptyRecycle"),onClick:async()=>{x("purgeAll");try{let u=await fetch(U+"/recycle/purge-expired?days=0"),D=await u.json().catch(()=>null);await S(),A(u.ok?t("toastPurgedExpired")+(D&&D.purged!=null?"\uFF08"+D.purged+"\uFF09":""):t("toastFailed"),u.ok)}catch(u){A(t("toastFailed")+"\uFF1A"+String(u&&u.message||u),!1)}finally{x("")}},children:t("emptyRecycle")})]}),m.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:m.map(u=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Qe[u.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(u.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!i,onClick:()=>h("restore",u.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!i,onClick:()=>{window.confirm(t("purgeConfirm"))&&h("purge",u.path)},children:t("purge")})]},u.path))}):(0,e.jsxs)("div",{className:"mc-card",style:{padding:18,fontSize:12.5,opacity:.78,textAlign:"center",lineHeight:1.9},children:["\u{1F5D1}\uFE0F ",t("emptyRecycle"),(0,e.jsx)("br",{}),(0,e.jsx)("span",{style:{fontSize:11.5},children:t("recycleEmptyHint").split("{days}").join("30")})]})]})]})}var La=({card:t,t:o,onOpen:r,query:m,onDelete:d})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>r(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Qe[t.kind]||Qe.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:Ct[t.kind]||"\u{1F4CE}"}),m?Gt(t.title,m):t.title,Oa(t.updated)&&(0,e.jsx)("span",{className:"mc-new",children:o("newBadge")}),t.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",o("statusPending")]}),t.status==="rejected"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",o("statusRejected")]}),(!t.status||t.status==="approved")&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",o("statusApproved")]})]}),(0,e.jsx)("p",{children:m?Gt(t.summary||"",m):t.summary||""}),t.tags.length>0&&(0,e.jsx)("div",{className:"mc-tags",children:t.tags.slice(0,4).map(i=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",i]},i))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[Ct[t.kind]||"\u{1F4CE}"," ",o(Ue[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",ut(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",pt(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:o("delete"),onClick:i=>{i.stopPropagation(),window.confirm(o("deleteConfirm"))&&d&&d(t.path)},children:"\u{1F5D1}"})]})]});function Ra({t,tab:o,onReload:r,version:m}){let[d,i]=(0,n.useState)(null),[x,N]=(0,n.useState)(""),[v,A]=(0,n.useState)(null),[S,h]=(0,n.useState)(null),[u,D]=(0,n.useState)(null),[I,w]=(0,n.useState)([]),[T,M]=(0,n.useState)(""),[H,ee]=(0,n.useState)(!1),ye=(0,n.useCallback)(async()=>{if(!(!v||!v.merge||!v.merge.length)&&window.confirm(t("mergeAllConfirm"))){M("merge");try{let y={},b=ie=>y[ie]===void 0?ie:y[ie]=b(y[ie]),k=(ie,te)=>{y[b(ie)]=b(te)},V=new Set;for(let ie of v.merge)V.add(ie.a.path),V.add(ie.b.path),k(ie.a.path,ie.b.path);let $={};for(let ie of V){let te=b(ie);($[te]=$[te]||[]).push(ie)}let _=0;for(let ie of Object.values($)){if(ie.length<2)continue;(await fetch(`${U}/merge?paths=${encodeURIComponent(ie.join(","))}`).then(ke=>ke.json())).ok&&_++}await K(),r&&r()}catch{}M("")}},[v,K,r,t]);async function K(){try{let y=await Promise.all([fetch(`${U}/stats`),fetch(`${U}/budget`),fetch(`${U}/capture-log`),fetch(`${U}/cards?status=all&limit=30&agent=${yt}`)]),[b,k,V,$]=await Promise.all(y.map(_=>_.json()));b&&b.ok&&i(b),k&&k.ok&&h(k),V&&V.ok&&D(V),$&&$.ok&&w($.cards||[]),N(!b||!b.ok?t("adminLoadFail"):"")}catch{N(t("adminLoadFail"))}}let Te=(0,n.useCallback)(async()=>{M("scan");try{let y=await fetch(`${U}/optimize`).then(b=>b.json());y.ok&&A(y)}catch{N(t("adminLoadFail"))}finally{M("")}},[t]);(0,n.useEffect)(()=>{K()},[m]);let W=async(y,b)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${U}/merge?paths=${encodeURIComponent(y+","+b)}`).then(V=>V.json())).ok&&(await K(),r&&r())}catch{}},de=async y=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${U}/delete?path=${encodeURIComponent(y)}`).then(k=>k.json())).ok&&(await K(),r&&r())}catch{}},oe=["project","knowledge","content","prompt","business","tool","mistake"],F=({title:y,kind:b,updated:k,path:V})=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[b]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(k)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>de(V),children:[t("delete")," \u2715"]})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[x&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",x]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:K,children:["\u21BB ",t("retry")]})]}),o==="stats"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1FAB5} ",t("captureLog")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("captureLogHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>K(),children:["\u21BB ",t("refresh")]})]}),u?u.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(u.entries||[]).length===0?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogEmpty")}):(0,e.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,e.jsx)("tbody",{children:(u.entries||[]).map((y,b)=>{let k=ka[y.action]||["\u2022","inherit"];return(0,e.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:pt(y.time?new Date(y.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:k[1],fontWeight:600},children:[k[0]," ",y.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:y.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:y.preview||"",children:y.preview||""})]},b)})})})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("loading")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:["\u{1F916} ",t("captureAgentCards"),"\uFF08",I.length,"\uFF09"]}),I.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:I.map(y=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Qe[y.kind]||Qe.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.title}),y.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(y.updated)})]},y.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),d&&(0,e.jsxs)(e.Fragment,{children:[d.trend&&d.trend.length>0&&(()=>{let y=d.trend,b=Math.max(...y.map(_=>_.count),1),k=260,V=50,$=k/y.length;return(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["\u{1F4C8} ",t("trendLabel")]}),(0,e.jsx)("svg",{width:k,height:V,style:{display:"block",width:"100%",height:50},children:y.map((_,ie)=>{let te=Math.round(_.count/b*(V-4));return(0,e.jsx)("rect",{x:ie*$+1,y:V-te,width:Math.max($-2,2),height:te,rx:1.5,fill:_.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:_.count>0?.85:.35},_.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.tags}),(0,e.jsx)("span",{children:t("tags")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("byKind")}),(0,e.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:oe.map(y=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[y]||"#666"}}),t(Ue[y]),": ",d.byKind?.[y]||0]},y))})]}),S&&(S.budgetChars||S.recallLimit||S.embedding)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,e.jsx)("b",{children:t("budgetLabel")}),"\uFF1A",t("budgetChars")," ",(0,e.jsx)("b",{children:S.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:S.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",S.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",d.todayCards?.length||0,"\uFF09"]}),d.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:d.todayCards.map(y=>(0,e.jsx)(F,{title:y.title,kind:y.kind,updated:y.updated,path:y.path},y.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})]})]}),o==="optimize"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("organizeTitle")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!T,onClick:Te,children:T==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),v&&v.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!T,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){M("oneclick");try{let y=JSON.stringify({cleanupStale:H}),k=await(await fetch(`${U}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:y})).json();k&&k.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${k.plan.merged} ${t("optimizedMerged")}${H?` \xB7 ${k.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await K(),r&&r(),A(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{M("")}}},children:T==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),v&&v.merge?.length>0&&(0,e.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,e.jsx)("input",{type:"checkbox",checked:H,onChange:y=>ee(y.target.checked)}),t("oneClickAlsoStale")]})]}),!v&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),v&&(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",flexDirection:"column",gap:8},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("mergePairs")}),(0,e.jsx)("div",{className:"spacer",style:{flex:1}}),v.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!T,onClick:ye,children:t(T==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),v.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:v.merge.map((y,b)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[y.a.title," \u21C4 ",y.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(y.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>W(y.a.path,y.b.path),children:t("mergeNow")})]},b))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:12},children:t("noOptimize")}),(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("staleCards"),"\uFF08",v.stale?.length||0,"\uFF09"]}),v.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!T,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;M("clean");let y=0;for(let b of v.stale)try{await fetch(`${U}/delete?path=${encodeURIComponent(b.path)}`),y++}catch{}M(""),notify(`${y} ${t("deletedStale")}`),await K(),r&&r()},children:t("cleanStale")})}),v.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:v.stale.map(y=>(0,e.jsx)(F,{title:y.title,kind:"other",updated:y.updated,path:y.path},y.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})})]})]})]})}var It=[{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 Aa({t,newCard:o,setNewCard:r,onCreated:m}){if(!o)return null;let d=It.find(h=>h.key===o.template),i=o.body||(d?t(d.bodyKey):""),x=o.kind||(d?d.kind:"knowledge"),N=o.tags||(d?t(d.tagKey):""),v=o._creating,A=h=>{let u=It.find(D=>D.key===h);r(D=>({...D,template:h,kind:u?u.kind:D.kind,body:u?t(u.bodyKey):D.body,tags:u?t(u.tagKey):D.tags}))},S=async()=>{if(!(!o.title&&!i)){r(h=>({...h,_creating:!0}));try{(await fetch(`${U}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.title||t("untitled"),kind:x,tags:N.split(",").map(u=>u.trim()).filter(Boolean),body:i,source:"manual"})}).then(u=>u.json())).ok?(r(null),m&&m()):r(u=>({...u,_creating:!1}))}catch{r(u=>({...u,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>r(null),children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:h=>h.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:t("newCard")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>r(null),children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[It.map(h=>(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===h.key?" me-on":""}`,onClick:()=>A(h.key),children:t(h.label)},h.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===""?" me-on":""}`,onClick:()=>r(h=>({...h,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:x,onChange:h=>r(u=>({...u,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,e.jsx)("option",{value:h,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:h},h))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:o.title||"",onChange:h=>r(u=>({...u,title:h.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:N,onChange:h=>r(u=>({...u,tags:h.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:i,onChange:h=>r(u=>({...u,body:h.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,e.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:v,onClick:S,children:t(v?"exporting":"createCard")})})]})]})]})}async function Vt(t){let o=String(t||"");if(!o)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(o),!0}catch{}try{let r=document.createElement("textarea");r.value=o,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();let m=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(r),m}catch{return!1}}function Ba({t,onClose:o}){let[r,m]=(0,n.useState)(""),[d,i]=(0,n.useState)(""),[x,N]=(0,n.useState)(""),[v,A]=(0,n.useState)(!0),[S,h]=(0,n.useState)(!1),[u,D]=(0,n.useState)(""),[I,w]=(0,n.useState)(""),T=(0,n.useRef)(null),M=(0,n.useRef)(null),H=()=>{let F=T.current;if(F)try{F.focus(),F.select()}catch{}},ee=F=>{D(F),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>D(""),2400)};(0,n.useEffect)(()=>{let F=!0;return fetch(U+"/diagnostics").then(y=>y.json()).then(y=>{F&&(y&&y.ok?(i(String(y.diagnostics||"")),N(String(y.version||""))):h(!0))}).catch(()=>{F&&h(!0)}).finally(()=>{F&&A(!1)}),()=>{F=!1}},[]),(0,n.useEffect)(()=>{let F=y=>{y.key==="Escape"&&o()};return window.addEventListener("keydown",F),()=>{window.removeEventListener("keydown",F),M.current&&clearTimeout(M.current)}},[o]);let ye=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),K=()=>{let F=r.trim().split(`
|
|
306
|
+
`)[0]||"",y=Ot({title:"[Bug] "+(F.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Wt({description:r,diagnostics:d,version:x})});try{window.open(y,"_blank","noopener")}catch{ee(t("fbCopyFail"))}},Te=async()=>{await Vt(d)?(w(""),ee(t("fbCopiedDiag"))):(w(d),ee(t("fbCopyManual")))},W=async()=>{let F=$t({lang:ye,description:r,diagnostics:d});await Vt(F)?(w(""),ee(t("fbCopiedPrompt"))):(w(F),ee(t("fbCopyManual")))},de={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},oe={margin:0,maxHeight:170,overflow:"auto",fontSize:11.5,lineHeight:1.55,padding:"8px 10px",borderRadius:10,background:"var(--dsw-alias-bg-layer-1, rgba(127,127,127,0.08))",whiteSpace:"pre-wrap"};return(0,e.jsxs)("div",{className:"me-overlay",onClick:o,children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:F=>F.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:["\u{1F41E} ",t("fbTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:o,children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10},children:[(0,e.jsx)("div",{style:{fontSize:12,opacity:.72,lineHeight:1.6},children:t("fbWhy")}),(0,e.jsx)("textarea",{value:r,onChange:F=>m(F.target.value),placeholder:t("fbDesc"),rows:5,style:de}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("fbDiag")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:Te,disabled:!d,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:oe,children:v?t("fbLoading"):S?t("fbDiagFail"):d})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!r.trim()){ee(t("fbNeedDesc"));return}K()},style:{borderColor:"var(--dsw-alias-brand-primary, #3b82f6)",color:"var(--dsw-alias-brand-primary, #3b82f6)",fontWeight:600},children:["\u{1F680} ",t("fbOpenIssue")]}),(0,e.jsx)("span",{style:{opacity:.5,fontSize:12},children:t("fbOr")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:W,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),u&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:u}),I&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12,color:"#b45309"},children:["\u26A0 ",t("fbCopyFail")]}),(0,e.jsx)("span",{style:{fontSize:11.5,opacity:.75},children:t("fbCopyManual")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:H,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:T,readOnly:!0,value:I,rows:7,style:de})]})]})]})]})}function Pa({t,card:o,query:r,onClose:m,onDelete:d,onFeedback:i}){(0,n.useEffect)(()=>{let T=M=>{M.key==="Escape"&&m()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[m]);let{meta:x,body:N}=(0,n.useMemo)(()=>zt(o.text||""),[o.text]),v=T=>{let M=x.find(([H])=>String(H).toLowerCase()===T);return M?M[1]:""},A=Ht(v("tags")),S=v("kind")||"knowledge",h=(v("status")||"approved").toLowerCase(),u=Qe[S]||"#6B7280",D=(N||"").length>460,[I,w]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:m,children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{className:"me-dialog",onClick:T=>T.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:Ct[S]||"\u{1F4CE}"}),o.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[r&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),D&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":I,onClick:()=>w(T=>!T),children:t(I?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&d&&d(o.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:m,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:u,borderColor:u+"59",background:u+"1a"},children:[Ct[S]||"\u{1F4CE}"," ",t(Ue[S]||"kindKnowledge")]}),(0,e.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"," ",t(h==="approved"?"statusApproved":h==="pending"?"statusPending":"statusRejected")]}),A.slice(0,8).map(T=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",T]},T)),!!v("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",pt(v("updated"))]}),!!v("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",v("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:I?{}:{maxHeight:300,overflow:"hidden"},onClick:I?void 0:T=>{T.stopPropagation(),w(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:jt(N)}})}),!I&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:T=>{T.stopPropagation(),w(!0)},children:[t("expand")," \u2304"]})]})]})}function Ea({t,onOpen:o,all:r,onAllChange:m,onMutate:d,active:i,visible:x}){let[N,v]=(0,n.useState)(null),[A,S]=(0,n.useState)(""),h=(0,n.useRef)(!1),u=(0,n.useRef)(0),D=(0,n.useRef)(t);D.current=t;let I=(0,n.useCallback)(async()=>{try{h.current=!1;let H=await(await fetch(`${U}/graph${r?"?all=1":""}`)).json();H.ok?(v(H),S(""),h.current=!0):(v(null),S(H.error||t("error")))}catch(M){S(String(M&&M.message?M.message:M))}},[r,t]);(0,n.useEffect)(()=>{if(!i||h.current)return;let M=!0;return fetch(`${U}/graph${r?"?all=1":""}`).then(H=>H.json()).then(H=>{M&&(H.ok?(v(H),S(""),h.current=!0):(v(null),S(H.error||t("error"))))}).catch(H=>{M&&S(String(H&&H.message?H.message:H))}),()=>{M=!1}},[r,t,i]),(0,n.useEffect)(()=>{x&&N&&u.current++},[x,N]);let w=(0,n.useCallback)(async M=>{try{let ee=await(await fetch(`${U}/delete?path=${encodeURIComponent(M)}`)).json();return ee&&ee.ok?(await I(),d&&d(),!0):!1}catch{return!1}},[I]),T=(0,n.useCallback)(async M=>{if(!M||M.length<2)return!1;try{let H=await fetch(`${U}/merge?paths=${encodeURIComponent(M.join(","))}`).then(ee=>ee.json());return H&&H.ok?(await I(),d&&d(),!0):!1}catch{return!1}},[I,d]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Ae}),A&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",A]}),!N&&!A&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),N&&N.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),N&&N.nodes.length>0&&(0,e.jsx)(Ha,{nodes:N.nodes,edges:N.edges,onOpen:o,onDelete:w,onMerge:T,t,all:r,onAllChange:m,countLabel:`${N.nodes.length} ${t("nodes")} \xB7 ${Fa(N.edges)} ${t("edges")}`,fitTrigger:u.current})]})}function Fa(t){let o=new Set;for(let r of t||[])o.add([r.source,r.target].sort().join("|"));return o.size}var ct={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 Ha({nodes:t,edges:o,onOpen:r,onDelete:m,onMerge:d,t:i,countLabel:x,all:N,onAllChange:v,fitTrigger:A}){let S=(0,n.useRef)(null),h=(0,n.useRef)(null),u=(0,n.useRef)(null),D=(0,n.useRef)(null),I=(0,n.useRef)(null),w=(0,n.useRef)(r);(0,n.useEffect)(()=>{w.current=r},[r]);let T=(0,n.useRef)(m);(0,n.useEffect)(()=>{T.current=m},[m]);let M=(0,n.useRef)(d);(0,n.useEffect)(()=>{M.current=d},[d]);let[H,ee]=(0,n.useState)(""),[ye,K]=(0,n.useState)(null),Te=(0,n.useRef)("");(0,n.useEffect)(()=>{Te.current=H.trim().toLowerCase()},[H]),(0,n.useEffect)(()=>{let c=u.current;if(!c)return;let s=H.trim().toLowerCase();if(!s)return;let E=c.nodes.find(ne=>(ne.name||"").toLowerCase().includes(s));E&&(u.current.selectedId=E.id,K(E.id),c.panX=c.w/2-E.x*c.zoom,c.panY=c.h/2-E.y*c.zoom,c.render&&c.render())},[H]);let[W,de]=(0,n.useState)("all"),[oe,F]=(0,n.useState)(!1),y=(0,n.useRef)("all"),[b,k]=(0,n.useState)(""),V=(0,n.useRef)(""),[$,_]=(0,n.useState)(!1),ie=(0,n.useRef)(!1),[te,ke]=(0,n.useState)(null);(0,n.useEffect)(()=>{y.current=W},[W]),(0,n.useEffect)(()=>{V.current=b},[b]),(0,n.useEffect)(()=>{ie.current=$},[$]);let Ke=(0,n.useMemo)(()=>{let c=new Map;for(let s of t)for(let E of s.tags||[]){let ne=String(E).trim();ne&&c.set(ne,(c.get(ne)||0)+1)}return[...c.entries()].sort((s,E)=>E[1]-s[1]).slice(0,24).map(([s,E])=>({tag:s,n:E}))},[t]),ue=(()=>{let c=H.trim().toLowerCase();return!!c&&!t.some(s=>(s.title||s.name||"").toLowerCase().includes(c)||String(s.kind||"").toLowerCase().includes(c)||String(Ue[s.kind]||"").toLowerCase().includes(c))})();(0,n.useEffect)(()=>{let c=u.current;c&&c.wake&&c.wake()},[H]),(0,n.useEffect)(()=>{let c=u.current;c&&c.render&&c.render()},[W,b,$]);let Be=(0,n.useRef)(null),[Pe,Oe]=(0,n.useState)([]),[Ce,be]=(0,n.useState)(null),[xe,et]=(0,n.useState)(!1),[Je,qe]=(0,n.useState)(null),[nt,tt]=(0,n.useState)(""),Me=(0,n.useRef)(null),Ie=(0,n.useRef)(null),se=(c,s=!0)=>{Me.current&&clearTimeout(Me.current),qe({msg:c,ok:s}),Me.current=setTimeout(()=>qe(null),1900)},Ve=c=>{tt(c),Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>tt(""),1600)};(0,n.useEffect)(()=>()=>{Me.current&&clearTimeout(Me.current),Ie.current&&clearTimeout(Ie.current)},[]);let we=(0,n.useMemo)(()=>t.reduce((c,s)=>(c[s.id]=s,c),{}),[t]);return(0,n.useEffect)(()=>{let c=S.current;if(!c||t.length===0)return;let s=c.getContext("2d");if(!s)return;let E=Math.max(1,window.devicePixelRatio||1),ne=()=>document.documentElement.getAttribute("data-theme")==="dark",O={};o.forEach(p=>{O[p.source]=(O[p.source]||0)+1,O[p.target]=(O[p.target]||0)+1});let ce=Math.max(1,...Object.values(O)),a={nodes:t.map(p=>({id:p.id,name:p.title||"",type:p.kind||"other",r:9+Math.min(10,(O[p.id]||0)/ce*8),x:0,y:0,vx:0,vy:0})),edges:o.map(p=>({sourceNodeId:p.source,targetNodeId:p.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:E,ctx:s,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((p,z)=>(p[z.id]=z,p),{}),a.nodes.forEach((p,z)=>{let C=z/a.nodes.length*Math.PI*2-Math.PI/2;p.x=Math.cos(C)*60,p.y=Math.sin(C)*60});let l=[...new Set(a.nodes.map(p=>p.type))];a.clustered=l.length>1,a.typeCenters={},l.forEach((p,z)=>{let C=z/l.length*Math.PI*2-Math.PI/2;a.typeCenters[p]={x:Math.cos(C)*160,y:Math.sin(C)*160}}),u.current=a;let L=0,B=0,G=()=>{let p=c.clientWidth,z=c.clientHeight;a.w=p,a.h=z,c.width=p*E,c.height=z*E,s.setTransform(E,0,0,E,0,0),(L===0||B===0)&&p>0&&z>0&&a.tickCount>0&&requestAnimationFrame(()=>X()),L=p,B=z};G();let me=new ResizeObserver(G);me.observe(c.parentElement);let q=(p,z)=>p&&p.length>z?p.slice(0,z)+"\u2026":p,ae=(p,z,C,R)=>{if(s.beginPath(),R==="rect")s.rect(p-C,z-C*.75,C*2,C*1.5);else if(R==="diamond")s.moveTo(p,z-C),s.lineTo(p+C,z),s.lineTo(p,z+C),s.lineTo(p-C,z),s.closePath();else if(R==="hexagon"){for(let j=0;j<6;j++){let re=Math.PI/3*j-Math.PI/2,J=p+C*Math.cos(re),Se=z+C*Math.sin(re);j===0?s.moveTo(J,Se):s.lineTo(J,Se)}s.closePath()}else s.arc(p,z,C,0,Math.PI*2)},f=new Map,P=(p,z)=>{let C=p+"|"+Math.round(z),R=f.get(C);if(!R){let j=parseInt(p.slice(1,3),16),re=parseInt(p.slice(3,5),16),J=parseInt(p.slice(5,7),16);R=s.createRadialGradient(-z*.3,-z*.3,0,0,0,z*1.2),R.addColorStop(0,"rgba("+Math.min(255,j+70)+","+Math.min(255,re+70)+","+Math.min(255,J+70)+",0.95)"),R.addColorStop(1,p),f.set(C,R)}return R},X=()=>{if(!a.nodes.length)return;let p=1/0,z=-1/0,C=1/0,R=-1/0;a.nodes.forEach(Fe=>{p=Math.min(p,Fe.x),z=Math.max(z,Fe.x),C=Math.min(C,Fe.y),R=Math.max(R,Fe.y)});let j=20,re=z-p+j*2,J=R-C+j*2,Se=Math.min(a.w/re,a.h/J);a.zoom=Math.max(.35,Math.min(1.8,Se)),a.panX=a.w/2-(p+z)/2*a.zoom,a.panY=a.h/2-(C+R)/2*a.zoom};D.current=X;let he=()=>{s.clearRect(0,0,a.w,a.h),a.searchTerm=Te.current,a.kindFilter=y.current,a.timeMode=ie.current,a.tagFilter=V.current;let p=a.tagFilter,z=a.kindFilter,C=g=>String(g||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");s.save(),s.strokeStyle=ne()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",s.lineWidth=.5;for(let g=0;g<a.w;g+=24)s.beginPath(),s.moveTo(g,0),s.lineTo(g,a.h),s.stroke();for(let g=0;g<a.h;g+=24)s.beginPath(),s.moveTo(0,g),s.lineTo(a.w,g),s.stroke();s.restore(),s.save(),s.translate(a.panX,a.panY),s.scale(a.zoom,a.zoom);let R={};a.nodes.forEach(g=>R[g.id]=g);let j=a.nodes.length>40,re=j?1.5:.55,J=a.selectedId||a.hoverId,Se=_t({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),Fe=(()=>{let g=(a.searchTerm||"").toLowerCase();if(!g)return null;let Z=[];for(let Q of a.nodes){let ve=(a.domainById[Q.id]||{}).kind||"other";if(((Q.name||"").toLowerCase().includes(g)||String(Ue[ve]||"").toLowerCase().includes(g)||String(ve).toLowerCase().includes(g))&&Z.push(Q.id),Z.length>200)break}return Z})(),ot=Kt(a.nodes,{limit:Ut(a.nodes.length),focusId:J,hoverId:a.hoverId,searchHits:Fe,degree:O}),le=new Map,ge=(g,Z)=>{let Q=g+"|"+Z,pe=le.get(Q);return pe===void 0&&(s.font=g,pe=s.measureText(Z).width,le.set(Q,pe)),pe},Le=a.nodes.length<=250,He=new Map;a.edges.forEach(g=>{let Z=R[g.sourceNodeId],Q=R[g.targetNodeId];if(!Z||!Q||!St(Z.x,Z.y,10,Se)&&!St(Q.x,Q.y,10,Se))return;if(z!=="all"){let rt=a.domainById[g.sourceNodeId]&&a.domainById[g.sourceNodeId].kind,Xe=a.domainById[g.targetNodeId]&&a.domainById[g.targetNodeId].kind;if(rt!==z&&Xe!==z)return}if(p){let rt=a.domainById[g.sourceNodeId]&&(a.domainById[g.sourceNodeId].tags||[]).includes(p),Xe=a.domainById[g.targetNodeId]&&(a.domainById[g.targetNodeId].tags||[]).includes(p);if(!rt&&!Xe)return}let pe=Q.x-Z.x,ve=Q.y-Z.y,ze=Math.sqrt(pe*pe+ve*ve)||1,Ze=j?12:18,at=-ve/ze*Ze,vt=pe/ze*Ze,xt=(Z.x+Q.x)/2+at,wt=(Z.y+Q.y)/2+vt,mt=ct.colors[a.domainById[Z.id]&&a.domainById[Z.id].kind||"other"],gt=J&&(g.sourceNodeId===J||g.targetNodeId===J),Nt=J?gt?.6:.08:j?.14:.24,Ge=parseInt(mt.slice(1,3),16),ft=parseInt(mt.slice(3,5),16),Mt=parseInt(mt.slice(5,7),16),_e=gt?1.6+(g.weight||1):.8+(g.weight||1)*.5,it=Ge+","+ft+","+Mt+","+Nt+","+_e,je=He.get(it);je||(je={path:new Path2D,stroke:"rgba("+Ge+","+ft+","+Mt+","+Nt+")",width:_e},He.set(it,je)),je.path.moveTo(Z.x,Z.y),je.path.quadraticCurveTo(xt,wt,Q.x,Q.y)}),He.forEach(g=>{s.strokeStyle=g.stroke,s.lineWidth=g.width,s.stroke(g.path)});let Re=null;J&&(Re=new Set,a.edges.forEach(g=>{g.sourceNodeId===J?Re.add(g.targetNodeId):g.targetNodeId===J&&Re.add(g.sourceNodeId)}));let Ye=[];if(a.nodes.forEach(g=>{if(!St(g.x,g.y,g.r+2,Se))return;let Z=a.domainById[g.id]||{},Q=Z.kind||"other",pe=a.timeMode?ja(Z.updated):ct.colors[Q],ve=ct.shapes[Q],ze=a.selectedId===g.id,Ze=a.hoverId===g.id,at=a.searchTerm||"",vt=!at||(g.name||"").toLowerCase().includes(at)||String(Ue[Q]||"").toLowerCase().includes(at)||String(Q).toLowerCase().includes(at),xt=z==="all"||Q===z,wt=!p||(Z.tags||[]).includes(p),mt=J&&g.id!==J&&!(Re&&Re.has(g.id))||at&&!vt||!xt||!wt;s.save(),s.globalAlpha=mt?.08:1,(ze||Ze)&&Le&&(s.shadowColor=pe,s.shadowBlur=ze?20:14),s.translate(g.x,g.y),ae(0,0,g.r,ve),s.fillStyle=P(pe,g.r),s.fill(),s.restore(),ze?(s.save(),ae(g.x,g.y,g.r+3,ve),s.strokeStyle=pe,s.lineWidth=3,s.shadowColor=pe,s.shadowBlur=12,s.stroke(),s.restore()):Ze?(s.save(),ae(g.x,g.y,g.r+2,ve),s.strokeStyle=pe,s.lineWidth=2,s.stroke(),s.restore()):at&&vt?(s.save(),ae(g.x,g.y,g.r+2,ve),s.strokeStyle="#e11d48",s.lineWidth=2,s.stroke(),s.restore()):a.multi.indexOf(g.id)>=0&&(s.save(),ae(g.x,g.y,g.r+2,ve),s.strokeStyle="#60a5fa",s.lineWidth=2,s.shadowColor="#60a5fa",s.shadowBlur=8,s.stroke(),s.restore());let gt=q(g.name,16);if((ze||Ze||ot.has(g.id)&&a.zoom>re||!j&&a.zoom>.6)&&xt&&wt){let Ge=1/a.zoom,ft="500 "+(12*Ge).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";s.font=ft;let _e=ge(ft,gt)+16*Ge,it=18*Ge,je=g.y+g.r+8*Ge,rt=!0;for(let Xe of Ye)if(g.x-_e/2<Xe.x+Xe.w&&g.x+_e/2>Xe.x&&je<Xe.y+Xe.h&&je+it>Xe.y){rt=!1;break}if(!rt&&!ze&&!Ze)return;Ye.push({x:g.x-_e/2,y:je,w:_e,h:it}),s.fillStyle=ne()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",s.beginPath(),s.roundRect?s.roundRect(g.x-_e/2,je,_e,it,4*Ge):s.rect(g.x-_e/2,je,_e,it),s.fill(),s.strokeStyle=ne()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",s.lineWidth=1*Ge,s.stroke(),s.fillStyle=ne()?ze||Ze?"#eee":"#bbb":ze||Ze?"#111":"#444",s.textAlign="center",s.fillText(gt,g.x,je+13*Ge)}}),s.restore(),a.marquee){let g=a.marquee,Z=Math.min(g.sx,g.ex),Q=Math.min(g.sy,g.ey),pe=Math.abs(g.ex-g.sx),ve=Math.abs(g.ey-g.sy);s.save(),s.setLineDash([4,4]),s.strokeStyle="rgba(96,165,250,0.9)",s.lineWidth=1,s.fillStyle="rgba(96,165,250,0.12)",s.fillRect(Z,Q,pe,ve),s.strokeRect(Z,Q,pe,ve),s.restore()}if(a.hoverId&&Be.current){let g=a.domainById[a.hoverId],Z=a.nodes.find(function(Q){return Q.id===a.hoverId});if(g&&Z){let Q=a.edges.filter(function(ze){return ze.sourceNodeId===g.id||ze.targetNodeId===g.id}).length,pe=Z.x*a.zoom+a.panX,ve=Z.y*a.zoom+a.panY;Be.current.style.display="block",Be.current.style.left=pe+14+"px",Be.current.style.top=ve-6+"px",Be.current.innerHTML="<b>"+C(g.title||g.name||"")+'</b><br/><span style="opacity:.8">'+C(g.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",Q)+"</span>"}}else Be.current&&(Be.current.style.display="none")},Y=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(Ne))};a.wake=Y,a.render=he;let fe=()=>{let p=a.nodes.length;a.tickCount++;let C=.9-Math.min(.4,a.tickCount/1500),R=p>1e3?3e3:p>100?2e3:p>50?1200:800,j=p>100?.002:.005,re=p>1e3?.012:p>100?.005:.01,J=p>1e3?6:p>200?12:24,Se={};a.nodes.forEach(le=>Se[le.id]=le);for(let le=0;le<p;le++){if(a.dragNode===a.nodes[le])continue;let ge=a.nodes[le],Le=0,He=0;for(let g=0;g<p;g++){if(le===g)continue;let Z=ge.x-a.nodes[g].x,Q=ge.y-a.nodes[g].y,pe=Math.sqrt(Z*Z+Q*Q)||1,ve=R/(pe*pe);Le+=Z/pe*ve,He+=Q/pe*ve}if(a.clustered&&a.typeCenters[ge.type]){let g=a.typeCenters[ge.type];Le+=(g.x-ge.x)*.006,He+=(g.y-ge.y)*.006}else Le-=ge.x*re,He-=ge.y*re;let Re=(ge.vx+Le)*C,Ye=(ge.vy+He)*C;Re=Math.max(-J,Math.min(J,Re)),Ye=Math.max(-J,Math.min(J,Ye)),ge.vx=Re,ge.vy=Ye}a.edges.forEach(le=>{let ge=Se[le.sourceNodeId],Le=Se[le.targetNodeId];if(!ge||!Le)return;let He=Le.x-ge.x,Re=Le.y-ge.y,Ye=Math.sqrt(He*He+Re*Re)||1,g=(Ye-100)*j,Z=He/Ye*g,Q=Re/Ye*g;a.dragNode!==ge&&(ge.vx+=Z,ge.vy+=Q),a.dragNode!==Le&&(Le.vx-=Z,Le.vy-=Q)});let Fe=0;a.nodes.forEach(le=>{a.dragNode!==le&&(le.x+=le.vx,le.y+=le.vy,Fe+=le.vx*le.vx+le.vy*le.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,X()),(p?Math.sqrt(Fe/p):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},Ne=()=>{if(a.running){try{fe(),he()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(Ne)}},De=(p,z)=>{let C=c.getBoundingClientRect();return{x:(p-C.left-a.panX)/a.zoom,y:(z-C.top-a.panY)/a.zoom}},We=p=>{let z=a.domainById[p];return!(!z||y.current!=="all"&&z.kind!==y.current||V.current&&!(z.tags||[]).includes(V.current))},Ee=(p,z,C)=>Math.max(z,Math.min(C,p)),$e=p=>{a.mouseX=p.clientX,a.mouseY=p.clientY;let z=De(p.clientX,p.clientY),C=null;for(let R=a.nodes.length-1;R>=0;R--){let j=a.nodes[R];if(!We(j.id))continue;let re=j.x-z.x,J=j.y-z.y;if(re*re+J*J<j.r*j.r+36){C=j.id;break}}C!==a.hoverId&&(a.hoverId=C,Y())},ht=p=>{if(p.button!==0)return;let z=De(p.clientX,p.clientY),C=null;for(let R=a.nodes.length-1;R>=0;R--){let j=a.nodes[R];if(!We(j.id))continue;let re=j.x-z.x,J=j.y-z.y;if(re*re+J*J<j.r*j.r+25){C=j;break}}if(p.shiftKey){if(C){a.shiftClick=C.id;return}a.marquee={sx:p.clientX,sy:p.clientY,ex:p.clientX,ey:p.clientY};return}a.dragStart={x:p.clientX,y:p.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=C||null,C&&(a.dragOffset={dx:C.x-z.x,dy:C.y-z.y})},Rt=p=>{if(a.marquee){a.marquee.ex=p.clientX,a.marquee.ey=p.clientY,Y();return}if(!a.dragStart)return;let z=p.clientX-a.dragStart.x,C=p.clientY-a.dragStart.y;if(Math.abs(z)+Math.abs(C)>3&&(a.dragging=!0),a.dragNode){let R=De(p.clientX,p.clientY);a.dragNode.x=R.x+a.dragOffset.dx,a.dragNode.y=R.y+a.dragOffset.dy,Y()}else a.dragging&&(a.panX=Ee(a.dragStart.px+z,-1e5,1e5),a.panY=Ee(a.dragStart.py+C,-1e5,1e5),Y())},At=p=>{if(a.marquee){let C=a.marquee;a.marquee=null;let R=c.getBoundingClientRect(),j=Math.min(C.sx,C.ex)-R.left,re=Math.max(C.sx,C.ex)-R.left,J=Math.min(C.sy,C.ey)-R.top,Se=Math.max(C.sy,C.ey)-R.top,Fe=a.nodes.filter(ot=>{let le=ot.x*a.zoom+a.panX,ge=ot.y*a.zoom+a.panY;return le>=j&&le<=re&&ge>=J&&ge<=Se}).map(ot=>ot.id);a.multi=Fe,Oe(Fe),Y();return}let z=a.dragStart&&!a.dragging;if(a.shiftClick){let C=a.shiftClick;a.shiftClick=null;let R=Array.isArray(a.multi)?a.multi.slice():[];R.includes(C)||R.push(C),a.multi=R,Oe(R),Y();return}if(z){let C=De(p.clientX,p.clientY),R=null;for(let j=a.nodes.length-1;j>=0;j--){let re=a.nodes[j];if(!We(re.id))continue;let J=re.x-C.x,Se=re.y-C.y;if(J*J+Se*Se<re.r*re.r+20){R=re;break}}R?(a.selectedId=R.id,K(R.id),Y()):(a.selectedId=null,a.hoverId=null,p.shiftKey||(a.multi=[],Oe([])),K(null),Y())}a.dragStart=null,a.dragging=!1,a.dragNode=null},Bt=p=>{p.preventDefault();let z=De(p.clientX,p.clientY),C=null;for(let R=a.nodes.length-1;R>=0;R--){let j=a.nodes[R];if(!We(j.id))continue;let re=j.x-z.x,J=j.y-z.y;if(re*re+J*J<j.r*j.r+25){C=j;break}}if(C){let R=a.domainById[C.id];R&&ke({x:p.clientX,y:p.clientY,id:C.id,path:R.id,title:R.title})}else ke(null)},Pt=p=>{p.preventDefault();let z=c.getBoundingClientRect(),C=(p.clientX-z.left-a.panX)/a.zoom,R=(p.clientY-z.top-a.panY)/a.zoom,j=Math.max(.3,Math.min(3,a.zoom*(p.deltaY<0?1.1:1/1.1)));a.panX=Ee(a.panX+C*(a.zoom-j),-1e5,1e5),a.panY=Ee(a.panY+R*(a.zoom-j),-1e5,1e5),a.zoom=j,Y()};c.addEventListener("mousemove",$e),c.addEventListener("mousedown",ht),window.addEventListener("mousemove",Rt),window.addEventListener("mouseup",At),c.addEventListener("wheel",Pt,{passive:!1}),c.addEventListener("contextmenu",Bt),I.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],Oe([]),X(),Y()};for(let p=0;p<200;p++)fe();X(),Y();let Et=()=>F(!1);return window.addEventListener("mousedown",Et),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),me.disconnect(),c.removeEventListener("mousemove",$e),c.removeEventListener("mousedown",ht),window.removeEventListener("mousemove",Rt),window.removeEventListener("mouseup",At),c.removeEventListener("wheel",Pt),c.removeEventListener("contextmenu",Bt),window.removeEventListener("mousedown",Et)}},[t,o]),(0,n.useEffect)(()=>{A!==void 0&&D.current&&requestAnimationFrame(()=>D.current())},[A]),(0,e.jsxs)("div",{className:"me-graph",ref:h,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",i("nodes")," \xB7 ",o.length," ",i("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:i("search"),value:H,onChange:c=>ee(c.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>F(c=>!c),"aria-expanded":oe,title:i("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",i("filterLabel")," ",W!=="all"||$||b?"\u25CF":"\u25BE"]}),oe&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:c=>c.stopPropagation(),style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:50,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,padding:8,minWidth:240,boxShadow:"0 12px 34px rgba(0,0,0,.35)"},children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,e.jsx)("button",{type:"button",className:`lg${W==="all"&&!$?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{de("all"),_(!1)},children:i("all")}),Object.keys(Qe).map(c=>(0,e.jsxs)("button",{type:"button",className:`lg${W===c?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>de(s=>s===c?"all":c),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[c]||Qe[c]}}),i(Ue[c])]},c)),(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsxs)("button",{type:"button",className:`lg${$?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>_(c=>!c),children:["\u23F1 ",i("timeDim")]}),Ke.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsx)("div",{style:{maxHeight:130,overflow:"auto",display:"flex",flexWrap:"wrap",gap:4},children:Ke.map(c=>(0,e.jsxs)("button",{type:"button",className:`lg${b===c.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>k(s=>s===c.tag?"":c.tag),title:c.tag,children:["#",c.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:c.n})]},c.tag))})]}),(W!=="all"||$||b)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{de("all"),_(!1),k("")},children:[i("clearFilter")," \u2715"]})]})})]}),(0,e.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:i("crossVault"),children:[(0,e.jsx)("input",{type:"checkbox",checked:!!N,onChange:c=>v&&v(c.target.checked)}),i("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${$?" me-on":""}`,onClick:()=>_(c=>!c),children:i("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let c=S.current;if(c)try{c.toBlob(s=>{s&&be({url:URL.createObjectURL(s),blob:s})},"image/png")}catch{}},children:i("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>D.current&&D.current(),children:i("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{K(null),de("all"),I.current&&I.current()},children:i("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:S,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:Be,style:{display:"none",position:"absolute",zIndex:4,pointerEvents:"none",background:"rgba(28,28,32,0.88)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:8,padding:"7px 10px",fontSize:12,maxWidth:220,boxShadow:"0 8px 24px rgba(0,0,0,.2)"}}),ue&&(0,e.jsx)("div",{className:"mc-empty",style:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)"},children:i("noMatch")}),te&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>ke(null)}),te&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:te.x,top:te.y,zIndex:31},onMouseDown:c=>c.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{w.current({path:te.path,title:te.title}),ke(null)},children:i("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{te.id&&(u.current.selectedId=te.id,K(te.id)),ke(null);let c=u.current;c&&c.wake&&c.wake()},children:i("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(te.title||"")}catch{}ke(null),se(i("copied"))},children:i("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let c=u.current,s=c&&Array.isArray(c.multi)?c.multi.slice():[],E=te.id;if(E&&!s.includes(E)&&s.push(E),ke(null),s.length<2){se(i("mergeNeed"),!1);return}if(!window.confirm(i("mergeConfirm")))return;let ne=M.current&&M.current(s);ne&&ne.then?ne.then(O=>O?se(i("merged")):se(i("mergeFail"),!1)).catch(()=>se(i("mergeFail"),!1)):ne&&se(i("merged"))},children:i("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let c=te.path;ke(null),window.confirm(i("deleteConfirm"))&&(async()=>{try{(T.current?await T.current(c):!1)?se(i("deleted")):se(i("deleteFail"),!1)}catch{se(i("deleteFail"),!1)}})()},children:i("delete")})]}),Pe.length>0&&(0,e.jsxs)("div",{style:{position:"absolute",left:10,top:10,zIndex:3,display:"flex",gap:8,alignItems:"center",background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:"6px 10px",fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsxs)("span",{style:{fontWeight:700},children:[Pe.length," ",i("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=Pe.map(ce=>we[ce]).filter(Boolean).map(ce=>ce.title||ce.name).join(`
|
|
307
|
+
`),E=new Blob([s],{type:"text/plain;charset=utf-8"}),ne=URL.createObjectURL(E),O=document.createElement("a");O.href=ne,O.download="memory-selected.txt",document.body.appendChild(O),O.click(),document.body.removeChild(O),setTimeout(()=>URL.revokeObjectURL(ne),1e3),se(Pe.length+i("exportedSel"))},children:i("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(Pe.length<2){se(i("mergeNeed"),!1);return}let c=Pe.map(E=>we[E]?we[E].id:E);if(!window.confirm(i("mergeConfirm")))return;Oe([]);let s=u.current;s&&(s.multi=[]),fetch(`${U}/merge?paths=${encodeURIComponent(c.join(","))}`).then(E=>E.json()).then(E=>{E&&E.ok?se(i("merged")):se(i("mergeFail"),!1)}).catch(()=>se(i("mergeFail"),!1))},children:i("merge")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(i("deleteConfirm")))return;let c=Pe.map(E=>we[E]?we[E].id:E);Oe([]);let s=u.current;s&&(s.multi=[]),(async()=>{let E=0;for(let ne of c)try{(T.current?await T.current(ne):!1)&&E++}catch{}se(E+i("deletedSelected"),E>0)})()},children:i("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let c=u.current;c&&(c.multi=[]),Oe([]);let s=u.current;s&&s.render&&s.render()},children:i("clearSelection")})]}),ye&&(0,e.jsxs)("div",{className:"me-graph-sidebar",style:{position:"absolute",right:10,top:10,zIndex:3,maxWidth:240,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:12,fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsx)("div",{style:{fontWeight:700,fontSize:13,marginBottom:4},children:we[ye]?we[ye].title||we[ye].name:ye}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:we[ye]?i(Ue[we[ye].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:i("graphHint")}),(o.filter(c=>c.source===ye||c.target===ye)||[]).slice(0,8).map((c,s)=>{let E=c.source===ye?c.target:c.source,ne=we[E];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:O=>{O.preventDefault();let ce=u.current;ce&&(ce.selectedId=E,ce.hoverId=E,ce.wake&&ce.wake()),K(E)},children:ne?(ne.title||ne.name).slice(0,28):E},s)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:i("graphTip")}),Je&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(Je.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:Je.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:Je.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:Je.msg})]}),Ce&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{Ce.url&&URL.revokeObjectURL(Ce.url),be(null),et(!1)},children:[(0,e.jsx)("style",{children:Ae}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:xe?"100vw":900,width:xe?"100vw":"92vw",maxHeight:xe?"100%":"90vh",height:xe?"100%":void 0,borderRadius:xe?0:14},onClick:c=>c.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:i("exportGraph")}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("a",{className:"mc-btn",href:Ce.url,download:"memory-graph.png",onClick:()=>{Ve("download"),se(i("downloaded")+" \xB7 "+i("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:i(nt==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ve("full"),et(c=>!c),se(i("fullscreen"))},children:i(nt==="full"?"done":xe?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let c=Ce.blob;c&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":c})]).then(()=>{Ve("copy"),se(i("copied"))}).catch(()=>{se(i("copyFail"),!1)}):se(i("copyFail"),!1)},children:i(nt==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ce.url&&URL.revokeObjectURL(Ce.url),be(null),et(!1)},children:i("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:xe?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,e.jsx)("img",{src:Ce.url,alt:i("exportGraph"),style:{maxWidth:"100%",maxHeight:xe?"calc(100% - 64px)":"70vh",borderRadius:xe?0:8,cursor:"zoom-in"},onClick:()=>et(c=>!c)})})]})]})]})}function ja(t){let o=new Date(t||0).getTime();if(!o)return"#94a3b8";let r=(Date.now()-o)/864e5;return r<3?"#10b981":r<14?"#f59e0b":r<30?"#f97316":"#94a3b8"}function Yt({label:t,value:o=[],options:r,onChange:m,placeholder:d,z:i=20}){let[x,N]=(0,n.useState)(!1),v=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!x)return;let w=T=>{v.current&&!v.current.contains(T.target)&&N(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[x]);let A=Array.isArray(o)?o:[],S=A.includes("__all__"),h=S?r.find(w=>w.value==="__all__")?.label||"":A.length?A.map(w=>r.find(T=>T.value===w)?.label||w).join("\u3001"):"",u=(w,T)=>{if(w.value==="__all__"){m(T?["__all__"]:[]);return}let M=new Set(A);M.has("__all__")&&M.delete("__all__"),T?M.add(w.value):M.delete(w.value),m([...M])},D=r.find(w=>w.value==="__all__"),I=r.filter(w=>w.value!=="__all__");return(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t}),(0,e.jsxs)("div",{ref:v,style:{position:"relative",minWidth:0},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>N(w=>!w),style:{width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[(0,e.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h||d||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),x&&(0,e.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:i,marginTop:2,borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",boxShadow:"0 6px 20px rgba(0,0,0,0.14)",maxHeight:180,overflow:"auto"},children:[D&&(0,e.jsxs)("label",{onClick:w=>w.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("input",{type:"checkbox",checked:S,onChange:w=>u(D,w.target.checked)}),(0,e.jsx)("span",{children:D.label})]}),I.map(w=>(0,e.jsxs)("label",{onClick:T=>T.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:A.includes(w.value),onChange:T=>u(w,T.target.checked)}),(0,e.jsx)("span",{children:w.label})]},w.value))]})]})]})}function Oa(t){let o=new Date(t||0).getTime();return!!o&&(Date.now()-o)/864e5<3}async function Wa(t,o,r){if(r&&typeof window.showSaveFilePicker=="function")try{let i=await window.showSaveFilePicker({suggestedName:o}),x=await i.createWritable();return await x.write(t),await x.close(),{ok:!0,picked:!0,name:i.name}}catch(i){return i&&i.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(i.message||i)}}let m=URL.createObjectURL(t),d=document.createElement("a");return d.href=m,d.download=o,document.body.appendChild(d),d.click(),document.body.removeChild(d),setTimeout(()=>URL.revokeObjectURL(m),1e3),{ok:!0,picked:!1,name:o}}function Gt(t,o){if(!o||!t)return t;let r=t.toLowerCase(),m=o.toLowerCase(),d=[],i=0;for(;i<t.length;){let x=r.indexOf(m,i);if(x<0){d.push(t.slice(i));break}x>i&&d.push(t.slice(i,x)),d.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(x,x+m.length)},x)),i=x+m.length}return d}function pt(t){if(!t)return"";let o=new Date(t);if(Number.isNaN(o.getTime()))return"";let r=new Date,m=o.toDateString()===r.toDateString(),d=x=>String(x).padStart(2,"0"),i=`${d(o.getHours())}:${d(o.getMinutes())}`;return m?i:`${o.getMonth()+1}-${o.getDate()} ${i}`}
|
|
308
308
|
|
|
309
309
|
return module.exports;
|
|
310
310
|
},
|