memory-eternal 0.9.12 → 0.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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 Ht=Object.create;var ut=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var Ut=Object.getOwnPropertyNames;var Kt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty;var Vt=(t,l)=>{for(var r in l)ut(t,r,{get:l[r],enumerable:!0})},Lt=(t,l,r,y)=>{if(l&&typeof l=="object"||typeof l=="function")for(let u of Ut(l))!Yt.call(t,u)&&u!==r&&ut(t,u,{get:()=>l[u],enumerable:!(y=_t(l,u))||y.enumerable});return t};var qt=(t,l,r)=>(r=t!=null?Ht(Kt(t)):{},Lt(l||!t||!t.__esModule?ut(r,"default",{value:t,enumerable:!0}):r,t)),Xt=t=>Lt(ut({},"__esModule",{value:!0}),t);var za={};Vt(za,{EN:()=>Ft,MemoryLibrary:()=>ma,ZH:()=>jt,apply:()=>sa,inject:()=>ia});module.exports=Xt(za);var n=qt(require("react"),1);var Gt={"&":"&amp;","<":"&lt;",">":"&gt;"},yt=t=>String(t).replace(/[&<>]/g,l=>Gt[l]),Jt=[[/结论|总结|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"]],Zt=["\u2728","info"],Qt=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],ea=t=>{let l=String(t);for(let[r,y,u]of Jt)if(r.test(l))return[y,u];return Zt},ta=t=>{let l=t.join(" ");for(let[r,y,u]of Qt)if(r.test(l))return[y,u];return["\u{1F4CC}","info"]};function Qe(t){let l=String(t),r=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(l);if(r&&!/[是为有了吗呢着过把被和与或于]/.test(r[1]))return'<span class="md-kv"><span class="md-k">'+yt(r[1])+'</span><span class="md-v">'+Qe(r[2])+"</span></span>";let y=yt(l);return y=y.replace(/^\[([ xX])\](?=\s|$)\s*/,(u,o)=>'<span class="md-task">'+(o.toLowerCase()==="x"?"\u2611":"\u2610")+"</span> "),y=y.replace(/`([^`\n]+)`/g,'<code class="md-code">$1</code>'),y=y.replace(/\*\*([^*]+)\*\*/g,'<strong class="md-b">$1</strong>'),y=y.replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>"),y=y.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(u,o,v)=>/^(https?:|\/|#)/i.test(v)?'<a class="md-link" href="'+v+'" target="_blank" rel="noopener noreferrer">'+o+"</a>":o),y}function ht(t){let l=String(t||"").replace(/\r\n?/g,`
7
- `),r=/^---\n([\s\S]*?)\n---\n?/.exec(l);if(!r)return{meta:[],body:l};let y=[];for(let u of r[1].split(`
8
- `)){let o=u.indexOf(":");if(o<=0)continue;let v=u.slice(0,o).trim(),k=u.slice(o+1).trim().replace(/^["']|["']$/g,"");v&&y.push([v,k])}return{meta:y,body:l.slice(r[0].length)}}function Dt(t){let l=String(t||"").trim().replace(/^\[|\]$/g,"");return l?l.split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Tt(t){let l=ht(String(t||"").replace(/\r\n?/g,`
9
- `)).body;if(!l.trim())return"";let r=[],y=l.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(m,A,C)=>(r.push('<pre class="md-pre"><code>'+yt(C.replace(/\n$/,""))+"</code></pre>"),"\0F"+(r.length-1)+"\0")),u=[],o=[],v=null,k=null,N=()=>{o.length&&(u.push('<p class="md-p">'+o.join("<br/>")+"</p>"),o=[])},I=()=>{if(!v)return;let m=v.type;u.push("<"+m+' class="md-'+m+'">'+v.items.map(A=>"<li>"+A+"</li>").join("")+"</"+m+">"),v=null},h=()=>{if(!k)return;let[m,A]=ta(k);u.push('<div class="md-callout md-c-'+A+'"><span class="md-ico">'+m+"</span>"+k.join("<br/>")+"</div>"),k=null},b=()=>{N(),I(),h()};for(let m of y.split(`
10
- `)){let A=m.trim();if(!A){b();continue}let C=/^\u0000F(\d+)\u0000$/.exec(A);if(C){b(),u.push(r[Number(C[1])]);continue}let w;if(w=/^(#{1,6})\s+(.+)$/.exec(A)){b();let[D,M]=ea(w[2]);u.push('<div class="md-h md-h-'+(w[1].length<=2?"h1":"h2")+" md-c-"+M+'"><span class="md-ico">'+D+'</span><span class="md-hx">'+Qe(w[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(A)){b(),u.push('<hr class="md-hr"/>');continue}if(w=/^>\s?(.*)$/.exec(A)){N(),I(),k=k||[],k.push(Qe(w[1]));continue}if(w=/^[-*+]\s+(.+)$/.exec(A)){N(),h(),(!v||v.type!=="ul")&&(I(),v={type:"ul",items:[]}),v.items.push(Qe(w[1]));continue}if(w=/^\d+[.)]\s+(.+)$/.exec(A)){N(),h(),(!v||v.type!=="ol")&&(I(),v={type:"ol",items:[]}),v.items.push(Qe(w[1]));continue}I(),h(),o.push(Qe(A))}return b(),u.join(`
11
- `)}function At(t={}){let l=t.repo||"EternalNight996/memory-eternal",r=String(t.title||"[Bug] ").slice(0,120),y=Array.isArray(t.labels)?t.labels:["bug"],u=Number(t.maxLength)>500?Number(t.maxLength):7e3,o=N=>{let I=new URLSearchParams;return I.set("title",r),I.set("body",N),y.length&&I.set("labels",y.join(",")),"https://github.com/"+l+"/issues/new?"+I.toString()},v=String(t.body||""),k=o(v);if(k.length>u){let N=`
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`,I=h=>o(v.slice(0,h)+N);if(I(0).length>u)v=N;else{let h=0,b=v.length;for(;h<b;){let m=Math.ceil((h+b)/2);I(m).length<=u?h=m:b=m-1}v=v.slice(0,h)+N}k=o(v)}return k}function Bt(t={}){return["## \u73B0\u8C61",String(t.description||"").trim()||"\uFF08\u8BF7\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF09","","## \u590D\u73B0\u6B65\u9AA4","1. ","2. ","","## \u671F\u671B\u884C\u4E3A","","## \u5B9E\u9645\u884C\u4E3A","","## \u73AF\u5883","- \u63D2\u4EF6\u7248\u672C: "+(t.version||"\uFF08\u89C1\u8BCA\u65AD\u4FE1\u606F\uFF09"),"",t.diagnostics||"","","---","> \u7531 memory-eternal \u63D2\u4EF6\u5185\u300C\u53CD\u9988\u5F02\u5E38\u300D\u751F\u6210\uFF08\u8BCA\u65AD\u4FE1\u606F\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E\u5404\u7C7B key/token \u5DF2\u66FF\u6362\uFF09\u3002"].join(`
14
- `)}var xt="https://github.com/EternalNight996/memory-eternal",aa=["\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"+xt,"","\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
- `),na=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+xt,"","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 Rt(t={}){let l=t.lang==="en"?"en":"zh",r=l==="en"?na:aa,y=t.repo||"EternalNight996/memory-eternal";return r=r.split(xt).join("https://github.com/"+y),t.description&&(r=r.replace(l==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(r=r.replace(l==="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}var e=require("react/jsx-runtime"),et="memory-eternal",U="/memory-eternal/api",oa=100,ia=["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",importedSkipped:"\uFF08\u8DF3\u8FC7\u91CD\u590D ",importFail:"\u5BFC\u5165\u5931\u8D25",location:"\u81EA\u9009\u4F4D\u7F6E",saveAs:"\u53E6\u5B58\u4E3A",saveAsUnsupported:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u9009\u62E9\u4FDD\u5B58\u4F4D\u7F6E",exportedTo:"\u5DF2\u5BFC\u51FA\u5230",defaultDownloads:"\u9ED8\u8BA4\u4E0B\u8F7D\u6587\u4EF6\u5939",exportCancel:"\u5DF2\u53D6\u6D88\u5BFC\u51FA",manage:"\u7BA1\u7406",tabUsage:"\u7528\u91CF/\u4ECA\u65E5",tabOptimize:"\u6574\u7406\u5EFA\u8BAE",adminLoadFail:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF1A\u8BF7\u5F7B\u5E95\u91CD\u542F dsh-desktop\uFF08host \u9700\u52A0\u8F7D\u65B0\u7248 /memory-eternal \u8DEF\u7531\uFF09",retry:"\u91CD\u8BD5",mergeSimilar:"\u4E00\u952E\u5408\u5E76\u76F8\u4F3C",trendLabel:"\u8FD1 30 \u5929\u8D8B\u52BF",cleanStale:"\u{1F5D1}\uFE0F \u4E00\u952E\u6E05\u7406\u9648\u65E7",deletedStale:"\u4E2A\u9648\u65E7\u5361\u5DF2\u6E05\u7406",newCard:"\u65B0\u5EFA",tplDecision:"\u{1F4DD} \u6280\u672F\u51B3\u7B56",tplBug:"\u{1F41B} \u8E29\u5751",tplMeeting:"\u{1F4CB} \u4F1A\u8BAE\u7EAA\u8981",tplWeekly:"\u{1F4CA} \u5468\u62A5",createCard:"\u521B\u5EFA",cardTitle:"\u6807\u9898",cardBody:"\u6B63\u6587",fbUseful:"\u6709\u7528",fbIrr:"\u65E0\u5173",todayAdd:"\u4ECA\u65E5\u65B0\u589E",weekAdd:"\u8FD1 7 \u5929",byKind:"\u5206\u7C7B\u7EDF\u8BA1",todayList:"\u4ECA\u65E5\u6C89\u6DC0",budgetLabel:"\u4F1A\u8BDD\u9884\u7B97",budgetChars:"\u9884\u7B97\u5B57\u7B26",recallLimitLabel:"\u53EC\u56DE\u6761\u6570",embeddingLabel:"\u8BED\u4E49\u53EC\u56DE",mergePairs:"\u76F8\u4F3C\u5361\u5BF9\uFF08\u53EF\u5408\u5E76\uFF09",staleCards:"\u9648\u65E7\u5361\uFF08>90 \u5929\u672A\u66F4\u65B0\uFF09",noOptimize:"\u6682\u65E0\u53EF\u6574\u7406\u9879\uFF0C\u5F88\u5065\u5EB7 \u{1F389}",oneClickOptimize:"\u4E00\u952E\u4F18\u5316",oneClickOptimizeConfirm:"\u786E\u8BA4\u4E00\u952E\u4F18\u5316\uFF1F\u5C06\u5408\u5E76\u6240\u6709\u76F8\u4F3C\u5361\u5BF9\uFF08\u9ED8\u8BA4\u4E0D\u6E05\u7406\u9648\u65E7\u5361\uFF09\u3002",oneClickAlsoStale:"\u540C\u65F6\u6E05\u7406\u9648\u65E7\u5361",oneClickOptimizeDone:"\u4E00\u952E\u4F18\u5316\u5B8C\u6210",optimizedMerged:"\u5BF9\u5DF2\u5408\u5E76",optimizedStaleDeleted:"\u5F20\u9648\u65E7\u5361\u5DF2\u6E05\u7406",mcpSetupStatus:"Agent MCP \u6302\u8F7D\u72B6\u6001",rerunSetup:"\u8865\u5168 MCP",notInstalled:"\u672A\u5B89\u88C5",noMcpEntry:"\u914D\u7F6E\u7F3A\u5931",nodePathMismatch:"node \u8DEF\u5F84\u4E0D\u4E00\u81F4\uFF0C\u5EFA\u8BAE\u91CD\u8DD1 setup",nodePathNote:"node \u73AF\u5883\u4E0D\u540C\uFF08\u53EF\u7528\uFF09",healthy:"\u914D\u7F6E\u6B63\u5E38",mcpSetupHint:"\u300C\u81EA\u52A8\u6302\u8F7D MCP\u300D= \u8BA9 Claude Code / Codex / Cursor \u8FD9\u4E9B\u5DE5\u5177\u80FD\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002\u5F00\u542F\u540E\u81EA\u52A8\u628A\u5B83\u4EEC\u914D\u7F6E\u597D\uFF1B\u5173\u6389\u5C31\u4E0D\u52A8\u4F60\u7535\u8111\u4E0A\u4EFB\u4F55\u914D\u7F6E\u6587\u4EF6\uFF0C\u9700\u8981\u65F6\u624B\u52A8\u8DD1 dsh-memory setup\u3002",mcpManageHint:"\u6BCF\u4E2A agent \u7528\u4E0B\u65B9\u6309\u94AE\u5355\u72EC\u5B89\u88C5/\u5378\u8F7D MCP",tabConfig:"\u8BB0\u5FC6\u914D\u7F6E",tabAudit:"\u5BA1\u6838\u4E2D\u5FC3",statusApproved:"\u5DF2\u5BA1\u6838",statusPending:"\u5F85\u5BA1\u6838",statusRejected:"\u5DF2\u9A73\u56DE",allStatus:"\u5168\u90E8\u72B6\u6001",tabRecycle:"\u56DE\u6536\u4E2D\u5FC3",pending:"\u5F85\u5BA1\u6838",rejected:"\u5DF2\u9A73\u56DE",selectAll:"\u5168\u9009",approve:"\u6279\u51C6",reject:"\u9A73\u56DE",allAgents:"\u5168\u90E8\u667A\u80FD\u4F53",noAuditItems:"\u6682\u65E0\u5BA1\u6838\u9879\u76EE",deletedAt:"\u5220\u9664\u4E8E",restore:"\u6062\u590D",restoreDelete:"\u5220\u9664\u8FDB\u56DE\u6536\u7AD9",purge:"\u6C38\u4E45\u5220\u9664",emptyRecycle:"\u56DE\u6536\u7AD9\u4E3A\u7A7A",recycleHint:"\u5220\u9664\u7684\u5361\u7247\u5148\u8FDB\u56DE\u6536\u7AD9\uFF0C30 \u5929\u5185\u53EF\u6062\u590D\uFF0C\u8D85\u671F\u81EA\u52A8\u6C38\u4E45\u5220\u9664",purgeConfirm:"\u786E\u5B9A\u6C38\u4E45\u5220\u9664\uFF1F\u4E0D\u53EF\u6062\u590D\u3002",recycleDeleteConfirm:"\u786E\u5B9A\u5220\u9664\u8FDB\u56DE\u6536\u7AD9\uFF1F30 \u5929\u5185\u53EF\u6062\u590D\u3002",modeInit:"\u542F\u52A8\u65F6\u62C9\u4E00\u6B21",modeInterval:"\u5468\u671F\u4FDD\u6D3B",modeManual:"\u4EC5\u624B\u52A8",serviceConfig:"\u670D\u52A1\u81EA\u7BA1\u7406\u914D\u7F6E",auditConfig:"\u81EA\u52A8\u5BA1\u6838\u914D\u7F6E",auditHint:"\u547D\u4E2D\u514D\u5BA1\u7684\u65B0\u5361\u76F4\u63A5\u5165\u5E93\uFF0C\u5176\u4F59\u8FDB\u5F85\u5BA1\u6838",auditMode:"\u5BA1\u6838\u6A21\u5F0F",auditAll:"\u5168\u90E8\u8981\u5BA1\u6838",auditNone:"\u5168\u90E8\u514D\u5BA1",auditExemptAgents:"\u514D\u5BA1\u667A\u80FD\u4F53",auditExemptKinds:"\u514D\u5BA1\u7C7B\u578B",allExempt:"\u5168\u90E8\u514D\u5BA1",recycleDays:"\u56DE\u6536\u4FDD\u7559\u5929\u6570",editInSetting:"\u7F16\u8F91\u8BF7\u5230 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6",setupRunInTerminal:"\u8BF7\u590D\u5236\u4EE5\u4E0B\u547D\u4EE4\u5230\u7EC8\u7AEF\u6267\u884C\uFF1A",dshMemoryConfig:"DSH \u8BB0\u5FC6\u914D\u7F6E",autoCapture:"\u81EA\u52A8\u6C89\u6DC0",autoRecall:"\u81EA\u52A8\u53EC\u56DE",captureMinChars:"\u6355\u83B7\u6700\u5C0F\u957F\u5EA6",maxCardsPerDay:"\u65E5\u914D\u989D",dedupThreshold:"\u53BB\u91CD\u9608\u503C",recallLimit:"\u53EC\u56DE\u6761\u6570",vaultMulti:"\u591A\u5E93\uFF08\u6309\u9879\u76EE\u9694\u79BB\uFF09",vaultMultiHint:"\u7559\u7A7A\u5373\u5355\u5E93\uFF0C\u8001\u914D\u7F6E\u4E0D\u53D7\u5F71\u54CD",vaultNow:"\u5F53\u524D\u751F\u6548",vaultSource:"\u6765\u6E90",vaultWorkspace:"\u5F53\u524D workspace",vaultNamePh:"\u5E93\u540D\uFF0C\u5982 work",vaultPathPh:"\u76EE\u5F55\uFF0C\u5982 D:/vaults/work",vaultMatchPh:"\u9879\u76EE\u76EE\u5F55\uFF08\u53EF\u9009\uFF0C\u6309 workspace \u81EA\u52A8\u9009\u5E93\uFF09",vaultAdd:"\u6DFB\u52A0\u4E00\u4E2A\u5E93",vaultActive:"\u6FC0\u6D3B\u5E93",vaultActiveNone:"\u9ED8\u8BA4\u5E93\uFF08\u4E0D\u6307\u5B9A\uFF09",vaultSrcEnv:"\u73AF\u5883\u53D8\u91CF MEMORY_VAULT_DIR",vaultSrcProfile:"\u6FC0\u6D3B\u5E93\u914D\u7F6E",vaultSrcWorkspace:"\u6309\u9879\u76EE\u76EE\u5F55\u81EA\u52A8\u547D\u4E2D",vaultSrcVaultDir:"\u5355\u5E93\u914D\u7F6E vaultDir",vaultSrcDefault:"\u9ED8\u8BA4\u76EE\u5F55",fbNav:"\u53CD\u9988\u5F02\u5E38",fbTitle:"\u53CD\u9988\u5F02\u5E38\uFF08\u63D0\u4EA4\u5230 GitHub\uFF09",fbDesc:"\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF08\u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A\uFF09",fbDiag:"\u8BCA\u65AD\u4FE1\u606F\uFF08\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E key/token \u5DF2\u66FF\u6362\uFF09",fbCopyDiag:"\u590D\u5236\u8BCA\u65AD\u4FE1\u606F",fbOpenIssue:"\u5728 GitHub \u63D0\u4EA4\uFF08\u5DF2\u9884\u586B\uFF09",fbCopyPrompt:"\u590D\u5236\u7ED9 AI \u7684\u63D0\u793A\u8BCD",fbCopiedDiag:"\u8BCA\u65AD\u4FE1\u606F\u5DF2\u590D\u5236",fbCopiedPrompt:"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\uFF0C\u7C98\u8FDB AI \u5BF9\u8BDD\u6846\u5373\u53EF",fbCopyFail:"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u590D\u5236",fbWhy:"GitHub \u4E0D\u5141\u8BB8\u533F\u540D\u521B\u5EFA issue\uFF0C\u63D2\u4EF6\u91CC\u4E5F\u4E0D\u5E94\u5185\u7F6E token\uFF1A\u6240\u4EE5\u8FD9\u91CC\u628A\u6807\u9898 / \u6B63\u6587 / \u8BCA\u65AD\u90FD\u9884\u586B\u597D\uFF0C\u4F60\u53EA\u9700\u518D\u70B9\u4E00\u6B21 Submit\u3002",fbNeedDesc:"\u8BF7\u5148\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898",fbLoading:"\u6B63\u5728\u6536\u96C6\u8BCA\u65AD\u4FE1\u606F\u2026",fbDiagFail:"\u8BCA\u65AD\u63A5\u53E3\u4E0D\u53EF\u7528\uFF08\u72EC\u7ACB web \u6216\u65E7\u7248\u5BBF\u4E3B\uFF09\uFF0C\u8BF7\u624B\u52A8\u8865\u5145\u73AF\u5883\u4FE1\u606F",fbOr:"\u6216\u8005",recallSummaryLen:"\u53EC\u56DE\u6458\u8981\u957F\u5EA6",recallBody:"\u53EC\u56DE\u542B\u6B63\u6587",autoWeb:"Web server",autoWebMode:"\u4FDD\u6D3B\u6A21\u5F0F",webPort:"Web \u7AEF\u53E3",webCheckIntervalMs:"\u63A2\u6D3B\u95F4\u9694(ms)",webMaxRestart:"\u6700\u5927\u91CD\u542F\u6B21\u6570",watchdogAutoSpawn:"\u770B\u95E8\u72D7\u8FDB\u7A0B",autoMcpSetup:"\u81EA\u52A8\u6302\u8F7D MCP",saveConfig:"\u4FDD\u5B58\u914D\u7F6E",saveFail:"\u4FDD\u5B58\u5931\u8D25",savedOk:"\u5DF2\u4FDD\u5B58",recallTool:"recall \u5DE5\u5177",costControl:"\u6210\u672C\u63A7\u5236",costHint:"\u7701 token\u3001\u63A7 LLM \u6D88\u8017",distillEnabled:"\u84B8\u998F\u77E5\u8BC6\u5361(\u5F00=LLM \u538B\u7F29, \u5173=\u539F\u6587\u5361\u96F6 LLM)",dedupByLLM:"\u8BED\u4E49\u53BB\u91CD\u5582 LLM(\u5173=\u7EAF\u8BCD\u6CD5\u66F4\u7701)",captureMaxTokens:"\u84B8\u998F\u8F93\u51FA\u4E0A\u9650(token)",recallMinScore:"\u53EC\u56DE\u76F8\u5173\u6027\u9608\u503C(\u8D8A\u9AD8\u8D8A\u7701)",configNeedsDsh:"\u914D\u7F6E\u7F16\u8F91\u9700\u5728 DSH \u5185\u6253\u5F00\uFF08\u672C\u9875\u53EF\u80FD\u53EA\u8BFB\u6216\u6709\u90E8\u5206\u7F3A\u5931\uFF09",installMcp:"\u5B89\u88C5 MCP",uninstallMcp:"\u5378\u8F7D MCP",uninstallConfirm:"\u786E\u8BA4\u5378\u8F7D\u8BE5\u667A\u80FD\u4F53\u7684 MCP\uFF1FClaude Code/Codex \u5C06\u65E0\u6CD5\u518D\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002",presetConfig:"\u4E00\u952E\u63A8\u8350\u914D\u7F6E",presetHint:"\u70B9\u51FB\u586B\u5145\u5BF9\u5E94\u65B9\u6848\uFF0C\u70B9\u4FDD\u5B58\u751F\u6548",planA:"A \u8F7B\u91CF\u7701\u5FC3",planB:"B \u6781\u81F4\u7701\u94B1",planC:"C \u9AD8\u8D28\u91CF",pluginInfo:"\u63D2\u4EF6\u4FE1\u606F",organizeTitle:"\u6574\u7406\u5EFA\u8BAE",scanAndOrganize:"\u4E00\u952E\u641C\u7D22\u548C\u6574\u7406",scanHint:"\u70B9\u300C\u{1F50D} \u4E00\u952E\u641C\u7D22\u548C\u6574\u7406\u300D\u626B\u63CF\u76F8\u4F3C\u5361/\u9648\u65E7\u5361\uFF0C\u518D\u7528\u300C\u26A1 \u4E00\u952E\u4F18\u5316\u300D\u6267\u884C\u3002",mergeNow:"\u5408\u5E76",delete:"\u5220\u9664",captureAlert:"\u81EA\u52A8\u6C89\u6DC0\u5F02\u5E38",captureAlertHint:"\u6253\u5F00\u5DE6\u680F\u300C\u7528\u91CF/\u4ECA\u65E5\u300D\u770B\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7\uFF1B\u82E5\u662F\u63A5\u53E3/\u7248\u672C\u4E0D\u5339\u914D\uFF0C\u9700\u66F4\u65B0 memory-eternal \u63D2\u4EF6\u3002",captureLog:"\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7",captureLogHint:"\u6BCF\u8F6E\u5BF9\u8BDD\u7ED3\u675F\u540E\u81EA\u52A8\u8DD1\uFF1A\u76D1\u542C \u2192 \u5224\u5B9A \u2192 \u5199\u5361\u3002\u8FD9\u91CC\u663E\u793A\u6700\u8FD1 100 \u6761\uFF0C\u7528\u6765\u6392\u67E5\u300C\u4E3A\u4EC0\u4E48\u6CA1\u5199\u5361\u300D\u3002",captureLogEmpty:"\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002\u8DDF Agent \u804A\u4E00\u8F6E\uFF08> \u6355\u83B7\u6700\u5C0F\u957F\u5EA6\uFF09\u540E\u518D\u56DE\u6765\u770B\u3002",captureLogUnavailable:"\u65E5\u5FD7\u4EC5\u5728 DSH \u5BBF\u4E3B\u5185\u53EF\u7528\uFF08\u72EC\u7ACB Web \u9875\u6CA1\u6709 host \u8FD0\u884C\u65F6\uFF09\u3002",captureAgentCards:"Agent \u81EA\u52A8\u6C89\u6DC0\u7684\u5361",noCards:"\u6682\u65E0",loadMore:"\u52A0\u8F7D\u66F4\u591A",batchMerge:"\u4E00\u952E\u667A\u80FD\u5408\u5E76",mergeAllConfirm:"\u5C06\u6309\u76F8\u4F3C\u5EA6\u5206\u7EC4\u7684\u5361\u7247\u5404\u5408\u5E76\u4E3A\u4E00\u5F20\uFF08\u4FDD\u7559\u5404\u81EA kind\uFF09\uFF0C\u539F\u5361\u5220\u9664\uFF1F",crossVault:"\u8DE8\u5E93\u805A\u5408",deleteConfirm:"\u786E\u5B9A\u5220\u9664\u8BE5\u8BB0\u5FC6\u5361\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002",deleted:"\u5DF2\u5220\u9664",deleteFail:"\u5220\u9664\u5931\u8D25",deleteSelected:"\u5220\u9664\u9009\u4E2D",deletedSelected:"\u5F20\u5361\u5DF2\u5220\u9664",merge:"\u5408\u5E76",mergeNeed:"\u81F3\u5C11\u9009 2 \u5F20\u5361",mergeConfirm:"\u5C06\u6240\u9009\u5361\u7247\u5408\u5E76\u4E3A\u4E00\u5F20\u5E76\u5220\u9664\u539F\u5361\uFF1F",merged:"\u5DF2\u5408\u5E76",mergeFail:"\u5408\u5E76\u5931\u8D25",mcpInstalled:"\u2705 {agent} MCP \u5DF2\u5B89\u88C5",mcpUninstalled:"\u2705 {agent} MCP \u5DF2\u5378\u8F7D",mcpActionFail:"\u274C {agent} MCP \u64CD\u4F5C\u5931\u8D25\uFF1A{error}",dshHostLabel:"DeepSeek Harness\uFF08\u5F53\u524D\u5BBF\u4E3B\uFF09",restartHint:"\u5DF2\u4FDD\u5B58\u3002autoWebMode/watchdogAutoSpawn \u7B49\u9700\u91CD\u542F DSH \u751F\u6548",conflictRefresh:"\u914D\u7F6E\u5DF2\u88AB\u5916\u90E8\u4FEE\u6539\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5",untitled:"\u65E0\u6807\u9898",tplBlank:"\u{1F4C4} \u7A7A\u767D",tagsHint:"\u6807\u7B7E\uFF08\u9017\u53F7\u5206\u9694\uFF09",connCount:"{n} \u8FDE\u63A5",tplDecisionTags:"\u51B3\u7B56, \u65B9\u6848",tplBugTags:"\u8E29\u5751, \u6559\u8BAD",tplMeetingTags:"\u4F1A\u8BAE, \u7EAA\u8981",tplWeeklyTags:"\u5468\u62A5",tplDecisionBody:`# \u6280\u672F\u51B3\u7B56\uFF1A[\u6807\u9898]
6
+ var ea=Object.create;var xt=Object.defineProperty;var ta=Object.getOwnPropertyDescriptor;var aa=Object.getOwnPropertyNames;var na=Object.getPrototypeOf,oa=Object.prototype.hasOwnProperty;var ia=(t,o)=>{for(var i in o)xt(t,i,{get:o[i],enumerable:!0})},Et=(t,o,i,g)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of aa(o))!oa.call(t,p)&&p!==i&&xt(t,p,{get:()=>o[p],enumerable:!(g=ta(o,p))||g.enumerable});return t};var la=(t,o,i)=>(i=t!=null?ea(na(t)):{},Et(o||!t||!t.__esModule?xt(i,"default",{value:t,enumerable:!0}):i,t)),ra=t=>Et(xt({},"__esModule",{value:!0}),t);var Oa={};ia(Oa,{EN:()=>Xt,MemoryLibrary:()=>Na,ZH:()=>qt,apply:()=>va,inject:()=>ya});module.exports=ra(Oa);var n=la(require("react"),1);var sa={"&":"&amp;","<":"&lt;",">":"&gt;"},St=t=>String(t).replace(/[&<>]/g,o=>sa[o]),da=[[/结论|总结|tl;?dr|summary|takeaway/i,"\u2705","ok"],[/风险|注意|警告|禁止|坑|踩坑|务必/i,"\u26A0\uFE0F","warn"],[/根因|原因|为什么|定位|复现/i,"\u{1F50D}","info"],[/修复|解决|变更|fix/i,"\u{1F527}","ok"],[/验证|测试|实测|回归/i,"\u{1F9EA}","ok"],[/方案|做法|实现|设计|思路|架构/i,"\u{1F6E0}\uFE0F","plan"],[/步骤|流程|操作|用法|命令/i,"\u{1F9E9}","plan"],[/背景|由来|context/i,"\u{1F9ED}","info"],[/目标|需求|要解决/i,"\u{1F3AF}","plan"],[/环境|依赖|前置|安装/i,"\u{1F4E6}","info"],[/收益|效果|性能|指标|数据|统计/i,"\u{1F4C8}","ok"],[/示例|例子|样例|demo/i,"\u{1F4A1}","idea"],[/参考|链接|相关/i,"\u{1F517}","info"]],ca=["\u2728","info"],pa=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],ua=t=>{let o=String(t);for(let[i,g,p]of da)if(i.test(o))return[g,p];return ca},ma=t=>{let o=t.join(" ");for(let[i,g,p]of pa)if(i.test(o))return[g,p];return["\u{1F4CC}","info"]};function at(t){let o=String(t),i=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(o);if(i&&!/[是为有了吗呢着过把被和与或于]/.test(i[1]))return'<span class="md-kv"><span class="md-k">'+St(i[1])+'</span><span class="md-v">'+at(i[2])+"</span></span>";let g=St(o);return g=g.replace(/^\[([ xX])\](?=\s|$)\s*/,(p,l)=>'<span class="md-task">'+(l.toLowerCase()==="x"?"\u2611":"\u2610")+"</span> "),g=g.replace(/`([^`\n]+)`/g,'<code class="md-code">$1</code>'),g=g.replace(/\*\*([^*]+)\*\*/g,'<strong class="md-b">$1</strong>'),g=g.replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>"),g=g.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(p,l,v)=>/^(https?:|\/|#)/i.test(v)?'<a class="md-link" href="'+v+'" target="_blank" rel="noopener noreferrer">'+l+"</a>":l),g}function Nt(t){let o=String(t||"").replace(/\r\n?/g,`
7
+ `),i=/^---\n([\s\S]*?)\n---\n?/.exec(o);if(!i)return{meta:[],body:o};let g=[];for(let p of i[1].split(`
8
+ `)){let l=p.indexOf(":");if(l<=0)continue;let v=p.slice(0,l).trim(),S=p.slice(l+1).trim().replace(/^["']|["']$/g,"");v&&g.push([v,S])}return{meta:g,body:o.slice(i[0].length)}}function Ft(t){let o=String(t||"").trim().replace(/^\[|\]$/g,"");return o?o.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function jt(t){let o=Nt(String(t||"").replace(/\r\n?/g,`
9
+ `)).body;if(!o.trim())return"";let i=[],g=o.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(m,M,z)=>(i.push('<pre class="md-pre"><code>'+St(z.replace(/\n$/,""))+"</code></pre>"),"\0F"+(i.length-1)+"\0")),p=[],l=[],v=null,S=null,x=()=>{l.length&&(p.push('<p class="md-p">'+l.join("<br/>")+"</p>"),l=[])},A=()=>{if(!v)return;let m=v.type;p.push("<"+m+' class="md-'+m+'">'+v.items.map(M=>"<li>"+M+"</li>").join("")+"</"+m+">"),v=null},k=()=>{if(!S)return;let[m,M]=ma(S);p.push('<div class="md-callout md-c-'+M+'"><span class="md-ico">'+m+"</span>"+S.join("<br/>")+"</div>"),S=null},y=()=>{x(),A(),k()};for(let m of g.split(`
10
+ `)){let M=m.trim();if(!M){y();continue}let z=/^\u0000F(\d+)\u0000$/.exec(M);if(z){y(),p.push(i[Number(z[1])]);continue}let w;if(w=/^(#{1,6})\s+(.+)$/.exec(M)){y();let[L,N]=ua(w[2]);p.push('<div class="md-h md-h-'+(w[1].length<=2?"h1":"h2")+" md-c-"+N+'"><span class="md-ico">'+L+'</span><span class="md-hx">'+at(w[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(M)){y(),p.push('<hr class="md-hr"/>');continue}if(w=/^>\s?(.*)$/.exec(M)){x(),A(),S=S||[],S.push(at(w[1]));continue}if(w=/^[-*+]\s+(.+)$/.exec(M)){x(),k(),(!v||v.type!=="ul")&&(A(),v={type:"ul",items:[]}),v.items.push(at(w[1]));continue}if(w=/^\d+[.)]\s+(.+)$/.exec(M)){x(),k(),(!v||v.type!=="ol")&&(A(),v={type:"ol",items:[]}),v.items.push(at(w[1]));continue}A(),k(),l.push(at(M))}return y(),p.join(`
11
+ `)}function Ot(t={}){let o=t.repo||"EternalNight996/memory-eternal",i=String(t.title||"[Bug] ").slice(0,120),g=Array.isArray(t.labels)?t.labels:["bug"],p=Number(t.maxLength)>500?Number(t.maxLength):7e3,l=x=>{let A=new URLSearchParams;return A.set("title",i),A.set("body",x),g.length&&A.set("labels",g.join(",")),"https://github.com/"+o+"/issues/new?"+A.toString()},v=String(t.body||""),S=l(v);if(S.length>p){let x=`
12
+
13
+ > \u5185\u5BB9\u8FC7\u957F\u5DF2\u622A\u65AD\uFF1A\u5B8C\u6574\u8BCA\u65AD\u8BF7\u5728\u63D2\u4EF6\u91CC\u70B9\u300C\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u300D\uFF0C\u518D\u8865\u5230 issue \u8BC4\u8BBA\u91CC\u3002`,A=k=>l(v.slice(0,k)+x);if(A(0).length>p)v=x;else{let k=0,y=v.length;for(;k<y;){let m=Math.ceil((k+y)/2);A(m).length<=p?k=m:y=m-1}v=v.slice(0,k)+x}S=l(v)}return S}function Ht(t={}){return["## \u73B0\u8C61",String(t.description||"").trim()||"\uFF08\u8BF7\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF09","","## \u590D\u73B0\u6B65\u9AA4","1. ","2. ","","## \u671F\u671B\u884C\u4E3A","","## \u5B9E\u9645\u884C\u4E3A","","## \u73AF\u5883","- \u63D2\u4EF6\u7248\u672C: "+(t.version||"\uFF08\u89C1\u8BCA\u65AD\u4FE1\u606F\uFF09"),"",t.diagnostics||"","","---","> \u7531 memory-eternal \u63D2\u4EF6\u5185\u300C\u53CD\u9988\u5F02\u5E38\u300D\u751F\u6210\uFF08\u8BCA\u65AD\u4FE1\u606F\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E\u5404\u7C7B key/token \u5DF2\u66FF\u6362\uFF09\u3002"].join(`
14
+ `)}var Mt="https://github.com/EternalNight996/memory-eternal",ga=["\u6211\u5728\u4F7F\u7528 memory-eternal\uFF08DeepSeek Harness \u7684\u8BB0\u5FC6\u63D2\u4EF6\uFF09\u65F6\u9047\u5230\u4E86\u95EE\u9898\uFF0C\u8BF7\u4F60\u5E2E\u6211\u628A\u8FD9\u4E2A\u95EE\u9898\u63D0\u4EA4\u5230 GitHub\u3002","","\u4ED3\u5E93\uFF1A"+Mt,"","\u8BF7\u6309\u8FD9\u4E2A\u6D41\u7A0B\u505A\uFF1A","","1. \u5148\u8DD1 `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50`\uFF0C\u770B\u662F\u5426\u5DF2\u6709\u76F8\u540C\u95EE\u9898\uFF1A"," - \u5DF2\u6709 \u2192 \u7528 `gh issue comment <\u7F16\u53F7> --body-file <\u6587\u4EF6>` \u8865\u5145\u73B0\u8C61\uFF0C\u4E0D\u8981\u91CD\u590D\u5F00\u65B0 issue\uFF1B"," - \u6CA1\u6709 \u2192 \u7EE7\u7EED\u7B2C 2 \u6B65\u3002",'2. \u628A\u6B63\u6587\u5199\u6210\u6587\u4EF6\uFF0C\u7136\u540E `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <\u4E00\u53E5\u8BDD\u6982\u62EC>" --body-file <\u6587\u4EF6>`\uFF1B\u6B63\u6587\u7528\u8FD9\u4E2A\u7ED3\u6784\uFF1A'," \u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A / \u5B9E\u9645\u884C\u4E3A / \u73AF\u5883\uFF08\u63D2\u4EF6\u7248\u672C / DSH \u7248\u672C / \u64CD\u4F5C\u7CFB\u7EDF / Node\uFF09/ \u8BCA\u65AD\u4FE1\u606F\u3002","3. \u5982\u679C `gh` \u6CA1\u767B\u5F55\u6216\u4E0D\u53EF\u7528\uFF0C\u4E0D\u8981\u5C1D\u8BD5\u63D0\u4EA4\uFF0C\u6539\u4E3A\u8F93\u51FA\u4E00\u6761\u300C\u6807\u9898\u4E0E\u6B63\u6587\u90FD\u5DF2\u9884\u586B\u300D\u7684 GitHub \u65B0\u5EFA issue \u94FE\u63A5\u7ED9\u6211\uFF0C\u6211\u81EA\u5DF1\u70B9\u63D0\u4EA4\u3002","4. \u63D0\u4EA4\u6210\u529F\u540E\uFF0C\u628A issue \u94FE\u63A5\u53D1\u7ED9\u6211\u3002","","\u6CE8\u610F\uFF1A\u6211\u7684\u95EE\u9898\u63CF\u8FF0\u8BF7\u539F\u6837\u7167\u5F55\uFF0C\u4E0D\u8981\u66FF\u6211\u7F8E\u5316\u6216\u7701\u7565\u7EC6\u8282\uFF1B\u8BCA\u65AD\u4FE1\u606F\u539F\u6837\u653E\u8FDB\u300C\u8BCA\u65AD\u4FE1\u606F\u300D\u4E00\u8282\u3002","","\u6211\u7684\u95EE\u9898\u63CF\u8FF0\uFF1A","<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>","","\u8BCA\u65AD\u4FE1\u606F\uFF1A","<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>"].join(`
15
+ `),fa=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+Mt,"","Workflow:","","1. Run `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50` first: if a matching issue exists, add a comment with `gh issue comment <n> --body-file <file>` instead of opening a duplicate.",'2. Otherwise create it with `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <one-line summary>" --body-file <file>`, using sections: Symptoms / Steps to reproduce / Expected / Actual / Environment (plugin, DSH, OS, Node) / Diagnostics.',"3. If `gh` is not authenticated or unavailable, do NOT try to submit: output a GitHub new-issue link with the title and body pre-filled instead, and I will click submit myself.","4. Report the resulting issue URL back to me.","","Keep my description verbatim - do not rewrite or summarise it. Put the diagnostics under the Diagnostics section as-is.","","My description:","<write your problem here>","","Diagnostics:","<paste the diagnostics copied from the in-app Report-a-bug dialog>"].join(`
16
+ `);function Wt(t={}){let o=t.lang==="en"?"en":"zh",i=o==="en"?fa:ga,g=t.repo||"EternalNight996/memory-eternal";return i=i.split(Mt).join("https://github.com/"+g),t.description&&(i=i.replace(o==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(i=i.replace(o==="en"?"<paste the diagnostics copied from the in-app Report-a-bug dialog>":"<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>",String(t.diagnostics).trim())),i}function $t({panX:t=0,panY:o=0,zoom:i=1,w:g=0,h:p=0,margin:l=60}={}){let v=i||1;return{x0:(0-t)/v-l,y0:(0-o)/v-l,x1:(g-t)/v+l,y1:(p-o)/v+l}}function vt(t,o,i,g){return g?t+i>=g.x0&&t-i<=g.x1&&o+i>=g.y0&&o-i<=g.y1:!0}function _t(t){let o=Number(t)||0;return o<=120?1/0:o<=300?160:o<=600?90:60}function Ut(t,o={}){let i=Number.isFinite(o.limit)?o.limit:1/0,g=new Set,p=x=>{x&&g.size<i&&g.add(x)};if(p(o.focusId),p(o.hoverId),o.searchHits)for(let x of o.searchHits){if(g.size>=i)break;g.add(x)}let l=o.degree||{},v=x=>Number(l[x])||0,S=[];for(let x of Array.isArray(t)?t:[])x&&x.id&&!g.has(x.id)&&S.push(x);S.sort((x,A)=>v(A.id)-v(x.id));for(let x of S){if(g.size>=i)break;g.add(x.id)}return g}var e=require("react/jsx-runtime"),nt="memory-eternal",Y="/memory-eternal/api",ba=100,ya=["slots","locale"],qt={nav:"\u8BB0\u5FC6",loading:"\u52A0\u8F7D\u4E2D\u2026",refresh:"\u5237\u65B0",overview:"\u8BB0\u5FC6\u5E93\u6982\u89C8",total:"\u77E5\u8BC6\u5361",recent:"\u8FD1 7 \u5929\u65B0\u589E",tags:"\u6807\u7B7E",searchPlaceholder:"\u641C\u7D22\u8BB0\u5FC6\uFF08\u652F\u6301\u4E2D\u6587\u7247\u6BB5\uFF09\u2026",search:"\u641C\u7D22",all:"\u5168\u90E8",kindProject:"\u9879\u76EE",kindKnowledge:"\u77E5\u8BC6",kindContent:"\u5185\u5BB9",kindPrompt:"\u63D0\u793A\u8BCD",kindBusiness:"\u4E1A\u52A1",kindTool:"\u5DE5\u5177",kindMistake:"\u6559\u8BAD",cardsTab:"\u77E5\u8BC6\u5361",graphTab:"\u77E5\u8BC6\u56FE\u8C31",graph:"\u77E5\u8BC6\u56FE\u8C31",graphHint:"\u8282\u70B9=\u77E5\u8BC6\u5361\uFF1B\u8FDE\u7EBF=[[\u94FE\u63A5]] \u6216\u5171\u4EAB\u6807\u7B7E\u3002\u70B9\u51FB\u8282\u70B9\u9605\u8BFB\u5361\u7247\u3002",graphTip:"\u5DE6\u952E\u51F8\u663E \xB7 Shift+\u62D6\u62FD\u6846\u9009 \xB7 \u53F3\u952E\u83DC\u5355 \xB7 \u6EDA\u8F6E\u7F29\u653E \xB7 \u62D6\u62FD\u5E73\u79FB",rebuild:"\u91CD\u5EFA",reset:"\u91CD\u7F6E",expandAll:"\u5168\u90E8\u5C55\u5F00",capped:"\u5DF2\u5C55\u793A\u6700\u6838\u5FC3\u7684",clearFocus:"\u53D6\u6D88\u9AD8\u4EAE",empty:"\u8BB0\u5FC6\u5E93\u8FD8\u662F\u7A7A\u7684\u3002\u591A\u804A\u51E0\u8F6E\u540E\uFF0C\u503C\u5F97\u4FDD\u5B58\u7684\u5185\u5BB9\u4F1A\u81EA\u52A8\u6C89\u6DC0\u6210\u77E5\u8BC6\u5361\u3002",emptyGraph:"\u56FE\u8C31\u6682\u65E0\u6570\u636E\u3002",open:"\u9605\u8BFB",updated:"\u66F4\u65B0\u4E8E",created:"\u521B\u5EFA\u4E8E",source:"\u6765\u6E90",close:"\u5173\u95ED",vaultDir:"\u8BB0\u5FC6\u5E93\u76EE\u5F55",capture:"\u81EA\u52A8\u6C89\u6DC0",recall:"\u81EA\u52A8\u53EC\u56DE",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u7981\u7528",error:"\u52A0\u8F7D\u5931\u8D25",back:"\u8FD4\u56DE\u5217\u8868",cardCount:"\u5F20\u5361",nodes:"\u8282\u70B9",edges:"\u8FDE\u7EBF",memoryTitle:"\u8BB0\u5FC6\u5E93",memoryHint:"\u4F60\u7684\u672C\u5730\u7B2C\u4E8C\u5927\u8111",zoomIn:"\u653E\u5927",zoomOut:"\u7F29\u5C0F",fit:"\u9002\u5E94",enterFullscreen:"\u5168\u5C4F",exitFullscreen:"\u9000\u51FA\u5168\u5C4F",exportGraph:"\u5BFC\u51FA",openCard:"\u6253\u5F00\u5361\u7247",focusNeighbors:"\u51F8\u663E\u5173\u8054",copyName:"\u590D\u5236\u540D\u79F0",noMatch:"\u6CA1\u6709\u5339\u914D\u7684\u8BB0\u5FC6",clearFilter:"\u6E05\u9664\u8FC7\u6EE4",filterLabel:"\u7B5B\u9009",sortRecent:"\u6700\u8FD1",sortTitle:"\u6807\u9898",sortHot:"\u70ED\u70B9",exportSel:"\u5BFC\u51FA\u9009\u4E2D",clearSelection:"\u6E05\u7A7A\u9009\u62E9",download:"\u4E0B\u8F7D",openNewTab:"\u65B0\u6807\u7B7E\u6253\u5F00",copyImage:"\u590D\u5236\u56FE\u7247",done:"\u5B8C\u6210",downloaded:"\u5DF2\u5F00\u59CB\u4E0B\u8F7D",openedTab:"\u5DF2\u5728\u65B0\u6807\u7B7E\u6253\u5F00",copied:"\u5DF2\u590D\u5236",exportedSel:"\u4E2A\u8282\u70B9\u5DF2\u5BFC\u51FA",fullscreen:"\u5168\u5C4F",exitFull:"\u9000\u51FA\u5168\u5C4F",copyFail:"\u590D\u5236\u5931\u8D25",timeDim:"\u65F6\u95F4\u7EF4",timeNew:"3 \u5929\u5185",timeRecent:"2 \u5468\u5185",timeMonth:"1 \u6708\u5185",timeOld:"\u66F4\u65E9",newBadge:"\u65B0",expand:"\u5C55\u5F00\u5168\u90E8",collapse:"\u6536\u8D77",exportVault:"\u5BFC\u51FAMD",exportJson:"\u5BFC\u51FAJSON",exporting:"\u5BFC\u51FA\u4E2D\u2026",exportedVault:"\u8BB0\u5FC6\u5E93\u5DF2\u5BFC\u51FA",exportFail:"\u5BFC\u51FA\u5931\u8D25",importVault:"\u5BFC\u5165",importedVault:"\u5BFC\u5165\u5B8C\u6210",importedSkipped:"\uFF08\u8DF3\u8FC7\u91CD\u590D ",importFail:"\u5BFC\u5165\u5931\u8D25",location:"\u81EA\u9009\u4F4D\u7F6E",saveAs:"\u53E6\u5B58\u4E3A",saveAsUnsupported:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u9009\u62E9\u4FDD\u5B58\u4F4D\u7F6E",exportedTo:"\u5DF2\u5BFC\u51FA\u5230",defaultDownloads:"\u9ED8\u8BA4\u4E0B\u8F7D\u6587\u4EF6\u5939",exportCancel:"\u5DF2\u53D6\u6D88\u5BFC\u51FA",manage:"\u7BA1\u7406",tabUsage:"\u7528\u91CF/\u4ECA\u65E5",tabOptimize:"\u6574\u7406\u5EFA\u8BAE",adminLoadFail:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF1A\u8BF7\u5F7B\u5E95\u91CD\u542F dsh-desktop\uFF08host \u9700\u52A0\u8F7D\u65B0\u7248 /memory-eternal \u8DEF\u7531\uFF09",retry:"\u91CD\u8BD5",mergeSimilar:"\u4E00\u952E\u5408\u5E76\u76F8\u4F3C",trendLabel:"\u8FD1 30 \u5929\u8D8B\u52BF",cleanStale:"\u{1F5D1}\uFE0F \u4E00\u952E\u6E05\u7406\u9648\u65E7",deletedStale:"\u4E2A\u9648\u65E7\u5361\u5DF2\u6E05\u7406",newCard:"\u65B0\u5EFA",tplDecision:"\u{1F4DD} \u6280\u672F\u51B3\u7B56",tplBug:"\u{1F41B} \u8E29\u5751",tplMeeting:"\u{1F4CB} \u4F1A\u8BAE\u7EAA\u8981",tplWeekly:"\u{1F4CA} \u5468\u62A5",createCard:"\u521B\u5EFA",cardTitle:"\u6807\u9898",cardBody:"\u6B63\u6587",fbUseful:"\u6709\u7528",fbIrr:"\u65E0\u5173",todayAdd:"\u4ECA\u65E5\u65B0\u589E",weekAdd:"\u8FD1 7 \u5929",byKind:"\u5206\u7C7B\u7EDF\u8BA1",todayList:"\u4ECA\u65E5\u6C89\u6DC0",budgetLabel:"\u4F1A\u8BDD\u9884\u7B97",budgetChars:"\u9884\u7B97\u5B57\u7B26",recallLimitLabel:"\u53EC\u56DE\u6761\u6570",embeddingLabel:"\u8BED\u4E49\u53EC\u56DE",mergePairs:"\u76F8\u4F3C\u5361\u5BF9\uFF08\u53EF\u5408\u5E76\uFF09",staleCards:"\u9648\u65E7\u5361\uFF08>90 \u5929\u672A\u66F4\u65B0\uFF09",noOptimize:"\u6682\u65E0\u53EF\u6574\u7406\u9879\uFF0C\u5F88\u5065\u5EB7 \u{1F389}",oneClickOptimize:"\u4E00\u952E\u4F18\u5316",oneClickOptimizeConfirm:"\u786E\u8BA4\u4E00\u952E\u4F18\u5316\uFF1F\u5C06\u5408\u5E76\u6240\u6709\u76F8\u4F3C\u5361\u5BF9\uFF08\u9ED8\u8BA4\u4E0D\u6E05\u7406\u9648\u65E7\u5361\uFF09\u3002",oneClickAlsoStale:"\u540C\u65F6\u6E05\u7406\u9648\u65E7\u5361",oneClickOptimizeDone:"\u4E00\u952E\u4F18\u5316\u5B8C\u6210",optimizedMerged:"\u5BF9\u5DF2\u5408\u5E76",optimizedStaleDeleted:"\u5F20\u9648\u65E7\u5361\u5DF2\u6E05\u7406",mcpSetupStatus:"Agent MCP \u6302\u8F7D\u72B6\u6001",rerunSetup:"\u8865\u5168 MCP",notInstalled:"\u672A\u5B89\u88C5",noMcpEntry:"\u914D\u7F6E\u7F3A\u5931",nodePathMismatch:"node \u8DEF\u5F84\u4E0D\u4E00\u81F4\uFF0C\u5EFA\u8BAE\u91CD\u8DD1 setup",nodePathNote:"node \u73AF\u5883\u4E0D\u540C\uFF08\u53EF\u7528\uFF09",healthy:"\u914D\u7F6E\u6B63\u5E38",mcpSetupHint:"\u300C\u81EA\u52A8\u6302\u8F7D MCP\u300D= \u8BA9 Claude Code / Codex / Cursor \u8FD9\u4E9B\u5DE5\u5177\u80FD\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002\u5F00\u542F\u540E\u81EA\u52A8\u628A\u5B83\u4EEC\u914D\u7F6E\u597D\uFF1B\u5173\u6389\u5C31\u4E0D\u52A8\u4F60\u7535\u8111\u4E0A\u4EFB\u4F55\u914D\u7F6E\u6587\u4EF6\uFF0C\u9700\u8981\u65F6\u624B\u52A8\u8DD1 dsh-memory setup\u3002",mcpManageHint:"\u6BCF\u4E2A agent \u7528\u4E0B\u65B9\u6309\u94AE\u5355\u72EC\u5B89\u88C5/\u5378\u8F7D MCP",tabConfig:"\u8BB0\u5FC6\u914D\u7F6E",tabAudit:"\u5BA1\u6838\u4E2D\u5FC3",statusApproved:"\u5DF2\u5BA1\u6838",statusPending:"\u5F85\u5BA1\u6838",statusRejected:"\u5DF2\u9A73\u56DE",allStatus:"\u5168\u90E8\u72B6\u6001",tabRecycle:"\u56DE\u6536\u4E2D\u5FC3",pending:"\u5F85\u5BA1\u6838",rejected:"\u5DF2\u9A73\u56DE",selectAll:"\u5168\u9009",approve:"\u6279\u51C6",reject:"\u9A73\u56DE",allAgents:"\u5168\u90E8\u667A\u80FD\u4F53",noAuditItems:"\u6682\u65E0\u5BA1\u6838\u9879\u76EE",deletedAt:"\u5220\u9664\u4E8E",restore:"\u6062\u590D",restoreDelete:"\u5220\u9664\u8FDB\u56DE\u6536\u7AD9",purge:"\u6C38\u4E45\u5220\u9664",emptyRecycle:"\u56DE\u6536\u7AD9\u4E3A\u7A7A",recycleHint:"\u5220\u9664\u7684\u5361\u7247\u5148\u8FDB\u56DE\u6536\u7AD9\uFF0C30 \u5929\u5185\u53EF\u6062\u590D\uFF0C\u8D85\u671F\u81EA\u52A8\u6C38\u4E45\u5220\u9664",purgeConfirm:"\u786E\u5B9A\u6C38\u4E45\u5220\u9664\uFF1F\u4E0D\u53EF\u6062\u590D\u3002",recycleDeleteConfirm:"\u786E\u5B9A\u5220\u9664\u8FDB\u56DE\u6536\u7AD9\uFF1F30 \u5929\u5185\u53EF\u6062\u590D\u3002",modeInit:"\u542F\u52A8\u65F6\u62C9\u4E00\u6B21",modeInterval:"\u5468\u671F\u4FDD\u6D3B",modeManual:"\u4EC5\u624B\u52A8",serviceConfig:"\u670D\u52A1\u81EA\u7BA1\u7406\u914D\u7F6E",auditConfig:"\u81EA\u52A8\u5BA1\u6838\u914D\u7F6E",auditHint:"\u547D\u4E2D\u514D\u5BA1\u7684\u65B0\u5361\u76F4\u63A5\u5165\u5E93\uFF0C\u5176\u4F59\u8FDB\u5F85\u5BA1\u6838",auditMode:"\u5BA1\u6838\u6A21\u5F0F",auditAll:"\u5168\u90E8\u8981\u5BA1\u6838",auditNone:"\u5168\u90E8\u514D\u5BA1",auditExemptAgents:"\u514D\u5BA1\u667A\u80FD\u4F53",auditExemptKinds:"\u514D\u5BA1\u7C7B\u578B",allExempt:"\u5168\u90E8\u514D\u5BA1",recycleDays:"\u56DE\u6536\u4FDD\u7559\u5929\u6570",editInSetting:"\u7F16\u8F91\u8BF7\u5230 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6",setupRunInTerminal:"\u8BF7\u590D\u5236\u4EE5\u4E0B\u547D\u4EE4\u5230\u7EC8\u7AEF\u6267\u884C\uFF1A",dshMemoryConfig:"DSH \u8BB0\u5FC6\u914D\u7F6E",autoCapture:"\u81EA\u52A8\u6C89\u6DC0",autoRecall:"\u81EA\u52A8\u53EC\u56DE",captureMinChars:"\u6355\u83B7\u6700\u5C0F\u957F\u5EA6",maxCardsPerDay:"\u65E5\u914D\u989D",dedupThreshold:"\u53BB\u91CD\u9608\u503C",recallLimit:"\u53EC\u56DE\u6761\u6570",vaultMulti:"\u591A\u5E93\uFF08\u6309\u9879\u76EE\u9694\u79BB\uFF09",vaultMultiHint:"\u7559\u7A7A\u5373\u5355\u5E93\uFF0C\u8001\u914D\u7F6E\u4E0D\u53D7\u5F71\u54CD",vaultNow:"\u5F53\u524D\u751F\u6548",vaultSource:"\u6765\u6E90",vaultWorkspace:"\u5F53\u524D workspace",vaultNamePh:"\u5E93\u540D\uFF0C\u5982 work",vaultPathPh:"\u76EE\u5F55\uFF0C\u5982 D:/vaults/work",vaultMatchPh:"\u9879\u76EE\u76EE\u5F55\uFF08\u53EF\u9009\uFF0C\u6309 workspace \u81EA\u52A8\u9009\u5E93\uFF09",vaultAdd:"\u6DFB\u52A0\u4E00\u4E2A\u5E93",vaultActive:"\u6FC0\u6D3B\u5E93",vaultActiveNone:"\u9ED8\u8BA4\u5E93\uFF08\u4E0D\u6307\u5B9A\uFF09",vaultSrcEnv:"\u73AF\u5883\u53D8\u91CF MEMORY_VAULT_DIR",vaultSrcProfile:"\u6FC0\u6D3B\u5E93\u914D\u7F6E",vaultSrcWorkspace:"\u6309\u9879\u76EE\u76EE\u5F55\u81EA\u52A8\u547D\u4E2D",vaultSrcVaultDir:"\u5355\u5E93\u914D\u7F6E vaultDir",vaultSrcDefault:"\u9ED8\u8BA4\u76EE\u5F55",fbNav:"\u53CD\u9988\u5F02\u5E38",fbTitle:"\u53CD\u9988\u5F02\u5E38\uFF08\u63D0\u4EA4\u5230 GitHub\uFF09",fbDesc:"\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF08\u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A\uFF09",fbDiag:"\u8BCA\u65AD\u4FE1\u606F\uFF08\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E key/token \u5DF2\u66FF\u6362\uFF09",fbCopyDiag:"\u590D\u5236\u8BCA\u65AD\u4FE1\u606F",fbOpenIssue:"\u5728 GitHub \u63D0\u4EA4\uFF08\u5DF2\u9884\u586B\uFF09",fbCopyPrompt:"\u590D\u5236\u7ED9 AI \u7684\u63D0\u793A\u8BCD",fbCopiedDiag:"\u8BCA\u65AD\u4FE1\u606F\u5DF2\u590D\u5236",fbCopiedPrompt:"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\uFF0C\u7C98\u8FDB AI \u5BF9\u8BDD\u6846\u5373\u53EF",fbCopyFail:"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u590D\u5236",fbWhy:"GitHub \u4E0D\u5141\u8BB8\u533F\u540D\u521B\u5EFA issue\uFF0C\u63D2\u4EF6\u91CC\u4E5F\u4E0D\u5E94\u5185\u7F6E token\uFF1A\u6240\u4EE5\u8FD9\u91CC\u628A\u6807\u9898 / \u6B63\u6587 / \u8BCA\u65AD\u90FD\u9884\u586B\u597D\uFF0C\u4F60\u53EA\u9700\u518D\u70B9\u4E00\u6B21 Submit\u3002",fbNeedDesc:"\u8BF7\u5148\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898",fbLoading:"\u6B63\u5728\u6536\u96C6\u8BCA\u65AD\u4FE1\u606F\u2026",fbDiagFail:"\u8BCA\u65AD\u63A5\u53E3\u4E0D\u53EF\u7528\uFF08\u72EC\u7ACB web \u6216\u65E7\u7248\u5BBF\u4E3B\uFF09\uFF0C\u8BF7\u624B\u52A8\u8865\u5145\u73AF\u5883\u4FE1\u606F",fbOr:"\u6216\u8005",fbSelectAll:"\u5168\u9009",toastApproved:"\u5DF2\u6279\u51C6",toastRejected:"\u5DF2\u9A73\u56DE",toastCardDeleted:"\u5DF2\u5220\u9664",toastRestored:"\u5DF2\u6062\u590D",toastPurged:"\u5DF2\u5F7B\u5E95\u5220\u9664",toastPurgedExpired:"\u5DF2\u6E05\u7406\u8FC7\u671F\u56DE\u6536\u7AD9",toastFailed:"\u64CD\u4F5C\u5931\u8D25",noSelection:"\u8BF7\u5148\u9009\u62E9\u8981\u5904\u7406\u7684\u5361\u7247",actionRunning:"\u5904\u7406\u4E2D\u2026",recycleEmptyHint:"\u56DE\u6536\u7AD9\u4E3A\u7A7A\uFF1A\u5220\u6389\u7684\u5361\u7247\u4F1A\u5148\u653E\u5230\u8FD9\u91CC\uFF0C\u4FDD\u7559 {days} \u5929\u540E\u81EA\u52A8\u6E05\u7406\u3002",recyclePurgeAll:"\u6E05\u7A7A\u56DE\u6536\u7AD9",fbCopyManual:"\u81EA\u52A8\u590D\u5236\u88AB\u6D4F\u89C8\u5668\u62E6\u622A\uFF0C\u5DF2\u628A\u5185\u5BB9\u653E\u5728\u4E0B\u9762\uFF1A\u70B9\u300C\u5168\u9009\u300D\u518D\u6309 Ctrl+C",vcLoaded:"\u8FD0\u884C\u4E2D\uFF08\u5BBF\u4E3B\u52A0\u8F7D\uFF09",vcOnDisk:"\u78C1\u76D8\u5B89\u88C5",vcLatest:"npm \u6700\u65B0",vcStale:"\u78C1\u76D8\u5DF2\u5B89\u88C5 {disk}\uFF0C\u4F46\u5F53\u524D DSH \u8FDB\u7A0B\u4ECD\u52A0\u8F7D {loaded} \u2014\u2014 \u91CD\u542F\u684C\u9762\u7248 / DSH \u540E\u624D\u751F\u6548",vcOutdated:"\u6709\u65B0\u7248\u672C",vcUpToDate:"\u5DF2\u662F\u6700\u65B0",vcCheck:"\u68C0\u67E5\u66F4\u65B0",checking:"\u68C0\u67E5\u4E2D\u2026",vcCheckFail:"\u68C0\u67E5\u66F4\u65B0\u5931\u8D25",saving:"\u4FDD\u5B58\u4E2D\u2026",recallSummaryLen:"\u53EC\u56DE\u6458\u8981\u957F\u5EA6",recallBody:"\u53EC\u56DE\u542B\u6B63\u6587",autoWeb:"Web server",autoWebMode:"\u4FDD\u6D3B\u6A21\u5F0F",webPort:"Web \u7AEF\u53E3",webCheckIntervalMs:"\u63A2\u6D3B\u95F4\u9694(ms)",webMaxRestart:"\u6700\u5927\u91CD\u542F\u6B21\u6570",watchdogAutoSpawn:"\u770B\u95E8\u72D7\u8FDB\u7A0B",autoMcpSetup:"\u81EA\u52A8\u6302\u8F7D MCP",saveConfig:"\u4FDD\u5B58\u914D\u7F6E",saveFail:"\u4FDD\u5B58\u5931\u8D25",savedOk:"\u5DF2\u4FDD\u5B58",recallTool:"recall \u5DE5\u5177",costControl:"\u6210\u672C\u63A7\u5236",costHint:"\u7701 token\u3001\u63A7 LLM \u6D88\u8017",distillEnabled:"\u84B8\u998F\u77E5\u8BC6\u5361(\u5F00=LLM \u538B\u7F29, \u5173=\u539F\u6587\u5361\u96F6 LLM)",dedupByLLM:"\u8BED\u4E49\u53BB\u91CD\u5582 LLM(\u5173=\u7EAF\u8BCD\u6CD5\u66F4\u7701)",captureMaxTokens:"\u84B8\u998F\u8F93\u51FA\u4E0A\u9650(token)",recallMinScore:"\u53EC\u56DE\u76F8\u5173\u6027\u9608\u503C(\u8D8A\u9AD8\u8D8A\u7701)",configNeedsDsh:"\u914D\u7F6E\u7F16\u8F91\u9700\u5728 DSH \u5185\u6253\u5F00\uFF08\u672C\u9875\u53EF\u80FD\u53EA\u8BFB\u6216\u6709\u90E8\u5206\u7F3A\u5931\uFF09",installMcp:"\u5B89\u88C5 MCP",uninstallMcp:"\u5378\u8F7D MCP",uninstallConfirm:"\u786E\u8BA4\u5378\u8F7D\u8BE5\u667A\u80FD\u4F53\u7684 MCP\uFF1FClaude Code/Codex \u5C06\u65E0\u6CD5\u518D\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002",presetConfig:"\u4E00\u952E\u63A8\u8350\u914D\u7F6E",presetHint:"\u70B9\u51FB\u586B\u5145\u5BF9\u5E94\u65B9\u6848\uFF0C\u70B9\u4FDD\u5B58\u751F\u6548",planA:"A \u8F7B\u91CF\u7701\u5FC3",planB:"B \u6781\u81F4\u7701\u94B1",planC:"C \u9AD8\u8D28\u91CF",pluginInfo:"\u63D2\u4EF6\u4FE1\u606F",organizeTitle:"\u6574\u7406\u5EFA\u8BAE",scanAndOrganize:"\u4E00\u952E\u641C\u7D22\u548C\u6574\u7406",scanHint:"\u70B9\u300C\u{1F50D} \u4E00\u952E\u641C\u7D22\u548C\u6574\u7406\u300D\u626B\u63CF\u76F8\u4F3C\u5361/\u9648\u65E7\u5361\uFF0C\u518D\u7528\u300C\u26A1 \u4E00\u952E\u4F18\u5316\u300D\u6267\u884C\u3002",mergeNow:"\u5408\u5E76",delete:"\u5220\u9664",captureAlert:"\u81EA\u52A8\u6C89\u6DC0\u5F02\u5E38",captureAlertHint:"\u6253\u5F00\u5DE6\u680F\u300C\u7528\u91CF/\u4ECA\u65E5\u300D\u770B\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7\uFF1B\u82E5\u662F\u63A5\u53E3/\u7248\u672C\u4E0D\u5339\u914D\uFF0C\u9700\u66F4\u65B0 memory-eternal \u63D2\u4EF6\u3002",captureLog:"\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7",captureLogHint:"\u6BCF\u8F6E\u5BF9\u8BDD\u7ED3\u675F\u540E\u81EA\u52A8\u8DD1\uFF1A\u76D1\u542C \u2192 \u5224\u5B9A \u2192 \u5199\u5361\u3002\u8FD9\u91CC\u663E\u793A\u6700\u8FD1 100 \u6761\uFF0C\u7528\u6765\u6392\u67E5\u300C\u4E3A\u4EC0\u4E48\u6CA1\u5199\u5361\u300D\u3002",captureLogEmpty:"\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002\u8DDF Agent \u804A\u4E00\u8F6E\uFF08> \u6355\u83B7\u6700\u5C0F\u957F\u5EA6\uFF09\u540E\u518D\u56DE\u6765\u770B\u3002",captureLogUnavailable:"\u65E5\u5FD7\u4EC5\u5728 DSH \u5BBF\u4E3B\u5185\u53EF\u7528\uFF08\u72EC\u7ACB Web \u9875\u6CA1\u6709 host \u8FD0\u884C\u65F6\uFF09\u3002",captureAgentCards:"Agent \u81EA\u52A8\u6C89\u6DC0\u7684\u5361",noCards:"\u6682\u65E0",loadMore:"\u52A0\u8F7D\u66F4\u591A",batchMerge:"\u4E00\u952E\u667A\u80FD\u5408\u5E76",mergeAllConfirm:"\u5C06\u6309\u76F8\u4F3C\u5EA6\u5206\u7EC4\u7684\u5361\u7247\u5404\u5408\u5E76\u4E3A\u4E00\u5F20\uFF08\u4FDD\u7559\u5404\u81EA kind\uFF09\uFF0C\u539F\u5361\u5220\u9664\uFF1F",crossVault:"\u8DE8\u5E93\u805A\u5408",deleteConfirm:"\u786E\u5B9A\u5220\u9664\u8BE5\u8BB0\u5FC6\u5361\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002",deleted:"\u5DF2\u5220\u9664",deleteFail:"\u5220\u9664\u5931\u8D25",deleteSelected:"\u5220\u9664\u9009\u4E2D",deletedSelected:"\u5F20\u5361\u5DF2\u5220\u9664",merge:"\u5408\u5E76",mergeNeed:"\u81F3\u5C11\u9009 2 \u5F20\u5361",mergeConfirm:"\u5C06\u6240\u9009\u5361\u7247\u5408\u5E76\u4E3A\u4E00\u5F20\u5E76\u5220\u9664\u539F\u5361\uFF1F",merged:"\u5DF2\u5408\u5E76",mergeFail:"\u5408\u5E76\u5931\u8D25",mcpInstalled:"\u2705 {agent} MCP \u5DF2\u5B89\u88C5",mcpUninstalled:"\u2705 {agent} MCP \u5DF2\u5378\u8F7D",mcpActionFail:"\u274C {agent} MCP \u64CD\u4F5C\u5931\u8D25\uFF1A{error}",dshHostLabel:"DeepSeek Harness\uFF08\u5F53\u524D\u5BBF\u4E3B\uFF09",restartHint:"\u5DF2\u4FDD\u5B58\u3002autoWebMode/watchdogAutoSpawn \u7B49\u9700\u91CD\u542F DSH \u751F\u6548",conflictRefresh:"\u914D\u7F6E\u5DF2\u88AB\u5916\u90E8\u4FEE\u6539\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5",untitled:"\u65E0\u6807\u9898",tplBlank:"\u{1F4C4} \u7A7A\u767D",tagsHint:"\u6807\u7B7E\uFF08\u9017\u53F7\u5206\u9694\uFF09",connCount:"{n} \u8FDE\u63A5",tplDecisionTags:"\u51B3\u7B56, \u65B9\u6848",tplBugTags:"\u8E29\u5751, \u6559\u8BAD",tplMeetingTags:"\u4F1A\u8BAE, \u7EAA\u8981",tplWeeklyTags:"\u5468\u62A5",tplDecisionBody:`# \u6280\u672F\u51B3\u7B56\uFF1A[\u6807\u9898]
17
17
 
18
18
  ## \u80CC\u666F
19
19
  - \u95EE\u9898\u63CF\u8FF0
@@ -58,7 +58,7 @@ var Ht=Object.create;var ut=Object.defineProperty;var _t=Object.getOwnPropertyDe
58
58
  -
59
59
 
60
60
  ## \u98CE\u9669/\u963B\u585E
61
- - `},Ft={nav:"Memory",loading:"Loading\u2026",refresh:"Refresh",overview:"Memory Overview",total:"Cards",recent:"Added (7d)",tags:"Tags",searchPlaceholder:"Search memory\u2026",search:"Search",all:"All",kindProject:"Projects",kindKnowledge:"Knowledge",kindContent:"Content",kindPrompt:"Prompts",kindBusiness:"Business",kindTool:"Tools",kindMistake:"Mistakes",cardsTab:"Cards",graphTab:"Graph",graph:"Knowledge Graph",graphHint:"Nodes = cards; edges = [[links]] or shared tags. Click a node to read.",graphTip:"Left-click highlights \xB7 Shift+drag box-select \xB7 right-click menu \xB7 scroll zoom \xB7 drag to pan",rebuild:"Rebuild",reset:"Reset",expandAll:"Expand all",capped:"Showing the",clearFocus:"Clear highlight",empty:"Memory is empty. After a few conversations, valuable content is auto-captured.",emptyGraph:"No graph data yet.",open:"Read",updated:"Updated",created:"Created",source:"Source",close:"Close",vaultDir:"Vault directory",capture:"Auto capture",recall:"Auto recall",enabled:"on",disabled:"off",error:"Load failed",back:"Back to list",cardCount:"cards",nodes:"nodes",edges:"edges",memoryTitle:"Memory Library",memoryHint:"Your local second brain",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",enterFullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",exportGraph:"Export",openCard:"Open card",focusNeighbors:"Highlight links",copyName:"Copy name",noMatch:"No matching memory",clearFilter:"Clear filter",filterLabel:"Filter",sortRecent:"Recent",sortTitle:"Title",sortHot:"Hot",exportSel:"Export selected",clearSelection:"Clear selection",download:"Download",openNewTab:"Open in new tab",copyImage:"Copy image",done:"Done",downloaded:"Download started",openedTab:"Opened in new tab",copied:"Copied",exportedSel:" nodes exported",fullscreen:"Fullscreen",exitFull:"Exit fullscreen",copyFail:"Copy failed",timeDim:"Time",timeNew:"\u22643 days",timeRecent:"\u22642 weeks",timeMonth:"\u22641 month",timeOld:"Older",newBadge:"NEW",expand:"Expand",collapse:"Collapse",exportVault:"Export MD",exportJson:"Export JSON",exporting:"Exporting\u2026",exportedVault:"Vault exported",exportFail:"Export failed",importVault:"Import",importedVault:"Import complete",importedSkipped:" (skipped dup ",importFail:"Import failed",location:"Choose location",saveAs:"Save as",saveAsUnsupported:"Choose-save-location not supported here",exportedTo:"Exported to",defaultDownloads:"default Downloads folder",exportCancel:"Export cancelled",manage:"Manage",tabUsage:"Usage / Today",tabOptimize:"Optimize",adminLoadFail:"Load failed: fully restart dsh-desktop so the host picks up the new /memory-eternal routes",retry:"Retry",mergeSimilar:"Merge similar",trendLabel:"Last 30 days trend",cleanStale:"\u{1F5D1}\uFE0F Clean stale",deletedStale:" stale cards cleaned",newCard:"New",tplDecision:"\u{1F4DD} Decision",tplBug:"\u{1F41B} Bug",tplMeeting:"\u{1F4CB} Meeting",tplWeekly:"\u{1F4CA} Weekly",createCard:"Create",cardTitle:"Title",cardBody:"Body",fbUseful:"Useful",fbIrr:"Irrelevant",todayAdd:"Added today",weekAdd:"Last 7d",byKind:"By kind",todayList:"Captured today",budgetLabel:"Session budget",budgetChars:"Budget chars",recallLimitLabel:"Recall limit",embeddingLabel:"Semantic recall",mergePairs:"Similar pairs (mergeable)",staleCards:"Stale (>90d)",noOptimize:"Nothing to organize, healthy \u{1F389}",oneClickOptimize:"One-click optimize",oneClickOptimizeConfirm:"Confirm one-click optimize? This will merge all similar pairs (stale cards are NOT deleted by default).",oneClickAlsoStale:"Also clean stale cards",oneClickOptimizeDone:"One-click optimize done",optimizedMerged:"pairs merged",optimizedStaleDeleted:"stale cards cleaned",mcpSetupStatus:"Agent MCP mount status",rerunSetup:"Re-run setup",notInstalled:"not installed",noMcpEntry:"no MCP entry",nodePathMismatch:"node path mismatch, consider re-running setup",nodePathNote:"different node env (usable)",healthy:"healthy",mcpSetupHint:'"Auto-mount MCP" = lets Claude Code / Codex / Cursor use the memory vault. On = auto-configures them; Off = never touches your machine config, run dsh-memory setup manually when needed.',mcpManageHint:"Use each agent row to install/uninstall MCP individually",tabConfig:"Memory Config",tabAudit:"Audit Center",statusApproved:"Approved",statusPending:"Pending",statusRejected:"Rejected",allStatus:"All statuses",tabRecycle:"Recycle Bin",pending:"Pending",rejected:"Rejected",selectAll:"Select all",approve:"Approve",reject:"Reject",allAgents:"All agents",noAuditItems:"No items to review",deletedAt:"deleted",restore:"Restore",restoreDelete:"Delete to recycle",purge:"Purge",emptyRecycle:"Recycle bin is empty",recycleHint:"Deleted cards go to the recycle bin \u2014 recover within 30 days, else auto-purged",purgeConfirm:"Permanently delete? This cannot be undone.",recycleDeleteConfirm:"Delete to recycle? Recoverable within 30 days.",modeInit:"Init once",modeInterval:"Interval keep-alive",modeManual:"Manual only",serviceConfig:"Service self-hosting config",auditConfig:"Auto-audit config",auditHint:"Cards matching an exemption go straight in; others await audit",auditMode:"Audit mode",auditAll:"Audit all",auditNone:"Skip all",auditExemptAgents:"Exempt agents",auditExemptKinds:"Exempt kinds",allExempt:"Exempt all",recycleDays:"Recycle retention days",editInSetting:"Edit in DSH Settings \u2192 Memory",setupRunInTerminal:"Copy this command to your terminal:",dshMemoryConfig:"DSH Memory Config",autoCapture:"Auto capture",autoRecall:"Auto recall",captureMinChars:"Min capture chars",maxCardsPerDay:"Daily quota",dedupThreshold:"Dedup threshold",recallLimit:"Recall limit",vaultMulti:"Multiple vaults (per project)",vaultMultiHint:"Empty = single vault; existing setups unaffected",vaultNow:"Active now",vaultSource:"Source",vaultWorkspace:"Current workspace",vaultNamePh:"Name, e.g. work",vaultPathPh:"Directory, e.g. D:/vaults/work",vaultMatchPh:"Project dir (optional, auto-select by workspace)",vaultAdd:"Add a vault",vaultActive:"Active vault",vaultActiveNone:"Default vault (unset)",vaultSrcEnv:"env MEMORY_VAULT_DIR",vaultSrcProfile:"activeVault profile",vaultSrcWorkspace:"matched by project dir",vaultSrcVaultDir:"vaultDir setting",vaultSrcDefault:"default directory",fbNav:"Report a bug",fbTitle:"Report a bug (files on GitHub)",fbDesc:"Describe the problem (symptoms / steps / expected)",fbDiag:"Diagnostics (auto-redacted: home dir and keys/tokens replaced)",fbCopyDiag:"Copy diagnostics",fbOpenIssue:"Open prefilled issue on GitHub",fbCopyPrompt:"Copy AI prompt",fbCopiedDiag:"Diagnostics copied",fbCopiedPrompt:"Prompt copied \u2014 paste it into your AI chat",fbCopyFail:"Copy failed; please select and copy manually",fbWhy:"GitHub does not allow anonymous issue creation and the plugin must not ship a token: so the title, body and diagnostics are pre-filled \u2014 you just click Submit.",fbNeedDesc:"Please describe the problem first",fbLoading:"Collecting diagnostics\u2026",fbDiagFail:"Diagnostics endpoint unavailable (standalone web or older host); please add environment info manually",fbOr:"or",recallSummaryLen:"Recall summary len",recallBody:"Recall with body",autoWeb:"Web server",autoWebMode:"Keep-alive mode",webPort:"Web port",webCheckIntervalMs:"Probe interval (ms)",webMaxRestart:"Max restart",watchdogAutoSpawn:"Watchdog process",autoMcpSetup:"Auto-mount MCP",saveConfig:"Save config",saveFail:"Save failed",savedOk:"Saved",recallTool:"recall tool",costControl:"Cost control",costHint:"save tokens, control LLM usage",distillEnabled:"Distill cards (on=LLM compress, off=raw cards zero LLM)",dedupByLLM:"Dedup feeds LLM (off=pure lexical, cheaper)",captureMaxTokens:"Distill output cap (tokens)",recallMinScore:"Recall min score (higher = cheaper)",configNeedsDsh:"Edit config inside DSH (this page may be read-only or partially missing)",installMcp:"Install MCP",uninstallMcp:"Uninstall MCP",uninstallConfirm:"Confirm uninstall MCP for this agent? Claude Code/Codex will lose access to the memory vault.",presetConfig:"One-click preset config",presetHint:"Click to fill a plan, then hit Save",planA:"A Light",planB:"B Budget",planC:"C Premium",pluginInfo:"Plugin info",organizeTitle:"Organize",scanAndOrganize:"Scan & organize",scanHint:'Click "\u{1F50D} Scan & organize" to find similar/stale cards, then "\u26A1 One-click optimize" to run.',mergeNow:"Merge",delete:"Delete",captureAlert:"Auto-capture failed",captureAlertHint:'Open "Usage / Today" for the capture log; if the cause is an API/version mismatch, update the memory-eternal plugin.',captureLog:"Auto-capture log",captureLogHint:"Runs after every turn: listen \u2192 judge \u2192 write. Last 100 entries, so you can see why a card was not written.",captureLogEmpty:"No entries yet. Chat one turn (> min capture chars) and come back.",captureLogUnavailable:"Log is available only inside the DSH host (the standalone web page has no host runtime).",captureAgentCards:"Cards auto-captured by the agent",noCards:"none",loadMore:"Load more",batchMerge:"Smart batch merge",mergeAllConfirm:"Merge similar-grouped cards into one each (keep kind), delete originals?",crossVault:"All vaults",deleteConfirm:"Delete this memory card? This cannot be undone.",deleted:"Deleted",deleteFail:"Delete failed",deleteSelected:"Delete selected",deletedSelected:" cards deleted",merge:"Merge",mergeNeed:"Select at least 2 cards",mergeConfirm:"Merge the selected cards into one and delete the originals?",merged:"Merged",mergeFail:"Merge failed",mcpInstalled:"\u2705 {agent} MCP installed",mcpUninstalled:"\u2705 {agent} MCP uninstalled",mcpActionFail:"\u274C {agent} MCP action failed: {error}",dshHostLabel:"DeepSeek Harness (current host)",restartHint:"Saved. autoWebMode/watchdogAutoSpawn take effect after restarting DSH",conflictRefresh:"Config changed elsewhere \u2014 refresh and retry",untitled:"Untitled",tplBlank:"\u{1F4C4} Blank",tagsHint:"Tags (comma-separated)",connCount:"{n} connections",tplDecisionTags:"decision, plan",tplBugTags:"pitfall, lesson",tplMeetingTags:"meeting, minutes",tplWeeklyTags:"weekly report",tplDecisionBody:`# Tech decision: [title]
61
+ - `},Xt={nav:"Memory",loading:"Loading\u2026",refresh:"Refresh",overview:"Memory Overview",total:"Cards",recent:"Added (7d)",tags:"Tags",searchPlaceholder:"Search memory\u2026",search:"Search",all:"All",kindProject:"Projects",kindKnowledge:"Knowledge",kindContent:"Content",kindPrompt:"Prompts",kindBusiness:"Business",kindTool:"Tools",kindMistake:"Mistakes",cardsTab:"Cards",graphTab:"Graph",graph:"Knowledge Graph",graphHint:"Nodes = cards; edges = [[links]] or shared tags. Click a node to read.",graphTip:"Left-click highlights \xB7 Shift+drag box-select \xB7 right-click menu \xB7 scroll zoom \xB7 drag to pan",rebuild:"Rebuild",reset:"Reset",expandAll:"Expand all",capped:"Showing the",clearFocus:"Clear highlight",empty:"Memory is empty. After a few conversations, valuable content is auto-captured.",emptyGraph:"No graph data yet.",open:"Read",updated:"Updated",created:"Created",source:"Source",close:"Close",vaultDir:"Vault directory",capture:"Auto capture",recall:"Auto recall",enabled:"on",disabled:"off",error:"Load failed",back:"Back to list",cardCount:"cards",nodes:"nodes",edges:"edges",memoryTitle:"Memory Library",memoryHint:"Your local second brain",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",enterFullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",exportGraph:"Export",openCard:"Open card",focusNeighbors:"Highlight links",copyName:"Copy name",noMatch:"No matching memory",clearFilter:"Clear filter",filterLabel:"Filter",sortRecent:"Recent",sortTitle:"Title",sortHot:"Hot",exportSel:"Export selected",clearSelection:"Clear selection",download:"Download",openNewTab:"Open in new tab",copyImage:"Copy image",done:"Done",downloaded:"Download started",openedTab:"Opened in new tab",copied:"Copied",exportedSel:" nodes exported",fullscreen:"Fullscreen",exitFull:"Exit fullscreen",copyFail:"Copy failed",timeDim:"Time",timeNew:"\u22643 days",timeRecent:"\u22642 weeks",timeMonth:"\u22641 month",timeOld:"Older",newBadge:"NEW",expand:"Expand",collapse:"Collapse",exportVault:"Export MD",exportJson:"Export JSON",exporting:"Exporting\u2026",exportedVault:"Vault exported",exportFail:"Export failed",importVault:"Import",importedVault:"Import complete",importedSkipped:" (skipped dup ",importFail:"Import failed",location:"Choose location",saveAs:"Save as",saveAsUnsupported:"Choose-save-location not supported here",exportedTo:"Exported to",defaultDownloads:"default Downloads folder",exportCancel:"Export cancelled",manage:"Manage",tabUsage:"Usage / Today",tabOptimize:"Optimize",adminLoadFail:"Load failed: fully restart dsh-desktop so the host picks up the new /memory-eternal routes",retry:"Retry",mergeSimilar:"Merge similar",trendLabel:"Last 30 days trend",cleanStale:"\u{1F5D1}\uFE0F Clean stale",deletedStale:" stale cards cleaned",newCard:"New",tplDecision:"\u{1F4DD} Decision",tplBug:"\u{1F41B} Bug",tplMeeting:"\u{1F4CB} Meeting",tplWeekly:"\u{1F4CA} Weekly",createCard:"Create",cardTitle:"Title",cardBody:"Body",fbUseful:"Useful",fbIrr:"Irrelevant",todayAdd:"Added today",weekAdd:"Last 7d",byKind:"By kind",todayList:"Captured today",budgetLabel:"Session budget",budgetChars:"Budget chars",recallLimitLabel:"Recall limit",embeddingLabel:"Semantic recall",mergePairs:"Similar pairs (mergeable)",staleCards:"Stale (>90d)",noOptimize:"Nothing to organize, healthy \u{1F389}",oneClickOptimize:"One-click optimize",oneClickOptimizeConfirm:"Confirm one-click optimize? This will merge all similar pairs (stale cards are NOT deleted by default).",oneClickAlsoStale:"Also clean stale cards",oneClickOptimizeDone:"One-click optimize done",optimizedMerged:"pairs merged",optimizedStaleDeleted:"stale cards cleaned",mcpSetupStatus:"Agent MCP mount status",rerunSetup:"Re-run setup",notInstalled:"not installed",noMcpEntry:"no MCP entry",nodePathMismatch:"node path mismatch, consider re-running setup",nodePathNote:"different node env (usable)",healthy:"healthy",mcpSetupHint:'"Auto-mount MCP" = lets Claude Code / Codex / Cursor use the memory vault. On = auto-configures them; Off = never touches your machine config, run dsh-memory setup manually when needed.',mcpManageHint:"Use each agent row to install/uninstall MCP individually",tabConfig:"Memory Config",tabAudit:"Audit Center",statusApproved:"Approved",statusPending:"Pending",statusRejected:"Rejected",allStatus:"All statuses",tabRecycle:"Recycle Bin",pending:"Pending",rejected:"Rejected",selectAll:"Select all",approve:"Approve",reject:"Reject",allAgents:"All agents",noAuditItems:"No items to review",deletedAt:"deleted",restore:"Restore",restoreDelete:"Delete to recycle",purge:"Purge",emptyRecycle:"Recycle bin is empty",recycleHint:"Deleted cards go to the recycle bin \u2014 recover within 30 days, else auto-purged",purgeConfirm:"Permanently delete? This cannot be undone.",recycleDeleteConfirm:"Delete to recycle? Recoverable within 30 days.",modeInit:"Init once",modeInterval:"Interval keep-alive",modeManual:"Manual only",serviceConfig:"Service self-hosting config",auditConfig:"Auto-audit config",auditHint:"Cards matching an exemption go straight in; others await audit",auditMode:"Audit mode",auditAll:"Audit all",auditNone:"Skip all",auditExemptAgents:"Exempt agents",auditExemptKinds:"Exempt kinds",allExempt:"Exempt all",recycleDays:"Recycle retention days",editInSetting:"Edit in DSH Settings \u2192 Memory",setupRunInTerminal:"Copy this command to your terminal:",dshMemoryConfig:"DSH Memory Config",autoCapture:"Auto capture",autoRecall:"Auto recall",captureMinChars:"Min capture chars",maxCardsPerDay:"Daily quota",dedupThreshold:"Dedup threshold",recallLimit:"Recall limit",vaultMulti:"Multiple vaults (per project)",vaultMultiHint:"Empty = single vault; existing setups unaffected",vaultNow:"Active now",vaultSource:"Source",vaultWorkspace:"Current workspace",vaultNamePh:"Name, e.g. work",vaultPathPh:"Directory, e.g. D:/vaults/work",vaultMatchPh:"Project dir (optional, auto-select by workspace)",vaultAdd:"Add a vault",vaultActive:"Active vault",vaultActiveNone:"Default vault (unset)",vaultSrcEnv:"env MEMORY_VAULT_DIR",vaultSrcProfile:"activeVault profile",vaultSrcWorkspace:"matched by project dir",vaultSrcVaultDir:"vaultDir setting",vaultSrcDefault:"default directory",fbNav:"Report a bug",fbTitle:"Report a bug (files on GitHub)",fbDesc:"Describe the problem (symptoms / steps / expected)",fbDiag:"Diagnostics (auto-redacted: home dir and keys/tokens replaced)",fbCopyDiag:"Copy diagnostics",fbOpenIssue:"Open prefilled issue on GitHub",fbCopyPrompt:"Copy AI prompt",fbCopiedDiag:"Diagnostics copied",fbCopiedPrompt:"Prompt copied \u2014 paste it into your AI chat",fbCopyFail:"Copy failed; please select and copy manually",fbWhy:"GitHub does not allow anonymous issue creation and the plugin must not ship a token: so the title, body and diagnostics are pre-filled \u2014 you just click Submit.",fbNeedDesc:"Please describe the problem first",fbLoading:"Collecting diagnostics\u2026",fbDiagFail:"Diagnostics endpoint unavailable (standalone web or older host); please add environment info manually",fbOr:"or",fbSelectAll:"Select all",toastApproved:"approved",toastRejected:"rejected",toastCardDeleted:"deleted",toastRestored:"restored",toastPurged:"permanently deleted",toastPurgedExpired:"expired recycle entries purged",toastFailed:"Action failed",noSelection:"Select the cards to act on first",actionRunning:"Working\u2026",recycleEmptyHint:"Recycle bin is empty: deleted cards land here first and are purged automatically after {days} days.",recyclePurgeAll:"Empty recycle bin",fbCopyManual:"Auto-copy was blocked by the browser \u2014 the text is below: click Select all, then Ctrl+C",vcLoaded:"running (loaded by host)",vcOnDisk:"on disk",vcLatest:"npm latest",vcStale:"{disk} is installed on disk but the running DSH process still has {loaded} loaded \u2014 restart the desktop app / DSH to apply",vcOutdated:"update available",vcUpToDate:"up to date",vcCheck:"Check for updates",checking:"Checking\u2026",vcCheckFail:"Update check failed",saving:"Saving\u2026",recallSummaryLen:"Recall summary len",recallBody:"Recall with body",autoWeb:"Web server",autoWebMode:"Keep-alive mode",webPort:"Web port",webCheckIntervalMs:"Probe interval (ms)",webMaxRestart:"Max restart",watchdogAutoSpawn:"Watchdog process",autoMcpSetup:"Auto-mount MCP",saveConfig:"Save config",saveFail:"Save failed",savedOk:"Saved",recallTool:"recall tool",costControl:"Cost control",costHint:"save tokens, control LLM usage",distillEnabled:"Distill cards (on=LLM compress, off=raw cards zero LLM)",dedupByLLM:"Dedup feeds LLM (off=pure lexical, cheaper)",captureMaxTokens:"Distill output cap (tokens)",recallMinScore:"Recall min score (higher = cheaper)",configNeedsDsh:"Edit config inside DSH (this page may be read-only or partially missing)",installMcp:"Install MCP",uninstallMcp:"Uninstall MCP",uninstallConfirm:"Confirm uninstall MCP for this agent? Claude Code/Codex will lose access to the memory vault.",presetConfig:"One-click preset config",presetHint:"Click to fill a plan, then hit Save",planA:"A Light",planB:"B Budget",planC:"C Premium",pluginInfo:"Plugin info",organizeTitle:"Organize",scanAndOrganize:"Scan & organize",scanHint:'Click "\u{1F50D} Scan & organize" to find similar/stale cards, then "\u26A1 One-click optimize" to run.',mergeNow:"Merge",delete:"Delete",captureAlert:"Auto-capture failed",captureAlertHint:'Open "Usage / Today" for the capture log; if the cause is an API/version mismatch, update the memory-eternal plugin.',captureLog:"Auto-capture log",captureLogHint:"Runs after every turn: listen \u2192 judge \u2192 write. Last 100 entries, so you can see why a card was not written.",captureLogEmpty:"No entries yet. Chat one turn (> min capture chars) and come back.",captureLogUnavailable:"Log is available only inside the DSH host (the standalone web page has no host runtime).",captureAgentCards:"Cards auto-captured by the agent",noCards:"none",loadMore:"Load more",batchMerge:"Smart batch merge",mergeAllConfirm:"Merge similar-grouped cards into one each (keep kind), delete originals?",crossVault:"All vaults",deleteConfirm:"Delete this memory card? This cannot be undone.",deleted:"Deleted",deleteFail:"Delete failed",deleteSelected:"Delete selected",deletedSelected:" cards deleted",merge:"Merge",mergeNeed:"Select at least 2 cards",mergeConfirm:"Merge the selected cards into one and delete the originals?",merged:"Merged",mergeFail:"Merge failed",mcpInstalled:"\u2705 {agent} MCP installed",mcpUninstalled:"\u2705 {agent} MCP uninstalled",mcpActionFail:"\u274C {agent} MCP action failed: {error}",dshHostLabel:"DeepSeek Harness (current host)",restartHint:"Saved. autoWebMode/watchdogAutoSpawn take effect after restarting DSH",conflictRefresh:"Config changed elsewhere \u2014 refresh and retry",untitled:"Untitled",tplBlank:"\u{1F4C4} Blank",tagsHint:"Tags (comma-separated)",connCount:"{n} connections",tplDecisionTags:"decision, plan",tplBugTags:"pitfall, lesson",tplMeetingTags:"meeting, minutes",tplWeeklyTags:"weekly report",tplDecisionBody:`# Tech decision: [title]
62
62
 
63
63
  ## Background
64
64
  - Problem
@@ -103,7 +103,7 @@ Option A, because:
103
103
  -
104
104
 
105
105
  ## Risks/blockers
106
- - `},wt=["all","project","knowledge","content","prompt","business","tool","mistake"],_e={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},mt={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},Fe={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},st="deepseek-harness",ot=t=>{let l=String(t||""),r=l.toLowerCase();return!l||l==="agent"||l==="unknown"||l.startsWith("session:")||r.startsWith("claude-code")?r.startsWith("claude-code")?"claude":st:r==="deepseek harness"?st:l.split(":")[0]||st},la=[st,"claude","codex","cursor","codex-desktop"],Ot=(t=[])=>[...new Set([...la,...(t||[]).map(ot)])],ra={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],fail:["\u274C","#ef4444"]},De=`
106
+ - `},It=["all","project","knowledge","content","prompt","business","tool","mistake"],Ue={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},wt={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},Ee={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},ut="deepseek-harness",rt=t=>{let o=String(t||""),i=o.toLowerCase();return!o||o==="agent"||o==="unknown"||o.startsWith("session:")||i.startsWith("claude-code")?i.startsWith("claude-code")?"claude":ut:i==="deepseek harness"?ut:o.split(":")[0]||ut},ha=[ut,"claude","codex","cursor","codex-desktop"],Gt=(t=[])=>[...new Set([...ha,...(t||[]).map(rt)])],xa={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],fail:["\u274C","#ef4444"]},Ie=`
107
107
  .memory-eternal-root { font-family: inherit; color: var(--dsw-alias-label-primary, #1f2937); }
108
108
  .mc-card { background: var(--dsw-alias-bg-layer-1, #fff); border: 1px solid var(--dsw-alias-border-l1, #e5e7eb); border-radius: 12px; padding: 14px 16px; }
109
109
  .mc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
@@ -295,13 +295,13 @@ Option A, because:
295
295
  height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
296
296
  max-height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
297
297
  }
298
- `;function sa(t){t.effect(()=>t.locale.register(et,{zh:jt,en:Ft}),"memory-eternal: locale");let l=t.locale.bind(et);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:et,order:25,label:()=>l("nav"),locale:et,inject:()=>({})},()=>n.default.createElement(ca,{t:l}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${et}:footer`,order:100,label:()=>l("nav"),locale:et,inject:()=>({})},r=>n.default.createElement(pa,{t:l,locale:t.locale,wide:!(r&&r.wide===!1)}))),"memory-eternal: sidebar footer action")}function da(){let[t,l]=(0,n.useState)("http://127.0.0.1:7999/");return(0,n.useEffect)(()=>{fetch("/memory-eternal/api/web-info").then(r=>r.json()).then(r=>{r&&r.ok&&r.url&&l(r.url.endsWith("/")?r.url:r.url+"/")}).catch(()=>{})},[]),t}function ca({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:De}),(0,e.jsx)(Wt,{t,onReload:()=>{},version:0})]})}function pa({t,locale:l,wide:r}){let[y,u]=(0,n.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${r?"":" rail"}`,children:[(0,e.jsx)("style",{children:De}),(0,e.jsxs)("button",{type:"button",className:"me-footer-btn",onClick:()=>u(!0),"aria-label":t("nav"),title:t("nav"),children:[(0,e.jsx)("span",{className:"me-footer-ico","aria-hidden":"true",children:(0,e.jsx)($t,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),y&&(0,e.jsx)(ua,{t,locale:l,onClose:()=>u(!1)})]})}function ua({t,locale:l,onClose:r,tab:y}){let[u,o]=(0,n.useState)(!1),v=(0,n.useRef)(null),k=da(),N=(0,n.useCallback)(C=>l&&typeof l.subscribe=="function"?l.subscribe(C):()=>{},[l]),I=(0,n.useCallback)(()=>l&&typeof l.getSnapshot=="function"?l.getSnapshot():null,[l]),h=(0,n.useSyncExternalStore)(N,I),b=h&&(h.active==="zh"||h.active==="en")?h.active:null,m=(0,n.useRef)(null);m.current===null&&b&&(m.current=b);let A=(0,n.useMemo)(()=>{let C=m.current?`lang=${m.current}`:"";return y==="config"?`${U}/ui/config?tab=config${C?`&${C}`:""}`:y?`${k.replace(/\/$/,"")}/?tab=${y}${C?`&${C}`:""}`:C?`${k}${k.endsWith("/")?"":"/"}?${C}`:k},[k,y]);return(0,n.useEffect)(()=>{let C=v.current&&v.current.contentWindow;C&&b&&C.postMessage({source:"memory-eternal",type:"locale",lang:b},"*")},[b]),(0,n.useEffect)(()=>{let C=w=>{w.key==="Escape"&&r()};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[r]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:r,children:[(0,e.jsx)("style",{children:De}),(0,e.jsx)("div",{className:"me-modal"+(u?" me-modal-full":""),onClick:C=>C.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:()=>o(C=>!C),"aria-label":t(u?"exitFullscreen":"enterFullscreen"),title:t(u?"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:u?"\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:v,src:A,title:"memory-eternal",style:{width:"100%",flex:1,border:0,borderRadius:"inherit",background:"var(--dsw-alias-bg-base, #fff)"}})]})})]})}function $t(){return(0,e.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,e.jsx)("defs",{children:(0,e.jsxs)("linearGradient",{id:"mg-brain",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,e.jsx)("stop",{offset:"0%",stopColor:"#FFC46B"}),(0,e.jsx)("stop",{offset:"50%",stopColor:"#F97316"}),(0,e.jsx)("stop",{offset:"100%",stopColor:"#EA580C"})]})}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 0-6.4.1 4.1 4.1 0 0 0-2.7 5.9 4.1 4.1 0 0 0 .6 6.7A4.2 4.2 0 0 0 12 18.2Z"}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 1 6.4.1 4.1 4.1 0 0 1 2.7 5.9 4.1 4.1 0 0 1-.6 6.7A4.2 4.2 0 0 1 12 18.2Z"}),(0,e.jsx)("path",{d:"M12 9.2c-.8-1.4-1.7-2-3.1-2.2M12 9.2c.8-1.4 1.7-2 3.1-2.2M12 12.4c-1.2 1-3.2 1.6-5 1.4M12 12.4c1.2 1 3.2 1.6 5 1.4M12 13.2v4",fill:"none",stroke:"rgba(255,255,255,0.62)",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"8.6",r:"1.1",fill:"rgba(255,255,255,0.85)"})]})}function ma({t,inModal:l,onClose:r,onFull:y,full:u}){let[o,v]=(0,n.useState)(null),[k,N]=(0,n.useState)([]),[I,h]=(0,n.useState)(!0),[b,m]=(0,n.useState)(null),[A,C]=(0,n.useState)(""),[w,D]=(0,n.useState)("all"),[M,j]=(0,n.useState)(""),[oe,te]=(0,n.useState)("all"),[W,Z]=(0,n.useState)("all"),[T,ve]=(0,n.useState)(()=>{try{let f=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),P={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(f&&P[f])return P[f]}catch{}return"cards"}),[z,ie]=(0,n.useState)(()=>new Set([T])),g=(0,n.useCallback)(f=>{ie(P=>P.has(f)?P:new Set(P).add(f)),ve(f)},[]),[R,Y]=(0,n.useState)("recent"),[Q,H]=(0,n.useState)(null),_=(0,n.useRef)(null),ne=(0,n.useRef)(null),[ae,we]=(0,n.useState)(!1),[Ue,Te]=(0,n.useState)(null),[Me,Ae]=(0,n.useState)(!1),[Be,ke]=(0,n.useState)(!1),[fe,Ie]=(0,n.useState)(!0),[Oe,pe]=(0,n.useState)(null),[be,d]=(0,n.useState)(0),F=(0,n.useCallback)(()=>d(f=>f+1),[]),O=(0,n.useRef)(null),[K,G]=(0,n.useState)(0),[ye,ue]=(0,n.useState)(!1),s=(0,n.useRef)(null),i=(0,n.useRef)(null),B=(0,n.useCallback)(async(f=w,P=M,X=W,Le={})=>{let me=Le.append===!0;try{me?ue(!0):(h(!0),C(""));let ge=new URLSearchParams;f&&f!=="all"&&ge.set("kind",f),P.trim()&&ge.set("q",P.trim()),ge.set("status",X||"all"),ge.set("limit",String(oa)),ge.set("offset",String(Le.offset||0)),R==="title"&&ge.set("sort","title");let Ke=await(await fetch(`${U}/cards?${ge.toString()}`)).json();if(Ke.ok){let $e=Ke.cards||[];N(Se=>me?[...Se,...$e.filter(Je=>!Se.some(Ze=>Ze.path===Je.path))]:$e),G(Number(Ke.total)||$e.length)}}catch(ge){C(String(ge&&ge.message?ge.message:ge))}finally{me?ue(!1):h(!1)}},[w,M,W,R]),V=(0,n.useCallback)(async()=>{try{let[f,P]=await Promise.all([fetch(`${U}/overview`).then(X=>X.json()),fetch(`${U}/capture-log`).then(X=>X.json()).catch(()=>null)]);f.ok&&v(f),m(P&&P.ok&&P.available&&P.health||null)}catch(f){C(String(f&&f.message?f.message:f))}finally{h(!1)}},[]),se=async f=>{try{let X=await(await fetch(`${U}/delete?path=${encodeURIComponent(f)}`)).json();X.ok?(H({ok:!0,msg:t("deleted")}),await V(),F()):H({ok:!1,msg:X.error||t("deleteFail")})}catch{H({ok:!1,msg:t("deleteFail")})}_.current&&clearTimeout(_.current),_.current=setTimeout(()=>H(null),2e3)};(0,n.useEffect)(()=>(V(),()=>{O.current&&clearTimeout(O.current)}),[V]);let ze=f=>{j(f),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>B(w,f,W),280)},a=f=>{D(f),B(f,M,W)};(0,n.useEffect)(()=>{T==="cards"&&B(w,M,W)},[W,T,be,R]),(0,n.useEffect)(()=>{if(T!=="cards"||I||ye||k.length>=K)return;let f=s.current,P=i.current;if(!f)return;let X=new IntersectionObserver(Le=>{Le[0]&&Le[0].isIntersecting&&B(w,M,W,{append:!0,offset:k.length})},{root:P||null,rootMargin:"400px"});return X.observe(f),()=>X.disconnect()},[T,k,K,I,ye,w,M,W,B]);let Ge=async f=>{try{let X=await(await fetch(`${U}/card?path=${encodeURIComponent(f.path||f.id)}`)).json();X.ok&&Te({path:X.path,title:f.title,text:X.text})}catch(P){C(String(P&&P.message?P.message:P))}},it=async(f,P)=>{we(!0);try{let X=await fetch(`${U}/export`);if(!X.ok)throw new Error("HTTP "+X.status);let Le=await X.json();if(!Le.ok)throw new Error(Le.error||"export failed");let me,ge,he;f==="json"?(ge="memory-vault.json",he="application/json",me=JSON.stringify(Le.cards.map(Se=>({path:Se.path,title:Se.title,kind:Se.kind,text:Se.text})),null,2)):(ge="memory-vault.md",he="text/markdown;charset=utf-8",me=Le.cards.map(Se=>Se.text.trim()).filter(Boolean).join(`
298
+ `;function va(t){t.effect(()=>t.locale.register(nt,{zh:qt,en:Xt}),"memory-eternal: locale");let o=t.locale.bind(nt);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:nt,order:25,label:()=>o("nav"),locale:nt,inject:()=>({})},()=>n.default.createElement(ka,{t:o}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${nt}:footer`,order:100,label:()=>o("nav"),locale:nt,inject:()=>({})},i=>n.default.createElement(Ca,{t:o,locale:t.locale,wide:!(i&&i.wide===!1)}))),"memory-eternal: sidebar footer action")}function wa(){let[t,o]=(0,n.useState)("http://127.0.0.1:7999/");return(0,n.useEffect)(()=>{fetch("/memory-eternal/api/web-info").then(i=>i.json()).then(i=>{i&&i.ok&&i.url&&o(i.url.endsWith("/")?i.url:i.url+"/")}).catch(()=>{})},[]),t}function ka({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsx)(Qt,{t,onReload:()=>{},version:0})]})}function Ca({t,locale:o,wide:i}){let[g,p]=(0,n.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${i?"":" rail"}`,children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("button",{type:"button",className:"me-footer-btn",onClick:()=>p(!0),"aria-label":t("nav"),title:t("nav"),children:[(0,e.jsx)("span",{className:"me-footer-ico","aria-hidden":"true",children:(0,e.jsx)(Jt,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),g&&(0,e.jsx)(Sa,{t,locale:o,onClose:()=>p(!1)})]})}function Sa({t,locale:o,onClose:i,tab:g}){let[p,l]=(0,n.useState)(!1),v=(0,n.useRef)(null),S=wa(),x=(0,n.useCallback)(z=>o&&typeof o.subscribe=="function"?o.subscribe(z):()=>{},[o]),A=(0,n.useCallback)(()=>o&&typeof o.getSnapshot=="function"?o.getSnapshot():null,[o]),k=(0,n.useSyncExternalStore)(x,A),y=k&&(k.active==="zh"||k.active==="en")?k.active:null,m=(0,n.useRef)(null);m.current===null&&y&&(m.current=y);let M=(0,n.useMemo)(()=>{let z=m.current?`lang=${m.current}`:"";return g==="config"?`${Y}/ui/config?tab=config${z?`&${z}`:""}`:g?`${S.replace(/\/$/,"")}/?tab=${g}${z?`&${z}`:""}`:z?`${S}${S.endsWith("/")?"":"/"}?${z}`:S},[S,g]);return(0,n.useEffect)(()=>{let z=v.current&&v.current.contentWindow;z&&y&&z.postMessage({source:"memory-eternal",type:"locale",lang:y},"*")},[y]),(0,n.useEffect)(()=>{let z=w=>{w.key==="Escape"&&i()};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[i]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:i,children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsx)("div",{className:"me-modal"+(p?" me-modal-full":""),onClick:z=>z.stopPropagation(),children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,position:"relative"},children:[(0,e.jsxs)("div",{style:{position:"absolute",top:8,right:8,zIndex:10,display:"flex",gap:4,padding:"4px 6px",background:"var(--dsw-alias-bg-overlay, rgba(17,24,39,0.45))",borderRadius:8,backdropFilter:"blur(4px)"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>l(z=>!z),"aria-label":t(p?"exitFullscreen":"enterFullscreen"),title:t(p?"exitFullscreen":"enterFullscreen"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:14,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:p?"\u2921":"\u2922"}),(0,e.jsx)("button",{type:"button",onClick:i,"aria-label":t("close"),title:t("close"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:16,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,e.jsx)("iframe",{ref:v,src:M,title:"memory-eternal",allow:"clipboard-write; clipboard-read",style:{width:"100%",flex:1,border:0,borderRadius:"inherit",background:"var(--dsw-alias-bg-base, #fff)"}})]})})]})}function Jt(){return(0,e.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,e.jsx)("defs",{children:(0,e.jsxs)("linearGradient",{id:"mg-brain",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,e.jsx)("stop",{offset:"0%",stopColor:"#FFC46B"}),(0,e.jsx)("stop",{offset:"50%",stopColor:"#F97316"}),(0,e.jsx)("stop",{offset:"100%",stopColor:"#EA580C"})]})}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 0-6.4.1 4.1 4.1 0 0 0-2.7 5.9 4.1 4.1 0 0 0 .6 6.7A4.2 4.2 0 0 0 12 18.2Z"}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 1 6.4.1 4.1 4.1 0 0 1 2.7 5.9 4.1 4.1 0 0 1-.6 6.7A4.2 4.2 0 0 1 12 18.2Z"}),(0,e.jsx)("path",{d:"M12 9.2c-.8-1.4-1.7-2-3.1-2.2M12 9.2c.8-1.4 1.7-2 3.1-2.2M12 12.4c-1.2 1-3.2 1.6-5 1.4M12 12.4c1.2 1 3.2 1.6 5 1.4M12 13.2v4",fill:"none",stroke:"rgba(255,255,255,0.62)",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"8.6",r:"1.1",fill:"rgba(255,255,255,0.85)"})]})}function Na({t,inModal:o,onClose:i,onFull:g,full:p}){let[l,v]=(0,n.useState)(null),[S,x]=(0,n.useState)([]),[A,k]=(0,n.useState)(!0),[y,m]=(0,n.useState)(null),[M,z]=(0,n.useState)(""),[w,L]=(0,n.useState)("all"),[N,O]=(0,n.useState)(""),[G,te]=(0,n.useState)("all"),[H,ye]=(0,n.useState)("all"),[$,J]=(0,n.useState)(()=>{try{let h=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),F={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(h&&F[h])return F[h]}catch{}return"cards"}),[be,W]=(0,n.useState)(()=>new Set([$])),b=(0,n.useCallback)(h=>{W(F=>F.has(h)?F:new Set(F).add(h)),J(h)},[]),[f,E]=(0,n.useState)("recent"),[K,_]=(0,n.useState)(null),B=(0,n.useRef)(null),ee=(0,n.useRef)(null),[Q,le]=(0,n.useState)(!1),[Ve,qe]=(0,n.useState)(null),[De,Be]=(0,n.useState)(!1),[he,xe]=(0,n.useState)(!1),[me,Ce]=(0,n.useState)(!0),[Fe,Se]=(0,n.useState)(null),[Re,Xe]=(0,n.useState)(0),We=(0,n.useCallback)(()=>Xe(h=>h+1),[]),re=(0,n.useRef)(null),[ce,d]=(0,n.useState)(0),[R,P]=(0,n.useState)(!1),s=(0,n.useRef)(null),r=(0,n.useRef)(null),D=(0,n.useCallback)(async(h=w,F=N,Z=H,Ne={})=>{let pe=Ne.append===!0;try{pe?P(!0):(k(!0),z(""));let ue=new URLSearchParams;h&&h!=="all"&&ue.set("kind",h),F.trim()&&ue.set("q",F.trim()),ue.set("status",Z||"all"),ue.set("limit",String(ba)),ue.set("offset",String(Ne.offset||0)),f==="title"&&ue.set("sort","title");let Ke=await(await fetch(`${Y}/cards?${ue.toString()}`)).json();if(Ke.ok){let $e=Ke.cards||[];x(ve=>pe?[...ve,...$e.filter(Qe=>!ve.some(et=>et.path===Qe.path))]:$e),d(Number(Ke.total)||$e.length)}}catch(ue){z(String(ue&&ue.message?ue.message:ue))}finally{pe?P(!1):k(!1)}},[w,N,H,f]),U=(0,n.useCallback)(async()=>{try{let[h,F]=await Promise.all([fetch(`${Y}/overview`).then(Z=>Z.json()),fetch(`${Y}/capture-log`).then(Z=>Z.json()).catch(()=>null)]);h.ok&&v(h),m(F&&F.ok&&F.available&&F.health||null)}catch(h){z(String(h&&h.message?h.message:h))}finally{k(!1)}},[]),se=async h=>{try{let Z=await(await fetch(`${Y}/delete?path=${encodeURIComponent(h)}`)).json();Z.ok?(_({ok:!0,msg:t("deleted")}),await U(),We()):_({ok:!1,msg:Z.error||t("deleteFail")})}catch{_({ok:!1,msg:t("deleteFail")})}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2e3)};(0,n.useEffect)(()=>(U(),()=>{re.current&&clearTimeout(re.current)}),[U]);let we=h=>{O(h),re.current&&clearTimeout(re.current),re.current=setTimeout(()=>D(w,h,H),280)},a=h=>{L(h),D(h,N,H)};(0,n.useEffect)(()=>{$==="cards"&&D(w,N,H)},[H,$,Re,f]),(0,n.useEffect)(()=>{if($!=="cards"||A||R||S.length>=ce)return;let h=s.current,F=r.current;if(!h)return;let Z=new IntersectionObserver(Ne=>{Ne[0]&&Ne[0].isIntersecting&&D(w,N,H,{append:!0,offset:S.length})},{root:F||null,rootMargin:"400px"});return Z.observe(h),()=>Z.disconnect()},[$,S,ce,A,R,w,N,H,D]);let Ze=async h=>{try{let Z=await(await fetch(`${Y}/card?path=${encodeURIComponent(h.path||h.id)}`)).json();Z.ok&&qe({path:Z.path,title:h.title,text:Z.text})}catch(F){z(String(F&&F.message?F.message:F))}},st=async(h,F)=>{le(!0);try{let Z=await fetch(`${Y}/export`);if(!Z.ok)throw new Error("HTTP "+Z.status);let Ne=await Z.json();if(!Ne.ok)throw new Error(Ne.error||"export failed");let pe,ue,ge;h==="json"?(ue="memory-vault.json",ge="application/json",pe=JSON.stringify(Ne.cards.map(ve=>({path:ve.path,title:ve.title,kind:ve.kind,text:ve.text})),null,2)):(ue="memory-vault.md",ge="text/markdown;charset=utf-8",pe=Ne.cards.map(ve=>ve.text.trim()).filter(Boolean).join(`
299
299
 
300
300
  ---
301
301
 
302
- `));let Ke=new Blob([me],{type:he}),$e=await Ma(Ke,ge,!1);if(!$e.ok){H({ok:!1,msg:t("exportFail")}),we(!1);return}H({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+$e.name})}catch(X){H({ok:!1,msg:t("exportFail")+" \xB7 "+(X.message||"")})}finally{we(!1)}_.current&&clearTimeout(_.current),_.current=setTimeout(()=>H(null),2600)},dt=async f=>{let P=f.target.files&&f.target.files[0];if(f.target.value="",!!P){try{let X=await P.text(),me=await(await fetch(`${U}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:X})).json();me.ok?(await V(),H({ok:!0,msg:t("importedVault")+"\uFF1A"+(me.imported||0)+(me.skipped?t("importedSkipped")+me.skipped:"")})):H({ok:!1,msg:me.error||t("importFail")})}catch{H({ok:!1,msg:t("importFail")})}_.current&&clearTimeout(_.current),_.current=setTimeout(()=>H(null),2400)}},ct=(0,n.useMemo)(()=>{let f=k.slice();return oe!=="all"&&(f=f.filter(P=>ot(P.submittedBy)===oe)),W!=="all"&&(f=f.filter(P=>(P.status||"approved")===W)),R==="title"?f.sort((P,X)=>String(P.title||"").localeCompare(String(X.title||""))):R==="hot"?f.sort((P,X)=>(X.weight||X.links||0)-(P.weight||P.links||0)):f.sort((P,X)=>new Date(X.updated||0).getTime()-new Date(P.updated||0).getTime()),f},[k,R,oe,W]),pt=(0,n.useMemo)(()=>[...new Set(k.map(f=>ot(f.submittedBy)))],[k]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:De}),Q&&(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 "+(Q.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:Q.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:Q.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:Q.msg})]}),l&&(0,e.jsxs)("div",{className:"me-modal-head",children:[(0,e.jsxs)("div",{className:"me-modal-title",children:[(0,e.jsx)("span",{className:"me-wicon",children:(0,e.jsx)($t,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),y&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:y,"aria-label":t(u?"exitFull":"fullscreen"),children:u?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:r,"aria-label":t("close"),children:"\u2715"})]}),b&&b.ok===!1&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,margin:"0 0 8px",padding:"9px 14px",borderRadius:10,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.45)",borderLeft:"4px solid #ef4444",color:"var(--dsw-alias-label-primary, #e5e7eb)",fontSize:12.5,lineHeight:1.6},children:[(0,e.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",t("captureAlert")]}),(0,e.jsxs)("span",{style:{flex:1},children:[b.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:b.since?nt(new Date(b.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${fe?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Ie(f=>!f),"aria-label":t(fe?"collapse":"expand"),title:t(fe?"collapse":"expand"),children:fe?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${T==="cards"?" active":""}`,onClick:()=>g("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),fe&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${T==="graph"?" active":""}`,onClick:()=>g("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),fe&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${T==="stats"?" active":""}`,onClick:()=>g("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),fe&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${T==="audit"?" active":""}`,onClick:()=>g("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),fe&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${T==="optimize"?" active":""}`,onClick:()=>g("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),fe&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${T==="config"?" active":""}`,onClick:()=>g("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),fe&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>ke(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),fe&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:i,children:[T==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(tt,{label:t("total"),value:o?o.total:"\u2014"}),(0,e.jsx)(tt,{label:t("recent"),value:o?o.recent:"\u2014"}),(0,e.jsx)(tt,{label:t("tags"),value:o?o.tags:"\u2014"}),(0,e.jsx)(tt,{label:t("pending"),value:o?.status?.pending??0}),(0,e.jsx)(tt,{label:t("rejected"),value:o?.status?.rejected??0}),(0,e.jsx)(tt,{label:t("cardCount"),value:o?o.byKind?.knowledge??0:"\u2014"})]}),T==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:M,onChange:f=>ze(f.target.value)}),(0,e.jsx)("input",{ref:ne,type:"file",accept:".json,application/json",style:{display:"none"},onChange:dt}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ne.current&&ne.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>pe({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:ae,onClick:()=>it("md"),children:t(ae?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:ae,onClick:()=>it("json"),children:t(ae?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>V(),children:t("refresh")})]}),T==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[wt.map(f=>(0,e.jsx)("button",{type:"button",className:`mc-chip${w===f?" active":""}`,onClick:()=>a(f),children:t(f==="all"?"all":Fe[f])},f)),(0,e.jsxs)("select",{value:oe,onChange:f=>te(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsxs)("option",{value:"all",children:["\u{1F916} ",t("allAgents")]}),Ot(pt).map(f=>(0,e.jsx)("option",{value:f,children:f},f))]}),(0,e.jsxs)("select",{value:W,onChange:f=>Z(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allStatus")}),(0,e.jsx)("option",{value:"approved",children:t("statusApproved")}),(0,e.jsx)("option",{value:"pending",children:t("statusPending")}),(0,e.jsx)("option",{value:"rejected",children:t("statusRejected")})]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:t("sortRecent")},{key:"title",label:t("sortTitle")},{key:"hot",label:t("sortHot")}].map(f=>(0,e.jsx)("button",{type:"button",className:`mc-chip${R===f.key?" active":""}`,onClick:()=>Y(f.key),children:f.label},f.key))]}),A&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",A]}),(0,e.jsx)("div",{style:{display:T==="cards"?"contents":"none"},children:I?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):A?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",A," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>V(),children:t("retry")})]}):k.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:ct.map(f=>(0,e.jsx)(ba,{card:f,t,query:M.trim(),onOpen:Ge,onDelete:se},f.path))}),k.length<K&&(0,e.jsx)("div",{ref:s,style:{height:1}}),ye&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",k.length," / ",K,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:T==="graph"?"flex":"none",flex:1,minHeight:0},children:z.has("graph")&&(0,e.jsx)(wa,{t,onOpen:Ge,all:Me,onAllChange:Ae,onMutate:F,active:T==="graph",visible:T==="graph"})}),(0,e.jsx)("div",{style:{display:T==="config"?"contents":"none"},children:z.has("config")&&(0,e.jsx)(Wt,{t,onReload:()=>V(),version:be})}),(0,e.jsx)("div",{style:{display:T==="stats"?"contents":"none"},children:z.has("stats")&&(0,e.jsx)(ya,{t,tab:"stats",onReload:()=>V(),version:be})}),(0,e.jsx)("div",{style:{display:T==="audit"?"contents":"none"},children:z.has("audit")&&(0,e.jsx)(ga,{t,onReload:()=>V(),version:be})}),(0,e.jsx)("div",{style:{display:T==="optimize"?"contents":"none"},children:z.has("optimize")&&(0,e.jsx)(fa,{t,onReload:()=>V(),version:be})}),Be&&(0,e.jsx)(xa,{t,onClose:()=>ke(!1)}),Ue&&(0,e.jsx)(va,{t,card:Ue,query:M.trim(),onClose:()=>Te(null),onDelete:f=>{Te(null),se(f)},onFeedback:f=>{let P=Ue.path;fetch(`${U}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:M.trim(),path:P,useful:f})}).then(()=>H({ok:!0,msg:t(f?"fbUseful":"fbIrr")})).catch(()=>{}),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>H(null),2e3)}}),(0,e.jsx)(ha,{t,newCard:Oe,setNewCard:pe,onCreated:()=>{V(),F(),H({ok:!0,msg:t("created")}),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>H(null),2e3)}})]})]})]})}var tt=({label:t,value:l})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:l}),(0,e.jsx)("span",{children:t})]});function Wt({t,onReload:l,version:r,compact:y}){let[u,o]=(0,n.useState)(null),[v,k]=(0,n.useState)(0),[N,I]=(0,n.useState)(null),[h,b]=(0,n.useState)(null),[m,A]=(0,n.useState)(!1),[C,w]=(0,n.useState)(null),[D,M]=(0,n.useState)(null),[j,oe]=(0,n.useState)(""),[te,W]=(0,n.useState)(""),[Z,T]=(0,n.useState)(""),[ve,z]=(0,n.useState)(""),[ie,g]=(0,n.useState)(null),R=(0,n.useRef)(null),Y=(d,F=!0)=>{R.current&&clearTimeout(R.current),g({msg:d,ok:F}),R.current=setTimeout(()=>g(null),1900)},Q=(d,F)=>Object.keys(F).reduce((O,K)=>O.split("{"+K+"}").join(F[K]),t(d)),H=(0,n.useCallback)(async()=>{try{let[d,F,O]=await Promise.all([fetch(`${U}/config`).then(K=>K.json()).catch(()=>null),fetch(`${U}/setup-status`).then(K=>K.json()).catch(()=>null),fetch(`${U}/budget`).then(K=>K.json()).catch(()=>null)]);d&&d.ok?(o(d),k(d.revision??0),I(d.schema??null),b({...d.config??{}}),w(d.dsh??null),A(d.writable===!1),oe("")):O&&O.ok?(b({...O}),A(!0),oe(t("configNeedsDsh"))):oe(t("adminLoadFail")),F&&F.ok&&M(F),T("")}catch{oe(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{H()},[r,H]);let _=(d,F)=>b(O=>({...O??{},[d]:F})),ne=d=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[d]||d,ae=async()=>{if(h){if(m){Y(t("editInSetting"),!1);return}W("save");try{let d={...h};Array.isArray(d.vaultProfiles)&&(d.vaultProfiles=d.vaultProfiles.filter(K=>K&&(String(K.name||"").trim()||String(K.path||"").trim())));let F=await fetch(`${U}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:d,expectedRevision:v})}),O=await F.json();if(O&&O.ok)T(t("savedOk")+(O.note?` \xB7 ${t("restartHint")}`:"")),Y(t("savedOk")),await H();else{let K=F.status===409?t("conflictRefresh"):O?.error||t("saveFail");oe(K),Y(K,!1)}}catch{oe(t("saveFail")),Y(t("saveFail"),!1)}finally{W("")}}},we=()=>{b({...u?.config??{}}),T("")},Ue={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},Te=d=>Array.isArray(d?.vaultProfiles)?d.vaultProfiles:[],Me=(d,F,O)=>b(K=>{let G=Te(K).map(ue=>({...ue||{}})),ye={...G[d]||{}};return F==="match"?String(O).trim()?ye.match={...ye.match||{},workspace:O}:delete ye.match:ye[F]=O,G[d]=ye,{...K??{},vaultProfiles:G}}),Ae=()=>b(d=>({...d??{},vaultProfiles:[...Te(d),{name:"",path:""}]})),Be=d=>b(F=>({...F??{},vaultProfiles:Te(F).filter((O,K)=>K!==d)})),ke={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},fe={A:{label:t("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:900,recallMinScore:2,recallLimit:5,recallSummaryLen:130,recallIncludeBody:!1,captureCooldownMs:3e5},B:{label:t("planB"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!1,dedupByLLM:!1,captureMaxTokens:500,recallMinScore:3,recallLimit:3,recallSummaryLen:80,recallIncludeBody:!1,captureMinChars:300,maxCardsPerDay:40,captureCooldownMs:3e5},C:{label:t("planC"),autoWebMode:"interval",watchdogAutoSpawn:!0,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:1200,recallMinScore:1,recallLimit:8,recallSummaryLen:200,recallIncludeBody:!0,captureCooldownMs:12e4}},Ie=async d=>{let F=fe[d];F&&b(O=>({...O??{},...F}))},Oe=async(d,F)=>{W(d+F);try{let K=await(await fetch(`${U}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:d,action:F})})).json();K&&K.ok?Y(Q(F==="install"?"mcpInstalled":"mcpUninstalled",{agent:d})):Y(Q("mcpActionFail",{agent:d,error:K?.error||""}),!1);try{let G=await fetch(`${U}/setup-status`).then(ye=>ye.json());G&&G.ok&&M(G)}catch{}}catch{Y(t("mergeFail"),!1)}finally{W("")}},pe=({k:d,label:F,type:O="text",step:K,min:G,max:ye})=>(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:F||d}),(0,e.jsx)("input",{type:O,step:K,min:G,max:ye,value:h?h[d]??"":"",onChange:ue=>_(d,O==="number"?Number(ue.target.value):ue.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12}})]}),be=({k:d,label:F})=>(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:!!(h&&h[d]),onChange:O=>_(d,O.target.checked)}),(0,e.jsx)("span",{children:F||d})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:y?"0 0 auto":1,minHeight:0,maxHeight:y?"52vh":void 0},children:[(0,e.jsx)("style",{children:De}),ie&&(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 "+(ie.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:ie.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:ie.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:ie.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[j&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",j]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:H,children:["\u21BB ",t("retry")]})]}),m&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #f59e0b",background:"rgba(245,158,11,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#b45309"},children:["\u2139\uFE0F ",t("configNeedsDsh")," \u2014\u2014 ",t("editInSetting")]}),Z&&(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 ",Z]}),u&&(u.version||u.dsh?.vaultDir)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px",display:"flex",gap:14,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",t("pluginInfo")]}),(0,e.jsx)("span",{style:{fontSize:12,opacity:.7},children:t("dshHostLabel")}),u.version&&(0,e.jsxs)("code",{style:{fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},children:["v",u.version]}),u.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",u.dsh.vaultDir]})]}),D&&D.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:D.agents.map(d=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1},children:[(0,e.jsx)("b",{children:d.isDsh?t("dshHostLabel"):d.name}),d.isDsh&&d.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",d.version]}),!d.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),d.installed&&d.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),d.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),d.mcpConfigured===!0&&d.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),d.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",d.recallTool?t("enabled"):t("disabled"),")"]})]}),d.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",d.hook]}),!d.isDsh&&d.installed&&d.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!te,onClick:()=>Oe(d.name,"install"),children:t("installMcp")}),!d.isDsh&&d.installed&&d.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!te,onClick:()=>{window.confirm(t("uninstallConfirm"))&&Oe(d.name,"uninstall")},children:t("uninstallMcp")})]},d.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),ve&&(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:ve})})]}),h?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("presetConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("presetHint")})]}),(0,e.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(d=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>Ie(d),disabled:!!te,children:[d==="A"?"\u{1F7E2} ":d==="B"?"\u{1F4B0} ":"\u2B50 ",fe[d].label]},d))})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9E0} ",t("dshMemoryConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:8},children:[(0,e.jsx)(be,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(be,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(pe,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(pe,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(pe,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(pe,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(pe,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(be,{k:"recallIncludeBody",label:t("recallBody")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #06b6d4"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5C2}\uFE0F ",t("vaultMulti")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("vaultMultiHint")})]}),(0,e.jsxs)("div",{style:{fontSize:11.5,opacity:.85,marginBottom:8,lineHeight:1.7},children:[t("vaultNow"),"\uFF1A",(0,e.jsx)("code",{children:C?.vaultDir||"\u2014"}),C?.vaultName?`\uFF08${C.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(Ue[C?.vaultSource]||"vaultSrcDefault"),C?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:C.workspace})]}):null]}),Te(h).map((d,F)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:d.name||"",placeholder:t("vaultNamePh"),onChange:O=>Me(F,"name",O.target.value),style:ke,disabled:m}),(0,e.jsx)("input",{value:d.path||"",placeholder:t("vaultPathPh"),onChange:O=>Me(F,"path",O.target.value),style:ke,disabled:m}),(0,e.jsx)("input",{value:d.match&&d.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:O=>Me(F,"match",O.target.value),style:ke,disabled:m}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Be(F),disabled:m,title:t("delete"),children:"\u2715"})]},F)),(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:Ae,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:h.activeVault||"",onChange:d=>_("activeVault",d.target.value),disabled:m,style:ke,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),Te(h).filter(d=>d&&d.name).map(d=>(0,e.jsx)("option",{value:d.name,children:d.name},d.name))]})]})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #f59e0b"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4B0} ",t("costControl")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("costHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))",gap:8,marginTop:6},children:[(0,e.jsx)(be,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(be,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(pe,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(pe,{k:"recallMinScore",label:t("recallMinScore"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("auditConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("auditHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))",gap:8},children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("auditMode")}),(0,e.jsxs)("select",{value:h.auditMode??"all",onChange:d=>_("auditMode",d.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"all",children:t("auditAll")}),(0,e.jsx)("option",{value:"none",children:t("auditNone")})]})]}),(0,e.jsx)(Pt,{label:t("auditExemptAgents"),value:h.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(D?.agents||[]).filter(d=>!d.isDsh).map(d=>({value:d.name,label:d.name}))],onChange:d=>_("auditExemptAgents",d)}),(0,e.jsx)(Pt,{label:t("auditExemptKinds"),value:h.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...wt.filter(d=>d!=="all").map(d=>({value:d,label:t(Fe[d])}))],onChange:d=>_("auditExemptKinds",d)}),(0,e.jsx)(pe,{k:"recycleRetentionDays",label:t("recycleDays"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E0} ",t("serviceConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:8},children:[(0,e.jsx)(be,{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:h.autoWebMode??"init",onChange:d=>_("autoWebMode",d.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"init",children:t("modeInit")}),(0,e.jsx)("option",{value:"interval",children:t("modeInterval")}),(0,e.jsx)("option",{value:"manual",children:t("modeManual")})]})]}),(0,e.jsx)(pe,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(pe,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(pe,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(be,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(be,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginBottom:10},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:we,disabled:!!te,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:ae,disabled:!!te||te==="save"||m,children:te==="save"?t("exporting"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function ga({t,onReload:l,version:r}){let[y,u]=(0,n.useState)([]),[o,v]=(0,n.useState)([]),[k,N]=(0,n.useState)("all"),[I,h]=(0,n.useState)("all"),[b,m]=(0,n.useState)(""),[A,C]=(0,n.useState)(new Set),[w,D]=(0,n.useState)(""),[M,j]=(0,n.useState)("pending"),oe=[...new Set([...y,...o].map(z=>z.submittedBy).filter(Boolean))],te=(0,n.useCallback)(async()=>{try{let z=await fetch(`${U}/audit/list`).then(ie=>ie.json());z.ok&&(u(z.pending||[]),v(z.rejected||[]),C(new Set))}catch{}},[]);(0,n.useEffect)(()=>{te()},[r,te]);let W=(M==="pending"?y:o).filter(z=>{if(k!=="all"&&z.kind!==k||I!=="all"&&ot(z.submittedBy)!==I)return!1;if(b){let ie=(z.created||"").slice(0,10);if(ie&&ie!==b)return!1}return!0}),Z=z=>C(ie=>{let g=new Set(ie);return g.has(z)?g.delete(z):g.add(z),g}),T=async(z,ie)=>{D("apply");try{for(let g of ie||[...A])await fetch(`${U}/${z==="approved"?"audit/approve":z==="rejected"?"audit/reject":"delete"}?path=${encodeURIComponent(g)}${z==="delete"?"&permanent=0":""}`);await te(),l&&l()}catch{}finally{D("")}},ve=[...A];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:De}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("tabAudit")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("select",{value:k,onChange:z=>N(z.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")}),wt.filter(z=>z!=="all").map(z=>(0,e.jsx)("option",{value:z,children:t(Fe[z])},z))]}),(0,e.jsxs)("select",{value:I,onChange:z=>h(z.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")}),Ot(oe).map(z=>(0,e.jsx)("option",{value:z,children:z},z))]}),(0,e.jsx)("input",{type:"date",value:b,onChange:z=>m(z.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"}})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("button",{type:"button",className:`mc-btn${M==="pending"?" me-on":""}`,onClick:()=>j("pending"),children:[t("pending"),"\uFF08",y.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${M==="rejected"?" me-on":""}`,onClick:()=>j("rejected"),children:[t("rejected"),"\uFF08",o.length,"\uFF09"]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("label",{style:{fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:W.length>0&&ve.length===W.length,onChange:z=>{z.target.checked?C(new Set(W.map(ie=>ie.path))):C(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!ve.length||!!w,onClick:()=>T("approved"),children:["\u2713 ",t(M==="rejected"?"restore":"approve")]}),M==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!ve.length||!!w,onClick:()=>T("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!ve.length||!!w,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&T("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),W.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:W.map(z=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:A.has(z.path),onChange:()=>Z(z.path)}),(0,e.jsx)("span",{className:"mc-kind",style:{background:_e[z.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:ot(z.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:z.created?z.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:z.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:z.severity==="high"?"#f87171":"#9ca3af"},children:z.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z.reason||"-"}),M==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>T("approved",[z.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>T("rejected",[z.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:()=>T("approved",[z.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"))&&T("delete",[z.path])},children:"\u{1F5D1}"})]})]},z.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function fa({t,onReload:l,version:r}){let[y,u]=(0,n.useState)([]),[o,v]=(0,n.useState)(""),k=(0,n.useCallback)(async()=>{try{let I=await fetch(`${U}/recycle/list`).then(h=>h.json());I.ok&&u(I.items||[])}catch{}},[]);(0,n.useEffect)(()=>{k()},[r,k]);let N=async(I,h)=>{v(I+h);try{I==="restore"?await fetch(`${U}/recycle/restore?path=${encodeURIComponent(h)}`):I==="purge"&&await fetch(`${U}/recycle/purge?path=${encodeURIComponent(h)}`),await k(),l&&l()}catch{}finally{v("")}};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:De}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",t("tabRecycle")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("recycleHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!o,onClick:async()=>{v("purgeAll");try{await fetch(`${U}/recycle/purge-expired?days=0`),await k()}catch{}finally{v("")}},children:t("emptyRecycle")})]}),y.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:y.map(I=>(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:_e[I.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(I.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!o,onClick:()=>N("restore",I.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!o,onClick:()=>{window.confirm(t("purgeConfirm"))&&N("purge",I.path)},children:t("purge")})]},I.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("emptyRecycle")})]})]})}var ba=({card:t,t:l,onOpen:r,query:y,onDelete:u})=>(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:_e[t.kind]||_e.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:mt[t.kind]||"\u{1F4CE}"}),y?Et(t.title,y):t.title,Na(t.updated)&&(0,e.jsx)("span",{className:"mc-new",children:l("newBadge")}),t.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",l("statusPending")]}),t.status==="rejected"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",l("statusRejected")]}),(!t.status||t.status==="approved")&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",l("statusApproved")]})]}),(0,e.jsx)("p",{children:y?Et(t.summary||"",y):t.summary||""}),t.tags.length>0&&(0,e.jsx)("div",{className:"mc-tags",children:t.tags.slice(0,4).map(o=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",o]},o))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[mt[t.kind]||"\u{1F4CE}"," ",l(Fe[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",ot(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",nt(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:l("delete"),onClick:o=>{o.stopPropagation(),window.confirm(l("deleteConfirm"))&&u&&u(t.path)},children:"\u{1F5D1}"})]})]});function ya({t,tab:l,onReload:r,version:y}){let[u,o]=(0,n.useState)(null),[v,k]=(0,n.useState)(""),[N,I]=(0,n.useState)(null),[h,b]=(0,n.useState)(null),[m,A]=(0,n.useState)(null),[C,w]=(0,n.useState)([]),[D,M]=(0,n.useState)(""),[j,oe]=(0,n.useState)(!1),te=(0,n.useCallback)(async()=>{if(!(!N||!N.merge||!N.merge.length)&&window.confirm(t("mergeAllConfirm"))){M("merge");try{let g={},R=ne=>g[ne]===void 0?ne:g[ne]=R(g[ne]),Y=(ne,ae)=>{g[R(ne)]=R(ae)},Q=new Set;for(let ne of N.merge)Q.add(ne.a.path),Q.add(ne.b.path),Y(ne.a.path,ne.b.path);let H={};for(let ne of Q){let ae=R(ne);(H[ae]=H[ae]||[]).push(ne)}let _=0;for(let ne of Object.values(H)){if(ne.length<2)continue;(await fetch(`${U}/merge?paths=${encodeURIComponent(ne.join(","))}`).then(we=>we.json())).ok&&_++}await W(),r&&r()}catch{}M("")}},[N,W,r,t]);async function W(){try{let g=await Promise.all([fetch(`${U}/stats`),fetch(`${U}/budget`),fetch(`${U}/capture-log`),fetch(`${U}/cards?status=all&limit=30&agent=${st}`)]),[R,Y,Q,H]=await Promise.all(g.map(_=>_.json()));R&&R.ok&&o(R),Y&&Y.ok&&b(Y),Q&&Q.ok&&A(Q),H&&H.ok&&w(H.cards||[]),k(!R||!R.ok?t("adminLoadFail"):"")}catch{k(t("adminLoadFail"))}}let Z=(0,n.useCallback)(async()=>{M("scan");try{let g=await fetch(`${U}/optimize`).then(R=>R.json());g.ok&&I(g)}catch{k(t("adminLoadFail"))}finally{M("")}},[t]);(0,n.useEffect)(()=>{W()},[y]);let T=async(g,R)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${U}/merge?paths=${encodeURIComponent(g+","+R)}`).then(Q=>Q.json())).ok&&(await W(),r&&r())}catch{}},ve=async g=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${U}/delete?path=${encodeURIComponent(g)}`).then(Y=>Y.json())).ok&&(await W(),r&&r())}catch{}},z=["project","knowledge","content","prompt","business","tool","mistake"],ie=({title:g,kind:R,updated:Y,path:Q})=>(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:at.colors[R]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:nt(Y)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>ve(Q),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:De}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[v&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",v]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:W,children:["\u21BB ",t("retry")]})]}),l==="stats"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1FAB5} ",t("captureLog")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("captureLogHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>W(),children:["\u21BB ",t("refresh")]})]}),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((g,R)=>{let Y=ra[g.action]||["\u2022","inherit"];return(0,e.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:nt(g.time?new Date(g.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:Y[1],fontWeight:600},children:[Y[0]," ",g.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:g.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:g.preview||"",children:g.preview||""})]},R)})})})}):(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",C.length,"\uFF09"]}),C.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:C.map(g=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:_e[g.kind]||_e.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.title}),g.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:nt(g.updated)})]},g.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),u&&(0,e.jsxs)(e.Fragment,{children:[u.trend&&u.trend.length>0&&(()=>{let g=u.trend,R=Math.max(...g.map(_=>_.count),1),Y=260,Q=50,H=Y/g.length;return(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["\u{1F4C8} ",t("trendLabel")]}),(0,e.jsx)("svg",{width:Y,height:Q,style:{display:"block",width:"100%",height:50},children:g.map((_,ne)=>{let ae=Math.round(_.count/R*(Q-4));return(0,e.jsx)("rect",{x:ne*H+1,y:Q-ae,width:Math.max(H-2,2),height:ae,rx:1.5,fill:_.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:_.count>0?.85:.35},_.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:u.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:u.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:u.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:u.tags}),(0,e.jsx)("span",{children:t("tags")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("byKind")}),(0,e.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:z.map(g=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:at.colors[g]||"#666"}}),t(Fe[g]),": ",u.byKind?.[g]||0]},g))})]}),h&&(h.budgetChars||h.recallLimit||h.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:h.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:h.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",h.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",u.todayCards?.length||0,"\uFF09"]}),u.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:u.todayCards.map(g=>(0,e.jsx)(ie,{title:g.title,kind:g.kind,updated:g.updated,path:g.path},g.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})]})]}),l==="optimize"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("organizeTitle")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!D,onClick:Z,children:D==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),N&&N.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!D,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){M("oneclick");try{let g=JSON.stringify({cleanupStale:j}),Y=await(await fetch(`${U}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:g})).json();Y&&Y.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${Y.plan.merged} ${t("optimizedMerged")}${j?` \xB7 ${Y.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await W(),r&&r(),I(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{M("")}}},children:D==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),N&&N.merge?.length>0&&(0,e.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,e.jsx)("input",{type:"checkbox",checked:j,onChange:g=>oe(g.target.checked)}),t("oneClickAlsoStale")]})]}),!N&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),N&&(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}}),N.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!D,onClick:te,children:t(D==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),N.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:N.merge.map((g,R)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[g.a.title," \u21C4 ",g.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(g.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>T(g.a.path,g.b.path),children:t("mergeNow")})]},R))}):(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",N.stale?.length||0,"\uFF09"]}),N.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!D,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;M("clean");let g=0;for(let R of N.stale)try{await fetch(`${U}/delete?path=${encodeURIComponent(R.path)}`),g++}catch{}M(""),notify(`${g} ${t("deletedStale")}`),await W(),r&&r()},children:t("cleanStale")})}),N.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:N.stale.map(g=>(0,e.jsx)(ie,{title:g.title,kind:"other",updated:g.updated,path:g.path},g.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})})]})]})]})}var vt=[{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 ha({t,newCard:l,setNewCard:r,onCreated:y}){if(!l)return null;let u=vt.find(b=>b.key===l.template),o=l.body||(u?t(u.bodyKey):""),v=l.kind||(u?u.kind:"knowledge"),k=l.tags||(u?t(u.tagKey):""),N=l._creating,I=b=>{let m=vt.find(A=>A.key===b);r(A=>({...A,template:b,kind:m?m.kind:A.kind,body:m?t(m.bodyKey):A.body,tags:m?t(m.tagKey):A.tags}))},h=async()=>{if(!(!l.title&&!o)){r(b=>({...b,_creating:!0}));try{(await fetch(`${U}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:l.title||t("untitled"),kind:v,tags:k.split(",").map(m=>m.trim()).filter(Boolean),body:o,source:"manual"})}).then(m=>m.json())).ok?(r(null),y&&y()):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:De}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:b=>b.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:t("newCard")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>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:[vt.map(b=>(0,e.jsx)("button",{type:"button",className:`mc-btn${l.template===b.key?" me-on":""}`,onClick:()=>I(b.key),children:t(b.label)},b.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${l.template===""?" me-on":""}`,onClick:()=>r(b=>({...b,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:v,onChange:b=>r(m=>({...m,kind:b.target.value})),style:{maxWidth:180,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:["project","knowledge","content","prompt","business","tool","mistake"].map(b=>(0,e.jsx)("option",{value:b,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:b},b))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:l.title||"",onChange:b=>r(m=>({...m,title:b.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:k,onChange:b=>r(m=>({...m,tags:b.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:o,onChange:b=>r(m=>({...m,body:b.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,e.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:N,onClick:h,children:t(N?"exporting":"createCard")})})]})]})]})}function xa({t,onClose:l}){let[r,y]=(0,n.useState)(""),[u,o]=(0,n.useState)(""),[v,k]=(0,n.useState)(""),[N,I]=(0,n.useState)(!0),[h,b]=(0,n.useState)(!1),[m,A]=(0,n.useState)(""),C=(0,n.useRef)(null),w=Z=>{A(Z),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>A(""),2400)};(0,n.useEffect)(()=>{let Z=!0;return fetch(U+"/diagnostics").then(T=>T.json()).then(T=>{Z&&(T&&T.ok?(o(String(T.diagnostics||"")),k(String(T.version||""))):b(!0))}).catch(()=>{Z&&b(!0)}).finally(()=>{Z&&I(!1)}),()=>{Z=!1}},[]),(0,n.useEffect)(()=>{let Z=T=>{T.key==="Escape"&&l()};return window.addEventListener("keydown",Z),()=>{window.removeEventListener("keydown",Z),C.current&&clearTimeout(C.current)}},[l]);let D=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),M=()=>{let Z=r.trim().split(`
303
- `)[0]||"",T=At({title:"[Bug] "+(Z.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Bt({description:r,diagnostics:u,version:v})});try{window.open(T,"_blank","noopener")}catch{w(t("fbCopyFail"))}},j=async()=>{try{await navigator.clipboard.writeText(u),w(t("fbCopiedDiag"))}catch{w(t("fbCopyFail"))}},oe=async()=>{let Z=Rt({lang:D,description:r,diagnostics:u});try{await navigator.clipboard.writeText(Z),w(t("fbCopiedPrompt"))}catch{w(t("fbCopyFail"))}},te={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},W={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:l,children:[(0,e.jsx)("style",{children:De}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:Z=>Z.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:l,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:Z=>y(Z.target.value),placeholder:t("fbDesc"),rows:5,style:te}),(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:j,disabled:!u,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:W,children:N?t("fbLoading"):h?t("fbDiagFail"):u})]}),(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()){w(t("fbNeedDesc"));return}M()},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:oe,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),m&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:m})]})]})]})}function va({t,card:l,query:r,onClose:y,onDelete:u,onFeedback:o}){(0,n.useEffect)(()=>{let D=M=>{M.key==="Escape"&&y()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[y]);let{meta:v,body:k}=(0,n.useMemo)(()=>ht(l.text||""),[l.text]),N=D=>{let M=v.find(([j])=>String(j).toLowerCase()===D);return M?M[1]:""},I=Dt(N("tags")),h=N("kind")||"knowledge",b=(N("status")||"approved").toLowerCase(),m=_e[h]||"#6B7280",A=(k||"").length>460,[C,w]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:y,children:[(0,e.jsx)("style",{children:De}),(0,e.jsxs)("div",{className:"me-dialog",onClick:D=>D.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:mt[h]||"\u{1F4CE}"}),l.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:()=>o&&o(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>o&&o(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),A&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":C,onClick:()=>w(D=>!D),children:t(C?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&u&&u(l.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:y,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:m,borderColor:m+"59",background:m+"1a"},children:[mt[h]||"\u{1F4CE}"," ",t(Fe[h]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(b==="approved"?"md-chip-st-ok":b==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[b==="approved"?"\u2705":b==="pending"?"\u23F3":"\u26D4"," ",t(b==="approved"?"statusApproved":b==="pending"?"statusPending":"statusRejected")]}),I.slice(0,8).map(D=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",D]},D)),!!N("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",nt(N("updated"))]}),!!N("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",N("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:C?{}:{maxHeight:300,overflow:"hidden"},onClick:C?void 0:D=>{D.stopPropagation(),w(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Tt(k)}})}),!C&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:D=>{D.stopPropagation(),w(!0)},children:[t("expand")," \u2304"]})]})]})}function wa({t,onOpen:l,all:r,onAllChange:y,onMutate:u,active:o,visible:v}){let[k,N]=(0,n.useState)(null),[I,h]=(0,n.useState)(""),b=(0,n.useRef)(!1),m=(0,n.useRef)(0),A=(0,n.useRef)(t);A.current=t;let C=(0,n.useCallback)(async()=>{try{b.current=!1;let j=await(await fetch(`${U}/graph${r?"?all=1":""}`)).json();j.ok?(N(j),h(""),b.current=!0):(N(null),h(j.error||t("error")))}catch(M){h(String(M&&M.message?M.message:M))}},[r,t]);(0,n.useEffect)(()=>{if(!o||b.current)return;let M=!0;return fetch(`${U}/graph${r?"?all=1":""}`).then(j=>j.json()).then(j=>{M&&(j.ok?(N(j),h(""),b.current=!0):(N(null),h(j.error||t("error"))))}).catch(j=>{M&&h(String(j&&j.message?j.message:j))}),()=>{M=!1}},[r,t,o]),(0,n.useEffect)(()=>{v&&k&&m.current++},[v,k]);let w=(0,n.useCallback)(async M=>{try{let oe=await(await fetch(`${U}/delete?path=${encodeURIComponent(M)}`)).json();return oe&&oe.ok?(await C(),u&&u(),!0):!1}catch{return!1}},[C]),D=(0,n.useCallback)(async M=>{if(!M||M.length<2)return!1;try{let j=await fetch(`${U}/merge?paths=${encodeURIComponent(M.join(","))}`).then(oe=>oe.json());return j&&j.ok?(await C(),u&&u(),!0):!1}catch{return!1}},[C,u]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:De}),I&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",I]}),!k&&!I&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),k&&k.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),k&&k.nodes.length>0&&(0,e.jsx)(Ca,{nodes:k.nodes,edges:k.edges,onOpen:l,onDelete:w,onMerge:D,t,all:r,onAllChange:y,countLabel:`${k.nodes.length} ${t("nodes")} \xB7 ${ka(k.edges)} ${t("edges")}`,fitTrigger:m.current})]})}function ka(t){let l=new Set;for(let r of t||[])l.add([r.source,r.target].sort().join("|"));return l.size}var at={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 Ca({nodes:t,edges:l,onOpen:r,onDelete:y,onMerge:u,t:o,countLabel:v,all:k,onAllChange:N,fitTrigger:I}){let h=(0,n.useRef)(null),b=(0,n.useRef)(null),m=(0,n.useRef)(null),A=(0,n.useRef)(null),C=(0,n.useRef)(null),w=(0,n.useRef)(r);(0,n.useEffect)(()=>{w.current=r},[r]);let D=(0,n.useRef)(y);(0,n.useEffect)(()=>{D.current=y},[y]);let M=(0,n.useRef)(u);(0,n.useEffect)(()=>{M.current=u},[u]);let[j,oe]=(0,n.useState)(""),[te,W]=(0,n.useState)(null),Z=(0,n.useRef)("");(0,n.useEffect)(()=>{Z.current=j.trim().toLowerCase()},[j]),(0,n.useEffect)(()=>{let s=m.current;if(!s)return;let i=j.trim().toLowerCase();if(!i)return;let B=s.nodes.find(V=>(V.name||"").toLowerCase().includes(i));B&&(m.current.selectedId=B.id,W(B.id),s.panX=s.w/2-B.x*s.zoom,s.panY=s.h/2-B.y*s.zoom,s.render&&s.render())},[j]);let[T,ve]=(0,n.useState)("all"),[z,ie]=(0,n.useState)(!1),g=(0,n.useRef)("all"),[R,Y]=(0,n.useState)(""),Q=(0,n.useRef)(""),[H,_]=(0,n.useState)(!1),ne=(0,n.useRef)(!1),[ae,we]=(0,n.useState)(null);(0,n.useEffect)(()=>{g.current=T},[T]),(0,n.useEffect)(()=>{Q.current=R},[R]),(0,n.useEffect)(()=>{ne.current=H},[H]);let Ue=(0,n.useMemo)(()=>{let s=new Map;for(let i of t)for(let B of i.tags||[]){let V=String(B).trim();V&&s.set(V,(s.get(V)||0)+1)}return[...s.entries()].sort((i,B)=>B[1]-i[1]).slice(0,24).map(([i,B])=>({tag:i,n:B}))},[t]),Te=(()=>{let s=j.trim().toLowerCase();return!!s&&!t.some(i=>(i.title||i.name||"").toLowerCase().includes(s)||String(i.kind||"").toLowerCase().includes(s)||String(Fe[i.kind]||"").toLowerCase().includes(s))})();(0,n.useEffect)(()=>{let s=m.current;s&&s.wake&&s.wake()},[j]),(0,n.useEffect)(()=>{let s=m.current;s&&s.render&&s.render()},[T,R,H]);let Me=(0,n.useRef)(null),[Ae,Be]=(0,n.useState)([]),[ke,fe]=(0,n.useState)(null),[Ie,Oe]=(0,n.useState)(!1),[pe,be]=(0,n.useState)(null),[d,F]=(0,n.useState)(""),O=(0,n.useRef)(null),K=(0,n.useRef)(null),G=(s,i=!0)=>{O.current&&clearTimeout(O.current),be({msg:s,ok:i}),O.current=setTimeout(()=>be(null),1900)},ye=s=>{F(s),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>F(""),1600)};(0,n.useEffect)(()=>()=>{O.current&&clearTimeout(O.current),K.current&&clearTimeout(K.current)},[]);let ue=(0,n.useMemo)(()=>t.reduce((s,i)=>(s[i.id]=i,s),{}),[t]);return(0,n.useEffect)(()=>{let s=h.current;if(!s||t.length===0)return;let i=s.getContext("2d");if(!i)return;let B=Math.max(1,window.devicePixelRatio||1),V=()=>document.documentElement.getAttribute("data-theme")==="dark",se={};l.forEach(c=>{se[c.source]=(se[c.source]||0)+1,se[c.target]=(se[c.target]||0)+1});let ze=Math.max(1,...Object.values(se)),a={nodes:t.map(c=>({id:c.id,name:c.title||"",type:c.kind||"other",r:9+Math.min(10,(se[c.id]||0)/ze*8),x:0,y:0,vx:0,vy:0})),edges:l.map(c=>({sourceNodeId:c.source,targetNodeId:c.target,weight:1})),panX:0,panY:0,zoom:1,running:!0,raf:0,tickCount:0,quietTicks:0,dragNode:null,selectedId:null,mouseX:0,mouseY:0,w:0,h:0,dpr:B,ctx:i,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((c,S)=>(c[S.id]=S,c),{}),a.nodes.forEach((c,S)=>{let x=S/a.nodes.length*Math.PI*2-Math.PI/2;c.x=Math.cos(x)*60,c.y=Math.sin(x)*60});let Ge=[...new Set(a.nodes.map(c=>c.type))];a.clustered=Ge.length>1,a.typeCenters={},Ge.forEach((c,S)=>{let x=S/Ge.length*Math.PI*2-Math.PI/2;a.typeCenters[c]={x:Math.cos(x)*160,y:Math.sin(x)*160}}),m.current=a;let it=0,dt=0,ct=()=>{let c=s.clientWidth,S=s.clientHeight;a.w=c,a.h=S,s.width=c*B,s.height=S*B,i.setTransform(B,0,0,B,0,0),(it===0||dt===0)&&c>0&&S>0&&a.tickCount>0&&requestAnimationFrame(()=>me()),it=c,dt=S};ct();let pt=new ResizeObserver(ct);pt.observe(s.parentElement);let f=(c,S)=>c&&c.length>S?c.slice(0,S)+"\u2026":c,P=(c,S,x,L)=>{if(i.beginPath(),L==="rect")i.rect(c-x,S-x*.75,x*2,x*1.5);else if(L==="diamond")i.moveTo(c,S-x),i.lineTo(c+x,S),i.lineTo(c,S+x),i.lineTo(c-x,S),i.closePath();else if(L==="hexagon"){for(let E=0;E<6;E++){let ee=Math.PI/3*E-Math.PI/2,q=c+x*Math.cos(ee),xe=S+x*Math.sin(ee);E===0?i.moveTo(q,xe):i.lineTo(q,xe)}i.closePath()}else i.arc(c,S,x,0,Math.PI*2)},X=new Map,Le=(c,S)=>{let x=c+"|"+Math.round(S),L=X.get(x);if(!L){let E=parseInt(c.slice(1,3),16),ee=parseInt(c.slice(3,5),16),q=parseInt(c.slice(5,7),16);L=i.createRadialGradient(-S*.3,-S*.3,0,0,0,S*1.2),L.addColorStop(0,"rgba("+Math.min(255,E+70)+","+Math.min(255,ee+70)+","+Math.min(255,q+70)+",0.95)"),L.addColorStop(1,c),X.set(x,L)}return L},me=()=>{if(!a.nodes.length)return;let c=1/0,S=-1/0,x=1/0,L=-1/0;a.nodes.forEach(Ce=>{c=Math.min(c,Ce.x),S=Math.max(S,Ce.x),x=Math.min(x,Ce.y),L=Math.max(L,Ce.y)});let E=20,ee=S-c+E*2,q=L-x+E*2,xe=Math.min(a.w/ee,a.h/q);a.zoom=Math.max(.35,Math.min(1.8,xe)),a.panX=a.w/2-(c+S)/2*a.zoom,a.panY=a.h/2-(x+L)/2*a.zoom};A.current=me;let ge=()=>{i.clearRect(0,0,a.w,a.h),a.searchTerm=Z.current,a.kindFilter=g.current,a.timeMode=ne.current,a.tagFilter=Q.current;let c=a.tagFilter,S=a.kindFilter,x=p=>String(p||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");i.save(),i.strokeStyle=V()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",i.lineWidth=.5;for(let p=0;p<a.w;p+=24)i.beginPath(),i.moveTo(p,0),i.lineTo(p,a.h),i.stroke();for(let p=0;p<a.h;p+=24)i.beginPath(),i.moveTo(0,p),i.lineTo(a.w,p),i.stroke();i.restore(),i.save(),i.translate(a.panX,a.panY),i.scale(a.zoom,a.zoom);let L={};a.nodes.forEach(p=>L[p.id]=p);let E=a.nodes.length>40,ee=E?1.5:.55,q=a.selectedId||a.hoverId,xe=new Map;a.edges.forEach(p=>{let $=L[p.sourceNodeId],J=L[p.targetNodeId];if(!$||!J)return;if(S!=="all"){let je=a.domainById[p.sourceNodeId]&&a.domainById[p.sourceNodeId].kind,bt=a.domainById[p.targetNodeId]&&a.domainById[p.targetNodeId].kind;if(je!==S&&bt!==S)return}if(c){let je=a.domainById[p.sourceNodeId]&&(a.domainById[p.sourceNodeId].tags||[]).includes(c),bt=a.domainById[p.targetNodeId]&&(a.domainById[p.targetNodeId].tags||[]).includes(c);if(!je&&!bt)return}let le=J.x-$.x,re=J.y-$.y,de=Math.sqrt(le*le+re*re)||1,ce=E?12:18,Ne=-re/de*ce,Re=le/de*ce,We=($.x+J.x)/2+Ne,qe=($.y+J.y)/2+Re,lt=at.colors[a.domainById[$.id]&&a.domainById[$.id].kind||"other"],rt=q&&(p.sourceNodeId===q||p.targetNodeId===q),gt=q?rt?.6:.08:E?.14:.24,Ee=parseInt(lt.slice(1,3),16),ft=parseInt(lt.slice(3,5),16),Pe=parseInt(lt.slice(5,7),16),Xe=rt?1.6+(p.weight||1):.8+(p.weight||1)*.5,He=Ee+","+ft+","+Pe+","+gt+","+Xe,Ve=xe.get(He);Ve||(Ve={path:new Path2D,stroke:"rgba("+Ee+","+ft+","+Pe+","+gt+")",width:Xe},xe.set(He,Ve)),Ve.path.moveTo($.x,$.y),Ve.path.quadraticCurveTo(We,qe,J.x,J.y)}),xe.forEach(p=>{i.strokeStyle=p.stroke,i.lineWidth=p.width,i.stroke(p.path)});let Ce=null;q&&(Ce=new Set,a.edges.forEach(p=>{p.sourceNodeId===q?Ce.add(p.targetNodeId):p.targetNodeId===q&&Ce.add(p.sourceNodeId)}));let Ye=[];if(a.nodes.forEach(p=>{let $=a.domainById[p.id]||{},J=$.kind||"other",le=a.timeMode?Sa($.updated):at.colors[J],re=at.shapes[J],de=a.selectedId===p.id,ce=a.hoverId===p.id,Ne=a.searchTerm||"",Re=!Ne||(p.name||"").toLowerCase().includes(Ne)||String(Fe[J]||"").toLowerCase().includes(Ne)||String(J).toLowerCase().includes(Ne),We=S==="all"||J===S,qe=!c||($.tags||[]).includes(c),lt=q&&p.id!==q&&!(Ce&&Ce.has(p.id))||Ne&&!Re||!We||!qe;i.save(),i.globalAlpha=lt?.08:1,(de||ce)&&(i.shadowColor=le,i.shadowBlur=de?20:14),i.translate(p.x,p.y),P(0,0,p.r,re),i.fillStyle=Le(le,p.r),i.fill(),i.restore(),de?(i.save(),P(p.x,p.y,p.r+3,re),i.strokeStyle=le,i.lineWidth=3,i.shadowColor=le,i.shadowBlur=12,i.stroke(),i.restore()):ce?(i.save(),P(p.x,p.y,p.r+2,re),i.strokeStyle=le,i.lineWidth=2,i.stroke(),i.restore()):Ne&&Re?(i.save(),P(p.x,p.y,p.r+2,re),i.strokeStyle="#e11d48",i.lineWidth=2,i.stroke(),i.restore()):a.multi.indexOf(p.id)>=0&&(i.save(),P(p.x,p.y,p.r+2,re),i.strokeStyle="#60a5fa",i.lineWidth=2,i.shadowColor="#60a5fa",i.shadowBlur=8,i.stroke(),i.restore());let rt=f(p.name,16);if((de||ce||a.zoom>ee||!E&&a.zoom>.6)&&We&&qe){let Ee=1/a.zoom;i.font="500 "+(12*Ee).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";let Pe=i.measureText(rt).width+16*Ee,Xe=18*Ee,He=p.y+p.r+8*Ee,Ve=!0;for(let je of Ye)if(p.x-Pe/2<je.x+je.w&&p.x+Pe/2>je.x&&He<je.y+je.h&&He+Xe>je.y){Ve=!1;break}if(!Ve&&!de&&!ce)return;Ye.push({x:p.x-Pe/2,y:He,w:Pe,h:Xe}),i.fillStyle=V()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",i.beginPath(),i.roundRect?i.roundRect(p.x-Pe/2,He,Pe,Xe,4*Ee):i.rect(p.x-Pe/2,He,Pe,Xe),i.fill(),i.strokeStyle=V()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",i.lineWidth=1*Ee,i.stroke(),i.fillStyle=V()?de||ce?"#eee":"#bbb":de||ce?"#111":"#444",i.textAlign="center",i.fillText(rt,p.x,He+13*Ee)}}),i.restore(),a.marquee){let p=a.marquee,$=Math.min(p.sx,p.ex),J=Math.min(p.sy,p.ey),le=Math.abs(p.ex-p.sx),re=Math.abs(p.ey-p.sy);i.save(),i.setLineDash([4,4]),i.strokeStyle="rgba(96,165,250,0.9)",i.lineWidth=1,i.fillStyle="rgba(96,165,250,0.12)",i.fillRect($,J,le,re),i.strokeRect($,J,le,re),i.restore()}if(a.hoverId&&Me.current){let p=a.domainById[a.hoverId],$=a.nodes.find(function(J){return J.id===a.hoverId});if(p&&$){let J=a.edges.filter(function(de){return de.sourceNodeId===p.id||de.targetNodeId===p.id}).length,le=$.x*a.zoom+a.panX,re=$.y*a.zoom+a.panY;Me.current.style.display="block",Me.current.style.left=le+14+"px",Me.current.style.top=re-6+"px",Me.current.innerHTML="<b>"+x(p.title||p.name||"")+'</b><br/><span style="opacity:.8">'+x(p.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",J)+"</span>"}}else Me.current&&(Me.current.style.display="none")},he=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame($e))};a.wake=he,a.render=ge;let Ke=()=>{let c=a.nodes.length;a.tickCount++;let x=.9-Math.min(.4,a.tickCount/1500),L=c>1e3?3e3:c>100?2e3:c>50?1200:800,E=c>100?.002:.005,ee=c>1e3?.012:c>100?.005:.01,q=c>1e3?6:c>200?12:24,xe={};a.nodes.forEach(p=>xe[p.id]=p);for(let p=0;p<c;p++){if(a.dragNode===a.nodes[p])continue;let $=a.nodes[p],J=0,le=0;for(let ce=0;ce<c;ce++){if(p===ce)continue;let Ne=$.x-a.nodes[ce].x,Re=$.y-a.nodes[ce].y,We=Math.sqrt(Ne*Ne+Re*Re)||1,qe=L/(We*We);J+=Ne/We*qe,le+=Re/We*qe}if(a.clustered&&a.typeCenters[$.type]){let ce=a.typeCenters[$.type];J+=(ce.x-$.x)*.006,le+=(ce.y-$.y)*.006}else J-=$.x*ee,le-=$.y*ee;let re=($.vx+J)*x,de=($.vy+le)*x;re=Math.max(-q,Math.min(q,re)),de=Math.max(-q,Math.min(q,de)),$.vx=re,$.vy=de}a.edges.forEach(p=>{let $=xe[p.sourceNodeId],J=xe[p.targetNodeId];if(!$||!J)return;let le=J.x-$.x,re=J.y-$.y,de=Math.sqrt(le*le+re*re)||1,ce=(de-100)*E,Ne=le/de*ce,Re=re/de*ce;a.dragNode!==$&&($.vx+=Ne,$.vy+=Re),a.dragNode!==J&&(J.vx-=Ne,J.vy-=Re)});let Ce=0;a.nodes.forEach(p=>{a.dragNode!==p&&(p.x+=p.vx,p.y+=p.vy,Ce+=p.vx*p.vx+p.vy*p.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,me()),(c?Math.sqrt(Ce/c):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},$e=()=>{if(a.running){try{Ke(),ge()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame($e)}},Se=(c,S)=>{let x=s.getBoundingClientRect();return{x:(c-x.left-a.panX)/a.zoom,y:(S-x.top-a.panY)/a.zoom}},Je=c=>{let S=a.domainById[c];return!(!S||g.current!=="all"&&S.kind!==g.current||Q.current&&!(S.tags||[]).includes(Q.current))},Ze=(c,S,x)=>Math.max(S,Math.min(x,c)),kt=c=>{a.mouseX=c.clientX,a.mouseY=c.clientY;let S=Se(c.clientX,c.clientY),x=null;for(let L=a.nodes.length-1;L>=0;L--){let E=a.nodes[L];if(!Je(E.id))continue;let ee=E.x-S.x,q=E.y-S.y;if(ee*ee+q*q<E.r*E.r+36){x=E.id;break}}x!==a.hoverId&&(a.hoverId=x,he())},Ct=c=>{if(c.button!==0)return;let S=Se(c.clientX,c.clientY),x=null;for(let L=a.nodes.length-1;L>=0;L--){let E=a.nodes[L];if(!Je(E.id))continue;let ee=E.x-S.x,q=E.y-S.y;if(ee*ee+q*q<E.r*E.r+25){x=E;break}}if(c.shiftKey){if(x){a.shiftClick=x.id;return}a.marquee={sx:c.clientX,sy:c.clientY,ex:c.clientX,ey:c.clientY};return}a.dragStart={x:c.clientX,y:c.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=x||null,x&&(a.dragOffset={dx:x.x-S.x,dy:x.y-S.y})},St=c=>{if(a.marquee){a.marquee.ex=c.clientX,a.marquee.ey=c.clientY,he();return}if(!a.dragStart)return;let S=c.clientX-a.dragStart.x,x=c.clientY-a.dragStart.y;if(Math.abs(S)+Math.abs(x)>3&&(a.dragging=!0),a.dragNode){let L=Se(c.clientX,c.clientY);a.dragNode.x=L.x+a.dragOffset.dx,a.dragNode.y=L.y+a.dragOffset.dy,he()}else a.dragging&&(a.panX=Ze(a.dragStart.px+S,-1e5,1e5),a.panY=Ze(a.dragStart.py+x,-1e5,1e5),he())},Nt=c=>{if(a.marquee){let x=a.marquee;a.marquee=null;let L=s.getBoundingClientRect(),E=Math.min(x.sx,x.ex)-L.left,ee=Math.max(x.sx,x.ex)-L.left,q=Math.min(x.sy,x.ey)-L.top,xe=Math.max(x.sy,x.ey)-L.top,Ce=a.nodes.filter(Ye=>{let p=Ye.x*a.zoom+a.panX,$=Ye.y*a.zoom+a.panY;return p>=E&&p<=ee&&$>=q&&$<=xe}).map(Ye=>Ye.id);a.multi=Ce,Be(Ce),he();return}let S=a.dragStart&&!a.dragging;if(a.shiftClick){let x=a.shiftClick;a.shiftClick=null;let L=Array.isArray(a.multi)?a.multi.slice():[];L.includes(x)||L.push(x),a.multi=L,Be(L),he();return}if(S){let x=Se(c.clientX,c.clientY),L=null;for(let E=a.nodes.length-1;E>=0;E--){let ee=a.nodes[E];if(!Je(ee.id))continue;let q=ee.x-x.x,xe=ee.y-x.y;if(q*q+xe*xe<ee.r*ee.r+20){L=ee;break}}L?(a.selectedId=L.id,W(L.id),he()):(a.selectedId=null,a.hoverId=null,c.shiftKey||(a.multi=[],Be([])),W(null),he())}a.dragStart=null,a.dragging=!1,a.dragNode=null},Mt=c=>{c.preventDefault();let S=Se(c.clientX,c.clientY),x=null;for(let L=a.nodes.length-1;L>=0;L--){let E=a.nodes[L];if(!Je(E.id))continue;let ee=E.x-S.x,q=E.y-S.y;if(ee*ee+q*q<E.r*E.r+25){x=E;break}}if(x){let L=a.domainById[x.id];L&&we({x:c.clientX,y:c.clientY,id:x.id,path:L.id,title:L.title})}else we(null)},zt=c=>{c.preventDefault();let S=s.getBoundingClientRect(),x=(c.clientX-S.left-a.panX)/a.zoom,L=(c.clientY-S.top-a.panY)/a.zoom,E=Math.max(.3,Math.min(3,a.zoom*(c.deltaY<0?1.1:1/1.1)));a.panX=Ze(a.panX+x*(a.zoom-E),-1e5,1e5),a.panY=Ze(a.panY+L*(a.zoom-E),-1e5,1e5),a.zoom=E,he()};s.addEventListener("mousemove",kt),s.addEventListener("mousedown",Ct),window.addEventListener("mousemove",St),window.addEventListener("mouseup",Nt),s.addEventListener("wheel",zt,{passive:!1}),s.addEventListener("contextmenu",Mt),C.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],Be([]),me(),he()};for(let c=0;c<200;c++)Ke();me(),he();let It=()=>ie(!1);return window.addEventListener("mousedown",It),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),pt.disconnect(),s.removeEventListener("mousemove",kt),s.removeEventListener("mousedown",Ct),window.removeEventListener("mousemove",St),window.removeEventListener("mouseup",Nt),s.removeEventListener("wheel",zt),s.removeEventListener("contextmenu",Mt),window.removeEventListener("mousedown",It)}},[t,l]),(0,n.useEffect)(()=>{I!==void 0&&A.current&&requestAnimationFrame(()=>A.current())},[I]),(0,e.jsxs)("div",{className:"me-graph",ref:b,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",o("nodes")," \xB7 ",l.length," ",o("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:o("search"),value:j,onChange:s=>oe(s.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>ie(s=>!s),"aria-expanded":z,title:o("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",o("filterLabel")," ",T!=="all"||H||R?"\u25CF":"\u25BE"]}),z&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:s=>s.stopPropagation(),style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:50,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,padding:8,minWidth:240,boxShadow:"0 12px 34px rgba(0,0,0,.35)"},children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,e.jsx)("button",{type:"button",className:`lg${T==="all"&&!H?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{ve("all"),_(!1)},children:o("all")}),Object.keys(_e).map(s=>(0,e.jsxs)("button",{type:"button",className:`lg${T===s?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>ve(i=>i===s?"all":s),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:at.colors[s]||_e[s]}}),o(Fe[s])]},s)),(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsxs)("button",{type:"button",className:`lg${H?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>_(s=>!s),children:["\u23F1 ",o("timeDim")]}),Ue.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:Ue.map(s=>(0,e.jsxs)("button",{type:"button",className:`lg${R===s.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>Y(i=>i===s.tag?"":s.tag),title:s.tag,children:["#",s.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:s.n})]},s.tag))})]}),(T!=="all"||H||R)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{ve("all"),_(!1),Y("")},children:[o("clearFilter")," \u2715"]})]})})]}),(0,e.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:o("crossVault"),children:[(0,e.jsx)("input",{type:"checkbox",checked:!!k,onChange:s=>N&&N(s.target.checked)}),o("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${H?" me-on":""}`,onClick:()=>_(s=>!s),children:o("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=h.current;if(s)try{s.toBlob(i=>{i&&fe({url:URL.createObjectURL(i),blob:i})},"image/png")}catch{}},children:o("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>A.current&&A.current(),children:o("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{W(null),ve("all"),C.current&&C.current()},children:o("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:h,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:Me,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)"}}),Te&&(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:o("noMatch")}),ae&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>we(null)}),ae&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:ae.x,top:ae.y,zIndex:31},onMouseDown:s=>s.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{w.current({path:ae.path,title:ae.title}),we(null)},children:o("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{ae.id&&(m.current.selectedId=ae.id,W(ae.id)),we(null);let s=m.current;s&&s.wake&&s.wake()},children:o("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(ae.title||"")}catch{}we(null),G(o("copied"))},children:o("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let s=m.current,i=s&&Array.isArray(s.multi)?s.multi.slice():[],B=ae.id;if(B&&!i.includes(B)&&i.push(B),we(null),i.length<2){G(o("mergeNeed"),!1);return}if(!window.confirm(o("mergeConfirm")))return;let V=M.current&&M.current(i);V&&V.then?V.then(se=>se?G(o("merged")):G(o("mergeFail"),!1)).catch(()=>G(o("mergeFail"),!1)):V&&G(o("merged"))},children:o("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let s=ae.path;we(null),window.confirm(o("deleteConfirm"))&&(async()=>{try{(D.current?await D.current(s):!1)?G(o("deleted")):G(o("deleteFail"),!1)}catch{G(o("deleteFail"),!1)}})()},children:o("delete")})]}),Ae.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:[Ae.length," ",o("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let i=Ae.map(ze=>ue[ze]).filter(Boolean).map(ze=>ze.title||ze.name).join(`
304
- `),B=new Blob([i],{type:"text/plain;charset=utf-8"}),V=URL.createObjectURL(B),se=document.createElement("a");se.href=V,se.download="memory-selected.txt",document.body.appendChild(se),se.click(),document.body.removeChild(se),setTimeout(()=>URL.revokeObjectURL(V),1e3),G(Ae.length+o("exportedSel"))},children:o("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(Ae.length<2){G(o("mergeNeed"),!1);return}let s=Ae.map(B=>ue[B]?ue[B].id:B);if(!window.confirm(o("mergeConfirm")))return;Be([]);let i=m.current;i&&(i.multi=[]),fetch(`${U}/merge?paths=${encodeURIComponent(s.join(","))}`).then(B=>B.json()).then(B=>{B&&B.ok?G(o("merged")):G(o("mergeFail"),!1)}).catch(()=>G(o("mergeFail"),!1))},children:o("merge")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(o("deleteConfirm")))return;let s=Ae.map(B=>ue[B]?ue[B].id:B);Be([]);let i=m.current;i&&(i.multi=[]),(async()=>{let B=0;for(let V of s)try{(D.current?await D.current(V):!1)&&B++}catch{}G(B+o("deletedSelected"),B>0)})()},children:o("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=m.current;s&&(s.multi=[]),Be([]);let i=m.current;i&&i.render&&i.render()},children:o("clearSelection")})]}),te&&(0,e.jsxs)("div",{className:"me-graph-sidebar",style:{position:"absolute",right:10,top:10,zIndex:3,maxWidth:240,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:12,fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsx)("div",{style:{fontWeight:700,fontSize:13,marginBottom:4},children:ue[te]?ue[te].title||ue[te].name:te}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:ue[te]?o(Fe[ue[te].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:o("graphHint")}),(l.filter(s=>s.source===te||s.target===te)||[]).slice(0,8).map((s,i)=>{let B=s.source===te?s.target:s.source,V=ue[B];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:se=>{se.preventDefault();let ze=m.current;ze&&(ze.selectedId=B,ze.hoverId=B,ze.wake&&ze.wake()),W(B)},children:V?(V.title||V.name).slice(0,28):B},i)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:o("graphTip")}),pe&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(pe.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:pe.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:pe.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:pe.msg})]}),ke&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{ke.url&&URL.revokeObjectURL(ke.url),fe(null),Oe(!1)},children:[(0,e.jsx)("style",{children:De}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:Ie?"100vw":900,width:Ie?"100vw":"92vw",maxHeight:Ie?"100%":"90vh",height:Ie?"100%":void 0,borderRadius:Ie?0:14},onClick:s=>s.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:o("exportGraph")}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("a",{className:"mc-btn",href:ke.url,download:"memory-graph.png",onClick:()=>{ye("download"),G(o("downloaded")+" \xB7 "+o("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:o(d==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{ye("full"),Oe(s=>!s),G(o("fullscreen"))},children:o(d==="full"?"done":Ie?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=ke.blob;s&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":s})]).then(()=>{ye("copy"),G(o("copied"))}).catch(()=>{G(o("copyFail"),!1)}):G(o("copyFail"),!1)},children:o(d==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{ke.url&&URL.revokeObjectURL(ke.url),fe(null),Oe(!1)},children:o("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Ie?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,e.jsx)("img",{src:ke.url,alt:o("exportGraph"),style:{maxWidth:"100%",maxHeight:Ie?"calc(100% - 64px)":"70vh",borderRadius:Ie?0:8,cursor:"zoom-in"},onClick:()=>Oe(s=>!s)})})]})]})]})}function Sa(t){let l=new Date(t||0).getTime();if(!l)return"#94a3b8";let r=(Date.now()-l)/864e5;return r<3?"#10b981":r<14?"#f59e0b":r<30?"#f97316":"#94a3b8"}function Pt({label:t,value:l=[],options:r,onChange:y,placeholder:u,z:o=20}){let[v,k]=(0,n.useState)(!1),N=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!v)return;let w=D=>{N.current&&!N.current.contains(D.target)&&k(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[v]);let I=Array.isArray(l)?l:[],h=I.includes("__all__"),b=h?r.find(w=>w.value==="__all__")?.label||"":I.length?I.map(w=>r.find(D=>D.value===w)?.label||w).join("\u3001"):"",m=(w,D)=>{if(w.value==="__all__"){y(D?["__all__"]:[]);return}let M=new Set(I);M.has("__all__")&&M.delete("__all__"),D?M.add(w.value):M.delete(w.value),y([...M])},A=r.find(w=>w.value==="__all__"),C=r.filter(w=>w.value!=="__all__");return(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t}),(0,e.jsxs)("div",{ref:N,style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>k(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:b||u||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),v&&(0,e.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:o,marginTop:2,borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",boxShadow:"0 6px 20px rgba(0,0,0,0.14)",maxHeight:180,overflow:"auto"},children:[A&&(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:h,onChange:w=>m(A,w.target.checked)}),(0,e.jsx)("span",{children:A.label})]}),C.map(w=>(0,e.jsxs)("label",{onClick:D=>D.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:I.includes(w.value),onChange:D=>m(w,D.target.checked)}),(0,e.jsx)("span",{children:w.label})]},w.value))]})]})]})}function Na(t){let l=new Date(t||0).getTime();return!!l&&(Date.now()-l)/864e5<3}async function Ma(t,l,r){if(r&&typeof window.showSaveFilePicker=="function")try{let o=await window.showSaveFilePicker({suggestedName:l}),v=await o.createWritable();return await v.write(t),await v.close(),{ok:!0,picked:!0,name:o.name}}catch(o){return o&&o.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(o.message||o)}}let y=URL.createObjectURL(t),u=document.createElement("a");return u.href=y,u.download=l,document.body.appendChild(u),u.click(),document.body.removeChild(u),setTimeout(()=>URL.revokeObjectURL(y),1e3),{ok:!0,picked:!1,name:l}}function Et(t,l){if(!l||!t)return t;let r=t.toLowerCase(),y=l.toLowerCase(),u=[],o=0;for(;o<t.length;){let v=r.indexOf(y,o);if(v<0){u.push(t.slice(o));break}v>o&&u.push(t.slice(o,v)),u.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(v,v+y.length)},v)),o=v+y.length}return u}function nt(t){if(!t)return"";let l=new Date(t);if(Number.isNaN(l.getTime()))return"";let r=new Date,y=l.toDateString()===r.toDateString(),u=v=>String(v).padStart(2,"0"),o=`${u(l.getHours())}:${u(l.getMinutes())}`;return y?o:`${l.getMonth()+1}-${l.getDate()} ${o}`}
302
+ `));let Ke=new Blob([pe],{type:ge}),$e=await ja(Ke,ue,!1);if(!$e.ok){_({ok:!1,msg:t("exportFail")}),le(!1);return}_({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+$e.name})}catch(Z){_({ok:!1,msg:t("exportFail")+" \xB7 "+(Z.message||"")})}finally{le(!1)}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2600)},mt=async h=>{let F=h.target.files&&h.target.files[0];if(h.target.value="",!!F){try{let Z=await F.text(),pe=await(await fetch(`${Y}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:Z})).json();pe.ok?(await U(),_({ok:!0,msg:t("importedVault")+"\uFF1A"+(pe.imported||0)+(pe.skipped?t("importedSkipped")+pe.skipped:"")})):_({ok:!1,msg:pe.error||t("importFail")})}catch{_({ok:!1,msg:t("importFail")})}B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2400)}},gt=(0,n.useMemo)(()=>{let h=S.slice();return G!=="all"&&(h=h.filter(F=>rt(F.submittedBy)===G)),H!=="all"&&(h=h.filter(F=>(F.status||"approved")===H)),f==="title"?h.sort((F,Z)=>String(F.title||"").localeCompare(String(Z.title||""))):f==="hot"?h.sort((F,Z)=>(Z.weight||Z.links||0)-(F.weight||F.links||0)):h.sort((F,Z)=>new Date(Z.updated||0).getTime()-new Date(F.updated||0).getTime()),h},[S,f,G,H]),ft=(0,n.useMemo)(()=>[...new Set(S.map(h=>rt(h.submittedBy)))],[S]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Ie}),K&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(K.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:K.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:K.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:K.msg})]}),o&&(0,e.jsxs)("div",{className:"me-modal-head",children:[(0,e.jsxs)("div",{className:"me-modal-title",children:[(0,e.jsx)("span",{className:"me-wicon",children:(0,e.jsx)(Jt,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),g&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:g,"aria-label":t(p?"exitFull":"fullscreen"),children:p?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:i,"aria-label":t("close"),children:"\u2715"})]}),y&&y.ok===!1&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,margin:"0 0 8px",padding:"9px 14px",borderRadius:10,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.45)",borderLeft:"4px solid #ef4444",color:"var(--dsw-alias-label-primary, #e5e7eb)",fontSize:12.5,lineHeight:1.6},children:[(0,e.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",t("captureAlert")]}),(0,e.jsxs)("span",{style:{flex:1},children:[y.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:y.since?lt(new Date(y.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${me?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Ce(h=>!h),"aria-label":t(me?"collapse":"expand"),title:t(me?"collapse":"expand"),children:me?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="cards"?" active":""}`,onClick:()=>b("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="graph"?" active":""}`,onClick:()=>b("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="stats"?" active":""}`,onClick:()=>b("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="audit"?" active":""}`,onClick:()=>b("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="optimize"?" active":""}`,onClick:()=>b("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${$==="config"?" active":""}`,onClick:()=>b("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>xe(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),me&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:r,children:[$==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(ot,{label:t("total"),value:l?l.total:"\u2014"}),(0,e.jsx)(ot,{label:t("recent"),value:l?l.recent:"\u2014"}),(0,e.jsx)(ot,{label:t("tags"),value:l?l.tags:"\u2014"}),(0,e.jsx)(ot,{label:t("pending"),value:l?.status?.pending??0}),(0,e.jsx)(ot,{label:t("rejected"),value:l?.status?.rejected??0}),(0,e.jsx)(ot,{label:t("cardCount"),value:l?l.byKind?.knowledge??0:"\u2014"})]}),$==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:N,onChange:h=>we(h.target.value)}),(0,e.jsx)("input",{ref:ee,type:"file",accept:".json,application/json",style:{display:"none"},onChange:mt}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ee.current&&ee.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>Se({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:Q,onClick:()=>st("md"),children:t(Q?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:Q,onClick:()=>st("json"),children:t(Q?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>U(),children:t("refresh")})]}),$==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[It.map(h=>(0,e.jsx)("button",{type:"button",className:`mc-chip${w===h?" active":""}`,onClick:()=>a(h),children:t(h==="all"?"all":Ee[h])},h)),(0,e.jsxs)("select",{value:G,onChange:h=>te(h.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsxs)("option",{value:"all",children:["\u{1F916} ",t("allAgents")]}),Gt(ft).map(h=>(0,e.jsx)("option",{value:h,children:h},h))]}),(0,e.jsxs)("select",{value:H,onChange:h=>ye(h.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allStatus")}),(0,e.jsx)("option",{value:"approved",children:t("statusApproved")}),(0,e.jsx)("option",{value:"pending",children:t("statusPending")}),(0,e.jsx)("option",{value:"rejected",children:t("statusRejected")})]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:t("sortRecent")},{key:"title",label:t("sortTitle")},{key:"hot",label:t("sortHot")}].map(h=>(0,e.jsx)("button",{type:"button",className:`mc-chip${f===h.key?" active":""}`,onClick:()=>E(h.key),children:h.label},h.key))]}),M&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",M]}),(0,e.jsx)("div",{style:{display:$==="cards"?"contents":"none"},children:A?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):M?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",M," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>U(),children:t("retry")})]}):S.length===0?(0,e.jsx)("div",{className:"mc-empty",children:t("empty")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"mc-grid",children:gt.map(h=>(0,e.jsx)(Ia,{card:h,t,query:N.trim(),onOpen:Ze,onDelete:se},h.path))}),S.length<ce&&(0,e.jsx)("div",{ref:s,style:{height:1}}),R&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",S.length," / ",ce,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:$==="graph"?"flex":"none",flex:1,minHeight:0},children:be.has("graph")&&(0,e.jsx)(Ba,{t,onOpen:Ze,all:De,onAllChange:Be,onMutate:We,active:$==="graph",visible:$==="graph"})}),(0,e.jsx)("div",{style:{display:$==="config"?"contents":"none"},children:be.has("config")&&(0,e.jsx)(Qt,{t,onReload:()=>U(),version:Re})}),(0,e.jsx)("div",{style:{display:$==="stats"?"contents":"none"},children:be.has("stats")&&(0,e.jsx)(Da,{t,tab:"stats",onReload:()=>U(),version:Re})}),(0,e.jsx)("div",{style:{display:$==="audit"?"contents":"none"},children:be.has("audit")&&(0,e.jsx)(Ma,{t,onReload:()=>U(),version:Re})}),(0,e.jsx)("div",{style:{display:$==="optimize"?"contents":"none"},children:be.has("optimize")&&(0,e.jsx)(za,{t,onReload:()=>U(),version:Re})}),he&&(0,e.jsx)(Ta,{t,onClose:()=>xe(!1)}),Ve&&(0,e.jsx)(Aa,{t,card:Ve,query:N.trim(),onClose:()=>qe(null),onDelete:h=>{qe(null),se(h)},onFeedback:h=>{let F=Ve.path;fetch(`${Y}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:N.trim(),path:F,useful:h})}).then(()=>_({ok:!0,msg:t(h?"fbUseful":"fbIrr")})).catch(()=>{}),B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2e3)}}),(0,e.jsx)(La,{t,newCard:Fe,setNewCard:Se,onCreated:()=>{U(),We(),_({ok:!0,msg:t("created")}),B.current&&clearTimeout(B.current),B.current=setTimeout(()=>_(null),2e3)}})]})]})]})}var Zt=({toast:t})=>t?(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"8px 12px",fontSize:12,borderLeft:"4px solid "+(t.ok?"#10b981":"#ef4444"),background:t.ok?"rgba(16,185,129,0.08)":"rgba(239,68,68,0.08)"},children:[t.ok?"\u2705":"\u26A0"," ",t.msg]}):null,ot=({label:t,value:o})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:o}),(0,e.jsx)("span",{children:t})]});function Qt({t,onReload:o,version:i,compact:g}){let[p,l]=(0,n.useState)(null),[v,S]=(0,n.useState)(0),[x,A]=(0,n.useState)(null),[k,y]=(0,n.useState)(null),[m,M]=(0,n.useState)(!1),[z,w]=(0,n.useState)(null),[L,N]=(0,n.useState)(null),[O,G]=(0,n.useState)(""),[te,H]=(0,n.useState)(""),[ye,$]=(0,n.useState)(""),[J,be]=(0,n.useState)(null),W=(0,n.useCallback)(async d=>{H("version");try{let R=await fetch(Y+"/version-check"+(d?"?force=1":"")).then(P=>P.json());R&&R.ok?(be(R),d&&B(R.updateAvailable?t("vcLatest")+" v"+R.latest:t("vcUpToDate"))):d&&B(t("vcCheckFail"),!1)}catch{d&&B(t("vcCheckFail"),!1)}finally{H("")}},[t]);(0,n.useEffect)(()=>{W(!1)},[i,W]);let[b,f]=(0,n.useState)(""),[E,K]=(0,n.useState)(null),_=(0,n.useRef)(null),B=(d,R=!0)=>{_.current&&clearTimeout(_.current),K({msg:d,ok:R}),_.current=setTimeout(()=>K(null),1900)},ee=(d,R)=>Object.keys(R).reduce((P,s)=>P.split("{"+s+"}").join(R[s]),t(d)),Q=(0,n.useCallback)(async()=>{try{let[d,R,P]=await Promise.all([fetch(`${Y}/config`).then(s=>s.json()).catch(()=>null),fetch(`${Y}/setup-status`).then(s=>s.json()).catch(()=>null),fetch(`${Y}/budget`).then(s=>s.json()).catch(()=>null)]);d&&d.ok?(l(d),S(d.revision??0),A(d.schema??null),y({...d.config??{}}),w(d.dsh??null),M(d.writable===!1),G("")):P&&P.ok?(y({...P}),M(!0),G(t("configNeedsDsh"))):G(t("adminLoadFail")),R&&R.ok&&N(R),$("")}catch{G(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{Q()},[i,Q]);let le=(d,R)=>y(P=>({...P??{},[d]:R})),Ve=d=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[d]||d,qe=async()=>{if(k){if(m){B(t("editInSetting"),!1);return}H("save");try{let d={...k};Array.isArray(d.vaultProfiles)&&(d.vaultProfiles=d.vaultProfiles.filter(s=>s&&(String(s.name||"").trim()||String(s.path||"").trim())));let R=await fetch(`${Y}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:d,expectedRevision:v})}),P=await R.json();if(P&&P.ok)$(t("savedOk")+(P.note?` \xB7 ${t("restartHint")}`:"")),B(t("savedOk")),await Q();else{let s=R.status===409?t("conflictRefresh"):P?.error||t("saveFail");G(s),B(s,!1)}}catch{G(t("saveFail")),B(t("saveFail"),!1)}finally{H("")}}},De=()=>{y({...p?.config??{}}),$("")},Be={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},he=d=>Array.isArray(d?.vaultProfiles)?d.vaultProfiles:[],xe=(d,R,P)=>y(s=>{let r=he(s).map(U=>({...U||{}})),D={...r[d]||{}};return R==="match"?String(P).trim()?D.match={...D.match||{},workspace:P}:delete D.match:D[R]=P,r[d]=D,{...s??{},vaultProfiles:r}}),me=()=>y(d=>({...d??{},vaultProfiles:[...he(d),{name:"",path:""}]})),Ce=d=>y(R=>({...R??{},vaultProfiles:he(R).filter((P,s)=>s!==d)})),Fe={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},Se={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},Re={A:{label:t("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:900,recallMinScore:2,recallLimit:5,recallSummaryLen:130,recallIncludeBody:!1,captureCooldownMs:3e5},B:{label:t("planB"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!1,dedupByLLM:!1,captureMaxTokens:500,recallMinScore:3,recallLimit:3,recallSummaryLen:80,recallIncludeBody:!1,captureMinChars:300,maxCardsPerDay:40,captureCooldownMs:3e5},C:{label:t("planC"),autoWebMode:"interval",watchdogAutoSpawn:!0,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:1200,recallMinScore:1,recallLimit:8,recallSummaryLen:200,recallIncludeBody:!0,captureCooldownMs:12e4}},Xe=async d=>{let R=Re[d];R&&y(P=>({...P??{},...R}))},We=async(d,R)=>{H(d+R);try{let s=await(await fetch(`${Y}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:d,action:R})})).json();s&&s.ok?B(ee(R==="install"?"mcpInstalled":"mcpUninstalled",{agent:d})):B(ee("mcpActionFail",{agent:d,error:s?.error||""}),!1);try{let r=await fetch(`${Y}/setup-status`).then(D=>D.json());r&&r.ok&&N(r)}catch{}}catch{B(t("mergeFail"),!1)}finally{H("")}},re=({k:d,label:R,type:P="text",step:s,min:r,max:D})=>(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:R||d}),(0,e.jsx)("input",{type:P,step:s,min:r,max:D,value:k?k[d]??"":"",onChange:U=>le(d,P==="number"?Number(U.target.value):U.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12}})]}),ce=({k:d,label:R})=>(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:!!(k&&k[d]),onChange:P=>le(d,P.target.checked)}),(0,e.jsx)("span",{children:R||d})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:g?"0 0 auto":1,minHeight:0,maxHeight:g?"52vh":void 0},children:[(0,e.jsx)("style",{children:Ie}),E&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(E.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:E.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:E.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:E.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[O&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",O]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:Q,children:["\u21BB ",t("retry")]})]}),m&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #f59e0b",background:"rgba(245,158,11,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#b45309"},children:["\u2139\uFE0F ",t("configNeedsDsh")," \u2014\u2014 ",t("editInSetting")]}),ye&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #10b981",background:"rgba(16,185,129,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#059669"},children:["\u2713 ",ye]}),p&&(p.version||p.dsh?.vaultDir)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",t("pluginInfo")]}),(0,e.jsx)("span",{style:{fontSize:12,opacity:.7},children:t("dshHostLabel")}),p.version&&(0,e.jsxs)("code",{style:Fe,children:[t("vcLoaded")," v",p.version]}),J&&J.onDisk&&(0,e.jsxs)("code",{style:Fe,children:[t("vcOnDisk")," v",J.onDisk]}),J&&J.latest&&(0,e.jsxs)("code",{style:Fe,children:[t("vcLatest")," v",J.latest]}),p.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",p.dsh.vaultDir]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:te==="version",onClick:()=>W(!0),children:te==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),J&&J.stale&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px"},children:["\u26A0\uFE0F ",ee("vcStale",{disk:J.onDisk,loaded:J.loaded})]}),J&&J.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:J.updateCommand})]}),J&&J.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",J.checkError]})]}),L&&L.agents&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F50C} ",t("mcpSetupStatus")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("mcpManageHint")})]}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:L.agents.map(d=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1},children:[(0,e.jsx)("b",{children:d.isDsh?t("dshHostLabel"):d.name}),d.isDsh&&d.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",d.version]}),!d.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),d.installed&&d.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),d.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),d.mcpConfigured===!0&&d.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),d.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",d.recallTool?t("enabled"):t("disabled"),")"]})]}),d.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",d.hook]}),!d.isDsh&&d.installed&&d.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!te,onClick:()=>We(d.name,"install"),children:t("installMcp")}),!d.isDsh&&d.installed&&d.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!te,onClick:()=>{window.confirm(t("uninstallConfirm"))&&We(d.name,"uninstall")},children:t("uninstallMcp")})]},d.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),b&&(0,e.jsx)("div",{style:{fontSize:11,marginTop:6},children:(0,e.jsx)("code",{style:{padding:"2px 6px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:4},children:b})})]}),k?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("presetConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("presetHint")})]}),(0,e.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(d=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>Xe(d),disabled:!!te,children:[d==="A"?"\u{1F7E2} ":d==="B"?"\u{1F4B0} ":"\u2B50 ",Re[d].label]},d))})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9E0} ",t("dshMemoryConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:8},children:[(0,e.jsx)(ce,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(ce,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(re,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(re,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(re,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(re,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(re,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(ce,{k:"recallIncludeBody",label:t("recallBody")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #06b6d4"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5C2}\uFE0F ",t("vaultMulti")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("vaultMultiHint")})]}),(0,e.jsxs)("div",{style:{fontSize:11.5,opacity:.85,marginBottom:8,lineHeight:1.7},children:[t("vaultNow"),"\uFF1A",(0,e.jsx)("code",{children:z?.vaultDir||"\u2014"}),z?.vaultName?`\uFF08${z.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(Be[z?.vaultSource]||"vaultSrcDefault"),z?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:z.workspace})]}):null]}),he(k).map((d,R)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:d.name||"",placeholder:t("vaultNamePh"),onChange:P=>xe(R,"name",P.target.value),style:Se,disabled:m}),(0,e.jsx)("input",{value:d.path||"",placeholder:t("vaultPathPh"),onChange:P=>xe(R,"path",P.target.value),style:Se,disabled:m}),(0,e.jsx)("input",{value:d.match&&d.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:P=>xe(R,"match",P.target.value),style:Se,disabled:m}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Ce(R),disabled:m,title:t("delete"),children:"\u2715"})]},R)),(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:me,disabled:m,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:k.activeVault||"",onChange:d=>le("activeVault",d.target.value),disabled:m,style:Se,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),he(k).filter(d=>d&&d.name).map(d=>(0,e.jsx)("option",{value:d.name,children:d.name},d.name))]})]})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #f59e0b"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4B0} ",t("costControl")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("costHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))",gap:8,marginTop:6},children:[(0,e.jsx)(ce,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(ce,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(re,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(re,{k:"recallMinScore",label:t("recallMinScore"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("auditConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("auditHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))",gap:8},children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("auditMode")}),(0,e.jsxs)("select",{value:k.auditMode??"all",onChange:d=>le("auditMode",d.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"all",children:t("auditAll")}),(0,e.jsx)("option",{value:"none",children:t("auditNone")})]})]}),(0,e.jsx)(Yt,{label:t("auditExemptAgents"),value:k.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(L?.agents||[]).filter(d=>!d.isDsh).map(d=>({value:d.name,label:d.name}))],onChange:d=>le("auditExemptAgents",d)}),(0,e.jsx)(Yt,{label:t("auditExemptKinds"),value:k.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...It.filter(d=>d!=="all").map(d=>({value:d,label:t(Ee[d])}))],onChange:d=>le("auditExemptKinds",d)}),(0,e.jsx)(re,{k:"recycleRetentionDays",label:t("recycleDays"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E0} ",t("serviceConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:8},children:[(0,e.jsx)(ce,{k:"autoWeb",label:t("autoWeb")}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("autoWebMode")}),(0,e.jsxs)("select",{value:k.autoWebMode??"init",onChange:d=>le("autoWebMode",d.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"init",children:t("modeInit")}),(0,e.jsx)("option",{value:"interval",children:t("modeInterval")}),(0,e.jsx)("option",{value:"manual",children:t("modeManual")})]})]}),(0,e.jsx)(re,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(re,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(re,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(ce,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(ce,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[te==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),ye&&te!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",ye]}),O&&te!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",O]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:De,disabled:!!te,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:qe,disabled:!!te||m,children:te==="save"?"\u23F3 "+t("saving"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function Ma({t,onReload:o,version:i}){let[g,p]=(0,n.useState)([]),[l,v]=(0,n.useState)([]),[S,x]=(0,n.useState)("all"),[A,k]=(0,n.useState)("all"),[y,m]=(0,n.useState)(""),[M,z]=(0,n.useState)(new Set),[w,L]=(0,n.useState)(""),[N,O]=(0,n.useState)(null),[G,te]=(0,n.useState)("pending"),H=(f,E=!0)=>{O({msg:f,ok:E}),setTimeout(()=>O(null),3e3)},ye=[...new Set([...g,...l].map(f=>f.submittedBy).filter(Boolean))],$=(0,n.useCallback)(async()=>{try{let f=await fetch(`${Y}/audit/list`).then(E=>E.json());f.ok&&(p(f.pending||[]),v(f.rejected||[]),z(new Set))}catch{}},[]);(0,n.useEffect)(()=>{$()},[i,$]);let J=(G==="pending"?g:l).filter(f=>{if(S!=="all"&&f.kind!==S||A!=="all"&&rt(f.submittedBy)!==A)return!1;if(y){let E=(f.created||"").slice(0,10);if(E&&E!==y)return!1}return!0}),be=f=>z(E=>{let K=new Set(E);return K.has(f)?K.delete(f):K.add(f),K}),W=async(f,E)=>{let K=E||[...M];if(!K.length){H(t("noSelection"),!1);return}L("apply");let _=t(f==="approved"?"toastApproved":f==="rejected"?"toastRejected":"toastCardDeleted");try{let B=0;for(let ee of K){let Q=f==="approved"?"audit/approve":f==="rejected"?"audit/reject":"delete";try{(await fetch(Y+"/"+Q+"?path="+encodeURIComponent(ee)+(f==="delete"?"&permanent=0":""))).ok||B++}catch{B++}}await $(),o&&o(),B?H(t("toastFailed")+"\uFF08"+B+"/"+K.length+"\uFF09",!1):H(_+" "+K.length+" \u5F20")}catch(B){H(t("toastFailed")+": "+String(B&&B.message||B),!1)}finally{L("")}},b=[...M];return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(Zt,{toast:N}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("tabAudit")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("select",{value:S,onChange:f=>x(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("all")}),It.filter(f=>f!=="all").map(f=>(0,e.jsx)("option",{value:f,children:t(Ee[f])},f))]}),(0,e.jsxs)("select",{value:A,onChange:f=>k(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allAgents")}),Gt(ye).map(f=>(0,e.jsx)("option",{value:f,children:f},f))]}),(0,e.jsx)("input",{type:"date",value:y,onChange:f=>m(f.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"}})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("button",{type:"button",className:`mc-btn${G==="pending"?" me-on":""}`,onClick:()=>te("pending"),children:[t("pending"),"\uFF08",g.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${G==="rejected"?" me-on":""}`,onClick:()=>te("rejected"),children:[t("rejected"),"\uFF08",l.length,"\uFF09"]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("label",{style:{fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:J.length>0&&b.length===J.length,onChange:f=>{f.target.checked?z(new Set(J.map(E=>E.path))):z(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!b.length||!!w,onClick:()=>W("approved"),children:["\u2713 ",t(G==="rejected"?"restore":"approve")]}),G==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!b.length||!!w,onClick:()=>W("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!b.length||!!w,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&W("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),J.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:J.map(f=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:M.has(f.path),onChange:()=>be(f.path)}),(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[f.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:rt(f.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:f.created?f.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:f.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:f.severity==="high"?"#f87171":"#9ca3af"},children:f.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.reason||"-"}),G==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>W("approved",[f.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>W("rejected",[f.path]),children:"\u2715"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},title:t("restore"),onClick:()=>W("approved",[f.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},title:t("restoreDelete"),onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&W("delete",[f.path])},children:"\u{1F5D1}"})]})]},f.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function za({t,onReload:o,version:i}){let[g,p]=(0,n.useState)([]),[l,v]=(0,n.useState)(""),[S,x]=(0,n.useState)(null),A=(m,M=!0)=>{x({msg:m,ok:M}),setTimeout(()=>x(null),3200)},k=(0,n.useCallback)(async()=>{try{let m=await fetch(`${Y}/recycle/list`).then(M=>M.json());m.ok&&p(m.items||[])}catch{}},[]);(0,n.useEffect)(()=>{k()},[i,k]);let y=async(m,M)=>{let z=(g.find(w=>w.path===M)||{}).title||M;v(m+M);try{let L=await fetch(Y+(m==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(M)),N=await L.json().catch(()=>null);await k(),o&&o(),L.ok&&(!N||N.ok!==!1)?A(t(m==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+z):A(t("toastFailed")+"\uFF1A"+(N&&N.error||"HTTP "+L.status),!1)}catch(w){A(t("toastFailed")+"\uFF1A"+String(w&&w.message||w),!1)}finally{v("")}};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(Zt,{toast:S}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",t("tabRecycle")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("recycleHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!l||g.length===0,title:g.length?"":t("emptyRecycle"),onClick:async()=>{v("purgeAll");try{let m=await fetch(Y+"/recycle/purge-expired?days=0"),M=await m.json().catch(()=>null);await k(),A(m.ok?t("toastPurgedExpired")+(M&&M.purged!=null?"\uFF08"+M.purged+"\uFF09":""):t("toastFailed"),m.ok)}catch(m){A(t("toastFailed")+"\uFF1A"+String(m&&m.message||m),!1)}finally{v("")}},children:t("emptyRecycle")})]}),g.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:g.map(m=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[m.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(m.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!l,onClick:()=>y("restore",m.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!l,onClick:()=>{window.confirm(t("purgeConfirm"))&&y("purge",m.path)},children:t("purge")})]},m.path))}):(0,e.jsxs)("div",{className:"mc-card",style:{padding:18,fontSize:12.5,opacity:.78,textAlign:"center",lineHeight:1.9},children:["\u{1F5D1}\uFE0F ",t("emptyRecycle"),(0,e.jsx)("br",{}),(0,e.jsx)("span",{style:{fontSize:11.5},children:t("recycleEmptyHint").split("{days}").join("30")})]})]})]})}var Ia=({card:t,t:o,onOpen:i,query:g,onDelete:p})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>i(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[t.kind]||Ue.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:wt[t.kind]||"\u{1F4CE}"}),g?Vt(t.title,g):t.title,Fa(t.updated)&&(0,e.jsx)("span",{className:"mc-new",children:o("newBadge")}),t.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",o("statusPending")]}),t.status==="rejected"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",o("statusRejected")]}),(!t.status||t.status==="approved")&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",o("statusApproved")]})]}),(0,e.jsx)("p",{children:g?Vt(t.summary||"",g):t.summary||""}),t.tags.length>0&&(0,e.jsx)("div",{className:"mc-tags",children:t.tags.slice(0,4).map(l=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",l]},l))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[wt[t.kind]||"\u{1F4CE}"," ",o(Ee[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",rt(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",lt(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:o("delete"),onClick:l=>{l.stopPropagation(),window.confirm(o("deleteConfirm"))&&p&&p(t.path)},children:"\u{1F5D1}"})]})]});function Da({t,tab:o,onReload:i,version:g}){let[p,l]=(0,n.useState)(null),[v,S]=(0,n.useState)(""),[x,A]=(0,n.useState)(null),[k,y]=(0,n.useState)(null),[m,M]=(0,n.useState)(null),[z,w]=(0,n.useState)([]),[L,N]=(0,n.useState)(""),[O,G]=(0,n.useState)(!1),te=(0,n.useCallback)(async()=>{if(!(!x||!x.merge||!x.merge.length)&&window.confirm(t("mergeAllConfirm"))){N("merge");try{let b={},f=ee=>b[ee]===void 0?ee:b[ee]=f(b[ee]),E=(ee,Q)=>{b[f(ee)]=f(Q)},K=new Set;for(let ee of x.merge)K.add(ee.a.path),K.add(ee.b.path),E(ee.a.path,ee.b.path);let _={};for(let ee of K){let Q=f(ee);(_[Q]=_[Q]||[]).push(ee)}let B=0;for(let ee of Object.values(_)){if(ee.length<2)continue;(await fetch(`${Y}/merge?paths=${encodeURIComponent(ee.join(","))}`).then(le=>le.json())).ok&&B++}await H(),i&&i()}catch{}N("")}},[x,H,i,t]);async function H(){try{let b=await Promise.all([fetch(`${Y}/stats`),fetch(`${Y}/budget`),fetch(`${Y}/capture-log`),fetch(`${Y}/cards?status=all&limit=30&agent=${ut}`)]),[f,E,K,_]=await Promise.all(b.map(B=>B.json()));f&&f.ok&&l(f),E&&E.ok&&y(E),K&&K.ok&&M(K),_&&_.ok&&w(_.cards||[]),S(!f||!f.ok?t("adminLoadFail"):"")}catch{S(t("adminLoadFail"))}}let ye=(0,n.useCallback)(async()=>{N("scan");try{let b=await fetch(`${Y}/optimize`).then(f=>f.json());b.ok&&A(b)}catch{S(t("adminLoadFail"))}finally{N("")}},[t]);(0,n.useEffect)(()=>{H()},[g]);let $=async(b,f)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${Y}/merge?paths=${encodeURIComponent(b+","+f)}`).then(K=>K.json())).ok&&(await H(),i&&i())}catch{}},J=async b=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${Y}/delete?path=${encodeURIComponent(b)}`).then(E=>E.json())).ok&&(await H(),i&&i())}catch{}},be=["project","knowledge","content","prompt","business","tool","mistake"],W=({title:b,kind:f,updated:E,path:K})=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:it.colors[f]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:lt(E)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>J(K),children:[t("delete")," \u2715"]})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[v&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",v]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:H,children:["\u21BB ",t("retry")]})]}),o==="stats"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1FAB5} ",t("captureLog")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("captureLogHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>H(),children:["\u21BB ",t("refresh")]})]}),m?m.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(m.entries||[]).length===0?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogEmpty")}):(0,e.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,e.jsx)("tbody",{children:(m.entries||[]).map((b,f)=>{let E=xa[b.action]||["\u2022","inherit"];return(0,e.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:lt(b.time?new Date(b.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:E[1],fontWeight:600},children:[E[0]," ",b.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:b.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b.preview||"",children:b.preview||""})]},f)})})})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("loading")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:["\u{1F916} ",t("captureAgentCards"),"\uFF08",z.length,"\uFF09"]}),z.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:z.map(b=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[b.kind]||Ue.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.title}),b.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:lt(b.updated)})]},b.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),p&&(0,e.jsxs)(e.Fragment,{children:[p.trend&&p.trend.length>0&&(()=>{let b=p.trend,f=Math.max(...b.map(B=>B.count),1),E=260,K=50,_=E/b.length;return(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["\u{1F4C8} ",t("trendLabel")]}),(0,e.jsx)("svg",{width:E,height:K,style:{display:"block",width:"100%",height:50},children:b.map((B,ee)=>{let Q=Math.round(B.count/f*(K-4));return(0,e.jsx)("rect",{x:ee*_+1,y:K-Q,width:Math.max(_-2,2),height:Q,rx:1.5,fill:B.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:B.count>0?.85:.35},B.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.tags}),(0,e.jsx)("span",{children:t("tags")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("byKind")}),(0,e.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:be.map(b=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:it.colors[b]||"#666"}}),t(Ee[b]),": ",p.byKind?.[b]||0]},b))})]}),k&&(k.budgetChars||k.recallLimit||k.embedding)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,e.jsx)("b",{children:t("budgetLabel")}),"\uFF1A",t("budgetChars")," ",(0,e.jsx)("b",{children:k.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:k.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",k.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",p.todayCards?.length||0,"\uFF09"]}),p.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:p.todayCards.map(b=>(0,e.jsx)(W,{title:b.title,kind:b.kind,updated:b.updated,path:b.path},b.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})]})]}),o==="optimize"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("organizeTitle")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!L,onClick:ye,children:L==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),x&&x.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!L,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){N("oneclick");try{let b=JSON.stringify({cleanupStale:O}),E=await(await fetch(`${Y}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:b})).json();E&&E.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${E.plan.merged} ${t("optimizedMerged")}${O?` \xB7 ${E.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await H(),i&&i(),A(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{N("")}}},children:L==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),x&&x.merge?.length>0&&(0,e.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,e.jsx)("input",{type:"checkbox",checked:O,onChange:b=>G(b.target.checked)}),t("oneClickAlsoStale")]})]}),!x&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),x&&(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",flexDirection:"column",gap:8},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("mergePairs")}),(0,e.jsx)("div",{className:"spacer",style:{flex:1}}),x.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!L,onClick:te,children:t(L==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),x.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:x.merge.map((b,f)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[b.a.title," \u21C4 ",b.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(b.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>$(b.a.path,b.b.path),children:t("mergeNow")})]},f))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:12},children:t("noOptimize")}),(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("staleCards"),"\uFF08",x.stale?.length||0,"\uFF09"]}),x.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!L,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;N("clean");let b=0;for(let f of x.stale)try{await fetch(`${Y}/delete?path=${encodeURIComponent(f.path)}`),b++}catch{}N(""),notify(`${b} ${t("deletedStale")}`),await H(),i&&i()},children:t("cleanStale")})}),x.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:x.stale.map(b=>(0,e.jsx)(W,{title:b.title,kind:"other",updated:b.updated,path:b.path},b.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})})]})]})]})}var zt=[{key:"decision",label:"tplDecision",kind:"knowledge",tagKey:"tplDecisionTags",bodyKey:"tplDecisionBody"},{key:"bug",label:"tplBug",kind:"mistake",tagKey:"tplBugTags",bodyKey:"tplBugBody"},{key:"meeting",label:"tplMeeting",kind:"content",tagKey:"tplMeetingTags",bodyKey:"tplMeetingBody"},{key:"weekly",label:"tplWeekly",kind:"content",tagKey:"tplWeeklyTags",bodyKey:"tplWeeklyBody"}];function La({t,newCard:o,setNewCard:i,onCreated:g}){if(!o)return null;let p=zt.find(y=>y.key===o.template),l=o.body||(p?t(p.bodyKey):""),v=o.kind||(p?p.kind:"knowledge"),S=o.tags||(p?t(p.tagKey):""),x=o._creating,A=y=>{let m=zt.find(M=>M.key===y);i(M=>({...M,template:y,kind:m?m.kind:M.kind,body:m?t(m.bodyKey):M.body,tags:m?t(m.tagKey):M.tags}))},k=async()=>{if(!(!o.title&&!l)){i(y=>({...y,_creating:!0}));try{(await fetch(`${Y}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.title||t("untitled"),kind:v,tags:S.split(",").map(m=>m.trim()).filter(Boolean),body:l,source:"manual"})}).then(m=>m.json())).ok?(i(null),g&&g()):i(m=>({...m,_creating:!1}))}catch{i(m=>({...m,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>i(null),children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:y=>y.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:t("newCard")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>i(null),children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[zt.map(y=>(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===y.key?" me-on":""}`,onClick:()=>A(y.key),children:t(y.label)},y.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===""?" me-on":""}`,onClick:()=>i(y=>({...y,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:v,onChange:y=>i(m=>({...m,kind:y.target.value})),style:{maxWidth:180,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:["project","knowledge","content","prompt","business","tool","mistake"].map(y=>(0,e.jsx)("option",{value:y,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:y},y))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:o.title||"",onChange:y=>i(m=>({...m,title:y.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:S,onChange:y=>i(m=>({...m,tags:y.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:l,onChange:y=>i(m=>({...m,body:y.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,e.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:x,onClick:k,children:t(x?"exporting":"createCard")})})]})]})]})}async function Kt(t){let o=String(t||"");if(!o)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(o),!0}catch{}try{let i=document.createElement("textarea");i.value=o,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",i.style.top="0",document.body.appendChild(i),i.focus(),i.select();let g=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(i),g}catch{return!1}}function Ta({t,onClose:o}){let[i,g]=(0,n.useState)(""),[p,l]=(0,n.useState)(""),[v,S]=(0,n.useState)(""),[x,A]=(0,n.useState)(!0),[k,y]=(0,n.useState)(!1),[m,M]=(0,n.useState)(""),[z,w]=(0,n.useState)(""),L=(0,n.useRef)(null),N=(0,n.useRef)(null),O=()=>{let W=L.current;if(W)try{W.focus(),W.select()}catch{}},G=W=>{M(W),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>M(""),2400)};(0,n.useEffect)(()=>{let W=!0;return fetch(Y+"/diagnostics").then(b=>b.json()).then(b=>{W&&(b&&b.ok?(l(String(b.diagnostics||"")),S(String(b.version||""))):y(!0))}).catch(()=>{W&&y(!0)}).finally(()=>{W&&A(!1)}),()=>{W=!1}},[]),(0,n.useEffect)(()=>{let W=b=>{b.key==="Escape"&&o()};return window.addEventListener("keydown",W),()=>{window.removeEventListener("keydown",W),N.current&&clearTimeout(N.current)}},[o]);let te=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),H=()=>{let W=i.trim().split(`
303
+ `)[0]||"",b=Ot({title:"[Bug] "+(W.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Ht({description:i,diagnostics:p,version:v})});try{window.open(b,"_blank","noopener")}catch{G(t("fbCopyFail"))}},ye=async()=>{await Kt(p)?(w(""),G(t("fbCopiedDiag"))):(w(p),G(t("fbCopyManual")))},$=async()=>{let W=Wt({lang:te,description:i,diagnostics:p});await Kt(W)?(w(""),G(t("fbCopiedPrompt"))):(w(W),G(t("fbCopyManual")))},J={width:"100%",resize:"vertical",padding:"8px 10px",borderRadius:10,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:13},be={margin:0,maxHeight:170,overflow:"auto",fontSize:11.5,lineHeight:1.55,padding:"8px 10px",borderRadius:10,background:"var(--dsw-alias-bg-layer-1, rgba(127,127,127,0.08))",whiteSpace:"pre-wrap"};return(0,e.jsxs)("div",{className:"me-overlay",onClick:o,children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:W=>W.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:["\u{1F41E} ",t("fbTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:o,children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10},children:[(0,e.jsx)("div",{style:{fontSize:12,opacity:.72,lineHeight:1.6},children:t("fbWhy")}),(0,e.jsx)("textarea",{value:i,onChange:W=>g(W.target.value),placeholder:t("fbDesc"),rows:5,style:J}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("fbDiag")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:ye,disabled:!p,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:be,children:x?t("fbLoading"):k?t("fbDiagFail"):p})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!i.trim()){G(t("fbNeedDesc"));return}H()},style:{borderColor:"var(--dsw-alias-brand-primary, #3b82f6)",color:"var(--dsw-alias-brand-primary, #3b82f6)",fontWeight:600},children:["\u{1F680} ",t("fbOpenIssue")]}),(0,e.jsx)("span",{style:{opacity:.5,fontSize:12},children:t("fbOr")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:$,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),m&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:m}),z&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12,color:"#b45309"},children:["\u26A0 ",t("fbCopyFail")]}),(0,e.jsx)("span",{style:{fontSize:11.5,opacity:.75},children:t("fbCopyManual")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:O,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:L,readOnly:!0,value:z,rows:7,style:J})]})]})]})]})}function Aa({t,card:o,query:i,onClose:g,onDelete:p,onFeedback:l}){(0,n.useEffect)(()=>{let L=N=>{N.key==="Escape"&&g()};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[g]);let{meta:v,body:S}=(0,n.useMemo)(()=>Nt(o.text||""),[o.text]),x=L=>{let N=v.find(([O])=>String(O).toLowerCase()===L);return N?N[1]:""},A=Ft(x("tags")),k=x("kind")||"knowledge",y=(x("status")||"approved").toLowerCase(),m=Ue[k]||"#6B7280",M=(S||"").length>460,[z,w]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:g,children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{className:"me-dialog",onClick:L=>L.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:wt[k]||"\u{1F4CE}"}),o.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[i&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>l&&l(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>l&&l(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),M&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":z,onClick:()=>w(L=>!L),children:t(z?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&p&&p(o.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:g,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:m,borderColor:m+"59",background:m+"1a"},children:[wt[k]||"\u{1F4CE}"," ",t(Ee[k]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(y==="approved"?"md-chip-st-ok":y==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[y==="approved"?"\u2705":y==="pending"?"\u23F3":"\u26D4"," ",t(y==="approved"?"statusApproved":y==="pending"?"statusPending":"statusRejected")]}),A.slice(0,8).map(L=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",L]},L)),!!x("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",lt(x("updated"))]}),!!x("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",x("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:z?{}:{maxHeight:300,overflow:"hidden"},onClick:z?void 0:L=>{L.stopPropagation(),w(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:jt(S)}})}),!z&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:L=>{L.stopPropagation(),w(!0)},children:[t("expand")," \u2304"]})]})]})}function Ba({t,onOpen:o,all:i,onAllChange:g,onMutate:p,active:l,visible:v}){let[S,x]=(0,n.useState)(null),[A,k]=(0,n.useState)(""),y=(0,n.useRef)(!1),m=(0,n.useRef)(0),M=(0,n.useRef)(t);M.current=t;let z=(0,n.useCallback)(async()=>{try{y.current=!1;let O=await(await fetch(`${Y}/graph${i?"?all=1":""}`)).json();O.ok?(x(O),k(""),y.current=!0):(x(null),k(O.error||t("error")))}catch(N){k(String(N&&N.message?N.message:N))}},[i,t]);(0,n.useEffect)(()=>{if(!l||y.current)return;let N=!0;return fetch(`${Y}/graph${i?"?all=1":""}`).then(O=>O.json()).then(O=>{N&&(O.ok?(x(O),k(""),y.current=!0):(x(null),k(O.error||t("error"))))}).catch(O=>{N&&k(String(O&&O.message?O.message:O))}),()=>{N=!1}},[i,t,l]),(0,n.useEffect)(()=>{v&&S&&m.current++},[v,S]);let w=(0,n.useCallback)(async N=>{try{let G=await(await fetch(`${Y}/delete?path=${encodeURIComponent(N)}`)).json();return G&&G.ok?(await z(),p&&p(),!0):!1}catch{return!1}},[z]),L=(0,n.useCallback)(async N=>{if(!N||N.length<2)return!1;try{let O=await fetch(`${Y}/merge?paths=${encodeURIComponent(N.join(","))}`).then(G=>G.json());return O&&O.ok?(await z(),p&&p(),!0):!1}catch{return!1}},[z,p]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Ie}),A&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",A]}),!S&&!A&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),S&&S.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),S&&S.nodes.length>0&&(0,e.jsx)(Pa,{nodes:S.nodes,edges:S.edges,onOpen:o,onDelete:w,onMerge:L,t,all:i,onAllChange:g,countLabel:`${S.nodes.length} ${t("nodes")} \xB7 ${Ra(S.edges)} ${t("edges")}`,fitTrigger:m.current})]})}function Ra(t){let o=new Set;for(let i of t||[])o.add([i.source,i.target].sort().join("|"));return o.size}var it={colors:{project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},shapes:{project:"circle",knowledge:"circle",content:"rect",prompt:"diamond",business:"hexagon",tool:"circle",mistake:"diamond",other:"circle"}};function Pa({nodes:t,edges:o,onOpen:i,onDelete:g,onMerge:p,t:l,countLabel:v,all:S,onAllChange:x,fitTrigger:A}){let k=(0,n.useRef)(null),y=(0,n.useRef)(null),m=(0,n.useRef)(null),M=(0,n.useRef)(null),z=(0,n.useRef)(null),w=(0,n.useRef)(i);(0,n.useEffect)(()=>{w.current=i},[i]);let L=(0,n.useRef)(g);(0,n.useEffect)(()=>{L.current=g},[g]);let N=(0,n.useRef)(p);(0,n.useEffect)(()=>{N.current=p},[p]);let[O,G]=(0,n.useState)(""),[te,H]=(0,n.useState)(null),ye=(0,n.useRef)("");(0,n.useEffect)(()=>{ye.current=O.trim().toLowerCase()},[O]),(0,n.useEffect)(()=>{let s=m.current;if(!s)return;let r=O.trim().toLowerCase();if(!r)return;let D=s.nodes.find(U=>(U.name||"").toLowerCase().includes(r));D&&(m.current.selectedId=D.id,H(D.id),s.panX=s.w/2-D.x*s.zoom,s.panY=s.h/2-D.y*s.zoom,s.render&&s.render())},[O]);let[$,J]=(0,n.useState)("all"),[be,W]=(0,n.useState)(!1),b=(0,n.useRef)("all"),[f,E]=(0,n.useState)(""),K=(0,n.useRef)(""),[_,B]=(0,n.useState)(!1),ee=(0,n.useRef)(!1),[Q,le]=(0,n.useState)(null);(0,n.useEffect)(()=>{b.current=$},[$]),(0,n.useEffect)(()=>{K.current=f},[f]),(0,n.useEffect)(()=>{ee.current=_},[_]);let Ve=(0,n.useMemo)(()=>{let s=new Map;for(let r of t)for(let D of r.tags||[]){let U=String(D).trim();U&&s.set(U,(s.get(U)||0)+1)}return[...s.entries()].sort((r,D)=>D[1]-r[1]).slice(0,24).map(([r,D])=>({tag:r,n:D}))},[t]),qe=(()=>{let s=O.trim().toLowerCase();return!!s&&!t.some(r=>(r.title||r.name||"").toLowerCase().includes(s)||String(r.kind||"").toLowerCase().includes(s)||String(Ee[r.kind]||"").toLowerCase().includes(s))})();(0,n.useEffect)(()=>{let s=m.current;s&&s.wake&&s.wake()},[O]),(0,n.useEffect)(()=>{let s=m.current;s&&s.render&&s.render()},[$,f,_]);let De=(0,n.useRef)(null),[Be,he]=(0,n.useState)([]),[xe,me]=(0,n.useState)(null),[Ce,Fe]=(0,n.useState)(!1),[Se,Re]=(0,n.useState)(null),[Xe,We]=(0,n.useState)(""),re=(0,n.useRef)(null),ce=(0,n.useRef)(null),d=(s,r=!0)=>{re.current&&clearTimeout(re.current),Re({msg:s,ok:r}),re.current=setTimeout(()=>Re(null),1900)},R=s=>{We(s),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>We(""),1600)};(0,n.useEffect)(()=>()=>{re.current&&clearTimeout(re.current),ce.current&&clearTimeout(ce.current)},[]);let P=(0,n.useMemo)(()=>t.reduce((s,r)=>(s[r.id]=r,s),{}),[t]);return(0,n.useEffect)(()=>{let s=k.current;if(!s||t.length===0)return;let r=s.getContext("2d");if(!r)return;let D=Math.max(1,window.devicePixelRatio||1),U=()=>document.documentElement.getAttribute("data-theme")==="dark",se={};o.forEach(c=>{se[c.source]=(se[c.source]||0)+1,se[c.target]=(se[c.target]||0)+1});let we=Math.max(1,...Object.values(se)),a={nodes:t.map(c=>({id:c.id,name:c.title||"",type:c.kind||"other",r:9+Math.min(10,(se[c.id]||0)/we*8),x:0,y:0,vx:0,vy:0})),edges:o.map(c=>({sourceNodeId:c.source,targetNodeId:c.target,weight:1})),panX:0,panY:0,zoom:1,running:!0,raf:0,tickCount:0,quietTicks:0,dragNode:null,selectedId:null,mouseX:0,mouseY:0,w:0,h:0,dpr:D,ctx:r,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((c,I)=>(c[I.id]=I,c),{}),a.nodes.forEach((c,I)=>{let C=I/a.nodes.length*Math.PI*2-Math.PI/2;c.x=Math.cos(C)*60,c.y=Math.sin(C)*60});let Ze=[...new Set(a.nodes.map(c=>c.type))];a.clustered=Ze.length>1,a.typeCenters={},Ze.forEach((c,I)=>{let C=I/Ze.length*Math.PI*2-Math.PI/2;a.typeCenters[c]={x:Math.cos(C)*160,y:Math.sin(C)*160}}),m.current=a;let st=0,mt=0,gt=()=>{let c=s.clientWidth,I=s.clientHeight;a.w=c,a.h=I,s.width=c*D,s.height=I*D,r.setTransform(D,0,0,D,0,0),(st===0||mt===0)&&c>0&&I>0&&a.tickCount>0&&requestAnimationFrame(()=>pe()),st=c,mt=I};gt();let ft=new ResizeObserver(gt);ft.observe(s.parentElement);let h=(c,I)=>c&&c.length>I?c.slice(0,I)+"\u2026":c,F=(c,I,C,T)=>{if(r.beginPath(),T==="rect")r.rect(c-C,I-C*.75,C*2,C*1.5);else if(T==="diamond")r.moveTo(c,I-C),r.lineTo(c+C,I),r.lineTo(c,I+C),r.lineTo(c-C,I),r.closePath();else if(T==="hexagon"){for(let j=0;j<6;j++){let ae=Math.PI/3*j-Math.PI/2,V=c+C*Math.cos(ae),fe=I+C*Math.sin(ae);j===0?r.moveTo(V,fe):r.lineTo(V,fe)}r.closePath()}else r.arc(c,I,C,0,Math.PI*2)},Z=new Map,Ne=(c,I)=>{let C=c+"|"+Math.round(I),T=Z.get(C);if(!T){let j=parseInt(c.slice(1,3),16),ae=parseInt(c.slice(3,5),16),V=parseInt(c.slice(5,7),16);T=r.createRadialGradient(-I*.3,-I*.3,0,0,0,I*1.2),T.addColorStop(0,"rgba("+Math.min(255,j+70)+","+Math.min(255,ae+70)+","+Math.min(255,V+70)+",0.95)"),T.addColorStop(1,c),Z.set(C,T)}return T},pe=()=>{if(!a.nodes.length)return;let c=1/0,I=-1/0,C=1/0,T=-1/0;a.nodes.forEach(Le=>{c=Math.min(c,Le.x),I=Math.max(I,Le.x),C=Math.min(C,Le.y),T=Math.max(T,Le.y)});let j=20,ae=I-c+j*2,V=T-C+j*2,fe=Math.min(a.w/ae,a.h/V);a.zoom=Math.max(.35,Math.min(1.8,fe)),a.panX=a.w/2-(c+I)/2*a.zoom,a.panY=a.h/2-(C+T)/2*a.zoom};M.current=pe;let ue=()=>{r.clearRect(0,0,a.w,a.h),a.searchTerm=ye.current,a.kindFilter=b.current,a.timeMode=ee.current,a.tagFilter=K.current;let c=a.tagFilter,I=a.kindFilter,C=u=>String(u||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");r.save(),r.strokeStyle=U()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",r.lineWidth=.5;for(let u=0;u<a.w;u+=24)r.beginPath(),r.moveTo(u,0),r.lineTo(u,a.h),r.stroke();for(let u=0;u<a.h;u+=24)r.beginPath(),r.moveTo(0,u),r.lineTo(a.w,u),r.stroke();r.restore(),r.save(),r.translate(a.panX,a.panY),r.scale(a.zoom,a.zoom);let T={};a.nodes.forEach(u=>T[u.id]=u);let j=a.nodes.length>40,ae=j?1.5:.55,V=a.selectedId||a.hoverId,fe=$t({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),Le=(()=>{let u=(a.searchTerm||"").toLowerCase();if(!u)return null;let q=[];for(let X of a.nodes){let de=(a.domainById[X.id]||{}).kind||"other";if(((X.name||"").toLowerCase().includes(u)||String(Ee[de]||"").toLowerCase().includes(u)||String(de).toLowerCase().includes(u))&&q.push(X.id),q.length>200)break}return q})(),Ge=Ut(a.nodes,{limit:_t(a.nodes.length),focusId:V,hoverId:a.hoverId,searchHits:Le,degree:se}),ne=new Map,ie=(u,q)=>{let X=u+"|"+q,oe=ne.get(X);return oe===void 0&&(r.font=u,oe=r.measureText(q).width,ne.set(X,oe)),oe},Me=a.nodes.length<=250,Te=new Map;a.edges.forEach(u=>{let q=T[u.sourceNodeId],X=T[u.targetNodeId];if(!q||!X||!vt(q.x,q.y,10,fe)&&!vt(X.x,X.y,10,fe))return;if(I!=="all"){let tt=a.domainById[u.sourceNodeId]&&a.domainById[u.sourceNodeId].kind,He=a.domainById[u.targetNodeId]&&a.domainById[u.targetNodeId].kind;if(tt!==I&&He!==I)return}if(c){let tt=a.domainById[u.sourceNodeId]&&(a.domainById[u.sourceNodeId].tags||[]).includes(c),He=a.domainById[u.targetNodeId]&&(a.domainById[u.targetNodeId].tags||[]).includes(c);if(!tt&&!He)return}let oe=X.x-q.x,de=X.y-q.y,ke=Math.sqrt(oe*oe+de*de)||1,_e=j?12:18,Ye=-de/ke*_e,bt=oe/ke*_e,yt=(q.x+X.x)/2+Ye,ht=(q.y+X.y)/2+bt,dt=it.colors[a.domainById[q.id]&&a.domainById[q.id].kind||"other"],ct=V&&(u.sourceNodeId===V||u.targetNodeId===V),kt=V?ct?.6:.08:j?.14:.24,Oe=parseInt(dt.slice(1,3),16),pt=parseInt(dt.slice(3,5),16),Ct=parseInt(dt.slice(5,7),16),Pe=ct?1.6+(u.weight||1):.8+(u.weight||1)*.5,Je=Oe+","+pt+","+Ct+","+kt+","+Pe,Ae=Te.get(Je);Ae||(Ae={path:new Path2D,stroke:"rgba("+Oe+","+pt+","+Ct+","+kt+")",width:Pe},Te.set(Je,Ae)),Ae.path.moveTo(q.x,q.y),Ae.path.quadraticCurveTo(yt,ht,X.x,X.y)}),Te.forEach(u=>{r.strokeStyle=u.stroke,r.lineWidth=u.width,r.stroke(u.path)});let ze=null;V&&(ze=new Set,a.edges.forEach(u=>{u.sourceNodeId===V?ze.add(u.targetNodeId):u.targetNodeId===V&&ze.add(u.sourceNodeId)}));let je=[];if(a.nodes.forEach(u=>{if(!vt(u.x,u.y,u.r+2,fe))return;let q=a.domainById[u.id]||{},X=q.kind||"other",oe=a.timeMode?Ea(q.updated):it.colors[X],de=it.shapes[X],ke=a.selectedId===u.id,_e=a.hoverId===u.id,Ye=a.searchTerm||"",bt=!Ye||(u.name||"").toLowerCase().includes(Ye)||String(Ee[X]||"").toLowerCase().includes(Ye)||String(X).toLowerCase().includes(Ye),yt=I==="all"||X===I,ht=!c||(q.tags||[]).includes(c),dt=V&&u.id!==V&&!(ze&&ze.has(u.id))||Ye&&!bt||!yt||!ht;r.save(),r.globalAlpha=dt?.08:1,(ke||_e)&&Me&&(r.shadowColor=oe,r.shadowBlur=ke?20:14),r.translate(u.x,u.y),F(0,0,u.r,de),r.fillStyle=Ne(oe,u.r),r.fill(),r.restore(),ke?(r.save(),F(u.x,u.y,u.r+3,de),r.strokeStyle=oe,r.lineWidth=3,r.shadowColor=oe,r.shadowBlur=12,r.stroke(),r.restore()):_e?(r.save(),F(u.x,u.y,u.r+2,de),r.strokeStyle=oe,r.lineWidth=2,r.stroke(),r.restore()):Ye&&bt?(r.save(),F(u.x,u.y,u.r+2,de),r.strokeStyle="#e11d48",r.lineWidth=2,r.stroke(),r.restore()):a.multi.indexOf(u.id)>=0&&(r.save(),F(u.x,u.y,u.r+2,de),r.strokeStyle="#60a5fa",r.lineWidth=2,r.shadowColor="#60a5fa",r.shadowBlur=8,r.stroke(),r.restore());let ct=h(u.name,16);if((ke||_e||Ge.has(u.id)&&a.zoom>ae||!j&&a.zoom>.6)&&yt&&ht){let Oe=1/a.zoom,pt="500 "+(12*Oe).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";r.font=pt;let Pe=ie(pt,ct)+16*Oe,Je=18*Oe,Ae=u.y+u.r+8*Oe,tt=!0;for(let He of je)if(u.x-Pe/2<He.x+He.w&&u.x+Pe/2>He.x&&Ae<He.y+He.h&&Ae+Je>He.y){tt=!1;break}if(!tt&&!ke&&!_e)return;je.push({x:u.x-Pe/2,y:Ae,w:Pe,h:Je}),r.fillStyle=U()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",r.beginPath(),r.roundRect?r.roundRect(u.x-Pe/2,Ae,Pe,Je,4*Oe):r.rect(u.x-Pe/2,Ae,Pe,Je),r.fill(),r.strokeStyle=U()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",r.lineWidth=1*Oe,r.stroke(),r.fillStyle=U()?ke||_e?"#eee":"#bbb":ke||_e?"#111":"#444",r.textAlign="center",r.fillText(ct,u.x,Ae+13*Oe)}}),r.restore(),a.marquee){let u=a.marquee,q=Math.min(u.sx,u.ex),X=Math.min(u.sy,u.ey),oe=Math.abs(u.ex-u.sx),de=Math.abs(u.ey-u.sy);r.save(),r.setLineDash([4,4]),r.strokeStyle="rgba(96,165,250,0.9)",r.lineWidth=1,r.fillStyle="rgba(96,165,250,0.12)",r.fillRect(q,X,oe,de),r.strokeRect(q,X,oe,de),r.restore()}if(a.hoverId&&De.current){let u=a.domainById[a.hoverId],q=a.nodes.find(function(X){return X.id===a.hoverId});if(u&&q){let X=a.edges.filter(function(ke){return ke.sourceNodeId===u.id||ke.targetNodeId===u.id}).length,oe=q.x*a.zoom+a.panX,de=q.y*a.zoom+a.panY;De.current.style.display="block",De.current.style.left=oe+14+"px",De.current.style.top=de-6+"px",De.current.innerHTML="<b>"+C(u.title||u.name||"")+'</b><br/><span style="opacity:.8">'+C(u.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",X)+"</span>"}}else De.current&&(De.current.style.display="none")},ge=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame($e))};a.wake=ge,a.render=ue;let Ke=()=>{let c=a.nodes.length;a.tickCount++;let C=.9-Math.min(.4,a.tickCount/1500),T=c>1e3?3e3:c>100?2e3:c>50?1200:800,j=c>100?.002:.005,ae=c>1e3?.012:c>100?.005:.01,V=c>1e3?6:c>200?12:24,fe={};a.nodes.forEach(ne=>fe[ne.id]=ne);for(let ne=0;ne<c;ne++){if(a.dragNode===a.nodes[ne])continue;let ie=a.nodes[ne],Me=0,Te=0;for(let u=0;u<c;u++){if(ne===u)continue;let q=ie.x-a.nodes[u].x,X=ie.y-a.nodes[u].y,oe=Math.sqrt(q*q+X*X)||1,de=T/(oe*oe);Me+=q/oe*de,Te+=X/oe*de}if(a.clustered&&a.typeCenters[ie.type]){let u=a.typeCenters[ie.type];Me+=(u.x-ie.x)*.006,Te+=(u.y-ie.y)*.006}else Me-=ie.x*ae,Te-=ie.y*ae;let ze=(ie.vx+Me)*C,je=(ie.vy+Te)*C;ze=Math.max(-V,Math.min(V,ze)),je=Math.max(-V,Math.min(V,je)),ie.vx=ze,ie.vy=je}a.edges.forEach(ne=>{let ie=fe[ne.sourceNodeId],Me=fe[ne.targetNodeId];if(!ie||!Me)return;let Te=Me.x-ie.x,ze=Me.y-ie.y,je=Math.sqrt(Te*Te+ze*ze)||1,u=(je-100)*j,q=Te/je*u,X=ze/je*u;a.dragNode!==ie&&(ie.vx+=q,ie.vy+=X),a.dragNode!==Me&&(Me.vx-=q,Me.vy-=X)});let Le=0;a.nodes.forEach(ne=>{a.dragNode!==ne&&(ne.x+=ne.vx,ne.y+=ne.vy,Le+=ne.vx*ne.vx+ne.vy*ne.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,pe()),(c?Math.sqrt(Le/c):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},$e=()=>{if(a.running){try{Ke(),ue()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame($e)}},ve=(c,I)=>{let C=s.getBoundingClientRect();return{x:(c-C.left-a.panX)/a.zoom,y:(I-C.top-a.panY)/a.zoom}},Qe=c=>{let I=a.domainById[c];return!(!I||b.current!=="all"&&I.kind!==b.current||K.current&&!(I.tags||[]).includes(K.current))},et=(c,I,C)=>Math.max(I,Math.min(C,c)),Dt=c=>{a.mouseX=c.clientX,a.mouseY=c.clientY;let I=ve(c.clientX,c.clientY),C=null;for(let T=a.nodes.length-1;T>=0;T--){let j=a.nodes[T];if(!Qe(j.id))continue;let ae=j.x-I.x,V=j.y-I.y;if(ae*ae+V*V<j.r*j.r+36){C=j.id;break}}C!==a.hoverId&&(a.hoverId=C,ge())},Lt=c=>{if(c.button!==0)return;let I=ve(c.clientX,c.clientY),C=null;for(let T=a.nodes.length-1;T>=0;T--){let j=a.nodes[T];if(!Qe(j.id))continue;let ae=j.x-I.x,V=j.y-I.y;if(ae*ae+V*V<j.r*j.r+25){C=j;break}}if(c.shiftKey){if(C){a.shiftClick=C.id;return}a.marquee={sx:c.clientX,sy:c.clientY,ex:c.clientX,ey:c.clientY};return}a.dragStart={x:c.clientX,y:c.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=C||null,C&&(a.dragOffset={dx:C.x-I.x,dy:C.y-I.y})},Tt=c=>{if(a.marquee){a.marquee.ex=c.clientX,a.marquee.ey=c.clientY,ge();return}if(!a.dragStart)return;let I=c.clientX-a.dragStart.x,C=c.clientY-a.dragStart.y;if(Math.abs(I)+Math.abs(C)>3&&(a.dragging=!0),a.dragNode){let T=ve(c.clientX,c.clientY);a.dragNode.x=T.x+a.dragOffset.dx,a.dragNode.y=T.y+a.dragOffset.dy,ge()}else a.dragging&&(a.panX=et(a.dragStart.px+I,-1e5,1e5),a.panY=et(a.dragStart.py+C,-1e5,1e5),ge())},At=c=>{if(a.marquee){let C=a.marquee;a.marquee=null;let T=s.getBoundingClientRect(),j=Math.min(C.sx,C.ex)-T.left,ae=Math.max(C.sx,C.ex)-T.left,V=Math.min(C.sy,C.ey)-T.top,fe=Math.max(C.sy,C.ey)-T.top,Le=a.nodes.filter(Ge=>{let ne=Ge.x*a.zoom+a.panX,ie=Ge.y*a.zoom+a.panY;return ne>=j&&ne<=ae&&ie>=V&&ie<=fe}).map(Ge=>Ge.id);a.multi=Le,he(Le),ge();return}let I=a.dragStart&&!a.dragging;if(a.shiftClick){let C=a.shiftClick;a.shiftClick=null;let T=Array.isArray(a.multi)?a.multi.slice():[];T.includes(C)||T.push(C),a.multi=T,he(T),ge();return}if(I){let C=ve(c.clientX,c.clientY),T=null;for(let j=a.nodes.length-1;j>=0;j--){let ae=a.nodes[j];if(!Qe(ae.id))continue;let V=ae.x-C.x,fe=ae.y-C.y;if(V*V+fe*fe<ae.r*ae.r+20){T=ae;break}}T?(a.selectedId=T.id,H(T.id),ge()):(a.selectedId=null,a.hoverId=null,c.shiftKey||(a.multi=[],he([])),H(null),ge())}a.dragStart=null,a.dragging=!1,a.dragNode=null},Bt=c=>{c.preventDefault();let I=ve(c.clientX,c.clientY),C=null;for(let T=a.nodes.length-1;T>=0;T--){let j=a.nodes[T];if(!Qe(j.id))continue;let ae=j.x-I.x,V=j.y-I.y;if(ae*ae+V*V<j.r*j.r+25){C=j;break}}if(C){let T=a.domainById[C.id];T&&le({x:c.clientX,y:c.clientY,id:C.id,path:T.id,title:T.title})}else le(null)},Rt=c=>{c.preventDefault();let I=s.getBoundingClientRect(),C=(c.clientX-I.left-a.panX)/a.zoom,T=(c.clientY-I.top-a.panY)/a.zoom,j=Math.max(.3,Math.min(3,a.zoom*(c.deltaY<0?1.1:1/1.1)));a.panX=et(a.panX+C*(a.zoom-j),-1e5,1e5),a.panY=et(a.panY+T*(a.zoom-j),-1e5,1e5),a.zoom=j,ge()};s.addEventListener("mousemove",Dt),s.addEventListener("mousedown",Lt),window.addEventListener("mousemove",Tt),window.addEventListener("mouseup",At),s.addEventListener("wheel",Rt,{passive:!1}),s.addEventListener("contextmenu",Bt),z.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],he([]),pe(),ge()};for(let c=0;c<200;c++)Ke();pe(),ge();let Pt=()=>W(!1);return window.addEventListener("mousedown",Pt),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),ft.disconnect(),s.removeEventListener("mousemove",Dt),s.removeEventListener("mousedown",Lt),window.removeEventListener("mousemove",Tt),window.removeEventListener("mouseup",At),s.removeEventListener("wheel",Rt),s.removeEventListener("contextmenu",Bt),window.removeEventListener("mousedown",Pt)}},[t,o]),(0,n.useEffect)(()=>{A!==void 0&&M.current&&requestAnimationFrame(()=>M.current())},[A]),(0,e.jsxs)("div",{className:"me-graph",ref:y,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",l("nodes")," \xB7 ",o.length," ",l("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:l("search"),value:O,onChange:s=>G(s.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>W(s=>!s),"aria-expanded":be,title:l("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",l("filterLabel")," ",$!=="all"||_||f?"\u25CF":"\u25BE"]}),be&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:s=>s.stopPropagation(),style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:50,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,padding:8,minWidth:240,boxShadow:"0 12px 34px rgba(0,0,0,.35)"},children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,e.jsx)("button",{type:"button",className:`lg${$==="all"&&!_?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{J("all"),B(!1)},children:l("all")}),Object.keys(Ue).map(s=>(0,e.jsxs)("button",{type:"button",className:`lg${$===s?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>J(r=>r===s?"all":s),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:it.colors[s]||Ue[s]}}),l(Ee[s])]},s)),(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsxs)("button",{type:"button",className:`lg${_?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>B(s=>!s),children:["\u23F1 ",l("timeDim")]}),Ve.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsx)("div",{style:{maxHeight:130,overflow:"auto",display:"flex",flexWrap:"wrap",gap:4},children:Ve.map(s=>(0,e.jsxs)("button",{type:"button",className:`lg${f===s.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>E(r=>r===s.tag?"":s.tag),title:s.tag,children:["#",s.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:s.n})]},s.tag))})]}),($!=="all"||_||f)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{J("all"),B(!1),E("")},children:[l("clearFilter")," \u2715"]})]})})]}),(0,e.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:l("crossVault"),children:[(0,e.jsx)("input",{type:"checkbox",checked:!!S,onChange:s=>x&&x(s.target.checked)}),l("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${_?" me-on":""}`,onClick:()=>B(s=>!s),children:l("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=k.current;if(s)try{s.toBlob(r=>{r&&me({url:URL.createObjectURL(r),blob:r})},"image/png")}catch{}},children:l("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>M.current&&M.current(),children:l("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{H(null),J("all"),z.current&&z.current()},children:l("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:k,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:De,style:{display:"none",position:"absolute",zIndex:4,pointerEvents:"none",background:"rgba(28,28,32,0.88)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:8,padding:"7px 10px",fontSize:12,maxWidth:220,boxShadow:"0 8px 24px rgba(0,0,0,.2)"}}),qe&&(0,e.jsx)("div",{className:"mc-empty",style:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)"},children:l("noMatch")}),Q&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>le(null)}),Q&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:Q.x,top:Q.y,zIndex:31},onMouseDown:s=>s.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{w.current({path:Q.path,title:Q.title}),le(null)},children:l("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{Q.id&&(m.current.selectedId=Q.id,H(Q.id)),le(null);let s=m.current;s&&s.wake&&s.wake()},children:l("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(Q.title||"")}catch{}le(null),d(l("copied"))},children:l("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let s=m.current,r=s&&Array.isArray(s.multi)?s.multi.slice():[],D=Q.id;if(D&&!r.includes(D)&&r.push(D),le(null),r.length<2){d(l("mergeNeed"),!1);return}if(!window.confirm(l("mergeConfirm")))return;let U=N.current&&N.current(r);U&&U.then?U.then(se=>se?d(l("merged")):d(l("mergeFail"),!1)).catch(()=>d(l("mergeFail"),!1)):U&&d(l("merged"))},children:l("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let s=Q.path;le(null),window.confirm(l("deleteConfirm"))&&(async()=>{try{(L.current?await L.current(s):!1)?d(l("deleted")):d(l("deleteFail"),!1)}catch{d(l("deleteFail"),!1)}})()},children:l("delete")})]}),Be.length>0&&(0,e.jsxs)("div",{style:{position:"absolute",left:10,top:10,zIndex:3,display:"flex",gap:8,alignItems:"center",background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:"6px 10px",fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsxs)("span",{style:{fontWeight:700},children:[Be.length," ",l("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let r=Be.map(we=>P[we]).filter(Boolean).map(we=>we.title||we.name).join(`
304
+ `),D=new Blob([r],{type:"text/plain;charset=utf-8"}),U=URL.createObjectURL(D),se=document.createElement("a");se.href=U,se.download="memory-selected.txt",document.body.appendChild(se),se.click(),document.body.removeChild(se),setTimeout(()=>URL.revokeObjectURL(U),1e3),d(Be.length+l("exportedSel"))},children:l("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(Be.length<2){d(l("mergeNeed"),!1);return}let s=Be.map(D=>P[D]?P[D].id:D);if(!window.confirm(l("mergeConfirm")))return;he([]);let r=m.current;r&&(r.multi=[]),fetch(`${Y}/merge?paths=${encodeURIComponent(s.join(","))}`).then(D=>D.json()).then(D=>{D&&D.ok?d(l("merged")):d(l("mergeFail"),!1)}).catch(()=>d(l("mergeFail"),!1))},children:l("merge")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(l("deleteConfirm")))return;let s=Be.map(D=>P[D]?P[D].id:D);he([]);let r=m.current;r&&(r.multi=[]),(async()=>{let D=0;for(let U of s)try{(L.current?await L.current(U):!1)&&D++}catch{}d(D+l("deletedSelected"),D>0)})()},children:l("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=m.current;s&&(s.multi=[]),he([]);let r=m.current;r&&r.render&&r.render()},children:l("clearSelection")})]}),te&&(0,e.jsxs)("div",{className:"me-graph-sidebar",style:{position:"absolute",right:10,top:10,zIndex:3,maxWidth:240,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:12,fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsx)("div",{style:{fontWeight:700,fontSize:13,marginBottom:4},children:P[te]?P[te].title||P[te].name:te}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:P[te]?l(Ee[P[te].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:l("graphHint")}),(o.filter(s=>s.source===te||s.target===te)||[]).slice(0,8).map((s,r)=>{let D=s.source===te?s.target:s.source,U=P[D];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:se=>{se.preventDefault();let we=m.current;we&&(we.selectedId=D,we.hoverId=D,we.wake&&we.wake()),H(D)},children:U?(U.title||U.name).slice(0,28):D},r)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:l("graphTip")}),Se&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(Se.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:Se.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:Se.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:Se.msg})]}),xe&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{xe.url&&URL.revokeObjectURL(xe.url),me(null),Fe(!1)},children:[(0,e.jsx)("style",{children:Ie}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:Ce?"100vw":900,width:Ce?"100vw":"92vw",maxHeight:Ce?"100%":"90vh",height:Ce?"100%":void 0,borderRadius:Ce?0:14},onClick:s=>s.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:l("exportGraph")}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("a",{className:"mc-btn",href:xe.url,download:"memory-graph.png",onClick:()=>{R("download"),d(l("downloaded")+" \xB7 "+l("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:l(Xe==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{R("full"),Fe(s=>!s),d(l("fullscreen"))},children:l(Xe==="full"?"done":Ce?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=xe.blob;s&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":s})]).then(()=>{R("copy"),d(l("copied"))}).catch(()=>{d(l("copyFail"),!1)}):d(l("copyFail"),!1)},children:l(Xe==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{xe.url&&URL.revokeObjectURL(xe.url),me(null),Fe(!1)},children:l("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Ce?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,e.jsx)("img",{src:xe.url,alt:l("exportGraph"),style:{maxWidth:"100%",maxHeight:Ce?"calc(100% - 64px)":"70vh",borderRadius:Ce?0:8,cursor:"zoom-in"},onClick:()=>Fe(s=>!s)})})]})]})]})}function Ea(t){let o=new Date(t||0).getTime();if(!o)return"#94a3b8";let i=(Date.now()-o)/864e5;return i<3?"#10b981":i<14?"#f59e0b":i<30?"#f97316":"#94a3b8"}function Yt({label:t,value:o=[],options:i,onChange:g,placeholder:p,z:l=20}){let[v,S]=(0,n.useState)(!1),x=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!v)return;let w=L=>{x.current&&!x.current.contains(L.target)&&S(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[v]);let A=Array.isArray(o)?o:[],k=A.includes("__all__"),y=k?i.find(w=>w.value==="__all__")?.label||"":A.length?A.map(w=>i.find(L=>L.value===w)?.label||w).join("\u3001"):"",m=(w,L)=>{if(w.value==="__all__"){g(L?["__all__"]:[]);return}let N=new Set(A);N.has("__all__")&&N.delete("__all__"),L?N.add(w.value):N.delete(w.value),g([...N])},M=i.find(w=>w.value==="__all__"),z=i.filter(w=>w.value!=="__all__");return(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t}),(0,e.jsxs)("div",{ref:x,style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>S(w=>!w),style:{width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[(0,e.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y||p||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),v&&(0,e.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:l,marginTop:2,borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",boxShadow:"0 6px 20px rgba(0,0,0,0.14)",maxHeight:180,overflow:"auto"},children:[M&&(0,e.jsxs)("label",{onClick:w=>w.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("input",{type:"checkbox",checked:k,onChange:w=>m(M,w.target.checked)}),(0,e.jsx)("span",{children:M.label})]}),z.map(w=>(0,e.jsxs)("label",{onClick:L=>L.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:A.includes(w.value),onChange:L=>m(w,L.target.checked)}),(0,e.jsx)("span",{children:w.label})]},w.value))]})]})]})}function Fa(t){let o=new Date(t||0).getTime();return!!o&&(Date.now()-o)/864e5<3}async function ja(t,o,i){if(i&&typeof window.showSaveFilePicker=="function")try{let l=await window.showSaveFilePicker({suggestedName:o}),v=await l.createWritable();return await v.write(t),await v.close(),{ok:!0,picked:!0,name:l.name}}catch(l){return l&&l.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(l.message||l)}}let g=URL.createObjectURL(t),p=document.createElement("a");return p.href=g,p.download=o,document.body.appendChild(p),p.click(),document.body.removeChild(p),setTimeout(()=>URL.revokeObjectURL(g),1e3),{ok:!0,picked:!1,name:o}}function Vt(t,o){if(!o||!t)return t;let i=t.toLowerCase(),g=o.toLowerCase(),p=[],l=0;for(;l<t.length;){let v=i.indexOf(g,l);if(v<0){p.push(t.slice(l));break}v>l&&p.push(t.slice(l,v)),p.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(v,v+g.length)},v)),l=v+g.length}return p}function lt(t){if(!t)return"";let o=new Date(t);if(Number.isNaN(o.getTime()))return"";let i=new Date,g=o.toDateString()===i.toDateString(),p=v=>String(v).padStart(2,"0"),l=`${p(o.getHours())}:${p(o.getMinutes())}`;return g?l:`${o.getMonth()+1}-${o.getDate()} ${l}`}
305
305
 
306
306
  return module.exports;
307
307
  },