chatlab-cli 0.1.0 → 0.21.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-YAOFJ73U.mjs → chunk-3DIWXYMJ.mjs} +80 -129
- package/dist/chunk-3DIWXYMJ.mjs.map +1 -0
- package/dist/{chunk-JMRDNHIR.mjs → chunk-EIRLEPXP.mjs} +824 -280
- package/dist/chunk-EIRLEPXP.mjs.map +1 -0
- package/dist/{chunk-DL3BFEAH.mjs → chunk-EWCSGYVT.mjs} +2 -2
- package/dist/chunk-EWCSGYVT.mjs.map +1 -0
- package/dist/{chunk-PF4QFHC6.mjs → chunk-FBTHZU55.mjs} +849 -824
- package/dist/chunk-FBTHZU55.mjs.map +1 -0
- package/dist/{chunk-P4N5GEFF.mjs → chunk-NB4BIAYM.mjs} +9 -9
- package/dist/{chunk-OC73KSMV.mjs → chunk-XUHPCRVT.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{http-PQEOFGJK.mjs → http-QVYJ5HER.mjs} +6 -6
- package/dist/{import-UR2IE2O7.mjs → import-AJKL6JPR.mjs} +6 -4
- package/dist/index.mjs +6 -6
- package/dist/{mcp-4XCDZ5PU.mjs → mcp-FRF3YAN5.mjs} +5 -6
- package/dist/mcp-FRF3YAN5.mjs.map +1 -0
- package/dist/{src-ZELOFE7P.mjs → src-KOIGBZJX.mjs} +14 -2
- package/dist/{stream-import-RP3XB6NM.mjs → stream-import-URGOCXUH.mjs} +5 -3
- package/dist-web/assets/{DebugToolsPanel.vue_vue_type_script_setup_true_lang-BuOhHrGp.js → DebugToolsPanel.vue_vue_type_script_setup_true_lang-DFN1Co1H.js} +19 -19
- package/dist-web/assets/{EChartWordcloud-DcC12j9S.js → EChartWordcloud-BYLFxPAX.js} +1 -1
- package/dist-web/assets/{MessageExportModal-CUS9nnwi.js → MessageExportModal-BAf68-wB.js} +1 -1
- package/dist-web/assets/electron-2m4Vdk2z.js +1 -0
- package/dist-web/assets/{fetch-DvfIZxuz.js → fetch-Ayp337Ng.js} +1 -1
- package/dist-web/assets/{fetch-CJ8Q4qM2.js → fetch-BWtpQwBZ.js} +1 -1
- package/dist-web/assets/fetch-o5NJ2uWE.js +3 -0
- package/dist-web/assets/{index-D3siJhmm.js → index-Bd5r2oFG.js} +4 -4
- package/dist-web/assets/index-BfZM-q0T.js +7 -0
- package/dist-web/assets/{index-CCE1zef2.js → index-CLYHD_f4.js} +2 -2
- package/dist-web/assets/{index-CUTe0Sc3.js → index-CaTRpNBK.js} +12 -12
- package/dist-web/assets/index-Ksa--o23.js +173 -0
- package/dist-web/assets/{vendor-echarts-BXkS9r5W.js → vendor-echarts-C13vDgZW.js} +5 -5
- package/dist-web/assets/{vendor-echarts-wordcloud-CmDVLUv0.js → vendor-echarts-wordcloud-uVdwYsYa.js} +1 -1
- package/dist-web/assets/{vendor-nuxt-ui-D1aReMtR.js → vendor-nuxt-ui-CYMNNdeD.js} +2 -2
- package/dist-web/assets/{vendor-zrender-B6SpLIkk.js → vendor-zrender-5DcYjSZk.js} +2 -2
- package/dist-web/assets/{web-DOZKbBMQ.js → web-C5yfcwjn.js} +1 -1
- package/dist-web/index.html +2 -2
- package/package.json +1 -2
- package/CHANGELOG.md +0 -51
- package/LICENSE +0 -661
- package/dist/chunk-DL3BFEAH.mjs.map +0 -1
- package/dist/chunk-JMRDNHIR.mjs.map +0 -1
- package/dist/chunk-PF4QFHC6.mjs.map +0 -1
- package/dist/chunk-YAOFJ73U.mjs.map +0 -1
- package/dist/mcp-4XCDZ5PU.mjs.map +0 -1
- package/dist-web/assets/electron-DvcSSc-D.js +0 -1
- package/dist-web/assets/fetch-DgQkWW73.js +0 -3
- package/dist-web/assets/index-68UnLyFT.js +0 -173
- package/dist-web/assets/index-n2XUUgti.js +0 -7
- /package/dist/{chunk-P4N5GEFF.mjs.map → chunk-NB4BIAYM.mjs.map} +0 -0
- /package/dist/{chunk-OC73KSMV.mjs.map → chunk-XUHPCRVT.mjs.map} +0 -0
- /package/dist/{http-PQEOFGJK.mjs.map → http-QVYJ5HER.mjs.map} +0 -0
- /package/dist/{import-UR2IE2O7.mjs.map → import-AJKL6JPR.mjs.map} +0 -0
- /package/dist/{src-ZELOFE7P.mjs.map → src-KOIGBZJX.mjs.map} +0 -0
- /package/dist/{stream-import-RP3XB6NM.mjs.map → stream-import-URGOCXUH.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-echarts-wordcloud-
|
|
1
|
+
import"./vendor-echarts-wordcloud-uVdwYsYa.js";import{p as L,w as r,d as W,F,G as D,P as I,a0 as T,h as S,b as j}from"./vendor-reka-ui-CW2cIgMu.js";import{u as A,m as G,j as P,n as U}from"./vendor-echarts-C13vDgZW.js";import"./vendor-zrender-5DcYjSZk.js";const N=L({__name:"EChartWordcloud",props:{data:{},height:{default:400},loading:{type:Boolean,default:!1},maxWords:{default:100},colorScheme:{default:"default"},sizeScale:{default:1},drawOutOfBound:{type:Boolean,default:!1},shape:{default:"circle"}},emits:["wordClick"],setup(M,{expose:x,emit:y}){A([G,P]);const e=M,v=y,c=j();let n=null;const C=S(()=>typeof e.height=="number"?`${e.height}px`:e.height),p=S(()=>document.documentElement.classList.contains("dark")),k={default:["#6366f1","#8b5cf6","#ec4899","#f43f5e","#f97316","#22c55e","#14b8a6","#3b82f6"],warm:["#f97316","#fb923c","#fbbf24","#facc15","#f59e0b","#ea580c","#dc2626","#ef4444"],cool:["#3b82f6","#6366f1","#8b5cf6","#a855f7","#14b8a6","#06b6d4","#0ea5e9","#0284c7"],rainbow:["#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#3b82f6","#8b5cf6","#ec4899"]},b=()=>{const t=e.data.words.slice(0,e.maxWords);if(t.length===0)return null;const a=Math.max(...t.map(o=>o.count)),g=Math.min(...t.map(o=>o.count)),O=a-g||1,w=k[e.colorScheme],B=14,R=56,f=Math.round(B*e.sizeScale),z=Math.round(R*e.sizeScale),_=z-f,E=t.map((o,i)=>{const h=(o.count-g)/O,m=Math.round(f+h*_),$=w[i%w.length];return{name:o.word,value:o.count,textStyle:{fontSize:m,color:$}}});return{backgroundColor:"transparent",tooltip:{show:!0,formatter:o=>{const i=t.find(m=>m.word===o.name),h=i?.percentage?` (${i.percentage}%)`:"";return`${o.name}: ${o.value}次${h}`},backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"}},series:[{type:"wordCloud",shape:e.shape==="rectangle"?o=>1/Math.max(Math.abs(Math.cos(o)),Math.abs(Math.sin(o))):e.shape,left:0,top:0,right:0,bottom:0,width:"100%",height:"100%",gridSize:Math.max(2,Math.round(4*e.sizeScale)),sizeRange:[f,z],rotationRange:[-45,45],rotationStep:15,drawOutOfBound:e.drawOutOfBound,layoutAnimation:!0,textStyle:{fontFamily:"sans-serif",fontWeight:"bold"},emphasis:{focus:"self",textStyle:{shadowBlur:10,shadowColor:p.value?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.3)"}},data:E}]}};function s(){if(!c.value)return;n&&n.dispose(),n=U(c.value);const t=b();t&&n.setOption(t),n.on("click",a=>{a.componentType==="series"&&a.seriesType==="wordCloud"&&v("wordClick",a.name,a.value)})}function l(){if(!n){s();return}const t=b();t&&n.setOption(t,{notMerge:!0})}function u(){n?.resize()}r(()=>e.data,l,{deep:!0}),r(()=>e.colorScheme,l),r(()=>e.sizeScale,l),r(p,()=>{s()}),r(()=>e.loading,t=>{t?n?.showLoading("default",{text:"",spinnerRadius:12,lineWidth:2}):n?.hideLoading()});let d=null;return W(()=>{s(),window.addEventListener("resize",u),d=new MutationObserver(()=>{s()}),d.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}),F(()=>{window.removeEventListener("resize",u),d?.disconnect(),n?.dispose(),n=null}),x({getInstance:()=>n,resize:u}),(t,a)=>(D(),I("div",{ref_key:"chartRef",ref:c,style:T({height:C.value,width:"100%"})},null,4))}});export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as de,a as le,k as ce,b as se,g as ue,r as ge}from"./vendor-nuxt-ui-D1aReMtR.js";import{u as J,d as ne,T as ye,h as ie,f as ve,G as me,b as xe,r as he,x as G,j as pe}from"./index-n2XUUgti.js";import{p as X,J as Q,w as W,d as re,G as l,P as u,a5 as t,R as T,T as n,u as y,L as I,K as R,Z as N,a3 as Z,H as Y,U as H,bA as ae,bB as oe,b as $,h as P,bE as fe,a0 as q,a9 as ke,Q as te,n as be,by as _e,W as we,bp as O}from"./vendor-reka-ui-CW2cIgMu.js";import{d as $e}from"./DebugToolsPanel.vue_vue_type_script_setup_true_lang-BuOhHrGp.js";import"./vendor-snapdom-XnBoh1gd.js";import"./index-CUTe0Sc3.js";import"./vendor-echarts-wordcloud-CmDVLUv0.js";import"./vendor-echarts-BXkS9r5W.js";import"./vendor-zrender-B6SpLIkk.js";const Se={class:"p-4 space-y-6"},Ie={class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},Ce={class:"text-gray-500 text-xs ml-1"},Te={class:"flex gap-2 mb-2"},Me={key:0,class:"flex flex-wrap gap-2"},ze=["onClick"],De={class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},Le={class:"space-y-2"},Be={key:0,class:"flex gap-2 items-center"},Fe={class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},Ue={class:"text-gray-500 text-xs ml-1"},Re={class:"max-h-60 overflow-y-auto border border-gray-200 dark:border-gray-700 rounded-md"},Pe={key:0,class:"p-4 text-center text-gray-500"},Ve={key:1,class:"p-4 text-center text-gray-500 text-sm"},He={key:2,class:"divide-y divide-gray-100 dark:divide-gray-700"},je=["checked","onChange"],Ee={class:"text-sm text-gray-700 dark:text-gray-300 truncate"},Ne={class:"text-xs text-gray-400 ml-auto"},Ae={key:0,class:"mt-2 text-xs text-gray-500"},Ke={class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},Ye={class:"text-gray-500 text-xs ml-1"},We=X({__name:"ConditionPanel",props:{keywords:{default:()=>[]},keywordsModifiers:{},timeRange:{default:null},timeRangeModifiers:{},senderIds:{default:()=>[]},senderIdsModifiers:{},contextSize:{default:10},contextSizeModifiers:{}},emits:["update:keywords","update:timeRange","update:senderIds","update:contextSize"],setup(v){const{t:C}=J(),M=ne(),h=Q(v,"keywords"),m=Q(v,"timeRange"),w=Q(v,"senderIds"),z=Q(v,"contextSize"),L=$(""),r=$([]),p=$(!1),k=$("all"),x=$(""),D=$(""),B=[{id:"all",label:"analysis.filter.allTime"},{id:"today",label:"analysis.filter.today"},{id:"week",label:"analysis.filter.lastWeek"},{id:"month",label:"analysis.filter.lastMonth"},{id:"3months",label:"analysis.filter.last3Months"},{id:"year",label:"analysis.filter.lastYear"},{id:"custom",label:"analysis.filter.customTime"}],F=P(()=>B.map(s=>({label:C(s.label),value:s.id})));W(k,()=>{a()});const j=$(null);async function E(){const s=M.currentSessionId;if(s){p.value=!0;try{r.value=await ie().getMembers(s)}catch(e){console.error("加载成员失败:",e)}finally{p.value=!1}}}async function V(){const s=M.currentSessionId;if(s)try{const e=await ie().getTimeRange(s);e&&(j.value=e)}catch(e){console.error("加载时间范围失败:",e)}}function U(){const s=L.value.trim();s&&!h.value.includes(s)&&(h.value=[...h.value,s],L.value="")}function c(s){h.value=h.value.filter(e=>e!==s)}function g(s){s.key==="Enter"&&(s.preventDefault(),U())}function o(s){w.value.includes(s)?w.value=w.value.filter(e=>e!==s):w.value=[...w.value,s]}function a(){const s=Math.floor(Date.now()/1e3),e=new Date;e.setHours(0,0,0,0);const d=Math.floor(e.getTime()/1e3);switch(k.value){case"all":m.value=null;break;case"today":m.value={start:d,end:s};break;case"week":m.value={start:s-10080*60,end:s};break;case"month":m.value={start:s-720*60*60,end:s};break;case"3months":m.value={start:s-2160*60*60,end:s};break;case"year":m.value={start:s-365*24*60*60,end:s};break;case"custom":if(x.value&&D.value){const f=new Date(x.value).getTime()/1e3,i=new Date(D.value).getTime()/1e3+86399;m.value={start:f,end:i}}break}}const b=$(""),A=P(()=>{if(!b.value)return r.value;const s=b.value.toLowerCase();return r.value.filter(e=>e.accountName?.toLowerCase().includes(s)||e.groupNickname?.toLowerCase().includes(s)||e.platformId.toLowerCase().includes(s)||e.aliases.some(d=>d.toLowerCase().includes(s)))});return re(()=>{E(),V()}),(s,e)=>{const d=de,f=le,i=se,S=ce;return l(),u("div",Se,[t("div",null,[t("label",Ie,[T(n(y(C)("analysis.filter.keywords"))+" ",1),t("span",Ce,"("+n(y(C)("analysis.filter.keywordsHint"))+")",1)]),t("div",Te,[I(d,{modelValue:L.value,"onUpdate:modelValue":e[0]||(e[0]=_=>L.value=_),placeholder:y(C)("analysis.filter.keywordPlaceholder"),class:"flex-1",onKeydown:g},null,8,["modelValue","placeholder"]),I(f,{size:"sm",onClick:U},{default:R(()=>[T(n(y(C)("common.add")),1)]),_:1})]),h.value.length>0?(l(),u("div",Me,[(l(!0),u(N,null,Z(h.value,_=>(l(),Y(S,{key:_,color:"primary",variant:"subtle",class:"gap-1"},{default:R(()=>[T(n(_)+" ",1),t("button",{class:"ml-1 hover:text-red-500",onClick:K=>c(_)},[I(i,{name:"i-heroicons-x-mark",class:"w-3 h-3"})],8,ze)]),_:2},1024))),128))])):H("",!0)]),t("div",null,[t("label",De,n(y(C)("analysis.filter.timeRange")),1),t("div",Le,[I(ye,{modelValue:k.value,"onUpdate:modelValue":e[1]||(e[1]=_=>k.value=_),items:F.value,size:"sm"},null,8,["modelValue","items"]),k.value==="custom"?(l(),u("div",Be,[ae(t("input",{"onUpdate:modelValue":e[2]||(e[2]=_=>x.value=_),type:"date",class:"flex-1 px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800",onChange:a},null,544),[[oe,x.value]]),e[6]||(e[6]=t("span",{class:"text-gray-500"},"~",-1)),ae(t("input",{"onUpdate:modelValue":e[3]||(e[3]=_=>D.value=_),type:"date",class:"flex-1 px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800",onChange:a},null,544),[[oe,D.value]])])):H("",!0)])]),t("div",null,[t("label",Fe,[T(n(y(C)("analysis.filter.senders"))+" ",1),t("span",Ue,"("+n(y(C)("analysis.filter.sendersHint"))+")",1)]),I(d,{modelValue:b.value,"onUpdate:modelValue":e[4]||(e[4]=_=>b.value=_),placeholder:y(C)("analysis.filter.searchMember"),icon:"i-heroicons-magnifying-glass",size:"sm",class:"mb-2"},null,8,["modelValue","placeholder"]),t("div",Re,[p.value?(l(),u("div",Pe,[I(i,{name:"i-heroicons-arrow-path",class:"w-5 h-5 animate-spin"})])):A.value.length===0?(l(),u("div",Ve,n(y(C)("analysis.filter.noMembers")),1)):(l(),u("div",He,[(l(!0),u(N,null,Z(A.value,_=>(l(),u("label",{key:_.id,class:"flex items-center gap-2 px-3 py-2 hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer"},[t("input",{type:"checkbox",checked:w.value.includes(_.id),class:"text-primary-500 rounded",onChange:K=>o(_.id)},null,40,je),t("span",Ee,n(_.groupNickname||_.accountName||_.platformId),1),t("span",Ne,"("+n(_.messageCount)+")",1)]))),128))]))]),w.value.length>0?(l(),u("div",Ae,n(y(C)("analysis.filter.selectedCount",{count:w.value.length})),1)):H("",!0)]),t("div",null,[t("label",Ke,[T(n(y(C)("analysis.filter.contextSize"))+" ",1),t("span",Ye,"±"+n(z.value)+" "+n(y(C)("analysis.filter.messages")),1)]),ae(t("input",{"onUpdate:modelValue":e[5]||(e[5]=_=>z.value=_),type:"range",min:"0",max:"50",step:"5",class:"w-full h-2 bg-gray-200 dark:bg-gray-700 rounded-lg appearance-none cursor-pointer"},null,512),[[oe,z.value,void 0,{number:!0}]]),e[7]||(e[7]=t("div",{class:"flex justify-between text-xs text-gray-400 mt-1"},[t("span",null,"0"),t("span",null,"25"),t("span",null,"50")],-1))])])}}}),Ge={class:"p-4 flex flex-col h-full min-h-0"},Oe={key:0,class:"flex-none mb-2 text-sm text-primary-500"},Qe={class:"flex-1 min-h-0"},Ze={key:0,class:"flex items-center justify-center h-full"},qe={key:1,class:"flex items-center justify-center h-full text-gray-500 text-sm"},Je=["onClick"],Xe={class:"text-sm font-medium text-gray-700 dark:text-gray-300"},et={class:"flex items-center gap-2"},tt={class:"text-xs text-gray-500"},st=["checked","onChange"],nt=["checked","onChange"],at={class:"flex-1 min-w-0"},ot={class:"flex items-center gap-2"},lt={class:"text-sm text-gray-700 dark:text-gray-300"},rt={class:"flex items-center gap-2 text-xs text-gray-500"},it=X({__name:"SessionPanel",props:{selectedIds:{default:()=>[]},selectedIdsModifiers:{}},emits:["update:selectedIds"],setup(v){const{t:C}=J(),M=ne(),h=Q(v,"selectedIds"),m=$(new Set);W(h,c=>{m.value=new Set(c)},{immediate:!0});const w=$([]),z=$(!1),L=$(null),r=P(()=>{const c={};for(const a of w.value){const b=new Date(a.startTs*1e3).toLocaleDateString();c[b]||(c[b]=[]),c[b].push(a)}const g=Object.keys(c).sort((a,b)=>new Date(b).getTime()-new Date(a).getTime()),o=[];for(const a of g){o.push({type:"date",date:a,sessionCount:c[a].length});for(const b of c[a])o.push({type:"session",session:b,date:a})}return o}),p=fe(P(()=>({count:r.value.length,getScrollElement:()=>L.value,estimateSize:c=>r.value[c]?.type==="date"?36:56,overscan:10}))),k=P(()=>p.value.getVirtualItems());async function x(){const c=M.currentSessionId;if(c){z.value=!0;try{w.value=await ve().getSessions(c)}catch(g){console.error("加载会话失败:",g)}finally{z.value=!1}}}function D(c){return m.value.has(c)}function B(c){const g=new Set(m.value);g.has(c)?g.delete(c):g.add(c),m.value=g,h.value=Array.from(g)}function F(c){return r.value.filter(g=>g.type==="session"&&g.date===c).map(g=>g.session.id)}function j(c){const g=F(c),o=g.every(b=>m.value.has(b)),a=new Set(m.value);if(o)for(const b of g)a.delete(b);else for(const b of g)a.add(b);m.value=a,h.value=Array.from(a)}function E(c){const g=F(c);return g.length>0&&g.every(o=>m.value.has(o))}function V(c){return new Date(c*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}function U(c,g){const o=g-c;return o<60?`${o}秒`:o<3600?`${Math.floor(o/60)}分钟`:`${Math.floor(o/3600)}小时${Math.floor(o%3600/60)}分钟`}return re(()=>{x()}),(c,g)=>{const o=se;return l(),u("div",Ge,[h.value.length>0?(l(),u("div",Oe,n(y(C)("analysis.filter.selectedSessions",{count:h.value.length})),1)):H("",!0),t("div",Qe,[z.value?(l(),u("div",Ze,[I(o,{name:"i-heroicons-arrow-path",class:"w-6 h-6 animate-spin text-gray-400"})])):w.value.length===0?(l(),u("div",qe,n(y(C)("analysis.filter.noSessions")),1)):(l(),u("div",{key:2,ref_key:"scrollContainerRef",ref:L,class:"h-full overflow-y-auto"},[t("div",{style:q({height:`${y(p).getTotalSize()}px`,position:"relative"})},[(l(!0),u(N,null,Z(k.value,a=>(l(),u("div",{key:String(a.key),style:q({position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${a.start}px)`})},[r.value[a.index].type==="date"?(l(),u("div",{key:0,class:"flex items-center justify-between px-2 py-1.5 bg-gray-100 dark:bg-gray-800 rounded-md cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700",onClick:b=>j(r.value[a.index].date)},[t("span",Xe,n(r.value[a.index].date),1),t("div",et,[t("span",tt,n(r.value[a.index].sessionCount)+" 个会话",1),t("input",{type:"checkbox",checked:E(r.value[a.index].date),class:"text-primary-500 rounded",onClick:g[0]||(g[0]=ke(()=>{},["stop"])),onChange:b=>j(r.value[a.index].date)},null,40,st)])],8,Je)):(l(),u("label",{key:1,class:te(["flex items-center gap-3 px-3 py-2 ml-2 rounded-md hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer border border-transparent",{"border-primary-300 bg-primary-50 dark:border-primary-600 dark:bg-primary-900/20":D(r.value[a.index].session.id)}])},[t("input",{type:"checkbox",checked:D(r.value[a.index].session.id),class:"text-primary-500 rounded",onChange:b=>B(r.value[a.index].session.id)},null,40,nt),t("div",at,[t("div",ot,[t("span",lt,n(V(r.value[a.index].session.startTs))+" - "+n(V(r.value[a.index].session.endTs)),1)]),t("div",rt,[t("span",null,n(r.value[a.index].session.messageCount)+" 条消息",1),g[1]||(g[1]=t("span",null,"·",-1)),t("span",null,n(U(r.value[a.index].session.startTs,r.value[a.index].session.endTs)),1)])])],2))],4))),128))],4)],512))])])}}}),dt={class:"flex-1 flex flex-col overflow-hidden bg-gray-50 dark:bg-gray-900"},ct={key:0,class:"flex-none px-4 py-3 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"},ut={class:"flex items-center justify-between mb-2"},ft={class:"flex items-center gap-6 text-sm"},gt={class:"text-gray-600 dark:text-gray-400"},yt={class:"font-medium text-gray-900 dark:text-white"},vt={class:"text-gray-600 dark:text-gray-400"},mt={class:"font-medium text-gray-900 dark:text-white"},xt={class:"text-gray-600 dark:text-gray-400"},ht={class:"font-medium text-primary-500"},pt={class:"text-gray-600 dark:text-gray-400"},kt={class:"font-medium text-gray-900 dark:text-white"},bt={class:"flex-1 min-h-0 flex overflow-hidden"},_t={key:1,class:"w-full h-full flex items-center justify-center"},wt={class:"text-center text-gray-400"},$t={key:2,class:"flex-1 flex items-center justify-center"},St={class:"text-center text-gray-400"},It={class:"w-64 flex-none border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col"},Ct={class:"flex-none px-3 py-2 border-b border-gray-200 dark:border-gray-700"},Tt={class:"text-sm font-medium text-gray-700 dark:text-gray-300"},Mt=["onClick"],zt={class:"flex items-center justify-between mb-1"},Dt={class:"text-sm font-medium text-gray-700 dark:text-gray-300"},Lt={key:0,class:"text-xs text-primary-500"},Bt={class:"text-xs text-gray-500"},Ft={class:"flex items-center gap-2 text-xs text-gray-400 mt-1"},Ut={key:0,class:"py-3 text-center text-sm text-gray-500 dark:text-gray-400 border-t border-gray-100 dark:border-gray-700"},Rt={key:1,class:"py-3 text-center text-xs text-gray-400 dark:text-gray-500"},Pt={class:"flex-1 overflow-hidden"},Vt={key:1,class:"flex items-center justify-center h-full text-gray-400"},Ht=X({__name:"PreviewPanel",props:{result:{},isLoading:{type:Boolean},isLoadingMore:{type:Boolean}},emits:["load-more"],setup(v,{emit:C}){const{t:M}=J(),h=v,m=C,w=$(0);let z=!1;const L=$(null),r=$(null),p=$(null);function k(s){if(!h.result)return null;const e=h.result.blocks.length-1-s;return h.result.blocks[e]}const x=P(()=>h.result?.blocks.length??0),D=fe(P(()=>({count:x.value,getScrollElement:()=>p.value,estimateSize:()=>72,overscan:5}))),B=P(()=>D.value.getVirtualItems()),F=P(()=>{if(x.value===0)return[];const s=k(w.value);return s?s.messages.map(e=>({id:e.id,senderName:e.senderName,senderPlatformId:e.senderPlatformId,senderAliases:e.senderAliases,senderAvatar:e.senderAvatar,content:e.content,timestamp:e.timestamp,type:e.type,replyToMessageId:e.replyToMessageId,replyToContent:e.replyToContent,replyToSenderName:e.replyToSenderName})):[]}),j=P(()=>{if(x.value===0)return[];const s=k(w.value);return s?s.messages.filter(e=>e.isHit).map(e=>e.id):[]}),E={startTs:0,endTs:0},V=P(()=>{if(!h.result||h.result.blocks.length===0)return!1;const s=h.result.blocks,e=new Date(s[0].startTs*1e3).getFullYear(),d=new Date(s[s.length-1].endTs*1e3).getFullYear();return e!==d});function U(s){const e={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return V.value&&(e.year="numeric"),new Date(s*1e3).toLocaleString("zh-CN",e)}function c(s,e){const d=e-s;return d<60?`${d}秒`:d<3600?`${Math.floor(d/60)}分钟`:`${Math.floor(d/3600)}h${Math.floor(d%3600/60)}m`}function g(s){w.value=s;const e=k(s);if(e){const d=e.messages.find(f=>f.isHit);d&&(L.value=d.id)}}function o(){z||x.value!==0&&w.value<x.value-1&&(z=!0,w.value++,b(w.value),setTimeout(()=>{z=!1},300))}function a(){}function b(s){D.value.scrollToIndex(s,{align:"center"})}W(()=>h.result,()=>{w.value=0,L.value=null}),W(L,async s=>{s!==null&&(await be(),setTimeout(()=>{r.value?.scrollToMessage(s),L.value=null},100))});function A(s){const e=s.target;if(!e||!h.result?.pagination?.hasMore||h.isLoadingMore)return;const d=100,{scrollTop:f,scrollHeight:i,clientHeight:S}=e;i-f-S<d&&m("load-more")}return(s,e)=>{const d=se;return l(),u("div",dt,[v.result&&v.result.blocks.length>0?(l(),u("div",ct,[t("div",ut,[t("div",ft,[t("span",gt,[T(n(y(M)("analysis.filter.stats.blocks"))+": ",1),t("span",yt,[T(n(v.result.blocks.length)+" ",1),v.result.pagination&&v.result.pagination.totalBlocks>v.result.blocks.length?(l(),u(N,{key:0},[T(" / "+n(v.result.pagination.totalBlocks),1)],64)):H("",!0)])]),t("span",vt,[T(n(y(M)("analysis.filter.stats.messages"))+": ",1),t("span",mt,n(v.result.stats.totalMessages),1)]),t("span",xt,[T(n(y(M)("analysis.filter.stats.hits"))+": ",1),t("span",ht,n(v.result.pagination?.totalHits??v.result.stats.hitMessages),1)]),t("span",pt,[T(n(y(M)("analysis.filter.stats.chars"))+": ",1),t("span",kt,n(v.result.stats.totalChars.toLocaleString()),1)])])])])):H("",!0),t("div",bt,[v.isLoading?(l(),Y($e,{key:0,variant:"page",text:y(M)("analysis.filter.filtering")},null,8,["text"])):v.result?v.result.blocks.length===0?(l(),u("div",$t,[t("div",St,[I(d,{name:"i-heroicons-magnifying-glass",class:"w-12 h-12 mb-3 mx-auto"}),t("p",null,n(y(M)("analysis.filter.noResults")),1)])])):(l(),u(N,{key:3},[t("div",It,[t("div",Ct,[t("span",Tt,[T(n(y(M)("analysis.filter.stats.blocks"))+" ("+n(v.result.blocks.length)+" ",1),v.result.pagination&&v.result.pagination.totalBlocks>v.result.blocks.length?(l(),u(N,{key:0},[T(" /"+n(v.result.pagination.totalBlocks),1)],64)):H("",!0),e[1]||(e[1]=T(" ) ",-1))])]),t("div",{ref_key:"blockListRef",ref:p,class:"flex-1 overflow-y-auto",onScroll:A},[t("div",{style:q({height:`${y(D).getTotalSize()}px`,position:"relative"})},[(l(!0),u(N,null,Z(B.value,f=>(l(),u("div",{key:String(f.key),style:q({position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${f.start}px)`})},[t("div",{class:te(["px-3 py-2 cursor-pointer border-b border-gray-100 dark:border-gray-700 transition-colors",w.value===f.index?"bg-primary-50 dark:bg-primary-900/30 border-l-2 border-l-primary-500":"hover:bg-gray-50 dark:hover:bg-gray-700/50"]),onClick:i=>g(f.index)},[t("div",zt,[t("span",Dt," #"+n(f.index+1),1),(k(f.index)?.hitCount??0)>0?(l(),u("span",Lt," 含 "+n(k(f.index)?.hitCount)+" 个结果 ",1)):H("",!0)]),t("div",Bt,n(U(k(f.index)?.startTs??0)),1),t("div",Ft,[t("span",null,n(k(f.index)?.messages.length??0)+" 条",1),e[2]||(e[2]=t("span",null,"·",-1)),t("span",null,n(c(k(f.index)?.startTs??0,k(f.index)?.endTs??0)),1)])],10,Mt)],4))),128))],4),v.result.pagination?.hasMore?(l(),u("div",Ut,[v.isLoadingMore?(l(),u(N,{key:0},[I(d,{name:"i-heroicons-arrow-path",class:"w-4 h-4 animate-spin inline mr-1"}),T(" "+n(y(M)("common.loading")),1)],64)):(l(),u("button",{key:1,class:"text-primary-500 hover:text-primary-600",onClick:e[0]||(e[0]=f=>m("load-more"))},n(y(M)("analysis.filter.loadMore")),1))])):v.result.pagination&&v.result.blocks.length>=v.result.pagination.totalBlocks?(l(),u("div",Rt,n(y(M)("analysis.filter.allLoaded")),1)):H("",!0)],544)]),t("div",Pt,[F.value.length>0?(l(),Y(me,{key:0,ref_key:"messageListRef",ref:r,query:E,"external-messages":F.value,"hit-message-ids":j.value,class:"h-full",onReachBottom:o,onReachTop:a},null,8,["external-messages","hit-message-ids"])):(l(),u("div",Vt,n(y(M)("analysis.filter.noResults")),1))])],64)):(l(),u("div",_t,[t("div",wt,[I(d,{name:"i-heroicons-funnel",class:"w-12 h-12 mb-3 mx-auto"}),t("p",null,n(y(M)("analysis.filter.emptyHint")),1)])]))])])}}}),jt={class:"flex items-center justify-between"},Et={class:"text-lg font-semibold"},Nt={class:"max-h-96 overflow-y-auto"},At={key:0,class:"py-8 text-center text-gray-500"},Kt={key:1,class:"divide-y divide-gray-200 dark:divide-gray-700"},Yt={class:"flex items-start justify-between gap-2"},Wt={class:"flex-1 min-w-0"},Gt={key:0,class:"flex items-center gap-2 mb-1"},Ot={key:1,class:"flex items-center gap-2 mb-1"},Qt={class:"font-medium text-gray-900 dark:text-white"},Zt=["onClick"],qt={class:"text-sm text-gray-600 dark:text-gray-400 truncate"},Jt={class:"text-xs text-gray-400 mt-1"},Xt={class:"flex items-center gap-1"},es=X({__name:"FilterHistory",props:{open:{type:Boolean,default:!1},openModifiers:{}},emits:we(["load"],["update:open"]),setup(v,{expose:C,emit:M}){const{t:h}=J(),m=ne(),w=xe(),z=Q(v,"open"),L=M,r=$([]);let p=[];const k=$(null),x=$("");async function D(){try{p=(await w.getPreferences()).filterHistory??[],r.value=p.filter(a=>a.sessionId===m.currentSessionId)}catch(o){console.error("Failed to load filter history:",o)}}function B(){p=[...p.filter(a=>a.sessionId!==m.currentSessionId),...r.value],w.savePreferences({filterHistory:p}).catch(a=>{console.error("Failed to save filter history:",a)})}function F(o){r.value=r.value.filter(a=>a.id!==o),B()}function j(o){L("load",{mode:o.mode,conditionFilter:o.conditionFilter,selectedSessionIds:o.selectedSessionIds})}function E(o){k.value=o.id,x.value=o.name}function V(o){o.name=x.value||o.name,k.value=null,B()}function U(){k.value=null}function c(o){return new Date(o).toLocaleString()}function g(o){if(o.mode==="condition"){const a=[];return o.conditionFilter?.keywords.length&&a.push(`关键词: ${o.conditionFilter.keywords.join(", ")}`),o.conditionFilter?.senderIds.length&&a.push(`${o.conditionFilter.senderIds.length} 位成员`),a.join(" | ")||"无条件"}else return`${o.selectedSessionIds?.length||0} 个会话`}return W(z,o=>{o&&D()}),re(()=>{D()}),C({saveCondition(o){const a={id:`filter_${Date.now()}`,sessionId:m.currentSessionId||"",createdAt:Date.now(),name:`筛选 ${r.value.length+1}`,...o};r.value.unshift(a),r.value=r.value.slice(0,20),B()}}),(o,a)=>{const b=le,A=de,s=ce,e=se,d=ge,f=ue;return l(),Y(f,{open:z.value,"onUpdate:open":a[2]||(a[2]=i=>z.value=i)},{content:R(()=>[I(d,null,{header:R(()=>[t("div",jt,[t("h3",Et,n(y(h)("analysis.filter.historyTitle")),1),I(b,{variant:"ghost",icon:"i-heroicons-x-mark",size:"sm",onClick:a[0]||(a[0]=i=>z.value=!1)})])]),default:R(()=>[t("div",Nt,[r.value.length===0?(l(),u("div",At,n(y(h)("analysis.filter.noHistory")),1)):(l(),u("div",Kt,[(l(!0),u(N,null,Z(r.value,i=>(l(),u("div",{key:i.id,class:"py-3 hover:bg-gray-50 dark:hover:bg-gray-800 px-2 rounded-md"},[t("div",Yt,[t("div",Wt,[k.value===i.id?(l(),u("div",Gt,[I(A,{modelValue:x.value,"onUpdate:modelValue":a[1]||(a[1]=S=>x.value=S),size:"sm",class:"flex-1",onKeydown:_e(S=>V(i),["enter"])},null,8,["modelValue","onKeydown"]),I(b,{size:"xs",onClick:S=>V(i)},{default:R(()=>[T(n(y(h)("common.save")),1)]),_:1},8,["onClick"]),I(b,{size:"xs",variant:"ghost",onClick:U},{default:R(()=>[T(n(y(h)("common.cancel")),1)]),_:1})])):(l(),u("div",Ot,[t("span",Qt,n(i.name),1),I(s,{color:i.mode==="condition"?"primary":"green",size:"xs"},{default:R(()=>[T(n(i.mode==="condition"?"条件":"会话"),1)]),_:2},1032,["color"]),t("button",{class:"text-gray-400 hover:text-gray-600",onClick:S=>E(i)},[I(e,{name:"i-heroicons-pencil",class:"w-3 h-3"})],8,Zt)])),t("p",qt,n(g(i)),1),t("p",Jt,n(c(i.createdAt)),1)]),t("div",Xt,[I(b,{size:"xs",variant:"soft",onClick:S=>j(i)},{default:R(()=>[T(n(y(h)("common.load")),1)]),_:1},8,["onClick"]),I(b,{size:"xs",variant:"ghost",color:"red",onClick:S=>F(i.id)},{default:R(()=>[I(e,{name:"i-heroicons-trash",class:"w-4 h-4"})]),_:1},8,["onClick"])])])]))),128))]))])]),_:1})]),_:1},8,["open"])}}}),ts={class:"flex h-[85vh] flex-col overflow-hidden bg-white dark:bg-gray-900"},ss={class:"flex flex-none items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-700"},ns={class:"flex items-center gap-4"},as={class:"text-lg font-semibold text-gray-900 dark:text-white"},os={class:"flex items-center gap-1 rounded-lg bg-gray-100 p-1 dark:bg-gray-800"},ls={class:"flex items-center gap-2"},rs={class:"flex flex-1 overflow-hidden"},is={class:"flex w-80 flex-none flex-col border-r border-gray-200 dark:border-gray-700"},ds={class:"min-h-0 flex-1 overflow-y-auto"},cs={class:"flex-none border-t border-gray-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-900"},us={class:"flex flex-1 flex-col overflow-hidden"},fs={key:0,class:"flex flex-none flex-col gap-2 border-t border-gray-200 bg-gray-50 px-4 py-3 dark:border-gray-700 dark:bg-gray-800"},gs={key:0,class:"w-full"},ys={class:"mb-1 flex items-center justify-between text-sm text-gray-600 dark:text-gray-400"},vs={class:"h-2 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700"},ms={class:"flex items-center justify-end gap-3"},ee=50,Is=X({__name:"MessageExportModal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(v,{emit:C}){const M=v,h=C,{t:m}=J(),w=he(),z=ne(),L=P({get:()=>M.modelValue,set:s=>h("update:modelValue",s)}),r=$("condition"),p=$({keywords:[],timeRange:null,senderIds:[],contextSize:10}),k=$([]),x=$(null),D=$(!1),B=$(!1),F=$(!1),j=P(()=>D.value?!1:r.value==="condition"?p.value.keywords.length>0||p.value.senderIds.length>0||p.value.timeRange!==null:k.value.length>0);async function E(){const s=z.currentSessionId;if(s){D.value=!0,x.value=null;try{if(r.value==="condition"){const e=O(p.value),d=e.keywords.length>0?[...e.keywords]:void 0,f=e.timeRange?{startTs:e.timeRange.start,endTs:e.timeRange.end}:void 0,i=e.senderIds.length>0?[...e.senderIds]:void 0,S=e.contextSize,_=await G().filterMessagesWithContext(s,d,f,i,S,1,ee);x.value=_}else{if(k.value.length===0)return;const e=[...O(k.value)],d=await G().getMultipleSessionsMessages(s,e,1,ee);x.value=d}}catch(e){console.error("筛选失败:",e)}finally{D.value=!1}}}async function V(){const s=z.currentSessionId;if(!s||!x.value||!x.value.pagination.hasMore||B.value)return;B.value=!0;const e=x.value.pagination.page+1;try{let d;if(r.value==="condition"){const f=O(p.value),i=f.keywords.length>0?[...f.keywords]:void 0,S=f.timeRange?{startTs:f.timeRange.start,endTs:f.timeRange.end}:void 0,_=f.senderIds.length>0?[...f.senderIds]:void 0,K=f.contextSize;d=await G().filterMessagesWithContext(s,i,S,_,K,e,ee)}else{const f=[...O(k.value)];d=await G().getMultipleSessionsMessages(s,f,e,ee)}d&&d.blocks.length>0&&(x.value={blocks:[...x.value.blocks,...d.blocks],stats:x.value.stats,pagination:d.pagination})}catch(d){console.error("加载更多失败:",d)}finally{B.value=!1}}const U=$(!1),c=$(null);let g=null;function o(){g=G().onExportProgress(s=>{c.value={percentage:s.percentage,message:s.message},(s.stage==="done"||s.stage==="error")&&(c.value=null)})}function a(){g&&(g(),g=null),c.value=null}async function b(){if(!x.value||x.value.blocks.length===0)return;const s=z.currentSessionId;if(!s)return;const d=z.currentSession?.name||"未知会话",f=await pe().showOpenDialog({title:"选择保存目录",properties:["openDirectory","createDirectory"]});if(f.canceled||!f.filePaths[0])return;const i=f.filePaths[0];U.value=!0,c.value={percentage:0,message:m("analysis.filter.exportPreparing")},o();try{const S=O(p.value),_={sessionId:s,sessionName:d,outputDir:i,filterMode:r.value,keywords:S.keywords.length>0?[...S.keywords]:void 0,timeFilter:S.timeRange?{startTs:S.timeRange.start,endTs:S.timeRange.end}:void 0,senderIds:S.senderIds.length>0?[...S.senderIds]:void 0,contextSize:S.contextSize,chatSessionIds:r.value==="session"?[...O(k.value)]:void 0},K=await G().exportFilterResultToFile(_);K.success&&K.filePath?w.success(m("analysis.filter.exportSuccess"),{description:K.filePath}):w.fail(m("analysis.filter.exportFailed"),{description:K.error||m("common.error.unknown")})}catch(S){console.error("导出失败:",S),w.fail(m("analysis.filter.exportFailed"),{description:String(S)})}finally{a(),U.value=!1}}W(r,()=>{x.value=null}),W(L,s=>{s||(x.value=null,a())});function A(s){r.value=s.mode,s.mode==="condition"&&s.conditionFilter?p.value={...s.conditionFilter}:s.mode==="session"&&s.selectedSessionIds&&(k.value=[...s.selectedSessionIds]),F.value=!1}return(s,e)=>{const d=le,f=ue;return l(),Y(f,{open:L.value,"onUpdate:open":e[10]||(e[10]=i=>L.value=i),ui:{content:"sm:max-w-[95vw]"}},{content:R(()=>[t("div",ts,[t("div",ss,[t("div",ns,[t("h2",as,n(y(m)("analysis.messageExport.title")),1),t("div",os,[t("button",{class:te(["rounded-md px-3 py-1.5 text-sm font-medium transition-colors",r.value==="condition"?"bg-white text-gray-900 shadow-sm dark:bg-gray-700 dark:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white"]),onClick:e[0]||(e[0]=i=>r.value="condition")},n(y(m)("analysis.filter.conditionMode")),3),t("button",{class:te(["rounded-md px-3 py-1.5 text-sm font-medium transition-colors",r.value==="session"?"bg-white text-gray-900 shadow-sm dark:bg-gray-700 dark:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white"]),onClick:e[1]||(e[1]=i=>r.value="session")},n(y(m)("analysis.filter.sessionMode")),3)])]),t("div",ls,[I(d,{variant:"ghost",icon:"i-heroicons-clock",size:"sm",onClick:e[2]||(e[2]=i=>F.value=!0)},{default:R(()=>[T(n(y(m)("analysis.filter.history")),1)]),_:1}),I(d,{variant:"ghost",icon:"i-heroicons-x-mark",size:"sm",onClick:e[3]||(e[3]=i=>L.value=!1)})])]),t("div",rs,[t("div",is,[t("div",ds,[r.value==="condition"?(l(),Y(We,{key:0,keywords:p.value.keywords,"onUpdate:keywords":e[4]||(e[4]=i=>p.value.keywords=i),"time-range":p.value.timeRange,"onUpdate:timeRange":e[5]||(e[5]=i=>p.value.timeRange=i),"sender-ids":p.value.senderIds,"onUpdate:senderIds":e[6]||(e[6]=i=>p.value.senderIds=i),"context-size":p.value.contextSize,"onUpdate:contextSize":e[7]||(e[7]=i=>p.value.contextSize=i)},null,8,["keywords","time-range","sender-ids","context-size"])):(l(),Y(it,{key:1,"selected-ids":k.value,"onUpdate:selectedIds":e[8]||(e[8]=i=>k.value=i)},null,8,["selected-ids"]))]),t("div",cs,[I(d,{block:"",color:"primary",loading:D.value,disabled:!j.value,onClick:E},{default:R(()=>[T(n(y(m)("analysis.filter.execute")),1)]),_:1},8,["loading","disabled"])])]),t("div",us,[I(Ht,{result:x.value,"is-loading":D.value,"is-loading-more":B.value,onLoadMore:V},null,8,["result","is-loading","is-loading-more"]),x.value&&x.value.blocks.length>0?(l(),u("div",fs,[U.value&&c.value?(l(),u("div",gs,[t("div",ys,[t("span",null,n(c.value.message),1),t("span",null,n(c.value.percentage)+"%",1)]),t("div",vs,[t("div",{class:"h-full bg-primary-500 transition-all duration-300",style:q({width:`${c.value.percentage}%`})},null,4)])])):H("",!0),t("div",ms,[I(d,{variant:"outline",icon:"i-heroicons-document-arrow-down",loading:U.value,disabled:U.value,onClick:b},{default:R(()=>[T(n(y(m)("analysis.filter.export")),1)]),_:1},8,["loading","disabled"])])])):H("",!0)])]),I(es,{open:F.value,"onUpdate:open":e[9]||(e[9]=i=>F.value=i),onLoad:A},null,8,["open"])])]),_:1},8,["open"])}}});export{Is as default};
|
|
1
|
+
import{e as de,a as le,k as ce,b as se,g as ue,r as ge}from"./vendor-nuxt-ui-CYMNNdeD.js";import{u as J,d as ne,T as ye,h as ie,f as ve,G as me,b as xe,r as he,x as G,j as pe}from"./index-BfZM-q0T.js";import{p as X,J as Q,w as W,d as re,G as l,P as u,a5 as t,R as T,T as n,u as y,L as I,K as R,Z as N,a3 as Z,H as Y,U as H,bA as ae,bB as oe,b as $,h as P,bE as fe,a0 as q,a9 as ke,Q as te,n as be,by as _e,W as we,bp as O}from"./vendor-reka-ui-CW2cIgMu.js";import{d as $e}from"./DebugToolsPanel.vue_vue_type_script_setup_true_lang-DFN1Co1H.js";import"./vendor-snapdom-XnBoh1gd.js";import"./index-CaTRpNBK.js";import"./vendor-echarts-wordcloud-uVdwYsYa.js";import"./vendor-echarts-C13vDgZW.js";import"./vendor-zrender-5DcYjSZk.js";const Se={class:"p-4 space-y-6"},Ie={class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},Ce={class:"text-gray-500 text-xs ml-1"},Te={class:"flex gap-2 mb-2"},Me={key:0,class:"flex flex-wrap gap-2"},ze=["onClick"],De={class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},Le={class:"space-y-2"},Be={key:0,class:"flex gap-2 items-center"},Fe={class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},Ue={class:"text-gray-500 text-xs ml-1"},Re={class:"max-h-60 overflow-y-auto border border-gray-200 dark:border-gray-700 rounded-md"},Pe={key:0,class:"p-4 text-center text-gray-500"},Ve={key:1,class:"p-4 text-center text-gray-500 text-sm"},He={key:2,class:"divide-y divide-gray-100 dark:divide-gray-700"},je=["checked","onChange"],Ee={class:"text-sm text-gray-700 dark:text-gray-300 truncate"},Ne={class:"text-xs text-gray-400 ml-auto"},Ae={key:0,class:"mt-2 text-xs text-gray-500"},Ke={class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},Ye={class:"text-gray-500 text-xs ml-1"},We=X({__name:"ConditionPanel",props:{keywords:{default:()=>[]},keywordsModifiers:{},timeRange:{default:null},timeRangeModifiers:{},senderIds:{default:()=>[]},senderIdsModifiers:{},contextSize:{default:10},contextSizeModifiers:{}},emits:["update:keywords","update:timeRange","update:senderIds","update:contextSize"],setup(v){const{t:C}=J(),M=ne(),h=Q(v,"keywords"),m=Q(v,"timeRange"),w=Q(v,"senderIds"),z=Q(v,"contextSize"),L=$(""),r=$([]),p=$(!1),k=$("all"),x=$(""),D=$(""),B=[{id:"all",label:"analysis.filter.allTime"},{id:"today",label:"analysis.filter.today"},{id:"week",label:"analysis.filter.lastWeek"},{id:"month",label:"analysis.filter.lastMonth"},{id:"3months",label:"analysis.filter.last3Months"},{id:"year",label:"analysis.filter.lastYear"},{id:"custom",label:"analysis.filter.customTime"}],F=P(()=>B.map(s=>({label:C(s.label),value:s.id})));W(k,()=>{a()});const j=$(null);async function E(){const s=M.currentSessionId;if(s){p.value=!0;try{r.value=await ie().getMembers(s)}catch(e){console.error("加载成员失败:",e)}finally{p.value=!1}}}async function V(){const s=M.currentSessionId;if(s)try{const e=await ie().getTimeRange(s);e&&(j.value=e)}catch(e){console.error("加载时间范围失败:",e)}}function U(){const s=L.value.trim();s&&!h.value.includes(s)&&(h.value=[...h.value,s],L.value="")}function c(s){h.value=h.value.filter(e=>e!==s)}function g(s){s.key==="Enter"&&(s.preventDefault(),U())}function o(s){w.value.includes(s)?w.value=w.value.filter(e=>e!==s):w.value=[...w.value,s]}function a(){const s=Math.floor(Date.now()/1e3),e=new Date;e.setHours(0,0,0,0);const d=Math.floor(e.getTime()/1e3);switch(k.value){case"all":m.value=null;break;case"today":m.value={start:d,end:s};break;case"week":m.value={start:s-10080*60,end:s};break;case"month":m.value={start:s-720*60*60,end:s};break;case"3months":m.value={start:s-2160*60*60,end:s};break;case"year":m.value={start:s-365*24*60*60,end:s};break;case"custom":if(x.value&&D.value){const f=new Date(x.value).getTime()/1e3,i=new Date(D.value).getTime()/1e3+86399;m.value={start:f,end:i}}break}}const b=$(""),A=P(()=>{if(!b.value)return r.value;const s=b.value.toLowerCase();return r.value.filter(e=>e.accountName?.toLowerCase().includes(s)||e.groupNickname?.toLowerCase().includes(s)||e.platformId.toLowerCase().includes(s)||e.aliases.some(d=>d.toLowerCase().includes(s)))});return re(()=>{E(),V()}),(s,e)=>{const d=de,f=le,i=se,S=ce;return l(),u("div",Se,[t("div",null,[t("label",Ie,[T(n(y(C)("analysis.filter.keywords"))+" ",1),t("span",Ce,"("+n(y(C)("analysis.filter.keywordsHint"))+")",1)]),t("div",Te,[I(d,{modelValue:L.value,"onUpdate:modelValue":e[0]||(e[0]=_=>L.value=_),placeholder:y(C)("analysis.filter.keywordPlaceholder"),class:"flex-1",onKeydown:g},null,8,["modelValue","placeholder"]),I(f,{size:"sm",onClick:U},{default:R(()=>[T(n(y(C)("common.add")),1)]),_:1})]),h.value.length>0?(l(),u("div",Me,[(l(!0),u(N,null,Z(h.value,_=>(l(),Y(S,{key:_,color:"primary",variant:"subtle",class:"gap-1"},{default:R(()=>[T(n(_)+" ",1),t("button",{class:"ml-1 hover:text-red-500",onClick:K=>c(_)},[I(i,{name:"i-heroicons-x-mark",class:"w-3 h-3"})],8,ze)]),_:2},1024))),128))])):H("",!0)]),t("div",null,[t("label",De,n(y(C)("analysis.filter.timeRange")),1),t("div",Le,[I(ye,{modelValue:k.value,"onUpdate:modelValue":e[1]||(e[1]=_=>k.value=_),items:F.value,size:"sm"},null,8,["modelValue","items"]),k.value==="custom"?(l(),u("div",Be,[ae(t("input",{"onUpdate:modelValue":e[2]||(e[2]=_=>x.value=_),type:"date",class:"flex-1 px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800",onChange:a},null,544),[[oe,x.value]]),e[6]||(e[6]=t("span",{class:"text-gray-500"},"~",-1)),ae(t("input",{"onUpdate:modelValue":e[3]||(e[3]=_=>D.value=_),type:"date",class:"flex-1 px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800",onChange:a},null,544),[[oe,D.value]])])):H("",!0)])]),t("div",null,[t("label",Fe,[T(n(y(C)("analysis.filter.senders"))+" ",1),t("span",Ue,"("+n(y(C)("analysis.filter.sendersHint"))+")",1)]),I(d,{modelValue:b.value,"onUpdate:modelValue":e[4]||(e[4]=_=>b.value=_),placeholder:y(C)("analysis.filter.searchMember"),icon:"i-heroicons-magnifying-glass",size:"sm",class:"mb-2"},null,8,["modelValue","placeholder"]),t("div",Re,[p.value?(l(),u("div",Pe,[I(i,{name:"i-heroicons-arrow-path",class:"w-5 h-5 animate-spin"})])):A.value.length===0?(l(),u("div",Ve,n(y(C)("analysis.filter.noMembers")),1)):(l(),u("div",He,[(l(!0),u(N,null,Z(A.value,_=>(l(),u("label",{key:_.id,class:"flex items-center gap-2 px-3 py-2 hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer"},[t("input",{type:"checkbox",checked:w.value.includes(_.id),class:"text-primary-500 rounded",onChange:K=>o(_.id)},null,40,je),t("span",Ee,n(_.groupNickname||_.accountName||_.platformId),1),t("span",Ne,"("+n(_.messageCount)+")",1)]))),128))]))]),w.value.length>0?(l(),u("div",Ae,n(y(C)("analysis.filter.selectedCount",{count:w.value.length})),1)):H("",!0)]),t("div",null,[t("label",Ke,[T(n(y(C)("analysis.filter.contextSize"))+" ",1),t("span",Ye,"±"+n(z.value)+" "+n(y(C)("analysis.filter.messages")),1)]),ae(t("input",{"onUpdate:modelValue":e[5]||(e[5]=_=>z.value=_),type:"range",min:"0",max:"50",step:"5",class:"w-full h-2 bg-gray-200 dark:bg-gray-700 rounded-lg appearance-none cursor-pointer"},null,512),[[oe,z.value,void 0,{number:!0}]]),e[7]||(e[7]=t("div",{class:"flex justify-between text-xs text-gray-400 mt-1"},[t("span",null,"0"),t("span",null,"25"),t("span",null,"50")],-1))])])}}}),Ge={class:"p-4 flex flex-col h-full min-h-0"},Oe={key:0,class:"flex-none mb-2 text-sm text-primary-500"},Qe={class:"flex-1 min-h-0"},Ze={key:0,class:"flex items-center justify-center h-full"},qe={key:1,class:"flex items-center justify-center h-full text-gray-500 text-sm"},Je=["onClick"],Xe={class:"text-sm font-medium text-gray-700 dark:text-gray-300"},et={class:"flex items-center gap-2"},tt={class:"text-xs text-gray-500"},st=["checked","onChange"],nt=["checked","onChange"],at={class:"flex-1 min-w-0"},ot={class:"flex items-center gap-2"},lt={class:"text-sm text-gray-700 dark:text-gray-300"},rt={class:"flex items-center gap-2 text-xs text-gray-500"},it=X({__name:"SessionPanel",props:{selectedIds:{default:()=>[]},selectedIdsModifiers:{}},emits:["update:selectedIds"],setup(v){const{t:C}=J(),M=ne(),h=Q(v,"selectedIds"),m=$(new Set);W(h,c=>{m.value=new Set(c)},{immediate:!0});const w=$([]),z=$(!1),L=$(null),r=P(()=>{const c={};for(const a of w.value){const b=new Date(a.startTs*1e3).toLocaleDateString();c[b]||(c[b]=[]),c[b].push(a)}const g=Object.keys(c).sort((a,b)=>new Date(b).getTime()-new Date(a).getTime()),o=[];for(const a of g){o.push({type:"date",date:a,sessionCount:c[a].length});for(const b of c[a])o.push({type:"session",session:b,date:a})}return o}),p=fe(P(()=>({count:r.value.length,getScrollElement:()=>L.value,estimateSize:c=>r.value[c]?.type==="date"?36:56,overscan:10}))),k=P(()=>p.value.getVirtualItems());async function x(){const c=M.currentSessionId;if(c){z.value=!0;try{w.value=await ve().getSessions(c)}catch(g){console.error("加载会话失败:",g)}finally{z.value=!1}}}function D(c){return m.value.has(c)}function B(c){const g=new Set(m.value);g.has(c)?g.delete(c):g.add(c),m.value=g,h.value=Array.from(g)}function F(c){return r.value.filter(g=>g.type==="session"&&g.date===c).map(g=>g.session.id)}function j(c){const g=F(c),o=g.every(b=>m.value.has(b)),a=new Set(m.value);if(o)for(const b of g)a.delete(b);else for(const b of g)a.add(b);m.value=a,h.value=Array.from(a)}function E(c){const g=F(c);return g.length>0&&g.every(o=>m.value.has(o))}function V(c){return new Date(c*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}function U(c,g){const o=g-c;return o<60?`${o}秒`:o<3600?`${Math.floor(o/60)}分钟`:`${Math.floor(o/3600)}小时${Math.floor(o%3600/60)}分钟`}return re(()=>{x()}),(c,g)=>{const o=se;return l(),u("div",Ge,[h.value.length>0?(l(),u("div",Oe,n(y(C)("analysis.filter.selectedSessions",{count:h.value.length})),1)):H("",!0),t("div",Qe,[z.value?(l(),u("div",Ze,[I(o,{name:"i-heroicons-arrow-path",class:"w-6 h-6 animate-spin text-gray-400"})])):w.value.length===0?(l(),u("div",qe,n(y(C)("analysis.filter.noSessions")),1)):(l(),u("div",{key:2,ref_key:"scrollContainerRef",ref:L,class:"h-full overflow-y-auto"},[t("div",{style:q({height:`${y(p).getTotalSize()}px`,position:"relative"})},[(l(!0),u(N,null,Z(k.value,a=>(l(),u("div",{key:String(a.key),style:q({position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${a.start}px)`})},[r.value[a.index].type==="date"?(l(),u("div",{key:0,class:"flex items-center justify-between px-2 py-1.5 bg-gray-100 dark:bg-gray-800 rounded-md cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700",onClick:b=>j(r.value[a.index].date)},[t("span",Xe,n(r.value[a.index].date),1),t("div",et,[t("span",tt,n(r.value[a.index].sessionCount)+" 个会话",1),t("input",{type:"checkbox",checked:E(r.value[a.index].date),class:"text-primary-500 rounded",onClick:g[0]||(g[0]=ke(()=>{},["stop"])),onChange:b=>j(r.value[a.index].date)},null,40,st)])],8,Je)):(l(),u("label",{key:1,class:te(["flex items-center gap-3 px-3 py-2 ml-2 rounded-md hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer border border-transparent",{"border-primary-300 bg-primary-50 dark:border-primary-600 dark:bg-primary-900/20":D(r.value[a.index].session.id)}])},[t("input",{type:"checkbox",checked:D(r.value[a.index].session.id),class:"text-primary-500 rounded",onChange:b=>B(r.value[a.index].session.id)},null,40,nt),t("div",at,[t("div",ot,[t("span",lt,n(V(r.value[a.index].session.startTs))+" - "+n(V(r.value[a.index].session.endTs)),1)]),t("div",rt,[t("span",null,n(r.value[a.index].session.messageCount)+" 条消息",1),g[1]||(g[1]=t("span",null,"·",-1)),t("span",null,n(U(r.value[a.index].session.startTs,r.value[a.index].session.endTs)),1)])])],2))],4))),128))],4)],512))])])}}}),dt={class:"flex-1 flex flex-col overflow-hidden bg-gray-50 dark:bg-gray-900"},ct={key:0,class:"flex-none px-4 py-3 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"},ut={class:"flex items-center justify-between mb-2"},ft={class:"flex items-center gap-6 text-sm"},gt={class:"text-gray-600 dark:text-gray-400"},yt={class:"font-medium text-gray-900 dark:text-white"},vt={class:"text-gray-600 dark:text-gray-400"},mt={class:"font-medium text-gray-900 dark:text-white"},xt={class:"text-gray-600 dark:text-gray-400"},ht={class:"font-medium text-primary-500"},pt={class:"text-gray-600 dark:text-gray-400"},kt={class:"font-medium text-gray-900 dark:text-white"},bt={class:"flex-1 min-h-0 flex overflow-hidden"},_t={key:1,class:"w-full h-full flex items-center justify-center"},wt={class:"text-center text-gray-400"},$t={key:2,class:"flex-1 flex items-center justify-center"},St={class:"text-center text-gray-400"},It={class:"w-64 flex-none border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col"},Ct={class:"flex-none px-3 py-2 border-b border-gray-200 dark:border-gray-700"},Tt={class:"text-sm font-medium text-gray-700 dark:text-gray-300"},Mt=["onClick"],zt={class:"flex items-center justify-between mb-1"},Dt={class:"text-sm font-medium text-gray-700 dark:text-gray-300"},Lt={key:0,class:"text-xs text-primary-500"},Bt={class:"text-xs text-gray-500"},Ft={class:"flex items-center gap-2 text-xs text-gray-400 mt-1"},Ut={key:0,class:"py-3 text-center text-sm text-gray-500 dark:text-gray-400 border-t border-gray-100 dark:border-gray-700"},Rt={key:1,class:"py-3 text-center text-xs text-gray-400 dark:text-gray-500"},Pt={class:"flex-1 overflow-hidden"},Vt={key:1,class:"flex items-center justify-center h-full text-gray-400"},Ht=X({__name:"PreviewPanel",props:{result:{},isLoading:{type:Boolean},isLoadingMore:{type:Boolean}},emits:["load-more"],setup(v,{emit:C}){const{t:M}=J(),h=v,m=C,w=$(0);let z=!1;const L=$(null),r=$(null),p=$(null);function k(s){if(!h.result)return null;const e=h.result.blocks.length-1-s;return h.result.blocks[e]}const x=P(()=>h.result?.blocks.length??0),D=fe(P(()=>({count:x.value,getScrollElement:()=>p.value,estimateSize:()=>72,overscan:5}))),B=P(()=>D.value.getVirtualItems()),F=P(()=>{if(x.value===0)return[];const s=k(w.value);return s?s.messages.map(e=>({id:e.id,senderName:e.senderName,senderPlatformId:e.senderPlatformId,senderAliases:e.senderAliases,senderAvatar:e.senderAvatar,content:e.content,timestamp:e.timestamp,type:e.type,replyToMessageId:e.replyToMessageId,replyToContent:e.replyToContent,replyToSenderName:e.replyToSenderName})):[]}),j=P(()=>{if(x.value===0)return[];const s=k(w.value);return s?s.messages.filter(e=>e.isHit).map(e=>e.id):[]}),E={startTs:0,endTs:0},V=P(()=>{if(!h.result||h.result.blocks.length===0)return!1;const s=h.result.blocks,e=new Date(s[0].startTs*1e3).getFullYear(),d=new Date(s[s.length-1].endTs*1e3).getFullYear();return e!==d});function U(s){const e={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return V.value&&(e.year="numeric"),new Date(s*1e3).toLocaleString("zh-CN",e)}function c(s,e){const d=e-s;return d<60?`${d}秒`:d<3600?`${Math.floor(d/60)}分钟`:`${Math.floor(d/3600)}h${Math.floor(d%3600/60)}m`}function g(s){w.value=s;const e=k(s);if(e){const d=e.messages.find(f=>f.isHit);d&&(L.value=d.id)}}function o(){z||x.value!==0&&w.value<x.value-1&&(z=!0,w.value++,b(w.value),setTimeout(()=>{z=!1},300))}function a(){}function b(s){D.value.scrollToIndex(s,{align:"center"})}W(()=>h.result,()=>{w.value=0,L.value=null}),W(L,async s=>{s!==null&&(await be(),setTimeout(()=>{r.value?.scrollToMessage(s),L.value=null},100))});function A(s){const e=s.target;if(!e||!h.result?.pagination?.hasMore||h.isLoadingMore)return;const d=100,{scrollTop:f,scrollHeight:i,clientHeight:S}=e;i-f-S<d&&m("load-more")}return(s,e)=>{const d=se;return l(),u("div",dt,[v.result&&v.result.blocks.length>0?(l(),u("div",ct,[t("div",ut,[t("div",ft,[t("span",gt,[T(n(y(M)("analysis.filter.stats.blocks"))+": ",1),t("span",yt,[T(n(v.result.blocks.length)+" ",1),v.result.pagination&&v.result.pagination.totalBlocks>v.result.blocks.length?(l(),u(N,{key:0},[T(" / "+n(v.result.pagination.totalBlocks),1)],64)):H("",!0)])]),t("span",vt,[T(n(y(M)("analysis.filter.stats.messages"))+": ",1),t("span",mt,n(v.result.stats.totalMessages),1)]),t("span",xt,[T(n(y(M)("analysis.filter.stats.hits"))+": ",1),t("span",ht,n(v.result.pagination?.totalHits??v.result.stats.hitMessages),1)]),t("span",pt,[T(n(y(M)("analysis.filter.stats.chars"))+": ",1),t("span",kt,n(v.result.stats.totalChars.toLocaleString()),1)])])])])):H("",!0),t("div",bt,[v.isLoading?(l(),Y($e,{key:0,variant:"page",text:y(M)("analysis.filter.filtering")},null,8,["text"])):v.result?v.result.blocks.length===0?(l(),u("div",$t,[t("div",St,[I(d,{name:"i-heroicons-magnifying-glass",class:"w-12 h-12 mb-3 mx-auto"}),t("p",null,n(y(M)("analysis.filter.noResults")),1)])])):(l(),u(N,{key:3},[t("div",It,[t("div",Ct,[t("span",Tt,[T(n(y(M)("analysis.filter.stats.blocks"))+" ("+n(v.result.blocks.length)+" ",1),v.result.pagination&&v.result.pagination.totalBlocks>v.result.blocks.length?(l(),u(N,{key:0},[T(" /"+n(v.result.pagination.totalBlocks),1)],64)):H("",!0),e[1]||(e[1]=T(" ) ",-1))])]),t("div",{ref_key:"blockListRef",ref:p,class:"flex-1 overflow-y-auto",onScroll:A},[t("div",{style:q({height:`${y(D).getTotalSize()}px`,position:"relative"})},[(l(!0),u(N,null,Z(B.value,f=>(l(),u("div",{key:String(f.key),style:q({position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${f.start}px)`})},[t("div",{class:te(["px-3 py-2 cursor-pointer border-b border-gray-100 dark:border-gray-700 transition-colors",w.value===f.index?"bg-primary-50 dark:bg-primary-900/30 border-l-2 border-l-primary-500":"hover:bg-gray-50 dark:hover:bg-gray-700/50"]),onClick:i=>g(f.index)},[t("div",zt,[t("span",Dt," #"+n(f.index+1),1),(k(f.index)?.hitCount??0)>0?(l(),u("span",Lt," 含 "+n(k(f.index)?.hitCount)+" 个结果 ",1)):H("",!0)]),t("div",Bt,n(U(k(f.index)?.startTs??0)),1),t("div",Ft,[t("span",null,n(k(f.index)?.messages.length??0)+" 条",1),e[2]||(e[2]=t("span",null,"·",-1)),t("span",null,n(c(k(f.index)?.startTs??0,k(f.index)?.endTs??0)),1)])],10,Mt)],4))),128))],4),v.result.pagination?.hasMore?(l(),u("div",Ut,[v.isLoadingMore?(l(),u(N,{key:0},[I(d,{name:"i-heroicons-arrow-path",class:"w-4 h-4 animate-spin inline mr-1"}),T(" "+n(y(M)("common.loading")),1)],64)):(l(),u("button",{key:1,class:"text-primary-500 hover:text-primary-600",onClick:e[0]||(e[0]=f=>m("load-more"))},n(y(M)("analysis.filter.loadMore")),1))])):v.result.pagination&&v.result.blocks.length>=v.result.pagination.totalBlocks?(l(),u("div",Rt,n(y(M)("analysis.filter.allLoaded")),1)):H("",!0)],544)]),t("div",Pt,[F.value.length>0?(l(),Y(me,{key:0,ref_key:"messageListRef",ref:r,query:E,"external-messages":F.value,"hit-message-ids":j.value,class:"h-full",onReachBottom:o,onReachTop:a},null,8,["external-messages","hit-message-ids"])):(l(),u("div",Vt,n(y(M)("analysis.filter.noResults")),1))])],64)):(l(),u("div",_t,[t("div",wt,[I(d,{name:"i-heroicons-funnel",class:"w-12 h-12 mb-3 mx-auto"}),t("p",null,n(y(M)("analysis.filter.emptyHint")),1)])]))])])}}}),jt={class:"flex items-center justify-between"},Et={class:"text-lg font-semibold"},Nt={class:"max-h-96 overflow-y-auto"},At={key:0,class:"py-8 text-center text-gray-500"},Kt={key:1,class:"divide-y divide-gray-200 dark:divide-gray-700"},Yt={class:"flex items-start justify-between gap-2"},Wt={class:"flex-1 min-w-0"},Gt={key:0,class:"flex items-center gap-2 mb-1"},Ot={key:1,class:"flex items-center gap-2 mb-1"},Qt={class:"font-medium text-gray-900 dark:text-white"},Zt=["onClick"],qt={class:"text-sm text-gray-600 dark:text-gray-400 truncate"},Jt={class:"text-xs text-gray-400 mt-1"},Xt={class:"flex items-center gap-1"},es=X({__name:"FilterHistory",props:{open:{type:Boolean,default:!1},openModifiers:{}},emits:we(["load"],["update:open"]),setup(v,{expose:C,emit:M}){const{t:h}=J(),m=ne(),w=xe(),z=Q(v,"open"),L=M,r=$([]);let p=[];const k=$(null),x=$("");async function D(){try{p=(await w.getPreferences()).filterHistory??[],r.value=p.filter(a=>a.sessionId===m.currentSessionId)}catch(o){console.error("Failed to load filter history:",o)}}function B(){p=[...p.filter(a=>a.sessionId!==m.currentSessionId),...r.value],w.savePreferences({filterHistory:p}).catch(a=>{console.error("Failed to save filter history:",a)})}function F(o){r.value=r.value.filter(a=>a.id!==o),B()}function j(o){L("load",{mode:o.mode,conditionFilter:o.conditionFilter,selectedSessionIds:o.selectedSessionIds})}function E(o){k.value=o.id,x.value=o.name}function V(o){o.name=x.value||o.name,k.value=null,B()}function U(){k.value=null}function c(o){return new Date(o).toLocaleString()}function g(o){if(o.mode==="condition"){const a=[];return o.conditionFilter?.keywords.length&&a.push(`关键词: ${o.conditionFilter.keywords.join(", ")}`),o.conditionFilter?.senderIds.length&&a.push(`${o.conditionFilter.senderIds.length} 位成员`),a.join(" | ")||"无条件"}else return`${o.selectedSessionIds?.length||0} 个会话`}return W(z,o=>{o&&D()}),re(()=>{D()}),C({saveCondition(o){const a={id:`filter_${Date.now()}`,sessionId:m.currentSessionId||"",createdAt:Date.now(),name:`筛选 ${r.value.length+1}`,...o};r.value.unshift(a),r.value=r.value.slice(0,20),B()}}),(o,a)=>{const b=le,A=de,s=ce,e=se,d=ge,f=ue;return l(),Y(f,{open:z.value,"onUpdate:open":a[2]||(a[2]=i=>z.value=i)},{content:R(()=>[I(d,null,{header:R(()=>[t("div",jt,[t("h3",Et,n(y(h)("analysis.filter.historyTitle")),1),I(b,{variant:"ghost",icon:"i-heroicons-x-mark",size:"sm",onClick:a[0]||(a[0]=i=>z.value=!1)})])]),default:R(()=>[t("div",Nt,[r.value.length===0?(l(),u("div",At,n(y(h)("analysis.filter.noHistory")),1)):(l(),u("div",Kt,[(l(!0),u(N,null,Z(r.value,i=>(l(),u("div",{key:i.id,class:"py-3 hover:bg-gray-50 dark:hover:bg-gray-800 px-2 rounded-md"},[t("div",Yt,[t("div",Wt,[k.value===i.id?(l(),u("div",Gt,[I(A,{modelValue:x.value,"onUpdate:modelValue":a[1]||(a[1]=S=>x.value=S),size:"sm",class:"flex-1",onKeydown:_e(S=>V(i),["enter"])},null,8,["modelValue","onKeydown"]),I(b,{size:"xs",onClick:S=>V(i)},{default:R(()=>[T(n(y(h)("common.save")),1)]),_:1},8,["onClick"]),I(b,{size:"xs",variant:"ghost",onClick:U},{default:R(()=>[T(n(y(h)("common.cancel")),1)]),_:1})])):(l(),u("div",Ot,[t("span",Qt,n(i.name),1),I(s,{color:i.mode==="condition"?"primary":"green",size:"xs"},{default:R(()=>[T(n(i.mode==="condition"?"条件":"会话"),1)]),_:2},1032,["color"]),t("button",{class:"text-gray-400 hover:text-gray-600",onClick:S=>E(i)},[I(e,{name:"i-heroicons-pencil",class:"w-3 h-3"})],8,Zt)])),t("p",qt,n(g(i)),1),t("p",Jt,n(c(i.createdAt)),1)]),t("div",Xt,[I(b,{size:"xs",variant:"soft",onClick:S=>j(i)},{default:R(()=>[T(n(y(h)("common.load")),1)]),_:1},8,["onClick"]),I(b,{size:"xs",variant:"ghost",color:"red",onClick:S=>F(i.id)},{default:R(()=>[I(e,{name:"i-heroicons-trash",class:"w-4 h-4"})]),_:1},8,["onClick"])])])]))),128))]))])]),_:1})]),_:1},8,["open"])}}}),ts={class:"flex h-[85vh] flex-col overflow-hidden bg-white dark:bg-gray-900"},ss={class:"flex flex-none items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-700"},ns={class:"flex items-center gap-4"},as={class:"text-lg font-semibold text-gray-900 dark:text-white"},os={class:"flex items-center gap-1 rounded-lg bg-gray-100 p-1 dark:bg-gray-800"},ls={class:"flex items-center gap-2"},rs={class:"flex flex-1 overflow-hidden"},is={class:"flex w-80 flex-none flex-col border-r border-gray-200 dark:border-gray-700"},ds={class:"min-h-0 flex-1 overflow-y-auto"},cs={class:"flex-none border-t border-gray-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-900"},us={class:"flex flex-1 flex-col overflow-hidden"},fs={key:0,class:"flex flex-none flex-col gap-2 border-t border-gray-200 bg-gray-50 px-4 py-3 dark:border-gray-700 dark:bg-gray-800"},gs={key:0,class:"w-full"},ys={class:"mb-1 flex items-center justify-between text-sm text-gray-600 dark:text-gray-400"},vs={class:"h-2 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700"},ms={class:"flex items-center justify-end gap-3"},ee=50,Is=X({__name:"MessageExportModal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(v,{emit:C}){const M=v,h=C,{t:m}=J(),w=he(),z=ne(),L=P({get:()=>M.modelValue,set:s=>h("update:modelValue",s)}),r=$("condition"),p=$({keywords:[],timeRange:null,senderIds:[],contextSize:10}),k=$([]),x=$(null),D=$(!1),B=$(!1),F=$(!1),j=P(()=>D.value?!1:r.value==="condition"?p.value.keywords.length>0||p.value.senderIds.length>0||p.value.timeRange!==null:k.value.length>0);async function E(){const s=z.currentSessionId;if(s){D.value=!0,x.value=null;try{if(r.value==="condition"){const e=O(p.value),d=e.keywords.length>0?[...e.keywords]:void 0,f=e.timeRange?{startTs:e.timeRange.start,endTs:e.timeRange.end}:void 0,i=e.senderIds.length>0?[...e.senderIds]:void 0,S=e.contextSize,_=await G().filterMessagesWithContext(s,d,f,i,S,1,ee);x.value=_}else{if(k.value.length===0)return;const e=[...O(k.value)],d=await G().getMultipleSessionsMessages(s,e,1,ee);x.value=d}}catch(e){console.error("筛选失败:",e)}finally{D.value=!1}}}async function V(){const s=z.currentSessionId;if(!s||!x.value||!x.value.pagination.hasMore||B.value)return;B.value=!0;const e=x.value.pagination.page+1;try{let d;if(r.value==="condition"){const f=O(p.value),i=f.keywords.length>0?[...f.keywords]:void 0,S=f.timeRange?{startTs:f.timeRange.start,endTs:f.timeRange.end}:void 0,_=f.senderIds.length>0?[...f.senderIds]:void 0,K=f.contextSize;d=await G().filterMessagesWithContext(s,i,S,_,K,e,ee)}else{const f=[...O(k.value)];d=await G().getMultipleSessionsMessages(s,f,e,ee)}d&&d.blocks.length>0&&(x.value={blocks:[...x.value.blocks,...d.blocks],stats:x.value.stats,pagination:d.pagination})}catch(d){console.error("加载更多失败:",d)}finally{B.value=!1}}const U=$(!1),c=$(null);let g=null;function o(){g=G().onExportProgress(s=>{c.value={percentage:s.percentage,message:s.message},(s.stage==="done"||s.stage==="error")&&(c.value=null)})}function a(){g&&(g(),g=null),c.value=null}async function b(){if(!x.value||x.value.blocks.length===0)return;const s=z.currentSessionId;if(!s)return;const d=z.currentSession?.name||"未知会话",f=await pe().showOpenDialog({title:"选择保存目录",properties:["openDirectory","createDirectory"]});if(f.canceled||!f.filePaths[0])return;const i=f.filePaths[0];U.value=!0,c.value={percentage:0,message:m("analysis.filter.exportPreparing")},o();try{const S=O(p.value),_={sessionId:s,sessionName:d,outputDir:i,filterMode:r.value,keywords:S.keywords.length>0?[...S.keywords]:void 0,timeFilter:S.timeRange?{startTs:S.timeRange.start,endTs:S.timeRange.end}:void 0,senderIds:S.senderIds.length>0?[...S.senderIds]:void 0,contextSize:S.contextSize,chatSessionIds:r.value==="session"?[...O(k.value)]:void 0},K=await G().exportFilterResultToFile(_);K.success&&K.filePath?w.success(m("analysis.filter.exportSuccess"),{description:K.filePath}):w.fail(m("analysis.filter.exportFailed"),{description:K.error||m("common.error.unknown")})}catch(S){console.error("导出失败:",S),w.fail(m("analysis.filter.exportFailed"),{description:String(S)})}finally{a(),U.value=!1}}W(r,()=>{x.value=null}),W(L,s=>{s||(x.value=null,a())});function A(s){r.value=s.mode,s.mode==="condition"&&s.conditionFilter?p.value={...s.conditionFilter}:s.mode==="session"&&s.selectedSessionIds&&(k.value=[...s.selectedSessionIds]),F.value=!1}return(s,e)=>{const d=le,f=ue;return l(),Y(f,{open:L.value,"onUpdate:open":e[10]||(e[10]=i=>L.value=i),ui:{content:"sm:max-w-[95vw]"}},{content:R(()=>[t("div",ts,[t("div",ss,[t("div",ns,[t("h2",as,n(y(m)("analysis.messageExport.title")),1),t("div",os,[t("button",{class:te(["rounded-md px-3 py-1.5 text-sm font-medium transition-colors",r.value==="condition"?"bg-white text-gray-900 shadow-sm dark:bg-gray-700 dark:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white"]),onClick:e[0]||(e[0]=i=>r.value="condition")},n(y(m)("analysis.filter.conditionMode")),3),t("button",{class:te(["rounded-md px-3 py-1.5 text-sm font-medium transition-colors",r.value==="session"?"bg-white text-gray-900 shadow-sm dark:bg-gray-700 dark:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white"]),onClick:e[1]||(e[1]=i=>r.value="session")},n(y(m)("analysis.filter.sessionMode")),3)])]),t("div",ls,[I(d,{variant:"ghost",icon:"i-heroicons-clock",size:"sm",onClick:e[2]||(e[2]=i=>F.value=!0)},{default:R(()=>[T(n(y(m)("analysis.filter.history")),1)]),_:1}),I(d,{variant:"ghost",icon:"i-heroicons-x-mark",size:"sm",onClick:e[3]||(e[3]=i=>L.value=!1)})])]),t("div",rs,[t("div",is,[t("div",ds,[r.value==="condition"?(l(),Y(We,{key:0,keywords:p.value.keywords,"onUpdate:keywords":e[4]||(e[4]=i=>p.value.keywords=i),"time-range":p.value.timeRange,"onUpdate:timeRange":e[5]||(e[5]=i=>p.value.timeRange=i),"sender-ids":p.value.senderIds,"onUpdate:senderIds":e[6]||(e[6]=i=>p.value.senderIds=i),"context-size":p.value.contextSize,"onUpdate:contextSize":e[7]||(e[7]=i=>p.value.contextSize=i)},null,8,["keywords","time-range","sender-ids","context-size"])):(l(),Y(it,{key:1,"selected-ids":k.value,"onUpdate:selectedIds":e[8]||(e[8]=i=>k.value=i)},null,8,["selected-ids"]))]),t("div",cs,[I(d,{block:"",color:"primary",loading:D.value,disabled:!j.value,onClick:E},{default:R(()=>[T(n(y(m)("analysis.filter.execute")),1)]),_:1},8,["loading","disabled"])])]),t("div",us,[I(Ht,{result:x.value,"is-loading":D.value,"is-loading-more":B.value,onLoadMore:V},null,8,["result","is-loading","is-loading-more"]),x.value&&x.value.blocks.length>0?(l(),u("div",fs,[U.value&&c.value?(l(),u("div",gs,[t("div",ys,[t("span",null,n(c.value.message),1),t("span",null,n(c.value.percentage)+"%",1)]),t("div",vs,[t("div",{class:"h-full bg-primary-500 transition-all duration-300",style:q({width:`${c.value.percentage}%`})},null,4)])])):H("",!0),t("div",ms,[I(d,{variant:"outline",icon:"i-heroicons-document-arrow-down",loading:U.value,disabled:U.value,onClick:b},{default:R(()=>[T(n(y(m)("analysis.filter.export")),1)]),_:1},8,["loading","disabled"])])])):H("",!0)])]),I(es,{open:F.value,"onUpdate:open":e[9]||(e[9]=i=>F.value=i),onLoad:A},null,8,["open"])])]),_:1},8,["open"])}}});export{Is as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(c){return typeof c=="string"?c:window.electron?.webUtils?.getPathForFile?.(c)??null}class m{async importFile(n,s,t){const a=o(n);return a?new Promise(i=>{const e=window.chatApi.onImportProgress(r=>{t?.({stage:r.stage||"parsing",progress:r.percentage||r.progress||0,message:r.message||"",bytesRead:r.bytesRead,totalBytes:r.totalBytes,messagesProcessed:r.messagesProcessed})});(s&&(s.formatId||s.chatIndex!==void 0)?window.chatApi.importWithOptions(a,s):window.chatApi.import(a)).then(r=>{e(),i({success:r.success,sessionId:r.sessionId,error:r.error,diagnostics:r.diagnostics})}).catch(r=>{e(),i({success:!1,error:r.message})})}):{success:!1,error:"Cannot get file path in Electron"}}async detectFormat(n){const s=o(n);if(!s)return null;const t=await window.chatApi.detectFormat(s);return t?{...t,extensions:t.extensions??[]}:null}async scanMultiChatFile(n){const s=o(n);if(!s)return[];const t=await window.chatApi.scanMultiChatFile(s);return!t.success||!t.chats?[]:t.chats}getSupportedFormats(){return window.chatApi.getSupportedFormats()}async importDemo(n,s){const t=window.chatApi.onDemoProgress(a=>{(a.stage==="downloading"||a.stage==="importing")&&s?.({stage:a.stage})});try{return await window.chatApi.importDemo(n)}finally{t()}}async analyzeIncrementalImport(n,s){const t=o(s);return t?window.chatApi.analyzeIncrementalImport(n,t):{newMessageCount:0,duplicateCount:0,totalInFile:0,error:"Cannot resolve file path"}}async incrementalImport(n,s,t){const a=o(s);if(!a)return{success:!1,newMessageCount:0,error:"Cannot resolve file path"};const i=window.chatApi.onImportProgress(e=>{t?.(e)});try{return await window.chatApi.incrementalImport(n,a)}finally{i()}}async importDirectory(n,s,t){return typeof n!="string"?{success:!1,error:"Expected directory path in Electron mode"}:new Promise(a=>{const i=window.chatApi.onImportProgress(e=>{t?.({stage:e.stage||"parsing",progress:e.percentage||e.progress||0,message:e.message||"",bytesRead:e.bytesRead,totalBytes:e.totalBytes,messagesProcessed:e.messagesProcessed})});window.chatApi.importDirectory(n).then(e=>{i(),a({success:e.success,sessionId:e.sessionId,error:e.error,diagnostics:e.diagnostics})}).catch(e=>{i(),a({success:!1,error:e.message})})})}}export{m as ElectronImportAdapter};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{F as w}from"./index-
|
|
1
|
+
import{F as w}from"./index-BfZM-q0T.js";import"./vendor-reka-ui-CW2cIgMu.js";import"./vendor-nuxt-ui-CYMNNdeD.js";import"./vendor-snapdom-XnBoh1gd.js";const x=`
|
|
2
2
|
msg.id,
|
|
3
3
|
m.id as senderId,
|
|
4
4
|
COALESCE(m.group_nickname, m.account_name, m.platform_id) as senderName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as n}from"./index-
|
|
1
|
+
import{F as n}from"./index-BfZM-q0T.js";import"./vendor-reka-ui-CW2cIgMu.js";import"./vendor-nuxt-ui-CYMNNdeD.js";import"./vendor-snapdom-XnBoh1gd.js";function a(){return n("data")}class g{async generate(s,e=1800){const t=await fetch(`/_web/sessions/${s}/generate-index`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gapThreshold:e})});if(!t.ok)throw new Error(`Failed to generate session index: ${t.status}`);return(await t.json()).sessionCount}async hasIndex(s){return(await this.getStats(s)).hasIndex}async getStats(s){try{const t=(await a().pluginQuery(s,"SELECT COUNT(*) as cnt FROM chat_session",[]))[0]?.cnt??0;return{hasIndex:t>0,sessionCount:t,gapThreshold:1800}}catch{return{hasIndex:!1,sessionCount:0,gapThreshold:1800}}}async clear(s){return await fetch(`/_web/sessions/${s}/clear-index`,{method:"POST"}),!0}async updateGapThreshold(s,e){return!0}async getSessions(s){return a().pluginQuery(s,"SELECT id, start_ts as startTs, end_ts as endTs, message_count as messageCount, summary FROM chat_session ORDER BY start_ts ASC",[])}async getByTimeRange(s,e,t){return a().pluginQuery(s,"SELECT id, start_ts as startTs, end_ts as endTs, message_count as messageCount, summary FROM chat_session WHERE start_ts >= ? AND end_ts <= ? ORDER BY start_ts ASC",[e,t])}async getRecent(s,e){return a().pluginQuery(s,"SELECT id, start_ts as startTs, end_ts as endTs, message_count as messageCount, summary FROM chat_session ORDER BY start_ts DESC LIMIT ?",[e])}async generateSummary(){return{success:!1,error:"Not available in web mode"}}async generateSummaries(){return{success:0,failed:0,skipped:0}}async checkCanGenerateSummary(s,e){return{}}}export{g as FetchSessionIndexAdapter};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{get as w}from"./http-CeXMt-Fv.js";const d="/_web";async function m(h,s,o){const t=h.body?.getReader();if(!t)return s;const e=new TextDecoder;let r="",n=s;for(;;){const{done:f,value:l}=await t.read();if(f)break;r+=e.decode(l,{stream:!0});const u=r.split(`
|
|
2
|
+
`);r=u.pop()||"";let i="";for(const a of u)if(a.startsWith("event: "))i=a.slice(7).trim();else if(a.startsWith("data: ")){const c=JSON.parse(a.slice(6));i==="progress"?o?.(c):(i==="done"||i==="error")&&(n=c),i=""}}return n}class g{async importFile(s,o,t){if(typeof s=="string")return{success:!1,error:"File path import is not supported in Web mode"};const e=new FormData;e.append("file",s),o?.formatId&&e.append("formatId",o.formatId),o?.chatIndex!==void 0&&e.append("chatIndex",String(o.chatIndex));const r=await fetch(`${d}/import`,{method:"POST",body:e});if(!r.ok){const n=await r.text();return{success:!1,error:`HTTP ${r.status}: ${n}`}}return m(r,{success:!1,error:"Unknown error"},t)}async detectFormat(s){if(typeof s=="string")return null;const o=new FormData;o.append("file",s);const t=await fetch(`${d}/detect-format`,{method:"POST",body:o});return t.ok?(await t.json()).format:null}async scanMultiChatFile(s){if(typeof s=="string")return[];const o=new FormData;o.append("file",s);const t=await fetch(`${d}/scan-multi-chat`,{method:"POST",body:o});return t.ok?(await t.json()).chats:[]}getSupportedFormats(){return w("/supported-formats")}async importDemo(s,o){return new Promise(t=>{fetch(`${d}/demo/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:s})}).then(async e=>{if(!e.ok||!e.body){t({success:!1,error:`HTTP ${e.status}`});return}const r=e.body.getReader(),n=new TextDecoder;let f="";for(;;){const{done:l,value:u}=await r.read();if(l)break;f+=n.decode(u,{stream:!0});const i=f.split(`
|
|
3
|
+
`);f=i.pop()||"";let a="";for(const c of i)if(c.startsWith("event: "))a=c.slice(7).trim();else if(c.startsWith("data: ")){const p=JSON.parse(c.slice(6));if(a==="progress")(p.stage==="downloading"||p.stage==="importing")&&o?.({stage:p.stage});else if(a==="result"){t(p);return}a=""}}t({success:!1,error:"Stream ended without result"})}).catch(e=>t({success:!1,error:String(e)}))})}async analyzeIncrementalImport(s,o){if(typeof o=="string")return{newMessageCount:0,duplicateCount:0,totalInFile:0,error:"File path not supported in Web mode"};const t=new FormData;t.append("file",o);const e=await fetch(`${d}/sessions/${s}/import/incremental/analyze`,{method:"POST",body:t});if(!e.ok){const r=await e.text();return{newMessageCount:0,duplicateCount:0,totalInFile:0,error:`HTTP ${e.status}: ${r}`}}return await e.json()}async incrementalImport(s,o,t){if(typeof o=="string")return{success:!1,newMessageCount:0,error:"File path not supported in Web mode"};const e=new FormData;e.append("file",o);const r=await fetch(`${d}/sessions/${s}/import/incremental`,{method:"POST",body:e});if(!r.ok){const n=await r.text();return{success:!1,newMessageCount:0,error:`HTTP ${r.status}: ${n}`}}return m(r,{success:!1,newMessageCount:0,error:"Unknown error"},t)}async importDirectory(s,o,t){if(typeof s=="string")return{success:!1,error:"Directory path import is not supported in Web mode"};if(s.length===0)return{success:!1,error:"No files in directory"};const e=new FormData;for(const n of s)e.append("files",n),e.append("relativePaths",n.webkitRelativePath||n.name);const r=await fetch(`${d}/import-directory`,{method:"POST",body:e});if(!r.ok){const n=await r.text();return{success:!1,error:`HTTP ${r.status}: ${n}`}}return m(r,{success:!1,error:"Unknown error"},t)}}export{g as FetchImportAdapter};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EChartWordcloud-
|
|
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,o as ot,C as it,u as rt,d as lt}from"./vendor-nuxt-ui-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EChartWordcloud-BYLFxPAX.js","assets/vendor-echarts-wordcloud-uVdwYsYa.js","assets/vendor-echarts-C13vDgZW.js","assets/vendor-zrender-5DcYjSZk.js","assets/vendor-reka-ui-CW2cIgMu.js","assets/MessageExportModal-BAf68-wB.js","assets/vendor-nuxt-ui-CYMNNdeD.js","assets/index-BfZM-q0T.js","assets/vendor-snapdom-XnBoh1gd.js","assets/index-CzR1sElx.css","assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-DFN1Co1H.js","assets/index-CaTRpNBK.js","assets/DebugToolsPanel-dUV6pVqD.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,o as ot,C as it,u as rt,d as lt}from"./vendor-nuxt-ui-CYMNNdeD.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{l as mt,u as se,m as Ae,T as ce,h as ue,n as gt,o as Ye,_ as Le,p as pt,d as ht,a as vt,s as ft}from"./index-BfZM-q0T.js";import{_ as ae,a as K,g as Ge,b as yt,c as Te,d as ne,e as le,f as xt,h as De,i as bt,j as Ve,k as _t,u as kt,l as wt,m as $t,n as It,o as Ct,p as St,q as Mt,r as Tt,s as Dt,t as Rt,v as Nt,P as At,w as Lt,x as Vt,y as Et,z as Ot,C as zt,A as Ft,B as Bt,D as Ut,E as Ht}from"./DebugToolsPanel.vue_vue_type_script_setup_true_lang-DFN1Co1H.js";import"./vendor-echarts-wordcloud-uVdwYsYa.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-C13vDgZW.js";import"./index-CaTRpNBK.js";import"./vendor-zrender-5DcYjSZk.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
3
|
<div style="padding: 4px 8px;">
|
|
4
4
|
<div style="font-weight: bold; margin-bottom: 4px;">${f.name}</div>
|
|
5
5
|
<div>${f.value} ${a.unit} (${f.percentage}%)</div>
|
|
6
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-DcC12j9S.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 (
|
|
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-BYLFxPAX.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
8
|
SELECT
|
|
9
9
|
strftime('%Y-%m-%d', msg.ts, 'unixepoch', 'localtime') as date,
|
|
10
10
|
msg.sender_id,
|
|
@@ -160,4 +160,4 @@ import{_ as ze}from"./vendor-snapdom-XnBoh1gd.js";import{l as st,g as _e,a as ge
|
|
|
160
160
|
FROM message msg
|
|
161
161
|
JOIN member m ON msg.sender_id = m.id
|
|
162
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-CUS9nnwi.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)?(r(),N(Vt,{key:3,modelValue:_.value,"onUpdate:modelValue":B[8]||(B[8]=Y=>_.value=Y),"session-id":t(p)},null,8,["modelValue","session-id"])):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-3443d660"]]);export{tl as default};
|
|
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-BAf68-wB.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)?(r(),N(Vt,{key:3,modelValue:_.value,"onUpdate:modelValue":B[8]||(B[8]=Y=>_.value=Y),"session-id":t(p)},null,8,["modelValue","session-id"])):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-3443d660"]]);export{tl as default};
|