HEX
Server: nginx/1.28.3
System: Linux ip-172-31-12-242 6.17.0-1007-aws #7~24.04.1-Ubuntu SMP Thu Jan 22 21:04:49 UTC 2026 x86_64
User: root (0)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/server/panel/BTPanel/static/js/index110.js
import{c as se,aI as Xo,a7 as Yo,g as me,p as n,j as r,k as u,q as e,L as z,e as E,v as K,M as Be,F as G,B as Y,s as P,y as N,bS as Qo,aB as no,r as M,w as Ae,aN as es,aH as Io,o as tt,J,K as nt,m as lo,aW as io,i as Rt,R as xe,A as Dt,x as ve,C as Ie,bm as Ne,b3 as ao,n as X,a8 as _t,bu as pe,cb as ts,Q as Lt,cc as os,cd as ss,b as zt,t as ns,ce as po,a3 as ls,cf as is,z as as,bi as rs,aV as us,ab as ds,ad as cs,at as ps,as as vs,ar as fs,cg as gs,aA as ms,T as hs,ay as ys,an as ws,am as _s,H as Cs,a_ as ks,O as bs,ch as xs,ci as Ts,b$ as Ms}from"./base-lib.js?v=1777008528";import{c as Ee,i9 as $s,ia as Ss,ib as Ls,q as Bs,T as Kt,p as As,t as Is,cZ as _e,lh as Eo,f as Po,jA as vo,w as We,M as le,e as Ro,_ as Es,lP as Ps,iA as fo,lQ as go,b as Do,lR as Rs,K as Ds,cO as zs,c7 as zo,d3 as Ns,d8 as No,u as Fs,i as Us,ds as Os,r as Ws,G as Vs,dm as Hs,li as qs,lS as js,Q as Zs,j as Fo,cs as Gs}from"./utils-lib.js?v=1777008528";import{w as Xt,o as Ks,h as Js,dN as Jt,k as Xs,a0 as Ys,ca as Qs}from"./index3.js?v=1777008528";import en from"./index219.js?v=1777008528";import{b as tn,c as on,e as sn,j as nn,k as Uo,l as ln,m as an,n as rn,o as Bt,p as mo,r as un,t as dn,u as cn}from"./useController24.js?v=1777008528";import{p as Yt,i as st,f as Oo,a as Wo,r as pn}from"./chat-utils.js?v=1777008528";import{p as vn}from"./ai.js?v=1777008528";import{u as fn}from"./hooks.js?v=1777008528";import{_ as gn}from"./index116.js?v=1777008528";import{_ as mn}from"./index117.js?v=1777008528";import{_ as hn}from"./index118.js?v=1777008528";import{_ as Vo}from"./index119.js?v=1777008528";import{B as yn}from"./index120.js?v=1777008528";import{_ as Ho}from"./index121.js?v=1777008528";import"./__commonjsHelpers__.js?v=1777008528";import"./marked.esm.js?v=1777008528";const wn={key:0,class:"dev-theme-switcher"},_n={class:"switcher-content"},Cn={class:"theme-btn color-trigger-btn",title:"切换主题色"},kn={class:"color-popover-inner"},bn={class:"color-grid"},xn=["title","onClick"],Tn={class:"color-label"},Mn=se({__name:"dev-theme-switcher",setup(t){const{globalTheme:v,scheme:$}=Xo(Ee()),B=Yo(),f=me(()=>{const d=v.value.theme.preset||$.value;return d==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":d||"light"}),T=(d,w)=>{f.value!==d&&Bs(w,()=>{v.value.theme.preset=d,$.value=d,window.vite_public_panel_theme.theme.preset=d,Kt.updateThemePreset(d),B.value=d==="auto"?As()==="dark":d==="dark"})},y=me(()=>Object.entries($s).filter(([d])=>!["grey","light"].includes(d)).map(([d,w])=>{var S;return{value:d,label:w.label,gradient:w.gradient,active:Ss(w.primary,((S=v.value.theme)==null?void 0:S.color)||"")}})),o=me(()=>{var d;return!Ls(((d=v.value.theme)==null?void 0:d.color)||"")}),c=me(()=>f.value==="dark"?"dark":"light"),_=d=>{const w=Is(d);w&&(v.value.theme.color=w,window.vite_public_panel_theme.theme.color=w,Kt.updateThemeColor(w,c.value))},C=d=>{d&&Kt.updateThemeColor(d,c.value)};return(d,w)=>{const S=Qo,W=no;return n(!1)?(r(),u("div",wn,[e("div",_n,[e("button",{class:z(["theme-btn",{active:f.value==="light"}]),title:"切换到亮色模式",onClick:w[0]||(w[0]=A=>T("light",A))},[...w[3]||(w[3]=[e("svg",{viewBox:"0 0 24 24",width:"18",height:"18"},[e("path",{fill:"currentColor",d:"M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0 c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2 c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1 C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06 c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41 l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41 c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36 c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"})],-1)])],2),e("button",{class:z(["theme-btn",{active:f.value==="dark"}]),title:"切换到暗色模式",onClick:w[1]||(w[1]=A=>T("dark",A))},[...w[4]||(w[4]=[e("svg",{viewBox:"0 0 24 24",width:"18",height:"18"},[e("path",{fill:"currentColor",d:"M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"})],-1)])],2),w[7]||(w[7]=e("div",{class:"switcher-divider"},null,-1)),E(W,{placement:"top-end",width:220,trigger:"click","popper-class":"dev-color-popover","show-arrow":!1},{reference:K(()=>[e("button",Cn,[e("span",{class:"color-dot",style:Be({background:n(v).theme.color})},null,4)])]),default:K(()=>[e("div",kn,[w[6]||(w[6]=e("p",{class:"color-popover-title"},"主题色",-1)),e("div",bn,[(r(!0),u(G,null,Y(y.value,A=>(r(),u("div",{key:A.value,class:z(["color-swatch-item",{active:A.active}]),title:A.label,onClick:L=>_(A.value)},[e("div",{class:"color-swatch",style:Be({background:A.gradient})},null,4),e("span",Tn,P(A.label),1)],10,xn))),128)),e("div",{class:z(["color-swatch-item color-swatch-item--custom",{active:o.value}]),title:"自定义"},[E(S,{modelValue:n(v).theme.color,"onUpdate:modelValue":w[2]||(w[2]=A=>n(v).theme.color=A),size:"small",onChange:_,onActiveChange:C},null,8,["modelValue"]),w[5]||(w[5]=e("span",{class:"color-label"},"自定义",-1))],2)])])]),_:1})])])):N("",!0)}}}),$n=_e(Mn,[["__scopeId","data-v-bf4839f3"]]),Sn=["src"],Ln=se({__name:"index",setup(t){const{pluginInfo:i}=Ee(),v=Po(),$=M(),B=M(0),f=M(),T=()=>{window.addEventListener("message",async o=>{var _,C;let c=o.data;switch(typeof o.data=="string"&&((_=o.data)==null?void 0:_.indexOf("&"))!==-1&&(c=o.data.split("&")[0]),c){case"closePlugin":i.value.visible=!1;const d=document.getElementById("app-container");if(d.style.position="relative",i.value.visible=!1,((C=o.data)==null?void 0:C.indexOf("&"))!==-1){const w=o.data.split("&");let S=!1;String(w[2])==="success"&&(S=!0),v.request({status:S,msg:String(w[1])}),i.value.visible=!1}break;case"refreshMain":window.location.reload();break;case"pluginLoad":f.value.close();break}}),$.value.onload=()=>{i.value.init=!0}},y=()=>{const{id:o,name:c,built:_}=i.value;if(_)i.value.visible=!1;else{const C={pluginName:o,pluginTitle:c,pluginBuilt:_};$.value.contentWindow.postMessage("".concat(JSON.stringify(C)),"*"),typeof i.value.callback=="function"&&i.value.callback($.value.contentWindow)}};return Ae(()=>i.value.visible,o=>{o?f.value=v.load("正在加载插件数据,请稍候..."):f.value.close()}),es(()=>{i.value.visible&&i.value.init&&y()}),Io(()=>{B.value&&clearInterval(B.value)}),tt(()=>{T()}),(o,c)=>J((r(),u("iframe",{ref_key:"iframeRef",ref:$,src:n(Eo)?"/software.html":"/software",class:"w-full h-full !fixed z-999999 min-h-[45rem] top-0 bg-transparent"},null,8,Sn)),[[nt,n(i).visible]])}}),Bn=_e(Ln,[["__scopeId","data-v-836e8177"]]);function An(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!Rt(t)}const qo=se({name:"BtTooltip",setup(t,{attrs:i,slots:v}){return()=>E(io,lo(i,t),An(v)?v:{default:()=>[v]})}});function Qt(t){try{const i=JSON.parse(t);let{todos:v}=i;if(typeof v=="string"&&(v=JSON.parse(v)),Array.isArray(v))return v}catch(i){}}function ho(t){try{const i=t.match(/<toolcall_result>\s*([\s\S]*?)\s*<\/toolcall_result>/);if(!i)return;const v=i[1].trim(),$=JSON.parse(v);if(Array.isArray($))return $}catch(i){}}const In=M(""),Xe=M([]),Le=M([]),Oe=M(null),En=M(!1),Pn=M(!1),Rn=M(!1),yo=M([]),Dn=M(!1),zn=M([]),Nn=M(""),Fn=M([]),Un=M([]),On=M(!1),Wn=M(!1),Vn=M(!1),Hn=M(!1),qn=M(!0);function jn(){const t=y=>{const o=[];let c=0;for(;c<y.length;){const _=y[c];if(_.role==="user")o.push({role:"user",content:_.content,time:new Date(_.timestamp*1e3).toISOString(),id:_.id}),c++;else if(_.role==="assistant"){const C=[];if(_.reasoning_content&&C.push({type:"think",content:_.reasoning_content,collapsed:!0}),_.tool_calls&&_.tool_calls.length>0)for(const w of _.tool_calls){const S=w.function.name==="TodoWrite",W=(()=>{try{return JSON.parse(w.function.arguments).description}catch(q){return}})(),A={type:"tool_call",tool:w.function.name,args:w.function.arguments,id:w.id,status:"calling",collapsed:!S,description:W,todoItems:S?Qt(w.function.arguments):void 0},L=y.find(q=>q.role==="tool"&&q.tool_call_id===w.id);L&&(A.result=L.content,A.status="completed"),C.push(A)}let d=_.content;if(Array.isArray(_.content)){const w=_.content.find(S=>S.type==="text");d=(w==null?void 0:w.text)||""}for(d&&C.push({type:"message",content:d}),o.push({role:"assistant",content:d||"",time:new Date(_.timestamp*1e3).toISOString(),contentBlocks:C.length>0?C:void 0,id:_.id}),c++;c<y.length&&y[c].role==="tool";)c++}else _.role,c++}return o},i=async()=>{const{data:y}=await tn({sessions_dir:"aics_sessions"});y.status&&Array.isArray(y.data)&&(Le.value=y.data.map(o=>{var c;return{id:o.session_id,title:Array.isArray(o.title)?((c=o.title.find(_=>_.type==="text"))==null?void 0:c.text)||"图片信息":o.title,messages:[],updatedAt:o.time_str}}))},v=()=>{if(!Oe.value||Xe.value.length===0)return;const y=Xe.value.find(C=>C.role==="user");let o="新对话";if(y){if(typeof y.content=="string")o=y.content.substring(0,30);else if(Array.isArray(y.content)){const C=y.content.find(d=>d.type==="text");C!=null&&C.text?o=C.text.substring(0,30):o="[图片消息]"}}const c={id:Oe.value,title:o,messages:Xe.value,updatedAt:new Date().toISOString()},_=Le.value.findIndex(C=>C.id===Oe.value);_>=0?Le.value[_]=c:Le.value.unshift(c)},$=async y=>{const o=Le.value.find(_=>_.id===y);if(o&&o.messages.length>0){Oe.value=y,Xe.value=[...o.messages];return}const{data:c}=await on({session_id:y,sessions_dir:"aics_sessions"});if(c.data&&Array.isArray(c.data)){const _=t(c.data),C=Le.value.findIndex(d=>d.id===y);C>=0&&(Le.value[C].messages=_),Oe.value=y,Xe.value=_}},B=async y=>{(await sn({session_id:y,sessions_dir:"aics_sessions"})).status&&(Le.value=Le.value.filter(c=>c.id!==y),Oe.value===y&&f())},f=()=>{Oe.value=null,Xe.value=[],yo.value=[]};return{inputMessage:In,currentMessages:Xe,conversations:Le,currentConversationId:Oe,historyPanelVisible:En,isTyping:Pn,isSending:Rn,streamingContentBlocks:yo,streamingThinkCollapsed:Dn,modelsList:zn,currentModel:Nn,toolsList:Fn,selectedTools:Un,showToolPopover:On,modelsLoading:Wn,toolsLoading:Vn,webSearchEnabled:Hn,smartMode:qn,loadConversations:i,saveConversation:v,loadConversation:$,deleteConversation:B,createNewConversation:f,getTimeAgo:y=>{const c=new Date().getTime()-y.getTime(),_=Math.floor(c/6e4),C=Math.floor(c/36e5),d=Math.floor(c/864e5);return _<1?"刚刚":_<60?"".concat(_,"分钟前"):C<24?"".concat(C,"小时前"):d<7?"".concat(d,"天前"):y.toLocaleDateString("zh-CN",{month:"numeric",day:"numeric"})}}}function Zn(){let t=null;const i=!1;async function v(B,f,T,y,o,c,_,C,d,w,S,W,A,L){var Q,ie,ne;t&&t.abort(),t=new AbortController;const{signal:q}=t;try{const Ce=Date.now(),U=window.vite_public_proxy_key||"",te=vo(String(Ce).concat(vo(U))),he=(Q=(await fetch("".concat(i?"/api":"","/mod/agent/com/chat").concat(i?"?request_time=".concat(Ce,"&request_token=").concat(te):""),{method:"POST",headers:{"Content-Type":"application/json","x-http-token":window.vite_public_request_token},body:JSON.stringify({sessions_dir:"aics_sessions",prompt_id:"agent_aics",message:typeof B=="string"?B:JSON.stringify(B),..._?{web_search:!0,tools:o.map(ge=>ge.id)}:{tools:y.map(ge=>ge.id),...c?{web_search:!0}:{}},session_id:f}),signal:q})).body)==null?void 0:Q.getReader();if(!he)throw new Error("无法获取响应流");const ae=new TextDecoder("utf-8");for(;;){const{done:ge,value:re}=await he.read();if(ge)break;const ue=ae.decode(re,{stream:!0}).split("\n");let V;const Z={onThink:S,onChunk:C,onError:w,onComplete:d,onToolCall:W,onToolResult:A,onMetaInfo:L};for(let de of ue)if(de=de.replace(/\r$/,""),de!==""){if(de.startsWith("event:"))switch(de.slice(6).trim()){case"message_think":V="onThink";break;case"message":V="onChunk";break;case"tool_call":V="onToolCall";break;case"tool_result":V="onToolResult";break;case"meta_info":V="onMetaInfo";break;case"message_end":d();break;case"error":V="onError";break;case"usage":V="";break}else if(de.startsWith("data:")){let ce=de.slice(5).slice(1);if((ce.startsWith('"')&&ce.endsWith('"')||ce.startsWith("'")&&ce.endsWith("'"))&&(ce=ce.slice(1,-1)),!V)continue;if(V==="onToolCall"||V==="onToolResult"||V==="onMetaInfo")try{const Pe=JSON.parse(ce);(ie=Z[V])==null||ie.call(Z,Pe)}catch(Pe){}else ce=ce.replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"	"),(ne=Z[V])==null||ne.call(Z,ce)}}}t=null}catch(Ce){if(Ce.name==="AbortError"){t=null;return}w("抱歉,连接AI服务时出现错误,请稍后再试。"),t=null}}function $(){t&&(t.abort(),t=null)}return{getAIResponseStream:v,abortCurrentRequest:$}}const Gn={class:"history-panel-header"},Kn={class:"history-list"},Jn={key:0,class:"history-empty"},Xn=["onClick"],Yn={class:"history-item-title"},Qn={class:"history-item-time"},el=["onClick"],tl=se({__name:"ChatSidebar",props:{conversations:{},currentConversationId:{},panelVisible:{type:Boolean},getTimeAgo:{type:Function},isSending:{type:Boolean}},emits:["showPanel","hidePanel","startHideTimer","clearHideTimer","loadConversation","deleteConversation"],setup(t,{emit:i}){const v=i;async function $(B){await We({title:"删除对话",content:"确定要删除这个对话吗?",type:"default top-index"}),v("deleteConversation",B)}return(B,f)=>(r(),u("div",{class:z(["history-panel",{"show-panel":t.panelVisible}]),onMouseenter:f[1]||(f[1]=T=>B.$emit("clearHideTimer")),onMouseleave:f[2]||(f[2]=T=>B.$emit("startHideTimer"))},[e("div",Gn,[f[4]||(f[4]=e("h4",null,"历史对话",-1)),e("button",{class:"close-panel-btn",onClick:f[0]||(f[0]=T=>B.$emit("hidePanel"))},[...f[3]||(f[3]=[e("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),e("div",Kn,[t.conversations.length===0?(r(),u("div",Jn,[...f[5]||(f[5]=[e("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})],-1),e("div",{class:"empty-title"},"暂无历史对话",-1),e("div",{class:"empty-desc"},"开始新对话后会显示在这里",-1)])])):(r(!0),u(G,{key:1},Y(t.conversations,T=>(r(),u("div",{key:T.id,class:z(["history-item",{active:T.id===t.currentConversationId}]),onClick:y=>B.$emit("loadConversation",T.id)},[e("div",Yn,P(T.title),1),e("div",Qn,P(t.getTimeAgo(new Date(T.updatedAt))),1),e("button",{class:"history-item-delete",title:"删除对话",onClick:xe(y=>$(T.id),["stop"])},[...f[6]||(f[6]=[Dt('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-9a9ac381><polyline points="3 6 5 6 21 6" data-v-9a9ac381></polyline><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2" data-v-9a9ac381></path><line x1="10" y1="11" x2="10" y2="17" data-v-9a9ac381></line><line x1="14" y1="11" x2="14" y2="17" data-v-9a9ac381></line></svg>',1)])],8,el)],10,Xn))),128))])],34))}}),ol=_e(tl,[["__scopeId","data-v-9a9ac381"]]),ro=M(!1),uo=M("");function jo(t){return t.contentBlocks&&t.contentBlocks.length>0?t.contentBlocks.filter(i=>i.type==="message").map(i=>i.content).join("\n"):typeof t.content=="string"?t.content:""}function sl(t){if(typeof t.content=="string")return t.content;if(Array.isArray(t.content)){const i=t.content.find(v=>v.type==="text");return(i==null?void 0:i.text)||""}return""}function nl(t){return Array.isArray(t.content)?t.content.filter(i=>i.type==="image_url").map(i=>{var v;return((v=i.image_url)==null?void 0:v.url)||""}).filter(i=>i):[]}function ll(t){return Array.isArray(t.content)?t.content.filter(i=>i.type==="file"&&i.source&&i.path).map(i=>({value:i.source.value,path:i.path,start:i.source.start,end:i.source.end})):[]}function il(t){return Array.isArray(t.content)?t.content.filter(i=>i.type==="site"&&i.source&&i.name).map(i=>({value:i.source.value,name:i.name,start:i.source.start,end:i.source.end})):[]}function al(t){t.collapsed=!t.collapsed}function rl(t){t.collapsed=!t.collapsed}function ul(t){uo.value=t,ro.value=!0}function At(){ro.value=!1,uo.value=""}function dl(t,i){return t.role!=="assistant"||!i?!1:jo(t).includes("max_tool_iterations")}const cl={key:0,class:"message-content user-message-content"},pl={key:0,class:"user-images"},vl=["src","onClick"],fl=["innerHTML"],gl=["onClick"],ml=["innerHTML"],hl=["onClick"],yl={class:"tool-name"},wl={key:0,class:"tool-call-description"},_l={class:"tool-call-details"},Cl={key:0,class:"todo-list"},kl={class:"todo-status-icon"},bl={key:0,class:"todo-icon-spin",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},xl={key:1,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},Tl={key:2,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},Ml={key:3,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},$l={class:"todo-description"},Sl={class:"tool-call-args"},Ll={key:0,class:"tool-result-content"},Bl=["innerHTML"],Al={key:2,class:"continue-section"},Il={key:2,class:"message-actions"},El=["src"],Pl=se({__name:"MessageItem",props:{msg:{},isLastAssistant:{type:Boolean},isLast:{type:Boolean},isSending:{type:Boolean}},emits:["copy","regenerate","delete","toggleThink","continue"],setup(t,{emit:i}){const v=t,$=i;function B(){return jo(v.msg)}function f(){return sl(v.msg)}function T(){return nl(v.msg)}function y(){return ll(v.msg)}function o(){return il(v.msg)}const c=me(()=>dl(v.msg,v.isLast||!1));function _(d){const w=y(),S=o();return pn(d,w,S)}function C(){const d=B();$("copy",d)}return(d,w)=>(r(),u("div",{class:z(["message",t.msg.role])},[t.msg.role==="user"?(r(),u("div",cl,[T().length>0?(r(),u("div",pl,[(r(!0),u(G,null,Y(T(),(S,W)=>(r(),u("img",{key:W,src:S,alt:"图片",class:"user-image",onClick:A=>n(ul)(S)},null,8,vl))),128))])):N("",!0),f()?(r(),u("div",{key:1,innerHTML:_(f())},null,8,fl)):N("",!0)])):t.msg.role==="assistant"?(r(),u(G,{key:1},[t.msg.contentBlocks&&t.msg.contentBlocks.length>0?(r(!0),u(G,{key:0},Y(t.msg.contentBlocks,(S,W)=>(r(),u(G,{key:W},[S.type==="think"?(r(),u("div",{key:0,class:z(["think-section",{collapsed:S.collapsed}])},[e("div",{class:"think-title",onClick:A=>n(al)(S)},[...w[4]||(w[4]=[Dt('<svg class="think-toggle-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-daeff49f><polyline points="6 9 12 15 18 9" data-v-daeff49f></polyline></svg><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-daeff49f><circle cx="12" cy="12" r="10" data-v-daeff49f></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" data-v-daeff49f></path><line x1="12" y1="17" x2="12.01" y2="17" data-v-daeff49f></line></svg> 思考过程 ',3)])],8,gl),J(e("div",{class:"think-content"},P(S.content),513),[[nt,!S.collapsed]])],2)):S.type==="message"?(r(),u("div",{key:1,class:"message-content",innerHTML:n(Yt)(S.content)},null,8,ml)):S.type==="tool_call"?(r(),u("div",{key:2,class:z(["tool-call-card",{completed:S.tool==="TodoWrite"?n(st)(S):S.status==="completed",collapsed:S.collapsed,"todo-card":S.tool==="TodoWrite"}])},[e("div",{class:"tool-call-header",onClick:A=>n(rl)(S)},[w[5]||(w[5]=e("svg",{class:"tool-toggle-icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"6 9 12 15 18 9"})],-1)),e("span",yl,[ve(P(S.tool==="TodoWrite"?"任务计划":S.tool)+" ",1),S.description?(r(),u("div",wl,P(S.description),1)):N("",!0)]),S.tool==="TodoWrite"?(r(),u("span",{key:0,class:z(["tool-badge",{success:n(st)(S)}])},P(S.status==="calling"?"更新中":n(st)(S)?"已完成":"进行中"),3)):(r(),u("span",{key:1,class:z(["tool-badge",{success:S.status==="completed"}])},P(S.status==="calling"?"调用中":"完成"),3))],8,hl),J(e("div",_l,[S.tool==="TodoWrite"&&S.todoItems&&S.todoItems.length>0?(r(),u("div",Cl,[(r(!0),u(G,null,Y(S.todoItems,A=>(r(),u("div",{key:A.id,class:z(["todo-item","todo-"+A.status])},[e("span",kl,[A.status==="in_progress"?(r(),u("svg",bl,[...w[6]||(w[6]=[e("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"},null,-1)])])):A.status==="completed"?(r(),u("svg",xl,[...w[7]||(w[7]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):A.status==="cancelled"?(r(),u("svg",Tl,[...w[8]||(w[8]=[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)])])):(r(),u("svg",Ml,[...w[9]||(w[9]=[e("circle",{cx:"12",cy:"12",r:"9"},null,-1)])]))]),e("span",$l,P(A.content||A.description),1)],2))),128))])):(r(),u(G,{key:1},[e("div",Sl,[w[10]||(w[10]=e("div",{class:"tool-args-label"},"参数:",-1)),e("code",null,P(n(Oo)(S.args)),1)]),S.result?(r(),u("div",Ll,[w[11]||(w[11]=e("div",{class:"tool-result-label"},"结果:",-1)),ve(" "+P(n(Wo)(S.result)),1)])):N("",!0)],64))],512),[[nt,!S.collapsed]])],2)):N("",!0)],64))),128)):(r(),u("div",{key:1,class:"message-content",innerHTML:n(Yt)(t.msg.content)},null,8,Bl)),c.value?(r(),u("div",Al,[e("button",{class:"continue-btn",onClick:w[0]||(w[0]=S=>$("continue"))},[...w[12]||(w[12]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"23 4 23 10 17 10"}),e("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})],-1),ve(" 继续 ",-1)])])])):N("",!0)],64)):N("",!0),t.msg.role==="assistant"&&t.msg.content?(r(),u("div",Il,[e("button",{class:"message-action-btn",title:"复制",onClick:C},[...w[13]||(w[13]=[e("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})],-1)])])])):N("",!0),(r(),Ie(ao,{to:"body"},[E(Ne,{name:"preview-fade"},{default:K(()=>[n(ro)?(r(),u("div",{key:0,class:"image-preview-overlay",onClick:w[3]||(w[3]=(...S)=>n(At)&&n(At)(...S))},[e("img",{src:n(uo),alt:"预览图片",class:"image-preview-full",onClick:w[1]||(w[1]=xe(()=>{},["stop"]))},null,8,El),e("button",{class:"image-preview-close",onClick:w[2]||(w[2]=(...S)=>n(At)&&n(At)(...S))},[...w[14]||(w[14]=[e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])):N("",!0)]),_:1})]))],2))}}),Rl=_e(Pl,[["__scopeId","data-v-daeff49f"]]),we=M(null),It=M(!1),yt=M(!1),Et=M(!0);let ht=null;function Zo(){yt.value||(Et.value=Dl(),It.value=!0,ht&&clearTimeout(ht),ht=setTimeout(()=>{It.value=!1},500))}function Dl(){if(!we.value)return!0;const{scrollTop:t,scrollHeight:i,clientHeight:v}=we.value;return i-t-v<150}function zl(){It.value||Et.value&&X(()=>{we.value&&(yt.value=!0,Et.value=!0,we.value.scrollTo({top:we.value.scrollHeight,behavior:"smooth"}),setTimeout(()=>{yt.value=!1},500))})}function Nl(){It.value=!1,Et.value=!0,X(()=>{we.value&&(yt.value=!0,we.value.scrollTo({top:we.value.scrollHeight,behavior:"smooth"}),setTimeout(()=>{yt.value=!1},500))})}function Fl(t,i){for(let v=t.length-1;v>=0;v--)if(t[v].role==="assistant")return v===i;return!1}async function Ul(t){try{if(navigator.clipboard)await navigator.clipboard.writeText(t);else{const i=document.createElement("textarea");i.value=t,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}le.request({status:!0,msg:"复制成功"})}catch(i){le.request({status:!1,msg:"复制失败"})}}function Ol(t,i){const v=t[i];v&&v.contentBlocks&&v.contentBlocks.forEach($=>{$.type==="think"&&($.collapsed=!$.collapsed)})}function Wl(t){t.collapsed=!t.collapsed}function Vl(t){t.collapsed=!t.collapsed}function Hl(){we.value&&we.value.addEventListener("scroll",Zo,{passive:!0})}function ql(){we.value&&we.value.removeEventListener("scroll",Zo),ht&&clearTimeout(ht)}const jl={key:0,class:"welcome-message"},Zl={class:"suggestion-cards"},Gl=["onClick"],Kl={key:1,class:"message assistant"},Jl=["onClick"],Xl=["innerHTML"],Yl=["onClick"],Ql={class:"tool-name"},ei={key:0,class:"tool-call-description"},ti={class:"tool-call-details"},oi={key:0,class:"todo-list"},si={class:"todo-status-icon"},ni={key:0,class:"todo-icon-spin",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},li={key:1,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},ii={key:2,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},ai={key:3,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},ri={class:"todo-description"},ui={class:"tool-call-args"},di={key:0,class:"tool-result-content"},ci={key:2,class:"typing-indicator"},pi=se({__name:"ChatMain",props:{messages:{},isTyping:{type:Boolean},streamingContentBlocks:{},streamingThinkCollapsed:{type:Boolean},suggestions:{},isSending:{type:Boolean}},emits:["update:streamingThinkCollapsed","suggestionClick","regenerate","deleteMessage","continue"],setup(t,{expose:i,emit:v}){const $=t;function B(T){return Fl($.messages,T)}function f(T){Ol($.messages,T)}return tt(()=>Hl()),_t(()=>ql()),i({scrollToBottom:zl,forceScrollToBottom:Nl}),(T,y)=>(r(),u("div",{ref_key:"chatMessagesRef",ref:we,class:"chat-messages"},[t.messages.length===0?(r(),u("div",jl,[y[1]||(y[1]=e("h2",null,"有什么我能帮你的吗?",-1)),e("div",Zl,[(r(!0),u(G,null,Y(t.suggestions,(o,c)=>(r(),u("button",{key:c,class:"suggestion-card",onClick:_=>T.$emit("suggestionClick",o)},P(o.question),9,Gl))),128))])])):N("",!0),(r(!0),u(G,null,Y(t.messages,(o,c)=>(r(),Ie(Rl,{key:c,msg:o,isSending:t.isSending,"is-last-assistant":B(c),"is-last":c===t.messages.length-1,onCopy:n(Ul),onRegenerate:_=>T.$emit("regenerate",c),onDelete:_=>T.$emit("deleteMessage",c),onToggleThink:_=>f(c),onContinue:y[0]||(y[0]=_=>T.$emit("continue"))},null,8,["msg","isSending","is-last-assistant","is-last","onCopy","onRegenerate","onDelete","onToggleThink"]))),128)),t.streamingContentBlocks.length>0?(r(),u("div",Kl,[(r(!0),u(G,null,Y(t.streamingContentBlocks,(o,c)=>(r(),u(G,{key:c},[o.type==="think"?(r(),u("div",{key:0,class:z(["think-section",{collapsed:o.collapsed}])},[e("div",{class:"think-title",onClick:_=>n(Wl)(o)},[...y[2]||(y[2]=[Dt('<svg class="think-toggle-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-55f36d11><polyline points="6 9 12 15 18 9" data-v-55f36d11></polyline></svg><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-55f36d11><circle cx="12" cy="12" r="10" data-v-55f36d11></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" data-v-55f36d11></path><line x1="12" y1="17" x2="12.01" y2="17" data-v-55f36d11></line></svg> 思考过程 ',3)])],8,Jl),J(e("div",{class:"think-content"},P(o.content),513),[[nt,!o.collapsed]])],2)):o.type==="message"?(r(),u("div",{key:1,class:"message-content",innerHTML:n(Yt)(o.content)},null,8,Xl)):o.type==="tool_call"?(r(),u("div",{key:2,class:z(["tool-call-card",{completed:o.tool==="TodoWrite"?n(st)(o):o.status==="completed",collapsed:o.collapsed,"todo-card":o.tool==="TodoWrite"}])},[e("div",{class:"tool-call-header",onClick:_=>n(Vl)(o)},[y[3]||(y[3]=e("svg",{class:"tool-toggle-icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"6 9 12 15 18 9"})],-1)),e("span",Ql,[ve(P(o.tool==="TodoWrite"?"任务计划":o.tool)+" ",1),o.description?(r(),u("div",ei,P(o.description),1)):N("",!0)]),o.tool==="TodoWrite"?(r(),u("span",{key:0,class:z(["tool-badge",{success:n(st)(o)}])},P(o.status==="calling"?"更新中":n(st)(o)?"已完成":"进行中"),3)):(r(),u("span",{key:1,class:z(["tool-badge",{success:o.status==="completed"}])},P(o.status==="calling"?"调用中":"完成"),3))],8,Yl),J(e("div",ti,[o.tool==="TodoWrite"&&o.todoItems&&o.todoItems.length>0?(r(),u("div",oi,[(r(!0),u(G,null,Y(o.todoItems,_=>(r(),u("div",{key:_.id,class:z(["todo-item","todo-"+_.status])},[e("span",si,[_.status==="in_progress"?(r(),u("svg",ni,[...y[4]||(y[4]=[e("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"},null,-1)])])):_.status==="completed"?(r(),u("svg",li,[...y[5]||(y[5]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):_.status==="cancelled"?(r(),u("svg",ii,[...y[6]||(y[6]=[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)])])):(r(),u("svg",ai,[...y[7]||(y[7]=[e("circle",{cx:"12",cy:"12",r:"9"},null,-1)])]))]),e("span",ri,P(_.content||_.description),1)],2))),128))])):(r(),u(G,{key:1},[e("div",ui,[y[8]||(y[8]=e("div",{class:"tool-args-label"},"参数:",-1)),e("code",null,P(n(Oo)(o.args)),1)]),o.result?(r(),u("div",di,[y[9]||(y[9]=e("div",{class:"tool-result-label"},"结果:",-1)),ve(" "+P(n(Wo)(o.result)),1)])):N("",!0)],64))],512),[[nt,!o.collapsed]])],2)):N("",!0)],64))),128))])):N("",!0),t.isTyping?(r(),u("div",ci,[...y[10]||(y[10]=[e("div",{class:"typing-dots"},[e("div",{class:"typing-dot"}),e("div",{class:"typing-dot"}),e("div",{class:"typing-dot"})],-1)])])):N("",!0)],512))}}),vi=_e(pi,[["__scopeId","data-v-55f36d11"]]),fi={class:"chat-input-container"},gi={key:0,class:"selected-tools-tags"},mi={class:"tool-tag-name"},hi=["onClick"],yi={key:0,class:"tool-tag tool-tag-overflow"},wi={class:"tool-tag-name"},_i={class:"tool-overflow-tooltip"},Ci=["onClick"],ki={key:1,class:"image-preview-container"},bi=["src","onClick"],xi=["onClick"],Ti={key:2,class:"upload-progress-container"},Mi={class:"upload-file-info"},$i={class:"upload-file-name"},Si={class:"upload-file-size"},Li={class:"upload-progress-bar"},Bi={class:"input-toolbar"},Ai={style:{position:"relative"}},Ii={style:{width:"24px",height:"24px"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Ei=["title"],Pi={style:{position:"relative"}},Ri=["title"],Di={key:0,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},zi={key:1,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"},Ni={class:"popover-header"},Fi={class:"tool-search-bar"},Ui={class:"popover-content"},Oi={key:0,class:"popover-loading"},Wi={key:1,class:"tool-search-empty"},Vi={key:2,class:"tool-list"},Hi=["onClick"],qi=["onClick"],ji={class:"tool-info"},Zi={class:"tool-name"},Gi={key:0,class:"risk-badge"},Ki={class:"popover-header"},Ji={key:0,class:"site-search-loading"},Xi={key:1,class:"site-search-empty"},Yi=["onClick","onMouseenter"],Qi={class:"site-name"},ea={class:"site-type-badge"},ta=["innerHTML"],oa=["src"],wo=5,sa=5*1024*1024,na=10*1024*1024,la=se({__name:"ChatInput",props:{inputMessage:{},selectedTools:{},toolsList:{},showToolPopover:{type:Boolean},toolsLoading:{type:Boolean},isSending:{type:Boolean},webSearchEnabled:{type:Boolean},smartMode:{type:Boolean}},emits:["update:inputMessage","update:showToolPopover","update:webSearchEnabled","update:smartMode","sendMessage","stopMessage","removeSelectedTool","toggleToolSelection","batchToggleTools","openSettings","openPluginView"],setup(t,{expose:i,emit:v}){const $=t,B=v,f=M(null),T=M(null),y=M(""),o=M(null),c=M(!1),_=M(""),C=M({top:"0px",left:"0px"}),d=M([]),w=M([]),S=M(!1),W=M(!1),A=M(""),L=M([]),q=M(!1),Q=M(null),ie=M(null),ne=M(null),Ce=M({bottom:"0px",left:"0px"}),U=M([]),te=M(!1),ke=M([]),he=M(!1),ae=M(0);let ge=null;const re=M(!1),He=M({bottom:"0px",left:"0px",width:"0px"}),ue=M(null),V=M(null),Z=M(0),de=M({bottom:"0px",left:"0px"});Ae(()=>$.inputMessage,l=>{f.value&&f.value.textContent!==l&&(f.value.textContent=l)});const ce=me(()=>$.selectedTools.slice(0,wo)),Pe=me(()=>$.selectedTools.slice(wo)),lt=me(()=>{const l=y.value.trim().toLowerCase(),s=$.toolsList,a=l?s.filter(g=>g.name.toLowerCase().includes(l)):s,p={};return a.forEach(g=>{const k=g.category||"其他";p[k]||(p[k]=[]),p[k].push(g)}),p});function Re(){f.value&&(f.value.style.height="auto",f.value.style.height="".concat(Math.min(f.value.scrollHeight,120),"px"),re.value&&at())}function Ct(l){const s=l.target,a=l.target.innerHTML.replace(/\s|&nbsp;/g,"");(a==="<br>"||a==="<div><br></div>"||a==="<p><br></p>")&&(s.innerText=""),B("update:inputMessage",s.textContent||""),X(()=>{Re()}),it(),Nt()}function it(){if(!f.value)return;const l=window.getSelection();if(!l||l.rangeCount===0){re.value=!1;return}const s=l.getRangeAt(0),a=s.startContainer;if(a.nodeType!==Node.TEXT_NODE){re.value=!1;return}const p=a.textContent||"",g=s.startOffset;if(g>0&&p[g-1]==="@"){if(te.value){re.value=!1;return}ue.value=g-1,V.value=a,Z.value=0,te.value=!1,re.value=!0,at()}else re.value=!1,te.value||(ue.value=null,V.value=null)}function Nt(){if(!f.value||!te.value)return;const l=window.getSelection();if(!l||l.rangeCount===0){te.value=!1;return}const s=l.getRangeAt(0),a=s.startContainer;if(a.nodeType!==Node.TEXT_NODE){te.value=!1;return}const p=a.textContent||"",g=s.startOffset,k="@site:",b=p.indexOf(k);if(b!==-1&&g>b){const R=p.substring(b+k.length);dt(R);return}te.value=!1}function at(){if(!f.value)return;const l=document.querySelector(".small-ai-chat.ai-chat-wrapper"),s=l==null?void 0:l.getBoundingClientRect();if(!s)return;const a=document.querySelector(".small-ai-chat .chat-input-wrapper"),p=a==null?void 0:a.getBoundingClientRect();if(!p)return;const g=45;He.value={bottom:"".concat(p.bottom-p.top+g,"px"),left:"".concat(p.left-s.left,"px"),width:"".concat(p.width,"px")}}function rt(){const l=document.getElementById("tool-tooltip"),s=localStorage.getItem("showToolTooltip");l&&!s&&(l.classList.add("show"),localStorage.setItem("showToolTooltip","true"),setTimeout(()=>{l.classList.remove("show")},3e3))}function ut(){}function Fe(l){if(!l.isComposing){if(re.value){if(l.key==="ArrowUp"){l.preventDefault(),Z.value=Z.value===0?1:0;return}if(l.key==="ArrowDown"){l.preventDefault(),Z.value=Z.value===1?0:1;return}if(l.key==="Enter"&&!l.shiftKey){l.preventDefault(),Z.value===0?Te():kt();return}if(l.key==="Escape"){re.value=!1,ue.value=null,V.value=null;return}}if(te.value){if(l.key==="Enter"&&!l.shiftKey){l.preventDefault(),Me();return}if(l.key==="ArrowUp"){l.preventDefault(),ae.value=ae.value>0?ae.value-1:ke.value.length-1;return}if(l.key==="ArrowDown"){l.preventDefault(),ae.value=ae.value<ke.value.length-1?ae.value+1:0;return}if(l.key==="Escape"){te.value=!1;return}}l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),B("sendMessage"))}}function Te(){re.value=!1,Xt({type:"all",path:"/",change:l=>{De(l)}},{customClass:"top-index"})}function De(l){if(!f.value)return;const s=l.split("/").pop()||l,a=Date.now().toString(),p=document.createElement("span");if(p.className="file-tag truncate",p.contentEditable="false",p.dataset.id=a,p.dataset.path=l,p.textContent="@".concat(s),V.value&&ue.value!==null){const g=V.value,k=g.textContent||"",b=ue.value;if(k[b]==="@"){const R=k.substring(0,b),F=k.substring(b+1);g.textContent=R+F;const H=document.createRange();H.setStart(g,b),H.setEnd(g,b),H.insertNode(p);const oe=document.createTextNode(" ");H.setStartAfter(p),H.insertNode(oe),H.setStartAfter(oe),H.collapse(!0);const Se=window.getSelection();Se&&(Se.removeAllRanges(),Se.addRange(H))}else{gt(l);return}}else{gt(l);return}w.value.push({id:a,path:l,name:s}),ue.value=null,V.value=null,B("update:inputMessage",f.value.textContent||""),X(()=>Re())}function kt(){var p;if(re.value=!1,!V.value||ue.value===null)return;const l=V.value,s=l.textContent||"",a=ue.value;if(s[a]==="@"){const g=s.substring(0,a),k=s.substring(a+1);l.textContent=g+"@site:"+k;const b=window.getSelection();if(b){const R=document.createRange(),F=a+6;R.setStart(l,Math.min(F,l.textContent.length)),R.collapse(!0),b.removeAllRanges(),b.addRange(R)}}te.value=!0,ae.value=0,at(),dt(""),B("update:inputMessage",((p=f.value)==null?void 0:p.textContent)||"")}function dt(l){ge&&clearTimeout(ge),ge=setTimeout(()=>{ze(l)},300)}async function ze(l){he.value=!0;try{const{data:s}=await vn({name:l,limit:5});s.status?(ke.value=s.data||[],ae.value=0):ke.value=[]}catch(s){ke.value=[]}finally{he.value=!1}}function Me(){if(ke.value.length===0)return;const l=ke.value[ae.value];l&&(te.value=!1,ge&&(clearTimeout(ge),ge=null),bt(l.name))}function bt(l){if(!f.value)return;const s=Date.now().toString(),a="@site:".concat(l),p=document.createElement("span");if(p.className="site-tag truncate",p.contentEditable="false",p.dataset.id=s,p.dataset.name=l,p.textContent=a,V.value&&ue.value!==null){const g=V.value,k=g.textContent||"",b=ue.value;let R=b+1;for(k.substring(b,b+6)==="@site:"&&(R=b+6);R<k.length&&k[R]!==" "&&k[R]!==" ";)R++;const F=k.substring(0,b),H=k.substring(R);g.textContent=F+H;const oe=document.createRange();oe.setStart(g,b),oe.collapse(!0),oe.insertNode(p);const Se=document.createTextNode(" ");oe.setStartAfter(p),oe.insertNode(Se),oe.setStartAfter(Se),oe.collapse(!0);const Gt=window.getSelection();Gt&&(Gt.removeAllRanges(),Gt.addRange(oe))}else{f.value.focus();const g=window.getSelection();if(g&&g.rangeCount>0){const k=g.getRangeAt(0);if(f.value.contains(k.commonAncestorContainer)){k.deleteContents(),k.insertNode(p);const b=document.createTextNode(" ");k.setStartAfter(p),k.insertNode(b),k.setStartAfter(b),k.collapse(!0),g.removeAllRanges(),g.addRange(k)}else{f.value.appendChild(p);const b=document.createTextNode(" ");f.value.appendChild(b),be()}}else{f.value.appendChild(p);const k=document.createTextNode(" ");f.value.appendChild(k),be()}}U.value.push({id:s,name:l}),ue.value=null,V.value=null,B("update:inputMessage",f.value.textContent||""),X(()=>Re())}function qe(l){var a;const s=(a=l.clipboardData)==null?void 0:a.items;if(s){for(const p of s)if(p.type.startsWith("image/")){l.preventDefault();const g=p.getAsFile();g&&pt(g);break}}}function xt(l){var s;(s=l.dataTransfer)!=null&&s.types.includes("Files")&&(S.value=!0)}function Ue(l){const s=l.currentTarget;s&&!s.contains(l.relatedTarget)&&(S.value=!1)}async function Ft(l){var g,k;S.value=!1;const s=(g=l.dataTransfer)==null?void 0:g.items;if(!s)return;const a=[],p=[];for(const b of Array.from(s))if(b.kind==="file"){const R=(k=b.webkitGetAsEntry)==null?void 0:k.call(b);if(R){if(R.isDirectory){const F=await ot(R);F.files.length>0&&p.push(F)}else if(R.isFile){const F=b.getAsFile();F&&a.push(F)}}else{const F=b.getAsFile();F&&a.push(F)}}for(const b of a)b.type.startsWith("image/")?pt(b):je(b);for(const b of p){const R=b.files;R.length>0&&Tt(R,b.name)}}function ot(l){return new Promise(s=>{const a=[],p=l.name,g=k=>{k.readEntries(async b=>{if(b.length===0){s({files:a,name:p});return}for(const R of b)if(R.isFile){const F=R,H=await new Promise(oe=>{F.file(oe)});a.push(H)}else if(R.isDirectory){const F=await ot(R);a.push(...F.files)}g(k)})};g(l.createReader())})}function ct(l){return l.replace(/[<>:"/\\|?*\x00-\x1f]/g,"_")}function pt(l){if(l.size>sa){le.error("图片大小不能超过 5MB,当前文件大小: ".concat((l.size/1024/1024).toFixed(2),"MB"));return}const s=new FileReader;s.onload=a=>{var g;const p=(g=a.target)==null?void 0:g.result;p&&d.value.push(p)},s.readAsDataURL(l)}function je(l){if(l.size>na){le.error("文件大小不能超过 10MB,当前文件大小: ".concat((l.size/1024/1024).toFixed(2),"MB"));return}const s=Date.now().toString(),a=ct(l.name);L.value.push({id:s,name:a,size:l.size,uploaded:0,status:"uploading"});const p="/www/server/panel/plugin/bt_agent/upload",g=k=>{const b=Math.min(l.size,k+2097152),R=new FormData;R.append("f_path",p),R.append("f_name",a),R.append("f_size",l.size.toString()),R.append("f_start",k.toString()),R.append("blob",l.slice(k,b)),fetch("/files?action=upload",{method:"POST",body:R}).then(F=>F.json()).then(F=>{if(typeof F=="number"){const H=L.value.find(oe=>oe.id===s);H&&(H.uploaded=F),g(F)}else if(F.status){const H=L.value.find(Se=>Se.id===s);H&&(H.status="success",H.uploaded=l.size);const oe="".concat(p,"/").concat(a);gt(oe),setTimeout(()=>{L.value=L.value.filter(Se=>Se.id!==s)},500)}else{const H=L.value.find(oe=>oe.id===s);H&&(H.status="error"),le.error("文件上传失败:".concat(F.msg||"未知错误"))}}).catch(()=>{const F=L.value.find(H=>H.id===s);F&&(F.status="error"),le.error("文件上传出现问题!")})};g(0)}async function Tt(l,s){const a=Date.now().toString(),g="".concat("/www/server/panel/plugin/bt_agent/upload","/").concat(ct(s)),k={id:a,name:"".concat(s,"/ (").concat(l.length," 个文件)"),size:l.reduce((F,H)=>F+H.size,0),uploaded:0,status:"uploading"};L.value.push(k);let b=0;const R=[];for(const F of l)try{const H=await Ut(F,g);R.push(H),b+=F.size,k.uploaded=b}catch(H){}k.status="success",k.uploaded=k.size,jt(g,s,R),setTimeout(()=>{L.value=L.value.filter(F=>F.id!==a)},500)}function Ut(l,s){return new Promise((a,p)=>{const g=ct(l.name),k=b=>{const R=Math.min(l.size,b+2097152),F=new FormData;F.append("f_path",s),F.append("f_name",g),F.append("f_size",l.size.toString()),F.append("f_start",b.toString()),F.append("blob",l.slice(b,R)),fetch("/files?action=upload",{method:"POST",body:F}).then(H=>H.json()).then(H=>{typeof H=="number"?k(H):H.status?a("".concat(s,"/").concat(g)):p(new Error(H.msg||"上传失败"))}).catch(H=>{p(H)})};k(0)})}function Ot(l){d.value.splice(l,1)}function Mt(){d.value=[]}function vt(l){A.value=l,W.value=!0}function ft(){W.value=!1,A.value=""}function $t(){return[...d.value]}function Wt(l){d.value=[];for(const s of l)d.value.push(s)}function Vt(l){l.stopPropagation(),B("update:showToolPopover",!1);const s=!q.value;q.value=s,s&&X(()=>{Ce.value=fe(Q.value)})}function Ht(){var l;q.value=!1,(l=ie.value)==null||l.click()}function qt(){var l;q.value=!1,(l=ne.value)==null||l.click()}function St(){q.value=!1,Xt({type:"all",path:"/",change:l=>{De(l)}},{customClass:"top-index"})}function be(){if(!f.value)return;const l=window.getSelection();if(!l)return;const s=document.createRange();s.selectNodeContents(f.value),s.collapse(!1),l.removeAllRanges(),l.addRange(s)}function gt(l){if(!f.value)return;const s=l.split("/").pop()||l,a=Date.now().toString(),p=document.createElement("span");p.className="file-tag truncate",p.contentEditable="false",p.dataset.id=a,p.dataset.path=l,p.textContent="@".concat(s),f.value.focus();const g=window.getSelection();if(g){let k;if(g.rangeCount>0)if(k=g.getRangeAt(0),f.value.contains(k.commonAncestorContainer)){k.deleteContents(),k.insertNode(p);const b=document.createTextNode(" ");k.setStartAfter(p),k.insertNode(b),k.setStartAfter(b),k.collapse(!0),g.removeAllRanges(),g.addRange(k)}else{f.value.appendChild(p);const b=document.createTextNode(" ");f.value.appendChild(b),be()}else{f.value.appendChild(p);const b=document.createTextNode(" ");f.value.appendChild(b),be()}}else{f.value.appendChild(p);const k=document.createTextNode(" ");f.value.appendChild(k),be()}w.value.push({id:a,path:l,name:s}),B("update:inputMessage",f.value.textContent||""),X(()=>Re())}function jt(l,s,a){if(!f.value)return;const p=Date.now().toString(),g=document.createElement("span");g.className="file-tag dir-tag truncate",g.contentEditable="false",g.dataset.id=p,g.dataset.path=l,g.dataset.files=JSON.stringify(a),g.dataset.isDir="true",g.textContent="@".concat(s,"/"),f.value.focus();const k=window.getSelection();if(k){let b;if(k.rangeCount>0)if(b=k.getRangeAt(0),f.value.contains(b.commonAncestorContainer)){b.deleteContents(),b.insertNode(g);const R=document.createTextNode(" ");b.setStartAfter(g),b.insertNode(R),b.setStartAfter(R),b.collapse(!0),k.removeAllRanges(),k.addRange(b)}else{f.value.appendChild(g);const R=document.createTextNode(" ");f.value.appendChild(R),be()}else{f.value.appendChild(g);const R=document.createTextNode(" ");f.value.appendChild(R),be()}}else{f.value.appendChild(g);const b=document.createTextNode(" ");f.value.appendChild(b),be()}w.value.push({id:p,path:l,name:"".concat(s,"/"),isDir:!0,files:a}),B("update:inputMessage",f.value.textContent||""),X(()=>Re())}function Zt(l){const s=l.target,{files:a}=s;if(a){for(const p of Array.from(a))p.type.startsWith("image/")?pt(p):je(p);s.value=""}}function m(l){const s=l.target,{files:a}=s;if(!a||a.length===0)return;const k=a[0].webkitRelativePath.split("/")[0],b=Array.from(a).filter(R=>!R.type.startsWith("image/"));if(b.length===0){le.error("目录中没有可上传的文件(图片文件不支持目录上传)"),s.value="";return}Tt(b,k),s.value=""}function h(l){if(l===0)return"0 B";const s=1024,a=["B","KB","MB","GB"],p=Math.floor(Math.log(l)/Math.log(s));return"".concat(parseFloat((l/s**p).toFixed(2))," ").concat(a[p])}function x(l){l.stopPropagation(),q.value=!1;const s=!$.showToolPopover;B("update:showToolPopover",s),s&&X(()=>{de.value=fe(T.value)})}function I(l){return $.selectedTools.some(s=>s.id===l)}function j(l){return l.length>0&&l.every(s=>I(s.id))}function O(l){const s=l.filter(a=>I(a.id)).length;return s>0&&s<l.length}function ee(l){const s=j(l),a=l.filter(p=>{const g=I(p.id);return s?g:!g});B("batchToggleTools",a,!s)}function fe(l){if(!l)return{bottom:"0px",left:"0px"};const s=l.getBoundingClientRect(),a=8,p=350,g=window.innerHeight-s.top+a,{left:k}=s;let b=k;return b+p>window.innerWidth-8&&(b=window.innerWidth-p-8),b<8&&(b=8),{bottom:"".concat(g,"px"),left:"".concat(b,"px")}}Ae(()=>$.showToolPopover,l=>{l?X(()=>{var s;de.value=fe(T.value),(s=o.value)==null||s.focus()}):y.value=""});function $e(l){return l?l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/\\n/g,"<br>").replace(/\n/g,"<br>"):""}function Ze(){var l;return((l=f.value)==null?void 0:l.innerText)||""}function Ge(){return[...w.value]}function Ke(){return[...U.value]}function Je(){f.value&&(f.value.innerHTML=""),d.value=[],w.value=[],U.value=[]}return i({autoResizeTextarea:Re,getPendingImages:$t,clearImages:Mt,addImages:Wt,getTextContent:Ze,getPendingFiles:Ge,getPendingSites:Ke,clearAll:Je,focus:()=>{var l;(l=f.value)==null||l.focus(),be()}}),(l,s)=>(r(),u("div",fi,[e("div",{class:z(["chat-input-wrapper",{"drag-over":S.value}]),onDragover:xe(xt,["prevent"]),onDragleave:Ue,onDrop:xe(Ft,["prevent"])},[t.selectedTools.length>0&&!t.smartMode?(r(),u("div",gi,[(r(!0),u(G,null,Y(ce.value,a=>(r(),u("div",{key:a.id,class:"tool-tag"},[e("span",mi,P(a.name),1),e("button",{class:"tool-tag-remove",title:"移除工具",onClick:p=>l.$emit("removeSelectedTool",a.id)},[...s[12]||(s[12]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,hi)]))),128)),Pe.value.length>0?(r(),u("div",yi,[e("span",wi,"+"+P(Pe.value.length),1),e("div",_i,[(r(!0),u(G,null,Y(Pe.value,a=>(r(),u("div",{key:a.id,class:"tool-overflow-item"},[e("span",null,P(a.name),1),e("button",{class:"tool-tag-remove",title:"移除工具",onClick:p=>l.$emit("removeSelectedTool",a.id)},[...s[13]||(s[13]=[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,Ci)]))),128))])])):N("",!0)])):N("",!0),d.value.length>0?(r(),u("div",ki,[(r(!0),u(G,null,Y(d.value,(a,p)=>(r(),u("div",{key:p,class:"image-preview-item"},[e("img",{src:a,alt:"预览图片",class:"image-preview-thumb",onClick:g=>vt(a)},null,8,bi),e("button",{class:"image-preview-remove",title:"移除图片",onClick:xe(g=>Ot(p),["stop"])},[...s[14]||(s[14]=[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,xi)]))),128))])):N("",!0),L.value.length>0?(r(),u("div",Ti,[(r(!0),u(G,null,Y(L.value,a=>(r(),u("div",{key:a.id,class:z(["upload-progress-item",{error:a.status==="error",success:a.status==="success"}])},[e("div",Mi,[s[15]||(s[15]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e("polyline",{points:"14 2 14 8 20 8"})],-1)),e("span",$i,P(a.name),1),e("span",Si,"("+P(h(a.uploaded))+"/"+P(h(a.size))+")",1)]),e("div",Li,[e("div",{class:"upload-progress-fill",style:Be({width:"".concat(a.uploaded/a.size*100,"%")})},null,4)])],2))),128))])):N("",!0),e("div",{ref_key:"editorRef",ref:f,class:"chat-input",contenteditable:"true","aria-label":"输入框","data-placeholder":"输入消息,按 Shift + Enter 换行,@ 打开引用菜单,可拖拽上传文件,可粘贴图片,按 Enter 发送",onInput:Ct,onBlur:ut,onFocus:rt,onPaste:qe,onKeydown:Fe},null,544),e("div",Bi,[e("div",Ai,[e("button",{ref_key:"uploadBtnRef",ref:Q,class:"toolbar-button",style:{padding:"0"},title:"上传文件",onClick:Vt},[(r(),u("svg",Ii,[...s[16]||(s[16]=[e("line",{x1:"12",y1:"5",x2:"12",y2:"19"},null,-1),e("line",{x1:"5",y1:"12",x2:"19",y2:"12"},null,-1)])]))],512)]),e("button",{class:z(["toolbar-button",{"toolbar-button-active":t.smartMode}]),title:t.smartMode?"智能模式已开启,AI将自动判断是否使用工具和联网搜索":"智能模式已关闭,可手动选择工具和联网搜索",onClick:s[0]||(s[0]=a=>l.$emit("update:smartMode",!t.smartMode))},[s[17]||(s[17]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),e("path",{d:"M2 17l10 5 10-5"}),e("path",{d:"M2 12l10 5 10-5"})],-1)),e("span",null,P((t.smartMode,"智能模式")),1)],10,Ei),t.smartMode?N("",!0):(r(),u(G,{key:0},[e("div",Pi,[e("button",{ref_key:"toolBtnRef",ref:T,class:"toolbar-button",title:"使用工具",onClick:x},[s[18]||(s[18]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"})],-1)),e("span",null,"使用工具"+P(t.selectedTools.length>0?" (".concat(t.selectedTools.length,")"):""),1)],512)]),e("button",{class:z(["toolbar-button",{"toolbar-button-active":t.webSearchEnabled}]),title:"联网搜索",onClick:s[1]||(s[1]=a=>l.$emit("update:webSearchEnabled",!t.webSearchEnabled))},[...s[19]||(s[19]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e("path",{d:"M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"})],-1),e("span",null,"联网搜索",-1)])],2)],64)),e("button",{class:z(["send-button",{"stop-button":t.isSending}]),title:t.isSending?"停止生成":"发送消息",onClick:s[2]||(s[2]=a=>t.isSending?l.$emit("stopMessage"):l.$emit("sendMessage"))},[t.isSending?(r(),u("svg",zi,[...s[21]||(s[21]=[e("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"},null,-1)])])):(r(),u("svg",Di,[...s[20]||(s[20]=[e("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"},null,-1)])]))],10,Ri)])],34),s[40]||(s[40]=e("div",{class:"ai-disclaimer"}," 内容由 AI 生成,仅供参考,您据此所作判断及操作均由您自行承担责任。 ",-1)),E(Ne,{name:"popover-fade"},{default:K(()=>[t.showToolPopover?(r(),u("div",{key:0,class:"custom-popover",style:Be(de.value)},[e("div",Ni,[s[23]||(s[23]=e("span",{class:"popover-title"},"选择工具",-1)),e("button",{class:"popover-close",onClick:s[3]||(s[3]=a=>l.$emit("update:showToolPopover",!1))},[...s[22]||(s[22]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),e("div",Fi,[s[25]||(s[25]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:"tool-search-icon"},[e("circle",{cx:"11",cy:"11",r:"8"}),e("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})],-1)),J(e("input",{ref_key:"toolSearchInputRef",ref:o,"onUpdate:modelValue":s[4]||(s[4]=a=>y.value=a),class:"tool-search-input",placeholder:"搜索工具名称...",type:"text"},null,512),[[pe,y.value]]),y.value?(r(),u("button",{key:0,class:"tool-search-clear",onClick:s[5]||(s[5]=xe(a=>y.value="",["stop"]))},[...s[24]||(s[24]=[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])):N("",!0)]),e("div",Ui,[t.toolsLoading?(r(),u("div",Oi,[...s[26]||(s[26]=[e("div",{class:"loading-spinner"},null,-1),e("span",null,"加载中...",-1)])])):Object.keys(lt.value).length===0?(r(),u("div",Wi," 未找到匹配的工具 ")):(r(),u("div",Vi,[(r(!0),u(G,null,Y(lt.value,(a,p)=>(r(),u(G,{key:p},[e("div",{class:"tool-category",onClick:g=>ee(a)},[e("span",null,P(p),1),e("div",{class:z(["category-switch",{active:j(a),partial:O(a)}])},[...s[27]||(s[27]=[e("div",{class:"category-switch-slider"},null,-1)])],2)],8,Hi),(r(!0),u(G,null,Y(a,g=>(r(),u("div",{key:g.id,class:"tool-item",onClick:k=>l.$emit("toggleToolSelection",g)},[e("div",ji,[e("span",Zi,P(g.name),1),g.risk_level&&g.risk_level!=="low"?(r(),u("span",Gi," 风险 ")):N("",!0)]),e("div",{class:z(["tool-switch",{active:I(g.id)}])},[...s[28]||(s[28]=[e("div",{class:"tool-switch-slider"},null,-1)])],2)],8,qi))),128))],64))),128))]))])],4)):N("",!0)]),_:1}),E(Ne,{name:"popover-fade"},{default:K(()=>[q.value?(r(),u("div",{key:0,class:"custom-popover upload-popover",style:Be(Ce.value)},[e("div",Ki,[s[30]||(s[30]=e("span",{class:"popover-title"},"上传文件",-1)),e("button",{class:"popover-close",onClick:s[6]||(s[6]=a=>q.value=!1)},[...s[29]||(s[29]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),e("div",{class:"popover-content"},[e("div",{class:"upload-option",onClick:Ht},[...s[31]||(s[31]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),e("polyline",{points:"17 8 12 3 7 8"}),e("line",{x1:"12",y1:"3",x2:"12",y2:"15"})],-1),e("span",null,"本地文件上传",-1)])]),e("div",{class:"upload-option",onClick:qt},[...s[32]||(s[32]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})],-1),e("span",null,"本地目录上传",-1)])]),e("div",{class:"upload-option",onClick:St},[...s[33]||(s[33]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2.18",ry:"2.18"}),e("line",{x1:"7",y1:"2",x2:"7",y2:"22"}),e("line",{x1:"17",y1:"2",x2:"17",y2:"22"}),e("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e("line",{x1:"2",y1:"7",x2:"7",y2:"7"}),e("line",{x1:"2",y1:"17",x2:"7",y2:"17"}),e("line",{x1:"17",y1:"17",x2:"22",y2:"17"}),e("line",{x1:"17",y1:"7",x2:"22",y2:"7"})],-1),e("span",null,"从服务器选择",-1)])])])],4)):N("",!0)]),_:1}),E(Ne,{name:"popover-fade"},{default:K(()=>[re.value?(r(),u("div",{key:0,class:"at-mention-popover",style:Be(He.value)},[e("div",{class:z(["at-mention-option",{active:Z.value===0}]),onClick:s[7]||(s[7]=a=>{Z.value=0,Te()}),onMouseenter:s[8]||(s[8]=a=>Z.value=0)},[...s[34]||(s[34]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2.18",ry:"2.18"}),e("line",{x1:"7",y1:"2",x2:"7",y2:"22"}),e("line",{x1:"17",y1:"2",x2:"17",y2:"22"}),e("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e("line",{x1:"2",y1:"7",x2:"7",y2:"7"}),e("line",{x1:"2",y1:"17",x2:"7",y2:"17"}),e("line",{x1:"17",y1:"17",x2:"22",y2:"17"}),e("line",{x1:"17",y1:"7",x2:"22",y2:"7"})],-1),e("span",null,"从服务器选择文件",-1),e("span",{class:"at-mention-hint"},"按 Enter 选择",-1)])],34),e("div",{class:z(["at-mention-option",{active:Z.value===1}]),onClick:s[9]||(s[9]=a=>{Z.value=1,kt()}),onMouseenter:s[10]||(s[10]=a=>Z.value=1)},[...s[35]||(s[35]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})],-1),e("span",null,"选择网站",-1),e("span",{class:"at-mention-hint"},"按 Enter 选择",-1)])],34)],4)):N("",!0)]),_:1}),E(Ne,{name:"popover-fade"},{default:K(()=>[te.value?(r(),u("div",{key:0,class:"at-mention-popover site-search-popover",style:Be(He.value)},[s[38]||(s[38]=e("div",{class:"site-search-tip"},"输入自动搜索域名",-1)),he.value?(r(),u("div",Ji,[...s[36]||(s[36]=[e("span",null,"搜索中...",-1)])])):ke.value.length===0?(r(),u("div",Xi,[...s[37]||(s[37]=[e("span",null,"无匹配网站",-1)])])):(r(!0),u(G,{key:2},Y(ke.value,(a,p)=>(r(),u("div",{key:a.name,class:z(["site-search-item",{active:p===ae.value}]),onClick:g=>{ae.value=p,Me()},onMouseenter:g=>ae.value=p},[e("span",{class:z(["site-status-dot",{online:a.status==="1"}])},null,2),e("span",Qi,P(a.name),1),e("span",ea,P(a.project_type),1)],42,Yi))),128))],4)):N("",!0)]),_:1}),e("input",{ref_key:"fileInputRef",ref:ie,type:"file",multiple:"",style:{display:"none"},onChange:Zt},null,544),e("input",{ref_key:"dirInputRef",ref:ne,type:"file",webkitdirectory:"",directory:"",multiple:"",style:{display:"none"},onChange:m},null,544),E(Ne,{name:"tooltip-fade"},{default:K(()=>[c.value&&t.showToolPopover?(r(),u("div",{key:0,class:"tool-tooltip",style:Be(C.value)},[e("div",{class:"tool-tooltip-content",innerHTML:$e(_.value)},null,8,ta)],4)):N("",!0)]),_:1}),(r(),Ie(ao,{to:"body"},[E(Ne,{name:"preview-fade"},{default:K(()=>[W.value?(r(),u("div",{key:0,class:"image-preview-overlay",onClick:ft},[e("img",{src:A.value,alt:"预览图片",class:"image-preview-full",onClick:s[11]||(s[11]=xe(()=>{},["stop"]))},null,8,oa),e("button",{class:"image-preview-close",onClick:ft},[...s[39]||(s[39]=[e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])):N("",!0)]),_:1})]))]))}}),ia=_e(la,[["__scopeId","data-v-f4277da2"]]),D=M({system_prompt:"",api_base_url:"",api_key:"",models:[],embedding:{embedding_api_key:"",embedding_base_url:"",embedding_model_name:""},rag:{sliding_window_size:10,rag_trigger_threshold:3,rag_retrieval_count:10,rag_final_count:5},agent:{max_tool_iterations:10,temperature:1,top_p:1},default_headers:{}}),Ve=M([]),Qe=M(!1),Ye=M(""),Pt=M([]),eo=M(!1),wt=M({}),Go=me(()=>{const t={};for(const i of Pt.value)t[i.category]||(t[i.category]=[]),t[i.category].push(i);return t}),ye=M(null),to=M(!1),et=M([]);function aa(t){var i;return(i={low:"低风险",medium:"中风险",high:"高风险"}[t])!=null?i:t}function _o(t){return t.every(i=>i.show)}function ra(t){const i=t.filter(v=>v.show).length;return i>0&&i<t.length}async function oo(){var t,i;if(!D.value.api_base_url||!D.value.api_key){Ye.value="请先填写 API Base URL 和 API Key";return}Qe.value=!0,Ye.value="";try{const v=await nn({base_url:D.value.api_base_url,key:D.value.api_key});Qe.value=!1;const $=(i=(t=v.data)==null?void 0:t.data)!=null?i:v.data;Array.isArray($)&&$.length>0?(Ve.value=$.map(B=>({id:B})),Ye.value=""):(Ve.value=[],Ye.value="未获取到任何模型")}catch(v){Qe.value=!1,Ye.value="获取模型列表失败,请检查 API 配置",Ve.value=[]}}async function ua(){var t,i;eo.value=!0;try{const v=await an(),$=(i=(t=v.data)==null?void 0:t.data)!=null?i:v.data;Pt.value=Array.isArray($)?$:[];const B={};for(const T of Pt.value)B[T.category]||(B[T.category]=[]),B[T.category].push(T);const f={};for(const[T,y]of Object.entries(B))f[T]=y.every(o=>!o.show);wt.value=f}catch(v){}finally{eo.value=!1}}async function da(){var t,i;to.value=!0;try{const v=await rn(),$=(i=(t=v.data)==null?void 0:t.data)!=null?i:v.data;ye.value=$}catch(v){}finally{to.value=!1}}function ca(t){wt.value[t]=!wt.value[t]}async function Co(t){t._loading=!0;const i=!t.show;try{(await Uo({tool_id:t.id,show:i?"True":"False"})).status&&(t.show=i)}catch(v){}finally{t._loading=!1}}async function pa(t,i){const v=Go.value[t];if(v){v.forEach($=>{$._loading=!0});try{(await Uo({category:t,show:i?"True":"False"})).status&&v.forEach(B=>{B.show=i})}catch($){}finally{v.forEach($=>{$._loading=!1})}}}async function va(t){t._loading=!0;try{(await ln({skill_name:t.name,enabled:!t.enabled})).status&&(t.enabled=!t.enabled,ye.value&&(ye.value.enabled=ye.value.skills.filter(v=>v.enabled).length,ye.value.disabled=ye.value.total-ye.value.enabled))}catch(i){}finally{t._loading=!1}}function ko(){const t="header_".concat(Date.now());D.value.default_headers[t]="",et.value.push(t)}function fa(t){delete D.value.default_headers[t];const i=et.value.indexOf(t);i>-1&&et.value.splice(i,1)}function ga(t,i){const v=et.value[t];if(v!==i&&v){const $=D.value.default_headers[i];delete D.value.default_headers[i],D.value.default_headers[v]=$}}function ma(t){var i,v,$,B,f,T,y,o,c,_,C,d;t&&(D.value={system_prompt:t.system_prompt||"",api_base_url:t.api_base_url||"",api_key:t.api_key||"",models:t.models||[],embedding:{embedding_api_key:((i=t.embedding)==null?void 0:i.embedding_api_key)||"",embedding_base_url:((v=t.embedding)==null?void 0:v.embedding_base_url)||"",embedding_model_name:(($=t.embedding)==null?void 0:$.embedding_model_name)||""},rag:{sliding_window_size:((B=t.rag)==null?void 0:B.sliding_window_size)||10,rag_trigger_threshold:((f=t.rag)==null?void 0:f.rag_trigger_threshold)||3,rag_retrieval_count:((T=t.rag)==null?void 0:T.rag_retrieval_count)||10,rag_final_count:((y=t.rag)==null?void 0:y.rag_final_count)||5},agent:{max_tool_iterations:((o=t.agent)==null?void 0:o.max_tool_iterations)||10,temperature:(_=(c=t.agent)==null?void 0:c.temperature)!=null?_:1,top_p:(d=(C=t.agent)==null?void 0:C.top_p)!=null?d:1},default_headers:t.default_headers||{}},et.value=Object.keys(D.value.default_headers))}function ha(t,i){const v=Ae(t,B=>{ma(B)},{immediate:!0,deep:!0}),$=Ae(i,B=>{B&&(D.value.api_base_url&&D.value.api_key&&oo(),ua(),da())});return()=>{v(),$()}}function ya(){if(Ve.value.length>0){const t=Ve.value.map(i=>i.id);D.value.models=D.value.models.filter(i=>t.includes(i))}return D.value}const wa={mounted(t,i){t.indeterminate=i.value},updated(t,i){t.indeterminate=i.value}},_a={class:"drawer-content"},Ca={class:"form-section"},ka={class:"form-section-group"},ba={class:"form-section"},xa={class:"form-section"},Ta={class:"form-section"},Ma={class:"form-label-with-action"},$a=["disabled","title"],Sa={key:0,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},La={key:1,class:"spinning",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Ba={key:0,class:"empty-models"},Aa={key:1,class:"error-message"},Ia={key:2,class:"models-checkbox-group"},Ea=["value"],Pa={class:"model-name"},Ra={class:"form-section-group"},Da={key:0,class:"skills-loading"},za={key:1,class:"empty-skills"},Na={key:2,class:"tool-groups"},Fa=["onClick"],Ua={class:"tool-group-left"},Oa={class:"tool-group-name"},Wa={class:"tool-group-count"},Va=["checked","disabled","onChange"],Ha={class:"tool-item-list"},qa=["onClick"],ja={class:"tool-item-info"},Za={class:"tool-item-title"},Ga={class:"tool-item-name"},Ka={class:"tool-item-desc"},Ja=["checked","disabled","onClick"],Xa={class:"form-section-group"},Ya={class:"skills-header"},Qa={key:0,class:"skills-stats"},er={class:"stats-badge stats-enabled"},tr={class:"stats-badge stats-total"},or={key:0,class:"skills-loading"},sr={key:1,class:"empty-skills"},nr={key:2,class:"skills-list"},lr={class:"skill-info"},ir={class:"skill-name"},ar={class:"skill-desc"},rr={class:"skill-actions"},ur=["disabled","onClick"],dr={key:0,class:"spinning",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},cr={class:"form-section-group"},pr={class:"form-section"},vr={class:"form-section"},fr={class:"form-section"},gr={class:"form-section-group"},mr={class:"form-section"},hr={class:"form-section"},yr={class:"form-section"},wr={class:"form-section"},_r={class:"form-section-group"},Cr={class:"form-section"},kr={class:"form-section"},br={class:"form-section"},xr={class:"form-section-group"},Tr=["onUpdate:modelValue","onBlur"],Mr=["onUpdate:modelValue"],$r=["onClick"],Sr=se({__name:"SettingsDrawer",props:{visible:{type:Boolean},config:{}},emits:["close","save"],setup(t,{emit:i}){const v=t,$=i;let B;tt(()=>{B=ha(()=>v.config,()=>v.visible)}),_t(()=>{B&&B()});function f(){$("close")}function T(){const y=ya();$("save",y)}return(y,o)=>(r(),u("div",{class:z(["settings-drawer-overlay",{show:t.visible}]),onClick:f},[e("div",{class:z(["settings-drawer",{show:t.visible}]),onClick:o[17]||(o[17]=xe(()=>{},["stop"]))},[o[63]||(o[63]=e("div",{class:"drawer-header"},[e("h3",null,"全局参数配置")],-1)),e("div",_a,[e("div",Ca,[o[18]||(o[18]=e("label",{class:"form-label"},"System Prompt",-1)),J(e("textarea",{"onUpdate:modelValue":o[0]||(o[0]=c=>n(D).system_prompt=c),class:"form-textarea",rows:"6",placeholder:"请输入系统提示词..."},null,512),[[pe,n(D).system_prompt]])]),e("div",ka,[o[27]||(o[27]=e("h4",{class:"section-title"},"API 配置",-1)),e("div",ba,[o[19]||(o[19]=e("label",{class:"form-label"},"API Base URL",-1)),o[20]||(o[20]=e("div",{class:"form-hint"},"大模型 API 服务接口地址",-1)),J(e("input",{"onUpdate:modelValue":o[1]||(o[1]=c=>n(D).api_base_url=c),type:"text",class:"form-input",placeholder:"https://api.openai.com/v1"},null,512),[[pe,n(D).api_base_url]])]),e("div",xa,[o[21]||(o[21]=e("label",{class:"form-label"},"API Key",-1)),o[22]||(o[22]=e("div",{class:"form-hint"},"调用 API 的密钥或密码",-1)),J(e("input",{"onUpdate:modelValue":o[2]||(o[2]=c=>n(D).api_key=c),type:"text",class:"form-input",placeholder:"请输入 API Key"},null,512),[[pe,n(D).api_key]])]),e("div",Ta,[e("div",Ma,[o[25]||(o[25]=e("label",{class:"form-label"},"Models",-1)),e("button",{class:"fetch-models-btn",disabled:n(Qe)||!n(D).api_base_url||!n(D).api_key,title:!n(D).api_base_url||!n(D).api_key?"请先填写 API Base URL 和 API Key":"获取模型列表",onClick:o[3]||(o[3]=(...c)=>n(oo)&&n(oo)(...c))},[n(Qe)?(r(),u("svg",La,[...o[24]||(o[24]=[e("path",{d:"M21 12a9 9 0 11-6.219-8.56"},null,-1)])])):(r(),u("svg",Sa,[...o[23]||(o[23]=[e("path",{d:"M21 12a9 9 0 11-6.219-8.56"},null,-1)])])),ve(" "+P(n(Qe)?"获取中...":"获取模型列表"),1)],8,$a)]),o[26]||(o[26]=e("div",{class:"form-hint"},"选择要使用的模型",-1)),n(Ve).length===0&&!n(Qe)?(r(),u("div",Ba,' 点击"获取模型列表"按钮加载可用模型 ')):N("",!0),n(Ye)?(r(),u("div",Aa,P(n(Ye)),1)):N("",!0),n(Ve).length>0?(r(),u("div",Ia,[(r(!0),u(G,null,Y(n(Ve),c=>(r(),u("label",{key:c.id,class:"model-checkbox-item"},[J(e("input",{"onUpdate:modelValue":o[4]||(o[4]=_=>n(D).models=_),type:"checkbox",value:c.id,class:"model-checkbox"},null,8,Ea),[[ts,n(D).models]]),e("span",Pa,P(c.id),1)]))),128))])):N("",!0)])]),e("div",Ra,[o[30]||(o[30]=e("h4",{class:"section-title"},"工具配置",-1)),o[31]||(o[31]=e("div",{class:"form-hint",style:{"margin-bottom":"12px"}},"控制 Agent 可调用的工具,可按分类或单个工具管理显示状态",-1)),n(eo)?(r(),u("div",Da,[...o[28]||(o[28]=[e("svg",{class:"spinning",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M21 12a9 9 0 11-6.219-8.56"})],-1),ve(" 加载中... ",-1)])])):n(Pt).length?(r(),u("div",Na,[(r(!0),u(G,null,Y(n(Go),(c,_)=>(r(),u("div",{key:_,class:"tool-group"},[e("div",{class:"tool-group-header",onClick:C=>n(ca)(_)},[e("div",Ua,[(r(),u("svg",{class:z(["collapse-chevron",{collapsed:n(wt)[_]}]),width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},[...o[29]||(o[29]=[e("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2)),e("span",Oa,P(_),1),e("span",Wa,P(c.filter(C=>C.show).length)+"/"+P(c.length),1)]),J(e("input",{type:"checkbox",class:"tool-checkbox",checked:n(_o)(c),disabled:c.some(C=>C._loading),onClick:o[5]||(o[5]=xe(()=>{},["stop"])),onChange:xe(C=>n(pa)(_,!n(_o)(c)),["stop"])},null,40,Va),[[n(wa),n(ra)(c)]])],8,Fa),J(e("div",Ha,[(r(!0),u(G,null,Y(c,C=>(r(),u("div",{key:C.id,class:z(["tool-item",{"tool-item-loading":C._loading}]),onClick:d=>!C._loading&&n(Co)(C)},[e("div",ja,[e("div",Za,[e("span",Ga,P(C.name_cn||C.id),1),e("span",{class:z(["tool-risk-badge","risk-".concat(C.risk_level)])},P(n(aa)(C.risk_level)),3)]),e("div",Ka,P(C.description),1)]),e("input",{type:"checkbox",class:"tool-checkbox",checked:C.show,disabled:C._loading,onClick:xe(d=>!C._loading&&n(Co)(C),["stop"])},null,8,Ja)],10,qa))),128))],512),[[nt,!n(wt)[_]]])]))),128))])):(r(),u("div",za," 暂无可用工具 "))]),e("div",Xa,[e("div",Ya,[o[32]||(o[32]=e("h4",{class:"section-title",style:{"margin-bottom":"0"}},"Skills 配置",-1)),n(ye)?(r(),u("div",Qa,[e("span",er,"已启用 "+P(n(ye).enabled),1),e("span",tr,"共 "+P(n(ye).total),1)])):N("",!0)]),o[35]||(o[35]=e("div",{class:"form-hint",style:{"margin-top":"6px","margin-bottom":"12px"}},"管理已安装的 Agent Skills,可单独启用或禁用",-1)),n(to)?(r(),u("div",or,[...o[33]||(o[33]=[e("svg",{class:"spinning",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M21 12a9 9 0 11-6.219-8.56"})],-1),ve(" 加载中... ",-1)])])):!n(ye)||!n(ye).skills.length?(r(),u("div",sr," 暂无可用 Skills ")):(r(),u("div",nr,[(r(!0),u(G,null,Y(n(ye).skills,c=>(r(),u("div",{key:c.name,class:"skill-item"},[e("div",lr,[e("div",ir,P(c.name),1),e("div",ar,P(c.description),1)]),e("div",rr,[e("span",{class:z(["skill-status-badge",c.enabled?"badge-enabled":"badge-disabled"])},P(c.enabled?"已启用":"已禁用"),3),e("button",{class:z(["skill-toggle-btn",c.enabled?"btn-disable":"btn-enable"]),disabled:c._loading,onClick:_=>n(va)(c)},[c._loading?(r(),u("svg",dr,[...o[34]||(o[34]=[e("path",{d:"M21 12a9 9 0 11-6.219-8.56"},null,-1)])])):N("",!0),ve(" "+P(c.enabled?"禁用":"启用"),1)],10,ur)])]))),128))]))]),e("div",cr,[o[42]||(o[42]=e("h4",{class:"section-title"},"Embedding 配置",-1)),e("div",pr,[o[36]||(o[36]=e("label",{class:"form-label"},"Embedding Base URL",-1)),o[37]||(o[37]=e("div",{class:"form-hint"},"向量模型 API 服务地址",-1)),J(e("input",{"onUpdate:modelValue":o[6]||(o[6]=c=>n(D).embedding.embedding_base_url=c),type:"text",class:"form-input",placeholder:"https://api.openai.com/v1/embeddings"},null,512),[[pe,n(D).embedding.embedding_base_url]])]),e("div",vr,[o[38]||(o[38]=e("label",{class:"form-label"},"Embedding API Key",-1)),o[39]||(o[39]=e("div",{class:"form-hint"},"向量模型 API 密钥或密码",-1)),J(e("input",{"onUpdate:modelValue":o[7]||(o[7]=c=>n(D).embedding.embedding_api_key=c),type:"text",class:"form-input",placeholder:"请输入 Embedding API Key"},null,512),[[pe,n(D).embedding.embedding_api_key]])]),e("div",fr,[o[40]||(o[40]=e("label",{class:"form-label"},"Embedding Model Name",-1)),o[41]||(o[41]=e("div",{class:"form-hint"},"使用的向量模型名称",-1)),J(e("input",{"onUpdate:modelValue":o[8]||(o[8]=c=>n(D).embedding.embedding_model_name=c),type:"text",class:"form-input",placeholder:"text-embedding-v4"},null,512),[[pe,n(D).embedding.embedding_model_name]])])]),e("div",gr,[o[51]||(o[51]=e("h4",{class:"section-title"},"RAG 配置",-1)),e("div",mr,[o[43]||(o[43]=e("label",{class:"form-label"},"Sliding Window Size",-1)),o[44]||(o[44]=e("div",{class:"form-hint"},"每次滑动窗口的大小, 在条格数",-1)),J(e("input",{"onUpdate:modelValue":o[9]||(o[9]=c=>n(D).rag.sliding_window_size=c),type:"number",class:"form-input",placeholder:"10"},null,512),[[pe,n(D).rag.sliding_window_size,void 0,{number:!0}]])]),e("div",hr,[o[45]||(o[45]=e("label",{class:"form-label"},"Trigger Threshold",-1)),o[46]||(o[46]=e("div",{class:"form-hint"},"对话超过 N 轮触发 RAG",-1)),J(e("input",{"onUpdate:modelValue":o[10]||(o[10]=c=>n(D).rag.rag_trigger_threshold=c),type:"number",class:"form-input",placeholder:"3"},null,512),[[pe,n(D).rag.rag_trigger_threshold,void 0,{number:!0}]])]),e("div",yr,[o[47]||(o[47]=e("label",{class:"form-label"},"Retrieval Count",-1)),o[48]||(o[48]=e("div",{class:"form-hint"},"从向量库中召回 N 条相关",-1)),J(e("input",{"onUpdate:modelValue":o[11]||(o[11]=c=>n(D).rag.rag_retrieval_count=c),type:"number",class:"form-input",placeholder:"10"},null,512),[[pe,n(D).rag.rag_retrieval_count,void 0,{number:!0}]])]),e("div",wr,[o[49]||(o[49]=e("label",{class:"form-label"},"Final Count",-1)),o[50]||(o[50]=e("div",{class:"form-hint"},"最终拼接进 Prompt 的参考条数",-1)),J(e("input",{"onUpdate:modelValue":o[12]||(o[12]=c=>n(D).rag.rag_final_count=c),type:"number",class:"form-input",placeholder:"5"},null,512),[[pe,n(D).rag.rag_final_count,void 0,{number:!0}]])])]),e("div",_r,[o[58]||(o[58]=e("h4",{class:"section-title"},"Agent 配置",-1)),e("div",Cr,[o[52]||(o[52]=e("label",{class:"form-label"},"Max Tool Iterations",-1)),o[53]||(o[53]=e("div",{class:"form-hint"},"单次工具调用次数, 防止循环",-1)),J(e("input",{"onUpdate:modelValue":o[13]||(o[13]=c=>n(D).agent.max_tool_iterations=c),type:"number",class:"form-input",placeholder:"10"},null,512),[[pe,n(D).agent.max_tool_iterations,void 0,{number:!0}]])]),e("div",kr,[o[54]||(o[54]=e("label",{class:"form-label"},"Temperature",-1)),o[55]||(o[55]=e("div",{class:"form-hint"},"温度值 (0-2), 控制随机性",-1)),J(e("input",{"onUpdate:modelValue":o[14]||(o[14]=c=>n(D).agent.temperature=c),type:"number",step:"0.1",min:"0",max:"2",class:"form-input",placeholder:"1"},null,512),[[pe,n(D).agent.temperature,void 0,{number:!0}]])]),e("div",br,[o[56]||(o[56]=e("label",{class:"form-label"},"Top P",-1)),o[57]||(o[57]=e("div",{class:"form-hint"},"采样值 (0-1), 控制输出稳定性",-1)),J(e("input",{"onUpdate:modelValue":o[15]||(o[15]=c=>n(D).agent.top_p=c),type:"number",step:"0.1",min:"0",max:"1",class:"form-input",placeholder:"1"},null,512),[[pe,n(D).agent.top_p,void 0,{number:!0}]])])]),e("div",xr,[o[61]||(o[61]=e("h4",{class:"section-title"},"Default Headers",-1)),o[62]||(o[62]=e("div",{class:"form-hint",style:{"margin-bottom":"12px"}},"自定义请求头",-1)),(r(!0),u(G,null,Y(n(D).default_headers,(c,_,C)=>(r(),u("div",{key:C,class:"header-item"},[J(e("input",{"onUpdate:modelValue":d=>n(et)[C]=d,type:"text",class:"form-input header-key",placeholder:"键",onBlur:d=>n(ga)(C,_)},null,40,Tr),[[pe,n(et)[C]]]),J(e("input",{"onUpdate:modelValue":d=>n(D).default_headers[_]=d,type:"text",class:"form-input header-value",placeholder:"值"},null,8,Mr),[[pe,n(D).default_headers[_]]]),e("button",{class:"delete-header-btn",title:"删除",onClick:d=>n(fa)(_)},[...o[59]||(o[59]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"3 6 5 6 21 6"}),e("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})],-1)])],8,$r)]))),128)),e("button",{class:"add-header-btn",onClick:o[16]||(o[16]=(...c)=>n(ko)&&n(ko)(...c))},[...o[60]||(o[60]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 5v14M5 12h14"})],-1),ve(" 添加 ",-1)])])])]),e("div",{class:"drawer-footer"},[e("button",{class:"save-btn",onClick:T},"保存")])],2)],2))}}),Lr=_e(Sr,[["__scopeId","data-v-138c9e9f"]]),Br={class:"ai-chat-title"},Ar={class:"ai-chat-actions"},Ir=["disabled"],Er=["disabled"],Pr={key:0,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},Rr={key:1,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},Dr={key:0,class:"quota-item"},zr={class:"quota-item"},Nr={key:0},Fr={key:1},Ur={class:"chat-main"},Or=se({__name:"index",props:{windowMode:{}},emits:["close","update:windowMode"],setup(t,{expose:i,emit:v}){const $=t,B=v,{inputMessage:f,currentMessages:T,conversations:y,currentConversationId:o,historyPanelVisible:c,isTyping:_,isSending:C,streamingContentBlocks:d,streamingThinkCollapsed:w,modelsList:S,currentModel:W,toolsList:A,selectedTools:L,showToolPopover:q,toolsLoading:Q,webSearchEnabled:ie,smartMode:ne,loadConversations:Ce,saveConversation:U,loadConversation:te,deleteConversation:ke,createNewConversation:he,getTimeAgo:ae}=jn(),{payment:ge}=Ee(),{getAIResponseStream:re,abortCurrentRequest:He}=Zn(),ue=M(null),V=M(null),Z=M(null);let de=null,ce=!1,Pe=0,lt=0,Re=0,Ct=0;function it(){var m;return(m=ue.value)==null?void 0:m.closest(".ai-chat-wrapper")}function Nt(){const m=it();m&&(m.style.top="",m.style.left="",m.style.bottom="",m.style.right="")}function at(m){if($.windowMode!=="popup"||m.target.closest("button")||m.target.closest(".el-popover"))return;const h=it();if(!h)return;ce=!0,Pe=m.clientX,lt=m.clientY;const x=h.getBoundingClientRect();Re=x.top,Ct=x.left,h.style.top="".concat(x.top,"px"),h.style.left="".concat(x.left,"px"),h.style.bottom="auto",h.style.right="auto",document.addEventListener("mousemove",rt),document.addEventListener("mouseup",ut),m.preventDefault()}function rt(m){if(!ce)return;const h=it();if(!h)return;const x=h.offsetWidth,I=h.offsetHeight,j=Math.max(0,Math.min(Re+m.clientY-lt,window.innerHeight-I)),O=Math.max(0,Math.min(Ct+m.clientX-Pe,window.innerWidth-x));h.style.top="".concat(j,"px"),h.style.left="".concat(O,"px")}function ut(){ce=!1,document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",ut)}let Fe=null;function Te(){_.value=!1,Fe&&clearTimeout(Fe),Fe=setTimeout(()=>{C.value&&(_.value=!0)},3e3)}function De(){Fe&&(clearTimeout(Fe),Fe=null),_.value=!1}function kt(){$.windowMode==="snap"?B("update:windowMode","popup"):B("update:windowMode","snap")}Ae(()=>$.windowMode,()=>{X(()=>Nt())});const dt=M(!1),ze=M({remain:0,total:0,resetTime:"",exhausted:!1}),Me=M({remain:0,total:0,exhausted:!1}),bt=M(!1),qe=M({system_prompt:"",api_base_url:"",api_key:"",models:[],embedding:{embedding_api_key:"",embedding_base_url:"",embedding_model_name:""},rag:{sliding_window_size:10,rag_trigger_threshold:3,rag_retrieval_count:10,rag_final_count:5},agent:{max_tool_iterations:10,temperature:1,top_p:1},default_headers:{},questions:[]});function xt(m){if(!m)return;dt.value=!0;const h=(m.total||0)-(m.used||0);ze.value={remain:Math.max(0,h),total:m.total||0,resetTime:m.reset_time||"",exhausted:h<=0};const x=m.common_packages;if(x&&x.total_count>0){const I=x.total_count-x.used_count;Me.value={remain:Math.max(0,I),total:x.total_count,exhausted:I<=0}}else Me.value={remain:0,total:0,exhausted:!1};m.gift&&dn()}const Ue=async()=>{var h;const m=await Bt({type:"aics"});m.data&&((h=m.data.data)!=null&&h.daily_quota)&&(xt(m.data.data.daily_quota),window.dispatchEvent(new CustomEvent("update-sidebar-info",{detail:{data:m.data}})))},Ft=async()=>{Ro({title:"额度充值",area:80,btn:!1,showFooter:!1,customClass:"top-index ",compData:{callback:async()=>{const m=await Bt({type:"aics"});m.status&&ot(m.data.data)}},component:()=>Es(()=>import("./index493.js?v=1777008528"),__vite__mapDeps([]),import.meta.url)})};function ot(m){var h,x,I,j,O,ee,fe,$e,Ze,Ge,Ke,Je;m&&m.config&&(qe.value={system_prompt:m.config.system_prompt||"",api_base_url:m.config.api_base_url||"",api_key:m.config.api_key||"",models:m.config.models||[],embedding:{embedding_api_key:((h=m.config.embedding)==null?void 0:h.embedding_api_key)||"",embedding_base_url:((x=m.config.embedding)==null?void 0:x.embedding_base_url)||"",embedding_model_name:((I=m.config.embedding)==null?void 0:I.embedding_model_name)||""},rag:{sliding_window_size:((j=m.config.rag)==null?void 0:j.sliding_window_size)||10,rag_trigger_threshold:((O=m.config.rag)==null?void 0:O.rag_trigger_threshold)||3,rag_retrieval_count:((ee=m.config.rag)==null?void 0:ee.rag_retrieval_count)||10,rag_final_count:((fe=m.config.rag)==null?void 0:fe.rag_final_count)||5},agent:{max_tool_iterations:(($e=m.config.agent)==null?void 0:$e.max_tool_iterations)||10,temperature:(Ge=(Ze=m.config.agent)==null?void 0:Ze.temperature)!=null?Ge:1,top_p:(Je=(Ke=m.config.agent)==null?void 0:Ke.top_p)!=null?Je:1},default_headers:m.config.default_headers||{}},S.value=m.config.models||[],S.value.length>0&&(W.value=m.config.default_model||S.value[0])),m&&m.questions&&(qe.value.questions=m.questions),m&&m.daily_quota&&xt(m.daily_quota)}const ct=()=>{Ks({name:"bt_agent"}),B("close")};tt(async()=>{var x;Ce(),document.addEventListener("click",St);const m=await Bt({type:"aics"});m.status&&ot(m.data.data),Q.value=!0;const h=await mo();h.data&&Array.isArray((x=h.data)==null?void 0:x.data)&&(A.value=h.data.data||[]),Q.value=!1}),_t(()=>{document.removeEventListener("click",St),document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",ut),He(),De(),Ue()});function pt(){He(),De(),C.value=!1,d.value.length>0&&(d.value.forEach(m=>{m.type==="think"&&(m.collapsed=!0)}),T.value.push({role:"assistant",content:"",time:new Date().toISOString(),contentBlocks:[...d.value]})),d.value=[],U(),Ue()}async function je(){var $e,Ze,Ge,Ke,Je,l,s;if(!ge.value.bindUser){le.error("请先绑定用户"),Js();return}const m=f.value,h=(($e=Z.value)==null?void 0:$e.getPendingImages())||[],x=((Ze=Z.value)==null?void 0:Ze.getPendingFiles())||[],I=(Ge=Z.value)==null?void 0:Ge.getPendingSites();if(!m&&h.length===0&&x.length===0&&((I==null?void 0:I.length)||0)===0||C.value)return;o.value||(o.value=Date.now().toString()),C.value=!0,f.value="",(Ke=Z.value)==null||Ke.clearAll(),X(()=>{var a;(a=Z.value)==null||a.autoResizeTextarea()});const j=[];m&&j.push({type:"text",text:m});const O=new Set;for(const a of x){const p="@".concat(a.name),g=j.find(b=>{var R;return b.type==="file"&&"source"in b&&((R=b.source)==null?void 0:R.value)===p}),k=m.indexOf(p,(l=(Je=g==null?void 0:g.source)==null?void 0:Je.end)!=null?l:0);k!==-1&&(j.push({type:"file",source:{value:p,start:k,end:k+p.length},path:a.path}),O.add(p))}for(const a of I||[]){const p="@site:".concat(a.name),g=m.indexOf(p);g!==-1&&j.push({type:"site",source:{value:p,start:g,end:g+p.length},name:a.name})}if(h.length>0)for(const a of h)j.push({type:"image_url",image_url:{url:a}});const ee=j,fe=T.value.length;T.value.push({role:"user",content:ee,time:new Date().toISOString()}),_.value=!0,(s=V.value)==null||s.forceScrollToBottom(),d.value=[],w.value=!1,await re(ee,o.value,W.value,L.value,A.value,ie.value,ne.value,a=>{Te();const p=d.value[d.value.length-1];p&&p.type==="message"?p.content+=a:d.value.push({type:"message",content:a}),d.value.some(g=>g.type==="think")&&(w.value=!0),X(()=>{var g;(g=V.value)==null||g.scrollToBottom()})},()=>{if(De(),d.value.length>0){d.value.forEach(p=>{p.type==="think"&&(p.collapsed=!0)});const a=window.__temp_ai_msg_id;delete window.__temp_ai_msg_id,T.value.push({role:"assistant",content:"",time:new Date().toISOString(),contentBlocks:[...d.value],id:a})}d.value=[],C.value=!1,U(),Ue(),X(()=>{var a;(a=V.value)==null||a.scrollToBottom()})},a=>{De(),d.value.forEach(p=>{p.type==="think"&&(p.collapsed=!0)}),d.value.push({type:"message",content:a}),T.value.push({role:"assistant",content:"",time:new Date().toISOString(),contentBlocks:[...d.value]}),d.value=[],C.value=!1,U(),Ue()},a=>{Te();const p=d.value[d.value.length-1];p&&p.type==="think"?p.content+=a:(d.value.forEach(g=>{g.type==="think"&&(g.collapsed=!0)}),d.value.push({type:"think",content:a,collapsed:!1})),X(()=>{var g;(g=V.value)==null||g.scrollToBottom()})},a=>{Te();const p=(()=>{try{return JSON.parse(a.args).description}catch(k){return}})();if(a.tool==="TodoWrite"){const k=Qt(a.args);if(k&&k.length>0){const b=d.value.findIndex(R=>R.type==="tool_call"&&R.tool==="TodoWrite");b!==-1&&d.value.splice(b,1),d.value.push({type:"tool_call",tool:a.tool,args:a.args,id:a.id,status:"calling",collapsed:!1,todoItems:k,description:p})}}else{const k=d.value.find(b=>b.type==="tool_call"&&b.id===a.id);k&&k.type==="tool_call"?(k.args=a.args,k.status="calling",p&&(k.description=p)):d.value.push({type:"tool_call",tool:a.tool,args:a.args,id:a.id,status:"calling",collapsed:!0,description:p})}X(()=>{var k;(k=V.value)==null||k.scrollToBottom()})},a=>{Te();const p=d.value.find(g=>g.type==="tool_call"&&g.id===a.id);if(p&&p.type==="tool_call"&&(p.result=a.result,p.status="completed",p.tool==="TodoWrite")){const g=ho(a.result);g&&(p.todoItems=g)}X(()=>{var g;(g=V.value)==null||g.scrollToBottom()})},a=>{T.value[fe]&&(T.value[fe].id=a.user_msg_id),window.__temp_ai_msg_id=a.ai_msg_id})}async function Tt(m){let h="";for(let x=m-1;x>=0;x--)if(T.value[x].role==="user"){h=T.value[x].content;break}h&&(T.value.splice(m,1),_.value=!0,C.value=!0,d.value=[],w.value=!1,await re(h,o.value||Date.now().toString(),W.value,L.value,A.value,ie.value,ne.value,x=>{var j;Te();const I=d.value[d.value.length-1];I&&I.type==="message"?I.content+=x:d.value.push({type:"message",content:x}),(j=V.value)==null||j.scrollToBottom()},()=>{if(De(),d.value.length>0){d.value.forEach(I=>{I.type==="think"&&(I.collapsed=!0)});const x=window.__temp_ai_msg_id_regen;delete window.__temp_ai_msg_id_regen,T.value.splice(m,0,{role:"assistant",content:"",time:new Date().toISOString(),contentBlocks:[...d.value],id:x})}d.value=[],C.value=!1,U(),Ue()},x=>{De(),d.value.forEach(I=>{I.type==="think"&&(I.collapsed=!0)}),d.value.push({type:"message",content:x}),T.value.splice(m,0,{role:"assistant",content:"",time:new Date().toISOString(),contentBlocks:[...d.value]}),d.value=[],C.value=!1,U(),Ue()},x=>{var j;Te();const I=d.value[d.value.length-1];I&&I.type==="think"?I.content+=x:(d.value.forEach(O=>{O.type==="think"&&(O.collapsed=!0)}),d.value.push({type:"think",content:x,collapsed:!1})),(j=V.value)==null||j.scrollToBottom()},x=>{var O;Te();const I=(()=>{try{return JSON.parse(x.args).description}catch(ee){return}})();if(x.tool==="TodoWrite"){const ee=Qt(x.args);if(ee&&ee.length>0){const fe=d.value.findIndex($e=>$e.type==="tool_call"&&$e.tool==="TodoWrite");fe!==-1&&d.value.splice(fe,1),d.value.push({type:"tool_call",tool:x.tool,args:x.args,id:x.id,status:"calling",collapsed:!1,todoItems:ee,description:I})}}else{const ee=d.value.find(fe=>fe.type==="tool_call"&&fe.id===x.id);ee&&ee.type==="tool_call"?(ee.args=x.args,ee.status="calling",I&&(ee.description=I)):d.value.push({type:"tool_call",tool:x.tool,args:x.args,id:x.id,status:"calling",collapsed:!0,description:I})}(O=V.value)==null||O.scrollToBottom()},x=>{var j;Te();const I=d.value.find(O=>O.type==="tool_call"&&O.id===x.id);if(I&&I.type==="tool_call"&&(I.result=x.result,I.status="completed",I.tool==="TodoWrite")){const O=ho(x.result);O&&(I.todoItems=O)}(j=V.value)==null||j.scrollToBottom()},x=>{window.__temp_ai_msg_id_regen=x.ai_msg_id}))}async function Ut(m){const h=T.value[m],x=async()=>{if(!h.id||!o.value){T.value.splice(m,1),U(),T.value.length===0&&he();return}(await cn({session_id:o.value,sessions_dir:"aics_sessions",id:h.id})).status&&(T.value.splice(m,1),U(),T.value.length===0&&he())},I=h.id?"删除后,聊天记录不可恢复,对话内的文件也将被彻底删除":"是否删除该条消息?";await We({title:"删除消息",content:I}),await x()}function Ot(m){if(f.value=m.question,m.tools&&m.tools.length>0){const h=m.tools.map(x=>A.value.find(I=>I.id===x)).filter(x=>x!==void 0);L.value=h}X(()=>{var h;(h=Z.value)==null||h.autoResizeTextarea()})}function Mt(){$t(),c.value=!0}function vt(){c.value=!1}function ft(){de=setTimeout(()=>{vt()},200)}function $t(){de&&(clearTimeout(de),de=null)}async function Wt(m){var h;vt(),await te(m),(h=V.value)==null||h.forceScrollToBottom()}async function Vt(m){localStorage.getItem("isPanelRiskConfirm");const h=L.value.findIndex(x=>x.id===m.id);h>-1?L.value.splice(h,1):L.value.push(m)}function Ht(m,h){if(h)m.forEach(x=>{L.value.some(I=>I.id===x.id)||L.value.push(x)});else{const x=new Set(m.map(I=>I.id));L.value=L.value.filter(I=>!x.has(I.id))}}function qt(m){const h=L.value.findIndex(x=>x.id===m);h>-1&&L.value.splice(h,1)}function St(m){const h=m.target;!h.closest(".custom-popover")&&!h.closest(".toolbar-button")&&(q.value=!1)}async function be(){var h;bt.value=!1;const m=await mo();m.data&&Array.isArray((h=m.data)==null?void 0:h.data)&&(A.value=m.data.data||[])}async function gt(m){var x,I;if((await un({config:m})).status){qe.value=m,be(),(x=window.layer)==null||x.msg("配置保存成功",{icon:1});const j=await Bt({type:"aics"});j.data&&ot(j.data)}else(I=window.layer)==null||I.msg("配置保存失败",{icon:2})}async function jt(m,h,x){var I,j;if(C.value){f.value=m,x&&x.length>0&&((I=Z.value)==null||I.addImages(x)),X(()=>{var O;(O=Z.value)==null||O.autoResizeTextarea()});return}he(),f.value="",await X(),f.value=m,x&&x.length>0&&((j=Z.value)==null||j.addImages(x)),X(()=>{var O,ee;(O=Z.value)==null||O.autoResizeTextarea(),h?je():(ee=Z.value)==null||ee.focus()})}function Zt(){C.value||(f.value="继续",X(()=>{je()}))}return i({sendMessage:je,isSending:C,inputMessage:f,createNewConversation:he,fillMessageAndSend:jt,scrollToBottom:()=>{var m;(m=V.value)==null||m.forceScrollToBottom()}}),(m,h)=>{const x=en,I=no,j=io;return r(),u("div",{ref_key:"containerRef",ref:ue,class:z(["ai-chat-container",t.windowMode])},[e("div",{class:"ai-chat-header",onMousedown:at},[e("div",Br,[h[10]||(h[10]=Dt('<span class="ai-icon" data-v-24495a99>✦</span><div class="ai-title-text" data-v-24495a99><span class="ai-title-main" data-v-24495a99>宝塔 AI 助手</span><span class="ai-title-status" data-v-24495a99><span class="status-dot" data-v-24495a99></span> 在线 </span></div>',2)),E(I,{placement:"bottom","popper-style":{padding:"0"},teleported:!1,width:200,trigger:"hover"},{reference:K(()=>[...h[9]||(h[9]=[e("div",{class:"customer-btn",title:"人工客服"},[e("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M3 18v-6a9 9 0 0 1 18 0v6"}),e("path",{d:"M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"})]),e("span",null,"人工客服")],-1)])]),default:K(()=>[E(x)]),_:1})]),e("div",Ar,[E(j,{content:"新建对话",placement:"bottom",teleported:!1},{default:K(()=>[e("button",{class:"action-btn",disabled:n(C),onClick:h[0]||(h[0]=(...O)=>n(he)&&n(he)(...O))},[...h[11]||(h[11]=[e("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 5v14M5 12h14"})],-1)])],8,Ir)]),_:1}),e("button",{class:"action-btn",disabled:n(C),onMouseenter:h[1]||(h[1]=O=>!n(C)&&Mt()),onMouseleave:h[2]||(h[2]=O=>!n(C)&&ft())},[...h[12]||(h[12]=[e("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("polyline",{points:"12 6 12 12 16 14"})],-1)])],40,Er),t.windowMode!=="auto-fullscreen"?(r(),Ie(j,{key:0,content:t.windowMode==="snap"?"取消吸附":"吸附到侧边",placement:"bottom",teleported:!1},{default:K(()=>[e("button",{class:"action-btn",onClick:kt},[t.windowMode!=="snap"?(r(),u("svg",Pr,[...h[13]||(h[13]=[e("rect",{x:"13",y:"3",width:"8",height:"18",rx:"1"},null,-1),e("path",{d:"M3 3h6v18H3z",opacity:"0.4"},null,-1)])])):(r(),u("svg",Rr,[...h[14]||(h[14]=[e("rect",{x:"3",y:"6",width:"18",height:"13",rx:"1"},null,-1),e("path",{d:"M8 6V4M16 6V4"},null,-1)])]))])]),_:1},8,["content"])):N("",!0),e("button",{class:"action-btn action-btn-close",onClick:h[3]||(h[3]=O=>m.$emit("close"))},[...h[15]||(h[15]=[e("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])])])],32),dt.value?(r(),u("div",{key:0,class:z(["quota-bar",{"quota-bar--exhausted":Me.value.total>0?ze.value.exhausted&&Me.value.exhausted:ze.value.exhausted}])},[ze.value.total>0?(r(),u("span",Dr,[h[16]||(h[16]=ve(" 每日剩余 ",-1)),e("strong",null,P(ze.value.remain),1),h[17]||(h[17]=ve(" 次 ",-1)),ze.value.resetTime?(r(),u(G,{key:0},[ve("· 于"+P(ze.value.resetTime)+"刷新",1)],64)):N("",!0)])):N("",!0),e("span",zr,[Me.value.total>0?(r(),u("span",Nr,[h[18]||(h[18]=ve("资源包剩余 ",-1)),e("strong",null,P(Me.value.remain),1),h[19]||(h[19]=ve(" 次 ",-1))])):N("",!0),h[20]||(h[20]=ve()),Me.value.total===0?(r(),u("span",Fr,"当前暂无额度,")):N("",!0),e("span",{class:"bt-link !text-[11px]",onClick:Ft},"点击充值")])],2)):N("",!0),e("div",Ur,[E(ol,{conversations:n(y),"current-conversation-id":n(o),"panel-visible":n(c),"get-time-ago":n(ae),"is-sending":n(C),onShowPanel:Mt,onHidePanel:vt,onStartHideTimer:ft,onClearHideTimer:$t,onLoadConversation:Wt,onDeleteConversation:n(ke)},null,8,["conversations","current-conversation-id","panel-visible","get-time-ago","is-sending","onDeleteConversation"]),E(vi,{ref_key:"chatMainRef",ref:V,messages:n(T),"is-typing":n(_),isSending:n(C),"streaming-content-blocks":n(d),"streaming-think-collapsed":n(w),suggestions:qe.value.questions,"onUpdate:streamingThinkCollapsed":h[4]||(h[4]=O=>w.value=O),onSuggestionClick:Ot,onRegenerate:Tt,onDeleteMessage:Ut,onContinue:Zt},null,8,["messages","is-typing","isSending","streaming-content-blocks","streaming-think-collapsed","suggestions"]),E(ia,{ref_key:"chatInputRef",ref:Z,inputMessage:n(f),"onUpdate:inputMessage":h[5]||(h[5]=O=>Lt(f)?f.value=O:null),showToolPopover:n(q),"onUpdate:showToolPopover":h[6]||(h[6]=O=>Lt(q)?q.value=O:null),webSearchEnabled:n(ie),"onUpdate:webSearchEnabled":h[7]||(h[7]=O=>Lt(ie)?ie.value=O:null),smartMode:n(ne),"onUpdate:smartMode":h[8]||(h[8]=O=>Lt(ne)?ne.value=O:null),"selected-tools":n(L),"tools-list":n(A),"tools-loading":n(Q),"is-sending":n(C),onSendMessage:je,onStopMessage:pt,onRemoveSelectedTool:qt,onToggleToolSelection:Vt,onBatchToggleTools:Ht,onOpenPluginView:ct},null,8,["inputMessage","showToolPopover","webSearchEnabled","smartMode","selected-tools","tools-list","tools-loading","is-sending"])]),E(Lr,{visible:bt.value,config:qe.value,onClose:be,onSave:gt},null,8,["visible","config"])],2)}}}),Wr=_e(Or,[["__scopeId","data-v-24495a99"]]),Vr={class:"toolbar-right"},bo="ai_window_mode",Hr=se({__name:"index",setup(t){const{panel:i,payment:v,getGlobalInfo:$}=Ee();M(!0),M(!1),M(!1);let B=0,f=0;const T=M(!1),y=M("popup");M(!1);const o=M(null);function c(){const W=localStorage.getItem(bo);return W&&["popup","snap","fullscreen"].includes(W)?window.innerWidth<920||window.innerHeight<500?"auto-fullscreen":W:window.innerWidth<920||window.innerHeight<500?"auto-fullscreen":"popup"}async function _(){T.value?C():(y.value=c(),T.value=!0,setTimeout(()=>{var W;(W=o.value)==null||W.scrollToBottom()},100))}function C(){y.value!=="auto-fullscreen"&&localStorage.setItem(bo,y.value),T.value=!1}async function d(){const W=i.value.isShowCustomer,A=i.value.isShowEvaluate;try{W&&A?await We({content:"您确定要永久关闭吗?",title:"关闭悬浮按钮",width:"42rem",type:"check",check:{content:"仅关闭AI助手",value:!0,onConfirm:async L=>{const q=await fo();if(L){q.status?(i.value.isShowCustomer=!1,le.success("已关闭AI助手"),$()):le.error("操作失败");return}(await go()).status?(i.value.isShowEvaluate=!1,le.success("已关闭"),$()):le.error("操作失败")}}}):W?(await We({content:"您确定要永久关闭吗?",title:"关闭悬浮按钮",width:"42rem"}),(await fo()).status?(i.value.isShowCustomer=!1,le.success("已关闭AI助手"),$()):le.error("操作失败")):A&&(await We({content:"您确定要永久关闭吗?",title:"关闭悬浮按钮",width:"42rem"}),(await go()).status?(i.value.isShowEvaluate=!1,le.success("已关闭"),$()):le.error("操作失败"))}catch(L){}}function w(){if(!T.value)return;const W=window.innerWidth<920||window.innerHeight<500;W&&y.value!=="auto-fullscreen"?y.value="auto-fullscreen":!W&&y.value==="auto-fullscreen"&&(y.value="popup")}function S(W){var ie;const{message:A,autoSend:L,windowMode:q,images:Q}=W.detail;if(T.value)(ie=o.value)==null||ie.fillMessageAndSend(A,L!=null?L:!1,Q);else{q&&["popup","snap","fullscreen"].includes(q)?y.value=q:y.value=c(),T.value=!0;const ne=()=>{if(!o.value){X(ne);return}o.value.fillMessageAndSend(A,L!=null?L:!1,Q)};X(ne)}}return tt(async()=>{if(window.addEventListener("resize",w),window.addEventListener("open-ai-chat",S),!i.value.panelNps){const W=await Ps({version:"v2",productType:0,softwareName:"panel"});W.data.nps&&W.data.safe_day>=15&&Jt()}}),_t(()=>{window.removeEventListener("resize",w),window.removeEventListener("open-ai-chat",S),clearTimeout(B),clearTimeout(f)}),(W,A)=>{const L=qo,q=Do;return r(),u(G,null,[e("div",Vr,[e("span",{class:"svgtofont-el-close",onClick:d}),E(L,{effect:"dark",content:"AI 助手",placement:"left",enterable:!1},{default:K(()=>[e("div",{class:z(["icon-menu flex-col !h-[9rem]",{"icon-menu-active":n(T),"!hidden":!n(i).isShowCustomer}]),onClick:_},[...A[2]||(A[2]=[e("div",{class:"ml-[-.3rem]"},[e("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 17 24",width:"24.000000",height:"33.000000",fill:"none",customFrame:"#000000"},[e("defs",null,[e("clipPath",{id:"clipPath_0"},[e("rect",{width:"13.000000",height:"13.000000",x:"3.175781",y:"12.000000",fill:"rgb(255,255,255)"})]),e("linearGradient",{id:"paint_linear_5",x1:"9.67578125",x2:"9.67578125",y1:"12.2714844",y2:"25",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(207,86,255)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(139,136,240)",offset:"1","stop-opacity":"1"})]),e("linearGradient",{id:"paint_linear_6",x1:"9.5",x2:"9.5",y1:"14",y2:"24",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(207,86,255)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(139,136,240)",offset:"1","stop-opacity":"1"})]),e("clipPath",{id:"clipPath_1"},[e("rect",{width:"7.000000",height:"7.000000",x:"6.175781",y:"4.000000",fill:"rgb(255,255,255)"})]),e("linearGradient",{id:"paint_linear_7",x1:"9.68390274",x2:"9.68390274",y1:"4.32434082",y2:"10.6896744",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(255,192,8)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(255,222,124)",offset:"1","stop-opacity":"1"})]),e("linearGradient",{id:"paint_linear_8",x1:"1.98535156",x2:"1.98535156",y1:"0",y2:"3.97070312",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(255,15,0)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(255,15,0)",offset:"1","stop-opacity":"0"})]),e("linearGradient",{id:"paint_linear_9",x1:"1.98339844",x2:"1.98339844",y1:"0",y2:"3.96679688",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(0,136,255)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(0,136,255)",offset:"1","stop-opacity":"0"})]),e("linearGradient",{id:"paint_linear_10",x1:"1",x2:"1",y1:"0",y2:"2",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(0,255,129)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(0,255,129)",offset:"1","stop-opacity":"0"})])]),e("g",{id:"组合 286"},[e("g",{id:"svg 155",opacity:"0","clip-path":"url(#clipPath_0)",customFrame:"url(#clipPath_0)"},[e("rect",{id:"svg 155",width:"13.000000",height:"13.000000",x:"3.175781",y:"12.000000"}),e("path",{id:"合并",d:"M10.2174 13.6896C10.3837 13.5406 10.4883 13.3245 10.4883 13.084C10.4883 12.9289 10.4439 12.777 10.3603 12.6463C10.2767 12.5156 10.1575 12.4115 10.0166 12.3464C9.87581 12.2814 9.71929 12.258 9.56558 12.279C9.41188 12.3 9.26741 12.3646 9.14925 12.4652C9.0311 12.5657 8.94419 12.698 8.89882 12.8463C8.85344 12.9947 8.85148 13.1529 8.89318 13.3024C8.93487 13.4518 9.01848 13.5862 9.13411 13.6896L9.13411 14.709L6.42578 14.709C6.14053 14.709 5.86031 14.7841 5.61328 14.9267C5.36625 15.0693 5.16111 15.2745 5.01849 15.5215C4.87587 15.7685 4.80078 16.0488 4.80078 16.334L4.80078 21.7507C4.80078 22.0359 4.87587 22.3161 5.01849 22.5632C5.16111 22.8102 5.36625 23.0153 5.61328 23.158C5.86031 23.3006 6.14053 23.3757 6.42578 23.3757L12.9258 23.3757C13.211 23.3757 13.4912 23.3006 13.7383 23.158C13.9853 23.0153 14.1904 22.8102 14.3331 22.5632C14.4757 22.3161 14.5508 22.0359 14.5508 21.7507L14.5508 16.334C14.5508 16.0488 14.4757 15.7685 14.3331 15.5215C14.1904 15.2745 13.9853 15.0693 13.7383 14.9267C13.4912 14.7841 13.211 14.709 12.9258 14.709L10.2174 14.709L10.2174 13.6896ZM4.25911 17.4173L3.17578 17.4173L3.17578 20.6673L4.25911 20.6673L4.25911 17.4173ZM15.0924 17.4173L16.1758 17.4173L16.1758 20.6673L15.0924 20.6673L15.0924 17.4173ZM8.52836 19.6997C8.38954 19.8005 8.22236 19.8548 8.05078 19.8548C7.8792 19.8548 7.71202 19.8005 7.57321 19.6997C7.43439 19.5988 7.33107 19.4566 7.27805 19.2934C7.22503 19.1302 7.22503 18.9544 7.27805 18.7913C7.33107 18.6281 7.43439 18.4859 7.57321 18.385C7.71202 18.2842 7.8792 18.2298 8.05078 18.2298C8.22236 18.2298 8.38954 18.2842 8.52836 18.385C8.66717 18.4859 8.77049 18.6281 8.82351 18.7913C8.87654 18.9544 8.87654 19.1302 8.82351 19.2934C8.77049 19.4566 8.66717 19.5988 8.52836 19.6997ZM11.5519 18.2696C11.715 18.3226 11.8573 18.4259 11.9581 18.5648C12.059 18.7036 12.1133 18.8708 12.1133 19.0423C12.1133 19.2139 12.059 19.3811 11.9581 19.5199C11.8573 19.6587 11.715 19.762 11.5519 19.8151C11.3887 19.8681 11.2129 19.8681 11.0497 19.8151C10.8865 19.762 10.7443 19.6587 10.6435 19.5199C10.5426 19.3811 10.4883 19.2139 10.4883 19.0423C10.4883 18.8708 10.5426 18.7036 10.6435 18.5648C10.7443 18.4259 10.8865 18.3226 11.0497 18.2696C11.2129 18.2166 11.3887 18.2166 11.5519 18.2696ZM13.1758 24.5C13.1758 24.2239 12.9519 24 12.6758 24L6.67578 24C6.39964 24 6.17578 24.2239 6.17578 24.5C6.17578 24.7761 6.39964 25 6.67578 25L12.6758 25C12.9519 25 13.1758 24.7761 13.1758 24.5Z",fill:"url(#paint_linear_5)","fill-rule":"evenodd"})]),e("g",{id:"组合 302"},[e("path",{id:"合并",d:"M11.3235 14.9659C11.6203 14.7183 11.61 14.0359 11.858 14.0093C12.4372 13.9472 13.1075 14.188 12.5669 14.9628C12.386 15.2222 12.0044 15.5484 11.5768 15.8676C11.7643 15.8935 11.9503 15.9222 12.1341 15.9532C12.9111 15.3147 14.3915 14.1808 14.9377 14.3283C15.4628 14.4701 15.1245 15.7963 14.8697 16.5908C15.9414 16.9049 16.6428 17.1837 16.6428 17.1837C16.6428 17.1837 17 18.2593 15.214 18.6192C14.6008 18.7427 14.7913 18.9199 15.2188 19.3176C15.422 19.5067 15.6788 19.7456 15.9284 20.0523C16.683 20.9798 17 22.5628 17 22.5628L14.857 21.8466L15.5712 22.9217L14.4998 22.9213L14.8569 23.9986L14.1426 23.2806L13.5384 23.9984L12.7146 23.9975L6.29425 23.9974L6.28544 23.9989L5.46131 23.9971L4.85743 23.282L4.14314 24L4.50021 22.9227L3.4288 22.9231L4.14295 21.848L2 22.5642C2 22.5642 2.31699 20.9812 3.07164 20.0537C3.32118 19.747 3.57798 19.5081 3.78121 19.319C4.20873 18.9213 4.39916 18.7441 3.78601 18.6206C1.99995 18.2607 2.35723 17.1851 2.35723 17.1851C2.35723 17.1851 3.05857 16.9063 4.13026 16.5922C3.87555 15.7977 3.53719 14.4715 4.06231 14.3297C4.60851 14.1822 6.08893 15.3161 6.86593 15.9546C7.0497 15.9236 7.23569 15.8949 7.42319 15.869C6.99561 15.5498 6.61404 15.2236 6.43307 14.9642C5.89247 14.1894 6.56276 13.9487 7.14196 14.0107C7.38998 14.0373 7.3797 14.7197 7.6765 14.9673C7.89071 15.1461 7.89864 15.0288 7.9076 14.8963C7.91522 14.7836 7.92357 14.66 8.06005 14.698C8.35707 14.7807 8.51548 14.8066 8.51968 15.0414C8.5217 15.1545 8.48678 15.2615 8.45302 15.365C8.41677 15.4761 8.38186 15.583 8.39545 15.6892C8.39935 15.7196 8.40974 15.7426 8.42535 15.7609C8.74972 15.7364 9.07491 15.7225 9.39745 15.7218C9.78695 15.7156 10.1814 15.7297 10.5746 15.7595C10.5903 15.7412 10.6006 15.7182 10.6045 15.6878C10.6181 15.5816 10.5832 15.4747 10.547 15.3636C10.5132 15.2601 10.4783 15.1531 10.4803 15.04C10.4845 14.8052 10.6429 14.7793 10.9399 14.6966C11.0764 14.6586 11.0848 14.7822 11.0924 14.8949C11.1014 15.0274 11.1093 15.1447 11.3235 14.9659Z",fill:"url(#paint_linear_6)","fill-rule":"evenodd"}),e("ellipse",{id:"椭圆 85",rx:"0.576923",ry:"0.579347",cx:"7.19215727",cy:"21.531496",fill:"rgb(255,255,255)"}),e("ellipse",{id:"椭圆 86",rx:"0.576923",ry:"0.579347",cx:"11.8076363",cy:"21.531496",fill:"rgb(255,255,255)"}),e("path",{id:"椭圆 87",d:"M8.47187 21.8046C8.27093 21.6029 7.99841 21.4895 7.71425 21.4895C7.43009 21.4895 7.15757 21.6029 6.95664 21.8046C6.7557 22.0064 6.64282 22.2801 6.64282 22.5654L6.95076 22.5654C6.95076 22.3621 7.0312 22.1671 7.17438 22.0233C7.31757 21.8795 7.51176 21.7987 7.71425 21.7987C7.91674 21.7987 8.11094 21.8795 8.25412 22.0233C8.3973 22.1671 8.47774 22.3621 8.47774 22.5654L8.78568 22.5654C8.78568 22.2801 8.6728 22.0064 8.47187 21.8046Z",opacity:"0",fill:"rgb(255,255,255)","fill-rule":"evenodd"}),e("path",{id:"椭圆 88",d:"M12.0434 21.8046C11.8425 21.6029 11.5699 21.4895 11.2858 21.4895C11.0016 21.4895 10.7291 21.6029 10.5282 21.8046C10.3272 22.0064 10.2144 22.2801 10.2144 22.5654L10.5223 22.5654C10.5223 22.3621 10.6027 22.1671 10.7459 22.0233C10.8891 21.8795 11.0833 21.7987 11.2858 21.7987C11.4883 21.7987 11.6825 21.8795 11.8257 22.0233C11.9688 22.1671 12.0493 22.3621 12.0493 22.5654L12.3572 22.5654C12.3572 22.2801 12.2443 22.0064 12.0434 21.8046Z",opacity:"0",fill:"rgb(255,255,255)","fill-rule":"evenodd"}),e("path",{id:"矢量 2577",d:"M9.49975 22.1108L9.50002 22.8831L10.0769 23.2692M9.50002 22.8831L8.9231 23.2695",stroke:"rgb(255,255,255)","stroke-linecap":"round","stroke-width":"0.200000"})]),e("g",{id:"svg 154","clip-path":"url(#clipPath_1)",customFrame:"url(#clipPath_1)",class:"lightbulb-glow"},[e("rect",{id:"svg 154",width:"7.000000",height:"7.000000",x:"6.175781",y:"4.000000"}),e("path",{id:"矢量 2565",d:"M7.59674 7.16634C7.59674 7.07301 7.60374 6.97967 7.6154 6.89101L6.91074 6.89101C6.80107 6.89101 6.7124 6.97734 6.7124 7.08467C6.7124 7.19201 6.80107 7.27834 6.91074 7.27834L7.59907 7.27834C7.59674 7.24101 7.59674 7.20367 7.59674 7.16634ZM7.58274 8.86967C7.50574 8.94667 7.50574 9.06801 7.58274 9.14501C7.65974 9.21967 7.78574 9.21967 7.86274 9.14501L8.2244 8.79034C8.14274 8.69934 8.0564 8.59901 7.97707 8.48467L7.58274 8.86967ZM8.0844 5.78967C8.16607 5.68701 8.25707 5.59367 8.3574 5.50734L7.86507 5.02434C7.78807 4.94734 7.66207 4.94734 7.58507 5.02434C7.50807 5.09901 7.50807 5.22267 7.58507 5.29967L8.0844 5.78967ZM10.1891 10.3187L9.18107 10.3187C9.07607 10.3187 8.99207 10.4027 8.99207 10.503C8.99207 10.6057 9.07607 10.6897 9.18107 10.6897L10.1891 10.6897C10.2941 10.6897 10.3781 10.6057 10.3781 10.503C10.3781 10.4003 10.2917 10.3187 10.1891 10.3187ZM9.68507 5.16667L9.68974 5.16667C9.75507 5.16667 9.81807 5.17134 9.88107 5.17601L9.88107 4.51801C9.88107 4.41067 9.7924 4.32434 9.68274 4.32434C9.57307 4.32434 9.4844 4.41067 9.4844 4.51801L9.4844 5.17601C9.5474 5.16901 9.61274 5.16667 9.67574 5.16667L9.68507 5.16667ZM11.2857 5.78967L11.7851 5.29967C11.8621 5.22501 11.8621 5.10134 11.7851 5.02434C11.7081 4.94734 11.5821 4.94734 11.5051 5.02434L11.0127 5.50734C11.1107 5.59367 11.2017 5.68701 11.2857 5.78967ZM11.3884 8.48234C11.3067 8.59901 11.2227 8.69701 11.1411 8.78801L11.5027 9.14267C11.5797 9.21734 11.7057 9.21734 11.7827 9.14267C11.8597 9.06567 11.8597 8.94434 11.7827 8.86734L11.3884 8.48234ZM10.1891 9.84967L9.18107 9.84967C9.07607 9.84967 8.99207 9.93134 8.99207 10.0363C8.99207 10.139 9.07607 10.2207 9.18107 10.2207L10.1891 10.2207C10.2941 10.2207 10.3781 10.1367 10.3781 10.0363C10.3781 9.93134 10.2917 9.84967 10.1891 9.84967ZM12.4571 6.89101L11.7524 6.89101C11.7641 6.98201 11.7711 7.07301 11.7711 7.16634C11.7711 7.20367 11.7711 7.24101 11.7687 7.27834L12.4571 7.27834C12.5667 7.27834 12.6554 7.19201 12.6554 7.08467C12.6531 6.97734 12.5667 6.89101 12.4571 6.89101ZM11.4934 7.16634C11.4934 6.76501 11.3581 6.39401 11.1271 6.09534C10.9264 5.83401 10.6511 5.62867 10.3337 5.50967L10.3361 5.50034L10.2007 5.46067C10.0957 5.43034 9.98607 5.40934 9.8764 5.39767L9.86007 5.39534C9.8064 5.39067 9.7504 5.38601 9.68974 5.38601L9.6804 5.38601C9.62207 5.38601 9.56607 5.39067 9.51007 5.39534L9.49373 5.39767C9.38407 5.40934 9.2744 5.43034 9.1694 5.46067L9.03873 5.49801L9.04107 5.50734C8.7214 5.62867 8.44607 5.83401 8.24307 6.09534C8.0144 6.39401 7.87674 6.76501 7.87674 7.16634C7.87674 7.45567 7.92807 7.69134 8.0074 7.88734C8.1264 8.18134 8.30607 8.37967 8.45307 8.53134C8.5254 8.60601 8.59074 8.67134 8.63274 8.72501C8.67707 8.78101 8.69807 8.82301 8.70507 8.85567C8.73773 9.02134 8.74007 9.22901 8.74007 9.28034L8.74007 9.29667C8.74007 9.53467 8.93607 9.72601 9.17873 9.72601L9.5194 9.72601L9.5194 8.04601L9.0294 7.55834C8.96873 7.50001 8.96873 7.40201 9.0294 7.34367C9.09007 7.28534 9.18573 7.28534 9.24407 7.34367L9.67107 7.76834L10.0981 7.34367C10.1587 7.28534 10.2544 7.28534 10.3127 7.34367C10.3734 7.40201 10.3734 7.50001 10.3127 7.55834L9.82273 8.04601L9.82273 9.72367L10.1914 9.72367C10.4341 9.72367 10.6301 9.53001 10.6301 9.29434L10.6301 9.28034C10.6301 9.22901 10.6324 9.01901 10.6651 8.85567C10.6697 8.83234 10.6791 8.80667 10.7001 8.77401C10.7351 8.71801 10.8004 8.64801 10.8821 8.56634C11.0034 8.44034 11.1574 8.28167 11.2811 8.05767C11.4047 7.83601 11.4934 7.54434 11.4934 7.16634Z",fill:"url(#paint_linear_7)","fill-rule":"nonzero"})]),e("g",{class:"star-animate star-1"},[e("path",{id:"星形 13",d:"M2.52162 1.44908L3.9707 1.98535L2.52162 2.52162L1.98535 3.9707L1.44908 2.52162L2.22045e-16 1.98535L1.44908 1.44908L1.98535 0L2.52162 1.44908Z",fill:"url(#paint_linear_8)","fill-rule":"evenodd",transform:"matrix(0.930482,0.366337,-0.366337,0.930482,12.6309,0)"})]),e("g",{class:"star-animate star-2"},[e("path",{id:"星形 12",d:"M2.51914 1.44765L3.9668 1.9834L2.51914 2.51914L1.9834 3.9668L1.44765 2.51914L2.22045e-16 1.9834L1.44765 1.44765L1.9834 0L2.51914 1.44765Z",fill:"url(#paint_linear_9)","fill-rule":"evenodd",transform:"matrix(0.96896,-0.247217,0.247217,0.96896,0,8.04492)"})]),e("g",{class:"star-animate star-3"},[e("path",{id:"星形 11",d:"M1.27011 0.729885L2 1L1.27011 1.27011L1 2L0.729885 1.27011L1.11022e-16 1L0.729885 0.729885L1 0L1.27011 0.729885Z",fill:"url(#paint_linear_10)","fill-rule":"evenodd",transform:"matrix(0.891472,0.453075,-0.453075,0.891472,15.082,10)"})])])])],-1),e("span",{class:"icon-text"},"AI",-1),e("span",{class:"icon-text",style:{"writing-mode":"vertical-rl"}},"助手",-1)])],2)]),_:1}),E(L,{effect:"dark",content:"点击打开调查问卷",placement:"left",enterable:!0},{default:K(()=>[e("div",{class:z(["icon-menu",{"!hidden":!n(i).isShowEvaluate}]),onClick:A[0]||(A[0]=(...Q)=>n(Jt)&&n(Jt)(...Q))},[E(q,{icon:"evaluation-feedback",size:45,color:"var(--el-color-primary)"})],2)]),_:1})]),(r(),Ie(ao,{to:"body"},[E(Ne,{name:"ai-chat-fade"},{default:K(()=>[n(T)?(r(),u("div",{key:0,class:z(["ai-chat-wrapper small-ai-chat",n(y)])},[E(Wr,{ref_key:"aiAssistantRef",ref:o,"window-mode":n(y),onClose:C,"onUpdate:windowMode":A[1]||(A[1]=Q=>y.value=Q)},null,8,["window-mode"])],2)):N("",!0)]),_:1})]))],64)}}}),qr=_e(Hr,[["__scopeId","data-v-68fe4706"]]);function jr(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!Rt(t)}const Ko=se({name:"BtContainer",setup(t,{attrs:i,slots:v}){return()=>E(os,i,jr(v)?v:{default:()=>[v]})}});function Zr(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!Rt(t)}const Gr=se({name:"BtAside",setup(t,{attrs:i,slots:v}){return()=>E(ss,lo(t,i),Zr(v)?v:{default:()=>[v]})}}),Kr=me(()=>{var t;return((t=zt())==null?void 0:t.path)||""}),{title:xo,panel:Jr,robserver:mt,layoutBody:Xr,mainWidth:Yr,mainHeight:Qr,updateTaskCount:e1,mountMessage:t1,payment:o1,aliyunEcsLtd:s1,isAapanel:n1}=Ee(),l1=()=>{mt.value&&mt.value.disconnect&&(mt.value.disconnect(),mt.value=null)},i1=()=>fn({vue:{defineComponent:se,version:is},components:{BtDialog:Ds,BtInput:zs,BtLink:zo,BtInputIcon:gn,BtSvgIcon:mn,BtTable:Ns,BtTableGroup:hn,ElButton:as,ElCard:rs,ElAlert:us,ElForm:ds,ElFormItem:cs,ElDropdownItem:ps,ElDropdownMenu:vs,ElDropdown:fs,ElTooltip:io,ElIcon:gs,ElPopover:no,ElTable:ms,ElInput:hs,ElTableColumn:ys,BtDivider:Vo,BtImage:No,ElSelect:ws,ElOption:_s},hooks:{useMessage:Po,useDialog:Ro,useAxios:Fs,useConfirm:We,Message:le,isUndefined:Us,inputFocus:Os,rsaEncrypt:Ws,isDev:Eo},utils:{getByteUnit:Vs,getRandomPwd:Hs},dialog:{fileSelectionDialog:Xt},vueMethods:{ref:M,unref:n,reactive:Cs,watch:Ae,computed:me,onMounted:tt,onBeforeUnmount:Io}}),a1=()=>{setTimeout(()=>{qs({request:async()=>{try{Kr.value!=="/waf"&&await js()}catch(t){await We({title:"登录验证已失效",content:"当前面板登录验证已失效,确认后重新登录",showClose:!1}),window.location.href="/login"}},timeout:6e5})},6e5)},r1=()=>{const{msgBoxTaskCount:t}=ns(Jr.value);Ae(xo,i=>po(i)),Ae(t,e1),Ae(s1,i=>{i&&o1.value.authType!=="ltd"&&Xs({compulsionLtd:!0,showClose:!1,disableEsc:!0})},{immediate:!0}),po(xo),a1(),Rs(),mt.value=ls(Xr,i=>{const v=i[0],{height:$}=v.contentRect,B=document.getElementById("layout-footer"),f=B==null?void 0:B.getBoundingClientRect(),T=(f==null?void 0:f.height)||0,y=(f==null?void 0:f.width)||0,o=document.getElementById("layout-main"),c=o==null?void 0:o.getBoundingClientRect(),_=(c==null?void 0:c.width)||0;Yr.value=(y||_)-32,Qr.value=parseInt("".concat($-T-(n1.value?16:30)),10)}),t1(),window.$extension=i1},u1={class:"mr-[8px] text-tertiary text-small"},d1={class:"flex bt-link-info items-center"},c1={class:"w-full flex items-center justify-center"},p1={class:"flex bt-link-info items-center"},v1={class:"w-full flex items-center justify-center"},f1=se({__name:"footer",setup(t){const i=zt(),v=me(()=>!i.path.includes("waf")),{vite_public_brand:$,vite_public_product:B,vite_public_year:f}=window,{globalTheme:T}=Ee(),y=me(()=>{const{container_width:o}=T.value.interface;return o!=="1400px"?{}:{"max-width":"1376px",position:"relative",left:"50%",transform:"translateX(-50%)",margin:"12px 0 0"}});return(o,c)=>{const _=Vo,C=Ho,d=zo,w=No,S=yn;return n(v)?(r(),u("footer",{key:0,id:"layout-footer",class:"flex items-center items-end w-full h-[30px] mb-[14px] text-base justify-center relative z-90 mt-[14px]",style:Be(n(y))},[e("span",u1,P(n($))+P(n(B))+"©2014-"+P(n(f))+" 广东堡塔安全技术有限公司 (bt.cn)",1),E(_),E(d,{class:"bt-link-info",href:"http://www.bt.cn/bbs"},{default:K(()=>[E(C,{name:"tools-help",size:"14",class:"mr-[.2rem]",color:"var(--el-color-primary)"}),c[0]||(c[0]=e("span",{class:"h-[1.2rem] flex items-center text-tertiary"},"论坛求助",-1))]),_:1}),E(_),E(d,{class:"bt-link-info",href:"https://docs.bt.cn"},{default:K(()=>[E(C,{name:"tools-manual",size:"14",class:"mr-[.2rem]"}),c[1]||(c[1]=e("span",{class:"h-[1.2rem] flex items-center text-tertiary"},"使用手册",-1))]),_:1}),E(_),E(S,{placement:"top-start","popper-class":"white-tips-popover",width:"160",trigger:"hover"},{reference:K(()=>[e("span",d1,[E(C,{name:"tools-wechat",size:"14",class:"mr-[.2rem]"}),c[2]||(c[2]=e("span",{class:"text-small h-[1.2rem] flex items-center text-tertiary cursor-pointer"},"微信公众号",-1))])]),default:K(()=>[e("div",c1,[E(w,{src:"/other/bt_wx.jpg"})])]),_:1}),E(_),E(d,{class:"bt-link-info",href:"https://www.bt.cn/auth"},{default:K(()=>[E(C,{name:"tools-check",size:"14",class:"mr-[.2rem]"}),c[3]||(c[3]=e("span",{class:"h-[1.2rem] flex items-center text-tertiary"},"正版查询",-1))]),_:1}),E(_),E(S,{placement:"top-start","popper-class":"white-tips-popover",width:"160",trigger:"hover"},{reference:K(()=>[e("span",p1,[E(C,{name:"tools-customer",size:"14",class:"mr-[.2rem]"}),c[4]||(c[4]=e("span",{class:"text-small h-[1.2rem] flex items-center text-tertiary cursor-pointer"},"联系人工客服",-1))])]),default:K(()=>[e("div",v1,[E(w,{src:"/other/customer-qrcode.png",class:"w-[150px]"})])]),_:1})],4)):N("",!0)}}}),g1=_e(f1,[["__scopeId","data-v-b9535e1e"]]),m1=se({__name:"main",setup(t){const{mainHeight:i,globalTheme:v}=Ee();return zt(),($,B)=>{const f=ks("router-view");return r(),u("section",{id:"layout-main",class:z({"w-full":n(v).interface.container_width==="100%"}),style:Be({"min-height":n(i)+"px","max-width":n(v).interface.container_width==="100%"?void 0:n(v).interface.container_width,margin:n(v).interface.container_width==="100%"?void 0:"0 auto"})},[E(f,null,{default:K(({Component:T})=>[E(Ne,{class:"animate-animated",name:"fade",mode:"out-in"},{default:K(()=>[(r(),Ie(bs(T)))]),_:2},1024)]),_:1})],6)}}}),h1=_e(m1,[["__scopeId","data-v-fd5194a3"]]);function y1(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!Rt(t)}const w1=se({name:"BtScrollbar",props:{...xs},setup(t,{attrs:i,slots:v}){return()=>E(Ts,lo(t,i),y1(v)?v:{default:()=>[v]})}}),{disableSidebar:Jo,serverIp:_1,menuControl:co,cutCollapseView:C1}=Ee(),To=()=>{Jo.value||Ys()},Mo=async()=>{Zs({value:_1.value})},so=t=>Fo.currentRoute.value.path.split("/")[1]===t.name,$o=t=>{co.value.menuName=t},So=t=>{co.value.menuName=""},k1=t=>so(t)?"is-active":"",Lo=async()=>{try{await We({icon:"warning-filled",title:"退出登录",content:"退出面板登录,是否继续?"}),setTimeout(()=>{window.location.href="/login?dologin=True"},400)}catch(t){}},Bo=async()=>{Jo.value||Qs()},Ao=async()=>{var i;if(C1(),!Fo.currentRoute.value.path.includes("/waf"))return;const t=document.getElementById("ifrramApp");t&&((i=t.contentWindow)==null||i.check_shrink(co.value.collapse))},b1={class:"sidebar"},x1={class:"flex-shrink-0"},T1=["src"],M1={class:"flex-1 overflow-y-auto overflow-hidden"},$1={class:"relative h-full"},S1=["onMouseenter","onMouseleave"],L1=["href","onClick"],B1={class:"flex-shrink-0"},A1={class:"cursor-pointer"},I1={class:"cursor-pointer"},E1=se({__name:"index",setup(t){Ms(A=>({e1ccd318:n(S)}));const{menuControl:i,panel:v,serverIp:$,messageNumberStyle:B,messageIpNumberLength:f,menuControlIcon:T,menuCollapseMouseleave:y,menuCollapseMouseenter:o,cutMenuRouter:c,menuLogo:_,globalTheme:C,isAapanel:d}=Ee(),w=A=>{d.value&&document.documentElement.classList.contains("dark");const L=d.value?"menu-aapanel-":"menu-",Q=(d.value?so(A):so(A)||i.value.menuName===A.name)?"".concat(A.name,"-active"):A.name;return"".concat(L).concat(Q)},S=me(()=>d.value?document.documentElement.classList.contains("dark")?"/src/icons/menu-aapanel/dark/":"/static/images/menu-aapanel/":"/static/images/menu/"),W=()=>{d.value&&document.documentElement.classList.contains("dark");const A=d.value?"menu-aapanel-":"menu-",q=!d.value&&i.value.menuName==="dologin"?"exit-active":"exit";return"".concat(A).concat(q)};return(A,L)=>{const q=Ho,Q=Ko,ie=w1,ne=Do,Ce=qo;return r(),u("section",b1,[e("div",x1,[E(Q,{class:z(["layout-message",n(i).collapse?"!justify-center":"!justify-start"])},{default:K(()=>[n(C).logo.image==="/static/icons/logo-white.svg"?(r(),Ie(q,{key:0,name:"tools-logo",size:"22"})):(r(),u("img",{key:1,src:n(_),alt:"logo-white",class:z("w-[2rem] "+(n(i).collapse?"":"mr-[.4rem]"))},null,10,T1)),n(i).collapse?N("",!0):(r(),u("div",{key:2,class:z(["flex leading-normal truncate font-600 w-[15rem] pl-[.8rem]",n(f)>=11?"text-small":"text-base"]),title:"双击可复制IP",onDblclick:L[0]||(L[0]=(...U)=>n(Mo)&&n(Mo)(...U))},P(n(v).sidebarTitle||n($)),35)),e("div",{class:z(n(B)),onClick:L[1]||(L[1]=(...U)=>n(To)&&n(To)(...U))},P(n(v).msgBoxTaskCount),3)]),_:1},8,["class"])]),e("div",M1,[e("div",$1,[E(ie,null,{default:K(()=>[e("ul",{class:z(["bt-menu",{"is-cut-menu":n(i).collapse,"hover-menu-bg":n(i).mouserover}])},[(r(!0),u(G,null,Y(n(Gs),U=>(r(),u(G,{key:U.path},[U.name!="dologin"&&U.show?(r(),u("li",{key:U.path,class:z(["menu-item","menu-".concat(String(U.name)),n(k1)(U)]),onMouseenter:te=>n($o)(U.name),onMouseleave:te=>n(So)(U.name)},[e("a",{href:U.path,onClick:xe(te=>n(c)(U.path),["prevent"])},[E(q,{name:w(U),color:"#fff",size:"21"},null,8,["name"]),e("span",null,P(U.title),1)],8,L1)],42,S1)):N("",!0)],64))),128)),e("li",{class:"menu-item menu-exit",onClick:L[4]||(L[4]=(...U)=>n(Lo)&&n(Lo)(...U))},[e("a",{href:"javascript:;",onMouseenter:L[2]||(L[2]=U=>n($o)("dologin")),onMouseleave:L[3]||(L[3]=U=>n(So)("dologin"))},[E(q,{name:W(),size:"22"},null,8,["name"]),L[9]||(L[9]=e("span",null,"退出",-1))],32)])],2)]),_:1})])]),e("div",B1,[e("div",{class:z(["menu-toolbar",{"justify-between":!n(i).collapse}])},[e("div",A1,[E(Ce,{class:"item",effect:"dark",content:"点击伸缩菜单栏",placement:"top",enterable:!1},{default:K(()=>[e("div",{class:"setting-hover",onClick:L[5]||(L[5]=(...U)=>n(Ao)&&n(Ao)(...U)),onMouseleave:L[6]||(L[6]=(...U)=>n(y)&&n(y)(...U)),onMouseenter:L[7]||(L[7]=(...U)=>n(o)&&n(o)(...U))},[E(ne,{icon:n(T)?"display-menu":"shrink-menu"},null,8,["icon"])],32)]),_:1})]),e("div",I1,[n(i).collapse?N("",!0):(r(),Ie(Ce,{key:0,class:"item",effect:"dark",content:"点击设置菜单显示隐藏",placement:"top",enterable:!1},{default:K(()=>[e("div",{class:"setting-hover",onClick:L[8]||(L[8]=(...U)=>n(Bo)&&n(Bo)(...U))},[E(ne,{icon:"menu-setting"})])]),_:1}))])],2)])])}}}),P1=_e(E1,[["__scopeId","data-v-f92a9e4e"]]),R1={class:"h-full"},D1=se({__name:"index",setup(t){const{layoutSidebarStyle:i,layoutBodyStyle:v,panel:$,layoutBody:B,menuCollapseMouseenter:f,menuCollapseMouseleave:T}=Ee(),y=zt(),o=!1;return tt(()=>{r1()}),_t(l1),(c,_)=>{const C=Gr,d=Ko,w=qr,S=Bn,W=$n;return r(),u("div",R1,[E(d,{id:"app-container",class:"h-full"},{default:K(()=>[E(C,{width:"auto",class:z(["h-full layout-left-menu",n(i)]),onMouseenter:n(f),onMouseleave:n(T)},{default:K(()=>[E(P1)]),_:1},8,["class","onMouseenter","onMouseleave"]),E(d,{id:"layout-body",ref_key:"layoutBody",ref:B,class:z(n(v))},{default:K(()=>[E(h1),E(g1)]),_:1},8,["class"]),E(w)]),_:1}),n(y).path.includes("bind")?N("",!0):(r(),Ie(S,{key:0})),n(o)?(r(),Ie(W,{key:1})):N("",!0)])}}}),Q1=_e(D1,[["__scopeId","data-v-ddf49f0c"]]);export{Q1 as default};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = []
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}