@aalis/plugin-webui-client 0.11.2 → 0.12.1
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/dist/assets/{AuthorityPage-BKfFvBWU.js → AuthorityPage-BQDYg1E1.js} +1 -1
- package/dist/assets/DynamicPage-DO0WnqVF.js +19 -0
- package/dist/assets/{FilesPage-TnRIpbLe.js → FilesPage-BNn0PjPx.js} +1 -1
- package/dist/assets/MarketplacePage-HbYZZCz_.js +6 -0
- package/dist/assets/{PlatformPage-D47Tlyot.js → PlatformPage-DEnexgD7.js} +1 -1
- package/dist/assets/{PluginConfigPage-iTmGGHZb.js → PluginConfigPage-D_MBDTbB.js} +1 -1
- package/dist/assets/{SessionsPage-BsoBBLVX.js → SessionsPage-BmA9dlNT.js} +1 -1
- package/dist/assets/{arc-C8FYpW_k.js → arc-DnVU9gDd.js} +1 -1
- package/dist/assets/{architectureDiagram-3BPJPVTR-CAv5Isoe.js → architectureDiagram-3BPJPVTR-D8geOE_F.js} +1 -1
- package/dist/assets/{blockDiagram-GPEHLZMM-BMkkS1CP.js → blockDiagram-GPEHLZMM-BFbUkYo9.js} +1 -1
- package/dist/assets/{c4Diagram-AAUBKEIU-Cv1li0XO.js → c4Diagram-AAUBKEIU-D-508PnY.js} +1 -1
- package/dist/assets/channel-BugX_IAn.js +1 -0
- package/dist/assets/{chunk-2J33WTMH-COYrBuB8.js → chunk-2J33WTMH-BBSHca43.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-Bv5A4tpJ.js → chunk-4BX2VUAB-CYpAo1Fy.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-CJ9T8Wtu.js → chunk-55IACEB6-CT9vDGm-.js} +1 -1
- package/dist/assets/{chunk-727SXJPM-CtzK3fFt.js → chunk-727SXJPM-Qbj03s5s.js} +1 -1
- package/dist/assets/{chunk-AQP2D5EJ-C-UnOi2J.js → chunk-AQP2D5EJ-D7h7VPGB.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-9CNqmsuy.js → chunk-FMBD7UC4-B-8aZQXh.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-B9JC5LqN.js → chunk-ND2GUHAM-aY4Jm31a.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-BR2ggXBl.js → chunk-QZHKN3VN-Bf1fE05f.js} +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-A8yISGxg.js +1 -0
- package/dist/assets/classDiagram-v2-Q7XG4LA2-A8yISGxg.js +1 -0
- package/dist/assets/{clock-RQMz9x7Y.js → clock-CHmqRkfK.js} +1 -1
- package/dist/assets/{cose-bilkent-S5V4N54A-964iBL_P.js → cose-bilkent-S5V4N54A-CLhPrA-X.js} +1 -1
- package/dist/assets/{dagre-BM42HDAG-D-dsmkCS.js → dagre-BM42HDAG-ldqthtLi.js} +1 -1
- package/dist/assets/{diagram-2AECGRRQ-WNDRTsOY.js → diagram-2AECGRRQ-gVpyidoY.js} +1 -1
- package/dist/assets/{diagram-5GNKFQAL-CY61CWjO.js → diagram-5GNKFQAL-DZO2z7Tj.js} +1 -1
- package/dist/assets/{diagram-KO2AKTUF-DqhL26LE.js → diagram-KO2AKTUF-CdJUd5dD.js} +1 -1
- package/dist/assets/{diagram-LMA3HP47-DxDG5PxW.js → diagram-LMA3HP47-ShvNokM1.js} +1 -1
- package/dist/assets/{diagram-OG6HWLK6-Dx_wiA_a.js → diagram-OG6HWLK6-BAYrIDPL.js} +1 -1
- package/dist/assets/{erDiagram-TEJ5UH35-C4xALfST.js → erDiagram-TEJ5UH35--6H9xqgq.js} +1 -1
- package/dist/assets/{flowDiagram-I6XJVG4X-Di3HNDco.js → flowDiagram-I6XJVG4X-jsKUH1HR.js} +1 -1
- package/dist/assets/{ganttDiagram-6RSMTGT7-HcIheWs9.js → ganttDiagram-6RSMTGT7-DFYCrHNq.js} +1 -1
- package/dist/assets/{gitGraphDiagram-PVQCEYII-CqR1wNgT.js → gitGraphDiagram-PVQCEYII-DuOMKvRu.js} +1 -1
- package/dist/assets/{globe-DkMTwfDx.js → globe-BfItFm6P.js} +1 -1
- package/dist/assets/{index-BwjDBPnu.css → index-D5X2Ahtu.css} +1 -1
- package/dist/assets/{index-C6kOarnb.js → index-pGwN5S79.js} +3 -3
- package/dist/assets/{infoDiagram-5YYISTIA-BL-ae21L.js → infoDiagram-5YYISTIA-CFc4L9CY.js} +1 -1
- package/dist/assets/{ishikawaDiagram-YF4QCWOH-BfwsZs9I.js → ishikawaDiagram-YF4QCWOH-Cpv8QGG-.js} +1 -1
- package/dist/assets/{journeyDiagram-JHISSGLW-CP8pImA1.js → journeyDiagram-JHISSGLW-D_ZYi-l_.js} +1 -1
- package/dist/assets/{kanban-definition-UN3LZRKU-BNKqyzBh.js → kanban-definition-UN3LZRKU-BAu1Iapx.js} +1 -1
- package/dist/assets/{linear-CtHUgwwf.js → linear-CWbLakH9.js} +1 -1
- package/dist/assets/{mermaid.core-DX1iGORO.js → mermaid.core-DCKNrwR3.js} +4 -4
- package/dist/assets/{mindmap-definition-RKZ34NQL-Ctio0c-a.js → mindmap-definition-RKZ34NQL-CwjfqD6z.js} +1 -1
- package/dist/assets/{pieDiagram-4H26LBE5-CDcJO30o.js → pieDiagram-4H26LBE5-iBQqAGdJ.js} +1 -1
- package/dist/assets/{quadrantDiagram-W4KKPZXB-DXF4SFSU.js → quadrantDiagram-W4KKPZXB-Bj5J8IjM.js} +1 -1
- package/dist/assets/{requirementDiagram-4Y6WPE33-BgOuPsQu.js → requirementDiagram-4Y6WPE33-X-8ktpsm.js} +1 -1
- package/dist/assets/{sankeyDiagram-5OEKKPKP-CLHPzDc9.js → sankeyDiagram-5OEKKPKP-DIkb4KbP.js} +1 -1
- package/dist/assets/{sequenceDiagram-3UESZ5HK-D6uVPJgk.js → sequenceDiagram-3UESZ5HK-Hlda4VPB.js} +1 -1
- package/dist/assets/{stateDiagram-AJRCARHV-DD-H-KUD.js → stateDiagram-AJRCARHV-NOKt-PZ_.js} +1 -1
- package/dist/assets/{stateDiagram-v2-BHNVJYJU-DBaAUEk1.js → stateDiagram-v2-BHNVJYJU-BF5REMmu.js} +1 -1
- package/dist/assets/{timeline-definition-PNZ67QCA-DcHy_22Q.js → timeline-definition-PNZ67QCA-CbG_bPsY.js} +1 -1
- package/dist/assets/{vennDiagram-CIIHVFJN-Bsy9pahQ.js → vennDiagram-CIIHVFJN-BVLsgOPX.js} +1 -1
- package/dist/assets/{wardley-L42UT6IY-CzWIZXfj.js → wardley-L42UT6IY-nRiwVAku.js} +1 -1
- package/dist/assets/{wardleyDiagram-YWT4CUSO-DG6xHRb_.js → wardleyDiagram-YWT4CUSO-jStW0NJa.js} +1 -1
- package/dist/assets/{xychartDiagram-2RQKCTM6-Co4crWuM.js → xychartDiagram-2RQKCTM6-bJC2yQYV.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/DynamicPage-1fMN_fFH.js +0 -19
- package/dist/assets/MarketplacePage-ncAn1gdt.js +0 -6
- package/dist/assets/channel-BO20buBp.js +0 -1
- package/dist/assets/classDiagram-4FO5ZUOK-BOHWB_6U.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-BOHWB_6U.js +0 -1
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{r as d,j as e,R as W,a as tt}from"./react-vendor-BPQixOLZ.js";import{c as me,a as ge,p as D,S as nt,W as st}from"./index-C6kOarnb.js";import{S as rt}from"./SchemaForm-BcYxH5r1.js";import{c as $e}from"./cytoscape.esm-LDYqcvCF.js";import{f as at}from"./cytoscape-fcose-DXAQNCkb.js";import{G as ot}from"./globe-DkMTwfDx.js";import{C as it}from"./clock-RQMz9x7Y.js";import{M as lt,r as dt,a as ct}from"./markdown-B2G8c9k5.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";/**
|
|
2
|
-
* @license lucide-react v1.7.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ut=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ht=me("brain",ut);/**
|
|
7
|
-
* @license lucide-react v1.7.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const pt=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],gt=me("chart-no-axes-column",pt);/**
|
|
12
|
-
* @license lucide-react v1.7.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ft=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],yt=me("puzzle",ft);let Pe=!1;function xt(){Pe||($e.use(at),Pe=!0)}function fe(t){if(!Number.isFinite(t)||t===0)return"0";if(Math.abs(t)<.01)return t.toExponential(2);const l=t.toPrecision(3);return l.includes("e")||l.includes("E")?l:l.includes(".")?l.replace(/0+$/,"").replace(/\.$/,""):l}const ye="#60a5fa",ze="#fb923c",V="#ef4444",re="#e4e4ef",xe="#0f0f14",Fe="#6b7280",mt="#1c1c28",_={topic:"#34d399",place:"#a78bfa",thing:"#fbbf24",work:"#f472b6"},bt="#9ca3af",vt=99,De={"person-event":"人 → 事件","person-entity":"人 → 物","person-person":"人 → 人","event-event":"事件 → 事件","event-entity":"事件 → 物","entity-entity":"物 → 物"},Te={initiator:"发起者",participant:"参与者",witness:"旁观者",target:"被指向",reporter:"转述者"},Be={enthusiast:"深度卷入",participant:"参与/使用",owner:"拥有",creator:"创作者",critic:"行为性批评",visitor:"到访",mentioned:"仅被提及"},_e={friend:"朋友",cp:"CP",rival:"对手",mentor:"师徒",colleague:"同事",familiar:"熟人",antagonist:"敌对",admirer:"仰慕者","is-alias-of":"是…的别名","alt-account-of":"是…的小号"},Oe={positive:"积极",negative:"消极",neutral:"中性",mixed:"复杂"},jt={superior:"高位(from 高于 to)",peer:"平级",subordinate:"低位(from 低于 to)",unknown:"未知"};function J(t,s){if(!t)return"";const l=s[t];return l?`${l}(${t})`:t}function kt(t,s){return s?t==="person-event"?J(s,Te):t==="person-entity"?J(s,Be):s:""}const Me=[{selector:"node",style:{label:"data(label)","background-color":ye,color:re,"font-size":11,"text-valign":"bottom","text-margin-y":4,"text-outline-color":xe,"text-outline-width":2,width:"mapData(pageRankScale, 0, 1, 20, 56)",height:"mapData(pageRankScale, 0, 1, 20, 56)","border-width":1,"border-color":"#1e3a8a"}},{selector:'node[kind = "event"]',style:{"background-color":ze,shape:"round-rectangle","border-color":"#9a3412",width:"mapData(pageRankScale, 0, 1, 24, 64)",height:"mapData(pageRankScale, 0, 1, 16, 40)"}},{selector:'node[kind = "entity"]',style:{shape:"diamond","background-color":bt,"border-color":"#374151",width:"mapData(pageRankScale, 0, 1, 22, 60)",height:"mapData(pageRankScale, 0, 1, 22, 60)"}},{selector:'node[entityKind = "topic"]',style:{"background-color":_.topic}},{selector:'node[entityKind = "place"]',style:{"background-color":_.place}},{selector:'node[entityKind = "thing"]',style:{"background-color":_.thing}},{selector:'node[entityKind = "work"]',style:{"background-color":_.work}},{selector:'node[focused = "1"]',style:{"background-color":V,"border-color":"#7f1d1d","border-width":3,width:36,height:36}},{selector:"node:selected",style:{"border-width":3,"border-color":"#0ea5e9"}},{selector:"edge",style:{width:"mapData(weightScale, 0, 1, 1, 6)","line-color":Fe,"curve-style":"bezier",label:"data(label)","font-size":9,color:re,"text-rotation":"autorotate","text-background-color":mt,"text-background-opacity":.85,"text-background-padding":1,"target-arrow-shape":"triangle","target-arrow-color":Fe}},{selector:'edge[kind = "person-event"]',style:{"line-color":"#fbbf24","target-arrow-color":"#fbbf24","line-style":"dashed"}},{selector:'edge[kind = "person-entity"]',style:{"line-color":"#34d399","target-arrow-color":"#34d399","line-style":"dashed"}},{selector:'edge[kind = "event-event"]',style:{"line-color":"#f472b6","target-arrow-color":"#f472b6"}},{selector:'edge[kind = "event-entity"]',style:{"line-color":"#06b6d4","target-arrow-color":"#06b6d4","line-style":"dashed"}},{selector:'edge[kind = "entity-entity"]',style:{"line-color":"#a855f7","target-arrow-color":"#a855f7"}},{selector:'edge[kind = "person-person"]',style:{"line-color":"#f87171","target-arrow-color":"#f87171"}},{selector:'edge[focused = "1"]',style:{"line-color":"#facc15","target-arrow-color":"#facc15",width:4,"overlay-color":"#facc15","overlay-opacity":.25,"overlay-padding":5,"z-index":9999}},{selector:"edge.dimmed",style:{opacity:.15}},{selector:"node.dimmed",style:{opacity:.2,"text-opacity":0}}];function St(t,s){if(!(t!=null&&t.length)&&!(s!=null&&s.length))return Me;const l=[];for(const u of t??[]){const h={};u.color&&(h["background-color"]=u.color,h["border-color"]=u.color),u.shape&&(h.shape=u.shape==="circle"?"ellipse":u.shape==="round-rect"?"round-rectangle":"diamond"),l.push({selector:`node[kind = "${u.kind}"]`,style:h})}for(const u of s??[]){const h={};u.color&&(h["line-color"]=u.color,h["target-arrow-color"]=u.color),u.dashed&&(h["line-style"]="dashed"),l.push({selector:`edge[kind = "${u.kind}"]`,style:h})}return[...Me,...l]}function wt({comp:t,pluginName:s,refreshTick:l,onRefresh:u}){var Ee,Ie;xt();const h=d.useRef(null),o=d.useRef(null),a=d.useRef(null),[r,b]=d.useState(null),[S,M]=d.useState(!1),[E,F]=d.useState(null),[j,A]=d.useState(),[p,C]=d.useState(t.defaultMaxDepth??2),[v,$]=d.useState(t.defaultMaxBreadth??10),[z,ae]=d.useState(""),[L,ee]=d.useState(null),[Ke,oe]=d.useState(null),[Ye,be]=d.useState(!1),[T,ve]=d.useState(!1),[te,ie]=d.useState(null),le="aalis.relgraph.spacing",K=60,de=1e3,ne=5e3,je=120,ke=()=>{if(typeof window>"u")return;const n=window.localStorage.getItem(le);if(n==null)return;const c=Number(n);return Number.isFinite(c)&&c>=K&&c<=ne?c:void 0},[Q,Se]=d.useState(()=>ke()??je),[ce,se]=d.useState(Q);d.useEffect(()=>{if(ke()!==void 0)return;let n=!1;return ge("/api/plugins/@aalis/plugin-webui-server/config").then(c=>{var w;if(n)return;const k=Number((w=c==null?void 0:c.config)==null?void 0:w.relationGraphDefaultSpacing);Number.isFinite(k)&&k>=K&&k<=ne&&(Se(k),se(k))}).catch(()=>{}),()=>{n=!0}},[]);const Y=d.useCallback(n=>{if(!Number.isFinite(n))return;const c=Math.max(K,Math.min(ne,Math.round(n)));Se(c),se(c);try{window.localStorage.setItem(le,String(c))}catch{}},[]),ue=`relation-graph-h:${s}:${t.source}`,[O,Ze]=d.useState(()=>{if(typeof window>"u")return 520;const n=Number(window.localStorage.getItem(ue));return Number.isFinite(n)&&n>=200?n:520}),Z=d.useRef(null),Ue=d.useCallback(n=>{n.target.setPointerCapture(n.pointerId),Z.current={y:n.clientY,h:O}},[O]),qe=d.useCallback(n=>{if(!Z.current)return;const c=Math.max(200,Math.min(1600,Z.current.h+(n.clientY-Z.current.y)));Ze(c)},[]),we=d.useCallback(n=>{if(Z.current){n.target.releasePointerCapture(n.pointerId),Z.current=null;try{window.localStorage.setItem(ue,String(O))}catch{}}},[ue,O]);d.useEffect(()=>{var n;(n=o.current)==null||n.resize()},[O]);const U=d.useCallback(async()=>{M(!0),F(null);try{const n={focusId:j,maxDepth:p<=0?vt:p,maxBreadth:v},c=await D(s,t.source,n);b(c?{nodes:Array.isArray(c.nodes)?c.nodes:[],edges:Array.isArray(c.edges)?c.edges:[],focusId:c.focusId,focusEdge:c.focusEdge,stats:c.stats,globalPrRanks:c.globalPrRanks}:{nodes:[],edges:[]})}catch(n){F(n.message||String(n)),b({nodes:[],edges:[]})}finally{M(!1)}},[s,t.source,j,p,v]);d.useEffect(()=>{U()},[U,l]),d.useEffect(()=>{if(!t.refresh||t.refresh<=0)return;const n=setInterval(U,t.refresh);return()=>clearInterval(n)},[t.refresh,U]),d.useEffect(()=>{if(!h.current)return;const n=$e({container:h.current,elements:[],style:St(t.nodeKinds,t.edgeKinds),minZoom:.2,maxZoom:3,wheelSensitivity:.2});o.current=n,n.on("tap","node",w=>{const x=w.target.data();ee({data:x}),A(String(x.id))}),n.on("tap","edge",w=>{const x=w.target.id();typeof x=="string"&&x&&(ee(null),A(x))});const c=(w,x)=>{const R=[],f=N=>{const y=w[N];return y==null?"":String(y)};if(x){const N=f("label"),y=f("role"),i=f("relationType");N?R.push(N):y?R.push(y):i&&R.push(i);const g=f("description");g&&R.push(g);const m=w.weight;typeof m=="number"&&R.push(`合并强度 ${m.toFixed(2)}`)}else{const N=f("kind"),y=f("title")||f("name")||f("displayName")||f("label");y&&R.push(y);const i=f("category")||f("entityKind");if(i&&R.push(`类型:${i}`),N==="event"){const m=f("sessionScope");m&&R.push(`会话:${m}`)}const g=f("summary");g&&R.push(g)}return R},k=(w,x)=>{var g,m,I;const R=(g=h.current)==null?void 0:g.getBoundingClientRect(),f=w.target.data(),N=c(f,x);if(N.length===0||!R)return;const y=((m=w.renderedPosition)==null?void 0:m.x)??0,i=((I=w.renderedPosition)==null?void 0:I.y)??0;ie({x:y+12,y:i+12,lines:N})};return n.on("mouseover","node",w=>k(w,!1)),n.on("mouseover","edge",w=>k(w,!0)),n.on("mouseout","node",()=>ie(null)),n.on("mouseout","edge",()=>ie(null)),()=>{n.destroy(),o.current=null}},[]),d.useEffect(()=>{const n=o.current;if(!n||!r)return;const c=r.focusId??j,k=new Map;for(const i of r.nodes){if(i.data.kind!=="person")continue;const g=typeof i.data.label=="string"?i.data.label:"";g&&k.set(g,(k.get(g)??0)+1)}const w=i=>{if(i.kind!=="person")return;const g=typeof i.label=="string"?i.label:"";if(!g||(k.get(g)??0)<2)return;const m=typeof i.platform=="string"?i.platform:"?",I=typeof i.userId=="string"?i.userId:"",X=I?`…${I.slice(-4)}`:typeof i.id=="string"?`…${i.id.slice(-4)}`:"?";return`${g} · ${m}:${X}`},x=new Map;for(const i of r.nodes){const g=String(i.data.kind??"person"),m=typeof i.data.lastPageRank=="number"?i.data.lastPageRank:0;let I=x.get(g);I||(I=new Map,x.set(g,I)),I.set(String(i.data.id),m)}const R=new Map;for(const[,i]of x){const g=[...i.entries()].sort((I,X)=>I[1]-X[1]),m=g.length;for(let I=0;I<m;I++){const X=m>1?I/(m-1):.5;R.set(g[I][0],X)}}const f=new Map;{const i=r.edges.map(m=>({id:m.data.id,w:typeof m.data.weight=="number"?m.data.weight:0})).sort((m,I)=>m.w-I.w),g=i.length;for(let m=0;m<g;m++)f.set(i[m].id,g>1?m/(g-1):.5)}const N=[...r.nodes.map(i=>{const g=w(i.data),m=R.get(String(i.data.id))??0;return{data:{...i.data,...g?{label:g}:{},pageRankScale:m,focused:c&&i.data.id===c?"1":void 0},group:"nodes"}}),...r.edges.map(i=>{const g=typeof i.data.label=="string"?i.data.label:"",m=f.get(i.data.id)??0;return{data:{...i.data,label:g,kind:i.data.kind??(i.data.relationType?"person-person":"person-event"),weightScale:m,focused:c&&i.data.id===c?"1":void 0},group:"edges"}})],y=a.current===r;a.current=r,y||(n.elements().remove(),n.add(N)),n.layout({name:"fcose",animate:y,animationDuration:400,randomize:!y&&r.nodes.length>20,nodeRepulsion:(i=>{const g=Math.round(Q*117),m=Number(i.data("pageRankScale"))||0;return Math.round(g*(1+3*m))}),idealEdgeLength:(i=>{const g=Number(i.data("weightScale"))||0;return Math.round(Q*(1.4-.8*g))}),nodeSeparation:Math.round(Q*.67),gravity:.1,gravityRange:3,padding:40,quality:"proof",uniformNodeDimensions:!1}).run()},[r,j,Q]),d.useEffect(()=>{const n=o.current;if(!n)return;const c=z.toLowerCase().split(/\s+/).filter(Boolean);if(n.elements().removeClass("dimmed"),c.length===0)return;const k=n.nodes().filter(x=>{const R=[String(x.data("label")??""),String(x.data("kind")??""),String(x.data("entityKind")??""),String(x.data("category")??""),String(x.data("title")??""),String(x.data("name")??""),String(x.data("displayName")??""),String(x.data("summary")??""),String(x.data("sessionScope")??"")].map(f=>f.toLowerCase());return c.every(f=>R.some(N=>N.includes(f)))});if(k.length===0)return;const w=new Set(k.map(x=>x.id()));n.nodes().forEach(x=>{w.has(x.id())||x.addClass("dimmed")}),n.edges().forEach(x=>{w.has(x.source().id())||w.has(x.target().id())||x.addClass("dimmed")})},[z,r]),d.useEffect(()=>{if(!L||!t.detailSource){oe(null);return}be(!0),D(s,t.detailSource,{nodeId:L.data.id,kind:L.data.kind}).then(n=>oe(n??null)).catch(n=>oe({error:n.message})).finally(()=>be(!1))},[L,s,t.detailSource]),d.useEffect(()=>{const n=o.current;if(!n)return;const c=requestAnimationFrame(()=>{n.resize(),n.fit(void 0,30)});return()=>cancelAnimationFrame(c)},[j,L]);const Ve=d.useCallback(()=>{const n=o.current;if(!n||n.elements().length===0)return;const c=n.png({full:!0,scale:2,bg:xe,maxWidth:1/0});if(!c||c==="data:,")return;const k=document.createElement("a");k.href=c,k.download=`relation-graph-${Date.now()}.png`,document.body.appendChild(k),k.click(),document.body.removeChild(k)},[]),he=d.useCallback(()=>{u?u():U()},[u,U]),Qe=d.useCallback(async(n,c)=>{if(!(c&&!window.confirm(c)))try{await D(s,n,{focusId:j}),he()}catch(k){alert(`操作失败: ${k.message}`)}},[s,j,he]),Ne=(r==null?void 0:r.stats)??{},Xe=d.useMemo(()=>{if(!r)return"";const n={persons:"人物",events:"事件",entities:"实体"},c=[`节点 ${r.nodes.length}`,`边 ${r.edges.length}`],k=[];for(const[x,R]of Object.entries(Ne))x!=="edges"&&k.push(`${n[x]??x} ${R}`);const w=k.length?`全库: ${k.join(" · ")}`:"";return[...c,...w?[w]:[]].join(" | ")},[r,Ne]),Re=d.useMemo(()=>{const n=new Map;if(!r)return n;const c=[];for(const f of r.nodes){const N=f.data.lastPageRank;typeof N!="number"||!Number.isFinite(N)||c.push({id:String(f.data.id),kind:String(f.data.kind??"person"),pr:N})}const k=[...c].sort((f,N)=>N.pr-f.pr),w=k.length,x=new Map;for(let f=0;f<k.length;f++)x.set(k[f].id,f+1);const R=new Map;for(const f of c)R.has(f.kind)||R.set(f.kind,[]),R.get(f.kind).push(f);for(const[,f]of R){f.sort((N,y)=>y.pr-N.pr);for(let N=0;N<f.length;N++)n.set(f[N].id,{kindRank:N+1,kindTotal:f.length,globalRank:x.get(f[N].id)??0,globalTotal:w})}return n},[r]),Ce=d.useMemo(()=>{const n=new Map;if(!(r!=null&&r.globalPrRanks))return n;for(const[c,k]of Object.entries(r.globalPrRanks))n.set(c,k);return n},[r]),Je={display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",padding:"8px 10px",background:"var(--bg-secondary)",borderBottom:"1px solid var(--border-color, #2a2a42)",fontSize:12,color:"var(--text)"},et={width:"100%",height:O,background:xe,position:"relative"};return e.jsxs("div",{className:"relation-graph-wrap",style:{border:"1px solid var(--border-color, #e5e7eb)",borderRadius:6,overflow:"hidden"},children:[t.label?e.jsx("div",{style:{padding:"8px 12px",fontWeight:600},children:t.label}):null,e.jsxs("div",{style:Je,children:[e.jsxs("div",{style:{position:"relative",flex:"1 1 200px",minWidth:160},children:[e.jsx("input",{type:"text",placeholder:"搜索 (label / kind / entityKind / category,空格分多关键词)",value:z,onChange:n=>ae(n.target.value),onCompositionEnd:n=>ae(n.target.value),style:{width:"100%",padding:"4px 24px 4px 8px"}}),z?e.jsx("button",{type:"button",onClick:()=>ae(""),title:"清除搜索",style:{position:"absolute",right:4,top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:"var(--text-muted, #888)",cursor:"pointer",fontSize:14,padding:"0 4px",lineHeight:1},children:"✕"}):null]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:4,opacity:j?1:.45},title:j?"从焦点节点出发的 BFS 跳数(0 = 不限)":"深度仅在选定焦点后生效:点击节点 → 详情面板 → 「以此为焦点」",children:["深度",e.jsx("input",{type:"range",min:0,max:10,value:p,onChange:n=>C(Number(n.target.value)),disabled:!j}),e.jsx("input",{type:"number",min:0,value:p,onChange:n=>{const c=Number(n.target.value);Number.isFinite(c)&&c>=0&&C(c)},disabled:!j,style:{width:56,padding:"2px 4px",background:"var(--surface)",color:"var(--text)",border:"1px solid var(--surface-active)"}}),e.jsx("span",{style:{width:32,color:"var(--text-secondary)"},children:p===0?"∞":p})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:4,opacity:j?1:.45},title:j?"焦点模式:每个节点向外展开的邻居数上限(按边权重降序截断;0 = 不限)":"宽度仅在选定焦点后生效:点击图中任一节点即可设为焦点",children:["宽度",e.jsx("input",{type:"range",min:0,max:30,value:v,onChange:n=>$(Number(n.target.value)),disabled:!j}),e.jsx("input",{type:"number",min:0,value:v,onChange:n=>{const c=Number(n.target.value);Number.isFinite(c)&&c>=0&&$(c)},disabled:!j,style:{width:56,padding:"2px 4px",background:"var(--surface)",color:"var(--text)",border:"1px solid var(--surface-active)"}}),e.jsx("span",{style:{width:32,color:"var(--text-secondary)"},children:v===0?"∞":v})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:4},title:`布局密度(≈ 理想边长 px)。当前 ${ce}。
|
|
17
|
-
slider 范围 ${K}–${de};数字框可手动输入更大值(上限 ${ne})。
|
|
18
|
-
松开鼠标 / Enter / 失焦后才重排(动画过渡),同时写入本地存储。`,children:["密度",e.jsx("input",{type:"range",min:K,max:de,step:5,value:Math.min(ce,de),onChange:n=>se(Number(n.target.value)),onMouseUp:n=>Y(Number(n.target.value)),onTouchEnd:n=>Y(Number(n.target.value)),onKeyUp:n=>Y(Number(n.target.value))}),e.jsx("input",{type:"number",min:K,value:ce,onChange:n=>{const c=Number(n.target.value);Number.isFinite(c)&&se(c)},onBlur:n=>Y(Number(n.target.value)),onKeyDown:n=>{n.key==="Enter"&&Y(Number(n.target.value))},style:{width:64,padding:"2px 4px",background:"var(--surface)",color:"var(--text)",border:"1px solid var(--surface-active)"}})]}),e.jsx("button",{type:"button",onClick:()=>{try{window.localStorage.removeItem(le)}catch{}Y(je)},title:"重置密度为默认值(同时清除本地覆盖)",style:{padding:"2px 6px",fontSize:11},children:"↺"}),j?e.jsx("button",{type:"button",onClick:()=>{A(void 0),ee(null)},style:{padding:"4px 8px"},title:"清除焦点,返回全图视图",children:"✕ 清除焦点"}):null,e.jsx("button",{type:"button",onClick:he,disabled:S,style:{padding:"4px 8px"},children:S?"加载中…":"刷新"}),e.jsx("button",{type:"button",onClick:Ve,style:{padding:"4px 8px"},children:"导出 PNG"}),(t.actions??[]).map(n=>e.jsx("button",{type:"button",onClick:()=>Qe(n.method,n.confirm),style:{padding:"4px 8px",color:n.danger?"#dc2626":void 0},children:n.label},n.method))]}),E?e.jsxs("div",{style:{padding:8,color:"#dc2626",fontSize:12},children:["错误: ",E]}):null,e.jsx("div",{style:{display:"flex"},children:e.jsxs("div",{style:{position:"relative",flex:1},children:[e.jsx("div",{ref:h,style:et}),te?e.jsx("div",{style:{position:"absolute",left:Math.min(te.x,600),top:te.y,maxWidth:320,padding:"6px 8px",background:"rgba(28, 28, 40, 0.96)",color:re,border:"1px solid rgba(120,140,200,0.5)",borderRadius:4,fontSize:11,lineHeight:1.5,pointerEvents:"none",zIndex:6,boxShadow:"0 2px 6px rgba(0,0,0,0.4)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:te.lines.map((n,c)=>e.jsx("div",{style:c===0?{fontWeight:600}:{color:"var(--text-muted)"},children:n},c))}):null,L||j&&(r!=null&&r.focusEdge)?e.jsxs("div",{style:{position:"absolute",top:10,left:10,width:T?"auto":360,maxWidth:"calc(100% - 20px)",maxHeight:T?void 0:O-20,overflowY:T?"visible":"auto",padding:T?"4px 8px":"10px 12px",background:"rgba(28, 28, 40, 0.94)",color:re,border:`1px solid ${V}`,borderRadius:6,fontSize:11,boxShadow:"0 2px 8px rgba(0,0,0,0.4)",pointerEvents:"auto",zIndex:5},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:8,marginBottom:T?0:6},children:[e.jsx("button",{type:"button",onClick:()=>ve(n=>!n),style:{background:"none",border:0,color:"var(--text-secondary)",cursor:"pointer",fontSize:12,padding:0,lineHeight:1,width:16},title:T?"展开详情":"收起详情(保留焦点)","aria-label":T?"展开":"收起",children:T?"▸":"▾"}),e.jsx("button",{type:"button",onClick:()=>{A(void 0),ee(null),ve(!1)},style:{background:"none",border:0,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,padding:0,lineHeight:1},title:"关闭(清焦点)","aria-label":"关闭",children:"✕"}),e.jsx("strong",{style:{color:V},children:L?`${L.data.kind??"节点"}:${L.data.label??L.data.id}`:"焦点(边)"}),e.jsx("span",{style:{marginLeft:"auto"},children:e.jsx(Nt,{})})]}),T?null:L?e.jsx(Ct,{node:L,detail:Ke,loading:Ye,hasDetailSource:!!t.detailSource,isFocus:j===L.data.id,prRank:{sub:Re.get(String(L.data.id)),global:Ce.get(String(L.data.id))}}):r!=null&&r.focusEdge?(()=>{var N;const n=r.focusEdge,c=y=>{if(!y||!Number.isFinite(y))return"—";try{return new Date(y).toLocaleString("zh-CN",{hour12:!1})}catch{return String(y)}},k=y=>{const i=r.nodes.find(m=>m.data.id===y);if(!i)return;const g=i.data.lastPageRank;return{label:typeof i.data.label=="string"?i.data.label:void 0,kind:typeof i.data.kind=="string"?i.data.kind:void 0,lastPageRank:typeof g=="number"&&Number.isFinite(g)?g:void 0}},w=n.endpoints??[],x=w.map(y=>{var i;return(i=k(y))==null?void 0:i.lastPageRank}).filter(y=>typeof y=="number"),R=x.length>0?x.reduce((y,i)=>y+i,0)/x.length:void 0,f=typeof n.weight=="number"&&typeof R=="number"?n.weight*R:void 0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:6,fontSize:10,color:"var(--text-secondary)"},children:["id=",n.id]}),e.jsx("div",{style:{marginBottom:6},children:n.description??"(无描述)"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,rowGap:3,color:"var(--text-secondary)",marginBottom:8},children:[e.jsx("span",{children:"kind"}),e.jsxs("span",{children:[J(n.kind,De),n.directed===!0?" · 有向":n.directed===!1?" · 无向":""]}),n.relation?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"relation"}),e.jsx("span",{children:J(n.relation,_e)})]}):null,n.role?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"role"}),e.jsx("span",{children:kt(n.kind,n.role)})]}):null,n.sentiment?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"sentiment"}),e.jsx("span",{children:J(n.sentiment,Oe)})]}):null,typeof n.weight=="number"?e.jsxs(e.Fragment,{children:[e.jsx("span",{title:"边按 (kind, source, target[, role/relation]) 重复合并的累计强度:0.5 起步,每次合并 +(1−prev)·delta(默认 delta=0.1,由 LLM/工具调用传入)→ 0.55 → 0.595 → 0.636 → … (clamp 1.0)。语义=被强化次数,不是重要性。",style:{cursor:"help"},children:"合并强度"}),e.jsx("span",{children:n.weight.toFixed(2)})]}):null,typeof f=="number"?e.jsxs(e.Fragment,{children:[e.jsx("span",{title:"边淘汰分 = 合并强度 × 端点 PR 平均。配额淘汰时按此升序删——分越低越先删。让「弱权但连接重要节点」的边受保护。",style:{cursor:"help"},children:"边淘汰分"}),e.jsxs("span",{children:[f.toFixed(5)," ",e.jsxs("span",{style:{opacity:.6},children:["= ",n.weight.toFixed(2)," × ",fe(R)]})]})]}):null,e.jsx("span",{children:"first"}),e.jsx("span",{children:c(n.firstSeenAt)}),e.jsx("span",{children:"last"}),e.jsx("span",{children:c(n.lastReinforcedAt)})]}),w.length>0?e.jsxs("div",{style:{marginBottom:8},children:[e.jsx("div",{style:{color:"var(--text-muted)",marginBottom:2},children:"端点"}),w.map(y=>{const i=k(y),g=Re.get(y),m=Ce.get(y),I=typeof(i==null?void 0:i.lastPageRank)=="number";return e.jsxs("div",{style:{fontFamily:"monospace",fontSize:10,color:"var(--text-secondary)",marginBottom:3},children:[e.jsxs("div",{children:[(i==null?void 0:i.label)??y," ",e.jsxs("span",{style:{opacity:.6},children:["[",String((i==null?void 0:i.kind)??"?"),"]",I?` · PR ${fe(i.lastPageRank)}`:""]})]}),I&&g?e.jsxs("div",{style:{opacity:.6,paddingLeft:8},children:["子图 #",g.kindRank,"/",g.kindTotal," 同类 · #",g.globalRank,"/",g.globalTotal," 全部"]}):null,I&&m?e.jsxs("div",{style:{opacity:.6,paddingLeft:8},children:["全库 #",m.kindRank,"/",m.kindTotal," 同类 · #",m.globalRank,"/",m.globalTotal," 全部"]}):null]},y)})]}):null,e.jsxs("div",{style:{color:"var(--text-muted)",marginBottom:2},children:["证据 ",((N=n.evidence)==null?void 0:N.length)??0," 条"]}),(n.evidence??[]).map((y,i)=>{var g,m;return e.jsxs("div",{style:{borderLeft:"2px solid var(--border-color, #2a2a42)",padding:"2px 6px",marginBottom:4,color:"var(--text-secondary)",lineHeight:1.4},children:[e.jsxs("div",{children:["「",y.quote??"(无摘录)","」"]}),e.jsxs("div",{style:{fontSize:10,opacity:.7},children:[y.extractedAt?c(y.extractedAt):"—",y.sessionId?` · ${y.sessionId}`:"",(g=y.messageIds)!=null&&g.length?` · ${y.messageIds.length} msg`:""]})]},`${((m=y.messageIds)==null?void 0:m.join(","))??i}-${y.extractedAt??i}`)}),e.jsxs("div",{style:{color:"var(--text-muted)",marginTop:6},children:["子图 节点 ",r.nodes.length," · 边 ",r.edges.length]})]})})():null]}):null]})}),e.jsx("div",{role:"separator","aria-orientation":"horizontal",title:"拖拽调整画布高度",onPointerDown:Ue,onPointerMove:qe,onPointerUp:we,onPointerCancel:we,style:{height:8,cursor:"ns-resize",background:"var(--bg-secondary)",borderTop:"1px solid var(--border-color, #2a2a42)",borderBottom:"1px solid var(--border-color, #2a2a42)",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",touchAction:"none"},children:e.jsx("div",{style:{width:40,height:3,borderRadius:2,background:"var(--text-muted, #6b7280)",opacity:.6}})}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:12,padding:"4px 10px",fontSize:11,color:"var(--text-secondary)",background:"var(--bg-secondary)",borderTop:"1px solid var(--border-color, #2a2a42)"},children:[(Ee=t.nodeKinds)!=null&&Ee.length?e.jsxs(e.Fragment,{children:[t.nodeKinds.map(n=>e.jsx(B,{shape:n.shape??"circle",color:n.color??ye,label:n.label},n.kind)),e.jsx(B,{shape:"circle",color:V,label:"焦点"}),(Ie=t.edgeKinds)!=null&&Ie.length?e.jsx("span",{style:{width:1,height:12,background:"var(--border-color, #2a2a42)",margin:"0 4px"}}):null,(t.edgeKinds??[]).map(n=>e.jsx(G,{color:n.color??"#6b7280",dashStyle:n.dashed?"dashed":"solid",label:n.label},n.kind))]}):e.jsxs(e.Fragment,{children:[e.jsx(B,{shape:"circle",color:ye,label:"人物"}),e.jsx(B,{shape:"round-rect",color:ze,label:"事件"}),e.jsx(B,{shape:"diamond",color:_.topic,label:"话题"}),e.jsx(B,{shape:"diamond",color:_.place,label:"地点"}),e.jsx(B,{shape:"diamond",color:_.thing,label:"事物"}),e.jsx(B,{shape:"diamond",color:_.work,label:"作品"}),e.jsx(B,{shape:"circle",color:V,label:"焦点"}),e.jsx("span",{style:{width:1,height:12,background:"var(--border-color, #2a2a42)",margin:"0 4px"}}),e.jsx(G,{color:"#f87171",dashStyle:"solid",label:"人↔人"}),e.jsx(G,{color:"#34d399",dashStyle:"dashed",label:"人→实体"}),e.jsx(G,{color:"#fbbf24",dashStyle:"dashed",label:"人→事"}),e.jsx(G,{color:"#a855f7",dashStyle:"solid",label:"实体↔实体"}),e.jsx(G,{color:"#06b6d4",dashStyle:"dashed",label:"事→实体"}),e.jsx(G,{color:"#f472b6",dashStyle:"solid",label:"事→事"})]}),e.jsx("span",{style:{marginLeft:"auto",opacity:.7},children:"点击节点 = 设为焦点 + 显示左上详情卡片;清除焦点请点工具栏「✕ 清除焦点」按钮"})]}),e.jsx("div",{style:{padding:"4px 10px",fontSize:11,color:"var(--text-secondary)",background:"var(--bg-secondary)"},children:Xe||"—"})]})}function B({shape:t,color:s,label:l}){const u={width:12,height:12,background:s,display:"inline-block",verticalAlign:"middle"};let h;return t==="circle"?h={...u,borderRadius:"50%"}:t==="round-rect"?h={...u,width:16,height:10,borderRadius:3}:h={...u,transform:"rotate(45deg)"},e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:h}),l]})}function G({color:t,dashStyle:s,label:l}){const u=s==="solid"?"solid":s==="dashed"?"dashed":"dotted";return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{width:18,height:0,borderTop:`2px ${u} ${t}`,display:"inline-block"}}),l]})}function Ge(t){if(typeof t!="number"||!Number.isFinite(t))return"—";try{return new Date(t).toLocaleString("zh-CN",{hour12:!1})}catch{return String(t)}}function H(t,s){const l=t[`${s}Text`]??t[s];if(typeof l=="string"&&l)return l;if(typeof l=="number")return Ge(l)}function P(t){if(typeof t=="string"&&t)return t;if(typeof t=="number")return String(t)}function q(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function pe({rows:t}){const s=t.filter(([,l])=>l!=null&&l!=="");return s.length===0?e.jsx(e.Fragment,{}):e.jsx("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,rowGap:3,color:"var(--text-secondary)",marginBottom:8},children:s.map(l=>{const[u,h,o]=l,a=typeof h=="string"||typeof h=="number"?String(h):h;return e.jsxs(W.Fragment,{children:[e.jsx("span",{style:{color:"var(--text-muted)",cursor:o?"help":void 0},title:o,children:u}),e.jsx("span",{style:{color:"var(--text)",wordBreak:"break-word"},children:a})]},u)})})}function Le({list:t}){return!t||t.length===0?e.jsx(e.Fragment,{}):e.jsxs("div",{style:{marginTop:6},children:[e.jsxs("div",{style:{color:"var(--text-muted)",marginBottom:2},children:["证据 ",t.length," 条"]}),t.map((s,l)=>{var u,h;return e.jsxs("div",{style:{borderLeft:"2px solid var(--border-color, #2a2a42)",padding:"2px 6px",marginBottom:4,color:"var(--text-secondary)",lineHeight:1.4},children:[e.jsxs("div",{children:["「",s.quote??"(无摘录)","」"]}),e.jsxs("div",{style:{fontSize:10,opacity:.7},children:[s.extractedAtText??Ge(s.extractedAt),s.sessionId?` · ${s.sessionId}`:"",(u=s.messageIds)!=null&&u.length?` · ${s.messageIds.length} msg`:""]})]},`${((h=s.messageIds)==null?void 0:h.join(","))??l}-${s.extractedAt??l}`)})]})}function Nt(){const[t,s]=d.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>s(!0),style:{background:"none",border:0,padding:0,cursor:"help",color:"var(--text-muted)",fontSize:11,textDecoration:"underline dotted"},title:"字段含义说明",children:"ⓘ 字段含义"}),t?e.jsx(Rt,{onClose:()=>s(!1)}):null]})}function Rt({onClose:t}){d.useEffect(()=>{const o=a=>{a.key==="Escape"&&t()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t]);const s={display:"grid",gridTemplateColumns:"120px 1fr",columnGap:12,rowGap:4,fontSize:12},l={margin:"12px 0 4px",fontSize:13,color:"var(--text-primary, #e4e4ef)"},h=e.jsx("div",{onClick:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",zIndex:9999,display:"flex",alignItems:"flex-start",justifyContent:"center",overflowY:"auto",padding:"4vh 16px"},children:e.jsxs("div",{onClick:o=>o.stopPropagation(),style:{background:"var(--bg-primary, #0f0f14)",color:"var(--text-primary, #e4e4ef)",border:"1px solid var(--border-color, #2a2a42)",borderRadius:8,padding:"16px 20px",width:"min(680px, 92vw)",boxShadow:"0 8px 32px rgba(0,0,0,0.5)",lineHeight:1.55},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:6},children:[e.jsx("strong",{style:{fontSize:14},children:"关系图字段含义"}),e.jsx("button",{type:"button",onClick:t,style:{marginLeft:"auto",background:"none",border:0,color:"var(--text-secondary)",cursor:"pointer",fontSize:16},"aria-label":"关闭",title:"关闭 (Esc)",children:"✕"})]}),e.jsx("div",{style:l,children:"三个数值指标"}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:[e.jsxs("div",{children:[e.jsx("b",{children:"合并强度"}),"(weight, 0~1):节点 / 边被重复合并的累计程度。0.5 起步,每次合并 ",e.jsx("code",{children:"+(1−prev)·delta"}),"(默认 delta=0.1,可由 LLM/工具调用传入;person 别名合并是直接 ",e.jsx("code",{children:"+0.3"})," 的特殊情况)→ 0.55 → 0.595 → 0.636 → … (clamp 1.0)。",e.jsxs("u",{children:["语义 = 被强化次数,",e.jsx("b",{children:"不是"}),"重要性"]}),"。"]}),e.jsxs("div",{style:{marginTop:3},children:[e.jsx("b",{children:"图重要性"}),"(lastPageRank):最近一次 ",e.jsx("code",{children:"/relation compress | maintain"}),' 计算的全图 PageRank。个性化种子按 kind 加权(人 2 · 物 1.5 · 事 1,可配置)。越高越靠近"核心人物 · 热门事件"。未跑过压缩则为空。注:节点越多,每个 PR 值越小(PR 是归一化概率分布,总和为 1),UI 在 |n| < 0.01 时切换科学计数法(如 ',e.jsx("code",{children:"2.07e-3"}),"),否则保留 3 位有效数字小数;同时附「子图同类/全部 + 全库同类/全部」四档排名(子图=当前 focusId/depth/breadth 限定的可见视图;全库=fullSnap 全体节点)便于判读位置。"]}),e.jsxs("div",{style:{marginTop:3},children:[e.jsx("b",{children:"边淘汰分"}),"(仅边详情):",e.jsx("code",{children:"合并强度 × ((PR_from + PR_to) / 2)"}),"。配额淘汰时按此",e.jsx("u",{children:"升序"}),'删——分越低越先删,让"弱权但连接重要节点"的边受保护。']})]}),e.jsx("div",{style:l,children:"边 kind(六类)"}),e.jsx("div",{style:s,children:Object.entries(De).map(([o,a])=>e.jsxs(W.Fragment,{children:[e.jsx("code",{style:{color:"var(--text-muted)"},children:o}),e.jsx("span",{children:a})]},o))}),e.jsx("div",{style:l,children:"role · 人 → 事件"}),e.jsx("div",{style:s,children:Object.entries(Te).map(([o,a])=>e.jsxs(W.Fragment,{children:[e.jsx("code",{style:{color:"var(--text-muted)"},children:o}),e.jsx("span",{children:a})]},o))}),e.jsx("div",{style:l,children:"role · 人 → 物"}),e.jsx("div",{style:s,children:Object.entries(Be).map(([o,a])=>e.jsxs(W.Fragment,{children:[e.jsx("code",{style:{color:"var(--text-muted)"},children:o}),e.jsx("span",{children:a})]},o))}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:'注:单句态度声明("我喜欢 X")不在关系图记录,归 user-profile 画像层。'}),e.jsx("div",{style:l,children:"relation · 人 → 人"}),e.jsx("div",{style:s,children:Object.entries(_e).map(([o,a])=>e.jsxs(W.Fragment,{children:[e.jsx("code",{style:{color:"var(--text-muted)"},children:o}),e.jsx("span",{children:a})]},o))}),e.jsx("div",{style:l,children:"sentiment"}),e.jsx("div",{style:s,children:Object.entries(Oe).map(([o,a])=>e.jsxs(W.Fragment,{children:[e.jsx("code",{style:{color:"var(--text-muted)"},children:o}),e.jsx("span",{children:a})]},o))}),e.jsx("div",{style:l,children:"hierarchy(人 → 人,与 directed 正交)"}),e.jsx("div",{style:s,children:Object.entries(jt).map(([o,a])=>e.jsxs(W.Fragment,{children:[e.jsx("code",{style:{color:"var(--text-muted)"},children:o}),e.jsx("span",{children:a})]},o))}),e.jsxs("div",{style:{marginTop:14,fontSize:11,color:"var(--text-muted)"},children:["完整文档:",e.jsx("a",{href:"/docs/plugins/user-relation-graph.md",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--text-link, #8ab4f8)",marginLeft:4},title:"在新标签页打开文档",children:"docs/plugins/user-relation-graph.md ↗"})]})]})});return typeof document>"u"?h:tt.createPortal(h,document.body)}function Ct({node:t,detail:s,loading:l,hasDetailSource:u,isFocus:h,prRank:o}){const a=t.data.kind,r=S=>{if(typeof S!="number"||!Number.isFinite(S))return e.jsxs("span",{style:{opacity:.6},children:["— ",e.jsx("span",{style:{fontSize:10},children:"(未跑过压缩,下次 evictByQuota 时计算)"})]});const M=fe(S),E=o==null?void 0:o.sub,F=o==null?void 0:o.global;return!E&&!F?M:e.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",gap:1},children:[e.jsx("span",{children:M}),E?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{opacity:.75},children:["子图 #",E.kindRank,"/",E.kindTotal," 同类"]}),e.jsxs("span",{style:{opacity:.75},children:["子图 #",E.globalRank,"/",E.globalTotal," 全部"]})]}):null,F?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{opacity:.75},children:["全库 #",F.kindRank,"/",F.kindTotal," 同类"]}),e.jsxs("span",{style:{opacity:.75},children:["全库 #",F.globalRank,"/",F.globalTotal," 全部"]})]}):e.jsx("span",{style:{opacity:.6,fontSize:10},children:"(全库排名暂缺:服务端未返回 globalPrRanks,可能需重启 aalis)"})]})},b=e.jsxs("div",{style:{color:"var(--text-secondary)",marginBottom:8,fontSize:10},children:["id=",t.data.id,h?e.jsx("span",{style:{marginLeft:6,color:V},children:"· 当前焦点"}):null]});if(l)return e.jsxs(e.Fragment,{children:[b,e.jsx("div",{style:{color:"var(--text-muted)"},children:"加载详情中…"})]});if(!u)return e.jsxs(e.Fragment,{children:[b,e.jsx("div",{style:{color:"var(--text-muted)"},children:"无详情(detailSource 未配置)"})]});if(!s)return e.jsxs(e.Fragment,{children:[b,e.jsx("div",{style:{color:"var(--text-muted)"},children:"无数据"})]});if(typeof s.error=="string")return e.jsxs(e.Fragment,{children:[b,e.jsxs("div",{style:{color:"#dc2626"},children:["错误: ",s.error]})]});if(a==="person"&&s.person&&typeof s.person=="object"){const S=s.person,M=[["昵称",P(S.displayName)],["平台",P(S.platform)],["用户 ID",P(S.userId)],["提及次数",q(S.mentionCount)],["图重要性",r(typeof S.lastPageRank=="number"?S.lastPageRank:void 0),"最近一次 evictByQuota 计算的全图 PageRank 分数。人/物/事 个性化种子 2:1.5:1(默认,可配置);该节点越靠近「核心人物 · 热门事件」越高。下方附「子图同类/全部 + 全库同类/全部」四档排名便于判读位置。未跑过压缩时为空。"],["首次出现",H(S,"firstSeenAt")],["最近出现",H(S,"lastSeenAt")],["最近提及",H(S,"lastMentionedAt")],["关联事件",q(s.eventCount)],["关联边数",q(s.edgeCount)]],E=Array.isArray(s.recentEvents)?s.recentEvents:[],F=Array.isArray(s.edges)?s.edges:[];return e.jsxs(e.Fragment,{children:[b,e.jsx(pe,{rows:M}),E.length>0?e.jsxs("div",{style:{marginBottom:8},children:[e.jsxs("div",{style:{color:"var(--text-muted)",marginBottom:2},children:["近期事件 ",E.length]}),E.slice(0,8).map((j,A)=>e.jsxs("div",{style:{color:"var(--text-secondary)",lineHeight:1.4},children:["· ",P(j.title)??"(无标题)",P(j.category)?e.jsxs("span",{style:{opacity:.6},children:[" [",P(j.category),"]"]}):null]},P(j.id)??A))]}):null,F.length>0?e.jsxs("div",{children:[e.jsxs("div",{style:{color:"var(--text-muted)",marginBottom:2},children:["边 ",F.length]}),F.slice(0,12).map((j,A)=>{const p=typeof j.weight=="number"?` w=${j.weight.toFixed(1)}`:"",C=P(j.relationZh)??P(j.roleZh)??P(j.relationType)??P(j.role)??P(j.kind)??"?",v=P(j.targetLabel)??P(j.toEntityId)??P(j.toEventId)??P(j.toPersonId)??"";return e.jsxs("div",{style:{fontFamily:"monospace",fontSize:10,color:"var(--text-secondary)"},children:[C,p," → ",v]},P(j.id)??A)})]}):null]})}if(a==="event"){const S=[["标题",P(s.title)],["类别",P(s.category)],["摘要",P(s.summary)],["提及次数",q(s.mentionCount)],["合并强度",typeof s.weight=="number"?s.weight.toFixed(2):void 0,"按 title 重复合并的累计强度:0.5 起步,每次合并 +(1−prev)·delta(默认 delta=0.1)。语义 = 被强化次数,不是重要性。"],["图重要性",r(typeof s.lastPageRank=="number"?s.lastPageRank:void 0),'最近一次 evictByQuota 计算的全图 PageRank 分数。反映"被重要节点引用"的结构性重要性;与合并强度独立。下方附「子图同类/全部 + 全库同类/全部」四档排名便于判读位置。'],["首次出现",H(s,"firstSeenAt")],["最近强化",H(s,"lastReinforcedAt")],["证据数",q(s.evidenceCount)]],M=Array.isArray(s.evidence)?s.evidence:[];return e.jsxs(e.Fragment,{children:[b,e.jsx(pe,{rows:S}),e.jsx(Le,{list:M})]})}if(a==="entity"){const S=Array.isArray(s.aliases)?s.aliases.filter(F=>typeof F=="string").join(" / "):void 0,M=[["名称",P(s.name)],["类型",P(s.entityKind)],["别名",S||void 0],["摘要",P(s.summary)],["合并强度",typeof s.weight=="number"?s.weight.toFixed(2):void 0,"按 (kind, name) 重复合并的累计强度:0.5 起步,每次合并 +(1−prev)·delta(默认 delta=0.1)。语义 = 被强化次数,不是重要性。"],["图重要性",r(typeof s.lastPageRank=="number"?s.lastPageRank:void 0),"最近一次 evictByQuota 计算的全图 PageRank 分数。多人共同指向的实体一般分数更高。下方附「子图同类/全部 + 全库同类/全部」四档排名便于判读位置。"],["首次出现",H(s,"firstSeenAt")],["最近强化",H(s,"lastReinforcedAt")],["证据数",q(s.evidenceCount)]],E=Array.isArray(s.evidence)?s.evidence:[];return e.jsxs(e.Fragment,{children:[b,e.jsx(pe,{rows:M}),e.jsx(Le,{list:E})]})}return e.jsxs(e.Fragment,{children:[b,e.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:11,margin:0,color:"var(--text)"},children:JSON.stringify(s,null,2)})]})}const Ae={skills:e.jsx(yt,{size:18}),scheduler:e.jsx(it,{size:18}),browser:e.jsx(ot,{size:18}),memory:e.jsx(ht,{size:18}),tools:e.jsx(st,{size:18}),agent:e.jsx(nt,{size:18}),default:e.jsx(gt,{size:18})};function He({comp:t,pluginName:s,refreshTick:l}){const[u,h]=d.useState("—"),[o,a]=d.useState(!0);d.useEffect(()=>{a(!0),D(s,t.source).then(b=>{b&&h(b.value)}).catch(()=>{}).finally(()=>a(!1))},[s,t.source,l]);const r=Ae[t.icon??""]??Ae.default;return e.jsxs("div",{className:"dyn-stat-card",children:[e.jsx("div",{className:"dyn-stat-icon",children:r}),e.jsxs("div",{className:"dyn-stat-body",children:[e.jsx("div",{className:"dyn-stat-label",children:t.label}),e.jsx("div",{className:"dyn-stat-value",children:o?"...":u})]})]})}function Et({target:t,onZero:s}){const[l,u]=d.useState(Date.now()),h=d.useRef(!1);if(d.useEffect(()=>{h.current=!1;const r=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(r)},[t]),!t||t<=0)return e.jsx("span",{children:"-"});const o=Math.max(0,Math.round((t-l)/1e3));if(o===0&&!h.current)return h.current=!0,s&&setTimeout(s,3e3),e.jsx("span",{className:"countdown-fired",children:"⏳ 执行中"});if(o===0)return e.jsx("span",{className:"countdown-fired",children:"⏳ 执行中"});let a;if(o<60)a=`${o}秒`;else if(o<3600){const r=Math.floor(o/60),b=o%60;a=b>0?`${r}分${b}秒`:`${r}分`}else{const r=Math.floor(o/3600),b=Math.floor(o%3600/60);a=b>0?`${r}时${b}分`:`${r}时`}return e.jsx("span",{className:o<=5?"countdown-imminent":"",children:a})}function It({text:t}){const[s,l]=d.useState(!1);return t?e.jsxs("div",{className:`dyn-cell-expandable${s?" expanded":""}`,children:[e.jsx("span",{className:"dyn-cell-expandable-text",children:t}),e.jsx("button",{type:"button",className:"dyn-cell-expandable-toggle",onClick:()=>l(u=>!u),title:s?"收起":"展开",children:s?"收起":"展开"})]}):null}function Pt({comp:t,pluginName:s,refreshTick:l}){const[u,h]=d.useState([]),[o,a]=d.useState(!0),[r,b]=d.useState(null),[S,M]=d.useState(""),E=d.useCallback(()=>{a(!0),D(s,t.source).then(p=>{Array.isArray(p)&&h(p)}).catch(()=>{}).finally(()=>a(!1))},[s,t.source]);d.useEffect(()=>{if(E(),t.refresh&&t.refresh>0){const p=setInterval(E,t.refresh*1e3);return()=>clearInterval(p)}},[E,t.refresh,l]);const F=async(p,C)=>{if(p.confirm&&!confirm(p.confirm))return;const v=await D(s,p.method,C);p.danger||p.confirm?E():v&&typeof v=="object"&&!Array.isArray(v)?b(v):E()},j=p=>{if(!p.minWidth&&!p.maxWidth)return;const C={};return p.minWidth&&(C.minWidth=`${p.minWidth}px`),p.maxWidth&&(C.maxWidth=`${p.maxWidth}px`),C},A=(()=>{if(!t.searchable)return u;const p=S.toLowerCase().split(/\s+/).filter(Boolean);return p.length===0?u:u.filter(C=>{const v=t.columns.map($=>String(C[$.key]??"")).join(" ").toLowerCase();return p.every($=>v.includes($))})})();return e.jsxs("div",{className:"dyn-table-block",children:[t.label&&e.jsx("h3",{className:"dyn-section-title",children:t.label}),t.searchable?e.jsxs("div",{style:{marginBottom:6},children:[e.jsx("input",{type:"text",value:S,onChange:p=>M(p.target.value),placeholder:t.searchPlaceholder??"搜索(空格分隔多个关键词,AND 语义)",style:{width:"100%",maxWidth:360,padding:"4px 8px",fontSize:12,border:"1px solid var(--border-color, #ddd)",borderRadius:4,background:"transparent",color:"inherit"}}),S?e.jsxs("span",{style:{marginLeft:8,fontSize:11,color:"var(--text-muted)"},children:[A.length,"/",u.length]}):null]}):null,o&&u.length===0?e.jsx("div",{className:"empty-hint",children:"加载中..."}):A.length===0?e.jsx("div",{className:"empty-hint",children:S?"无匹配":"暂无数据"}):e.jsx("div",{className:"dyn-table-scroll",children:e.jsxs("table",{className:"dyn-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[t.columns.map(p=>e.jsx("th",{className:p.nowrap?"dyn-cell-nowrap":void 0,style:j(p),children:p.label},p.key)),t.actions&&t.actions.length>0&&e.jsx("th",{children:"操作"})]})}),e.jsx("tbody",{children:A.map((p,C)=>e.jsxs("tr",{children:[t.columns.map(v=>e.jsx("td",{className:v.nowrap?"dyn-cell-nowrap":void 0,style:j(v),children:v.render==="countdown"?e.jsx(Et,{target:Number(p[v.key])||0,onZero:E}):v.render==="status-badge"?e.jsx("span",{className:`dyn-badge dyn-badge-${String(p[v.key])}`,children:String(p[v.key]??"")}):v.render==="code"?e.jsx("code",{children:String(p[v.key]??"")}):v.render==="expandable-text"?e.jsx(It,{text:String(p[v.key]??"")}):String(p[v.key]??"")},v.key)),t.actions&&t.actions.length>0&&e.jsx("td",{className:"dyn-table-actions",children:t.actions.map((v,$)=>e.jsx("button",{className:`btn btn-sm${v.danger?" btn-danger":""}`,onClick:()=>F(v,p),children:v.label},$))})]},C))})]})}),r&&e.jsx("div",{className:"dyn-detail-overlay",onClick:()=>b(null),children:e.jsxs("div",{className:"dyn-detail-modal",onClick:p=>p.stopPropagation(),children:[e.jsxs("div",{className:"dyn-detail-header",children:[e.jsx("span",{className:"dyn-detail-title",children:String(r.name||r.title||"详情")}),e.jsx("button",{className:"dyn-detail-close",onClick:()=>b(null),children:"×"})]}),e.jsx("div",{className:"dyn-detail-body",children:Object.entries(r).map(([p,C])=>{const v=C==null?"":typeof C=="object"?JSON.stringify(C,null,2):String(C),$=v.length>120||v.includes(`
|
|
19
|
-
`);return e.jsxs("div",{className:"dyn-detail-field",children:[e.jsx("div",{className:"dyn-detail-key",children:p}),$?e.jsx("pre",{className:"dyn-detail-pre",children:v}):e.jsx("div",{className:"dyn-detail-val",children:v})]},p)})})]})})]})}function Ft({comp:t,pluginName:s}){const[l,u]=d.useState({}),[h,o]=d.useState(!0),[a,r]=d.useState(!1),[b,S]=d.useState(""),M=d.useRef({}),[E,F]=d.useState(void 0);d.useEffect(()=>{o(!0),D(s,t.source).then(C=>{C&&u(C)}).catch(()=>{}).finally(()=>o(!1))},[s,t.source]);const j=async()=>{r(!0),S("");try{await D(s,t.save,l),S("已保存")}catch{S("保存失败")}r(!1)},A=C=>{ge(`/api/models/${C}`).then(v=>{const $=v.providers&&v.providers.length>0?v.providers.map(z=>({label:`${z.provider} / ${z.model}`,value:z.value})):(v.models??[]).map(z=>({label:z,value:z}));M.current={...M.current,[C]:$}}).catch(()=>{})},p=()=>{E||ge("/api/llm-providers").then(C=>F(C.providers??[])).catch(()=>F([]))};return h?e.jsx("div",{className:"empty-hint",children:"加载中..."}):e.jsxs("div",{className:"dyn-form-block",children:[t.label&&e.jsx("h3",{className:"dyn-section-title",children:t.label}),e.jsx(rt,{schema:t.schema,draft:l,onChange:u,modelCache:M.current,onFetchModels:A,llmProviders:E,onFetchLLMProviders:p}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12,alignItems:"center"},children:[e.jsx("button",{className:"btn btn-sm btn-primary",onClick:j,disabled:a,children:a?"保存中...":"保存"}),b&&e.jsx("span",{style:{fontSize:13,color:b==="已保存"?"#22c55e":"#ef4444"},children:b})]})]})}function Mt({comp:t,pluginName:s,onRefresh:l}){const[u,h]=d.useState({}),o=async a=>{if(!(a.confirm&&!confirm(a.confirm))){h(r=>({...r,[a.method]:"执行中..."}));try{await D(s,a.method),h(r=>({...r,[a.method]:"完成"})),l()}catch{h(r=>({...r,[a.method]:"失败"}))}}};return e.jsxs("div",{className:"dyn-actions-block",children:[t.label&&e.jsx("div",{className:"dyn-section-title",children:t.label}),e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:t.items.map((a,r)=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx("button",{className:`btn btn-sm${a.danger?" btn-danger":a.variant==="primary"?" btn-primary":""}`,onClick:()=>o(a),children:a.label}),u[a.method]&&e.jsx("span",{className:"dyn-action-msg",children:u[a.method]})]},r))})]})}function Lt({comp:t,pluginName:s,refreshTick:l}){const[u,h]=d.useState(null);return d.useEffect(()=>{D(s,t.source).then(o=>{o&&h(o)}).catch(()=>{})},[s,t.source,l]),e.jsxs("div",{className:"dyn-info-block",children:[t.label&&e.jsx("h3",{className:"dyn-section-title",children:t.label}),u?e.jsx("div",{className:"dyn-info-grid",children:Object.entries(u).map(([o,a])=>e.jsxs("div",{className:"dyn-info-item",children:[e.jsx("span",{className:"dyn-info-key",children:o}),e.jsx("span",{className:"dyn-info-val",children:typeof a=="object"?JSON.stringify(a):String(a??"")})]},o))}):e.jsx("div",{className:"empty-hint",children:"加载中..."})]})}function At({comp:t,pluginName:s,refreshTick:l}){const[u,h]=d.useState("");return d.useEffect(()=>{D(s,t.source).then(o=>{o&&h(o.content)}).catch(()=>{})},[s,t.source,l]),e.jsxs("div",{className:"dyn-markdown-block",children:[t.label&&e.jsx("h3",{className:"dyn-section-title",children:t.label}),e.jsx(lt,{remarkPlugins:[ct],rehypePlugins:[dt],children:u})]})}function $t({comp:t,pluginName:s,refreshTick:l,onRefresh:u}){var r;const[h,o]=d.useState(((r=t.items[0])==null?void 0:r.key)??""),a=t.items.find(b=>b.key===h);return e.jsxs("div",{className:"dyn-tabs-block",children:[t.label&&e.jsx("h3",{className:"dyn-section-title",children:t.label}),e.jsx("div",{className:"dyn-tabs-header",children:t.items.map(b=>e.jsx("button",{className:`dyn-tab-btn${h===b.key?" active":""}`,onClick:()=>o(b.key),children:b.label},b.key))}),e.jsx("div",{className:"dyn-tabs-body",children:a&&a.content.map((b,S)=>e.jsx(We,{component:b,pluginName:s,refreshTick:l,onRefresh:u},S))})]})}function We({component:t,pluginName:s,refreshTick:l,onRefresh:u}){switch(t.type){case"stat":return e.jsx(He,{comp:t,pluginName:s,refreshTick:l});case"table":return e.jsx(Pt,{comp:t,pluginName:s,refreshTick:l});case"form":return e.jsx(Ft,{comp:t,pluginName:s});case"actions":return e.jsx(Mt,{comp:t,pluginName:s,onRefresh:u});case"info":return e.jsx(Lt,{comp:t,pluginName:s,refreshTick:l});case"markdown":return e.jsx(At,{comp:t,pluginName:s,refreshTick:l});case"tabs":return e.jsx($t,{comp:t,pluginName:s,refreshTick:l,onRefresh:u});case"graph":return e.jsx(wt,{comp:t,pluginName:s,refreshTick:l,onRefresh:u});default:return null}}function Yt({page:t}){const[s,l]=d.useState(0),u=d.useCallback(()=>l(a=>a+1),[]);if(d.useEffect(()=>{const a=r=>{const b=r.detail;(!b.pluginName||b.pluginName===t.plugin)&&u()};return window.addEventListener("aalis:page-refresh",a),()=>window.removeEventListener("aalis:page-refresh",a)},[t.plugin,u]),!t.content||t.content.length===0)return e.jsx("div",{className:"empty-hint",style:{padding:24},children:"此页面未提供内容"});const h=[];for(const a of t.content)if(a.type==="stat"){const r=h[h.length-1];r&&r.type==="stat-grid"?r.items.push(a):h.push({type:"stat-grid",items:[a]})}else h.push({type:"component",item:a});const o=h.some(a=>a.type==="component"&&a.item.type==="graph");return e.jsx("div",{className:`page-content dynamic-page${o?" has-graph":""}`,children:h.map((a,r)=>{const b=o&&a.type==="component"&&a.item.type==="tabs";return a.type==="stat-grid"?e.jsx("div",{className:"dyn-stat-grid",children:a.items.map((S,M)=>e.jsx(He,{comp:S,pluginName:t.plugin,refreshTick:s},M))},r):e.jsx("div",{className:b?"dyn-scroll-region":void 0,children:e.jsx(We,{component:a.item,pluginName:t.plugin,refreshTick:s,onRefresh:u})},r)})})}export{Yt as DynamicPage};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as s,r}from"./react-vendor-BPQixOLZ.js";import{c as oe,a as g,T as V,D as de}from"./index-C6kOarnb.js";import{u as me}from"./ConfirmDialog-DbV-E1Nd.js";import{C as ue}from"./clock-RQMz9x7Y.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-B2G8c9k5.js";/**
|
|
2
|
-
* @license lucide-react v1.7.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const he=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]],pe=oe("scale",he);function M({node:t,mode:o,depth:d=0}){var n,p;const m=((n=t.services)==null?void 0:n.requires)??[],u=((p=t.services)==null?void 0:p.provides)??[];return s.jsxs("div",{className:"dep-tree-node",style:d>0?{marginLeft:14}:void 0,children:[s.jsxs("div",{className:"dep-tree-row",children:[s.jsx("span",{className:"dep-tree-name",children:t.name}),!t.present&&s.jsx("span",{className:"dep-tree-tag dep-tag-missing",children:o==="install"?"将引入":"未装"}),m.length>0&&s.jsxs("span",{className:"dep-tree-tag dep-tag-req",children:["需 ",m.join("、")]}),u.length>0&&s.jsxs("span",{className:"dep-tree-tag dep-tag-prov",children:["供 ",u.join("、")]})]}),t.children.map(w=>s.jsx(M,{node:w,mode:o,depth:d+1},w.name))]})}function fe({graph:t}){const o=t.upstream.children,{required:d,provides:m}=t.services,u=t.downstream.children.map(n=>n.name);return s.jsxs("div",{className:"dep-disclosure",children:[s.jsx("div",{className:"dep-section-label",children:"依赖关系"}),o.length>0?o.map(n=>s.jsx(M,{node:n,mode:"install"},n.name)):s.jsx("div",{className:"dep-empty",children:"无 import 依赖"}),d.length>0&&s.jsxs("div",{className:"dep-line",children:["需要服务:",d.map(n=>s.jsxs("span",{className:`dep-svc ${n.providedBy?"ok":"warn"}`,children:[n.service,n.providedBy?`(✓ ${n.providedBy})`:"(⚠ 无提供者)"]},n.service))]}),m.length>0&&s.jsxs("div",{className:"dep-line",children:["提供服务:",m.join("、")]}),u.length>0&&s.jsxs("div",{className:"dep-line",children:["已装插件中依赖它的:",u.join("、")]})]})}function xe({graph:t}){const o=t.downstream.children;return o.length===0&&t.serviceDependents.length===0?null:s.jsxs("div",{className:"dep-uninstall-warn",children:[t.serviceDependents.length>0&&s.jsxs("div",{className:"dep-line dep-warn-block",children:["⛔ 依赖它提供的服务且无替代:",t.serviceDependents.join("、"),s.jsx("br",{}),"(卸载会被拒绝,请先卸载它们或装替代提供者)"]}),o.length>0&&s.jsxs("div",{className:"dep-warn-block",children:[s.jsx("div",{children:"⚠️ 这些已装插件 import 了它(删除后可能无法启动,需重新安装恢复):"}),o.map(d=>s.jsx(M,{node:d,mode:"view"},d.name))]})]})}const Y={workspace:{label:"工作区",hint:"源码在本仓库内,改代码即生效,不经市场更新"},link:{label:"本地链接",hint:"由 file: / link: 指向本地目录,更新请改那份源码"},git:{label:"外部源",hint:"由 git / URL / user-repo 简写安装,更新请改依赖声明"},alias:{label:"别名",hint:"由 npm: 别名指向另一个包,市场更新会拆掉别名,故不提供"},transitive:{label:"依赖引入",hint:"由其它包引入,版本随父包的范围,不单独更新"}},H={relevance:"默认排序",downloads:"下载量",updated:"最近更新",score:"综合评分"},K={all:"全部来源",official:"仅官方",community:"仅社区"},Q={all:"全部状态",installed:"已安装",available:"未安装"},z={all:"全部类型",plugin:"功能插件",interface:"前端界面",core:"内核",runtime:"宿主",api:"API 契约",schema:"数据规范",util:"工具库"},B=new Set(["plugin","interface"]);function je(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function ve(t){if(!t)return"";const o=Date.parse(t);if(Number.isNaN(o))return"";const d=Math.max(0,(Date.now()-o)/1e3),m=[[31536e3,"年"],[2592e3,"个月"],[86400,"天"],[3600,"小时"],[60,"分钟"]];for(const[u,n]of m)if(d>=u)return`${Math.floor(d/u)} ${n}前`;return"刚刚"}function Ce({plugins:t,onRefresh:o,onRestart:d}){const{confirm:m,dialog:u}=me(),[n,p]=r.useState(null),[w,U]=r.useState(null),[y,X]=r.useState([]),[C,_]=r.useState(!1),[O,Z]=r.useState(!1),[A,P]=r.useState(null),[k,F]=r.useState(""),[N,ee]=r.useState("relevance"),[L,se]=r.useState("all"),[T,ae]=r.useState("all"),[D,te]=r.useState("plugin"),[W,I]=r.useState(new Set),[S,G]=r.useState(!1),[f,R]=r.useState(null),E=r.useRef(0),x=e=>{U(e),setTimeout(()=>U(null),2500)},$=r.useCallback(async()=>{const e=++E.current;_(!0),P(null);try{const[l,a]=await Promise.all([g("/api/marketplace?q="),g("/api/system-components").catch(()=>({components:[]}))]),i=l.packages??[],v=new Set(i.map(c=>c.name)),h=(a.components??[]).filter(c=>!v.has(c.name)).map(c=>({name:c.name,description:c.description??"",version:c.latest??c.version??"",resolved:c.version,request:c.request,origin:c.origin,updatable:c.updatable??!1,installed:!0,official:c.name.startsWith("@aalis/"),category:c.kind}));if(e!==E.current)return;X([...i,...h]),l.warning&&P(l.warning)}catch{if(e!==E.current)return;x("无法加载插件市场")}e===E.current&&(_(!1),Z(!0))},[]);r.useEffect(()=>{$()},[$]);const J=r.useMemo(()=>new Set(t.map(e=>e.name)),[t]),b=r.useMemo(()=>y.filter(e=>e.updatable),[y]);r.useEffect(()=>{I(e=>{const l=new Set(b.map(i=>i.name)),a=new Set([...e].filter(i=>l.has(i)));return a.size===e.size?e:a})},[b]);const j=b.filter(e=>W.has(e.name)),ne=j.some(e=>e.category==="core"||e.category==="runtime"),le=e=>I(l=>{const a=new Set(l);return a.has(e)?a.delete(e):a.add(e),a}),ie=async()=>{if(!(j.length===0||S)){G(!0),R(null);try{const e=await g("/api/marketplace/update",{method:"POST",body:JSON.stringify({targets:j.map(l=>({name:l.name,version:l.version}))})});R(e),e.ok&&e.restarting&&(d==null||d(`正在应用 ${j.length} 项更新并重启…`))}catch(e){R({ok:!1,message:e instanceof Error?e.message:String(e)})}G(!1)}},q=r.useMemo(()=>{const e=k.trim().toLowerCase().split(/\s+/).filter(Boolean),l=y.map(a=>({...a,installed:a.installed||J.has(a.name)})).filter(a=>{if(D!=="all"&&(a.category??"plugin")!==D||L==="official"&&!a.official||L==="community"&&a.official||T==="installed"&&!a.installed||T==="available"&&a.installed)return!1;if(e.length){const i=`${a.name} ${a.description} ${(a.keywords??[]).join(" ")} ${a.author??""}`.toLowerCase();if(!e.every(v=>i.includes(v)))return!1}return!0});return N==="relevance"?l:l.sort((a,i)=>N==="downloads"?(i.downloads??0)-(a.downloads??0):N==="score"?(i.score??0)-(a.score??0):N==="updated"?Date.parse(i.updated??"0")-Date.parse(a.updated??"0"):0)},[y,J,k,N,L,T,D]),re=async(e,l)=>{let a=null;try{a=await g(`/api/marketplace/depgraph?name=${encodeURIComponent(e)}`)}catch{}if(await m({title:`安装${l?"官方插件":"第三方社区插件"}「${e}」`,body:s.jsxs(s.Fragment,{children:[a&&s.jsx(fe,{graph:a}),s.jsx("div",{className:"dep-note",children:"将从 npm 安装。安装后它以你授予的能力运行(可在权限页查看依赖与权限)。请确认来源可信。"})]}),confirmLabel:"安装"})){p(e);try{const h=await g("/api/marketplace/install",{method:"POST",body:JSON.stringify({name:e})});h.ok?(x(h.message??`${e} 已安装`),o(),$()):x(h.error??h.message??"安装失败")}catch{x("安装失败")}p(null)}},ce=async e=>{let l=null;try{l=await g(`/api/marketplace/depgraph?name=${encodeURIComponent(e)}`)}catch{}if(await m({title:`卸载「${e}」`,body:s.jsxs(s.Fragment,{children:[l&&s.jsx(xe,{graph:l}),s.jsx("div",{className:"dep-note",children:"将删除其代码目录并清除残留配置。不可恢复,但可从市场重新安装。"})]}),confirmLabel:"卸载",danger:!0})){p(e);try{const i=await g("/api/marketplace/uninstall",{method:"POST",body:JSON.stringify({name:e})});i.ok?(x(i.message??`${e} 已卸载`),o(),$()):x(i.error??i.message??"卸载失败")}catch{x("卸载失败")}p(null)}};return s.jsxs("div",{className:"page-content page-marketplace",children:[u,w&&s.jsx("div",{className:"toast",children:w}),s.jsxs("div",{className:"section-label",children:["插件市场",O&&s.jsxs("span",{className:"market-count",children:["显示 ",q.length," / 共 ",y.length]})]}),b.length>0&&s.jsxs("div",{className:"update-panel",children:[s.jsxs("div",{className:"update-panel-head",children:[s.jsxs("span",{children:["可更新 ",b.length," 项,已选 ",j.length]}),s.jsxs("div",{className:"update-panel-actions",children:[s.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>I(new Set(b.map(e=>e.name))),disabled:S,children:"全选"}),s.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:ie,disabled:S||j.length===0,children:S?"正在更新…":`更新所选(${j.length})`})]})]}),ne&&s.jsxs("div",{className:"update-panel-warn",children:[s.jsx(V,{size:14})," 所选包含内核或宿主,更新后将重启整个应用;新版本起不来会自动回滚。"]}),s.jsx("div",{className:"update-panel-note",children:"所选项**一次性提交**:先整组做依赖预检,通过后一次安装、一次重启。任一项的 peer 版本不兼容则整批不执行且不改动任何文件——此时把它要求的包(如内核)一并勾选再试。"})]}),f&&s.jsxs("div",{className:f.ok?"update-result ok":"update-result err",children:[s.jsx("div",{children:f.error??f.message??"更新失败"}),f.conflicts&&f.conflicts.length>0&&s.jsx("ul",{className:"update-conflicts",children:f.conflicts.map(e=>s.jsx("li",{children:e},e))})]}),s.jsxs("div",{className:"market-filter-row",children:[s.jsx("input",{className:"config-edit-input",style:{flex:1,minWidth:180},placeholder:"搜索插件(名称 / 描述 / 关键词 / 作者)",value:k,onChange:e=>F(e.target.value)}),s.jsx("select",{className:"config-edit-input",value:D,onChange:e=>te(e.target.value),title:"组件类型",children:Object.keys(z).map(e=>s.jsx("option",{value:e,children:z[e]},e))}),s.jsx("select",{className:"config-edit-input",value:L,onChange:e=>se(e.target.value),children:Object.keys(K).map(e=>s.jsx("option",{value:e,children:K[e]},e))}),s.jsx("select",{className:"config-edit-input",value:T,onChange:e=>ae(e.target.value),children:Object.keys(Q).map(e=>s.jsx("option",{value:e,children:Q[e]},e))}),s.jsx("select",{className:"config-edit-input",value:N,onChange:e=>ee(e.target.value),title:"排序",children:Object.keys(H).map(e=>s.jsx("option",{value:e,children:H[e]},e))}),s.jsx("button",{className:"btn-sm",onClick:()=>$(),disabled:C,children:C?"加载中...":"刷新"})]}),!O&&C&&s.jsxs("div",{className:"empty-hint",style:{padding:16},children:["正在从 npm 加载带 ",s.jsx("code",{children:"aalis-plugin"})," 标签的插件…"]}),A&&s.jsx("div",{className:"empty-hint",style:{padding:12,color:"var(--warning, #ffb300)"},children:A}),O&&q.length===0&&!C&&!A&&s.jsx("div",{className:"empty-hint",style:{padding:16},children:y.length===0?"未找到任何插件":"无匹配项 —— 试试调整搜索词或筛选条件"}),s.jsx("div",{className:"marketplace-grid",children:q.map(e=>{var i,v,h;const l=((i=e.links)==null?void 0:i.homepage)||((v=e.links)==null?void 0:v.repository)||((h=e.links)==null?void 0:h.npm),a=l&&/^https?:\/\//i.test(l)?l:void 0;return s.jsxs("div",{className:"marketplace-card",children:[s.jsxs("div",{className:"marketplace-card-info",children:[a?s.jsx("a",{className:"marketplace-card-name",href:a,target:"_blank",rel:"noreferrer",children:e.name}):s.jsx("span",{className:"marketplace-card-name",children:e.name}),s.jsx("span",{className:"marketplace-card-version",children:e.installed?e.resolved?`v${e.resolved}`:"版本未知":`v${e.version}`}),s.jsx("span",{className:`badge ${e.official?"official":"community"}`,children:e.official?"官方":"社区"}),e.category&&e.category!=="plugin"&&s.jsx("span",{className:"badge",title:"组件类别",children:z[e.category]}),e.insecure&&s.jsxs("span",{className:"badge",style:{background:"var(--danger)",color:"#fff",display:"inline-flex",alignItems:"center",gap:3},title:"npm 标记为不安全包,谨慎安装",children:[s.jsx(V,{size:11})," 不安全"]}),e.author&&s.jsxs("span",{className:"marketplace-card-author",children:["by ",e.author]}),e.installed&&s.jsx("span",{className:"badge active",children:"已安装"}),e.installed&&e.origin&&e.origin!=="registry"&&s.jsx("span",{className:"badge",title:Y[e.origin].hint,children:Y[e.origin].label}),e.updatable&&s.jsxs("label",{className:"badge",style:{background:"var(--warning)",color:"#1a1a1a",cursor:"pointer"},title:`本地 v${e.resolved}(声明 ${e.request??"?"}),npm 最新 v${e.version}。勾选后用顶部「更新所选」批量提交`,children:[s.jsx("input",{type:"checkbox",checked:W.has(e.name),onChange:()=>le(e.name),disabled:S,style:{marginRight:4}}),"可更新 v",e.version]})]}),s.jsx("div",{className:"marketplace-card-desc",children:e.description||"(无描述)"}),e.keywords&&e.keywords.length>0&&s.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:4},children:e.keywords.slice(0,6).map(c=>s.jsx("button",{type:"button",className:"market-kw",title:`按 “${c}” 筛选`,onClick:()=>F(c),children:c},c))}),s.jsxs("div",{className:"market-meta",children:[e.downloads!=null&&s.jsxs("span",{className:"market-meta-item",title:"近一月下载量",children:[s.jsx(de,{size:12})," ",je(e.downloads),"/月"]}),e.updated&&s.jsxs("span",{className:"market-meta-item",title:new Date(e.updated).toLocaleString(),children:[s.jsx(ue,{size:12})," ",ve(e.updated)]}),e.license&&s.jsxs("span",{className:"market-meta-item",title:"许可证",children:[s.jsx(pe,{size:12})," ",e.license]})]}),s.jsxs("div",{style:{marginTop:8},children:[!B.has(e.category??"plugin")&&s.jsx("span",{className:"market-meta-item",title:"随脚手架就位或作为插件依赖自动安装/卸载,无需也无法单独装卸",children:"随依赖管理"}),B.has(e.category??"plugin")&&!e.installed&&s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>re(e.name,e.official),disabled:n!==null,title:n&&n!==e.name?`请等待 ${n} 处理完成`:void 0,children:n===e.name?"安装中...":"安装"}),B.has(e.category??"plugin")&&e.installed&&s.jsx("button",{className:"btn btn-sm",style:{color:"var(--danger)"},onClick:()=>ce(e.name),disabled:n!==null,title:n&&n!==e.name?`请等待 ${n} 处理完成`:"卸载插件(删包 + 清配置)",children:n===e.name?"处理中...":"卸载"})]})]},e.name)})})]})}export{Ce as MarketplacePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ai as o,aj as n}from"./mermaid.core-DX1iGORO.js";const t=(a,r)=>o.lang.round(n.parse(a)[r]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as t,C as e}from"./chunk-727SXJPM-CtzK3fFt.js";import{_ as i}from"./mermaid.core-DX1iGORO.js";import"./chunk-FMBD7UC4-9CNqmsuy.js";import"./chunk-ND2GUHAM-B9JC5LqN.js";import"./chunk-55IACEB6-CJ9T8Wtu.js";import"./chunk-2J33WTMH-COYrBuB8.js";import"./index-C6kOarnb.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-B2G8c9k5.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as t,C as e}from"./chunk-727SXJPM-CtzK3fFt.js";import{_ as i}from"./mermaid.core-DX1iGORO.js";import"./chunk-FMBD7UC4-9CNqmsuy.js";import"./chunk-ND2GUHAM-B9JC5LqN.js";import"./chunk-55IACEB6-CJ9T8Wtu.js";import"./chunk-2J33WTMH-COYrBuB8.js";import"./index-C6kOarnb.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-B2G8c9k5.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
|