Files
wecom_it_smart_desk/deploy-server/tmp/h5-main-v2-part3.bin
Simon bea288e414 feat: 2026-07-11 全量更新 - 代办集成+会议室预定+知识迭代修复+UI统一+Bug修复
== 已部署上线 (9项) ==
- 代办事项真实数据源集成 (企微审批API 8bug修复链)
- H5/坐席端 Logo样式统一+绿色背景
- 视频引导页修复 (localStorage key v2)
- 坐席端 v9 Vue版本修复 (ElMessage._context)
- 截图按钮 v10 修复 (getDisplayMedia user gesture)
- 扫码样式恢复+H5扫码登录跳转修复
- H5截图快捷键提示

== 代码完成待部署 (3项) ==
- 知识迭代3Bug修复 (#8 POST端点/#7 MERGE幂等/#6 过期检查)
- 会议室预定-小鱼易联终端 (40文件, 40/40测试通过)
- IT资产升级审批推送 (asset_service.py)

== 需求文档 (2项) ==
- 坐席端AI辅助消息框-PRD (4项新功能确认)
- 坐席端布局优化建议 v2.0 (7天计划)

== 新增文档 ==
- 日报-2026-07-11.md
- 知识迭代Bug修复报告-20260711.md
- 会议室预定-部署指南.md
- CHANGELOG.md 更新

== 测试 ==
- test_todo_integration.py: 40/40
- test_meetingroom.py: 40/40
- test_bugfix_ki_suggestions.py: 21/21
2026-07-11 23:13:10 +08:00

6 lines
97 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
osError:DE,CanceledError:$E,isCancel:NE,CancelToken:LE,VERSION:ME,all:VE,Cancel:jE,isAxiosError:UE,spread:HE,toFormData:qE,AxiosHeaders:zE,HttpStatusCode:WE,formToJSON:KE,getAdapter:GE,mergeConfig:JE,create:XE}=Me;let ai=null;function Vy(e){ai=e}async function jy(){return ai?(await ai(),!0):!1}const $e=Me.create({baseURL:"/api",timeout:2e4,headers:{"Content-Type":"application/json"}});$e.interceptors.request.use(e=>{const t=localStorage.getItem("h5_token");return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e));$e.interceptors.response.use(e=>{const t=e.data;return t.code!==0?t.code===1002?(Ia("biz1002"),Promise.reject({code:1002,message:t.message||"未授权"})):(ve(t.message||"请求失败"),Promise.reject({code:t.code,message:t.message||"请求失败"})):t.data},async e=>{let t="网络异常,请稍后重试",n=-1;if(e.response)switch(n=e.response.status,e.response.status){case 401:await Ia("http401");break;case 403:t="拒绝访问";break;case 404:t="请求的资源不存在";break;case 500:t="服务器内部错误";break;default:t=`请求失败 (${e.response.status})`}else e.code==="ECONNABORTED"&&(t="请求超时,请稍后重试");return n!==401&&ve(t),Promise.reject({code:n,message:t})});const Uy="oauth_redirect_count",Pa=3;let hs=null;async function Ia(e){const t=e==="http401"?"HTTP 401":"业务码 1002";return hs?(console.warn(`[API] ${t} 未授权 — 已有处理进行中,等待完成`),hs):(console.warn(`[API] ${t} 未授权,清除凭证并跳转登录`),hs=(async()=>{try{if(localStorage.removeItem("h5_token"),localStorage.removeItem("employee_id"),localStorage.removeItem("employee_name"),"wwa8c87970b2011f41"){const s=parseInt(localStorage.getItem(Uy)||"0",10);if(s>=Pa){console.error("[API] OAuth2 重定向次数超限,疑似无限循环,停止重定向"),ve("登录状态异常,请刷新页面重试");return}console.warn(`[API] OAuth2 重定向计数: ${s}/${Pa}`),await jy()||(console.warn("[API] 认证过期处理器未注册,降级为刷新页面"),window.location.reload())}}catch(n){console.warn("[API] 401 处理失败,刷新页面:",n),window.location.reload()}finally{hs=null}})(),hs)}function ci(e){return{message_id:e.id||e.message_id||"",conversation_id:e.conversation_id||"",message_type:e.sender_type||e.message_type||"text",msg_type:e.msg_type,content:e.content||"",sender_name:e.sender_name||"",created_at:e.created_at||"",media_url:e.media_url,file_name:e.file_name,file_size:e.file_size,extra_data:e.extra_data,reply_to_id:e.reply_to_id}}function Df(e){return(e||[]).map(ci)}async function Hy(){return await $e.get("/h5/user")}async function qy(){return await $e.get("/h5/conversations/current")}async function zy(e){const t=await $e.post("/h5/conversations/current/messages",e,{timeout:3e4});return{user_message:ci(t.user_message),ai_reply:t.ai_reply?ci(t.ai_reply):t.ai_reply,is_guidance:t.is_guidance,ai_reply_count:t.ai_reply_count,can_call_agent:t.can_call_agent}}async function Wy(e){const n=await $e.get("/h5/conversations/current/messages/poll",{params:e}),s=(n==null?void 0:n.items)||n||[];return Df(s)}async function Fa(e){const n=await $e.get("/h5/conversations/current/messages",{params:e}),s=(n==null?void 0:n.items)||[];return{items:Df(s),has_more:(n==null?void 0:n.has_more)||!1}}async function Ky(e){return await $e.post("/h5/conversations/current/shake",e)}async function Gy(){const t=await $e.get("/h5/approval-links");return(t==null?void 0:t.items)||t||[]}async function Jy(){return await $e.get("/approval/keywords")||[]}async function Xy(e){return await $e.post("/approval/jump",{template_id:e})}async function Yy(e){return await $e.post("/approval/detect-intent",{text:e})}async function Qy(){const t=await $e.get("/h5/software-downloads");return(t==null?void 0:t.items)||t||[]}async function Zy(e){return await $e.post(`/h5/conversations/${e}/join`)}async function ew(e){return await $e.post(`/h5/conversations/${e}/leave-participant`)}async function tw(e,t){return await $e.post(`/conversation/${e}/evaluate`,t)}async function nw(e){return await $e.get(`/conversation/${e}/evaluation`)}async function sw(e){return await $e.post("/h5/oauth/callback",e)}async function ow(e){return await $e.post("/h5/mock-login",e)}async function rw(){return await $e.get("/h5/me")}async function iw(){const e=window.location.origin+"/h5/";return await $e.get("/h5/oauth/authorize",{params:{redirect_uri:e}})}async function lw(e){return await $e.post("/agents/password",e)}const Rr="h5_token",Sn="employee_id",jn="employee_name",ms="oauth_redirect_count",Ba=3,It=Bi("employee",()=>{const e=K(localStorage.getItem(Rr)||"");e.value&&!i(e.value)&&localStorage.removeItem(ms);const t=K(null),n=K(!1),s=oe(()=>e.value?!i(e.value):!1),o=oe(()=>{var g;return((g=t.value)==null?void 0:g.employee_id)||localStorage.getItem(Sn)||""}),r=oe(()=>{var g;return((g=t.value)==null?void 0:g.employee_name)||localStorage.getItem(jn)||""});function i(g){try{const O=g.split(".");if(O.length!==3)return!1;const P=JSON.parse(atob(O[1]));return P.exp?Math.floor(Date.now()/1e3)>=P.exp-60:!1}catch{return!1}}function l(g){e.value=g,localStorage.setItem(Rr,g)}function a(){e.value="",t.value=null,localStorage.removeItem(Rr),localStorage.removeItem(Sn),localStorage.removeItem(jn)}function c(){localStorage.removeItem(ms)}function u(){const O=parseInt(localStorage.getItem(ms)||"0",10)+1;return localStorage.setItem(ms,String(O)),O}function f(){return parseInt(localStorage.getItem(ms)||"0",10)>=Ba}async function d(g,O){n.value=!0;try{const P=await sw({code:g,state:O});return l(P.token),localStorage.setItem(Sn,P.employee_id),localStorage.setItem(jn,P.employee_name),t.value={employee_id:P.employee_id,employee_name:P.employee_name,department:P.department,position:P.position,mobile:"",email:"",avatar:P.avatar,is_vip:!1},console.log("[EmployeeStore] OAuth2 登录成功:",P.employee_name),c(),P}catch(P){throw console.error("[EmployeeStore] OAuth2 登录失败:",P),P}finally{n.value=!1}}async function h(g,O){n.value=!0;try{const P=await ow({employee_id:g,employee_name:O||"测试用户"});return l(P.token),localStorage.setItem(Sn,P.employee_id),localStorage.setItem(jn,P.employee_name),t.value={employee_id:P.employee_id,employee_name:P.employee_name,department:P.department,position:P.position,mobile:"",email:"",avatar:P.avatar,is_vip:!1},console.log("[EmployeeStore] Mock 登录成功:",P.employee_name),c(),P}catch(P){throw console.error("[EmployeeStore] Mock 登录失败:",P),P}finally{n.value=!1}}async function x(){if(e.value)try{const g=await rw();t.value=g,localStorage.setItem(Sn,g.employee_id),localStorage.setItem(jn,g.employee_name),console.log("[EmployeeStore] 获取员工信息成功:",g.employee_name)}catch(g){throw console.error("[EmployeeStore] 获取员工信息失败:",g),g}}async function _(){const g=window.location.origin+"/h5/";try{const D=await iw();if(D.authorize_url){window.location.href=D.authorize_url;return}}catch(D){console.warn("[EmployeeStore] 从后端获取授权URL失败,尝试本地构造:",D)}const O="wwa8c87970b2011f41",P=encodeURIComponent(g),z=`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${O}&redirect_uri=${P}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;window.location.href=z}async function m(){if(console.warn("[EmployeeStore] Token 已过期或无效,重新授权"),f()){console.error("[EmployeeStore] OAuth2 重定向次数超限,疑似无限循环,停止重定向"),a(),c();const{showToast:O}=await qn(async()=>{const{showToast:P}=await import("./index-cmDZpIZH.js");return{showToast:P}},__vite__mapDeps([0,1,2,3]));O("登录状态异常,请刷新页面重试");return}a();const g=u();console.warn(`[EmployeeStore] OAuth2 重定向计数: ${g}/${Ba}`),await _()}function v(g){localStorage.setItem(Sn,g),e.value="",t.value={employee_id:g,employee_name:"开发测试用户",department:"IT部",position:"开发工程师",mobile:"",email:"",avatar:"",is_vip:!1},console.log("[EmployeeStore] 开发模式登录:",g)}function S(){a(),console.log("[EmployeeStore] 已登出")}function T(g){l(g),c()}function C(g){t.value={employee_id:g.userid,employee_name:g.name,department:g.department||"",position:"",mobile:g.phone||"",email:g.email||"",avatar:g.avatar||"",is_vip:!1},localStorage.setItem(Sn,g.userid),localStorage.setItem(jn,g.name)}return Vy(m),{token:e,employeeInfo:t,authenticating:n,isAuthenticated:s,employeeId:o,employeeName:r,handleOAuthCallback:d,mockLogin:h,fetchEmployeeInfo:x,redirectToOAuth:_,handleUnauthorized:m,devLogin:v,logout:S,setToken:T,setUserInfo:C}}),aw=Object.freeze(Object.defineProperty({__proto__:null,useEmployeeStore:It},Symbol.toStringTag,{value:"Module"})),cw="h5_messages_cache",uw=7,fw=100;function Hi(e){return`${cw}_${e}`}function dw(e){try{const t=Hi(e),n=localStorage.getItem(t);if(!n)return null;const s=JSON.parse(n),o=s.timestamp||0,r=Date.now(),i=uw*24*60*60*1e3;return r-o>i?(localStorage.removeItem(t),null):s.messages||null}catch(t){return console.warn("[Store] 读取消息缓存失败:",t),null}}function gs(e,t){try{const n=Hi(e),s=t.slice(-fw);localStorage.setItem(n,JSON.stringify({messages:s,timestamp:Date.now()}))}catch(n){console.warn("[Store] 保存消息缓存失败:",n)}}function pw(e){try{const t=Hi(e);localStorage.removeItem(t)}catch(t){console.warn("[Store] 清除消息缓存失败:",t)}}function hw(e,t){const n=new Map;return e.forEach(s=>n.set(s.message_id,s)),t.forEach(s=>n.set(s.message_id,s)),Array.from(n.values()).sort((s,o)=>new Date(s.created_at).getTime()-new Date(o.created_at).getTime())}const $t=Bi("conversation",()=>{const e=K(null),t=K(null),n=K([]),s=K(!1),o=K(!1),r=K(!1),i=K(!0),l=K(null),a=K(!1),c=K([]),u=K(!1),f=K(""),d=K([]),h=K(""),x=K(!1),_=K([]),m=K(""),v=K(null),S=K([]),T=K(!1),C=K(null),g=K(new Set),O=oe(()=>It().isAuthenticated),P=oe(()=>t.value?t.value.status!=="resolved":!1),z=oe(()=>!t.value||!e.value||t.value.employee_id===e.value.employee_id?!1:S.value.some(b=>{var I;return b.id===((I=e.value)==null?void 0:I.employee_id)})),D=oe(()=>S.value.filter(I=>I.joined).length),J=oe(()=>{const b={};for(const I of c.value)b[I.category]||(b[I.category]=[]),b[I.category].push(I);return b}),se=oe(()=>{const b={};for(const I of d.value)b[I.category]||(b[I.category]=[]),b[I.category].push(I);return b});function H(b){const I=g.value;if(I.delete(b),I.add(b),I.size>500){const F=I.values().next().value;F&&I.delete(F)}}function j(b){if(g.value.has(b.message_id)){console.log(`[H5 WS去重] 跳过重复消息: ${b.message_id}`);return}H(b.message_id),n.value.push({message_id:b.message_id,conversation_id:b.conversation_id,message_type:b.sender_type||"system",msg_type:b.msg_type||"text",content:b.content,sender_name:b.sender_name||"",created_at:new Date().toISOString()}),h.value=b.message_id}async function W(b,I){await It().handleOAuthCallback(b,I)}async function ee(){try{const b=It();b.employeeInfo&&(e.value={employee_id:b.employeeInfo.employee_id,employee_name:b.employeeInfo.employee_name,department:b.employeeInfo.department,position:b.employeeInfo.position,level:"",is_vip:b.employeeInfo.is_vip,avatar_url:b.employeeInfo.avatar});const I=await Hy();e.value=I,console.log("[Store] 获取用户信息成功:",I.employee_name)}catch(b){throw console.error("[Store] 获取用户信息失败:",b),b}}async function G(){try{const b=await qy();t.value=b,r.value=(b==null?void 0:b.can_call_agent)??!1,S.value=(b==null?void 0:b.participants)||[],console.log("[Store] 获取当前会话:",b?b.conversation_id:"无活跃会话","参与者:",S.value.length)}catch(b){console.error("[Store] 获取当前会话失败:",b)}}async function X(b,I){var pe,ge,Ee;if(console.log("[Store] sendNewMessage 开始执行, content:",b,"options:",I),!b.trim()){console.warn("[Store] content 为空,直接返回");return}Ue(b).catch(he=>{console.warn("[Store] 审批意图检测异常:",he)});const F=It(),q=`temp_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,te={message_id:q,conversation_id:((pe=t.value)==null?void 0:pe.conversation_id)||"",message_type:"employee",msg_type:(I==null?void 0:I.msg_type)||"text",content:b.trim(),sender_name:F.employeeName||"我",created_at:new Date().toISOString(),status:"sending"};n.value.push(te),console.log("[Store] 乐观更新:临时消息已添加到列表, tempMessageId:",q),s.value=!0;try{const he={content:b.trim()};I!=null&&I.msg_type&&(he.msg_type=I.msg_type,he.media_url=I.media_url,he.file_name=I.file_name,he.file_size=I.file_size),console.log("[Store] 请求参数:",JSON.stringify(he));const me=await zy(he);if(console.log("[Store] API 响应:",me),!me)throw console.error("[Store] API 响应为空"),new Error("API 响应为空");if(!me.user_message)throw console.error("[Store] API 响应缺少 user_message"),new Error("API 响应格式错误:缺少 user_message");const nt=n.value.findIndex(st=>st.message_id===q);if(nt!==-1){n.value[nt]={...me.user_message,status:"sent"},H(me.user_message.message_id),h.value=me.user_message.message_id,console.log("[Store] 乐观更新成功:临时消息已替换为真实消息");const st=(ge=t.value)==null?void 0:ge.conversation_id;st&&gs(st,n.value)}else n.value.push({...me.user_message,status:"sent"}),H(me.user_message.message_id),h.value=me.user_message.message_id;r.value=me.can_call_agent??!1,t.value&&(t.value.can_call_agent=me.can_call_agent??!1,t.value.ai_substantive_reply_count=me.ai_reply_count??0),console.log("[Store] 消息发送成功, AI回复计数:",me.ai_reply_count,"可呼叫坐席:",me.can_call_agent,"是否引导:",me.is_guidance)}catch(he){console.error("[Store] 消息发送失败:",he),console.error("[Store] 错误详情:",he==null?void 0:he.message,(Ee=he==null?void 0:he.response)==null?void 0:Ee.data,he==null?void 0:he.stack);const me=n.value.findIndex(nt=>nt.message_id===q);throw me!==-1&&(n.value[me].status="failed",console.log("[Store] 乐观更新失败:临时消息状态已改为 failed")),he}finally{s.value=!1,console.log("[Store] sendNewMessage finally 执行完成")}}async function ae(){var b;if(!(!O.value||!P.value))try{const I=h.value?{after_message_id:h.value}:void 0,F=await Wy(I);if(F&&F.length>0){const q=F.filter(te=>g.value.has(te.message_id)?(console.log(`[H5轮询去重] 跳过重复消息: ${te.message_id}`),!1):(H(te.message_id),!0));if(q.length>0){n.value.push(...q),h.value=q[q.length-1].message_id,console.log("[Store] 轮询到新消息:",q.length,"条");const te=(b=t.value)==null?void 0:b.conversation_id;te&&gs(te,n.value)}}}catch(I){console.error("[Store] 轮询消息失败:",I)}}async function xe(b){var I;if(!(!O.value||!P.value))try{const F=await Fa(b);if(F.items&&F.items.length>0){const q=F.items.filter(te=>g.value.has(te.message_id)?!1:(H(te.message_id),!0));if(q.length>0){b!=null&&b.before?n.value.push(...q):n.value=q;const te=q[q.length-1];te&&(h.value=te.message_id),console.log("[Store] 获取到历史消息:",q.length,"条");const pe=(I=t.value)==null?void 0:I.conversation_id;pe&&gs(pe,n.value)}}}catch(F){console.error("[Store] 获取历史消息失败:",F)}}function we(){l.value||(console.log("[Store] 启动消息轮询(3秒间隔)"),l.value=setInterval(()=>{ae()},3e3))}function be(){l.value&&(console.log("[Store] 停止消息轮询"),clearInterval(l.value),l.value=null)}async function Be(){var b,I;if(o.value)return"pending";o.value=!0;try{const F=It(),q=await Ky({employee_id:F.employeeId,employee_name:F.employeeName});console.log("[Store] 招手成功:",q);const te={message_id:`sys_shake_${Date.now()}`,conversation_id:((b=t.value)==null?void 0:b.conversation_id)||"",message_type:"system",content:q.funny_phrase,sender_name:"系统",created_at:new Date().toISOString()};return n.value.push(te),q.assign_result==="assigned"&&q.assigned_agent_id?(te.content=`${q.funny_phrase}
🎉 坐席已为您服务,请稍候...`,t.value&&(t.value.status="serving")):q.assign_result==="queued"&&(te.content=`${q.funny_phrase}
⏳ 当前无空闲坐席,您已进入排队,请耐心等待...`),((I=q.conversation)==null?void 0:I.status)==="serving"&&await G(),q.assign_result||"queued"}catch(F){return console.error("[Store] 招手失败:",F),"error"}finally{o.value=!1}}async function ye(){try{const b=await Gy();c.value=b,console.log("[Store] 获取审批链接成功:",b.length,"条")}catch(b){console.error("[Store] 获取审批链接失败:",b)}}async function Ue(b){var I;try{const F=await Yy(b);if(console.log("[Store] 审批意图检测结果:",F),F.is_approval_request){const q={message_id:`approval_card_${Date.now()}`,conversation_id:((I=t.value)==null?void 0:I.conversation_id)||"",message_type:"system",msg_type:"approval_card",content:"",sender_name:"",created_at:new Date().toISOString(),extra_data:{approval_type:F.approval_type,confidence:F.confidence}};n.value.push(q),console.log("[Store] 已插入审批卡片消息, approval_type:",F.approval_type)}}catch(F){console.warn("[Store] 审批意图检测失败:",F)}}function Ve(){u.value=!1,f.value=""}function He(b=""){var F;const I={message_id:`approval_card_${Date.now()}`,conversation_id:((F=t.value)==null?void 0:F.conversation_id)||"",message_type:"system",msg_type:"approval_card",content:"",sender_name:"",created_at:new Date().toISOString(),extra_data:{approval_type:"",confidence:0}};n.value.push(I),console.log("[Store] 手动插入审批卡片消息(快捷按钮触发)")}async function E(){try{const b=await Qy();d.value=b,console.log("[Store] 获取软件下载列表成功:",b.length,"条")}catch(b){console.error("[Store] 获取软件下载列表失败:",b)}}function $(){a.value=!a.value}async function V(b){try{await G();const I=t.value;I&&I.conversation_id!==b&&console.warn("[Store] 当前会话ID不匹配, 期望:",b,"实际:",I.conversation_id),n.value=[],h.value="",await xe(),console.log("[Store] 已切换到邀请会话:",b)}catch(I){console.error("[Store] 切换会话失败:",I)}}async function Q(){if(!t.value)return;const b=t.value.conversation_id;try{await ew(b),console.log("[Store] 已退出会话:",b),t.value=null,S.value=[],n.value=[],h.value="",be()}catch(I){throw console.error("[Store] 退出会话失败:",I),I}}function le(){T.value=!T.value}async function y(b){const I=n.value.findIndex(te=>te.message_id===b);if(I===-1){console.warn("[Store] 重试消息找不到:",b);return}const F=n.value[I];if(F.status!=="failed"){console.warn("[Store] 消息状态不是 failed,无法重试:",b);return}const q=F.content;n.value.splice(I,1),console.log("[Store] 删除失败消息:",b),await X(q,{msg_type:F.msg_type,media_url:F.media_url,file_name:F.file_name,file_size:F.file_size})}function w(b){S.value=b,t.value&&(t.value.participants=b),console.log("[Store] 参与者列表已通过WS更新:",b.length,"人")}function R(){console.log("[Store] 当前用户被移除会话,清空状态"),t.value=null,S.value=[],n.value=[],h.value="",T.value=!1,be()}function N(b){var F;if(((F=t.value)==null?void 0:F.conversation_id)!==b.conversation_id||!b.chunk)return;if(!C.value){const q=`ai_stream_${b.conversation_id}_${Date.now()}`;C.value=q,n.value.push({message_id:q,conversation_id:b.conversation_id,message_type:"ai",msg_type:"text",content:"",sender_name:"Duckula(达寇拉)",created_at:new Date().toISOString()})}const I=n.value.findIndex(q=>q.message_id===C.value);I!==-1&&(n.value[I].content+=b.chunk)}function U(b){var te,pe;if(((te=t.value)==null?void 0:te.conversation_id)!==b.conversation_id)return;const I={message_id:b.message_id,conversation_id:b.conversation_id,message_type:b.sender_type||"ai",msg_type:b.msg_type||"text",content:b.content,sender_name:b.sender_name||"Duckula(达寇拉)",created_at:new Date().toISOString(),status:"sent"},F=C.value?n.value.findIndex(ge=>ge.message_id===C.value):-1;if(F!==-1?n.value[F]=I:n.value.push(I),C.value=null,H(b.message_id),h.value=b.message_id,r.value=b.can_call_agent??!1,t.value){t.value.can_call_agent=b.can_call_agent??!1,t.value.ai_substantive_reply_count=b.ai_reply_count??0;const ge={ai_handling:"waiting",queued:"waiting",serving:"serving",resolved:"resolved"};t.value.status=ge[b.conversation_status]||t.value.status}const q=(pe=t.value)==null?void 0:pe.conversation_id;q&&gs(q,n.value)}function L(b){var q;if(((q=t.value)==null?void 0:q.conversation_id)!==b.conversation_id)return;const I={message_id:`ai_failed_${b.conversation_id}_${Date.now()}`,conversation_id:b.conversation_id,message_type:"ai",msg_type:"text",content:b.message||"⚠️ AI 服务异常,请输入「IT」转人工或稍后重试。",sender_name:"Duckula(达寇拉)",created_at:new Date().toISOString(),status:"sent"},F=C.value?n.value.findIndex(te=>te.message_id===C.value):-1;F!==-1?n.value[F]=I:n.value.push(I),C.value=null}function ne(){if(!C.value)return;const b=n.value.findIndex(I=>I.message_id===C.value);b!==-1&&n.value.splice(b,1),C.value=null}async function Z(){var b;if(!x.value)try{console.log("[Store] 开始初始化应用..."),await Promise.all([ee(),G()]);const I=(b=t.value)==null?void 0:b.conversation_id;if(I){const F=dw(I);if(F&&F.length>0){console.log(`[Store] 加载缓存消息 ${F.length} 条`),n.value=F;const q=F[F.length-1];q&&(h.value=q.message_id)}}Promise.resolve().then(async()=>{try{const F=await Fa({limit:50});if(F.items&&F.items.length>0){const q=F.items.filter(te=>g.value.has(te.message_id)?!1:(H(te.message_id),!0));if(q.length>0){I&&n.value.length>0?n.value=hw(n.value,q):n.value=q;const te=q[q.length-1];te&&(h.value=te.message_id),I&&gs(I,n.value),console.log(`[Store] 历史消息已加载,共 ${n.value.length} 条`)}}}catch(F){console.warn("[Store] 加载历史消息失败:",F)}}),setTimeout(()=>{Promise.all([ye(),E()]).catch(F=>console.warn("[Store] 加载面板数据失败:",F))},500),we(),x.value=!0,console.log("[Store] 应用初始化完成(缓存优先显示)")}catch(I){console.error("[Store] 应用初始化失败:",I)}}function Y(){var b;(b=t.value)!=null&&b.conversation_id&&pw(t.value.conversation_id),be()}return{userInfo:e,currentConversation:t,messages:n,loading:s,shaking:o,canCallAgent:r,agentOnline:i,assistantPanelVisible:a,approvalLinks:c,approvalCardVisible:u,approvalCardTriggerText:f,softwareDownloads:d,lastMessageId:h,initialized:x,troubleshootingSteps:_,troubleshootingTemplateName:m,troubleshootingCurrentNode:v,participants:S,participantPanelVisible:T,isLoggedIn:O,hasActiveConversation:P,isParticipant:z,joinedParticipantCount:D,approvalLinksByCategory:J,softwareDownloadsByCategory:se,handleOAuthCallback:W,fetchUserInfo:ee,fetchCurrentConversation:G,fetchMessages:xe,sendNewMessage:X,pollNewMessages:ae,startPolling:we,stopPolling:be,shakeAgent:Be,fetchApprovalLinks:ye,checkApprovalIntent:Ue,closeApprovalCard:Ve,showApprovalCard:He,fetchSoftwareDownloads:E,toggleAssistantPanel:$,switchToConversation:V,leaveAsParticipant:Q,toggleParticipantPanel:le,retryMessage:y,updateParticipants:w,handleRemovedFromConversation:R,initialize:Z,cleanup:Y,handleNewMessage:j,handleAiReplyChunk:N,handleAiReply:U,handleAiReplyFailed:L,cancelStreamingBubble:ne}}),mw=3e4,gw=3e4,_w=1e3;function vw(){let e=null,t=null,n=null,s=0,o=!1;function r(){const f=It(),d=f.employeeId,h=f.token;if(!d||!h){console.warn("[H5 WS] 未登录或缺少token,跳过连接");return}e&&i(),o=!1;const x=window.location.protocol==="https:"?"wss:":"ws:",_=window.location.host,m=`${x}//${_}/ws/h5/${d}`;console.log(`[H5 WS] 正在连接: ${m}`),e=new WebSocket(m,[`bearer.${h}`]),e.onopen=()=>{console.log("[H5 WS] 连接成功"),s=0,l(),$t().stopPolling()},e.onmessage=v=>{try{const S=JSON.parse(v.data);u(S)}catch(S){console.error("[H5 WS] 消息解析失败:",S)}},e.onclose=()=>{if(console.log("[H5 WS] 连接关闭"),a(),e=null,!o){const v=$t();v.cancelStreamingBubble(),v.startPolling(),c()}},e.onerror=v=>{console.error("[H5 WS] 连接错误:",v)}}function i(){o=!0,n&&(clearTimeout(n),n=null),a(),e&&(e.close(),e=null),s=0,console.log("[H5 WS] 已主动断开连接")}function l(){a(),t=setInterval(()=>{e&&e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({type:"ping"}))},mw)}function a(){t&&(clearInterval(t),t=null)}function c(){if(o)return;const f=Math.min(_w*Math.pow(2,s),gw);s++,console.log(`[H5 WS] 将在 ${f/1e3} 秒后重连(第 ${s} 次)`),n&&clearTimeout(n),n=setTimeout(()=>{console.log("[H5 WS] 正在重连..."),r()},f)}function u(f){var h,x,_,m,v;const d=$t();switch(f.type){case"participant_invited":(h=f.data)!=null&&h.participants&&d.updateParticipants(f.data.participants);break;case"participant_joined":(x=f.data)!=null&&x.participants&&d.updateParticipants(f.data.participants);break;case"participant_removed":if((_=f.data)!=null&&_.participants&&d.updateParticipants(f.data.participants),(m=f.data)!=null&&m.changed){const S=It();f.data.changed.map(C=>C.id).includes(S.employeeId)&&(console.log("[H5 WS] 当前用户被移除会话"),d.handleRemovedFromConversation())}break;case"participant_left":(v=f.data)!=null&&v.participants&&d.updateParticipants(f.data.participants);break;case"new_message":f.data&&d.handleNewMessage(f.data);break;case"ai_reply_chunk":f.data&&d.handleAiReplyChunk(f.data);break;case"ai_reply":f.data&&d.handleAiReply(f.data);break;case"ai_reply_failed":f.data&&d.handleAiReplyFailed(f.data);break;case"pong":break;default:console.warn(`[H5 WS] 未知消息类型: ${f.type}`)}}return{connect:r,disconnect:i}}const yw="/h5/duckula.webp";function ww(e,t){return hi()?(tc(e,t),!0):!1}const qi=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const bw=Object.prototype.toString,Ew=e=>bw.call(e)==="[object Object]";function Sw(e){let t;function n(){return t||(t=e()),t}return n.reset=async()=>{const s=t;t=void 0,s&&await s},n}function Tr(e){return Array.isArray(e)?e:[e]}function xw(e,t,n={}){const{immediate:s=!0,immediateCallback:o=!1}=n,r=mn(!1);let i;function l(){i&&(clearTimeout(i),i=void 0)}function a(){r.value=!1,l()}function c(...u){o&&e(),l(),r.value=!0,i=setTimeout(()=>{r.value=!1,i=void 0,e(...u)},Kn(t))}return s&&(r.value=!0,qi&&c()),ww(a),{isPending:uo(r),start:c,stop:a}}function Cw(e,t,n){return Ie(e,t,{...n,immediate:!0})}const Aw=qi?window:void 0,$f=qi?window.navigator:void 0;function Rw(e){var t;const n=Kn(e);return(t=n==null?void 0:n.$el)!==null&&t!==void 0?t:n}function Nf(...e){const t=(s,o,r,i)=>(s.addEventListener(o,r,i),()=>s.removeEventListener(o,r,i)),n=oe(()=>{const s=Tr(Kn(e[0])).filter(o=>o!=null);return s.every(o=>typeof o!="string")?s:void 0});return Cw(()=>{var s,o;return[(s=(o=n.value)===null||o===void 0?void 0:o.map(r=>Rw(r)))!==null&&s!==void 0?s:[Aw].filter(r=>r!=null),Tr(Kn(n.value?e[1]:e[0])),Tr(de(n.value?e[2]:e[1])),Kn(n.value?e[3]:e[2])]},([s,o,r,i],l,a)=>{if(!(s!=null&&s.length)||!(o!=null&&o.length)||!(r!=null&&r.length))return;const c=Ew(i)?{...i}:i,u=s.flatMap(f=>o.flatMap(d=>r.map(h=>t(f,d,h,c))));a(()=>{u.forEach(f=>f())})},{flush:"post"})}function Tw(){const e=mn(!1),t=Vt();return t&&mt(()=>{e.value=!0},t),e}function Lf(e){const t=Tw();return oe(()=>(t.value,!!e()))}function Da(e,t={}){const{controls:n=!1,navigator:s=$f}=t,o=Lf(()=>s&&"permissions"in s),r=mn(),i=typeof e=="string"?{name:e}:e,l=mn(),a=()=>{var u,f;l.value=(u=(f=r.value)===null||f===void 0?void 0:f.state)!==null&&u!==void 0?u:"prompt"};Nf(r,"change",a,{passive:!0});const c=Sw(async()=>{if(o.value){if(!r.value)try{r.value=await s.permissions.query(i)}catch{r.value=void 0}finally{a()}if(n)return _e(r.value)}});return c(),n?{state:l,isSupported:o,query:c}:l}function kw(e={}){const{navigator:t=$f,read:n=!1,source:s,copiedDuring:o=1500,legacy:r=!1}=e,i=Lf(()=>t&&"clipboard"in t),l=Da("clipboard-read"),a=Da("clipboard-write"),c=oe(()=>i.value||r),u=mn(""),f=mn(!1),d=mn(!1),h=xw(()=>f.value=!1,o,{immediate:!1});let x=0;async function _(){let g=!(i.value&&C(l.value));if(!g)try{u.value=await t.clipboard.readText()}catch{g=!0}g&&(u.value=T())}c.value&&n&&Nf(["copy","cut"],_,{passive:!0});async function m(g){const O=g??Kn(s);if(c.value&&O!=null){d.value=!0;let P=!(i.value&&C(a.value));if(!P)try{const z=v(O);await t.clipboard.write([z])}catch{P=!0}if(P)if(typeof O=="string")u.value=O,S(O);else{const z=++x,D=await O();D!=null&&z===x&&(u.value=D,S(D))}f.value=!0,h.start(),d.value=!1}}function v(g){return typeof g=="string"?(u.value=g,new ClipboardItem({"text/plain":g})):new ClipboardItem({"text/plain":g().then((O="")=>(u.value=O,new Blob([O],{type:"text/plain"})))})}function S(g){const O=document.createElement("textarea");O.value=g,O.style.position="absolute",O.style.opacity="0",O.setAttribute("readonly",""),document.body.appendChild(O),O.select(),document.execCommand("copy"),O.remove()}function T(){var g,O,P;return(g=(O=document)===null||O===void 0||(P=O.getSelection)===null||P===void 0||(P=P.call(O))===null||P===void 0?void 0:P.toString())!==null&&g!==void 0?g:""}function C(g){return g==="granted"||g==="prompt"}return{copyPending:uo(d),isSupported:c,text:uo(u),copied:uo(f),copy:m}}const Ow={class:"approval-card-inline"},Pw={class:"approval-card-inline__header"},Iw={class:"approval-card-inline__title-row"},Fw={key:0,class:"approval-card-inline__tag"},Bw={class:"approval-card-inline__options"},Dw=["onClick"],$w={class:"approval-card-inline__option-icon"},Nw={class:"approval-card-inline__option-content"},Lw={class:"approval-card-inline__option-name"},Mw={class:"approval-card-inline__option-desc"},Vw=Se({__name:"ApprovalCardModal",props:{approvalType:{default:""}},setup(e){const t=e,n={设备申请:[{name:"IT资产领用",icon:"orders-o",desc:"申请新设备",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=C4c8qt31AbSHwN9MuaFhYXt4Qwsx6ZLCftAFh6X1w&sp_id=&from=template_list"},{name:"IT资产借用",icon:"orders-o",desc:"临时借用设备",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=3TmACnFs8oqgYcasxVh4BfSMGNX7p9sb6ydBX77mK&sp_id=&from=template_list"},{name:"IT资产升级",icon:"orders-o",desc:"设备升级换新",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=Bs7ucTGsPuFhxfk8pn8EydxrWxkVetB4JR8Pb6PHS&sp_id=&from=template_list"}],账号权限申请:[{name:"VPN账号申请",icon:"lock",desc:"零信任VPN",url:"https://devops.dc.servyou-it.com/ITSM/workflow/service/createTicket?name=%E5%91%98%E5%B7%A5%E9%9B%B6%E4%BF%A1%E4%BB%BB%EF%BC%88%E5%8E%9FVPN%EF%BC%89%E8%B4%A6%E5%8F%B7%E7%94%B3%E8%AF%B7"},{name:"企微外联权限",icon:"lock",desc:"外部联系人权限",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=C4WrCbZd214XrDMZJiHDho7ZQHWX7gsabb7x2fF72&sp_id=&from=template_list"},{name:"公共邮箱账号",icon:"lock",desc:"共享邮箱",url:"https://devops.dc.servyou-it.com/ITSM/workflow/service/createTicket?name=%E5%85%AC%E5%85%B1%E9%82%AE%E7%AE%B1%E8%B4%A6%E5%8F%B7%E7%94%B3%E8%AF%B7"}],软件服务申请:[{name:"商业软件申请",icon:"apps-o",desc:"正版软件授权",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=3TmACf8DsJy5yr7aymanLskywC4EDhFLuz1KuBBQK&sp_id=&from=template_list"}],资产处置申请:[{name:"IT资产外修",icon:"warn-o",desc:"设备送修",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=Bs7ucTLPo42dtj8Y1LzBoujijsa6geRWaRxZJjk4X&sp_id=&from=template_list"},{name:"IT资产报废",icon:"delete-o",desc:"设备报废",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=C4WroCDfWuHKyujQjatjm3AjNv67imXk5C6WNooFkb&sp_id=&from=template_list"},{name:"资产退还",icon:"back-top",desc:"退还设备",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=C4c8qt33AZ52a7n9BBWDh6PmsDnpM5B6w8geqqqoHz&sp_id=&from=template_list"}],办公用品申请:[{name:"办公用品超额领用",icon:"gift-o",desc:"超配额申领",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=3WN6zRucbjycdnR94gBvkSVuXRamX7pKW4PrmNFh&sp_id=&from=template_list"}],会议室故障报修:[{name:"会议室故障报修",icon:"warn-o",desc:"会议室设备故障",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=C4ZXJMtjQJiPXo6N5vNMK26uPRT3KTi9VvkH2NScg&sp_id=&from=template_list"}],企业应用管理:[{name:"企业应用管理",icon:"apps-o",desc:"企业应用开通管理",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=3WLJnRg2Se1fwizQtNvFtcYMgci1mhRJZhMw2FFKb&sp_id=&from=template_list"}],资产变更确认:[{name:"资产变更确认",icon:"exchange",desc:"资产信息变更",url:"https://app.work.weixin.qq.com/wework_admin/approval_v3#/?template_id=C4cA2owjRcXRRPQ46otZvUHoWNEKL5t25tHHfeePip&sp_id=&from=template_list"}],终端设备网络准入:[{name:"终端设备网络准入申请",icon:"lock",desc:"终端网络准入",url:"https://devops.dc.servyou-it.com/ITSM/workflow/service/createTicket?name=%E7%BB%88%E7%AB%AF%E8%AE%BE%E5%A4%87%E7%BD%91%E7%BB%9C%E5%87%86%E5%85%A5%E7%94%B3%E8%AF%B7"}],活动与会议技术支持:[{name:"活动与会议技术支持",icon:"calendar-o",desc:"活动会议技术保障",url:"https://devops.dc.servyou-it.com/ITSM/workflow/service/createTicket?name=%E6%B4%BB%E5%8A%A8%E4%B8%8E%E4%BC%9A%E8%AE%AE%E6%8A%80%E6%9C%AF%E6%94%AF%E6%8C%81"}],员工IT支持与故障报修:[{name:"员工IT支持与故障报修",icon:"warn-o",desc:"IT支持与故障报修",url:"https://devops.dc.servyou-it.com/ITSM/workflow/service/createTicket?name=%E5%91%98%E5%B7%A5IT%E6%94%AF%E6%8C%81%E4%B8%8E%E6%95%85%E9%9A%9C%E6%8A%A5%E4%BF%AE"}],公共邮箱账号申请:[{name:"公共邮箱账号申请",icon:"lock",desc:"公共邮箱账号",url:"https://devops.dc.servyou-it.com/ITSM/workflow/service/createTicket?name=%E5%85%AC%E5%85%B1%E9%82%AE%E7%AE%B1%E8%B4%A6%E5%8F%B7%E7%94%B3%E8%AF%B7"}]},s=oe(()=>t.approvalType&&n[t.approvalType]?n[t.approvalType]:Object.values(n).flat()),o=K([]);async function r(){if(!(o.value.length>0))try{o.value=await Jy()}catch(l){console.error("[ApprovalCard] 加载审批关键词失败:",l)}}mt(()=>{r()});async function i(l){if(l.url){window.location.href=l.url;return}try{const a=o.value.find(c=>c.template_name===t.approvalType||c.keyword===l.name);if(a)if(a.type==="jump"){const c=await Xy(a.template_id);window.location.href=c.url}else ve("该功能正在开发中");else ve(`${l.name} — 审批模板配置中,请稍后`)}catch(a){console.error("[ApprovalCard] 打开审批失败:",a),ve("打开审批失败,请重试")}}return(l,a)=>{const c=Rt;return B(),M("div",Ow,[p("div",Pw,[p("div",Iw,[A(c,{name:"orders-o",size:"16",color:"#07c160"}),a[0]||(a[0]=p("span",{class:"approval-card-inline__title"},"审批快捷入口",-1)),e.approvalType?(B(),M("span",Fw,ie(e.approvalType),1)):fe("",!0)]),a[1]||(a[1]=p("div",{class:"approval-card-inline__subtitle"}," 检测到您可能需要提交审批,请选择对应类型 ",-1))]),p("div",Bw,[(B(!0),M(Re,null,Ft(s.value,u=>(B(),M("div",{key:u.name,class:"approval-card-inline__option",onClick:f=>i(u)},[p("div",$w,[A(c,{name:u.icon,size:"20"},null,8,["name"])]),p("div",Nw,[p("div",Lw,ie(u.name),1),p("div",Mw,ie(u.desc),1)]),A(c,{name:"arrow",class:"approval-card-inline__option-arrow"})],8,Dw))),128))])])}}}),Et=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},jw=Et(Vw,[["__scopeId","data-v-76b39a8c"]]),Uw={key:0,class:"message-bubble message-bubble--approval-card"},Hw={key:1,class:"message-bubble message-bubble--system"},qw={class:"message-bubble__system-text"},zw={key:0,class:"message-bubble__sender"},Ww={key:0,src:yw,class:"message-bubble__ai-avatar",alt:"Duckula"},Kw={class:"message-bubble__sender-name"},Gw={class:"reply-quote__text"},Jw={class:"reply-quote__sender"},Xw={key:1,class:"message-bubble__text",style:{"white-space":"pre-wrap"}},Yw=["src","alt"],Qw={key:1,class:"media-card"},Zw={class:"media-card__info"},e0={key:0,class:"media-card__name"},t0=["href"],n0={class:"media-card__info"},s0={class:"media-card__label"},o0={key:0,class:"media-card__size"},r0={key:1,class:"media-card"},i0={class:"media-card__info"},l0={class:"media-card__label"},a0={key:0,class:"media-card__size"},c0={key:4,class:"media-card"},u0={class:"media-card__icon"},f0={class:"media-card__info"},d0={class:"media-card__label"},p0={key:0,class:"media-card__name"},h0={key:1,class:"media-card__size"},m0={key:5,class:"message-bubble__actions"},g0=Se({__name:"MessageBubble",props:{msg:{}},emits:["scrollToMessage"],setup(e){const t=e,{copy:n}=kw(),s=K(!1),o=K(!1);async function r(){try{await n(t.msg.content),o.value=!0,ve("已复制"),setTimeout(()=>{o.value=!1},1500)}catch(v){console.error("复制失败:",v)}}const i=oe(()=>{const v=[`message-bubble--${t.msg.message_type}`];return t.msg.status==="sending"?v.push("message-bubble--sending"):t.msg.status==="failed"&&v.push("message-bubble--failed"),v.join(" ")}),l=oe(()=>`message-bubble__content--${t.msg.message_type}`),a=oe(()=>t.msg.message_type==="employee"?"message-bubble__time--right":"message-bubble__time--left"),c=oe(()=>t.msg.message_type==="agent"?t.msg.sender_name||"IT坐席":t.msg.message_type==="ai"?"Duckula(达寇拉)":t.msg.sender_name),u=oe(()=>({image:"🖼️",voice:"🎤",video:"🎬",file:"📎",location:"📍"})[t.msg.msg_type||""]||"📄"),f=oe(()=>({image:"图片消息",voice:"语音消息",video:"视频消息",file:"文件消息",location:"位置消息"})[t.msg.msg_type||""]||"媒体消息"),d=oe(()=>t.msg.reply_to_id?"...":""),h=oe(()=>(t.msg.reply_to_id,""));function x(v){if(!v)return"";const S=new Date(v),T=S.getHours().toString().padStart(2,"0"),C=S.getMinutes().toString().padStart(2,"0");return`${T}:${C}`}function _(v){return v<1024?`${v} B`:v<1024*1024?`${(v/1024).toFixed(1)} KB`:`${(v/(1024*1024)).toFixed(1)} MB`}function m(){var S;const v=t.msg.media_url||((S=t.msg.extra_data)==null?void 0:S.pic_url);v&&window.open(v,"_blank")}return(v,S)=>{var T,C,g;return e.msg.msg_type==="approval_card"?(B(),M("div",Uw,[A(jw,{"approval-type":((T=e.msg.extra_data)==null?void 0:T.approval_type)||""},null,8,["approval-type"])])):e.msg.message_type==="system"?(B(),M("div",Hw,[p("span",qw,ie(e.msg.content),1)])):(B(),M("div",{key:2,class:Ne(["message-bubble",i.value]),onMouseenter:S[2]||(S[2]=O=>s.value=!0),onMouseleave:S[3]||(S[3]=O=>s.value=!1)},[e.msg.message_type!=="employee"?(B(),M("div",zw,[e.msg.message_type==="ai"?(B(),M("img",Ww)):fe("",!0),p("span",Kw,ie(c.value),1)])):fe("",!0),p("div",{class:Ne(["message-bubble__content",l.value])},[e.msg.reply_to_id&&d.value?(B(),M("div",{key:0,class:"reply-quote",onClick:S[0]||(S[0]=On(O=>v.$emit("scrollToMessage",e.msg.reply_to_id),["stop"]))},[S[4]||(S[4]=p("div",{class:"reply-quote__bar"},null,-1)),p("div",Gw,[p("span",Jw,ie(h.value),1),Xe(" "+ie(d.value),1)])])):fe("",!0),!e.msg.msg_type||e.msg.msg_type==="text"?(B(),M("p",Xw,ie(e.msg.content),1)):e.msg.msg_type==="image"?(B(),M("div",{key:2,class:"image-message",onClick:m},[e.msg.media_url||(C=e.msg.extra_data)!=null&&C.pic_url?(B(),M("img",{key:0,src:e.msg.media_url||((g=e.msg.extra_data)==null?void 0:g.pic_url),alt:e.msg.file_name||"图片",class:"image-message__thumbnail",loading:"lazy"},null,8,Yw)):(B(),M("div",Qw,[S[6]||(S[6]=p("div",{class:"media-card__icon"},"🖼️",-1)),p("div",Zw,[S[5]||(S[5]=p("span",{class:"media-card__label"},"图片消息",-1)),e.msg.file_name?(B(),M("span",e0,ie(e.msg.file_name),1)):fe("",!0)])]))])):e.msg.msg_type==="file"?(B(),M(Re,{key:3},[e.msg.media_url?(B(),M("a",{key:0,href:e.msg.media_url,target:"_blank",class:"media-card media-card--link",onClick:S[1]||(S[1]=On(()=>{},["stop"]))},[S[7]||(S[7]=p("div",{class:"media-card__icon"},"📎",-1)),p("div",n0,[p("span",s0,ie(e.msg.file_name||"文件消息"),1),e.msg.file_size?(B(),M("span",o0,ie(_(e.msg.file_size)),1)):fe("",!0)])],8,t0)):(B(),M("div",r0,[S[8]||(S[8]=p("div",{class:"media-card__icon"},"📎",-1)),p("div",i0,[p("span",l0,ie(e.msg.file_name||"文件消息"),1),e.msg.file_size?(B(),M("span",a0,ie(_(e.msg.file_size)),1)):fe("",!0)])]))],64)):(B(),M("div",c0,[p("div",u0,ie(u.value),1),p("div",f0,[p("span",d0,ie(f.value),1),e.msg.file_name?(B(),M("span",p0,ie(e.msg.file_name),1)):fe("",!0),e.msg.file_size?(B(),M("span",h0,ie(_(e.msg.file_size)),1)):fe("",!0)])])),s.value?(B(),M("div",m0,[!e.msg.msg_type||e.msg.msg_type==="text"?(B(),M("button",{key:0,class:"action-btn",title:"复制消息",onClick:On(r,["stop"])},ie(o.value?"✓":"📋"),1)):fe("",!0)])):fe("",!0)],2),p("div",{class:Ne(["message-bubble__time",a.value])},ie(x(e.msg.created_at)),3)],34))}}}),_0=Et(g0,[["__scopeId","data-v-7ed50abc"]]);async function kr(e,t="paste"){const n=new FormData;if(e instanceof Blob&&!(e instanceof File)){const s=`${t}_${Date.now()}.png`;n.append("file",e,s)}else n.append("file",e);return await v0(n)}async function v0(e,t=3){for(let n=0;n<=t;n++)try{return await $e.post("/upload",e,{headers:{"Content-Type":void 0},timeout:6e4})}catch(s){if(n===t)throw s;const o=1e3*Math.pow(2,n);console.warn(`[Upload H5] 上传失败,${o/1e3}秒后重试(第 ${n+1}/${t} 次)`),await new Promise(r=>setTimeout(r,o))}throw new Error("上传失败:已达最大重试次数")}async function y0(e){return $e.get("/wecom/jsapi-config",{params:{url:e}})}const $a="https://res.wx.qq.com/open/js/jweixin-1.2.0.js",w0=59e3,Na=8e3,b0=1e4,La=!0,Ma=["startRecord","stopRecord","translateVoice","checkJsApi"];function E0(){const e=bt({isReady:!1,isRecording:!1,isTranslating:!1,error:null});let t=!1,n=null;function s(){return new Promise((c,u)=>{if(typeof window.wx<"u"){console.log("[WecomVoice] JS-SDK 已加载(window.wx 存在),跳过动态加载"),c();return}console.log("[WecomVoice] 动态加载 JS-SDK 脚本:",$a);const f=setTimeout(()=>{d.onload=null,d.onerror=null,u(new Error("加载企微 JS-SDK 脚本超时(10秒),请检查网络连接"))},b0),d=document.createElement("script");d.src=$a,d.async=!0,d.onload=()=>{clearTimeout(f),typeof window.wx<"u"?(console.log("[WecomVoice] JS-SDK 脚本加载成功,window.wx 已挂载"),c()):(console.error("[WecomVoice] JS-SDK 脚本已加载,但 window.wx 未挂载"),u(new Error("企微 JS-SDK 脚本已加载,但 window.wx 未挂载")))},d.onerror=()=>{clearTimeout(f),console.error("[WecomVoice] JS-SDK 脚本加载失败"),u(new Error("加载企微 JS-SDK 脚本失败,请检查网络连接"))},document.head.appendChild(d)})}function o(c){return new Promise((u,f)=>{const d=window.wx;if(!d||typeof d.config!="function"){const _="wx.config 不可用,JS-SDK 未正确加载";console.error("[WecomVoice]",_),e.isReady=!1,e.error=_,f(new Error(_));return}let h=!1;const x=setTimeout(()=>{h||(h=!0,e.isReady=!1,e.error=`wx.config 鉴权超时(${Na/1e3}秒无响应),可能是签名无效或企微环境异常`,console.error("[WecomVoice]",e.error),f(new Error(e.error)))},Na);d.ready(()=>{h||(h=!0,clearTimeout(x),e.isReady=!0,console.log("[WecomVoice] wx.config 鉴权成功(ready 回调触发)"),u())}),d.error(_=>{h||(h=!0,clearTimeout(x),e.isReady=!1,e.error=`JS-SDK 鉴权失败: ${_.errMsg}`,console.error("[WecomVoice] wx.config 鉴权失败:",_.errMsg),f(new Error(e.error)))}),console.log("[WecomVoice] 调用 wx.config:",{appId:c.corp_id,timestamp:c.timestamp,debug:La,jsApiList:Ma}),d.config({beta:!0,debug:La,appId:c.corp_id,timestamp:c.timestamp,nonceStr:c.nonce_str,signature:c.signature,jsApiList:Ma})})}async function r(){if(t){console.log("[WecomVoice] 已初始化,跳过");return}console.log("[WecomVoice] ===== 开始初始化 =====");try{console.log("[WecomVoice] Step 1/3: 加载 JS-SDK 脚本"),await s(),console.log("[WecomVoice] Step 2/3: 获取签名配置");const c=window.location.href.split("#")[0];console.log("[WecomVoice] 签名 URL:",c);const u=await y0(c);console.log("[WecomVoice] 签名配置:",{corp_id:u.corp_id,agent_id:u.agent_id,timestamp:u.timestamp,nonce_str:u.nonce_str,signature:u.signature?u.signature.substring(0,10)+"...":"(空)"}),console.log("[WecomVoice] Step 3/3: wx.config 鉴权"),await o(u),window.wx&&typeof window.wx.checkJsApi=="function"&&window.wx.checkJsApi({jsApiList:["startRecord","stopRecord","translateVoice"],success:f=>{console.log("[WecomVoice] checkJsApi 结果:",JSON.stringify(f))},fail:f=>{console.warn("[WecomVoice] checkJsApi 失败(不阻塞):",f)}}),t=!0,e.error=null,console.log("[WecomVoice] ===== 初始化完成 =====")}catch(c){throw e.error=(c==null?void 0:c.message)||"JS-SDK 初始化失败",console.error("[WecomVoice] ===== 初始化失败 =====",e.error),c}}async function i(){if(e.isRecording){console.log("[WecomVoice] 已在录音中,跳过");return}e.isReady||(console.log("[WecomVoice] SDK 未就绪,先调用 init()..."),await r());const c=window.wx;if(!c||typeof c.startRecord!="function"){const u="wx.startRecord 不可用,JS-SDK 未正确初始化";throw console.error("[WecomVoice]",u),e.error=u,new Error(u)}return new Promise((u,f)=>{n=setTimeout(()=>{e.isRecording&&(console.log("[WecomVoice] 59秒自动停止录音"),l().catch(d=>{e.error=`自动停止录音失败: ${(d==null?void 0:d.message)||"未知错误"}`}))},w0),console.log("[WecomVoice] 调用 wx.startRecord..."),c.startRecord({success:()=>{e.isRecording=!0,e.error=null,console.log("[WecomVoice] 录音开始成功(startRecord success 回调)"),u()},fail:d=>{n&&(clearTimeout(n),n=null),e.error=`开始录音失败: ${d.errMsg}`,console.error("[WecomVoice] 录音开始失败:",d.errMsg),f(new Error(e.error))},cancel:()=>{n&&(clearTimeout(n),n=null),e.error="用户拒绝了录音权限",console.warn("[WecomVoice] 用户拒绝录音权限"),f(new Error(e.error))}})})}async function l(){const c=window.wx;return n&&(clearTimeout(n),n=null),e.isRecording?(console.log("[WecomVoice] 调用 wx.stopRecord..."),new Promise((u,f)=>{c.stopRecord({success:d=>{e.isRecording=!1;const h=d.localId;if(console.log("[WecomVoice] 停止录音成功,localId:",h),!h){f(new Error("未获取到录音 localId"));return}e.isTranslating=!0,console.log("[WecomVoice] 调用 wx.translateVoice..."),c.translateVoice({localId:h,isShowProgressTips:1,success:x=>{e.isTranslating=!1;const _=(x.translateResult||"").trim();console.log("[WecomVoice] 语音转文字成功:",_),u(_)},fail:x=>{e.isTranslating=!1,e.error=`语音转文字失败: ${x.errMsg}`,console.error("[WecomVoice] 语音转文字失败:",x.errMsg),f(new Error(e.error))}})},fail:d=>{e.isRecording=!1,e.error=`停止录音失败: ${d.errMsg}`,console.error("[WecomVoice] 停止录音失败:",d.errMsg),f(new Error(e.error))}})})):(console.log("[WecomVoice] 未在录音中,跳过 stopAndTranslate"),"")}function a(){const c=navigator.userAgent,u=/wxwork/i.test(c),f=/Mobile|Android|iPhone|iPad|iPod/i.test(c);return u&&f}return{state:e,init:r,startRecording:i,stopAndTranslate:l,isSupported:a}}const S0={class:"input-bar"},x0={class:"input-bar__row"},C0={key:0,class:"emoji-panel"},A0={class:"emoji-panel__grid"},R0=["onClick"],T0={class:"input-bar__input-row"},k0=["title"],O0={key:0,class:"input-bar__guide input-bar__guide--active"},P0={key:2,class:"input-bar__guide"},I0=Se({__name:"InputBar",emits:["call-agent"],setup(e){function t(j){return j?typeof j=="string"?j:Array.isArray(j)?j.map(W=>W.loc&&W.msg?`${W.loc.slice(1).join(".")}: ${W.msg}`:W.msg?W.msg:JSON.stringify(W)).join("; "):typeof j=="object"?JSON.stringify(j):String(j):""}const n=$t(),s=K(""),o=K(null),r=K(null),i=oe(()=>s.value.trim().length>0&&!n.loading&&n.isLoggedIn),l=K(!1),a=K(!1),{state:c,init:u,startRecording:f,stopAndTranslate:d,isSupported:h}=E0();function x(j){return j.length>0&&!j.endsWith(" ")&&!j.endsWith(`
`)}mt(()=>{document.addEventListener("paste",_),document.addEventListener("keydown",se),h()&&u().catch(j=>{console.warn("[InputBar] 企微 JS-SDK 初始化失败:",j)})}),Bn(()=>{document.removeEventListener("paste",_),document.removeEventListener("keydown",se)});async function _(j){var G;const W=j.target;if(W.tagName==="TEXTAREA"||W.isContentEditable)return;const ee=(G=j.clipboardData)==null?void 0:G.items;if(ee){for(const X of Array.from(ee))if(X.kind==="file"){j.preventDefault();const ae=X.getAsFile();if(!ae)continue;ae.type.startsWith("image/")?await g(ae):await O(ae);return}}}const m=["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🤐","🤨","😐","😑","😶","😏","😒","🙄","😬","😮","🤯","😲","😳","🥺","😢","😭","😤","😠","😡","🤬","👍","👎","👏","🙌","🤝","💪","✌️","🤞","❤️","🧡","💛","💚","💙","💜","💯","✅"];function v(j){s.value+=j,a.value=!1,_t(()=>{var ee,G;const W=(G=(ee=o.value)==null?void 0:ee.$el)==null?void 0:G.querySelector("textarea");W==null||W.focus()})}function S(j){/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)||j.shiftKey||(j.preventDefault(),T())}async function T(){const j=s.value.trim();!j||n.loading||(s.value="",await n.sendNewMessage(j))}async function C(j){var ee;const W=(ee=j.clipboardData)==null?void 0:ee.items;if(W){for(const G of Array.from(W))if(G.kind==="file"){j.preventDefault();const X=G.getAsFile();if(!X)continue;X.type.startsWith("image/")?await g(X):await O(X);return}}}async function g(j){var W,ee;try{ve("图片上传中...");const G=await kr(j),X=j instanceof File?j.name:"截图";await n.sendNewMessage(`[图片] ${X}`,{msg_type:"image",media_url:G.url,file_name:G.filename,file_size:G.file_size}),ve("图片发送成功")}catch(G){console.error("图片上传失败:",G),ve(t((ee=(W=G==null?void 0:G.response)==null?void 0:W.data)==null?void 0:ee.detail)||(G==null?void 0:G.message)||"图片上传失败,请重试")}}async function O(j){var W,ee;try{const G=j instanceof File?j.name:"文件";ve(`文件上传中: ${G}`);const X=await kr(j);await n.sendNewMessage(`[文件] ${X.filename}`,{msg_type:"file",media_url:X.url,file_name:X.filename,file_size:X.file_size}),ve("文件发送成功")}catch(G){console.error("文件上传失败:",G),ve(t((ee=(W=G==null?void 0:G.response)==null?void 0:W.data)==null?void 0:ee.detail)||(G==null?void 0:G.message)||"文件上传失败,请重试")}}async function P(j){const W=j.target,ee=W.files;if(!(!ee||ee.length===0)){for(const G of Array.from(ee))try{ve(`正在上传: ${G.name}`);const X=await kr(G);ve(`${G.name} 上传成功`),console.log("[InputBar] 文件上传成功:",X.url)}catch(X){console.error("文件上传失败:",X),ve(`${G.name} 上传失败`)}W.value=""}}function z(){a.value=!a.value}function D(){r.value&&(r.value.accept="",r.value.multiple=!0,r.value.click())}async function J(j){if(j==null||j.preventDefault(),j==null||j.stopPropagation(),!h()){ve("当前环境不支持语音识别");return}try{if(c.isRecording){const W=await d();W?(x(s.value)&&(s.value+=" "),s.value+=W,ve("语音识别完成")):ve("未识别到语音内容")}else await f(),ve("正在录音,点击停止")}catch(W){const ee=c.error||(W==null?void 0:W.message)||"语音识别失败";ve(ee),console.error("[InputBar] 语音识别错误:",W)}}function se(j){j.ctrlKey&&(j.key==="d"||j.key==="D")&&(j.preventDefault(),J())}function H(j){l.value=!0;const W=j.clientY,ee=j.target.closest(".input-bar"),G=ee?ee.offsetHeight:100;function X(xe){if(!l.value)return;const we=W-xe.clientY;let be=G+we;be=Math.max(100,Math.min(400,be)),ee&&(ee.style.height=`${be}px`,ee.style.flexShrink="0")}function ae(){l.value=!1,document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",ae),document.body.style.cursor="",document.body.style.userSelect=""}document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",X),document.addEventListener("mouseup",ae)}return(j,W)=>{const ee=Fi,G=Ls;return B(),M("div",S0,[p("div",{class:"input-bar__resize-handle",onMousedown:H},[...W[2]||(W[2]=[p("div",{class:"input-bar__resize-track"},null,-1)])],32),p("div",x0,[p("div",{class:"input-bar__toolbar"},[p("button",{class:"input-bar__tool-btn",title:"表情",onClick:z},[...W[3]||(W[3]=[p("span",null,"😊",-1)])]),p("button",{class:"input-bar__tool-btn",title:"文件",onClick:D},[...W[4]||(W[4]=[p("span",null,"📎",-1)])])]),a.value?(B(),M("div",C0,[p("div",A0,[(B(),M(Re,null,Ft(m,X=>p("button",{key:X,class:"emoji-panel__item",onClick:ae=>v(X)},ie(X),9,R0)),64))])])):fe("",!0),p("div",T0,[A(ee,{ref_key:"inputFieldRef",ref:o,modelValue:s.value,"onUpdate:modelValue":W[0]||(W[0]=X=>s.value=X),class:"input-bar__field",placeholder:"请输入消息...",type:"textarea",autosize:{minHeight:54,maxHeight:200},rows:"3",disabled:!de(n).isLoggedIn,onKeydown:pu(S,["enter"]),onPaste:C},null,8,["modelValue","disabled"]),de(h)()?(B(),M("button",{key:0,class:Ne(["input-bar__voice-btn",{"input-bar__voice-btn--recording":de(c).isRecording}]),title:de(c).isRecording?"点击停止录音":"语音输入 (Ctrl+D)",onMousedown:On(J,["prevent"]),onClick:On(J,["prevent"]),onTouchstart:On(J,["prevent"])},ie(de(c).isRecording?"⏹":"🎤"),43,k0)):fe("",!0),A(G,{class:"input-bar__send-btn",type:"primary",size:"small",disabled:!i.value,loading:de(n).loading,onClick:T},{default:dt(()=>[...W[5]||(W[5]=[Xe(" 发送 ",-1)])]),_:1},8,["disabled","loading"])])]),de(n).canCallAgent?(B(),M("div",O0," 点击【呼叫】召唤人工坐席 ")):fe("",!0),a.value?(B(),M("div",{key:1,class:"emoji-panel__overlay",onClick:W[1]||(W[1]=X=>a.value=!1)})):(B(),M("div",P0," 请描述你遇到的问题,AI 助手会帮你分析 💡 ")),p("input",{ref_key:"fileInputRef",ref:r,type:"file",style:{display:"none"},onChange:P},null,544)])}}}),F0=Et(I0,[["__scopeId","data-v-faf82729"]]),B0={key:0,class:"call-modal call-modal--compact"},D0={class:"call-modal__step"},$0={class:"call-modal__body call-modal__body--center"},N0={key:0,class:"scene scene--hand"},L0={key:1,class:"scene scene--pound"},M0={key:2,class:"scene scene--scarecrow"},V0={key:3,class:"scene scene--watermelon"},j0={key:4,class:"scene scene--bell"},U0={key:5,class:"scene scene--cannon"},H0={key:6,class:"scene scene--missile"},q0={class:"call-modal__speech-text"},z0={class:"call-modal__speech-emoji"},W0={class:"call-modal__speech-content"},K0={key:7,class:"call-modal__sending"},G0={key:8,class:"call-modal__success"},J0={class:"call-modal__footer call-modal__footer--center"},X0=Se({__name:"CallAgentModal",props:{visible:{type:Boolean}},emits:["update:visible","call-success"],setup(e,{emit:t}){const n=e,s=t,o=$t(),r=K(1),i=K(!1),l=K(!1),a=[{id:1,emoji:"🙋",text:"看这里!看我这里...我有个问题!",weight:3},{id:2,emoji:"🪑",text:"快快快!我等不及了!",weight:3},{id:3,emoji:"💀",text:"这个问题不解决我就要原地爆炸了💥",weight:1.5},{id:4,emoji:"🍉",text:"IT!救我!这个问题卡住我了🍉",weight:1.5},{id:5,emoji:"🔔",text:"叮叮叮!有人吗!IT 在线吗!",weight:1},{id:6,emoji:"💣",text:"开炮!💣 这个问题必须解决了!",weight:1.5},{id:7,emoji:"🚀",text:"发射!🚀 紧急呼叫 IT 特种部队!",weight:1.5}];function c(){return 5}const u=oe(()=>{var _;return((_=a.find(m=>m.id===r.value))==null?void 0:_.text)??""}),f=oe(()=>{var _;return((_=a.find(m=>m.id===r.value))==null?void 0:_.emoji)??"🙋"});Ie(()=>n.visible,_=>{_&&h()});const d=K("");async function h(){r.value=c(),i.value=!0,l.value=!1,d.value="";try{const _=await o.shakeAgent();d.value=_,l.value=!0,s("call-success"),setTimeout(()=>{l.value&&x()},5e3)}catch{x()}finally{i.value=!1}}function x(){s("update:visible",!1),setTimeout(()=>{i.value=!1,l.value=!1},300)}return(_,m)=>(B(),Bt(Ei,{to:"body"},[A(Co,{name:"modal-fade"},{default:dt(()=>[e.visible?(B(),M("div",{key:0,class:"call-modal__overlay",onClick:On(x,["self"])},[A(Co,{name:"modal-zoom",appear:""},{default:dt(()=>[e.visible?(B(),M("div",B0,[p("div",D0,[m[8]||(m[8]=p("div",{class:"call-modal__header"},[p("span",{class:"call-modal__icon"},"🔔"),p("h3",null,"呼叫人工坐席帮助...")],-1)),p("div",$0,[r.value===1?(B(),M("div",N0,[...m[0]||(m[0]=[p("svg",{viewBox:"0 0 200 180",xmlns:"http://www.w3.org/2000/svg",class:"scene__svg"},[p("rect",{x:"0",y:"140",width:"200",height:"40",fill:"#E8EAF6"}),p("rect",{x:"45",y:"75",width:"110",height:"65",rx:"10",fill:"#ECEFF1"}),p("rect",{x:"50",y:"80",width:"100",height:"55",rx:"8",fill:"#CFD8DC"}),p("rect",{x:"55",y:"85",width:"40",height:"25",rx:"3",fill:"#90CAF9"}),p("rect",{x:"100",y:"85",width:"40",height:"25",rx:"3",fill:"#90CAF9"}),p("circle",{cx:"135",cy:"70",r:"16",fill:"#F5C6A0"}),p("circle",{cx:"130",cy:"67",r:"2",fill:"#333"}),p("circle",{cx:"140",cy:"67",r:"2",fill:"#333"}),p("path",{d:"M130 75 Q135 79 140 75",stroke:"#333","stroke-width":"1.5",fill:"none"}),p("rect",{x:"12",y:"72",width:"30",height:"50",rx:"8",fill:"#F5C6A0"}),p("g",{class:"hand-arm"},[p("line",{x1:"42",y1:"80",x2:"55",y2:"55",stroke:"#F5C6A0","stroke-width":"8","stroke-linecap":"round"})]),p("g",{class:"bubble-float"},[p("rect",{x:"55",y:"36",width:"100",height:"24",rx:"12",fill:"#FF9800"}),p("text",{x:"105",y:"52","text-anchor":"middle",fill:"white","font-size":"11","font-weight":"bold"},"看这里!🙋")])],-1)])])):r.value===2?(B(),M("div",L0,[...m[1]||(m[1]=[p("svg",{viewBox:"0 0 200 180",xmlns:"http://www.w3.org/2000/svg",class:"scene__svg"},[p("rect",{x:"0",y:"140",width:"200",height:"40",fill:"#D7CCC8"}),p("rect",{x:"30",y:"105",width:"140",height:"35",rx:"6",fill:"#8D6E63"}),p("rect",{x:"35",y:"110",width:"130",height:"25",rx:"4",fill:"#A1887F"}),p("rect",{x:"20",y:"75",width:"35",height:"50",rx:"8",fill:"#795548"}),p("circle",{cx:"37",cy:"60",r:"16",fill:"#F5C6A0"}),p("g",{class:"pound-fists"},[p("circle",{cx:"75",cy:"98",r:"9",fill:"#F5C6A0"}),p("circle",{cx:"105",cy:"98",r:"9",fill:"#F5C6A0"})]),p("g",{class:"splash-lines"},[p("line",{x1:"68",y1:"90",x2:"62",y2:"82",stroke:"#FF5722","stroke-width":"2"}),p("line",{x1:"80",y1:"88",x2:"80",y2:"78",stroke:"#FF5722","stroke-width":"2"}),p("line",{x1:"90",y1:"88",x2:"95",y2:"78",stroke:"#FF5722","stroke-width":"2"}),p("line",{x1:"110",y1:"90",x2:"110",y2:"80",stroke:"#FF5722","stroke-width":"2"}),p("line",{x1:"120",y1:"90",x2:"126",y2:"82",stroke:"#FF5722","stroke-width":"2"})]),p("g",{class:"bubble-float"},[p("rect",{x:"90",y:"36",width:"100",height:"24",rx:"12",fill:"#FF5722"}),p("text",{x:"140",y:"52","text-anchor":"middle",fill:"white","font-size":"11","font-weight":"bold"},"快快快!🪑")])],-1)])])):r.value===3?(B(),M("div",M0,[...m[2]||(m[2]=[p("svg",{viewBox:"0 0 200 180",xmlns:"http://www.w3.org/2000/svg",class:"scene__svg"},[p("rect",{x:"0",y:"140",width:"200",height:"40",fill:"#C8E6C9"}),p("rect",{x:"145",y:"100",width:"6",height:"40",fill:"#795548"}),p("rect",{x:"133",y:"95",width:"30",height:"5",rx:"2",fill:"#795548"}),p("circle",{cx:"148",cy:"85",r:"14",fill:"#FFE082"}),p("line",{x1:"148",y1:"74",x2:"148",y2:"70",stroke:"#333","stroke-width":"1.5"}),p("rect",{x:"25",y:"72",width:"30",height:"50",rx:"8",fill:"#1565C0"}),p("circle",{cx:"40",cy:"57",r:"16",fill:"#F5C6A0"}),p("g",{class:"slash-blade"},[p("rect",{x:"55",y:"40",width:"6",height:"50",rx:"2",fill:"#B0BEC5"}),p("rect",{x:"52",y:"38",width:"12",height:"8",rx:"2",fill:"#90A4AE"})]),p("g",{class:"explosion-effect"},[p("circle",{cx:"148",cy:"85",r:"10",fill:"#FF5722",opacity:"0"})]),p("g",{class:"bubble-float"},[p("rect",{x:"5",y:"5",width:"105",height:"24",rx:"12",fill:"#D32F2F"}),p("text",{x:"57",y:"21","text-anchor":"middle",fill:"white","font-size":"10","font-weight":"bold"},"我要爆炸了💥")])],-1)])])):r.value===4?(B(),M("div",V0,[...m[3]||(m[3]=[p("svg",{viewBox:"0 0 200 180",xmlns:"http://www.w3.org/2000/svg",class:"scene__svg"},[p("rect",{x:"0",y:"140",width:"200",height:"40",fill:"#C8E6C9"}),p("g",{class:"melon"},[p("ellipse",{cx:"140",cy:"125",rx:"25",ry:"18",fill:"#4CAF50"}),p("ellipse",{cx:"140",cy:"122",rx:"18",ry:"10",fill:"#F44336"})]),p("rect",{x:"25",y:"75",width:"30",height:"47",rx:"8",fill:"#1565C0"}),p("circle",{cx:"40",cy:"60",r:"16",fill:"#F5C6A0"}),p("g",{class:"knife"},[p("rect",{x:"55",y:"42",width:"6",height:"45",rx:"2",fill:"#B0BEC5"}),p("rect",{x:"52",y:"40",width:"12",height:"8",rx:"2",fill:"#90A4AE"})]),p("g",{class:"juice-splash"},[p("circle",{cx:"130",cy:"110",r:"2",fill:"#F44336",opacity:"0"}),p("circle",{cx:"145",cy:"105",r:"2.5",fill:"#F44336",opacity:"0"}),p("circle",{cx:"155",cy:"112",r:"1.5",fill:"#F44336",opacity:"0"})]),p("g",{class:"bubble-float"},[p("rect",{x:"5",y:"5",width:"105",height:"24",rx:"12",fill:"#43A047"}),p("text",{x:"57",y:"21","text-anchor":"middle",fill:"white","font-size":"10","font-weight":"bold"},"IT救我!🍉")])],-1)])])):r.value===5?(B(),M("div",j0,[...m[4]||(m[4]=[p("svg",{viewBox:"0 0 200 180",xmlns:"http://www.w3.org/2000/svg",class:"scene__svg"},[p("rect",{x:"0",y:"140",width:"200",height:"40",fill:"#FFF3E0"}),p("rect",{x:"25",y:"70",width:"30",height:"52",rx:"8",fill:"#FF9800"}),p("circle",{cx:"40",cy:"55",r:"16",fill:"#F5C6A0"}),p("g",{class:"bell-left"},[p("path",{d:"M52 72 Q52 58 60 50 Q68 42 72 50 Q76 58 74 72",fill:"#FFD54F",stroke:"#FFA000","stroke-width":"1.5"}),p("ellipse",{cx:"63",cy:"72",rx:"9",ry:"3",fill:"#FFA000"})]),p("g",{class:"bell-right"},[p("path",{d:"M92 72 Q92 58 100 50 Q108 42 112 50 Q116 58 114 72",fill:"#FFD54F",stroke:"#FFA000","stroke-width":"1.5"}),p("ellipse",{cx:"103",cy:"72",rx:"9",ry:"3",fill:"#FFA000"})]),p("g",{class:"sound-waves"},[p("circle",{cx:"160",cy:"55",r:"10",fill:"none",stroke:"#FF9800","stroke-width":"1.5",opacity:"0"}),p("circle",{cx:"160",cy:"55",r:"16",fill:"none",stroke:"#FF9800","stroke-width":"1.5",opacity:"0"}),p("circle",{cx:"160",cy:"55",r:"22",fill:"none",stroke:"#FF9800","stroke-width":"1",opacity:"0"})]),p("g",{class:"bubble-float"},[p("rect",{x:"5",y:"5",width:"105",height:"24",rx:"12",fill:"#FF9800"}),p("text",{x:"57",y:"21","text-anchor":"middle",fill:"white","font-size":"10","font-weight":"bold"},"叮叮叮!有人吗")])],-1)])])):r.value===6?(B(),M("div",U0,[...m[5]||(m[5]=[p("svg",{viewBox:"0 0 200 180",xmlns:"http://www.w3.org/2000/svg",class:"scene__svg"},[p("rect",{x:"0",y:"145",width:"200",height:"35",fill:"#D7CCC8"}),p("rect",{x:"55",y:"132",width:"50",height:"16",rx:"3",fill:"#5D4037"}),p("circle",{cx:"80",cy:"138",r:"9",fill:"#4E342E"}),p("g",{class:"cannon-barrel"},[p("rect",{x:"58",y:"110",width:"55",height:"14",rx:"4",fill:"#616161"}),p("rect",{x:"108",y:"108",width:"12",height:"18",rx:"3",fill:"#757575"})]),p("g",{class:"fuse"},[p("path",{d:"M58 117 Q52 115 48 118 Q44 121 40 117",stroke:"#FF9800","stroke-width":"2",fill:"none"}),p("circle",{cx:"38",cy:"116",r:"3",fill:"#FF5722",class:"fuse-spark"})]),p("g",{class:"cannonball"},[p("circle",{cx:"120",cy:"105",r:"7",fill:"#37474F"})]),p("g",{class:"explosion"},[p("circle",{cx:"170",cy:"60",r:"18",fill:"#FF5722",opacity:"0",class:"blast-main"}),p("circle",{cx:"170",cy:"60",r:"12",fill:"#FFC107",opacity:"0",class:"blast-inner"}),p("line",{x1:"170",y1:"40",x2:"170",y2:"30",stroke:"#FF5722","stroke-width":"3",opacity:"0",class:"blast-ray ray-1"}),p("line",{x1:"185",y1:"48",x2:"192",y2:"42",stroke:"#FF5722","stroke-width":"3",opacity:"0",class:"blast-ray ray-2"}),p("line",{x1:"188",y1:"60",x2:"196",y2:"60",stroke:"#FF5722","stroke-width":"3",opacity:"0",class:"blast-ray ray-3"}),p("line",{x1:"185",y1:"72",x2:"192",y2:"78",stroke:"#FF5722","stroke-width":"3",opacity:"0",class:"blast-ray ray-4"}),p("line",{x1:"170",y1:"80",x2:"170",y2:"90",stroke:"#FF5722","stroke-width":"3",opacity:"0",class:"blast-ray ray-5"}),p("line",{x1:"155",y1:"72",x2:"148",y2:"78",stroke:"#FF5722","stroke-width":"3",opacity:"0",class:"blast-ray ray-6"}),p("line",{x1:"152",y1:"60",x2:"144",y2:"60",stroke:"#FF5722","stroke-width":"3",opacity:"0",class:"blast-ray ray-7"}),p("line",{x1:"155",y1:"48",x2:"148",y2:"42",stroke:"#FF5722","stroke-width":"3",opacity:"0",class:"blast-ray ray-8"})]),p("g",{class:"target"},[p("circle",{cx:"170",cy:"55",r:"14",fill:"none",stroke:"#F44336","stroke-width":"2"}),p("circle",{cx:"170",cy:"55",r:"8",fill:"none",stroke:"#F44336","stroke-width":"1.5"}),p("circle",{cx:"170",cy:"55",r:"2",fill:"#F44336"}),p("text",{x:"170",y:"38","text-anchor":"middle",fill:"#F44336","font-size":"9","font-weight":"bold"},"BUG")]),p("rect",{x:"5",y:"75",width:"30",height:"57",rx:"7",fill:"#795548"}),p("circle",{cx:"20",cy:"60",r:"16",fill:"#F5C6A0"}),p("circle",{cx:"15",cy:"57",r:"2",fill:"#333"}),p("circle",{cx:"25",cy:"57",r:"2",fill:"#333"}),p("path",{d:"M14 66 Q20 70 26 66",stroke:"#333","stroke-width":"1.5",fill:"none"}),p("line",{x1:"35",y1:"85",x2:"48",y2:"100",stroke:"#F5C6A0","stroke-width":"7","stroke-linecap":"round",class:"gunner-arm"}),p("g",{class:"bubble-float"},[p("rect",{x:"5",y:"5",width:"95",height:"24",rx:"12",fill:"#FF5722"}),p("text",{x:"52",y:"21","text-anchor":"middle",fill:"white","font-size":"11","font-weight":"bold"},"开炮!💣")])],-1)])])):r.value===7?(B(),M("div",H0,[...m[6]||(m[6]=[p("svg",{viewBox:"0 0 200 180",xmlns:"http://www.w3.org/2000/svg",class:"scene__svg"},[p("rect",{x:"0",y:"0",width:"200",height:"140",fill:"#E3F2FD"}),p("rect",{x:"0",y:"140",width:"200",height:"40",fill:"#BDBDBD"}),p("rect",{x:"85",y:"130",width:"30",height:"12",rx:"2",fill:"#616161"}),p("rect",{x:"88",y:"142",width:"8",height:"10",fill:"#757575"}),p("rect",{x:"104",y:"142",width:"8",height:"10",fill:"#757575"}),p("g",{class:"missile-body"},[p("rect",{x:"94",y:"50",width:"12",height:"65",rx:"4",fill:"#E0E0E0"}),p("path",{d:"M94 50 L100 35 L106 50 Z",fill:"#F44336"}),p("polygon",{points:"94,108 86,115 94,112",fill:"#F44336"}),p("polygon",{points:"106,108 114,115 106,112",fill:"#F44336"})]),p("g",{class:"rocket-flame"},[p("ellipse",{cx:"100",cy:"118",rx:"4",ry:"10",fill:"#FF9800",class:"flame-outer"}),p("ellipse",{cx:"100",cy:"116",rx:"2",ry:"6",fill:"#FFEB3B",class:"flame-inner"})]),p("g",{class:"smoke"},[p("circle",{cx:"88",cy:"145",r:"8",fill:"#CFD8DC",opacity:"0",class:"smoke-puff puff-1"}),p("circle",{cx:"112",cy:"145",r:"8",fill:"#CFD8DC",opacity:"0",class:"smoke-puff puff-2"}),p("circle",{cx:"100",cy:"155",r:"10",fill:"#CFD8DC",opacity:"0",class:"smoke-puff puff-3"})]),p("g",{class:"trail"},[p("path",{d:"M100 130 L100 145",stroke:"#FFC107","stroke-width":"2",opacity:"0",class:"trail-line"})]),p("rect",{x:"15",y:"80",width:"28",height:"52",rx:"7",fill:"#1565C0"}),p("circle",{cx:"29",cy:"65",r:"16",fill:"#F5C6A0"}),p("rect",{x:"18",y:"58",width:"22",height:"8",rx:"3",fill:"#333",opacity:"0.7"}),p("circle",{cx:"24",cy:"62",r:"1.5",fill:"#FFF"}),p("circle",{cx:"34",cy:"62",r:"1.5",fill:"#FFF"}),p("ellipse",{cx:"29",cy:"72",rx:"4",ry:"3",fill:"#333"}),p("line",{x1:"43",y1:"90",x2:"60",y2:"100",stroke:"#F5C6A0","stroke-width":"7","stroke-linecap":"round"}),p("rect",{x:"55",y:"105",width:"15",height:"20",rx:"3",fill:"#424242"}),p("circle",{cx:"62.5",cy:"112",r:"3",fill:"#F44336",class:"launch-button"})],-1)])])):fe("",!0),p("div",q0,[p("span",z0,ie(f.value),1),p("span",W0,ie(u.value),1)]),i.value?(B(),M("div",K0,[...m[7]||(m[7]=[p("span",{class:"call-modal__dot-flashing"},null,-1),p("span",null,"正在通知 IT 坐席...",-1)])])):fe("",!0),l.value?(B(),M("div",G0,[d.value==="assigned"?(B(),M(Re,{key:0},[Xe(" 🎉 呼叫成功!坐席已为您服务 ")],64)):d.value==="queued"?(B(),M(Re,{key:1},[Xe(" ⏳ 坐席正忙,您已进入排队,请耐心等待... ")],64)):(B(),M(Re,{key:2},[Xe(" ✅ 呼叫成功!坐席马上就来~ ")],64))])):fe("",!0)]),p("div",J0,[l.value?(B(),M("button",{key:0,class:"call-modal__btn call-modal__btn--primary call-modal__btn--large",onClick:x},"好的,返回聊天")):(B(),M("button",{key:1,class:"call-modal__btn call-modal__btn--cancel",onClick:x},"取消"))])])])):fe("",!0)]),_:1})])):fe("",!0)]),_:1})]))}}),Y0=Et(X0,[["__scopeId","data-v-bdaecda0"]]),Q0={key:0,class:"ts-flow"},Z0={class:"ts-flow__path"},eb={class:"ts-flow__path-bar"},tb={class:"ts-flow__label"},nb={class:"ts-flow__card"},sb={key:0,class:"ts-flow__question"},ob={class:"ts-flow__question-header"},rb={class:"ts-flow__question-text"},ib={class:"ts-flow__options"},lb=["disabled"],ab=["disabled"],cb={key:1,class:"ts-flow__instruction"},ub={class:"ts-flow__instruction-header"},fb={class:"ts-flow__instruction-title"},db={key:0,class:"ts-flow__instruction-steps"},pb={class:"ts-flow__sub-dot"},hb={class:"ts-flow__sub-label"},mb={key:2,class:"ts-flow__waiting"},gb={class:"ts-flow__sync-status"},_b=Se({__name:"TroubleshootFlow",setup(e){const t=$t(),n=K(!1),s=oe(()=>t.troubleshootingSteps||[]),o=oe(()=>t.troubleshootingTemplateName||"排查中"),r=oe(()=>t.troubleshootingCurrentNode||null);function i(a){var c,u;if(!n.value){n.value=!0;try{r.value&&(r.value.status="done");const f=a==="yes"?(c=r.value)==null?void 0:c.yes_branch:(u=r.value)==null?void 0:u.no_branch;f&&(t.troubleshootingCurrentNode=f,f.status="current",f.type==="step"&&l(f)),console.log("[TroubleshootFlow] 用户选择:",a,"下一节点:",f==null?void 0:f.label)}finally{setTimeout(()=>{n.value=!1},500)}}}function l(a){const c=t.troubleshootingSteps;if(!c||c.length===0)return;const u=c.findIndex(f=>f.label===a.label);if(u>=0){const f=c.map((d,h)=>({...d,status:h<u?"done":h===u?"current":"pending"}));t.troubleshootingSteps=f}}return(a,c)=>{var u,f;return s.value.length>0?(B(),M("div",Q0,[p("div",Z0,[p("div",eb,[(B(!0),M(Re,null,Ft(s.value,(d,h)=>(B(),M(Re,{key:h},[p("div",{class:Ne(["ts-flow__step",`ts-flow__step--${d.status}`])},[p("span",{class:Ne(["ts-flow__dot",`ts-flow__dot--${d.status}`])},[d.status==="done"?(B(),M(Re,{key:0},[Xe("✓")],64)):(B(),M(Re,{key:1},[Xe(ie(h+1),1)],64))],2),p("span",tb,ie(d.label),1)],2),h<s.value.length-1?(B(),M("span",{key:0,class:Ne(["ts-flow__arrow",{"ts-flow__arrow--active":d.status==="done"}])},"→",2)):fe("",!0)],64))),128))])]),p("div",nb,[r.value&&r.value.type==="decision"?(B(),M("div",sb,[p("div",ob,[c[2]||(c[2]=p("span",{class:"ts-flow__question-icon"},"❓",-1)),p("span",rb,ie(r.value.label),1)]),p("div",ib,[p("button",{class:"ts-flow__option ts-flow__option--yes",onClick:c[0]||(c[0]=d=>i("yes")),disabled:n.value},[c[3]||(c[3]=p("span",{class:"ts-flow__option-icon"},"✅",-1)),p("span",null,ie(((u=r.value.yes_branch)==null?void 0:u.label)||"是"),1)],8,lb),p("button",{class:"ts-flow__option ts-flow__option--no",onClick:c[1]||(c[1]=d=>i("no")),disabled:n.value},[c[4]||(c[4]=p("span",{class:"ts-flow__option-icon"},"❌",-1)),p("span",null,ie(((f=r.value.no_branch)==null?void 0:f.label)||"否"),1)],8,ab)])])):r.value&&r.value.type==="step"?(B(),M("div",cb,[p("div",ub,[c[5]||(c[5]=p("span",{class:"ts-flow__instruction-icon"},"📋",-1)),p("span",fb,"正在执行:"+ie(r.value.label),1)]),r.value.children&&r.value.children.length>0?(B(),M("div",db,[(B(!0),M(Re,null,Ft(r.value.children,(d,h)=>(B(),M("div",{key:d.id,class:Ne(["ts-flow__sub-step",`ts-flow__sub-step--${d.status||"pending"}`])},[p("span",pb,ie(h+1),1),p("span",hb,ie(d.label),1)],2))),128))])):fe("",!0),c[6]||(c[6]=p("div",{class:"ts-flow__instruction-hint"},[p("span",null,"💡 请按坐席指引操作,完成后坐席会推进到下一步")],-1))])):(B(),M("div",mb,[...c[7]||(c[7]=[p("span",{class:"ts-flow__waiting-icon"},"⏳",-1),p("span",null,"坐席正在选择排查流程,请稍候...",-1)])])),p("div",gb,[c[8]||(c[8]=p("span",{class:"ts-flow__sync-dot"},null,-1)),p("span",null,"排查进度实时同步 · "+ie(o.value),1)])])])):fe("",!0)}}}),vb=Et(_b,[["__scopeId","data-v-412334b8"]]),Mf={primary_agent:"#3b82f6",collaborator:"#07C160",owner:"#FF9800",invitee:"transparent"};function Vf(){const e=$t(),t=It(),n=oe(()=>{var i;return((i=e.userInfo)==null?void 0:i.employee_id)||""}),s=oe(()=>{var c;const i=e.currentConversation;if(!i)return[];const l=[];if(i.agent_name&&l.push({id:i.agent_id||"agent_primary",name:i.agent_name,avatar:"",department:"IT坐席",role:"primary_agent",joined:!0,isSelf:!1}),i.employee_name){const u=i.employee_id===n.value;l.push({id:i.employee_id,name:u?"我":i.employee_name,avatar:u&&((c=t.employeeInfo)==null?void 0:c.avatar)||"",department:"",role:"owner",joined:!0,isSelf:u})}const a=(e.participants||[]).slice().sort((u,f)=>u.joined!==f.joined?u.joined?-1:1:u.joined_at&&f.joined_at?new Date(u.joined_at).getTime()-new Date(f.joined_at).getTime():0);for(const u of a)l.push({id:u.id,name:u.name,avatar:u.avatar||"",department:u.department||"",role:"invitee",joined:u.joined??!1,isSelf:u.id===n.value,joinedAt:u.joined_at});return l}),o=oe(()=>s.value.length),r=oe(()=>s.value.some(i=>!i.joined));return{normalizedParticipants:s,totalCount:o,hasPending:r,currentUserId:n}}const yb={class:"participant-strip__count"},wb={class:"participant-strip__avatars"},bb=["src","alt","onError"],Eb={key:1,class:"participant-strip__avatar-letter"},Sb={key:0,class:"participant-strip__overflow"},xb={key:0,class:"participant-strip__badge-dot"},Va=4,Cb=Se({__name:"ParticipantStrip",setup(e){const t=$t(),n=K({}),{normalizedParticipants:s,totalCount:o,hasPending:r}=Vf(),i=oe(()=>s.value.slice(0,Va)),l=oe(()=>Math.max(0,s.value.length-Va));function a(u){return(u||"?").charAt(0)}function c(){t.participantPanelVisible=!0}return(u,f)=>(B(),M("div",{class:Ne(["participant-strip",{"participant-strip--has-pending":de(r)}]),onClick:c},[p("span",yb,ie(de(o))+"人在群",1),p("div",wb,[(B(!0),M(Re,null,Ft(i.value,d=>(B(),M("div",{key:d.id,class:Ne(["participant-strip__avatar",{"participant-strip__avatar--self":d.isSelf}]),style:ns({borderColor:de(Mf)[d.role]})},[d.avatar&&!n.value[d.id]?(B(),M("img",{key:0,src:d.avatar,alt:d.name,class:"participant-strip__avatar-img",onError:h=>n.value[d.id]=!0},null,40,bb)):(B(),M("span",Eb,ie(a(d.name)),1))],6))),128)),l.value>0?(B(),M("span",Sb," +"+ie(l.value),1)):fe("",!0)]),f[0]||(f[0]=p("span",{class:"participant-strip__arrow"},"▼",-1)),de(r)?(B(),M("span",xb)):fe("",!0)],2))}}),Ab=Et(Cb,[["__scopeId","data-v-154a02b9"]]),Rb={class:"participant-list"},Tb={class:"participant-list__header"},kb={class:"participant-list__items"},Ob=["src","alt","onError"],Pb={key:1,class:"participant-item__avatar-letter"},Ib={class:"participant-item__info"},Fb={class:"participant-item__name"},Bb={key:0,class:"participant-item__self-tag"},Db={key:0,class:"participant-item__dept"},$b={key:0,class:"participant-item__badge participant-item__badge--agent"},Nb={key:1,class:"participant-item__badge participant-item__badge--owner"},Lb={key:2,class:"participant-item__badge participant-item__badge--joined"},Mb={key:3,class:"participant-item__badge participant-item__badge--pending"},Vb={key:0,class:"participant-list__footer"},jb=["disabled"],Ub=Se({__name:"ParticipantList",setup(e){const t=$t(),n=K(!1),s=K({}),{normalizedParticipants:o}=Vf();function r(l){return(l||"?").charAt(0)}async function i(){try{await Ag({title:"退出会话",message:"确定要退出该会话吗?退出后将无法查看会话消息。",confirmButtonText:"确定退出",cancelButtonText:"再想想",confirmButtonColor:"#ee0a24"}),n.value=!0,await t.leaveAsParticipant(),ve("已退出会话"),t.participantPanelVisible=!1}catch(l){l!=="cancel"&&(console.error("[ParticipantList] 退出失败:",l),ve("退出失败,请重试"))}finally{n.value=!1}}return(l,a)=>(B(),M("div",Rb,[p("div",Tb,[a[1]||(a[1]=p("span",{class:"participant-list__title"},"参与者",-1)),p("button",{class:"participant-list__close-btn",onClick:a[0]||(a[0]=c=>de(t).participantPanelVisible=!1)}," × ")]),p("div",kb,[(B(!0),M(Re,null,Ft(de(o),c=>(B(),M("div",{key:c.id,class:Ne(["participant-item",{"participant-item--self":c.isSelf}])},[p("div",{class:Ne(["participant-item__avatar",{"participant-item__avatar--self":c.isSelf,"participant-item__avatar--agent":c.role==="primary_agent"}]),style:ns({borderColor:de(Mf)[c.role]})},[c.avatar&&!s.value[c.id]?(B(),M("img",{key:0,src:c.avatar,alt:c.name,class:"participant-item__avatar-img",onError:u=>s.value[c.id]=!0},null,40,Ob)):(B(),M("span",Pb,ie(r(c.name)),1))],6),p("div",Ib,[p("span",Fb,[Xe(ie(c.name)+" ",1),c.isSelf?(B(),M("span",Bb,"(我)")):fe("",!0)]),c.department?(B(),M("span",Db,ie(c.department),1)):fe("",!0)]),c.role==="primary_agent"?(B(),M("span",$b,"坐席")):c.role==="owner"?(B(),M("span",Nb,"发起人")):c.joined?(B(),M("span",Lb,"已加入")):(B(),M("span",Mb,"待加入"))],2))),128))]),de(t).isParticipant?(B(),M("div",Vb,[p("button",{class:"participant-list__leave-btn",disabled:n.value,onClick:i},ie(n.value?"退出中...":"退出会话"),9,jb)])):fe("",!0)]))}}),Hb=Et(Ub,[["__scopeId","data-v-f3ed16d6"]]),qb={class:"evaluation-dialog"},zb={class:"evaluation-dialog__section"},Wb={class:"star-rating"},Kb={class:"star-label"},Gb={class:"evaluation-dialog__section"},Jb={class:"emoji-selector"},Xb={class:"evaluation-dialog__section"},Yb={class:"evaluation-dialog__actions"},Qb={class:"evaluation-dialog__skip"},Zb=Se({__name:"EvaluationDialog",props:{modelValue:{type:Boolean,default:!1},conversationId:{default:""}},emits:["update:modelValue","submitted"],setup(e,{expose:t,emit:n}){const s=e,o=n,r=oe({get:()=>s.modelValue,set:_=>o("update:modelValue",_)}),i=K({star_rating:0,emoji:"",feedback_text:""}),l=K(!1),a=oe(()=>({0:"",1:"非常差",2:"较差",3:"一般",4:"满意",5:"非常满意"})[i.value.star_rating]||""),c=oe(()=>i.value.star_rating>0&&i.value.emoji!=="");Ie(r,async _=>{if(_&&s.conversationId)try{await nw(s.conversationId)&&(r.value=!1,ve("您已评价过该会话"))}catch(m){console.warn("[EvaluationDialog] 检查评价状态失败:",m)}});function u(_){i.value.emoji=_}function f(_){_>=4?i.value.emoji="satisfied":_>=2?i.value.emoji="neutral":i.value.emoji="dissatisfied"}async function d(){var _,m;if(!(!c.value||l.value)){l.value=!0;try{await tw(s.conversationId,{star_rating:i.value.star_rating,emoji:i.value.emoji,feedback_text:i.value.feedback_text||void 0}),ve("评价成功,感谢您的反馈!"),r.value=!1,o("submitted")}catch(v){console.error("[EvaluationDialog] 提交评价失败:",v);const S=((m=(_=v==null?void 0:v.response)==null?void 0:_.data)==null?void 0:m.message)||"提交失败,请稍后重试";ve(S)}finally{l.value=!1}}}function h(){r.value=!1}function x(){i.value={star_rating:0,emoji:"",feedback_text:""},l.value=!1}return t({resetForm:x}),(_,m)=>{const v=Ig,S=Fi,T=Ls,C=Ks;return B(),Bt(C,{show:r.value,"onUpdate:show":m[5]||(m[5]=g=>r.value=g),round:"","close-on-click-overlay":!1,class:"evaluation-popup"},{default:dt(()=>[p("div",qb,[m[14]||(m[14]=p("div",{class:"evaluation-dialog__header"},[p("h3",{class:"evaluation-dialog__title"},"请对本次服务进行评价"),p("p",{class:"evaluation-dialog__subtitle"},"您的评价对我们非常重要")],-1)),p("div",zb,[m[6]||(m[6]=p("div",{class:"evaluation-dialog__label"},"服务评分",-1)),p("div",Wb,[A(v,{modelValue:i.value.star_rating,"onUpdate:modelValue":m[0]||(m[0]=g=>i.value.star_rating=g),count:5,size:"32",color:"#FFD21E","void-color":"#E5E5E5",onChange:f},null,8,["modelValue"]),p("span",Kb,ie(a.value),1)])]),p("div",Gb,[m[10]||(m[10]=p("div",{class:"evaluation-dialog__label"},"整体感受",-1)),p("div",Jb,[p("div",{class:Ne(["emoji-item",{"emoji-item--selected":i.value.emoji==="satisfied"}]),onClick:m[1]||(m[1]=g=>u("satisfied"))},[...m[7]||(m[7]=[p("span",{class:"emoji-icon"},"😀",-1),p("span",{class:"emoji-text"},"满意",-1)])],2),p("div",{class:Ne(["emoji-item",{"emoji-item--selected":i.value.emoji==="neutral"}]),onClick:m[2]||(m[2]=g=>u("neutral"))},[...m[8]||(m[8]=[p("span",{class:"emoji-icon"},"😐",-1),p("span",{class:"emoji-text"},"一般",-1)])],2),p("div",{class:Ne(["emoji-item",{"emoji-item--selected":i.value.emoji==="dissatisfied"}]),onClick:m[3]||(m[3]=g=>u("dissatisfied"))},[...m[9]||(m[9]=[p("span",{class:"emoji-icon"},"😞",-1),p("span",{class:"emoji-text"},"不满意",-1)])],2)])]),p("div",Xb,[m[11]||(m[11]=p("div",{class:"evaluation-dialog__label"},[Xe(" 改进建议 "),p("span",{class:"evaluation-dialog__optional"},"(选填)")],-1)),A(S,{modelValue:i.value.feedback_text,"onUpdate:modelValue":m[4]||(m[4]=g=>i.value.feedback_text=g),type:"textarea",placeholder:"您对本次服务有什么建议?",maxlength:"200","show-word-limit":"",rows:"3",class:"evaluation-dialog__textarea"},null,8,["modelValue"])]),p("div",Yb,[A(T,{type:"primary",size:"large",loading:l.value,disabled:!c.value,onClick:d},{default:dt(()=>[...m[12]||(m[12]=[Xe(" 提交评价 ",-1)])]),_:1},8,["loading","disabled"])]),p("div",Qb,[A(T,{size:"small",type:"default",disabled:l.value,onClick:h},{default:dt(()=>[...m[13]||(m[13]=[Xe(" 暂不评价 ",-1)])]),_:1},8,["disabled"])])])]),_:1},8,["show"])}}}),e1=Et(Zb,[["__scopeId","data-v-f4a30d2d"]]),t1={class:"chat-panel"},n1={class:"chat-panel__header"},s1={class:"chat-panel__header-left"},o1={key:0,class:"chat-panel__status chat-panel__status--online"},r1={key:1,class:"chat-panel__status chat-panel__status--offline"},i1={class:"chat-panel__header-actions"},l1=["disabled"],a1=["title"],c1={class:"user-menu"},u1={class:"user-avatar"},f1={key:0,class:"user-dropdown"},d1={class:"user-dropdown__info"},p1={class:"user-dropdown__name"},h1={class:"user-dropdown__id"},m1={key:0,class:"chat-panel__troubleshoot-fixed"},g1={key:0,class:"chat-panel__not-logged"},_1={key:1,class:"chat-panel__empty"},v1={class:"change-password-form"},y1=Se({__name:"ChatPanel",setup(e){const t=$t(),n=Yu(),s=It(),o=K(null),r=K(!1),i=K(!1),l=bt({oldPassword:"",newPassword:"",confirmPassword:""}),a=K(!1),c=K(!1),u=K(""),f=K(""),d=K(!0);function h(){r.value=!1,l.oldPassword="",l.newPassword="",l.confirmPassword="",i.value=!0}async function x(){var C,g;if(!l.oldPassword){ve("请输入旧密码");return}if(!l.newPassword||l.newPassword.length<6){ve("新密码长度不能少于6位");return}if(l.newPassword!==l.confirmPassword){ve("两次输入的密码不一致");return}if(l.oldPassword===l.newPassword){ve("新密码不能与旧密码相同");return}try{await lw({old_password:l.oldPassword,new_password:l.newPassword}),ve("密码修改成功"),i.value=!1}catch(O){console.error("修改密码失败:",O);const P=((g=(C=O==null?void 0:O.response)==null?void 0:C.data)==null?void 0:g.message)||(O==null?void 0:O.message)||"修改密码失败";ve(P)}}function _(){r.value=!1,s.logout()}async function m(){await _t(),o.value&&(o.value.scrollTop=o.value.scrollHeight)}function v(){if(!o.value)return;const{scrollTop:C,scrollHeight:g,clientHeight:O}=o.value;d.value=g-C-O<100}function S(){t.fetchCurrentConversation()}function T(){console.log("[ChatPanel] 评价已提交")}return Ie(()=>t.messages.length,()=>{m()}),Ie(()=>{var C;return(C=t.currentConversation)==null?void 0:C.conversation_id},()=>{t.participantPanelVisible=!1}),Ie(()=>{var C;return(C=t.currentConversation)==null?void 0:C.status},(C,g)=>{var O;if(g==="serving"&&C==="resolved"){const P=(O=t.currentConversation)==null?void 0:O.conversation_id;P&&setTimeout(()=>{u.value=P,c.value=!0},3e3)}f.value=C||""}),mt(()=>{var C;m(),f.value=((C=t.currentConversation)==null?void 0:C.status)||""}),(C,g)=>{var J,se,H,j,W;const O=vg,P=Fi,z=Rg,D=Ks;return B(),M("div",t1,[p("div",n1,[p("div",s1,[g[12]||(g[12]=p("span",{class:"chat-panel__title"},"IT智能服务台",-1)),de(t).agentOnline?(B(),M("span",o1,[...g[10]||(g[10]=[p("span",{class:"chat-panel__status-dot"},null,-1),Xe(" 坐席在线 ",-1)])])):(B(),M("span",r1,[...g[11]||(g[11]=[p("span",{class:"chat-panel__status-dot"},null,-1),Xe(" 坐席离线 ",-1)])]))]),p("div",i1,[de(t).canCallAgent?(B(),M("button",{key:0,class:"chat-panel__bell-btn",disabled:!de(t).isLoggedIn||de(t).shaking,title:"摇铃呼叫人工坐席",onClick:g[0]||(g[0]=ee=>a.value=!0)},[...g[13]||(g[13]=[p("span",{class:"chat-panel__bell-icon"},"🔔",-1),p("span",{class:"chat-panel__bell-text"},"呼叫",-1)])],8,l1)):fe("",!0),p("div",{class:"theme-switch",title:de(n).currentTheme==="light"?"切换到深色模式":"切换到浅色模式",onClick:g[1]||(g[1]=ee=>de(n).toggleTheme())},[...g[14]||(g[14]=[p("span",{class:"switch-icon"},"☀️",-1),p("div",{class:"switch-track"},[p("div",{class:"switch-thumb"})],-1),p("span",{class:"switch-icon"},"🌙",-1)])],8,a1),p("div",c1,[p("button",{class:"user-avatar-btn",onClick:g[2]||(g[2]=ee=>r.value=!r.value)},[p("span",u1,ie(((se=(J=de(s).employeeInfo)==null?void 0:J.employee_name)==null?void 0:se.charAt(0))||"?"),1)]),r.value?(B(),M("div",f1,[p("div",d1,[p("div",p1,ie((H=de(s).employeeInfo)==null?void 0:H.employee_name),1),p("div",h1,ie((j=de(s).employeeInfo)==null?void 0:j.employee_id),1)]),g[17]||(g[17]=p("div",{class:"user-dropdown__divider"},null,-1)),p("div",{class:"user-dropdown__item",onClick:h},[...g[15]||(g[15]=[p("span",{class:"user-dropdown__icon"},"🔑",-1),Xe(" 修改密码 ",-1)])]),p("div",{class:"user-dropdown__item user-dropdown__item--danger",onClick:_},[...g[16]||(g[16]=[p("span",{class:"user-dropdown__icon"},"🚪",-1),Xe(" 退出登录 ",-1)])])])):fe("",!0)])])]),(W=de(t).troubleshootingSteps)!=null&&W.length?(B(),M("div",m1,[A(vb)])):fe("",!0),de(t).participants.length>0?(B(),Bt(Ab,{key:1})):fe("",!0),p("div",{ref_key:"messageListRef",ref:o,class:"chat-panel__messages",onScroll:v},[de(t).isLoggedIn?de(t).messages.length===0?(B(),M("div",_1,[...g[18]||(g[18]=[p("div",{class:"chat-panel__empty-icon"},"💬",-1),p("p",{class:"chat-panel__empty-text"},"暂无消息",-1),p("p",{class:"chat-panel__empty-hint"},"输入问题咨询,或 🔔 摇铃呼叫坐席",-1)])])):(B(!0),M(Re,{key:2},Ft(de(t).messages,ee=>(B(),Bt(_0,{key:ee.message_id,msg:ee},null,8,["msg"]))),128)):(B(),M("div",g1,[A(O,{description:"正在获取身份信息...",image:"search"})]))],544),A(F0),A(Y0,{visible:a.value,"onUpdate:visible":g[3]||(g[3]=ee=>a.value=ee),onCallSuccess:S},null,8,["visible"]),A(e1,{modelValue:c.value,"onUpdate:modelValue":g[4]||(g[4]=ee=>c.value=ee),"conversation-id":u.value,onSubmitted:T},null,8,["modelValue","conversation-id"]),A(z,{show:i.value,"onUpdate:show":g[8]||(g[8]=ee=>i.value=ee),title:"修改密码","show-cancel-button":"","confirm-button-text":"确认修改",onConfirm:x},{default:dt(()=>[p("div",v1,[A(P,{modelValue:l.oldPassword,"onUpdate:modelValue":g[5]||(g[5]=ee=>l.oldPassword=ee),type:"password",label:"旧密码",placeholder:"请输入旧密码",rules:[{required:!0,message:"请输入旧密码"}]},null,8,["modelValue"]),A(P,{modelValue:l.newPassword,"onUpdate:modelValue":g[6]||(g[6]=ee=>l.newPassword=ee),type:"password",label:"新密码",placeholder:"请输入新密码(6-128位)",rules:[{required:!0,message:"请输入新密码"}]},null,8,["modelValue"]),A(P,{modelValue:l.confirmPassword,"onUpdate:modelValue":g[7]||(g[7]=ee=>l.confirmPassword=ee),type:"password",label:"确认密码",placeholder:"请再次输入新密码",rules:[{required:!0,message:"请再次输入新密码"}]},null,8,["modelValue"])])]),_:1},8,["show"]),A(D,{show:de(t).participantPanelVisible,"onUpdate:show":g[9]||(g[9]=ee=>de(t).participantPanelVisible=ee),position:"bottom",round:"",teleport:"body",style:{maxHeight:"60vh"}},{default:dt(()=>[A(Hb)]),_:1},8,["show"])])}}}),w1=Et(y1,[["__scopeId","data-v-31533cb0"]]),b1={class:"right-panel"},E1={class:"right-panel__section right-panel__ai-push"},S1={class:"right-panel__section-body"},x1=["onClick"],C1={class:"ai-push-card__header"},A1={class:"ai-push-card__icon"},R1={class:"ai-push-card__type-label"},T1={class:"ai-push-card__title"},k1={key:0,class:"ai-push-card__subtitle"},O1={key:0,class:"right-panel__empty"},P1={class:"right-panel__section right-panel__resources"},I1={class:"right-panel__tabs"},F1={key:0,class:"right-panel__tab-content"},B1=["onClick"],D1={class:"resource-item__icon"},$1={class:"resource-item__info"},N1={class:"resource-item__title"},L1={key:0,class:"resource-item__desc"},M1={key:1,class:"right-panel__tab-content"},V1=["onClick"],j1={class:"resource-item__icon"},U1={class:"resource-item__info"},H1={class:"resource-item__title"},q1={key:0,class:"resource-item__desc"},z1={class:"right-panel__section right-panel__quiz"},W1={class:"right-panel__section-header"},K1={class:"right-panel__quiz-score"},G1={class:"right-panel__section-body"},J1={class:"quiz-question"},X1={class:"quiz-options"},Y1=["disabled","onClick"],Q1={class:"quiz-option__label"},Z1={class:"quiz-option__text"},eE={key:0,class:"quiz-result"},tE={key:0,class:"quiz-result--correct"},nE={key:1,class:"quiz-result--wrong"},sE={key:1,class:"right-panel__empty"},oE=Se({__name:"RightPanel",setup(e){const t=oe(()=>[{id:"push-1",type:"guide",icon:"📖",typeLabel:"处理指南",title:"WiFi连接问题处理指南",subtitle:"已解决28次类似问题"},{id:"push-2",type:"process",icon:"📋",typeLabel:"申请流程",title:"网络连接申请流程",subtitle:"在线申请,1-3个工作日"},{id:"push-3",type:"download",icon:"💾",typeLabel:"软件下载",title:"无线网卡驱动下载",subtitle:"适用于 Windows 10/11"}]);function n(_){console.log("[RightPanel] AI推送点击:",_.title)}const s=K("process"),o=K([{id:"p-1",icon:"💻",title:"IT设备申请",desc:"电脑/显示器/外设"},{id:"p-2",icon:"🔐",title:"权限申请",desc:"系统/文件夹/VPN"},{id:"p-3",icon:"🌐",title:"VPN申请",desc:"远程办公网络"},{id:"p-4",icon:"📧",title:"邮箱别名申请",desc:"别名/分发组"}]),r=K([{id:"s-1",icon:"📝",title:"Office 365",desc:"Word/Excel/PPT"},{id:"s-2",icon:"📄",title:"Adobe Acrobat",desc:"PDF阅读/编辑"},{id:"s-3",icon:"💬",title:"企业微信",desc:"即时通讯/协作"},{id:"s-4",icon:"🛡️",title:"火绒安全",desc:"杀毒/终端防护"}]);function i(_){console.log("[RightPanel] 申请流程点击:",_.title)}function l(_){console.log("[RightPanel] 软件下载点击:",_.title)}const a=["A","B","C","D"],c=K(0),u=K(!1),f=K(-1),d=K([{id:"q-1",question:"IT服务台电话分机号是?",options:["8001","8002","8003","8004"],correctIndex:0},{id:"q-2",question:"电脑无法连接WiFi时,首先应该检查什么?",options:["重启路由器","WiFi适配器是否禁用","联系网络管理员","重新安装系统"],correctIndex:1},{id:"q-3",question:"VPN申请一般需要几个工作日?",options:["1个工作日","1-3个工作日","3-5个工作日","5个工作日以上"],correctIndex:1}]),h=oe(()=>d.value[0]||null);function x(_){u.value||(u.value=!0,f.value=_,h.value&&_===h.value.correctIndex&&(c.value+=10))}return(_,m)=>(B(),M("div",b1,[p("div",E1,[m[3]||(m[3]=p("div",{class:"right-panel__section-header"},[p("span",{class:"right-panel__section-icon"},"🤖"),p("span",{class:"right-panel__section-title"},"AI 推荐")],-1)),p("div",S1,[(B(!0),M(Re,null,Ft(t.value,v=>(B(),M("div",{key:v.id,class:Ne(["ai-push-card",`ai-push-card--${v.type}`]),onClick:S=>n(v)},[p("div",C1,[p("span",A1,ie(v.icon),1),p("span",R1,ie(v.typeLabel),1)]),p("div",T1,ie(v.title),1),v.subtitle?(B(),M("div",k1,ie(v.subtitle),1)):fe("",!0)],10,x1))),128)),t.value.length===0?(B(),M("div",O1,[...m[2]||(m[2]=[p("span",null,"💡 对话过程中会自动推送相关资源",-1)])])):fe("",!0)])]),p("div",P1,[m[6]||(m[6]=p("div",{class:"right-panel__section-header"},[p("span",{class:"right-panel__section-icon"},"📚"),p("span",{class:"right-panel__section-title"},"常用资源")],-1)),p("div",I1,[p("button",{class:Ne(["right-panel__tab",{"right-panel__tab--active":s.value==="process"}]),onClick:m[0]||(m[0]=v=>s.value="process")},"申请流程",2),p("button",{class:Ne(["right-panel__tab",{"right-panel__tab--active":s.value==="software"}]),onClick:m[1]||(m[1]=v=>s.value="software")},"必装软件",2)]),s.value==="process"?(B(),M("div",F1,[(B(!0),M(Re,null,Ft(o.value,v=>(B(),M("div",{key:v.id,class:"resource-item",onClick:S=>i(v)},[p("span",D1,ie(v.icon),1),p("div",$1,[p("span",N1,ie(v.title),1),v.desc?(B(),M("span",L1,ie(v.desc),1)):fe("",!0)]),m[4]||(m[4]=p("span",{class:"resource-item__arrow"},"→",-1))],8,B1))),128))])):fe("",!0),s.value==="software"?(B(),M("div",M1,[(B(!0),M(Re,null,Ft(r.value,v=>(B(),M("div",{key:v.id,class:"resource-item",onClick:S=>l(v)},[p("span",j1,ie(v.icon),1),p("div",U1,[p("span",H1,ie(v.title),1),v.desc?(B(),M("span",q1,ie(v.desc),1)):fe("",!0)]),m[5]||(m[5]=p("span",{class:"resource-item__arrow"},"→",-1))],8,V1))),128))])):fe("",!0)]),p("div",z1,[p("div",W1,[m[7]||(m[7]=p("span",{class:"right-panel__section-icon"},"🎯",-1)),m[8]||(m[8]=p("span",{class:"right-panel__section-title"},"趣味问答",-1)),p("span",K1,"🏆 "+ie(c.value)+"分",1)]),p("div",G1,[h.value?(B(),M(Re,{key:0},[p("div",J1,ie(h.value.question),1),p("div",X1,[(B(!0),M(Re,null,Ft(h.value.options,(v,S)=>(B(),M("button",{key:S,class:Ne(["quiz-option",{"quiz-option--correct":u.value&&S===h.value.correctIndex,"quiz-option--wrong":u.value&&f.value===S&&S!==h.value.correctIndex}]),disabled:u.value,onClick:T=>x(S)},[p("span",Q1,ie(a[S]),1),p("span",Z1,ie(v),1)],10,Y1))),128))]),u.value?(B(),M("div",eE,[f.value===h.value.correctIndex?(B(),M("span",tE," ✅ 答对啦!+10积分 ")):(B(),M("span",nE," ❌ 答错了!正确答案是 "+ie(a[h.value.correctIndex]),1))])):fe("",!0)],64)):(B(),M("div",sE,[...m[9]||(m[9]=[p("span",null,"暂无问答题目",-1)])]))])])]))}}),ui=Et(oE,[["__scopeId","data-v-4f431dca"]]),rE={class:"chat-view"},iE={key:1,class:"chat-view__right"},lE=Se({__name:"ChatView",setup(e){const t=ff(),n=df(),s=It(),o=$t(),r=vw(),i=K(window.innerWidth),l=K(60),a=K(!1),c=oe(()=>i.value<500),u=oe(()=>!c.value);function f(_){a.value=!0;const m=_.clientX,v=l.value,S=i.value;function T(g){if(!a.value)return;const P=(g.clientX-m)/S*100;let z=v+P;z=Math.max(40,Math.min(80,z)),l.value=z}function C(){a.value=!1,document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",C),document.body.style.cursor="",document.body.style.userSelect=""}document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",T),document.addEventListener("mouseup",C)}function d(){i.value=window.innerWidth}mt(()=>{if(window.addEventListener("resize",d),!s.isAuthenticated){console.warn("[ChatView] 未登录,跳转登录页"),t.push("/login");return}o.initialize(),r.connect()});const h=n.query.invite,x=n.query.eid;if(h&&x){console.log(`[ChatView] 检测到邀请链接: conv=${h}, eid=${x}`);const _=Ie(()=>o.initialized,async m=>{var v,S;if(m){_();try{await Zy(h),console.log("[ChatView] 已成功加入邀请的会话"),await o.switchToConversation(h)}catch(T){console.error("[ChatView] 加入会话失败:",T);const C=(S=(v=T==null?void 0:T.response)==null?void 0:v.data)==null?void 0:S.code;if(C!==3034&&C!==3033)try{await o.switchToConversation(h)}catch(g){console.error("[ChatView] 切换会话也失败:",g)}}finally{t.replace({path:n.path,query:{}})}}},{immediate:!0})}return Bn(()=>{window.removeEventListener("resize",d),r.disconnect(),o.cleanup()}),(_,m)=>(B(),M("div",rE,[p("div",{class:Ne(["chat-view__left",{"chat-view__left--full":!u.value}]),style:ns(!c.value&&u.value?{flex:`0 0 ${l.value}%`,maxWidth:`${l.value}%`}:{})},[A(w1)],6),u.value&&!c.value?(B(),M("div",{key:0,class:"chat-view__resize-handle",onMousedown:f},[...m[0]||(m[0]=[p("div",{class:"chat-view__resize-grip"},null,-1)])],32)):fe("",!0),u.value?(B(),M("div",iE,[A(ui)])):fe("",!0)]))}}),aE=Et(lE,[["__scopeId","data-v-8734f543"]]),cE={class:"emergency-dispatcher"},uE={class:"emergency-dispatcher__panel"},fE={class:"subtitle"},dE={key:1,class:"error-msg"},pE=Se({__name:"EmergencyDispatcher",setup(e){const t=ff(),n=K(!0),s=K(""),o=K("正在检测身份...");function r(){return new Promise((u,f)=>{if(typeof window.wx<"u"&&window.wx.agentConfig){u();return}const d=document.createElement("script");d.src="https://res.wx.qq.com/wwopen/js/wwLogin-1.2.7.js",d.onload=()=>{const h=document.createElement("script");h.src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js",h.onload=()=>u(),h.onerror=()=>f(new Error("加载企微 agent SDK 失败")),document.head.appendChild(h)},d.onerror=()=>f(new Error("加载企微 JS-SDK 失败")),document.head.appendChild(d)})}async function i(u){const f=await Me.get("/api/wecom/jsapi-config",{params:{url:u}});if(f.data.code!==0)throw new Error(`拿签名失败: ${f.data.message}`);return f.data.data}function l(u){return new Promise((f,d)=>{const h=window.wx;h.config({beta:!0,debug:!1,appId:u.corp_id,timestamp:u.timestamp,nonceStr:u.nonce_str,signature:u.signature,jsApiList:["agentConfig"]}),h.ready(()=>f()),h.error(x=>d(new Error(`wx.config 失败: ${JSON.stringify(x)}`)))})}function a(u){return new Promise((f,d)=>{window.wx.agentConfig({corpid:u.corp_id,agentid:u.agent_id,timestamp:u.timestamp,nonceStr:u.nonce_str,signature:u.signature,jsApiList:["selectExternalContact"],success:x=>{const _=window.wecom_userid||"";f({userId:_})},fail:x=>d(new Error(`wx.agentConfig 失败: ${JSON.stringify(x)}`))})})}async function c(u){const f=await Me.get("/api/wecom/check-role",{params:{userid:u}});if(f.data.code!==0)throw new Error(`检查角色失败: ${f.data.message}`);return f.data.data}return mt(async()=>{try{o.value="正在加载企微 SDK...",await r(),o.value="正在获取鉴权签名...";const u=window.location.href.split("#")[0],f=await i(u);o.value="正在初始化企微...",await l(f),o.value="正在获取身份...";const{userId:d}=await a(f);if(!d)throw new Error("未能获取当前用户 userid");o.value="正在检查角色...";const h=await c(d);console.log("[EmergencyDispatcher] 角色检测:",h),o.value=`角色: ${h.role},正在跳转...`,h.role==="agent"?window.location.href="/itagent/agent-preview?userid="+encodeURIComponent(d):t.push({path:"/h5-preview",query:{userid:d}})}catch(u){console.error("[EmergencyDispatcher] 错误:",u),s.value=u.message||"未知错误",n.value=!1,pg({message:s.value,duration:5e3}),setTimeout(()=>{t.push({path:"/h5-preview"})},3e3)}}),(u,f)=>{const d=Go;return B(),M("div",cE,[p("div",uE,[f[0]||(f[0]=p("div",{class:"logo"},null,-1)),f[1]||(f[1]=p("h2",{class:"title"},"IT 智能服务台",-1)),p("p",fE,ie(o.value),1),n.value?(B(),Bt(d,{key:0,type:"spinner",color:"#1989fa",size:"32"})):fe("",!0),s.value?(B(),M("div",dE,ie(s.value),1)):fe("",!0)])])}}}),hE=Et(pE,[["__scopeId","data-v-fd04bede"]]),mE={class:"h5-preview"},gE={class:"h5-preview__topbar"},_E={key:1,class:"userid-tag"},vE={key:0,class:"h5-preview__content"},yE={class:"h5-preview__drawer-header"},wE={class:"h5-preview__drawer-body"},bE={key:2,class:"h5-preview__mobile-hint"},EE=Se({__name:"H5PreviewView",setup(e){const t=df(),n=K(!1),s=oe(()=>t.query.userid||""),o=oe(()=>window.innerWidth<500);return s.value&&ve({message:"员工模式",duration:1500}),(r,i)=>{const l=Rt,a=Ks;return B(),M("div",mE,[p("div",gE,[i[4]||(i[4]=Op('<div class="topbar-left" data-v-f91237e0><span class="logo" data-v-f91237e0>🤖</span><div class="title-block" data-v-f91237e0><h1 class="title" data-v-f91237e0>员工自助</h1><p class="subtitle" data-v-f91237e0>IT 智能服务台 · 应急模式</p></div></div>',1)),o.value?(B(),M("button",{key:0,class:"topbar-menu-btn",onClick:i[0]||(i[0]=c=>n.value=!0)},[A(l,{name:"apps-o",size:"22"}),i[3]||(i[3]=p("span",null,"右栏",-1))])):(B(),M("div",_E," userid: "+ie(s.value||"anonymous"),1))]),o.value?fe("",!0):(B(),M("div",vE,[A(ui)])),o.value?(B(),Bt(a,{key:1,show:n.value,"onUpdate:show":i[2]||(i[2]=c=>n.value=c),position:"top",style:{height:"85%"},"close-on-click-overlay":!0,closeable:"","safe-area-inset-top":""},{default:dt(()=>[p("div",yE,[i[5]||(i[5]=p("span",{class:"drawer-title"},"📋 右栏内容",-1)),A(l,{name:"cross",size:"20",class:"drawer-close",onClick:i[1]||(i[1]=c=>n.value=!1)})]),p("div",wE,[A(ui)])]),_:1},8,["show"])):fe("",!0),o.value?(B