ysyt-react-agent-lib 1.2.26 → 1.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConsultModel-B0g4sapV.mjs → ConsultModel-CQUhtuAd.mjs} +2 -2
- package/dist/{ConsultModel-CwPWnbDX.js → ConsultModel-Ch0fM8XE.js} +1 -1
- package/dist/{TransferModel-BQN0vfjr.js → TransferModel-Dx-h4fyt.js} +1 -1
- package/dist/{TransferModel-D30vJSOe.mjs → TransferModel-OMb6IgmA.mjs} +2 -2
- package/dist/{index-CDzJ3Vhz.mjs → index-BQ9WPo_3.mjs} +1631 -1632
- package/dist/{index-DRLrhuTR.mjs → index-CIG_xuvT.mjs} +1 -1
- package/dist/{index-CEYQQfvr.js → index-CpHjelsP.js} +3 -3
- package/dist/{index-CA6GtpIf.js → index-TT0NyPBh.js} +1 -1
- package/dist/ysyt-react-agent-lib.cjs.js +1 -1
- package/dist/ysyt-react-agent-lib.es.js +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as r from "react";
|
|
2
2
|
import $, { useContext as re, useRef as Z, useMemo as Lt, useEffect as De } from "react";
|
|
3
|
-
import { i as Dt, K as Ne, g as se, F as kt, m as fe, u as N, r as nt, b as Pe, p as je, C as q, c as O, d as Ie, e as At, o as ge, f as Ce, h as _t, k as Vt, l as Wt, W as qt, n as Gt, B as Te, q as ot, s as Xt, _ as R, t as ke, v as Y, w as Me, x as at, y as Ae, z as Ut, A as _e, D as Ve, P as Kt, G as Qt, H as K, J as Zt, L as Yt, N as Re, O as Jt, Q as lt, T as en, U as tn, V as rt, X as nn, Z as on, $ as an, a0 as ue, a1 as ln, a2 as st, a3 as rn, a4 as sn, a5 as cn, a6 as dn, a7 as un, a8 as mn, a9 as fn, aa as gn, ab as Cn, ac as it, ad as pn, ae as vn } from "./index-
|
|
3
|
+
import { i as Dt, K as Ne, g as se, F as kt, m as fe, u as N, r as nt, b as Pe, p as je, C as q, c as O, d as Ie, e as At, o as ge, f as Ce, h as _t, k as Vt, l as Wt, W as qt, n as Gt, B as Te, q as ot, s as Xt, _ as R, t as ke, v as Y, w as Me, x as at, y as Ae, z as Ut, A as _e, D as Ve, P as Kt, G as Qt, H as K, J as Zt, L as Yt, N as Re, O as Jt, Q as lt, T as en, U as tn, V as rt, X as nn, Z as on, $ as an, a0 as ue, a1 as ln, a2 as st, a3 as rn, a4 as sn, a5 as cn, a6 as dn, a7 as un, a8 as mn, a9 as fn, aa as gn, ab as Cn, ac as it, ad as pn, ae as vn } from "./index-BQ9WPo_3.mjs";
|
|
4
4
|
const bn = new Ne("antFadeIn", {
|
|
5
5
|
"0%": {
|
|
6
6
|
opacity: 0
|
|
@@ -160,7 +160,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
160
160
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
161
161
|
* @copyright Chen, Yi-Cyuan 2014-2023
|
|
162
162
|
* @license MIT
|
|
163
|
-
*/Vc=k0,function(){var t="input is invalid type",e=typeof window=="object",n=e?window:{};n.JS_MD5_NO_WINDOW&&(e=!1);var r=!e&&typeof self=="object",i=!n.JS_MD5_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;i?n=Tw:r&&(n=self);var o,a=!n.JS_MD5_NO_COMMON_JS&&Vc.exports,s=!n.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",A="0123456789abcdef".split(""),c=[128,32768,8388608,-2147483648],u=[0,8,16,24],d=["hex","array","digest","buffer","arrayBuffer","base64"],f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),p=[];if(s){var v=new ArrayBuffer(68);o=new Uint8Array(v),p=new Uint32Array(v)}var C=Array.isArray;!n.JS_MD5_NO_NODE_JS&&C||(C=function(E){return Object.prototype.toString.call(E)==="[object Array]"});var m=ArrayBuffer.isView;!s||!n.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&m||(m=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});var y=function(E){var b=typeof E;if(b==="string")return[E,!0];if(b!=="object"||E===null)throw new Error(t);if(s&&E.constructor===ArrayBuffer)return[new Uint8Array(E),!1];if(!C(E)&&!m(E))throw new Error(t);return[E,!1]},w=function(E){return function(b){return new x(!0).update(b)[E]()}},I=function(E){var b,h=Og,S=Og.Buffer;return b=S.from&&!n.JS_MD5_NO_BUFFER_FROM?S.from:function(T){return new S(T)},function(T){if(typeof T=="string")return h.createHash("md5").update(T,"utf8").digest("hex");if(T==null)throw new Error(t);return T.constructor===ArrayBuffer&&(T=new Uint8Array(T)),C(T)||m(T)||T.constructor===S?h.createHash("md5").update(b(T)).digest("hex"):E(T)}},O=function(E){return function(b,h){return new g(b,!0).update(h)[E]()}};function x(E){if(E)p[0]=p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0,this.blocks=p,this.buffer8=o;else if(s){var b=new ArrayBuffer(68);this.buffer8=new Uint8Array(b),this.blocks=new Uint32Array(b)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function g(E,b){var h,S=y(E);if(E=S[0],S[1]){var T,R=[],D=E.length,B=0;for(h=0;h<D;++h)(T=E.charCodeAt(h))<128?R[B++]=T:T<2048?(R[B++]=192|T>>>6,R[B++]=128|63&T):T<55296||T>=57344?(R[B++]=224|T>>>12,R[B++]=128|T>>>6&63,R[B++]=128|63&T):(T=65536+((1023&T)<<10|1023&E.charCodeAt(++h)),R[B++]=240|T>>>18,R[B++]=128|T>>>12&63,R[B++]=128|T>>>6&63,R[B++]=128|63&T);E=R}E.length>64&&(E=new x(!0).update(E).array());var k=[],P=[];for(h=0;h<64;++h){var H=E[h]||0;k[h]=92^H,P[h]=54^H}x.call(this,b),this.update(P),this.oKeyPad=k,this.inner=!0,this.sharedMemory=b}x.prototype.update=function(E){if(this.finalized)throw new Error("finalize already called");var b=y(E);E=b[0];for(var h,S,T=b[1],R=0,D=E.length,B=this.blocks,k=this.buffer8;R<D;){if(this.hashed&&(this.hashed=!1,B[0]=B[16],B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),T)if(s)for(S=this.start;R<D&&S<64;++R)(h=E.charCodeAt(R))<128?k[S++]=h:h<2048?(k[S++]=192|h>>>6,k[S++]=128|63&h):h<55296||h>=57344?(k[S++]=224|h>>>12,k[S++]=128|h>>>6&63,k[S++]=128|63&h):(h=65536+((1023&h)<<10|1023&E.charCodeAt(++R)),k[S++]=240|h>>>18,k[S++]=128|h>>>12&63,k[S++]=128|h>>>6&63,k[S++]=128|63&h);else for(S=this.start;R<D&&S<64;++R)(h=E.charCodeAt(R))<128?B[S>>>2]|=h<<u[3&S++]:h<2048?(B[S>>>2]|=(192|h>>>6)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]):h<55296||h>=57344?(B[S>>>2]|=(224|h>>>12)<<u[3&S++],B[S>>>2]|=(128|h>>>6&63)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]):(h=65536+((1023&h)<<10|1023&E.charCodeAt(++R)),B[S>>>2]|=(240|h>>>18)<<u[3&S++],B[S>>>2]|=(128|h>>>12&63)<<u[3&S++],B[S>>>2]|=(128|h>>>6&63)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]);else if(s)for(S=this.start;R<D&&S<64;++R)k[S++]=E[R];else for(S=this.start;R<D&&S<64;++R)B[S>>>2]|=E[R]<<u[3&S++];this.lastByteIndex=S,this.bytes+=S-this.start,S>=64?(this.start=S-64,this.hash(),this.hashed=!0):this.start=S}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,b=this.lastByteIndex;E[b>>>2]|=c[3&b],b>=56&&(this.hashed||this.hash(),E[0]=E[16],E[16]=E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=0),E[14]=this.bytes<<3,E[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},x.prototype.hash=function(){var E,b,h,S,T,R,D=this.blocks;this.first?b=((b=((E=((E=D[0]-680876937)<<7|E>>>25)-271733879|0)^(h=((h=(-271733879^(S=((S=(-1732584194^2004318071&E)+D[1]-117830708)<<12|S>>>20)+E|0)&(-271733879^E))+D[2]-1126478375)<<17|h>>>15)+S|0)&(S^E))+D[3]-1316259209)<<22|b>>>10)+h|0:(E=this.h0,b=this.h1,h=this.h2,b=((b+=((E=((E+=((S=this.h3)^b&(h^S))+D[0]-680876936)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[1]-389564586)<<12|S>>>20)+E|0)&(E^b))+D[2]+606105819)<<17|h>>>15)+S|0)&(S^E))+D[3]-1044525330)<<22|b>>>10)+h|0),b=((b+=((E=((E+=(S^b&(h^S))+D[4]-176418897)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[5]+1200080426)<<12|S>>>20)+E|0)&(E^b))+D[6]-1473231341)<<17|h>>>15)+S|0)&(S^E))+D[7]-45705983)<<22|b>>>10)+h|0,b=((b+=((E=((E+=(S^b&(h^S))+D[8]+1770035416)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[9]-1958414417)<<12|S>>>20)+E|0)&(E^b))+D[10]-42063)<<17|h>>>15)+S|0)&(S^E))+D[11]-1990404162)<<22|b>>>10)+h|0,b=((b+=((E=((E+=(S^b&(h^S))+D[12]+1804603682)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[13]-40341101)<<12|S>>>20)+E|0)&(E^b))+D[14]-1502002290)<<17|h>>>15)+S|0)&(S^E))+D[15]+1236535329)<<22|b>>>10)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[1]-165796510)<<5|E>>>27)+b|0)^b))+D[6]-1069501632)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[11]+643717713)<<14|h>>>18)+S|0)^S))+D[0]-373897302)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[5]-701558691)<<5|E>>>27)+b|0)^b))+D[10]+38016083)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[15]-660478335)<<14|h>>>18)+S|0)^S))+D[4]-405537848)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[9]+568446438)<<5|E>>>27)+b|0)^b))+D[14]-1019803690)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[3]-187363961)<<14|h>>>18)+S|0)^S))+D[8]+1163531501)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[13]-1444681467)<<5|E>>>27)+b|0)^b))+D[2]-51403784)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[7]+1735328473)<<14|h>>>18)+S|0)^S))+D[12]-1926607734)<<20|b>>>12)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[5]-378558)<<4|E>>>28)+b|0))+D[8]-2022574463)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[11]+1839030562)<<16|h>>>16)+S|0))+D[14]-35309556)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[1]-1530992060)<<4|E>>>28)+b|0))+D[4]+1272893353)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[7]-155497632)<<16|h>>>16)+S|0))+D[10]-1094730640)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[13]+681279174)<<4|E>>>28)+b|0))+D[0]-358537222)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[3]-722521979)<<16|h>>>16)+S|0))+D[6]+76029189)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[9]-640364487)<<4|E>>>28)+b|0))+D[12]-421815835)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[15]+530742520)<<16|h>>>16)+S|0))+D[2]-995338651)<<23|b>>>9)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[0]-198630844)<<6|E>>>26)+b|0)|~h))+D[7]+1126891415)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[14]-1416354905)<<15|h>>>17)+S|0)|~E))+D[5]-57434055)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[12]+1700485571)<<6|E>>>26)+b|0)|~h))+D[3]-1894986606)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[10]-1051523)<<15|h>>>17)+S|0)|~E))+D[1]-2054922799)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[8]+1873313359)<<6|E>>>26)+b|0)|~h))+D[15]-30611744)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[6]-1560198380)<<15|h>>>17)+S|0)|~E))+D[13]+1309151649)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[4]-145523070)<<6|E>>>26)+b|0)|~h))+D[11]-1120210379)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[2]+718787259)<<15|h>>>17)+S|0)|~E))+D[9]-343485551)<<21|b>>>11)+h|0,this.first?(this.h0=E+1732584193|0,this.h1=b-271733879|0,this.h2=h-1732584194|0,this.h3=S+271733878|0,this.first=!1):(this.h0=this.h0+E|0,this.h1=this.h1+b|0,this.h2=this.h2+h|0,this.h3=this.h3+S|0)},x.prototype.hex=function(){this.finalize();var E=this.h0,b=this.h1,h=this.h2,S=this.h3;return A[E>>>4&15]+A[15&E]+A[E>>>12&15]+A[E>>>8&15]+A[E>>>20&15]+A[E>>>16&15]+A[E>>>28&15]+A[E>>>24&15]+A[b>>>4&15]+A[15&b]+A[b>>>12&15]+A[b>>>8&15]+A[b>>>20&15]+A[b>>>16&15]+A[b>>>28&15]+A[b>>>24&15]+A[h>>>4&15]+A[15&h]+A[h>>>12&15]+A[h>>>8&15]+A[h>>>20&15]+A[h>>>16&15]+A[h>>>28&15]+A[h>>>24&15]+A[S>>>4&15]+A[15&S]+A[S>>>12&15]+A[S>>>8&15]+A[S>>>20&15]+A[S>>>16&15]+A[S>>>28&15]+A[S>>>24&15]},x.prototype.toString=x.prototype.hex,x.prototype.digest=function(){this.finalize();var E=this.h0,b=this.h1,h=this.h2,S=this.h3;return[255&E,E>>>8&255,E>>>16&255,E>>>24&255,255&b,b>>>8&255,b>>>16&255,b>>>24&255,255&h,h>>>8&255,h>>>16&255,h>>>24&255,255&S,S>>>8&255,S>>>16&255,S>>>24&255]},x.prototype.array=x.prototype.digest,x.prototype.arrayBuffer=function(){this.finalize();var E=new ArrayBuffer(16),b=new Uint32Array(E);return b[0]=this.h0,b[1]=this.h1,b[2]=this.h2,b[3]=this.h3,E},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.base64=function(){for(var E,b,h,S="",T=this.array(),R=0;R<15;)E=T[R++],b=T[R++],h=T[R++],S+=f[E>>>2]+f[63&(E<<4|b>>>4)]+f[63&(b<<2|h>>>6)]+f[63&h];return E=T[R],S+=f[E>>>2]+f[E<<4&63]+"=="},g.prototype=new x,g.prototype.finalize=function(){if(x.prototype.finalize.call(this),this.inner){this.inner=!1;var E=this.array();x.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(E),x.prototype.finalize.call(this)}};var M=function(){var E=w("hex");i&&(E=I(E)),E.create=function(){return new x},E.update=function(S){return E.create().update(S)};for(var b=0;b<d.length;++b){var h=d[b];E[h]=w(h)}return E}();M.md5=M,M.md5.hmac=function(){var E=O("hex");E.create=function(S){return new g(S)},E.update=function(S,T){return E.create(S).update(T)};for(var b=0;b<d.length;++b){var h=d[b];E[h]=O(h)}return E}(),a?Vc.exports=M:n.md5=M}();var Nw=k0.exports;const P0=(t,e)=>{const n=Date.now(),r=`${t}:${n}:${Nw.md5(`${e}${n}`)}`,i=new TextEncoder().encode(r);return btoa(String.fromCharCode(...i))},iu=t=>{if(/^\d+$/.test(t)||!t||typeof t!="string"||t.length%4!=0||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t))return!1;try{const e=atob(t);return btoa(e)===t}catch{return!1}},Yi="/v1/aicc/bmserver",Or="/v1/aicc/ccs";let Si="",Kd="",Vd="",zc="";function Q0(t){const e=P0(Kd,Vd);return Mw.create({prefixUrl:`${Si}`,timeout:!1,headers:{Authorization:e,...t},hooks:{afterResponse:[async(n,r,i)=>{if(i.url.indexOf("heartbeat")!==-1)return i;const o=await i.clone().json();if(o.code!==0)throw new Error(JSON.stringify(o)||"请求失败");return i.json=async()=>o,i}]}})}async function yn(t,e,n){const r=Q0(n),i="api/"+t.replace(/^\/+/,"");return r.post(i,{json:e}).json()}const Ug=(t,e)=>yn(`${Or}/state/change?h=${e}`,t,{h:e}),Dw=()=>async function(t,e){const n=Q0(),r=t.replace(/^\/+/,"");return n.post(r,{json:e}).json()}("/heartbeat",{});class nn{static log(e,n={}){const{level:r="info",module:i="",timestamp:o=!0}=n;if(K.logBuiltinEnabled){const A=i?`[${i}]`:"",c=o?`[${new Date().toLocaleString()}]`:"";switch(r){case"debug":break;case"warn":console.warn(`${c}${A} ${e}`);break;case"error":console.error(`${c}${A} ${e}`)}}const a=K.agentInfo.agent_no;if(a){const A=JSON.stringify({level:r,module:i,content:e,timestamp:new Date().toISOString()});(s={agent_no:a,content:A},yn("/v1/aicc/ccs/softphone/log",s)).catch(()=>{})}var s}static debug(e,n){this.log(e,{level:"debug",module:n})}static info(e,n){this.log(e,{level:"info",module:n})}static warn(e,n){this.log(e,{level:"warn",module:n})}static error(e,n){this.log(e,{level:"error",module:n})}static errorObj(e,n){const r=JSON.stringify({message:e.message,stack:e.stack,name:e.name});this.log(r,{level:"error",module:n})}}class Bw{constructor(e,n){this.config=e,this.eventCallback=n,this.userAgent=null,this.registerer=null,this.activeSession=null,this.callTimeoutTimer=null,this.incomingInvitation=null,this.reconnectAttempts=0,this.maxReconnectAttempts=5,this.reconnectTimer=null,this.isOffline=!1,this.isManuallyStopped=!1,this.registerInterval=6e4,this.handleNetworkInfoChange=r=>{var i,o;if((i=r.rttObject)!=null&&i.rtt){const a=(o=r.rttObject)==null?void 0:o.rtt,s=a!=null&&a>0;s||this.isOffline?s&&this.isOffline&&(this.isOffline=!1,this.handleOnline()):(this.isOffline=!0,this.handleOffline())}},this.handleOffline=()=>{nn.warn("网络断开,准备销毁 SIP 客户端","sip-client.ts 75 handleOffline"),fe.emit(He.FAIL_NOTIFICATION,"网络断开,准备销毁 SIP 客户端"),this.destroy()},this.handleOnline=()=>{nn.warn("网络恢复,准备重新启动 SIP 客户端","sip-client.ts 82 handleOnline"),this.reconnect()},this.sleep=r=>new Promise(i=>setTimeout(i,r)),T0.subscribe(this.handleNetworkInfoChange)}async start(){const e=Fg.makeURI(`sip:${this.config.user}@${this.config.server}`);if(!e)throw new Error("无效的SIP配置");const n={uri:e,authorizationUsername:this.config.user,authorizationPassword:this.config.password,sendInitialProvisionalResponse:!1,transportOptions:{server:this.config.webSocket,connectionTimeout:10,keepAliveInterval:20,keepAliveDebounce:10},contactName:this.config.user,contactParams:{transport:"wss"},userAgentString:"SwiftSIP/2.0.21",sessionDescriptionHandlerFactoryOptions:{alwaysAcquireMediaFirst:!0,peerConnectionConfiguration:{iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceCandidatePoolSize:0,iceTransportPolicy:"all",rtcpMuxPolicy:"require",bundlePolicy:"balanced",certificates:void 0,peerIdentity:void 0},iceGatheringTimeout:1e3},logBuiltinEnabled:K.logBuiltinEnabled};this.userAgent=new Fg(n),this.setupEventListeners(),await this.userAgent.start(),await this.register()}setupEventListeners(){this.userAgent&&(this.userAgent.transport.stateChange.addListener(e=>{var r;let n;switch(e){case dt.Connecting:n=Ar.WEB_RTC_CONNECTING;break;case dt.Connected:n=Ar.WEB_RTC_CONNECTED,this.reconnectAttempts=0,K.isRtcReconnecting=!1,G.updateIsSipConnected(!0),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);break;case dt.Disconnecting:n=Ar.WEB_RTC_DISCONNECTING,G.updateIsSipConnected(!1);break;case dt.Disconnected:{if(G.updateIsSipConnected(!1),this.isManuallyStopped)return nn.warn("手动断开,不触发重连","sip-client.ts 204"),void console.warn("[SIP] 手动断开,不触发重连");fe.emit(He.FAIL_NOTIFICATION,"软电话链接失败"),n=Ar.WEB_RTC_DISCONNECTED;const i=G.get("answerDevice");if(!K.isRtcReconnecting&&this.reconnectAttempts<this.maxReconnectAttempts&&i===1){this.reconnectAttempts++;const o=1e3*this.reconnectAttempts;nn.warn(`SIP WebSocket 断开,第 ${this.reconnectAttempts} 次尝试重连,${o}ms 后重试...`,"sip-client.ts 219"),this.reconnectTimer=setTimeout(()=>{this.reconnect()},o)}else this.reconnectAttempts>=this.maxReconnectAttempts&&(nn.warn(`SIP 重连失败:已达到最大重试次数; reconnectAttempts: ${this.reconnectAttempts}; maxReconnectAttempts: ${this.maxReconnectAttempts}`,"sip-client.ts 228"),console.error("SIP 重连失败:已达到最大重试次数"),fe.emit(He.FAIL_NOTIFICATION,"SIP 重连失败:已达到最大重试次数"));break}default:G.updateIsSipConnected(!1),n="unknown"}(r=this.eventCallback)==null||r.call(this,{type:n})}),this.userAgent.delegate={onInvite:e=>{this.handleIncomingCall(e)}})}async refreshRegister(){if(this.registerer)try{await this.registerer.register(),new Date().toLocaleTimeString()}catch(e){console.error("[SIPClient] REGISTER刷新失败",e)}}async register(){var e,n;if(this.userAgent){this.registerer=new tu(this.userAgent,{expires:120,refreshFrequency:80}),(e=this.registerer)==null||e.stateChange.addListener(r=>{var o;let i;switch(r){case jt.Initial:G.updateDisplayText(Kt.LINKING),i="initial";break;case jt.Registered:G.updateDisplayText(""),i=Ar.WEB_RTC_REGISTERED;break;case jt.Unregistered:i=Ar.WEB_RTC_UNREGISTERED;break;case jt.Terminated:nn.warn(`注册流程已终止,无法再注册(如 UA 停止,或网络不可达);regStatus: ${Ar.WEB_RTC_TERMINATED}`,"sip-client.ts 299"),i=Ar.WEB_RTC_TERMINATED;break;default:i="unknown"}(o=this.eventCallback)==null||o.call(this,{type:i})});try{await this.registerer.register()}catch(r){(n=this.eventCallback)==null||n.call(this,{type:Ar.WEB_RTC_REGISTER_FAILED,data:r})}}}attachRemoteAudio(e){const n=e.sessionDescriptionHandler;if(n){const r=n.peerConnection;if(!r)return;const i=new MediaStream;r.getReceivers().forEach(a=>{a.track&&a.track.kind==="audio"&&i.addTrack(a.track)});let o=document.getElementById("sip-remote-audio");o||(o=document.createElement("audio"),o.id="sip-remote-audio",o.autoplay=!0,o.style.display="none",document.body.appendChild(o)),o.srcObject=i,o.play().catch(a=>{console.error("音频播放失败,需要用户交互触发",a)})}}handleSessionState(e,n,r){e.stateChange.addListener(i=>{switch(i){case he.Established:clearTimeout(this.callTimeoutTimer),this.activeSession=e,this.attachRemoteAudio(e);break;case he.Terminating:break;case he.Terminated:this.activeSession=null,clearTimeout(this.callTimeoutTimer);case he.Establishing:}})}handleIncomingCall(e){this.incomingInvitation=e,this.handleSessionState(e,!1),e.progress({statusCode:180,reasonPhrase:"Ringing"}).catch(n=>console.error("发送 180 失败",n)),G.get("direction")===xn.OUTGOING&&this.answerCall()}async answerCall(){var e;if(!this.incomingInvitation)throw new Error("无来电可接听");K.autoAnswerTimer&&(clearTimeout(K.autoAnswerTimer),K.autoAnswerTimer=null);try{await this.incomingInvitation.accept(),this.activeSession=this.incomingInvitation,this.incomingInvitation=null}catch(n){(e=this.eventCallback)==null||e.call(this,{type:Ar.WEB_RTC_ANSWER_FAILED,data:{detail:n}})}}async rejectInCall(){var e;if(this.incomingInvitation)try{await this.incomingInvitation.reject(),this.incomingInvitation=null,G.updateDirection(null),G.updateIsCalling(!1),clearTimeout(this.callTimeoutTimer)}catch(n){(e=this.eventCallback)==null||e.call(this,{type:"error",data:{message:"拒接失败",detail:n}})}}sendDTMF(e){var r;if(!this.activeSession)throw new Error("当前没有活跃的通话");const n=this.activeSession.sessionDescriptionHandler;n&&typeof n.sendDtmf=="function"?(n.sendDtmf(e),(r=this.eventCallback)==null||r.call(this,{type:Ar.WEB_RTC_SEND_DTMF,data:{tone:e}})):(console.warn("DTMF发送不支持或未初始化"),nn.warn("DTMF发送不支持或未初始化","sip-client.ts 490 sendDTMF"))}async hangup(){if(this.activeSession,this.activeSession){clearTimeout(this.callTimeoutTimer);const e=this.activeSession;if(!e)return;const n=e.state;try{n===he.Established?await e.bye():n===he.Establishing&&(e instanceof v0?await e.cancel():e instanceof eu&&await e.reject()),clearTimeout(this.callTimeoutTimer)}catch(r){nn.error("挂断失败","sip-client.ts 522 hangup"),console.error("挂断失败",r)}finally{this.activeSession=null}}}async rejectOutCall(){this.activeSession instanceof eu&&(await this.activeSession.reject(),this.activeSession=null)}async destroy(){if(this.isManuallyStopped=!0,clearTimeout(this.callTimeoutTimer),this.activeSession&&await this.hangup(),this.registerer){try{await this.registerer.unregister()}catch(e){console.warn("注销失败",e)}this.registerer=null}this.userAgent&&(await this.userAgent.stop(),this.userAgent=null)}async reconnect(){if(!K.isRtcReconnecting){K.isRtcReconnecting=!0;try{this.isManuallyStopped=!1,await this.destroy(),await this.start(),this.isOffline=!1,this.reconnectAttempts=0}catch(e){console.error("重连失败",e),K.isRtcReconnecting=!1}finally{K.isRtcReconnecting=!1}}}async getNetworkStats(){var e;if(this.activeSession){const n=(e=this.activeSession.sessionDescriptionHandler)==null?void 0:e.peerConnection;if(!n)return null;const r=await n.getStats(),i={};return r.forEach(o=>{o.type==="candidate-pair"&&o.state==="succeeded"&&o.currentRoundTripTime!=null&&(i.rtt=+(1e3*o.currentRoundTripTime).toFixed(2)),o.type==="inbound-rtp"&&o.kind==="audio"&&(i.jitter=+(1e3*o.jitter).toFixed(2),i.packetsLost=o.packetsLost,i.packetsReceived=o.packetsReceived,o.bytesReceived&&o.timestamp&&(i.recvBitrate=+(o.bytesReceived/1024).toFixed(2))),o.type==="outbound-rtp"&&o.kind==="audio"&&(i.packetsSent=o.packetsSent,o.bytesSent&&o.timestamp&&(i.sendBitrate=+(o.bytesSent/1024).toFixed(2))),o.type==="codec"&&o.mimeType&&(i.codec=o.mimeType)}),{...i,rtt:(i==null?void 0:i.rtt)||40}}return{rtt:K.latency||1}}}class To{static requestPermission(){"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()}static async requestMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(n=>n.kind==="audioinput"&&n.label!=="")?null:await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){return console.warn("获取音频权限失败:",e),null}}static show(e,n,r,i){if("Notification"in window&&Notification.permission==="granted"){const o=new Notification(e,{body:n,tag:`xy-global-notification${new Date().getTime()}`,renotify:!0});o.onclick=()=>{window.focus(),o.close(),r==null||r()},setTimeout(()=>o.close(),1e3*(i||3))}}static async checkMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind==="audioinput"&&e.label!=="")}catch(e){return console.warn("无法检查设备权限:",e),!1}}}const Fw=[],Vn=["call_number"],gA=["call_number"],kw=["hangup"],Ci=["hold","hangup","mute","transfer","consult","satisfaction","dtmf"],Yc=["hold","hangup","mute","transfer","consult"],Hg=["consult_transfer","conference","consult_retrieve"],Pw=["hangup"],Qw=["hangup"],Os=["answer","reject"],Gi=["hangup","consult","transfer","hold","mute","satisfaction","dtmf"],Gg=["hangup","whisper","force_insert","force_disconnect"],jw=["hangup"],Lw=["hangup","cancel_whisper","force_insert"],Uw=["hangup"],Hw=["hangup"];class ja{constructor(){this.roleData={agentInfo:()=>{var e;if(!((e=K.agentInfo)!=null&&e.agent_no))throw new Error(JSON.stringify({code:1,msg:"请先登录"}))},requestInfo:e=>{if(!e.data)throw new Error(JSON.stringify({code:1,msg:'Parameter "data" is required'}))},changeDevice:e=>{if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "device" is required'}));const{answer_devices:n}=K.agentInfo;if(!n.split(",").map(r=>Number(r)).includes(e))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}))},changeState:(e,n)=>{if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "state" is required'}));if(!n)throw new Error(JSON.stringify({code:1,msg:'Parameter "state_name" is required'}));if(e===2&&(n==="通话中"||n==="整理"))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}));if(![1,2].includes(e))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}))},setAgentExplicit:e=>{const{out_display_select_switch:n,out_display_data:r}=K.agentInfo;if(n!==1)throw new Error(JSON.stringify({code:1,msg:"当前坐席设置未开启允许指定外显"}));if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "number" is required'}));if(!(r||"").split("#").includes(e))throw new Error(JSON.stringify({code:1,msg:"当前外显号码不存在"}))}},this.changeDevice=async e=>{try{if(G.get("isCalling"))throw new Error(JSON.stringify({code:1,msg:"当前正在通话中,请勿切换设备"}));this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:n,success:r}=e,{device:i}=n;i===1&&await ja.initRtcFn(),this.roleData.changeDevice(i);const{agent_no:o}=K.agentInfo;await(s=>yn(`${Or}/device/change`,s))({agent_no:o,answer_device:i}),G.updateAnswerDevice(i);const a=G.get("actionConfigs");G.updateActionConfigs(a),i===2&&K.stateObject.state===Rt.UNREGISTERED&&await this._changeState({data:{...K.stateBeforeChange,state_name:K.stateBeforeChange.state===Rt.IDLE?"空闲":"忙碌"}},"q"),r==null||r({code:0,msg:"请求成功"})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}}formatDate(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}static setInitRtcFn(e){this.initRtcFn=e}async _agentLogin(e){try{const r=await(n={agent_no:e},yn(`${Or}/agent/login`,n));K.agentInfo=r.data}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}var n}async _changeState(e,n){try{K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:r,success:i}=e,{state:o,state_name:a}=r,{agent_no:s}=K.agentInfo;await Ug({agent_no:s,state_name:a,state:o},n),o===Rt.IDLE?G.updateActionConfigs(Vn):o===Rt.BUSY&&G.updateActionConfigs(gA),K.stateObject={state:o,state_name:a},i==null||i({code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async _getInCallCrmDetail(e){var n;try{const{phone:r}=e.data,i={};iu(r)?i.trace_id=r:i.phone=r.replace(/[\s\r\n-]+/g,"");const o=await(a=>yn(`${Yi}/crm/popups`,a))({...i});(n=e.success)==null||n.call(e,o)}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async changeState(e,n){try{if(G.get("isCalling"))throw new Error(JSON.stringify({code:1,msg:"当前正在通话中,请勿切换设备"}));K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:r,success:i}=e,{state:o,state_name:a}=r;this.roleData.changeState(o,a);const{agent_no:s}=K.agentInfo;await Ug({agent_no:s,state_name:a,state:o},n),(K.stateObject.state===Rt.IDLE||K.stateObject.state===Rt.BUSY&&a!=="整理")&&(K.stateBeforeChange=K.stateObject),o===Rt.IDLE?G.updateActionConfigs(Vn):o===Rt.BUSY&&G.updateActionConfigs(gA),K.stateObject={state:o,state_name:a},i==null||i({code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async getIdleAgentList(e){var r;const{agent_no:n}=K.agentInfo;try{this.roleData.agentInfo();const i=await(o=>yn(`${Or}/agent/free`,o))({agent_no:n});(r=e.success)==null||r.call(e,i)}catch(i){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(i.message).msg),i}}async getAgentState(e){var n;try{const r=await yn(`${Yi}/agent/statecfg/list`,{}),i=(r.data||[]).filter(o=>o.enable===0).filter(o=>o.state!==0&&o.state!==3).filter(o=>o.state_name!=="通话中"&&o.state_name!=="整理"&&o.state_name!=="未注册"&&o.state_name!=="离线接听").map(o=>({state:o.state,state_name:o.state_name})).reverse();(n=e.success)==null||n.call(e,{...r,data:i})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async setAgentExplicit(e){var n;try{this.roleData.agentInfo(),this.roleData.requestInfo(e),this.roleData.setAgentExplicit(e.data.number);const{agent_id:r}=K.agentInfo;await(i=>yn(`${Yi}/agent/update`,i))({agent_id:r,out_display_number:e.data.number}),G.updateSelectOutNumber(e.data.number),(n=e.success)==null||n.call(e,{code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async checkAgentLogin(e){var n;try{this.roleData.requestInfo(e);const{agent_no:r}=e.data;if(!r)throw new Error(JSON.stringify({code:1,msg:'Parameter "agent_no" is required'}));const i=await(o=>yn(`${Or}/agent/islogin`,o))({agent_no:r});(n=e.success)==null||n.call(e,i)}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async getCallRecord(e){try{this.roleData.agentInfo();const{success:n}=e,r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),0,0,0),o=new Date(r.getFullYear(),r.getMonth(),r.getDate(),23,59,59),a=[this.formatDate(i),this.formatDate(o)],{agent_no:s}=K.agentInfo,A=await(f=>yn(`${Yi}/agent/recordpage`,f))({start_time:a[0],end_time:a[1],page_no:1,page_size:10,agent_no:s}),{code:c,msg:u,data:d}=A;n==null||n({code:c,msg:u,data:d})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async logout(e){this.roleData.agentInfo();try{const{agent_no:n}=K.agentInfo,{data:r,success:i}=e;await(o=>yn(`${Or}/agent/logout`,o))({...r,agent_no:n}),i==null||i({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async listenCall(e){try{const{agent_no:n}=K.agentInfo,{data:r,success:i}=e;if(this.roleData.agentInfo(),this.roleData.requestInfo(e),!r.monitored_agent_no)throw new Error(JSON.stringify({code:1,msg:'Parameter "monitored_agent_no" is required'}));await(o=>yn(`${Or}/call/monitor`,o))({...r,monitor_agent_no:n}),K.monitoredAgentNo=r.monitored_agent_no,i==null||i({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async earCall(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>yn(`${Or}/call/whisper`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async stopEarCall(e){try{const{agentInfo:n,earSpeakAgent:r}=K;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前没有正在耳语的坐席"}));const{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;await(a=>yn(`${Or}/call/stopwhisper`,a))({monitor_agent_no:i,monitored_agent_no:r}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async forceInsert(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>yn(`${Or}/call/bargein`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async forceDisconnect(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>yn(`${Or}/call/intercept`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}}const Gw=console.log,qg=(...t)=>{K.logBuiltinEnabled&&Gw(...t)};let ni=null;class An{constructor(e,n){this.url=e,this.onOpenCallback=n,this.ws=null,this.heartbeatWorker=null,this.reconnectDelay=3e3,this.manualClose=!1,this.apiClient=new ja,this.sipClient=null,this.pendingMessages=new Map,this.initWebSocket()}static getInstance({url:e,sipClient:n,onOpen:r}){if(!ni){if(!e)throw new Error("WebSocket 尚未初始化");ni=new An(e,r),ni.sipClient=n}return ni}setSipClient(e){this.sipClient=e}stateIdleChange(e){const{state:n}=K.stateObject;n!==Rt.IDLE&&this.apiClient._changeState({data:{...K.stateBeforeChange,state_name:K.stateBeforeChange.state===Rt.IDLE?"空闲":"忙碌"}},e)}inCallAutoAnswer(){const{soft_device_auto_answer:e,auto_answer_time:n}=K.agentInfo,r=e===1,i=G.get("direction");if(r&&i===xn.INCOMING){const o=Number(n)||0;o>0&&(K.autoAnswerTimer=setTimeout(()=>{var a;(a=this.sipClient)==null||a.answerCall(),K.autoAnswerTimer=null},o>0?1e3*o-500:0))}}async getCustomerInfo(e){try{await this.apiClient._getInCallCrmDetail({data:{phone:e},success:n=>{G.updateCustomerInfo(n.data||{phone:n.data.phone,is_vip:0,customer_name:"未知客户",city:"未知",province:"未知",contact_count:0,in_contact_count:0,trace_id:n.data.trace_id,contact_count_month:0,in_contact_count_month:0})}})}catch{}}putAgentState(e,n){if(!e)return;if(n===5)return void this.stateIdleChange("device_type5");K.sessionId="";const{post_call_process_time:r}=K.agentInfo,i=r||0;if(K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),G.updateCustomerInfo(void 0),i>0){const{state:o}=K.stateObject;if(o===Rt.IDLE)return;this.apiClient._changeState({data:{state:Rt.BUSY,state_name:"整理"}},"ez"),K.autoStateTimer=setTimeout(()=>{K.autoStateTimer=null,this.stateIdleChange(`delay${i}`)},1e3*i)}else this.stateIdleChange("delay0")}stateBusyChange(){K.sessionId="",clearTimeout(K.autoStateTimer),G.updateCustomerInfo(void 0),this.apiClient._changeState({data:{state:Rt.BUSY,state_name:"忙碌"}},"dm")}initWebSocket(){var n;if(((n=this.ws)==null?void 0:n.readyState)===1||!G.get("isNextState")||this.manualClose)return;const e=P0(Kd,Vd);this.ws=new WebSocket(this.url+e),this.ws.onopen=()=>{const r=new Date().getTime();this.sendMessage({type:0,msg_id:r}),this.pendingMessages.set(r,performance.now()),this.startHeartbeat(),this.manualClose=!1,this.onOpenCallback&&this.onOpenCallback()},this.ws.onmessage=async r=>{var u;const i=JSON.parse(r.data),{type:o,data:a,code:s,msg:A,msg_id:c}=i;if(o===0&&c){const d=this.pendingMessages.get(c),f=performance.now()-d;K.latency=parseFloat(f.toFixed(2)),this.pendingMessages.delete(c)}if(o!==0&&qg("%cWebSocket 收到消息:","color: blue; font-weight: bold;",i),o!==it.OUT_CALL&&o!==it.PREVIEW_OUT_CALL||(K.isAgentHangup=!1,s!==0?(G.reset(),fe.emit(ie.OUT_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A),G.updateActionConfigs(Vn),setTimeout(()=>{G.updateCustomerInfo(void 0)},500),this.stateIdleChange("h")):s===0&&(fe.emit(ie.OUT_SUCCESS),K.sessionId=a.session_id,G.updateIsCalling(!0),clearTimeout(K.autoStateTimer))),o===it.AGENT_STATE){const{state:d,state_name:f}=a;K.stateObject={state:d,state_name:f},(u=K.stateBeforeChange)!=null&&u.state||K.stateObject.state!==Rt.IDLE&&(K.stateObject.state!==Rt.BUSY||f==="整理")||(K.stateBeforeChange=K.stateObject),f==="振铃中"&&G.updateDisplayText(Kt.AGENT_RINGING);const p=G.get("isCalling");d!==Rt.UNREGISTERED||p||G.updateActionConfigs(Fw),d===Rt.IDLE&&K.stateObject.state===Rt.UNREGISTERED&&G.updateActionConfigs(Vn),fe.emit(ie.AGENT_STATE,{state:d,state_name:f})}else if(o===it.OUT_CALL_INCOMING_CALL){K.isAgentHangup=!1;try{await this.getCustomerInfo(a.trace_id||a.customer_phone)}catch(d){console.error(d)}a.preview_task_id?fe.emit(ie.PREVIEW_OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,preview_task_id:a.preview_task_id,trace_id:a.trace_id}):a.direction===0?fe.emit(ie.OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,trace_id:a.trace_id}):a.direction===8&&fe.emit(ie.INTERNAL_OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,trace_id:a.trace_id}),K.sessionId=a.session_id,G.updateActionConfigs(kw,a.direction!==8)}else if(o===it.OUT_CALL_END){if(K.sessionId!==a.session_id)return;if(G.updateDisplayText(""),a.device_type===1&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===2&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUR_SIDE_CONSULT_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===2&&a.agent_no!==K.agentInfo.agent_no)G.get("isCalling")&&(G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Ci));else if(a.device_type===3&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.THREE_WAY_OUR_SIDE_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===4&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.TRANSFER_END,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===4&&a.agent_no!==K.agentInfo.agent_no){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===xn.OUTGOING?G.updateActionConfigs(Ci):d===xn.INCOMING&&G.updateActionConfigs(Gi)}else a.device_type===5&&a.agent_no===K.agentInfo.agent_no&&(K.monitoredAgentNo="",K.earSpeakAgent="",G.reset(),fe.emit(ie.LISTEN_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0,5))}else if(o===it.OUT_CALL_RINGING)a.type===1&&(K.isAgentHangup=!1,fe.emit(ie.OUT_RINGING,{session_id:K.sessionId,type:a.type}),G.updateDisplayText(Kt.RINGING));else if(o===it.OUT_CALL_ANSWER)K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),G.updateIsCalling(!0),G.updateOutCallIsAnswer(!0),G.updateDisplayText(Kt.CALLING),a.direction===8?(fe.emit(ie.INTERNAL_OUT_OFF_ANSWER,{session_id:K.sessionId}),G.updateActionConfigs(Yc)):(fe.emit(ie.OUT_OFF_ANSWER,{session_id:K.sessionId}),G.updateActionConfigs(Ci));else if(o===it.CONSULT_RINGING)K.isAgentHangup=!1,fe.emit(ie.CONSULT_RINGING,{session_id:a.session_id}),G.updateDisplayText(Kt.AGENT_RINGING),G.updateActionConfigs([]),clearTimeout(K.autoStateTimer);else if(o===it.CONSULT_ANSWER)K.isAgentHangup=!1,fe.emit(ie.CONSULT_OFF_HOOK,{session_id:a.session_id}),G.updateConsultIsAnswer(!0),G.updateDisplayText(Kt.CONSULTING),G.updateActionConfigs(Hg);else if(o===it.CONSULT_FAIL)fe.emit(ie.CONSULT_FAILED,{custom_reason:a.custom_reason}),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Ci);else if(o===it.CONSULT_CALL_IN)K.isAgentHangup=!1,fe.emit(ie.CONSULT_INCOMING,{agent_no:a.agent_no,agent_mane:a.agent_name,session_id:a.session_id}),K.sessionId=a.session_id,G.updateIsCalling(!0),G.updateDirection(xn.CONSULT),G.updateDisplayText(Kt.CONSULT_CALL_IN),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 咨询来电",`坐席 [${a.agent_name}] 正在咨询...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{agent_mane:a.agent_name,agent_no:a.agent_no})},K.browserAlertTime);else if(o===it.CONSULT_CALL_IN_SUCCESS)fe.emit(ie.CONSULT_CALL_IN_SUCCESS,{session_id:a.session_id}),G.updateConsultIsAnswer(!0),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Pw);else if(o===it.CONSULT_RETURN_CALL_SUCCESS)a.status==="success"?(G.updateConsultIsAnswer(!1),fe.emit(ie.CONSULT_RETURN_CALL_SUCCESS),G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP),G.updateActionConfigs(Ci)):fe.emit(He.FAIL_NOTIFICATION,"媒体失败");else if(o===it.MUTE)s===0?(G.updateIsMuted(!0),fe.emit(ie.MUTE_SUCCESS),G.updateDisplayText(Kt.MUTING)):(fe.emit(ie.MUTE_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.UNMUTE)s===0?(G.updateIsMuted(!1),fe.emit(ie.UNMUTE_SUCCESS),G.updateDisplayText(Kt.CALLING)):(fe.emit(ie.UNMUTE_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CALL_HOLD)s===0?(G.updateIsHold(!0),G.updateDisplayText(Kt.HOLDING),fe.emit(ie.HOLD_SUCCESS)):(fe.emit(ie.HOLD_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CALL_UNHOLD)s===0?(G.updateDisplayText(Kt.CALLING),G.updateIsHold(!1),fe.emit(ie.UNHOLD_SUCCESS)):(fe.emit(ie.UNHOLD_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_TRANSFER)K.isAgentHangup=!1,s===0?fe.emit(ie.CONSULT_TRANSFER_SUCCESS):(fe.emit(ie.CONSULT_TRANSFER_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_TRANSFER_FAILED)fe.emit(ie.CONSULT_TRANSFER_FAILED,a.status);else if(o===it.CONSULT_TRANSFER_OFF_HOOK)G.updateDirection(xn.INCOMING),G.updateDisplayText(Kt.CALLING),fe.emit(ie.CONSULT_TRANSFER_OFF_HOOK),G.updateActionConfigs(Gi),G.updateIncomingIsAnswer(!0),G.updateConsultIsAnswer(!1);else if(o===it.INCOMING_CALL){K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),K.sessionId=a.session_id;try{await this.getCustomerInfo(a.trace_id||a.customer_phone)}catch(d){console.error(d)}G.updateIsCalling(!0),G.updateDirection(xn.INCOMING),G.updateDisplayText(Kt.INCOMING_CALL),this.inCallAutoAnswer(),a.direction===1&&fe.emit(ie.INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id}),a.direction===8&&fe.emit(ie.INCOMING_CALL_IN,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id}),a.direction===3&&fe.emit(ie.PREDICT_INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id}),a.direction===6&&fe.emit(ie.DUAL_CALL_INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id}),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 客户来电",`客户 [${a.customer_phone}] 正在呼入...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{customer_phone:a.customer_phone})},K.browserAlertTime)}else if(o===it.INCOMING_CALL_OFF_HOOK)G.updateIncomingIsAnswer(!0),a.direction===8?(G.updateActionConfigs(Yc),fe.emit(ie.INCOMING_CALL_IN_OFF_HOOK,{session_id:K.sessionId})):(G.updateActionConfigs(Gi),fe.emit(ie.INCOMING_CALL_OFF_HOOK,{session_id:K.sessionId})),G.updateDisplayText(Kt.CALLING);else if(o===it.INCOMING_CALL_END){if(K.sessionId!==a.session_id)return;if(G.updateDisplayText(""),a.device_type!==1&&a.device_type!==7||a.agent_no!==K.agentInfo.agent_no)if(a.device_type===2&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUR_SIDE_CONSULT_HANGUP,{session_id:a.session_id}),this.putAgentState(!0),G.updateActionConfigs(Vn);else if(a.device_type===2&&a.agent_no!==K.agentInfo.agent_no)G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Ci);else if(a.device_type===3&&a.agent_no===K.agentInfo.agent_no)this.putAgentState(!0),G.reset(),fe.emit(ie.THREE_WAY_OUR_SIDE_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn);else if(a.device_type===4&&a.agent_no===K.agentInfo.agent_no)this.putAgentState(!0),G.reset(),fe.emit(ie.TRANSFER_END,{session_id:a.session_id}),G.updateActionConfigs(Vn);else if(a.device_type===4&&a.agent_no!==K.agentInfo.agent_no){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===xn.OUTGOING?G.updateActionConfigs(Ci):d===xn.INCOMING&&G.updateActionConfigs(Gi)}else a.device_type===5&&a.agent_no===K.agentInfo.agent_no&&(this.putAgentState(!0,5),K.monitoredAgentNo="",K.earSpeakAgent="",G.reset(),fe.emit(ie.LISTEN_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn));else this.putAgentState(!0),G.reset(),fe.emit(ie.INCOMING_CALL_END,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Vn)}else if(o===it.SATISFACTION_EVALUATION)s===0?fe.emit(ie.SATISFACTION_EVALUATION_SUCCESS):(fe.emit(ie.SATISFACTION_EVALUATION_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_THREE_WAY)s!==0?(fe.emit(ie.CONSULT_THREE_WAY_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A)):s===0&&G.updateIsMeeting(!0);else if(o===it.CONSULT_THREE_WAY_RESULT)a.status==="success"?(G.updateDirection(xn.MEETING),G.updateDisplayText(Kt.MEETING),G.updateActionConfigs(Qw),fe.emit(ie.CONSULT_THREE_WAY_SUCCESS)):(fe.emit(ie.CONSULT_THREE_WAY_FAILED,{conf_name:a.conf_name}),G.updateIsMeeting(!1));else if(o===it.TRANSFER_INCOMING_CALL)K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),a.agent_no===K.agentInfo.agent_no?(G.updateDisplayText(Kt.TRANSFERRING),fe.emit(ie.TRANSFER_PROGRESS),G.updateActionConfigs([]),G.updateTransferIsAnswer(!0)):(K.sessionId=a.session_id,fe.emit(ie.TRANSFER_INCOMING_CALL,{agent_no:a.agent_no,agent_name:a.agent_name,session_id:a.session_id}),G.updateIsCalling(!0),G.updateDirection(xn.TRANSFER),G.updateDisplayText(Kt.TRANSFER_INCOMING_CALL),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 转接来电",`坐席 [${a.agent_no}] 正在转接...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{agent_no:a.agent_no})},K.browserAlertTime));else if(o===it.TRANSFER_OFF_HOOK)fe.emit(ie.TRANSFER_OFF_HOOK,{session_id:K.sessionId}),G.updateTransferIsAnswer(!1),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Gi,a.direction!==8);else if(o===it.TRANSFER_FAILED){if(a.status==="failed"){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===xn.OUTGOING?G.updateActionConfigs(Ci):d===xn.INCOMING&&G.updateActionConfigs(Gi)}}else o===it.KICK_OFFLINE?fe.emit(He.KICK_OFF):o===it.CONTINUOUS_NOT_ANSWER?(fe.emit(He.FAIL_NOTIFICATION,`已连续 ${a.miss_count} 次未接, 设置忙碌`),this.stateBusyChange()):o===it.SIGN_OUT?fe.emit(He.SIGN_OUT):o===it.SIGN_IN_SWITCH_DEVICE?fe.emit(He.SIGN_IN_SWITCH_DEVICE,a):o===it.LISTEN_INCOMING_CALL?(clearTimeout(K.autoStateTimer),K.sessionId=a.session_id,G.updateIsCalling(!0),G.updateDirection(xn.INCOMING),this.inCallAutoAnswer(),G.updateDisplayText(Kt.LISTENING),G.updateActionConfigs(Os),fe.emit(ie.LISTEN_INCOMING_CALL,{session_id:a.session_id}),K.enableBrowserAlert&&To.show("📞 监听来电","正在来电...",()=>{fe.emit(He.NOTIFICATION_CLICK,{customer_phone:a.customer_phone})},K.browserAlertTime)):o===it.LISTEN_INCOMING_CALL_OFF_HOOK?(K.monitoredAgentNo=a.monitored_agent_no,K.earSpeakAgent="",G.updateIncomingIsAnswer(!0),fe.emit(ie.LISTEN_INCOMING_CALL_OFF_HOOK,{session_id:K.sessionId,monitored_agent_no:a.monitored_agent_no}),G.updateActionConfigs(Gg),G.updateDisplayText(Kt.CALLING)):o===it.LISTEN_CALL_FAILED?a.status==="failed"&&(fe.emit(ie.LISTEN_CALL_FAILED),K.monitoredAgentNo=""):o===it.EAR_SPEECH?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(jw),fe.emit(ie.EAR_SPEECH_BE_SUCCESS)),a.monitor_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Lw),fe.emit(ie.EAR_SPEECH_SUCCESS,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no}),K.earSpeakAgent=a.monitored_agent_no)):fe.emit(ie.EAR_SPEECH_FAILED):o===it.STOP_EAR_SPEECH?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&G.updateActionConfigs(Gi),a.monitor_agent_no===K.agentInfo.agent_no&&G.updateActionConfigs(Gg),K.earSpeakAgent="",fe.emit(ie.STOP_EAR_SPEECH_SUCCESS)):fe.emit(ie.STOP_EAR_SPEECH_FAILED):o===it.CALL_FORCE_INSERT?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Hw),fe.emit(ie.CALL_FORCE_INSERT_SUCCESS,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no})),a.monitor_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Uw),fe.emit(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no}))):fe.emit(ie.CALL_FORCE_INSERT_FAILED):o===it.INTERNAL_CALL_START_CONSULT?a.agent_no===K.agentInfo.agent_no?(G.updateConsultIsAnswer(!0),G.updateActionConfigs(Hg),G.updateDisplayText(Kt.CONSULTING)):(G.updateDisplayText(Kt.OTHER_SIDE_CONSULTING),G.updateActionConfigs([])):o===it.INTERNAL_CALL_END_CONSULT?(G.updateActionConfigs(Yc),G.updateDisplayText(""),G.updateConsultIsAnswer(!1)):o===it.CALL_SIP_INCOMING_CALL&&fe.emit(ie.CALL_SIP_INCOMING_CALL)},this.ws.onclose=r=>{fe.emit(He.FAIL_NOTIFICATION,"链接已断开,请检查网络"),this.stopHeartbeat();const i=G.get("isNextState");!this.manualClose&&i&&setTimeout(()=>this.initWebSocket(),this.reconnectDelay)},this.ws.onerror=r=>{var i;fe.emit(He.FAIL_NOTIFICATION,"连接失败,请检查网络"),(i=this.ws)==null||i.close()}}startHeartbeat(){const e=new Blob([`
|
|
163
|
+
*/Vc=k0,function(){var t="input is invalid type",e=typeof window=="object",n=e?window:{};n.JS_MD5_NO_WINDOW&&(e=!1);var r=!e&&typeof self=="object",i=!n.JS_MD5_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;i?n=Tw:r&&(n=self);var o,a=!n.JS_MD5_NO_COMMON_JS&&Vc.exports,s=!n.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",A="0123456789abcdef".split(""),c=[128,32768,8388608,-2147483648],u=[0,8,16,24],d=["hex","array","digest","buffer","arrayBuffer","base64"],f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),p=[];if(s){var v=new ArrayBuffer(68);o=new Uint8Array(v),p=new Uint32Array(v)}var C=Array.isArray;!n.JS_MD5_NO_NODE_JS&&C||(C=function(E){return Object.prototype.toString.call(E)==="[object Array]"});var m=ArrayBuffer.isView;!s||!n.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&m||(m=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});var y=function(E){var b=typeof E;if(b==="string")return[E,!0];if(b!=="object"||E===null)throw new Error(t);if(s&&E.constructor===ArrayBuffer)return[new Uint8Array(E),!1];if(!C(E)&&!m(E))throw new Error(t);return[E,!1]},w=function(E){return function(b){return new x(!0).update(b)[E]()}},I=function(E){var b,h=Og,S=Og.Buffer;return b=S.from&&!n.JS_MD5_NO_BUFFER_FROM?S.from:function(T){return new S(T)},function(T){if(typeof T=="string")return h.createHash("md5").update(T,"utf8").digest("hex");if(T==null)throw new Error(t);return T.constructor===ArrayBuffer&&(T=new Uint8Array(T)),C(T)||m(T)||T.constructor===S?h.createHash("md5").update(b(T)).digest("hex"):E(T)}},O=function(E){return function(b,h){return new g(b,!0).update(h)[E]()}};function x(E){if(E)p[0]=p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0,this.blocks=p,this.buffer8=o;else if(s){var b=new ArrayBuffer(68);this.buffer8=new Uint8Array(b),this.blocks=new Uint32Array(b)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function g(E,b){var h,S=y(E);if(E=S[0],S[1]){var T,R=[],D=E.length,B=0;for(h=0;h<D;++h)(T=E.charCodeAt(h))<128?R[B++]=T:T<2048?(R[B++]=192|T>>>6,R[B++]=128|63&T):T<55296||T>=57344?(R[B++]=224|T>>>12,R[B++]=128|T>>>6&63,R[B++]=128|63&T):(T=65536+((1023&T)<<10|1023&E.charCodeAt(++h)),R[B++]=240|T>>>18,R[B++]=128|T>>>12&63,R[B++]=128|T>>>6&63,R[B++]=128|63&T);E=R}E.length>64&&(E=new x(!0).update(E).array());var k=[],P=[];for(h=0;h<64;++h){var H=E[h]||0;k[h]=92^H,P[h]=54^H}x.call(this,b),this.update(P),this.oKeyPad=k,this.inner=!0,this.sharedMemory=b}x.prototype.update=function(E){if(this.finalized)throw new Error("finalize already called");var b=y(E);E=b[0];for(var h,S,T=b[1],R=0,D=E.length,B=this.blocks,k=this.buffer8;R<D;){if(this.hashed&&(this.hashed=!1,B[0]=B[16],B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),T)if(s)for(S=this.start;R<D&&S<64;++R)(h=E.charCodeAt(R))<128?k[S++]=h:h<2048?(k[S++]=192|h>>>6,k[S++]=128|63&h):h<55296||h>=57344?(k[S++]=224|h>>>12,k[S++]=128|h>>>6&63,k[S++]=128|63&h):(h=65536+((1023&h)<<10|1023&E.charCodeAt(++R)),k[S++]=240|h>>>18,k[S++]=128|h>>>12&63,k[S++]=128|h>>>6&63,k[S++]=128|63&h);else for(S=this.start;R<D&&S<64;++R)(h=E.charCodeAt(R))<128?B[S>>>2]|=h<<u[3&S++]:h<2048?(B[S>>>2]|=(192|h>>>6)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]):h<55296||h>=57344?(B[S>>>2]|=(224|h>>>12)<<u[3&S++],B[S>>>2]|=(128|h>>>6&63)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]):(h=65536+((1023&h)<<10|1023&E.charCodeAt(++R)),B[S>>>2]|=(240|h>>>18)<<u[3&S++],B[S>>>2]|=(128|h>>>12&63)<<u[3&S++],B[S>>>2]|=(128|h>>>6&63)<<u[3&S++],B[S>>>2]|=(128|63&h)<<u[3&S++]);else if(s)for(S=this.start;R<D&&S<64;++R)k[S++]=E[R];else for(S=this.start;R<D&&S<64;++R)B[S>>>2]|=E[R]<<u[3&S++];this.lastByteIndex=S,this.bytes+=S-this.start,S>=64?(this.start=S-64,this.hash(),this.hashed=!0):this.start=S}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,b=this.lastByteIndex;E[b>>>2]|=c[3&b],b>=56&&(this.hashed||this.hash(),E[0]=E[16],E[16]=E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=0),E[14]=this.bytes<<3,E[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},x.prototype.hash=function(){var E,b,h,S,T,R,D=this.blocks;this.first?b=((b=((E=((E=D[0]-680876937)<<7|E>>>25)-271733879|0)^(h=((h=(-271733879^(S=((S=(-1732584194^2004318071&E)+D[1]-117830708)<<12|S>>>20)+E|0)&(-271733879^E))+D[2]-1126478375)<<17|h>>>15)+S|0)&(S^E))+D[3]-1316259209)<<22|b>>>10)+h|0:(E=this.h0,b=this.h1,h=this.h2,b=((b+=((E=((E+=((S=this.h3)^b&(h^S))+D[0]-680876936)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[1]-389564586)<<12|S>>>20)+E|0)&(E^b))+D[2]+606105819)<<17|h>>>15)+S|0)&(S^E))+D[3]-1044525330)<<22|b>>>10)+h|0),b=((b+=((E=((E+=(S^b&(h^S))+D[4]-176418897)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[5]+1200080426)<<12|S>>>20)+E|0)&(E^b))+D[6]-1473231341)<<17|h>>>15)+S|0)&(S^E))+D[7]-45705983)<<22|b>>>10)+h|0,b=((b+=((E=((E+=(S^b&(h^S))+D[8]+1770035416)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[9]-1958414417)<<12|S>>>20)+E|0)&(E^b))+D[10]-42063)<<17|h>>>15)+S|0)&(S^E))+D[11]-1990404162)<<22|b>>>10)+h|0,b=((b+=((E=((E+=(S^b&(h^S))+D[12]+1804603682)<<7|E>>>25)+b|0)^(h=((h+=(b^(S=((S+=(h^E&(b^h))+D[13]-40341101)<<12|S>>>20)+E|0)&(E^b))+D[14]-1502002290)<<17|h>>>15)+S|0)&(S^E))+D[15]+1236535329)<<22|b>>>10)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[1]-165796510)<<5|E>>>27)+b|0)^b))+D[6]-1069501632)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[11]+643717713)<<14|h>>>18)+S|0)^S))+D[0]-373897302)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[5]-701558691)<<5|E>>>27)+b|0)^b))+D[10]+38016083)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[15]-660478335)<<14|h>>>18)+S|0)^S))+D[4]-405537848)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[9]+568446438)<<5|E>>>27)+b|0)^b))+D[14]-1019803690)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[3]-187363961)<<14|h>>>18)+S|0)^S))+D[8]+1163531501)<<20|b>>>12)+h|0,b=((b+=((S=((S+=(b^h&((E=((E+=(h^S&(b^h))+D[13]-1444681467)<<5|E>>>27)+b|0)^b))+D[2]-51403784)<<9|S>>>23)+E|0)^E&((h=((h+=(E^b&(S^E))+D[7]+1735328473)<<14|h>>>18)+S|0)^S))+D[12]-1926607734)<<20|b>>>12)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[5]-378558)<<4|E>>>28)+b|0))+D[8]-2022574463)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[11]+1839030562)<<16|h>>>16)+S|0))+D[14]-35309556)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[1]-1530992060)<<4|E>>>28)+b|0))+D[4]+1272893353)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[7]-155497632)<<16|h>>>16)+S|0))+D[10]-1094730640)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[13]+681279174)<<4|E>>>28)+b|0))+D[0]-358537222)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[3]-722521979)<<16|h>>>16)+S|0))+D[6]+76029189)<<23|b>>>9)+h|0,b=((b+=((R=(S=((S+=((T=b^h)^(E=((E+=(T^S)+D[9]-640364487)<<4|E>>>28)+b|0))+D[12]-421815835)<<11|S>>>21)+E|0)^E)^(h=((h+=(R^b)+D[15]+530742520)<<16|h>>>16)+S|0))+D[2]-995338651)<<23|b>>>9)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[0]-198630844)<<6|E>>>26)+b|0)|~h))+D[7]+1126891415)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[14]-1416354905)<<15|h>>>17)+S|0)|~E))+D[5]-57434055)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[12]+1700485571)<<6|E>>>26)+b|0)|~h))+D[3]-1894986606)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[10]-1051523)<<15|h>>>17)+S|0)|~E))+D[1]-2054922799)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[8]+1873313359)<<6|E>>>26)+b|0)|~h))+D[15]-30611744)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[6]-1560198380)<<15|h>>>17)+S|0)|~E))+D[13]+1309151649)<<21|b>>>11)+h|0,b=((b+=((S=((S+=(b^((E=((E+=(h^(b|~S))+D[4]-145523070)<<6|E>>>26)+b|0)|~h))+D[11]-1120210379)<<10|S>>>22)+E|0)^((h=((h+=(E^(S|~b))+D[2]+718787259)<<15|h>>>17)+S|0)|~E))+D[9]-343485551)<<21|b>>>11)+h|0,this.first?(this.h0=E+1732584193|0,this.h1=b-271733879|0,this.h2=h-1732584194|0,this.h3=S+271733878|0,this.first=!1):(this.h0=this.h0+E|0,this.h1=this.h1+b|0,this.h2=this.h2+h|0,this.h3=this.h3+S|0)},x.prototype.hex=function(){this.finalize();var E=this.h0,b=this.h1,h=this.h2,S=this.h3;return A[E>>>4&15]+A[15&E]+A[E>>>12&15]+A[E>>>8&15]+A[E>>>20&15]+A[E>>>16&15]+A[E>>>28&15]+A[E>>>24&15]+A[b>>>4&15]+A[15&b]+A[b>>>12&15]+A[b>>>8&15]+A[b>>>20&15]+A[b>>>16&15]+A[b>>>28&15]+A[b>>>24&15]+A[h>>>4&15]+A[15&h]+A[h>>>12&15]+A[h>>>8&15]+A[h>>>20&15]+A[h>>>16&15]+A[h>>>28&15]+A[h>>>24&15]+A[S>>>4&15]+A[15&S]+A[S>>>12&15]+A[S>>>8&15]+A[S>>>20&15]+A[S>>>16&15]+A[S>>>28&15]+A[S>>>24&15]},x.prototype.toString=x.prototype.hex,x.prototype.digest=function(){this.finalize();var E=this.h0,b=this.h1,h=this.h2,S=this.h3;return[255&E,E>>>8&255,E>>>16&255,E>>>24&255,255&b,b>>>8&255,b>>>16&255,b>>>24&255,255&h,h>>>8&255,h>>>16&255,h>>>24&255,255&S,S>>>8&255,S>>>16&255,S>>>24&255]},x.prototype.array=x.prototype.digest,x.prototype.arrayBuffer=function(){this.finalize();var E=new ArrayBuffer(16),b=new Uint32Array(E);return b[0]=this.h0,b[1]=this.h1,b[2]=this.h2,b[3]=this.h3,E},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.base64=function(){for(var E,b,h,S="",T=this.array(),R=0;R<15;)E=T[R++],b=T[R++],h=T[R++],S+=f[E>>>2]+f[63&(E<<4|b>>>4)]+f[63&(b<<2|h>>>6)]+f[63&h];return E=T[R],S+=f[E>>>2]+f[E<<4&63]+"=="},g.prototype=new x,g.prototype.finalize=function(){if(x.prototype.finalize.call(this),this.inner){this.inner=!1;var E=this.array();x.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(E),x.prototype.finalize.call(this)}};var M=function(){var E=w("hex");i&&(E=I(E)),E.create=function(){return new x},E.update=function(S){return E.create().update(S)};for(var b=0;b<d.length;++b){var h=d[b];E[h]=w(h)}return E}();M.md5=M,M.md5.hmac=function(){var E=O("hex");E.create=function(S){return new g(S)},E.update=function(S,T){return E.create(S).update(T)};for(var b=0;b<d.length;++b){var h=d[b];E[h]=O(h)}return E}(),a?Vc.exports=M:n.md5=M}();var Nw=k0.exports;const P0=(t,e)=>{const n=Date.now(),r=`${t}:${n}:${Nw.md5(`${e}${n}`)}`,i=new TextEncoder().encode(r);return btoa(String.fromCharCode(...i))},iu=t=>{if(/^\d+$/.test(t)||!t||typeof t!="string"||t.length%4!=0||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t))return!1;try{const e=atob(t);return btoa(e)===t}catch{return!1}},Yi="/v1/aicc/bmserver",Or="/v1/aicc/ccs";let Si="",Kd="",Vd="",zc="";function Q0(t){const e=P0(Kd,Vd);return Mw.create({prefixUrl:`${Si}`,timeout:!1,headers:{Authorization:e,...t},hooks:{afterResponse:[async(n,r,i)=>{if(i.url.indexOf("heartbeat")!==-1)return i;const o=await i.clone().json();if(o.code!==0)throw new Error(JSON.stringify(o)||"请求失败");return i.json=async()=>o,i}]}})}async function yn(t,e,n){const r=Q0(n),i="api/"+t.replace(/^\/+/,"");return r.post(i,{json:e}).json()}const Ug=(t,e)=>yn(`${Or}/state/change?h=${e}`,t,{h:e}),Dw=()=>async function(t,e){const n=Q0(),r=t.replace(/^\/+/,"");return n.post(r,{json:e}).json()}("/heartbeat",{});class nn{static log(e,n={}){const{level:r="info",module:i="",timestamp:o=!0}=n;if(K.logBuiltinEnabled){const A=i?`[${i}]`:"",c=o?`[${new Date().toLocaleString()}]`:"";switch(r){case"debug":break;case"warn":console.warn(`${c}${A} ${e}`);break;case"error":console.error(`${c}${A} ${e}`)}}const a=K.agentInfo.agent_no;if(a){const A=JSON.stringify({level:r,module:i,content:e,timestamp:new Date().toISOString()});(s={agent_no:a,content:A},yn("/v1/aicc/ccs/softphone/log",s)).catch(()=>{})}var s}static debug(e,n){this.log(e,{level:"debug",module:n})}static info(e,n){this.log(e,{level:"info",module:n})}static warn(e,n){this.log(e,{level:"warn",module:n})}static error(e,n){this.log(e,{level:"error",module:n})}static errorObj(e,n){const r=JSON.stringify({message:e.message,stack:e.stack,name:e.name});this.log(r,{level:"error",module:n})}}class Bw{constructor(e,n){this.config=e,this.eventCallback=n,this.userAgent=null,this.registerer=null,this.activeSession=null,this.callTimeoutTimer=null,this.incomingInvitation=null,this.reconnectAttempts=0,this.maxReconnectAttempts=5,this.reconnectTimer=null,this.isOffline=!1,this.isManuallyStopped=!1,this.registerInterval=6e4,this.handleNetworkInfoChange=r=>{var i,o;if((i=r.rttObject)!=null&&i.rtt){const a=(o=r.rttObject)==null?void 0:o.rtt,s=a!=null&&a>0;s||this.isOffline?s&&this.isOffline&&(this.isOffline=!1,this.handleOnline()):(this.isOffline=!0,this.handleOffline())}},this.handleOffline=()=>{nn.warn("网络断开,准备销毁 SIP 客户端","sip-client.ts 75 handleOffline"),fe.emit(He.FAIL_NOTIFICATION,"网络断开,准备销毁 SIP 客户端"),this.destroy()},this.handleOnline=()=>{nn.warn("网络恢复,准备重新启动 SIP 客户端","sip-client.ts 82 handleOnline"),this.reconnect()},this.sleep=r=>new Promise(i=>setTimeout(i,r)),T0.subscribe(this.handleNetworkInfoChange)}async start(){const e=Fg.makeURI(`sip:${this.config.user}@${this.config.server}`);if(!e)throw new Error("无效的SIP配置");const n={uri:e,authorizationUsername:this.config.user,authorizationPassword:this.config.password,sendInitialProvisionalResponse:!1,transportOptions:{server:this.config.webSocket,connectionTimeout:10,keepAliveInterval:20,keepAliveDebounce:10},contactName:this.config.user,contactParams:{transport:"wss"},userAgentString:"SwiftSIP/2.0.21",sessionDescriptionHandlerFactoryOptions:{alwaysAcquireMediaFirst:!0,peerConnectionConfiguration:{iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceCandidatePoolSize:0,iceTransportPolicy:"all",rtcpMuxPolicy:"require",bundlePolicy:"balanced",certificates:void 0,peerIdentity:void 0},iceGatheringTimeout:1e3},logBuiltinEnabled:K.logBuiltinEnabled};this.userAgent=new Fg(n),this.setupEventListeners(),await this.userAgent.start(),await this.register()}setupEventListeners(){this.userAgent&&(this.userAgent.transport.stateChange.addListener(e=>{var r;let n;switch(e){case dt.Connecting:n=Ar.WEB_RTC_CONNECTING;break;case dt.Connected:n=Ar.WEB_RTC_CONNECTED,this.reconnectAttempts=0,K.isRtcReconnecting=!1,G.updateIsSipConnected(!0),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);break;case dt.Disconnecting:n=Ar.WEB_RTC_DISCONNECTING,G.updateIsSipConnected(!1);break;case dt.Disconnected:{if(G.updateIsSipConnected(!1),this.isManuallyStopped)return nn.warn("手动断开,不触发重连","sip-client.ts 204"),void console.warn("[SIP] 手动断开,不触发重连");fe.emit(He.FAIL_NOTIFICATION,"软电话链接失败"),n=Ar.WEB_RTC_DISCONNECTED;const i=G.get("answerDevice");if(!K.isRtcReconnecting&&this.reconnectAttempts<this.maxReconnectAttempts&&i===1){this.reconnectAttempts++;const o=1e3*this.reconnectAttempts;nn.warn(`SIP WebSocket 断开,第 ${this.reconnectAttempts} 次尝试重连,${o}ms 后重试...`,"sip-client.ts 219"),this.reconnectTimer=setTimeout(()=>{this.reconnect()},o)}else this.reconnectAttempts>=this.maxReconnectAttempts&&(nn.warn(`SIP 重连失败:已达到最大重试次数; reconnectAttempts: ${this.reconnectAttempts}; maxReconnectAttempts: ${this.maxReconnectAttempts}`,"sip-client.ts 228"),console.error("SIP 重连失败:已达到最大重试次数"),fe.emit(He.FAIL_NOTIFICATION,"SIP 重连失败:已达到最大重试次数"));break}default:G.updateIsSipConnected(!1),n="unknown"}(r=this.eventCallback)==null||r.call(this,{type:n})}),this.userAgent.delegate={onInvite:e=>{this.handleIncomingCall(e)}})}async refreshRegister(){if(this.registerer)try{await this.registerer.register(),new Date().toLocaleTimeString()}catch(e){console.error("[SIPClient] REGISTER刷新失败",e)}}async register(){var e,n;if(this.userAgent){this.registerer=new tu(this.userAgent,{expires:120,refreshFrequency:80}),(e=this.registerer)==null||e.stateChange.addListener(r=>{var o;let i;switch(r){case jt.Initial:G.updateDisplayText(Kt.LINKING),i="initial";break;case jt.Registered:G.updateDisplayText(""),i=Ar.WEB_RTC_REGISTERED;break;case jt.Unregistered:i=Ar.WEB_RTC_UNREGISTERED;break;case jt.Terminated:nn.warn(`注册流程已终止,无法再注册(如 UA 停止,或网络不可达);regStatus: ${Ar.WEB_RTC_TERMINATED}`,"sip-client.ts 299"),i=Ar.WEB_RTC_TERMINATED;break;default:i="unknown"}(o=this.eventCallback)==null||o.call(this,{type:i})});try{await this.registerer.register()}catch(r){(n=this.eventCallback)==null||n.call(this,{type:Ar.WEB_RTC_REGISTER_FAILED,data:r})}}}attachRemoteAudio(e){const n=e.sessionDescriptionHandler;if(n){const r=n.peerConnection;if(!r)return;const i=new MediaStream;r.getReceivers().forEach(a=>{a.track&&a.track.kind==="audio"&&i.addTrack(a.track)});let o=document.getElementById("sip-remote-audio");o||(o=document.createElement("audio"),o.id="sip-remote-audio",o.autoplay=!0,o.style.display="none",document.body.appendChild(o)),o.srcObject=i,o.play().catch(a=>{console.error("音频播放失败,需要用户交互触发",a)})}}handleSessionState(e,n,r){e.stateChange.addListener(i=>{switch(i){case he.Established:clearTimeout(this.callTimeoutTimer),this.activeSession=e,this.attachRemoteAudio(e);break;case he.Terminating:break;case he.Terminated:this.activeSession=null,clearTimeout(this.callTimeoutTimer);case he.Establishing:}})}handleIncomingCall(e){this.incomingInvitation=e,this.handleSessionState(e,!1),e.progress({statusCode:180,reasonPhrase:"Ringing"}).catch(n=>console.error("发送 180 失败",n)),G.get("direction")===xn.OUTGOING&&this.answerCall()}async answerCall(){var e;if(!this.incomingInvitation)throw new Error("无来电可接听");K.autoAnswerTimer&&(clearTimeout(K.autoAnswerTimer),K.autoAnswerTimer=null);try{await this.incomingInvitation.accept(),this.activeSession=this.incomingInvitation,this.incomingInvitation=null}catch(n){(e=this.eventCallback)==null||e.call(this,{type:Ar.WEB_RTC_ANSWER_FAILED,data:{detail:n}})}}async rejectInCall(){var e;if(this.incomingInvitation)try{await this.incomingInvitation.reject(),this.incomingInvitation=null,G.updateDirection(null),G.updateIsCalling(!1),clearTimeout(this.callTimeoutTimer)}catch(n){(e=this.eventCallback)==null||e.call(this,{type:"error",data:{message:"拒接失败",detail:n}})}}sendDTMF(e){var r;if(!this.activeSession)throw new Error("当前没有活跃的通话");const n=this.activeSession.sessionDescriptionHandler;n&&typeof n.sendDtmf=="function"?(n.sendDtmf(e),(r=this.eventCallback)==null||r.call(this,{type:Ar.WEB_RTC_SEND_DTMF,data:{tone:e}})):(console.warn("DTMF发送不支持或未初始化"),nn.warn("DTMF发送不支持或未初始化","sip-client.ts 490 sendDTMF"))}async hangup(){if(this.activeSession,this.activeSession){clearTimeout(this.callTimeoutTimer);const e=this.activeSession;if(!e)return;const n=e.state;try{n===he.Established?await e.bye():n===he.Establishing&&(e instanceof v0?await e.cancel():e instanceof eu&&await e.reject()),clearTimeout(this.callTimeoutTimer)}catch(r){nn.error("挂断失败","sip-client.ts 522 hangup"),console.error("挂断失败",r)}finally{this.activeSession=null}}}async rejectOutCall(){this.activeSession instanceof eu&&(await this.activeSession.reject(),this.activeSession=null)}async destroy(){if(this.isManuallyStopped=!0,clearTimeout(this.callTimeoutTimer),this.activeSession&&await this.hangup(),this.registerer){try{await this.registerer.unregister()}catch(e){console.warn("注销失败",e)}this.registerer=null}this.userAgent&&(await this.userAgent.stop(),this.userAgent=null)}async reconnect(){if(!K.isRtcReconnecting){K.isRtcReconnecting=!0;try{this.isManuallyStopped=!1,await this.destroy(),await this.start(),this.isOffline=!1,this.reconnectAttempts=0}catch(e){console.error("重连失败",e),K.isRtcReconnecting=!1}finally{K.isRtcReconnecting=!1}}}async getNetworkStats(){var e;if(this.activeSession){const n=(e=this.activeSession.sessionDescriptionHandler)==null?void 0:e.peerConnection;if(!n)return null;const r=await n.getStats(),i={};return r.forEach(o=>{o.type==="candidate-pair"&&o.state==="succeeded"&&o.currentRoundTripTime!=null&&(i.rtt=+(1e3*o.currentRoundTripTime).toFixed(2)),o.type==="inbound-rtp"&&o.kind==="audio"&&(i.jitter=+(1e3*o.jitter).toFixed(2),i.packetsLost=o.packetsLost,i.packetsReceived=o.packetsReceived,o.bytesReceived&&o.timestamp&&(i.recvBitrate=+(o.bytesReceived/1024).toFixed(2))),o.type==="outbound-rtp"&&o.kind==="audio"&&(i.packetsSent=o.packetsSent,o.bytesSent&&o.timestamp&&(i.sendBitrate=+(o.bytesSent/1024).toFixed(2))),o.type==="codec"&&o.mimeType&&(i.codec=o.mimeType)}),{...i,rtt:(i==null?void 0:i.rtt)||40}}return{rtt:K.latency||1}}}class To{static requestPermission(){"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()}static async requestMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(n=>n.kind==="audioinput"&&n.label!=="")?null:await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){return console.warn("获取音频权限失败:",e),null}}static show(e,n,r,i){if("Notification"in window&&Notification.permission==="granted"){const o=new Notification(e,{body:n,tag:`xy-global-notification${new Date().getTime()}`,renotify:!0});o.onclick=()=>{window.focus(),o.close(),r==null||r()},setTimeout(()=>o.close(),1e3*(i||3))}}static async checkMediaPermissions(){try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind==="audioinput"&&e.label!=="")}catch(e){return console.warn("无法检查设备权限:",e),!1}}}const Fw=[],Vn=["call_number"],gA=["call_number"],kw=["hangup"],Ci=["hold","hangup","mute","transfer","consult","satisfaction","dtmf"],Yc=["hold","hangup","mute","transfer","consult"],Hg=["consult_transfer","conference","consult_retrieve"],Pw=["hangup"],Qw=["hangup"],Os=["answer","reject"],Gi=["hangup","consult","transfer","hold","mute","satisfaction","dtmf"],Gg=["hangup","whisper","force_insert","force_disconnect"],jw=["hangup"],Lw=["hangup","cancel_whisper","force_insert"],Uw=["hangup"],Hw=["hangup"];class ja{constructor(){this.roleData={agentInfo:()=>{var e;if(!((e=K.agentInfo)!=null&&e.agent_no))throw new Error(JSON.stringify({code:1,msg:"请先登录"}))},requestInfo:e=>{if(!e.data)throw new Error(JSON.stringify({code:1,msg:'Parameter "data" is required'}))},changeDevice:e=>{if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "device" is required'}));const{answer_devices:n}=K.agentInfo;if(!n.split(",").map(r=>Number(r)).includes(e))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}))},changeState:(e,n)=>{if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "state" is required'}));if(!n)throw new Error(JSON.stringify({code:1,msg:'Parameter "state_name" is required'}));if(e===2&&(n==="通话中"||n==="整理"))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}));if(![1,2].includes(e))throw new Error(JSON.stringify({code:1,msg:"当前状态不支持"}))},setAgentExplicit:e=>{const{out_display_select_switch:n,out_display_data:r}=K.agentInfo;if(n!==1)throw new Error(JSON.stringify({code:1,msg:"当前坐席设置未开启允许指定外显"}));if(!e)throw new Error(JSON.stringify({code:1,msg:'Parameter "number" is required'}));if(!(r||"").split("#").includes(e))throw new Error(JSON.stringify({code:1,msg:"当前外显号码不存在"}))}},this.changeDevice=async e=>{try{if(G.get("isCalling"))throw new Error(JSON.stringify({code:1,msg:"当前正在通话中,请勿切换设备"}));this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:n,success:r}=e,{device:i}=n;i===1&&await ja.initRtcFn(),this.roleData.changeDevice(i);const{agent_no:o}=K.agentInfo;await(s=>yn(`${Or}/device/change`,s))({agent_no:o,answer_device:i}),G.updateAnswerDevice(i);const a=G.get("actionConfigs");G.updateActionConfigs(a),i===2&&K.stateObject.state===Rt.UNREGISTERED&&await this._changeState({data:{...K.stateBeforeChange,state_name:K.stateBeforeChange.state===Rt.IDLE?"空闲":"忙碌"}},"q"),r==null||r({code:0,msg:"请求成功"})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}}formatDate(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}static setInitRtcFn(e){this.initRtcFn=e}async _agentLogin(e){try{const r=await(n={agent_no:e},yn(`${Or}/agent/login`,n));K.agentInfo=r.data}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}var n}async _changeState(e,n){try{K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:r,success:i}=e,{state:o,state_name:a}=r,{agent_no:s}=K.agentInfo;await Ug({agent_no:s,state_name:a,state:o},n),o===Rt.IDLE?G.updateActionConfigs(Vn):o===Rt.BUSY&&G.updateActionConfigs(gA),K.stateObject={state:o,state_name:a},i==null||i({code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async _getInCallCrmDetail(e){var n;try{const{phone:r}=e.data,i={};iu(r)?i.trace_id=r:i.phone=r.replace(/[\s\r\n-]+/g,"");const o=await(a=>yn(`${Yi}/crm/popups`,a))({...i});(n=e.success)==null||n.call(e,o)}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async changeState(e,n){try{if(G.get("isCalling"))throw new Error(JSON.stringify({code:1,msg:"当前正在通话中,请勿切换设备"}));K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),this.roleData.agentInfo(),this.roleData.requestInfo(e);const{data:r,success:i}=e,{state:o,state_name:a}=r;this.roleData.changeState(o,a);const{agent_no:s}=K.agentInfo;await Ug({agent_no:s,state_name:a,state:o},n),(K.stateObject.state===Rt.IDLE||K.stateObject.state===Rt.BUSY&&a!=="整理")&&(K.stateBeforeChange=K.stateObject),o===Rt.IDLE?G.updateActionConfigs(Vn):o===Rt.BUSY&&G.updateActionConfigs(gA),K.stateObject={state:o,state_name:a},i==null||i({code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async getIdleAgentList(e){var r;const{agent_no:n}=K.agentInfo;try{this.roleData.agentInfo();const i=await(o=>yn(`${Or}/agent/free`,o))({agent_no:n});(r=e.success)==null||r.call(e,i)}catch(i){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(i.message).msg),i}}async getAgentState(e){var n;try{const r=await yn(`${Yi}/agent/statecfg/list`,{}),i=(r.data||[]).filter(o=>o.enable===0).filter(o=>o.state!==0&&o.state!==3).filter(o=>o.state_name!=="通话中"&&o.state_name!=="整理"&&o.state_name!=="未注册"&&o.state_name!=="离线接听").map(o=>({state:o.state,state_name:o.state_name})).reverse();(n=e.success)==null||n.call(e,{...r,data:i})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async setAgentExplicit(e){var n;try{this.roleData.agentInfo(),this.roleData.requestInfo(e),this.roleData.setAgentExplicit(e.data.number);const{agent_id:r}=K.agentInfo;await(i=>yn(`${Yi}/agent/update`,i))({agent_id:r,out_display_number:e.data.number}),G.updateSelectOutNumber(e.data.number),(n=e.success)==null||n.call(e,{code:0,msg:"请求成功"})}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async checkAgentLogin(e){var n;try{this.roleData.requestInfo(e);const{agent_no:r}=e.data;if(!r)throw new Error(JSON.stringify({code:1,msg:'Parameter "agent_no" is required'}));const i=await(o=>yn(`${Or}/agent/islogin`,o))({agent_no:r});(n=e.success)==null||n.call(e,i)}catch(r){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(r.message).msg),r}}async getCallRecord(e){try{this.roleData.agentInfo();const{success:n}=e,r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),0,0,0),o=new Date(r.getFullYear(),r.getMonth(),r.getDate(),23,59,59),a=[this.formatDate(i),this.formatDate(o)],{agent_no:s}=K.agentInfo,A=await(f=>yn(`${Yi}/agent/recordpage`,f))({start_time:a[0],end_time:a[1],page_no:1,page_size:10,agent_no:s}),{code:c,msg:u,data:d}=A;n==null||n({code:c,msg:u,data:d})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async logout(e){this.roleData.agentInfo();try{const{agent_no:n}=K.agentInfo,{data:r,success:i}=e;await(o=>yn(`${Or}/agent/logout`,o))({...r,agent_no:n}),i==null||i({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async listenCall(e){try{const{agent_no:n}=K.agentInfo,{data:r,success:i}=e;if(this.roleData.agentInfo(),this.roleData.requestInfo(e),!r.monitored_agent_no)throw new Error(JSON.stringify({code:1,msg:'Parameter "monitored_agent_no" is required'}));await(o=>yn(`${Or}/call/monitor`,o))({...r,monitor_agent_no:n}),K.monitoredAgentNo=r.monitored_agent_no,i==null||i({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async earCall(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>yn(`${Or}/call/whisper`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async stopEarCall(e){try{const{agentInfo:n,earSpeakAgent:r}=K;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前没有正在耳语的坐席"}));const{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;await(a=>yn(`${Or}/call/stopwhisper`,a))({monitor_agent_no:i,monitored_agent_no:r}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async forceInsert(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>yn(`${Or}/call/bargein`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}async forceDisconnect(e){try{const{agentInfo:n,monitoredAgentNo:r}=K,{agent_no:i}=n;this.roleData.agentInfo();const{success:o}=e;if(!r)throw new Error(JSON.stringify({code:1,msg:"当前未有监听坐席"}));await(a=>yn(`${Or}/call/intercept`,a))({monitored_agent_no:r,monitor_agent_no:i}),o==null||o({code:0,msg:""})}catch(n){throw fe.emit(He.FAIL_NOTIFICATION,JSON.parse(n.message).msg),n}}}const Gw=console.log,qg=(...t)=>{K.logBuiltinEnabled&&Gw(...t)};let ni=null;class An{constructor(e,n){this.url=e,this.onOpenCallback=n,this.ws=null,this.heartbeatWorker=null,this.reconnectDelay=3e3,this.manualClose=!1,this.apiClient=new ja,this.sipClient=null,this.pendingMessages=new Map,this.initWebSocket()}static getInstance({url:e,sipClient:n,onOpen:r}){if(!ni){if(!e)throw new Error("WebSocket 尚未初始化");ni=new An(e,r),ni.sipClient=n}return ni}setSipClient(e){this.sipClient=e}stateIdleChange(e){const{state:n}=K.stateObject;n!==Rt.IDLE&&this.apiClient._changeState({data:{...K.stateBeforeChange,state_name:K.stateBeforeChange.state===Rt.IDLE?"空闲":"忙碌"}},e)}inCallAutoAnswer(){const{soft_device_auto_answer:e,auto_answer_time:n}=K.agentInfo,r=e===1,i=G.get("direction");if(r&&i===xn.INCOMING){const o=Number(n)||0;o>0&&(K.autoAnswerTimer=setTimeout(()=>{var a;(a=this.sipClient)==null||a.answerCall(),K.autoAnswerTimer=null},o>0?1e3*o-500:0))}}async getCustomerInfo(e){try{await this.apiClient._getInCallCrmDetail({data:{phone:e},success:n=>{G.updateCustomerInfo(n.data||{phone:n.data.phone,is_vip:0,customer_name:"未知客户",city:"未知",province:"未知",contact_count:0,in_contact_count:0,trace_id:n.data.trace_id,contact_count_month:0,in_contact_count_month:0})}})}catch{}}putAgentState(e,n){if(!e)return;if(n===5)return void this.stateIdleChange("device_type5");K.sessionId="";const{post_call_process_time:r}=K.agentInfo,i=r||0;if(K.autoStateTimer&&(clearTimeout(K.autoStateTimer),K.autoStateTimer=null),G.updateCustomerInfo(void 0),i>0){const{state:o}=K.stateObject;if(o===Rt.IDLE)return;this.apiClient._changeState({data:{state:Rt.BUSY,state_name:"整理"}},"ez"),K.autoStateTimer=setTimeout(()=>{K.autoStateTimer=null,this.stateIdleChange(`delay${i}`)},1e3*i)}else this.stateIdleChange("delay0")}stateBusyChange(){K.sessionId="",clearTimeout(K.autoStateTimer),G.updateCustomerInfo(void 0),this.apiClient._changeState({data:{state:Rt.BUSY,state_name:"忙碌"}},"dm")}initWebSocket(){var n;if(((n=this.ws)==null?void 0:n.readyState)===1||!G.get("isNextState")||this.manualClose)return;const e=P0(Kd,Vd);this.ws=new WebSocket(this.url+e),this.ws.onopen=()=>{const r=new Date().getTime();this.sendMessage({type:0,msg_id:r}),this.pendingMessages.set(r,performance.now()),this.startHeartbeat(),this.manualClose=!1,this.onOpenCallback&&this.onOpenCallback()},this.ws.onmessage=async r=>{var u;const i=JSON.parse(r.data),{type:o,data:a,code:s,msg:A,msg_id:c}=i;if(o===0&&c){const d=this.pendingMessages.get(c),f=performance.now()-d;K.latency=parseFloat(f.toFixed(2)),this.pendingMessages.delete(c)}if(o!==0&&qg("%cWebSocket 收到消息:","color: blue; font-weight: bold;",i),o!==it.OUT_CALL&&o!==it.PREVIEW_OUT_CALL||(K.isAgentHangup=!1,s!==0?(G.reset(),fe.emit(ie.OUT_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A),G.updateActionConfigs(Vn),setTimeout(()=>{G.updateCustomerInfo(void 0)},500),this.stateIdleChange("h")):s===0&&(fe.emit(ie.OUT_SUCCESS),K.sessionId=a.session_id,G.updateIsCalling(!0),clearTimeout(K.autoStateTimer))),o===it.AGENT_STATE){const{state:d,state_name:f}=a;K.stateObject={state:d,state_name:f},(u=K.stateBeforeChange)!=null&&u.state||K.stateObject.state!==Rt.IDLE&&(K.stateObject.state!==Rt.BUSY||f==="整理")||(K.stateBeforeChange=K.stateObject),f==="振铃中"&&G.updateDisplayText(Kt.AGENT_RINGING);const p=G.get("isCalling");d!==Rt.UNREGISTERED||p||G.updateActionConfigs(Fw),d===Rt.IDLE&&K.stateObject.state===Rt.UNREGISTERED&&G.updateActionConfigs(Vn),fe.emit(ie.AGENT_STATE,{state:d,state_name:f})}else if(o===it.OUT_CALL_INCOMING_CALL){K.isAgentHangup=!1;try{await this.getCustomerInfo(a.trace_id||a.customer_phone)}catch(d){console.error(d)}a.preview_task_id?fe.emit(ie.PREVIEW_OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,preview_task_id:a.preview_task_id,trace_id:a.trace_id}):a.direction===0?fe.emit(ie.OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,trace_id:a.trace_id}):a.direction===8&&fe.emit(ie.INTERNAL_OUT_INCOMING_CALL,{customer_phone:a.customer_phone,session_id:a.session_id,trace_id:a.trace_id}),K.sessionId=a.session_id,G.updateActionConfigs(kw,a.direction!==8)}else if(o===it.OUT_CALL_END){if(K.sessionId!==a.session_id)return;if(G.updateDisplayText(""),a.device_type===1&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===2&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUR_SIDE_CONSULT_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===2&&a.agent_no!==K.agentInfo.agent_no)G.get("isCalling")&&(G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Ci));else if(a.device_type===3&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.THREE_WAY_OUR_SIDE_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===4&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.TRANSFER_END,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0);else if(a.device_type===4&&a.agent_no!==K.agentInfo.agent_no){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===xn.OUTGOING?G.updateActionConfigs(Ci):d===xn.INCOMING&&G.updateActionConfigs(Gi)}else a.device_type===5&&a.agent_no===K.agentInfo.agent_no&&(K.monitoredAgentNo="",K.earSpeakAgent="",G.reset(),fe.emit(ie.LISTEN_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn),this.putAgentState(!0,5))}else if(o===it.OUT_CALL_RINGING)a.type===1&&(K.isAgentHangup=!1,fe.emit(ie.OUT_RINGING,{session_id:K.sessionId,type:a.type}),G.updateDisplayText(Kt.RINGING));else if(o===it.OUT_CALL_ANSWER)K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),G.updateIsCalling(!0),G.updateOutCallIsAnswer(!0),G.updateDisplayText(Kt.CALLING),a.direction===8?(fe.emit(ie.INTERNAL_OUT_OFF_ANSWER,{session_id:K.sessionId}),G.updateActionConfigs(Yc)):(fe.emit(ie.OUT_OFF_ANSWER,{session_id:K.sessionId}),G.updateActionConfigs(Ci));else if(o===it.CONSULT_RINGING)K.isAgentHangup=!1,fe.emit(ie.CONSULT_RINGING,{session_id:a.session_id}),G.updateDisplayText(Kt.AGENT_RINGING),G.updateActionConfigs([]),clearTimeout(K.autoStateTimer);else if(o===it.CONSULT_ANSWER)K.isAgentHangup=!1,fe.emit(ie.CONSULT_OFF_HOOK,{session_id:a.session_id}),G.updateConsultIsAnswer(!0),G.updateDisplayText(Kt.CONSULTING),G.updateActionConfigs(Hg);else if(o===it.CONSULT_FAIL)fe.emit(ie.CONSULT_FAILED,{custom_reason:a.custom_reason}),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Ci);else if(o===it.CONSULT_CALL_IN)K.isAgentHangup=!1,fe.emit(ie.CONSULT_INCOMING,{agent_no:a.agent_no,agent_mane:a.agent_name,session_id:a.session_id}),K.sessionId=a.session_id,G.updateIsCalling(!0),G.updateDirection(xn.CONSULT),G.updateDisplayText(Kt.CONSULT_CALL_IN),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 咨询来电",`坐席 [${a.agent_name}] 正在咨询...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{agent_mane:a.agent_name,agent_no:a.agent_no})},K.browserAlertTime);else if(o===it.CONSULT_CALL_IN_SUCCESS)fe.emit(ie.CONSULT_CALL_IN_SUCCESS,{session_id:a.session_id}),G.updateConsultIsAnswer(!0),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Pw);else if(o===it.CONSULT_RETURN_CALL_SUCCESS)a.status==="success"?(G.updateConsultIsAnswer(!1),fe.emit(ie.CONSULT_RETURN_CALL_SUCCESS),G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP),G.updateActionConfigs(Ci)):fe.emit(He.FAIL_NOTIFICATION,"媒体失败");else if(o===it.MUTE)s===0?(G.updateIsMuted(!0),fe.emit(ie.MUTE_SUCCESS),G.updateDisplayText(Kt.MUTING)):(fe.emit(ie.MUTE_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.UNMUTE)s===0?(G.updateIsMuted(!1),fe.emit(ie.UNMUTE_SUCCESS),G.updateDisplayText(Kt.CALLING)):(fe.emit(ie.UNMUTE_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CALL_HOLD)s===0?(G.updateIsHold(!0),G.updateDisplayText(Kt.HOLDING),fe.emit(ie.HOLD_SUCCESS)):(fe.emit(ie.HOLD_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CALL_UNHOLD)s===0?(G.updateDisplayText(Kt.CALLING),G.updateIsHold(!1),fe.emit(ie.UNHOLD_SUCCESS)):(fe.emit(ie.UNHOLD_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_TRANSFER)K.isAgentHangup=!1,s===0?fe.emit(ie.CONSULT_TRANSFER_SUCCESS):(fe.emit(ie.CONSULT_TRANSFER_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_TRANSFER_FAILED)fe.emit(ie.CONSULT_TRANSFER_FAILED,a.status);else if(o===it.CONSULT_TRANSFER_OFF_HOOK)G.updateDirection(xn.INCOMING),G.updateDisplayText(Kt.CALLING),fe.emit(ie.CONSULT_TRANSFER_OFF_HOOK),G.updateActionConfigs(Gi),G.updateIncomingIsAnswer(!0),G.updateConsultIsAnswer(!1);else if(o===it.INCOMING_CALL){K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),K.sessionId=a.session_id;try{this.getCustomerInfo(a.trace_id||a.customer_phone)}catch(d){console.error(d)}G.updateIsCalling(!0),G.updateDirection(xn.INCOMING),G.updateDisplayText(Kt.INCOMING_CALL),this.inCallAutoAnswer(),a.direction===1&&fe.emit(ie.INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id}),a.direction===8&&fe.emit(ie.INCOMING_CALL_IN,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id}),a.direction===3&&fe.emit(ie.PREDICT_INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id}),a.direction===6&&fe.emit(ie.DUAL_CALL_INCOMING_CALL,{customer_phone:a.customer_phone,trace_id:a.trace_id,session_id:a.session_id}),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 客户来电",`客户 [${a.customer_phone}] 正在呼入...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{customer_phone:a.customer_phone})},K.browserAlertTime)}else if(o===it.INCOMING_CALL_OFF_HOOK)G.updateIncomingIsAnswer(!0),a.direction===8?(G.updateActionConfigs(Yc),fe.emit(ie.INCOMING_CALL_IN_OFF_HOOK,{session_id:K.sessionId})):(G.updateActionConfigs(Gi),fe.emit(ie.INCOMING_CALL_OFF_HOOK,{session_id:K.sessionId})),G.updateDisplayText(Kt.CALLING);else if(o===it.INCOMING_CALL_END){if(K.sessionId!==a.session_id)return;if(G.updateDisplayText(""),a.device_type!==1&&a.device_type!==7||a.agent_no!==K.agentInfo.agent_no)if(a.device_type===2&&a.agent_no===K.agentInfo.agent_no)G.reset(),fe.emit(ie.OUR_SIDE_CONSULT_HANGUP,{session_id:a.session_id}),this.putAgentState(!0),G.updateActionConfigs(Vn);else if(a.device_type===2&&a.agent_no!==K.agentInfo.agent_no)G.updateDisplayText(Kt.CALLING),fe.emit(ie.OTHER_SIDE_CONSULT_HANGUP,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Ci);else if(a.device_type===3&&a.agent_no===K.agentInfo.agent_no)this.putAgentState(!0),G.reset(),fe.emit(ie.THREE_WAY_OUR_SIDE_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn);else if(a.device_type===4&&a.agent_no===K.agentInfo.agent_no)this.putAgentState(!0),G.reset(),fe.emit(ie.TRANSFER_END,{session_id:a.session_id}),G.updateActionConfigs(Vn);else if(a.device_type===4&&a.agent_no!==K.agentInfo.agent_no){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===xn.OUTGOING?G.updateActionConfigs(Ci):d===xn.INCOMING&&G.updateActionConfigs(Gi)}else a.device_type===5&&a.agent_no===K.agentInfo.agent_no&&(this.putAgentState(!0,5),K.monitoredAgentNo="",K.earSpeakAgent="",G.reset(),fe.emit(ie.LISTEN_HANGUP,{session_id:a.session_id}),G.updateActionConfigs(Vn));else this.putAgentState(!0),G.reset(),fe.emit(ie.INCOMING_CALL_END,{session_id:a.session_id,isAgentHangup:K.isAgentHangup}),G.updateActionConfigs(Vn)}else if(o===it.SATISFACTION_EVALUATION)s===0?fe.emit(ie.SATISFACTION_EVALUATION_SUCCESS):(fe.emit(ie.SATISFACTION_EVALUATION_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A));else if(o===it.CONSULT_THREE_WAY)s!==0?(fe.emit(ie.CONSULT_THREE_WAY_FAILED,A),fe.emit(He.FAIL_NOTIFICATION,A)):s===0&&G.updateIsMeeting(!0);else if(o===it.CONSULT_THREE_WAY_RESULT)a.status==="success"?(G.updateDirection(xn.MEETING),G.updateDisplayText(Kt.MEETING),G.updateActionConfigs(Qw),fe.emit(ie.CONSULT_THREE_WAY_SUCCESS)):(fe.emit(ie.CONSULT_THREE_WAY_FAILED,{conf_name:a.conf_name}),G.updateIsMeeting(!1));else if(o===it.TRANSFER_INCOMING_CALL)K.isAgentHangup=!1,clearTimeout(K.autoStateTimer),a.agent_no===K.agentInfo.agent_no?(G.updateDisplayText(Kt.TRANSFERRING),fe.emit(ie.TRANSFER_PROGRESS),G.updateActionConfigs([]),G.updateTransferIsAnswer(!0)):(K.sessionId=a.session_id,fe.emit(ie.TRANSFER_INCOMING_CALL,{agent_no:a.agent_no,agent_name:a.agent_name,session_id:a.session_id}),G.updateIsCalling(!0),G.updateDirection(xn.TRANSFER),G.updateDisplayText(Kt.TRANSFER_INCOMING_CALL),G.updateActionConfigs(Os),K.enableBrowserAlert&&To.show("📞 转接来电",`坐席 [${a.agent_no}] 正在转接...`,()=>{fe.emit(He.NOTIFICATION_CLICK,{agent_no:a.agent_no})},K.browserAlertTime));else if(o===it.TRANSFER_OFF_HOOK)fe.emit(ie.TRANSFER_OFF_HOOK,{session_id:K.sessionId}),G.updateTransferIsAnswer(!1),G.updateDisplayText(Kt.CALLING),G.updateActionConfigs(Gi,a.direction!==8);else if(o===it.TRANSFER_FAILED){if(a.status==="failed"){fe.emit(ie.TRANSFER_FAILED,"未知原因"),fe.emit(He.FAIL_NOTIFICATION,"转接失败");const d=G.get("direction");d===xn.OUTGOING?G.updateActionConfigs(Ci):d===xn.INCOMING&&G.updateActionConfigs(Gi)}}else o===it.KICK_OFFLINE?fe.emit(He.KICK_OFF):o===it.CONTINUOUS_NOT_ANSWER?(fe.emit(He.FAIL_NOTIFICATION,`已连续 ${a.miss_count} 次未接, 设置忙碌`),this.stateBusyChange()):o===it.SIGN_OUT?fe.emit(He.SIGN_OUT):o===it.SIGN_IN_SWITCH_DEVICE?fe.emit(He.SIGN_IN_SWITCH_DEVICE,a):o===it.LISTEN_INCOMING_CALL?(clearTimeout(K.autoStateTimer),K.sessionId=a.session_id,G.updateIsCalling(!0),G.updateDirection(xn.INCOMING),this.inCallAutoAnswer(),G.updateDisplayText(Kt.LISTENING),G.updateActionConfigs(Os),fe.emit(ie.LISTEN_INCOMING_CALL,{session_id:a.session_id}),K.enableBrowserAlert&&To.show("📞 监听来电","正在来电...",()=>{fe.emit(He.NOTIFICATION_CLICK,{customer_phone:a.customer_phone})},K.browserAlertTime)):o===it.LISTEN_INCOMING_CALL_OFF_HOOK?(K.monitoredAgentNo=a.monitored_agent_no,K.earSpeakAgent="",G.updateIncomingIsAnswer(!0),fe.emit(ie.LISTEN_INCOMING_CALL_OFF_HOOK,{session_id:K.sessionId,monitored_agent_no:a.monitored_agent_no}),G.updateActionConfigs(Gg),G.updateDisplayText(Kt.CALLING)):o===it.LISTEN_CALL_FAILED?a.status==="failed"&&(fe.emit(ie.LISTEN_CALL_FAILED),K.monitoredAgentNo=""):o===it.EAR_SPEECH?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(jw),fe.emit(ie.EAR_SPEECH_BE_SUCCESS)),a.monitor_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Lw),fe.emit(ie.EAR_SPEECH_SUCCESS,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no}),K.earSpeakAgent=a.monitored_agent_no)):fe.emit(ie.EAR_SPEECH_FAILED):o===it.STOP_EAR_SPEECH?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&G.updateActionConfigs(Gi),a.monitor_agent_no===K.agentInfo.agent_no&&G.updateActionConfigs(Gg),K.earSpeakAgent="",fe.emit(ie.STOP_EAR_SPEECH_SUCCESS)):fe.emit(ie.STOP_EAR_SPEECH_FAILED):o===it.CALL_FORCE_INSERT?a.status==="success"?(a.monitored_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Hw),fe.emit(ie.CALL_FORCE_INSERT_SUCCESS,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no})),a.monitor_agent_no===K.agentInfo.agent_no&&(G.updateActionConfigs(Uw),fe.emit(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,{monitored_agent_no:a.monitored_agent_no,monitor_agent_no:a.monitor_agent_no}))):fe.emit(ie.CALL_FORCE_INSERT_FAILED):o===it.INTERNAL_CALL_START_CONSULT?a.agent_no===K.agentInfo.agent_no?(G.updateConsultIsAnswer(!0),G.updateActionConfigs(Hg),G.updateDisplayText(Kt.CONSULTING)):(G.updateDisplayText(Kt.OTHER_SIDE_CONSULTING),G.updateActionConfigs([])):o===it.INTERNAL_CALL_END_CONSULT?(G.updateActionConfigs(Yc),G.updateDisplayText(""),G.updateConsultIsAnswer(!1)):o===it.CALL_SIP_INCOMING_CALL&&fe.emit(ie.CALL_SIP_INCOMING_CALL)},this.ws.onclose=r=>{fe.emit(He.FAIL_NOTIFICATION,"链接已断开,请检查网络"),this.stopHeartbeat();const i=G.get("isNextState");!this.manualClose&&i&&setTimeout(()=>this.initWebSocket(),this.reconnectDelay)},this.ws.onerror=r=>{var i;fe.emit(He.FAIL_NOTIFICATION,"连接失败,请检查网络"),(i=this.ws)==null||i.close()}}startHeartbeat(){const e=new Blob([`
|
|
164
164
|
let timer;
|
|
165
165
|
self.onmessage = function (e) {
|
|
166
166
|
if (e.data === 'start') {
|
|
@@ -683,7 +683,7 @@ html body {
|
|
|
683
683
|
&:hover {
|
|
684
684
|
opacity: 0.9;
|
|
685
685
|
}
|
|
686
|
-
`;function bN({title:t,content:e,icon:n,onOk:r,onCancel:i}){const o=document.createElement("div");document.body.appendChild(o);const a=hN.createRoot(o),s=()=>{a.unmount(),o.remove()},A=async()=>{r&&await r(),s()},c=()=>{i==null||i(),s()};a.render(ae.jsx(pN,{children:ae.jsxs(mN,{children:[ae.jsxs(vN,{children:[n&&ae.jsx(CN,{children:n}),t]}),ae.jsx(yN,{children:e}),ae.jsxs(EN,{children:[ae.jsx(Ym,{onClick:c,children:"取消"}),ae.jsx(Ym,{primary:!0,onClick:A,children:"确定"})]})]})}))}const SN={1:ae.jsx(vt,{name:"ruandianhua"}),2:ae.jsx(vt,{name:"pnhone"}),3:ae.jsx(vt,{name:"sip-phone"})},wN={call_number:"",answer:"接听",reject:"拒接",hangup:"挂机",dtmf:"DTMF",unhold:"取消保持",hold:"保持",mute:"静音",unmute:"取消静音",satisfaction:"满意度",consult:"咨询",consult_transfer:"咨询转接",consult_retrieve:"取回通话",conference:"三方会议",whisper:"耳语",cancel_whisper:"取消耳语",force_insert:"强插",force_disconnect:"强拆",transfer:"转接"},IN={空闲:1,离线:0,未注册:4},xN=N.lazy(()=>Promise.resolve().then(()=>require("./ConsultModel-
|
|
686
|
+
`;function bN({title:t,content:e,icon:n,onOk:r,onCancel:i}){const o=document.createElement("div");document.body.appendChild(o);const a=hN.createRoot(o),s=()=>{a.unmount(),o.remove()},A=async()=>{r&&await r(),s()},c=()=>{i==null||i(),s()};a.render(ae.jsx(pN,{children:ae.jsxs(mN,{children:[ae.jsxs(vN,{children:[n&&ae.jsx(CN,{children:n}),t]}),ae.jsx(yN,{children:e}),ae.jsxs(EN,{children:[ae.jsx(Ym,{onClick:c,children:"取消"}),ae.jsx(Ym,{primary:!0,onClick:A,children:"确定"})]})]})}))}const SN={1:ae.jsx(vt,{name:"ruandianhua"}),2:ae.jsx(vt,{name:"pnhone"}),3:ae.jsx(vt,{name:"sip-phone"})},wN={call_number:"",answer:"接听",reject:"拒接",hangup:"挂机",dtmf:"DTMF",unhold:"取消保持",hold:"保持",mute:"静音",unmute:"取消静音",satisfaction:"满意度",consult:"咨询",consult_transfer:"咨询转接",consult_retrieve:"取回通话",conference:"三方会议",whisper:"耳语",cancel_whisper:"取消耳语",force_insert:"强插",force_disconnect:"强拆",transfer:"转接"},IN={空闲:1,离线:0,未注册:4},xN=N.lazy(()=>Promise.resolve().then(()=>require("./ConsultModel-Ch0fM8XE.js"))),RN=N.lazy(()=>Promise.resolve().then(()=>require("./TransferModel-Dx-h4fyt.js"))),Cl=on.div`
|
|
687
687
|
width: 25px;
|
|
688
688
|
height: 25px;
|
|
689
689
|
background: ${({bg:t})=>t};
|
|
@@ -691,4 +691,4 @@ html body {
|
|
|
691
691
|
display: flex;
|
|
692
692
|
justify-content: center;
|
|
693
693
|
align-items: center;
|
|
694
|
-
`,ON=t=>{var Ue,F,ge;const{style:e,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,agentNo:o,appKey:a,appSecret:s,url:A,onCallBack:c,ringingCardShow:u=!0,onLoginCancel:d,isCheckLogin:f,...p}=t,{height:v,busy:C,idle:m,unavailable:y,selectOutNumberColor:w}=e||{},I=N.useRef(),O=N.useRef(),[x,g]=N.useState(new Audio(fN)),M=N.useRef(),E=N.useRef(),[b,h]=N.useState(),[S,T]=N.useState(),[R,D]=N.useState(!1),[B,k]=N.useState(new Date().getTime()),[P,H]=N.useState(),[Z,V]=N.useState(),[q,U]=N.useState([]),[$,z]=N.useState([]),[J,W]=N.useState(""),[te,_]=N.useState(!1),[se,ce]=N.useState([]),[ue,ne]=N.useState(""),[me,Y]=N.useState(""),[de,le]=N.useState(!1),[Se,xe]=N.useState(!1),[ve,De]=N.useState(),[je,Le]=N.useState(new Date().getTime()),[Ie,pe]=N.useState(!0),[Oe,Ze]=N.useState(""),tt=j=>{switch(j){case Rt.IDLE:return m||"#1D92E9";case Rt.BUSY:return C||"#F5212D";case Rt.UNREGISTERED:return y||"#faad14";case Rt.OFFLINE:return y||"#8c8c8c";default:return"#1D92E9"}};N.useEffect(()=>((async()=>(D(!0),I.current=kn.getInstance({agentNo:o,appKey:a,appSecret:s,url:A}),rt(),I.current.on(He.PHONE_BAR_OPERATION,j=>{console.log(j),U(j)}),f?await I.current.agent_api.checkAgentLogin({data:{agent_no:o},success:async j=>{j.data.is_login?bN({title:"当前账号已登录!",icon:ae.jsx(vt,{name:"wing",size:20}),content:"是否继续登录",onOk:async()=>{await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const re=I.current.getEarSpeakAgent();M.current=new Audio(re);const X=I.current.getEndSpeakAgent();E.current=new Audio(X)}}),O.current=I.current.getAgentData()},onCancel:()=>{d==null||d()}}):(await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const re=I.current.getEarSpeakAgent();M.current=new Audio(re);const X=I.current.getEndSpeakAgent();E.current=new Audio(X)}}),O.current=I.current.getAgentData())}}):(await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const j=I.current.getEarSpeakAgent();M.current=new Audio(j);const re=I.current.getEndSpeakAgent();E.current=new Audio(re)}}),O.current=I.current.getAgentData()),k(new Date().getTime()),D(!1)))(),()=>{var j;be(x),be(M.current),(j=I.current)==null||j.destroy()}),[]);const rt=()=>{var j,re;(j=I.current)==null||j.on(He.EVENT_ALL,({event:X,data:Ce})=>{switch(X){case ie.OUT_SUCCESS:case ie.CONSULT_RINGING:{Ge(x),De("out"),be(E.current);return}case ie.OUT_INCOMING_CALL:case ie.INTERNAL_OUT_INCOMING_CALL:{c==null||c(X,{customer_phone:Ce.customer_phone,session_id:Ce.session_id});return}case ie.PREVIEW_OUT_INCOMING_CALL:{c==null||c(ie.PREVIEW_OUT_INCOMING_CALL,{customer_phone:Ce.customer_phone,session_id:Ce.session_id,preview_task_id:Ce.preview_task_id});return}case ie.OUT_OFF_ANSWER:case ie.INTERNAL_OUT_OFF_ANSWER:case ie.OUT_FAILED:case ie.CONSULT_FAILED:case ie.OUT_RINGING:case ie.CONSULT_OFF_HOOK:{X===ie.OUT_OFF_ANSWER&&(c==null||c(X,{session_id:Ce.session_id})),be(x);return}case ie.CONSULT_INCOMING:case ie.TRANSFER_INCOMING_CALL:case ie.LISTEN_INCOMING_CALL:case ie.INCOMING_CALL_IN:case ie.INCOMING_CALL:{De("in"),be(E.current),(X===ie.CONSULT_INCOMING||X===ie.TRANSFER_INCOMING_CALL)&&(c==null||c(X,{agent_no:Ce.agent_no,agent_name:Ce.agent_name,session_id:Ce.session_id})),X===ie.INCOMING_CALL?c==null||c(ie.INCOMING_CALL,{customer_phone:Ce.customer_phone,session_id:Ce.session_id}):X===ie.INCOMING_CALL_IN?c==null||c(ie.INCOMING_CALL_IN,{customer_phone:Ce.customer_phone,session_id:Ce.session_id}):X===ie.LISTEN_INCOMING_CALL&&(c==null||c(ie.LISTEN_INCOMING_CALL,{session_id:Ce.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.PREDICT_INCOMING_CALL:{De("out"),be(E.current),X===ie.PREDICT_INCOMING_CALL&&(c==null||c(ie.PREDICT_INCOMING_CALL,{customer_phone:Ce.customer_phone,session_id:Ce.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.DUAL_CALL_INCOMING_CALL:{De("out"),be(E.current),X===ie.DUAL_CALL_INCOMING_CALL&&(c==null||c(ie.DUAL_CALL_INCOMING_CALL,{customer_phone:Ce.customer_phone,session_id:Ce.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.TRANSFER_OFF_HOOK:case ie.LISTEN_INCOMING_CALL_OFF_HOOK:case ie.CONSULT_CALL_IN_SUCCESS:case ie.INCOMING_CALL_IN_OFF_HOOK:case ie.INCOMING_CALL_OFF_HOOK:{X===ie.LISTEN_INCOMING_CALL_OFF_HOOK?c==null||c(X,{session_id:Ce.session_id,monitored_agent_no:Ce.monitored_agent_no}):c==null||c(X,{session_id:Ce.session_id}),be(M.current);return}case ie.OUT_HANGUP:case ie.LISTEN_HANGUP:case ie.LISTEN_CALL_FAILED:case ie.TRANSFER_END:case ie.THREE_WAY_OUR_SIDE_HANGUP:case ie.OUR_SIDE_CONSULT_HANGUP:case ie.OTHER_SIDE_CONSULT_HANGUP:case ie.INCOMING_CALL_END:{if(c==null||c(X,{session_id:Ce.session_id}),be(M.current),be(x),De(void 0),le(!1),xe(!1),X===ie.OUT_HANGUP||X===ie.INCOMING_CALL_END){const{isAgentHangup:ke}=Ce,{agent_hangup_ring_switch:Xe}=I.current.getAgentData();!ke&&Xe&&Ge(E.current,!1)}return}case ie.REJECT:c==null||c(X,{session_id:Ce.session_id});return;default:return null}}),(re=I.current)==null||re.on(ie.AGENT_STATE,X=>{if(V(X.state_name),k(new Date().getTime()),c==null||c(ie.AGENT_STATE,X),X.state===Rt.UNREGISTERED){It.warning("当前已掉线,自动重连中,请检查网络"),be(x);const{soft_device_ring_switch:Ce}=I.current.getAgentData();if(!Ce)return;be(M.current)}}).on(ie.CALL_PROGRESS,X=>{W(X)}).on(He.WEBSITE_DELAY,X=>{h(X)}).on(ie.CUSTOMER_INFO,X=>{T(X),X&&pe(!0)}).on(He.AGENT_INIT_STATUS,X=>{if(X){const{default_device:Ce,out_display_select_switch:ke,out_display_data:Xe,stateObject:{state_name:Ft}}=I.current.getAgentData();_(ke===1),ke===1&&ce((Xe||"").split("#")),H(Ce),V(Ft),Be()}}).on(He.SELECT_EXTERNAL_NUMBER,X=>{ne(X)}).on(He.FAIL_NOTIFICATION,X=>{be(x),be(M.current),It.error(X)}).on(He.KICK_OFF,()=>{be(x),be(M.current),c?c==null||c(He.KICK_OFF):It.warning("您的座席账号已在别处登录,请重新登录。如非您本人操作,请及时修改密码。"),V("")}).on(He.DESTROY,()=>{c==null||c(He.DESTROY),It.success("已离线"),be(x),be(M.current)}).on(He.NETWORK_OFFLINE,()=>{It.warning("网络已断开,请检查网络设置。"),be(x),be(M.current)}).on(He.NETWORK_ONLINE,()=>{It.success("网络已恢复")}).on(He.SIGN_OUT,()=>{c==null||c(He.SIGN_OUT),It.success("已被签出"),be(x),be(M.current)}).on(ie.LISTEN_CALL_FAILED,()=>{c==null||c(ie.LISTEN_CALL_FAILED),It.error("监听失败")}).on(ie.EAR_SPEECH_SUCCESS,({monitored_agent_no:X})=>{c==null||c(ie.EAR_SPEECH_SUCCESS,{monitored_agent_no:X}),It.success("正在耳语")}).on(ie.EAR_SPEECH_BE_SUCCESS,({monitor_agent_no:X})=>{c==null||c(ie.EAR_SPEECH_BE_SUCCESS,{monitor_agent_no:X}),It.success(`${X}正在与你耳语`)}).on(ie.EAR_SPEECH_FAILED,()=>{c==null||c(ie.EAR_SPEECH_FAILED),It.error("耳语失败")}).on(ie.STOP_EAR_SPEECH_SUCCESS,()=>{c==null||c(ie.STOP_EAR_SPEECH_SUCCESS),It.success("停止耳语")}).on(ie.CALL_FORCE_INSERT_SUCCESS,({monitored_agent_no:X,monitor_agent_no:Ce})=>{c==null||c(ie.CALL_FORCE_INSERT_SUCCESS,{monitored_agent_no:X,monitor_agent_no:Ce}),It.success("强插成功")}).on(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,({monitored_agent_no:X,monitor_agent_no:Ce})=>{c==null||c(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,{monitored_agent_no:X,monitor_agent_no:Ce}),It.success(`${Ce}强插`)}).on(He.SIGN_IN_SWITCH_DEVICE,X=>{c==null||c(He.SIGN_IN_SWITCH_DEVICE),It.success(`已被切换${X.answer_device===2?"手机模式":"SIP 话机"}设备`)}).on(ie.CALL_SIP_INCOMING_CALL,()=>{It.success("SIP话机有新的呼入")})};N.useEffect(()=>{var j;(j=I.current)==null||j.setBrowserAlertTime(r||3)},[r]),N.useEffect(()=>{var j;(j=I.current)==null||j.setBrowserAlert(i||!1)},[i]);const Ge=(j,re=!0)=>{j&&(j.currentTime=0,j.loop=re,j.play())},be=j=>{j&&j.pause()},Je=async j=>{var re;try{await((re=I.current)==null?void 0:re.agent_api.changeDevice({data:{device:j},success:()=>{H(j),It.success("切换设备成功")}}))}catch{}},lt=async(j,re)=>{var X;try{await((X=I.current)==null?void 0:X.agent_api.changeState({data:{state:j,state_name:re},success:()=>{V(re),It.success("切换状态成功")}}))}catch{}},$e=async j=>{var re;try{await((re=I.current)==null?void 0:re.agent_api.setAgentExplicit({data:{number:j},success:()=>{It.success(`切换[${j}]外显号码成功`)}}))}catch{}},Be=async()=>{var j;try{await((j=I.current)==null?void 0:j.agent_api.getAgentState({success:re=>{z(re.data)}}))}catch{}},Me=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.makeCall(j))}catch(X){const{msg:Ce}=JSON.parse(X.message);It.warning(Ce)}},st=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.answerCall())}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},At=async()=>{var j;try{(j=I.current)==null||j.call_api.cancelCall()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ct=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.hangup())}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Nt=async()=>{var j;try{(j=I.current)==null||j.call_api.holdCall()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Jt=()=>{var j;(j=I.current)==null||j.call_api.unholdCall()},Wt=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.consultCall(j))}catch(X){const{msg:Ce}=JSON.parse(X.message);It.warning(Ce)}},en=async()=>{var j;try{(j=I.current)==null||j.call_api.consultRetrieve()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},_t=async()=>{var j;try{(j=I.current)==null||j.call_api.consultTransfer()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Zt=()=>{var j;try{(j=I.current)==null||j.call_api.mute()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ot=()=>{var j;try{(j=I.current)==null||j.call_api.unmute()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},pt=()=>{var j;try{(j=I.current)==null||j.call_api.satisfactionEvaluation()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ve=()=>{var j;try{(j=I.current)==null||j.call_api.startConference()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},_e=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.transferAgent(j))}catch(X){const{msg:Ce}=JSON.parse(X.message);It.warning(Ce)}},Te=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.transferOutline(j))}catch(X){const{msg:Ce}=JSON.parse(X.message);It.warning(Ce)}},ot=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.earSpeakStart({success:()=>{}}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},mt=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.earSpeakStop({success:()=>{}}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Fe=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.forceInsert({}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},we=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.forceDisconnect({}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ke=ae.jsx(cN,{onPressEnter:j=>{j&&Me(j)}},je),ze=N.useMemo(()=>[{name:"call_number",icon:ae.jsx(No,{trigger:"click",rootClassName:"call-number-popover",destroyTooltipOnHide:!0,onOpenChange:re=>{Le(new Date().getTime())},content:Ke,children:ae.jsx(vt,{name:"boda",color:"#48D866",size:25})})},{name:"answer",icon:ae.jsx(vt,{name:"jieting",onClick:st,size:25})},{name:"hold",icon:ae.jsx(vt,{name:"baochi",color:"#1D92E9",onClick:Nt,size:25})},{name:"unhold",icon:ae.jsx(vt,{name:"quxiaobaochi",color:"#1D92E9",onClick:Jt,size:25})},{name:"mute",icon:ae.jsx(vt,{name:"mk",onClick:Zt,color:"#1D92E9",size:25})},{name:"unmute",icon:ae.jsx(vt,{name:"guanbimk",onClick:Ot,color:"#1D92E9",size:25})},{name:"satisfaction",icon:ae.jsx(vt,{name:"manyidu",onClick:pt,size:25})},{name:"consult",icon:ae.jsx(vt,{name:"zixun",onClick:()=>{le(!0)},size:25})},{name:"consult_transfer",icon:ae.jsx(vt,{name:"zhuanjie",onClick:_t,size:25})},{name:"transfer",icon:ae.jsx(vt,{size:25,name:"zhuanjie",onClick:()=>{xe(!0)}})},{name:"consult_retrieve",icon:ae.jsx(vt,{name:"fanhui",color:"#ffc53d",size:25,onClick:en})},{name:"conference",icon:ae.jsx(vt,{name:"huiyi",onClick:Ve,size:25})},{name:"whisper",icon:ae.jsx(Cl,{bg:"#1D92E9",children:ae.jsx(vt,{name:"whisper",size:15,color:"#fff",onClick:ot})})},{name:"cancel_whisper",icon:ae.jsx(Cl,{bg:"red",children:ae.jsx(vt,{name:"cancel_whisper",size:15,color:"#fff",onClick:mt})})},{name:"force_insert",icon:ae.jsx(Cl,{bg:"#1D92E9",children:ae.jsx(vt,{name:"force_insert",size:15,color:"#fff",onClick:Fe})})},{name:"force_disconnect",icon:ae.jsx(vt,{name:"force_disconnect",onClick:we,size:25})},{name:"reject",icon:ae.jsx(vt,{name:"jujie",color:"red",onClick:At,size:25})},{name:"hangup",icon:ae.jsx(vt,{name:"guaji",color:"red",onClick:Ct,size:25})},{name:"dtmf",icon:ae.jsx(No,{trigger:"click",onOpenChange:()=>{Ze("")},title:ae.jsx(di,{style:{borderRadius:20,textAlign:"center"},placeholder:"点击进行发送按键",value:Oe}),content:ae.jsx("div",{style:{width:300},children:ae.jsx(Dy,{onCallBack:re=>{var Ce;const X=Oe+re;Ze(X),(Ce=I.current)==null||Ce.call_api.sendDTMF(re)}})}),children:ae.jsx(vt,{name:"dtmf",size:25})})}].filter(({name:re})=>q.includes(re)),[q,Oe]);return ae.jsx(ae.Fragment,{children:ae.jsxs(_r,{prefixCls:"ysyt",theme:{components:{Select:{selectorBg:"none"}}},children:[Z?ae.jsx(Sc,{spinning:R,children:ae.jsxs(WI,{height:v,children:[ae.jsx(JI,{children:ae.jsx(go,{variant:"underlined",value:P,onChange:j=>{Je(j)},options:(((Ue=I.current.getAgentData())==null?void 0:Ue.answer_devices)||[]).map(j=>({...j,label:ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[SN[j.value],ae.jsx("span",{style:{marginLeft:5},children:j.label})]})})),style:{width:140}})}),ae.jsxs(_I,{background:tt(IN[Z]??2),children:[ae.jsxs("div",{className:"ysyt-strip",children:[ae.jsx("div",{children:J?ae.jsx("span",{className:"ysyt-strip-state-name",children:J}):ae.jsx(ty,{trigger:["click"],menu:{items:$.map(j=>({label:ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[j.state===1?ae.jsx(vt,{name:"kongxian",color:"#7cb305",size:16}):ae.jsx(vt,{name:"manglu",color:"#f5222d",size:16}),ae.jsx("span",{style:{marginLeft:10},children:j.state_name})]}),key:j.state_name,onClick:()=>{lt(j.state,j.state_name)}}))},children:ae.jsxs("div",{style:{color:"#fff",cursor:"pointer",display:"flex",alignItems:"center"},children:[Z==="空闲"?ae.jsx(vt,{name:"kongxian",color:"#fff",size:20}):ae.jsx(ae.Fragment,{children:Z==="未注册"?ae.jsx(vt,{name:"unregistered",size:20}):ae.jsx(vt,{name:"manglu2",size:20})}),ae.jsx("span",{style:{margin:"0 10px"},children:Z}),ae.jsx(vt,{name:"xia",color:"#fff"})]})})}),ae.jsx("div",{className:"ysyt-strip-time",children:ae.jsx(dN,{},B)}),u&&S&&ae.jsx("div",{className:"ysyt-strip-call-card",onClick:()=>pe(!Ie),children:Ie?ae.jsx(vt,{name:"unopen",color:"#fff"}):ae.jsx(vt,{name:"open",color:"#fff"})})]}),ae.jsx("div",{className:"ysyt-action",children:ze.map(({name:j,icon:re})=>ae.jsx(us,{title:wN[j],children:re},j))}),te&&ae.jsx(s2,{children:ae.jsx("div",{children:ae.jsx(No,{trigger:"click",title:"外显号码池",onOpenChange:j=>{j||Y("")},content:ae.jsxs(A2,{children:[ae.jsx("div",{children:ae.jsx(di,{value:me,placeholder:"请输入外显号码",onChange:j=>Y(j.target.value)})}),ae.jsx("div",{className:"ysyt-number-content",children:ae.jsx(os.Group,{value:ue,onChange:j=>{$e(j.target.value)},options:se.filter(j=>j.includes(me)).map(j=>({label:ae.jsx(c2,{style:{color:ue===j?"#1D92E9":""},children:j},j),value:j}))})})]}),children:ae.jsxs("div",{style:{fontSize:14,cursor:"pointer",color:w||"#333",display:"flex",alignItems:"center"},children:[ae.jsx(vt,{name:"external",color:w||"#333"}),ae.jsx("span",{style:{margin:"0 5px"},children:"外显号码"}),ae.jsx(vt,{name:"xia",color:w||"#333"})]})})})})]}),ae.jsx(r2,{children:b&&b.rtt&&ae.jsx("div",{children:ae.jsx(No,{content:ae.jsxs("div",{children:[ae.jsxs("div",{children:["延迟: ",b.rtt,"ms"]}),b.jitter&&ae.jsxs("div",{children:["抖动: ",b.jitter,"ms"]}),ae.jsxs("div",{children:["丢包: ",b.packetsLost||0]}),b.packetsReceived?ae.jsxs("div",{children:["接收: ",b.packetsReceived]}):null,b.packetsSent?ae.jsxs("div",{children:["发送: ",b.packetsSent]}):null,b.sendBitrate?ae.jsxs("div",{children:["发送码率: ",b.sendBitrate,"KB/s"]}):null,b.recvBitrate?ae.jsxs("div",{children:["接收码率: ",b.recvBitrate,"KB/s"]}):null]}),placement:"bottomLeft",children:ae.jsxs("div",{style:{padding:"0 10px"},children:[b.rtt>=250?ae.jsx(vt,{name:"wifi1"}):"",b.rtt>=121&&b.rtt<250?ae.jsx(vt,{name:"wifi2"}):"",b.rtt<=120?ae.jsx(vt,{name:"wifi3"}):""]})})})}),u&&ae.jsxs(a2,{height:v,show:!!S&&Ie,children:[ae.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[(S==null?void 0:S.is_vip)===1&&ae.jsx(vt,{name:"vip"}),ae.jsx("span",{style:{marginLeft:5},children:S==null?void 0:S.customer_name})]}),ae.jsx("b",{children:S==null?void 0:S.phone})]}),ae.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ae.jsxs("span",{children:[S==null?void 0:S.province,"-",S==null?void 0:S.city]}),ve&&ae.jsxs("span",{children:["当月",ve==="out"?"呼出次数:":"呼入次数:",ae.jsx("span",{style:{color:"#1D92E9"},children:ve==="out"?S==null?void 0:S.contact_count_month:S==null?void 0:S.in_contact_count_month})]})]}),ae.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:ve&&ae.jsxs("span",{children:["总",ve==="out"?"呼出次数:":"呼入次数:",ae.jsx("span",{style:{color:"#1D92E9"},children:ve==="out"?(S==null?void 0:S.contact_count)||0:(S==null?void 0:S.in_contact_count)||0})]})})]})]})}):ae.jsx(ae.Fragment,{}),ae.jsx(N.Suspense,{children:de&&((F=I.current)==null?void 0:F.agent_api)&&ae.jsx(xN,{open:de,queryFetch:I.current.agent_api.getIdleAgentList,onCallBack:j=>{le(!1),j&&Wt(j)}})}),ae.jsx(N.Suspense,{children:Se&&((ge=I.current)==null?void 0:ge.agent_api)&&ae.jsx(RN,{open:Se,queryFetch:I.current.agent_api.getIdleAgentList,onCallBack:(j,re)=>{xe(!1),j&&(re===0?_e(j):re===1&&Te(j))}})})]})})},MN=t=>{var e;return(e=kn.getInstance())==null?void 0:e.call_api.makeCall(t)},TN=()=>{var t;return(t=kn.getInstance())==null?void 0:t.getRealTimeCustomerInfo()},NN=async t=>{var e,n;if(t!==Rt.IDLE&&t!==Rt.BUSY)throw new Error("Invalid agent state");try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.changeState({data:{state:t,state_name:t===Rt.IDLE?"空闲":"忙碌"}}))}catch(r){console.error(r)}},DN=async t=>{var e,n;try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.changeDevice({data:{device:t}}))}catch(r){console.error(r)}},BN=async(t=!1,e)=>{var n,r;try{await((r=(n=kn.getInstance())==null?void 0:n.agent_api)==null?void 0:r.agentLogout({data:{offline_answer:t},success:()=>{e==null||e()}}))}catch(i){console.log(i)}},FN=async(t,e)=>{var n,r;(r=(n=kn.getInstance())==null?void 0:n.call_api)==null||r.previewMakeCall(t,e)},kN=async t=>{var e,n;try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.listenAgentCall({data:{monitored_agent_no:t},success:()=>{It.success("监听坐席通话成功")}}))}catch(r){console.error(r)}},PN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.earSpeakStart({}))}catch(n){console.log(n)}},QN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.earSpeakStop({}))}catch(n){console.log(n)}},jN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.forceInsert({}))}catch(n){console.log(n)}},LN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.forceDisconnect({}))}catch(n){console.log(n)}};exports.Button=Ao;exports.CONTAINER_MAX_OFFSET=sf;exports.CSSMotion=lo;exports.ConfigContext=Qt;exports.ConfigProvider=_r;exports.ContextIsolator=Ua;exports.DisabledContextProvider=Vv;exports.Empty=si;exports.FastColor=Gt;exports.Input=di;exports.KeyCode=at;exports.Keyframe=Pt;exports.ModelBody=n2;exports.Portal=gc;exports.Radio=os;exports.RefIcon=yc;exports.RefIcon$1=Rf;exports.RefIcon$2=as;exports.RefIcon$3=xf;exports.RefIcon$4=Of;exports.Space=Cc;exports.Spin=Sc;exports.Wave=nc;exports.YsytBarPhone=ON;exports.YsytIconSvg=vt;exports._extends=Qe;exports._objectSpread2=L;exports._slicedToArray=ee;exports._toConsumableArray=Re;exports._typeof=et;exports.agentLogout=BN;exports.callForceInsert=jN;exports.callForceSplit=LN;exports.canUseDom=Ln;exports.classNames=Ae;exports.clearFix=sA;exports.contains=tv;exports.convertLegacyProps=eR;exports.devUseWarning=cn;exports.genFocusStyle=AA;exports.genPresetColor=Uv;exports.genStyleHooks=Tn;exports.genSubStyleComponent=Lv;exports.getConfirmLocale=Wb;exports.getCustomerInfo=TN;exports.getReactRender=uf;exports.getTransitionName=sc;exports.globalConfig=Gd;exports.initMotion=XA;exports.initZoomMotion=Xa;exports.isPresetColor=WC;exports.isPresetStatusColor=OM;exports.jsxRuntimeExports=ae;exports.listenCall=kN;exports.localeValues=oo;exports.makeCall=MN;exports.merge=zt;exports.omit=tr;exports.pickAttrs=ki;exports.previewMakeCall=FN;exports.replaceElement=k1;exports.resetComponent=zn;exports.setAgentDevice=DN;exports.setAgentInitState=NN;exports.startEarSpeak=PN;exports.stopEarSpeak=QN;exports.unit=ye;exports.useCSSVarCls=Ur;exports.useComponentConfig=Jr;exports.useComposeRef=ji;exports.useEvent=rn;exports.useId=rc;exports.useLocale=HA;exports.useSafeState=Lo;exports.useToken=dr;exports.useZIndex=ts;exports.warnContext=s0;exports.warning=Di;exports.withPureRenderTheme=MC;exports.zIndexContext=es;
|
|
694
|
+
`,ON=t=>{var Ue,F,ge;const{style:e,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,agentNo:o,appKey:a,appSecret:s,url:A,onCallBack:c,ringingCardShow:u=!0,onLoginCancel:d,isCheckLogin:f,...p}=t,{height:v,busy:C,idle:m,unavailable:y,selectOutNumberColor:w}=e||{},I=N.useRef(),O=N.useRef(),[x,g]=N.useState(new Audio(fN)),M=N.useRef(),E=N.useRef(),[b,h]=N.useState(),[S,T]=N.useState(),[R,D]=N.useState(!1),[B,k]=N.useState(new Date().getTime()),[P,H]=N.useState(),[Z,V]=N.useState(),[q,U]=N.useState([]),[$,z]=N.useState([]),[J,W]=N.useState(""),[te,_]=N.useState(!1),[se,ce]=N.useState([]),[ue,ne]=N.useState(""),[me,Y]=N.useState(""),[de,le]=N.useState(!1),[Se,xe]=N.useState(!1),[ve,De]=N.useState(),[je,Le]=N.useState(new Date().getTime()),[Ie,pe]=N.useState(!0),[Oe,Ze]=N.useState(""),tt=j=>{switch(j){case Rt.IDLE:return m||"#1D92E9";case Rt.BUSY:return C||"#F5212D";case Rt.UNREGISTERED:return y||"#faad14";case Rt.OFFLINE:return y||"#8c8c8c";default:return"#1D92E9"}};N.useEffect(()=>((async()=>(D(!0),I.current=kn.getInstance({agentNo:o,appKey:a,appSecret:s,url:A}),rt(),I.current.on(He.PHONE_BAR_OPERATION,j=>{console.log(j),U(j)}),f?await I.current.agent_api.checkAgentLogin({data:{agent_no:o},success:async j=>{j.data.is_login?bN({title:"当前账号已登录!",icon:ae.jsx(vt,{name:"wing",size:20}),content:"是否继续登录",onOk:async()=>{await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const re=I.current.getEarSpeakAgent();M.current=new Audio(re);const X=I.current.getEndSpeakAgent();E.current=new Audio(X)}}),O.current=I.current.getAgentData()},onCancel:()=>{d==null||d()}}):(await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const re=I.current.getEarSpeakAgent();M.current=new Audio(re);const X=I.current.getEndSpeakAgent();E.current=new Audio(X)}}),O.current=I.current.getAgentData())}}):(await I.current.init({...p,logBuiltinEnabled:n,browserAlertTime:r,enableBrowserAlert:i,onCallBack:()=>{const j=I.current.getEarSpeakAgent();M.current=new Audio(j);const re=I.current.getEndSpeakAgent();E.current=new Audio(re)}}),O.current=I.current.getAgentData()),k(new Date().getTime()),D(!1)))(),()=>{var j;be(x),be(M.current),(j=I.current)==null||j.destroy()}),[]);const rt=()=>{var j,re;(j=I.current)==null||j.on(He.EVENT_ALL,({event:X,data:Ce})=>{switch(console.log(X),X){case ie.OUT_SUCCESS:case ie.CONSULT_RINGING:{Ge(x),De("out"),be(E.current);return}case ie.OUT_INCOMING_CALL:case ie.INTERNAL_OUT_INCOMING_CALL:{c==null||c(X,{customer_phone:Ce.customer_phone,session_id:Ce.session_id});return}case ie.PREVIEW_OUT_INCOMING_CALL:{c==null||c(ie.PREVIEW_OUT_INCOMING_CALL,{customer_phone:Ce.customer_phone,session_id:Ce.session_id,preview_task_id:Ce.preview_task_id});return}case ie.OUT_OFF_ANSWER:case ie.INTERNAL_OUT_OFF_ANSWER:case ie.OUT_FAILED:case ie.CONSULT_FAILED:case ie.OUT_RINGING:case ie.CONSULT_OFF_HOOK:{X===ie.OUT_OFF_ANSWER&&(c==null||c(X,{session_id:Ce.session_id})),be(x);return}case ie.CONSULT_INCOMING:case ie.TRANSFER_INCOMING_CALL:case ie.LISTEN_INCOMING_CALL:case ie.INCOMING_CALL_IN:case ie.INCOMING_CALL:{De("in"),be(E.current),(X===ie.CONSULT_INCOMING||X===ie.TRANSFER_INCOMING_CALL)&&(c==null||c(X,{agent_no:Ce.agent_no,agent_name:Ce.agent_name,session_id:Ce.session_id})),X===ie.INCOMING_CALL?c==null||c(ie.INCOMING_CALL,{customer_phone:Ce.customer_phone,session_id:Ce.session_id}):X===ie.INCOMING_CALL_IN?c==null||c(ie.INCOMING_CALL_IN,{customer_phone:Ce.customer_phone,session_id:Ce.session_id}):X===ie.LISTEN_INCOMING_CALL&&(c==null||c(ie.LISTEN_INCOMING_CALL,{session_id:Ce.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.PREDICT_INCOMING_CALL:{De("out"),be(E.current),X===ie.PREDICT_INCOMING_CALL&&(c==null||c(ie.PREDICT_INCOMING_CALL,{customer_phone:Ce.customer_phone,session_id:Ce.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.DUAL_CALL_INCOMING_CALL:{De("out"),be(E.current),X===ie.DUAL_CALL_INCOMING_CALL&&(c==null||c(ie.DUAL_CALL_INCOMING_CALL,{customer_phone:Ce.customer_phone,session_id:Ce.session_id}));const{soft_device_ring_switch:ke}=I.current.getAgentData();if(!ke)return;Ge(M.current);return}case ie.TRANSFER_OFF_HOOK:case ie.LISTEN_INCOMING_CALL_OFF_HOOK:case ie.CONSULT_CALL_IN_SUCCESS:case ie.INCOMING_CALL_IN_OFF_HOOK:case ie.INCOMING_CALL_OFF_HOOK:{X===ie.LISTEN_INCOMING_CALL_OFF_HOOK?c==null||c(X,{session_id:Ce.session_id,monitored_agent_no:Ce.monitored_agent_no}):c==null||c(X,{session_id:Ce.session_id}),be(M.current);return}case ie.OUT_HANGUP:case ie.LISTEN_HANGUP:case ie.LISTEN_CALL_FAILED:case ie.TRANSFER_END:case ie.THREE_WAY_OUR_SIDE_HANGUP:case ie.OUR_SIDE_CONSULT_HANGUP:case ie.OTHER_SIDE_CONSULT_HANGUP:case ie.INCOMING_CALL_END:{if(c==null||c(X,{session_id:Ce.session_id}),be(M.current),be(x),De(void 0),le(!1),xe(!1),X===ie.OUT_HANGUP||X===ie.INCOMING_CALL_END){const{isAgentHangup:ke}=Ce,{agent_hangup_ring_switch:Xe}=I.current.getAgentData();!ke&&Xe&&Ge(E.current,!1)}return}case ie.REJECT:c==null||c(X,{session_id:Ce.session_id});return;default:return null}}),(re=I.current)==null||re.on(ie.AGENT_STATE,X=>{if(V(X.state_name),k(new Date().getTime()),c==null||c(ie.AGENT_STATE,X),X.state===Rt.UNREGISTERED){It.warning("当前已掉线,自动重连中,请检查网络"),be(x);const{soft_device_ring_switch:Ce}=I.current.getAgentData();if(!Ce)return;be(M.current)}}).on(ie.CALL_PROGRESS,X=>{W(X)}).on(He.WEBSITE_DELAY,X=>{h(X)}).on(ie.CUSTOMER_INFO,X=>{T(X),X&&pe(!0)}).on(He.AGENT_INIT_STATUS,X=>{if(X){const{default_device:Ce,out_display_select_switch:ke,out_display_data:Xe,stateObject:{state_name:Ft}}=I.current.getAgentData();_(ke===1),ke===1&&ce((Xe||"").split("#")),H(Ce),V(Ft),Be()}}).on(He.SELECT_EXTERNAL_NUMBER,X=>{ne(X)}).on(He.FAIL_NOTIFICATION,X=>{be(x),be(M.current),It.error(X)}).on(He.KICK_OFF,()=>{be(x),be(M.current),c?c==null||c(He.KICK_OFF):It.warning("您的座席账号已在别处登录,请重新登录。如非您本人操作,请及时修改密码。"),V("")}).on(He.DESTROY,()=>{c==null||c(He.DESTROY),It.success("已离线"),be(x),be(M.current)}).on(He.NETWORK_OFFLINE,()=>{It.warning("网络已断开,请检查网络设置。"),be(x),be(M.current)}).on(He.NETWORK_ONLINE,()=>{It.success("网络已恢复")}).on(He.SIGN_OUT,()=>{c==null||c(He.SIGN_OUT),It.success("已被签出"),be(x),be(M.current)}).on(ie.LISTEN_CALL_FAILED,()=>{c==null||c(ie.LISTEN_CALL_FAILED),It.error("监听失败")}).on(ie.EAR_SPEECH_SUCCESS,({monitored_agent_no:X})=>{c==null||c(ie.EAR_SPEECH_SUCCESS,{monitored_agent_no:X}),It.success("正在耳语")}).on(ie.EAR_SPEECH_BE_SUCCESS,({monitor_agent_no:X})=>{c==null||c(ie.EAR_SPEECH_BE_SUCCESS,{monitor_agent_no:X}),It.success(`${X}正在与你耳语`)}).on(ie.EAR_SPEECH_FAILED,()=>{c==null||c(ie.EAR_SPEECH_FAILED),It.error("耳语失败")}).on(ie.STOP_EAR_SPEECH_SUCCESS,()=>{c==null||c(ie.STOP_EAR_SPEECH_SUCCESS),It.success("停止耳语")}).on(ie.CALL_FORCE_INSERT_SUCCESS,({monitored_agent_no:X,monitor_agent_no:Ce})=>{c==null||c(ie.CALL_FORCE_INSERT_SUCCESS,{monitored_agent_no:X,monitor_agent_no:Ce}),It.success("强插成功")}).on(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,({monitored_agent_no:X,monitor_agent_no:Ce})=>{c==null||c(ie.CALL_FORCE_INSERT_SUCCESS_LISTENER,{monitored_agent_no:X,monitor_agent_no:Ce}),It.success(`${Ce}强插`)}).on(He.SIGN_IN_SWITCH_DEVICE,X=>{c==null||c(He.SIGN_IN_SWITCH_DEVICE),It.success(`已被切换${X.answer_device===2?"手机模式":"SIP 话机"}设备`)}).on(ie.CALL_SIP_INCOMING_CALL,()=>{It.success("SIP话机有新的呼入")})};N.useEffect(()=>{var j;(j=I.current)==null||j.setBrowserAlertTime(r||3)},[r]),N.useEffect(()=>{var j;(j=I.current)==null||j.setBrowserAlert(i||!1)},[i]);const Ge=(j,re=!0)=>{j&&(j.currentTime=0,j.loop=re,j.play())},be=j=>{j&&j.pause()},Je=async j=>{var re;try{await((re=I.current)==null?void 0:re.agent_api.changeDevice({data:{device:j},success:()=>{H(j),It.success("切换设备成功")}}))}catch{}},lt=async(j,re)=>{var X;try{await((X=I.current)==null?void 0:X.agent_api.changeState({data:{state:j,state_name:re},success:()=>{V(re),It.success("切换状态成功")}}))}catch{}},$e=async j=>{var re;try{await((re=I.current)==null?void 0:re.agent_api.setAgentExplicit({data:{number:j},success:()=>{It.success(`切换[${j}]外显号码成功`)}}))}catch{}},Be=async()=>{var j;try{await((j=I.current)==null?void 0:j.agent_api.getAgentState({success:re=>{z(re.data)}}))}catch{}},Me=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.makeCall(j))}catch(X){const{msg:Ce}=JSON.parse(X.message);It.warning(Ce)}},st=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.answerCall())}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},At=async()=>{var j;try{(j=I.current)==null||j.call_api.cancelCall()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ct=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.hangup())}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Nt=async()=>{var j;try{(j=I.current)==null||j.call_api.holdCall()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Jt=()=>{var j;(j=I.current)==null||j.call_api.unholdCall()},Wt=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.consultCall(j))}catch(X){const{msg:Ce}=JSON.parse(X.message);It.warning(Ce)}},en=async()=>{var j;try{(j=I.current)==null||j.call_api.consultRetrieve()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},_t=async()=>{var j;try{(j=I.current)==null||j.call_api.consultTransfer()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Zt=()=>{var j;try{(j=I.current)==null||j.call_api.mute()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ot=()=>{var j;try{(j=I.current)==null||j.call_api.unmute()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},pt=()=>{var j;try{(j=I.current)==null||j.call_api.satisfactionEvaluation()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ve=()=>{var j;try{(j=I.current)==null||j.call_api.startConference()}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},_e=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.transferAgent(j))}catch(X){const{msg:Ce}=JSON.parse(X.message);It.warning(Ce)}},Te=async j=>{var re;try{await((re=I.current)==null?void 0:re.call_api.transferOutline(j))}catch(X){const{msg:Ce}=JSON.parse(X.message);It.warning(Ce)}},ot=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.earSpeakStart({success:()=>{}}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},mt=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.earSpeakStop({success:()=>{}}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Fe=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.forceInsert({}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},we=async()=>{var j;try{await((j=I.current)==null?void 0:j.call_api.forceDisconnect({}))}catch(re){const{msg:X}=JSON.parse(re.message);It.warning(X)}},Ke=ae.jsx(cN,{onPressEnter:j=>{j&&Me(j)}},je),ze=N.useMemo(()=>[{name:"call_number",icon:ae.jsx(No,{trigger:"click",rootClassName:"call-number-popover",destroyTooltipOnHide:!0,onOpenChange:re=>{Le(new Date().getTime())},content:Ke,children:ae.jsx(vt,{name:"boda",color:"#48D866",size:25})})},{name:"answer",icon:ae.jsx(vt,{name:"jieting",onClick:st,size:25})},{name:"hold",icon:ae.jsx(vt,{name:"baochi",color:"#1D92E9",onClick:Nt,size:25})},{name:"unhold",icon:ae.jsx(vt,{name:"quxiaobaochi",color:"#1D92E9",onClick:Jt,size:25})},{name:"mute",icon:ae.jsx(vt,{name:"mk",onClick:Zt,color:"#1D92E9",size:25})},{name:"unmute",icon:ae.jsx(vt,{name:"guanbimk",onClick:Ot,color:"#1D92E9",size:25})},{name:"satisfaction",icon:ae.jsx(vt,{name:"manyidu",onClick:pt,size:25})},{name:"consult",icon:ae.jsx(vt,{name:"zixun",onClick:()=>{le(!0)},size:25})},{name:"consult_transfer",icon:ae.jsx(vt,{name:"zhuanjie",onClick:_t,size:25})},{name:"transfer",icon:ae.jsx(vt,{size:25,name:"zhuanjie",onClick:()=>{xe(!0)}})},{name:"consult_retrieve",icon:ae.jsx(vt,{name:"fanhui",color:"#ffc53d",size:25,onClick:en})},{name:"conference",icon:ae.jsx(vt,{name:"huiyi",onClick:Ve,size:25})},{name:"whisper",icon:ae.jsx(Cl,{bg:"#1D92E9",children:ae.jsx(vt,{name:"whisper",size:15,color:"#fff",onClick:ot})})},{name:"cancel_whisper",icon:ae.jsx(Cl,{bg:"red",children:ae.jsx(vt,{name:"cancel_whisper",size:15,color:"#fff",onClick:mt})})},{name:"force_insert",icon:ae.jsx(Cl,{bg:"#1D92E9",children:ae.jsx(vt,{name:"force_insert",size:15,color:"#fff",onClick:Fe})})},{name:"force_disconnect",icon:ae.jsx(vt,{name:"force_disconnect",onClick:we,size:25})},{name:"reject",icon:ae.jsx(vt,{name:"jujie",color:"red",onClick:At,size:25})},{name:"hangup",icon:ae.jsx(vt,{name:"guaji",color:"red",onClick:Ct,size:25})},{name:"dtmf",icon:ae.jsx(No,{trigger:"click",onOpenChange:()=>{Ze("")},title:ae.jsx(di,{style:{borderRadius:20,textAlign:"center"},placeholder:"点击进行发送按键",value:Oe}),content:ae.jsx("div",{style:{width:300},children:ae.jsx(Dy,{onCallBack:re=>{var Ce;const X=Oe+re;Ze(X),(Ce=I.current)==null||Ce.call_api.sendDTMF(re)}})}),children:ae.jsx(vt,{name:"dtmf",size:25})})}].filter(({name:re})=>q.includes(re)),[q,Oe]);return ae.jsx(ae.Fragment,{children:ae.jsxs(_r,{prefixCls:"ysyt",theme:{components:{Select:{selectorBg:"none"}}},children:[Z?ae.jsx(Sc,{spinning:R,children:ae.jsxs(WI,{height:v,children:[ae.jsx(JI,{children:ae.jsx(go,{variant:"underlined",value:P,onChange:j=>{Je(j)},options:(((Ue=I.current.getAgentData())==null?void 0:Ue.answer_devices)||[]).map(j=>({...j,label:ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[SN[j.value],ae.jsx("span",{style:{marginLeft:5},children:j.label})]})})),style:{width:140}})}),ae.jsxs(_I,{background:tt(IN[Z]??2),children:[ae.jsxs("div",{className:"ysyt-strip",children:[ae.jsx("div",{children:J?ae.jsx("span",{className:"ysyt-strip-state-name",children:J}):ae.jsx(ty,{trigger:["click"],menu:{items:$.map(j=>({label:ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[j.state===1?ae.jsx(vt,{name:"kongxian",color:"#7cb305",size:16}):ae.jsx(vt,{name:"manglu",color:"#f5222d",size:16}),ae.jsx("span",{style:{marginLeft:10},children:j.state_name})]}),key:j.state_name,onClick:()=>{lt(j.state,j.state_name)}}))},children:ae.jsxs("div",{style:{color:"#fff",cursor:"pointer",display:"flex",alignItems:"center"},children:[Z==="空闲"?ae.jsx(vt,{name:"kongxian",color:"#fff",size:20}):ae.jsx(ae.Fragment,{children:Z==="未注册"?ae.jsx(vt,{name:"unregistered",size:20}):ae.jsx(vt,{name:"manglu2",size:20})}),ae.jsx("span",{style:{margin:"0 10px"},children:Z}),ae.jsx(vt,{name:"xia",color:"#fff"})]})})}),ae.jsx("div",{className:"ysyt-strip-time",children:ae.jsx(dN,{},B)}),u&&S&&ae.jsx("div",{className:"ysyt-strip-call-card",onClick:()=>pe(!Ie),children:Ie?ae.jsx(vt,{name:"unopen",color:"#fff"}):ae.jsx(vt,{name:"open",color:"#fff"})})]}),ae.jsx("div",{className:"ysyt-action",children:ze.map(({name:j,icon:re})=>ae.jsx(us,{title:wN[j],children:re},j))}),te&&ae.jsx(s2,{children:ae.jsx("div",{children:ae.jsx(No,{trigger:"click",title:"外显号码池",onOpenChange:j=>{j||Y("")},content:ae.jsxs(A2,{children:[ae.jsx("div",{children:ae.jsx(di,{value:me,placeholder:"请输入外显号码",onChange:j=>Y(j.target.value)})}),ae.jsx("div",{className:"ysyt-number-content",children:ae.jsx(os.Group,{value:ue,onChange:j=>{$e(j.target.value)},options:se.filter(j=>j.includes(me)).map(j=>({label:ae.jsx(c2,{style:{color:ue===j?"#1D92E9":""},children:j},j),value:j}))})})]}),children:ae.jsxs("div",{style:{fontSize:14,cursor:"pointer",color:w||"#333",display:"flex",alignItems:"center"},children:[ae.jsx(vt,{name:"external",color:w||"#333"}),ae.jsx("span",{style:{margin:"0 5px"},children:"外显号码"}),ae.jsx(vt,{name:"xia",color:w||"#333"})]})})})})]}),ae.jsx(r2,{children:b&&b.rtt&&ae.jsx("div",{children:ae.jsx(No,{content:ae.jsxs("div",{children:[ae.jsxs("div",{children:["延迟: ",b.rtt,"ms"]}),b.jitter&&ae.jsxs("div",{children:["抖动: ",b.jitter,"ms"]}),ae.jsxs("div",{children:["丢包: ",b.packetsLost||0]}),b.packetsReceived?ae.jsxs("div",{children:["接收: ",b.packetsReceived]}):null,b.packetsSent?ae.jsxs("div",{children:["发送: ",b.packetsSent]}):null,b.sendBitrate?ae.jsxs("div",{children:["发送码率: ",b.sendBitrate,"KB/s"]}):null,b.recvBitrate?ae.jsxs("div",{children:["接收码率: ",b.recvBitrate,"KB/s"]}):null]}),placement:"bottomLeft",children:ae.jsxs("div",{style:{padding:"0 10px"},children:[b.rtt>=250?ae.jsx(vt,{name:"wifi1"}):"",b.rtt>=121&&b.rtt<250?ae.jsx(vt,{name:"wifi2"}):"",b.rtt<=120?ae.jsx(vt,{name:"wifi3"}):""]})})})}),u&&ae.jsxs(a2,{height:v,show:!!S&&Ie,children:[ae.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[(S==null?void 0:S.is_vip)===1&&ae.jsx(vt,{name:"vip"}),ae.jsx("span",{style:{marginLeft:5},children:S==null?void 0:S.customer_name})]}),ae.jsx("b",{children:S==null?void 0:S.phone})]}),ae.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ae.jsxs("span",{children:[S==null?void 0:S.province,"-",S==null?void 0:S.city]}),ve&&ae.jsxs("span",{children:["当月",ve==="out"?"呼出次数:":"呼入次数:",ae.jsx("span",{style:{color:"#1D92E9"},children:ve==="out"?S==null?void 0:S.contact_count_month:S==null?void 0:S.in_contact_count_month})]})]}),ae.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:ve&&ae.jsxs("span",{children:["总",ve==="out"?"呼出次数:":"呼入次数:",ae.jsx("span",{style:{color:"#1D92E9"},children:ve==="out"?(S==null?void 0:S.contact_count)||0:(S==null?void 0:S.in_contact_count)||0})]})})]})]})}):ae.jsx(ae.Fragment,{}),ae.jsx(N.Suspense,{children:de&&((F=I.current)==null?void 0:F.agent_api)&&ae.jsx(xN,{open:de,queryFetch:I.current.agent_api.getIdleAgentList,onCallBack:j=>{le(!1),j&&Wt(j)}})}),ae.jsx(N.Suspense,{children:Se&&((ge=I.current)==null?void 0:ge.agent_api)&&ae.jsx(RN,{open:Se,queryFetch:I.current.agent_api.getIdleAgentList,onCallBack:(j,re)=>{xe(!1),j&&(re===0?_e(j):re===1&&Te(j))}})})]})})},MN=t=>{var e;return(e=kn.getInstance())==null?void 0:e.call_api.makeCall(t)},TN=()=>{var t;return(t=kn.getInstance())==null?void 0:t.getRealTimeCustomerInfo()},NN=async t=>{var e,n;if(t!==Rt.IDLE&&t!==Rt.BUSY)throw new Error("Invalid agent state");try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.changeState({data:{state:t,state_name:t===Rt.IDLE?"空闲":"忙碌"}}))}catch(r){console.error(r)}},DN=async t=>{var e,n;try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.changeDevice({data:{device:t}}))}catch(r){console.error(r)}},BN=async(t=!1,e)=>{var n,r;try{await((r=(n=kn.getInstance())==null?void 0:n.agent_api)==null?void 0:r.agentLogout({data:{offline_answer:t},success:()=>{e==null||e()}}))}catch(i){console.log(i)}},FN=async(t,e)=>{var n,r;(r=(n=kn.getInstance())==null?void 0:n.call_api)==null||r.previewMakeCall(t,e)},kN=async t=>{var e,n;try{await((n=(e=kn.getInstance())==null?void 0:e.agent_api)==null?void 0:n.listenAgentCall({data:{monitored_agent_no:t},success:()=>{It.success("监听坐席通话成功")}}))}catch(r){console.error(r)}},PN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.earSpeakStart({}))}catch(n){console.log(n)}},QN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.earSpeakStop({}))}catch(n){console.log(n)}},jN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.forceInsert({}))}catch(n){console.log(n)}},LN=async()=>{var t,e;try{await((e=(t=kn.getInstance())==null?void 0:t.call_api)==null?void 0:e.forceDisconnect({}))}catch(n){console.log(n)}};exports.Button=Ao;exports.CONTAINER_MAX_OFFSET=sf;exports.CSSMotion=lo;exports.ConfigContext=Qt;exports.ConfigProvider=_r;exports.ContextIsolator=Ua;exports.DisabledContextProvider=Vv;exports.Empty=si;exports.FastColor=Gt;exports.Input=di;exports.KeyCode=at;exports.Keyframe=Pt;exports.ModelBody=n2;exports.Portal=gc;exports.Radio=os;exports.RefIcon=yc;exports.RefIcon$1=Rf;exports.RefIcon$2=as;exports.RefIcon$3=xf;exports.RefIcon$4=Of;exports.Space=Cc;exports.Spin=Sc;exports.Wave=nc;exports.YsytBarPhone=ON;exports.YsytIconSvg=vt;exports._extends=Qe;exports._objectSpread2=L;exports._slicedToArray=ee;exports._toConsumableArray=Re;exports._typeof=et;exports.agentLogout=BN;exports.callForceInsert=jN;exports.callForceSplit=LN;exports.canUseDom=Ln;exports.classNames=Ae;exports.clearFix=sA;exports.contains=tv;exports.convertLegacyProps=eR;exports.devUseWarning=cn;exports.genFocusStyle=AA;exports.genPresetColor=Uv;exports.genStyleHooks=Tn;exports.genSubStyleComponent=Lv;exports.getConfirmLocale=Wb;exports.getCustomerInfo=TN;exports.getReactRender=uf;exports.getTransitionName=sc;exports.globalConfig=Gd;exports.initMotion=XA;exports.initZoomMotion=Xa;exports.isPresetColor=WC;exports.isPresetStatusColor=OM;exports.jsxRuntimeExports=ae;exports.listenCall=kN;exports.localeValues=oo;exports.makeCall=MN;exports.merge=zt;exports.omit=tr;exports.pickAttrs=ki;exports.previewMakeCall=FN;exports.replaceElement=k1;exports.resetComponent=zn;exports.setAgentDevice=DN;exports.setAgentInitState=NN;exports.startEarSpeak=PN;exports.stopEarSpeak=QN;exports.unit=ye;exports.useCSSVarCls=Ur;exports.useComponentConfig=Jr;exports.useComposeRef=ji;exports.useEvent=rn;exports.useId=rc;exports.useLocale=HA;exports.useSafeState=Lo;exports.useToken=dr;exports.useZIndex=ts;exports.warnContext=s0;exports.warning=Di;exports.withPureRenderTheme=MC;exports.zIndexContext=es;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const b=require("react"),a=require("./index-
|
|
1
|
+
"use strict";const b=require("react"),a=require("./index-CpHjelsP.js");function st(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const s=st(b),it=new a.Keyframe("antFadeIn",{"0%":{opacity:0},"100%":{opacity:1}}),ct=new a.Keyframe("antFadeOut",{"0%":{opacity:1},"100%":{opacity:0}}),dt=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const{antCls:o}=e,n=`${o}-fade`,r=t?"&":"";return[a.initMotion(n,it,ct,e.motionDurationMid,t),{[`
|
|
2
2
|
${r}${n}-enter,
|
|
3
3
|
${r}${n}-appear
|
|
4
4
|
`]:{opacity:0,animationTimingFunction:"linear"},[`${r}${n}-leave`]:{animationTimingFunction:"linear"}}]},ut=e=>{const{paddingXXS:t,lineWidth:o,tagPaddingHorizontal:n,componentCls:r,calc:l}=e,i=l(n).sub(o).equal(),u=l(t).sub(o).equal();return{[r]:Object.assign(Object.assign({},a.resetComponent(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:i,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:`${a.unit(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:"start",position:"relative",[`&${r}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},[`${r}-close-icon`]:{marginInlineStart:u,fontSize:e.tagIconSize,color:e.colorTextDescription,cursor:"pointer",transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},[`&${r}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${r}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:i}}),[`${r}-borderless`]:{borderColor:"transparent",background:e.tagBorderlessBg}}},Ce=e=>{const{lineWidth:t,fontSizeIcon:o,calc:n}=e,r=e.fontSizeSM;return a.merge(e,{tagFontSize:r,tagLineHeight:a.unit(n(e.lineHeightSM).mul(r).equal()),tagIconSize:n(o).sub(n(t).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},pe=e=>({defaultBg:new a.FastColor(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText}),Re=a.genStyleHooks("Tag",e=>{const t=Ce(e);return ut(t)},pe);function oe(e){if(e)return{closable:e.closable,closeIcon:e.closeIcon}}function $e(e){const{closable:t,closeIcon:o}=e||{};return b.useMemo(()=>{if(!t&&(t===!1||o===!1||o===null))return!1;if(t===void 0&&o===void 0)return null;let n={closeIcon:typeof o!="boolean"&&o!==null?o:void 0};return t&&typeof t=="object"&&(n=Object.assign(Object.assign({},n),t)),n},[t,o])}function xe(){const e={};for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];return o.forEach(r=>{r&&Object.keys(r).forEach(l=>{r[l]!==void 0&&(e[l]=r[l])})}),e}const mt={};function Be(e,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mt;const n=$e(e),r=$e(t),l=typeof n!="boolean"?!!(n!=null&&n.disabled):!1,i=b.useMemo(()=>Object.assign({closeIcon:b.createElement(a.RefIcon,null)},o),[o]),u=b.useMemo(()=>n===!1?!1:n?xe(i,r,n):r===!1?!1:r?xe(i,r):i.closable?i:!1,[n,r,i]);return b.useMemo(()=>{if(u===!1)return[!1,null,l];const{closeIconRender:c}=i,{closeIcon:g}=u;let d=g;if(d!=null){c&&(d=c(g));const m=a.pickAttrs(u,!0);Object.keys(m).length&&(d=b.isValidElement(d)?b.cloneElement(d,m):b.createElement("span",Object.assign({},m),d))}return[!0,d,l]},[u,i])}var ft=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o};const gt=s.forwardRef((e,t)=>{const{prefixCls:o,style:n,className:r,checked:l,onChange:i,onClick:u}=e,c=ft(e,["prefixCls","style","className","checked","onChange","onClick"]),{getPrefixCls:g,tag:d}=s.useContext(a.ConfigContext),m=y=>{i==null||i(!l),u==null||u(y)},f=g("tag",o),[v,x,C]=Re(f),p=a.classNames(f,`${f}-checkable`,{[`${f}-checkable-checked`]:l},d==null?void 0:d.className,r,x,C);return v(s.createElement("span",Object.assign({},c,{ref:t,style:Object.assign(Object.assign({},n),d==null?void 0:d.style),className:p,onClick:m})))}),Ct=e=>a.genPresetColor(e,(t,o)=>{let{textColor:n,lightBorderColor:r,lightColor:l,darkColor:i}=o;return{[`${e.componentCls}${e.componentCls}-${t}`]:{color:n,background:l,borderColor:r,"&-inverse":{color:e.colorTextLightSolid,background:i,borderColor:i},[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}}),pt=a.genSubStyleComponent(["Tag","preset"],e=>{const t=Ce(e);return Ct(t)},pe);function bt(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.slice(1)}const ne=(e,t,o)=>{const n=bt(o);return{[`${e.componentCls}${e.componentCls}-${t}`]:{color:e[`color${o}`],background:e[`color${n}Bg`],borderColor:e[`color${n}Border`],[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}},vt=a.genSubStyleComponent(["Tag","status"],e=>{const t=Ce(e);return[ne(t,"success","Success"),ne(t,"processing","Info"),ne(t,"error","Error"),ne(t,"warning","Warning")]},pe);var ht=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o};const yt=s.forwardRef((e,t)=>{const{prefixCls:o,className:n,rootClassName:r,style:l,children:i,icon:u,color:c,onClose:g,bordered:d=!0,visible:m}=e,f=ht(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:v,direction:x,tag:C}=s.useContext(a.ConfigContext),[p,y]=s.useState(!0),h=a.omit(f,["closeIcon","closable"]);process.env.NODE_ENV!=="production"&&a.devUseWarning("Tag").deprecated(!("visible"in e),"visible","visible && <Tag />"),s.useEffect(()=>{m!==void 0&&y(m)},[m]);const S=a.isPresetColor(c),N=a.isPresetStatusColor(c),E=S||N,O=Object.assign(Object.assign({backgroundColor:c&&!E?c:void 0},C==null?void 0:C.style),l),$=v("tag",o),[P,j,H]=Re($),B=a.classNames($,C==null?void 0:C.className,{[`${$}-${c}`]:E,[`${$}-has-color`]:c&&!E,[`${$}-hidden`]:!p,[`${$}-rtl`]:x==="rtl",[`${$}-borderless`]:!d},n,r,j,H),_=I=>{I.stopPropagation(),g==null||g(I),!I.defaultPrevented&&y(!1)},[,V]=Be(oe(e),oe(C),{closable:!1,closeIconRender:I=>{const X=s.createElement("span",{className:`${$}-close-icon`,onClick:_},I);return a.replaceElement(I,X,M=>({onClick:q=>{var R;(R=M==null?void 0:M.onClick)===null||R===void 0||R.call(M,q),_(q)},className:a.classNames(M==null?void 0:M.className,`${$}-close-icon`)}))}}),A=typeof f.onClick=="function"||i&&i.type==="a",z=u||null,W=z?s.createElement(s.Fragment,null,z,i&&s.createElement("span",null,i)):i,L=s.createElement("span",Object.assign({},h,{ref:t,className:B,style:O}),W,V,S&&s.createElement(pt,{key:"preset",prefixCls:$}),N&&s.createElement(vt,{key:"status",prefixCls:$}));return P(A?s.createElement(a.Wave,{component:"Tag"},L):L)}),be=yt;process.env.NODE_ENV!=="production"&&(be.displayName="Tag");be.CheckableTag=gt;function ie(e){return!!(e!=null&&e.then)}const _e=e=>{const{type:t,children:o,prefixCls:n,buttonProps:r,close:l,autoFocus:i,emitEvent:u,isSilent:c,quitOnNullishReturnValue:g,actionFn:d}=e,m=s.useRef(!1),f=s.useRef(null),[v,x]=a.useSafeState(!1),C=function(){l==null||l.apply(void 0,arguments)};s.useEffect(()=>{let h=null;return i&&(h=setTimeout(()=>{var S;(S=f.current)===null||S===void 0||S.focus({preventScroll:!0})})),()=>{h&&clearTimeout(h)}},[]);const p=h=>{ie(h)&&(x(!0),h.then(function(){x(!1,!0),C.apply(void 0,arguments),m.current=!1},S=>{if(x(!1,!0),m.current=!1,!(c!=null&&c()))return Promise.reject(S)}))},y=h=>{if(m.current)return;if(m.current=!0,!d){C();return}let S;if(u){if(S=d(h),g&&!ie(S)){m.current=!1,C(h);return}}else if(d.length)S=d(l),m.current=!1;else if(S=d(),!ie(S)){C();return}p(S)};return s.createElement(a.Button,Object.assign({},a.convertLegacyProps(t),{onClick:y,loading:v,prefixCls:n},r,{ref:f}),o)},ee=b.createContext({}),{Provider:He}=ee,Se=()=>{const{autoFocusButton:e,cancelButtonProps:t,cancelTextLocale:o,isSilent:n,mergedOkCancel:r,rootPrefixCls:l,close:i,onCancel:u,onConfirm:c}=b.useContext(ee);return r?b.createElement(_e,{isSilent:n,actionFn:u,close:function(){i==null||i.apply(void 0,arguments),c==null||c(!1)},autoFocus:e==="cancel",buttonProps:t,prefixCls:`${l}-btn`},o):null},Oe=()=>{const{autoFocusButton:e,close:t,isSilent:o,okButtonProps:n,rootPrefixCls:r,okTextLocale:l,okType:i,onConfirm:u,onOk:c}=b.useContext(ee);return b.createElement(_e,{isSilent:o,type:i||"primary",actionFn:c,close:function(){t==null||t.apply(void 0,arguments),u==null||u(!0)},autoFocus:e==="ok",buttonProps:n,prefixCls:`${r}-btn`},l)};var ze=s.createContext({});function Ne(e,t,o){var n=t;return!n&&o&&(n="".concat(e,"-").concat(o)),n}function Ee(e,t){var o=e["page".concat(t?"Y":"X","Offset")],n="scroll".concat(t?"Top":"Left");if(typeof o!="number"){var r=e.document;o=r.documentElement[n],typeof o!="number"&&(o=r.body[n])}return o}function $t(e){var t=e.getBoundingClientRect(),o={left:t.left,top:t.top},n=e.ownerDocument,r=n.defaultView||n.parentWindow;return o.left+=Ee(r),o.top+=Ee(r,!0),o}const xt=s.memo(function(e){var t=e.children;return t},function(e,t){var o=t.shouldUpdate;return!o});var St={width:0,height:0,overflow:"hidden",outline:"none"},Ot={outline:"none"},ve=b.forwardRef(function(e,t){var o=e.prefixCls,n=e.className,r=e.style,l=e.title,i=e.ariaId,u=e.footer,c=e.closable,g=e.closeIcon,d=e.onClose,m=e.children,f=e.bodyStyle,v=e.bodyProps,x=e.modalRender,C=e.onMouseDown,p=e.onMouseUp,y=e.holderRef,h=e.visible,S=e.forceRender,N=e.width,E=e.height,O=e.classNames,$=e.styles,P=b.useContext(ze),j=P.panel,H=a.useComposeRef(y,j),B=b.useRef(),_=b.useRef();b.useImperativeHandle(t,function(){return{focus:function(){var R;(R=B.current)===null||R===void 0||R.focus({preventScroll:!0})},changeActive:function(R){var Y=document,G=Y.activeElement;R&&G===_.current?B.current.focus({preventScroll:!0}):!R&&G===B.current&&_.current.focus({preventScroll:!0})}}});var V={};N!==void 0&&(V.width=N),E!==void 0&&(V.height=E);var A=u?b.createElement("div",{className:a.classNames("".concat(o,"-footer"),O==null?void 0:O.footer),style:a._objectSpread2({},$==null?void 0:$.footer)},u):null,z=l?b.createElement("div",{className:a.classNames("".concat(o,"-header"),O==null?void 0:O.header),style:a._objectSpread2({},$==null?void 0:$.header)},b.createElement("div",{className:"".concat(o,"-title"),id:i},l)):null,W=b.useMemo(function(){return a._typeof(c)==="object"&&c!==null?c:c?{closeIcon:g??b.createElement("span",{className:"".concat(o,"-close-x")})}:{}},[c,g,o]),L=a.pickAttrs(W,!0),I=a._typeof(c)==="object"&&c.disabled,X=c?b.createElement("button",a._extends({type:"button",onClick:d,"aria-label":"Close"},L,{className:"".concat(o,"-close"),disabled:I}),W.closeIcon):null,M=b.createElement("div",{className:a.classNames("".concat(o,"-content"),O==null?void 0:O.content),style:$==null?void 0:$.content},X,z,b.createElement("div",a._extends({className:a.classNames("".concat(o,"-body"),O==null?void 0:O.body),style:a._objectSpread2(a._objectSpread2({},f),$==null?void 0:$.body)},v),m),A);return b.createElement("div",{key:"dialog-element",role:"dialog","aria-labelledby":l?i:null,"aria-modal":"true",ref:H,style:a._objectSpread2(a._objectSpread2({},r),V),className:a.classNames(o,n),onMouseDown:C,onMouseUp:p},b.createElement("div",{ref:B,tabIndex:0,style:Ot},b.createElement(xt,{shouldUpdate:h||S},x?x(M):M)),b.createElement("div",{tabIndex:0,ref:_,style:St}))});process.env.NODE_ENV!=="production"&&(ve.displayName="Panel");var Ae=s.forwardRef(function(e,t){var o=e.prefixCls,n=e.title,r=e.style,l=e.className,i=e.visible,u=e.forceRender,c=e.destroyOnClose,g=e.motionName,d=e.ariaId,m=e.onVisibleChanged,f=e.mousePosition,v=b.useRef(),x=s.useState(),C=a._slicedToArray(x,2),p=C[0],y=C[1],h={};p&&(h.transformOrigin=p);function S(){var N=$t(v.current);y(f&&(f.x||f.y)?"".concat(f.x-N.left,"px ").concat(f.y-N.top,"px"):"")}return s.createElement(a.CSSMotion,{visible:i,onVisibleChanged:m,onAppearPrepare:S,onEnterPrepare:S,forceRender:u,motionName:g,removeOnLeave:c,ref:v},function(N,E){var O=N.className,$=N.style;return s.createElement(ve,a._extends({},e,{ref:t,title:n,ariaId:d,prefixCls:o,holderRef:E,style:a._objectSpread2(a._objectSpread2(a._objectSpread2({},$),r),h),className:a.classNames(l,O)}))})});Ae.displayName="Content";var Nt=function(t){var o=t.prefixCls,n=t.style,r=t.visible,l=t.maskProps,i=t.motionName,u=t.className;return s.createElement(a.CSSMotion,{key:"mask",visible:r,motionName:i,leavedClassName:"".concat(o,"-mask-hidden")},function(c,g){var d=c.className,m=c.style;return s.createElement("div",a._extends({ref:g,style:a._objectSpread2(a._objectSpread2({},m),n),className:a.classNames("".concat(o,"-mask"),d,u)},l))})},Et=function(t){var o=t.prefixCls,n=o===void 0?"rc-dialog":o,r=t.zIndex,l=t.visible,i=l===void 0?!1:l,u=t.keyboard,c=u===void 0?!0:u,g=t.focusTriggerAfterClose,d=g===void 0?!0:g,m=t.wrapStyle,f=t.wrapClassName,v=t.wrapProps,x=t.onClose,C=t.afterOpenChange,p=t.afterClose,y=t.transitionName,h=t.animation,S=t.closable,N=S===void 0?!0:S,E=t.mask,O=E===void 0?!0:E,$=t.maskTransitionName,P=t.maskAnimation,j=t.maskClosable,H=j===void 0?!0:j,B=t.maskStyle,_=t.maskProps,V=t.rootClassName,A=t.classNames,z=t.styles;process.env.NODE_ENV!=="production"&&(["wrapStyle","bodyStyle","maskStyle"].forEach(function(w){a.warning(!(w in t),"".concat(w," is deprecated, please use styles instead."))}),"wrapClassName"in t&&a.warning(!1,"wrapClassName is deprecated, please use classNames instead."));var W=b.useRef(),L=b.useRef(),I=b.useRef(),X=s.useState(i),M=a._slicedToArray(X,2),q=M[0],R=M[1],Y=a.useId();function G(){a.contains(L.current,document.activeElement)||(W.current=document.activeElement)}function le(){if(!a.contains(L.current,document.activeElement)){var w;(w=I.current)===null||w===void 0||w.focus()}}function k(w){if(w)le();else{if(R(!1),O&&W.current&&d){try{W.current.focus({preventScroll:!0})}catch{}W.current=null}q&&(p==null||p())}C==null||C(w)}function T(w){x==null||x(w)}var D=b.useRef(!1),J=b.useRef(),ot=function(){clearTimeout(J.current),D.current=!0},at=function(){J.current=setTimeout(function(){D.current=!1})},ye=null;H&&(ye=function(se){D.current?D.current=!1:L.current===se.target&&T(se)});function rt(w){if(c&&w.keyCode===a.KeyCode.ESC){w.stopPropagation(),T(w);return}i&&w.keyCode===a.KeyCode.TAB&&I.current.changeActive(!w.shiftKey)}b.useEffect(function(){i&&(R(!0),G())},[i]),b.useEffect(function(){return function(){clearTimeout(J.current)}},[]);var lt=a._objectSpread2(a._objectSpread2(a._objectSpread2({zIndex:r},m),z==null?void 0:z.wrapper),{},{display:q?null:"none"});return s.createElement("div",a._extends({className:a.classNames("".concat(n,"-root"),V)},a.pickAttrs(t,{data:!0})),s.createElement(Nt,{prefixCls:n,visible:O&&i,motionName:Ne(n,$,P),style:a._objectSpread2(a._objectSpread2({zIndex:r},B),z==null?void 0:z.mask),maskProps:_,className:A==null?void 0:A.mask}),s.createElement("div",a._extends({tabIndex:-1,onKeyDown:rt,className:a.classNames("".concat(n,"-wrap"),f,A==null?void 0:A.wrapper),ref:L,onClick:ye,style:lt},v),s.createElement(Ae,a._extends({},t,{onMouseDown:ot,onMouseUp:at,ref:I,closable:N,ariaId:Y,prefixCls:n,visible:i&&q,onClose:T,onVisibleChanged:k,motionName:Ne(n,y,h)}))))},Le=function(t){var o=t.visible,n=t.getContainer,r=t.forceRender,l=t.destroyOnClose,i=l===void 0?!1:l,u=t.afterClose,c=t.panelRef,g=s.useState(o),d=a._slicedToArray(g,2),m=d[0],f=d[1],v=s.useMemo(function(){return{panel:c}},[c]);return s.useEffect(function(){o&&f(!0)},[o]),!r&&i&&!m?null:s.createElement(ze.Provider,{value:v},s.createElement(a.Portal,{open:o||r||m,autoDestroy:!1,getContainer:n,autoLock:o||m},s.createElement(Et,a._extends({},t,{destroyOnClose:i,afterClose:function(){u==null||u(),f(!1)}}))))};Le.displayName="Dialog";const wt=()=>a.canUseDom()&&window.document.documentElement,ae=e=>{const{prefixCls:t,className:o,style:n,size:r,shape:l}=e,i=a.classNames({[`${t}-lg`]:r==="large",[`${t}-sm`]:r==="small"}),u=a.classNames({[`${t}-circle`]:l==="circle",[`${t}-square`]:l==="square",[`${t}-round`]:l==="round"}),c=s.useMemo(()=>typeof r=="number"?{width:r,height:r,lineHeight:`${r}px`}:{},[r]);return s.createElement("span",{className:a.classNames(t,i,u,o),style:Object.assign(Object.assign({},c),n)})},jt=new a.Keyframe("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),re=e=>({height:e,lineHeight:a.unit(e)}),Q=e=>Object.assign({width:e},re(e)),Pt=e=>({background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:jt,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"}),ce=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},re(e)),It=e=>{const{skeletonAvatarCls:t,gradientFromColor:o,controlHeight:n,controlHeightLG:r,controlHeightSM:l}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:o},Q(n)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},Q(r)),[`${t}${t}-sm`]:Object.assign({},Q(l))}},Tt=e=>{const{controlHeight:t,borderRadiusSM:o,skeletonInputCls:n,controlHeightLG:r,controlHeightSM:l,gradientFromColor:i,calc:u}=e;return{[n]:Object.assign({display:"inline-block",verticalAlign:"top",background:i,borderRadius:o},ce(t,u)),[`${n}-lg`]:Object.assign({},ce(r,u)),[`${n}-sm`]:Object.assign({},ce(l,u))}},we=e=>Object.assign({width:e},re(e)),Mt=e=>{const{skeletonImageCls:t,imageSizeBase:o,gradientFromColor:n,borderRadiusSM:r,calc:l}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:n,borderRadius:r},we(l(o).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},we(o)),{maxWidth:l(o).mul(4).equal(),maxHeight:l(o).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}},de=(e,t,o)=>{const{skeletonButtonCls:n}=e;return{[`${o}${n}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${o}${n}-round`]:{borderRadius:t}}},ue=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},re(e)),Rt=e=>{const{borderRadiusSM:t,skeletonButtonCls:o,controlHeight:n,controlHeightLG:r,controlHeightSM:l,gradientFromColor:i,calc:u}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[o]:Object.assign({display:"inline-block",verticalAlign:"top",background:i,borderRadius:t,width:u(n).mul(2).equal(),minWidth:u(n).mul(2).equal()},ue(n,u))},de(e,n,o)),{[`${o}-lg`]:Object.assign({},ue(r,u))}),de(e,r,`${o}-lg`)),{[`${o}-sm`]:Object.assign({},ue(l,u))}),de(e,l,`${o}-sm`))},Bt=e=>{const{componentCls:t,skeletonAvatarCls:o,skeletonTitleCls:n,skeletonParagraphCls:r,skeletonButtonCls:l,skeletonInputCls:i,skeletonImageCls:u,controlHeight:c,controlHeightLG:g,controlHeightSM:d,gradientFromColor:m,padding:f,marginSM:v,borderRadius:x,titleHeight:C,blockRadius:p,paragraphLiHeight:y,controlHeightXS:h,paragraphMarginTop:S}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:f,verticalAlign:"top",[o]:Object.assign({display:"inline-block",verticalAlign:"top",background:m},Q(c)),[`${o}-circle`]:{borderRadius:"50%"},[`${o}-lg`]:Object.assign({},Q(g)),[`${o}-sm`]:Object.assign({},Q(d))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[n]:{width:"100%",height:C,background:m,borderRadius:p,[`+ ${r}`]:{marginBlockStart:d}},[r]:{padding:0,"> li":{width:"100%",height:y,listStyle:"none",background:m,borderRadius:p,"+ li":{marginBlockStart:h}}},[`${r}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${n}, ${r} > li`]:{borderRadius:x}}},[`${t}-with-avatar ${t}-content`]:{[n]:{marginBlockStart:v,[`+ ${r}`]:{marginBlockStart:S}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},Rt(e)),It(e)),Tt(e)),Mt(e)),[`${t}${t}-block`]:{width:"100%",[l]:{width:"100%"},[i]:{width:"100%"}},[`${t}${t}-active`]:{[`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-CpHjelsP.js");exports.YsytAgentLogout=e.agentLogout;exports.YsytCallForceInsert=e.callForceInsert;exports.YsytCallForceSplit=e.callForceSplit;exports.YsytGetCustomerInfo=e.getCustomerInfo;exports.YsytListenCall=e.listenCall;exports.YsytMakeCall=e.makeCall;exports.YsytPreviewMakeCall=e.previewMakeCall;exports.YsytSetAgentDevice=e.setAgentDevice;exports.YsytSetAgentInitState=e.setAgentInitState;exports.YsytStartEarSpeak=e.startEarSpeak;exports.YsytStopEarSpeak=e.stopEarSpeak;exports.default=e.YsytBarPhone;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ak as s, ap as e, aq as l, ah as y, am as Y, ag as o, al as r, aj as n, ai as S, an as i, ao as p, af as C } from "./index-
|
|
1
|
+
import { ak as s, ap as e, aq as l, ah as y, am as Y, ag as o, al as r, aj as n, ai as S, an as i, ao as p, af as C } from "./index-BQ9WPo_3.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as YsytAgentLogout,
|
|
4
4
|
e as YsytCallForceInsert,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ysyt-react-agent-lib",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.27",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/ysyt-react-agent-lib.cjs.js",
|
|
6
6
|
"module": "dist/ysyt-react-agent-lib.es.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"antd": "5.24.0",
|
|
31
31
|
"styled-components": "^6.1.13",
|
|
32
|
-
"ysyt-agent-sdk": "2.0.
|
|
32
|
+
"ysyt-agent-sdk": "2.0.37"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^18.2.0",
|