chatlab-cli 0.22.1 → 0.23.0
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/{chunk-OC2W5Q5T.mjs → chunk-3MX7VF2B.mjs} +2 -2
- package/dist/chunk-5ADKYYNA.mjs +28 -0
- package/dist/chunk-5ADKYYNA.mjs.map +1 -0
- package/dist/{chunk-QRC3RSER.mjs → chunk-643S2N2U.mjs} +2 -2
- package/dist/{chunk-XPBPKH6B.mjs → chunk-D2BR3MFN.mjs} +107 -37
- package/dist/chunk-D2BR3MFN.mjs.map +1 -0
- package/dist/{chunk-6NB475AA.mjs → chunk-FJ35V3TE.mjs} +2 -17
- package/dist/chunk-FJ35V3TE.mjs.map +1 -0
- package/dist/{chunk-SQKT45MM.mjs → chunk-G7Q7EQ3V.mjs} +546 -84
- package/dist/chunk-G7Q7EQ3V.mjs.map +1 -0
- package/dist/{chunk-LZ3W6NS5.mjs → chunk-NTWDG52H.mjs} +66 -68
- package/dist/chunk-NTWDG52H.mjs.map +1 -0
- package/dist/{chunk-Z2LYMKCC.mjs → chunk-WTQ7LAZR.mjs} +2 -2
- package/dist/cli.mjs +4 -3
- package/dist/{http-O5P4BYXU.mjs → http-2DN3XOXO.mjs} +8 -7
- package/dist/{import-BDLL3DG7.mjs → import-LCBSBLYF.mjs} +4 -4
- package/dist/index.mjs +10 -9
- package/dist/{mcp-L2TPZFE7.mjs → mcp-AR7HBIK4.mjs} +8 -6
- package/dist/{mcp-L2TPZFE7.mjs.map → mcp-AR7HBIK4.mjs.map} +1 -1
- package/dist/service-WNEVPQ4N.mjs +258 -0
- package/dist/service-WNEVPQ4N.mjs.map +1 -0
- package/dist/{src-FVJL5ENA.mjs → src-EGXULYFQ.mjs} +2 -2
- package/dist/{stream-import-ZTEW3YVL.mjs → stream-import-QM5R5FDG.mjs} +3 -3
- package/dist/{update-checker-MQMQ6A4B.mjs → update-checker-JG5K67O2.mjs} +3 -2
- package/dist/{update-checker-MQMQ6A4B.mjs.map → update-checker-JG5K67O2.mjs.map} +1 -1
- package/dist-web/assets/{DebugToolsPanel-DkbsB6lr.css → DebugToolsPanel-D9O_4J04.css} +1 -1
- package/dist-web/assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-hp9Mjpub.js +161 -0
- package/dist-web/assets/{EChartWordcloud-Ubal_aYg.js → EChartWordcloud-Cenbzcyj.js} +1 -1
- package/dist-web/assets/MessageExportModal-CvocO88D.js +1 -0
- package/dist-web/assets/electron-DpE69lO4.js +1 -0
- package/dist-web/assets/electron-SyPZX9OU.js +1 -0
- package/dist-web/assets/{fetch-BS4SlQjA.js → fetch-B7OBmANJ.js} +1 -1
- package/dist-web/assets/{fetch-o5NJ2uWE.js → fetch-BikSxuED.js} +1 -1
- package/dist-web/assets/fetch-BwMZFwbF.js +1 -0
- package/dist-web/assets/fetch-CfTcWxqG.js +1 -0
- package/dist-web/assets/fetch-DTP8Q782.js +17 -0
- package/dist-web/assets/{fetch-W43zfemj.js → fetch-LBHcBBkv.js} +1 -1
- package/dist-web/assets/http-C741fIwb.js +1 -0
- package/dist-web/assets/index-B6dkyIiA.js +2 -0
- package/dist-web/assets/index-CALU1QPF.js +163 -0
- package/dist-web/assets/{index-DOwQB7In.js → index-CHkXbqMb.js} +1 -1
- package/dist-web/assets/{index-DSpvXged.css → index-CvuHOeoU.css} +1 -1
- package/dist-web/assets/{index-BE64tUWq.css → index-CxMP0DNd.css} +1 -1
- package/dist-web/assets/index-DOS5o2_H.js +7 -0
- package/dist-web/assets/{index-CbQMfheg.css → index-DuepdDzz.css} +1 -1
- package/dist-web/assets/index-niwrSprs.js +173 -0
- package/dist-web/assets/model-catalog-DUuKjIVU.js +1 -0
- package/dist-web/assets/{vendor-nuxt-ui-7OAuiz_i.js → vendor-nuxt-ui-CuCZ1aRl.js} +2 -2
- package/dist-web/assets/vendor-reka-ui-BrTYuIfH.js +11 -0
- package/dist-web/assets/{web-Cx5APyCN.js → web-DGd63PrV.js} +1 -1
- package/dist-web/index.html +4 -4
- package/package.json +1 -1
- package/dist/chunk-6NB475AA.mjs.map +0 -1
- package/dist/chunk-LZ3W6NS5.mjs.map +0 -1
- package/dist/chunk-SQKT45MM.mjs.map +0 -1
- package/dist/chunk-XPBPKH6B.mjs.map +0 -1
- package/dist-web/assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-CqacsKDU.js +0 -147
- package/dist-web/assets/MessageExportModal-D1GY6WSV.js +0 -1
- package/dist-web/assets/electron-8qi0d92j.js +0 -1
- package/dist-web/assets/electron-CsUM2O_Y.js +0 -1
- package/dist-web/assets/fetch-BOogCPfg.js +0 -1
- package/dist-web/assets/fetch-CclRWOHf.js +0 -1
- package/dist-web/assets/fetch-CxwnEEqk.js +0 -17
- package/dist-web/assets/http-CeXMt-Fv.js +0 -1
- package/dist-web/assets/index-CM29Kc4p.js +0 -173
- package/dist-web/assets/index-D183wYuz.js +0 -7
- package/dist-web/assets/index-DTxRy2FH.js +0 -163
- package/dist-web/assets/index-grds3iG-.js +0 -2
- package/dist-web/assets/vendor-reka-ui-CW2cIgMu.js +0 -11
- /package/dist/{chunk-OC2W5Q5T.mjs.map → chunk-3MX7VF2B.mjs.map} +0 -0
- /package/dist/{chunk-QRC3RSER.mjs.map → chunk-643S2N2U.mjs.map} +0 -0
- /package/dist/{chunk-Z2LYMKCC.mjs.map → chunk-WTQ7LAZR.mjs.map} +0 -0
- /package/dist/{http-O5P4BYXU.mjs.map → http-2DN3XOXO.mjs.map} +0 -0
- /package/dist/{import-BDLL3DG7.mjs.map → import-LCBSBLYF.mjs.map} +0 -0
- /package/dist/{src-FVJL5ENA.mjs.map → src-EGXULYFQ.mjs.map} +0 -0
- /package/dist/{stream-import-ZTEW3YVL.mjs.map → stream-import-QM5R5FDG.mjs.map} +0 -0
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EChartWordcloud-Ubal_aYg.js","assets/vendor-echarts-wordcloud-CZ9gsX8l.js","assets/vendor-echarts-C5u62NnM.js","assets/vendor-zrender-DFl4U2Oe.js","assets/vendor-reka-ui-CW2cIgMu.js","assets/MessageExportModal-D1GY6WSV.js","assets/vendor-nuxt-ui-7OAuiz_i.js","assets/index-D183wYuz.js","assets/vendor-snapdom-XnBoh1gd.js","assets/index-DSpvXged.css","assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-CqacsKDU.js","assets/index-DOwQB7In.js","assets/DebugToolsPanel-DkbsB6lr.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as ze}from"./vendor-snapdom-XnBoh1gd.js";import{l as st,g as _e,a as ge,j as at,b as we,k as Fe,c as nt,e as Be,_ as Ue,p as ot,C as it,u as rt,d as lt}from"./vendor-nuxt-ui-7OAuiz_i.js";import{b as A,d as ke,F as Re,p as P,G as r,P as I,Q as Z,a5 as s,Z as q,a3 as te,T as x,O as He,J as ct,H as N,a0 as be,h as D,w as G,u as t,K as V,L as $,U,R as Q,bI as We,a9 as je,bJ as dt,au as Pe,bF as qe,n as Se,bD as Ne,i as ut}from"./vendor-reka-ui-CW2cIgMu.js";import{n as mt,u as se,i as Ae,T as ce,h as ue,o as gt,p as Ye,_ as Le,q as pt,d as ht,a as vt,s as ft}from"./index-D183wYuz.js";import{a as Te}from"./index-DOwQB7In.js";import{_ as ae,a as K,g as Ge,b as yt,c as ne,d as le,e as xt,f as De,h as bt,i as Ve,j as _t,u as kt,k as wt,l as $t,m as It,n as Ct,o as St,p as Mt,q as Tt,r as Dt,s as Rt,t as Nt,P as At,v as Lt,w as Vt,x as Et,y as Ot,C as zt,z as Ft,A as Bt,D as Ut,B as Ht}from"./DebugToolsPanel.vue_vue_type_script_setup_true_lang-CqacsKDU.js";import"./vendor-echarts-wordcloud-CZ9gsX8l.js";import{u as Je,i as Wt,j as Ke,k as jt,m as Qe,n as Xe,o as Pt,p as qt,q as Yt}from"./vendor-echarts-C5u62NnM.js";import"./vendor-zrender-DFl4U2Oe.js";function Gt(l,a={}){const{threshold:e=300,containerSelector:o=".overflow-y-auto",scrollLockDuration:c=800}=a,u=A(l[0]?.id||"");let d=!1;const g=A(null);let p=null;function _(){if(d)return;const m=[];l.forEach(i=>{const h=document.getElementById(i.id);if(h){const f=h.getBoundingClientRect();m.push({id:i.id,top:Math.round(f.top)})}});let n=0;for(let i=0;i<m.length;i++){if(m[i].top>e){n=Math.max(0,i-1);break}n=i}u.value=l[n]?.id||""}function y(m){const n=document.getElementById(m);n&&(u.value=m,d=!0,n.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout(()=>{d=!1,_()},c))}return ke(()=>{p=g.value?.closest(o)||null,p&&(p.addEventListener("scroll",_,{passive:!0}),_())}),Re(()=>{p&&p.removeEventListener("scroll",_)}),{contentRef:g,activeAnchor:u,scrollToAnchor:y,updateActiveAnchor:_}}const Jt={class:"sticky top-24 space-y-6"},Kt={class:"border-l border-gray-200 dark:border-gray-800"},Qt=["onClick"],Xt=P({__name:"PageAnchorsNav",props:{anchors:{},activeAnchor:{},width:{default:"w-44"},hideOnMobile:{type:Boolean,default:!0}},emits:["click"],setup(l,{emit:a}){const e=a;function o(c){e("click",c)}return(c,u)=>(r(),I("div",{class:Z([l.width,"shrink-0",l.hideOnMobile?"hidden lg:block":""])},[s("div",Jt,[s("nav",null,[s("div",Kt,[(r(!0),I(q,null,te(l.anchors,d=>(r(),I("button",{key:d.id,class:Z(["-ml-px block border-l-2 py-1.5 pl-4 text-left text-sm transition-colors",[l.activeAnchor===d.id?"border-pink-500 font-medium text-pink-600 dark:text-pink-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"]]),onClick:g=>o(d.id)},x(d.label),11,Qt))),128))])]),He(c.$slots,"default")])],2))}}),me=P({__name:"TopNSelect",props:{modelValue:{default:10},modelModifiers:{}},emits:["update:modelValue"],setup(l){const a=ct(l,"modelValue"),e=[{label:"Top 5",value:5},{label:"Top 10",value:10},{label:"Top 20",value:20},{label:"Top 30",value:30},{label:"Top 50",value:50},{label:"Top 100",value:100}];return(o,c)=>{const u=st;return r(),N(u,{modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),items:e,"value-key":"value",class:"w-25"},null,8,["modelValue"])}}}),ye=P({__name:"ScrollableChart",props:{contentHeight:{},maxHeightVh:{default:60},paddingClass:{default:"px-3 py-2"}},setup(l){const a=l,e=D(()=>typeof window>"u"?500:Math.round(window.innerHeight*a.maxHeightVh/100)),o=D(()=>a.contentHeight>e.value),c=D(()=>({maxHeight:`${a.maxHeightVh}vh`,overflowY:o.value?"auto":"hidden"}));return(u,d)=>(r(),I("div",{class:Z(l.paddingClass),style:be(c.value)},[He(u.$slots,"default")],6))}}),Zt=P({__name:"EChartGraph",props:{data:{},height:{default:400},layout:{default:"circular"},directed:{type:Boolean,default:!1}},setup(l,{expose:a}){Je([Wt,Ke,jt,Qe]);const e=l,o=D(()=>typeof e.height=="number"?`${e.height}px`:e.height),c=mt(),u=A(null);let d=null;const g=["#ee4567","#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#9a60b4","#fc8452","#3ba272","#ea7ccc","#6e7074","#546570"],p=D(()=>{const b=new Set;return e.data.nodes.filter(k=>b.has(k.name)?!1:(b.add(k.name),!0))}),_=D(()=>{const b=new Map;return p.value.forEach((k,C)=>{b.set(k.name,g[C%g.length])}),b});function y(b,k){return k<=0?1:1+b/k*5}const m=D(()=>{const b=e.data.maxLinkValue||Math.max(...e.data.links.map(k=>k.value||1),1);return{tooltip:{trigger:"item",backgroundColor:c.value?"rgba(30, 30, 30, 0.9)":"rgba(255, 255, 255, 0.95)",borderColor:c.value?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",textStyle:{color:c.value?"#e5e7eb":"#374151"},formatter:k=>k.dataType==="node"?`<b>${k.data.name}</b><br/>消息数: ${k.data.value||0}`:k.dataType==="edge"?`${k.data.source} → ${k.data.target}<br/>艾特次数: ${k.data.value||0}`:""},animationDuration:1e3,animationDurationUpdate:500,animationEasingUpdate:"quinticInOut",series:[{type:"graph",layout:e.layout,circular:e.layout==="circular"?{rotateLabel:!0}:void 0,force:e.layout==="force"?{repulsion:300,gravity:.1,edgeLength:[80,200],friction:.6}:void 0,roam:!0,scaleLimit:{min:.3,max:3},draggable:!0,label:{show:!0,position:"right",formatter:"{b}",color:c.value?"#e5e7eb":"#374151",fontSize:11,fontWeight:500},edgeSymbol:e.directed?["none","arrow"]:["none","none"],edgeSymbolSize:e.directed?[0,10]:[0,0],lineStyle:{curveness:.3,opacity:.5},emphasis:{focus:"adjacency",label:{show:!0,fontSize:13,fontWeight:600},lineStyle:{width:4,opacity:.9},itemStyle:{shadowBlur:15,shadowColor:"rgba(0, 0, 0, 0.3)"}},data:p.value.map(k=>{const C=_.value.get(k.name)||g[0];return{name:k.name,value:k.value,symbolSize:k.symbolSize||30,label:{show:e.layout==="circular"?!0:(k.symbolSize||30)>30},itemStyle:{color:C,borderColor:"#fff",borderWidth:2,shadowBlur:5,shadowColor:`${C}66`}}}),links:e.data.links.filter(k=>_.value.has(k.source)&&_.value.has(k.target)).map(k=>{const C=_.value.get(k.source)||g[0];return{source:k.source,target:k.target,value:k.value,lineStyle:{color:C,width:y(k.value||1,b)}}})}]}});function n(){u.value&&(d=Xe(u.value,c.value?"dark":void 0,{renderer:"canvas"}),d.setOption({backgroundColor:"transparent",...m.value}))}function i(){d&&d.setOption({backgroundColor:"transparent",...m.value},{notMerge:!0})}function h(){d?.resize()}function f(){d&&d.dispatchAction({type:"restore"})}return a({resetView:f}),G([()=>e.data,()=>e.layout,()=>e.directed,c],()=>{d?i():n()},{deep:!0}),ke(()=>{n(),window.addEventListener("resize",h)}),Re(()=>{window.removeEventListener("resize",h),d?.dispose()}),(b,k)=>(r(),I("div",{ref_key:"chartRef",ref:u,style:be({height:o.value,width:"100%"})},null,4))}}),es={class:"px-3 py-2"},$e=P({__name:"EChartRank",props:{members:{},title:{},description:{},topN:{default:10},unit:{default:"条"},height:{default:"auto"},maxHeightVh:{default:60},bare:{type:Boolean,default:!1}},setup(l){const a=l,e=D(()=>a.members.slice(0,a.topN)),o=D(()=>{if(a.height!=="auto")return a.height;const g=e.value.length*36;return Math.max(g+30,180)}),c={type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#ee4567"},{offset:1,color:"#f7758c"}]};function u(g,p=8){return g.length<=p?g:g.slice(0,p)+"…"}const d=D(()=>{const g=[...e.value].reverse(),p=g.map(n=>u(n.name)),_=g.map(n=>n.value),y=Math.max(..._,1),m=g.map(n=>({value:n.value,itemStyle:{color:c,borderRadius:[0,4,4,0]}}));return{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"},formatter:n=>{const i=n[0];if(!i)return"";const h=e.value.length-1-i.dataIndex,f=e.value[h];return`
|
|
3
|
-
<div style="padding: 4px 8px;">
|
|
4
|
-
<div style="font-weight: bold; margin-bottom: 4px;">${f.name}</div>
|
|
5
|
-
<div>${f.value} ${a.unit} (${f.percentage}%)</div>
|
|
6
|
-
</div>
|
|
7
|
-
`}},grid:{left:110,right:70,top:15,bottom:15,containLabel:!1},xAxis:{type:"value",max:y*1.1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1}},yAxis:{type:"category",data:p,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:12,color:"#4b5563",margin:12,formatter:(n,i)=>{const f=e.value.length-1-i+1;return`${f===1?"🥇":f===2?"🥈":f===3?"🥉":`${f}.`} ${n}`}}},series:[{type:"bar",data:m,barWidth:18,barCategoryGap:"30%",label:{show:!0,position:"right",distance:8,formatter:n=>{const i=e.value.length-1-n.dataIndex;return`${e.value[i].value} ${a.unit}`},fontSize:11,fontWeight:500,color:"#6b7280"},emphasis:{itemStyle:{shadowBlur:6,shadowColor:"rgba(238, 69, 103, 0.3)"}}}]}});return(g,p)=>l.bare?(r(),N(t(ye),{key:0,"content-height":o.value,"max-height-vh":l.maxHeightVh},{default:V(()=>[$(ae,{option:d.value,height:o.value},null,8,["option","height"])]),_:1},8,["content-height","max-height-vh"])):(r(),N(t(K),{key:1,title:l.title,description:l.description,scrollable:"","max-height-vh":l.maxHeightVh},{default:V(()=>[s("div",es,[$(ae,{option:d.value,height:o.value},null,8,["option","height"])])]),_:1},8,["title","description","max-height-vh"]))}}),ts={class:"divide-y divide-gray-100 dark:divide-gray-800"},ss={key:0,class:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-linear-to-br from-pink-100 to-rose-100 text-sm font-medium text-pink-600 dark:from-pink-900/30 dark:to-rose-900/30 dark:text-pink-400"},as={class:"w-32 shrink-0"},ns={class:"wrap-break-word font-medium text-gray-900 dark:text-white"},os={class:"flex flex-1 items-center"},is={class:"h-2 w-full overflow-hidden rounded-full bg-gray-100 dark:bg-gray-800"},rs={class:"flex shrink-0 items-baseline gap-2 whitespace-nowrap"},ls={class:"text-lg font-bold text-gray-900 dark:text-white"},cs={class:"text-sm text-gray-500"},Ee=P({__name:"RankList",props:{members:{},showAvatar:{type:Boolean,default:!1},rankLimit:{default:0},unit:{}},setup(l){const{t:a}=se(),e=l,o=D(()=>e.unit||a("views.charts.rankList.unit")),c=D(()=>e.rankLimit>0?e.members.slice(0,e.rankLimit):e.members);function u(d){if(c.value.length===0)return 0;const g=c.value[0].value;return g===0?0:Math.round(c.value[d].value/g*100)}return(d,g)=>(r(),I("div",ts,[(r(!0),I(q,null,te(c.value,(p,_)=>(r(),I("div",{key:p.id,class:"flex items-center gap-3 px-5 py-3 transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50"},[s("div",{class:Z(["flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-bold",t(Ge)(_)])},x(_+1),3),l.showAvatar?(r(),I("div",ss,x(p.name.slice(0,1)),1)):U("",!0),s("div",as,[s("p",ns,x(p.name),1)]),s("div",os,[s("div",is,[s("div",{class:Z(["h-full rounded-full bg-linear-to-r transition-all",t(yt)(_)]),style:be({width:`${u(_)}%`})},null,6)])]),s("div",rs,[s("span",ls,x(p.value),1),s("span",cs,x(o.value)+" ("+x(p.percentage)+"%)",1)])]))),128))]))}}),ds={class:"flex items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-800"},us={class:"font-semibold text-gray-900 whitespace-nowrap dark:text-white"},ms={key:0,class:"mt-1 text-sm text-gray-500 dark:text-gray-400"},gs={class:"no-capture flex items-center gap-1"},ps={class:"flex w-full items-center justify-between border-b border-gray-200 px-6 py-4 dark:border-gray-700"},hs={class:"flex items-center gap-2"},vs={class:"text-lg font-semibold text-gray-900 whitespace-nowrap dark:text-white"},fs={class:"text-sm text-gray-500"},ys={class:"max-h-[60vh] p-4 overflow-y-auto"},Oe=P({__name:"RankListPro",props:{members:{},title:{},description:{},topN:{default:10},unit:{}},setup(l){const{t:a}=se(),e=l,o=A(!1),c=A(null),u=A(null),d=D(()=>e.members.slice(0,e.topN)),g=D(()=>e.members.length>e.topN);return(p,_)=>{const y=ge,m=_e;return r(),I("div",{ref_key:"cardRef",ref:c,class:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900"},[s("div",ds,[s("div",null,[s("h3",us,x(l.title),1),l.description?(r(),I("p",ms,x(l.description),1)):U("",!0)]),s("div",gs,[$(Te,{size:"xs",type:"element","target-element":c.value},null,8,["target-element"]),$(m,{open:o.value,"onUpdate:open":_[0]||(_[0]=n=>o.value=n),ui:{content:"md:w-full max-w-3xl"}},{content:V(()=>[s("div",{ref_key:"modalBodyRef",ref:u,class:"section-content flex flex-col"},[s("div",ps,[s("div",hs,[s("h3",vs,x(l.title),1),s("span",fs," ("+x(t(a)("views.charts.rankListPro.memberCount",{count:l.members.length}))+") ",1)]),$(Te,{size:"xs",type:"element","target-element":u.value},null,8,["target-element"])]),s("div",ys,[$(Ee,{members:l.members,unit:l.unit},null,8,["members","unit"])])],512)]),default:V(()=>[g.value?(r(),N(y,{key:0,icon:"i-heroicons-list-bullet",variant:"ghost"},{default:V(()=>[Q(x(t(a)("views.charts.rankListPro.fullRanking")),1)]),_:1})):U("",!0)]),_:1},8,["open"])])]),$(Ee,{members:d.value,unit:l.unit},null,8,["members","unit"])],512)}}}),xs={class:"main-content mx-auto max-w-6xl py-6"},bs={class:"mb-4 flex items-center justify-end gap-4"},_s={class:"text-xs text-gray-500 dark:text-gray-400"},ks={key:0,class:"grid grid-cols-2 gap-6"},ws={class:"mb-3 text-center"},$s={class:"text-base font-semibold text-gray-900 dark:text-white"},Is={class:"flex flex-wrap gap-2"},Cs=["title","onClick"],Ss={class:"text-xs opacity-50"},Ms={key:1,class:"grid grid-cols-2 gap-6"},Ts={class:"mb-3 text-center"},Ds={class:"text-base font-semibold text-gray-900 dark:text-white"},Rs={class:"relative w-full",style:{"aspect-ratio":"4 / 3"}},Ns={class:"mt-4 text-center text-xs text-gray-500 dark:text-gray-400"},As=P({__name:"CatchphraseTab",props:{sessionId:{},timeFilter:{}},setup(l){const a=We(()=>ze(()=>import("./EChartWordcloud-Ubal_aYg.js"),__vite__mapDeps([0,1,2,3,4]))),{t:e}=se(),o=Ae(),c=l,u=A(null),d=A(!1),g=A("list"),p=A(30),_=D(()=>[{label:e("quotes.catchphrase.viewMode.list"),value:"list"},{label:e("quotes.catchphrase.viewMode.wordcloud"),value:"wordcloud"}]),y=[{label:"10",value:10},{label:"30",value:30},{label:"50",value:50},{label:"100",value:100}],m=D(()=>u.value&&u.value.members.length>0),n=D(()=>{if(!u.value)return[];const v=p.value;return console.log("[CatchphraseTab] displayMembers recompute, topN:",v,"type:",typeof v),u.value.members.map(w=>{const S=w.catchphrases.slice(0,v);return console.log("[CatchphraseTab]",w.name,"total:",w.catchphrases.length,"display:",S.length),{...w,catchphrases:S}})}),i=D(()=>n.value.map(v=>({name:v.name,data:{words:v.catchphrases.map(w=>({word:w.content,count:w.count}))}}))),h=[{bg:"bg-amber-50 dark:bg-amber-900/20",text:"text-amber-700 dark:text-amber-400",badge:"bg-amber-100 dark:bg-amber-800/40 text-amber-600 dark:text-amber-300"},{bg:"bg-slate-50 dark:bg-slate-800/40",text:"text-slate-600 dark:text-slate-300",badge:"bg-slate-100 dark:bg-slate-700/60 text-slate-500 dark:text-slate-400"},{bg:"bg-orange-50 dark:bg-orange-900/15",text:"text-orange-600 dark:text-orange-400",badge:"bg-orange-100 dark:bg-orange-800/30 text-orange-500 dark:text-orange-300"}];function f(v){return v<h.length?h[v]:{bg:"bg-gray-50 dark:bg-gray-800/30",text:"text-gray-600 dark:text-gray-400",badge:"bg-gray-100 dark:bg-gray-700/40 text-gray-500 dark:text-gray-400"}}function b(v,w=20){return v.length<=w?v:v.slice(0,w)+"..."}async function k(){if(c.sessionId){d.value=!0;try{u.value=await ue().getCatchphraseAnalysis(c.sessionId,c.timeFilter),console.log("[CatchphraseTab] API result: members:",u.value?.members.length,"per-member catchphrases:",u.value?.members.map(v=>({name:v.name,count:v.catchphrases.length})))}catch(v){console.error("Failed to load catchphrase analysis:",v)}finally{d.value=!1}}}function C(v){o.openChatRecordDrawer({keywords:[v]})}return G(p,(v,w)=>{console.log("[CatchphraseTab] topN changed:",w,"->",v,"type:",typeof v)}),G(()=>[c.sessionId,c.timeFilter],()=>{k()},{immediate:!0,deep:!0}),(v,w)=>(r(),I("div",xs,[d.value?(r(),N(t(ne),{key:0,text:t(e)("quotes.catchphrase.loading")},null,8,["text"])):m.value?(r(),I(q,{key:2},[s("div",bs,[s("span",_s,x(t(e)("quotes.catchphrase.topN")),1),$(t(ce),{modelValue:p.value,"onUpdate:modelValue":w[0]||(w[0]=S=>p.value=S),size:"xs",items:y},null,8,["modelValue"]),w[2]||(w[2]=s("div",{class:"h-4 w-px bg-gray-200 dark:bg-gray-700"},null,-1)),$(t(ce),{modelValue:g.value,"onUpdate:modelValue":w[1]||(w[1]=S=>g.value=S),size:"xs",items:_.value},null,8,["modelValue","items"])]),g.value==="list"?(r(),I("div",ks,[(r(!0),I(q,null,te(n.value,S=>(r(),I("div",{key:S.memberId},[s("div",ws,[s("span",$s,x(S.name),1)]),s("div",Is,[(r(!0),I(q,null,te(S.catchphrases,(M,T)=>(r(),I("div",{key:T,class:Z(["inline-flex cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 transition-opacity hover:opacity-75",f(T).bg]),title:M.content,onClick:L=>C(M.content)},[T<3?(r(),I("span",{key:0,class:Z(["flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-[10px] font-bold",f(T).badge])},x(T+1),3)):U("",!0),s("span",{class:Z(["text-sm font-medium",f(T).text])},x(b(M.content)),3),s("span",Ss,x(t(e)("quotes.catchphrase.times",{count:M.count})),1)],10,Cs))),128))])]))),128))])):(r(),I("div",Ms,[(r(!0),I(q,null,te(i.value,S=>(r(),I("div",{key:S.name},[s("div",Ts,[s("span",Ds,x(S.name),1)]),s("div",Rs,[S.data.words.length===0?(r(),N(t(le),{key:0,text:t(e)("quotes.catchphrase.empty.title"),class:"h-full"},null,8,["text"])):(r(),N(t(a),{key:1,data:S.data,height:"100%","max-words":p.value,"color-scheme":"default","size-scale":1,loading:d.value,onWordClick:C},null,8,["data","max-words","loading"]))])]))),128))])),s("p",Ns,x(t(e)("quotes.catchphrase.stats.clickHint")),1)],64)):(r(),N(t(le),{key:1,text:t(e)("quotes.catchphrase.empty.title")},null,8,["text"]))]))}});function xe(l){const a=[],e=[];return l?.startTs!=null&&(a.push("AND msg.ts >= ?"),e.push(l.startTs)),l?.endTs!=null&&(a.push("AND msg.ts <= ?"),e.push(l.endTs)),l?.memberId!=null&&(a.push("AND msg.sender_id = ?"),e.push(l.memberId)),{conditions:a.join(" "),params:e}}const fe="AND COALESCE(m.account_name, '') != '系统消息'";async function Ls(l,a){const{conditions:e,params:o}=xe(a),[c,u]=await Promise.all([window.chatApi.pluginQuery(l,`WITH daily_counts AS (
|
|
8
|
-
SELECT
|
|
9
|
-
strftime('%Y-%m-%d', msg.ts, 'unixepoch', 'localtime') as date,
|
|
10
|
-
msg.sender_id,
|
|
11
|
-
m.platform_id,
|
|
12
|
-
COALESCE(m.group_nickname, m.account_name, m.platform_id) as name,
|
|
13
|
-
COUNT(*) as msg_count
|
|
14
|
-
FROM message msg
|
|
15
|
-
JOIN member m ON msg.sender_id = m.id
|
|
16
|
-
WHERE 1=1 ${fe} ${e}
|
|
17
|
-
GROUP BY date, msg.sender_id
|
|
18
|
-
),
|
|
19
|
-
daily_max AS (
|
|
20
|
-
SELECT date, MAX(msg_count) as max_count
|
|
21
|
-
FROM daily_counts
|
|
22
|
-
GROUP BY date
|
|
23
|
-
)
|
|
24
|
-
SELECT dc.sender_id, dc.platform_id, dc.name, COUNT(*) as dragon_days
|
|
25
|
-
FROM daily_counts dc
|
|
26
|
-
JOIN daily_max dm ON dc.date = dm.date AND dc.msg_count = dm.max_count
|
|
27
|
-
GROUP BY dc.sender_id
|
|
28
|
-
ORDER BY dragon_days DESC`,o),window.chatApi.pluginQuery(l,`SELECT COUNT(DISTINCT strftime('%Y-%m-%d', msg.ts, 'unixepoch', 'localtime')) as total
|
|
29
|
-
FROM message msg
|
|
30
|
-
JOIN member m ON msg.sender_id = m.id
|
|
31
|
-
WHERE 1=1 ${fe} ${e}`,o)]),d=u[0]?.total??0;return{rank:c.map(p=>({memberId:p.sender_id,platformId:p.platform_id,name:p.name,count:p.dragon_days,percentage:d>0?Math.round(p.dragon_days/d*1e4)/100:0})),totalDays:d}}async function Vs(l,a){const{conditions:e,params:o}=xe(a),c=await window.chatApi.pluginQuery(l,`SELECT
|
|
32
|
-
m.id as member_id,
|
|
33
|
-
m.platform_id,
|
|
34
|
-
COALESCE(m.group_nickname, m.account_name, m.platform_id) as name,
|
|
35
|
-
MAX(msg.ts) as last_ts
|
|
36
|
-
FROM member m
|
|
37
|
-
JOIN message msg ON m.id = msg.sender_id
|
|
38
|
-
WHERE 1=1 ${fe} ${e}
|
|
39
|
-
GROUP BY m.id
|
|
40
|
-
ORDER BY last_ts ASC`,o),u=Math.floor(Date.now()/1e3);return{rank:c.map(g=>({memberId:g.member_id,platformId:g.platform_id,name:g.name,lastMessageTs:g.last_ts,daysSinceLastMessage:Math.floor((u-g.last_ts)/86400)}))}}function Es(l){const{dailyActivity:a}=l;if(a.length===0)return{streakRank:[],loyaltyRank:[],totalDays:0};const e=new Set(a.map(i=>i.day)),o=e.size,c=Array.from(e).sort(),u=c[c.length-1],d=new Map;for(const i of a)d.has(i.senderId)||d.set(i.senderId,{name:i.name,days:new Set}),d.get(i.senderId).days.add(i.day);const g=[],p=[];for(const[i,h]of d){const f=Array.from(h.days).sort(),b=f.length;let k=1,C=f[0],v=f[0],w=1,S=f[0];for(let T=1;T<f.length;T++){const L=new Date(f[T-1]),W=new Date(f[T]);Math.round((W.getTime()-L.getTime())/(1e3*60*60*24))===1?w++:(w>k&&(k=w,C=S,v=f[T-1]),w=1,S=f[T])}w>k&&(k=w,C=S,v=f[f.length-1]);let M=0;if(f[f.length-1]===u){M=1;for(let T=f.length-2;T>=0;T--){const L=new Date(f[T+1]),W=new Date(f[T]);if(Math.round((L.getTime()-W.getTime())/(1e3*60*60*24))===1)M++;else break}}g.push({memberId:i,name:h.name,maxStreak:k,maxStreakStart:C,maxStreakEnd:v,currentStreak:M}),p.push({memberId:i,name:h.name,totalDays:b})}const _=g.sort((i,h)=>h.maxStreak-i.maxStreak),y=p.sort((i,h)=>h.totalDays-i.totalDays),m=y.length>0?y[0].totalDays:1,n=y.map(i=>({...i,percentage:Math.round(i.totalDays/m*100)}));return{streakRank:_,loyaltyRank:n,totalDays:o}}async function Ze(l,a){const{conditions:e,params:o}=xe(a),c=await window.chatApi.pluginQuery(l,`SELECT
|
|
41
|
-
msg.sender_id as senderId,
|
|
42
|
-
COALESCE(m.group_nickname, m.account_name, m.platform_id) as name,
|
|
43
|
-
DATE(msg.ts, 'unixepoch', 'localtime') as day
|
|
44
|
-
FROM message msg
|
|
45
|
-
JOIN member m ON msg.sender_id = m.id
|
|
46
|
-
WHERE 1=1 ${fe} ${e}
|
|
47
|
-
GROUP BY msg.sender_id, day
|
|
48
|
-
ORDER BY msg.sender_id, day`,o);return c.length===0?{streakRank:[],loyaltyRank:[],totalDays:0}:window.chatApi.pluginCompute(Es.toString(),{dailyActivity:c})}function Os(l){const{messages:a}=l,e={topBattles:[],rankByCount:[],rankByImageCount:[],totalBattles:0},o=[];let c=[];const u=()=>{c.length>=3&&new Set(c.map(i=>i.senderId)).size>=2&&o.push({startTime:c[0].ts,endTime:c[c.length-1].ts,msgs:c.map(({senderId:i,name:h,platformId:f})=>({senderId:i,name:h,platformId:f}))}),c=[]};for(const n of a)n.type===1||n.type===5?c.push({senderId:n.senderId,name:n.name,platformId:n.platformId,ts:n.ts}):u();if(u(),o.length===0)return e;const d=o.map(n=>({startTime:n.startTime,endTime:n.endTime,totalImages:n.msgs.length,participantCount:new Set(n.msgs.map(i=>i.senderId)).size,participants:Object.values(n.msgs.reduce((i,h)=>(i[h.senderId]||(i[h.senderId]={memberId:h.senderId,name:h.name,imageCount:0}),i[h.senderId].imageCount++,i),{})).sort((i,h)=>h.imageCount-i.imageCount)})).sort((n,i)=>i.totalImages-n.totalImages).slice(0,30),g=new Map;for(const n of o){const i=new Set;for(const h of n.msgs)g.has(h.senderId)||g.set(h.senderId,{memberId:h.senderId,platformId:h.platformId,name:h.name,battleCount:0,imageCount:0}),g.get(h.senderId).imageCount++,i.add(h.senderId);for(const h of i)g.get(h).battleCount++}const p=Array.from(g.values()),_=[...p].sort((n,i)=>i.battleCount-n.battleCount).map(n=>({memberId:n.memberId,platformId:n.platformId,name:n.name,count:n.battleCount,percentage:o.length>0?Math.round(n.battleCount/o.length*1e4)/100:0})),y=o.reduce((n,i)=>n+i.msgs.length,0),m=[...p].sort((n,i)=>i.imageCount-n.imageCount).map(n=>({memberId:n.memberId,platformId:n.platformId,name:n.name,count:n.imageCount,percentage:y>0?Math.round(n.imageCount/y*1e4)/100:0}));return{topBattles:d,rankByCount:_,rankByImageCount:m,totalBattles:o.length}}async function zs(l,a){const{conditions:e,params:o}=xe(a),c=await window.chatApi.pluginQuery(l,`SELECT
|
|
49
|
-
msg.sender_id as senderId,
|
|
50
|
-
msg.type,
|
|
51
|
-
msg.ts,
|
|
52
|
-
m.platform_id as platformId,
|
|
53
|
-
COALESCE(m.group_nickname, m.account_name, m.platform_id) as name
|
|
54
|
-
FROM message msg
|
|
55
|
-
JOIN member m ON msg.sender_id = m.id
|
|
56
|
-
WHERE msg.type != 6 ${e}
|
|
57
|
-
ORDER BY msg.ts ASC`,o);return c.length===0?{topBattles:[],rankByCount:[],rankByImageCount:[],totalBattles:0}:window.chatApi.pluginCompute(Os.toString(),{messages:c})}function Fs(l){const{messages:a}=l,e={nightOwlRank:[],lastSpeakerRank:[],firstSpeakerRank:[],consecutiveRecords:[],champions:[],totalDays:0};if(a.length===0)return e;function o(v){return v===0?"养生达人":v<=20?"偶尔失眠":v<=50?"经常失眠":v<=100?"夜猫子":v<=200?"秃头预备役":v<=500?"修仙练习生":"守夜冠军"}function c(v){const w=new Date(v*1e3);return w.getHours()<5&&w.setDate(w.getDate()-1),w.toISOString().split("T")[0]}function u(v){const w=Math.floor(v/60),S=Math.round(v%60);return`${w.toString().padStart(2,"0")}:${S.toString().padStart(2,"0")}`}const d=new Map,g=new Map,p=new Map,_=new Map;for(const v of a){d.has(v.senderId)||d.set(v.senderId,{platformId:v.platformId,name:v.name});const w=new Date(v.ts*1e3),S=w.getHours(),M=w.getMinutes(),T=c(v.ts);g.has(v.senderId)||g.set(v.senderId,{total:0,h23:0,h0:0,h1:0,h2:0,h3to4:0,totalMessages:0});const L=g.get(v.senderId);L.totalMessages++,S===23?(L.h23++,L.total++):S===0?(L.h0++,L.total++):S===1?(L.h1++,L.total++):S===2?(L.h2++,L.total++):S>=3&&S<5&&(L.h3to4++,L.total++),(S>=23||S<5)&&(_.has(v.senderId)||_.set(v.senderId,new Set),_.get(v.senderId).add(T)),p.has(T)||p.set(T,[]),p.get(T).push({senderId:v.senderId,ts:v.ts,hour:S,minute:M})}const y=p.size,m=[];for(const[v,w]of g.entries()){if(w.total===0)continue;const S=d.get(v);m.push({memberId:v,platformId:S.platformId,name:S.name,totalNightMessages:w.total,title:o(w.total),hourlyBreakdown:{h23:w.h23,h0:w.h0,h1:w.h1,h2:w.h2,h3to4:w.h3to4},percentage:w.totalMessages>0?Math.round(w.total/w.totalMessages*1e4)/100:0})}m.sort((v,w)=>w.totalNightMessages-v.totalNightMessages);const n=new Map,i=new Map;for(const[,v]of p.entries()){if(v.length===0)continue;const w=v[v.length-1];n.has(w.senderId)||n.set(w.senderId,{count:0,times:[]});const S=n.get(w.senderId);S.count++,S.times.push(w.hour*60+w.minute);const M=v[0];i.has(M.senderId)||i.set(M.senderId,{count:0,times:[]});const T=i.get(M.senderId);T.count++,T.times.push(M.hour*60+M.minute)}const h=[];for(const[v,w]of n.entries()){const S=d.get(v),M=w.times.reduce((L,W)=>L+W,0)/w.times.length,T=Math.max(...w.times);h.push({memberId:v,platformId:S.platformId,name:S.name,count:w.count,avgTime:u(M),extremeTime:u(T),percentage:y>0?Math.round(w.count/y*1e4)/100:0})}h.sort((v,w)=>w.count-v.count);const f=[];for(const[v,w]of i.entries()){const S=d.get(v),M=w.times.reduce((L,W)=>L+W,0)/w.times.length,T=Math.min(...w.times);f.push({memberId:v,platformId:S.platformId,name:S.name,count:w.count,avgTime:u(M),extremeTime:u(T),percentage:y>0?Math.round(w.count/y*1e4)/100:0})}f.sort((v,w)=>w.count-v.count);const b=[];for(const[v,w]of _.entries()){if(w.size===0)continue;const S=d.get(v),M=Array.from(w).sort();let T=1,L=1;for(let E=1;E<M.length;E++){const j=new Date(M[E-1]);(new Date(M[E]).getTime()-j.getTime())/(1e3*60*60*24)===1?(L++,T=Math.max(T,L)):L=1}const W=M[M.length-1],H=new Date().toISOString().split("T")[0],R=new Date(Date.now()-864e5).toISOString().split("T")[0],O=W===H||W===R;b.push({memberId:v,platformId:S.platformId,name:S.name,maxConsecutiveDays:T,currentStreak:O?L:0})}b.sort((v,w)=>w.maxConsecutiveDays-v.maxConsecutiveDays);const k=new Map;for(const v of m)k.has(v.memberId)||k.set(v.memberId,{nightMessages:0,lastSpeakerCount:0,consecutiveDays:0}),k.get(v.memberId).nightMessages=v.totalNightMessages;for(const v of h)k.has(v.memberId)||k.set(v.memberId,{nightMessages:0,lastSpeakerCount:0,consecutiveDays:0}),k.get(v.memberId).lastSpeakerCount=v.count;for(const v of b)k.has(v.memberId)||k.set(v.memberId,{nightMessages:0,lastSpeakerCount:0,consecutiveDays:0}),k.get(v.memberId).consecutiveDays=v.maxConsecutiveDays;const C=[];for(const[v,w]of k.entries()){const S=d.get(v),M=w.nightMessages*1+w.lastSpeakerCount*10+w.consecutiveDays*20;M>0&&C.push({memberId:v,platformId:S.platformId,name:S.name,score:M,nightMessages:w.nightMessages,lastSpeakerCount:w.lastSpeakerCount,consecutiveDays:w.consecutiveDays})}return C.sort((v,w)=>w.score-v.score),{nightOwlRank:m,lastSpeakerRank:h,firstSpeakerRank:f,consecutiveRecords:b,champions:C,totalDays:y}}async function Bs(l,a){const{conditions:e,params:o}=xe(a),c=await window.chatApi.pluginQuery(l,`SELECT
|
|
58
|
-
msg.id,
|
|
59
|
-
msg.sender_id as senderId,
|
|
60
|
-
msg.ts,
|
|
61
|
-
m.platform_id as platformId,
|
|
62
|
-
COALESCE(m.group_nickname, m.account_name, m.platform_id) as name
|
|
63
|
-
FROM message msg
|
|
64
|
-
JOIN member m ON msg.sender_id = m.id
|
|
65
|
-
WHERE 1=1 ${fe} ${e}
|
|
66
|
-
ORDER BY msg.ts ASC`,o);return c.length===0?{nightOwlRank:[],lastSpeakerRank:[],firstSpeakerRank:[],consecutiveRecords:[],champions:[],totalDays:0}:window.chatApi.pluginCompute(Fs.toString(),{messages:c})}function Us(l){const{messages:a}=l,e=new Map,o=new Map,c=new Map,u=new Map,d=new Map,g=new Map,p=new Map;let _=null,y=[],m=0,n=0;const i=new Map,h=(S,M)=>{if(S.length<3)return;m++;const T=S.length;n+=T;const L=S[0].senderId;e.set(L,(e.get(L)||0)+1);const W=S[1].senderId;o.set(W,(o.get(W)||0)+1),M!==void 0&&c.set(M,(c.get(M)||0)+1),g.set(T,(g.get(T)||0)+1);const H=S[0].content,R=S[0].ts,O=S[0].id,E=p.get(H);E?(E.count++,E.lastTs=Math.max(E.lastTs,R),T>E.maxChainLength&&(E.maxChainLength=T,E.originatorId=L,E.firstMessageId=O)):p.set(H,{count:1,maxChainLength:T,originatorId:L,lastTs:R,firstMessageId:O});for(let j=1;j<S.length;j++){const X=S[j],ee=S[j-1],re=(X.ts-ee.ts)*1e3;if(re<=20*1e3){i.has(X.senderId)||i.set(X.senderId,{totalDiff:0,count:0});const oe=i.get(X.senderId);oe.totalDiff+=re,oe.count++}}};for(const S of a){d.has(S.senderId)||d.set(S.senderId,{platformId:S.platformId,name:S.name}),u.set(S.senderId,(u.get(S.senderId)||0)+1);const M=S.content.trim();M===_?y[y.length-1]?.senderId!==S.senderId&&y.push({id:S.id,senderId:S.senderId,content:M,ts:S.ts}):(h(y,S.senderId),_=M,y=[{id:S.id,senderId:S.senderId,content:M,ts:S.ts}])}h(y);const f=(S,M)=>{const T=[];for(const[L,W]of S.entries()){const H=d.get(L);H&&T.push({memberId:L,platformId:H.platformId,name:H.name,count:W,percentage:M>0?Math.round(W/M*1e4)/100:0})}return T.sort((L,W)=>W.count-L.count)},b=S=>{const M=[];for(const[T,L]of S.entries()){const W=d.get(T),H=u.get(T)||0;W&&H>0&&M.push({memberId:T,platformId:W.platformId,name:W.name,count:L,totalMessages:H,rate:Math.round(L/H*1e4)/100})}return M.sort((T,L)=>L.rate-T.rate)},k=()=>{const S=[];for(const[M,T]of i.entries()){if(T.count<5)continue;const L=d.get(M);L&&S.push({memberId:M,platformId:L.platformId,name:L.name,count:T.count,avgTimeDiff:Math.round(T.totalDiff/T.count)})}return S.sort((M,T)=>M.avgTimeDiff-T.avgTimeDiff)},C=[];for(const[S,M]of g.entries())C.push({length:S,count:M});C.sort((S,M)=>S.length-M.length);const v=[];for(const[S,M]of p.entries()){const T=d.get(M.originatorId);v.push({content:S,count:M.count,maxChainLength:M.maxChainLength,originatorName:T?.name||"未知",lastTs:M.lastTs,firstMessageId:M.firstMessageId})}v.sort((S,M)=>M.maxChainLength-S.maxChainLength);const w=v.slice(0,100);return{originators:f(e,m),initiators:f(o,m),breakers:f(c,m),fastestRepeaters:k(),originatorRates:b(e),initiatorRates:b(o),breakerRates:b(c),chainLengthDistribution:C,hotContents:w,avgChainLength:m>0?Math.round(n/m*100)/100:0,totalRepeatChains:m}}async function et(l,a){const{conditions:e,params:o}=xe(a),c=await window.chatApi.pluginQuery(l,`SELECT
|
|
67
|
-
msg.id,
|
|
68
|
-
msg.sender_id as senderId,
|
|
69
|
-
msg.content,
|
|
70
|
-
msg.ts,
|
|
71
|
-
m.platform_id as platformId,
|
|
72
|
-
COALESCE(m.group_nickname, m.account_name, m.platform_id) as name
|
|
73
|
-
FROM message msg
|
|
74
|
-
JOIN member m ON msg.sender_id = m.id
|
|
75
|
-
WHERE 1=1 ${fe}
|
|
76
|
-
AND msg.type = 0
|
|
77
|
-
AND msg.content IS NOT NULL
|
|
78
|
-
AND TRIM(msg.content) != ''
|
|
79
|
-
${e}
|
|
80
|
-
ORDER BY msg.ts ASC, msg.id ASC`,o);return c.length===0?{originators:[],initiators:[],breakers:[],fastestRepeaters:[],originatorRates:[],initiatorRates:[],breakerRates:[],chainLengthDistribution:[],hotContents:[],avgChainLength:0,totalRepeatChains:0}:window.chatApi.pluginCompute(Us.toString(),{messages:c})}const Hs={class:"main-content mx-auto max-w-3xl p-6"},Ws={class:"flex items-center gap-3"},js={class:"shrink-0 text-lg font-bold text-pink-600"},Ps={class:"flex flex-1 items-center gap-1 overflow-hidden text-sm"},qs={class:"shrink-0 font-medium text-gray-900 dark:text-white whitespace-nowrap"},Ys=["title"],Gs={class:"flex shrink-0 items-center gap-2 text-xs text-gray-500"},Js=P({__name:"HotRepeatTab",props:{sessionId:{},timeFilter:{}},setup(l){const{t:a}=se(),e=l,o=Ae(),c=A(null),u=A(!1);async function d(){if(e.sessionId){u.value=!0;try{c.value=await et(e.sessionId,e.timeFilter)}catch(_){console.error("Failed to load repeat analysis:",_)}finally{u.value=!1}}}function g(_,y=30){return _.length<=y?_:_.slice(0,y)+"..."}function p(_){o.openChatRecordDrawer({scrollToMessageId:_.firstMessageId,highlightKeywords:[_.content]})}return G(()=>[e.sessionId,e.timeFilter],()=>{d()},{immediate:!0,deep:!0}),(_,y)=>{const m=ge;return r(),I("div",Hs,[u.value?(r(),N(t(ne),{key:0,text:t(a)("quotes.hotRepeat.loading")},null,8,["text"])):c.value&&c.value.hotContents.length>0?(r(),N(t(xt),{key:1,items:c.value.hotContents,title:t(a)("quotes.hotRepeat.title"),description:t(a)("quotes.hotRepeat.description"),"top-n":50,"count-template":t(a)("quotes.hotRepeat.countTemplate")},{item:V(({item:n,index:i})=>[s("div",Ws,[s("span",{class:Z(["flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",t(Ge)(i)])},x(i+1),3),s("span",js,x(t(a)("quotes.hotRepeat.people",{count:n.maxChainLength})),1),s("div",Ps,[s("span",qs,x(n.originatorName)+x(t(a)("quotes.hotRepeat.colon")),1),s("span",{class:"truncate text-gray-600 dark:text-gray-400",title:n.content},x(g(n.content)),9,Ys)]),s("div",Gs,[s("span",null,x(t(a)("quotes.hotRepeat.times",{count:n.count})),1),y[0]||(y[0]=s("span",{class:"text-gray-300 dark:text-gray-600"},"|",-1)),s("span",null,x(t(De)(n.lastTs)),1),$(m,{icon:"i-heroicons-chat-bubble-left-right",color:"neutral",variant:"ghost",size:"xs",title:t(a)("quotes.hotRepeat.viewChat"),onClick:je(h=>p(n),["stop"])},null,8,["title","onClick"])])])]),_:1},8,["items","title","description","count-template"])):(r(),N(t(K),{key:2,title:t(a)("quotes.hotRepeat.title")},{default:V(()=>[$(t(le),{text:t(a)("quotes.hotRepeat.empty")},null,8,["text"])]),_:1},8,["title"]))])}}}),Ks={class:"main-content mx-auto max-w-[920px] space-y-6 p-6"},Qs={class:"grid grid-cols-1 gap-6 lg:grid-cols-2"},Xs={class:"p-5"},Zs={class:"p-5"},ea=P({__name:"OverviewTab",props:{session:{},memberActivity:{},topMembers:{},bottomMembers:{},messageTypes:{},hourlyActivity:{},dailyActivity:{},timeRange:{},selectedYear:{},filteredMessageCount:{},filteredMemberCount:{},timeFilter:{}},setup(l){const{t:a}=se(),e=l,{dailyChartData:o}=kt(()=>e.dailyActivity),c=D(()=>({labels:e.messageTypes.map(d=>wt(d.type,a)),values:e.messageTypes.map(d=>d.count)})),u=D(()=>{const d=[...e.memberActivity].sort((m,n)=>n.messageCount-m.messageCount),g=d.slice(0,10),p=d.slice(10).reduce((m,n)=>m+n.messageCount,0),_=g.map(m=>m.name),y=g.map(m=>m.messageCount);return p>0&&(_.push(a("analysis.overview.others")),y.push(p)),{labels:_,values:y}});return(d,g)=>(r(),I("div",Ks,[$(bt,{session:l.session,"daily-activity":l.dailyActivity,"message-types":l.messageTypes,"hourly-activity":l.hourlyActivity,"time-range":l.timeRange,"selected-year":l.selectedYear,"filtered-message-count":l.filteredMessageCount,"time-filter":l.timeFilter},null,8,["session","daily-activity","message-types","hourly-activity","time-range","selected-year","filtered-message-count","time-filter"]),s("div",Qs,[$(t(K),{title:t(a)("analysis.overview.messageTypeDistribution"),"show-divider":!1},{default:V(()=>[s("div",Xs,[$(t(Ve),{data:c.value,height:280},null,8,["data"])])]),_:1},8,["title"]),$(t(K),{title:t(a)("analysis.overview.memberDistribution"),"show-divider":!1},{default:V(()=>[s("div",Zs,[$(t(Ve),{data:u.value,height:280},null,8,["data"])])]),_:1},8,["title"])]),$(_t,{"daily-activity":l.dailyActivity,"daily-chart-data":t(o)},null,8,["daily-activity","daily-chart-data"])]))}}),ta={class:"flex items-center gap-3"},sa={key:1,class:"py-8 text-center text-sm text-gray-400"},aa=P({__name:"ActivityRank",props:{sessionId:{},memberActivity:{},timeFilter:{},showTopNSelect:{type:Boolean,default:!0},globalTopN:{}},setup(l){const a=l,e=A(null),o=A(null),c=A(!1),u=A("activity"),d=A(a.globalTopN??10);G(()=>a.globalTopN,f=>{f!==void 0&&(d.value=f)});async function g(){if(a.sessionId){c.value=!0;try{const[f,b]=await Promise.all([Ls(a.sessionId,a.timeFilter),Ze(a.sessionId,a.timeFilter)]);e.value=f,o.value=b}catch(f){console.error("加载活跃数据失败:",f)}finally{c.value=!1}}}const p=D(()=>a.memberActivity.map(f=>({id:f.memberId.toString(),name:f.name,value:f.messageCount,percentage:f.percentage}))),_=D(()=>e.value?e.value.rank.map(f=>({id:f.memberId.toString(),name:f.name,value:f.count,percentage:f.percentage})):[]),y=D(()=>o.value?o.value.loyaltyRank.map(f=>({id:f.memberId.toString(),name:f.name,value:f.totalDays,percentage:f.percentage})):[]),m=D(()=>{switch(u.value){case"activity":return p.value;case"dragon":return _.value;case"loyalty":return y.value;default:return p.value}}),n=D(()=>{switch(u.value){case"activity":return"条";case"dragon":case"loyalty":return"天";default:return"条"}}),i=D(()=>{switch(u.value){case"activity":return"🏆 活跃榜 - 发言数量";case"dragon":return"🏆 活跃榜 - 龙王";case"loyalty":return"🏆 活跃榜 - 累计发言";default:return"🏆 活跃榜"}}),h=D(()=>{switch(u.value){case"activity":return"按消息发送数量排名";case"dragon":return`每天发言最多的人+1(共 ${e.value?.totalDays??0} 天)`;case"loyalty":return`累计发言天数排名(共 ${o.value?.totalDays??0} 天)`;default:return""}});return G(()=>[a.sessionId,a.timeFilter],()=>g(),{immediate:!0,deep:!0}),(f,b)=>(r(),N(t(K),{title:i.value,description:h.value},{headerRight:V(()=>[s("div",ta,[l.showTopNSelect?(r(),N(t(me),{key:0,modelValue:d.value,"onUpdate:modelValue":b[0]||(b[0]=k=>d.value=k)},null,8,["modelValue"])):U("",!0),$(t(ce),{modelValue:u.value,"onUpdate:modelValue":b[1]||(b[1]=k=>u.value=k),items:[{label:"发言数量",value:"activity"},{label:"龙王",value:"dragon"},{label:"累计发言",value:"loyalty"}],size:"sm"},null,8,["modelValue"])])]),default:V(()=>[c.value&&(u.value==="dragon"||u.value==="loyalty")?(r(),N(t(ne),{key:0,text:"正在加载数据..."})):(r(),I(q,{key:1},[m.value.length>0?(r(),N(t($e),{key:0,members:m.value,title:i.value,unit:n.value,"top-n":d.value,bare:""},null,8,["members","title","unit","top-n"])):(r(),I("div",sa,"暂无数据"))],64))]),_:1},8,["title","description"]))}}),na={key:0},oa={key:0,class:"flex items-center justify-center gap-6 border-t border-gray-100 px-5 py-3 dark:border-gray-800"},ia={class:"px-3 py-2"},ra=P({__name:"EChartStreakRank",props:{items:{},title:{},description:{},topN:{default:10},mode:{default:"max"},maxHeightVh:{default:60},bare:{type:Boolean,default:!1}},setup(l){const a=l,e=D(()=>a.mode==="current"?a.items.filter(y=>y.currentStreak>0).sort((y,m)=>m.currentStreak-y.currentStreak).slice(0,a.topN):a.items.slice(0,a.topN)),o=D(()=>{const y=e.value.length*36;return Math.max(y+30,180)}),c={type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#ee4567"},{offset:1,color:"#f7758c"}]},u={type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#f97316"},{offset:1,color:"#fb923c"}]};function d(y,m=8){return y.length<=m?y:y.slice(0,m)+"…"}function g(y,m){return`${y} ~ ${m}`}function p(y){return a.mode==="current"?y.currentStreak:y.maxStreak}const _=D(()=>{const y=[...e.value].reverse(),m=y.map(f=>d(f.name)),n=y.map(f=>p(f)),i=Math.max(...n,1),h=y.map(f=>({value:p(f),itemStyle:{color:a.mode==="current"||f.currentStreak>0?u:c,borderRadius:[0,4,4,0]}}));return{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"},formatter:f=>{const b=f[0];if(!b)return"";const k=e.value.length-1-b.dataIndex,C=e.value[k];if(a.mode==="current")return`
|
|
81
|
-
<div style="padding: 4px 8px;">
|
|
82
|
-
<div style="font-weight: bold; margin-bottom: 6px;">${C.name}</div>
|
|
83
|
-
<div style="color: #fb923c;">🔥 当前连续 <b>${C.currentStreak}</b> 天</div>
|
|
84
|
-
<div style="margin-top: 4px; font-size: 12px; color: #9ca3af;">最长记录: ${C.maxStreak} 天</div>
|
|
85
|
-
</div>
|
|
86
|
-
`;let v=`
|
|
87
|
-
<div style="padding: 4px 8px;">
|
|
88
|
-
<div style="font-weight: bold; margin-bottom: 6px;">${C.name}</div>
|
|
89
|
-
<div style="margin-bottom: 4px;">🔥 最长连续: <b>${C.maxStreak}</b> 天</div>
|
|
90
|
-
<div style="font-size: 12px; color: #9ca3af;">${g(C.maxStreakStart,C.maxStreakEnd)}</div>
|
|
91
|
-
`;return C.currentStreak>0&&(v+=`<div style="margin-top: 6px; color: #fb923c;">🔥 当前连续 ${C.currentStreak} 天</div>`),v+="</div>",v}},grid:{left:110,right:70,top:15,bottom:15,containLabel:!1},xAxis:{type:"value",max:i*1.15,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1}},yAxis:{type:"category",data:m,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:12,color:"#4b5563",margin:12,formatter:(f,b)=>{const C=e.value.length-1-b+1;return`${C===1?"🥇":C===2?"🥈":C===3?"🥉":`${C}.`} ${f}`}}},series:[{type:"bar",data:h,barWidth:18,barCategoryGap:"30%",label:{show:!0,position:"right",distance:8,formatter:f=>{const b=e.value.length-1-f.dataIndex,k=e.value[b],C=p(k),v=a.mode==="current"||k.currentStreak>0?" 🔥":"";return`${C} 天${v}`},fontSize:11,fontWeight:500,color:"#6b7280"},emphasis:{itemStyle:{shadowBlur:6,shadowColor:"rgba(249, 115, 22, 0.3)"}}}]}});return(y,m)=>l.bare?(r(),I("div",na,[$(t(ye),{"content-height":o.value,"max-height-vh":l.maxHeightVh},{default:V(()=>[$(t(ae),{option:_.value,height:o.value},null,8,["option","height"])]),_:1},8,["content-height","max-height-vh"]),l.mode==="max"?(r(),I("div",oa,[...m[0]||(m[0]=[dt('<div class="flex items-center gap-1.5"><div class="h-3 w-6 rounded bg-linear-to-r from-orange-500 to-orange-400"></div><span class="text-xs text-gray-500">当前连续中 🔥</span></div><div class="flex items-center gap-1.5"><div class="h-3 w-6 rounded bg-linear-to-r from-pink-500 to-pink-400"></div><span class="text-xs text-gray-500">已中断</span></div>',2)])])):U("",!0)])):(r(),N(t(K),{key:1,title:l.title,description:l.description,scrollable:"","max-height-vh":l.maxHeightVh},Pe({default:V(()=>[s("div",ia,[$(t(ae),{option:_.value,height:o.value},null,8,["option","height"])])]),_:2},[l.mode==="max"?{name:"footer",fn:V(()=>[m[1]||(m[1]=s("div",{class:"flex items-center justify-center gap-6 border-t border-gray-100 px-5 py-3 dark:border-gray-800"},[s("div",{class:"flex items-center gap-1.5"},[s("div",{class:"h-3 w-6 rounded bg-linear-to-r from-orange-500 to-orange-400"}),s("span",{class:"text-xs text-gray-500"},"当前连续中 🔥")]),s("div",{class:"flex items-center gap-1.5"},[s("div",{class:"h-3 w-6 rounded bg-linear-to-r from-pink-500 to-pink-400"}),s("span",{class:"text-xs text-gray-500"},"已中断")])],-1))]),key:"0"}:void 0]),1032,["title","description","max-height-vh"]))}}),la={class:"px-3 py-2"},ca=P({__name:"EChartBattleRank",props:{battles:{},title:{},description:{},topN:{default:10},maxHeightVh:{default:60},bare:{type:Boolean,default:!1}},setup(l){const a=l,e=D(()=>a.battles.slice(0,a.topN)),o=D(()=>{const g=e.value.length*36;return Math.max(g+30,180)}),c={type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#ee4567"},{offset:1,color:"#f7758c"}]};function u(g){return`${g.participantCount} 人参战`}const d=D(()=>{const g=[...e.value].reverse(),p=g.map(n=>u(n)),_=g.map(n=>n.totalImages),y=Math.max(..._,1),m=g.map(n=>({value:n.totalImages,itemStyle:{color:c,borderRadius:[0,4,4,0]}}));return{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(0, 0, 0, 0.85)",borderColor:"transparent",textStyle:{color:"#fff",fontSize:12},extraCssText:"max-width: 300px;",formatter:n=>{const i=n[0];if(!i)return"";const h=e.value.length-1-i.dataIndex,f=e.value[h],b=f.participants.slice(0,5).map(C=>`<span style="color: #d1d5db;">${C.name}</span> <b>${C.imageCount}</b>张`).join("、"),k=f.participants.length>5?`、+${f.participants.length-5}`:"";return`
|
|
92
|
-
<div style="padding: 6px 8px;">
|
|
93
|
-
<div style="font-weight: bold; margin-bottom: 8px; font-size: 13px;">
|
|
94
|
-
⚔️ ${De(f.startTime)}
|
|
95
|
-
</div>
|
|
96
|
-
<div style="margin-bottom: 6px;">
|
|
97
|
-
<span style="color: #9ca3af;">参战人数:</span> <b>${f.participantCount}</b> 人
|
|
98
|
-
</div>
|
|
99
|
-
<div style="margin-bottom: 8px;">
|
|
100
|
-
<span style="color: #9ca3af;">总图片数:</span> <b style="color: #f472b6;">${f.totalImages}</b> 张
|
|
101
|
-
</div>
|
|
102
|
-
<div style="border-top: 1px solid #374151; padding-top: 6px; font-size: 11px;">
|
|
103
|
-
${b}${k}
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
`}},grid:{left:95,right:125,top:15,bottom:15,containLabel:!1},xAxis:{type:"value",max:y*1.15,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1}},yAxis:{type:"category",data:p,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:11,color:"#4b5563",margin:12,formatter:(n,i)=>{const f=e.value.length-1-i+1;return`${f===1?"🥇":f===2?"🥈":f===3?"🥉":`${f}.`} ${n}`}}},series:[{type:"bar",data:m,barWidth:18,barCategoryGap:"30%",label:{show:!0,position:"right",distance:8,formatter:n=>{const i=e.value.length-1-n.dataIndex,h=e.value[i],f=De(h.startTime);return`${h.totalImages} 张 (${f})`},fontSize:11,fontWeight:500,color:"#6b7280"},emphasis:{itemStyle:{shadowBlur:6,shadowColor:"rgba(238, 69, 103, 0.3)"}}}]}});return(g,p)=>l.bare?(r(),N(t(ye),{key:0,"content-height":o.value,"max-height-vh":l.maxHeightVh},{default:V(()=>[$(t(ae),{option:d.value,height:o.value},null,8,["option","height"])]),_:1},8,["content-height","max-height-vh"])):(r(),N(t(K),{key:1,title:l.title,description:l.description,scrollable:"","max-height-vh":l.maxHeightVh},{default:V(()=>[s("div",la,[$(t(ae),{option:d.value,height:o.value},null,8,["option","height"])])]),_:1},8,["title","description","max-height-vh"]))}}),da={class:"px-3 py-2"},ua=P({__name:"EChartTimeRank",props:{items:{},title:{},description:{},topN:{default:10},maxHeightVh:{default:60},bare:{type:Boolean,default:!1}},setup(l){const a=l,e=D(()=>a.items.slice(0,a.topN)),o=D(()=>{const p=e.value.length*36;return Math.max(p+30,180)}),c={type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#f59e0b"},{offset:1,color:"#fbbf24"}]};function u(p,_=8){return p.length<=_?p:p.slice(0,_)+"…"}function d(p){return(p/1e3).toFixed(2)+"s"}const g=D(()=>{if(e.value.length===0)return{};const p=[...e.value].reverse(),_=p.map(n=>u(n.name)),y=e.value[0].avgTimeDiff,m=p.map(n=>({value:Math.round(y/n.avgTimeDiff*100),itemStyle:{color:c,borderRadius:[0,4,4,0]}}));return{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"},formatter:n=>{const i=n[0];if(!i)return"";const h=e.value.length-1-i.dataIndex,f=e.value[h];return`
|
|
107
|
-
<div style="padding: 4px 8px;">
|
|
108
|
-
<div style="font-weight: bold; margin-bottom: 6px;">${f.name}</div>
|
|
109
|
-
<div style="margin-bottom: 4px;">⚡️ 平均反应时间: <b>${d(f.avgTimeDiff)}</b></div>
|
|
110
|
-
<div style="font-size: 12px; color: #9ca3af;">参与复读 ${f.count} 次</div>
|
|
111
|
-
</div>
|
|
112
|
-
`}},grid:{left:110,right:100,top:15,bottom:15,containLabel:!1},xAxis:{type:"value",max:105,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1}},yAxis:{type:"category",data:_,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:12,color:"#4b5563",margin:12,formatter:(n,i)=>{const f=e.value.length-1-i+1;return`${f===1?"🥇":f===2?"🥈":f===3?"🥉":`${f}.`} ${n}`}}},series:[{type:"bar",data:m,barWidth:18,barCategoryGap:"30%",label:{show:!0,position:"right",distance:8,formatter:n=>{const i=e.value.length-1-n.dataIndex,h=e.value[i];return`${d(h.avgTimeDiff)} · ${h.count}次`},fontSize:11,fontWeight:500,color:"#6b7280"},emphasis:{itemStyle:{shadowBlur:6,shadowColor:"rgba(245, 158, 11, 0.3)"}}}]}});return(p,_)=>l.bare?(r(),N(t(ye),{key:0,"content-height":o.value,"max-height-vh":l.maxHeightVh},{default:V(()=>[$(t(ae),{option:g.value,height:o.value},null,8,["option","height"])]),_:1},8,["content-height","max-height-vh"])):(r(),N(t(K),{key:1,title:l.title,description:l.description,scrollable:"","max-height-vh":l.maxHeightVh},{default:V(()=>[s("div",da,[$(t(ae),{option:g.value,height:o.value},null,8,["option","height"])])]),_:1},8,["title","description","max-height-vh"]))}}),ma={class:"flex items-center gap-3"},ga={class:"px-3 py-2"},pa=P({__name:"EChartDivingRank",props:{items:{},showTopNSelect:{type:Boolean,default:!0},maxHeightVh:{default:60},globalTopN:{}},setup(l){const a=l,e=A("desc"),o=A(a.globalTopN??10);G(()=>a.globalTopN,n=>{n!==void 0&&(o.value=n)});const c=D(()=>[...a.items].sort((i,h)=>e.value==="desc"?h.daysSinceLastMessage-i.daysSinceLastMessage:i.daysSinceLastMessage-h.daysSinceLastMessage).slice(0,o.value)),u=D(()=>e.value==="desc"?"🤿 潜水榜 - 潜水最久":"🤿 潜水榜 - 最近冒泡"),d=D(()=>e.value==="desc"?"距离上次发言时间最久的成员":"最近发言过的成员"),g=D(()=>{const n=c.value.length*36;return Math.max(n+30,180)}),p={type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#06b6d4"},{offset:1,color:"#22d3ee"}]};function _(n,i=8){return n.length<=i?n:n.slice(0,i)+"…"}function y(n){return n===0?"今天":n===1?"昨天":`${n} 天前`}const m=D(()=>{if(c.value.length===0)return{};const n=[...c.value].reverse(),i=n.map(b=>_(b.name)),h=Math.max(...c.value.map(b=>b.daysSinceLastMessage),1),f=n.map(b=>({value:b.daysSinceLastMessage,itemStyle:{color:p,borderRadius:[0,4,4,0]}}));return{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"},formatter:b=>{const k=b[0];if(!k)return"";const C=c.value.length-1-k.dataIndex,v=c.value[C];return`
|
|
113
|
-
<div style="padding: 4px 8px;">
|
|
114
|
-
<div style="font-weight: bold; margin-bottom: 6px;">${v.name}</div>
|
|
115
|
-
<div style="margin-bottom: 4px;">🤿 ${y(v.daysSinceLastMessage)}</div>
|
|
116
|
-
<div style="font-size: 12px; color: #9ca3af;">最后发言: ${$t(v.lastMessageTs)}</div>
|
|
117
|
-
</div>
|
|
118
|
-
`}},grid:{left:110,right:100,top:15,bottom:15,containLabel:!1},xAxis:{type:"value",max:h*1.15,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1}},yAxis:{type:"category",data:i,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:12,color:"#4b5563",margin:12,formatter:(b,k)=>{const v=c.value.length-1-k+1;return`${v===1?"🥇":v===2?"🥈":v===3?"🥉":`${v}.`} ${b}`}}},series:[{type:"bar",data:f,barWidth:18,barCategoryGap:"30%",label:{show:!0,position:"right",distance:8,formatter:b=>{const k=c.value.length-1-b.dataIndex,C=c.value[k];return y(C.daysSinceLastMessage)},fontSize:11,fontWeight:500,color:"#6b7280"},emphasis:{itemStyle:{shadowBlur:6,shadowColor:"rgba(0, 0, 0, 0.2)"}}}]}});return(n,i)=>(r(),N(t(K),{title:u.value,description:d.value,scrollable:"","max-height-vh":l.maxHeightVh},{headerRight:V(()=>[s("div",ma,[l.showTopNSelect?(r(),N(t(me),{key:0,modelValue:o.value,"onUpdate:modelValue":i[0]||(i[0]=h=>o.value=h)},null,8,["modelValue"])):U("",!0),$(t(ce),{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=h=>e.value=h),items:[{label:"潜水最久",value:"desc"},{label:"最近冒泡",value:"asc"}],size:"sm"},null,8,["modelValue"])])]),default:V(()=>[s("div",ga,[$(t(ae),{option:m.value,height:g.value},null,8,["option","height"])])]),_:1},8,["title","description","max-height-vh"]))}}),ha={class:"px-3 py-2"},va=P({__name:"EChartConsecutiveRank",props:{items:{},title:{},description:{},topN:{default:10},maxHeightVh:{default:60},bare:{type:Boolean,default:!1}},setup(l){const a=l,e=D(()=>[...a.items].sort((p,_)=>_.maxConsecutiveDays-p.maxConsecutiveDays).slice(0,a.topN)),o=D(()=>{const p=e.value.length*36;return Math.max(p+30,180)}),c={type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#f97316"},{offset:1,color:"#fb923c"}]},u={type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#ec4899"},{offset:1,color:"#f472b6"}]};function d(p,_=8){return p.length<=_?p:p.slice(0,_)+"…"}const g=D(()=>{if(e.value.length===0)return{};const p=[...e.value].reverse(),_=p.map(m=>d(m.name)),y=Math.max(...e.value.map(m=>m.maxConsecutiveDays),1);return{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(0, 0, 0, 0.85)",borderColor:"transparent",textStyle:{color:"#fff",fontSize:12},formatter:m=>{if(!m||m.length===0)return"";const n=m[0].dataIndex,i=e.value.length-1-n,h=e.value[i];let f=`
|
|
119
|
-
<div style="padding: 6px 8px;">
|
|
120
|
-
<div style="font-weight: bold; margin-bottom: 6px;">${h.name}</div>
|
|
121
|
-
<div>最长连续: <b style="color: #f472b6;">${h.maxConsecutiveDays}</b> 天</div>
|
|
122
|
-
`;return h.currentStreak>0&&(f+=`<div style="color: #f97316;">🔥 当前连续 ${h.currentStreak} 天</div>`),f+="</div>",f}},legend:{show:!1},grid:{left:110,right:75,top:15,bottom:15,containLabel:!1},xAxis:{type:"value",max:y*1.15,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1}},yAxis:{type:"category",data:_,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:12,color:"#4b5563",margin:12,formatter:(m,n)=>{const h=e.value.length-1-n+1;return`${h===1?"🥇":h===2?"🥈":h===3?"🥉":`${h}.`} ${m}`}}},series:[{name:"当前连续",type:"bar",data:p.map(m=>({value:m.currentStreak>0?m.maxConsecutiveDays:0,itemStyle:{color:c,borderRadius:[0,4,4,0]}})),barWidth:18,barGap:"-100%",label:{show:!0,position:"right",distance:8,formatter:m=>{const n=e.value.length-1-m.dataIndex,i=e.value[n];return i.currentStreak>0?`${i.maxConsecutiveDays} 天`:""},fontSize:11,fontWeight:500,color:"#6b7280"}},{name:"已中断",type:"bar",data:p.map(m=>({value:m.currentStreak===0?m.maxConsecutiveDays:0,itemStyle:{color:u,borderRadius:[0,4,4,0]}})),barWidth:18,label:{show:!0,position:"right",distance:8,formatter:m=>{const n=e.value.length-1-m.dataIndex,i=e.value[n];return i.currentStreak===0?`${i.maxConsecutiveDays} 天`:""},fontSize:11,fontWeight:500,color:"#6b7280"}}]}});return(p,_)=>l.bare?(r(),N(t(ye),{key:0,"content-height":o.value,"max-height-vh":l.maxHeightVh},{default:V(()=>[$(t(ae),{option:g.value,height:o.value},null,8,["option","height"])]),_:1},8,["content-height","max-height-vh"])):(r(),N(t(K),{key:1,title:l.title,description:l.description,scrollable:"","max-height-vh":l.maxHeightVh},{default:V(()=>[s("div",ha,[$(t(ae),{option:g.value,height:o.value},null,8,["option","height"])])]),_:1},8,["title","description","max-height-vh"]))}}),fa={class:"px-3 py-2"},ya=P({__name:"EChartNightOwlRank",props:{items:{},title:{},description:{},topN:{default:10},maxHeightVh:{default:60},bare:{type:Boolean,default:!1}},setup(l){const a=l,e=D(()=>a.items.slice(0,a.topN)),o=D(()=>{const g=e.value.length*36;return Math.max(g+50,200)}),c={h23:"#8b5cf6",h0:"#3b82f6",h1:"#06b6d4",h2:"#f59e0b",h3to4:"#ef4444"};function u(g,p=8){return g.length<=p?g:g.slice(0,p)+"…"}const d=D(()=>{if(e.value.length===0)return{};const g=[...e.value].reverse(),p=g.map(y=>u(y.name)),_=Math.max(...e.value.map(y=>y.totalNightMessages),1);return{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(0, 0, 0, 0.85)",borderColor:"transparent",textStyle:{color:"#fff",fontSize:12},formatter:y=>{if(!y||y.length===0)return"";const m=y[0].dataIndex,n=e.value.length-1-m,i=e.value[n],h=i.hourlyBreakdown;return`
|
|
123
|
-
<div style="padding: 6px 8px;">
|
|
124
|
-
<div style="font-weight: bold; margin-bottom: 6px;">${i.name}</div>
|
|
125
|
-
<div style="margin-bottom: 4px;">
|
|
126
|
-
称号: <b style="color: #f472b6;">${i.title}</b>
|
|
127
|
-
</div>
|
|
128
|
-
<div style="margin-bottom: 6px;">总发言: <b>${i.totalNightMessages}</b> 条</div>
|
|
129
|
-
<div style="border-top: 1px solid #374151; padding-top: 6px;">
|
|
130
|
-
<div><span style="color: ${c.h23};">●</span> 23点: ${h.h23} 条</div>
|
|
131
|
-
<div><span style="color: ${c.h0};">●</span> 0点: ${h.h0} 条</div>
|
|
132
|
-
<div><span style="color: ${c.h1};">●</span> 1点: ${h.h1} 条</div>
|
|
133
|
-
<div><span style="color: ${c.h2};">●</span> 2点: ${h.h2} 条</div>
|
|
134
|
-
<div><span style="color: ${c.h3to4};">●</span> 3-4点: ${h.h3to4} 条</div>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
`}},legend:{show:!0,bottom:0,itemWidth:12,itemHeight:12,textStyle:{color:"#6b7280",fontSize:10}},grid:{left:110,right:70,top:15,bottom:35,containLabel:!1},xAxis:{type:"value",max:_*1.15,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1}},yAxis:{type:"category",data:p,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:12,color:"#4b5563",margin:12,formatter:(y,m)=>{const i=e.value.length-1-m+1;return`${i===1?"🥇":i===2?"🥈":i===3?"🥉":`${i}.`} ${y}`}}},series:[{name:"23点",type:"bar",stack:"total",data:g.map(y=>y.hourlyBreakdown.h23),itemStyle:{color:c.h23},barWidth:18},{name:"0点",type:"bar",stack:"total",data:g.map(y=>y.hourlyBreakdown.h0),itemStyle:{color:c.h0},barWidth:18},{name:"1点",type:"bar",stack:"total",data:g.map(y=>y.hourlyBreakdown.h1),itemStyle:{color:c.h1},barWidth:18},{name:"2点",type:"bar",stack:"total",data:g.map(y=>y.hourlyBreakdown.h2),itemStyle:{color:c.h2},barWidth:18},{name:"3-4点",type:"bar",stack:"total",data:g.map(y=>y.hourlyBreakdown.h3to4),itemStyle:{color:c.h3to4,borderRadius:[0,4,4,0]},barWidth:18,label:{show:!0,position:"right",distance:8,formatter:y=>{const m=e.value.length-1-y.dataIndex;return`${e.value[m].totalNightMessages} 条`},fontSize:11,fontWeight:500,color:"#6b7280"}}]}});return(g,p)=>l.bare?(r(),N(t(ye),{key:0,"content-height":o.value,"max-height-vh":l.maxHeightVh},{default:V(()=>[$(t(ae),{option:d.value,height:o.value},null,8,["option","height"])]),_:1},8,["content-height","max-height-vh"])):(r(),N(t(K),{key:1,title:l.title,description:l.description,scrollable:"","max-height-vh":l.maxHeightVh},{default:V(()=>[s("div",fa,[$(t(ae),{option:d.value,height:o.value},null,8,["option","height"])])]),_:1},8,["title","description","max-height-vh"]))}}),xa={id:"streak-rank",class:"scroll-mt-24"},ba={class:"flex items-center gap-3"},_a=P({__name:"CheckInRank",props:{sessionId:{},timeFilter:{},showTopNSelect:{type:Boolean,default:!0},globalTopN:{}},setup(l){const a=l,e=A(null),o=A(!1),c=A("max"),u=A(a.globalTopN??10);G(()=>a.globalTopN,y=>{y!==void 0&&(u.value=y)});const d=D(()=>c.value==="max"?"🔥 火花榜 - 最长连续":"🔥 火花榜 - 当前连续"),g=D(()=>c.value==="max"?"历史最长连续发言天数":"正在持续连续发言的成员"),p=D(()=>e.value?e.value.streakRank.some(y=>y.currentStreak>0):!1);async function _(){if(a.sessionId){o.value=!0;try{e.value=await Ze(a.sessionId,a.timeFilter)}catch(y){console.error("加载打卡分析失败:",y)}finally{o.value=!1}}}return G(()=>[a.sessionId,a.timeFilter],()=>{_()},{immediate:!0,deep:!0}),(y,m)=>(r(),I("div",xa,[o.value?(r(),N(t(ne),{key:0,text:"正在分析数据..."})):e.value&&e.value.streakRank.length>0?(r(),N(t(K),{key:1,title:d.value,description:g.value},{headerRight:V(()=>[s("div",ba,[l.showTopNSelect?(r(),N(t(me),{key:0,modelValue:u.value,"onUpdate:modelValue":m[0]||(m[0]=n=>u.value=n)},null,8,["modelValue"])):U("",!0),p.value?(r(),N(t(ce),{key:1,modelValue:c.value,"onUpdate:modelValue":m[1]||(m[1]=n=>c.value=n),items:[{label:"最长连续",value:"max"},{label:"当前连续",value:"current"}],size:"sm"},null,8,["modelValue"])):U("",!0)])]),default:V(()=>[$(t(ra),{items:e.value.streakRank,title:d.value,mode:c.value,"top-n":u.value,bare:""},null,8,["items","title","mode","top-n"])]),_:1},8,["title","description"])):(r(),N(t(K),{key:2,title:"🔥 火花榜"},{default:V(()=>[$(t(le),{text:"暂无连续发言数据"})]),_:1}))]))}}),ka={class:"flex items-center gap-3"},wa={key:1,class:"py-8 text-center text-sm text-gray-400"},$a={key:1,class:"py-8 text-center text-sm text-gray-400"},Ia=P({__name:"MemeBattleRank",props:{sessionId:{},timeFilter:{},showTopNSelect:{type:Boolean,default:!0},globalTopN:{}},setup(l){const a=l,e=A(null),o=A(!1),c=A("count"),u=A(a.globalTopN??10);G(()=>a.globalTopN,i=>{i!==void 0&&(u.value=i)});async function d(){if(a.sessionId){o.value=!0;try{e.value=await zs(a.sessionId,a.timeFilter)}catch(i){console.error("加载斗图分析失败:",i)}finally{o.value=!1}}}const g=D(()=>e.value?e.value.rankByCount.map(i=>({id:i.memberId.toString(),name:i.name,value:i.count,percentage:i.percentage})):[]),p=D(()=>e.value?e.value.rankByImageCount.map(i=>({id:i.memberId.toString(),name:i.name,value:i.count,percentage:i.percentage})):[]),_=D(()=>c.value==="count"?g.value:p.value),y=D(()=>c.value==="count"?"场":"张"),m=D(()=>{switch(c.value){case"battle":return"⚔️ 斗图榜 - 史诗级战役";case"count":return"⚔️ 斗图榜 - 按场次";case"image":return"⚔️ 斗图榜 - 按图量";default:return"⚔️ 斗图榜"}}),n=D(()=>{switch(c.value){case"battle":return"记录最激烈的斗图大战";case"count":return"参与斗图次数最多的人";case"image":return"在斗图中发送图片最多的人";default:return""}});return G(()=>[a.sessionId,a.timeFilter],()=>d(),{immediate:!0,deep:!0}),(i,h)=>o.value?(r(),N(t(ne),{key:0,text:"正在统计斗图数据..."})):e.value?(r(),N(t(K),{key:1,title:m.value,description:n.value},{headerRight:V(()=>[s("div",ka,[l.showTopNSelect?(r(),N(t(me),{key:0,modelValue:u.value,"onUpdate:modelValue":h[0]||(h[0]=f=>u.value=f)},null,8,["modelValue"])):U("",!0),$(t(ce),{modelValue:c.value,"onUpdate:modelValue":h[1]||(h[1]=f=>c.value=f),items:[{label:"按场次",value:"count"},{label:"按图量",value:"image"},{label:"史诗级战役",value:"battle"}],size:"sm"},null,8,["modelValue"])])]),default:V(()=>[c.value==="battle"?(r(),I(q,{key:0},[e.value.topBattles.length>0?(r(),N(t(ca),{key:0,battles:e.value.topBattles,title:"","top-n":u.value,bare:""},null,8,["battles","top-n"])):(r(),I("div",wa,"暂无史诗级战役数据"))],64)):(r(),I(q,{key:1},[_.value.length>0?(r(),N(t($e),{key:0,members:_.value,title:m.value,unit:y.value,"top-n":u.value,bare:""},null,8,["members","title","unit","top-n"])):(r(),I("div",$a,"暂无斗图数据"))],64))]),_:1},8,["title","description"])):U("",!0)}}),Ca={class:"space-y-6"},Sa={class:"flex items-center gap-3"},Ma={class:"flex items-center gap-3"},Ta={key:1,class:"px-3 py-2"},Da=P({__name:"RepeatSection",props:{sessionId:{},timeFilter:{},showTopNSelect:{type:Boolean,default:!0},globalTopN:{}},setup(l){const a=l,e=A(null),o=A(!1),c=A("originator"),u=A("fastest"),d=A(a.globalTopN??10),g=A(a.globalTopN??10);G(()=>a.globalTopN,C=>{C!==void 0&&(d.value=C,g.value=C)});async function p(){if(a.sessionId){o.value=!0;try{e.value=await et(a.sessionId,a.timeFilter)}catch(C){console.error("加载复读分析失败:",C)}finally{o.value=!1}}}const _=D(()=>e.value?e.value.originators.map(C=>({id:C.memberId.toString(),name:C.name,value:C.count,percentage:C.percentage})):[]),y=D(()=>e.value?e.value.initiators.map(C=>({id:C.memberId.toString(),name:C.name,value:C.count,percentage:C.percentage})):[]),m=D(()=>e.value?e.value.breakers.map(C=>({id:C.memberId.toString(),name:C.name,value:C.count,percentage:C.percentage})):[]),n=D(()=>{switch(c.value){case"originator":return _.value;case"initiator":return y.value;case"breaker":return m.value;default:return _.value}}),i=D(()=>{switch(c.value){case"originator":return"🔁 复读榜 - 被复读";case"initiator":return"🔁 复读榜 - 挑起";case"breaker":return"🔁 复读榜 - 打断";default:return"🔁 复读榜"}}),h=D(()=>{switch(c.value){case"originator":return"发出的消息被别人复读的次数";case"initiator":return"第二个发送相同消息、带起节奏的人";case"breaker":return"终结复读链的人";default:return""}}),f=D(()=>{if(!e.value)return{labels:[],values:[]};const C=e.value.chainLengthDistribution;return{labels:C.map(v=>`${v.length}人`),values:C.map(v=>v.count)}}),b=D(()=>u.value==="fastest"?"📊 复读统计 - 最快反应":"📊 复读统计 - 链长分布"),k=D(()=>{if(u.value==="fastest")return"平均复读反应时间(至少参与5次复读)";const C=e.value?.totalRepeatChains??0,v=e.value?.avgChainLength??0;return`共 ${C} 次复读,平均 ${v} 人参与`});return G(()=>[a.sessionId,a.timeFilter],()=>p(),{immediate:!0,deep:!0}),(C,v)=>(r(),I("div",Ca,[o.value?(r(),N(t(ne),{key:0,text:"正在分析复读数据..."})):e.value&&e.value.totalRepeatChains>0?(r(),I(q,{key:1},[$(t(K),{title:i.value,description:h.value},{headerRight:V(()=>[s("div",Sa,[l.showTopNSelect?(r(),N(t(me),{key:0,modelValue:d.value,"onUpdate:modelValue":v[0]||(v[0]=w=>d.value=w)},null,8,["modelValue"])):U("",!0),$(t(ce),{modelValue:c.value,"onUpdate:modelValue":v[1]||(v[1]=w=>c.value=w),items:[{label:"被复读",value:"originator"},{label:"挑起",value:"initiator"},{label:"打断",value:"breaker"}],size:"sm"},null,8,["modelValue"])])]),default:V(()=>[n.value.length>0?(r(),N(t($e),{key:0,members:n.value,title:i.value,unit:"次","top-n":d.value,bare:""},null,8,["members","title","top-n"])):(r(),N(t(le),{key:1,text:"暂无数据"}))]),_:1},8,["title","description"]),$(t(K),{title:b.value,description:k.value},{headerRight:V(()=>[s("div",Ma,[l.showTopNSelect&&u.value==="fastest"?(r(),N(t(me),{key:0,modelValue:g.value,"onUpdate:modelValue":v[2]||(v[2]=w=>g.value=w)},null,8,["modelValue"])):U("",!0),$(t(ce),{modelValue:u.value,"onUpdate:modelValue":v[3]||(v[3]=w=>u.value=w),items:[{label:"最快反应",value:"fastest"},{label:"链长分布",value:"distribution"}],size:"sm"},null,8,["modelValue"])])]),default:V(()=>[u.value==="fastest"?(r(),I(q,{key:0},[e.value.fastestRepeaters&&e.value.fastestRepeaters.length>0?(r(),N(t(ua),{key:0,items:e.value.fastestRepeaters,"top-n":g.value,title:"",bare:""},null,8,["items","top-n"])):(r(),N(t(le),{key:1,text:"暂无最快复读数据"}))],64)):(r(),I("div",Ta,[f.value.labels.length>0?(r(),N(t(It),{key:0,data:f.value,height:200},null,8,["data"])):(r(),N(t(le),{key:1,text:"暂无分布数据"}))]))]),_:1},8,["title","description"])],64)):(r(),N(t(K),{key:2,title:"🔁 复读榜"},{default:V(()=>[$(t(le),{text:"该群组暂无复读记录"})]),_:1}))]))}}),Ra=P({__name:"DivingRank",props:{sessionId:{},timeFilter:{},globalTopN:{}},setup(l){const a=l,e=A(null),o=A(!1);async function c(){if(a.sessionId){o.value=!0;try{e.value=await Vs(a.sessionId,a.timeFilter)}catch(u){console.error("加载潜水分析失败:",u)}finally{o.value=!1}}}return G(()=>[a.sessionId,a.timeFilter],()=>c(),{immediate:!0,deep:!0}),(u,d)=>o.value?(r(),N(t(ne),{key:0,text:"正在统计潜水数据..."})):e.value&&e.value.rank.length>0?(r(),N(t(pa),{key:1,items:e.value.rank,"global-top-n":l.globalTopN},null,8,["items","global-top-n"])):U("",!0)}}),Na={class:"space-y-6"},Aa={class:"flex items-center gap-3"},La={key:1,class:"py-8 text-center text-sm text-gray-400"},Va={key:1,class:"py-8 text-center text-sm text-gray-400"},Ea={class:"flex items-center gap-3"},Oa={key:1,class:"py-8 text-center text-sm text-gray-400"},za=P({__name:"NightOwlRank",props:{sessionId:{},timeFilter:{},showTopNSelect:{type:Boolean,default:!0},globalTopN:{}},setup(l){const a=l,e=A(null),o=A(!1),c=A("first"),u=A("distribution"),d=A(a.globalTopN??10),g=A(a.globalTopN??10);G(()=>a.globalTopN,b=>{b!==void 0&&(d.value=b,g.value=b)});async function p(){if(a.sessionId){o.value=!0;try{e.value=await Bs(a.sessionId,a.timeFilter)}catch(b){console.error("加载出勤分析失败:",b)}finally{o.value=!1}}}const _=D(()=>e.value?e.value.lastSpeakerRank.map(b=>({id:String(b.memberId),name:b.name,value:b.count,percentage:b.percentage})):[]),y=D(()=>e.value?e.value.firstSpeakerRank.map(b=>({id:String(b.memberId),name:b.name,value:b.count,percentage:b.percentage})):[]),m=D(()=>c.value==="last"?_.value:y.value),n=D(()=>c.value==="last"?"⏰ 出勤排行 - 最晚下班":"⏰ 出勤排行 - 最早上班"),i=D(()=>{const b=e.value?.totalDays??0;return c.value==="last"?`每天最后一个发言的人(共 ${b} 天)`:`每天第一个发言的人(共 ${b} 天)`}),h=D(()=>u.value==="distribution"?"🦉 修仙统计 - 发言分布":"🦉 修仙统计 - 连续记录"),f=D(()=>u.value==="distribution"?"深夜时段(23:00-05:00)各时段发言分布":"连续在深夜时段发言的天数");return G(()=>[a.sessionId,a.timeFilter],()=>p(),{immediate:!0,deep:!0}),(b,k)=>(r(),I("div",Na,[o.value?(r(),N(t(ne),{key:0,text:"正在加载出勤分析..."})):e.value?(r(),I(q,{key:1},[$(t(K),{title:h.value,description:f.value},{headerRight:V(()=>[s("div",Aa,[l.showTopNSelect?(r(),N(t(me),{key:0,modelValue:d.value,"onUpdate:modelValue":k[0]||(k[0]=C=>d.value=C)},null,8,["modelValue"])):U("",!0),$(t(ce),{modelValue:u.value,"onUpdate:modelValue":k[1]||(k[1]=C=>u.value=C),items:[{label:"发言分布",value:"distribution"},{label:"连续记录",value:"consecutive"}],size:"sm"},null,8,["modelValue"])])]),default:V(()=>[u.value==="distribution"?(r(),I(q,{key:0},[e.value.nightOwlRank.length>0?(r(),N(t(ya),{key:0,items:e.value.nightOwlRank,"top-n":d.value,title:"",bare:""},null,8,["items","top-n"])):(r(),I("div",La,"暂无深夜发言数据"))],64)):(r(),I(q,{key:1},[e.value.consecutiveRecords.length>0?(r(),N(t(va),{key:0,items:e.value.consecutiveRecords,"top-n":d.value,title:"",bare:""},null,8,["items","top-n"])):(r(),I("div",Va,"暂无连续记录"))],64))]),_:1},8,["title","description"]),$(t(K),{title:n.value,description:i.value},{headerRight:V(()=>[s("div",Ea,[l.showTopNSelect?(r(),N(t(me),{key:0,modelValue:g.value,"onUpdate:modelValue":k[2]||(k[2]=C=>g.value=C)},null,8,["modelValue"])):U("",!0),$(t(ce),{modelValue:c.value,"onUpdate:modelValue":k[3]||(k[3]=C=>c.value=C),items:[{label:"最早上班",value:"first"},{label:"最晚下班",value:"last"}],size:"sm"},null,8,["modelValue"])])]),default:V(()=>[m.value.length>0?(r(),N(t($e),{key:0,members:m.value,title:n.value,"top-n":g.value,unit:"次",bare:""},null,8,["members","title","top-n"])):(r(),I("div",Oa,"暂无数据"))]),_:1},8,["title","description"])],64)):U("",!0)]))}}),Fa={class:"main-content min-w-0 flex-1 px-8 mx-auto max-w-3xl space-y-6"},Ba={class:"mb-8 mt-4"},Ua={class:"text-5xl tracking-wider",style:{"font-weight":"800",background:"linear-gradient(to right, #f59e0b, #ec4899, #9333ea)","-webkit-background-clip":"text","-webkit-text-fill-color":"transparent"}},Ha={id:"activity-rank",class:"scroll-mt-24"},Wa={id:"meme-battle",class:"scroll-mt-24"},ja={id:"repeat",class:"scroll-mt-24"},Pa={id:"night-owl",class:"scroll-mt-24"},qa={id:"diving",class:"scroll-mt-24"},Ya={class:"border-l border-gray-200 pl-4 dark:border-gray-800"},Ga=P({__name:"RankingView",props:{sessionId:{},timeFilter:{}},setup(l){const a=l,e=A([]),o=A([]);async function c(){if(!a.sessionId)return;const[n,i]=await Promise.all([window.chatApi.getMemberActivity(a.sessionId,a.timeFilter),window.chatApi.getAvailableYears(a.sessionId)]);e.value=n,o.value=i}G(()=>[a.sessionId,a.timeFilter],()=>c(),{immediate:!0,deep:!0});const u=D(()=>{if(a.timeFilter?.startTs&&a.timeFilter?.endTs){const n=new Date(a.timeFilter.startTs*1e3).getFullYear(),i=new Date(a.timeFilter.endTs*1e3).getFullYear();return n===i?`${n} 赛季`:`${n}-${i} 赛季`}if(o.value.length>0){const n=[...o.value].sort((f,b)=>f-b),i=n[0],h=n[n.length-1];return i===h?`${i} 赛季`:`${i}-${h} 赛季`}return"全部赛季"}),d=D(()=>({startTs:a.timeFilter?.startTs,endTs:a.timeFilter?.endTs})),g=[{id:"activity-rank",label:"🏆 活跃榜"},{id:"streak-rank",label:"🔥 火花榜"},{id:"meme-battle",label:"⚔️ 斗图榜"},{id:"repeat",label:"🔁 复读榜"},{id:"night-owl",label:"⏰ 出勤榜"},{id:"diving",label:"🤿 潜水榜"}],{contentRef:p,activeAnchor:_,scrollToAnchor:y}=Gt(g,{threshold:350}),m=A(10);return(n,i)=>(r(),I("div",{ref_key:"contentRef",ref:p,class:"flex gap-6 p-6"},[s("div",Fa,[s("div",Ba,[s("h1",Ua," 🏆 "+x(u.value),1),i[1]||(i[1]=s("p",{class:"mt-4 text-sm text-gray-500 dark:text-gray-400"},"各榜单前三名请找群主领取奖励 🎁",-1))]),s("div",Ha,[$(t(aa),{"session-id":a.sessionId,"member-activity":e.value,"time-filter":d.value,"global-top-n":m.value},null,8,["session-id","member-activity","time-filter","global-top-n"])]),$(t(_a),{"session-id":a.sessionId,"time-filter":d.value,"global-top-n":m.value},null,8,["session-id","time-filter","global-top-n"]),s("div",Wa,[$(t(Ia),{"session-id":a.sessionId,"time-filter":d.value,"global-top-n":m.value},null,8,["session-id","time-filter","global-top-n"])]),s("div",ja,[$(t(Da),{"session-id":a.sessionId,"time-filter":d.value,"global-top-n":m.value},null,8,["session-id","time-filter","global-top-n"])]),s("div",Pa,[$(t(za),{"session-id":a.sessionId,"time-filter":d.value,"global-top-n":m.value},null,8,["session-id","time-filter","global-top-n"])]),s("div",qa,[$(t(Ra),{"session-id":a.sessionId,"time-filter":d.value,"global-top-n":m.value},null,8,["session-id","time-filter","global-top-n"])]),i[2]||(i[2]=s("div",{class:"h-48 no-capture"},null,-1))]),$(t(Xt),{anchors:g,"active-anchor":t(_),onClick:t(y)},{default:V(()=>[s("div",Ya,[i[3]||(i[3]=s("div",{class:"text-xs text-gray-400 mb-2"},"显示数量",-1)),$(t(me),{modelValue:m.value,"onUpdate:modelValue":i[0]||(i[0]=h=>m.value=h)},null,8,["modelValue"])])]),_:1},8,["active-anchor","onClick"])],512))}});function tt(l){const a=[],e=[];return l?.startTs!=null&&(a.push("AND msg.ts >= ?"),e.push(l.startTs)),l?.endTs!=null&&(a.push("AND msg.ts <= ?"),e.push(l.endTs)),l?.memberId!=null&&(a.push("AND msg.sender_id = ?"),e.push(l.memberId)),{conditions:a.join(" "),params:e}}const Ja="AND COALESCE(m.account_name, '') != '系统消息'";async function Ka(l,a){const{conditions:e,params:o}=tt(a);return window.chatApi.pluginQuery(l,`SELECT
|
|
138
|
-
m.id,
|
|
139
|
-
m.platform_id as platformId,
|
|
140
|
-
COALESCE(m.group_nickname, m.account_name, m.platform_id) as name,
|
|
141
|
-
COUNT(msg.id) as messageCount
|
|
142
|
-
FROM member m
|
|
143
|
-
LEFT JOIN message msg ON m.id = msg.sender_id ${e} ${Ja}
|
|
144
|
-
WHERE COALESCE(m.account_name, '') != '系统消息'
|
|
145
|
-
GROUP BY m.id`,o)}async function Qa(l){return window.chatApi.pluginQuery(l,`SELECT member_id as memberId, name
|
|
146
|
-
FROM member_name_history`)}async function Xa(l,a){const{conditions:e,params:o}=tt(a);return window.chatApi.pluginQuery(l,`SELECT msg.sender_id as senderId, msg.content
|
|
147
|
-
FROM message msg
|
|
148
|
-
JOIN member m ON msg.sender_id = m.id
|
|
149
|
-
WHERE COALESCE(m.account_name, '') != '系统消息'
|
|
150
|
-
AND msg.type = 0
|
|
151
|
-
AND msg.content IS NOT NULL
|
|
152
|
-
AND msg.content LIKE '%@%'
|
|
153
|
-
${e}`,o)}function Za(l){const{members:a,nameHistory:e,messages:o}=l,c={nodes:[],links:[],maxLinkValue:0};if(a.length===0)return c;const u=new Map,d=new Map;for(const h of a)d.set(h.id,{name:h.name,messageCount:h.messageCount}),u.set(h.name,h.id);for(const h of e)u.has(h.name)||u.set(h.name,h.memberId);const g=new Map,p=/@([^\s@]+)/g;for(const h of o){const f=h.content.matchAll(p),b=new Set;for(const k of f){const C=k[1],v=u.get(C);if(v&&v!==h.senderId&&!b.has(v)){b.add(v),g.has(h.senderId)||g.set(h.senderId,new Map);const w=g.get(h.senderId);w.set(v,(w.get(v)||0)+1)}}}const _=new Set;for(const[h,f]of g.entries()){_.add(h);for(const b of f.keys())_.add(b)}const y=Math.max(...a.filter(h=>_.has(h.id)).map(h=>h.messageCount),1),m=[];for(const h of _){const f=d.get(h);if(f){const b=20+f.messageCount/y*40;m.push({id:h,name:f.name,value:f.messageCount,symbolSize:Math.round(b)})}}const n=[];let i=0;for(const[h,f]of g.entries()){const b=d.get(h);if(b)for(const[k,C]of f.entries()){const v=d.get(k);v&&(n.push({source:b.name,target:v.name,value:C}),i=Math.max(i,C))}}return{nodes:m,links:n,maxLinkValue:i}}async function en(l,a){const e={nodes:[],links:[],maxLinkValue:0};try{const[o,c,u]=await Promise.all([Ka(l,a),Qa(l),Xa(l,a)]);return o.length===0?e:await window.chatApi.pluginCompute(Za.toString(),{members:o,nameHistory:c,messages:u})}catch(o){return console.error("[chart-interaction] Failed to load mention graph:",o),e}}const tn={class:"flex h-full flex-col"},sn={class:"flex items-center justify-end px-4 py-2"},an={class:"flex items-center gap-4"},nn={class:"flex items-center gap-2"},on={class:"text-xs text-gray-400"},rn={class:"flex items-center gap-2"},ln={class:"text-xs text-gray-400"},cn={class:"flex-1 min-h-0 relative"},dn={key:0,class:"absolute inset-0 flex items-center justify-center"},un={key:0,class:"h-full"},mn={class:"absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-gray-100/80 px-3 py-1 text-xs text-gray-500 backdrop-blur-sm dark:bg-gray-800/80 dark:text-gray-400"},gn={key:1,class:"flex h-full items-center justify-center text-gray-400"},pn={class:"text-center"},hn={class:"mt-2 text-sm"},vn=P({__name:"InteractionView",props:{sessionId:{},timeFilter:{}},setup(l){const a=l,{t:e}=se(),o=A(!0),c=A({nodes:[],links:[],maxLinkValue:0}),u=A("circular"),d=A(!1),g=A(null);function p(){g.value?.resetView()}async function _(){if(a.sessionId){o.value=!0;try{const y=await en(a.sessionId,a.timeFilter);c.value={nodes:y.nodes,links:y.links,maxLinkValue:y.maxLinkValue}}catch(y){console.error("[chart-interaction] 加载互动关系图数据失败:",y)}finally{o.value=!1}}}return G(()=>[a.sessionId,a.timeFilter],()=>{_()},{immediate:!0,deep:!0}),(y,m)=>{const n=ge,i=qe("UButtonGroup"),h=at,f=we;return r(),I("div",tn,[s("div",sn,[s("div",an,[s("div",nn,[s("span",on,x(t(e)("views.interaction.layout"))+":",1),$(i,{size:"xs"},{default:V(()=>[$(n,{color:u.value==="circular"?"primary":"neutral",variant:u.value==="circular"?"solid":"ghost",onClick:m[0]||(m[0]=b=>u.value="circular")},{default:V(()=>[Q(x(t(e)("views.interaction.circular")),1)]),_:1},8,["color","variant"]),$(n,{color:u.value==="force"?"primary":"neutral",variant:u.value==="force"?"solid":"ghost",onClick:m[1]||(m[1]=b=>u.value="force")},{default:V(()=>[Q(x(t(e)("views.interaction.force")),1)]),_:1},8,["color","variant"])]),_:1})]),s("div",rn,[s("span",ln,x(t(e)("views.interaction.directed"))+":",1),$(h,{modelValue:d.value,"onUpdate:modelValue":m[2]||(m[2]=b=>d.value=b),size:"xs"},null,8,["modelValue"])]),$(n,{size:"xs",color:"neutral",variant:"ghost",icon:"i-heroicons-arrow-path",onClick:p},{default:V(()=>[Q(x(t(e)("views.interaction.reset")),1)]),_:1})])]),s("div",cn,[o.value?(r(),I("div",dn,[$(f,{name:"i-heroicons-arrow-path",class:"h-8 w-8 animate-spin text-pink-500"})])):(r(),I(q,{key:1},[c.value.nodes.length>0?(r(),I("div",un,[$(t(Zt),{ref_key:"graphRef",ref:g,data:c.value,layout:u.value,directed:d.value,height:"100%"},null,8,["data","layout","directed"]),s("div",mn,x(t(e)("views.interaction.graphHint",{nodes:c.value.nodes.length,links:c.value.links.length})),1)])):(r(),I("div",gn,[s("div",pn,[$(f,{name:"i-heroicons-user-group",class:"mx-auto h-10 w-10 text-gray-300 dark:text-gray-600"}),s("p",hn,x(t(e)("views.interaction.noInteraction")),1)])]))],64))])])}}}),fn={class:"main-content mx-auto max-w-[920px] space-y-6 p-6"},yn={class:"grid grid-cols-1 gap-6 lg:grid-cols-2"},xn={class:"grid grid-cols-1 gap-6 lg:grid-cols-2"},bn={class:"divide-y divide-gray-100 dark:divide-gray-800"},_n={class:"flex flex-1 items-center gap-2"},kn=["onClick"],wn={class:"flex items-center gap-1 text-pink-500"},$n={class:"text-xs"},In=["onClick"],Cn={class:"shrink-0 text-right text-sm text-gray-500"},Sn={key:0,class:"text-red-500"},Mn={key:1},Tn={class:"divide-y divide-gray-100 dark:divide-gray-800"},Dn={class:"flex flex-1 items-center gap-2"},Rn=["onClick"],Nn={class:"flex items-center gap-1"},An={class:"text-xs text-gray-400"},Ln={class:"text-xs text-gray-400"},Vn=["onClick"],En={class:"shrink-0 text-right"},On={class:"text-lg font-bold text-pink-600"},zn={class:"ml-1 text-sm text-gray-500"},Fn={key:0,class:"p-5"},Bn={class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"},Un={key:0,class:"mb-4"},Hn={class:"mb-2 text-sm font-medium text-gray-700 dark:text-gray-300"},Wn={class:"space-y-2"},jn={class:"text-sm font-medium text-gray-900 dark:text-white"},Pn={class:"text-xs text-gray-500"},qn={key:1},Yn={class:"mb-2 text-sm font-medium text-gray-700 dark:text-gray-300"},Gn={class:"space-y-2"},Jn={class:"text-sm font-medium text-gray-900 dark:text-white"},Kn={class:"text-xs text-gray-500"},Qn={class:"mt-4 flex justify-end"},Xn=P({__name:"Relationships",props:{sessionId:{},timeFilter:{}},setup(l){const{t:a}=se(),e=l,o=A(null),c=A(!1),u=A(null),d=A(!1);async function g(){if(e.sessionId){c.value=!0;try{o.value=await ue().getMentionAnalysis(e.sessionId,e.timeFilter)}catch(m){console.error("加载 @ 互动分析失败:",m)}finally{c.value=!1}}}const p=D(()=>o.value?o.value.topMentioners.map(m=>({id:m.memberId.toString(),name:m.name,value:m.count,percentage:m.percentage})):[]),_=D(()=>o.value?o.value.topMentioned.map(m=>({id:m.memberId.toString(),name:m.name,value:m.count,percentage:m.percentage})):[]);function y(m){if(!o.value)return;const n=o.value.memberDetails.find(i=>i.memberId===m);n&&(u.value=n,d.value=!0)}return G(()=>[e.sessionId,e.timeFilter],()=>{g()},{immediate:!0,deep:!0}),(m,n)=>{const i=Fe,h=ge,f=_e;return r(),I("div",fn,[c.value?(r(),N(t(ne),{key:0,text:t(a)("members.relationships.loading")},null,8,["text"])):o.value&&o.value.totalMentions>0?(r(),I(q,{key:1},[s("div",yn,[p.value.length>0?(r(),N(t(Oe),{key:0,members:p.value,title:t(a)("members.relationships.topMentioners"),description:t(a)("members.relationships.totalMentions",{count:o.value.totalMentions}),unit:t(a)("members.relationships.times")},null,8,["members","title","description","unit"])):U("",!0),_.value.length>0?(r(),N(t(Oe),{key:1,members:_.value,title:t(a)("members.relationships.topMentioned"),description:t(a)("members.relationships.popularMember"),unit:t(a)("members.relationships.times")},null,8,["members","title","description","unit"])):U("",!0)]),s("div",xn,[o.value.oneWay.length>0?(r(),N(t(K),{key:0,class:"hidden",title:t(a)("members.relationships.oneWay.title"),description:t(a)("members.relationships.oneWay.description",{count:o.value.oneWay.length})},{default:V(()=>[s("div",bn,[(r(!0),I(q,null,te(o.value.oneWay.slice(0,10),(b,k)=>(r(),I("div",{key:k,class:"flex items-center gap-4 px-5 py-3 transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50"},[s("span",{class:Z(["flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",k===0?"bg-pink-100 text-pink-600 dark:bg-pink-900/30 dark:text-pink-400":"bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-500"])},x(k+1),3),s("div",_n,[s("button",{class:"font-medium text-gray-900 hover:text-pink-600 dark:text-white dark:hover:text-pink-600",onClick:C=>y(b.fromMemberId)},x(b.fromName),9,kn),s("div",wn,[n[2]||(n[2]=s("span",{class:"text-lg"},"→",-1)),s("span",$n,x(b.fromToCount)+"次",1)]),s("button",{class:"font-medium text-gray-900 hover:text-pink-600 dark:text-white dark:hover:text-pink-600",onClick:C=>y(b.toMemberId)},x(b.toName),9,In)]),s("div",Cn,[b.toFromCount===0?(r(),I("span",Sn,x(t(a)("members.relationships.oneWay.neverRespond")),1)):(r(),I("span",Mn,x(t(a)("members.relationships.oneWay.reverse",{count:b.toFromCount})),1))]),$(i,{color:"pink",variant:"soft",size:"xs"},{default:V(()=>[Q(x(t(a)("members.relationships.oneWay.ratio",{value:Math.round(b.ratio*100)})),1)]),_:2},1024)]))),128))])]),_:1},8,["title","description"])):U("",!0),o.value.twoWay.length>0?(r(),N(t(K),{key:1,title:t(a)("members.relationships.twoWay.title"),description:t(a)("members.relationships.twoWay.description",{count:o.value.twoWay.length})},{default:V(()=>[s("div",Tn,[(r(!0),I(q,null,te(o.value.twoWay.slice(0,10),(b,k)=>(r(),I("div",{key:k,class:"flex items-center gap-4 px-5 py-3 transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50"},[s("span",{class:Z(["flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",k===0?"bg-linear-to-r from-pink-400 to-red-400 text-white":k===1?"bg-linear-to-r from-pink-300 to-red-300 text-white":k===2?"bg-linear-to-r from-pink-200 to-red-200 text-pink-700":"bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-500"])},x(k+1),3),s("div",Dn,[s("button",{class:"font-medium text-gray-900 hover:text-pink-600 dark:text-white dark:hover:text-pink-600",onClick:C=>y(b.member1Id)},x(b.member1Name),9,Rn),s("div",Nn,[s("span",An,x(b.member1To2),1),n[3]||(n[3]=s("span",{class:"text-lg text-pink-500"},"⇄",-1)),s("span",Ln,x(b.member2To1),1)]),s("button",{class:"font-medium text-gray-900 hover:text-pink-600 dark:text-white dark:hover:text-pink-600",onClick:C=>y(b.member2Id)},x(b.member2Name),9,Vn)]),s("div",En,[s("span",On,x(b.total),1),s("span",zn,x(t(a)("members.relationships.twoWay.interactions")),1)]),$(i,{color:b.balance>=.7?"green":b.balance>=.5?"blue":"gray",variant:"soft",size:"xs"},{default:V(()=>[Q(x(t(a)("members.relationships.twoWay.balance",{value:Math.round(b.balance*100)})),1)]),_:2},1032,["color"])]))),128))])]),_:1},8,["title","description"])):U("",!0)])],64)):c.value?U("",!0):(r(),N(t(K),{key:2,title:t(a)("members.relationships.emptyTitle")},{default:V(()=>[$(t(le),{text:t(a)("members.relationships.empty")},null,8,["text"])]),_:1},8,["title"])),$(f,{open:d.value,"onUpdate:open":n[1]||(n[1]=b=>d.value=b)},{content:V(()=>[u.value?(r(),I("div",Fn,[s("h3",Bn,x(t(a)("members.relationships.modal.title",{name:u.value.name})),1),u.value.topMentioned.length>0?(r(),I("div",Un,[s("h4",Hn,x(t(a)("members.relationships.modal.topMentioned")),1),s("div",Wn,[(r(!0),I(q,null,te(u.value.topMentioned,(b,k)=>(r(),I("div",{key:k,class:"flex items-center gap-3 rounded-lg bg-gray-50 px-3 py-2 dark:bg-gray-800"},[s("span",jn,x(b.toName),1),s("span",Pn,x(t(a)("members.relationships.modal.timesCount",{count:b.count})),1)]))),128))])])):U("",!0),u.value.topMentioners.length>0?(r(),I("div",qn,[s("h4",Yn,x(t(a)("members.relationships.modal.topMentioners")),1),s("div",Gn,[(r(!0),I(q,null,te(u.value.topMentioners,(b,k)=>(r(),I("div",{key:k,class:"flex items-center gap-3 rounded-lg bg-gray-50 px-3 py-2 dark:bg-gray-800"},[s("span",Jn,x(b.fromName),1),s("span",Kn,x(t(a)("members.relationships.modal.timesCount",{count:b.count})),1)]))),128))])])):U("",!0),s("div",Qn,[$(h,{variant:"soft",onClick:n[0]||(n[0]=b=>d.value=!1)},{default:V(()=>[Q(x(t(a)("members.relationships.modal.close")),1)]),_:1})])])):U("",!0)]),_:1},8,["open"])])}}}),Zn={lookAhead:3,decaySeconds:120,topEdges:150},eo="AND COALESCE(m.account_name, '') != '系统消息'";function to(l){const a=[],e=[];return l?.startTs!=null&&(a.push("AND msg.ts >= ?"),e.push(l.startTs)),l?.endTs!=null&&(a.push("AND msg.ts <= ?"),e.push(l.endTs)),{conditions:a.join(" "),params:e}}async function so(l){return window.chatApi.pluginQuery(l,`SELECT
|
|
154
|
-
id,
|
|
155
|
-
platform_id as platformId,
|
|
156
|
-
COALESCE(group_nickname, account_name, platform_id) as name,
|
|
157
|
-
(SELECT COUNT(*) FROM message WHERE sender_id = member.id) as messageCount
|
|
158
|
-
FROM member
|
|
159
|
-
WHERE COALESCE(account_name, '') != '系统消息'`)}async function ao(l,a){const{conditions:e,params:o}=to(a);return window.chatApi.pluginQuery(l,`SELECT msg.sender_id as senderId, msg.ts as ts
|
|
160
|
-
FROM message msg
|
|
161
|
-
JOIN member m ON msg.sender_id = m.id
|
|
162
|
-
WHERE 1=1 ${eo} ${e}
|
|
163
|
-
ORDER BY msg.ts ASC, msg.id ASC`,o)}function no(l){const{members:a,messages:e,options:o}=l;function c(R,O){return R<O?`${R}-${O}`:`${O}-${R}`}function u(R){return Math.round(R*100)/100}const d={nodes:[],links:[],maxLinkValue:0,communities:[],stats:{totalMembers:0,totalMessages:0,involvedMembers:0,edgeCount:0,communityCount:0}};if(a.length<2)return{...d,stats:{...d.stats,totalMembers:a.length}};const g=new Map;for(const R of a)g.set(R.id,{name:R.name,platformId:R.platformId,messageCount:R.messageCount});if(e.length<2)return{...d,stats:{...d.stats,totalMembers:a.length,totalMessages:e.length}};const p=new Map;for(const R of e)p.set(R.senderId,(p.get(R.senderId)||0)+1);const _=e.length,y=new Map,m=new Map;for(let R=0;R<e.length-1;R++){const O=e[R],E=new Set;let j=0;for(let X=R+1;X<e.length&&j<o.lookAhead;X++){const ee=e[X];if(ee.senderId===O.senderId||E.has(ee.senderId))continue;E.add(ee.senderId),j++;const re=(ee.ts-O.ts)/1e3,oe=Math.exp(-re/o.decaySeconds),de=1-(j-1)*.2,z=oe*de,F=c(O.senderId,ee.senderId);y.set(F,(y.get(F)||0)+z),m.set(F,(m.get(F)||0)+1)}}const n=o.lookAhead*.8,i=[];for(const[R,O]of y){const[E,j]=R.split("-"),X=parseInt(E),ee=parseInt(j),re=p.get(X)||0,oe=p.get(ee)||0,de=re*oe/_*n,z=de>0?O/de:0;i.push({sourceId:X,targetId:ee,rawScore:O,expectedScore:de,normalizedScore:z,coOccurrenceCount:m.get(R)||0})}const h=Math.max(...i.map(R=>R.rawScore),1),f=Math.max(...i.map(R=>R.normalizedScore),1),b=i.map(R=>{const O=.5*(R.rawScore/h)+.5*(R.normalizedScore/f);return{...R,rawScore:u(R.rawScore),expectedScore:u(R.expectedScore),normalizedScore:u(R.normalizedScore),hybridScore:u(O)}});b.sort((R,O)=>O.hybridScore-R.hybridScore);const k=b.slice(0,o.topEdges);if(k.length===0)return{...d,stats:{...d.stats,totalMembers:a.length,totalMessages:e.length}};const C=new Set;for(const R of k)C.add(R.sourceId),C.add(R.targetId);const v=new Map;for(const R of k)v.set(R.sourceId,(v.get(R.sourceId)||0)+R.hybridScore),v.set(R.targetId,(v.get(R.targetId)||0)+R.hybridScore);const w=Math.max(...v.values(),1),S=new Map;for(const R of C){const O=g.get(R)?.name||String(R);S.set(O,(S.get(O)||0)+1)}const M=new Map;for(const R of C){const O=g.get(R),E=O?.name||String(R);(S.get(E)||0)>1?M.set(R,`${E}#${(O?.platformId||String(R)).slice(-4)}`):M.set(R,E)}const T=Math.max(...[...C].map(R=>g.get(R)?.messageCount||0),1),L=[...C].map(R=>{const O=g.get(R),E=v.get(R)||0,j=E/w,X=O.messageCount/T,ee=20+(.7*j+.3*X)*35;return{id:R,name:M.get(R),messageCount:O.messageCount,symbolSize:Math.round(ee),degree:u(E),normalizedDegree:u(j)}});L.sort((R,O)=>O.degree-R.degree);const W=k.length>0?Math.max(...k.map(R=>R.hybridScore)):0,H=k.map(R=>({source:M.get(R.sourceId),target:M.get(R.targetId),value:R.hybridScore,rawScore:R.rawScore,expectedScore:R.expectedScore,coOccurrenceCount:R.coOccurrenceCount}));return{nodes:L,links:H,maxLinkValue:u(W),communities:[],stats:{totalMembers:a.length,totalMessages:e.length,involvedMembers:C.size,edgeCount:k.length,communityCount:0}}}async function oo(l,a,e){const o={nodes:[],links:[],maxLinkValue:0,communities:[],stats:{totalMembers:0,totalMessages:0,involvedMembers:0,edgeCount:0,communityCount:0}};try{const[c,u]=await Promise.all([so(l),ao(l,a)]);if(c.length<2||u.length<2)return{...o,stats:{...o.stats,totalMembers:c.length,totalMessages:u.length}};const d={...Zn,...e};return await window.chatApi.pluginCompute(no.toString(),{members:c,messages:u,options:d})}catch(c){return console.error("[chart-cluster] Failed to load cluster graph:",c),o}}const io={class:"mx-auto max-w-[920px] p-4 h-full"},ro={class:"flex h-full flex-col rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm overflow-hidden"},lo={class:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50"},co={class:"flex items-center gap-3"},uo={class:"flex items-center gap-3"},mo={class:"p-3 w-64"},go={class:"text-sm font-medium mb-3"},po={class:"space-y-3"},ho={class:"text-xs text-gray-500 mb-1 block"},vo={class:"text-xs text-gray-400 mt-1"},fo={class:"text-xs text-gray-500 mb-1 block"},yo={class:"text-xs text-gray-400 mt-1"},xo={class:"flex-1 min-h-0 overflow-hidden"},bo={key:0,class:"h-full flex items-center justify-center"},_o={key:1,class:"h-full flex items-center justify-center"},ko={class:"text-center text-gray-400"},wo={key:2,class:"h-full"},$o={key:3,class:"h-full flex overflow-hidden"},Io={class:"w-64 border-r border-gray-200 dark:border-gray-700 flex flex-col overflow-hidden"},Co={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700"},So={class:"text-sm font-medium flex items-center gap-2"},Mo={class:"flex-1 overflow-y-auto"},To=["onClick"],Do={class:"flex items-center justify-between"},Ro={class:"text-sm truncate"},No={class:"text-xs text-gray-400"},Ao={class:"flex-1 overflow-hidden flex flex-col"},Lo={key:0,class:"flex-1 flex items-center justify-center"},Vo={class:"text-center text-gray-400"},Eo={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center gap-3"},Oo={class:"w-10 h-10 rounded-full flex items-center justify-center text-white font-bold bg-primary-500"},zo={class:"font-medium"},Fo={class:"text-xs text-gray-400"},Bo={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700"},Uo={class:"text-sm font-medium flex items-center gap-2"},Ho={class:"flex-1 overflow-y-auto"},Wo={key:0,class:"p-4 text-center text-gray-400"},jo={class:"flex items-center gap-3"},Po={class:"flex-1 min-w-0"},qo={class:"text-sm font-medium truncate"},Yo={class:"flex items-center gap-3 mt-0.5 text-xs text-gray-400"},Go={class:"w-20 h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden"},Jo={key:4,class:"h-full flex flex-col overflow-hidden"},Ko={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700"},Qo={class:"text-sm font-medium flex items-center gap-2"},Xo={class:"flex-1 overflow-y-auto"},Zo={class:"flex items-center gap-3"},ei={class:"flex-1 min-w-0"},ti={class:"flex items-center gap-2 text-sm"},si={class:"font-medium truncate"},ai={class:"font-medium truncate"},ni={class:"flex items-center gap-3 mt-1 text-xs text-gray-400"},oi={class:"w-24 h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden"},ii={key:0,class:"px-4 py-2 border-t border-gray-200 dark:border-gray-700 text-xs text-gray-400 flex items-center gap-4 bg-gray-50 dark:bg-gray-800/50"},ri=P({__name:"ClusterView",props:{sessionId:{},timeFilter:{}},setup(l){Je([Pt,Ke,qt,Yt,Qe]);const a=l,{t:e}=se(),o=gt(),c=D(()=>o.value==="dark"),u=A(!0),d=A(null),g=A("matrix"),p=A(null),_=A({lookAhead:3,decaySeconds:120,topEdges:150}),y=A(null);let m=null;async function n(){if(a.sessionId){u.value=!0;try{d.value=await oo(a.sessionId,a.timeFilter,{lookAhead:_.value.lookAhead,decaySeconds:_.value.decaySeconds,topEdges:_.value.topEdges})}catch(M){console.error("[chart-cluster] 加载小团体关系数据失败:",M),d.value=null}finally{u.value=!1}}}const i=D(()=>{if(!d.value||d.value.nodes.length===0)return null;const{nodes:M,links:T,maxLinkValue:L}=d.value,H=[...M].sort((E,j)=>j.messageCount-E.messageCount).slice(0,20).map(E=>E.name),R=new Map;for(const E of T)R.set(`${E.source}-${E.target}`,E.value),R.set(`${E.target}-${E.source}`,E.value);const O=[];for(let E=0;E<H.length;E++)for(let j=0;j<H.length;j++)if(E===j)O.push([E,j,-1]);else{const X=R.get(`${H[E]}-${H[j]}`)||0;O.push([E,j,X])}return{names:H,data:O,maxValue:L}});function h(){if(!i.value)return{graphic:{type:"text",style:{text:e("views.cluster.noData"),fill:"#999"}}};const{names:M,data:T,maxValue:L}=i.value;return{tooltip:{position:"top",formatter:W=>{const[H,R,O]=W.data;return O<0?`${M[H]}`:O===0?`${M[H]} ↔ ${M[R]}<br/>暂无关系数据`:`${M[H]} ↔ ${M[R]}<br/>临近度: ${O.toFixed(2)}`}},grid:{left:120,right:40,top:40,bottom:120},xAxis:{type:"category",data:M,splitArea:{show:!0},axisLabel:{rotate:45,fontSize:10,color:c.value?"#ccc":"#333"}},yAxis:{type:"category",data:M,splitArea:{show:!0},axisLabel:{fontSize:10,color:c.value?"#ccc":"#333"}},visualMap:{min:0,max:L||1,calculable:!0,orient:"horizontal",left:"center",bottom:10,inRange:{color:c.value?["#1a1a2e","#16213e","#0f3460","#e94560"]:["#f7f7f7","#fce4ec","#f8bbd9","#ee4567"]},textStyle:{color:c.value?"#ccc":"#333"}},series:[{type:"heatmap",data:T.filter(W=>W[2]>=0),label:{show:!1},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}],backgroundColor:"transparent"}}const f=D(()=>d.value?[...d.value.nodes].sort((M,T)=>T.messageCount-M.messageCount):[]),b=D(()=>!d.value||p.value===null?null:d.value.nodes.find(M=>M.id===p.value)||null),k=D(()=>{if(!d.value||!b.value)return[];const M=b.value.name,T=[];for(const L of d.value.links)L.source===M?T.push({otherName:L.target,value:L.value,coOccurrenceCount:L.coOccurrenceCount}):L.target===M&&T.push({otherName:L.source,value:L.value,coOccurrenceCount:L.coOccurrenceCount});return T.sort((L,W)=>W.value-L.value),T}),C=D(()=>d.value?d.value.links.slice(0,50):[]);function v(){m&&g.value==="matrix"&&m.setOption(h(),{notMerge:!0})}function w(){y.value&&(m=Xe(y.value,c.value?"dark":void 0),v())}function S(){m?.resize()}return G(g,async(M,T)=>{T==="matrix"&&m&&(m.dispose(),m=null),M==="matrix"&&(await Se(),w())}),G([d,()=>c.value],()=>{g.value==="matrix"&&v()},{deep:!0}),G(u,async(M,T)=>{T&&!M&&g.value==="matrix"&&(m&&(m.dispose(),m=null),await Se(),w())}),G(()=>[a.sessionId,a.timeFilter],()=>n(),{immediate:!0,deep:!0}),ke(()=>{window.addEventListener("resize",S),g.value==="matrix"&&Se(()=>w())}),Re(()=>{window.removeEventListener("resize",S),m?.dispose(),m=null}),(M,T)=>{const L=ge,W=qe("UButtonGroup"),H=Be,R=nt,O=we;return r(),I("div",io,[s("div",ro,[s("div",lo,[s("div",co,[$(W,{size:"xs"},{default:V(()=>[$(L,{color:g.value==="matrix"?"primary":"neutral",variant:g.value==="matrix"?"solid":"ghost",onClick:T[0]||(T[0]=E=>g.value="matrix")},{default:V(()=>[Q(x(t(e)("views.cluster.matrixView")),1)]),_:1},8,["color","variant"]),$(L,{color:g.value==="member"?"primary":"neutral",variant:g.value==="member"?"solid":"ghost",onClick:T[1]||(T[1]=E=>g.value="member")},{default:V(()=>[Q(x(t(e)("views.cluster.memberView")),1)]),_:1},8,["color","variant"]),$(L,{color:g.value==="circle"?"primary":"neutral",variant:g.value==="circle"?"solid":"ghost",onClick:T[2]||(T[2]=E=>g.value="circle")},{default:V(()=>[Q(x(t(e)("views.cluster.rankingView")),1)]),_:1},8,["color","variant"])]),_:1})]),s("div",uo,[$(R,null,{content:V(()=>[s("div",mo,[s("h4",go,x(t(e)("views.cluster.modelSettings")),1),s("div",po,[s("div",null,[s("label",ho,x(t(e)("views.cluster.lookAhead")),1),$(H,{modelValue:_.value.lookAhead,"onUpdate:modelValue":T[3]||(T[3]=E=>_.value.lookAhead=E),modelModifiers:{number:!0},type:"number",min:1,max:10,size:"xs",placeholder:"1-10"},null,8,["modelValue"]),s("p",vo,x(t(e)("views.cluster.lookAheadDesc")),1)]),s("div",null,[s("label",fo,x(t(e)("views.cluster.decaySeconds")),1),$(H,{modelValue:_.value.decaySeconds,"onUpdate:modelValue":T[4]||(T[4]=E=>_.value.decaySeconds=E),modelModifiers:{number:!0},type:"number",min:30,max:3600,size:"xs",placeholder:"30-3600"},null,8,["modelValue"]),s("p",yo,x(t(e)("views.cluster.decaySecondsDesc")),1)]),$(L,{size:"xs",color:"primary",class:"w-full mt-2",onClick:n},{default:V(()=>[Q(x(t(e)("views.cluster.applySettings")),1)]),_:1})])])]),default:V(()=>[$(L,{variant:"ghost",size:"xs",icon:"i-heroicons-adjustments-horizontal"})]),_:1}),$(L,{variant:"ghost",size:"xs",icon:"i-heroicons-arrow-path",onClick:n})])]),s("div",xo,[u.value?(r(),I("div",bo,[$(O,{name:"i-heroicons-arrow-path",class:"w-6 h-6 animate-spin text-gray-400"})])):!d.value||d.value.nodes.length===0?(r(),I("div",_o,[s("div",ko,[$(O,{name:"i-heroicons-user-group",class:"w-12 h-12 mx-auto mb-2 opacity-50"}),s("p",null,x(t(e)("views.cluster.noData")),1)])])):g.value==="matrix"?(r(),I("div",wo,[s("div",{ref_key:"chartRef",ref:y,class:"w-full h-full"},null,512)])):g.value==="member"?(r(),I("div",$o,[s("div",Io,[s("div",Co,[s("h3",So,[$(O,{name:"i-heroicons-users",class:"w-4 h-4"}),Q(" "+x(t(e)("views.cluster.selectMember")),1)])]),s("div",Mo,[(r(!0),I(q,null,te(f.value,E=>(r(),I("div",{key:E.id,class:Z(["px-4 py-2 cursor-pointer border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",{"bg-primary-50 dark:bg-primary-900/30":p.value===E.id}]),onClick:j=>p.value=E.id},[s("div",Do,[s("span",Ro,x(E.name),1),s("span",No,x(E.messageCount),1)])],10,To))),128))])]),s("div",Ao,[b.value?(r(),I(q,{key:1},[s("div",Eo,[s("div",Oo,x(b.value.name.charAt(0)),1),s("div",null,[s("div",zo,x(b.value.name),1),s("div",Fo,x(t(e)("views.cluster.msgCount"))+": "+x(b.value.messageCount)+" | "+x(t(e)("views.cluster.relationCount"))+": "+x(k.value.length),1)])]),s("div",Bo,[s("h3",Uo,[$(O,{name:"i-heroicons-heart",class:"w-4 h-4 text-pink-500"}),Q(" "+x(t(e)("views.cluster.relationsByIntimacy")),1)])]),s("div",Ho,[k.value.length===0?(r(),I("div",Wo,x(t(e)("views.cluster.noRelations")),1)):U("",!0),(r(!0),I(q,null,te(k.value,(E,j)=>(r(),I("div",{key:E.otherName,class:"px-4 py-3 border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50"},[s("div",jo,[s("span",{class:Z(["w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold",j<3?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400"])},x(j+1),3),s("div",Po,[s("div",qo,x(E.otherName),1),s("div",Yo,[s("span",null,x(t(e)("views.cluster.intimacy"))+": "+x((E.value*100).toFixed(0))+"%",1),s("span",null,x(t(e)("views.cluster.coOccurrence"))+": "+x(E.coOccurrenceCount)+x(t(e)("views.cluster.times")),1)])]),s("div",Go,[s("div",{class:"h-full bg-linear-to-r from-pink-400 to-pink-600",style:be({width:`${k.value[0]?.value?E.value/k.value[0].value*100:0}%`})},null,4)])])]))),128))])],64)):(r(),I("div",Lo,[s("div",Vo,[$(O,{name:"i-heroicons-cursor-arrow-rays",class:"w-12 h-12 mx-auto mb-2 opacity-50"}),s("p",null,x(t(e)("views.cluster.selectMemberHint")),1)])]))])])):(r(),I("div",Jo,[s("div",Ko,[s("h3",Qo,[$(O,{name:"i-heroicons-trophy",class:"w-4 h-4 text-yellow-500"}),Q(" "+x(t(e)("views.cluster.interactionRanking")),1)])]),s("div",Xo,[(r(!0),I(q,null,te(C.value,(E,j)=>(r(),I("div",{key:j,class:"px-4 py-3 border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50"},[s("div",Zo,[s("span",{class:Z(["w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold",j<3?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400"])},x(j+1),3),s("div",ei,[s("div",ti,[s("span",si,x(E.source),1),T[5]||(T[5]=s("span",{class:"text-gray-400"},"↔",-1)),s("span",ai,x(E.target),1)]),s("div",ni,[s("span",null,x(t(e)("views.cluster.score"))+": "+x(E.value.toFixed(2)),1),s("span",null,x(t(e)("views.cluster.coOccurrence"))+": "+x(E.coOccurrenceCount)+x(t(e)("views.cluster.times")),1)])]),s("div",oi,[s("div",{class:"h-full bg-linear-to-r from-yellow-400 to-orange-500",style:be({width:`${C.value[0]?.value?E.value/C.value[0].value*100:0}%`})},null,4)])])]))),128))])]))]),d.value?(r(),I("div",ii,[s("span",null,x(t(e)("views.cluster.totalMembers"))+": "+x(d.value.stats.totalMembers),1),s("span",null,x(t(e)("views.cluster.totalMessages"))+": "+x(d.value.stats.totalMessages.toLocaleString()),1),s("span",null,x(t(e)("views.cluster.involvedMembers"))+": "+x(d.value.stats.involvedMembers),1),s("span",null,x(t(e)("views.cluster.edgeCount"))+": "+x(d.value.stats.edgeCount),1)])):U("",!0)])])}}}),li={class:"flex h-full flex-col"},ci={class:"min-h-0 flex-1 overflow-y-auto"},di=P({__name:"GroupRelationships",props:{sessionId:{},timeFilter:{}},setup(l){const{t:a}=se(),e=l,o=A("mention-graph"),c=D(()=>[{id:"mention-graph",label:a("analysis.subTabs.groupRelationships.mentionGraph"),icon:"i-heroicons-arrows-right-left"},{id:"mention-ranking",label:a("analysis.subTabs.groupRelationships.mentionRanking"),icon:"i-heroicons-heart"},{id:"proximity",label:a("analysis.subTabs.groupRelationships.proximity"),icon:"i-heroicons-user-group"}]);return(u,d)=>(r(),I("div",li,[$(t(Ye),{modelValue:o.value,"onUpdate:modelValue":d[0]||(d[0]=g=>o.value=g),items:c.value,"persist-key":"groupRelationshipsTab",size:"sm"},null,8,["modelValue","items"]),s("div",ci,[$(Ne,{name:"fade",mode:"out-in"},{default:V(()=>[o.value==="mention-graph"?(r(),N(vn,{key:0,"session-id":e.sessionId,"time-filter":e.timeFilter},null,8,["session-id","time-filter"])):o.value==="mention-ranking"?(r(),N(Xn,{key:1,"session-id":e.sessionId,"time-filter":e.timeFilter},null,8,["session-id","time-filter"])):o.value==="proximity"?(r(),N(ri,{key:2,"session-id":e.sessionId,"time-filter":e.timeFilter},null,8,["session-id","time-filter"])):U("",!0)]),_:1})])]))}}),ui=Le(di,[["__scopeId","data-v-90e47115"]]),mi={class:"flex h-full flex-col"},gi={class:"flex-1 min-h-0 overflow-y-auto"},pi=P({__name:"ViewTab",props:{sessionId:{},sessionName:{},timeFilter:{}},setup(l){const{t:a,locale:e}=se(),o=l,c=D(()=>{const p=[{id:"message",label:a("analysis.subTabs.view.message"),icon:"i-heroicons-chat-bubble-left-right"},{id:"topic",label:a("analysis.subTabs.view.topic"),icon:"i-heroicons-cloud"},{id:"group-relationships",label:a("analysis.subTabs.view.groupRelationships"),icon:"i-heroicons-heart"},{id:"hot-repeat",label:a("analysis.subTabs.quotes.hotRepeat"),icon:"i-heroicons-fire"},{id:"catchphrase",label:a("analysis.subTabs.quotes.catchphrase"),icon:"i-heroicons-chat-bubble-bottom-center-text"}];return pt("groupRanking",e.value)&&p.splice(1,0,{id:"ranking",label:a("analysis.subTabs.view.ranking"),icon:"i-heroicons-trophy"}),p}),u=A("message"),d=A(null),g=D(()=>({...o.timeFilter,memberId:d.value}));return(p,_)=>(r(),I("div",mi,[$(t(Ye),{modelValue:u.value,"onUpdate:modelValue":_[1]||(_[1]=y=>u.value=y),items:c.value,"persist-key":"groupViewTab"},{right:V(()=>[u.value!=="topic"?(r(),N(Ct,{key:0,modelValue:d.value,"onUpdate:modelValue":_[0]||(_[0]=y=>d.value=y),"session-id":o.sessionId},null,8,["modelValue","session-id"])):U("",!0)]),_:1},8,["modelValue","items"]),s("div",gi,[$(Ne,{name:"fade",mode:"out-in"},{default:V(()=>[u.value==="message"?(r(),N(St,{key:0,"session-id":o.sessionId,"session-name":o.sessionName,"time-filter":g.value},null,8,["session-id","session-name","time-filter"])):u.value==="topic"?(r(),N(t(Mt),{key:1,"session-id":o.sessionId,"time-filter":o.timeFilter},null,8,["session-id","time-filter"])):u.value==="group-relationships"?(r(),N(ui,{key:2,"session-id":o.sessionId,"time-filter":g.value},null,8,["session-id","time-filter"])):u.value==="ranking"?(r(),N(Ga,{key:3,"session-id":o.sessionId,"time-filter":g.value},null,8,["session-id","time-filter"])):u.value==="hot-repeat"?(r(),N(t(Js),{key:4,"session-id":o.sessionId,"time-filter":o.timeFilter},null,8,["session-id","time-filter"])):u.value==="catchphrase"?(r(),N(t(As),{key:5,"session-id":o.sessionId,"time-filter":o.timeFilter},null,8,["session-id","time-filter"])):U("",!0)]),_:1})])]))}}),hi=Le(pi,[["__scopeId","data-v-6549d466"]]),vi={key:0,class:"mb-6"},fi={class:"flex items-center gap-3"},yi={class:"text-xl font-bold text-gray-900 dark:text-white"},xi={class:"text-sm text-gray-500 dark:text-gray-400"},bi={class:"mb-4 flex flex-wrap items-center justify-between gap-3"},_i={class:"flex items-center gap-2"},ki={class:"text-xs text-gray-500 dark:text-gray-400"},wi={key:0,class:"flex h-60 items-center justify-center"},$i={key:1,class:"flex h-60 flex-col items-center justify-center"},Ii={class:"text-gray-500 dark:text-gray-400"},Ci={key:2,class:"flex min-h-0 flex-1 flex-col"},Si={class:"w-full"},Mi={class:"sticky top-0 bg-gray-50 dark:bg-gray-800"},Ti={class:"text-left text-xs font-medium uppercase text-gray-500 dark:text-gray-400"},Di={class:"px-4 py-4"},Ri={class:"px-4 py-4"},Ni={class:"px-4 py-4"},Ai={class:"w-64 px-4 py-4"},Li={class:"inline-flex items-center gap-1.5"},Vi={class:"px-4 py-4 text-right"},Ei={class:"divide-y divide-gray-200 dark:divide-gray-700"},Oi={class:"px-4 py-4"},zi={class:"px-4 py-4"},Fi={class:"flex items-center gap-2"},Bi=["src","alt"],Ui={key:1,class:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-pink-400 to-pink-600 text-xs font-medium text-white"},Hi={class:"text-sm font-medium text-gray-900 dark:text-white"},Wi={class:"ml-1 text-sm text-gray-500 dark:text-gray-400"},ji={class:"px-4 py-4"},Pi={key:0,class:"text-sm font-medium text-gray-900 dark:text-white"},qi={key:1,class:"text-sm text-gray-400 dark:text-gray-500"},Yi={class:"px-4 py-4"},Gi={class:"text-sm font-semibold text-gray-900 dark:text-white"},Ji={class:"px-4 py-4"},Ki={class:"max-w-xs"},Qi={key:0,class:"absolute right-2 top-1/2 -translate-y-1/2"},Xi={class:"px-4 py-4 text-right"},Zi={key:0,class:"flex items-center justify-between border-t border-gray-200 px-6 py-4 dark:border-gray-700"},er={class:"text-sm text-gray-500 dark:text-gray-400"},tr={class:"flex items-center gap-2"},sr={class:"text-sm font-medium text-gray-600 dark:text-gray-300"},ar={class:"p-6 text-center"},nr={class:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30"},or={class:"mb-2 text-lg font-semibold text-gray-900 dark:text-white"},ir={class:"mb-6 text-sm text-gray-500 dark:text-gray-400"},rr={class:"flex justify-center gap-3"},lr={class:"p-6"},cr={class:"mb-4 flex items-center gap-3"},dr={class:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-900/30"},ur={class:"text-lg font-semibold text-gray-900 dark:text-white"},mr={class:"mb-2 text-sm text-gray-600 dark:text-gray-400"},gr={class:"mb-6 text-xs text-amber-700 dark:text-amber-300"},pr={class:"flex justify-end gap-2"},Me=20,hr=P({__name:"MemberList",props:{sessionId:{},showHeader:{type:Boolean,default:!0}},emits:["data-changed"],setup(l,{emit:a}){const{t:e}=se(),o=l,c=a,u=A([]),d=A([]),g=A(!1),p=A(""),_=A(null),y=A(!1),m=A(new Set),n=A(!1),i=A(!1),h=A(1),f=A(0),b=A(0),k=A("desc"),C=A(null);let v=null;function w(z){return z.groupNickname||z.accountName||z.platformId}function S(z){return w(z).slice(0,1)}const M=D(()=>d.value.filter(z=>m.value.has(z.id))),T=D(()=>M.value.length===2),L=D(()=>{if(M.value.length!==2)return null;const[z,F]=M.value;return F.messageCount>z.messageCount||F.messageCount===z.messageCount&&F.id<z.id?{primary:F,secondary:z}:{primary:z,secondary:F}});function W(){k.value=k.value==="desc"?"asc":"desc",h.value=1,H()}async function H(){if(o.sessionId){g.value=!0;try{const z=await ue().getMembersPaginated(o.sessionId,{page:h.value,pageSize:Me,search:p.value.trim(),sortOrder:k.value});u.value=z.items,f.value=z.total,b.value=z.totalPages}catch(z){console.error("加载成员列表失败:",z)}finally{g.value=!1}}}async function R(){if(o.sessionId)try{d.value=await ue().getMembers(o.sessionId)}catch(z){console.error("加载所有成员失败:",z)}}async function O(z,F){const B=JSON.parse(JSON.stringify(F)),he=JSON.stringify(z.aliases),ie=JSON.stringify(B);if(he!==ie){C.value=z.id;try{if(await ue().updateMemberAliases(o.sessionId,z.id,B)){const pe=u.value.findIndex(Y=>Y.id===z.id);pe!==-1&&(u.value[pe]={...u.value[pe],aliases:B})}}catch(ve){console.error("保存别名失败:",ve)}finally{C.value=null}}}function E(z){_.value=z}function j(){_.value=null}async function X(){if(_.value){y.value=!0;try{await ue().deleteMember(o.sessionId,_.value.id)&&(await H(),await R(),c("data-changed"))}catch(z){console.error("删除成员失败:",z)}finally{y.value=!1,_.value=null}}}function ee(z){const F=new Set(m.value);F.has(z)?F.delete(z):F.add(z),m.value=F}function re(){T.value&&(n.value=!0)}function oe(){m.value=new Set}async function de(){if(L.value){i.value=!0;try{await ue().mergeMembers(o.sessionId,L.value.primary.id,L.value.secondary.id)&&(n.value=!1,oe(),await H(),await R(),c("data-changed"))}catch(z){console.error("合并成员失败:",z)}finally{i.value=!1}}}return G(p,()=>{h.value=1,v&&clearTimeout(v),v=setTimeout(()=>{H()},300)}),G(h,()=>{H()}),G(()=>o.sessionId,()=>{p.value="",h.value=1,oe(),H(),R()},{immediate:!0}),ke(()=>{H(),R()}),(z,F)=>{const B=ge,he=Be,ie=we,ve=Ue,pe=ot,Y=it,Ie=_e;return r(),I("div",{class:Z(["main-content",o.showHeader?"max-w-5xl p-6":"flex h-full max-w-none flex-col overflow-hidden p-4"])},[o.showHeader?(r(),I("div",vi,[s("div",fi,[s("div",null,[s("h2",yi,x(t(e)("members.list.title")),1),s("p",xi,x(t(e)("members.list.description",{count:f.value})),1)])])])):U("",!0),$(Tt,{class:"mb-6","session-id":l.sessionId,members:d.value,"is-loading":g.value,"chat-type":"group"},null,8,["session-id","members","is-loading"]),s("div",bi,[$(he,{modelValue:p.value,"onUpdate:modelValue":F[1]||(F[1]=J=>p.value=J),placeholder:t(e)("members.list.searchPlaceholder"),icon:"i-heroicons-magnifying-glass",class:"w-full md:w-100"},Pe({_:2},[p.value?{name:"trailing",fn:V(()=>[$(B,{icon:"i-heroicons-x-mark",variant:"link",color:"neutral",size:"xs",onClick:F[0]||(F[0]=J=>p.value="")})]),key:"0"}:void 0]),1032,["modelValue","placeholder"]),s("div",_i,[s("span",ki,x(t(e)("members.list.mergeSelectedCount",{count:m.value.size})),1),$(B,{icon:"i-heroicons-link",size:"sm",color:"primary",disabled:!T.value,onClick:re},{default:V(()=>[Q(x(t(e)("members.list.mergeSelected")),1)]),_:1},8,["disabled"])])]),s("div",{class:Z(["rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900",o.showHeader?"":"flex min-h-0 flex-1 flex-col"])},[g.value?(r(),I("div",wi,[$(ie,{name:"i-heroicons-arrow-path",class:"h-8 w-8 animate-spin text-pink-500"})])):u.value.length===0?(r(),I("div",$i,[$(ie,{name:"i-heroicons-user-group",class:"mb-3 h-12 w-12 text-gray-300 dark:text-gray-600"}),s("p",Ii,x(p.value?t(e)("members.list.noMatch"):t(e)("members.list.empty")),1)])):(r(),I("div",Ci,[s("div",{class:Z(["max-h-[500px] overflow-y-auto",o.showHeader?"":"max-h-none min-h-0 flex-1"])},[s("table",Si,[s("thead",Mi,[s("tr",Ti,[F[7]||(F[7]=s("th",{class:"w-12 px-4 py-4"},null,-1)),s("th",Di,x(t(e)("members.list.table.accountName")),1),s("th",Ri,x(t(e)("members.list.table.groupNickname")),1),s("th",Ni,[s("button",{class:"flex items-center gap-1.5 hover:text-gray-700 dark:hover:text-gray-200",onClick:W},[Q(x(t(e)("members.list.table.messageCount"))+" ",1),$(ie,{name:k.value==="desc"?"i-heroicons-arrow-down":"i-heroicons-arrow-up",class:"h-3.5 w-3.5"},null,8,["name"])])]),s("th",Ai,[s("div",Li,[s("span",null,x(t(e)("members.list.table.customAlias")),1),$(ve,{text:t(e)("members.list.tip"),popper:{placement:"top"}},{default:V(()=>[$(ie,{name:"i-heroicons-question-mark-circle",class:"h-4 w-4 text-gray-400 dark:text-gray-500"})]),_:1},8,["text"])])]),s("th",Vi,x(t(e)("members.list.table.actions")),1)])]),s("tbody",Ei,[(r(!0),I(q,null,te(u.value,J=>(r(),I("tr",{key:J.id,class:"hover:bg-gray-50 dark:hover:bg-gray-800/50"},[s("td",Oi,[$(pe,{"model-value":m.value.has(J.id),onClick:je(Ce=>ee(J.id),["stop"])},null,8,["model-value","onClick"])]),s("td",zi,[s("div",Fi,[J.avatar?(r(),I("img",{key:0,src:J.avatar,alt:w(J),class:"h-8 w-8 shrink-0 rounded-full object-cover"},null,8,Bi)):(r(),I("div",Ui,x(S(J)),1)),s("div",null,[s("span",Hi,x(J.accountName||"-"),1),s("span",Wi,"("+x(J.platformId)+")",1)])])]),s("td",ji,[J.groupNickname?(r(),I("span",Pi,x(J.groupNickname),1)):(r(),I("span",qi,"-"))]),s("td",Yi,[s("span",Gi,x(J.messageCount.toLocaleString()),1)]),s("td",Ji,[s("div",Ki,[$(Y,{"model-value":J.aliases,placeholder:t(e)("members.list.aliasPlaceholder"),class:"w-80","onUpdate:modelValue":Ce=>O(J,Ce)},null,8,["model-value","placeholder","onUpdate:modelValue"]),C.value===J.id?(r(),I("div",Qi,[$(ie,{name:"i-heroicons-arrow-path",class:"h-4 w-4 animate-spin text-pink-500"})])):U("",!0)])]),s("td",Xi,[$(B,{label:t(e)("members.list.delete"),size:"xs",onClick:Ce=>E(J)},null,8,["label","onClick"])])]))),128))])])],2),b.value>1?(r(),I("div",Zi,[s("p",er,x(t(e)("members.list.pagination",{start:(h.value-1)*Me+1,end:Math.min(h.value*Me,f.value),total:f.value})),1),s("div",tr,[$(B,{icon:"i-heroicons-chevron-left",variant:"outline",size:"sm",disabled:h.value===1||g.value,onClick:F[2]||(F[2]=J=>h.value--)},null,8,["disabled"]),s("span",sr,x(h.value)+" / "+x(b.value),1),$(B,{icon:"i-heroicons-chevron-right",variant:"outline",size:"sm",disabled:h.value>=b.value||g.value,onClick:F[3]||(F[3]=J=>h.value++)},null,8,["disabled"])])])):U("",!0)]))],2),$(Ie,{open:!!_.value,ui:{content:"max-w-sm"},"onUpdate:open":F[4]||(F[4]=J=>_.value=null)},{content:V(()=>[s("div",ar,[s("div",nr,[$(ie,{name:"i-heroicons-exclamation-triangle",class:"h-7 w-7 text-red-500"})]),s("h3",or,x(t(e)("members.list.modal.title")),1),s("p",ir,x(t(e)("members.list.modal.content",{name:_.value?w(_.value):"",count:_.value?.messageCount.toLocaleString()})),1),s("div",rr,[$(B,{variant:"outline",onClick:j},{default:V(()=>[Q(x(t(e)("members.list.modal.cancel")),1)]),_:1}),$(B,{color:"error",loading:y.value,onClick:X},{default:V(()=>[Q(x(t(e)("members.list.modal.confirm")),1)]),_:1},8,["loading"])])])]),_:1},8,["open"]),$(Ie,{open:n.value,ui:{content:"max-w-md"},"onUpdate:open":F[6]||(F[6]=J=>n.value=J)},{content:V(()=>[s("div",lr,[s("div",cr,[s("div",dr,[$(ie,{name:"i-heroicons-link",class:"h-5 w-5 text-amber-600 dark:text-amber-400"})]),s("h3",ur,x(t(e)("members.list.mergeModal.title")),1)]),s("p",mr,x(t(e)("members.list.mergeModal.content",{source:L.value?w(L.value.secondary):"",sourceCount:L.value?L.value.secondary.messageCount.toLocaleString():"0",target:L.value?w(L.value.primary):"",targetCount:L.value?L.value.primary.messageCount.toLocaleString():"0"})),1),s("p",gr,x(t(e)("members.list.mergeModal.hint")),1),s("div",pr,[$(B,{variant:"outline",disabled:i.value,onClick:F[5]||(F[5]=J=>n.value=!1)},{default:V(()=>[Q(x(t(e)("members.list.mergeModal.cancel")),1)]),_:1},8,["disabled"]),$(B,{color:"primary",loading:i.value,onClick:de},{default:V(()=>[Q(x(t(e)("members.list.mergeModal.confirm")),1)]),_:1},8,["loading"])])])]),_:1},8,["open"])],2)}}}),vr={class:"main-content max-w-5xl p-6"},fr={class:"mb-4 text-sm text-gray-500 dark:text-gray-400 no-capture"},yr={key:0,class:"divide-y divide-gray-100 dark:divide-gray-800"},xr={class:"w-32 shrink-0 pt-0.5 font-medium text-gray-900 dark:text-white"},br={class:"flex flex-1 flex-wrap items-center gap-2"},_r={class:"flex items-center gap-1.5 rounded-lg bg-gray-50 px-3 py-1.5 dark:bg-gray-800"},kr={class:"text-xs text-gray-400"},wr={key:0,class:"text-gray-300 dark:text-gray-600"},$r=P({__name:"NicknameHistory",props:{sessionId:{}},setup(l){const{t:a}=se(),e=l,o=A([]),c=A([]),u=A(!1);function d(_){return _.groupNickname||_.accountName||_.platformId}async function g(){if(e.sessionId)try{o.value=await ue().getMembers(e.sessionId)}catch(_){console.error("加载成员列表失败:",_)}}async function p(){if(!e.sessionId||o.value.length===0)return;u.value=!0;const _=[];try{const y=o.value.map(n=>ue().getMemberNameHistory(e.sessionId,n.id)),m=await Promise.all(y);o.value.forEach((n,i)=>{const h=m[i];h.length>2&&_.push({memberId:n.id,name:d(n),history:h})}),c.value=_}catch(y){console.error("加载昵称变更记录失败:",y)}finally{u.value=!1}}return G(()=>e.sessionId,async()=>{await g()},{immediate:!0}),G(()=>o.value.length,()=>{o.value.length>0&&p()}),ke(async()=>{o.value.length===0&&await g()}),(_,y)=>{const m=Fe;return r(),I("div",vr,[s("p",fr,x(t(a)("members.nicknameHistory.note")),1),$(t(K),{title:t(a)("members.nicknameHistory.title"),description:u.value?t(a)("members.nicknameHistory.loading"):c.value.length>0?t(a)("members.nicknameHistory.hasChanges",{count:c.value.length}):t(a)("members.nicknameHistory.noChanges")},{default:V(()=>[!u.value&&c.value.length>0?(r(),I("div",yr,[(r(!0),I(q,null,te(c.value,n=>(r(),I("div",{key:n.memberId,class:"flex items-start gap-3 px-5 py-3"},[s("div",xr,x(n.name),1),s("div",br,[(r(!0),I(q,null,te(n.history,(i,h)=>(r(),I(q,{key:h},[s("div",_r,[s("span",{class:Z(["text-sm",i.endTs===null?"font-semibold text-pink-600":"text-gray-700 dark:text-gray-300"])},x(i.name),3),i.endTs===null?(r(),N(m,{key:0,color:"primary",variant:"soft",size:"xs"},{default:V(()=>[Q(x(t(a)("members.nicknameHistory.current")),1)]),_:1})):U("",!0),s("span",kr,"("+x(t(Dt)(i.startTs,i.endTs))+")",1)]),h<n.history.length-1?(r(),I("span",wr,"→")):U("",!0)],64))),128))])]))),128))])):u.value?(r(),N(t(ne),{key:2,text:t(a)("members.nicknameHistory.loadingText")},null,8,["text"])):(r(),N(t(le),{key:1,text:t(a)("members.nicknameHistory.empty")},null,8,["text"]))]),_:1},8,["title","description"])])}}}),Ir={class:"flex h-full flex-col overflow-hidden bg-white dark:bg-gray-900"},Cr={class:"flex flex-none items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-700"},Sr={class:"text-lg font-semibold text-gray-900 dark:text-white"},Mr={class:"flex-1 overflow-auto"},Tr=P({__name:"NicknameHistoryEntry",props:{sessionId:{}},setup(l){const{t:a}=se(),e=l,o=A(!1);return(c,u)=>{const d=ge,g=_e;return r(),I(q,null,[$(d,{variant:"ghost",icon:"i-heroicons-clock",size:"sm",onClick:u[0]||(u[0]=p=>o.value=!0)},{default:V(()=>[Q(x(t(a)("analysis.subTabs.member.nicknameHistory")),1)]),_:1}),e.sessionId?(r(),N(g,{key:0,open:o.value,"onUpdate:open":u[2]||(u[2]=p=>o.value=p),ui:{content:"max-w-6xl h-[85vh]"}},{content:V(()=>[s("div",Ir,[s("div",Cr,[s("h2",Sr,x(t(a)("analysis.subTabs.member.nicknameHistory")),1),$(d,{variant:"ghost",icon:"i-heroicons-x-mark",size:"sm",onClick:u[1]||(u[1]=p=>o.value=!1)})]),s("div",Mr,[$($r,{"session-id":e.sessionId},null,8,["session-id"])])])]),_:1},8,["open"])):U("",!0)],64)}}}),Dr={class:"flex h-full flex-col bg-white dark:bg-gray-900",style:{"padding-top":"var(--titlebar-area-height)"}},Rr={class:"mt-2 flex items-center justify-between gap-3"},Nr={class:"flex shrink-0 items-center gap-0.5 overflow-x-auto scrollbar-hide"},Ar=["onClick"],Lr={class:"whitespace-nowrap"},Vr={class:"relative flex-1 overflow-y-auto"},Er={class:"h-full"},Or={key:2,class:"flex h-full items-center justify-center"},zr={class:"text-gray-500"},Fr={class:"flex h-full flex-col overflow-hidden bg-white dark:bg-gray-900"},Br={class:"flex flex-none items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-700"},Ur={class:"text-lg font-semibold text-gray-900 dark:text-white"},Hr={class:"text-sm text-gray-500 dark:text-gray-400"},Wr={class:"flex items-center gap-2"},jr={class:"flex-1 overflow-hidden"},Pr=P({__name:"index",setup(l){const a=We(()=>ze(()=>import("./MessageExportModal-D1GY6WSV.js"),__vite__mapDeps([5,6,4,7,8,9,10,11,1,2,3,12]))),{t:e}=se(),o=rt(),c=lt(),u=ht(),d=Ae(),g=vt(),{currentSessionId:p}=ft(u),_=A(!1),y=A(!1),m=A(!1),n=A(!1);function i(){d.openChatRecordDrawer({})}const h=[{id:"overview",labelKey:"analysis.tabs.overview",icon:"i-heroicons-chart-pie"},{id:"view",labelKey:"analysis.tabs.view",icon:"i-heroicons-presentation-chart-bar"},{id:"ai-chat",labelKey:"analysis.tabs.aiChat",icon:"i-heroicons-chat-bubble-left-ellipsis"},{id:"lab",labelKey:"analysis.tabs.lab",icon:"i-heroicons-beaker"}],f=D(()=>g.debugMode?[...h,{id:"debug",labelKey:"analysis.tabs.debug",icon:"i-heroicons-bug-ant"}]:h),b=D(()=>f.value.map(F=>F.id)),{activeTab:k,isLoading:C,isInitialLoad:v,session:w,memberActivity:S,hourlyActivity:M,dailyActivity:T,messageTypes:L,timeRangeValue:W,fullTimeRange:H,availableYears:R,timeFilter:O,selectedYearForOverview:E,initialTimeState:j,loadData:X}=Rt({route:o,router:c,currentSessionId:p,selectSession:u.selectSession,defaultTab:g.defaultSessionTab,validTabIds:b.value}),ee=D(()=>S.value.slice(0,3)),re=D(()=>S.value.length<=1?[]:[...S.value].sort((F,B)=>F.messageCount-B.messageCount).slice(0,1)),oe=D(()=>S.value.reduce((F,B)=>F+B.messageCount,0)),de=D(()=>S.value.filter(F=>F.messageCount>0).length),{headerDescription:z}=Nt({session:w,fullTimeRange:H,timeRangeValue:W,descriptionKey:"analysis.groupChat.description"});return(F,B)=>{const he=ge,ie=Ue,ve=we,pe=_e;return r(),I("div",Dr,[t(v)?(r(),N(ne,{key:0,variant:"page",text:t(e)("analysis.groupChat.loading")},null,8,["text"])):t(w)?(r(),I(q,{key:1},[$(At,{title:t(w).name,description:t(z),avatar:t(w).groupAvatar,icon:"i-heroicons-chat-bubble-left-right","icon-class":"bg-primary-600 text-white dark:bg-primary-500 dark:text-white"},{actions:V(()=>[t(d).toolsPanelPosition==="header"?(r(),N(ie,{key:0,text:t(e)("analysis.overview.tools")},{default:V(()=>[$(he,{icon:"i-heroicons-wrench-screwdriver",variant:"ghost",color:"primary",size:"sm",onClick:B[0]||(B[0]=Y=>t(d).toggleToolsPanelOpen())})]),_:1},8,["text"])):U("",!0),$(Te)]),default:V(()=>[s("div",Rr,[s("div",Nr,[(r(!0),I(q,null,te(f.value,Y=>(r(),I("button",{key:Y.id,class:Z(["flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-sm font-medium transition-all",[t(k)===Y.id?"bg-pink-500 text-white dark:bg-pink-900/30 dark:text-pink-300":"text-gray-600 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800"]]),onClick:Ie=>k.value=Y.id},[$(ve,{name:Y.icon,class:"h-4 w-4"},null,8,["name"]),s("span",Lr,x(t(e)(Y.labelKey)),1)],10,Ar))),128))]),$(Ot,{modelValue:t(W),"onUpdate:modelValue":B[1]||(B[1]=Y=>ut(W)?W.value=Y:null),"session-id":t(p)??void 0,visible:t(k)!=="ai-chat"&&t(k)!=="memory"&&t(k)!=="lab"&&t(k)!=="debug","initial-state":t(j),"onUpdate:fullRange":B[2]||(B[2]=Y=>H.value=Y),"onUpdate:availableYears":B[3]||(B[3]=Y=>R.value=Y)},null,8,["modelValue","session-id","visible","initial-state"])])]),_:1},8,["title","description","avatar"]),s("div",Vr,[t(C)?(r(),N(ne,{key:0,variant:"overlay"})):U("",!0),s("div",Er,[$(Ne,{name:"tab-slide",mode:"out-in"},{default:V(()=>[t(k)==="overview"?(r(),N(ea,{key:"overview-"+t(p),session:t(w),"member-activity":t(S),"top-members":ee.value,"bottom-members":re.value,"message-types":t(L),"hourly-activity":t(M),"daily-activity":t(T),"time-range":t(H),"selected-year":t(E),"filtered-message-count":oe.value,"filtered-member-count":de.value,"time-filter":t(O)},null,8,["session","member-activity","top-members","bottom-members","message-types","hourly-activity","daily-activity","time-range","selected-year","filtered-message-count","filtered-member-count","time-filter"])):t(k)==="view"?(r(),N(hi,{key:"view-"+t(p),"session-id":t(p),"session-name":t(w).name,"time-filter":t(O)},null,8,["session-id","session-name","time-filter"])):t(k)==="ai-chat"?(r(),N(t(zt),{key:"ai-chat-"+t(p),"session-id":t(p),"session-name":t(w).name,"chat-type":"group"},null,8,["session-id","session-name"])):t(k)==="memory"?(r(),N(Ft,{key:"memory-"+t(p),"session-id":t(p),"session-name":t(w).name},null,8,["session-id","session-name"])):t(k)==="lab"?(r(),N(Bt,{key:"lab-"+t(p),"session-id":t(p),"session-name":t(w).name,"time-filter":t(O),"chat-type":"group",mode:"sql-only"},null,8,["session-id","session-name","time-filter"])):t(k)==="debug"?(r(),N(t(Ut),{key:"debug-"+t(p),"session-id":t(p)},null,8,["session-id"])):U("",!0)]),_:1})])]),$(Lt,{onOpenIncrementalImport:B[4]||(B[4]=Y=>y.value=!0),onOpenSessionIndex:B[5]||(B[5]=Y=>_.value=!0),onOpenMemberManagement:B[6]||(B[6]=Y=>n.value=!0),onOpenChatRecord:i,onOpenMessageExport:B[7]||(B[7]=Y=>m.value=!0)}),t(g).debugMode?(r(),N(Ht,{key:0})):U("",!0)],64)):(r(),I("div",Or,[s("p",zr,x(t(e)("analysis.groupChat.loadError")),1)])),t(p)&&t(w)&&t(w).messageCount>0?(r(),N(Vt,{key:3,modelValue:_.value,"onUpdate:modelValue":B[8]||(B[8]=Y=>_.value=Y),"session-id":t(p),"message-count":t(w).messageCount},null,8,["modelValue","session-id","message-count"])):U("",!0),t(p)&&t(w)?(r(),N(Et,{key:4,modelValue:y.value,"onUpdate:modelValue":B[9]||(B[9]=Y=>y.value=Y),"session-id":t(p),"session-name":t(w).name,onImported:t(X)},null,8,["modelValue","session-id","session-name","onImported"])):U("",!0),t(p)?(r(),N(t(a),{key:5,modelValue:m.value,"onUpdate:modelValue":B[10]||(B[10]=Y=>m.value=Y)},null,8,["modelValue"])):U("",!0),t(p)?(r(),N(pe,{key:6,open:n.value,"onUpdate:open":B[12]||(B[12]=Y=>n.value=Y),ui:{content:"max-w-6xl h-[85vh]"}},{content:V(()=>[s("div",Fr,[s("div",Br,[s("div",null,[s("h2",Ur,x(t(e)("analysis.tooltip.memberManagement")),1),s("p",Hr,x(t(e)("members.list.description",{count:t(w)?.memberCount??0})),1)]),s("div",Wr,[$(Tr,{"session-id":t(p)},null,8,["session-id"]),$(he,{variant:"ghost",icon:"i-heroicons-x-mark",size:"sm",onClick:B[11]||(B[11]=Y=>n.value=!1)})])]),s("div",jr,[$(hr,{"session-id":t(p),"show-header":!1,onDataChanged:t(X)},null,8,["session-id","onDataChanged"])])])]),_:1},8,["open"])):U("",!0)])}}}),tl=Le(Pr,[["__scopeId","data-v-c37848ed"]]);export{tl as default};
|