memory-eternal 0.10.32 → 0.10.33
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 +3 -2
- package/README.md +3 -2
- package/index.js +27 -2
- package/lib/api.js +44 -1
- package/lib/capture.js +36 -1
- package/lib/client.js +15 -15
- package/lib/watchdog.js +19 -9
- package/package.json +2 -2
- package/web/app.js +16 -16
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 na=Object.create;var St=Object.defineProperty;var oa=Object.getOwnPropertyDescriptor;var ia=Object.getOwnPropertyNames;var
|
|
7
|
-
`),r=/^---\n([\s\S]*?)\n---\n?/.exec(
|
|
8
|
-
`)){let
|
|
9
|
-
`)).body;if(!
|
|
10
|
-
`)){let
|
|
11
|
-
`)}function
|
|
12
|
-
|
|
13
|
-
> \u5185\u5BB9\u8FC7\u957F\u5DF2\u622A\u65AD\uFF1A\u5B8C\u6574\u8BCA\u65AD\u8BF7\u5728\u63D2\u4EF6\u91CC\u70B9\u300C\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u300D\uFF0C\u518D\u8865\u5230 issue \u8BC4\u8BBA\u91CC\u3002`,
|
|
6
|
+
var na=Object.create;var St=Object.defineProperty;var oa=Object.getOwnPropertyDescriptor;var ia=Object.getOwnPropertyNames;var la=Object.getPrototypeOf,ra=Object.prototype.hasOwnProperty;var sa=(t,i)=>{for(var r in i)St(t,r,{get:i[r],enumerable:!0})},Ht=(t,i,r,g)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of ia(i))!ra.call(t,c)&&c!==r&&St(t,c,{get:()=>i[c],enumerable:!(g=oa(i,c))||g.enumerable});return t};var da=(t,i,r)=>(r=t!=null?na(la(t)):{},Ht(i||!t||!t.__esModule?St(r,"default",{value:t,enumerable:!0}):r,t)),ca=t=>Ht(St({},"__esModule",{value:!0}),t);var _a={};sa(_a,{EN:()=>Zt,MemoryLibrary:()=>Da,ZH:()=>Jt,apply:()=>Ca,inject:()=>ka});module.exports=ca(_a);var o=da(require("react"),1);var pa={"&":"&","<":"<",">":">"},Rt=t=>String(t).replace(/[&<>]/g,i=>pa[i]),ua=[[/结论|总结|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"]],ma=["\u2728","info"],ga=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],fa=t=>{let i=String(t);for(let[r,g,c]of ua)if(r.test(i))return[g,c];return ma},ba=t=>{let i=t.join(" ");for(let[r,g,c]of ga)if(r.test(i))return[g,c];return["\u{1F4CC}","info"]};function lt(t){let i=String(t),r=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(i);if(r&&!/[是为有了吗呢着过把被和与或于]/.test(r[1]))return'<span class="md-kv"><span class="md-k">'+Rt(r[1])+'</span><span class="md-v">'+lt(r[2])+"</span></span>";let g=Rt(i);return g=g.replace(/^\[([ xX])\](?=\s|$)\s*/,(c,l)=>'<span class="md-task">'+(l.toLowerCase()==="x"?"\u2611":"\u2610")+"</span> "),g=g.replace(/`([^`\n]+)`/g,'<code class="md-code">$1</code>'),g=g.replace(/\*\*([^*]+)\*\*/g,'<strong class="md-b">$1</strong>'),g=g.replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>"),g=g.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(c,l,C)=>/^(https?:|\/|#)/i.test(C)?'<a class="md-link" href="'+C+'" target="_blank" rel="noopener noreferrer">'+l+"</a>":l),g}function Ct(t){let i=String(t||"").replace(/\r\n?/g,`
|
|
7
|
+
`),r=/^---\n([\s\S]*?)\n---\n?/.exec(i);if(!r)return{meta:[],body:i};let g=[];for(let c of r[1].split(`
|
|
8
|
+
`)){let l=c.indexOf(":");if(l<=0)continue;let C=c.slice(0,l).trim(),R=c.slice(l+1).trim().replace(/^["']|["']$/g,"");C&&g.push([C,R])}return{meta:g,body:i.slice(r[0].length)}}function Ot(t){let i=String(t||"").trim().replace(/^\[|\]$/g,"");return i?i.split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Dt(t){let i=Ct(String(t||"").replace(/\r\n?/g,`
|
|
9
|
+
`)).body;if(!i.trim())return"";let r=[],g=i.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(m,I,T)=>(r.push('<pre class="md-pre"><code>'+Rt(T.replace(/\n$/,""))+"</code></pre>"),"\0F"+(r.length-1)+"\0")),c=[],l=[],C=null,R=null,S=()=>{l.length&&(c.push('<p class="md-p">'+l.join("<br/>")+"</p>"),l=[])},H=()=>{if(!C)return;let m=C.type;c.push("<"+m+' class="md-'+m+'">'+C.items.map(I=>"<li>"+I+"</li>").join("")+"</"+m+">"),C=null},k=()=>{if(!R)return;let[m,I]=ba(R);c.push('<div class="md-callout md-c-'+I+'"><span class="md-ico">'+m+"</span>"+R.join("<br/>")+"</div>"),R=null},v=()=>{S(),H(),k()};for(let m of g.split(`
|
|
10
|
+
`)){let I=m.trim();if(!I){v();continue}let T=/^\u0000F(\d+)\u0000$/.exec(I);if(T){v(),c.push(r[Number(T[1])]);continue}let w;if(w=/^(#{1,6})\s+(.+)$/.exec(I)){v();let[j,B]=fa(w[2]);c.push('<div class="md-h md-h-'+(w[1].length<=2?"h1":"h2")+" md-c-"+B+'"><span class="md-ico">'+j+'</span><span class="md-hx">'+lt(w[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(I)){v(),c.push('<hr class="md-hr"/>');continue}if(w=/^>\s?(.*)$/.exec(I)){S(),H(),R=R||[],R.push(lt(w[1]));continue}if(w=/^[-*+]\s+(.+)$/.exec(I)){S(),k(),(!C||C.type!=="ul")&&(H(),C={type:"ul",items:[]}),C.items.push(lt(w[1]));continue}if(w=/^\d+[.)]\s+(.+)$/.exec(I)){S(),k(),(!C||C.type!=="ol")&&(H(),C={type:"ol",items:[]}),C.items.push(lt(w[1]));continue}H(),k(),l.push(lt(I))}return v(),c.join(`
|
|
11
|
+
`)}function Et(t={}){let i=t.repo||"EternalNight996/memory-eternal",r=String(t.title||"[Bug] ").slice(0,120),g=Array.isArray(t.labels)?t.labels:["bug"],c=Number(t.maxLength)>500?Number(t.maxLength):7e3,l=S=>{let H=new URLSearchParams;return H.set("title",r),H.set("body",S),g.length&&H.set("labels",g.join(",")),"https://github.com/"+i+"/issues/new?"+H.toString()},C=String(t.body||""),R=l(C);if(R.length>c){let S=`
|
|
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`,H=k=>l(C.slice(0,k)+S);if(H(0).length>c)C=S;else{let k=0,v=C.length;for(;k<v;){let m=Math.ceil((k+v)/2);H(m).length<=c?k=m:v=m-1}C=C.slice(0,k)+S}R=l(C)}return R}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 zt="https://github.com/EternalNight996/memory-eternal",ya=["\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"+zt,"","\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
|
`),ha=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+zt,"","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"?ha:ya,f=t.repo||"EternalNight996/memory-eternal";return r=r.split(zt).join("https://github.com/"+f),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:f=0,h:p=0,margin:i=60}={}){let w=r||1;return{x0:(0-t)/w-i,y0:(0-o)/w-i,x1:(f-t)/w+i,y1:(p-o)/w+i}}function Nt(t,o,r,f){return f?t+r>=f.x0&&t-r<=f.x1&&o+r>=f.y0&&o-r<=f.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,f=new Set,p=k=>{k&&f.size<r&&f.add(k)};if(p(o.focusId),p(o.hoverId),o.searchHits)for(let k of o.searchHits){if(f.size>=r)break;f.add(k)}let i=o.degree||{},w=k=>Number(i[k])||0,D=[];for(let k of Array.isArray(t)?t:[])k&&k.id&&!f.has(k.id)&&D.push(k);D.sort((k,E)=>w(E.id)-w(k.id));for(let k of D){if(f.size>=r)break;f.add(k.id)}return f}function va(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||{}},f={};for(let[p,i]of Object.entries(o||{}))va(t?t[p]:void 0,i)||(r[p]=i,f[p]=i);return{values:r,overlay:f}}var e=require("react/jsx-runtime"),st="memory-eternal",W="/memory-eternal/api",xa=100,ka=["slots","locale"],Jt={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}",refineTitle:"\u77DB\u76FE\u626B\u63CF",refineScan:"\u5F00\u59CB\u626B\u63CF",refineHint:"\u76F8\u4F3C\u53EF\u4EE5\u5408\u5E76\uFF0C\u77DB\u76FE\u5FC5\u987B\u4EBA\u5224\u65AD \u2014\u2014 \u626B\u63CF\u53EA\u8BFB\uFF0C\u9009\u62E9\u540E\u624D\u52A8\u6570\u636E\uFF08\u4FDD\u7559\u4E00\u5F20\u4F1A\u628A\u53E6\u4E00\u5F20\u653E\u8FDB\u56DE\u6536\u7AD9\uFF0C\u53EF\u8FD8\u539F\uFF09",refineIdle:"\u70B9\u300C\u5F00\u59CB\u626B\u63CF\u300D\uFF1A\u5148\u5BBD\u53EC\u56DE\u53EF\u80FD\u6709\u5173\u7CFB\u7684\u5361\u7247\u5BF9\uFF0C\u518D\u8BA9\u6A21\u578B\u5224\u65AD\u662F\u91CD\u590D / \u8865\u5145 / \u77DB\u76FE / \u65E0\u5173",refineNone:"\u8FD9\u4E00\u8F6E\u6CA1\u6709\u53D1\u73B0\u9700\u8981\u4F60\u88C1\u51B3\u7684\u5361\u7247\u5BF9 \u{1F389}",refineFail:"\u77DB\u76FE\u626B\u63CF\u5931\u8D25",refineApplied:"\u5DF2\u8BB0\u5F55\u4F60\u7684\u88C1\u51B3\uFF08\u4E0D\u4F1A\u91CD\u590D\u6253\u6270\uFF09",refineRel_duplicate:"\u91CD\u590D\uFF08\u53EF\u5408\u5E76\uFF09",refineRel_complement:"\u8865\u5145\uFF08\u90FD\u7559\u7740\uFF09",refineRel_conflict:"\u77DB\u76FE\uFF08\u9700\u4F60\u88C1\u51B3\uFF09",refineRel_unrelated:"\u65E0\u5173",refineKeepA:"\u4FDD\u7559 A",refineKeepB:"\u4FDD\u7559 B",refineKeepBoth:"\u90FD\u4FDD\u7559",refineMerge:"\u5408\u5E76",junkTitle:"\u6CE8\u5165\u5783\u573E\u5361",junkScan:"\u626B\u63CF\u5B58\u91CF",junkHint:"\u6000\u7591\u662F\u8FD0\u884C\u65F6\u6CE8\u5165\u6587\u672C\uFF08\u6280\u80FD\u76EE\u5F55 / system-reminder\uFF09\u6C89\u6DC0\u6210\u7684\u5361 \u2014\u2014 \u626B\u63CF\u53EA\u8BFB\uFF0C\u56DE\u6536\u8D70\u56DE\u6536\u7AD9\u53EF\u8FD8\u539F",junkIdle:"\u70B9\u300C\u626B\u63CF\u5B58\u91CF\u300D\uFF1A\u627E\u51FA\u6B63\u6587\u5176\u5B9E\u662F\u88AB\u6CE8\u5165\u7684\u8FD0\u884C\u65F6\u6587\u672C\u3001\u5265\u6389\u540E\u51E0\u4E4E\u4E0D\u5269\u4EBA\u8BDD\u7684\u5361",junkNone:"\u6CA1\u53D1\u73B0\u8FD9\u7C7B\u5361 \u{1F389}",junkRecycle:"\u56DE\u6536",junkRecycleAll:"\u5168\u90E8\u56DE\u6536",junkRecycleAllConfirm:"\u786E\u8BA4\u628A\u8FD9\u4E9B\u5361\u9001\u8FDB\u56DE\u6536\u7AD9\uFF1F\uFF08\u4E0D\u662F\u6C38\u4E45\u5220\u9664\uFF0C\u53EF\u5728\u56DE\u6536\u4E2D\u5FC3\u8FD8\u539F\uFF09",junkDone:"\u5DF2\u9001\u56DE\u6536\u7AD9",junkFail:"\u626B\u63CF / \u56DE\u6536\u5931\u8D25",dbReadonlyTitle:"\u8BB0\u5FC6\u5E93\u5F53\u524D\u4E0D\u53EF\u5199",dbReadonlyBody:"\u5361\u7247\u8BFB\u5199 / \u5BA1\u6838 / \u56FE\u8C31\u4F1A\u5931\u8D25\uFF0C\u4F46**\u914D\u7F6E\u4ECD\u53EF\u4FDD\u5B58**\uFF08\u914D\u7F6E\u4E0D\u7ECF\u8FC7\u6570\u636E\u5E93\uFF09",dbReadonlyFix:"\u6392\u67E5\uFF1Adsh-memory doctor\uFF08\u770B journal \u6A21\u5F0F\u3001\u5199\u63A2\u9488\u3001\u5907\u4EFD\u6E05\u5355\u4E0E\u6062\u590D\u6B65\u9AA4\uFF09",goalTitle:"\u540C\u76EE\u6807\u4E0D\u540C\u505A\u6CD5",goalScan:"\u626B\u63CF\u76EE\u6807",goalHint:"\u6309\u300C\u8FD9\u5F20\u5361\u89E3\u51B3\u4EC0\u4E48\u95EE\u9898\u300D\u805A\u7C7B \u2014\u2014 \u6B63\u6587\u76F8\u4F3C\u5EA6\u6293\u4E0D\u5230\u7684\u505A\u6CD5\u5DEE\u5F02\uFF087z \u538B\u7F29 / tar \u5206\u53D1 / npm \u7626\u8EAB\uFF09\u4E5F\u80FD\u5F52\u5230\u4E00\u8D77",goalIdle:"\u70B9\u300C\u626B\u63CF\u76EE\u6807\u300D\uFF1A\u6A21\u578B\u5148\u7ED9\u6BCF\u5F20\u5361\u62BD\u4E00\u53E5\u76EE\u6807\uFF08\u9996\u6B21\u4F1A\u8C03\u6A21\u578B\uFF0C\u4E4B\u540E\u8D70\u7F13\u5B58\uFF09\uFF0C\u518D\u6309\u76EE\u6807\u805A\u7C7B",goalNone:"\u6CA1\u6709\u53D1\u73B0\u300C\u540C\u4E00\u76EE\u6807\u3001\u591A\u5F20\u5361\u300D\u7684\u7C07 \u{1F389}",goalStats:"\u5DF2\u7D22\u5F15 / \u672C\u6B21\u8C03\u7528",goalCards:"\u5F20\u5361",goalKeep:"\u90FD\u4FDD\u7559",goalMerge:"\u5408\u5E76\u8FD9\u4E00\u7EC4",goalMerged:"\u5DF2\u63D0\u4EA4\u5408\u5E76\uFF08\u65B0\u5361\u8FDB\u5BA1\u6838\u961F\u5217\uFF09",goalDone:"\u5DF2\u8BB0\u5F55\u300C\u90FD\u4FDD\u7559\u300D",goalFail:"\u76EE\u6807\u805A\u7C7B\u5931\u8D25",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",auditBodyFail:"\u6B63\u6587\u8BFB\u53D6\u5931\u8D25",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",vcResidentDownShort:"\u672A\u8FD0\u884C",vcResidentDown:"\u5E38\u9A7B\u5B9E\u4F8B\u6CA1\u5728\u8FD0\u884C\uFF08\u7AEF\u53E3 {port} \u65E0\u54CD\u5E94\uFF09\u2014\u2014 \u70B9\u4E0B\u9762\u7684\u6309\u94AE\u7528\u65B0\u4EE3\u7801\u628A\u5B83\u62C9\u8D77\u6765\uFF1B\u62C9\u4E0D\u8D77\u6765\u65F6\u6267\u884C {cmd}\uFF0C\u5E76\u8D34\u4E00\u4E0B dsh-memory status \u7684\u8F93\u51FA",vcResidentUnmanagedShort:"\u672A\u6258\u7BA1",vcResidentUnmanaged:"\u5E38\u9A7B\u5B9E\u4F8B\u5728\u670D\u52A1 v{served}\uFF0C\u4F46**\u6CA1\u6709\u770B\u95E8\u72D7\u4FDD\u6D3B**\uFF08\u505C\u6B62 / \u786C\u6740\u540E\u6B8B\u7559\u7684\u5B64\u513F\uFF09\u2014\u2014 \u70B9\u4E0B\u9762\u7684\u6309\u94AE\u628A\u5B83\u91CD\u65B0\u6258\u7BA1\uFF08\u91CD\u65B0\u62C9\u4E00\u4E2A\u770B\u95E8\u72D7 + \u65B0\u5B9E\u4F8B\uFF09\uFF1B\u4E5F\u53EF\u4EE5\u6267\u884C {cmd}",vcResidentLockUnknownShort:"\u6258\u7BA1\u72B6\u6001\u672A\u77E5",vcResidentReplaceBlockedShort:"\u4E0D\u53EF\u66FF\u6362",vcResidentReplaceBlocked:"\u5E38\u9A7B\u5B9E\u4F8B**\u4E0D\u53EF\u66FF\u6362**\uFF08\u73AF\u5883\u9650\u5236\uFF09\uFF1A\u770B\u95E8\u72D7\u9501\u76EE\u5F55\u4E0D\u53EF\u5199\uFF08{err}\uFF1B{path}\uFF09\u2192 \u7AEF\u53E3\u4E0A\u4F1A**\u957F\u671F**\u505C\u5728 v{served}\u3002\u8FD9\u4E0D\u662F\u300C\u6682\u65F6\u843D\u540E\u300D\uFF1A\u81EA\u52A8\u66FF\u6362\u88AB\u6B63\u786E\u5730\u62D2\u7EDD\uFF08\u907F\u514D\u7559\u4E0B\u5B64\u513F\uFF09\u3002\u51FA\u8DEF\uFF1A\u4FEE\u590D\u8BE5\u76EE\u5F55\u6743\u9650\u540E\u6267\u884C {cmd}\uFF0C\u6216\u524D\u53F0\u89C2\u5BDF dsh-memory watchdog --port 7999",vcResidentLockUnknown:"\u5E38\u9A7B\u5B9E\u4F8B\u5728\u670D\u52A1 v{served}\uFF0C\u4F46**\u770B\u95E8\u72D7\u9501\u6587\u4EF6\u5199\u4E0D\u8FDB\u53BB**\uFF08\u53D7\u9650\u73AF\u5883\uFF1A\u6C99\u7BB1\u7981\u5199 / ACL / \u975E\u7CFB\u7EDF\u76D8\uFF09\u2192 \u65E0\u6CD5\u5224\u65AD\u5B83\u6709\u6CA1\u6709\u88AB\u6258\u7BA1\uFF08\u4E0D\u662F\u300C\u672A\u6258\u7BA1\u300D\uFF09\u3002\u539F\u56E0\uFF1A{err}\uFF08{path}\uFF09\u3002\u4FDD\u6D3B\u901A\u5E38\u4ECD\u7136\u6709\u6548\uFF1B\u70B9\u4E0B\u9762\u7684\u6309\u94AE\u53EF\u7528\u65B0\u4EE3\u7801\u91CD\u65B0\u6258\u7BA1\u4E00\u6B21\u3002",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",alignTitle:"\u7248\u672C\u5BF9\u9F50\u68C0\u67E5",alignRun:"\u5F00\u59CB\u68C0\u67E5",alignFix:"\u91CD\u5199\u63A5\u7EBF",alignFixConfirm:"\u91CD\u5199 MCP / hooks \u63A5\u7EBF\uFF1F\uFF08\u53EA\u78B0\u63D2\u4EF6\u81EA\u5DF1\u7684\u952E\uFF0C\u4E0D\u52A8\u4F60\u7684\u6570\u636E\u4E0E\u914D\u7F6E\uFF09",alignFixed:"\u63A5\u7EBF\u5DF2\u91CD\u5199\uFF1B\u82E5\u4E0A\u9762\u63D0\u793A\u300C\u5BBF\u4E3B\u8FDB\u7A0B\u65E7\u300D\uFF0C\u4ECD\u9700\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u5F00 DSH",alignFail:"\u5BF9\u9F50\u68C0\u67E5\u5931\u8D25",alignHint:"\u63D2\u4EF6\u5347\u7EA7\u53EA\u6362\u78C1\u76D8\u6587\u4EF6 \u2014\u2014 \u5BBF\u4E3B\u5185\u5B58\u91CC\u7684\u4E8B\u4EF6\u8BA2\u9605\u4E0E MCP / hooks \u91CC\u7684\u65E7\u8DEF\u5F84\u4E0D\u4F1A\u81EA\u5DF1\u66F4\u65B0\uFF0C\u8FD9\u91CC\u4E00\u6B21\u67E5\u6E05",alignIdle:"\u70B9\u300C\u5F00\u59CB\u68C0\u67E5\u300D\uFF1A\u5BF9\u6BD4\u5BBF\u4E3B / \u5E38\u9A7B\u5B9E\u4F8B / npm \u7684\u7248\u672C\uFF0C\u5E76\u68C0\u67E5 MCP\u3001hooks \u91CC\u662F\u5426\u6709\u65E7\u8DEF\u5F84\u4E0E\u65E7\u53C2\u6570",alignDisk:"\u78C1\u76D8",alignResident:"\u5E38\u9A7B\u5B9E\u4F8B",alignHost:"\u5BBF\u4E3B\u8FDB\u7A0B",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 i=t.lang==="en"?"en":"zh",r=i==="en"?ha:ya,g=t.repo||"EternalNight996/memory-eternal";return r=r.split(zt).join("https://github.com/"+g),t.description&&(r=r.replace(i==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(r=r.replace(i==="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:i=0,zoom:r=1,w:g=0,h:c=0,margin:l=60}={}){let C=r||1;return{x0:(0-t)/C-l,y0:(0-i)/C-l,x1:(g-t)/C+l,y1:(c-i)/C+l}}function Nt(t,i,r,g){return g?t+r>=g.x0&&t-r<=g.x1&&i+r>=g.y0&&i-r<=g.y1:!0}function Ut(t){let i=Number(t)||0;return i<=120?1/0:i<=300?160:i<=600?90:60}function Kt(t,i={}){let r=Number.isFinite(i.limit)?i.limit:1/0,g=new Set,c=S=>{S&&g.size<r&&g.add(S)};if(c(i.focusId),c(i.hoverId),i.searchHits)for(let S of i.searchHits){if(g.size>=r)break;g.add(S)}let l=i.degree||{},C=S=>Number(l[S])||0,R=[];for(let S of Array.isArray(t)?t:[])S&&S.id&&!g.has(S.id)&&R.push(S);R.sort((S,H)=>C(H.id)-C(S.id));for(let S of R){if(g.size>=r)break;g.add(S.id)}return g}function va(t,i){if(t===i)return!0;if(t===null||i===null||t===void 0||i===void 0||typeof t!="object"&&typeof i!="object")return t===i;try{return JSON.stringify(t)===JSON.stringify(i)}catch{return!1}}function qt(t,i){let r={...t||{}},g={};for(let[c,l]of Object.entries(i||{}))va(t?t[c]:void 0,l)||(r[c]=l,g[c]=l);return{values:r,overlay:g}}var e=require("react/jsx-runtime"),rt="memory-eternal",E="/memory-eternal/api",xa=100,ka=["slots","locale"],Jt={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}",refineTitle:"\u77DB\u76FE\u626B\u63CF",refineScan:"\u5F00\u59CB\u626B\u63CF",refineHint:"\u76F8\u4F3C\u53EF\u4EE5\u5408\u5E76\uFF0C\u77DB\u76FE\u5FC5\u987B\u4EBA\u5224\u65AD \u2014\u2014 \u626B\u63CF\u53EA\u8BFB\uFF0C\u9009\u62E9\u540E\u624D\u52A8\u6570\u636E\uFF08\u4FDD\u7559\u4E00\u5F20\u4F1A\u628A\u53E6\u4E00\u5F20\u653E\u8FDB\u56DE\u6536\u7AD9\uFF0C\u53EF\u8FD8\u539F\uFF09",refineIdle:"\u70B9\u300C\u5F00\u59CB\u626B\u63CF\u300D\uFF1A\u5148\u5BBD\u53EC\u56DE\u53EF\u80FD\u6709\u5173\u7CFB\u7684\u5361\u7247\u5BF9\uFF0C\u518D\u8BA9\u6A21\u578B\u5224\u65AD\u662F\u91CD\u590D / \u8865\u5145 / \u77DB\u76FE / \u65E0\u5173",refineNone:"\u8FD9\u4E00\u8F6E\u6CA1\u6709\u53D1\u73B0\u9700\u8981\u4F60\u88C1\u51B3\u7684\u5361\u7247\u5BF9 \u{1F389}",refineFail:"\u77DB\u76FE\u626B\u63CF\u5931\u8D25",refineApplied:"\u5DF2\u8BB0\u5F55\u4F60\u7684\u88C1\u51B3\uFF08\u4E0D\u4F1A\u91CD\u590D\u6253\u6270\uFF09",refineRel_duplicate:"\u91CD\u590D\uFF08\u53EF\u5408\u5E76\uFF09",refineRel_complement:"\u8865\u5145\uFF08\u90FD\u7559\u7740\uFF09",refineRel_conflict:"\u77DB\u76FE\uFF08\u9700\u4F60\u88C1\u51B3\uFF09",refineRel_unrelated:"\u65E0\u5173",refineKeepA:"\u4FDD\u7559 A",refineKeepB:"\u4FDD\u7559 B",refineKeepBoth:"\u90FD\u4FDD\u7559",refineMerge:"\u5408\u5E76",junkTitle:"\u6CE8\u5165\u5783\u573E\u5361",junkScan:"\u626B\u63CF\u5B58\u91CF",junkHint:"\u6000\u7591\u662F\u8FD0\u884C\u65F6\u6CE8\u5165\u6587\u672C\uFF08\u6280\u80FD\u76EE\u5F55 / system-reminder\uFF09\u6C89\u6DC0\u6210\u7684\u5361 \u2014\u2014 \u626B\u63CF\u53EA\u8BFB\uFF0C\u56DE\u6536\u8D70\u56DE\u6536\u7AD9\u53EF\u8FD8\u539F",junkIdle:"\u70B9\u300C\u626B\u63CF\u5B58\u91CF\u300D\uFF1A\u627E\u51FA\u6B63\u6587\u5176\u5B9E\u662F\u88AB\u6CE8\u5165\u7684\u8FD0\u884C\u65F6\u6587\u672C\u3001\u5265\u6389\u540E\u51E0\u4E4E\u4E0D\u5269\u4EBA\u8BDD\u7684\u5361",junkNone:"\u6CA1\u53D1\u73B0\u8FD9\u7C7B\u5361 \u{1F389}",junkRecycle:"\u56DE\u6536",junkRecycleAll:"\u5168\u90E8\u56DE\u6536",junkRecycleAllConfirm:"\u786E\u8BA4\u628A\u8FD9\u4E9B\u5361\u9001\u8FDB\u56DE\u6536\u7AD9\uFF1F\uFF08\u4E0D\u662F\u6C38\u4E45\u5220\u9664\uFF0C\u53EF\u5728\u56DE\u6536\u4E2D\u5FC3\u8FD8\u539F\uFF09",junkDone:"\u5DF2\u9001\u56DE\u6536\u7AD9",junkFail:"\u626B\u63CF / \u56DE\u6536\u5931\u8D25",dbReadonlyTitle:"\u8BB0\u5FC6\u5E93\u5F53\u524D\u4E0D\u53EF\u5199",dbReadonlyBody:"\u5361\u7247\u8BFB\u5199 / \u5BA1\u6838 / \u56FE\u8C31\u4F1A\u5931\u8D25\uFF0C\u4F46**\u914D\u7F6E\u4ECD\u53EF\u4FDD\u5B58**\uFF08\u914D\u7F6E\u4E0D\u7ECF\u8FC7\u6570\u636E\u5E93\uFF09",dbReadonlyFix:"\u6392\u67E5\uFF1Adsh-memory doctor\uFF08\u770B journal \u6A21\u5F0F\u3001\u5199\u63A2\u9488\u3001\u5907\u4EFD\u6E05\u5355\u4E0E\u6062\u590D\u6B65\u9AA4\uFF09",goalTitle:"\u540C\u76EE\u6807\u4E0D\u540C\u505A\u6CD5",goalScan:"\u626B\u63CF\u76EE\u6807",goalHint:"\u6309\u300C\u8FD9\u5F20\u5361\u89E3\u51B3\u4EC0\u4E48\u95EE\u9898\u300D\u805A\u7C7B \u2014\u2014 \u6B63\u6587\u76F8\u4F3C\u5EA6\u6293\u4E0D\u5230\u7684\u505A\u6CD5\u5DEE\u5F02\uFF087z \u538B\u7F29 / tar \u5206\u53D1 / npm \u7626\u8EAB\uFF09\u4E5F\u80FD\u5F52\u5230\u4E00\u8D77",goalIdle:"\u70B9\u300C\u626B\u63CF\u76EE\u6807\u300D\uFF1A\u6A21\u578B\u5148\u7ED9\u6BCF\u5F20\u5361\u62BD\u4E00\u53E5\u76EE\u6807\uFF08\u9996\u6B21\u4F1A\u8C03\u6A21\u578B\uFF0C\u4E4B\u540E\u8D70\u7F13\u5B58\uFF09\uFF0C\u518D\u6309\u76EE\u6807\u805A\u7C7B",goalNone:"\u6CA1\u6709\u53D1\u73B0\u300C\u540C\u4E00\u76EE\u6807\u3001\u591A\u5F20\u5361\u300D\u7684\u7C07 \u{1F389}",goalStats:"\u5DF2\u7D22\u5F15 / \u672C\u6B21\u8C03\u7528",goalCards:"\u5F20\u5361",goalKeep:"\u90FD\u4FDD\u7559",goalMerge:"\u5408\u5E76\u8FD9\u4E00\u7EC4",goalMerged:"\u5DF2\u63D0\u4EA4\u5408\u5E76\uFF08\u65B0\u5361\u8FDB\u5BA1\u6838\u961F\u5217\uFF09",goalDone:"\u5DF2\u8BB0\u5F55\u300C\u90FD\u4FDD\u7559\u300D",goalFail:"\u76EE\u6807\u805A\u7C7B\u5931\u8D25",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",auditBodyFail:"\u6B63\u6587\u8BFB\u53D6\u5931\u8D25",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",routeAuto:"\u81EA\u52A8\uFF08\u6309\u6CE8\u518C\u987A\u5E8F\uFF09",captureFollowSession:"\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\uFF08\u84B8\u998F\u7528\u4F1A\u8BDD\u7684 provider/model\uFF09",captureFirstOnly:"\u4EC5\u8BD5\u9996\u9009\uFF08\u5931\u8D25\u5373\u505C\uFF0C\u4E0D\u8F6E\u6362\u515C\u5E95\uFF09",llmTest:"\u6D4B\u8BD5\u84B8\u998F\u8DEF\u7531",llmTestOk:"\u2713 \u8C03\u7528\u6210\u529F",llmTestFail:"\u2717 \u8C03\u7528\u5931\u8D25",llmCandidates:"\u5019\u9009\u6570",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",vcResidentDownShort:"\u672A\u8FD0\u884C",vcResidentDown:"\u5E38\u9A7B\u5B9E\u4F8B\u6CA1\u5728\u8FD0\u884C\uFF08\u7AEF\u53E3 {port} \u65E0\u54CD\u5E94\uFF09\u2014\u2014 \u70B9\u4E0B\u9762\u7684\u6309\u94AE\u7528\u65B0\u4EE3\u7801\u628A\u5B83\u62C9\u8D77\u6765\uFF1B\u62C9\u4E0D\u8D77\u6765\u65F6\u6267\u884C {cmd}\uFF0C\u5E76\u8D34\u4E00\u4E0B dsh-memory status \u7684\u8F93\u51FA",vcResidentUnmanagedShort:"\u672A\u6258\u7BA1",vcResidentUnmanaged:"\u5E38\u9A7B\u5B9E\u4F8B\u5728\u670D\u52A1 v{served}\uFF0C\u4F46**\u6CA1\u6709\u770B\u95E8\u72D7\u4FDD\u6D3B**\uFF08\u505C\u6B62 / \u786C\u6740\u540E\u6B8B\u7559\u7684\u5B64\u513F\uFF09\u2014\u2014 \u70B9\u4E0B\u9762\u7684\u6309\u94AE\u628A\u5B83\u91CD\u65B0\u6258\u7BA1\uFF08\u91CD\u65B0\u62C9\u4E00\u4E2A\u770B\u95E8\u72D7 + \u65B0\u5B9E\u4F8B\uFF09\uFF1B\u4E5F\u53EF\u4EE5\u6267\u884C {cmd}",vcResidentLockUnknownShort:"\u6258\u7BA1\u72B6\u6001\u672A\u77E5",vcResidentReplaceBlockedShort:"\u4E0D\u53EF\u66FF\u6362",vcResidentReplaceBlocked:"\u5E38\u9A7B\u5B9E\u4F8B**\u4E0D\u53EF\u66FF\u6362**\uFF08\u73AF\u5883\u9650\u5236\uFF09\uFF1A\u770B\u95E8\u72D7\u9501\u76EE\u5F55\u4E0D\u53EF\u5199\uFF08{err}\uFF1B{path}\uFF09\u2192 \u7AEF\u53E3\u4E0A\u4F1A**\u957F\u671F**\u505C\u5728 v{served}\u3002\u8FD9\u4E0D\u662F\u300C\u6682\u65F6\u843D\u540E\u300D\uFF1A\u81EA\u52A8\u66FF\u6362\u88AB\u6B63\u786E\u5730\u62D2\u7EDD\uFF08\u907F\u514D\u7559\u4E0B\u5B64\u513F\uFF09\u3002\u51FA\u8DEF\uFF1A\u4FEE\u590D\u8BE5\u76EE\u5F55\u6743\u9650\u540E\u6267\u884C {cmd}\uFF0C\u6216\u524D\u53F0\u89C2\u5BDF dsh-memory watchdog --port 7999",vcResidentLockUnknown:"\u5E38\u9A7B\u5B9E\u4F8B\u5728\u670D\u52A1 v{served}\uFF0C\u4F46**\u770B\u95E8\u72D7\u9501\u6587\u4EF6\u5199\u4E0D\u8FDB\u53BB**\uFF08\u53D7\u9650\u73AF\u5883\uFF1A\u6C99\u7BB1\u7981\u5199 / ACL / \u975E\u7CFB\u7EDF\u76D8\uFF09\u2192 \u65E0\u6CD5\u5224\u65AD\u5B83\u6709\u6CA1\u6709\u88AB\u6258\u7BA1\uFF08\u4E0D\u662F\u300C\u672A\u6258\u7BA1\u300D\uFF09\u3002\u539F\u56E0\uFF1A{err}\uFF08{path}\uFF09\u3002\u4FDD\u6D3B\u901A\u5E38\u4ECD\u7136\u6709\u6548\uFF1B\u70B9\u4E0B\u9762\u7684\u6309\u94AE\u53EF\u7528\u65B0\u4EE3\u7801\u91CD\u65B0\u6258\u7BA1\u4E00\u6B21\u3002",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",alignTitle:"\u7248\u672C\u5BF9\u9F50\u68C0\u67E5",alignRun:"\u5F00\u59CB\u68C0\u67E5",alignFix:"\u91CD\u5199\u63A5\u7EBF",alignFixConfirm:"\u91CD\u5199 MCP / hooks \u63A5\u7EBF\uFF1F\uFF08\u53EA\u78B0\u63D2\u4EF6\u81EA\u5DF1\u7684\u952E\uFF0C\u4E0D\u52A8\u4F60\u7684\u6570\u636E\u4E0E\u914D\u7F6E\uFF09",alignFixed:"\u63A5\u7EBF\u5DF2\u91CD\u5199\uFF1B\u82E5\u4E0A\u9762\u63D0\u793A\u300C\u5BBF\u4E3B\u8FDB\u7A0B\u65E7\u300D\uFF0C\u4ECD\u9700\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u5F00 DSH",alignFail:"\u5BF9\u9F50\u68C0\u67E5\u5931\u8D25",alignHint:"\u63D2\u4EF6\u5347\u7EA7\u53EA\u6362\u78C1\u76D8\u6587\u4EF6 \u2014\u2014 \u5BBF\u4E3B\u5185\u5B58\u91CC\u7684\u4E8B\u4EF6\u8BA2\u9605\u4E0E MCP / hooks \u91CC\u7684\u65E7\u8DEF\u5F84\u4E0D\u4F1A\u81EA\u5DF1\u66F4\u65B0\uFF0C\u8FD9\u91CC\u4E00\u6B21\u67E5\u6E05",alignIdle:"\u70B9\u300C\u5F00\u59CB\u68C0\u67E5\u300D\uFF1A\u5BF9\u6BD4\u5BBF\u4E3B / \u5E38\u9A7B\u5B9E\u4F8B / npm \u7684\u7248\u672C\uFF0C\u5E76\u68C0\u67E5 MCP\u3001hooks \u91CC\u662F\u5426\u6709\u65E7\u8DEF\u5F84\u4E0E\u65E7\u53C2\u6570",alignDisk:"\u78C1\u76D8",alignResident:"\u5E38\u9A7B\u5B9E\u4F8B",alignHost:"\u5BBF\u4E3B\u8FDB\u7A0B",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
|
|
@@ -58,7 +58,7 @@ var na=Object.create;var St=Object.defineProperty;var oa=Object.getOwnPropertyDe
|
|
|
58
58
|
-
|
|
59
59
|
|
|
60
60
|
## \u98CE\u9669/\u963B\u585E
|
|
61
|
-
- `},Zt={nav:"Memory",loading:"Loading\u2026",refresh:"Refresh",overview:"Memory Overview",total:"Cards",recent:"Added (7d)",tags:"Tags",searchPlaceholder:"Search memory\u2026",search:"Search",all:"All",kindProject:"Projects",kindKnowledge:"Knowledge",kindContent:"Content",kindPrompt:"Prompts",kindBusiness:"Business",kindTool:"Tools",kindMistake:"Mistakes",cardsTab:"Cards",graphTab:"Graph",graph:"Knowledge Graph",graphHint:"Nodes = cards; edges = [[links]] or shared tags. Click a node to read.",graphTip:"Left-click highlights \xB7 Shift+drag box-select \xB7 right-click menu \xB7 scroll zoom \xB7 drag to pan",rebuild:"Rebuild",reset:"Reset",expandAll:"Expand all",capped:"Showing the",clearFocus:"Clear highlight",empty:"Memory is empty. After a few conversations, valuable content is auto-captured.",emptyGraph:"No graph data yet.",open:"Read",updated:"Updated",created:"Created",source:"Source",close:"Close",vaultDir:"Vault directory",capture:"Auto capture",recall:"Auto recall",enabled:"on",disabled:"off",error:"Load failed",back:"Back to list",cardCount:"cards",nodes:"nodes",edges:"edges",memoryTitle:"Memory Library",memoryHint:"Your local second brain",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",enterFullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",exportGraph:"Export",openCard:"Open card",focusNeighbors:"Highlight links",copyName:"Copy name",noMatch:"No matching memory",clearFilter:"Clear filter",filterLabel:"Filter",sortRecent:"Recent",sortTitle:"Title",sortHot:"Hot",exportSel:"Export selected",clearSelection:"Clear selection",download:"Download",openNewTab:"Open in new tab",copyImage:"Copy image",done:"Done",downloaded:"Download started",openedTab:"Opened in new tab",copied:"Copied",exportedSel:" nodes exported",fullscreen:"Fullscreen",exitFull:"Exit fullscreen",copyFail:"Copy failed",timeDim:"Time",timeNew:"\u22643 days",timeRecent:"\u22642 weeks",timeMonth:"\u22641 month",timeOld:"Older",newBadge:"NEW",expand:"Expand",collapse:"Collapse",exportVault:"Export MD",exportJson:"Export JSON",exporting:"Exporting\u2026",exportedVault:"Vault exported",exportFail:"Export failed",importVault:"Import",importedVault:"Import complete",importedTotal:" / of ",importedTotalTail:"",importedQuarantine:" \xB7 pending review ",importedQuarantineTail:" (quarantined until approved)",importedSkipped:" \xB7 skipped ",importedSkippedTail:" (duplicate or empty)",importFail:"Import failed",location:"Choose location",saveAs:"Save as",saveAsUnsupported:"Choose-save-location not supported here",exportedTo:"Exported to",defaultDownloads:"default Downloads folder",exportCancel:"Export cancelled",manage:"Manage",tabUsage:"Usage / Today",tabOptimize:"Optimize",adminLoadFail:"Load failed: fully restart dsh-desktop so the host picks up the new /memory-eternal routes",retry:"Retry",mergeSimilar:"Merge similar",trendLabel:"Last 30 days trend",cleanStale:"\u{1F5D1}\uFE0F Clean stale",deletedStale:" stale cards cleaned",newCard:"New",tplDecision:"\u{1F4DD} Decision",tplBug:"\u{1F41B} Bug",tplMeeting:"\u{1F4CB} Meeting",tplWeekly:"\u{1F4CA} Weekly",createCard:"Create",cardTitle:"Title",cardBody:"Body",fbUseful:"Useful",fbIrr:"Irrelevant",todayAdd:"Added today",weekAdd:"Last 7d",byKind:"By kind",todayList:"Captured today",budgetLabel:"Session budget",budgetChars:"Budget chars",recallLimitLabel:"Recall limit",embeddingLabel:"Semantic recall",mergePairs:"Similar pairs (mergeable)",staleCards:"Stale (>90d)",noOptimize:"Nothing to organize, healthy \u{1F389}",refineTitle:"Conflict scan",refineScan:"Scan now",refineHint:"Similar cards can be merged; conflicts must be judged by a human \u2014 the scan is read-only, and data only moves after you choose (keeping one moves the other to the recycle bin, recoverable)",refineIdle:'Hit "Scan now": recall possibly-related card pairs, then let the model classify each as duplicate / complement / conflict / unrelated',refineNone:"No card pairs need your ruling this round \u{1F389}",refineFail:"Conflict scan failed",refineApplied:"Your ruling was recorded (it will not ask again)",refineRel_duplicate:"Duplicate (mergeable)",refineRel_complement:"Complement (keep both)",refineRel_conflict:"Conflict (needs your ruling)",refineRel_unrelated:"Unrelated",refineKeepA:"Keep A",refineKeepB:"Keep B",refineKeepBoth:"Keep both",refineMerge:"Merge",junkTitle:"Injected junk cards",junkScan:"Scan existing",junkHint:"Cards suspected to be captured runtime injections (skill catalogs / system-reminders) \u2014 the scan is read-only and recycling goes to the recycle bin (recoverable)",junkIdle:'Hit "Scan existing": find cards whose body is really injected runtime text with almost no human content left after stripping',junkNone:"No such cards found \u{1F389}",junkRecycle:"Recycle",junkRecycleAll:"Recycle all",junkRecycleAllConfirm:"Send these cards to the recycle bin? (Not a permanent delete \u2014 recoverable from the recycle center)",junkDone:"Sent to recycle bin",junkFail:"Scan / recycle failed",dbReadonlyTitle:"The memory database is currently not writable",dbReadonlyBody:"Card reads/writes, auditing and the graph will fail, but **settings can still be saved** (they do not go through the database)",dbReadonlyFix:"Diagnose with: dsh-memory doctor (journal mode, write probe, backups and recovery steps)",goalTitle:"Same goal, different approach",goalScan:"Scan goals",goalHint:'Clusters by "what problem does this card solve" \u2014 approaches that differ in wording (7z vs tar vs npm slimming) still land together',goalIdle:'Hit "Scan goals": the model first writes a one-line goal per card (first run calls the model, later runs use the cache), then clusters by goal',goalNone:'No clusters of "one goal, several cards" found \u{1F389}',goalStats:"indexed / calls this run",goalCards:"cards",goalKeep:"Keep all",goalMerge:"Merge this group",goalMerged:"Merge submitted (the new card goes to the audit queue)",goalDone:'Recorded as "keep all"',goalFail:"Goal clustering failed",oneClickOptimize:"One-click optimize",oneClickOptimizeConfirm:"Confirm one-click optimize? This will merge all similar pairs (stale cards are NOT deleted by default).",oneClickAlsoStale:"Also clean stale cards",oneClickOptimizeDone:"One-click optimize done",optimizedMerged:"pairs merged",optimizedStaleDeleted:"stale cards cleaned",mcpSetupStatus:"Agent MCP mount status",rerunSetup:"Re-run setup",notInstalled:"not installed",noMcpEntry:"no MCP entry",nodePathMismatch:"node path mismatch, consider re-running setup",nodePathNote:"different node env (usable)",healthy:"healthy",mcpSetupHint:'"Auto-mount MCP" = lets Claude Code / Codex / Cursor use the memory vault. On = auto-configures them; Off = never touches your machine config, run dsh-memory setup manually when needed.',mcpManageHint:"Use each agent row to install/uninstall MCP individually",tabConfig:"Memory Config",tabAudit:"Audit Center",statusApproved:"Approved",statusPending:"Pending",statusRejected:"Rejected",allStatus:"All statuses",tabRecycle:"Recycle Bin",pending:"Pending",rejected:"Rejected",selectAll:"Select all",approve:"Approve",reject:"Reject",allAgents:"All agents",noAuditItems:"No items to review",auditBodyFail:"Failed to load the card body",deletedAt:"deleted",restore:"Restore",restoreDelete:"Delete to recycle",purge:"Purge",emptyRecycle:"Recycle bin is empty",recycleHint:"Deleted cards go to the recycle bin \u2014 recover within 30 days, else auto-purged",purgeConfirm:"Permanently delete? This cannot be undone.",recycleDeleteConfirm:"Delete to recycle? Recoverable within 30 days.",modeInit:"Init once",modeInterval:"Interval keep-alive",modeManual:"Manual only",serviceConfig:"Service self-hosting config",auditConfig:"Auto-audit config",auditHint:"Cards matching an exemption go straight in; others await audit",auditMode:"Audit mode",auditAll:"Audit all",auditNone:"Skip all",auditExemptAgents:"Exempt agents",auditExemptKinds:"Exempt kinds",allExempt:"Exempt all",recycleDays:"Recycle retention days",editInSetting:"Edit in DSH Settings \u2192 Memory",pendingSyncNote:'This is the standalone web page: the DSH host applies a save (a current host is woken up and applies it in a request context, so saving takes effect immediately); when no DSH host is running here the change goes straight into the shared config. Only an older host falls back to "queued until it syncs on its own" \u2014 in that case change the same option under DSH Settings \u2192 Memory.',readonlyTitle:"This page is read-only; config cannot be saved here",readonlyBody:"This process has no DSH settings service (settings.update is unavailable). Edit the config in DSH: desktop app \u2192 Settings \u2192 Memory.",readonlyBtn:"Read-only",setupRunInTerminal:"Copy this command to your terminal:",dshMemoryConfig:"DSH Memory Config",autoCapture:"Auto capture",autoRecall:"Auto recall",captureMinChars:"Min capture chars",maxCardsPerDay:"Daily quota",dedupThreshold:"Dedup threshold",recallLimit:"Recall limit",vaultMulti:"Multiple vaults (per project)",vaultMultiHint:"Empty = single vault; existing setups unaffected",vaultNow:"Active now",vaultSource:"Source",vaultWorkspace:"Current workspace",vaultNamePh:"Name, e.g. work",vaultPathPh:"Directory, e.g. D:/vaults/work",vaultMatchPh:"Project dir (optional, auto-select by workspace)",vaultAdd:"Add a vault",vaultActive:"Active vault",vaultActiveNone:"Default vault (unset)",vaultSrcEnv:"env MEMORY_VAULT_DIR",vaultSrcProfile:"activeVault profile",vaultSrcWorkspace:"matched by project dir",vaultSrcVaultDir:"vaultDir setting",vaultSrcDefault:"default directory",fbNav:"Report a bug",fbTitle:"Report a bug (files on GitHub)",fbDesc:"Describe the problem (symptoms / steps / expected)",fbDiag:"Diagnostics (auto-redacted: home dir and keys/tokens replaced)",fbCopyDiag:"Copy diagnostics",fbOpenIssue:"Open prefilled issue on GitHub",fbCopyPrompt:"Copy AI prompt",fbCopiedDiag:"Diagnostics copied",fbCopiedPrompt:"Prompt copied \u2014 paste it into your AI chat",fbCopyFail:"Copy failed; please select and copy manually",fbWhy:"GitHub does not allow anonymous issue creation and the plugin must not ship a token: so the title, body and diagnostics are pre-filled \u2014 you just click Submit.",fbNeedDesc:"Please describe the problem first",fbLoading:"Collecting diagnostics\u2026",fbDiagFail:"Diagnostics endpoint unavailable (standalone web or older host); please add environment info manually",fbOr:"or",fbSelectAll:"Select all",toastApproved:"approved",toastRejected:"rejected",toastCardDeleted:"deleted",toastRestored:"restored",toastPurged:"permanently deleted",toastPurgedExpired:"expired recycle entries purged",toastFailed:"Action failed",noSelection:"Select the cards to act on first",enabledLabel:"Enable memory core",vaultDirLabel:"Vault directory (single)",captureCooldownMs:"Capture cooldown (ms)",captureProvider:"Distill provider (auto if empty)",captureModel:"Distill model (auto if empty)",recallEmbedding:"Semantic recall provider (optional)",sessionBudgetChars:"Session budget (chars)",saving:"Saving\u2026",savePending:"Saved to the config file; the host half is still the old build, so restart DSH to make it effective (already applied in this panel)",saveInvalid:"Some field values are invalid; nothing was submitted",invalidField:'"{field}" must be a number between {min} and {max} (now: {value})',actionRunning:"Working\u2026",recycleEmptyHint:"Recycle bin is empty: deleted cards land here first and are purged automatically after {days} days.",recyclePurgeAll:"Empty recycle bin",fbCopyManual:"Auto-copy was blocked by the browser \u2014 the text is below: click Select all, then Ctrl+C",vcLoaded:"running (process serving this page)",vcResident:"resident instance",vcOnDisk:"on disk",vcLatest:"npm latest",vcStale:'v{disk} is installed on disk but the process serving this page still has v{loaded} loaded \u2014 click "Restart resident instance" to restart it on the new code (no DSH restart needed)',vcRestart:"Restart resident instance",vcRestarting:"Restarting\u2026",vcRestartSent:"Resident restart scheduled: the new process takes over in ~3-8s \u2014 refresh the page (Ctrl+F5) shortly",vcRestartCurrent:"The resident instance is already up to date \u2014 no restart needed",vcRestartFail:"Restart request failed",vcRestartNoRoute:"The process serving this page is still the old build (no such endpoint): restart the desktop app / DSH and retry, or run {cmd}",vcHostStale:'The "running" chip above comes from the process serving this page; the resident instance is already current \u2014 restart the desktop app / DSH to refresh that chip',vcResidentDownShort:"not running",vcResidentDown:"The resident instance is not running (no response on port {port}) \u2014 use the button below to bring it up on the new code; if that fails run {cmd} and share the output of dsh-memory status",vcResidentUnmanagedShort:"unmanaged",vcResidentUnmanaged:"The resident instance serves v{served} but has **no watchdog keeping it alive** (an orphan left by a stop or a hard kill) \u2014 use the button below to put it back under management (a fresh watchdog plus a new instance), or run {cmd}",vcResidentLockUnknownShort:"management unknown",vcResidentReplaceBlockedShort:"cannot replace",vcResidentReplaceBlocked:'The resident instance **cannot be replaced** (environment limit): the watchdog lock directory is not writable ({err}; {path}) \u2192 the port will stay on v{served} **long-term**. This is not "temporarily behind": automatic replacement is refused on purpose to avoid leaving an orphan. Way out: fix that directory permissions and run {cmd}, or run dsh-memory watchdog --port 7999 in the foreground',vcResidentLockUnknown:'The resident instance serves v{served}, but the **watchdog lock file cannot be written** (restricted environment: sandbox, ACLs, non-system drive) \u2192 whether it is managed cannot be determined (this is not "unmanaged"). Cause: {err} ({path}). Keep-alive usually still works; the button below can put it back under management on the new code.',vcPage:"Page script",vcPageStale:"\u26A0 This page is still running an older script (page v{page} / disk v{disk}): press Ctrl+F5 to refresh. If the running version is still old, restart the desktop app / DSH as well",vcOutdated:"update available",vcUpToDate:"up to date",vcCheck:"Check for updates",checking:"Checking\u2026",vcCheckFail:"Update check failed",recallSummaryLen:"Recall summary len",recallBody:"Recall with body",secretHint:"Credential hint (injected into every session)",autoWeb:"Web server",autoWebMode:"Keep-alive mode",webPort:"Web port",webCheckIntervalMs:"Probe interval (ms)",webMaxRestart:"Max restart",watchdogAutoSpawn:"Watchdog process",autoRestartOnDrift:"Auto-restart resident on version drift",autoMcpSetup:"Auto-mount MCP",saveConfig:"Save config",saveFail:"Save failed",savedOk:"Saved",savedDirect:"No DSH host is running here, so the change went straight into the shared config (hooks / MCP / the standalone page pick it up immediately)",savedApplied:"Saved and applied (the host applied it in a request context)",saveQueued:"Handed to the DSH host for sync \u2014 not confirmed applied yet",saveHostGuard:"This host does not let a plugin write config from its own callback context; change the same option under DSH Settings \u2192 Memory, or edit the profile patch layer",saveFailHint:"the host did not apply it \u2014 see Diagnostics under Report a bug",recallTool:"recall tool",costControl:"Cost control",costHint:"save tokens, control LLM usage",distillEnabled:"Distill cards (on=LLM compress, off=raw cards zero LLM)",dedupByLLM:"Dedup feeds LLM (off=pure lexical, cheaper)",captureMaxTokens:"Distill output cap (tokens)",recallMinScore:"Recall min score (higher = cheaper)",configNeedsDsh:"Edit config inside DSH (this page may be read-only or partially missing)",installMcp:"Install MCP",uninstallMcp:"Uninstall MCP",uninstallConfirm:"Confirm uninstall MCP for this agent? Claude Code/Codex will lose access to the memory vault.",presetConfig:"One-click preset config",presetHint:"Click to fill a plan, then hit Save",planA:"A Light",planB:"B Budget",planC:"C Premium",pluginInfo:"Plugin info",organizeTitle:"Organize",scanAndOrganize:"Scan & organize",scanHint:'Click "\u{1F50D} Scan & organize" to find similar/stale cards, then "\u26A1 One-click optimize" to run.',mergeNow:"Merge",delete:"Delete",captureAlert:"Auto-capture failed",captureAlertHint:'Open "Usage / Today" for the capture log; if the cause is an API/version mismatch, update the memory-eternal plugin.',captureLog:"Auto-capture log",captureLogHint:"Runs after every turn: listen \u2192 judge \u2192 write. Last 100 entries, so you can see why a card was not written.",captureLogEmpty:"No entries yet. Chat one turn (> min capture chars) and come back.",alignTitle:"Version alignment check",alignRun:"Check now",alignFix:"Rewrite wiring",alignFixConfirm:"Rewrite the MCP / hooks wiring? (Only the plugin's own keys are touched; your data and config stay as they are)",alignFixed:"Wiring rewritten; if it still reports an old host process, you must fully quit and reopen DSH",alignFail:"Alignment check failed",alignHint:"Upgrading the plugin only replaces files on disk \u2014 the host's in-memory event subscriptions and stale paths inside MCP / hooks do not update themselves; this checks all of it at once",alignIdle:'Hit "Check now": compare the host / resident / npm versions and look for stale paths and arguments in MCP and hooks',alignDisk:"disk",alignResident:"resident",alignHost:"host process",captureLogUnavailable:"Log is available only inside the DSH host (the standalone web page has no host runtime).",captureAgentCards:"Cards auto-captured by the agent",noCards:"none",loadMore:"Load more",batchMerge:"Smart batch merge",mergeAllConfirm:"Merge similar-grouped cards into one each (keep kind), delete originals?",crossVault:"All vaults",deleteConfirm:"Delete this memory card? This cannot be undone.",deleted:"Deleted",deleteFail:"Delete failed",deleteSelected:"Delete selected",deletedSelected:" cards deleted",merge:"Merge",mergeNeed:"Select at least 2 cards",mergeConfirm:"Merge the selected cards into one and delete the originals?",merged:"Merged",mergeFail:"Merge failed",mcpInstalled:"\u2705 {agent} MCP installed",mcpUninstalled:"\u2705 {agent} MCP uninstalled",mcpActionFail:"\u274C {agent} MCP action failed: {error}",dshHostLabel:"DeepSeek Harness (current host)",restartHint:"Saved. autoWebMode/watchdogAutoSpawn take effect after restarting DSH; a resident watchdog is never stopped automatically \u2014 use dsh-memory stop / restart (#19)",conflictRefresh:"Config changed elsewhere \u2014 refresh and retry",untitled:"Untitled",tplBlank:"\u{1F4C4} Blank",tagsHint:"Tags (comma-separated)",connCount:"{n} connections",tplDecisionTags:"decision, plan",tplBugTags:"pitfall, lesson",tplMeetingTags:"meeting, minutes",tplWeeklyTags:"weekly report",tplDecisionBody:`# Tech decision: [title]
|
|
61
|
+
- `},Zt={nav:"Memory",loading:"Loading\u2026",refresh:"Refresh",overview:"Memory Overview",total:"Cards",recent:"Added (7d)",tags:"Tags",searchPlaceholder:"Search memory\u2026",search:"Search",all:"All",kindProject:"Projects",kindKnowledge:"Knowledge",kindContent:"Content",kindPrompt:"Prompts",kindBusiness:"Business",kindTool:"Tools",kindMistake:"Mistakes",cardsTab:"Cards",graphTab:"Graph",graph:"Knowledge Graph",graphHint:"Nodes = cards; edges = [[links]] or shared tags. Click a node to read.",graphTip:"Left-click highlights \xB7 Shift+drag box-select \xB7 right-click menu \xB7 scroll zoom \xB7 drag to pan",rebuild:"Rebuild",reset:"Reset",expandAll:"Expand all",capped:"Showing the",clearFocus:"Clear highlight",empty:"Memory is empty. After a few conversations, valuable content is auto-captured.",emptyGraph:"No graph data yet.",open:"Read",updated:"Updated",created:"Created",source:"Source",close:"Close",vaultDir:"Vault directory",capture:"Auto capture",recall:"Auto recall",enabled:"on",disabled:"off",error:"Load failed",back:"Back to list",cardCount:"cards",nodes:"nodes",edges:"edges",memoryTitle:"Memory Library",memoryHint:"Your local second brain",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",enterFullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",exportGraph:"Export",openCard:"Open card",focusNeighbors:"Highlight links",copyName:"Copy name",noMatch:"No matching memory",clearFilter:"Clear filter",filterLabel:"Filter",sortRecent:"Recent",sortTitle:"Title",sortHot:"Hot",exportSel:"Export selected",clearSelection:"Clear selection",download:"Download",openNewTab:"Open in new tab",copyImage:"Copy image",done:"Done",downloaded:"Download started",openedTab:"Opened in new tab",copied:"Copied",exportedSel:" nodes exported",fullscreen:"Fullscreen",exitFull:"Exit fullscreen",copyFail:"Copy failed",timeDim:"Time",timeNew:"\u22643 days",timeRecent:"\u22642 weeks",timeMonth:"\u22641 month",timeOld:"Older",newBadge:"NEW",expand:"Expand",collapse:"Collapse",exportVault:"Export MD",exportJson:"Export JSON",exporting:"Exporting\u2026",exportedVault:"Vault exported",exportFail:"Export failed",importVault:"Import",importedVault:"Import complete",importedTotal:" / of ",importedTotalTail:"",importedQuarantine:" \xB7 pending review ",importedQuarantineTail:" (quarantined until approved)",importedSkipped:" \xB7 skipped ",importedSkippedTail:" (duplicate or empty)",importFail:"Import failed",location:"Choose location",saveAs:"Save as",saveAsUnsupported:"Choose-save-location not supported here",exportedTo:"Exported to",defaultDownloads:"default Downloads folder",exportCancel:"Export cancelled",manage:"Manage",tabUsage:"Usage / Today",tabOptimize:"Optimize",adminLoadFail:"Load failed: fully restart dsh-desktop so the host picks up the new /memory-eternal routes",retry:"Retry",mergeSimilar:"Merge similar",trendLabel:"Last 30 days trend",cleanStale:"\u{1F5D1}\uFE0F Clean stale",deletedStale:" stale cards cleaned",newCard:"New",tplDecision:"\u{1F4DD} Decision",tplBug:"\u{1F41B} Bug",tplMeeting:"\u{1F4CB} Meeting",tplWeekly:"\u{1F4CA} Weekly",createCard:"Create",cardTitle:"Title",cardBody:"Body",fbUseful:"Useful",fbIrr:"Irrelevant",todayAdd:"Added today",weekAdd:"Last 7d",byKind:"By kind",todayList:"Captured today",budgetLabel:"Session budget",budgetChars:"Budget chars",recallLimitLabel:"Recall limit",embeddingLabel:"Semantic recall",mergePairs:"Similar pairs (mergeable)",staleCards:"Stale (>90d)",noOptimize:"Nothing to organize, healthy \u{1F389}",refineTitle:"Conflict scan",refineScan:"Scan now",refineHint:"Similar cards can be merged; conflicts must be judged by a human \u2014 the scan is read-only, and data only moves after you choose (keeping one moves the other to the recycle bin, recoverable)",refineIdle:'Hit "Scan now": recall possibly-related card pairs, then let the model classify each as duplicate / complement / conflict / unrelated',refineNone:"No card pairs need your ruling this round \u{1F389}",refineFail:"Conflict scan failed",refineApplied:"Your ruling was recorded (it will not ask again)",refineRel_duplicate:"Duplicate (mergeable)",refineRel_complement:"Complement (keep both)",refineRel_conflict:"Conflict (needs your ruling)",refineRel_unrelated:"Unrelated",refineKeepA:"Keep A",refineKeepB:"Keep B",refineKeepBoth:"Keep both",refineMerge:"Merge",junkTitle:"Injected junk cards",junkScan:"Scan existing",junkHint:"Cards suspected to be captured runtime injections (skill catalogs / system-reminders) \u2014 the scan is read-only and recycling goes to the recycle bin (recoverable)",junkIdle:'Hit "Scan existing": find cards whose body is really injected runtime text with almost no human content left after stripping',junkNone:"No such cards found \u{1F389}",junkRecycle:"Recycle",junkRecycleAll:"Recycle all",junkRecycleAllConfirm:"Send these cards to the recycle bin? (Not a permanent delete \u2014 recoverable from the recycle center)",junkDone:"Sent to recycle bin",junkFail:"Scan / recycle failed",dbReadonlyTitle:"The memory database is currently not writable",dbReadonlyBody:"Card reads/writes, auditing and the graph will fail, but **settings can still be saved** (they do not go through the database)",dbReadonlyFix:"Diagnose with: dsh-memory doctor (journal mode, write probe, backups and recovery steps)",goalTitle:"Same goal, different approach",goalScan:"Scan goals",goalHint:'Clusters by "what problem does this card solve" \u2014 approaches that differ in wording (7z vs tar vs npm slimming) still land together',goalIdle:'Hit "Scan goals": the model first writes a one-line goal per card (first run calls the model, later runs use the cache), then clusters by goal',goalNone:'No clusters of "one goal, several cards" found \u{1F389}',goalStats:"indexed / calls this run",goalCards:"cards",goalKeep:"Keep all",goalMerge:"Merge this group",goalMerged:"Merge submitted (the new card goes to the audit queue)",goalDone:'Recorded as "keep all"',goalFail:"Goal clustering failed",oneClickOptimize:"One-click optimize",oneClickOptimizeConfirm:"Confirm one-click optimize? This will merge all similar pairs (stale cards are NOT deleted by default).",oneClickAlsoStale:"Also clean stale cards",oneClickOptimizeDone:"One-click optimize done",optimizedMerged:"pairs merged",optimizedStaleDeleted:"stale cards cleaned",mcpSetupStatus:"Agent MCP mount status",rerunSetup:"Re-run setup",notInstalled:"not installed",noMcpEntry:"no MCP entry",nodePathMismatch:"node path mismatch, consider re-running setup",nodePathNote:"different node env (usable)",healthy:"healthy",mcpSetupHint:'"Auto-mount MCP" = lets Claude Code / Codex / Cursor use the memory vault. On = auto-configures them; Off = never touches your machine config, run dsh-memory setup manually when needed.',mcpManageHint:"Use each agent row to install/uninstall MCP individually",tabConfig:"Memory Config",tabAudit:"Audit Center",statusApproved:"Approved",statusPending:"Pending",statusRejected:"Rejected",allStatus:"All statuses",tabRecycle:"Recycle Bin",pending:"Pending",rejected:"Rejected",selectAll:"Select all",approve:"Approve",reject:"Reject",allAgents:"All agents",noAuditItems:"No items to review",auditBodyFail:"Failed to load the card body",deletedAt:"deleted",restore:"Restore",restoreDelete:"Delete to recycle",purge:"Purge",emptyRecycle:"Recycle bin is empty",recycleHint:"Deleted cards go to the recycle bin \u2014 recover within 30 days, else auto-purged",purgeConfirm:"Permanently delete? This cannot be undone.",recycleDeleteConfirm:"Delete to recycle? Recoverable within 30 days.",modeInit:"Init once",modeInterval:"Interval keep-alive",modeManual:"Manual only",serviceConfig:"Service self-hosting config",auditConfig:"Auto-audit config",auditHint:"Cards matching an exemption go straight in; others await audit",auditMode:"Audit mode",auditAll:"Audit all",auditNone:"Skip all",auditExemptAgents:"Exempt agents",auditExemptKinds:"Exempt kinds",allExempt:"Exempt all",recycleDays:"Recycle retention days",editInSetting:"Edit in DSH Settings \u2192 Memory",pendingSyncNote:'This is the standalone web page: the DSH host applies a save (a current host is woken up and applies it in a request context, so saving takes effect immediately); when no DSH host is running here the change goes straight into the shared config. Only an older host falls back to "queued until it syncs on its own" \u2014 in that case change the same option under DSH Settings \u2192 Memory.',readonlyTitle:"This page is read-only; config cannot be saved here",readonlyBody:"This process has no DSH settings service (settings.update is unavailable). Edit the config in DSH: desktop app \u2192 Settings \u2192 Memory.",readonlyBtn:"Read-only",setupRunInTerminal:"Copy this command to your terminal:",dshMemoryConfig:"DSH Memory Config",autoCapture:"Auto capture",autoRecall:"Auto recall",captureMinChars:"Min capture chars",maxCardsPerDay:"Daily quota",dedupThreshold:"Dedup threshold",recallLimit:"Recall limit",vaultMulti:"Multiple vaults (per project)",vaultMultiHint:"Empty = single vault; existing setups unaffected",vaultNow:"Active now",vaultSource:"Source",vaultWorkspace:"Current workspace",vaultNamePh:"Name, e.g. work",vaultPathPh:"Directory, e.g. D:/vaults/work",vaultMatchPh:"Project dir (optional, auto-select by workspace)",vaultAdd:"Add a vault",vaultActive:"Active vault",vaultActiveNone:"Default vault (unset)",vaultSrcEnv:"env MEMORY_VAULT_DIR",vaultSrcProfile:"activeVault profile",vaultSrcWorkspace:"matched by project dir",vaultSrcVaultDir:"vaultDir setting",vaultSrcDefault:"default directory",fbNav:"Report a bug",fbTitle:"Report a bug (files on GitHub)",fbDesc:"Describe the problem (symptoms / steps / expected)",fbDiag:"Diagnostics (auto-redacted: home dir and keys/tokens replaced)",fbCopyDiag:"Copy diagnostics",fbOpenIssue:"Open prefilled issue on GitHub",fbCopyPrompt:"Copy AI prompt",fbCopiedDiag:"Diagnostics copied",fbCopiedPrompt:"Prompt copied \u2014 paste it into your AI chat",fbCopyFail:"Copy failed; please select and copy manually",fbWhy:"GitHub does not allow anonymous issue creation and the plugin must not ship a token: so the title, body and diagnostics are pre-filled \u2014 you just click Submit.",fbNeedDesc:"Please describe the problem first",fbLoading:"Collecting diagnostics\u2026",fbDiagFail:"Diagnostics endpoint unavailable (standalone web or older host); please add environment info manually",fbOr:"or",fbSelectAll:"Select all",toastApproved:"approved",toastRejected:"rejected",toastCardDeleted:"deleted",toastRestored:"restored",toastPurged:"permanently deleted",toastPurgedExpired:"expired recycle entries purged",toastFailed:"Action failed",noSelection:"Select the cards to act on first",enabledLabel:"Enable memory core",vaultDirLabel:"Vault directory (single)",captureCooldownMs:"Capture cooldown (ms)",captureProvider:"Distill provider (auto if empty)",routeAuto:"Auto (registration order)",captureFollowSession:"Follow current session (distill with the session provider/model)",captureFirstOnly:"First candidate only (stop on failure, no fallback)",llmTest:"Test distill route",llmTestOk:"\u2713 Call succeeded",llmTestFail:"\u2717 Call failed",llmCandidates:"candidates",captureModel:"Distill model (auto if empty)",recallEmbedding:"Semantic recall provider (optional)",sessionBudgetChars:"Session budget (chars)",saving:"Saving\u2026",savePending:"Saved to the config file; the host half is still the old build, so restart DSH to make it effective (already applied in this panel)",saveInvalid:"Some field values are invalid; nothing was submitted",invalidField:'"{field}" must be a number between {min} and {max} (now: {value})',actionRunning:"Working\u2026",recycleEmptyHint:"Recycle bin is empty: deleted cards land here first and are purged automatically after {days} days.",recyclePurgeAll:"Empty recycle bin",fbCopyManual:"Auto-copy was blocked by the browser \u2014 the text is below: click Select all, then Ctrl+C",vcLoaded:"running (process serving this page)",vcResident:"resident instance",vcOnDisk:"on disk",vcLatest:"npm latest",vcStale:'v{disk} is installed on disk but the process serving this page still has v{loaded} loaded \u2014 click "Restart resident instance" to restart it on the new code (no DSH restart needed)',vcRestart:"Restart resident instance",vcRestarting:"Restarting\u2026",vcRestartSent:"Resident restart scheduled: the new process takes over in ~3-8s \u2014 refresh the page (Ctrl+F5) shortly",vcRestartCurrent:"The resident instance is already up to date \u2014 no restart needed",vcRestartFail:"Restart request failed",vcRestartNoRoute:"The process serving this page is still the old build (no such endpoint): restart the desktop app / DSH and retry, or run {cmd}",vcHostStale:'The "running" chip above comes from the process serving this page; the resident instance is already current \u2014 restart the desktop app / DSH to refresh that chip',vcResidentDownShort:"not running",vcResidentDown:"The resident instance is not running (no response on port {port}) \u2014 use the button below to bring it up on the new code; if that fails run {cmd} and share the output of dsh-memory status",vcResidentUnmanagedShort:"unmanaged",vcResidentUnmanaged:"The resident instance serves v{served} but has **no watchdog keeping it alive** (an orphan left by a stop or a hard kill) \u2014 use the button below to put it back under management (a fresh watchdog plus a new instance), or run {cmd}",vcResidentLockUnknownShort:"management unknown",vcResidentReplaceBlockedShort:"cannot replace",vcResidentReplaceBlocked:'The resident instance **cannot be replaced** (environment limit): the watchdog lock directory is not writable ({err}; {path}) \u2192 the port will stay on v{served} **long-term**. This is not "temporarily behind": automatic replacement is refused on purpose to avoid leaving an orphan. Way out: fix that directory permissions and run {cmd}, or run dsh-memory watchdog --port 7999 in the foreground',vcResidentLockUnknown:'The resident instance serves v{served}, but the **watchdog lock file cannot be written** (restricted environment: sandbox, ACLs, non-system drive) \u2192 whether it is managed cannot be determined (this is not "unmanaged"). Cause: {err} ({path}). Keep-alive usually still works; the button below can put it back under management on the new code.',vcPage:"Page script",vcPageStale:"\u26A0 This page is still running an older script (page v{page} / disk v{disk}): press Ctrl+F5 to refresh. If the running version is still old, restart the desktop app / DSH as well",vcOutdated:"update available",vcUpToDate:"up to date",vcCheck:"Check for updates",checking:"Checking\u2026",vcCheckFail:"Update check failed",recallSummaryLen:"Recall summary len",recallBody:"Recall with body",secretHint:"Credential hint (injected into every session)",autoWeb:"Web server",autoWebMode:"Keep-alive mode",webPort:"Web port",webCheckIntervalMs:"Probe interval (ms)",webMaxRestart:"Max restart",watchdogAutoSpawn:"Watchdog process",autoRestartOnDrift:"Auto-restart resident on version drift",autoMcpSetup:"Auto-mount MCP",saveConfig:"Save config",saveFail:"Save failed",savedOk:"Saved",savedDirect:"No DSH host is running here, so the change went straight into the shared config (hooks / MCP / the standalone page pick it up immediately)",savedApplied:"Saved and applied (the host applied it in a request context)",saveQueued:"Handed to the DSH host for sync \u2014 not confirmed applied yet",saveHostGuard:"This host does not let a plugin write config from its own callback context; change the same option under DSH Settings \u2192 Memory, or edit the profile patch layer",saveFailHint:"the host did not apply it \u2014 see Diagnostics under Report a bug",recallTool:"recall tool",costControl:"Cost control",costHint:"save tokens, control LLM usage",distillEnabled:"Distill cards (on=LLM compress, off=raw cards zero LLM)",dedupByLLM:"Dedup feeds LLM (off=pure lexical, cheaper)",captureMaxTokens:"Distill output cap (tokens)",recallMinScore:"Recall min score (higher = cheaper)",configNeedsDsh:"Edit config inside DSH (this page may be read-only or partially missing)",installMcp:"Install MCP",uninstallMcp:"Uninstall MCP",uninstallConfirm:"Confirm uninstall MCP for this agent? Claude Code/Codex will lose access to the memory vault.",presetConfig:"One-click preset config",presetHint:"Click to fill a plan, then hit Save",planA:"A Light",planB:"B Budget",planC:"C Premium",pluginInfo:"Plugin info",organizeTitle:"Organize",scanAndOrganize:"Scan & organize",scanHint:'Click "\u{1F50D} Scan & organize" to find similar/stale cards, then "\u26A1 One-click optimize" to run.',mergeNow:"Merge",delete:"Delete",captureAlert:"Auto-capture failed",captureAlertHint:'Open "Usage / Today" for the capture log; if the cause is an API/version mismatch, update the memory-eternal plugin.',captureLog:"Auto-capture log",captureLogHint:"Runs after every turn: listen \u2192 judge \u2192 write. Last 100 entries, so you can see why a card was not written.",captureLogEmpty:"No entries yet. Chat one turn (> min capture chars) and come back.",alignTitle:"Version alignment check",alignRun:"Check now",alignFix:"Rewrite wiring",alignFixConfirm:"Rewrite the MCP / hooks wiring? (Only the plugin's own keys are touched; your data and config stay as they are)",alignFixed:"Wiring rewritten; if it still reports an old host process, you must fully quit and reopen DSH",alignFail:"Alignment check failed",alignHint:"Upgrading the plugin only replaces files on disk \u2014 the host's in-memory event subscriptions and stale paths inside MCP / hooks do not update themselves; this checks all of it at once",alignIdle:'Hit "Check now": compare the host / resident / npm versions and look for stale paths and arguments in MCP and hooks',alignDisk:"disk",alignResident:"resident",alignHost:"host process",captureLogUnavailable:"Log is available only inside the DSH host (the standalone web page has no host runtime).",captureAgentCards:"Cards auto-captured by the agent",noCards:"none",loadMore:"Load more",batchMerge:"Smart batch merge",mergeAllConfirm:"Merge similar-grouped cards into one each (keep kind), delete originals?",crossVault:"All vaults",deleteConfirm:"Delete this memory card? This cannot be undone.",deleted:"Deleted",deleteFail:"Delete failed",deleteSelected:"Delete selected",deletedSelected:" cards deleted",merge:"Merge",mergeNeed:"Select at least 2 cards",mergeConfirm:"Merge the selected cards into one and delete the originals?",merged:"Merged",mergeFail:"Merge failed",mcpInstalled:"\u2705 {agent} MCP installed",mcpUninstalled:"\u2705 {agent} MCP uninstalled",mcpActionFail:"\u274C {agent} MCP action failed: {error}",dshHostLabel:"DeepSeek Harness (current host)",restartHint:"Saved. autoWebMode/watchdogAutoSpawn take effect after restarting DSH; a resident watchdog is never stopped automatically \u2014 use dsh-memory stop / restart (#19)",conflictRefresh:"Config changed elsewhere \u2014 refresh and retry",untitled:"Untitled",tplBlank:"\u{1F4C4} Blank",tagsHint:"Tags (comma-separated)",connCount:"{n} connections",tplDecisionTags:"decision, plan",tplBugTags:"pitfall, lesson",tplMeetingTags:"meeting, minutes",tplWeeklyTags:"weekly report",tplDecisionBody:`# Tech decision: [title]
|
|
62
62
|
|
|
63
63
|
## Background
|
|
64
64
|
- Problem
|
|
@@ -103,7 +103,7 @@ Option A, because:
|
|
|
103
103
|
-
|
|
104
104
|
|
|
105
105
|
## Risks/blockers
|
|
106
|
-
- `},
|
|
106
|
+
- `},At=["all","project","knowledge","content","prompt","business","tool","mistake"],Ue={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},Vt=t=>Array.isArray(t&&t.tags)?t.tags:[],ht={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},_e={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},yt="deepseek-harness",pt=t=>{let i=String(t||""),r=i.toLowerCase();return!i||i==="agent"||i==="unknown"||i.startsWith("session:")||r.startsWith("claude-code")?r.startsWith("claude-code")?"claude":yt:r==="deepseek harness"?yt:i.split(":")[0]||yt},wa=[yt,"claude","codex","cursor","codex-desktop"],Qt=(t=[])=>[...new Set([...wa,...(t||[]).map(pt)])],Sa={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],warn:["\u26A0\uFE0F","#f59e0b"],fail:["\u274C","#ef4444"]},Oe=`
|
|
107
107
|
.memory-eternal-root { font-family: inherit; color: var(--dsw-alias-label-primary, #1f2937); }
|
|
108
108
|
.mc-card { background: var(--dsw-alias-bg-layer-1, #fff); border: 1px solid var(--dsw-alias-border-l1, #e5e7eb); border-radius: 12px; padding: 14px 16px; }
|
|
109
109
|
.mc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
|
|
@@ -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 Ca(t){t.effect(()=>t.locale.register(
|
|
301
|
+
`;function Ca(t){t.effect(()=>t.locale.register(rt,{zh:Jt,en:Zt}),"memory-eternal: locale");let i=t.locale.bind(rt);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:rt,order:25,label:()=>i("nav"),locale:rt,inject:()=>({})},()=>o.default.createElement(Ma,{t:i}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${rt}:footer`,order:100,label:()=>i("nav"),locale:rt,inject:()=>({})},r=>o.default.createElement(Ta,{t:i,locale:t.locale,wide:!(r&&r.wide===!1)}))),"memory-eternal: sidebar footer action")}function Na(){let[t,i]=(0,o.useState)(E+"/ui/app");return(0,o.useEffect)(()=>{let r=!0,g=()=>fetch("/memory-eternal/api/web-info").then(c=>c.json()).then(c=>{r&&c&&c.ok&&c.alive!==!1&&c.url&&i(c.url.endsWith("/")?c.url:c.url+"/")}).catch(()=>{});return fetch(E+"/ui/app",{method:"HEAD"}).then(c=>{if(r&&!c.ok)return g()}).catch(()=>r?g():void 0),()=>{r=!1}},[]),t}function Ma({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsx)(aa,{t,onReload:()=>{},version:0})]})}function Ta({t,locale:i,wide:r}){let[g,c]=(0,o.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${r?"":" rail"}`,children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsxs)("button",{type:"button",className:"me-footer-btn",onClick:()=>c(!0),"aria-label":t("nav"),title:t("nav"),children:[(0,e.jsx)("span",{className:"me-footer-ico","aria-hidden":"true",children:(0,e.jsx)(ea,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),g&&(0,e.jsx)(Ra,{t,locale:i,onClose:()=>c(!1)})]})}function Ra({t,locale:i,onClose:r,tab:g}){let[c,l]=(0,o.useState)(!1),C=(0,o.useRef)(null),R=Na(),S=(0,o.useCallback)(T=>i&&typeof i.subscribe=="function"?i.subscribe(T):()=>{},[i]),H=(0,o.useCallback)(()=>i&&typeof i.getSnapshot=="function"?i.getSnapshot():null,[i]),k=(0,o.useSyncExternalStore)(S,H),v=k&&(k.active==="zh"||k.active==="en")?k.active:null,m=(0,o.useRef)(null);m.current===null&&v&&(m.current=v);let I=(0,o.useMemo)(()=>{let T=m.current?`lang=${m.current}`:"";if(g==="config")return`${E}/ui/config?tab=config${T?`&${T}`:""}`;let w=R.replace(/\/$/,""),j=w.endsWith("/ui/app")?"?":"/?";return g?`${w}${j}tab=${g}${T?`&${T}`:""}`:T?`${w}${j}${T}`:R},[R,g]);return(0,o.useEffect)(()=>{let T=C.current&&C.current.contentWindow;T&&v&&T.postMessage({source:"memory-eternal",type:"locale",lang:v},"*")},[v]),(0,o.useEffect)(()=>{let T=w=>{w.key==="Escape"&&r()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:r,children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsx)("div",{className:"me-modal"+(c?" me-modal-full":""),onClick:T=>T.stopPropagation(),children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,position:"relative"},children:[(0,e.jsxs)("div",{style:{position:"absolute",top:8,right:8,zIndex:10,display:"flex",gap:4,padding:"4px 6px",background:"var(--dsw-alias-bg-overlay, rgba(17,24,39,0.45))",borderRadius:8,backdropFilter:"blur(4px)"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>l(T=>!T),"aria-label":t(c?"exitFullscreen":"enterFullscreen"),title:t(c?"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:c?"\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:C,src:I,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 ea(){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.33";function Da({t,inModal:i,onClose:r,onFull:g,full:c}){let[l,C]=(0,o.useState)(null),[R,S]=(0,o.useState)([]),[H,k]=(0,o.useState)(!0),[v,m]=(0,o.useState)(null),[I,T]=(0,o.useState)(""),[w,j]=(0,o.useState)("all"),[B,_]=(0,o.useState)(""),[te,q]=(0,o.useState)("all"),[F,Ie]=(0,o.useState)("all"),[V,fe]=(0,o.useState)(()=>{try{let a=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),y={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(a&&y[a])return y[a]}catch{}return"cards"}),[G,W]=(0,o.useState)(()=>new Set([V])),ie=(0,o.useCallback)(a=>{W(y=>y.has(a)?y:new Set(y).add(a)),fe(a)},[]),[ve,Ae]=(0,o.useState)("recent"),[ke,b]=(0,o.useState)(null),ce=(0,o.useRef)(null),Re=(0,o.useRef)(null),[h,$]=(0,o.useState)(!1),[le,ye]=(0,o.useState)(null),[Q,X]=(0,o.useState)(!1),[Be,Se]=(0,o.useState)(!1),[Te,Ce]=(0,o.useState)(!0),[s,N]=(0,o.useState)(null),[z,Z]=(0,o.useState)(0),se=(0,o.useCallback)(()=>Z(a=>a+1),[]),ue=l?.quarantine?.pending??0,J=l?.quarantine?.deleted??0,ee=(0,o.useRef)(null),[Ke,Le]=(0,o.useState)(0),[p,d]=(0,o.useState)(!1),O=(0,o.useRef)(null),re=(0,o.useRef)(null),me=(0,o.useCallback)(async(a=w,y=B,x=F,U={})=>{let D=U.append===!0;try{D?d(!0):(k(!0),T(""));let L=new URLSearchParams;a&&a!=="all"&&L.set("kind",a),y.trim()&&L.set("q",y.trim()),L.set("status",x||"all"),L.set("limit",String(xa)),L.set("offset",String(U.offset||0)),ve==="title"&&L.set("sort","title");let pe=await(await fetch(`${E}/cards?${L.toString()}`)).json();if(pe.ok){let ze=pe.cards||[];S(je=>D?[...je,...ze.filter(qe=>!je.some(vt=>vt.path===qe.path))]:ze),Le(Number(pe.total)||ze.length)}}catch(L){T(String(L&&L.message?L.message:L))}finally{D?d(!1):k(!1)}},[w,B,F,ve]),be=(0,o.useCallback)(async()=>{try{let[a,y]=await Promise.all([fetch(`${E}/overview`).then(x=>x.json()),fetch(`${E}/capture-log`).then(x=>x.json()).catch(()=>null)]);a.ok&&C(a),m(y&&y.ok&&y.available&&y.health||null)}catch(a){T(String(a&&a.message?a.message:a))}finally{k(!1)}},[]),n=async a=>{try{let x=await(await fetch(`${E}/delete?path=${encodeURIComponent(a)}`)).json();x.ok?(b({ok:!0,msg:t("deleted")}),await be(),se()):b({ok:!1,msg:x.error||t("deleteFail")})}catch{b({ok:!1,msg:t("deleteFail")})}ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>b(null),2e3)};(0,o.useEffect)(()=>(be(),()=>{ee.current&&clearTimeout(ee.current)}),[be]);let Ye=a=>{_(a),ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>me(w,a,F),280)},tt=a=>{j(a),me(a,B,F)};(0,o.useEffect)(()=>{V==="cards"&&me(w,B,F)},[F,V,z,ve]),(0,o.useEffect)(()=>{if(V!=="cards"||H||p||R.length>=Ke)return;let a=O.current,y=re.current;if(!a)return;let x=new IntersectionObserver(U=>{U[0]&&U[0].isIntersecting&&me(w,B,F,{append:!0,offset:R.length})},{root:y||null,rootMargin:"400px"});return x.observe(a),()=>x.disconnect()},[V,R,Ke,H,p,w,B,F,me]);let at=async a=>{try{let y=a.status;if(!y&&a.path)try{let Y=((await fetch(`${E}/cards?status=all&q=${encodeURIComponent(a.title||"")}&limit=50`).then(pe=>pe.json())).cards||[]).find(pe=>pe.path===a.path);Y&&(y=Y.status)}catch{}let x=y&&y!=="approved"?`&status=${encodeURIComponent(y)}`:"",U=await fetch(`${E}/card?path=${encodeURIComponent(a.path||a.id)}${x}`),D=await U.json();D.ok?ye({path:D.path,title:a.title,text:D.text}):T(D.error||`HTTP ${U.status}`)}catch(y){T(String(y&&y.message?y.message:y))}},Qe=async(a,y)=>{$(!0);try{let x=await fetch(`${E}/export`);if(!x.ok)throw new Error("HTTP "+x.status);let U=await x.json();if(!U.ok)throw new Error(U.error||"export failed");let D,L,Y;if(a==="json"){L="memory-vault.json",Y="application/json";let je=U.cards.map(qe=>({path:qe.path,title:qe.title,kind:qe.kind,status:qe.status,store:qe.store,text:qe.text}));D=JSON.stringify({format:U.format||"memory-eternal-vault",formatVersion:U.formatVersion||1,exportedAt:U.exportedAt||new Date().toISOString(),count:je.length,cards:je},null,2)}else L="memory-vault.md",Y="text/markdown;charset=utf-8",D=U.cards.map(je=>je.text.trim()).filter(Boolean).join(`
|
|
302
302
|
|
|
303
303
|
---
|
|
304
304
|
|
|
305
|
-
`);let De=new Blob([B],{type:Ne}),Ve=await $a(De,te,!1);if(!Ve.ok){Z({ok:!1,msg:t("exportFail")}),$(!1);return}Z({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+Ve.name})}catch(O){Z({ok:!1,msg:t("exportFail")+" \xB7 "+(O.message||"")})}finally{$(!1)}ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>Z(null),2600)},Ae=async d=>{let S=d.target.files&&d.target.files[0];if(d.target.value="",!!S){try{let O=await S.text(),B=await(await fetch(`${W}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:O})).json();if(B.ok){await ue();let te=B.imported||0,Ne=t("importedVault")+"\uFF1A"+te;B.total&&(Ne+=t("importedTotal")+B.total+t("importedTotalTail")),B.quarantined&&(Ne+=t("importedQuarantine")+B.quarantined+t("importedQuarantineTail")),B.skipped&&(Ne+=t("importedSkipped")+B.skipped+t("importedSkippedTail")),B.warning&&(Ne+=" \xB7 "+B.warning),Z({ok:te>0||!B.total,msg:Ne})}else Z({ok:!1,msg:B.error||t("importFail")})}catch{Z({ok:!1,msg:t("importFail")})}ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>Z(null),2400)}},c=(0,n.useMemo)(()=>{let d=D.slice();return ee!=="all"&&(d=d.filter(S=>ut(S.submittedBy)===ee)),P!=="all"&&(d=d.filter(S=>(S.status||"approved")===P)),ve==="title"?d.sort((S,O)=>String(S.title||"").localeCompare(String(O.title||""))):ve==="hot"?d.sort((S,O)=>(O.weight||O.links||0)-(S.weight||S.links||0)):d.sort((S,O)=>new Date(O.updated||0).getTime()-new Date(S.updated||0).getTime()),d},[D,ve,ee,P]),A=(0,n.useMemo)(()=>[...new Set(D.map(d=>ut(d.submittedBy)))],[D]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Ee}),we&&(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 "+(we.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:we.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:we.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:we.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)(ea,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),f&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:f,"aria-label":t(p?"exitFull":"fullscreen"),children:p?"\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${Se?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Te(d=>!d),"aria-label":t(Se?"collapse":"expand"),title:t(Se?"collapse":"expand"),children:Se?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="cards"?" active":""}`,onClick:()=>ie("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="graph"?" active":""}`,onClick:()=>ie("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="stats"?" active":""}`,onClick:()=>ie("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="audit"?" active":""}`,onClick:()=>ie("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")}),Ce>0&&(0,e.jsx)("span",{className:"mc-dot",children:Ce>99?"99+":Ce})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="optimize"?" active":""}`,onClick:()=>ie("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")}),de>0&&(0,e.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:de>99?"99+":de})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="config"?" active":""}`,onClick:()=>ie("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Me(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:pe,children:[i&&i.db&&i.db.writable===!1?(0,e.jsxs)("div",{style:{margin:"8px 10px 0",padding:"8px 12px",borderRadius:8,fontSize:12,lineHeight:1.7,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.35)",color:"#b91c1c"},children:["\u26A0\uFE0F ",t("dbReadonlyTitle"),"\uFF1A",i.db.error||"\u2014"," \u2014\u2014 ",t("dbReadonlyBody"),(0,e.jsx)("div",{style:{opacity:.85,marginTop:2},children:t("dbReadonlyFix")})]}):null,Y==="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"})]}),Y==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:L,onChange:d=>tt(d.target.value)}),(0,e.jsx)("input",{ref:je,type:"file",accept:".json,application/json",style:{display:"none"},onChange:Ae}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>je.current&&je.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>N({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:y,onClick:()=>nt("md"),children:t(y?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:y,onClick:()=>nt("json"),children:t(y?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ue(),children:t("refresh")})]}),Y==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[Bt.map(d=>(0,e.jsx)("button",{type:"button",className:`mc-chip${v===d?" active":""}`,onClick:()=>at(d),children:t(d==="all"?"all":Ke[d])},d)),(0,e.jsxs)("select",{value:ee,onChange:d=>V(d.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")]}),Qt(A).map(d=>(0,e.jsx)("option",{value:d,children:d},d))]}),(0,e.jsxs)("select",{value:P,onChange:d=>Ie(d.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(d=>(0,e.jsx)("button",{type:"button",className:`mc-chip${ve===d.key?" active":""}`,onClick:()=>x(d.key),children:d.label},d.key))]}),z&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",z]}),(0,e.jsx)("div",{style:{display:Y==="cards"?"contents":"none"},children:E?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):z?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",z," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ue(),children:t("retry")})]}):D.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:c.map(d=>(0,e.jsx)(Ba,{card:d,t,query:L.trim(),onOpen:xe,onDelete:a},d.path))}),D.length<Oe&&(0,e.jsx)("div",{ref:_,style:{height:1}}),u&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",D.length," / ",Oe,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:Y==="graph"?"flex":"none",flex:1,minHeight:0},children:J.has("graph")&&(0,e.jsx)(Fa,{t,onOpen:xe,all:re,onAllChange:ye,onMutate:ge,active:Y==="graph",visible:Y==="graph"})}),(0,e.jsx)("div",{style:{display:Y==="config"?"contents":"none"},children:J.has("config")&&(0,e.jsx)(aa,{t,onReload:()=>ue(),version:R})}),(0,e.jsx)("div",{style:{display:Y==="stats"?"contents":"none"},children:J.has("stats")&&(0,e.jsx)(La,{t,tab:"stats",onReload:()=>ue(),version:R})}),(0,e.jsx)("div",{style:{display:Y==="audit"?"contents":"none"},children:J.has("audit")&&(0,e.jsx)(za,{t,onReload:()=>ue(),version:R})}),(0,e.jsx)("div",{style:{display:Y==="optimize"?"contents":"none"},children:J.has("optimize")&&(0,e.jsx)(Ia,{t,onReload:()=>ue(),version:R})}),Be&&(0,e.jsx)(ja,{t,onClose:()=>Me(!1)}),le&&(0,e.jsx)(Pa,{t,card:le,query:L.trim(),onClose:()=>X(null),onDelete:d=>{X(null),a(d)},onFeedback:d=>{let S=le.path;fetch(`${W}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:L.trim(),path:S,useful:d})}).then(()=>Z({ok:!0,msg:t(d?"fbUseful":"fbIrr")})).catch(()=>{}),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>Z(null),2e3)}}),(0,e.jsx)(Aa,{t,newCard:l,setNewCard:N,onCreated:()=>{ue(),ge(),Z({ok:!0,msg:t("created")}),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>Z(null),2e3)}})]})]})]})}var ta=({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 aa({t,onReload:o,version:r,compact:f}){let[p,i]=(0,n.useState)(null),[w,D]=(0,n.useState)(0),[k,E]=(0,n.useState)(null),[C,h]=(0,n.useState)(null),[g,z]=(0,n.useState)(!1),[T,v]=(0,n.useState)(!1),j=(0,n.useRef)(!1),L=(0,n.useRef)(null),K=(0,n.useRef)({}),[ee,V]=(0,n.useState)(null),[P,Ie]=(0,n.useState)(null),[Y,be]=(0,n.useState)(""),[J,U]=(0,n.useState)(""),[ie,ve]=(0,n.useState)(""),[x,we]=(0,n.useState)(null),Z=(0,n.useCallback)(async c=>{U("version");try{let A=await fetch(W+"/version-check"+(c?"?force=1":"")).then(d=>d.json());A&&A.ok?(we(A),c&&X(A.updateAvailable?t("vcLatest")+" v"+A.latest:t("vcUpToDate"))):c&&X(t("vcCheckFail"),!1)}catch{c&&X(t("vcCheckFail"),!1)}finally{U("")}},[t]);(0,n.useEffect)(()=>{Z(!1)},[r,Z]);let[ce,je]=(0,n.useState)(""),[y,$]=(0,n.useState)(null),le=(0,n.useRef)(null),X=(c,A=!0)=>{le.current&&clearTimeout(le.current),$({msg:c,ok:A}),le.current=setTimeout(()=>$(null),1900)},re=async()=>{if(!J){U("restart");try{let c=await fetch(W+"/restart-self",{method:"POST"});if(c.status===404||c.status===405){X(R("vcRestartNoRoute",{cmd:x&&x.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let A=await c.json().catch(()=>null);if(!A){X(t("vcRestartFail")+"\uFF08HTTP "+c.status+"\uFF09",!1);return}if(!A.ok){X(A.error||t("vcRestartFail"),!1);return}if(A.alreadyCurrent){X(A.note||t("vcRestartCurrent"));return}X(A.note||t("vcRestartSent")),A.alreadyRunning||setTimeout(()=>{Z(!0)},6e3)}catch(c){X(t("vcRestartFail")+"\uFF1A"+String(c&&c.message||c),!1)}finally{U("")}}},ye=x&&x.resident?String(x.resident.served||""):"",Be=!!(x&&x.onDisk&&ye&&ye!==x.onDisk),Me=!!(x&&x.resident&&x.resident.managed===!1&&x.resident.managedKnown===!1),Se=x&&x.resident&&x.resident.replaceBlocked&&x.resident.replaceBlocked.fresh||null,Te=!!(x&&x.resident&&x.resident.managed===!1&&!Me),l=!!(x&&x.resident&&!ye),N=Be||l||Te||Me,R=(c,A)=>Object.keys(A).reduce((d,S)=>d.split("{"+S+"}").join(A[S]),t(c)),G=(0,n.useCallback)(async()=>{try{let[c,A,d]=await Promise.all([fetch(`${W}/config`).then(S=>S.json()).catch(()=>null),fetch(`${W}/setup-status`).then(S=>S.json()).catch(()=>null),fetch(`${W}/budget`).then(S=>S.json()).catch(()=>null)]);if(c&&c.ok){i(c),D(c.revision??0),E(c.schema??null);let S=qt(c.config??{},K.current);K.current=S.overlay,h({...S.values}),V(c.dsh??null),z(c.writable===!1),v(c.viaPending===!0),be(""),j.current=!1}else d&&d.ok?(h({...d}),z(!0),be(t("configNeedsDsh"))):be(t("adminLoadFail"));A&&A.ok&&Ie(A),ve("")}catch{be(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{G()},[r,G]);let ge=(c,A)=>{j.current=!0,h(d=>({...d??{},[c]:A}))};(0,n.useEffect)(()=>{L.current=G},[G]),(0,n.useEffect)(()=>{if(typeof EventSource>"u")return;let c=null;try{c=new EventSource(W+"/events")}catch{return}let A=()=>{!j.current&&typeof L.current=="function"&&L.current()};try{c.addEventListener("config",A)}catch{}return()=>{try{c.close()}catch{}}},[]);let Ce=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),de=c=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[c]||c,Q=async()=>{if(!C)return;if(g){X(t("editInSetting"),!1);return}let c={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]},A=[];for(let[d,[S,O]]of Object.entries(c)){if(!(d in C))continue;let F=C[d],B=typeof F=="number"?F:Number(F);(F===""||F===null||F===void 0||!Number.isFinite(B)||B<S||B>O)&&A.push(t("invalidField",{field:d,min:S,max:O,value:String(F===""?"\u7A7A":F)}))}if(A.length){let d=t("saveInvalid")+"\uFF1A"+A.join("\uFF1B");be(d),X(d,!1);return}U("save");try{let d={...C};for(let B of Object.keys(C))B in d&&typeof d[B]=="string"&&d[B].trim()!==""&&Ce.has(B)&&(d[B]=Number(d[B]));Array.isArray(d.vaultProfiles)&&(d.vaultProfiles=d.vaultProfiles.filter(B=>B&&(String(B.name||"").trim()||String(B.path||"").trim())));let S=await fetch(`${W}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:d,expectedRevision:w})}),O=await S.text(),F=null;try{F=O?JSON.parse(O):null}catch{F=null}if(F||(F={error:"HTTP "+S.status+(O?"\uFF1A"+O.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")}),F&&F.ok){let B=typeof F.pendingOutcome=="string"?F.pendingOutcome:"",te,Ne=!0;if(B==="applied")te=t("savedApplied")+(Array.isArray(F.applied)&&F.applied.length?" \xB7 "+F.applied.join("\u3001"):"");else if(B==="queued")Ne=!1,te=t("saveQueued");else if(B==="failed")Ne=!1,te=t("saveFail")+" \xB7 "+(F.hostGuard?t("saveHostGuard"):t("saveFailHint"));else if(B==="applied-direct")te=t("savedOk")+" \xB7 "+t("savedDirect");else{let De=Array.isArray(F.pending)&&F.pending.length?" \xB7 "+t("savePending"):F.note?" \xB7 "+t("restartHint"):"";te=(F.retried?"\u267B ":"")+t("savedOk")+De}K.current={...K.current,...d},Ne?ve(te):be(te),X(te,Ne),await G()}else{let B=S.status===409?t("conflictRefresh"):F?.error||t("saveFail");be(B),X(B,!1)}}catch{be(t("saveFail")),X(t("saveFail"),!1)}finally{U("")}},Oe=()=>{K.current={},h({...p?.config??{}}),ve("")},Le={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},u=c=>Array.isArray(c?.vaultProfiles)?c.vaultProfiles:[],s=(c,A,d)=>h(S=>{let O=u(S).map(B=>({...B||{}})),F={...O[c]||{}};return A==="match"?String(d).trim()?F.match={...F.match||{},workspace:d}:delete F.match:F[A]=d,O[c]=F,{...S??{},vaultProfiles:O}}),_=()=>h(c=>({...c??{},vaultProfiles:[...u(c),{name:"",path:""}]})),pe=c=>h(A=>({...A??{},vaultProfiles:u(A).filter((d,S)=>S!==c)})),se={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},ue={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},a={A:{label:t("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:4e3,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}},tt=async c=>{let A=a[c];A&&h(d=>({...d??{},...A}))},at=async(c,A)=>{U(c+A);try{let S=await(await fetch(`${W}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:c,action:A})})).json();S&&S.ok?X(R(A==="install"?"mcpInstalled":"mcpUninstalled",{agent:c})):X(R("mcpActionFail",{agent:c,error:S?.error||""}),!1);try{let O=await fetch(`${W}/setup-status`).then(F=>F.json());O&&O.ok&&Ie(O)}catch{}}catch{X(t("mergeFail"),!1)}finally{U("")}},xe=({k:c,label:A,type:d="text",step:S,min:O,max:F})=>(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:A||c}),(0,e.jsx)("input",{type:d,step:S,min:O,max:F,value:C?C[c]??"":"",onChange:B=>{let te=B.target.value;ge(c,d==="number"?te===""?"":Number(te):te)},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}})]}),nt=new Set(["autoRestartOnDrift"]),Ae=({k:c,label:A})=>{let d=C?C[c]:void 0,S=d===void 0?nt.has(c):!!d;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:S,onChange:O=>ge(c,O.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,e.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:A||c})]})};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:f?"0 0 auto":1,minHeight:0,maxHeight:f?"52vh":void 0},children:[(0,e.jsx)("style",{children:Ee}),y&&(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 "+(y.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:y.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:y.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:y.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[Y&&(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 ",Y]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:G,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")]}),g&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #f59e0b",background:"rgba(245,158,11,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#b45309"},children:["\u2139\uFE0F ",t("configNeedsDsh")," \u2014\u2014 ",t("editInSetting")]}),ie&&(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 ",ie]}),p&&(p.version||p.dsh?.vaultDir)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",t("pluginInfo")]}),(0,e.jsx)("span",{style:{fontSize:12,opacity:.7},children:t("dshHostLabel")}),p.version&&(0,e.jsxs)("code",{style:se,children:[t("vcLoaded")," v",p.version]}),x&&x.resident&&x.resident.served&&x.resident.served!==p.version&&(0,e.jsxs)("code",{style:se,children:[t("vcResident")," v",x.resident.served]}),x&&x.resident&&!x.resident.served&&(0,e.jsxs)("code",{style:{...se,color:"#b45309",fontWeight:600},children:[t("vcResident")," ",t("vcResidentDownShort")]}),x&&x.resident&&x.resident.served&&x.resident.managed===!1&&(0,e.jsxs)("code",{style:{...se,color:"#b45309",fontWeight:600},children:[t("vcResident")," v",x.resident.served," \xB7 ",t(Se?"vcResidentReplaceBlockedShort":Me?"vcResidentLockUnknownShort":"vcResidentUnmanagedShort")]}),bt&&(0,e.jsxs)("code",{style:se,children:[t("vcPage")," v",bt]}),x&&x.onDisk&&(0,e.jsxs)("code",{style:se,children:[t("vcOnDisk")," v",x.onDisk]}),x&&x.latest&&(0,e.jsxs)("code",{style:se,children:[t("vcLatest")," v",x.latest]}),p.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",p.dsh.vaultDir]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:J==="version",onClick:()=>Z(!0),children:J==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),x&&(x.stale||l||Te||Me||Se)&&(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 ",x.stale?R("vcStale",{disk:x.onDisk,loaded:x.loaded}):l?R("vcResidentDown",{port:x.resident&&x.resident.port||"",cmd:x.restartCommand||"dsh-memory restart --port 7999"}):Se?R("vcResidentReplaceBlocked",{served:ye,err:Se.error||"",path:Se.lockPath||"",cmd:x.restartCommand||"dsh-memory restart --port "+(x.resident&&x.resident.port||7999)}):Me?R("vcResidentLockUnknown",{served:ye,path:x.resident&&x.resident.lock&&x.resident.lock.path||"",err:x.resident&&x.resident.lock&&x.resident.lock.error||""}):R("vcResidentUnmanaged",{served:ye,cmd:x.restartCommand||"dsh-memory restart --port 7999"})]}),N?(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:!!J,onClick:re,children:J==="restart"?"\u23F3 "+t("vcRestarting"):"\u{1F504} "+t("vcRestart")}),x.restartCommand&&(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:x.restartCommand})]}):(0,e.jsxs)("div",{style:{marginTop:6,lineHeight:1.7},children:["\u2139\uFE0F ",t("vcHostStale"),x.restartCommand&&(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:x.restartCommand})]})]})]}),bt&&x&&x.onDisk&&bt!==x.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:x.onDisk})}),x&&x.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:x.updateCommand})]}),x&&x.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",x.checkError]})]}),P&&P.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:P.agents.map(c=>(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:c.isDsh?t("dshHostLabel"):c.name}),c.isDsh&&c.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",c.version]}),!c.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),c.installed&&c.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),c.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),c.mcpConfigured===!0&&c.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),c.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",c.recallTool?t("enabled"):t("disabled"),")"]})]}),c.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",c.hook]}),!c.isDsh&&c.installed&&c.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!J,onClick:()=>at(c.name,"install"),children:t("installMcp")}),!c.isDsh&&c.installed&&c.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!J,onClick:()=>{window.confirm(t("uninstallConfirm"))&&at(c.name,"uninstall")},children:t("uninstallMcp")})]},c.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),ce&&(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:ce})})]}),C?(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(c=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>tt(c),disabled:!!J,children:[c==="A"?"\u{1F7E2} ":c==="B"?"\u{1F4B0} ":"\u2B50 ",a[c].label]},c))})]}),(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)(Ae,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(Ae,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(xe,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(xe,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(xe,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(xe,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(xe,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(Ae,{k:"recallIncludeBody",label:t("recallBody")}),(0,e.jsx)(xe,{k:"secretHint",label:t("secretHint")}),(0,e.jsx)(xe,{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(Le[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]}),u(C).map((c,A)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:c.name||"",placeholder:t("vaultNamePh"),onChange:d=>s(A,"name",d.target.value),style:ue,disabled:g}),(0,e.jsx)("input",{value:c.path||"",placeholder:t("vaultPathPh"),onChange:d=>s(A,"path",d.target.value),style:ue,disabled:g}),(0,e.jsx)("input",{value:c.match&&c.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:d=>s(A,"match",d.target.value),style:ue,disabled:g}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>pe(A),disabled:g,title:t("delete"),children:"\u2715"})]},A)),(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:_,disabled:g,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:C.activeVault||"",onChange:c=>ge("activeVault",c.target.value),disabled:g,style:ue,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),u(C).filter(c=>c&&c.name).map(c=>(0,e.jsx)("option",{value:c.name,children:c.name},c.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)(Ae,{k:"enabled",label:t("enabledLabel")}),(0,e.jsx)(xe,{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)(Ae,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(Ae,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(xe,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(xe,{k:"recallMinScore",label:t("recallMinScore"),type:"number"}),(0,e.jsx)(xe,{k:"captureCooldownMs",label:t("captureCooldownMs"),type:"number"}),(0,e.jsx)(xe,{k:"captureProvider",label:t("captureProvider")}),(0,e.jsx)(xe,{k:"captureModel",label:t("captureModel")}),(0,e.jsx)(xe,{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:C.auditMode??"all",onChange:c=>ge("auditMode",c.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)(Gt,{label:t("auditExemptAgents"),value:C.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(P?.agents||[]).filter(c=>!c.isDsh).map(c=>({value:c.name,label:c.name}))],onChange:c=>ge("auditExemptAgents",c)}),(0,e.jsx)(Gt,{label:t("auditExemptKinds"),value:C.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...Bt.filter(c=>c!=="all").map(c=>({value:c,label:t(Ke[c])}))],onChange:c=>ge("auditExemptKinds",c)}),(0,e.jsx)(xe,{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)(Ae,{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:C.autoWebMode??"init",onChange:c=>ge("autoWebMode",c.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)(xe,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(xe,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(xe,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(Ae,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(Ae,{k:"autoRestartOnDrift",label:t("autoRestartOnDrift")}),(0,e.jsx)(Ae,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[J==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),ie&&J!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",ie]}),Y&&J!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",Y]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:Oe,disabled:!!J,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:g?()=>X(t("readonlyTitle")+"\uFF1A"+t("readonlyBody"),!1):Q,disabled:J==="save",title:t(g?"readonlyBody":"saveConfig"),children:J==="save"?"\u23F3 "+t("saving"):g?"\u{1F512} "+t("readonlyBtn"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function za({t,onReload:o,version:r}){let[f,p]=(0,n.useState)([]),[i,w]=(0,n.useState)([]),[D,k]=(0,n.useState)("all"),[E,C]=(0,n.useState)("all"),[h,g]=(0,n.useState)(""),[z,T]=(0,n.useState)(new Set),[v,j]=(0,n.useState)(""),[L,K]=(0,n.useState)(null),[ee,V]=(0,n.useState)("pending"),P=(y,$=!0)=>{K({msg:y,ok:$}),setTimeout(()=>K(null),3e3)},Ie=[...new Set([...f,...i].map(y=>y.submittedBy).filter(Boolean))],Y=(0,n.useCallback)(async()=>{try{let y=await fetch(`${W}/audit/list`).then($=>$.json());y.ok&&(p(y.pending||[]),w(y.rejected||[]),T(new Set),ve(new Set),we({}))}catch{}},[]);(0,n.useEffect)(()=>{Y()},[r,Y]);let be=(ee==="pending"?f:i).filter(y=>{if(D!=="all"&&y.kind!==D||E!=="all"&&ut(y.submittedBy)!==E)return!1;if(h){let $=(y.created||"").slice(0,10);if($&&$!==h)return!1}return!0}),J=y=>T($=>{let le=new Set($);return le.has(y)?le.delete(y):le.add(y),le}),U=async(y,$)=>{let le=$||[...z];if(!le.length){P(t("noSelection"),!1);return}j("apply");let X=t(y==="approved"?"toastApproved":y==="rejected"?"toastRejected":"toastCardDeleted");try{let re=0;for(let ye of le){let Be=y==="approved"?"audit/approve":y==="rejected"?"audit/reject":"delete";try{(await fetch(W+"/"+Be+"?path="+encodeURIComponent(ye)+(y==="delete"?"&permanent=0":""))).ok||re++}catch{re++}}await Y(),o&&o(),re?P(t("toastFailed")+"\uFF08"+re+"/"+le.length+"\uFF09",!1):P(X+" "+le.length+" \u5F20")}catch(re){P(t("toastFailed")+": "+String(re&&re.message||re),!1)}finally{j("")}},[ie,ve]=(0,n.useState)(new Set),[x,we]=(0,n.useState)({}),Z=y=>x[y]||{},ce=async y=>{let $=y.path,le=!ie.has($);if(ve(X=>{let re=new Set(X);return le?re.add($):re.delete($),re}),!(!le||x[$])){we(X=>({...X,[$]:{loading:!0}}));try{let X=y.status||(ee==="pending"?"pending":"rejected"),re=await fetch(`${W}/card?path=${encodeURIComponent($)}&status=${X}`).then(ye=>ye.json());re&&re.ok?we(ye=>({...ye,[$]:{text:re.text||""}})):we(ye=>({...ye,[$]:{error:re&&re.error||"HTTP"}}))}catch(X){we(re=>({...re,[$]:{error:String(X&&X.message||X)}}))}}},je=[...z];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:Ee}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ta,{toast:L}),(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:D,onChange:y=>k(y.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")}),Bt.filter(y=>y!=="all").map(y=>(0,e.jsx)("option",{value:y,children:t(Ke[y])},y))]}),(0,e.jsxs)("select",{value:E,onChange:y=>C(y.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")}),Qt(Ie).map(y=>(0,e.jsx)("option",{value:y,children:y},y))]}),(0,e.jsx)("input",{type:"date",value:h,onChange:y=>g(y.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:()=>V("pending"),children:[t("pending"),"\uFF08",f.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${ee==="rejected"?" me-on":""}`,onClick:()=>V("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:be.length>0&&je.length===be.length,onChange:y=>{y.target.checked?T(new Set(be.map($=>$.path))):T(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!je.length||!!v,onClick:()=>U("approved"),children:["\u2713 ",t(ee==="rejected"?"restore":"approve")]}),ee==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!je.length||!!v,onClick:()=>U("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!je.length||!!v,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&U("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),be.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:be.map(y=>{let $=Z(y.path),le=ie.has(y.path);return(0,e.jsxs)("div",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:z.has(y.path),onChange:()=>J(y.path)}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"0 6px"},title:t(le?"collapse":"expand"),"aria-expanded":le,onClick:()=>ce(y),children:le?"\u25BE":"\u25B8"}),(0,e.jsx)("span",{className:"mc-kind",style:{background:qe[y.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},title:t(le?"collapse":"expand"),onClick:()=>ce(y),children:y.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:ut(y.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:y.created?y.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:y.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:y.severity==="high"?"#f87171":"#9ca3af"},children:y.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.reason||"-"}),ee==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>U("approved",[y.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>U("rejected",[y.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:()=>U("approved",[y.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"))&&U("delete",[y.path])},children:"\u{1F5D1}"})]})]}),le&&(0,e.jsxs)("div",{style:{padding:"2px 10px 12px 34px"},children:[$.loading&&(0,e.jsxs)("div",{style:{fontSize:12,opacity:.6},children:["\u23F3 ",t("loading")]}),$.error&&(0,e.jsxs)("div",{style:{fontSize:12,color:"#f87171"},children:["\u26A0 ",t("auditBodyFail"),"\uFF1A",$.error]}),$.text!=null&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"md-meta",style:{marginBottom:6},children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:qe[y.kind]||"#6B7280",borderColor:(qe[y.kind]||"#6B7280")+"59",background:(qe[y.kind]||"#6B7280")+"1a"},children:[ht[y.kind]||"\u{1F4CE}"," ",t(Ke[y.kind]||"kindKnowledge")]}),(Array.isArray(y.tags)?y.tags:[]).slice(0,8).map(X=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",X]},X)),!!y.reason&&(0,e.jsxs)("span",{className:"md-chip md-chip-st-warn",children:["\u2691 ",y.reason]})]}),(0,e.jsx)("div",{className:"md-doc",style:{maxHeight:340,overflow:"auto"},dangerouslySetInnerHTML:{__html:Dt(Ct($.text).body)}}),ee==="pending"&&(0,e.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!!v,onClick:()=>U("approved",[y.path]),children:["\u2713 ",t("approve")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!v,onClick:()=>U("rejected",[y.path]),children:["\u2715 ",t("reject")]})]})]})]})]},y.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[f,p]=(0,n.useState)([]),[i,w]=(0,n.useState)(""),[D,k]=(0,n.useState)(null),E=(g,z=!0)=>{k({msg:g,ok:z}),setTimeout(()=>k(null),3200)},C=(0,n.useCallback)(async()=>{try{let g=await fetch(`${W}/recycle/list`).then(z=>z.json());g.ok&&p(g.items||[])}catch{}},[]);(0,n.useEffect)(()=>{C()},[r,C]);let h=async(g,z)=>{let T=(f.find(v=>v.path===z)||{}).title||z;w(g+z);try{let j=await fetch(W+(g==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(z)),L=await j.json().catch(()=>null);await C(),o&&o(),j.ok&&(!L||L.ok!==!1)?E(t(g==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+T):E(t("toastFailed")+"\uFF1A"+(L&&L.error||"HTTP "+j.status),!1)}catch(v){E(t("toastFailed")+"\uFF1A"+String(v&&v.message||v),!1)}finally{w("")}};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:Ee}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ta,{toast:D}),(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||f.length===0,title:f.length?"":t("emptyRecycle"),onClick:async()=>{w("purgeAll");try{let g=await fetch(W+"/recycle/purge-expired?days=0"),z=await g.json().catch(()=>null);await C(),E(g.ok?t("toastPurgedExpired")+(z&&z.purged!=null?"\uFF08"+z.purged+"\uFF09":""):t("toastFailed"),g.ok)}catch(g){E(t("toastFailed")+"\uFF1A"+String(g&&g.message||g),!1)}finally{w("")}},children:t("emptyRecycle")})]}),f.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:f.map(g=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:qe[g.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(g.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!i,onClick:()=>h("restore",g.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",g.path)},children:t("purge")})]},g.path))}):(0,e.jsxs)("div",{className:"mc-card",style:{padding:18,fontSize:12.5,opacity:.78,textAlign:"center",lineHeight:1.9},children:["\u{1F5D1}\uFE0F ",t("emptyRecycle"),(0,e.jsx)("br",{}),(0,e.jsx)("span",{style:{fontSize:11.5},children:t("recycleEmptyHint").split("{days}").join("30")})]})]})]})}var Ba=({card:t,t:o,onOpen:r,query:f,onDelete:p})=>(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:ht[t.kind]||"\u{1F4CE}"}),f?Xt(t.title,f):t.title,Wa(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:f?Xt(t.summary||"",f):t.summary||""}),Vt(t).length>0&&(0,e.jsx)("div",{className:"mc-tags",children:Vt(t).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:[ht[t.kind]||"\u{1F4CE}"," ",o(Ke[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"))&&p&&p(t.path)},children:"\u{1F5D1}"})]})]});function La({t,tab:o,onReload:r,version:f}){let[p,i]=(0,n.useState)(null),[w,D]=(0,n.useState)(""),[k,E]=(0,n.useState)(null),[C,h]=(0,n.useState)(null),[g,z]=(0,n.useState)(null),[T,v]=(0,n.useState)(null),j=(0,n.useCallback)(async()=>{P("align");try{let l=await fetch(W+"/align").then(N=>N.json());l&&l.findings?v(l):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{P("")}},[t]),L=async()=>{if(window.confirm(t("alignFixConfirm"))){P("alignfix");try{let l=await fetch(W+"/setup-run",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}).then(N=>N.json());l&&l.ok?(notify(t("alignFixed")),await j()):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{P("")}}},[K,ee]=(0,n.useState)([]),[V,P]=(0,n.useState)(""),[Ie,Y]=(0,n.useState)(!1),be=(0,n.useCallback)(async()=>{if(!(!k||!k.merge||!k.merge.length)&&window.confirm(t("mergeAllConfirm"))){P("merge");try{let l={},N=de=>l[de]===void 0?de:l[de]=N(l[de]),R=(de,Q)=>{l[N(de)]=N(Q)},G=new Set;for(let de of k.merge)G.add(de.a.path),G.add(de.b.path),R(de.a.path,de.b.path);let ge={};for(let de of G){let Q=N(de);(ge[Q]=ge[Q]||[]).push(de)}let Ce=0;for(let de of Object.values(ge)){if(de.length<2)continue;(await fetch(`${W}/merge?paths=${encodeURIComponent(de.join(","))}`).then(Oe=>Oe.json())).ok&&Ce++}await J(),r&&r()}catch{}P("")}},[k,J,r,t]);async function J(){try{let l=await Promise.all([fetch(`${W}/stats`),fetch(`${W}/budget`),fetch(`${W}/capture-log`),fetch(`${W}/cards?status=all&limit=30&agent=${yt}`)]),[N,R,G,ge]=await Promise.all(l.map(Ce=>Ce.json()));N&&N.ok&&i(N),R&&R.ok&&h(R),G&&G.ok&&z(G),ge&&ge.ok&&ee(ge.cards||[]),D(!N||!N.ok?t("adminLoadFail"):"")}catch{D(t("adminLoadFail"))}}let U=(0,n.useCallback)(async()=>{P("scan");try{let l=await fetch(`${W}/optimize`).then(N=>N.json());l.ok&&E(l)}catch{D(t("adminLoadFail"))}finally{P("")}},[t]),[ie,ve]=(0,n.useState)(null),x=(0,n.useCallback)(async()=>{P("refine");try{let l=await fetch(`${W}/refine-scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:8})}).then(N=>N.json());l&&l.ok?ve(l):notify(l&&l.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{P("")}},[t]),we=async(l,N)=>{if(!(N==="merge"&&!window.confirm(t("mergeConfirm")))){P("refineapply");try{let R=await fetch(`${W}/refine-apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({a:l.a.path,b:l.b.path,action:N,relation:l.relation})}).then(G=>G.json());R&&R.ok?(notify(t("refineApplied")),ve(G=>G&&{...G,findings:(G.findings||[]).filter(ge=>!(ge.a.path===l.a.path&&ge.b.path===l.b.path))}),await J(),r&&r()):notify(R&&R.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{P("")}}},[Z,ce]=(0,n.useState)(null),je=(0,n.useCallback)(async()=>{P("junk");try{let l=await fetch(`${W}/refine-junk`).then(N=>N.json());l&&l.ok?ce(l.items||[]):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{P("")}},[t]),y=async l=>{if(l.length&&window.confirm(t("junkRecycleAllConfirm"))){P("junkpurge");try{let N=await fetch(`${W}/refine-junk-purge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:l})}).then(R=>R.json());N&&N.removed?(notify(t("junkDone")+"\uFF1A"+N.removed.length+(N.failed?.length?"\uFF08\u5931\u8D25 "+N.failed.length+"\uFF09":"")),ce(R=>R&&R.filter(G=>!N.removed.includes(G.path))),await J(),r&&r()):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{P("")}}},[$,le]=(0,n.useState)(null),X=(0,n.useCallback)(async()=>{P("goals");try{let l=await fetch(W+"/refine-goals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:30})}).then(N=>N.json());l&&l.ok?le(l):notify(l&&l.error||t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{P("")}},[t]),re=async l=>{P("goalskeep");try{let N=await fetch(W+"/refine-goals-keep",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:l.members.map(R=>R.path)})}).then(R=>R.json());N&&N.ok?(notify(t("goalDone")),le(R=>R&&{...R,clusters:(R.clusters||[]).filter(G=>G.goal!==l.goal)})):notify(t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{P("")}},ye=async l=>{if(window.confirm(t("mergeConfirm"))){P("goalsmerge");try{let N=await fetch(W+"/merge?paths="+encodeURIComponent(l.members.map(R=>R.path).join(","))).then(R=>R.json());N&&N.ok?(notify(t("goalMerged")),le(R=>R&&{...R,clusters:(R.clusters||[]).filter(G=>G.goal!==l.goal)}),await J(),r&&r()):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{P("")}}};(0,n.useEffect)(()=>{J()},[f]);let Be=async(l,N)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${W}/merge?paths=${encodeURIComponent(l+","+N)}`).then(G=>G.json())).ok&&(await J(),r&&r())}catch{}},Me=async l=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${W}/delete?path=${encodeURIComponent(l)}`).then(R=>R.json())).ok&&(await J(),r&&r())}catch{}},Se=["project","knowledge","content","prompt","business","tool","mistake"],Te=({title:l,kind:N,updated:R,path:G})=>(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[N]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(R)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Me(G),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:Ee}),(0,e.jsxs)("div",{style:{overflow:"auto"},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:J,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{1F527} ",t("alignTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:j,children:t(V==="align"?"exporting":"alignRun")}),T&&T.counts&&T.counts.fix>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:L,children:t(V==="alignfix"?"exporting":"alignFix")}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("alignHint")})]}),T&&T.findings?(0,e.jsxs)("div",{style:{marginTop:6},children:[(0,e.jsxs)("div",{style:{fontSize:12,opacity:.75,marginBottom:4},children:[t("alignDisk")," v",T.onDisk||"?",T.residentServed?" \xB7 "+t("alignResident")+" v"+T.residentServed:"",T.hostVersion?" \xB7 "+t("alignHost")+" v"+T.hostVersion:""]}),(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:T.findings.map((l,N)=>(0,e.jsxs)("li",{style:{padding:"4px 2px",borderTop:N?"1px solid rgba(127,127,127,0.12)":"none",fontSize:12},children:[(0,e.jsx)("span",{style:{fontWeight:700,color:l.level==="fix"?"#ef4444":l.level==="warn"?"#f59e0b":"#10b981"},children:l.level==="fix"?"\u2717":l.level==="warn"?"\u26A0":"\u2713"})," ",(0,e.jsx)("span",{children:l.title}),l.detail?(0,e.jsx)("div",{style:{opacity:.75,marginLeft:14},children:l.detail}):null,l.command?(0,e.jsxs)("div",{style:{marginLeft:14,opacity:.9},children:["\u2192 ",(0,e.jsx)("code",{children:l.command})]}):null]},N))})]}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginTop:4},children:t("alignIdle")})]}),(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:()=>J(),children:["\u21BB ",t("refresh")]})]}),g?g.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(g.entries||[]).length===0?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogEmpty")}):(0,e.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,e.jsx)("tbody",{children:(g.entries||[]).map((l,N)=>{let R=Sa[l.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(l.time?new Date(l.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:R[1],fontWeight:600},children:[R[0]," ",l.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:l.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:l.preview||"",children:l.preview||""})]},N)})})})}):(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",K.length,"\uFF09"]}),K.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:K.map(l=>(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[l.kind]||qe.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.title}),l.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(l.updated)})]},l.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),p&&(0,e.jsxs)(e.Fragment,{children:[p.trend&&p.trend.length>0&&(()=>{let l=p.trend,N=Math.max(...l.map(Ce=>Ce.count),1),R=260,G=50,ge=R/l.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:R,height:G,style:{display:"block",width:"100%",height:50},children:l.map((Ce,de)=>{let Q=Math.round(Ce.count/N*(G-4));return(0,e.jsx)("rect",{x:de*ge+1,y:G-Q,width:Math.max(ge-2,2),height:Q,rx:1.5,fill:Ce.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:Ce.count>0?.85:.35},Ce.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.tags}),(0,e.jsx)("span",{children:t("tags")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("byKind")}),(0,e.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:Se.map(l=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[l]||"#666"}}),t(Ke[l]),": ",p.byKind?.[l]||0]},l))})]}),C&&(C.budgetChars||C.recallLimit||C.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:C.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:C.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",C.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",p.todayCards?.length||0,"\uFF09"]}),p.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:p.todayCards.map(l=>(0,e.jsx)(Te,{title:l.title,kind:l.kind,updated:l.updated,path:l.path},l.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:!!V,onClick:U,children:V==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),k&&k.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){P("oneclick");try{let l=JSON.stringify({cleanupStale:Ie}),R=await(await fetch(`${W}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:l})).json();R&&R.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${R.plan.merged} ${t("optimizedMerged")}${Ie?` \xB7 ${R.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await J(),r&&r(),E(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{P("")}}},children:V==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),k&&k.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:Ie,onChange:l=>Y(l.target.checked)}),t("oneClickAlsoStale")]})]}),!k&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),k&&(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}}),k.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:be,children:t(V==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),k.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:k.merge.map((l,N)=>(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:[l.a.title," \u21C4 ",l.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(l.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Be(l.a.path,l.b.path),children:t("mergeNow")})]},N))}):(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",k.stale?.length||0,"\uFF09"]}),k.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!V,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;P("clean");let l=0;for(let N of k.stale)try{await fetch(`${W}/delete?path=${encodeURIComponent(N.path)}`),l++}catch{}P(""),notify(`${l} ${t("deletedStale")}`),await J(),r&&r()},children:t("cleanStale")})}),k.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:k.stale.map(l=>(0,e.jsx)(Te,{title:l.title,kind:"other",updated:l.updated,path:l.path},l.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9ED} ",t("refineTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:x,children:t(V==="refine"?"exporting":"refineScan")}),(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("refineHint")})]}),ie?.findings?.length?ie.findings.map((l,N)=>(0,e.jsxs)("div",{style:{borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",padding:"7px 2px"},children:[(0,e.jsxs)("div",{style:{fontSize:12,marginBottom:3},children:[(0,e.jsx)("span",{style:{fontWeight:700,color:l.relation==="conflict"?"#ef4444":l.relation==="duplicate"?"#f59e0b":"#10b981"},children:t("refineRel_"+l.relation)}),(0,e.jsxs)("span",{style:{opacity:.55},children:[" \xB7 sim ",l.sim," \xB7 ",l.useModel||""]}),l.conflict?(0,e.jsx)("span",{style:{marginLeft:6},children:l.conflict}):null]}),(0,e.jsxs)("div",{style:{fontSize:12,opacity:.85,marginBottom:5},children:["A\uFF1A",l.a.title,(0,e.jsx)("br",{}),"B\uFF1A",l.b.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>we(l,"keepA"),children:t("refineKeepA")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>we(l,"keepB"),children:t("refineKeepB")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>we(l,"keepBoth"),children:t("refineKeepBoth")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>we(l,"merge"),children:t("refineMerge")})]})]},N)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(ie?"refineNone":"refineIdle")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9F9} ",t("junkTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:je,children:t(V==="junk"?"exporting":"junkScan")}),Z?.length?(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:()=>y(Z.map(l=>l.path)),children:t(V==="junkpurge"?"exporting":"junkRecycleAll")}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("junkHint")})]}),Z?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:Z.map((l,N)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 2px",borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",fontSize:12},children:[(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:l.reasons.join("\uFF1B"),children:l.title||l.path}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:l.reasons[0]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>y([l.path]),children:t("junkRecycle")})]},N))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(Z?"junkNone":"junkIdle")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("goalTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:X,children:t(V==="goals"?"exporting":"goalScan")}),$?(0,e.jsxs)("span",{style:{opacity:.6,fontSize:11},children:[t("goalStats"),"\uFF1A",$.cached," / ",$.calls]}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("goalHint")})]}),$?.clusters?.length?$.clusters.map((l,N)=>(0,e.jsxs)("div",{style:{borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",padding:"7px 2px"},children:[(0,e.jsxs)("div",{style:{fontSize:12,marginBottom:4},children:[(0,e.jsx)("b",{children:l.goal})," ",(0,e.jsxs)("span",{style:{opacity:.55},children:["\xB7 ",l.members.length," ",t("goalCards")]})]}),(0,e.jsx)("ul",{style:{margin:"0 0 5px",padding:"0 0 0 16px",fontSize:12,opacity:.85},children:l.members.map((R,G)=>(0,e.jsx)("li",{children:R.title},G))}),(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>re(l),children:t("goalKeep")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>ye(l),children:t("goalMerge")})]})]},N)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t($?"goalNone":"goalIdle")})]})]})]})]})}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:f}){if(!o)return null;let p=It.find(h=>h.key===o.template),i=o.body||(p?t(p.bodyKey):""),w=o.kind||(p?p.kind:"knowledge"),D=o.tags||(p?t(p.tagKey):""),k=o._creating,E=h=>{let g=It.find(z=>z.key===h);r(z=>({...z,template:h,kind:g?g.kind:z.kind,body:g?t(g.bodyKey):z.body,tags:g?t(g.tagKey):z.tags}))},C=async()=>{if(!(!o.title&&!i)){r(h=>({...h,_creating:!0}));try{(await fetch(`${W}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.title||t("untitled"),kind:w,tags:D.split(",").map(g=>g.trim()).filter(Boolean),body:i,source:"manual"})}).then(g=>g.json())).ok?(r(null),f&&f()):r(g=>({...g,_creating:!1}))}catch{r(g=>({...g,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>r(null),children:[(0,e.jsx)("style",{children:Ee}),(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:()=>E(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:w,onChange:h=>r(g=>({...g,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(g=>({...g,title:h.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:D,onChange:h=>r(g=>({...g,tags:h.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:i,onChange:h=>r(g=>({...g,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:k,onClick:C,children:t(k?"exporting":"createCard")})})]})]})]})}async function Yt(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 f=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(r),f}catch{return!1}}function ja({t,onClose:o}){let[r,f]=(0,n.useState)(""),[p,i]=(0,n.useState)(""),[w,D]=(0,n.useState)(""),[k,E]=(0,n.useState)(!0),[C,h]=(0,n.useState)(!1),[g,z]=(0,n.useState)(""),[T,v]=(0,n.useState)(""),j=(0,n.useRef)(null),L=(0,n.useRef)(null),K=()=>{let U=j.current;if(U)try{U.focus(),U.select()}catch{}},ee=U=>{z(U),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>z(""),2400)};(0,n.useEffect)(()=>{let U=!0;return fetch(W+"/diagnostics").then(ie=>ie.json()).then(ie=>{U&&(ie&&ie.ok?(i(String(ie.diagnostics||"")),D(String(ie.version||""))):h(!0))}).catch(()=>{U&&h(!0)}).finally(()=>{U&&E(!1)}),()=>{U=!1}},[]),(0,n.useEffect)(()=>{let U=ie=>{ie.key==="Escape"&&o()};return window.addEventListener("keydown",U),()=>{window.removeEventListener("keydown",U),L.current&&clearTimeout(L.current)}},[o]);let V=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),P=()=>{let U=r.trim().split(`
|
|
306
|
-
`)[0]||"",ie=Ot({title:"[Bug] "+(U.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Wt({description:r,diagnostics:p,version:w})});try{window.open(ie,"_blank","noopener")}catch{ee(t("fbCopyFail"))}},Ie=async()=>{await Yt(p)?(v(""),ee(t("fbCopiedDiag"))):(v(p),ee(t("fbCopyManual")))},Y=async()=>{let U=$t({lang:V,description:r,diagnostics:p});await Yt(U)?(v(""),ee(t("fbCopiedPrompt"))):(v(U),ee(t("fbCopyManual")))},be={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},J={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:Ee}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:U=>U.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:U=>f(U.target.value),placeholder:t("fbDesc"),rows:5,style:be}),(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:Ie,disabled:!p,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:J,children:k?t("fbLoading"):C?t("fbDiagFail"):p})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!r.trim()){ee(t("fbNeedDesc"));return}P()},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:Y,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),g&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:g}),T&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12,color:"#b45309"},children:["\u26A0 ",t("fbCopyFail")]}),(0,e.jsx)("span",{style:{fontSize:11.5,opacity:.75},children:t("fbCopyManual")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:K,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:j,readOnly:!0,value:T,rows:7,style:be})]})]})]})]})}function Pa({t,card:o,query:r,onClose:f,onDelete:p,onFeedback:i}){(0,n.useEffect)(()=>{let j=L=>{L.key==="Escape"&&f()};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[f]);let{meta:w,body:D}=(0,n.useMemo)(()=>Ct(o.text||""),[o.text]),k=j=>{let L=w.find(([K])=>String(K).toLowerCase()===j);return L?L[1]:""},E=Et(k("tags")),C=k("kind")||"knowledge",h=(k("status")||"approved").toLowerCase(),g=qe[C]||"#6B7280",z=(D||"").length>460,[T,v]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:f,children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{className:"me-dialog",onClick:j=>j.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:ht[C]||"\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")]})]}),z&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":T,onClick:()=>v(j=>!j),children:t(T?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&p&&p(o.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:f,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:g,borderColor:g+"59",background:g+"1a"},children:[ht[C]||"\u{1F4CE}"," ",t(Ke[C]||"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")]}),(Array.isArray(E)?E:[]).slice(0,8).map(j=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",j]},j)),!!k("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",pt(k("updated"))]}),!!k("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",k("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:T?{}:{maxHeight:300,overflow:"hidden"},onClick:T?void 0:j=>{j.stopPropagation(),v(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Dt(D)}})}),!T&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:j=>{j.stopPropagation(),v(!0)},children:[t("expand")," \u2304"]})]})]})}function Fa({t,onOpen:o,all:r,onAllChange:f,onMutate:p,active:i,visible:w}){let[D,k]=(0,n.useState)(null),[E,C]=(0,n.useState)(""),h=(0,n.useRef)(!1),g=(0,n.useRef)(0),z=(0,n.useRef)(t);z.current=t;let T=(0,n.useCallback)(async()=>{try{h.current=!1;let K=await(await fetch(`${W}/graph${r?"?all=1":""}`)).json();K.ok?(k(K),C(""),h.current=!0):(k(null),C(K.error||t("error")))}catch(L){C(String(L&&L.message?L.message:L))}},[r,t]);(0,n.useEffect)(()=>{if(!i||h.current)return;let L=!0;return fetch(`${W}/graph${r?"?all=1":""}`).then(K=>K.json()).then(K=>{L&&(K.ok?(k(K),C(""),h.current=!0):(k(null),C(K.error||t("error"))))}).catch(K=>{L&&C(String(K&&K.message?K.message:K))}),()=>{L=!1}},[r,t,i]),(0,n.useEffect)(()=>{w&&D&&g.current++},[w,D]);let v=(0,n.useCallback)(async L=>{try{let ee=await(await fetch(`${W}/delete?path=${encodeURIComponent(L)}`)).json();return ee&&ee.ok?(await T(),p&&p(),!0):!1}catch{return!1}},[T]),j=(0,n.useCallback)(async L=>{if(!L||L.length<2)return!1;try{let K=await fetch(`${W}/merge?paths=${encodeURIComponent(L.join(","))}`).then(ee=>ee.json());return K&&K.ok?(await T(),p&&p(),!0):!1}catch{return!1}},[T,p]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Ee}),E&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",E]}),!D&&!E&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),D&&D.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),D&&D.nodes.length>0&&(0,e.jsx)(Ea,{nodes:D.nodes,edges:D.edges,onOpen:o,onDelete:v,onMerge:j,t,all:r,onAllChange:f,countLabel:`${D.nodes.length} ${t("nodes")} \xB7 ${Ha(D.edges)} ${t("edges")}`,fitTrigger:g.current})]})}function Ha(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 Ea({nodes:t,edges:o,onOpen:r,onDelete:f,onMerge:p,t:i,countLabel:w,all:D,onAllChange:k,fitTrigger:E}){let C=(0,n.useRef)(null),h=(0,n.useRef)(null),g=(0,n.useRef)(null),z=(0,n.useRef)(null),T=(0,n.useRef)(null),v=(0,n.useRef)(r);(0,n.useEffect)(()=>{v.current=r},[r]);let j=(0,n.useRef)(f);(0,n.useEffect)(()=>{j.current=f},[f]);let L=(0,n.useRef)(p);(0,n.useEffect)(()=>{L.current=p},[p]);let[K,ee]=(0,n.useState)(""),[V,P]=(0,n.useState)(null),Ie=(0,n.useRef)("");(0,n.useEffect)(()=>{Ie.current=K.trim().toLowerCase()},[K]),(0,n.useEffect)(()=>{let u=g.current;if(!u)return;let s=K.trim().toLowerCase();if(!s)return;let _=u.nodes.find(pe=>(pe.name||"").toLowerCase().includes(s));_&&(g.current.selectedId=_.id,P(_.id),u.panX=u.w/2-_.x*u.zoom,u.panY=u.h/2-_.y*u.zoom,u.render&&u.render())},[K]);let[Y,be]=(0,n.useState)("all"),[J,U]=(0,n.useState)(!1),ie=(0,n.useRef)("all"),[ve,x]=(0,n.useState)(""),we=(0,n.useRef)(""),[Z,ce]=(0,n.useState)(!1),je=(0,n.useRef)(!1),[y,$]=(0,n.useState)(null);(0,n.useEffect)(()=>{ie.current=Y},[Y]),(0,n.useEffect)(()=>{we.current=ve},[ve]),(0,n.useEffect)(()=>{je.current=Z},[Z]);let le=(0,n.useMemo)(()=>{let u=new Map;for(let s of t)for(let _ of s.tags||[]){let pe=String(_).trim();pe&&u.set(pe,(u.get(pe)||0)+1)}return[...u.entries()].sort((s,_)=>_[1]-s[1]).slice(0,24).map(([s,_])=>({tag:s,n:_}))},[t]),X=(()=>{let u=K.trim().toLowerCase();return!!u&&!t.some(s=>(s.title||s.name||"").toLowerCase().includes(u)||String(s.kind||"").toLowerCase().includes(u)||String(Ke[s.kind]||"").toLowerCase().includes(u))})();(0,n.useEffect)(()=>{let u=g.current;u&&u.wake&&u.wake()},[K]),(0,n.useEffect)(()=>{let u=g.current;u&&u.render&&u.render()},[Y,ve,Z]);let re=(0,n.useRef)(null),[ye,Be]=(0,n.useState)([]),[Me,Se]=(0,n.useState)(null),[Te,l]=(0,n.useState)(!1),[N,R]=(0,n.useState)(null),[G,ge]=(0,n.useState)(""),Ce=(0,n.useRef)(null),de=(0,n.useRef)(null),Q=(u,s=!0)=>{Ce.current&&clearTimeout(Ce.current),R({msg:u,ok:s}),Ce.current=setTimeout(()=>R(null),1900)},Oe=u=>{ge(u),de.current&&clearTimeout(de.current),de.current=setTimeout(()=>ge(""),1600)};(0,n.useEffect)(()=>()=>{Ce.current&&clearTimeout(Ce.current),de.current&&clearTimeout(de.current)},[]);let Le=(0,n.useMemo)(()=>t.reduce((u,s)=>(u[s.id]=s,u),{}),[t]);return(0,n.useEffect)(()=>{let u=C.current;if(!u||t.length===0)return;let s=u.getContext("2d");if(!s)return;let _=Math.max(1,window.devicePixelRatio||1),pe=()=>document.documentElement.getAttribute("data-theme")==="dark",se={};o.forEach(m=>{se[m.source]=(se[m.source]||0)+1,se[m.target]=(se[m.target]||0)+1});let ue=Math.max(1,...Object.values(se)),a={nodes:t.map(m=>({id:m.id,name:m.title||"",type:m.kind||"other",r:9+Math.min(10,(se[m.id]||0)/ue*8),x:0,y:0,vx:0,vy:0})),edges:o.map(m=>({sourceNodeId:m.source,targetNodeId:m.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:_,ctx:s,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((m,I)=>(m[I.id]=I,m),{}),a.nodes.forEach((m,I)=>{let M=I/a.nodes.length*Math.PI*2-Math.PI/2;m.x=Math.cos(M)*60,m.y=Math.sin(M)*60});let tt=[...new Set(a.nodes.map(m=>m.type))];a.clustered=tt.length>1,a.typeCenters={},tt.forEach((m,I)=>{let M=I/tt.length*Math.PI*2-Math.PI/2;a.typeCenters[m]={x:Math.cos(M)*160,y:Math.sin(M)*160}}),g.current=a;let at=0,xe=0,nt=()=>{let m=u.clientWidth,I=u.clientHeight;a.w=m,a.h=I,u.width=m*_,u.height=I*_,s.setTransform(_,0,0,_,0,0),(at===0||xe===0)&&m>0&&I>0&&a.tickCount>0&&requestAnimationFrame(()=>O()),at=m,xe=I};nt();let Ae=new ResizeObserver(nt);Ae.observe(u.parentElement);let c=(m,I)=>m&&m.length>I?m.slice(0,I)+"\u2026":m,A=(m,I,M,H)=>{if(s.beginPath(),H==="rect")s.rect(m-M,I-M*.75,M*2,M*1.5);else if(H==="diamond")s.moveTo(m,I-M),s.lineTo(m+M,I),s.lineTo(m,I+M),s.lineTo(m-M,I),s.closePath();else if(H==="hexagon"){for(let q=0;q<6;q++){let me=Math.PI/3*q-Math.PI/2,ae=m+M*Math.cos(me),ze=I+M*Math.sin(me);q===0?s.moveTo(ae,ze):s.lineTo(ae,ze)}s.closePath()}else s.arc(m,I,M,0,Math.PI*2)},d=new Map,S=(m,I)=>{let M=m+"|"+Math.round(I),H=d.get(M);if(!H){let q=parseInt(m.slice(1,3),16),me=parseInt(m.slice(3,5),16),ae=parseInt(m.slice(5,7),16);H=s.createRadialGradient(-I*.3,-I*.3,0,0,0,I*1.2),H.addColorStop(0,"rgba("+Math.min(255,q+70)+","+Math.min(255,me+70)+","+Math.min(255,ae+70)+",0.95)"),H.addColorStop(1,m),d.set(M,H)}return H},O=()=>{if(!a.nodes.length)return;let m=1/0,I=-1/0,M=1/0,H=-1/0;a.nodes.forEach($e=>{m=Math.min(m,$e.x),I=Math.max(I,$e.x),M=Math.min(M,$e.y),H=Math.max(H,$e.y)});let q=20,me=I-m+q*2,ae=H-M+q*2,ze=Math.min(a.w/me,a.h/ae);a.zoom=Math.max(.35,Math.min(1.8,ze)),a.panX=a.w/2-(m+I)/2*a.zoom,a.panY=a.h/2-(M+H)/2*a.zoom};z.current=O;let F=()=>{s.clearRect(0,0,a.w,a.h),a.searchTerm=Ie.current,a.kindFilter=ie.current,a.timeMode=je.current,a.tagFilter=we.current;let m=a.tagFilter,I=a.kindFilter,M=b=>String(b||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");s.save(),s.strokeStyle=pe()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",s.lineWidth=.5;for(let b=0;b<a.w;b+=24)s.beginPath(),s.moveTo(b,0),s.lineTo(b,a.h),s.stroke();for(let b=0;b<a.h;b+=24)s.beginPath(),s.moveTo(0,b),s.lineTo(a.w,b),s.stroke();s.restore(),s.save(),s.translate(a.panX,a.panY),s.scale(a.zoom,a.zoom);let H={};a.nodes.forEach(b=>H[b.id]=b);let q=a.nodes.length>40,me=q?1.5:.55,ae=a.selectedId||a.hoverId,ze=_t({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),$e=(()=>{let b=(a.searchTerm||"").toLowerCase();if(!b)return null;let ne=[];for(let oe of a.nodes){let Re=(a.domainById[oe.id]||{}).kind||"other";if(((oe.name||"").toLowerCase().includes(b)||String(Ke[Re]||"").toLowerCase().includes(b)||String(Re).toLowerCase().includes(b))&&ne.push(oe.id),ne.length>200)break}return ne})(),ot=Kt(a.nodes,{limit:Ut(a.nodes.length),focusId:ae,hoverId:a.hoverId,searchHits:$e,degree:se}),fe=new Map,ke=(b,ne)=>{let oe=b+"|"+ne,he=fe.get(oe);return he===void 0&&(s.font=b,he=s.measureText(ne).width,fe.set(oe,he)),he},Fe=a.nodes.length<=250,_e=new Map;a.edges.forEach(b=>{let ne=H[b.sourceNodeId],oe=H[b.targetNodeId];if(!ne||!oe||!Nt(ne.x,ne.y,10,ze)&&!Nt(oe.x,oe.y,10,ze))return;if(I!=="all"){let rt=a.domainById[b.sourceNodeId]&&a.domainById[b.sourceNodeId].kind,Ze=a.domainById[b.targetNodeId]&&a.domainById[b.targetNodeId].kind;if(rt!==I&&Ze!==I)return}if(m){let rt=a.domainById[b.sourceNodeId]&&(a.domainById[b.sourceNodeId].tags||[]).includes(m),Ze=a.domainById[b.targetNodeId]&&(a.domainById[b.targetNodeId].tags||[]).includes(m);if(!rt&&!Ze)return}let he=oe.x-ne.x,Re=oe.y-ne.y,Pe=Math.sqrt(he*he+Re*Re)||1,Qe=q?12:18,et=-Re/Pe*Qe,xt=he/Pe*Qe,kt=(ne.x+oe.x)/2+et,wt=(ne.y+oe.y)/2+xt,mt=ct.colors[a.domainById[ne.id]&&a.domainById[ne.id].kind||"other"],gt=ae&&(b.sourceNodeId===ae||b.targetNodeId===ae),Mt=ae?gt?.6:.08:q?.14:.24,Je=parseInt(mt.slice(1,3),16),ft=parseInt(mt.slice(3,5),16),Rt=parseInt(mt.slice(5,7),16),Ge=gt?1.6+(b.weight||1):.8+(b.weight||1)*.5,it=Je+","+ft+","+Rt+","+Mt+","+Ge,Ue=_e.get(it);Ue||(Ue={path:new Path2D,stroke:"rgba("+Je+","+ft+","+Rt+","+Mt+")",width:Ge},_e.set(it,Ue)),Ue.path.moveTo(ne.x,ne.y),Ue.path.quadraticCurveTo(kt,wt,oe.x,oe.y)}),_e.forEach(b=>{s.strokeStyle=b.stroke,s.lineWidth=b.width,s.stroke(b.path)});let He=null;ae&&(He=new Set,a.edges.forEach(b=>{b.sourceNodeId===ae?He.add(b.targetNodeId):b.targetNodeId===ae&&He.add(b.sourceNodeId)}));let Xe=[];if(a.nodes.forEach(b=>{if(!Nt(b.x,b.y,b.r+2,ze))return;let ne=a.domainById[b.id]||{},oe=ne.kind||"other",he=a.timeMode?Oa(ne.updated):ct.colors[oe],Re=ct.shapes[oe],Pe=a.selectedId===b.id,Qe=a.hoverId===b.id,et=a.searchTerm||"",xt=!et||(b.name||"").toLowerCase().includes(et)||String(Ke[oe]||"").toLowerCase().includes(et)||String(oe).toLowerCase().includes(et),kt=I==="all"||oe===I,wt=!m||(ne.tags||[]).includes(m),mt=ae&&b.id!==ae&&!(He&&He.has(b.id))||et&&!xt||!kt||!wt;s.save(),s.globalAlpha=mt?.08:1,(Pe||Qe)&&Fe&&(s.shadowColor=he,s.shadowBlur=Pe?20:14),s.translate(b.x,b.y),A(0,0,b.r,Re),s.fillStyle=S(he,b.r),s.fill(),s.restore(),Pe?(s.save(),A(b.x,b.y,b.r+3,Re),s.strokeStyle=he,s.lineWidth=3,s.shadowColor=he,s.shadowBlur=12,s.stroke(),s.restore()):Qe?(s.save(),A(b.x,b.y,b.r+2,Re),s.strokeStyle=he,s.lineWidth=2,s.stroke(),s.restore()):et&&xt?(s.save(),A(b.x,b.y,b.r+2,Re),s.strokeStyle="#e11d48",s.lineWidth=2,s.stroke(),s.restore()):a.multi.indexOf(b.id)>=0&&(s.save(),A(b.x,b.y,b.r+2,Re),s.strokeStyle="#60a5fa",s.lineWidth=2,s.shadowColor="#60a5fa",s.shadowBlur=8,s.stroke(),s.restore());let gt=c(b.name,16);if((Pe||Qe||ot.has(b.id)&&a.zoom>me||!q&&a.zoom>.6)&&kt&&wt){let Je=1/a.zoom,ft="500 "+(12*Je).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";s.font=ft;let Ge=ke(ft,gt)+16*Je,it=18*Je,Ue=b.y+b.r+8*Je,rt=!0;for(let Ze of Xe)if(b.x-Ge/2<Ze.x+Ze.w&&b.x+Ge/2>Ze.x&&Ue<Ze.y+Ze.h&&Ue+it>Ze.y){rt=!1;break}if(!rt&&!Pe&&!Qe)return;Xe.push({x:b.x-Ge/2,y:Ue,w:Ge,h:it}),s.fillStyle=pe()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",s.beginPath(),s.roundRect?s.roundRect(b.x-Ge/2,Ue,Ge,it,4*Je):s.rect(b.x-Ge/2,Ue,Ge,it),s.fill(),s.strokeStyle=pe()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",s.lineWidth=1*Je,s.stroke(),s.fillStyle=pe()?Pe||Qe?"#eee":"#bbb":Pe||Qe?"#111":"#444",s.textAlign="center",s.fillText(gt,b.x,Ue+13*Je)}}),s.restore(),a.marquee){let b=a.marquee,ne=Math.min(b.sx,b.ex),oe=Math.min(b.sy,b.ey),he=Math.abs(b.ex-b.sx),Re=Math.abs(b.ey-b.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(ne,oe,he,Re),s.strokeRect(ne,oe,he,Re),s.restore()}if(a.hoverId&&re.current){let b=a.domainById[a.hoverId],ne=a.nodes.find(function(oe){return oe.id===a.hoverId});if(b&&ne){let oe=a.edges.filter(function(Pe){return Pe.sourceNodeId===b.id||Pe.targetNodeId===b.id}).length,he=ne.x*a.zoom+a.panX,Re=ne.y*a.zoom+a.panY;re.current.style.display="block",re.current.style.left=he+14+"px",re.current.style.top=Re-6+"px",re.current.innerHTML="<b>"+M(b.title||b.name||"")+'</b><br/><span style="opacity:.8">'+M(b.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",oe)+"</span>"}}else re.current&&(re.current.style.display="none")},B=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(Ne))};a.wake=B,a.render=F;let te=()=>{let m=a.nodes.length;a.tickCount++;let M=.9-Math.min(.4,a.tickCount/1500),H=m>1e3?3e3:m>100?2e3:m>50?1200:800,q=m>100?.002:.005,me=m>1e3?.012:m>100?.005:.01,ae=m>1e3?6:m>200?12:24,ze={};a.nodes.forEach(fe=>ze[fe.id]=fe);for(let fe=0;fe<m;fe++){if(a.dragNode===a.nodes[fe])continue;let ke=a.nodes[fe],Fe=0,_e=0;for(let b=0;b<m;b++){if(fe===b)continue;let ne=ke.x-a.nodes[b].x,oe=ke.y-a.nodes[b].y,he=Math.sqrt(ne*ne+oe*oe)||1,Re=H/(he*he);Fe+=ne/he*Re,_e+=oe/he*Re}if(a.clustered&&a.typeCenters[ke.type]){let b=a.typeCenters[ke.type];Fe+=(b.x-ke.x)*.006,_e+=(b.y-ke.y)*.006}else Fe-=ke.x*me,_e-=ke.y*me;let He=(ke.vx+Fe)*M,Xe=(ke.vy+_e)*M;He=Math.max(-ae,Math.min(ae,He)),Xe=Math.max(-ae,Math.min(ae,Xe)),ke.vx=He,ke.vy=Xe}a.edges.forEach(fe=>{let ke=ze[fe.sourceNodeId],Fe=ze[fe.targetNodeId];if(!ke||!Fe)return;let _e=Fe.x-ke.x,He=Fe.y-ke.y,Xe=Math.sqrt(_e*_e+He*He)||1,b=(Xe-100)*q,ne=_e/Xe*b,oe=He/Xe*b;a.dragNode!==ke&&(ke.vx+=ne,ke.vy+=oe),a.dragNode!==Fe&&(Fe.vx-=ne,Fe.vy-=oe)});let $e=0;a.nodes.forEach(fe=>{a.dragNode!==fe&&(fe.x+=fe.vx,fe.y+=fe.vy,$e+=fe.vx*fe.vx+fe.vy*fe.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,O()),(m?Math.sqrt($e/m):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},Ne=()=>{if(a.running){try{te(),F()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(Ne)}},De=(m,I)=>{let M=u.getBoundingClientRect();return{x:(m-M.left-a.panX)/a.zoom,y:(I-M.top-a.panY)/a.zoom}},Ve=m=>{let I=a.domainById[m];return!(!I||ie.current!=="all"&&I.kind!==ie.current||we.current&&!(I.tags||[]).includes(we.current))},We=(m,I,M)=>Math.max(I,Math.min(M,m)),Ye=m=>{a.mouseX=m.clientX,a.mouseY=m.clientY;let I=De(m.clientX,m.clientY),M=null;for(let H=a.nodes.length-1;H>=0;H--){let q=a.nodes[H];if(!Ve(q.id))continue;let me=q.x-I.x,ae=q.y-I.y;if(me*me+ae*ae<q.r*q.r+36){M=q.id;break}}M!==a.hoverId&&(a.hoverId=M,B())},vt=m=>{if(m.button!==0)return;let I=De(m.clientX,m.clientY),M=null;for(let H=a.nodes.length-1;H>=0;H--){let q=a.nodes[H];if(!Ve(q.id))continue;let me=q.x-I.x,ae=q.y-I.y;if(me*me+ae*ae<q.r*q.r+25){M=q;break}}if(m.shiftKey){if(M){a.shiftClick=M.id;return}a.marquee={sx:m.clientX,sy:m.clientY,ex:m.clientX,ey:m.clientY};return}a.dragStart={x:m.clientX,y:m.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=M||null,M&&(a.dragOffset={dx:M.x-I.x,dy:M.y-I.y})},Lt=m=>{if(a.marquee){a.marquee.ex=m.clientX,a.marquee.ey=m.clientY,B();return}if(!a.dragStart)return;let I=m.clientX-a.dragStart.x,M=m.clientY-a.dragStart.y;if(Math.abs(I)+Math.abs(M)>3&&(a.dragging=!0),a.dragNode){let H=De(m.clientX,m.clientY);a.dragNode.x=H.x+a.dragOffset.dx,a.dragNode.y=H.y+a.dragOffset.dy,B()}else a.dragging&&(a.panX=We(a.dragStart.px+I,-1e5,1e5),a.panY=We(a.dragStart.py+M,-1e5,1e5),B())},At=m=>{if(a.marquee){let M=a.marquee;a.marquee=null;let H=u.getBoundingClientRect(),q=Math.min(M.sx,M.ex)-H.left,me=Math.max(M.sx,M.ex)-H.left,ae=Math.min(M.sy,M.ey)-H.top,ze=Math.max(M.sy,M.ey)-H.top,$e=a.nodes.filter(ot=>{let fe=ot.x*a.zoom+a.panX,ke=ot.y*a.zoom+a.panY;return fe>=q&&fe<=me&&ke>=ae&&ke<=ze}).map(ot=>ot.id);a.multi=$e,Be($e),B();return}let I=a.dragStart&&!a.dragging;if(a.shiftClick){let M=a.shiftClick;a.shiftClick=null;let H=Array.isArray(a.multi)?a.multi.slice():[];H.includes(M)||H.push(M),a.multi=H,Be(H),B();return}if(I){let M=De(m.clientX,m.clientY),H=null;for(let q=a.nodes.length-1;q>=0;q--){let me=a.nodes[q];if(!Ve(me.id))continue;let ae=me.x-M.x,ze=me.y-M.y;if(ae*ae+ze*ze<me.r*me.r+20){H=me;break}}H?(a.selectedId=H.id,P(H.id),B()):(a.selectedId=null,a.hoverId=null,m.shiftKey||(a.multi=[],Be([])),P(null),B())}a.dragStart=null,a.dragging=!1,a.dragNode=null},jt=m=>{m.preventDefault();let I=De(m.clientX,m.clientY),M=null;for(let H=a.nodes.length-1;H>=0;H--){let q=a.nodes[H];if(!Ve(q.id))continue;let me=q.x-I.x,ae=q.y-I.y;if(me*me+ae*ae<q.r*q.r+25){M=q;break}}if(M){let H=a.domainById[M.id];H&&$({x:m.clientX,y:m.clientY,id:M.id,path:H.id,title:H.title})}else $(null)},Pt=m=>{m.preventDefault();let I=u.getBoundingClientRect(),M=(m.clientX-I.left-a.panX)/a.zoom,H=(m.clientY-I.top-a.panY)/a.zoom,q=Math.max(.3,Math.min(3,a.zoom*(m.deltaY<0?1.1:1/1.1)));a.panX=We(a.panX+M*(a.zoom-q),-1e5,1e5),a.panY=We(a.panY+H*(a.zoom-q),-1e5,1e5),a.zoom=q,B()};u.addEventListener("mousemove",Ye),u.addEventListener("mousedown",vt),window.addEventListener("mousemove",Lt),window.addEventListener("mouseup",At),u.addEventListener("wheel",Pt,{passive:!1}),u.addEventListener("contextmenu",jt),T.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],Be([]),O(),B()};for(let m=0;m<200;m++)te();O(),B();let Ft=()=>U(!1);return window.addEventListener("mousedown",Ft),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),Ae.disconnect(),u.removeEventListener("mousemove",Ye),u.removeEventListener("mousedown",vt),window.removeEventListener("mousemove",Lt),window.removeEventListener("mouseup",At),u.removeEventListener("wheel",Pt),u.removeEventListener("contextmenu",jt),window.removeEventListener("mousedown",Ft)}},[t,o]),(0,n.useEffect)(()=>{E!==void 0&&z.current&&requestAnimationFrame(()=>z.current())},[E]),(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:K,onChange:u=>ee(u.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>U(u=>!u),"aria-expanded":J,title:i("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",i("filterLabel")," ",Y!=="all"||Z||ve?"\u25CF":"\u25BE"]}),J&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:u=>u.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${Y==="all"&&!Z?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{be("all"),ce(!1)},children:i("all")}),Object.keys(qe).map(u=>(0,e.jsxs)("button",{type:"button",className:`lg${Y===u?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>be(s=>s===u?"all":u),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[u]||qe[u]}}),i(Ke[u])]},u)),(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${Z?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>ce(u=>!u),children:["\u23F1 ",i("timeDim")]}),le.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:le.map(u=>(0,e.jsxs)("button",{type:"button",className:`lg${ve===u.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>x(s=>s===u.tag?"":u.tag),title:u.tag,children:["#",u.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:u.n})]},u.tag))})]}),(Y!=="all"||Z||ve)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{be("all"),ce(!1),x("")},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:!!D,onChange:u=>k&&k(u.target.checked)}),i("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${Z?" me-on":""}`,onClick:()=>ce(u=>!u),children:i("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let u=C.current;if(u)try{u.toBlob(s=>{s&&Se({url:URL.createObjectURL(s),blob:s})},"image/png")}catch{}},children:i("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>z.current&&z.current(),children:i("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{P(null),be("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:C,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:re,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)"}}),X&&(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")}),y&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>$(null)}),y&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:y.x,top:y.y,zIndex:31},onMouseDown:u=>u.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{v.current({path:y.path,title:y.title}),$(null)},children:i("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{y.id&&(g.current.selectedId=y.id,P(y.id)),$(null);let u=g.current;u&&u.wake&&u.wake()},children:i("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(y.title||"")}catch{}$(null),Q(i("copied"))},children:i("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let u=g.current,s=u&&Array.isArray(u.multi)?u.multi.slice():[],_=y.id;if(_&&!s.includes(_)&&s.push(_),$(null),s.length<2){Q(i("mergeNeed"),!1);return}if(!window.confirm(i("mergeConfirm")))return;let pe=L.current&&L.current(s);pe&&pe.then?pe.then(se=>se?Q(i("merged")):Q(i("mergeFail"),!1)).catch(()=>Q(i("mergeFail"),!1)):pe&&Q(i("merged"))},children:i("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let u=y.path;$(null),window.confirm(i("deleteConfirm"))&&(async()=>{try{(j.current?await j.current(u):!1)?Q(i("deleted")):Q(i("deleteFail"),!1)}catch{Q(i("deleteFail"),!1)}})()},children:i("delete")})]}),ye.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:[ye.length," ",i("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=ye.map(ue=>Le[ue]).filter(Boolean).map(ue=>ue.title||ue.name).join(`
|
|
307
|
-
`),
|
|
305
|
+
`);let pe=new Blob([D],{type:Y}),ze=await $a(pe,L,!1);if(!ze.ok){b({ok:!1,msg:t("exportFail")}),$(!1);return}b({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+ze.name})}catch(x){b({ok:!1,msg:t("exportFail")+" \xB7 "+(x.message||"")})}finally{$(!1)}ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>b(null),2600)},we=async a=>{let y=a.target.files&&a.target.files[0];if(a.target.value="",!!y){try{let x=await y.text(),D=await(await fetch(`${E}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:x})).json();if(D.ok){await be();let L=D.imported||0,Y=t("importedVault")+"\uFF1A"+L;D.total&&(Y+=t("importedTotal")+D.total+t("importedTotalTail")),D.quarantined&&(Y+=t("importedQuarantine")+D.quarantined+t("importedQuarantineTail")),D.skipped&&(Y+=t("importedSkipped")+D.skipped+t("importedSkippedTail")),D.warning&&(Y+=" \xB7 "+D.warning),b({ok:L>0||!D.total,msg:Y})}else b({ok:!1,msg:D.error||t("importFail")})}catch{b({ok:!1,msg:t("importFail")})}ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>b(null),2400)}},ut=(0,o.useMemo)(()=>{let a=R.slice();return te!=="all"&&(a=a.filter(y=>pt(y.submittedBy)===te)),F!=="all"&&(a=a.filter(y=>(y.status||"approved")===F)),ve==="title"?a.sort((y,x)=>String(y.title||"").localeCompare(String(x.title||""))):ve==="hot"?a.sort((y,x)=>(x.weight||x.links||0)-(y.weight||y.links||0)):a.sort((y,x)=>new Date(x.updated||0).getTime()-new Date(y.updated||0).getTime()),a},[R,ve,te,F]),Ne=(0,o.useMemo)(()=>[...new Set(R.map(a=>pt(a.submittedBy)))],[R]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Oe}),ke&&(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 "+(ke.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:ke.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:ke.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:ke.msg})]}),i&&(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)(ea,{})}),(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"})]}),v&&v.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:[v.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:v.since?ct(new Date(v.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${Te?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Ce(a=>!a),"aria-label":t(Te?"collapse":"expand"),title:t(Te?"collapse":"expand"),children:Te?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${V==="cards"?" active":""}`,onClick:()=>ie("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),Te&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${V==="graph"?" active":""}`,onClick:()=>ie("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),Te&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${V==="stats"?" active":""}`,onClick:()=>ie("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),Te&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${V==="audit"?" active":""}`,onClick:()=>ie("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),Te&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")}),ue>0&&(0,e.jsx)("span",{className:"mc-dot",children:ue>99?"99+":ue})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${V==="optimize"?" active":""}`,onClick:()=>ie("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),Te&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")}),J>0&&(0,e.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:J>99?"99+":J})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${V==="config"?" active":""}`,onClick:()=>ie("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),Te&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Se(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),Te&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:re,children:[l&&l.db&&l.db.writable===!1?(0,e.jsxs)("div",{style:{margin:"8px 10px 0",padding:"8px 12px",borderRadius:8,fontSize:12,lineHeight:1.7,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.35)",color:"#b91c1c"},children:["\u26A0\uFE0F ",t("dbReadonlyTitle"),"\uFF1A",l.db.error||"\u2014"," \u2014\u2014 ",t("dbReadonlyBody"),(0,e.jsx)("div",{style:{opacity:.85,marginTop:2},children:t("dbReadonlyFix")})]}):null,V==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(st,{label:t("total"),value:l?l.total:"\u2014"}),(0,e.jsx)(st,{label:t("recent"),value:l?l.recent:"\u2014"}),(0,e.jsx)(st,{label:t("tags"),value:l?l.tags:"\u2014"}),(0,e.jsx)(st,{label:t("pending"),value:l?.quarantine?.pending??l?.status?.pending??0}),(0,e.jsx)(st,{label:t("rejected"),value:l?.quarantine?.rejected??l?.status?.rejected??0}),(0,e.jsx)(st,{label:t("cardCount"),value:l?l.byKind?.knowledge??0:"\u2014"})]}),V==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:B,onChange:a=>Ye(a.target.value)}),(0,e.jsx)("input",{ref:Re,type:"file",accept:".json,application/json",style:{display:"none"},onChange:we}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Re.current&&Re.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>N({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:h,onClick:()=>Qe("md"),children:t(h?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:h,onClick:()=>Qe("json"),children:t(h?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>be(),children:t("refresh")})]}),V==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[At.map(a=>(0,e.jsx)("button",{type:"button",className:`mc-chip${w===a?" active":""}`,onClick:()=>tt(a),children:t(a==="all"?"all":_e[a])},a)),(0,e.jsxs)("select",{value:te,onChange:a=>q(a.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")]}),Qt(Ne).map(a=>(0,e.jsx)("option",{value:a,children:a},a))]}),(0,e.jsxs)("select",{value:F,onChange:a=>Ie(a.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(a=>(0,e.jsx)("button",{type:"button",className:`mc-chip${ve===a.key?" active":""}`,onClick:()=>Ae(a.key),children:a.label},a.key))]}),I&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",I]}),(0,e.jsx)("div",{style:{display:V==="cards"?"contents":"none"},children:H?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):I?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",I," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>be(),children:t("retry")})]}):R.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:ut.map(a=>(0,e.jsx)(Aa,{card:a,t,query:B.trim(),onOpen:at,onDelete:n},a.path))}),R.length<Ke&&(0,e.jsx)("div",{ref:O,style:{height:1}}),p&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",R.length," / ",Ke,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:V==="graph"?"flex":"none",flex:1,minHeight:0},children:G.has("graph")&&(0,e.jsx)(Pa,{t,onOpen:at,all:Q,onAllChange:X,onMutate:se,active:V==="graph",visible:V==="graph"})}),(0,e.jsx)("div",{style:{display:V==="config"?"contents":"none"},children:G.has("config")&&(0,e.jsx)(aa,{t,onReload:()=>be(),version:z})}),(0,e.jsx)("div",{style:{display:V==="stats"?"contents":"none"},children:G.has("stats")&&(0,e.jsx)(Ba,{t,tab:"stats",onReload:()=>be(),version:z})}),(0,e.jsx)("div",{style:{display:V==="audit"?"contents":"none"},children:G.has("audit")&&(0,e.jsx)(za,{t,onReload:()=>be(),version:z})}),(0,e.jsx)("div",{style:{display:V==="optimize"?"contents":"none"},children:G.has("optimize")&&(0,e.jsx)(Ia,{t,onReload:()=>be(),version:z})}),Be&&(0,e.jsx)(ja,{t,onClose:()=>Se(!1)}),le&&(0,e.jsx)(Fa,{t,card:le,query:B.trim(),onClose:()=>ye(null),onDelete:a=>{ye(null),n(a)},onFeedback:a=>{let y=le.path;fetch(`${E}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:B.trim(),path:y,useful:a})}).then(()=>b({ok:!0,msg:t(a?"fbUseful":"fbIrr")})).catch(()=>{}),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>b(null),2e3)}}),(0,e.jsx)(La,{t,newCard:s,setNewCard:N,onCreated:()=>{be(),se(),b({ok:!0,msg:t("created")}),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>b(null),2e3)}})]})]})]})}var ta=({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,st=({label:t,value:i})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:i}),(0,e.jsx)("span",{children:t})]});function aa({t,onReload:i,version:r,compact:g}){let[c,l]=(0,o.useState)(null),[C,R]=(0,o.useState)(0),[S,H]=(0,o.useState)(null),[k,v]=(0,o.useState)(null),[m,I]=(0,o.useState)(!1),[T,w]=(0,o.useState)(!1),j=(0,o.useRef)(!1),B=(0,o.useRef)(null),_=(0,o.useRef)({}),[te,q]=(0,o.useState)(null),[F,Ie]=(0,o.useState)(null),[V,fe]=(0,o.useState)(""),[G,W]=(0,o.useState)(""),[ie,ve]=(0,o.useState)(""),[Ae,ke]=(0,o.useState)(null),[b,ce]=(0,o.useState)(null),Re=(0,o.useCallback)(async a=>{W("version");try{let y=await fetch(E+"/version-check"+(a?"?force=1":"")).then(x=>x.json());y&&y.ok?(ce(y),a&&X(y.updateAvailable?t("vcLatest")+" v"+y.latest:t("vcUpToDate"))):a&&X(t("vcCheckFail"),!1)}catch{a&&X(t("vcCheckFail"),!1)}finally{W("")}},[t]);(0,o.useEffect)(()=>{Re(!1)},[r,Re]);let[h,$]=(0,o.useState)(""),[le,ye]=(0,o.useState)(null),Q=(0,o.useRef)(null),X=(a,y=!0)=>{Q.current&&clearTimeout(Q.current),ye({msg:a,ok:y}),Q.current=setTimeout(()=>ye(null),1900)},Be=async()=>{if(!G){W("restart");try{let a=await fetch(E+"/restart-self",{method:"POST"});if(a.status===404||a.status===405){X(se("vcRestartNoRoute",{cmd:b&&b.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let y=await a.json().catch(()=>null);if(!y){X(t("vcRestartFail")+"\uFF08HTTP "+a.status+"\uFF09",!1);return}if(!y.ok){X(y.error||t("vcRestartFail"),!1);return}if(y.alreadyCurrent){X(y.note||t("vcRestartCurrent"));return}X(y.note||t("vcRestartSent")),y.alreadyRunning||setTimeout(()=>{Re(!0)},6e3)}catch(a){X(t("vcRestartFail")+"\uFF1A"+String(a&&a.message||a),!1)}finally{W("")}}},Se=b&&b.resident?String(b.resident.served||""):"",Te=!!(b&&b.onDisk&&Se&&Se!==b.onDisk),Ce=!!(b&&b.resident&&b.resident.managed===!1&&b.resident.managedKnown===!1),s=b&&b.resident&&b.resident.replaceBlocked&&b.resident.replaceBlocked.fresh||null,N=!!(b&&b.resident&&b.resident.managed===!1&&!Ce),z=!!(b&&b.resident&&!Se),Z=Te||z||N||Ce,se=(a,y)=>Object.keys(y).reduce((x,U)=>x.split("{"+U+"}").join(y[U]),t(a)),ue=(0,o.useCallback)(async()=>{try{let[a,y,x,U]=await Promise.all([fetch(`${E}/config`).then(D=>D.json()).catch(()=>null),fetch(`${E}/setup-status`).then(D=>D.json()).catch(()=>null),fetch(`${E}/budget`).then(D=>D.json()).catch(()=>null),fetch(`${E}/llm-routes`).then(D=>D.json()).catch(()=>null)]);if(U&&U.ok&&ke(U),a&&a.ok){l(a),R(a.revision??0),H(a.schema??null);let D=qt(a.config??{},_.current);_.current=D.overlay,v({...D.values}),q(a.dsh??null),I(a.writable===!1),w(a.viaPending===!0),fe(""),j.current=!1}else x&&x.ok?(v({...x}),I(!0),fe(t("configNeedsDsh"))):fe(t("adminLoadFail"));y&&y.ok&&Ie(y),ve("")}catch{fe(t("adminLoadFail"))}},[t]);(0,o.useEffect)(()=>{ue()},[r,ue]);let J=(a,y)=>{j.current=!0,v(x=>({...x??{},[a]:y}))};(0,o.useEffect)(()=>{B.current=ue},[ue]),(0,o.useEffect)(()=>{if(typeof EventSource>"u")return;let a=null;try{a=new EventSource(E+"/events")}catch{return}let y=()=>{!j.current&&typeof B.current=="function"&&B.current()};try{a.addEventListener("config",y)}catch{}return()=>{try{a.close()}catch{}}},[]);let ee=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),Ke=a=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[a]||a,Le=async()=>{if(!k)return;if(m){X(t("editInSetting"),!1);return}let a={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]},y=[];for(let[x,[U,D]]of Object.entries(a)){if(!(x in k))continue;let L=k[x],Y=typeof L=="number"?L:Number(L);(L===""||L===null||L===void 0||!Number.isFinite(Y)||Y<U||Y>D)&&y.push(t("invalidField",{field:x,min:U,max:D,value:String(L===""?"\u7A7A":L)}))}if(y.length){let x=t("saveInvalid")+"\uFF1A"+y.join("\uFF1B");fe(x),X(x,!1);return}W("save");try{let x={...k};for(let Y of Object.keys(k))Y in x&&typeof x[Y]=="string"&&x[Y].trim()!==""&&ee.has(Y)&&(x[Y]=Number(x[Y]));Array.isArray(x.vaultProfiles)&&(x.vaultProfiles=x.vaultProfiles.filter(Y=>Y&&(String(Y.name||"").trim()||String(Y.path||"").trim())));let U=await fetch(`${E}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:x,expectedRevision:C})}),D=await U.text(),L=null;try{L=D?JSON.parse(D):null}catch{L=null}if(L||(L={error:"HTTP "+U.status+(D?"\uFF1A"+D.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")}),L&&L.ok){let Y=typeof L.pendingOutcome=="string"?L.pendingOutcome:"",pe,ze=!0;if(Y==="applied")pe=t("savedApplied")+(Array.isArray(L.applied)&&L.applied.length?" \xB7 "+L.applied.join("\u3001"):"");else if(Y==="queued")ze=!1,pe=t("saveQueued");else if(Y==="failed")ze=!1,pe=t("saveFail")+" \xB7 "+(L.hostGuard?t("saveHostGuard"):t("saveFailHint"));else if(Y==="applied-direct")pe=t("savedOk")+" \xB7 "+t("savedDirect");else{let je=Array.isArray(L.pending)&&L.pending.length?" \xB7 "+t("savePending"):L.note?" \xB7 "+t("restartHint"):"";pe=(L.retried?"\u267B ":"")+t("savedOk")+je}_.current={..._.current,...x},ze?ve(pe):fe(pe),X(pe,ze),await ue()}else{let Y=U.status===409?t("conflictRefresh"):L?.error||t("saveFail");fe(Y),X(Y,!1)}}catch{fe(t("saveFail")),X(t("saveFail"),!1)}finally{W("")}},p=()=>{_.current={},v({...c?.config??{}}),ve("")},d={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},O=a=>Array.isArray(a?.vaultProfiles)?a.vaultProfiles:[],re=(a,y,x)=>v(U=>{let D=O(U).map(Y=>({...Y||{}})),L={...D[a]||{}};return y==="match"?String(x).trim()?L.match={...L.match||{},workspace:x}:delete L.match:L[y]=x,D[a]=L,{...U??{},vaultProfiles:D}}),me=()=>v(a=>({...a??{},vaultProfiles:[...O(a),{name:"",path:""}]})),be=a=>v(y=>({...y??{},vaultProfiles:O(y).filter((x,U)=>U!==a)})),n={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},Ye={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},tt={A:{label:t("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:4e3,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}},at=async a=>{let y=tt[a];y&&v(x=>({...x??{},...y}))},Qe=async(a,y)=>{W(a+y);try{let U=await(await fetch(`${E}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:a,action:y})})).json();U&&U.ok?X(se(y==="install"?"mcpInstalled":"mcpUninstalled",{agent:a})):X(se("mcpActionFail",{agent:a,error:U?.error||""}),!1);try{let D=await fetch(`${E}/setup-status`).then(L=>L.json());D&&D.ok&&Ie(D)}catch{}}catch{X(t("mergeFail"),!1)}finally{W("")}},we=({k:a,label:y,type:x="text",step:U,min:D,max:L})=>(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:y||a}),(0,e.jsx)("input",{type:x,step:U,min:D,max:L,value:k?k[a]??"":"",onChange:Y=>{let pe=Y.target.value;J(a,x==="number"?pe===""?"":Number(pe):pe)},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}})]}),ut=new Set(["autoRestartOnDrift"]),Ne=({k:a,label:y})=>{let x=k?k[a]:void 0,U=x===void 0?ut.has(a):!!x;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:U,onChange:D=>J(a,D.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,e.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:y||a})]})};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:Oe}),le&&(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 "+(le.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:le.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:le.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:le.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[V&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",V]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:ue,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")]}),m&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #f59e0b",background:"rgba(245,158,11,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#b45309"},children:["\u2139\uFE0F ",t("configNeedsDsh")," \u2014\u2014 ",t("editInSetting")]}),ie&&(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 ",ie]}),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:n,children:[t("vcLoaded")," v",c.version]}),b&&b.resident&&b.resident.served&&b.resident.served!==c.version&&(0,e.jsxs)("code",{style:n,children:[t("vcResident")," v",b.resident.served]}),b&&b.resident&&!b.resident.served&&(0,e.jsxs)("code",{style:{...n,color:"#b45309",fontWeight:600},children:[t("vcResident")," ",t("vcResidentDownShort")]}),b&&b.resident&&b.resident.served&&b.resident.managed===!1&&(0,e.jsxs)("code",{style:{...n,color:"#b45309",fontWeight:600},children:[t("vcResident")," v",b.resident.served," \xB7 ",t(s?"vcResidentReplaceBlockedShort":Ce?"vcResidentLockUnknownShort":"vcResidentUnmanagedShort")]}),bt&&(0,e.jsxs)("code",{style:n,children:[t("vcPage")," v",bt]}),b&&b.onDisk&&(0,e.jsxs)("code",{style:n,children:[t("vcOnDisk")," v",b.onDisk]}),b&&b.latest&&(0,e.jsxs)("code",{style:n,children:[t("vcLatest")," v",b.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:G==="version",onClick:()=>Re(!0),children:G==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),b&&(b.stale||z||N||Ce||s)&&(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 ",b.stale?se("vcStale",{disk:b.onDisk,loaded:b.loaded}):z?se("vcResidentDown",{port:b.resident&&b.resident.port||"",cmd:b.restartCommand||"dsh-memory restart --port 7999"}):s?se("vcResidentReplaceBlocked",{served:Se,err:s.error||"",path:s.lockPath||"",cmd:b.restartCommand||"dsh-memory restart --port "+(b.resident&&b.resident.port||7999)}):Ce?se("vcResidentLockUnknown",{served:Se,path:b.resident&&b.resident.lock&&b.resident.lock.path||"",err:b.resident&&b.resident.lock&&b.resident.lock.error||""}):se("vcResidentUnmanaged",{served:Se,cmd:b.restartCommand||"dsh-memory restart --port 7999"})]}),Z?(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:!!G,onClick:Be,children:G==="restart"?"\u23F3 "+t("vcRestarting"):"\u{1F504} "+t("vcRestart")}),b.restartCommand&&(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:b.restartCommand})]}):(0,e.jsxs)("div",{style:{marginTop:6,lineHeight:1.7},children:["\u2139\uFE0F ",t("vcHostStale"),b.restartCommand&&(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:b.restartCommand})]})]})]}),bt&&b&&b.onDisk&&bt!==b.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:b.onDisk})}),b&&b.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:b.updateCommand})]}),b&&b.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",b.checkError]})]}),F&&F.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:F.agents.map(a=>(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:a.isDsh?t("dshHostLabel"):a.name}),a.isDsh&&a.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",a.version]}),!a.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),a.installed&&a.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),a.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),a.mcpConfigured===!0&&a.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),a.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",a.recallTool?t("enabled"):t("disabled"),")"]})]}),a.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",a.hook]}),!a.isDsh&&a.installed&&a.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!G,onClick:()=>Qe(a.name,"install"),children:t("installMcp")}),!a.isDsh&&a.installed&&a.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!G,onClick:()=>{window.confirm(t("uninstallConfirm"))&&Qe(a.name,"uninstall")},children:t("uninstallMcp")})]},a.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),h&&(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:h})})]}),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(a=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>at(a),disabled:!!G,children:[a==="A"?"\u{1F7E2} ":a==="B"?"\u{1F4B0} ":"\u2B50 ",tt[a].label]},a))})]}),(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)(Ne,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(Ne,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(we,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(we,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(we,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(we,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(we,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(Ne,{k:"recallIncludeBody",label:t("recallBody")}),(0,e.jsx)(we,{k:"secretHint",label:t("secretHint")}),(0,e.jsx)(we,{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:te?.vaultDir||"\u2014"}),te?.vaultName?`\uFF08${te.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(d[te?.vaultSource]||"vaultSrcDefault"),te?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:te.workspace})]}):null]}),O(k).map((a,y)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:a.name||"",placeholder:t("vaultNamePh"),onChange:x=>re(y,"name",x.target.value),style:Ye,disabled:m}),(0,e.jsx)("input",{value:a.path||"",placeholder:t("vaultPathPh"),onChange:x=>re(y,"path",x.target.value),style:Ye,disabled:m}),(0,e.jsx)("input",{value:a.match&&a.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:x=>re(y,"match",x.target.value),style:Ye,disabled:m}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>be(y),disabled:m,title:t("delete"),children:"\u2715"})]},y)),(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:me,disabled:m,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:k.activeVault||"",onChange:a=>J("activeVault",a.target.value),disabled:m,style:Ye,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),O(k).filter(a=>a&&a.name).map(a=>(0,e.jsx)("option",{value:a.name,children:a.name},a.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)(Ne,{k:"enabled",label:t("enabledLabel")}),(0,e.jsx)(we,{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)(Ne,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(Ne,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(we,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(we,{k:"recallMinScore",label:t("recallMinScore"),type:"number"}),(0,e.jsx)(we,{k:"captureCooldownMs",label:t("captureCooldownMs"),type:"number"}),Ae&&Ae.providers&&Ae.providers.length?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("captureProvider")}),(0,e.jsxs)("select",{value:k.captureProvider||"",onChange:a=>{J("captureProvider",a.target.value),J("captureModel","")},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:"",children:t("routeAuto")}),Ae.providers.map(a=>(0,e.jsx)("option",{value:a.id,children:a.label},a.id))]})]}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("captureModel")}),(0,e.jsxs)("select",{value:k.captureModel||"",onChange:a=>J("captureModel",a.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:"",children:t("routeAuto")}),((Ae.providers.find(a=>a.id===k.captureProvider)||{}).models||[]).map(a=>(0,e.jsx)("option",{value:a.id,children:a.label||a.id},a.id))]})]})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(we,{k:"captureProvider",label:t("captureProvider")}),(0,e.jsx)(we,{k:"captureModel",label:t("captureModel")})]}),(0,e.jsx)(Ne,{k:"captureFollowSession",label:t("captureFollowSession")}),(0,e.jsx)(Ne,{k:"captureFirstOnly",label:t("captureFirstOnly")}),(0,e.jsx)(we,{k:"sessionBudgetChars",label:t("sessionBudgetChars"),type:"number"}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"flex-end"},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!G,onClick:async()=>{W("llmtest");try{let a=await fetch(E+"/llm-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:k.captureProvider||"",model:k.captureModel||"",firstOnly:k.captureFirstOnly===!0})}).then(y=>y.json());a&&a.ok?X(t("llmTestOk")+"\uFF1A"+a.route.provider+(a.route.model?"/"+a.route.model:"")+" \xB7 "+a.ms+"ms \xB7 "+t("llmCandidates")+" "+a.candidates):X(t("llmTestFail")+"\uFF1A"+(a&&(a.failure?a.failure.code+" "+a.failure.message:a.error)||"?"),!1)}catch(a){X(t("llmTestFail")+"\uFF1A"+String(a&&a.message||a),!1)}finally{W("")}},children:G==="llmtest"?t("exporting"):"\u{1F50C} "+t("llmTest")})})]})]}),(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:a=>J("auditMode",a.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)(Gt,{label:t("auditExemptAgents"),value:k.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(F?.agents||[]).filter(a=>!a.isDsh).map(a=>({value:a.name,label:a.name}))],onChange:a=>J("auditExemptAgents",a)}),(0,e.jsx)(Gt,{label:t("auditExemptKinds"),value:k.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...At.filter(a=>a!=="all").map(a=>({value:a,label:t(_e[a])}))],onChange:a=>J("auditExemptKinds",a)}),(0,e.jsx)(we,{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)(Ne,{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:a=>J("autoWebMode",a.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)(we,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(we,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(we,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(Ne,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(Ne,{k:"autoRestartOnDrift",label:t("autoRestartOnDrift")}),(0,e.jsx)(Ne,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[G==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),ie&&G!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",ie]}),V&&G!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",V]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:p,disabled:!!G,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:m?()=>X(t("readonlyTitle")+"\uFF1A"+t("readonlyBody"),!1):Le,disabled:G==="save",title:t(m?"readonlyBody":"saveConfig"),children:G==="save"?"\u23F3 "+t("saving"):m?"\u{1F512} "+t("readonlyBtn"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function za({t,onReload:i,version:r}){let[g,c]=(0,o.useState)([]),[l,C]=(0,o.useState)([]),[R,S]=(0,o.useState)("all"),[H,k]=(0,o.useState)("all"),[v,m]=(0,o.useState)(""),[I,T]=(0,o.useState)(new Set),[w,j]=(0,o.useState)(""),[B,_]=(0,o.useState)(null),[te,q]=(0,o.useState)("pending"),F=(h,$=!0)=>{_({msg:h,ok:$}),setTimeout(()=>_(null),3e3)},Ie=[...new Set([...g,...l].map(h=>h.submittedBy).filter(Boolean))],V=(0,o.useCallback)(async()=>{try{let h=await fetch(`${E}/audit/list`).then($=>$.json());h.ok&&(c(h.pending||[]),C(h.rejected||[]),T(new Set),ve(new Set),ke({}))}catch{}},[]);(0,o.useEffect)(()=>{V()},[r,V]);let fe=(te==="pending"?g:l).filter(h=>{if(R!=="all"&&h.kind!==R||H!=="all"&&pt(h.submittedBy)!==H)return!1;if(v){let $=(h.created||"").slice(0,10);if($&&$!==v)return!1}return!0}),G=h=>T($=>{let le=new Set($);return le.has(h)?le.delete(h):le.add(h),le}),W=async(h,$)=>{let le=$||[...I];if(!le.length){F(t("noSelection"),!1);return}j("apply");let ye=t(h==="approved"?"toastApproved":h==="rejected"?"toastRejected":"toastCardDeleted");try{let Q=0;for(let X of le){let Be=h==="approved"?"audit/approve":h==="rejected"?"audit/reject":"delete";try{(await fetch(E+"/"+Be+"?path="+encodeURIComponent(X)+(h==="delete"?"&permanent=0":""))).ok||Q++}catch{Q++}}await V(),i&&i(),Q?F(t("toastFailed")+"\uFF08"+Q+"/"+le.length+"\uFF09",!1):F(ye+" "+le.length+" \u5F20")}catch(Q){F(t("toastFailed")+": "+String(Q&&Q.message||Q),!1)}finally{j("")}},[ie,ve]=(0,o.useState)(new Set),[Ae,ke]=(0,o.useState)({}),b=h=>Ae[h]||{},ce=async h=>{let $=h.path,le=!ie.has($);if(ve(ye=>{let Q=new Set(ye);return le?Q.add($):Q.delete($),Q}),!(!le||Ae[$])){ke(ye=>({...ye,[$]:{loading:!0}}));try{let ye=h.status||(te==="pending"?"pending":"rejected"),Q=await fetch(`${E}/card?path=${encodeURIComponent($)}&status=${ye}`).then(X=>X.json());Q&&Q.ok?ke(X=>({...X,[$]:{text:Q.text||""}})):ke(X=>({...X,[$]:{error:Q&&Q.error||"HTTP"}}))}catch(ye){ke(Q=>({...Q,[$]:{error:String(ye&&ye.message||ye)}}))}}},Re=[...I];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:Oe}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ta,{toast:B}),(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:R,onChange:h=>S(h.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("all")}),At.filter(h=>h!=="all").map(h=>(0,e.jsx)("option",{value:h,children:t(_e[h])},h))]}),(0,e.jsxs)("select",{value:H,onChange:h=>k(h.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allAgents")}),Qt(Ie).map(h=>(0,e.jsx)("option",{value:h,children:h},h))]}),(0,e.jsx)("input",{type:"date",value:v,onChange:h=>m(h.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"}})]}),(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${te==="pending"?" me-on":""}`,onClick:()=>q("pending"),children:[t("pending"),"\uFF08",g.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${te==="rejected"?" me-on":""}`,onClick:()=>q("rejected"),children:[t("rejected"),"\uFF08",l.length,"\uFF09"]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("label",{style:{fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:fe.length>0&&Re.length===fe.length,onChange:h=>{h.target.checked?T(new Set(fe.map($=>$.path))):T(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!Re.length||!!w,onClick:()=>W("approved"),children:["\u2713 ",t(te==="rejected"?"restore":"approve")]}),te==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!Re.length||!!w,onClick:()=>W("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!Re.length||!!w,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&W("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),fe.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:fe.map(h=>{let $=b(h.path),le=ie.has(h.path);return(0,e.jsxs)("div",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:I.has(h.path),onChange:()=>G(h.path)}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"0 6px"},title:t(le?"collapse":"expand"),"aria-expanded":le,onClick:()=>ce(h),children:le?"\u25BE":"\u25B8"}),(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[h.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},title:t(le?"collapse":"expand"),onClick:()=>ce(h),children:h.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:pt(h.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:h.created?h.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:h.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:h.severity==="high"?"#f87171":"#9ca3af"},children:h.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.reason||"-"}),te==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>W("approved",[h.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>W("rejected",[h.path]),children:"\u2715"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},title:t("restore"),onClick:()=>W("approved",[h.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},title:t("restoreDelete"),onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&W("delete",[h.path])},children:"\u{1F5D1}"})]})]}),le&&(0,e.jsxs)("div",{style:{padding:"2px 10px 12px 34px"},children:[$.loading&&(0,e.jsxs)("div",{style:{fontSize:12,opacity:.6},children:["\u23F3 ",t("loading")]}),$.error&&(0,e.jsxs)("div",{style:{fontSize:12,color:"#f87171"},children:["\u26A0 ",t("auditBodyFail"),"\uFF1A",$.error]}),$.text!=null&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"md-meta",style:{marginBottom:6},children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:Ue[h.kind]||"#6B7280",borderColor:(Ue[h.kind]||"#6B7280")+"59",background:(Ue[h.kind]||"#6B7280")+"1a"},children:[ht[h.kind]||"\u{1F4CE}"," ",t(_e[h.kind]||"kindKnowledge")]}),(Array.isArray(h.tags)?h.tags:[]).slice(0,8).map(ye=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",ye]},ye)),!!h.reason&&(0,e.jsxs)("span",{className:"md-chip md-chip-st-warn",children:["\u2691 ",h.reason]})]}),(0,e.jsx)("div",{className:"md-doc",style:{maxHeight:340,overflow:"auto"},dangerouslySetInnerHTML:{__html:Dt(Ct($.text).body)}}),te==="pending"&&(0,e.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!!w,onClick:()=>W("approved",[h.path]),children:["\u2713 ",t("approve")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!w,onClick:()=>W("rejected",[h.path]),children:["\u2715 ",t("reject")]})]})]})]})]},h.path)})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function Ia({t,onReload:i,version:r}){let[g,c]=(0,o.useState)([]),[l,C]=(0,o.useState)(""),[R,S]=(0,o.useState)(null),H=(m,I=!0)=>{S({msg:m,ok:I}),setTimeout(()=>S(null),3200)},k=(0,o.useCallback)(async()=>{try{let m=await fetch(`${E}/recycle/list`).then(I=>I.json());m.ok&&c(m.items||[])}catch{}},[]);(0,o.useEffect)(()=>{k()},[r,k]);let v=async(m,I)=>{let T=(g.find(w=>w.path===I)||{}).title||I;C(m+I);try{let j=await fetch(E+(m==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(I)),B=await j.json().catch(()=>null);await k(),i&&i(),j.ok&&(!B||B.ok!==!1)?H(t(m==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+T):H(t("toastFailed")+"\uFF1A"+(B&&B.error||"HTTP "+j.status),!1)}catch(w){H(t("toastFailed")+"\uFF1A"+String(w&&w.message||w),!1)}finally{C("")}};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:Oe}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ta,{toast:R}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",t("tabRecycle")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("recycleHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!l||g.length===0,title:g.length?"":t("emptyRecycle"),onClick:async()=>{C("purgeAll");try{let m=await fetch(E+"/recycle/purge-expired?days=0"),I=await m.json().catch(()=>null);await k(),H(m.ok?t("toastPurgedExpired")+(I&&I.purged!=null?"\uFF08"+I.purged+"\uFF09":""):t("toastFailed"),m.ok)}catch(m){H(t("toastFailed")+"\uFF1A"+String(m&&m.message||m),!1)}finally{C("")}},children:t("emptyRecycle")})]}),g.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:g.map(m=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[m.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(m.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!l,onClick:()=>v("restore",m.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!l,onClick:()=>{window.confirm(t("purgeConfirm"))&&v("purge",m.path)},children:t("purge")})]},m.path))}):(0,e.jsxs)("div",{className:"mc-card",style:{padding:18,fontSize:12.5,opacity:.78,textAlign:"center",lineHeight:1.9},children:["\u{1F5D1}\uFE0F ",t("emptyRecycle"),(0,e.jsx)("br",{}),(0,e.jsx)("span",{style:{fontSize:11.5},children:t("recycleEmptyHint").split("{days}").join("30")})]})]})]})}var Aa=({card:t,t:i,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:Ue[t.kind]||Ue.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:ht[t.kind]||"\u{1F4CE}"}),g?Xt(t.title,g):t.title,Wa(t.updated)&&(0,e.jsx)("span",{className:"mc-new",children:i("newBadge")}),t.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",i("statusPending")]}),t.status==="rejected"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",i("statusRejected")]}),(!t.status||t.status==="approved")&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",i("statusApproved")]})]}),(0,e.jsx)("p",{children:g?Xt(t.summary||"",g):t.summary||""}),Vt(t).length>0&&(0,e.jsx)("div",{className:"mc-tags",children:Vt(t).slice(0,4).map(l=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",l]},l))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[ht[t.kind]||"\u{1F4CE}"," ",i(_e[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",pt(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",ct(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:i("delete"),onClick:l=>{l.stopPropagation(),window.confirm(i("deleteConfirm"))&&c&&c(t.path)},children:"\u{1F5D1}"})]})]});function Ba({t,tab:i,onReload:r,version:g}){let[c,l]=(0,o.useState)(null),[C,R]=(0,o.useState)(""),[S,H]=(0,o.useState)(null),[k,v]=(0,o.useState)(null),[m,I]=(0,o.useState)(null),[T,w]=(0,o.useState)(null),j=(0,o.useCallback)(async()=>{F("align");try{let s=await fetch(E+"/align").then(N=>N.json());s&&s.findings?w(s):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{F("")}},[t]),B=async()=>{if(window.confirm(t("alignFixConfirm"))){F("alignfix");try{let s=await fetch(E+"/setup-run",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}).then(N=>N.json());s&&s.ok?(notify(t("alignFixed")),await j()):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{F("")}}},[_,te]=(0,o.useState)([]),[q,F]=(0,o.useState)(""),[Ie,V]=(0,o.useState)(!1),fe=(0,o.useCallback)(async()=>{if(!(!S||!S.merge||!S.merge.length)&&window.confirm(t("mergeAllConfirm"))){F("merge");try{let s={},N=J=>s[J]===void 0?J:s[J]=N(s[J]),z=(J,ee)=>{s[N(J)]=N(ee)},Z=new Set;for(let J of S.merge)Z.add(J.a.path),Z.add(J.b.path),z(J.a.path,J.b.path);let se={};for(let J of Z){let ee=N(J);(se[ee]=se[ee]||[]).push(J)}let ue=0;for(let J of Object.values(se)){if(J.length<2)continue;(await fetch(`${E}/merge?paths=${encodeURIComponent(J.join(","))}`).then(Ke=>Ke.json())).ok&&ue++}await G(),r&&r()}catch{}F("")}},[S,G,r,t]);async function G(){try{let s=await Promise.all([fetch(`${E}/stats`),fetch(`${E}/budget`),fetch(`${E}/capture-log`),fetch(`${E}/cards?status=all&limit=30&agent=${yt}`)]),[N,z,Z,se]=await Promise.all(s.map(ue=>ue.json()));N&&N.ok&&l(N),z&&z.ok&&v(z),Z&&Z.ok&&I(Z),se&&se.ok&&te(se.cards||[]),R(!N||!N.ok?t("adminLoadFail"):"")}catch{R(t("adminLoadFail"))}}let W=(0,o.useCallback)(async()=>{F("scan");try{let s=await fetch(`${E}/optimize`).then(N=>N.json());s.ok&&H(s)}catch{R(t("adminLoadFail"))}finally{F("")}},[t]),[ie,ve]=(0,o.useState)(null),Ae=(0,o.useCallback)(async()=>{F("refine");try{let s=await fetch(`${E}/refine-scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:8})}).then(N=>N.json());s&&s.ok?ve(s):notify(s&&s.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{F("")}},[t]),ke=async(s,N)=>{if(!(N==="merge"&&!window.confirm(t("mergeConfirm")))){F("refineapply");try{let z=await fetch(`${E}/refine-apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({a:s.a.path,b:s.b.path,action:N,relation:s.relation})}).then(Z=>Z.json());z&&z.ok?(notify(t("refineApplied")),ve(Z=>Z&&{...Z,findings:(Z.findings||[]).filter(se=>!(se.a.path===s.a.path&&se.b.path===s.b.path))}),await G(),r&&r()):notify(z&&z.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{F("")}}},[b,ce]=(0,o.useState)(null),Re=(0,o.useCallback)(async()=>{F("junk");try{let s=await fetch(`${E}/refine-junk`).then(N=>N.json());s&&s.ok?ce(s.items||[]):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{F("")}},[t]),h=async s=>{if(s.length&&window.confirm(t("junkRecycleAllConfirm"))){F("junkpurge");try{let N=await fetch(`${E}/refine-junk-purge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:s})}).then(z=>z.json());N&&N.removed?(notify(t("junkDone")+"\uFF1A"+N.removed.length+(N.failed?.length?"\uFF08\u5931\u8D25 "+N.failed.length+"\uFF09":"")),ce(z=>z&&z.filter(Z=>!N.removed.includes(Z.path))),await G(),r&&r()):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{F("")}}},[$,le]=(0,o.useState)(null),ye=(0,o.useCallback)(async()=>{F("goals");try{let s=await fetch(E+"/refine-goals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:30})}).then(N=>N.json());s&&s.ok?le(s):notify(s&&s.error||t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{F("")}},[t]),Q=async s=>{F("goalskeep");try{let N=await fetch(E+"/refine-goals-keep",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:s.members.map(z=>z.path)})}).then(z=>z.json());N&&N.ok?(notify(t("goalDone")),le(z=>z&&{...z,clusters:(z.clusters||[]).filter(Z=>Z.goal!==s.goal)})):notify(t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{F("")}},X=async s=>{if(window.confirm(t("mergeConfirm"))){F("goalsmerge");try{let N=await fetch(E+"/merge?paths="+encodeURIComponent(s.members.map(z=>z.path).join(","))).then(z=>z.json());N&&N.ok?(notify(t("goalMerged")),le(z=>z&&{...z,clusters:(z.clusters||[]).filter(Z=>Z.goal!==s.goal)}),await G(),r&&r()):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{F("")}}};(0,o.useEffect)(()=>{G()},[g]);let Be=async(s,N)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${E}/merge?paths=${encodeURIComponent(s+","+N)}`).then(Z=>Z.json())).ok&&(await G(),r&&r())}catch{}},Se=async s=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${E}/delete?path=${encodeURIComponent(s)}`).then(z=>z.json())).ok&&(await G(),r&&r())}catch{}},Te=["project","knowledge","content","prompt","business","tool","mistake"],Ce=({title:s,kind:N,updated:z,path:Z})=>(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:dt.colors[N]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:ct(z)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Se(Z),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:Oe}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[C&&(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 ",C]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:G,children:["\u21BB ",t("retry")]})]}),i==="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{1F527} ",t("alignTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!q,onClick:j,children:t(q==="align"?"exporting":"alignRun")}),T&&T.counts&&T.counts.fix>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!q,onClick:B,children:t(q==="alignfix"?"exporting":"alignFix")}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("alignHint")})]}),T&&T.findings?(0,e.jsxs)("div",{style:{marginTop:6},children:[(0,e.jsxs)("div",{style:{fontSize:12,opacity:.75,marginBottom:4},children:[t("alignDisk")," v",T.onDisk||"?",T.residentServed?" \xB7 "+t("alignResident")+" v"+T.residentServed:"",T.hostVersion?" \xB7 "+t("alignHost")+" v"+T.hostVersion:""]}),(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:T.findings.map((s,N)=>(0,e.jsxs)("li",{style:{padding:"4px 2px",borderTop:N?"1px solid rgba(127,127,127,0.12)":"none",fontSize:12},children:[(0,e.jsx)("span",{style:{fontWeight:700,color:s.level==="fix"?"#ef4444":s.level==="warn"?"#f59e0b":"#10b981"},children:s.level==="fix"?"\u2717":s.level==="warn"?"\u26A0":"\u2713"})," ",(0,e.jsx)("span",{children:s.title}),s.detail?(0,e.jsx)("div",{style:{opacity:.75,marginLeft:14},children:s.detail}):null,s.command?(0,e.jsxs)("div",{style:{marginLeft:14,opacity:.9},children:["\u2192 ",(0,e.jsx)("code",{children:s.command})]}):null]},N))})]}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginTop:4},children:t("alignIdle")})]}),(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:()=>G(),children:["\u21BB ",t("refresh")]})]}),m?m.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(m.entries||[]).length===0?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogEmpty")}):(0,e.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,e.jsx)("tbody",{children:(m.entries||[]).map((s,N)=>{let z=Sa[s.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:ct(s.time?new Date(s.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:z[1],fontWeight:600},children:[z[0]," ",s.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:s.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:s.preview||"",children:s.preview||""})]},N)})})})}):(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",_.length,"\uFF09"]}),_.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:_.map(s=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[s.kind]||Ue.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.title}),s.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:ct(s.updated)})]},s.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 s=c.trend,N=Math.max(...s.map(ue=>ue.count),1),z=260,Z=50,se=z/s.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:z,height:Z,style:{display:"block",width:"100%",height:50},children:s.map((ue,J)=>{let ee=Math.round(ue.count/N*(Z-4));return(0,e.jsx)("rect",{x:J*se+1,y:Z-ee,width:Math.max(se-2,2),height:ee,rx:1.5,fill:ue.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:ue.count>0?.85:.35},ue.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:Te.map(s=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:dt.colors[s]||"#666"}}),t(_e[s]),": ",c.byKind?.[s]||0]},s))})]}),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(s=>(0,e.jsx)(Ce,{title:s.title,kind:s.kind,updated:s.updated,path:s.path},s.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})]})]}),i==="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:!!q,onClick:W,children:q==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),S&&S.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!q,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){F("oneclick");try{let s=JSON.stringify({cleanupStale:Ie}),z=await(await fetch(`${E}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:s})).json();z&&z.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${z.plan.merged} ${t("optimizedMerged")}${Ie?` \xB7 ${z.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await G(),r&&r(),H(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{F("")}}},children:q==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),S&&S.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:Ie,onChange:s=>V(s.target.checked)}),t("oneClickAlsoStale")]})]}),!S&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),S&&(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}}),S.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!q,onClick:fe,children:t(q==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),S.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:S.merge.map((s,N)=>(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:[s.a.title," \u21C4 ",s.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(s.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Be(s.a.path,s.b.path),children:t("mergeNow")})]},N))}):(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",S.stale?.length||0,"\uFF09"]}),S.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!q,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;F("clean");let s=0;for(let N of S.stale)try{await fetch(`${E}/delete?path=${encodeURIComponent(N.path)}`),s++}catch{}F(""),notify(`${s} ${t("deletedStale")}`),await G(),r&&r()},children:t("cleanStale")})}),S.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:S.stale.map(s=>(0,e.jsx)(Ce,{title:s.title,kind:"other",updated:s.updated,path:s.path},s.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9ED} ",t("refineTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!q,onClick:Ae,children:t(q==="refine"?"exporting":"refineScan")}),(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("refineHint")})]}),ie?.findings?.length?ie.findings.map((s,N)=>(0,e.jsxs)("div",{style:{borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",padding:"7px 2px"},children:[(0,e.jsxs)("div",{style:{fontSize:12,marginBottom:3},children:[(0,e.jsx)("span",{style:{fontWeight:700,color:s.relation==="conflict"?"#ef4444":s.relation==="duplicate"?"#f59e0b":"#10b981"},children:t("refineRel_"+s.relation)}),(0,e.jsxs)("span",{style:{opacity:.55},children:[" \xB7 sim ",s.sim," \xB7 ",s.useModel||""]}),s.conflict?(0,e.jsx)("span",{style:{marginLeft:6},children:s.conflict}):null]}),(0,e.jsxs)("div",{style:{fontSize:12,opacity:.85,marginBottom:5},children:["A\uFF1A",s.a.title,(0,e.jsx)("br",{}),"B\uFF1A",s.b.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!q,onClick:()=>ke(s,"keepA"),children:t("refineKeepA")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!q,onClick:()=>ke(s,"keepB"),children:t("refineKeepB")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!q,onClick:()=>ke(s,"keepBoth"),children:t("refineKeepBoth")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!q,onClick:()=>ke(s,"merge"),children:t("refineMerge")})]})]},N)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(ie?"refineNone":"refineIdle")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9F9} ",t("junkTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!q,onClick:Re,children:t(q==="junk"?"exporting":"junkScan")}),b?.length?(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!q,onClick:()=>h(b.map(s=>s.path)),children:t(q==="junkpurge"?"exporting":"junkRecycleAll")}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("junkHint")})]}),b?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:b.map((s,N)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 2px",borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",fontSize:12},children:[(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:s.reasons.join("\uFF1B"),children:s.title||s.path}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:s.reasons[0]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!q,onClick:()=>h([s.path]),children:t("junkRecycle")})]},N))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(b?"junkNone":"junkIdle")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("goalTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!q,onClick:ye,children:t(q==="goals"?"exporting":"goalScan")}),$?(0,e.jsxs)("span",{style:{opacity:.6,fontSize:11},children:[t("goalStats"),"\uFF1A",$.cached," / ",$.calls]}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("goalHint")})]}),$?.clusters?.length?$.clusters.map((s,N)=>(0,e.jsxs)("div",{style:{borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",padding:"7px 2px"},children:[(0,e.jsxs)("div",{style:{fontSize:12,marginBottom:4},children:[(0,e.jsx)("b",{children:s.goal})," ",(0,e.jsxs)("span",{style:{opacity:.55},children:["\xB7 ",s.members.length," ",t("goalCards")]})]}),(0,e.jsx)("ul",{style:{margin:"0 0 5px",padding:"0 0 0 16px",fontSize:12,opacity:.85},children:s.members.map((z,Z)=>(0,e.jsx)("li",{children:z.title},Z))}),(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!q,onClick:()=>Q(s),children:t("goalKeep")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!q,onClick:()=>X(s),children:t("goalMerge")})]})]},N)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t($?"goalNone":"goalIdle")})]})]})]})]})}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 La({t,newCard:i,setNewCard:r,onCreated:g}){if(!i)return null;let c=It.find(v=>v.key===i.template),l=i.body||(c?t(c.bodyKey):""),C=i.kind||(c?c.kind:"knowledge"),R=i.tags||(c?t(c.tagKey):""),S=i._creating,H=v=>{let m=It.find(I=>I.key===v);r(I=>({...I,template:v,kind:m?m.kind:I.kind,body:m?t(m.bodyKey):I.body,tags:m?t(m.tagKey):I.tags}))},k=async()=>{if(!(!i.title&&!l)){r(v=>({...v,_creating:!0}));try{(await fetch(`${E}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i.title||t("untitled"),kind:C,tags:R.split(",").map(m=>m.trim()).filter(Boolean),body:l,source:"manual"})}).then(m=>m.json())).ok?(r(null),g&&g()):r(m=>({...m,_creating:!1}))}catch{r(m=>({...m,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>r(null),children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:v=>v.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(v=>(0,e.jsx)("button",{type:"button",className:`mc-btn${i.template===v.key?" me-on":""}`,onClick:()=>H(v.key),children:t(v.label)},v.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${i.template===""?" me-on":""}`,onClick:()=>r(v=>({...v,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:C,onChange:v=>r(m=>({...m,kind:v.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(v=>(0,e.jsx)("option",{value:v,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:v},v))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:i.title||"",onChange:v=>r(m=>({...m,title:v.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:R,onChange:v=>r(m=>({...m,tags:v.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:l,onChange:v=>r(m=>({...m,body:v.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:S,onClick:k,children:t(S?"exporting":"createCard")})})]})]})]})}async function Yt(t){let i=String(t||"");if(!i)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(i),!0}catch{}try{let r=document.createElement("textarea");r.value=i,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 ja({t,onClose:i}){let[r,g]=(0,o.useState)(""),[c,l]=(0,o.useState)(""),[C,R]=(0,o.useState)(""),[S,H]=(0,o.useState)(!0),[k,v]=(0,o.useState)(!1),[m,I]=(0,o.useState)(""),[T,w]=(0,o.useState)(""),j=(0,o.useRef)(null),B=(0,o.useRef)(null),_=()=>{let W=j.current;if(W)try{W.focus(),W.select()}catch{}},te=W=>{I(W),B.current&&clearTimeout(B.current),B.current=setTimeout(()=>I(""),2400)};(0,o.useEffect)(()=>{let W=!0;return fetch(E+"/diagnostics").then(ie=>ie.json()).then(ie=>{W&&(ie&&ie.ok?(l(String(ie.diagnostics||"")),R(String(ie.version||""))):v(!0))}).catch(()=>{W&&v(!0)}).finally(()=>{W&&H(!1)}),()=>{W=!1}},[]),(0,o.useEffect)(()=>{let W=ie=>{ie.key==="Escape"&&i()};return window.addEventListener("keydown",W),()=>{window.removeEventListener("keydown",W),B.current&&clearTimeout(B.current)}},[i]);let q=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),F=()=>{let W=r.trim().split(`
|
|
306
|
+
`)[0]||"",ie=Et({title:"[Bug] "+(W.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Wt({description:r,diagnostics:c,version:C})});try{window.open(ie,"_blank","noopener")}catch{te(t("fbCopyFail"))}},Ie=async()=>{await Yt(c)?(w(""),te(t("fbCopiedDiag"))):(w(c),te(t("fbCopyManual")))},V=async()=>{let W=$t({lang:q,description:r,diagnostics:c});await Yt(W)?(w(""),te(t("fbCopiedPrompt"))):(w(W),te(t("fbCopyManual")))},fe={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},G={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:i,children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:W=>W.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:["\u{1F41E} ",t("fbTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:i,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:W=>g(W.target.value),placeholder:t("fbDesc"),rows:5,style:fe}),(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:Ie,disabled:!c,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:G,children:S?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()){te(t("fbNeedDesc"));return}F()},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:V,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),m&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:m}),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:_,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:j,readOnly:!0,value:T,rows:7,style:fe})]})]})]})]})}function Fa({t,card:i,query:r,onClose:g,onDelete:c,onFeedback:l}){(0,o.useEffect)(()=>{let j=B=>{B.key==="Escape"&&g()};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[g]);let{meta:C,body:R}=(0,o.useMemo)(()=>Ct(i.text||""),[i.text]),S=j=>{let B=C.find(([_])=>String(_).toLowerCase()===j);return B?B[1]:""},H=Ot(S("tags")),k=S("kind")||"knowledge",v=(S("status")||"approved").toLowerCase(),m=Ue[k]||"#6B7280",I=(R||"").length>460,[T,w]=(0,o.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:g,children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsxs)("div",{className:"me-dialog",onClick:j=>j.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:ht[k]||"\u{1F4CE}"}),i.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:()=>l&&l(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>l&&l(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),I&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":T,onClick:()=>w(j=>!j),children:t(T?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&c&&c(i.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:g,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:m,borderColor:m+"59",background:m+"1a"},children:[ht[k]||"\u{1F4CE}"," ",t(_e[k]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(v==="approved"?"md-chip-st-ok":v==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[v==="approved"?"\u2705":v==="pending"?"\u23F3":"\u26D4"," ",t(v==="approved"?"statusApproved":v==="pending"?"statusPending":"statusRejected")]}),(Array.isArray(H)?H:[]).slice(0,8).map(j=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",j]},j)),!!S("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",ct(S("updated"))]}),!!S("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",S("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:T?{}:{maxHeight:300,overflow:"hidden"},onClick:T?void 0:j=>{j.stopPropagation(),w(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Dt(R)}})}),!T&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:j=>{j.stopPropagation(),w(!0)},children:[t("expand")," \u2304"]})]})]})}function Pa({t,onOpen:i,all:r,onAllChange:g,onMutate:c,active:l,visible:C}){let[R,S]=(0,o.useState)(null),[H,k]=(0,o.useState)(""),v=(0,o.useRef)(!1),m=(0,o.useRef)(0),I=(0,o.useRef)(t);I.current=t;let T=(0,o.useCallback)(async()=>{try{v.current=!1;let _=await(await fetch(`${E}/graph${r?"?all=1":""}`)).json();_.ok?(S(_),k(""),v.current=!0):(S(null),k(_.error||t("error")))}catch(B){k(String(B&&B.message?B.message:B))}},[r,t]);(0,o.useEffect)(()=>{if(!l||v.current)return;let B=!0;return fetch(`${E}/graph${r?"?all=1":""}`).then(_=>_.json()).then(_=>{B&&(_.ok?(S(_),k(""),v.current=!0):(S(null),k(_.error||t("error"))))}).catch(_=>{B&&k(String(_&&_.message?_.message:_))}),()=>{B=!1}},[r,t,l]),(0,o.useEffect)(()=>{C&&R&&m.current++},[C,R]);let w=(0,o.useCallback)(async B=>{try{let te=await(await fetch(`${E}/delete?path=${encodeURIComponent(B)}`)).json();return te&&te.ok?(await T(),c&&c(),!0):!1}catch{return!1}},[T]),j=(0,o.useCallback)(async B=>{if(!B||B.length<2)return!1;try{let _=await fetch(`${E}/merge?paths=${encodeURIComponent(B.join(","))}`).then(te=>te.json());return _&&_.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:Oe}),H&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",H]}),!R&&!H&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),R&&R.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),R&&R.nodes.length>0&&(0,e.jsx)(Oa,{nodes:R.nodes,edges:R.edges,onOpen:i,onDelete:w,onMerge:j,t,all:r,onAllChange:g,countLabel:`${R.nodes.length} ${t("nodes")} \xB7 ${Ha(R.edges)} ${t("edges")}`,fitTrigger:m.current})]})}function Ha(t){let i=new Set;for(let r of t||[])i.add([r.source,r.target].sort().join("|"));return i.size}var dt={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 Oa({nodes:t,edges:i,onOpen:r,onDelete:g,onMerge:c,t:l,countLabel:C,all:R,onAllChange:S,fitTrigger:H}){let k=(0,o.useRef)(null),v=(0,o.useRef)(null),m=(0,o.useRef)(null),I=(0,o.useRef)(null),T=(0,o.useRef)(null),w=(0,o.useRef)(r);(0,o.useEffect)(()=>{w.current=r},[r]);let j=(0,o.useRef)(g);(0,o.useEffect)(()=>{j.current=g},[g]);let B=(0,o.useRef)(c);(0,o.useEffect)(()=>{B.current=c},[c]);let[_,te]=(0,o.useState)(""),[q,F]=(0,o.useState)(null),Ie=(0,o.useRef)("");(0,o.useEffect)(()=>{Ie.current=_.trim().toLowerCase()},[_]),(0,o.useEffect)(()=>{let p=m.current;if(!p)return;let d=_.trim().toLowerCase();if(!d)return;let O=p.nodes.find(re=>(re.name||"").toLowerCase().includes(d));O&&(m.current.selectedId=O.id,F(O.id),p.panX=p.w/2-O.x*p.zoom,p.panY=p.h/2-O.y*p.zoom,p.render&&p.render())},[_]);let[V,fe]=(0,o.useState)("all"),[G,W]=(0,o.useState)(!1),ie=(0,o.useRef)("all"),[ve,Ae]=(0,o.useState)(""),ke=(0,o.useRef)(""),[b,ce]=(0,o.useState)(!1),Re=(0,o.useRef)(!1),[h,$]=(0,o.useState)(null);(0,o.useEffect)(()=>{ie.current=V},[V]),(0,o.useEffect)(()=>{ke.current=ve},[ve]),(0,o.useEffect)(()=>{Re.current=b},[b]);let le=(0,o.useMemo)(()=>{let p=new Map;for(let d of t)for(let O of d.tags||[]){let re=String(O).trim();re&&p.set(re,(p.get(re)||0)+1)}return[...p.entries()].sort((d,O)=>O[1]-d[1]).slice(0,24).map(([d,O])=>({tag:d,n:O}))},[t]),ye=(()=>{let p=_.trim().toLowerCase();return!!p&&!t.some(d=>(d.title||d.name||"").toLowerCase().includes(p)||String(d.kind||"").toLowerCase().includes(p)||String(_e[d.kind]||"").toLowerCase().includes(p))})();(0,o.useEffect)(()=>{let p=m.current;p&&p.wake&&p.wake()},[_]),(0,o.useEffect)(()=>{let p=m.current;p&&p.render&&p.render()},[V,ve,b]);let Q=(0,o.useRef)(null),[X,Be]=(0,o.useState)([]),[Se,Te]=(0,o.useState)(null),[Ce,s]=(0,o.useState)(!1),[N,z]=(0,o.useState)(null),[Z,se]=(0,o.useState)(""),ue=(0,o.useRef)(null),J=(0,o.useRef)(null),ee=(p,d=!0)=>{ue.current&&clearTimeout(ue.current),z({msg:p,ok:d}),ue.current=setTimeout(()=>z(null),1900)},Ke=p=>{se(p),J.current&&clearTimeout(J.current),J.current=setTimeout(()=>se(""),1600)};(0,o.useEffect)(()=>()=>{ue.current&&clearTimeout(ue.current),J.current&&clearTimeout(J.current)},[]);let Le=(0,o.useMemo)(()=>t.reduce((p,d)=>(p[d.id]=d,p),{}),[t]);return(0,o.useEffect)(()=>{let p=k.current;if(!p||t.length===0)return;let d=p.getContext("2d");if(!d)return;let O=Math.max(1,window.devicePixelRatio||1),re=()=>document.documentElement.getAttribute("data-theme")==="dark",me={};i.forEach(u=>{me[u.source]=(me[u.source]||0)+1,me[u.target]=(me[u.target]||0)+1});let be=Math.max(1,...Object.values(me)),n={nodes:t.map(u=>({id:u.id,name:u.title||"",type:u.kind||"other",r:9+Math.min(10,(me[u.id]||0)/be*8),x:0,y:0,vx:0,vy:0})),edges:i.map(u=>({sourceNodeId:u.source,targetNodeId:u.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:O,ctx:d,multi:[],marquee:null};n.domain=t,n.domainById=t.reduce((u,A)=>(u[A.id]=A,u),{}),n.nodes.forEach((u,A)=>{let M=A/n.nodes.length*Math.PI*2-Math.PI/2;u.x=Math.cos(M)*60,u.y=Math.sin(M)*60});let Ye=[...new Set(n.nodes.map(u=>u.type))];n.clustered=Ye.length>1,n.typeCenters={},Ye.forEach((u,A)=>{let M=A/Ye.length*Math.PI*2-Math.PI/2;n.typeCenters[u]={x:Math.cos(M)*160,y:Math.sin(M)*160}}),m.current=n;let tt=0,at=0,Qe=()=>{let u=p.clientWidth,A=p.clientHeight;n.w=u,n.h=A,p.width=u*O,p.height=A*O,d.setTransform(O,0,0,O,0,0),(tt===0||at===0)&&u>0&&A>0&&n.tickCount>0&&requestAnimationFrame(()=>x()),tt=u,at=A};Qe();let we=new ResizeObserver(Qe);we.observe(p.parentElement);let ut=(u,A)=>u&&u.length>A?u.slice(0,A)+"\u2026":u,Ne=(u,A,M,P)=>{if(d.beginPath(),P==="rect")d.rect(u-M,A-M*.75,M*2,M*1.5);else if(P==="diamond")d.moveTo(u,A-M),d.lineTo(u+M,A),d.lineTo(u,A+M),d.lineTo(u-M,A),d.closePath();else if(P==="hexagon"){for(let K=0;K<6;K++){let de=Math.PI/3*K-Math.PI/2,ae=u+M*Math.cos(de),De=A+M*Math.sin(de);K===0?d.moveTo(ae,De):d.lineTo(ae,De)}d.closePath()}else d.arc(u,A,M,0,Math.PI*2)},a=new Map,y=(u,A)=>{let M=u+"|"+Math.round(A),P=a.get(M);if(!P){let K=parseInt(u.slice(1,3),16),de=parseInt(u.slice(3,5),16),ae=parseInt(u.slice(5,7),16);P=d.createRadialGradient(-A*.3,-A*.3,0,0,0,A*1.2),P.addColorStop(0,"rgba("+Math.min(255,K+70)+","+Math.min(255,de+70)+","+Math.min(255,ae+70)+",0.95)"),P.addColorStop(1,u),a.set(M,P)}return P},x=()=>{if(!n.nodes.length)return;let u=1/0,A=-1/0,M=1/0,P=-1/0;n.nodes.forEach(Ee=>{u=Math.min(u,Ee.x),A=Math.max(A,Ee.x),M=Math.min(M,Ee.y),P=Math.max(P,Ee.y)});let K=20,de=A-u+K*2,ae=P-M+K*2,De=Math.min(n.w/de,n.h/ae);n.zoom=Math.max(.35,Math.min(1.8,De)),n.panX=n.w/2-(u+A)/2*n.zoom,n.panY=n.h/2-(M+P)/2*n.zoom};I.current=x;let U=()=>{d.clearRect(0,0,n.w,n.h),n.searchTerm=Ie.current,n.kindFilter=ie.current,n.timeMode=Re.current,n.tagFilter=ke.current;let u=n.tagFilter,A=n.kindFilter,M=f=>String(f||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");d.save(),d.strokeStyle=re()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",d.lineWidth=.5;for(let f=0;f<n.w;f+=24)d.beginPath(),d.moveTo(f,0),d.lineTo(f,n.h),d.stroke();for(let f=0;f<n.h;f+=24)d.beginPath(),d.moveTo(0,f),d.lineTo(n.w,f),d.stroke();d.restore(),d.save(),d.translate(n.panX,n.panY),d.scale(n.zoom,n.zoom);let P={};n.nodes.forEach(f=>P[f.id]=f);let K=n.nodes.length>40,de=K?1.5:.55,ae=n.selectedId||n.hoverId,De=_t({panX:n.panX,panY:n.panY,zoom:n.zoom,w:n.w,h:n.h,margin:80}),Ee=(()=>{let f=(n.searchTerm||"").toLowerCase();if(!f)return null;let ne=[];for(let oe of n.nodes){let Me=(n.domainById[oe.id]||{}).kind||"other";if(((oe.name||"").toLowerCase().includes(f)||String(_e[Me]||"").toLowerCase().includes(f)||String(Me).toLowerCase().includes(f))&&ne.push(oe.id),ne.length>200)break}return ne})(),nt=Kt(n.nodes,{limit:Ut(n.nodes.length),focusId:ae,hoverId:n.hoverId,searchHits:Ee,degree:me}),ge=new Map,xe=(f,ne)=>{let oe=f+"|"+ne,he=ge.get(oe);return he===void 0&&(d.font=f,he=d.measureText(ne).width,ge.set(oe,he)),he},Pe=n.nodes.length<=250,We=new Map;n.edges.forEach(f=>{let ne=P[f.sourceNodeId],oe=P[f.targetNodeId];if(!ne||!oe||!Nt(ne.x,ne.y,10,De)&&!Nt(oe.x,oe.y,10,De))return;if(A!=="all"){let it=n.domainById[f.sourceNodeId]&&n.domainById[f.sourceNodeId].kind,Je=n.domainById[f.targetNodeId]&&n.domainById[f.targetNodeId].kind;if(it!==A&&Je!==A)return}if(u){let it=n.domainById[f.sourceNodeId]&&(n.domainById[f.sourceNodeId].tags||[]).includes(u),Je=n.domainById[f.targetNodeId]&&(n.domainById[f.targetNodeId].tags||[]).includes(u);if(!it&&!Je)return}let he=oe.x-ne.x,Me=oe.y-ne.y,Fe=Math.sqrt(he*he+Me*Me)||1,Ze=K?12:18,et=-Me/Fe*Ze,xt=he/Fe*Ze,kt=(ne.x+oe.x)/2+et,wt=(ne.y+oe.y)/2+xt,mt=dt.colors[n.domainById[ne.id]&&n.domainById[ne.id].kind||"other"],gt=ae&&(f.sourceNodeId===ae||f.targetNodeId===ae),Mt=ae?gt?.6:.08:K?.14:.24,Xe=parseInt(mt.slice(1,3),16),ft=parseInt(mt.slice(3,5),16),Tt=parseInt(mt.slice(5,7),16),Ve=gt?1.6+(f.weight||1):.8+(f.weight||1)*.5,ot=Xe+","+ft+","+Tt+","+Mt+","+Ve,$e=We.get(ot);$e||($e={path:new Path2D,stroke:"rgba("+Xe+","+ft+","+Tt+","+Mt+")",width:Ve},We.set(ot,$e)),$e.path.moveTo(ne.x,ne.y),$e.path.quadraticCurveTo(kt,wt,oe.x,oe.y)}),We.forEach(f=>{d.strokeStyle=f.stroke,d.lineWidth=f.width,d.stroke(f.path)});let He=null;ae&&(He=new Set,n.edges.forEach(f=>{f.sourceNodeId===ae?He.add(f.targetNodeId):f.targetNodeId===ae&&He.add(f.sourceNodeId)}));let Ge=[];if(n.nodes.forEach(f=>{if(!Nt(f.x,f.y,f.r+2,De))return;let ne=n.domainById[f.id]||{},oe=ne.kind||"other",he=n.timeMode?Ea(ne.updated):dt.colors[oe],Me=dt.shapes[oe],Fe=n.selectedId===f.id,Ze=n.hoverId===f.id,et=n.searchTerm||"",xt=!et||(f.name||"").toLowerCase().includes(et)||String(_e[oe]||"").toLowerCase().includes(et)||String(oe).toLowerCase().includes(et),kt=A==="all"||oe===A,wt=!u||(ne.tags||[]).includes(u),mt=ae&&f.id!==ae&&!(He&&He.has(f.id))||et&&!xt||!kt||!wt;d.save(),d.globalAlpha=mt?.08:1,(Fe||Ze)&&Pe&&(d.shadowColor=he,d.shadowBlur=Fe?20:14),d.translate(f.x,f.y),Ne(0,0,f.r,Me),d.fillStyle=y(he,f.r),d.fill(),d.restore(),Fe?(d.save(),Ne(f.x,f.y,f.r+3,Me),d.strokeStyle=he,d.lineWidth=3,d.shadowColor=he,d.shadowBlur=12,d.stroke(),d.restore()):Ze?(d.save(),Ne(f.x,f.y,f.r+2,Me),d.strokeStyle=he,d.lineWidth=2,d.stroke(),d.restore()):et&&xt?(d.save(),Ne(f.x,f.y,f.r+2,Me),d.strokeStyle="#e11d48",d.lineWidth=2,d.stroke(),d.restore()):n.multi.indexOf(f.id)>=0&&(d.save(),Ne(f.x,f.y,f.r+2,Me),d.strokeStyle="#60a5fa",d.lineWidth=2,d.shadowColor="#60a5fa",d.shadowBlur=8,d.stroke(),d.restore());let gt=ut(f.name,16);if((Fe||Ze||nt.has(f.id)&&n.zoom>de||!K&&n.zoom>.6)&&kt&&wt){let Xe=1/n.zoom,ft="500 "+(12*Xe).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";d.font=ft;let Ve=xe(ft,gt)+16*Xe,ot=18*Xe,$e=f.y+f.r+8*Xe,it=!0;for(let Je of Ge)if(f.x-Ve/2<Je.x+Je.w&&f.x+Ve/2>Je.x&&$e<Je.y+Je.h&&$e+ot>Je.y){it=!1;break}if(!it&&!Fe&&!Ze)return;Ge.push({x:f.x-Ve/2,y:$e,w:Ve,h:ot}),d.fillStyle=re()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",d.beginPath(),d.roundRect?d.roundRect(f.x-Ve/2,$e,Ve,ot,4*Xe):d.rect(f.x-Ve/2,$e,Ve,ot),d.fill(),d.strokeStyle=re()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",d.lineWidth=1*Xe,d.stroke(),d.fillStyle=re()?Fe||Ze?"#eee":"#bbb":Fe||Ze?"#111":"#444",d.textAlign="center",d.fillText(gt,f.x,$e+13*Xe)}}),d.restore(),n.marquee){let f=n.marquee,ne=Math.min(f.sx,f.ex),oe=Math.min(f.sy,f.ey),he=Math.abs(f.ex-f.sx),Me=Math.abs(f.ey-f.sy);d.save(),d.setLineDash([4,4]),d.strokeStyle="rgba(96,165,250,0.9)",d.lineWidth=1,d.fillStyle="rgba(96,165,250,0.12)",d.fillRect(ne,oe,he,Me),d.strokeRect(ne,oe,he,Me),d.restore()}if(n.hoverId&&Q.current){let f=n.domainById[n.hoverId],ne=n.nodes.find(function(oe){return oe.id===n.hoverId});if(f&&ne){let oe=n.edges.filter(function(Fe){return Fe.sourceNodeId===f.id||Fe.targetNodeId===f.id}).length,he=ne.x*n.zoom+n.panX,Me=ne.y*n.zoom+n.panY;Q.current.style.display="block",Q.current.style.left=he+14+"px",Q.current.style.top=Me-6+"px",Q.current.innerHTML="<b>"+M(f.title||f.name||"")+'</b><br/><span style="opacity:.8">'+M(f.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",oe)+"</span>"}}else Q.current&&(Q.current.style.display="none")},D=()=>{n.running=!0,n.raf||(n.raf=requestAnimationFrame(Y))};n.wake=D,n.render=U;let L=()=>{let u=n.nodes.length;n.tickCount++;let M=.9-Math.min(.4,n.tickCount/1500),P=u>1e3?3e3:u>100?2e3:u>50?1200:800,K=u>100?.002:.005,de=u>1e3?.012:u>100?.005:.01,ae=u>1e3?6:u>200?12:24,De={};n.nodes.forEach(ge=>De[ge.id]=ge);for(let ge=0;ge<u;ge++){if(n.dragNode===n.nodes[ge])continue;let xe=n.nodes[ge],Pe=0,We=0;for(let f=0;f<u;f++){if(ge===f)continue;let ne=xe.x-n.nodes[f].x,oe=xe.y-n.nodes[f].y,he=Math.sqrt(ne*ne+oe*oe)||1,Me=P/(he*he);Pe+=ne/he*Me,We+=oe/he*Me}if(n.clustered&&n.typeCenters[xe.type]){let f=n.typeCenters[xe.type];Pe+=(f.x-xe.x)*.006,We+=(f.y-xe.y)*.006}else Pe-=xe.x*de,We-=xe.y*de;let He=(xe.vx+Pe)*M,Ge=(xe.vy+We)*M;He=Math.max(-ae,Math.min(ae,He)),Ge=Math.max(-ae,Math.min(ae,Ge)),xe.vx=He,xe.vy=Ge}n.edges.forEach(ge=>{let xe=De[ge.sourceNodeId],Pe=De[ge.targetNodeId];if(!xe||!Pe)return;let We=Pe.x-xe.x,He=Pe.y-xe.y,Ge=Math.sqrt(We*We+He*He)||1,f=(Ge-100)*K,ne=We/Ge*f,oe=He/Ge*f;n.dragNode!==xe&&(xe.vx+=ne,xe.vy+=oe),n.dragNode!==Pe&&(Pe.vx-=ne,Pe.vy-=oe)});let Ee=0;n.nodes.forEach(ge=>{n.dragNode!==ge&&(ge.x+=ge.vx,ge.y+=ge.vy,Ee+=ge.vx*ge.vx+ge.vy*ge.vy)}),n.autoFitPending&&n.tickCount>45&&(n.autoFitPending=!1,x()),(u?Math.sqrt(Ee/u):0)<.05&&n.tickCount>60&&!n.dragNode?n.quietTicks=(n.quietTicks|0)+1:n.quietTicks=0},Y=()=>{if(n.running){try{L(),U()}catch{}if(n.quietTicks>30){n.raf=0;return}n.raf=requestAnimationFrame(Y)}},pe=(u,A)=>{let M=p.getBoundingClientRect();return{x:(u-M.left-n.panX)/n.zoom,y:(A-M.top-n.panY)/n.zoom}},ze=u=>{let A=n.domainById[u];return!(!A||ie.current!=="all"&&A.kind!==ie.current||ke.current&&!(A.tags||[]).includes(ke.current))},je=(u,A,M)=>Math.max(A,Math.min(M,u)),qe=u=>{n.mouseX=u.clientX,n.mouseY=u.clientY;let A=pe(u.clientX,u.clientY),M=null;for(let P=n.nodes.length-1;P>=0;P--){let K=n.nodes[P];if(!ze(K.id))continue;let de=K.x-A.x,ae=K.y-A.y;if(de*de+ae*ae<K.r*K.r+36){M=K.id;break}}M!==n.hoverId&&(n.hoverId=M,D())},vt=u=>{if(u.button!==0)return;let A=pe(u.clientX,u.clientY),M=null;for(let P=n.nodes.length-1;P>=0;P--){let K=n.nodes[P];if(!ze(K.id))continue;let de=K.x-A.x,ae=K.y-A.y;if(de*de+ae*ae<K.r*K.r+25){M=K;break}}if(u.shiftKey){if(M){n.shiftClick=M.id;return}n.marquee={sx:u.clientX,sy:u.clientY,ex:u.clientX,ey:u.clientY};return}n.dragStart={x:u.clientX,y:u.clientY,px:n.panX,py:n.panY},n.dragging=!1,n.dragNode=M||null,M&&(n.dragOffset={dx:M.x-A.x,dy:M.y-A.y})},Bt=u=>{if(n.marquee){n.marquee.ex=u.clientX,n.marquee.ey=u.clientY,D();return}if(!n.dragStart)return;let A=u.clientX-n.dragStart.x,M=u.clientY-n.dragStart.y;if(Math.abs(A)+Math.abs(M)>3&&(n.dragging=!0),n.dragNode){let P=pe(u.clientX,u.clientY);n.dragNode.x=P.x+n.dragOffset.dx,n.dragNode.y=P.y+n.dragOffset.dy,D()}else n.dragging&&(n.panX=je(n.dragStart.px+A,-1e5,1e5),n.panY=je(n.dragStart.py+M,-1e5,1e5),D())},Lt=u=>{if(n.marquee){let M=n.marquee;n.marquee=null;let P=p.getBoundingClientRect(),K=Math.min(M.sx,M.ex)-P.left,de=Math.max(M.sx,M.ex)-P.left,ae=Math.min(M.sy,M.ey)-P.top,De=Math.max(M.sy,M.ey)-P.top,Ee=n.nodes.filter(nt=>{let ge=nt.x*n.zoom+n.panX,xe=nt.y*n.zoom+n.panY;return ge>=K&&ge<=de&&xe>=ae&&xe<=De}).map(nt=>nt.id);n.multi=Ee,Be(Ee),D();return}let A=n.dragStart&&!n.dragging;if(n.shiftClick){let M=n.shiftClick;n.shiftClick=null;let P=Array.isArray(n.multi)?n.multi.slice():[];P.includes(M)||P.push(M),n.multi=P,Be(P),D();return}if(A){let M=pe(u.clientX,u.clientY),P=null;for(let K=n.nodes.length-1;K>=0;K--){let de=n.nodes[K];if(!ze(de.id))continue;let ae=de.x-M.x,De=de.y-M.y;if(ae*ae+De*De<de.r*de.r+20){P=de;break}}P?(n.selectedId=P.id,F(P.id),D()):(n.selectedId=null,n.hoverId=null,u.shiftKey||(n.multi=[],Be([])),F(null),D())}n.dragStart=null,n.dragging=!1,n.dragNode=null},jt=u=>{u.preventDefault();let A=pe(u.clientX,u.clientY),M=null;for(let P=n.nodes.length-1;P>=0;P--){let K=n.nodes[P];if(!ze(K.id))continue;let de=K.x-A.x,ae=K.y-A.y;if(de*de+ae*ae<K.r*K.r+25){M=K;break}}if(M){let P=n.domainById[M.id];P&&$({x:u.clientX,y:u.clientY,id:M.id,path:P.id,title:P.title})}else $(null)},Ft=u=>{u.preventDefault();let A=p.getBoundingClientRect(),M=(u.clientX-A.left-n.panX)/n.zoom,P=(u.clientY-A.top-n.panY)/n.zoom,K=Math.max(.3,Math.min(3,n.zoom*(u.deltaY<0?1.1:1/1.1)));n.panX=je(n.panX+M*(n.zoom-K),-1e5,1e5),n.panY=je(n.panY+P*(n.zoom-K),-1e5,1e5),n.zoom=K,D()};p.addEventListener("mousemove",qe),p.addEventListener("mousedown",vt),window.addEventListener("mousemove",Bt),window.addEventListener("mouseup",Lt),p.addEventListener("wheel",Ft,{passive:!1}),p.addEventListener("contextmenu",jt),T.current=()=>{n.selectedId=null,n.hoverId=null,n.multi=[],Be([]),x(),D()};for(let u=0;u<200;u++)L();x(),D();let Pt=()=>W(!1);return window.addEventListener("mousedown",Pt),()=>{n.running=!1,n.raf&&cancelAnimationFrame(n.raf),we.disconnect(),p.removeEventListener("mousemove",qe),p.removeEventListener("mousedown",vt),window.removeEventListener("mousemove",Bt),window.removeEventListener("mouseup",Lt),p.removeEventListener("wheel",Ft),p.removeEventListener("contextmenu",jt),window.removeEventListener("mousedown",Pt)}},[t,i]),(0,o.useEffect)(()=>{H!==void 0&&I.current&&requestAnimationFrame(()=>I.current())},[H]),(0,e.jsxs)("div",{className:"me-graph",ref:v,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",l("nodes")," \xB7 ",i.length," ",l("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:l("search"),value:_,onChange:p=>te(p.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>W(p=>!p),"aria-expanded":G,title:l("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",l("filterLabel")," ",V!=="all"||b||ve?"\u25CF":"\u25BE"]}),G&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:p=>p.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${V==="all"&&!b?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{fe("all"),ce(!1)},children:l("all")}),Object.keys(Ue).map(p=>(0,e.jsxs)("button",{type:"button",className:`lg${V===p?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>fe(d=>d===p?"all":p),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:dt.colors[p]||Ue[p]}}),l(_e[p])]},p)),(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${b?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>ce(p=>!p),children:["\u23F1 ",l("timeDim")]}),le.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:le.map(p=>(0,e.jsxs)("button",{type:"button",className:`lg${ve===p.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>Ae(d=>d===p.tag?"":p.tag),title:p.tag,children:["#",p.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:p.n})]},p.tag))})]}),(V!=="all"||b||ve)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{fe("all"),ce(!1),Ae("")},children:[l("clearFilter")," \u2715"]})]})})]}),(0,e.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:l("crossVault"),children:[(0,e.jsx)("input",{type:"checkbox",checked:!!R,onChange:p=>S&&S(p.target.checked)}),l("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${b?" me-on":""}`,onClick:()=>ce(p=>!p),children:l("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let p=k.current;if(p)try{p.toBlob(d=>{d&&Te({url:URL.createObjectURL(d),blob:d})},"image/png")}catch{}},children:l("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>I.current&&I.current(),children:l("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{F(null),fe("all"),T.current&&T.current()},children:l("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:k,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:Q,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)"}}),ye&&(0,e.jsx)("div",{className:"mc-empty",style:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)"},children:l("noMatch")}),h&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>$(null)}),h&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:h.x,top:h.y,zIndex:31},onMouseDown:p=>p.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{w.current({path:h.path,title:h.title}),$(null)},children:l("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{h.id&&(m.current.selectedId=h.id,F(h.id)),$(null);let p=m.current;p&&p.wake&&p.wake()},children:l("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(h.title||"")}catch{}$(null),ee(l("copied"))},children:l("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let p=m.current,d=p&&Array.isArray(p.multi)?p.multi.slice():[],O=h.id;if(O&&!d.includes(O)&&d.push(O),$(null),d.length<2){ee(l("mergeNeed"),!1);return}if(!window.confirm(l("mergeConfirm")))return;let re=B.current&&B.current(d);re&&re.then?re.then(me=>me?ee(l("merged")):ee(l("mergeFail"),!1)).catch(()=>ee(l("mergeFail"),!1)):re&&ee(l("merged"))},children:l("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let p=h.path;$(null),window.confirm(l("deleteConfirm"))&&(async()=>{try{(j.current?await j.current(p):!1)?ee(l("deleted")):ee(l("deleteFail"),!1)}catch{ee(l("deleteFail"),!1)}})()},children:l("delete")})]}),X.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:[X.length," ",l("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let d=X.map(be=>Le[be]).filter(Boolean).map(be=>be.title||be.name).join(`
|
|
307
|
+
`),O=new Blob([d],{type:"text/plain;charset=utf-8"}),re=URL.createObjectURL(O),me=document.createElement("a");me.href=re,me.download="memory-selected.txt",document.body.appendChild(me),me.click(),document.body.removeChild(me),setTimeout(()=>URL.revokeObjectURL(re),1e3),ee(X.length+l("exportedSel"))},children:l("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(X.length<2){ee(l("mergeNeed"),!1);return}let p=X.map(O=>Le[O]?Le[O].id:O);if(!window.confirm(l("mergeConfirm")))return;Be([]);let d=m.current;d&&(d.multi=[]),fetch(`${E}/merge?paths=${encodeURIComponent(p.join(","))}`).then(O=>O.json()).then(O=>{O&&O.ok?ee(l("merged")):ee(l("mergeFail"),!1)}).catch(()=>ee(l("mergeFail"),!1))},children:l("merge")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(l("deleteConfirm")))return;let p=X.map(O=>Le[O]?Le[O].id:O);Be([]);let d=m.current;d&&(d.multi=[]),(async()=>{let O=0;for(let re of p)try{(j.current?await j.current(re):!1)&&O++}catch{}ee(O+l("deletedSelected"),O>0)})()},children:l("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let p=m.current;p&&(p.multi=[]),Be([]);let d=m.current;d&&d.render&&d.render()},children:l("clearSelection")})]}),q&&(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:Le[q]?Le[q].title||Le[q].name:q}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:Le[q]?l(_e[Le[q].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:l("graphHint")}),(i.filter(p=>p.source===q||p.target===q)||[]).slice(0,8).map((p,d)=>{let O=p.source===q?p.target:p.source,re=Le[O];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:me=>{me.preventDefault();let be=m.current;be&&(be.selectedId=O,be.hoverId=O,be.wake&&be.wake()),F(O)},children:re?(re.title||re.name).slice(0,28):O},d)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:l("graphTip")}),N&&(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 "+(N.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:N.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:N.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:N.msg})]}),Se&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{Se.url&&URL.revokeObjectURL(Se.url),Te(null),s(!1)},children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:Ce?"100vw":900,width:Ce?"100vw":"92vw",maxHeight:Ce?"100%":"90vh",height:Ce?"100%":void 0,borderRadius:Ce?0:14},onClick:p=>p.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:l("exportGraph")}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("a",{className:"mc-btn",href:Se.url,download:"memory-graph.png",onClick:()=>{Ke("download"),ee(l("downloaded")+" \xB7 "+l("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:l(Z==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ke("full"),s(p=>!p),ee(l("fullscreen"))},children:l(Z==="full"?"done":Ce?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let p=Se.blob;p&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":p})]).then(()=>{Ke("copy"),ee(l("copied"))}).catch(()=>{ee(l("copyFail"),!1)}):ee(l("copyFail"),!1)},children:l(Z==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Se.url&&URL.revokeObjectURL(Se.url),Te(null),s(!1)},children:l("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Ce?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,e.jsx)("img",{src:Se.url,alt:l("exportGraph"),style:{maxWidth:"100%",maxHeight:Ce?"calc(100% - 64px)":"70vh",borderRadius:Ce?0:8,cursor:"zoom-in"},onClick:()=>s(p=>!p)})})]})]})]})}function Ea(t){let i=new Date(t||0).getTime();if(!i)return"#94a3b8";let r=(Date.now()-i)/864e5;return r<3?"#10b981":r<14?"#f59e0b":r<30?"#f97316":"#94a3b8"}function Gt({label:t,value:i=[],options:r,onChange:g,placeholder:c,z:l=20}){let[C,R]=(0,o.useState)(!1),S=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!C)return;let w=j=>{S.current&&!S.current.contains(j.target)&&R(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[C]);let H=Array.isArray(i)?i:[],k=H.includes("__all__"),v=k?r.find(w=>w.value==="__all__")?.label||"":H.length?H.map(w=>r.find(j=>j.value===w)?.label||w).join("\u3001"):"",m=(w,j)=>{if(w.value==="__all__"){g(j?["__all__"]:[]);return}let B=new Set(H);B.has("__all__")&&B.delete("__all__"),j?B.add(w.value):B.delete(w.value),g([...B])},I=r.find(w=>w.value==="__all__"),T=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:S,style:{position:"relative",minWidth:0},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>R(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:v||c||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),C&&(0,e.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:l,marginTop:2,borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",boxShadow:"0 6px 20px rgba(0,0,0,0.14)",maxHeight:180,overflow:"auto"},children:[I&&(0,e.jsxs)("label",{onClick:w=>w.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("input",{type:"checkbox",checked:k,onChange:w=>m(I,w.target.checked)}),(0,e.jsx)("span",{children:I.label})]}),T.map(w=>(0,e.jsxs)("label",{onClick:j=>j.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:H.includes(w.value),onChange:j=>m(w,j.target.checked)}),(0,e.jsx)("span",{children:w.label})]},w.value))]})]})]})}function Wa(t){let i=new Date(t||0).getTime();return!!i&&(Date.now()-i)/864e5<3}async function $a(t,i,r){if(r&&typeof window.showSaveFilePicker=="function")try{let l=await window.showSaveFilePicker({suggestedName:i}),C=await l.createWritable();return await C.write(t),await C.close(),{ok:!0,picked:!0,name:l.name}}catch(l){return l&&l.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(l.message||l)}}let g=URL.createObjectURL(t),c=document.createElement("a");return c.href=g,c.download=i,document.body.appendChild(c),c.click(),document.body.removeChild(c),setTimeout(()=>URL.revokeObjectURL(g),1e3),{ok:!0,picked:!1,name:i}}function Xt(t,i){if(!i||!t)return t;let r=t.toLowerCase(),g=i.toLowerCase(),c=[],l=0;for(;l<t.length;){let C=r.indexOf(g,l);if(C<0){c.push(t.slice(l));break}C>l&&c.push(t.slice(l,C)),c.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(C,C+g.length)},C)),l=C+g.length}return c}function ct(t){if(!t)return"";let i=new Date(t);if(Number.isNaN(i.getTime()))return"";let r=new Date,g=i.toDateString()===r.toDateString(),c=C=>String(C).padStart(2,"0"),l=`${c(i.getHours())}:${c(i.getMinutes())}`;return g?l:`${i.getMonth()+1}-${i.getDate()} ${l}`}
|
|
308
308
|
|
|
309
309
|
return module.exports;
|
|
310
310
|
},
|