2 lines
39 KiB
JavaScript
2 lines
39 KiB
JavaScript
var kn=Object.defineProperty;var Rn=(i,o,a)=>o in i?kn(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var D=(i,o,a)=>Rn(i,typeof o!="symbol"?o+"":o,a);import{o as $e,dx as Mn,q as R,r as H,T as Q,P as $,s as k,O as Z,u as L,dy as Ln,a7 as Dn,p as z,dz as xn,ap as Un,aq as Nn,R as Vn,ac as Qt,ad as te,v as w,D as M,L as Le,bn as Pn,aw as Ct,w as On,av as De,K as Hn,a1 as Kn,dA as Wn,dB as $n,ba as zn,be as jn,dC as Bn,dD as qn,dE as Fn,dF as Gn,dG as Xn,dH as Yn,dI as Jn,dJ as Zn,dK as Qn,dL as to,dM as eo,dr as no,t as xe,ae as oo,ar as ao,M as p,dN as io,dq as x,n as ee,dO as so,ds as X,dt as Y,du as W,dP as ro}from"./.pnpm-By2WSs8B.js";import{u as lo,D as co}from"./index-C1E_LNMx.js";import{u as uo,l as fo}from"./file-CMguSMKH.js";import{a as mo}from"./patient-JzLR3y9i.js";import{Z as Kt,am as ho,aJ as vo,aK as po,aL as go,au as yo}from"./tcm-BGyKkE-q.js";import{_ as ze,u as _o,f as I}from"./index-BBgQrtMN.js";import{a as wo,c as Ue}from"./appointment-type-DJT6wPaT.js";import{p as Co}from"./im-business-message-parse-O7IHlzq4.js";import{T as J}from"./@tencentcloud/chat-e5KY3XHB.js";import{X as Wt}from"./@tencentcloud/chat-uikit-engine-CpHw2vdM.js";import{c as St}from"./@tencentcloud/call-engine-js-uEsopP0l.js";import"./desktop_workstation-BZORgaVM.js";import"./dayjs-CS-Rws8D.js";import"./tim-upload-plugin-DR9fNzfw.js";import"./tim-profanity-filter-plugin-BPFhJcrS.js";import"./rtc-detect-C0_5bxei.js";function So(){const i=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];for(const o of i)if(MediaRecorder.isTypeSupported(o))return o;return""}function To(){const i=window;return i.AudioContext||i.webkitAudioContext||null}function Ne(i,o,a,r,s,c){const m=o.videoWidth||o.clientWidth||1,u=o.videoHeight||o.clientHeight||1,h=Math.max(s/m,c/u),d=m*h,v=u*h,T=a+(s-d)/2,U=r+(c-v)/2;try{i.drawImage(o,T,U,d,v)}catch{}}function Eo(i,o,a,r){i.fillStyle="#0b0b0b",i.fillRect(0,0,a,r);const s=o.filter(d=>d.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA);if(s.length===0)return;if(s.length===1){Ne(i,s[0],0,0,a,r);return}const c=Math.ceil(Math.sqrt(s.length)),m=Math.ceil(s.length/c),u=a/c,h=r/m;s.forEach((d,v)=>{const T=v%c,U=Math.floor(v/c);Ne(i,d,T*u,U*h,u,h)})}function Ao(i){const o=new Set,a=[];for(const r of i){const s=r.srcObject;if(s instanceof MediaStream)for(const c of s.getAudioTracks())c.kind!=="audio"||c.readyState==="ended"||!c.enabled||o.has(c.id)||(o.add(c.id),a.push(c))}return a}function bo(i){var r;const o=new Set,a=[];for(const s of i){if(s.readyState<HTMLMediaElement.HAVE_CURRENT_DATA)continue;const c=(r=s.captureStream)==null?void 0:r.call(s);if(c)for(const m of c.getAudioTracks())m.kind!=="audio"||m.readyState==="ended"||!m.enabled||o.has(m.id)||(o.add(m.id),a.push(m))}return a}function Io(i){const o=new Set,a=[],r=[...document.body.querySelectorAll("audio")];i&&r.push(...i.querySelectorAll("audio"));const s=document.getElementById("tuicallkit-id");s&&r.push(...s.querySelectorAll("audio"));const c=new Set;for(const m of r){if(c.has(m))continue;c.add(m);const u=m.srcObject;if(u instanceof MediaStream)for(const h of u.getAudioTracks())h.kind!=="audio"||h.readyState==="ended"||!h.enabled||o.has(h.id)||(o.add(h.id),a.push(h))}return a}function ne(i){const o=new Set,a=u=>{const h=[];for(const d of u)o.has(d)||(o.add(d),h.push(d));return h},r=[...i.querySelectorAll("video")];if(r.length>0)return a(r);const s=document.getElementById("tuicallkit-id");if(s){const u=[...s.querySelectorAll("video")];if(u.length>0)return a(u)}const m=[...document.body.querySelectorAll("video")].filter(u=>{const h=u.srcObject;return h instanceof MediaStream?h.getVideoTracks().some(d=>d.readyState==="live"):!1});return a(m)}class ko{constructor(){D(this,"canvas",null);D(this,"ctx",null);D(this,"rafId",0);D(this,"container",null);D(this,"mediaRecorder",null);D(this,"chunks",[]);D(this,"mimeType","");D(this,"audioCtx",null);D(this,"audioDestination",null);D(this,"wiredTrackIds",new Set);D(this,"canvasVideoTrack",null);D(this,"silentOsc",null);D(this,"silentGain",null);D(this,"micStream",null);D(this,"stopResultPromise",null)}isRecording(){return this.mediaRecorder!==null&&this.mediaRecorder.state==="recording"}beginStopNow(){if(this.stopResultPromise)return;cancelAnimationFrame(this.rafId),this.rafId=0;const o=this.mediaRecorder,a=this.mimeType;!o||o.state==="inactive"||(this.stopResultPromise=new Promise(r=>{var s;o.onstop=()=>{this.teardownAudioGraph();const c=o.mimeType||a||"video/webm",m=this.chunks.length>0?new Blob(this.chunks,{type:c}):null;this.chunks=[],this.mediaRecorder=null,this.container=null,this.canvas=null,this.ctx=null,this.canvasVideoTrack=null,r(m&&m.size>0?m:null)};try{const c=o;(s=c.requestData)==null||s.call(c),o.stop()}catch{this.teardownAudioGraph(),this.chunks=[],this.mediaRecorder=null,this.container=null,this.canvas=null,this.ctx=null,this.canvasVideoTrack=null,r(null)}}))}teardownAudioGraph(){var o;try{(o=this.silentOsc)==null||o.stop()}catch{}if(this.silentOsc=null,this.silentGain=null,this.micStream){for(const a of this.micStream.getTracks())try{a.stop()}catch{}this.micStream=null}this.wiredTrackIds.clear(),this.audioDestination=null,this.audioCtx&&(this.audioCtx.close().catch(()=>{}),this.audioCtx=null)}connectTrackToMixer(o){if(!(o.kind!=="audio"||o.readyState==="ended"||!o.enabled)&&!(!this.audioCtx||!this.audioDestination)&&!this.wiredTrackIds.has(o.id))try{const a=this.audioCtx.createMediaStreamSource(new MediaStream([o])),r=this.audioCtx.createGain();r.gain.value=1.25,a.connect(r),r.connect(this.audioDestination),this.wiredTrackIds.add(o.id)}catch{}}attachMicForMixer(){if(!this.audioCtx||!this.audioDestination)return;const o=navigator.mediaDevices;o!=null&&o.getUserMedia&&o.getUserMedia({audio:!0,video:!1}).then(a=>{if(!this.audioDestination||!this.audioCtx){a.getTracks().forEach(r=>r.stop());return}if(this.micStream){a.getTracks().forEach(r=>r.stop());return}this.micStream=a;for(const r of a.getAudioTracks())this.connectTrackToMixer(r)}).catch(()=>{})}wireIncomingAudio(){var m;if(!this.audioCtx||!this.audioDestination||!this.container)return;this.audioCtx.state==="suspended"&&this.audioCtx.resume().catch(()=>{});const o=ne(this.container),a=document.getElementById("tuicallkit-id"),r=[...document.body.querySelectorAll("audio"),...this.container.querySelectorAll("audio"),...a?a.querySelectorAll("audio"):[]],s=new Set,c=[];for(const u of o)s.has(u)||(s.add(u),c.push(u));for(const u of r)s.has(u)||(s.add(u),c.push(u));for(const u of c){const h=u.srcObject;if(h instanceof MediaStream)for(const d of h.getAudioTracks())this.connectTrackToMixer(d);if(u instanceof HTMLVideoElement&&u.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){const d=(m=u.captureStream)==null?void 0:m.call(u);if(d)for(const v of d.getAudioTracks())this.connectTrackToMixer(v)}}}reset(){if(cancelAnimationFrame(this.rafId),this.rafId=0,this.stopResultPromise=null,this.canvasVideoTrack=null,this.mediaRecorder&&this.mediaRecorder.state!=="inactive")try{this.mediaRecorder.stop()}catch{}this.mediaRecorder=null,this.chunks=[],this.canvas=null,this.ctx=null,this.container=null,this.mimeType="",this.teardownAudioGraph()}start(o){if(typeof MediaRecorder>"u")return!1;this.reset(),this.container=o;const a=So();if(this.mimeType=a||"video/webm",this.canvas=document.createElement("canvas"),this.canvas.width=1280,this.canvas.height=720,this.ctx=this.canvas.getContext("2d",{alpha:!1}),!this.ctx)return!1;const s=this.canvas.captureStream(30).getVideoTracks();this.canvasVideoTrack=s[0]??null;const c=ne(o),m=To();let u;if(m)try{this.audioCtx=new m,this.audioDestination=this.audioCtx.createMediaStreamDestination(),this.audioCtx.resume().catch(()=>{}),this.wireIncomingAudio(),this.attachMicForMixer();const d=this.audioDestination.stream.getAudioTracks(),v=this.audioCtx.createOscillator(),T=this.audioCtx.createGain();T.gain.value=1e-5,v.frequency.value=20,v.connect(T),T.connect(this.audioDestination),v.start(),this.silentOsc=v,this.silentGain=T,u=new MediaStream([...s,...d])}catch{this.teardownAudioGraph(),u=this.buildStreamWithoutMixer(s,c)}else u=this.buildStreamWithoutMixer(s,c);try{this.mediaRecorder=a?new MediaRecorder(u,{mimeType:a}):new MediaRecorder(u)}catch{try{this.mediaRecorder=new MediaRecorder(u)}catch{return this.reset(),!1}}this.chunks=[],this.mediaRecorder.ondataavailable=d=>{d.data&&d.data.size>0&&this.chunks.push(d.data)},this.mediaRecorder.onerror=d=>{console.error("[call-local-recorder] MediaRecorder 错误",d)};const h=()=>{var v,T;if(!this.ctx||!this.canvas||!this.container)return;this.wireIncomingAudio();const d=ne(this.container);Eo(this.ctx,d,this.canvas.width,this.canvas.height),(T=(v=this.canvasVideoTrack)==null?void 0:v.requestFrame)==null||T.call(v),this.rafId=requestAnimationFrame(h)};this.rafId=requestAnimationFrame(h);try{this.mediaRecorder.start(250)}catch{return this.reset(),!1}return!0}buildStreamWithoutMixer(o,a){const r=new Set,s=[],c=m=>{for(const u of m)r.has(u.id)||(r.add(u.id),s.push(u))};return c(Ao(a)),c(bo(a)),c(Io(this.container)),new MediaStream([...o,...s])}async stop(){this.beginStopNow();const o=this.stopResultPromise;return o||null}}function Ro(i,o=()=>{}){const a=new Map;return r=>{if(!Number.isInteger(r)||r<=0)return Promise.resolve();const s=a.get(r);if(s)return s.again=!0,s.promise;const c={again:!1,promise:Promise.resolve()};return a.set(r,c),c.promise=(async()=>{var m;try{do{c.again=!1;let u;for(;;){const h=await i({diagnosis_id:r,scope:"current",sync_token:u});if(h.completed){if((m=h.errors)!=null&&m.length)throw new Error(h.errors.join(";"));break}if(!h.sync_token)throw new Error("聊天记录同步未返回进度");u=h.sync_token}}while(c.again)}catch(u){o(u)}finally{a.delete(r)}})(),c.promise}}function Ve(i){const o=i.srcObject;return o instanceof MediaStream?o.getVideoTracks().some(a=>a.readyState==="live"):!1}function ct(i){const o=i.getBoundingClientRect();return Math.max(0,o.width)*Math.max(0,o.height)}function Pe(i){const o=i.videoWidth||i.clientWidth,a=i.videoHeight||i.clientHeight;return o*a}function Mo(i){const o=new Map,a=new Map;for(const r of i){const s=r.srcObject;if(!(s instanceof MediaStream))continue;const c=s.getVideoTracks(),m=s.id&&String(s.id)||c.map(d=>d.id).filter(Boolean).join("|")||`${c.length}`,u=ct(r),h=a.get(m)??0;u>=h&&(o.set(m,r),a.set(m,u))}return o.size===0?i:Array.from(o.values())}function Lo(i){if(i.length<2)return i;let o=0;for(const r of i)o=Math.max(o,ct(r));return o<=1||Math.min(...i.map(r=>ct(r)))/o>=.25?i:i.filter(r=>ct(r)>=o*.25)}function Do(i){let o=i;for(let a=0;a<12&&o;a++){const r=getComputedStyle(o).transform;if(r&&r!=="none"&&(/matrix\(\s*-1\s*,/.test(r)||/scaleX\(\s*-1/.test(r)))return!0;o=o.parentElement}return!1}function xo(i){const o=/local|self|pusher|mini[_-]?stream|preview[_-]?self|own[_-]?camera|tui-local|tencent-local|stream-local|publisher|send|pip|picture[_-]?in[_-]?picture/i,a=/remote|subscriber|peer|other|tui-remote|stream-remote|big-stream|play[_-]?stream|receiver|pull|substream/i;let r=i;for(let s=0;s<20&&r;s++){const c=`${r.className||""} ${r.id||""} ${r.getAttribute("data-type")||""}`;if(a.test(c))return!1;if(o.test(c))return!0;r=r.parentElement}return!1}async function Uo(i,o){const a=(o==null?void 0:o.preferRemote)!==!1,r=[i,...(o==null?void 0:o.extraRoots)||[]].filter(y=>!!y),s=new Set;for(const y of r)for(const _ of y.querySelectorAll("video"))_ instanceof HTMLVideoElement&&s.add(_);if(s.size===0){const y=document.querySelector(".chat-dialog-call-kit-wrapper");if(y)for(const _ of y.querySelectorAll("video"))_ instanceof HTMLVideoElement&&s.add(_)}s.size===0&&document.body.querySelectorAll("video").forEach(y=>{y instanceof HTMLVideoElement&&Ve(y)&&s.add(y)});let c=Array.from(s).filter(y=>y.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&Ve(y));if(c.length===0&&(c=Array.from(s).filter(y=>y.readyState>=2)),c.length===0)return null;c=Mo(c);let m=null,u=0,h=0;if(a){const y=c.map(S=>({v:S,layout:ct(S),pixel:Pe(S),localClass:xo(S),mirror:Do(S)}));let _=y.filter(S=>!S.localClass&&!S.mirror);_.length===0&&(_=y.filter(S=>!S.localClass)),_.length===0&&(_=y.filter(S=>!S.mirror)),_.length===0&&(_=y);let j=_.map(S=>S.v);j=Lo(j),_=_.filter(S=>j.includes(S.v));for(const S of _)(S.layout>u||S.layout===u&&S.pixel>h)&&(u=S.layout,h=S.pixel,m=S.v)}else for(const y of c){const _=ct(y),j=Pe(y);(_>u||_===u&&j>h)&&(u=_,h=j,m=y)}if(!m)return null;const d=m.videoWidth||m.clientWidth,v=m.videoHeight||m.clientHeight;if(!d||!v)return null;const T=document.createElement("canvas");T.width=d,T.height=v;const U=T.getContext("2d");if(!U)return null;try{U.drawImage(m,0,0,d,v)}catch{return null}return new Promise(y=>{T.toBlob(_=>y(_),"image/jpeg",.92)})}let At;function No(i){return At=i,()=>{At===i&&(At=void 0)}}async function Vo(i){const o=At;if(!o)throw new Error("请先打开本次挂号的聊天窗口");const a=i&&typeof i=="object"&&"type"in i?Number(i.type):2;if(await o(a===1?1:2),At!==o)throw new Error("当前问诊已切换,请重新发起通话")}function Po(i){const o=[];let a=i,r=0;for(;a!=null&&r<6;){if(typeof a=="string"){o.push(a);break}if(typeof a=="object"){const s=a;typeof s.message=="string"&&o.push(s.message),typeof s.name=="string"&&o.push(s.name),typeof s.code<"u"&&o.push(String(s.code)),a=s.cause}else{o.push(String(a));break}r++}return o.join(" ").toLowerCase()}const Oe=-1001;function lt(i){if(i&&typeof i=="object"){const a=i,r=a.code??a.error_code;if(r===Oe||r===String(Oe))return!0}const o=Po(i);return o.includes("does not support this ability")||o.includes("package you purchased")||o.includes("-1001")&&o.includes("does not support")}function je(){return"套餐欠费或未开通该能力,请联系管理员在腾讯云续费或升级套餐。"}function Oo(i,o="通话操作失败"){return lt(i)?je():i instanceof Error?i.message||o:typeof i=="string"&&i||o}const Ho={key:0,class:"chat-uikit-custom-msg"},Ko={key:0,class:"chat-uikit-custom-msg__tag"},Wo={class:"chat-uikit-custom-msg__main"},$o={key:1,class:"chat-uikit-custom-msg__sub"},zo={key:1,class:"chat-uikit-custom-msg chat-uikit-custom-msg--plain"},jo={class:"chat-uikit-custom-msg__main"},Bo={key:2,class:"chat-uikit-custom-msg chat-uikit-custom-msg--plain"},qo={key:0,class:"chat-uikit-custom-msg__sub"},Fo=$e({inheritAttrs:!1,__name:"ChatMessageItem",props:{message:{}},setup(i){const o=i,a=Mn();function r(d){if(!d||typeof d!="object")return null;const v=d,T=v.data;if(typeof T=="string")return T;if(T&&typeof T=="object")return JSON.stringify(T);const U=v.extension;return typeof U=="string"&&U.trim().startsWith("{")?U:null}const s=z(()=>{var v;const d=(v=o.message)==null?void 0:v.type;return!!(d===xn.CUSTOM||typeof d=="string"&&/custom/i.test(d))}),c=z(()=>{var v;if(!s.value)return null;const d=(v=r(o.message.payload))==null?void 0:v.trim();return d?Co(d):null}),m=z(()=>s.value&&!!c.value),u=z(()=>{const d=o.message.payload,v=d==null?void 0:d.description;return typeof v=="string"&&v.trim()?v.trim():""}),h=z(()=>{var v;const d=(v=r(o.message.payload))==null?void 0:v.trim();return!d||d.length<2?"":d.length<=120?d:`${d.slice(0,117)}…`});return(d,v)=>m.value?(R(),H("div",Ho,[c.value.tag?(R(),H("span",Ko,Q(c.value.tag),1)):$("",!0),k("div",Wo,Q(c.value.main),1),c.value.sub?(R(),H("div",$o,Q(c.value.sub),1)):$("",!0)])):s.value&&u.value?(R(),H("div",zo,[k("div",jo,Q(u.value),1)])):s.value?(R(),H("div",Bo,[v[0]||(v[0]=k("div",{class:"chat-uikit-custom-msg__main"},"系统消息",-1)),h.value?(R(),H("div",qo,Q(h.value),1)):$("",!0)])):(R(),Z(L(Ln),Dn({key:3},L(a),{message:i.message}),null,16,["message"]))}}),Go=ze(Fo,[["__scopeId","data-v-09aaa469"]]);function Xo(i){if(i==null)return null;if(typeof i=="object"&&!Array.isArray(i))return i;if(typeof i!="string")return null;const o=i.trim();if(!o.startsWith("{"))return null;try{return JSON.parse(o)}catch{return null}}function He(i){const o=i.toLowerCase();return["hangup","cancel","reject","timeout","linebusy","end"].includes(o)}function Yo(i){const o=i.trim();if(!o)return!1;if(/\bcall_end\b/i.test(o)&&(/call_engine|call_record|rtc/i.test(o)||/"reason"\s*:\s*\d/.test(o))||/call_engine_srv\.[a-z_]*call[a-z_]*/i.test(o)&&/hangup|end|leave|reject|cancel/i.test(o))return!0;if(!o.startsWith("{"))return!1;let a;try{a=JSON.parse(o)}catch{return!1}if(a.businessID===1||a.businessID==="1"){const s=Xo(a.data);if(s){const c=String(s.cmd??"");if(He(c))return!0}}if((a.businessID==="rtc_call"||typeof a.cmd=="string")&&He(String(a.cmd??"")))return!0;const r=JSON.stringify(a);return!!(r.includes("call_engine_srv")&&/hangup|call_end|CALL_END|reject|cancel/i.test(r))}const Jo={class:"chat-window-heading"},Zo=["title"],Qo={class:"chat-container"},ta={key:0,class:"loading-container"},ea={key:1,class:"error-container"},na={key:2,class:"chat-content"},oa={class:"chat-layout"},aa={class:"message-toolbar"},ia={key:3,class:"text-consultation-hint"},sa={class:"call-kit-drag-handle-left"},ra={key:0,class:"call-local-recording-hint"},la={class:"call-kit-drag-handle-actions"},Tt="idle",Et="calling",ot="connected",Ke=40,ca=100,ua=1500,da=2600,fa=667,We=16,ma=$e({__name:"index",setup(i,{expose:o}){const a=p(""),r=p(!1),s=p(!1),c=p(!1),m=p(""),u=p(""),h=p("video"),d=p(0),v=p(""),T=z(()=>v.value||wo(h.value)),U=p(!1),y=p(!1),_=p("正在确认挂号类型"),{webConsultationBlocked:j,webConsultationMessage:S,ensureWebConsultationAllowed:ut}=lo(),bt=z(()=>!j.value&&U.value&&Ue(h.value)),oe=z(()=>!j.value&&y.value&&(Ue(h.value)||h.value==="phone"));let K,tt=0,ae=2;const B=p(null),A=p(null),dt=p("正在初始化..."),q=p(""),It=p(""),V=p(!1),F=p(!1),{login:Be}=ro(),{setActiveConversation:qe,createC2CConversation:Fe,activeConversation:Ge}=io(),Xe=_o(),ie=Ro(yo,()=>{console.warn("[chat-dialog] 聊天记录归档未完成,可在诊单聊天记录中重试同步")});let kt,et;function Rt(){const t=A.value;!s.value||!c.value||!t||(et&&clearTimeout(et),et=setTimeout(()=>{et=void 0,ie(t)},500))}function Mt(t=!1){var e,n,l;kt&&clearInterval(kt),et&&clearTimeout(et),kt=void 0,et=void 0,t&&A.value&&c.value&&ie(A.value),(l=(n=(e=Wt)==null?void 0:e.chat)==null?void 0:n.off)==null||l.call(n,J.EVENT.CONVERSATION_LIST_UPDATED,Rt)}function Ye(){var t,e,n;Mt(),(n=(e=(t=Wt)==null?void 0:t.chat)==null?void 0:e.on)==null||n.call(e,J.EVENT.CONVERSATION_LIST_UPDATED,Rt),kt=setInterval(Rt,15e3),Rt()}function se(t){"appointment_type"in t&&(h.value=t.appointment_type),v.value=t.appointment_type_desc||"",U.value=t.can_video_call===!0,y.value=t.can_audio_call===!0,_.value=t.call_disabled_reason||"当前挂号不支持该通话方式",Number(t.appointment_id)>0&&(d.value=Number(t.appointment_id))}async function Je(t){if(!ut())throw new Error(S.value);const e=tt,n=()=>t===1?oe.value:bt.value;if(!s.value||!n()){const f=h.value==="text"?"图文问诊不支持音视频通话":_.value;throw I.msgWarning(f),new Error(f)}const l=await Kt({patient_id:B.value,diagnosis_id:A.value,appointment_id:d.value});if(!s.value||tt!==e)throw new Error("当前问诊已切换,请重新发起通话");if(se(l),!ut())throw new Error(S.value);if(!n())throw I.msgWarning(_.value),new Error(_.value);ae=t}const ft=p("");let G=null,at=null,$t=0;const P=new ko,zt=p(!1),mt=p(!1);let jt=0,it=null,ht=null,Lt=Promise.resolve(),Bt=null;function st(){it&&(clearTimeout(it),it=null)}function qt(t){zt.value=!!(t!=null&&t.isLochostVod)}function Dt(){return ht||(ht=(async()=>{if(st(),mt.value=!1,!zt.value)return;P.beginStopNow();const t=Bt??A.value;try{await Lt}catch{}const e=await P.stop();if(!e){console.warn("[chat-dialog] 本地录制无有效文件(若通话较长仍出现,请换 Chrome 并看控制台是否有 MediaRecorder 报错)");return}if(t==null){I.msgWarning("缺少诊单信息,本地录制无法保存到通话记录");return}try{const n=await fo(e,`call-rec-${t}-${Date.now()}.webm`),l=n.uri||n.url;if(!l){I.msgError("上传成功但未返回文件地址");return}await ho({diagnosis_id:t,file_url:l}),I.msgSuccess("本地录制已上传并关联到通话记录")}catch(n){const l=n instanceof Error?n.message:String(n);console.warn("[chat-dialog] 本地录制上传/关联失败",n),I.msgError(l||"本地录制上传失败")}})().finally(()=>{ht=null}),ht)}function Ze(){const t=X.getData(Y.CALL,W.ROOM_ID);if(t==null)return"";if(typeof t=="number")return t===0?"":String(t);const e=String(t).trim();return!e||e==="0"?"":e}function Qe(){var t,e;try{const n=(e=(t=x).getTUICallEngineInstance)==null?void 0:e.call(t);if(!n)return"";const l=[n.roomId,n.roomID,n._roomId,n._roomID,n.strRoomID];for(const f of l){if(f==null||f==="")continue;const g=String(f).trim();if(g&&g!=="0")return g}}catch{}return""}function Ft(){return Ze()||Qe()}function xt(t,e){if(e!=null&&String(e).trim()!==""&&String(e)!=="0")return String(e).trim();if(typeof t=="number"&&t>0)return String(t);if(typeof t=="string"){const n=t.trim();if(n&&n!=="0")return n}return""}function re(t){if(t==null||typeof t!="object")return"";const e=t,n=xt(e.roomID,e.strRoomID)||xt(e.roomId,e.strRoomId);if(n)return n;const l=e.data;if(l&&typeof l=="object"){const f=l,g=xt(f.roomID,f.strRoomID)||xt(f.roomId,f.strRoomId);if(g)return g}return""}function rt(){at&&(clearTimeout(at),at=null),$t=0}function tn(){rt();const t=()=>{at=null;const e=X.getData(Y.CALL,W.CALL_STATUS);if(e===Tt||e!==Et&&e!==ot)return;const n=Ft();if(n){gt(n);return}if($t++,$t>=Ke){console.warn("[chat-dialog] 仍未解析到有效房间号(已重试",Ke,"次)");return}at=setTimeout(t,ca)};at=setTimeout(t,0)}async function le(t){if(!(B.value==null||A.value==null)){await ee();for(let e=0;e<40;e++){const n=Ft();if(n){await gt(n);return}await new Promise(l=>setTimeout(l,50))}console.warn("[chat-dialog] 发起通话后仍未解析到房间号(API:",t,")")}}function en(){var l,f;const t=window;if(t.__zytEngineRoomCapture__)return;const e=(f=(l=x).getTUICallEngineInstance)==null?void 0:f.call(l);if(!e||typeof e.calls!="function")return;t.__zytEngineRoomCapture__=!0,e.__zytEngineRoomCapture__=!0;const n=g=>{const C=e[g];typeof C=="function"&&(e[g]=async function(...b){const N=await C.apply(e,b),O=re(N);return O&>(O),await le("engine."+g),N})};n("calls"),n("call"),n("groupCall")}function nn(){const t=window;if(t.__zytHangupPreStop__)return;const e=x,n=e.hangup;typeof n=="function"&&(t.__zytHangupPreStop__=!0,e.hangup=function(...f){return P.beginStopNow(),n.apply(x,f)})}function ce(){var g,C;const t=window;if(t.__zytTrtcPreStop__)return;const e=(C=(g=x).getTUICallEngineInstance)==null?void 0:C.call(g),n=e==null?void 0:e.trtcCloud;if(!n||typeof n!="object")return;let l=0;const f=["stopLocalVideo","stopLocalAudio"];for(const E of f){const b=n[E];typeof b=="function"&&(n[E]=function(...O){return P.beginStopNow(),b.apply(n,O)},l++)}l>0&&(t.__zytTrtcPreStop__=!0)}let vt=[],pt=null,ue=0;async function Ut(){const t=Bt??A.value;if(t==null){console.warn("[chat-dialog] endCall 跳过:无诊单 ID(快照与当前均为空)");return}try{await vo({diagnosis_id:t}),console.log("[chat-dialog] endCall 已同步",{diagnosis_id:t})}catch(e){console.warn("[chat-dialog] endCall 失败",e)}}function de(t){const e=Date.now();e-ue<ua||(ue=e,console.log("[chat-dialog] 挂断停合流:",t),P.isRecording()&&P.beginStopNow(),Ut())}function on(){var t;Gt();try{const e=(t=Wt)==null?void 0:t.chat;if(!(e!=null&&e.on)){console.warn("[chat-dialog] TUIChatEngine.chat 不可用,无法监听 IM 视频挂断信令");return}pt=n=>{if(!s.value)return;const l=q.value;if(!l)return;const f=l.startsWith("C2C")?l:`C2C${l}`,g=Array.isArray(n.data)?n.data:[];for(const C of g){if(!C||C.conversationID!==f)continue;const E=C.type;if(!(E===J.TYPES.MSG_CUSTOM||E==="TIMCustomElem"||typeof E=="string"&&/custom/i.test(E)))continue;const N=C.payload,O=typeof(N==null?void 0:N.data)=="string"?N.data:"";if(!(!O||!Yo(O))){de("IM");break}}},e.on(J.EVENT.MESSAGE_RECEIVED,pt)}catch(e){console.warn("[chat-dialog] 绑定 IM 挂断监听失败",e)}}function Gt(){var t,e;if(pt){try{const n=(t=Wt)==null?void 0:t.chat;(e=n==null?void 0:n.off)==null||e.call(n,J.EVENT.MESSAGE_RECEIVED,pt)}catch{}pt=null}}function an(){var t,e;try{const n=(e=(t=x).getTUICallEngineInstance)==null?void 0:e.call(t),l=n==null?void 0:n.on;if(!n||typeof l!="function"||n.__zytRoomEvents)return;n.__zytRoomEvents=!0;const f=b=>{const N=re(b);if(N){gt(N);return}Xt()},g=()=>{de("TUICallEngine")},C=[St.TUICallEvent.CALL_END,St.TUICallEvent.USER_LEAVE,St.TUICallEvent.ON_CALL_NOT_CONNECTED];for(const b of C)l.call(n,b,g),vt.push({event:b,fn:g});const E=[St.TUICallEvent.USER_ENTER,St.TUICallEvent.ON_CALL_BEGIN];for(const b of E)l.call(n,b,f),vt.push({event:b,fn:f})}catch(n){console.warn("[chat-dialog] 绑定引擎房间事件失败",n)}}function sn(){var t,e;try{const n=(e=(t=x).getTUICallEngineInstance)==null?void 0:e.call(t);if(!(n!=null&&n.off)){vt=[];return}for(const{event:l,fn:f}of vt)n.off(l,f);n.__zytRoomEvents=!1}catch{}vt=[]}function rn(){const t=window;if(t.__zytTUICallRoomHooks__)return;t.__zytTUICallRoomHooks__=!0;const e=x,n=f=>{const g=e[f];typeof g=="function"&&(e[f]=async function(...E){await Vo(E[0]);const b=await g.apply(e,E);return await le(f),b})};n("calls"),n("call"),n("groupCall");const l=e.accept;typeof l=="function"&&(e.accept=async function(...g){if(!ut())throw new Error(S.value);return l.apply(e,g)})}async function gt(t){try{await Lt}catch{}if(B.value==null||A.value==null)return;const e=`${A.value}:${t}`;if(e===ft.value){rt();return}ft.value=e;try{const n=await po({diagnosis_id:A.value,room_id:t});rt(),console.log("[chat-dialog] bindCallRoom 成功",{room_id:t,bindRes:n});const l=n==null?void 0:n.cloud_recording;l&&l.started===!1&&l.message&&I.msgWarning(`云端合流录制未启动(关闭控制台全局录制后仅依赖 API):${l.message}`)}catch(n){console.warn("[chat-dialog] bindCallRoom 失败",n),ft.value=""}}async function Xt(){if(B.value==null||A.value==null)return;const t=X.getData(Y.CALL,W.CALL_STATUS);if(t===Tt){rt(),ft.value="";return}if(t!==Et&&t!==ot)return;await ee();const e=Ft();if(e){await gt(e);return}tn()}async function ln(){if(!(B.value==null||A.value==null))try{await go({diagnosis_id:A.value,patient_id:B.value,appointment_id:d.value,call_type:ae})}catch(t){console.warn("[chat-dialog] startCall 记录失败",t)}}function cn(){G==null||G();let t=X.getData(Y.CALL,W.CALL_STATUS)??Tt;const e=l=>{const f=l??Tt;if(f===Tt){(t===Et||t===ot)&&P.beginStopNow(),st(),mt.value=!1,(t===Et||t===ot)&&(async()=>(await Ut(),F.value=!1,await Dt()))(),rt(),ft.value="",t=f;return}if(f===ot){if(Xt(),st(),!zt.value){t=f;return}const g=jt,C=(E=0)=>{if(g!==jt){console.log("[chat-dialog] 录制轮次已变化,取消启动");return}const b=Jt.value,N=X.getData(Y.CALL,W.CALL_STATUS);if(!b||N!==ot){console.warn("[chat-dialog] 录制启动条件不满足",{root:!!b,status:N});return}console.log(`[chat-dialog] 尝试启动本地录制(第 ${E+1} 次)`);let O=Array.from(b.querySelectorAll("video"));if(O.length===0&&(O=Array.from(document.body.querySelectorAll("video")).filter(bn=>{const Me=bn.srcObject;return Me instanceof MediaStream?Me.getVideoTracks().some(In=>In.readyState==="live"):!1}),console.log("[chat-dialog] 在 body 中找到活跃视频:",O.length)),O.length===0){E<10?(console.warn("[chat-dialog] 未找到视频元素,300ms 后重试"),it=setTimeout(()=>C(E+1),300)):console.error("[chat-dialog] 重试 10 次后仍未找到视频元素,放弃录制");return}if(!O.some(Re=>Re.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA)){E<10?(console.warn("[chat-dialog] 视频元素未就绪,300ms 后重试"),it=setTimeout(()=>C(E+1),300)):console.error("[chat-dialog] 重试 10 次后视频仍未就绪,放弃录制");return}console.log("[chat-dialog] 视频元素已就绪,立即启动录制");const ke=P.start(b);mt.value=ke,ke?console.log("[chat-dialog] ✅ 本地录制已成功启动"):console.error("[chat-dialog] 本地录制启动失败(MediaRecorder 或画布初始化失败)")};it=setTimeout(()=>C(0),500)}else st();t=f},n=()=>{Xt()};X.watch(Y.CALL,{[W.CALL_STATUS]:e,[W.ROOM_ID]:n}),G=()=>{try{X.unwatch(Y.CALL,{[W.CALL_STATUS]:e,[W.ROOM_ID]:n})}catch{}rt(),G=null}}let fe=0;function yt(){const t=Date.now();t-fe<da||(fe=t,I.msgError(je()),F.value=!1)}let _t=null,Nt=!1,nt=null;function un(){Nt||(_t=console.error.bind(console),Nt=!0,console.error=(...t)=>{if(_t(...t),!s.value||!V.value)return;const e=t.map(n=>{if(typeof n=="string")return n;if(n instanceof Error)return n.message;try{return JSON.stringify(n)}catch{return String(n)}}).join(" ");lt(e)&&yt()})}function dn(){Nt&&_t&&(console.error=_t),Nt=!1,_t=null}function fn(){var t,e,n;try{const l=(e=(t=x).getTUICallEngineInstance)==null?void 0:e.call(t);if(!(l!=null&&l.on))return;nt&&((n=l.off)==null||n.call(l,"error",nt)),nt=f=>{!s.value||!V.value||lt(f)&&yt()},l.on("error",nt)}catch(l){console.warn("绑定 TUICallEngine error 监听失败:",l)}}function mn(){var t,e;try{const n=(e=(t=x).getTUICallEngineInstance)==null?void 0:e.call(t);n!=null&&n.off&&nt&&n.off("error",nt)}catch{}nt=null}async function hn(t,e){try{const n=J.create({SDKAppID:t}),l={businessID:"doctor_entered_consult_room",time:Date.now()},f=n.createCustomMessage({to:e,conversationType:J.TYPES.CONV_C2C,payload:{data:JSON.stringify(l)}});await n.sendMessage(f),console.log("已发送医生进入诊室信令(患者端聊天列表不展示)")}catch(n){console.warn("发送医生进入诊室信令失败:",n)}}const me=t=>{!s.value||!V.value||lt(t.reason)&&yt()};Un(()=>{un(),window.addEventListener("unhandledrejection",me)}),Nn(()=>{Mt(!0),tt++,K==null||K(),st(),P.reset(),G==null||G(),sn(),Gt(),dn(),mn(),window.removeEventListener("unhandledrejection",me)});const vn=async(t,e)=>{try{if(!t){console.warn("头像 URL 为空,跳过更新");return}console.log("开始更新头像到 IM:",t);const n=await new Promise((l,f)=>{setTimeout(async()=>{try{const C=await J.create({SDKAppID:e}).updateMyProfile({avatar:t});console.log("IM 头像更新成功:",C),l(C)}catch(g){console.error("更新头像异常:",g),l(null)}},500)})}catch(n){console.error("IM 头像更新失败:",n.message||n)}};Vn(()=>Ge.value,async t=>{if(t){if(u.value=t.getShowName()||u.value,console.log("会话切换:",t.conversationID,"名称:",u.value,t),t.userProfile.userID.includes("doctor"))console.log("当前会话是医生,跳过获取 assistant_id");else try{const e=await Kt({patient_id:t.userProfile.userID.replace("patient_",""),diagnosis_id:A.value,appointment_id:d.value});qt(e),q.value=e.patientUserId,a.value=e.assistant_id,console.log("会话切换后获取到 assistant_id:",a.value,"完整响应:",e)}catch(e){console.error("获取 assistant_id 失败:",e)}console.log("会话切换完成,userID:",t.userProfile.userID)}});const pn=async t=>{if(!ut())return;Mt(!0);const e=++tt;K==null||K(),K=No(Je),s.value=!0,r.value=!1,Vt.value=100,Pt.value=80,_e(),u.value=t.patientName,h.value=t.appointmentType,d.value=Number(t.appointmentId||0),v.value="",U.value=!1,y.value=!1,_.value="正在确认挂号类型",B.value=t.patientId,A.value=t.diagnosisId||null,m.value="",c.value=!1,V.value=!1,F.value=!1,dt.value="正在获取签名...";try{const n=await Kt({patient_id:t.patientId,diagnosis_id:t.diagnosisId||0,appointment_id:d.value});if(e!==tt||!s.value)return;if(se(n),qt(n),a.value=n.assistant_id,console.log("后端返回的签名数据:",n),console.log("assistant_id:",a.value),!n||!n.userSig)throw new Error("获取签名失败");n.assistant_id||console.warn("警告:后端未返回 assistant_id,群视频通话可能无法正常工作"),q.value=n.patientUserId||`patient_${t.patientId}`,dt.value="正在登录聊天...",await Be({sdkAppId:Number(n.sdkAppId),userId:n.userId,userSig:n.userSig,useUploadPlugin:!0}),on();const l=Number(n.sdkAppId);if(!window.__TUICallKitInited__){dt.value="正在初始化通话能力...";try{await x.init({userID:n.userId,userSig:n.userSig,SDKAppID:l}),window.__TUICallKitInited__=!0}catch(f){console.warn("TUICallKit 初始化失败,聊天仍可用,音视频通话不可用:",(f==null?void 0:f.message)||f),lt(f)&&yt()}}V.value=!!window.__TUICallKitInited__,V.value&&(x.setCallback({beforeCalling:()=>{ce(),st(),P.reset(),mt.value=!1,jt++,Bt=A.value,_e(),F.value=!0,Lt=ln()},afterCalling:()=>{P.beginStopNow(),(async()=>(await Ut(),F.value=!1,await Dt()))()}}),rn(),en(),nn(),ce(),an(),cn(),fn()),console.log("Chat UIKit 登录成功,患者用户ID:",q.value),dt.value="加载聊天界面...",setTimeout(async()=>{var g;if(e!==tt||!s.value)return;c.value=!0,Ye(),await ee(),await new Promise(C=>setTimeout(C,1e3));const f=(g=Xe.userInfo)==null?void 0:g.avatar;console.log("准备更新头像,avatar:",f),f&&await vn(f,l);try{const C=await Fe(q.value);It.value=C.conversationID,console.log("已创建/获取会话:",It.value),qe(It.value),console.log("已激活会话"),await hn(l,q.value)}catch(C){console.error("创建/激活会话失败:",C)}},800)}catch(n){console.error("初始化聊天失败:",n),m.value=n.message||"初始化聊天失败",I.msgError(m.value)}},gn=async()=>{if(ut()){if(!bt.value){I.msgWarning(h.value==="text"?"图文问诊不支持视频通话":_.value);return}if(!V.value){I.msgWarning("通话服务初始化中,请稍后再试");return}if(!q.value){I.msgWarning("未找到患者通话ID,无法发起群视频");return}try{if(!a.value){console.warn("assistant_id 为空,尝试重新获取");const e=await Kt({patient_id:B.value,diagnosis_id:A.value,appointment_id:d.value});qt(e),a.value=e.assistant_id,console.log("重新获取 assistant_id:",a.value)}const t=[q.value,a.value].filter(e=>e);if(t.length<2){I.msgWarning("助理ID获取失败,无法发起群视频"),console.error("userIDList 不完整:",t,"assistant_ids:",a.value);return}console.log("发起群视频通话,参与者:",t),await x.calls({userIDList:t,type:so.VIDEO_CALL})}catch(t){console.error("发起群视频失败:",t),lt(t)?yt():I.msgError(Oo(t,"发起群视频失败"))}}},yn=p(),Vt=p(100),Pt=p(80),Yt=p(!1),he=p(0),ve=p(0),pe=p(0),ge=p(0),ye=p(),Jt=p(),wt=p(!1),Ot=p(0),Ht=p(0);function _e(){Ot.value=We,Ht.value=Math.max(We,Math.floor((window.innerHeight-fa)/2))}const Zt=p(!1),we=p(0),Ce=p(0),Se=p(0),Te=p(0),_n=z(()=>({left:`${Ot.value}px`,top:`${Ht.value}px`})),wn=t=>{Zt.value=!0,we.value=t.clientX,Ce.value=t.clientY,Se.value=Ot.value,Te.value=Ht.value,document.addEventListener("mousemove",Ee),document.addEventListener("mouseup",Ae)},Ee=t=>{Zt.value&&(Ot.value=Math.max(0,Se.value+t.clientX-we.value),Ht.value=Math.max(0,Te.value+t.clientY-Ce.value))},Ae=()=>{Zt.value=!1,document.removeEventListener("mousemove",Ee),document.removeEventListener("mouseup",Ae)},Cn=async()=>{if(!wt.value){wt.value=!0;try{if(B.value==null){I.msgWarning("缺少患者信息,无法同步舌苔照片");return}const t=ye.value,e=Jt.value,n=t||e;if(!n)return;const l=await Uo(n,{extraRoots:[e].filter(Boolean)});if(!l){I.msgWarning("截屏失败,请确认视频画面已加载");return}const f=await uo(l,`callshot-${Date.now()}.jpg`),g=f.url||f.uri;if(!g){I.msgError("上传未返回图片路径");return}if(A.value==null){I.msgWarning("请先保存诊单后再从视频同步舌苔照片");return}await mo({diagnosis_id:A.value,tongue_images:[g]}),I.msgSuccess("舌苔照片已保存")}catch(t){const e=t;console.error(e),I.msgError((e==null?void 0:e.message)||"上传失败")}finally{wt.value=!1}}},Sn=async()=>{if(V.value)try{P.beginStopNow(),await Dt(),await x.hangup()}catch(t){console.warn("关闭视频窗口时挂断失败:",t)}F.value=!1},Tn=z(()=>({left:`${Vt.value}px`,top:`${Pt.value}px`})),En=t=>{const e=t.target;e.closest(".chat-close-btn")||e.closest(".chat-header-actions")||(Yt.value=!0,he.value=t.clientX,ve.value=t.clientY,pe.value=Vt.value,ge.value=Pt.value,document.addEventListener("mousemove",be),document.addEventListener("mouseup",Ie))},be=t=>{Yt.value&&(Vt.value=Math.max(0,pe.value+t.clientX-he.value),Pt.value=Math.max(0,ge.value+t.clientY-ve.value))},Ie=()=>{Yt.value=!1,document.removeEventListener("mousemove",be),document.removeEventListener("mouseup",Ie)},An=async()=>{if(Mt(!0),tt++,K==null||K(),Gt(),V.value){const t=X.getData(Y.CALL,W.CALL_STATUS);if(t===Et||t===ot)try{P.beginStopNow(),await Dt(),await x.hangup()}catch(e){console.warn("挂断通话时出错:",e)}}A.value!=null&&await Ut(),s.value=!1,F.value=!1};return o({open:pn}),(t,e)=>{const n=Pn,l=On,f=Hn,g=Kn,C=jn;return R(),Z(ao,{to:"body"},[Qt(k("div",{ref_key:"chatWindowRef",ref:yn,class:oo(["chat-floating-window",{"chat-floating-window--minimized":r.value}]),style:xe(Tn.value)},[k("div",{class:"chat-window-header",onMousedown:En},[k("div",Jo,[k("span",{class:"chat-window-title",title:u.value},"与 "+Q(u.value)+" 通讯",9,Zo),w(n,{size:"small",type:"info",class:"chat-appointment-type"},{default:M(()=>[Le(Q(T.value),1)]),_:1})]),k("div",{class:"chat-header-actions",onMousedown:e[2]||(e[2]=Ct(()=>{},["stop"]))},[w(f,{type:"danger",link:"",class:"chat-close-btn",onClick:An},{default:M(()=>[w(l,null,{default:M(()=>[w(L(De))]),_:1})]),_:1}),r.value?(R(),Z(g,{key:1,content:"展开聊天窗口",placement:"top"},{default:M(()=>[w(f,{type:"primary",link:"",class:"chat-expand-btn",onClick:e[1]||(e[1]=E=>r.value=!1)},{default:M(()=>[w(l,null,{default:M(()=>[w(L($n))]),_:1}),e[6]||(e[6]=k("span",{class:"chat-header-btn-text"},"展开",-1))]),_:1})]),_:1})):(R(),Z(g,{key:0,content:"缩小为标题条,不关闭会话",placement:"top"},{default:M(()=>[w(f,{type:"primary",link:"",class:"chat-minimize-btn",onClick:e[0]||(e[0]=E=>r.value=!0)},{default:M(()=>[w(l,null,{default:M(()=>[w(L(Wn))]),_:1}),e[5]||(e[5]=k("span",{class:"chat-header-btn-text"},"缩小",-1))]),_:1})]),_:1}))],32)],32),r.value?$("",!0):(R(),Z(co,{key:0})),Qt(k("div",Qo,[c.value?m.value?(R(),H("div",ea,[w(C,{title:m.value,type:"error",closable:!1},null,8,["title"])])):(R(),H("div",na,[w(L(Qn),{language:"zh-CN",theme:"light"},{default:M(()=>[k("div",oa,[w(L(Bn),{class:"chat-area"},{default:M(()=>[w(L(qn),{conversationID:It.value,Message:Go},null,8,["conversationID"]),w(L(Fn),null,{headerToolbar:M(()=>[k("div",aa,[w(L(Gn)),w(L(Xn)),w(L(Yn)),V.value&&oe.value?(R(),Z(L(Jn),{key:0})):$("",!0),V.value&&bt.value?(R(),Z(L(Zn),{key:1})):$("",!0),V.value&&bt.value?(R(),Z(f,{key:2,size:"small",type:"primary",onClick:gn},{default:M(()=>[...e[7]||(e[7]=[Le(" 群视频 ",-1)])]),_:1})):$("",!0),h.value==="text"?(R(),H("span",ia,"图文问诊,不支持音视频通话")):$("",!0)])]),_:1})]),_:1})])]),_:1})])):(R(),H("div",ta,[w(l,{class:"is-loading"},{default:M(()=>[w(L(zn))]),_:1}),k("span",null,Q(dt.value),1)]))],512),[[te,!r.value]]),V.value?Qt((R(),H("div",{key:1,ref_key:"callKitWrapperRef",ref:ye,class:"chat-dialog-call-kit-wrapper",style:xe(_n.value)},[k("div",{class:"call-kit-drag-handle",onMousedown:wn},[k("div",sa,[e[8]||(e[8]=k("span",{class:"drag-handle-text"},"视频通话",-1)),mt.value?(R(),H("span",ra,"本地录制中")):$("",!0)]),k("div",la,[w(f,{type:"primary",link:"",class:"call-kit-screenshot-btn",loading:wt.value,disabled:wt.value,onMousedown:e[3]||(e[3]=Ct(()=>{},["stop"])),onClick:Ct(Cn,["stop","prevent"])},{default:M(()=>[w(l,null,{default:M(()=>[w(L(to))]),_:1}),e[9]||(e[9]=k("span",{class:"call-kit-screenshot-text"},"截屏",-1))]),_:1},8,["loading","disabled"]),w(f,{type:"danger",link:"",class:"call-kit-close-btn",onMousedown:e[4]||(e[4]=Ct(()=>{},["stop"])),onClick:Ct(Sn,["stop"])},{default:M(()=>[w(l,null,{default:M(()=>[w(L(De))]),_:1})]),_:1}),w(l,{class:"drag-handle-icon"},{default:M(()=>[w(L(eo))]),_:1})])],32),k("div",{ref_key:"callKitContentRef",ref:Jt,class:"call-kit-content"},[w(L(no),{allowedMinimized:!0,allowedFullScreen:!0,class:"chat-dialog-call-kit"})],512)],4)),[[te,F.value]]):$("",!0)],6),[[te,s.value]])])}}}),Da=ze(ma,[["__scopeId","data-v-f1d37143"]]);export{Da as default};
|