123456789 |
- import t from"tsignaling-wx";import e from"trtc-wx-sdk";import n from"tim-wx-sdk";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){d(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function a(){a=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var a=e&&e.prototype instanceof I?e:I,o=Object.create(a.prototype),s=new O(r||[]);return i(o,"_invoke",{value:w(t,n,s)}),o}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",p="suspendedYield",v="executing",g="completed",y={};function I(){}function m(){}function E(){}var _={};u(_,s,(function(){return this}));var T=Object.getPrototypeOf,C=T&&T(T(k([])));C&&C!==n&&r.call(C,s)&&(_=C);var b=E.prototype=I.prototype=Object.create(_);function D(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function R(t,e){function n(i,a,o,s){var c=f(t[i],t,a);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&r.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,o,s)}),(function(t){n("throw",t,o,s)})):e.resolve(u).then((function(t){l.value=t,o(l)}),(function(t){return n("throw",t,o,s)}))}s(c.arg)}var a;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return a=a?a.then(i,i):i()}})}function w(e,n,r){var i=d;return function(a,o){if(i===v)throw new Error("Generator is already running");if(i===g){if("throw"===a)throw o;return{value:t,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=S(s,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=v;var l=f(e,n,r);if("normal"===l.type){if(i=r.done?g:p,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=g,r.method="throw",r.arg=l.arg)}}}function S(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function k(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}throw new TypeError(typeof e+" is not iterable")}return m.prototype=E,i(b,"constructor",{value:E,configurable:!0}),i(E,"constructor",{value:m,configurable:!0}),m.displayName=u(E,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,u(t,l,"GeneratorFunction")),t.prototype=Object.create(b),t},e.awrap=function(t){return{__await:t}},D(R.prototype),u(R.prototype,c,(function(){return this})),e.AsyncIterator=R,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new R(h(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},D(b),u(b,l,"Generator"),u(b,s,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=k,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:k(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function o(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function c(t,e,n,r,i,a,o){try{var s=t[a](o),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,i)}function l(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(t){c(a,r,i,o,s,"next",t)}function s(t){c(a,r,i,o,s,"throw",t)}o(void 0)}))}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function f(t,e,n){return e&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(t,e,n){return(e=o(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function I(t,e,n){return I=y()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&g(i,n.prototype),i},I.apply(null,arguments)}function m(t){var e="function"==typeof Map?new Map:void 0;return m=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return I(t,arguments,v(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),g(n,t)},m(t)}function E(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function _(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function T(t){var e=y();return function(){var n,r=v(t);if(e){var i=v(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _(t)}(this,n)}}function C(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return b(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function D(t,e){return function(t,e){if(e.get)return e.get.call(t);return e.value}(t,w(t,e,"get"))}function R(t,e,n){return function(t,e,n){if(e.set)e.set.call(t,n);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=n}}(t,w(t,e,"set"),n),n}function w(t,e,n){if(!e.has(t))throw new TypeError("attempted to "+n+" private field on non-instance");return e.get(t)}function S(t,e,n){!function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,e),e.set(t,n)}var x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function L(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var O=function(t){return t&&t.Math===Math&&t},k=O("object"==typeof globalThis&&globalThis)||O("object"==typeof window&&window)||O("object"==typeof self&&self)||O("object"==typeof x&&x)||O("object"==typeof x&&x)||function(){return this}()||Function("return this")(),A={},N=function(t){try{return!!t()}catch(t){return!0}},U=!N((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),P=!N((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),M=P,j=Function.prototype.call,V=M?j.bind(j):function(){return j.apply(j,arguments)},G={},H={}.propertyIsEnumerable,B=Object.getOwnPropertyDescriptor,F=B&&!H.call({1:2},1);G.f=F?function(t){var e=B(this,t);return!!e&&e.enumerable}:H;var K,z,J=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},W=P,$=Function.prototype,q=$.call,Y=W&&$.bind.bind(q,q),X=W?Y:function(t){return function(){return q.apply(t,arguments)}},Q=X,Z=Q({}.toString),tt=Q("".slice),et=function(t){return tt(Z(t),8,-1)},nt=N,rt=et,it=Object,at=X("".split),ot=nt((function(){return!it("z").propertyIsEnumerable(0)}))?function(t){return"String"===rt(t)?at(t,""):it(t)}:it,st=function(t){return null==t},ct=st,lt=TypeError,ut=function(t){if(ct(t))throw new lt("Can't call method on "+t);return t},ht=ot,ft=ut,dt=function(t){return ht(ft(t))},pt="object"==typeof document&&document.all,vt={all:pt,IS_HTMLDDA:void 0===pt&&void 0!==pt},gt=vt.all,yt=vt.IS_HTMLDDA?function(t){return"function"==typeof t||t===gt}:function(t){return"function"==typeof t},It=yt,mt=vt.all,Et=vt.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:It(t)||t===mt}:function(t){return"object"==typeof t?null!==t:It(t)},_t=k,Tt=yt,Ct=function(t,e){return arguments.length<2?(n=_t[t],Tt(n)?n:void 0):_t[t]&&_t[t][e];var n},bt=X({}.isPrototypeOf),Dt="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Rt=k,wt=Dt,St=Rt.process,xt=Rt.Deno,Lt=St&&St.versions||xt&&xt.version,Ot=Lt&&Lt.v8;Ot&&(z=(K=Ot.split("."))[0]>0&&K[0]<4?1:+(K[0]+K[1])),!z&&wt&&(!(K=wt.match(/Edge\/(\d+)/))||K[1]>=74)&&(K=wt.match(/Chrome\/(\d+)/))&&(z=+K[1]);var kt=z,At=kt,Nt=N,Ut=k.String,Pt=!!Object.getOwnPropertySymbols&&!Nt((function(){var t=Symbol("symbol detection");return!Ut(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&At&&At<41})),Mt=Pt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,jt=Ct,Vt=yt,Gt=bt,Ht=Object,Bt=Mt?function(t){return"symbol"==typeof t}:function(t){var e=jt("Symbol");return Vt(e)&&Gt(e.prototype,Ht(t))},Ft=String,Kt=function(t){try{return Ft(t)}catch(t){return"Object"}},zt=yt,Jt=Kt,Wt=TypeError,$t=function(t){if(zt(t))return t;throw new Wt(Jt(t)+" is not a function")},qt=$t,Yt=st,Xt=function(t,e){var n=t[e];return Yt(n)?void 0:qt(n)},Qt=V,Zt=yt,te=Et,ee=TypeError,ne={exports:{}},re=k,ie=Object.defineProperty,ae=function(t,e){try{ie(re,t,{value:e,configurable:!0,writable:!0})}catch(n){re[t]=e}return e},oe=ae,se="__core-js_shared__",ce=k[se]||oe(se,{}),le=ce;(ne.exports=function(t,e){return le[t]||(le[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.34.0",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.34.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ue=ut,he=Object,fe=function(t){return he(ue(t))},de=fe,pe=X({}.hasOwnProperty),ve=Object.hasOwn||function(t,e){return pe(de(t),e)},ge=X,ye=0,Ie=Math.random(),me=ge(1..toString),Ee=function(t){return"Symbol("+(void 0===t?"":t)+")_"+me(++ye+Ie,36)},_e=k,Te=ne.exports,Ce=ve,be=Ee,De=Pt,Re=Mt,we=_e.Symbol,Se=Te("wks"),xe=Re?we.for||we:we&&we.withoutSetter||be,Le=function(t){return Ce(Se,t)||(Se[t]=De&&Ce(we,t)?we[t]:xe("Symbol."+t)),Se[t]},Oe=V,ke=Et,Ae=Bt,Ne=Xt,Ue=function(t,e){var n,r;if("string"===e&&Zt(n=t.toString)&&!te(r=Qt(n,t)))return r;if(Zt(n=t.valueOf)&&!te(r=Qt(n,t)))return r;if("string"!==e&&Zt(n=t.toString)&&!te(r=Qt(n,t)))return r;throw new ee("Can't convert object to primitive value")},Pe=TypeError,Me=Le("toPrimitive"),je=function(t,e){if(!ke(t)||Ae(t))return t;var n,r=Ne(t,Me);if(r){if(void 0===e&&(e="default"),n=Oe(r,t,e),!ke(n)||Ae(n))return n;throw new Pe("Can't convert object to primitive value")}return void 0===e&&(e="number"),Ue(t,e)},Ve=je,Ge=Bt,He=function(t){var e=Ve(t,"string");return Ge(e)?e:e+""},Be=Et,Fe=k.document,Ke=Be(Fe)&&Be(Fe.createElement),ze=function(t){return Ke?Fe.createElement(t):{}},Je=ze,We=!U&&!N((function(){return 7!==Object.defineProperty(Je("div"),"a",{get:function(){return 7}}).a})),$e=U,qe=V,Ye=G,Xe=J,Qe=dt,Ze=He,tn=ve,en=We,nn=Object.getOwnPropertyDescriptor;A.f=$e?nn:function(t,e){if(t=Qe(t),e=Ze(e),en)try{return nn(t,e)}catch(t){}if(tn(t,e))return Xe(!qe(Ye.f,t,e),t[e])};var rn={},an=U&&N((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),on=Et,sn=String,cn=TypeError,ln=function(t){if(on(t))return t;throw new cn(sn(t)+" is not an object")},un=U,hn=We,fn=an,dn=ln,pn=He,vn=TypeError,gn=Object.defineProperty,yn=Object.getOwnPropertyDescriptor,In="enumerable",mn="configurable",En="writable";rn.f=un?fn?function(t,e,n){if(dn(t),e=pn(e),dn(n),"function"==typeof t&&"prototype"===e&&"value"in n&&En in n&&!n[En]){var r=yn(t,e);r&&r[En]&&(t[e]=n.value,n={configurable:mn in n?n[mn]:r[mn],enumerable:In in n?n[In]:r[In],writable:!1})}return gn(t,e,n)}:gn:function(t,e,n){if(dn(t),e=pn(e),dn(n),hn)try{return gn(t,e,n)}catch(t){}if("get"in n||"set"in n)throw new vn("Accessors not supported");return"value"in n&&(t[e]=n.value),t};var _n=rn,Tn=J,Cn=U?function(t,e,n){return _n.f(t,e,Tn(1,n))}:function(t,e,n){return t[e]=n,t},bn={exports:{}},Dn=U,Rn=ve,wn=Function.prototype,Sn=Dn&&Object.getOwnPropertyDescriptor,xn=Rn(wn,"name"),Ln={EXISTS:xn,PROPER:xn&&"something"===function(){}.name,CONFIGURABLE:xn&&(!Dn||Dn&&Sn(wn,"name").configurable)},On=yt,kn=ce,An=X(Function.toString);On(kn.inspectSource)||(kn.inspectSource=function(t){return An(t)});var Nn,Un,Pn,Mn=kn.inspectSource,jn=yt,Vn=k.WeakMap,Gn=jn(Vn)&&/native code/.test(String(Vn)),Hn=ne.exports,Bn=Ee,Fn=Hn("keys"),Kn=function(t){return Fn[t]||(Fn[t]=Bn(t))},zn={},Jn=Gn,Wn=k,$n=Et,qn=Cn,Yn=ve,Xn=ce,Qn=Kn,Zn=zn,tr="Object already initialized",er=Wn.TypeError,nr=Wn.WeakMap;if(Jn||Xn.state){var rr=Xn.state||(Xn.state=new nr);rr.get=rr.get,rr.has=rr.has,rr.set=rr.set,Nn=function(t,e){if(rr.has(t))throw new er(tr);return e.facade=t,rr.set(t,e),e},Un=function(t){return rr.get(t)||{}},Pn=function(t){return rr.has(t)}}else{var ir=Qn("state");Zn[ir]=!0,Nn=function(t,e){if(Yn(t,ir))throw new er(tr);return e.facade=t,qn(t,ir,e),e},Un=function(t){return Yn(t,ir)?t[ir]:{}},Pn=function(t){return Yn(t,ir)}}var ar={set:Nn,get:Un,has:Pn,enforce:function(t){return Pn(t)?Un(t):Nn(t,{})},getterFor:function(t){return function(e){var n;if(!$n(e)||(n=Un(e)).type!==t)throw new er("Incompatible receiver, "+t+" required");return n}}},or=X,sr=N,cr=yt,lr=ve,ur=U,hr=Ln.CONFIGURABLE,fr=Mn,dr=ar.enforce,pr=ar.get,vr=String,gr=Object.defineProperty,yr=or("".slice),Ir=or("".replace),mr=or([].join),Er=ur&&!sr((function(){return 8!==gr((function(){}),"length",{value:8}).length})),_r=String(String).split("String"),Tr=bn.exports=function(t,e,n){"Symbol("===yr(vr(e),0,7)&&(e="["+Ir(vr(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!lr(t,"name")||hr&&t.name!==e)&&(ur?gr(t,"name",{value:e,configurable:!0}):t.name=e),Er&&n&&lr(n,"arity")&&t.length!==n.arity&&gr(t,"length",{value:n.arity});try{n&&lr(n,"constructor")&&n.constructor?ur&&gr(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=dr(t);return lr(r,"source")||(r.source=mr(_r,"string"==typeof e?e:"")),t};Function.prototype.toString=Tr((function(){return cr(this)&&pr(this).source||fr(this)}),"toString");var Cr=yt,br=rn,Dr=bn.exports,Rr=ae,wr=function(t,e,n,r){r||(r={});var i=r.enumerable,a=void 0!==r.name?r.name:e;if(Cr(n)&&Dr(n,a,r),r.global)i?t[e]=n:Rr(e,n);else{try{r.unsafe?t[e]&&(i=!0):delete t[e]}catch(t){}i?t[e]=n:br.f(t,e,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return t},Sr={},xr=Math.ceil,Lr=Math.floor,Or=Math.trunc||function(t){var e=+t;return(e>0?Lr:xr)(e)},kr=function(t){var e=+t;return e!=e||0===e?0:Or(e)},Ar=kr,Nr=Math.max,Ur=Math.min,Pr=function(t,e){var n=Ar(t);return n<0?Nr(n+e,0):Ur(n,e)},Mr=kr,jr=Math.min,Vr=function(t){return t>0?jr(Mr(t),9007199254740991):0},Gr=Vr,Hr=function(t){return Gr(t.length)},Br=dt,Fr=Pr,Kr=Hr,zr=function(t){return function(e,n,r){var i,a=Br(e),o=Kr(a),s=Fr(r,o);if(t&&n!=n){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((t||s in a)&&a[s]===n)return t||s||0;return!t&&-1}},Jr={includes:zr(!0),indexOf:zr(!1)},Wr=ve,$r=dt,qr=Jr.indexOf,Yr=zn,Xr=X([].push),Qr=function(t,e){var n,r=$r(t),i=0,a=[];for(n in r)!Wr(Yr,n)&&Wr(r,n)&&Xr(a,n);for(;e.length>i;)Wr(r,n=e[i++])&&(~qr(a,n)||Xr(a,n));return a},Zr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ti=Qr,ei=Zr.concat("length","prototype");Sr.f=Object.getOwnPropertyNames||function(t){return ti(t,ei)};var ni={};ni.f=Object.getOwnPropertySymbols;var ri=Ct,ii=Sr,ai=ni,oi=ln,si=X([].concat),ci=ri("Reflect","ownKeys")||function(t){var e=ii.f(oi(t)),n=ai.f;return n?si(e,n(t)):e},li=ve,ui=ci,hi=A,fi=rn,di=N,pi=yt,vi=/#|\.prototype\./,gi=function(t,e){var n=Ii[yi(t)];return n===Ei||n!==mi&&(pi(e)?di(e):!!e)},yi=gi.normalize=function(t){return String(t).replace(vi,".").toLowerCase()},Ii=gi.data={},mi=gi.NATIVE="N",Ei=gi.POLYFILL="P",_i=gi,Ti=k,Ci=A.f,bi=Cn,Di=wr,Ri=ae,wi=function(t,e,n){for(var r=ui(e),i=fi.f,a=hi.f,o=0;o<r.length;o++){var s=r[o];li(t,s)||n&&li(n,s)||i(t,s,a(e,s))}},Si=_i,xi=function(t,e){var n,r,i,a,o,s=t.target,c=t.global,l=t.stat;if(n=c?Ti:l?Ti[s]||Ri(s,{}):(Ti[s]||{}).prototype)for(r in e){if(a=e[r],i=t.dontCallGetSet?(o=Ci(n,r))&&o.value:n[r],!Si(c?r:s+(l?".":"#")+r,t.forced)&&void 0!==i){if(typeof a==typeof i)continue;wi(a,i)}(t.sham||i&&i.sham)&&bi(a,"sham",!0),Di(n,r,a,t)}},Li=et,Oi=Array.isArray||function(t){return"Array"===Li(t)},ki=TypeError,Ai=function(t){if(t>9007199254740991)throw ki("Maximum allowed index exceeded");return t},Ni=He,Ui=rn,Pi=J,Mi=function(t,e,n){var r=Ni(e);r in t?Ui.f(t,r,Pi(0,n)):t[r]=n},ji={};ji[Le("toStringTag")]="z";var Vi="[object z]"===String(ji),Gi=Vi,Hi=yt,Bi=et,Fi=Le("toStringTag"),Ki=Object,zi="Arguments"===Bi(function(){return arguments}()),Ji=Gi?Bi:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ki(t),Fi))?n:zi?Bi(e):"Object"===(r=Bi(e))&&Hi(e.callee)?"Arguments":r},Wi=X,$i=N,qi=yt,Yi=Ji,Xi=Mn,Qi=function(){},Zi=[],ta=Ct("Reflect","construct"),ea=/^\s*(?:class|function)\b/,na=Wi(ea.exec),ra=!ea.test(Qi),ia=function(t){if(!qi(t))return!1;try{return ta(Qi,Zi,t),!0}catch(t){return!1}},aa=function(t){if(!qi(t))return!1;switch(Yi(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ra||!!na(ea,Xi(t))}catch(t){return!0}};aa.sham=!0;var oa=!ta||$i((function(){var t;return ia(ia.call)||!ia(Object)||!ia((function(){t=!0}))||t}))?aa:ia,sa=Oi,ca=oa,la=Et,ua=Le("species"),ha=Array,fa=function(t){var e;return sa(t)&&(e=t.constructor,(ca(e)&&(e===ha||sa(e.prototype))||la(e)&&null===(e=e[ua]))&&(e=void 0)),void 0===e?ha:e},da=function(t,e){return new(fa(t))(0===e?0:e)},pa=N,va=kt,ga=Le("species"),ya=function(t){return va>=51||!pa((function(){var e=[];return(e.constructor={})[ga]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Ia=xi,ma=N,Ea=Oi,_a=Et,Ta=fe,Ca=Hr,ba=Ai,Da=Mi,Ra=da,wa=ya,Sa=kt,xa=Le("isConcatSpreadable"),La=Sa>=51||!ma((function(){var t=[];return t[xa]=!1,t.concat()[0]!==t})),Oa=function(t){if(!_a(t))return!1;var e=t[xa];return void 0!==e?!!e:Ea(t)};Ia({target:"Array",proto:!0,arity:1,forced:!La||!wa("concat")},{concat:function(t){var e,n,r,i,a,o=Ta(this),s=Ra(o,0),c=0;for(e=-1,r=arguments.length;e<r;e++)if(Oa(a=-1===e?o:arguments[e]))for(i=Ca(a),ba(c+i),n=0;n<i;n++,c++)n in a&&Da(s,c,a[n]);else ba(c+1),Da(s,c++,a);return s.length=c,s}});var ka=X,Aa=wr,Na=Date.prototype,Ua="Invalid Date",Pa="toString",Ma=ka(Na[Pa]),ja=ka(Na.getTime);String(new Date(NaN))!==Ua&&Aa(Na,Pa,(function(){var t=ja(this);return t==t?Ma(this):Ua}));var Va=Qr,Ga=Zr,Ha=Object.keys||function(t){return Va(t,Ga)},Ba=fe,Fa=Ha;xi({target:"Object",stat:!0,forced:N((function(){Fa(1)}))},{keys:function(t){return Fa(Ba(t))}});var Ka=et,za=X,Ja=function(t){if("Function"===Ka(t))return za(t)},Wa=N,$a=function(t,e){var n=[][t];return!!n&&Wa((function(){n.call(null,e||function(){return 1},1)}))},qa=xi,Ya=Jr.indexOf,Xa=$a,Qa=Ja([].indexOf),Za=!!Qa&&1/Qa([1],1,-0)<0;qa({target:"Array",proto:!0,forced:Za||!Xa("indexOf")},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return Za?Qa(this,t,e)||0:Ya(this,t,e)}});var to=$t,eo=P,no=Ja(Ja.bind),ro=function(t,e){return to(t),void 0===e?t:eo?no(t,e):function(){return t.apply(e,arguments)}},io=ro,ao=ot,oo=fe,so=Hr,co=da,lo=X([].push),uo=function(t){var e=1===t,n=2===t,r=3===t,i=4===t,a=6===t,o=7===t,s=5===t||a;return function(c,l,u,h){for(var f,d,p=oo(c),v=ao(p),g=so(v),y=io(l,u),I=0,m=h||co,E=e?m(c,g):n||o?m(c,0):void 0;g>I;I++)if((s||I in v)&&(d=y(f=v[I],I,p),t))if(e)E[I]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return I;case 2:lo(E,f)}else switch(t){case 4:return!1;case 7:lo(E,f)}return a?-1:r||i?i:E}},ho={forEach:uo(0),map:uo(1),filter:uo(2),some:uo(3),every:uo(4),find:uo(5),findIndex:uo(6),filterReject:uo(7)},fo=ho.filter;xi({target:"Array",proto:!0,forced:!ya("filter")},{filter:function(t){return fo(this,t,arguments.length>1?arguments[1]:void 0)}});var po=Ji,vo=Vi?{}.toString:function(){return"[object "+po(this)+"]"};Vi||wr(Object.prototype,"toString",vo,{unsafe:!0});var go=ho.map;xi({target:"Array",proto:!0,forced:!ya("map")},{map:function(t){return go(this,t,arguments.length>1?arguments[1]:void 0)}});var yo=xi,Io=Date,mo=X(Io.prototype.getTime);yo({target:"Date",stat:!0},{now:function(){return mo(new Io)}});var Eo=U,_o=X,To=V,Co=N,bo=Ha,Do=ni,Ro=G,wo=fe,So=ot,xo=Object.assign,Lo=Object.defineProperty,Oo=_o([].concat),ko=!xo||Co((function(){if(Eo&&1!==xo({b:1},xo(Lo({},"a",{enumerable:!0,get:function(){Lo(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol("assign detection"),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!==xo({},t)[n]||bo(xo({},e)).join("")!==r}))?function(t,e){for(var n=wo(t),r=arguments.length,i=1,a=Do.f,o=Ro.f;r>i;)for(var s,c=So(arguments[i++]),l=a?Oo(bo(c),a(c)):bo(c),u=l.length,h=0;u>h;)s=l[h++],Eo&&!To(o,c,s)||(n[s]=c[s]);return n}:xo,Ao=ko;xi({target:"Object",stat:!0,arity:2,forced:Object.assign!==Ao},{assign:Ao});var No,Uo,Po,Mo,jo="process"===et(k.process),Vo=X,Go=$t,Ho=yt,Bo=String,Fo=TypeError,Ko=function(t,e,n){try{return Vo(Go(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(t){}},zo=ln,Jo=function(t){if("object"==typeof t||Ho(t))return t;throw new Fo("Can't set "+Bo(t)+" as a prototype")},Wo=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Ko(Object.prototype,"__proto__","set"))(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return zo(n),Jo(r),e?t(n,r):n.__proto__=r,n}}():void 0),$o=rn.f,qo=ve,Yo=Le("toStringTag"),Xo=function(t,e,n){t&&!n&&(t=t.prototype),t&&!qo(t,Yo)&&$o(t,Yo,{configurable:!0,value:e})},Qo=bn.exports,Zo=rn,ts=function(t,e,n){return n.get&&Qo(n.get,e,{getter:!0}),n.set&&Qo(n.set,e,{setter:!0}),Zo.f(t,e,n)},es=Ct,ns=ts,rs=U,is=Le("species"),as=function(t){var e=es(t);rs&&e&&!e[is]&&ns(e,is,{configurable:!0,get:function(){return this}})},os=bt,ss=TypeError,cs=function(t,e){if(os(e,t))return t;throw new ss("Incorrect invocation")},ls=oa,us=Kt,hs=TypeError,fs=ln,ds=function(t){if(ls(t))return t;throw new hs(us(t)+" is not a constructor")},ps=st,vs=Le("species"),gs=P,ys=Function.prototype,Is=ys.apply,ms=ys.call,Es="object"==typeof Reflect&&Reflect.apply||(gs?ms.bind(Is):function(){return ms.apply(Is,arguments)}),_s=Ct("document","documentElement"),Ts=X([].slice),Cs=TypeError,bs=function(t,e){if(t<e)throw new Cs("Not enough arguments");return t},Ds=/(?:ipad|iphone|ipod).*applewebkit/i.test(Dt),Rs=k,ws=Es,Ss=ro,xs=yt,Ls=ve,Os=N,ks=_s,As=Ts,Ns=ze,Us=bs,Ps=Ds,Ms=jo,js=Rs.setImmediate,Vs=Rs.clearImmediate,Gs=Rs.process,Hs=Rs.Dispatch,Bs=Rs.Function,Fs=Rs.MessageChannel,Ks=Rs.String,zs=0,Js={},Ws="onreadystatechange";Os((function(){No=Rs.location}));var $s=function(t){if(Ls(Js,t)){var e=Js[t];delete Js[t],e()}},qs=function(t){return function(){$s(t)}},Ys=function(t){$s(t.data)},Xs=function(t){Rs.postMessage(Ks(t),No.protocol+"//"+No.host)};js&&Vs||(js=function(t){Us(arguments.length,1);var e=xs(t)?t:Bs(t),n=As(arguments,1);return Js[++zs]=function(){ws(e,void 0,n)},Uo(zs),zs},Vs=function(t){delete Js[t]},Ms?Uo=function(t){Gs.nextTick(qs(t))}:Hs&&Hs.now?Uo=function(t){Hs.now(qs(t))}:Fs&&!Ps?(Mo=(Po=new Fs).port2,Po.port1.onmessage=Ys,Uo=Ss(Mo.postMessage,Mo)):Rs.addEventListener&&xs(Rs.postMessage)&&!Rs.importScripts&&No&&"file:"!==No.protocol&&!Os(Xs)?(Uo=Xs,Rs.addEventListener("message",Ys,!1)):Uo=Ws in Ns("script")?function(t){ks.appendChild(Ns("script"))[Ws]=function(){ks.removeChild(this),$s(t)}}:function(t){setTimeout(qs(t),0)});var Qs={set:js,clear:Vs},Zs=function(){this.head=null,this.tail=null};Zs.prototype={add:function(t){var e={item:t,next:null},n=this.tail;n?n.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}};var tc,ec,nc,rc,ic,ac=Zs,oc=/ipad|iphone|ipod/i.test(Dt)&&"undefined"!=typeof Pebble,sc=/web0s(?!.*chrome)/i.test(Dt),cc=k,lc=ro,uc=A.f,hc=Qs.set,fc=ac,dc=Ds,pc=oc,vc=sc,gc=jo,yc=cc.MutationObserver||cc.WebKitMutationObserver,Ic=cc.document,mc=cc.process,Ec=cc.Promise,_c=uc(cc,"queueMicrotask"),Tc=_c&&_c.value;if(!Tc){var Cc=new fc,bc=function(){var t,e;for(gc&&(t=mc.domain)&&t.exit();e=Cc.get();)try{e()}catch(t){throw Cc.head&&tc(),t}t&&t.enter()};dc||gc||vc||!yc||!Ic?!pc&&Ec&&Ec.resolve?((rc=Ec.resolve(void 0)).constructor=Ec,ic=lc(rc.then,rc),tc=function(){ic(bc)}):gc?tc=function(){mc.nextTick(bc)}:(hc=lc(hc,cc),tc=function(){hc(bc)}):(ec=!0,nc=Ic.createTextNode(""),new yc(bc).observe(nc,{characterData:!0}),tc=function(){nc.data=ec=!ec}),Tc=function(t){Cc.head||tc(),Cc.add(t)}}var Dc=Tc,Rc=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},wc=k.Promise,Sc="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,xc=!Sc&&!jo&&"object"==typeof window&&"object"==typeof document,Lc=k,Oc=wc,kc=yt,Ac=_i,Nc=Mn,Uc=Le,Pc=xc,Mc=Sc,jc=kt;Oc&&Oc.prototype;var Vc=Uc("species"),Gc=!1,Hc=kc(Lc.PromiseRejectionEvent),Bc=Ac("Promise",(function(){var t=Nc(Oc),e=t!==String(Oc);if(!e&&66===jc)return!0;if(!jc||jc<51||!/native code/.test(t)){var n=new Oc((function(t){t(1)})),r=function(t){t((function(){}),(function(){}))};if((n.constructor={})[Vc]=r,!(Gc=n.then((function(){}))instanceof r))return!0}return!e&&(Pc||Mc)&&!Hc})),Fc={CONSTRUCTOR:Bc,REJECTION_EVENT:Hc,SUBCLASSING:Gc},Kc={},zc=$t,Jc=TypeError,Wc=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw new Jc("Bad Promise constructor");e=t,n=r})),this.resolve=zc(e),this.reject=zc(n)};Kc.f=function(t){return new Wc(t)};var $c,qc,Yc,Xc=xi,Qc=jo,Zc=k,tl=V,el=wr,nl=Wo,rl=Xo,il=as,al=$t,ol=yt,sl=Et,cl=cs,ll=function(t,e){var n,r=fs(t).constructor;return void 0===r||ps(n=fs(r)[vs])?e:ds(n)},ul=Qs.set,hl=Dc,fl=function(t,e){try{1===arguments.length?console.error(t):console.error(t,e)}catch(t){}},dl=Rc,pl=ac,vl=ar,gl=wc,yl=Kc,Il="Promise",ml=Fc.CONSTRUCTOR,El=Fc.REJECTION_EVENT,_l=Fc.SUBCLASSING,Tl=vl.getterFor(Il),Cl=vl.set,bl=gl&&gl.prototype,Dl=gl,Rl=bl,wl=Zc.TypeError,Sl=Zc.document,xl=Zc.process,Ll=yl.f,Ol=Ll,kl=!!(Sl&&Sl.createEvent&&Zc.dispatchEvent),Al="unhandledrejection",Nl=function(t){var e;return!(!sl(t)||!ol(e=t.then))&&e},Ul=function(t,e){var n,r,i,a=e.value,o=1===e.state,s=o?t.ok:t.fail,c=t.resolve,l=t.reject,u=t.domain;try{s?(o||(2===e.rejection&&Gl(e),e.rejection=1),!0===s?n=a:(u&&u.enter(),n=s(a),u&&(u.exit(),i=!0)),n===t.promise?l(new wl("Promise-chain cycle")):(r=Nl(n))?tl(r,n,c,l):c(n)):l(a)}catch(t){u&&!i&&u.exit(),l(t)}},Pl=function(t,e){t.notified||(t.notified=!0,hl((function(){for(var n,r=t.reactions;n=r.get();)Ul(n,t);t.notified=!1,e&&!t.rejection&&jl(t)})))},Ml=function(t,e,n){var r,i;kl?((r=Sl.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),Zc.dispatchEvent(r)):r={promise:e,reason:n},!El&&(i=Zc["on"+t])?i(r):t===Al&&fl("Unhandled promise rejection",n)},jl=function(t){tl(ul,Zc,(function(){var e,n=t.facade,r=t.value;if(Vl(t)&&(e=dl((function(){Qc?xl.emit("unhandledRejection",r,n):Ml(Al,n,r)})),t.rejection=Qc||Vl(t)?2:1,e.error))throw e.value}))},Vl=function(t){return 1!==t.rejection&&!t.parent},Gl=function(t){tl(ul,Zc,(function(){var e=t.facade;Qc?xl.emit("rejectionHandled",e):Ml("rejectionhandled",e,t.value)}))},Hl=function(t,e,n){return function(r){t(e,r,n)}},Bl=function(t,e,n){t.done||(t.done=!0,n&&(t=n),t.value=e,t.state=2,Pl(t,!0))},Fl=function(t,e,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===e)throw new wl("Promise can't be resolved itself");var r=Nl(e);r?hl((function(){var n={done:!1};try{tl(r,e,Hl(Fl,n,t),Hl(Bl,n,t))}catch(e){Bl(n,e,t)}})):(t.value=e,t.state=1,Pl(t,!1))}catch(e){Bl({done:!1},e,t)}}};if(ml&&(Rl=(Dl=function(t){cl(this,Rl),al(t),tl($c,this);var e=Tl(this);try{t(Hl(Fl,e),Hl(Bl,e))}catch(t){Bl(e,t)}}).prototype,($c=function(t){Cl(this,{type:Il,done:!1,notified:!1,parent:!1,reactions:new pl,rejection:!1,state:0,value:void 0})}).prototype=el(Rl,"then",(function(t,e){var n=Tl(this),r=Ll(ll(this,Dl));return n.parent=!0,r.ok=!ol(t)||t,r.fail=ol(e)&&e,r.domain=Qc?xl.domain:void 0,0===n.state?n.reactions.add(r):hl((function(){Ul(r,n)})),r.promise})),qc=function(){var t=new $c,e=Tl(t);this.promise=t,this.resolve=Hl(Fl,e),this.reject=Hl(Bl,e)},yl.f=Ll=function(t){return t===Dl||undefined===t?new qc(t):Ol(t)},ol(gl)&&bl!==Object.prototype)){Yc=bl.then,_l||el(bl,"then",(function(t,e){var n=this;return new Dl((function(t,e){tl(Yc,n,t,e)})).then(t,e)}),{unsafe:!0});try{delete bl.constructor}catch(t){}nl&&nl(bl,Rl)}Xc({global:!0,constructor:!0,wrap:!0,forced:ml},{Promise:Dl}),rl(Dl,Il,!1),il(Il);var Kl={},zl=Kl,Jl=Le("iterator"),Wl=Array.prototype,$l=function(t){return void 0!==t&&(zl.Array===t||Wl[Jl]===t)},ql=Ji,Yl=Xt,Xl=st,Ql=Kl,Zl=Le("iterator"),tu=function(t){if(!Xl(t))return Yl(t,Zl)||Yl(t,"@@iterator")||Ql[ql(t)]},eu=V,nu=$t,ru=ln,iu=Kt,au=tu,ou=TypeError,su=function(t,e){var n=arguments.length<2?au(t):e;if(nu(n))return ru(eu(n,t));throw new ou(iu(t)+" is not iterable")},cu=V,lu=ln,uu=Xt,hu=function(t,e,n){var r,i;lu(t);try{if(!(r=uu(t,"return"))){if("throw"===e)throw n;return n}r=cu(r,t)}catch(t){i=!0,r=t}if("throw"===e)throw n;if(i)throw r;return lu(r),n},fu=ro,du=V,pu=ln,vu=Kt,gu=$l,yu=Hr,Iu=bt,mu=su,Eu=tu,_u=hu,Tu=TypeError,Cu=function(t,e){this.stopped=t,this.result=e},bu=Cu.prototype,Du=function(t,e,n){var r,i,a,o,s,c,l,u=n&&n.that,h=!(!n||!n.AS_ENTRIES),f=!(!n||!n.IS_RECORD),d=!(!n||!n.IS_ITERATOR),p=!(!n||!n.INTERRUPTED),v=fu(e,u),g=function(t){return r&&_u(r,"normal",t),new Cu(!0,t)},y=function(t){return h?(pu(t),p?v(t[0],t[1],g):v(t[0],t[1])):p?v(t,g):v(t)};if(f)r=t.iterator;else if(d)r=t;else{if(!(i=Eu(t)))throw new Tu(vu(t)+" is not iterable");if(gu(i)){for(a=0,o=yu(t);o>a;a++)if((s=y(t[a]))&&Iu(bu,s))return s;return new Cu(!1)}r=mu(t,i)}for(c=f?t.next:r.next;!(l=du(c,r)).done;){try{s=y(l.value)}catch(t){_u(r,"throw",t)}if("object"==typeof s&&s&&Iu(bu,s))return s}return new Cu(!1)},Ru=Le("iterator"),wu=!1;try{var Su=0,xu={next:function(){return{done:!!Su++}},return:function(){wu=!0}};xu[Ru]=function(){return this},Array.from(xu,(function(){throw 2}))}catch(t){}var Lu=function(t,e){try{if(!e&&!wu)return!1}catch(t){return!1}var n=!1;try{var r={};r[Ru]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n},Ou=wc,ku=Fc.CONSTRUCTOR||!Lu((function(t){Ou.all(t).then(void 0,(function(){}))})),Au=V,Nu=$t,Uu=Kc,Pu=Rc,Mu=Du;xi({target:"Promise",stat:!0,forced:ku},{all:function(t){var e=this,n=Uu.f(e),r=n.resolve,i=n.reject,a=Pu((function(){var n=Nu(e.resolve),a=[],o=0,s=1;Mu(t,(function(t){var c=o++,l=!1;s++,Au(n,e,t).then((function(t){l||(l=!0,a[c]=t,--s||r(a))}),i)})),--s||r(a)}));return a.error&&i(a.value),n.promise}});var ju=xi,Vu=Fc.CONSTRUCTOR,Gu=wc,Hu=Ct,Bu=yt,Fu=wr,Ku=Gu&&Gu.prototype;if(ju({target:"Promise",proto:!0,forced:Vu,real:!0},{catch:function(t){return this.then(void 0,t)}}),Bu(Gu)){var zu=Hu("Promise").prototype.catch;Ku.catch!==zu&&Fu(Ku,"catch",zu,{unsafe:!0})}var Ju=V,Wu=$t,$u=Kc,qu=Rc,Yu=Du;xi({target:"Promise",stat:!0,forced:ku},{race:function(t){var e=this,n=$u.f(e),r=n.reject,i=qu((function(){var i=Wu(e.resolve);Yu(t,(function(t){Ju(i,e,t).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var Xu=V,Qu=Kc;xi({target:"Promise",stat:!0,forced:Fc.CONSTRUCTOR},{reject:function(t){var e=Qu.f(this);return Xu(e.reject,void 0,t),e.promise}});var Zu=ln,th=Et,eh=Kc,nh=xi,rh=Fc.CONSTRUCTOR,ih=function(t,e){if(Zu(t),th(e)&&e.constructor===t)return e;var n=eh.f(t);return(0,n.resolve)(e),n.promise};Ct("Promise"),nh({target:"Promise",stat:!0,forced:rh},{resolve:function(t){return ih(this,t)}});var ah="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,oh=k,sh=Es,ch=yt,lh=ah,uh=Dt,hh=Ts,fh=bs,dh=oh.Function,ph=/MSIE .\./.test(uh)||lh&&function(){var t=oh.Bun.version.split(".");return t.length<3||"0"===t[0]&&(t[1]<3||"3"===t[1]&&"0"===t[2])}(),vh=function(t,e){var n=e?2:1;return ph?function(r,i){var a=fh(arguments.length,1)>n,o=ch(r)?r:dh(r),s=a?hh(arguments,n):[],c=a?function(){sh(o,this,s)}:o;return e?t(c,i):t(c)}:t},gh=xi,yh=k,Ih=vh(yh.setInterval,!0);gh({global:!0,bind:!0,forced:yh.setInterval!==Ih},{setInterval:Ih});var mh=xi,Eh=k,_h=vh(Eh.setTimeout,!0);mh({global:!0,bind:!0,forced:Eh.setTimeout!==_h},{setTimeout:_h});var Th=Ji,Ch=String,bh=function(t){if("Symbol"===Th(t))throw new TypeError("Cannot convert a Symbol value to a string");return Ch(t)},Dh=X,Rh=kr,wh=bh,Sh=ut,xh=Dh("".charAt),Lh=Dh("".charCodeAt),Oh=Dh("".slice),kh=function(t){return function(e,n){var r,i,a=wh(Sh(e)),o=Rh(n),s=a.length;return o<0||o>=s?t?"":void 0:(r=Lh(a,o))<55296||r>56319||o+1===s||(i=Lh(a,o+1))<56320||i>57343?t?xh(a,o):r:t?Oh(a,o,o+2):i-56320+(r-55296<<10)+65536}},Ah={codeAt:kh(!1),charAt:kh(!0)},Nh={},Uh=U,Ph=an,Mh=rn,jh=ln,Vh=dt,Gh=Ha;Nh.f=Uh&&!Ph?Object.defineProperties:function(t,e){jh(t);for(var n,r=Vh(e),i=Gh(e),a=i.length,o=0;a>o;)Mh.f(t,n=i[o++],r[n]);return t};var Hh,Bh=ln,Fh=Nh,Kh=Zr,zh=zn,Jh=_s,Wh=ze,$h="prototype",qh="script",Yh=Kn("IE_PROTO"),Xh=function(){},Qh=function(t){return"<"+qh+">"+t+"</"+qh+">"},Zh=function(t){t.write(Qh("")),t.close();var e=t.parentWindow.Object;return t=null,e},tf=function(){try{Hh=new ActiveXObject("htmlfile")}catch(t){}var t,e,n;tf="undefined"!=typeof document?document.domain&&Hh?Zh(Hh):(e=Wh("iframe"),n="java"+qh+":",e.style.display="none",Jh.appendChild(e),e.src=String(n),(t=e.contentWindow.document).open(),t.write(Qh("document.F=Object")),t.close(),t.F):Zh(Hh);for(var r=Kh.length;r--;)delete tf[$h][Kh[r]];return tf()};zh[Yh]=!0;var ef,nf,rf,af=Object.create||function(t,e){var n;return null!==t?(Xh[$h]=Bh(t),n=new Xh,Xh[$h]=null,n[Yh]=t):n=tf(),void 0===e?n:Fh.f(n,e)},of=!N((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),sf=ve,cf=yt,lf=fe,uf=of,hf=Kn("IE_PROTO"),ff=Object,df=ff.prototype,pf=uf?ff.getPrototypeOf:function(t){var e=lf(t);if(sf(e,hf))return e[hf];var n=e.constructor;return cf(n)&&e instanceof n?n.prototype:e instanceof ff?df:null},vf=N,gf=yt,yf=Et,If=pf,mf=wr,Ef=Le("iterator"),_f=!1;[].keys&&("next"in(rf=[].keys())?(nf=If(If(rf)))!==Object.prototype&&(ef=nf):_f=!0);var Tf=!yf(ef)||vf((function(){var t={};return ef[Ef].call(t)!==t}));Tf&&(ef={}),gf(ef[Ef])||mf(ef,Ef,(function(){return this}));var Cf={IteratorPrototype:ef,BUGGY_SAFARI_ITERATORS:_f},bf=Cf.IteratorPrototype,Df=af,Rf=J,wf=Xo,Sf=Kl,xf=function(){return this},Lf=xi,Of=V,kf=yt,Af=function(t,e,n,r){var i=e+" Iterator";return t.prototype=Df(bf,{next:Rf(+!r,n)}),wf(t,i,!1),Sf[i]=xf,t},Nf=pf,Uf=Wo,Pf=Xo,Mf=Cn,jf=wr,Vf=Kl,Gf=Ln.PROPER,Hf=Ln.CONFIGURABLE,Bf=Cf.IteratorPrototype,Ff=Cf.BUGGY_SAFARI_ITERATORS,Kf=Le("iterator"),zf="keys",Jf="values",Wf="entries",$f=function(){return this},qf=function(t,e,n,r,i,a,o){Af(n,e,r);var s,c,l,u=function(t){if(t===i&&v)return v;if(!Ff&&t&&t in d)return d[t];switch(t){case zf:case Jf:case Wf:return function(){return new n(this,t)}}return function(){return new n(this)}},h=e+" Iterator",f=!1,d=t.prototype,p=d[Kf]||d["@@iterator"]||i&&d[i],v=!Ff&&p||u(i),g="Array"===e&&d.entries||p;if(g&&(s=Nf(g.call(new t)))!==Object.prototype&&s.next&&(Nf(s)!==Bf&&(Uf?Uf(s,Bf):kf(s[Kf])||jf(s,Kf,$f)),Pf(s,h,!0)),Gf&&i===Jf&&p&&p.name!==Jf&&(Hf?Mf(d,"name",Jf):(f=!0,v=function(){return Of(p,this)})),i)if(c={values:u(Jf),keys:a?v:u(zf),entries:u(Wf)},o)for(l in c)(Ff||f||!(l in d))&&jf(d,l,c[l]);else Lf({target:e,proto:!0,forced:Ff||f},c);return d[Kf]!==v&&jf(d,Kf,v,{name:i}),Vf[e]=v,c},Yf=function(t,e){return{value:t,done:e}},Xf=Ah.charAt,Qf=bh,Zf=ar,td=qf,ed=Yf,nd="String Iterator",rd=Zf.set,id=Zf.getterFor(nd);td(String,"String",(function(t){rd(this,{type:nd,string:Qf(t),index:0})}),(function(){var t,e=id(this),n=e.string,r=e.index;return r>=n.length?ed(void 0,!0):(t=Xf(n,r),e.index+=t.length,ed(t,!1))}));var ad=Le,od=af,sd=rn.f,cd=ad("unscopables"),ld=Array.prototype;void 0===ld[cd]&&sd(ld,cd,{configurable:!0,value:od(null)});var ud=function(t){ld[cd][t]=!0},hd=dt,fd=ud,dd=Kl,pd=ar,vd=rn.f,gd=qf,yd=Yf,Id=U,md="Array Iterator",Ed=pd.set,_d=pd.getterFor(md),Td=gd(Array,"Array",(function(t,e){Ed(this,{type:md,target:hd(t),index:0,kind:e})}),(function(){var t=_d(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=void 0,yd(void 0,!0);switch(t.kind){case"keys":return yd(n,!1);case"values":return yd(e[n],!1)}return yd([n,e[n]],!1)}),"values"),Cd=dd.Arguments=dd.Array;if(fd("keys"),fd("values"),fd("entries"),Id&&"values"!==Cd.name)try{vd(Cd,"name",{value:"values"})}catch(t){}var bd={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Dd=ze("span").classList,Rd=Dd&&Dd.constructor&&Dd.constructor.prototype,wd=Rd===Object.prototype?void 0:Rd,Sd=k,xd=bd,Ld=wd,Od=Td,kd=Cn,Ad=Xo,Nd=Le("iterator"),Ud=Od.values,Pd=function(t,e){if(t){if(t[Nd]!==Ud)try{kd(t,Nd,Ud)}catch(e){t[Nd]=Ud}if(Ad(t,e,!0),xd[e])for(var n in Od)if(t[n]!==Od[n])try{kd(t,n,Od[n])}catch(e){t[n]=Od[n]}}};for(var Md in xd)Pd(Sd[Md]&&Sd[Md].prototype,Md);Pd(Ld,"DOMTokenList");var jd=xi,Vd=Oi,Gd=oa,Hd=Et,Bd=Pr,Fd=Hr,Kd=dt,zd=Mi,Jd=Le,Wd=Ts,$d=ya("slice"),qd=Jd("species"),Yd=Array,Xd=Math.max;jd({target:"Array",proto:!0,forced:!$d},{slice:function(t,e){var n,r,i,a=Kd(this),o=Fd(a),s=Bd(t,o),c=Bd(void 0===e?o:e,o);if(Vd(a)&&(n=a.constructor,(Gd(n)&&(n===Yd||Vd(n.prototype))||Hd(n)&&null===(n=n[qd]))&&(n=void 0),n===Yd||void 0===n))return Wd(a,s,c);for(r=new(void 0===n?Yd:n)(Xd(c-s,0)),i=0;s<c;s++,i++)s in a&&zd(r,i,a[s]);return r.length=i,r}});var Qd=ho.forEach,Zd=$a("forEach")?[].forEach:function(t){return Qd(this,t,arguments.length>1?arguments[1]:void 0)};xi({target:"Array",proto:!0,forced:[].forEach!==Zd},{forEach:Zd});var tp=k,ep=bd,np=wd,rp=Zd,ip=Cn,ap=function(t){if(t&&t.forEach!==rp)try{ip(t,"forEach",rp)}catch(e){t.forEach=rp}};for(var op in ep)ep[op]&&ap(tp[op]&&tp[op].prototype);ap(np);var sp=ln,cp=hu,lp=ro,up=V,hp=fe,fp=function(t,e,n,r){try{return r?e(sp(n)[0],n[1]):e(n)}catch(e){cp(t,"throw",e)}},dp=$l,pp=oa,vp=Hr,gp=Mi,yp=su,Ip=tu,mp=Array,Ep=function(t){var e=hp(t),n=pp(this),r=arguments.length,i=r>1?arguments[1]:void 0,a=void 0!==i;a&&(i=lp(i,r>2?arguments[2]:void 0));var o,s,c,l,u,h,f=Ip(e),d=0;if(!f||this===mp&&dp(f))for(o=vp(e),s=n?new this(o):mp(o);o>d;d++)h=a?i(e[d],d):e[d],gp(s,d,h);else for(u=(l=yp(e,f)).next,s=n?new this:[];!(c=up(u,l)).done;d++)h=a?fp(l,i,[c.value,d],!0):c.value,gp(s,d,h);return s.length=d,s};xi({target:"Array",stat:!0,forced:!Lu((function(t){Array.from(t)}))},{from:Ep});var _p={exports:{}},Tp={},Cp=Pr,bp=Hr,Dp=Mi,Rp=Array,wp=Math.max,Sp=et,xp=dt,Lp=Sr.f,Op=function(t,e,n){for(var r=bp(t),i=Cp(e,r),a=Cp(void 0===n?r:n,r),o=Rp(wp(a-i,0)),s=0;i<a;i++,s++)Dp(o,s,t[i]);return o.length=s,o},kp="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Tp.f=function(t){return kp&&"Window"===Sp(t)?function(t){try{return Lp(t)}catch(t){return Op(kp)}}(t):Lp(xp(t))};var Ap=N((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),Np=N,Up=Et,Pp=et,Mp=Ap,jp=Object.isExtensible,Vp=Np((function(){jp(1)}))||Mp?function(t){return!!Up(t)&&((!Mp||"ArrayBuffer"!==Pp(t))&&(!jp||jp(t)))}:jp,Gp=!N((function(){return Object.isExtensible(Object.preventExtensions({}))})),Hp=xi,Bp=X,Fp=zn,Kp=Et,zp=ve,Jp=rn.f,Wp=Sr,$p=Tp,qp=Vp,Yp=Gp,Xp=!1,Qp=Ee("meta"),Zp=0,tv=function(t){Jp(t,Qp,{value:{objectID:"O"+Zp++,weakData:{}}})},ev=_p.exports={enable:function(){ev.enable=function(){},Xp=!0;var t=Wp.f,e=Bp([].splice),n={};n[Qp]=1,t(n).length&&(Wp.f=function(n){for(var r=t(n),i=0,a=r.length;i<a;i++)if(r[i]===Qp){e(r,i,1);break}return r},Hp({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:$p.f}))},fastKey:function(t,e){if(!Kp(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!zp(t,Qp)){if(!qp(t))return"F";if(!e)return"E";tv(t)}return t[Qp].objectID},getWeakData:function(t,e){if(!zp(t,Qp)){if(!qp(t))return!0;if(!e)return!1;tv(t)}return t[Qp].weakData},onFreeze:function(t){return Yp&&Xp&&qp(t)&&!zp(t,Qp)&&tv(t),t}};Fp[Qp]=!0;var nv=yt,rv=Et,iv=Wo,av=function(t,e,n){var r,i;return iv&&nv(r=e.constructor)&&r!==n&&rv(i=r.prototype)&&i!==n.prototype&&iv(t,i),t},ov=xi,sv=k,cv=X,lv=_i,uv=wr,hv=_p.exports,fv=Du,dv=cs,pv=yt,vv=st,gv=Et,yv=N,Iv=Lu,mv=Xo,Ev=av,_v=function(t,e,n){var r=-1!==t.indexOf("Map"),i=-1!==t.indexOf("Weak"),a=r?"set":"add",o=sv[t],s=o&&o.prototype,c=o,l={},u=function(t){var e=cv(s[t]);uv(s,t,"add"===t?function(t){return e(this,0===t?0:t),this}:"delete"===t?function(t){return!(i&&!gv(t))&&e(this,0===t?0:t)}:"get"===t?function(t){return i&&!gv(t)?void 0:e(this,0===t?0:t)}:"has"===t?function(t){return!(i&&!gv(t))&&e(this,0===t?0:t)}:function(t,n){return e(this,0===t?0:t,n),this})};if(lv(t,!pv(o)||!(i||s.forEach&&!yv((function(){(new o).entries().next()})))))c=n.getConstructor(e,t,r,a),hv.enable();else if(lv(t,!0)){var h=new c,f=h[a](i?{}:-0,1)!==h,d=yv((function(){h.has(1)})),p=Iv((function(t){new o(t)})),v=!i&&yv((function(){for(var t=new o,e=5;e--;)t[a](e,e);return!t.has(-0)}));p||((c=e((function(t,e){dv(t,s);var n=Ev(new o,t,c);return vv(e)||fv(e,n[a],{that:n,AS_ENTRIES:r}),n}))).prototype=s,s.constructor=c),(d||v)&&(u("delete"),u("has"),r&&u("get")),(v||f)&&u(a),i&&s.clear&&delete s.clear}return l[t]=c,ov({global:!0,constructor:!0,forced:c!==o},l),mv(c,t),i||n.setStrong(c,t,r),c},Tv=wr,Cv=function(t,e,n){for(var r in e)Tv(t,r,e[r],n);return t},bv=af,Dv=ts,Rv=Cv,wv=ro,Sv=cs,xv=st,Lv=Du,Ov=qf,kv=Yf,Av=as,Nv=U,Uv=_p.exports.fastKey,Pv=ar.set,Mv=ar.getterFor,jv={getConstructor:function(t,e,n,r){var i=t((function(t,i){Sv(t,a),Pv(t,{type:e,index:bv(null),first:void 0,last:void 0,size:0}),Nv||(t.size=0),xv(i)||Lv(i,t[r],{that:t,AS_ENTRIES:n})})),a=i.prototype,o=Mv(e),s=function(t,e,n){var r,i,a=o(t),s=c(t,e);return s?s.value=n:(a.last=s={index:i=Uv(e,!0),key:e,value:n,previous:r=a.last,next:void 0,removed:!1},a.first||(a.first=s),r&&(r.next=s),Nv?a.size++:t.size++,"F"!==i&&(a.index[i]=s)),t},c=function(t,e){var n,r=o(t),i=Uv(e);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key===e)return n};return Rv(a,{clear:function(){for(var t=o(this),e=t.index,n=t.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete e[n.index],n=n.next;t.first=t.last=void 0,Nv?t.size=0:this.size=0},delete:function(t){var e=this,n=o(e),r=c(e,t);if(r){var i=r.next,a=r.previous;delete n.index[r.index],r.removed=!0,a&&(a.next=i),i&&(i.previous=a),n.first===r&&(n.first=i),n.last===r&&(n.last=a),Nv?n.size--:e.size--}return!!r},forEach:function(t){for(var e,n=o(this),r=wv(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:n.first;)for(r(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!c(this,t)}}),Rv(a,n?{get:function(t){var e=c(this,t);return e&&e.value},set:function(t,e){return s(this,0===t?0:t,e)}}:{add:function(t){return s(this,t=0===t?0:t,t)}}),Nv&&Dv(a,"size",{configurable:!0,get:function(){return o(this).size}}),i},setStrong:function(t,e,n){var r=e+" Iterator",i=Mv(e),a=Mv(r);Ov(t,e,(function(t,e){Pv(this,{type:r,target:t,state:i(t),kind:e,last:void 0})}),(function(){for(var t=a(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?kv("keys"===e?n.key:"values"===e?n.value:[n.key,n.value],!1):(t.target=void 0,kv(void 0,!0))}),n?"entries":"values",!n,!0),Av(e)}};_v("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),jv);var Vv=U,Gv=Oi,Hv=TypeError,Bv=Object.getOwnPropertyDescriptor,Fv=Vv&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}()?function(t,e){if(Gv(t)&&!Bv(t,"length").writable)throw new Hv("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e},Kv=Kt,zv=TypeError,Jv=xi,Wv=fe,$v=Pr,qv=kr,Yv=Hr,Xv=Fv,Qv=Ai,Zv=da,tg=Mi,eg=function(t,e){if(!delete t[e])throw new zv("Cannot delete property "+Kv(e)+" of "+Kv(t))},ng=ya("splice"),rg=Math.max,ig=Math.min;Jv({target:"Array",proto:!0,forced:!ng},{splice:function(t,e){var n,r,i,a,o,s,c=Wv(this),l=Yv(c),u=$v(t,l),h=arguments.length;for(0===h?n=r=0:1===h?(n=0,r=l-u):(n=h-2,r=ig(rg(qv(e),0),l-u)),Qv(l+n-r),i=Zv(c,r),a=0;a<r;a++)(o=u+a)in c&&tg(i,a,c[o]);if(i.length=r,n<r){for(a=u;a<l-r;a++)s=a+n,(o=a+r)in c?c[s]=c[o]:eg(c,s);for(a=l;a>l-r+n;a--)eg(c,a-1)}else if(n>r)for(a=l-r;a>u;a--)s=a+n-1,(o=a+r-1)in c?c[s]=c[o]:eg(c,s);for(a=0;a<n;a++)c[a+u]=arguments[a+2];return Xv(c,l-r+n),i}});var ag=function(){function t(){u(this,t)}return f(t,[{key:"on",value:function(t,e,n){"function"==typeof e?(this._stores=this._stores||{},(this._stores[t]=this._stores[t]||[]).push({cb:e,ctx:n})):console.error("listener must be a function")}},{key:"emit",value:function(t){this._stores=this._stores||{};var e,n=this._stores[t];if(n){n=n.slice(0),(e=[].slice.call(arguments,1))[0]={eventCode:t,data:e[0]};for(var r=0,i=n.length;r<i;r++)n[r].cb.apply(n[r].ctx,e)}}},{key:"off",value:function(t,e){if(this._stores=this._stores||{},arguments.length){var n=this._stores[t];if(n)if(1!==arguments.length){for(var r=0,i=n.length;r<i;r++)if(n[r].cb===e){n.splice(r,1);break}}else delete this._stores[t]}else this._stores={}}}]),t}(),og={INVITED:"INVITED",ON_CALL_RECEIVED:"onCallReceived",GROUP_CALL_INVITEE_LIST_UPDATE:"GROUP_CALL_INVITEE_LIST_UPDATE",USER_ENTER:"USER_ENTER",USER_LEAVE:"USER_LEAVE",USER_ACCEPT:"USER_ACCEPT",USER_UPDATE:"USER_UPDATE",REJECT:"REJECT",NO_RESP:"NO_RESP",LINE_BUSY:"LINE_BUSY",CALLING_CANCEL:"CALLING_CANCEL",ON_CALL_CANCELED:"onCallCancelled",CALLING_TIMEOUT:"CALLING_TIMEOUT",ON_CALL_BEGIN:"onCallBegin",CALL_END:"CALL_END",USER_VIDEO_AVAILABLE:"USER_VIDEO_AVAILABLE",USER_AUDIO_AVAILABLE:"USER_AUDIO_AVAILABLE",USER_VOICE_VOLUME:"USER_VOICE_VOLUME",SDK_READY:"SDK_READY",KICKED_OUT:"KICKED_OUT",CALL_MODE:"CALL_MODE",HANG_UP:"HANG_UP",MESSAGE_SENT_BY_ME:"onMessageSentByMe",ERROR:"ERROR"},sg={IDLE:"idle",CALLING:"calling",CONNECTED:"connected"},cg=1,lg=2,ug=3,hg=4,fg=5,dg=1,pg={AUDIO:1,VIDEO:2},vg="",gg="inviter",yg="invitee",Ig=0,mg=1,Eg=2,_g=["","audioCall","videoCall"],Tg="audio",Cg="video",bg={EAR:"ear",SPEAKER:"speaker"},Dg={BASE:Math.pow(2,16),PRO:Math.pow(2,17),ULTIMATE:Math.pow(2,18)},Rg=2147483647,wg={DEFAULT:"default",VIDEO:"video",AUDIO:"audio",ON_ERROR:"onError",MAIN:"main",RTC:"rtc",LIVE:"live",SMALL:"small",BIG:"big",AUXILIARY:"auxiliary",NUMBER:"number",STRING:"string",INVITER:"inviter",INVITEE:"invitee",VIDEO_INPUT:"videoinput",AUDIO_INPUT:"audioinput",LOCAL:"local",REMOTE:"remote",TRTC:"TRTC",WXMINIPROGRAM:"wxminiprogram",NORMAL:"normal",REJECT:"reject",IGNORE:"ignore",TIMEOUT:"timeout",RIC:"ric",RAF:"raf",INTERVAL:"interval",CANCEL:"cancel",BUSYLINE:"busyline",UNKNOWN:"unknown",SINGLE_CALL:"SingleCall",GROUP_CALL:"groupCall",CALLER:"caller",CALLEE:"callee",DEVTOOLS:"devtools",AV_CALL:"av_call",CALLKIT_RECORDS_SVR:"callkit_records_svr",SINGLE:"single",GROUP:"group",START_CALL:"start_call",RECEIVE_CALL:"receive_call",CALL_ACCEPTED:"call_accepted",ACCEPT_CALL:"accept_call",CALL_MISSED:"call_missed",NOT_ANSWER_CALL:"not_answer_call",CALL_REJECTED:"call_rejected",REJECT_CALL:"reject_call",CALL_BUSY:"call_busy",IGNORE_CALL:"ignore_call",CANCEL_CALL:"cancel_call",CALL_CANCELED:"call_canceled",CALL_FAILED:"call_failed",CALL_END:"call_end",CALL_INTERRUPTED:"call_interrupted",INVITE_USER:"invite_user",JOIN_IN_GROUP_CALL:"join_in_group_call",EVENT_REPORT:"event_report",HEART_BEAT:"heartbeat",CALLING:"calling",MINI_PROGRAM:"miniProgram",BANNED:"banned",WAITING:"waiting",CONNECTED:"connected"},Sg={MIC_TITLE:"麦克风权限授权",MIC_CONTENT:"使用语音通话,需要在设置中对麦克风进行授权允许",CAMERA_TITLE:"麦克风、摄像头权限授权",CAMERA_CONTENT:"使用视频通话,需要在设置中对麦克风、摄像头进行授权允许",CONFIRM_TEXT:"去设置"},xg="微信开发者工具不支持原生推拉流组件(即 <live-pusher> 和 <live-player> 标签),请使用真机调试或者扫码预览。",Lg={RECORD:"scope.record",CAMERA:"scope.camera"},Og="https://buy.cloud.tencent.com/avc?addRavLicense=1",kg="https://buy.tencentcloud.com/avc?addRavLicense=1",Ag=1,Ng=9,Ug=17,Pg=18,Mg=21,jg=15,Vg="\t\n\v\f\r \u2028\u2029\ufeff",Gg=ut,Hg=bh,Bg=Vg,Fg=X("".replace),Kg=RegExp("^["+Bg+"]+"),zg=RegExp("(^|[^"+Bg+"])["+Bg+"]+$"),Jg=function(t){return function(e){var n=Hg(Gg(e));return 1&t&&(n=Fg(n,Kg,"")),2&t&&(n=Fg(n,zg,"$1")),n}},Wg={start:Jg(1),end:Jg(2),trim:Jg(3)},$g=k,qg=N,Yg=X,Xg=bh,Qg=Wg.trim,Zg=Vg,ty=$g.parseInt,ey=$g.Symbol,ny=ey&&ey.iterator,ry=/^[+-]?0x/i,iy=Yg(ry.exec),ay=8!==ty(Zg+"08")||22!==ty(Zg+"0x16")||ny&&!qg((function(){ty(Object(ny))}))?function(t,e){var n=Qg(Xg(t));return ty(n,e>>>0||(iy(ry,n)?16:10))}:ty;function oy(t){var e=new Date(t);return"".concat(e.getFullYear(),"-")+"".concat(e.getMonth()+1<10?"0".concat(e.getMonth()+1):e.getMonth()+1,"-")+sy(e.getDate()," ")+sy(e.getHours(),":")+sy(e.getMinutes(),":")+sy(e.getSeconds(),"")}function sy(t,e){return"".concat(t<10?"0".concat(t).concat(e):"".concat(t).concat(e))}xi({global:!0,forced:parseInt!==ay},{parseInt:ay});var cy={exports:{}};self;var ly=L(cy.exports=(()=>(()=>{var t={530:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)},i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}c((r=r.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0});var o,s=n(928),c=n(434),l=n(757),u=n(150),h=n(758),f=n(23);!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARING=2]="WARING",t[t.ERROR=3]="ERROR"}(o||(o={}));var d={metric:!0,context:!0},p=function(t,e,n){return void 0===n&&(n=0),(0,s.isPlainObject)(t)?(0,s.isPlainObject)(e)?(Object.keys(e).forEach((function(r){var i=t[r],a=e[r];t[r]=d[r]&&0===n?p(i,a,1):a})),t):t:(0,s.isPlainObject)(e)?e:{}},v={clsConfig:{endpoint:"",topicId:""}},g=function(){function t(t){var e=this;this.url="",this.uploadChannel="",this.sendPipe=null,this.sendEsPipe=null,this._logLevel=o.INFO,this._getReportDataList=[];var n=t||v,r=n.clsConfig,s=n.esConfig,c=r.endpoint,d=r.topicId;this.esConfig=s,this.endpoint=c,this.topicId=d;var p=this.buildUploadUrl();this.url=p,this.initPageUnloadMonitor(),this.sendPipe=(0,l.createPipeline)([(0,f.createThrottlePipe)(this,5),(0,u.formatClsLog)(),(0,h.limitLengthPipe)(),function(t){return i(e,void 0,void 0,(function(){var e,n,r=this;return a(this,(function(o){return e=0,n=function(){return i(r,void 0,void 0,(function(){var r;return a(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.send({url:p,data:t})];case 1:return i.sent(),[3,3];case 2:return r=i.sent(),e<=2?(e++,setTimeout((function(){n()}),1e3)):console.debug(r),[3,3];case 3:return[2]}}))}))},n(),[2]}))}))}])}return t.prototype.initPageUnloadMonitor=function(){var t=this,e=this;!(0,s.isMiniProgram)()&&document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",(function(){if("hidden"===document.visibilityState){var n=t.getCommonReportData(),r=p(n,{level:o.WARING,method:"PAGE_UNLOAD",type:"event"});if(e.esConfig)try{var s=e.esConfig,c=s.url,d=s.table;(0,l.createPipeline)([(0,f.createThrottlePipe)(e,1),(0,u.formatESLog)({table:d}),(0,h.limitLengthPipe)(),function(e){return i(t,void 0,void 0,(function(){var t;return a(this,(function(n){try{t=new Blob([JSON.stringify(e)],{type:"application/x-www-form-urlencoded"}),null===navigator||void 0===navigator||navigator.sendBeacon(c,t)}catch(t){console.debug(t)}return[2]}))}))}])(r)}catch(t){console.debug(t)}}}))},t.prototype.updateEsConfig=function(t){var e=this;try{if(t){this.esConfig=t;var n=t.url,r=t.table;n&&r&&(this.uploadChannel=n,this.sendEsPipe=(0,l.createPipeline)([(0,f.createThrottlePipe)(this,5),(0,u.formatESLog)({table:r}),(0,h.limitLengthPipe)(),function(t){return i(e,void 0,void 0,(function(){var e,r,o=this;return a(this,(function(s){return e=0,r=function(){return i(o,void 0,void 0,(function(){var i;return a(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.send({url:n,data:t})];case 1:return a.sent(),[3,3];case 2:return i=a.sent(),e<=2?(e++,setTimeout((function(){r()}),1e3)):console.debug(i),[3,3];case 3:return[2]}}))}))},r(),[2]}))}))}]))}}catch(t){console.debug(t)}},t.prototype.updateGetReportData=function(t){"function"==typeof t&&this._getReportDataList.push(t)},t.prototype.setLogLevel=function(t){"number"!=typeof t&&(t=o.INFO),this._logLevel=t},t.prototype.createLogFunc=function(t){var e=this;return function(n,r){e.log(n,r,{level:t})}},t.prototype.buildUploadUrl=function(){return this.endpoint&&this.topicId?"".concat(this.endpoint,"/tracklog?topic_id=").concat(this.topicId):""},t.prototype.info=function(t,e){this.log(t,e,{level:o.INFO})},t.prototype.debug=function(t,e){this.log(t,e,{level:o.DEBUG})},t.prototype.warn=function(t,e){this.log(t,e,{level:o.WARING})},t.prototype.error=function(t,e){this.log(t,e,{level:o.ERROR})},t.prototype.log=function(t,e,n){try{var i=n||{},a=i.level;if(i.topicId,this._logLevel<=a){var o=this.getCommonReportData(),s=p(o,r({level:a,method:t},e));this.sendPipe(s),"function"==typeof this.sendEsPipe&&this.sendEsPipe(s)}}catch(t){console.debug(t)}},t.prototype.getCommonReportData=function(){for(var t={},e=0;e<this._getReportDataList.length;e++)t=p(t,this._getReportDataList[e]());return t},t.prototype.send=function(t){return i(this,void 0,void 0,(function(){var e,n,r,i;return a(this,(function(a){switch(a.label){case 0:n=(e=t||{}).url,r=e.data,a.label=1;case 1:return a.trys.push([1,4,,5]),n?[4,(0,c.request)({url:n,data:r,method:"post"})]:[3,3];case 2:a.sent(),a.label=3;case 3:return[3,5];case 4:throw i=a.sent(),console.debug(i),new Error(i);case 5:return[2]}}))}))},t}();e.default=g},314:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatClsLog=void 0;var r=n(928);e.formatClsLog=function(){return function(t,e){try{e({logs:null==t?void 0:t.map((function(t){var e={};return Object.keys(t).forEach((function(n){if((0,r.isPlainObject)(t[n]))try{e[n]=(0,r.stringifyPlus)(t[n])}catch(t){console.debug(t)}else"time"===n&&(e[n]=new Date(t[n]).toISOString()),e[n]=t[n]+""})),{contents:e,time:t.time}})),source:""})}catch(t){console.debug(t)}}}},597:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatESLog=void 0;var r=n(928);e.formatESLog=function(t){var e=t.table;return function(t,n){try{var i=null==t?void 0:t.map((function(t){var e={};return Object.keys(t).forEach((function(n){if((0,r.isPlainObject)(t[n]))try{e[n]=(0,r.stringifyPlus)(t[n])}catch(t){console.debug(t)}else e[n]="level"===n?t[n]+"":"time"===n?new Date(t[n]).toISOString():t[n]})),e}));n({table:e,report:i})}catch(t){console.debug(t)}}}},150:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatClsLog=e.formatESLog=void 0;var r=n(314);Object.defineProperty(e,"formatClsLog",{enumerable:!0,get:function(){return r.formatClsLog}});var i=n(597);Object.defineProperty(e,"formatESLog",{enumerable:!0,get:function(){return i.formatESLog}})},757:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createPipeline=void 0;var r=n(928);e.createPipeline=function(t){if(!t||!t.reduce||!t.length)throw new TypeError("createPipeline need at least one function param");return 1===t.length?function(e,n){t[0](e,n||r.noop)}:t.reduce((function(t,e){return function(n,i){return void 0===i&&(i=r.noop),t(n,(function(t){return null==e?void 0:e(t,i)}))}}))}},758:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.limitLengthPipe=e.MAX_LOG_LENGTH=void 0;var r=n(928);e.MAX_LOG_LENGTH=102400,e.limitLengthPipe=function(){return function(t,n){try{var i=(t=t||{}).logs,a=void 0===i?[]:i;t.logs=null==a?void 0:a.map((function(t){var n=e.MAX_LOG_LENGTH,i=t.contents;return Object.keys(i).forEach((function(t){var e=i[t];try{e&&e.length>n&&(i[t]=null==e?void 0:e.substring(0,n))}catch(a){console.debug("size of content > limitSize"),i[t]=(0,r.stringifyPlus)(e).substring(0,n)}})),t})),n(t)}catch(t){console.debug(t)}}}},23:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createThrottlePipe=void 0,e.createThrottlePipe=function(t,e){var n,r=[];return function(i,a){if(Array.isArray(i)?r=r.concat(i):r.push(i),e&&r.length>=e||t.sendNow&&r.length>0)return a(r.splice(0,r.length)),void(n&&clearTimeout(n));n&&clearTimeout(n),n=setTimeout((function(){n=null,r.length>0&&a(r.splice(0,r.length))}),t.delay||1e3)}}},434:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)},i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}c((r=r.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};Object.defineProperty(e,"__esModule",{value:!0}),e.request=void 0;var s=n(147),c=n(310),l=n(928);e.request=function(t){return i(void 0,void 0,void 0,(function(){var e=t.url,n=t.data,i=t.header,u=void 0===i?{}:i,h=t.method,f=void 0===h?"GET":h,d=t.dataType,p=t.responseType,v=o(t,["url","data","header","method","dataType","responseType"]);return a(this,(function(t){return(0,l.isBrowser)()?[2,(0,c.requestXHR)(e,n,{headers:u,method:f,responseType:p,dataType:d})]:(0,l.isMiniProgram)()?[2,(0,s.requestWeapp)(r({url:e,data:n,header:u,method:f,dataType:d,responseType:p},v))]:(console.debug("unsupport env"),[2])}))}))}},147:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)},i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}c((r=r.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.requestWeapp=void 0;var o=n(690),s=0;e.requestWeapp=function(t){return i(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:n.trys.push([0,5,6,7]),n.label=1;case 1:return s>=2?[4,(0,o.startBlocking)()]:[3,3];case 2:return n.sent(),[3,1];case 3:return s++,[4,new Promise((function(e,n){wx.request(r(r({},t),{success:function(t){e(t)},fail:function(t){n(t)}}))}))];case 4:return[2,n.sent()];case 5:return e=n.sent(),[2,Promise.reject(e)];case 6:return s--,(0,o.resolveFirstBlock)(),[7];case 7:return[2]}}))}))}},310:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}c((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.requestXHR=void 0;var a=n(580),o=n(690),s=0;function c(t,e,n){n.status?e(new Error("Request failed with status code "+n.status)):t(n)}e.default=c,e.requestXHR=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),r(this,void 0,void 0,(function(){var l,u=this;return i(this,(function(h){switch(h.label){case 0:return h.trys.push([0,2,3,4]),[4,new Promise((function(l,h){return r(u,void 0,void 0,(function(){var r,u,f,d,p,v;return i(this,(function(i){switch(i.label){case 0:return s>=2?[4,(0,o.startBlocking)()]:[3,2];case 1:return i.sent(),[3,0];case 2:return s++,r=n.method,u=n.headers,f=void 0===u?{}:u,d=n.responseType,p=void 0===d?"json":d,r=(r||"get").toUpperCase(),Object.assign(f,{"Content-type":"application/json"}),(v=new window.XMLHttpRequest).responseType=p,v.timeout=1e4,v.onreadystatechange=function(){4===v.readyState&&(200===v.status?l({data:v.response}):h({code:v.status,msg:v.statusText}))},v.ontimeout=function(t){h({code:v.status,msg:v.statusText})},v.onloadend=function(){v&&(c((function(t){l(t)}),(function(t){h(t)}),{status:v.status,statusText:v.statusText}),v=null)},v.onabort=function(){v&&(h(new Error("Request aborted")),v=null)},v.onerror=function(){h(new Error("Network Error")),v=null},"GET"===r?t="url".concat(-1===t.indexOf("?")?"?":"&").concat(a.default.stringify(e)):"POST"===r&&(e=JSON.stringify(e)),v.open(r,t,!0),Object.keys(f).forEach((function(t){v.setRequestHeader(t,f[t])})),v.send("POST"===r?e:null),[2]}}))}))}))];case 1:return[2,h.sent()];case 2:throw l=h.sent(),new Error(l);case 3:return s--,(0,o.resolveFirstBlock)(),[7];case 4:return[2]}}))}))}},928:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.date2ISOString=e.stringifyPlus=e.noop=e.isBrowser=e.isMiniProgram=e.isPlainObject=e.appendParams=void 0,e.appendParams=function(t,n){void 0===n&&(n={});var r=[];return Object.keys(n).forEach((function(t){var i=n[t];if(void 0!==i){if((0,e.isPlainObject)(i))try{i=JSON.stringify(i)}catch(t){}r.push("".concat(t,"=").concat(encodeURIComponent(i)))}})),r.length?(t.indexOf("?")>-1?"".concat(t,"&"):"".concat(t,"?"))+r.join("&"):t},e.isPlainObject=function(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;for(var n=e;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return e===n},e.isMiniProgram=function(){try{return!(!(null===wx||void 0===wx?void 0:wx.request)||!(null===wx||void 0===wx?void 0:wx.connectSocket))}catch(t){return!1}},e.isBrowser=function(){try{return!(0,e.isMiniProgram)()&&"undefined"!=typeof window&&void 0!==window.document}catch(t){return!1}},e.noop=function(){};var n=function(){var t=new WeakSet;return function(e,n){if(n instanceof Error)return"Error.message: ".concat(n.message," \n Error.stack: ").concat(n.stack);if("object"==typeof n&&null!==n){if(t.has(n))return"[Circular ".concat(e||"root","]");t.add(n)}return n}};e.stringifyPlus=function(t){if("string"==typeof t)return t;try{return t instanceof Error?(JSON.stringify(t,n())||"undefined").replace(/"/gim,""):JSON.stringify(t,n())||"undefined"}catch(t){return"error happen when aegis stringify: \n ".concat(t.message," \n ").concat(t.stack)}},e.date2ISOString=function(){var t,e=new Date,n=e.toISOString(),r=e.getTimezoneOffset()/60;return t=r<0?r>-10?"+0".concat(Math.abs(100*r)):"+".concat(Math.abs(100*r)):r>=10?"-".concat(100*r):"-0".concat(100*r),n.replace("Z",t)}},580:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=n(928);e.default={stringify:function(t){return t?Object.keys(t).map((function(e){var n=t[e];if((0,r.isPlainObject)(n))n=JSON.stringify(n);else{if("string"!=typeof n&&"number"!=typeof n)return"";n=+n}return encodeURIComponent(e)+"="+encodeURIComponent(n)})).filter((function(t){return t.length>0})).join("&"):""}}},690:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.startBlocking=e.resolveFirstBlock=void 0;var n=[];e.startBlocking=function(){var t,e=new Promise((function(e){t=e}));return n.push({promise:e,resolve:t}),e},e.resolveFirstBlock=function(){n.length&&(n[0].resolve(),n.shift())}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var a=e[r]={exports:{}};return t[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var t=r;Object.defineProperty(t,"__esModule",{value:!0});var e=n(530),i={debug:console.debug,info:console.info,warn:console.warn,error:console.error,updateGetReportData:function(t){console.debug(t)}},a=null;t.default=function(t){if(!a){var n=t||{},r=n.clsConfig,o=(n.esConfig,r.endpoint),s=r.topicId;if(!o||!s)return console.debug("endpoint and topicId must not be null"),i;a=new e.default(t)}return a}})(),r})())()),uy=U,hy=Ln.EXISTS,fy=X,dy=ts,py=Function.prototype,vy=fy(py.toString),gy=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,yy=fy(gy.exec);uy&&!hy&&dy(py,"name",{configurable:!0,get:function(){try{return yy(gy,vy(this))[1]}catch(t){return""}}});var Iy={UNKNOWN:65535,NO_NETWORK:2805,FAILURE_SWITCH_TO_AUDIO:60001,FAILURE_SWITCH_TO_VIDEO:60002,ERROR_PACKAGE_NOT_PURCHASED:-1001,ERROR_PACKAGE_NOT_SUPPORTED:-1002,ERROR_TIM_VERSION_OUTDATED:-1003,ERROR_PERMISSION_DENIED:-1101,ERROR_GET_DEVICE_LIST_FAIL:-1102,ERROR_INIT_FAIL:-1201,ERROR_PARAM_INVALID:-1202,ERROR_REQUEST_REFUSED:-1203,ERROR_REQUEST_REPEATED:-1204,ERROR_SCENE_NOT_SUPPORTED:-1205,ERROR_SIGNALING_SEND_FAIL:-1401,ERROR_INVALID_INVITEID:8010,ERROR_INVALID_SEND_FAIL:20003,ERROR_BLACKLIST:20007},my="未连接到网络",Ey="You do not have TUICallKit package, please open the free experience in the console: https://console.intl.cloud.tencent.com/im/detail or purchase the official package: ${purchaseAddress}",_y="The package you purchased does not support this ability. You can refer to here to purchase: ${purchaseAddress}",Ty="TIM SDK version is too old. Please upgrade version",Cy="init is not complete, this API needs to be used after init. To solve the problem, please go to: https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887",by="The API is support use in the state of. Please go to: https://cloud.tencent.com/document/product/647/78769#5e65043d-e3dc-4bd3-8220-3ac7694dfa42",Dy={NO_NETWORK:"未连接到网络",FAILURE_SWITCH_TO_AUDIO:"切换语音通话失败",FAILURE_SWITCH_TO_VIDEO:"切换视频通话失败",ERROR_NULL:"成功",ERROR_PACKAGE_NOT_PURCHASED:"您的应用还未开通音视频通话(TUICallKit)能力,您可以去控制台申请免费体验: https://console.cloud.tencent.com/im/detail 或购买通话能力套餐包: ${purchaseAddress}",ERROR_PACKAGE_NOT_SUPPORTED:"您暂不支持使用该能力,请前往如下购买页购买开通: ${purchaseAddress}",ERROR_TIM_VERSION_OUTDATED:"TIM SDK 版本太旧,请升级版本",ERROR_PERMISSION_DENIED:"摄像头/麦克风权限被拒绝。解决方案请前往: https://cloud.tencent.com/document/product/647/78770",ERROR_GET_DEVICE_LIST_FAIL:"获取设备列表失败",ERROR_INIT_FAIL:"TUICallEngine init 未完成,需要在 init 完成后使用此 API。解决方案请前往: https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887",ERROR_REQUEST_REFUSED:"当前通话状态无法使用该API。解决方案请前往: https://cloud.tencent.com/document/product/647/78769#5e65043d-e3dc-4bd3-8220-3ac7694dfa42",ERROR_REQUEST_REPEATED:"当前方法正在执行中,请勿重复调用",ERROR_REQUEST_REPEATED_SWITCH:"与当前通话类型一致,请勿重复切换",ERROR_SCENE_NOT_SUPPORTED:"当前通话场景不支持该功能",ERROR_SIGNALING_SEND_FAIL:"信令发送失败",ERROR_INVALID_INVITEID:"inviteID 无效或邀请已处理。解决方案请前往: https://cloud.tencent.com/document/product/647/84363#e97ea97b-7812-42ed-89b7-2a3840ac0e3f",ERROR_INVALID_SEND_FAIL:"消息发送方或接收方 UserID 无效或不存在。解决方案请前往: https://cloud.tencent.com/document/product/647/84363#661be1b0-f649-4199-a343-958c3f4f4bbb",ERROR_PARAM_INVALID:"参数错误"},Ry=function(t){p(n,m(Error));var e=T(n);function n(t){var r,i=t.message,a=t.code,o=void 0===a?Iy.UNKNOWN:a;return u(this,n),r=e.call(this,"".concat(i).concat(function(t){for(var e=0,n=Object.keys(Dy);e<n.length;e++){var r=n[e];if(Iy[r]===t)return Dy[r]}return"UNKNOWN"}(o))+" <".concat(function(t){for(var e=0,n=Object.keys(Iy);e<n.length;e++){var r=n[e];if(Iy[r]===t)return r}return"UNKNOWN"}(o),": ").concat(o,">")),r.code=o,r.name="TUICallEngineError",r.message_=i,r}return f(n,[{key:"getCode",value:function(){return this.code}}]),n}(),wy=["inviteID","type"],Sy=function(){function t(e){u(this,t),this.TSignaling=e.TSignaling,this._logger=ly()}var e,n,r,o,s,c,h;return f(t,[{key:"handleNewSignaling",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._logger.info("TSignaling.handleNewSignaling.start",{text:{data:{data:t,params:e,userData:n}},type:"api"}),i(i({userData:n||""},t),{},{version:4,businessID:"av_call",platform:"MiniApp",data:i({cmd:_g[t.call_type],room_id:t.room_id,message:""},e)})}},{key:"extractCallingInfoFromMessage",value:function(t){if(!t||"TIMCustomElem"!==t.type)return"";var e=JSON.parse(t.payload.data);if(e.businessID!==dg)return"";switch(e.actionType){case cg:var n=JSON.parse(e.data);return n.call_end>0&&!e.groupID?n.call_end:0!==n.call_end&&n.room_id?"发起通话":"结束群聊";case lg:return"取消通话";case ug:return"已接听";case hg:return"拒绝通话";case fg:return"无应答";default:return""}}},{key:"handleError",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.code,n=void 0===e?"":e,r=t.message;if(n)throw new Ry({message:void 0===r?"":r,code:n})}},{key:"_handleInviteData",value:function(t){var e=t.type,n=t.roomID,r=t.userIDList,i=t.hangup,a=t.switchMode,o=t.userData;if(i)return JSON.stringify(this.handleNewSignaling({version:0,call_type:e,call_end:i.callEnd},{cmd:"hangup"}));if(a){var s={version:0,call_type:e,room_id:n},c={cmd:"switchToVideo"};return a===Tg&&(s.switch_to_audio_call="switch_to_audio_call",c.cmd="switchToAudio"),JSON.stringify(this.handleNewSignaling(s,c))}return JSON.stringify(this.handleNewSignaling({version:0,call_type:e,room_id:n},{userIDs:r},o))}},{key:"_handleInviteGroupData",value:function(t){var e=t.type,n=t.roomID,r=t.hangup,i=t.userData;return r?JSON.stringify(this.handleNewSignaling({version:0,call_type:e,call_end:r.call_end},{cmd:"hangup"},i)):JSON.stringify(this.handleNewSignaling({version:0,call_type:e,room_id:n}))}},{key:"invite",value:(h=l(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.invite.start",{text:{data:{params:e}},type:"api"}),n=e.userID,r=e.offlinePushInfo,i=e.hangup,o=e.switchMode,t.prev=2,t.next=5,this.TSignaling.invite({userID:n,data:this._handleInviteData(e),timeout:i?0:30,offlinePushInfo:r});case 5:return t.abrupt("return",t.sent);case 8:if(t.prev=8,t.t0=t.catch(2),this._logger.error("TSignaling.invite.fail",{text:{data:{hangup:i,switchMode:o},error:t.t0},type:"api"}),!i){t.next=13;break}return t.abrupt("return",this.handleError(t.t0,"hangup C2C"));case 13:if(!o){t.next=15;break}return t.abrupt("return",this.handleError(t.t0,o));case 15:return t.abrupt("return",this.handleError(t.t0,"invite"));case 16:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t){return h.apply(this,arguments)})},{key:"inviteGroup",value:(c=l(a().mark((function t(e){var n,r,i,o,s,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.inviteGroup.start",{text:{data:{params:e}},type:"api"}),n=e.groupID,r=e.userIDList,i=e.offlinePushInfo,o=e.hangup,s=e.inCallUserIDs,c=void 0===s?[]:s,t.prev=2,t.next=5,this.TSignaling.inviteInGroup({groupID:n,inviteeList:r,timeout:o?0:30,data:this._handleInviteGroupData(e),offlinePushInfo:i,inCallUserIDs:c});case 5:return t.abrupt("return",t.sent);case 8:if(t.prev=8,t.t0=t.catch(2),this._logger.error("TSignaling.inviteGroup.fail",{text:{data:{hangup:o},error:t.t0},type:"api"}),!o){t.next=13;break}return t.abrupt("return",this.handleError(t.t0,"hangup group"));case 13:return t.abrupt("return",this.handleError(t.t0,"inviteGroup"));case 14:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t){return c.apply(this,arguments)})},{key:"accept",value:(s=l(a().mark((function t(e,n){var r,o,s;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.accept.start",{text:{data:{params:e,supportParams:n}},type:"api"}),r=e.inviteID,o=e.type,s=E(e,wy),t.prev=2,t.next=5,this.TSignaling.accept({inviteID:r,data:JSON.stringify(this.handleNewSignaling(i({version:0,call_type:o},s),n))});case 5:return t.abrupt("return",t.sent);case 8:return t.prev=8,t.t0=t.catch(2),this._logger.error("TSignaling.accept.fail",{text:{error:t.t0},type:"api"}),t.abrupt("return",this.handleError(t.t0,"accept"));case 12:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t,e){return s.apply(this,arguments)})},{key:"reject",value:(o=l(a().mark((function t(e){var n,r,i,o,s;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.reject.start",{text:{data:{params:e}},type:"api"}),n=e.inviteID,r=e.type,i=e.lineBusy,o={version:0,call_type:r},s=null,i?(o.line_busy=i,s=JSON.stringify(this.handleNewSignaling(o,{message:"lineBusy"}))):s=JSON.stringify(this.handleNewSignaling(o)),t.prev=5,t.next=8,this.TSignaling.reject({inviteID:n,data:s});case 8:return t.abrupt("return",t.sent);case 11:if(t.prev=11,t.t0=t.catch(5),this._logger.error("TSignaling.reject.fail",{text:{error:t.t0},type:"api"}),!i){t.next=16;break}return t.abrupt("return",this.handleError(t.t0,"line_busy"));case 16:return t.abrupt("return",this.handleError(t.t0,"reject"));case 17:case"end":return t.stop()}}),t,this,[[5,11]])}))),function(t){return o.apply(this,arguments)})},{key:"cancel",value:(r=l(a().mark((function t(e){var n,r,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.cancel.start",{text:{data:{params:e}},type:"api"}),n=e.inviteID,r=e.callType,t.prev=2,t.next=5,this.TSignaling.cancel({inviteID:n,data:JSON.stringify(this.handleNewSignaling({version:0,call_type:r}))});case 5:return i=t.sent,t.abrupt("return",i);case 9:return t.prev=9,t.t0=t.catch(2),this._logger.error("TSignaling.cancel.fail",{text:{error:t.t0},type:"api"}),t.abrupt("return",this.handleError(t.t0,"cancel"));case 13:case"end":return t.stop()}}),t,this,[[2,9]])}))),function(t){return r.apply(this,arguments)})},{key:"hangup",value:(n=l(a().mark((function t(e){var n,r,i,o,s,c,l,u,h,f,d;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.hangup.start",{text:{data:{params:e}},type:"api"}),n=e.userIDList,r=e.callType,i=e.callEnd,o=void 0===i?0:i,s=e.isGroupCall,c=void 0!==s&&s,l=e.groupID,u=void 0===l?"":l,h={version:0,call_type:r,call_end:o},f={cmd:"hangup"},d=JSON.stringify(this.handleNewSignaling(h,f)),!c||!u){t.next=10;break}return t.next=8,this.TSignaling.inviteInGroup({inviteeList:n,groupID:u,data:d,timeout:0});case 8:t.next=12;break;case 10:return t.next=12,this.TSignaling.invite({userID:n[0],data:d,timeout:0});case 12:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"switchCallMode",value:(e=l(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.switchCallMode.start",{text:{data:{params:e}},type:"api"}),n=e.userID,r=e.callType,i=e.roomID,o=e.mode,t.abrupt("return",this.invite({userID:n,type:r,roomID:i,switchMode:o}));case 3:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"destroyed",value:function(){this._logger.info("TSignaling.destroyed.start",{type:"api"}),this.TSignaling=null}},{key:"setLogLevel",value:function(t){this.TSignaling.setLogLevel(t)}}]),t}(),xy=function(){function t(e){u(this,t),this._emitter=e.emitter,this._logger=ly()}return f(t,[{key:"onError",value:function(t){this._logger.error("TUICallEvent.onError",{text:{error:t},type:"event"}),this._emitter.emit(og.ERROR,t)}},{key:"onCallBegin",value:function(t){this._logger.info("TUICallEvent.onCallBegin",{text:{data:t},type:"event"}),this._emitter.emit(og.ON_CALL_BEGIN,t)}},{key:"onCallEnd",value:function(t){this._logger.info("TUICallEvent.onCallEnd",{text:{data:t},type:"event"});var e=t.userID,n=t.callEnd,r=t.message,i=t.roomID,a=t.callMediaType,o=t.callRole,s=t.totalTime;this._emitter.emit(og.CALL_END,{userID:e,callEnd:n,message:r,roomID:i,callMediaType:a,callRole:o,totalTime:s})}},{key:"onInvited",value:function(t){this._logger.info("TUICallEvent.onInvited",{text:{data:t},type:"event"}),this._emitter.emit(og.INVITED,t),this._emitter.emit(og.ON_CALL_RECEIVED,t)}},{key:"onLineBusy",value:function(t){this._logger.info("TUICallEvent.onLineBusy",{text:{data:t},type:"event"});var e=t.inviteID,n=t.invitee,r=t.userID;this._emitter.emit(og.LINE_BUSY,{inviteID:e,invitee:n,userID:r,reason:"line busy"})}},{key:"onReject",value:function(t){var e=t.inviteID,n=t.invitee,r=t.userID;this._emitter.emit(og.REJECT,{inviteID:e,invitee:n,userID:r,reason:"reject"})}},{key:"onNoResp",value:function(t){this._logger.info("TUICallEvent.onNoResp",{text:{data:t},type:"event"});var e=t.groupID,n=void 0===e?"":e,r=t.inviteID,i=t.sponsor,a=t.timeoutUserList,o=t.userIDList;this._emitter.emit(og.NO_RESP,{groupID:n,inviteID:r,sponsor:i,timeoutUserList:a,userIDList:o})}},{key:"onCancel",value:function(t){this._emitter.emit(og.CALLING_CANCEL,t),this._emitter.emit(og.ON_CALL_CANCELED,t)}},{key:"onTimeout",value:function(t){this._logger.info("TUICallEvent.onTimeout",{text:{data:t},type:"event"});var e=t.inviteID,n=t.groupID,r=t.sponsor,i=t.timeoutUserList;this._emitter.emit(og.CALLING_TIMEOUT,{groupID:n,inviteID:e,sponsor:r,timeoutUserList:i})}},{key:"onUserAccept",value:function(t){this._logger.info("TUICallEvent.onUserAccept",{text:{data:t},type:"event"});var e=t.userID,n=t.userList;this._emitter.emit(og.USER_ACCEPT,{userID:e,userList:n})}},{key:"onUserEnter",value:function(t){this._logger.info("TUICallEvent.onUserEnter",{text:{data:t},type:"event"});var e=t.userID,n=t.playerList;this._emitter.emit(og.USER_ENTER,{userID:e,playerList:n})}},{key:"onUserLeave",value:function(t){this._logger.info("TUICallEvent.onUserLeave",{text:{data:t},type:"event"});var e=t.userID,n=t.playerList;this._emitter.emit(og.USER_LEAVE,{userID:e,playerList:n})}},{key:"onUserUpdate",value:function(t){var e=t.pusher,n=t.playerList;this._emitter.emit(og.USER_UPDATE,{pusher:e,playerList:n})}},{key:"onSdkReady",value:function(t){this._logger.info("TUICallEvent.onSdkReady",{text:{data:t},type:"event"}),this._emitter.emit(og.SDK_READY,t)}},{key:"onKickedOut",value:function(t){this._logger.info("TUICallEvent.onKickedOut",{text:{data:t},type:"event"}),this._emitter.emit(og.KICKED_OUT,t)}},{key:"onCallMode",value:function(t){this._logger.info("TUICallEvent.onCallMode",{text:{data:t},type:"event"}),this._emitter.emit(og.CALL_MODE,t)}},{key:"onMessageSentByMe",value:function(t){this._logger.info("TUICallEvent.onMessageSentByMe",{text:{data:t},type:"event"}),this._emitter.emit(og.MESSAGE_SENT_BY_ME,t)}},{key:"destroyed",value:function(){this._logger.info("TUICallEvent.destroyed",{type:"api"}),this._emitter=null}}]),t}(),Ly="1.6.0";_v("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),jv);var Oy=ln,ky=function(){var t=Oy(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e},Ay=V,Ny=ve,Uy=bt,Py=ky,My=RegExp.prototype,jy=Ln.PROPER,Vy=wr,Gy=ln,Hy=bh,By=N,Fy=function(t){var e=t.flags;return void 0!==e||"flags"in My||Ny(t,"flags")||!Uy(My,t)?e:Ay(Py,t)},Ky="toString",zy=RegExp.prototype[Ky],Jy=By((function(){return"/a/b"!==zy.call({source:"a",flags:"b"})})),Wy=jy&&zy.name!==Ky;(Jy||Wy)&&Vy(RegExp.prototype,Ky,(function(){var t=Gy(this);return"/"+Hy(t.source)+"/"+Hy(Fy(t))}),{unsafe:!0});var $y,qy,Yy=Vp;xi({target:"Object",stat:!0,forced:Object.isExtensible!==Yy},{isExtensible:Yy}),$y="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};for(var Xy=function(){},Qy=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Zy=Qy.length-1;Zy;)qy=Qy[Zy],console[qy]||($y[qy]=Xy),Zy-=1;Object.isExtensible($y)&&($y.methods=Qy);var tI,eI,nI=$y,rI=N,iI=k.RegExp,aI=rI((function(){var t=iI("a","y");return t.lastIndex=2,null!==t.exec("abcd")})),oI=aI||rI((function(){return!iI("a","y").sticky})),sI={BROKEN_CARET:aI||rI((function(){var t=iI("^r","gy");return t.lastIndex=2,null!==t.exec("str")})),MISSED_STICKY:oI,UNSUPPORTED_Y:aI},cI=N,lI=k.RegExp,uI=cI((function(){var t=lI(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)})),hI=N,fI=k.RegExp,dI=hI((function(){var t=fI("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})),pI=V,vI=X,gI=bh,yI=ky,II=sI,mI=ne.exports,EI=af,_I=ar.get,TI=uI,CI=dI,bI=mI("native-string-replace",String.prototype.replace),DI=RegExp.prototype.exec,RI=DI,wI=vI("".charAt),SI=vI("".indexOf),xI=vI("".replace),LI=vI("".slice),OI=(eI=/b*/g,pI(DI,tI=/a/,"a"),pI(DI,eI,"a"),0!==tI.lastIndex||0!==eI.lastIndex),kI=II.BROKEN_CARET,AI=void 0!==/()??/.exec("")[1];(OI||AI||kI||TI||CI)&&(RI=function(t){var e,n,r,i,a,o,s,c=this,l=_I(c),u=gI(t),h=l.raw;if(h)return h.lastIndex=c.lastIndex,e=pI(RI,h,u),c.lastIndex=h.lastIndex,e;var f=l.groups,d=kI&&c.sticky,p=pI(yI,c),v=c.source,g=0,y=u;if(d&&(p=xI(p,"y",""),-1===SI(p,"g")&&(p+="g"),y=LI(u,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==wI(u,c.lastIndex-1))&&(v="(?: "+v+")",y=" "+y,g++),n=new RegExp("^(?:"+v+")",p)),AI&&(n=new RegExp("^"+v+"$(?!\\s)",p)),OI&&(r=c.lastIndex),i=pI(DI,d?n:c,y),d?i?(i.input=LI(i.input,g),i[0]=LI(i[0],g),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:OI&&i&&(c.lastIndex=c.global?i.index+i[0].length:r),AI&&i&&i.length>1&&pI(bI,i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&f)for(i.groups=o=EI(null),a=0;a<f.length;a++)o[(s=f[a])[0]]=i[s[1]];return i});var NI=RI;xi({target:"RegExp",proto:!0,forced:/./.exec!==NI},{exec:NI});var UI=Ja,PI=wr,MI=NI,jI=N,VI=Le,GI=Cn,HI=VI("species"),BI=RegExp.prototype,FI=function(t,e,n,r){var i=VI(t),a=!jI((function(){var e={};return e[i]=function(){return 7},7!==""[t](e)})),o=a&&!jI((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[HI]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return e=!0,null},n[i](""),!e}));if(!a||!o||n){var s=UI(/./[i]),c=e(i,""[t],(function(t,e,n,r,i){var o=UI(t),c=e.exec;return c===MI||c===BI.exec?a&&!i?{done:!0,value:s(e,n,r)}:{done:!0,value:o(n,e,r)}:{done:!1}}));PI(String.prototype,t,c[0]),PI(BI,i,c[1])}r&&GI(BI[i],"sham",!0)},KI=Ah.charAt,zI=function(t,e,n){return e+(n?KI(t,e).length:1)},JI=V,WI=ln,$I=yt,qI=et,YI=NI,XI=TypeError,QI=function(t,e){var n=t.exec;if($I(n)){var r=JI(n,t,e);return null!==r&&WI(r),r}if("RegExp"===qI(t))return JI(YI,t,e);throw new XI("RegExp#exec called on incompatible receiver")},ZI=V,tm=ln,em=st,nm=Vr,rm=bh,im=ut,am=Xt,om=zI,sm=QI;FI("match",(function(t,e,n){return[function(e){var n=im(this),r=em(e)?void 0:am(e,t);return r?ZI(r,e,n):new RegExp(e)[t](rm(n))},function(t){var r=tm(this),i=rm(t),a=n(e,r,i);if(a.done)return a.value;if(!r.global)return sm(r,i);var o=r.unicode;r.lastIndex=0;for(var s,c=[],l=0;null!==(s=sm(r,i));){var u=rm(s[0]);c[l]=u,""===u&&(r.lastIndex=om(i,nm(r.lastIndex),o)),l++}return 0===l?null:c}]})),xi({target:"Array",stat:!0},{isArray:Oi});var cm=k,lm=X(1..valueOf),um=xi,hm=U,fm=k,dm=cm,pm=X,vm=_i,gm=ve,ym=av,Im=bt,mm=Bt,Em=je,_m=N,Tm=Sr.f,Cm=A.f,bm=rn.f,Dm=lm,Rm=Wg.trim,wm="Number",Sm=fm[wm];dm[wm];var xm=Sm.prototype,Lm=fm.TypeError,Om=pm("".slice),km=pm("".charCodeAt),Am=function(t){var e,n,r,i,a,o,s,c,l=Em(t,"number");if(mm(l))throw new Lm("Cannot convert a Symbol value to a number");if("string"==typeof l&&l.length>2)if(l=Rm(l),43===(e=km(l,0))||45===e){if(88===(n=km(l,2))||120===n)return NaN}else if(48===e){switch(km(l,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+l}for(o=(a=Om(l,2)).length,s=0;s<o;s++)if((c=km(a,s))<48||c>i)return NaN;return parseInt(a,r)}return+l},Nm=vm(wm,!Sm(" 0o1")||!Sm("0b1")||Sm("+0x1")),Um=function(t){var e,n=arguments.length<1?0:Sm(function(t){var e=Em(t,"number");return"bigint"==typeof e?e:Am(e)}(t));return Im(xm,e=this)&&_m((function(){Dm(e)}))?ym(Object(n),this,Um):n};Um.prototype=xm,Nm&&(xm.constructor=Um),um({global:!0,constructor:!0,wrap:!0,forced:Nm},{Number:Um});Nm&&function(t,e){for(var n,r=hm?Tm(e):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),i=0;r.length>i;i++)gm(e,n=r[i])&&!gm(t,n)&&bm(t,n,Cm(e,n))}(dm[wm],Sm);var Pm=kr,Mm=bh,jm=ut,Vm=RangeError,Gm=function(t){var e=Mm(jm(this)),n="",r=Pm(t);if(r<0||r===1/0)throw new Vm("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n},Hm=X,Bm=Vr,Fm=bh,Km=ut,zm=Hm(Gm),Jm=Hm("".slice),Wm=Math.ceil,$m=function(t){return function(e,n,r){var i,a,o=Fm(Km(e)),s=Bm(n),c=o.length,l=void 0===r?" ":Fm(r);return s<=c||""===l?o:((a=zm(l,Wm((i=s-c)/l.length))).length>i&&(a=Jm(a,0,i)),t?o+a:a+o)}},qm=X,Ym=N,Xm={start:$m(!1),end:$m(!0)}.start,Qm=RangeError,Zm=isFinite,tE=Math.abs,eE=Date.prototype,nE=eE.toISOString,rE=qm(eE.getTime),iE=qm(eE.getUTCDate),aE=qm(eE.getUTCFullYear),oE=qm(eE.getUTCHours),sE=qm(eE.getUTCMilliseconds),cE=qm(eE.getUTCMinutes),lE=qm(eE.getUTCMonth),uE=qm(eE.getUTCSeconds),hE=Ym((function(){return"0385-07-25T07:06:39.999Z"!==nE.call(new Date(-50000000000001))}))||!Ym((function(){nE.call(new Date(NaN))}))?function(){if(!Zm(rE(this)))throw new Qm("Invalid time value");var t=this,e=aE(t),n=sE(t),r=e<0?"-":e>9999?"+":"";return r+Xm(tE(e),r?6:4,0)+"-"+Xm(lE(t)+1,2,0)+"-"+Xm(iE(t),2,0)+"T"+Xm(oE(t),2,0)+":"+Xm(cE(t),2,0)+":"+Xm(uE(t),2,0)+"."+Xm(n,3,0)+"Z"}:nE;xi({target:"Date",proto:!0,forced:Date.prototype.toISOString!==hE},{toISOString:hE});var fE=X,dE=fe,pE=Math.floor,vE=fE("".charAt),gE=fE("".replace),yE=fE("".slice),IE=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,mE=/\$([$&'`]|\d{1,2})/g,EE=Es,_E=V,TE=X,CE=FI,bE=N,DE=ln,RE=yt,wE=st,SE=kr,xE=Vr,LE=bh,OE=ut,kE=zI,AE=Xt,NE=function(t,e,n,r,i,a){var o=n+t.length,s=r.length,c=mE;return void 0!==i&&(i=dE(i),c=IE),gE(a,c,(function(a,c){var l;switch(vE(c,0)){case"$":return"$";case"&":return t;case"`":return yE(e,0,n);case"'":return yE(e,o);case"<":l=i[yE(c,1,-1)];break;default:var u=+c;if(0===u)return a;if(u>s){var h=pE(u/10);return 0===h?a:h<=s?void 0===r[h-1]?vE(c,1):r[h-1]+vE(c,1):a}l=r[u-1]}return void 0===l?"":l}))},UE=QI,PE=Le("replace"),ME=Math.max,jE=Math.min,VE=TE([].concat),GE=TE([].push),HE=TE("".indexOf),BE=TE("".slice),FE="$0"==="a".replace(/./,"$0"),KE=!!/./[PE]&&""===/./[PE]("a","$0");CE("replace",(function(t,e,n){var r=KE?"$":"$0";return[function(t,n){var r=OE(this),i=wE(t)?void 0:AE(t,PE);return i?_E(i,t,r,n):_E(e,LE(r),t,n)},function(t,i){var a=DE(this),o=LE(t);if("string"==typeof i&&-1===HE(i,r)&&-1===HE(i,"$<")){var s=n(e,a,o,i);if(s.done)return s.value}var c=RE(i);c||(i=LE(i));var l,u=a.global;u&&(l=a.unicode,a.lastIndex=0);for(var h,f=[];null!==(h=UE(a,o))&&(GE(f,h),u);){""===LE(h[0])&&(a.lastIndex=kE(o,xE(a.lastIndex),l))}for(var d,p="",v=0,g=0;g<f.length;g++){for(var y,I=LE((h=f[g])[0]),m=ME(jE(SE(h.index),o.length),0),E=[],_=1;_<h.length;_++)GE(E,void 0===(d=h[_])?d:String(d));var T=h.groups;if(c){var C=VE([I],E,m,o);void 0!==T&&GE(C,T),y=LE(EE(i,void 0,C))}else y=NE(I,o,m,E,T,i);m>=v&&(p+=BE(o,v,m)+y,v=m+I.length)}return p+BE(o,v)}]}),!!bE((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}))||!FE||KE);var zE,JE=Et,WE=et,$E=Le("match"),qE=function(t){var e;return JE(t)&&(void 0!==(e=t[$E])?!!e:"RegExp"===WE(t))},YE=TypeError,XE=function(t){if(qE(t))throw new YE("The method doesn't accept regular expressions");return t},QE=Le("match"),ZE=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[QE]=!1,"/./"[t](e)}catch(t){}}return!1},t_=xi,e_=Ja,n_=A.f,r_=Vr,i_=bh,a_=XE,o_=ut,s_=ZE,c_=e_("".startsWith),l_=e_("".slice),u_=Math.min,h_=s_("startsWith");function f_(t,e){t=t.split("."),e=e.split(".");for(var n=Math.max(t.length,e.length);t.length<n;)t.push("0");for(;e.length<n;)e.push("0");for(var r=0;r<n;r++){var i=parseInt(t[r],10),a=parseInt(e[r],10);if(i>a)return 1;if(i<a)return-1}return 0}t_({target:"String",proto:!0,forced:!!(h_||(zE=n_(String.prototype,"startsWith"),!zE||zE.writable))&&!h_},{startsWith:function(t){var e=i_(o_(this));a_(t);var n=r_(u_(arguments.length>1?arguments[1]:void 0,e.length)),r=i_(t);return c_?c_(e,r,n):l_(e,n,n+r.length)===r}});var d_="TRTC-ROOM",p_=wx||qq;p_||console.error(d_,"不支持当前小程序环境");var v_,g_=p_.getSystemInfoSync(),y_=g_.safeArea;("iOS 13.3"===g_.system||"iPhoneX"===g_.model&&"iOS 13.3.1"===g_.system)&&console.log("use media audio volume type"),console.log(d_,"SystemInfo",g_),"undefined"!=typeof qq?v_=!0:"undefined"!=typeof wx&&(v_=f_(g_.version,"7.0.8")>=0||f_(g_.version,"2.4.0")>=0&&f_(g_.version,"6.0.0")<0&&f_(g_.SDKVersion,"2.10.0")>=0);var I_=v_,m_="undefined"!=typeof uni,E_=/iOS/i.test(g_.system),__=/Android/i.test(g_.system);/mac/i.test(g_.system);var T_=g_.version,C_=g_.SDKBuild?"".concat(g_.SDKVersion,"-").concat(g_.SDKBuild):g_.SDKVersion;g_.screenHeight,y_.bottom,console.log(d_,"APP_VERSION:",T_," LIB_VERSION:",C_," is new version:",I_);var b_=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"array"===function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()}(t)},D_=function(t){return null!==t&&("number"==typeof t&&!isNaN(t-0)||"object"===s(t)&&t.constructor===Number)},R_=function(t){return"string"==typeof t},w_=function(t){return null!==t&&"object"===s(t)},S_=function(t){return void 0===t},x_=0;Date.now||(Date.now=function(){return(new Date).getTime()});var L_=function(){0===x_&&(x_=Date.now()-1);var t=Date.now()-x_;return t>4294967295?(x_+=4294967295,Date.now()-x_):t},O_=function(t){return t instanceof Error},k_=function(t){return JSON.stringify(t,["message","code"])};function A_(){var t="unknown";return E_&&(t="ios"),__&&(t="android"),t}function N_(t){return U_.apply(this,arguments)}function U_(){return(U_=l(a().mark((function t(e){var n,r,i,o,s,c,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return",!1);case 2:return n=e.microphone,r=void 0!==n&&n,i=e.camera,o=void 0!==i&&i,t.prev=3,t.next=6,wx.getSetting();case 6:if(s=t.sent,c=s.authSetting[Lg.RECORD],l=s.authSetting[Lg.CAMERA],!r||!o){t.next=11;break}return t.abrupt("return",c&&l);case 11:if(!r){t.next=13;break}return t.abrupt("return",c);case 13:if(!o){t.next=15;break}return t.abrupt("return",l);case 15:return t.abrupt("return",!1);case 18:return t.prev=18,t.t0=t.catch(3),t.abrupt("return",!1);case 21:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}function P_(t){return t===wg.AV_CALL}function M_(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}function j_(t){var e=String(t);return e.startsWith("14")||e.startsWith("16")||e.startsWith("17")}function V_(t){var e=j_(t)?Og:kg;return"".concat(e,"&position=").concat(t,"®ionId=").concat(function(t){return t>=2e7&&t<3e7||t>=172e7&&t<173e7?Ng:t>=3e7&&t<4e7||t>=173e7&&t<174e7?Pg:t>=4e7&&t<5e7||t>=174e7&&t<175e7?Ug:t>=5e7&&t<6e7||t>=175e7&&t<176e7?Mg:t>=7e7&&t<8e7||t>=177e7&&t<178e7?jg:Ag}(t))}var G_=0,H_=new Map;function B_(){var t=new Date;return"TUICallEngine ".concat(t.toLocaleTimeString("en-US",{hour12:!1}),".").concat(function(t){var e;switch(t.toString().length){case 1:e="00".concat(t);break;case 2:e="0".concat(t);break;default:e=t}return e}(t.getMilliseconds()),":")}var F_={_data:[],_length:0,_visible:!1,arguments2String:function(t){var e,n;if(1===t.length)e=B_()+t[0];else{e=B_();for(var r=0,i=t.length;r<i;r++)n=t[r],b_(n)||w_(n)?O_(t[r])?e+=k_(t[r]):e+=JSON.stringify(t[r]):e+=t[r],e+=" "}return e},debug:function(){if(G_<=-1){var t=this.arguments2String(arguments);F_.record(t,"debug"),nI.debug(t)}},log:function(){if(G_<=0){var t=this.arguments2String(arguments);F_.record(t,"log"),nI.log(t)}},info:function(){if(G_<=1){var t=this.arguments2String(arguments);F_.record(t,"info"),nI.info(t)}},warn:function(){if(G_<=2){var t=this.arguments2String(arguments);F_.record(t,"warn"),nI.warn(t)}},error:function(){if(G_<=3){var t=this.arguments2String(arguments);F_.record(t,"error"),nI.error(t)}},time:function(t){H_.set(t,L_())},timeEnd:function(t){if(H_.has(t)){var e=L_()-H_.get(t);return H_.delete(t),e}return nI.warn("未找到对应label: ".concat(t,", 请在调用 logger.timeEnd 前,调用 logger.time")),0},setLevel:function(t){t<4&&nI.log("".concat(B_(),"set level from ").concat(G_," to ").concat(t)),G_=t},getLevel:function(){return G_},record:function(t,e){1100===F_._length&&(F_._data.splice(0,100),F_._length=1e3),F_._length+=1,F_._data.push("".concat(t," [").concat(e,"] \n"))},getLog:function(){return F_._data}},K_=function(){function t(e){u(this,t),this.sdkappid="",this.version="",this.userid="",this.platform="",this.useragent="",this.method=e,this.codeint=1,this.calltype=1,this.talktime=0,this.message="",this.text="",this.startts=Date.now(),this.endts=0,this.timespan=0,this.time="",this.networktype="",this.host=A_()}return f(t,[{key:"setCommonInfo",value:function(t){var e,n,r,i,a=t.SDKAppID,o=t.version,s=t.userID,c=t.platform,l=t.scene;this.sdkappid=a,this.version="".concat(o),this.userid=s,this.platform=c,this.scene=l,this.time=(e=new Date,n=e.toISOString(),r=e.getTimezoneOffset()/60,i="",i=r<0?r>-10?"+0".concat(Math.abs(100*r)):"+".concat(Math.abs(100*r)):r>=10?"-".concat(100*r):"-0".concat(100*r),n.replace("Z",i)),this.startts&&this.endts&&!this.timespan&&(this.timespan=Math.abs(this.endts-this.startts))}},{key:"setEnd",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.endts=Date.now(),e?this._eventStatController.pushIn(this):setTimeout((function(){t._eventStatController.pushIn(t)}),0)}},{key:"setError",value:function(t,e,n){return this.setNetworkType(n),e?(t.code&&this.setCode(t.code),t.message&&this.setMessage(t.message)):(this.setCode(Iy.NO_NETWORK),this.setMessage(my)),this}},{key:"setCode",value:function(t){return"ECONNABORTED"===t&&(this.codeint=103),D_(t)?this.codeint=t:F_.warn("SSOLogData.setCode value not a number, please check!",t,s(t)),this}},{key:"setMessage",value:function(t){return R_(t)?(this.message=t,this):this}},{key:"setText",value:function(t){return D_(t)?this.text=t.toString():R_(t)&&(this.text=t),this}},{key:"setTalkTime",value:function(t){return this.talktime=t,this}},{key:"setMessageType",value:function(t){return this.msgType=t,this}},{key:"setCallType",value:function(t){return this.calltype=t,this}},{key:"setNetworkType",value:function(t){return S_(t)?F_.warn("SSOLogData.setNetworkType value is undefined, please check!"):this.networktype=t,this}}],[{key:"bindController",value:function(e){t.prototype._eventStatController=e}}]),t}(),z_="sdkConstruct",J_="quality_report",W_=function(){function t(){u(this,t),this._table="timweb-trtccalling",this._report=[]}return f(t,[{key:"pushIn",value:function(t){F_.debug("SSOLogBody.pushIn",this._report.length,t),this._report.push(t)}},{key:"backfill",value:function(t){var e;b_(t)&&0!==t.length&&(F_.debug("SSOLogBody.backfill",this._report.length,t.length),(e=this._report).unshift.apply(e,C(t)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return 0===this._report.length}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getTable",value:function(){return this._table}},{key:"getLogsInMemory",value:function(){var t=this._report.slice();return this._reset(),t}}]),t}(),$_={CURRENT:{COMMON:"https://webim.tim.qq.com"},PRODUCTION:{COMMON:"https://webim.tim.qq.com"}},q_={IM_OPEN_STAT:"imopenstat"},Y_={TIM_WEB_TRTCCALLING_REPORT:"tweb_trtccalling_report"},X_={imopenstat:"v4"},Q_=function(){function t(){u(this,t),this.TAG="trtccalling-ssolog-event",this._reportBody=new W_,this._version=Ly,this.MIN_THRESHOLD=20,this.MAX_THRESHOLD=100,this.WAITING_TIME=6e4,this.INTERVAL=2e4,this._timerID=0,this._resetLastReportTime(),this._startReportTimer(),this._retryCount=0,this.MAX_RETRY_COUNT=3}return f(t,[{key:"reportAtOnce",value:function(){F_.debug("EventStatController.reportAtOnce"),this._report()}},{key:"pushIn",value:function(t){t instanceof K_&&(t.setCommonInfo({SDKAppID:Number(wx.getStorageSync("sdkAppId")),version:this._version,userID:wx.getStorageSync("userId")}),this._reportBody.pushIn(t),this._report())}},{key:"_resetLastReportTime",value:function(){this._lastReportTime=Date.now()}},{key:"_startReportTimer",value:function(){var t=this;this._timerID=setInterval((function(){Date.now()<t._lastReportTime+t.WAITING_TIME||t._reportBody.isEmpty()||t._report()}),this.INTERVAL)}},{key:"_stopReportTimer",value:function(){this._timerID>0&&(clearInterval(this._timerID),this._timerID=0)}},{key:"_report",value:function(){var t=this;if(!this._reportBody.isEmpty()){var e=Math.ceil(+new Date/1e3),n=wx.getStorageSync("sdkAppId"),r=this._reportBody.getLogsInMemory(),i={table:this._reportBody.getTable(),report:r},a=$_.CURRENT.COMMON,o=X_.imopenstat,s=q_.IM_OPEN_STAT,c=Y_.TIM_WEB_TRTCCALLING_REPORT,l="".concat(a,"/").concat(o,"/").concat(s,"/").concat(c,"/?sdkappid=").concat(n,"&reqtime=").concat(e);wx.request({url:l,method:"POST",data:JSON.stringify(i),header:{"content-type":"application/json"},success:function(e){t._retryCount>0&&(F_.debug("EventStatController.report retry success"),t._retryCount=0)},fail:function(e){F_.warn("EventStatController.report, error:".concat(k_(e))),t._reportBody.backfill(r),t._reportBody.getLogsNumInMemory()>t.MAX_THRESHOLD||t._retryCount===t.MAX_RETRY_COUNT||0===t._timerID?t._retryCount=0:t._retryCount+=1}})}}},{key:"reset",value:function(){F_.log("EventStatController.reset"),this._stopReportTimer(),this._report()}}]),t}(),Z_=Jr.includes,tT=ud;xi({target:"Array",proto:!0,forced:N((function(){return!Array(1).includes()}))},{includes:function(t){return Z_(this,t,arguments.length>1?arguments[1]:void 0)}}),tT("includes");var eT=xi,nT=XE,rT=ut,iT=bh,aT=ZE,oT=X("".indexOf);eT({target:"String",proto:!0,forced:!aT("includes")},{includes:function(t){return!!~oT(iT(rT(this)),iT(nT(t)),arguments.length>1?arguments[1]:void 0)}});var sT=X,cT=Cv,lT=_p.exports.getWeakData,uT=cs,hT=ln,fT=st,dT=Et,pT=Du,vT=ve,gT=ar.set,yT=ar.getterFor,IT=ho.find,mT=ho.findIndex,ET=sT([].splice),_T=0,TT=function(t){return t.frozen||(t.frozen=new CT)},CT=function(){this.entries=[]},bT=function(t,e){return IT(t.entries,(function(t){return t[0]===e}))};CT.prototype={get:function(t){var e=bT(this,t);if(e)return e[1]},has:function(t){return!!bT(this,t)},set:function(t,e){var n=bT(this,t);n?n[1]=e:this.entries.push([t,e])},delete:function(t){var e=mT(this.entries,(function(e){return e[0]===t}));return~e&&ET(this.entries,e,1),!!~e}};var DT,RT={getConstructor:function(t,e,n,r){var i=t((function(t,i){uT(t,a),gT(t,{type:e,id:_T++,frozen:void 0}),fT(i)||pT(i,t[r],{that:t,AS_ENTRIES:n})})),a=i.prototype,o=yT(e),s=function(t,e,n){var r=o(t),i=lT(hT(e),!0);return!0===i?TT(r).set(e,n):i[r.id]=n,t};return cT(a,{delete:function(t){var e=o(this);if(!dT(t))return!1;var n=lT(t);return!0===n?TT(e).delete(t):n&&vT(n,e.id)&&delete n[e.id]},has:function(t){var e=o(this);if(!dT(t))return!1;var n=lT(t);return!0===n?TT(e).has(t):n&&vT(n,e.id)}}),cT(a,n?{get:function(t){var e=o(this);if(dT(t)){var n=lT(t);return!0===n?TT(e).get(t):n?n[e.id]:void 0}},set:function(t,e){return s(this,t,e)}}:{add:function(t){return s(this,t,!0)}}),i}},wT=Gp,ST=k,xT=X,LT=Cv,OT=_p.exports,kT=_v,AT=RT,NT=Et,UT=ar.enforce,PT=N,MT=Gn,jT=Object,VT=Array.isArray,GT=jT.isExtensible,HT=jT.isFrozen,BT=jT.isSealed,FT=jT.freeze,KT=jT.seal,zT={},JT={},WT=!ST.ActiveXObject&&"ActiveXObject"in ST,$T=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},qT=kT("WeakMap",$T,AT),YT=qT.prototype,XT=xT(YT.set);if(MT)if(WT){DT=AT.getConstructor($T,"WeakMap",!0),OT.enable();var QT=xT(YT.delete),ZT=xT(YT.has),tC=xT(YT.get);LT(YT,{delete:function(t){if(NT(t)&&!GT(t)){var e=UT(this);return e.frozen||(e.frozen=new DT),QT(this,t)||e.frozen.delete(t)}return QT(this,t)},has:function(t){if(NT(t)&&!GT(t)){var e=UT(this);return e.frozen||(e.frozen=new DT),ZT(this,t)||e.frozen.has(t)}return ZT(this,t)},get:function(t){if(NT(t)&&!GT(t)){var e=UT(this);return e.frozen||(e.frozen=new DT),ZT(this,t)?tC(this,t):e.frozen.get(t)}return tC(this,t)},set:function(t,e){if(NT(t)&&!GT(t)){var n=UT(this);n.frozen||(n.frozen=new DT),ZT(this,t)?XT(this,t,e):n.frozen.set(t,e)}else XT(this,t,e);return this}})}else wT&&PT((function(){var t=FT([]);return XT(new qT,t,1),!HT(t)}))&<(YT,{set:function(t,e){var n;return VT(t)&&(HT(t)?n=zT:BT(t)&&(n=JT)),XT(this,t,e),n===zT&&FT(t),n===JT&&KT(t),this}});var eC={exports:{}};
- /*!
- * validate.js 0.13.1
- *
- * (c) 2013-2019 Nicklas Ansman, 2013 Wrapp
- * Validate.js may be freely distributed under the MIT license.
- * For all details and documentation:
- * http://validatejs.org/
- */(function(t,e,n){var r=function(t,e,n){n=i.extend({},i.options,n);var a=i.runValidations(t,e,n);if(a.some((function(t){return i.isPromise(t.error)})))throw new Error("Use validate.async if you want support for promises");return r.processValidationResults(a,n)},i=r;i.extend=function(t){return[].slice.call(arguments,1).forEach((function(e){for(var n in e)t[n]=e[n]})),t},i.extend(r,{version:{major:0,minor:13,patch:1,metadata:null,toString:function(){var t=i.format("%{major}.%{minor}.%{patch}",i.version);return i.isEmpty(i.version.metadata)||(t+="+"+i.version.metadata),t}},Promise:"undefined"!=typeof Promise?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(t,e,n){var r,a,o,s,c,l,u,h=[];for(r in(i.isDomElement(t)||i.isJqueryElement(t))&&(t=i.collectFormValues(t)),e)for(a in o=i.getDeepObjectValue(t,r),s=i.result(e[r],o,t,r,n,e)){if(!(c=i.validators[a]))throw u=i.format("Unknown validator %{name}",{name:a}),new Error(u);l=s[a],(l=i.result(l,o,t,r,n,e))&&h.push({attribute:r,value:o,validator:a,globalOptions:n,attributes:t,options:l,error:c.call(c,o,l,r,t,n)})}return h},processValidationResults:function(t,e){t=i.pruneEmptyErrors(t,e),t=i.expandMultipleErrors(t,e),t=i.convertErrorMessages(t,e);var n=e.format||"grouped";if("function"!=typeof i.formatters[n])throw new Error(i.format("Unknown format %{format}",e));return t=i.formatters[n](t),i.isEmpty(t)?void 0:t},async:function(t,e,n){var r=(n=i.extend({},i.async.options,n)).wrapErrors||function(t){return t};!1!==n.cleanAttributes&&(t=i.cleanAttributes(t,e));var a=i.runValidations(t,e,n);return new i.Promise((function(o,s){i.waitForResults(a).then((function(){var c=i.processValidationResults(a,n);c?s(new r(c,n,t,e)):o(t)}),(function(t){s(t)}))}))},single:function(t,e,n){return n=i.extend({},i.single.options,n,{format:"flat",fullMessages:!1}),i({single:t},{single:e},n)},waitForResults:function(t){return t.reduce((function(t,e){return i.isPromise(e.error)?t.then((function(){return e.error.then((function(t){e.error=t||null}))})):t}),new i.Promise((function(t){t()})))},result:function(t){var e=[].slice.call(arguments,1);return"function"==typeof t&&(t=t.apply(null,e)),t},isNumber:function(t){return"number"==typeof t&&!isNaN(t)},isFunction:function(t){return"function"==typeof t},isInteger:function(t){return i.isNumber(t)&&t%1==0},isBoolean:function(t){return"boolean"==typeof t},isObject:function(t){return t===Object(t)},isDate:function(t){return t instanceof Date},isDefined:function(t){return null!=t},isPromise:function(t){return!!t&&i.isFunction(t.then)},isJqueryElement:function(t){return t&&i.isString(t.jquery)},isDomElement:function(t){return!!t&&!(!t.querySelectorAll||!t.querySelector)&&(!(!i.isObject(document)||t!==document)||("object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName))},isEmpty:function(t){var e;if(!i.isDefined(t))return!0;if(i.isFunction(t))return!1;if(i.isString(t))return i.EMPTY_STRING_REGEXP.test(t);if(i.isArray(t))return 0===t.length;if(i.isDate(t))return!1;if(i.isObject(t)){for(e in t)return!1;return!0}return!1},format:i.extend((function(t,e){return i.isString(t)?t.replace(i.format.FORMAT_REGEXP,(function(t,n,r){return"%"===n?"%{"+r+"}":String(e[r])})):t}),{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(t){return i.isNumber(t)?100*t%1==0?""+t:parseFloat(Math.round(100*t)/100).toFixed(2):i.isArray(t)?t.map((function(t){return i.prettify(t)})).join(", "):i.isObject(t)?i.isDefined(t.toString)?t.toString():JSON.stringify(t):(t=""+t).replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,(function(t,e,n){return e+" "+n.toLowerCase()})).toLowerCase()},stringifyValue:function(t,e){return(e&&e.prettify||i.prettify)(t)},isString:function(t){return"string"==typeof t},isArray:function(t){return"[object Array]"==={}.toString.call(t)},isHash:function(t){return i.isObject(t)&&!i.isArray(t)&&!i.isFunction(t)},contains:function(t,e){return!!i.isDefined(t)&&(i.isArray(t)?-1!==t.indexOf(e):e in t)},unique:function(t){return i.isArray(t)?t.filter((function(t,e,n){return n.indexOf(t)==e})):t},forEachKeyInKeypath:function(t,e,n){if(i.isString(e)){var r,a="",o=!1;for(r=0;r<e.length;++r)switch(e[r]){case".":o?(o=!1,a+="."):(t=n(t,a,!1),a="");break;case"\\":o?(o=!1,a+="\\"):o=!0;break;default:o=!1,a+=e[r]}return n(t,a,!0)}},getDeepObjectValue:function(t,e){if(i.isObject(t))return i.forEachKeyInKeypath(t,e,(function(t,e){if(i.isObject(t))return t[e]}))},collectFormValues:function(t,e){var n,r,a,o,s,c,l={};if(i.isJqueryElement(t)&&(t=t[0]),!t)return l;for(e=e||{},o=t.querySelectorAll("input[name], textarea[name]"),n=0;n<o.length;++n)if(a=o.item(n),!i.isDefined(a.getAttribute("data-ignored"))){var u=a.name.replace(/\./g,"\\\\.");c=i.sanitizeFormValue(a.value,e),"number"===a.type?c=c?+c:null:"checkbox"===a.type?a.attributes.value?a.checked||(c=l[u]||null):c=a.checked:"radio"===a.type&&(a.checked||(c=l[u]||null)),l[u]=c}for(o=t.querySelectorAll("select[name]"),n=0;n<o.length;++n)if(a=o.item(n),!i.isDefined(a.getAttribute("data-ignored"))){if(a.multiple)for(r in c=[],a.options)(s=a.options[r])&&s.selected&&c.push(i.sanitizeFormValue(s.value,e));else{var h=void 0!==a.options[a.selectedIndex]?a.options[a.selectedIndex].value:"";c=i.sanitizeFormValue(h,e)}l[a.name]=c}return l},sanitizeFormValue:function(t,e){return e.trim&&i.isString(t)&&(t=t.trim()),!1!==e.nullify&&""===t?null:t},capitalize:function(t){return i.isString(t)?t[0].toUpperCase()+t.slice(1):t},pruneEmptyErrors:function(t){return t.filter((function(t){return!i.isEmpty(t.error)}))},expandMultipleErrors:function(t){var e=[];return t.forEach((function(t){i.isArray(t.error)?t.error.forEach((function(n){e.push(i.extend({},t,{error:n}))})):e.push(t)})),e},convertErrorMessages:function(t,e){var n=[],r=(e=e||{}).prettify||i.prettify;return t.forEach((function(t){var a=i.result(t.error,t.value,t.attribute,t.options,t.attributes,t.globalOptions);i.isString(a)?("^"===a[0]?a=a.slice(1):!1!==e.fullMessages&&(a=i.capitalize(r(t.attribute))+" "+a),a=a.replace(/\\\^/g,"^"),a=i.format(a,{value:i.stringifyValue(t.value,e)}),n.push(i.extend({},t,{error:a}))):n.push(t)})),n},groupErrorsByAttribute:function(t){var e={};return t.forEach((function(t){var n=e[t.attribute];n?n.push(t):e[t.attribute]=[t]})),e},flattenErrorsToArray:function(t){return t.map((function(t){return t.error})).filter((function(t,e,n){return n.indexOf(t)===e}))},cleanAttributes:function(t,e){function n(t,e,n){return i.isObject(t[e])?t[e]:t[e]=!!n||{}}return i.isObject(e)&&i.isObject(t)?function t(e,n){if(!i.isObject(e))return e;var r,a,o=i.extend({},e);for(a in e)r=n[a],i.isObject(r)?o[a]=t(o[a],r):r||delete o[a];return o}(t,e=function(t){var e,r={};for(e in t)t[e]&&i.forEachKeyInKeypath(r,e,n);return r}(e)):{}},exposeModule:function(t,e,n,r,i){n?(r&&r.exports&&(n=r.exports=t),n.validate=t):(e.validate=t,t.isFunction(i)&&i.amd&&i([],(function(){return t})))},warn:function(t){"undefined"!=typeof console&&console.warn&&console.warn("[validate.js] "+t)},error:function(t){"undefined"!=typeof console&&console.error&&console.error("[validate.js] "+t)}}),r.validators={presence:function(t,e){if(!1!==(e=i.extend({},this.options,e)).allowEmpty?!i.isDefined(t):i.isEmpty(t))return e.message||this.message||"can't be blank"},length:function(t,e,n){if(i.isDefined(t)){var r,a=(e=i.extend({},this.options,e)).is,o=e.maximum,s=e.minimum,c=[],l=(t=(e.tokenizer||function(t){return t})(t)).length;return i.isNumber(l)?(i.isNumber(a)&&l!==a&&(r=e.wrongLength||this.wrongLength||"is the wrong length (should be %{count} characters)",c.push(i.format(r,{count:a}))),i.isNumber(s)&&l<s&&(r=e.tooShort||this.tooShort||"is too short (minimum is %{count} characters)",c.push(i.format(r,{count:s}))),i.isNumber(o)&&l>o&&(r=e.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",c.push(i.format(r,{count:o}))),c.length>0?e.message||c:void 0):e.message||this.notValid||"has an incorrect length"}},numericality:function(t,e,n,r,a){if(i.isDefined(t)){var o,s,c=[],l={greaterThan:function(t,e){return t>e},greaterThanOrEqualTo:function(t,e){return t>=e},equalTo:function(t,e){return t===e},lessThan:function(t,e){return t<e},lessThanOrEqualTo:function(t,e){return t<=e},divisibleBy:function(t,e){return t%e==0}},u=(e=i.extend({},this.options,e)).prettify||a&&a.prettify||i.prettify;if(i.isString(t)&&e.strict){var h="^-?(0|[1-9]\\d*)";if(e.onlyInteger||(h+="(\\.\\d+)?"),h+="$",!new RegExp(h).test(t))return e.message||e.notValid||this.notValid||this.message||"must be a valid number"}if(!0!==e.noStrings&&i.isString(t)&&!i.isEmpty(t)&&(t=+t),!i.isNumber(t))return e.message||e.notValid||this.notValid||this.message||"is not a number";if(e.onlyInteger&&!i.isInteger(t))return e.message||e.notInteger||this.notInteger||this.message||"must be an integer";for(o in l)if(s=e[o],i.isNumber(s)&&!l[o](t,s)){var f="not"+i.capitalize(o),d=e[f]||this[f]||this.message||"must be %{type} %{count}";c.push(i.format(d,{count:s,type:u(o)}))}return e.odd&&t%2!=1&&c.push(e.notOdd||this.notOdd||this.message||"must be odd"),e.even&&t%2!=0&&c.push(e.notEven||this.notEven||this.message||"must be even"),c.length?e.message||c:void 0}},datetime:i.extend((function(t,e){if(!i.isFunction(this.parse)||!i.isFunction(this.format))throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator");if(i.isDefined(t)){var n,r=[],a=(e=i.extend({},this.options,e)).earliest?this.parse(e.earliest,e):NaN,o=e.latest?this.parse(e.latest,e):NaN;return t=this.parse(t,e),isNaN(t)||e.dateOnly&&t%864e5!=0?(n=e.notValid||e.message||this.notValid||"must be a valid date",i.format(n,{value:arguments[0]})):(!isNaN(a)&&t<a&&(n=e.tooEarly||e.message||this.tooEarly||"must be no earlier than %{date}",n=i.format(n,{value:this.format(t,e),date:this.format(a,e)}),r.push(n)),!isNaN(o)&&t>o&&(n=e.tooLate||e.message||this.tooLate||"must be no later than %{date}",n=i.format(n,{date:this.format(o,e),value:this.format(t,e)}),r.push(n)),r.length?i.unique(r):void 0)}}),{parse:null,format:null}),date:function(t,e){return e=i.extend({},e,{dateOnly:!0}),i.validators.datetime.call(i.validators.datetime,t,e)},format:function(t,e){(i.isString(e)||e instanceof RegExp)&&(e={pattern:e});var n,r=(e=i.extend({},this.options,e)).message||this.message||"is invalid",a=e.pattern;if(i.isDefined(t))return i.isString(t)?(i.isString(a)&&(a=new RegExp(e.pattern,e.flags)),(n=a.exec(t))&&n[0].length==t.length?void 0:r):r},inclusion:function(t,e){if(i.isDefined(t)&&(i.isArray(e)&&(e={within:e}),e=i.extend({},this.options,e),!i.contains(e.within,t))){var n=e.message||this.message||"^%{value} is not included in the list";return i.format(n,{value:t})}},exclusion:function(t,e){if(i.isDefined(t)&&(i.isArray(e)&&(e={within:e}),e=i.extend({},this.options,e),i.contains(e.within,t))){var n=e.message||this.message||"^%{value} is restricted";return i.isString(e.within[t])&&(t=e.within[t]),i.format(n,{value:t})}},email:i.extend((function(t,e){var n=(e=i.extend({},this.options,e)).message||this.message||"is not a valid email";if(i.isDefined(t))return i.isString(t)&&this.PATTERN.exec(t)?void 0:n}),{PATTERN:/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i}),equality:function(t,e,n,r,a){if(i.isDefined(t)){i.isString(e)&&(e={attribute:e});var o=(e=i.extend({},this.options,e)).message||this.message||"is not equal to %{attribute}";if(i.isEmpty(e.attribute)||!i.isString(e.attribute))throw new Error("The attribute must be a non empty string");var s=i.getDeepObjectValue(r,e.attribute),c=e.comparator||function(t,e){return t===e},l=e.prettify||a&&a.prettify||i.prettify;return c(t,s,e,n,r)?void 0:i.format(o,{attribute:l(e.attribute)})}},url:function(t,e){if(i.isDefined(t)){var n=(e=i.extend({},this.options,e)).message||this.message||"is not a valid url",r=e.schemes||this.schemes||["http","https"],a=e.allowLocal||this.allowLocal||!1,o=e.allowDataUrl||this.allowDataUrl||!1;if(!i.isString(t))return n;var s="^(?:(?:"+r.join("|")+")://)(?:\\S+(?::\\S*)?@)?(?:",c="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";return a?c+="?":s+="(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})",s+="(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"+c+")(?::\\d{2,5})?(?:[/?#]\\S*)?$",o&&(s="(?:"+s+")|(?:^data:(?:\\w+\\/[-+.\\w]+(?:;[\\w=]+)*)?(?:;base64)?,[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*$)"),new RegExp(s,"i").exec(t)?void 0:n}},type:i.extend((function(t,e,n,r,a){if(i.isString(e)&&(e={type:e}),i.isDefined(t)){var o,s=i.extend({},this.options,e),c=s.type;if(!i.isDefined(c))throw new Error("No type was specified");if(o=i.isFunction(c)?c:this.types[c],!i.isFunction(o))throw new Error("validate.validators.type.types."+c+" must be a function.");if(!o(t,s,n,r,a)){var l=e.message||this.messages[c]||this.message||s.message||(i.isFunction(c)?"must be of the correct type":"must be of type %{type}");return i.isFunction(l)&&(l=l(t,e,n,r,a)),i.format(l,{attribute:i.prettify(n),type:c})}}}),{types:{object:function(t){return i.isObject(t)&&!i.isArray(t)},array:i.isArray,integer:i.isInteger,number:i.isNumber,string:i.isString,date:i.isDate,boolean:i.isBoolean},messages:{}})},r.formatters={detailed:function(t){return t},flat:i.flattenErrorsToArray,grouped:function(t){var e;for(e in t=i.groupErrorsByAttribute(t))t[e]=i.flattenErrorsToArray(t[e]);return t},constraint:function(t){var e;for(e in t=i.groupErrorsByAttribute(t))t[e]=t[e].map((function(t){return t.validator})).sort();return t}},r.exposeModule(r,this,t,e,n)}).call(x,eC.exports,eC,null);var nC=eC.exports,rC="number",iC="string",aC="object",oC="function",sC="array",cC={createInstance:{sdkAppID:{presence:!0,type:rC},tim:{type:aC}},destroyInstance:{},init:{userID:{presence:!0,type:iC},userSig:{presence:!0,type:iC}},on:{eventCode:{presence:!0,type:iC},handler:{presence:!0,type:oC},context:{presence:!0,type:aC}},off:{eventCode:{presence:!0,type:iC},handler:{presence:!0,type:oC}},call:{userID:{presence:!0,type:iC},type:{presence:!0,type:rC},roomID:{presence:!1,type:rC,numericality:{onlyInteger:!0,greaterThan:0,lessThanOrEqualTo:Rg}}},groupCall:{groupID:{presence:!0,type:iC},type:{presence:!0,type:rC},userIDList:{presence:!0,type:sC},roomID:{presence:!1,type:rC,numericality:{onlyInteger:!0,greaterThan:0,lessThanOrEqualTo:Rg}}},joinInGroupCall:{groupID:{presence:!0,type:iC},type:{presence:!0,type:rC},roomID:{presence:!0,type:rC}},inviteUser:{userIDList:{presence:!0,type:sC}},accept:{},reject:{},hangup:{},switchCallMediaType:{type:{presence:!0,type:rC}},openCamera:{},closeCamera:{},switchCamera:{},openMicrophone:{},closeMicrophone:{},selectAudioPlaybackDevice:{type:{presence:!0,type:iC}},setSelfInfo:{nickName:{presence:!0,type:iC},avatar:{presence:!0,type:iC}}},lC={createInstance:"",destroyInstance:"",init:"",on:"",off:"",call:[sg.IDLE],groupCall:[sg.IDLE],accept:[sg.CALLING],reject:[sg.CALLING],hangup:[sg.CALLING,sg.CONNECTED],switchCallMediaType:[sg.CALLING,sg.CONNECTED],joinInGroupCall:[sg.IDLE],inviteUser:[sg.CALLING,sg.CONNECTED],openCamera:[sg.CALLING,sg.CONNECTED],closeCamera:[sg.CALLING,sg.CONNECTED],switchCamera:[sg.CALLING,sg.CONNECTED],openMicrophone:[sg.CALLING,sg.CONNECTED],closeMicrophone:[sg.CALLING,sg.CONNECTED],selectAudioPlaybackDevice:[sg.CALLING,sg.CONNECTED],setSelfInfo:""},uC={createInstance:!1,destroyInstance:!0,init:!1,off:!0,call:!0,groupCall:!0,joinInGroupCall:!0,inviteUser:!0,accept:!0,reject:!0,hangup:!0,switchCallMediaType:!0,openCamera:!0,closeCamera:!0,switchCamera:!0,openMicrophone:!0,closeMicrophone:!0,selectAudioPlaybackDevice:!0,setSelfInfo:!0},hC=function(t){p(n,m(Error));var e=T(n);function n(t,r,i){var a;return u(this,n),d(_(a=e.call(this,r)),"code",void 0),d(_(a),"message",void 0),d(_(a),"data",void 0),a.code=t,a.message=r,a.data=i,a}return f(n,null,[{key:"error",value:function(t,e,r){return r?new n(t,e,r):new n(t,e)}}]),n}();function fC(t){var e=j_(t)?"".concat(Dy.ERROR_PACKAGE_NOT_PURCHASED):"".concat(Ey);return e=e.replace("${purchaseAddress}",V_(t))}nC.validators.type.types.function=function(t){return t instanceof Function};var dC=function(){function t(){u(this,t),d(this,"paramsMatchedRule",cC),d(this,"statusMatchedRule",lC),d(this,"requireInit",uC)}return f(t,[{key:"getParamsMatchedRule",value:function(t){return this.paramsMatchedRule[t]}},{key:"getStatusMatchedRule",value:function(t){return this.statusMatchedRule[t]}},{key:"getInitReadyRule",value:function(t){return this.requireInit[t]}}]),t}(),pC=function(){function t(){u(this,t),this._logger=ly()}return f(t,[{key:"notify",value:function(t,e,n,r){throw this._logger.error("check:".concat(t.api),{text:{data:t,error:{code:e,message:n}}}),hC.error(e,"[TUICallEngine:".concat(t.api,",").concat(e,"]").concat(n).concat(r))}}]),t}(),vC=f((function t(e){u(this,t),d(this,"api",""),d(this,"attributes",{}),d(this,"callStatus",""),d(this,"capabilityCode",void 0),d(this,"initReady",void 0),this.api=e.api,this.attributes=e.attributes,this.callStatus=e.callStatus,this.capabilityCode=e.capabilityCode,this.initReady=e.initReady,this.sdkAppID=e.sdkAppID})),gC=new WeakMap,yC=function(){function t(){u(this,t),S(this,gC,{writable:!0,value:void 0}),R(this,gC,[])}var e;return f(t,[{key:"addAlertHandler",value:function(t){D(this,gC).push(t)}},{key:"check",value:(e=l(a().mark((function t(e,n){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=0;case 1:if(!(r<D(this,gC).length)){t.next=7;break}return t.next=4,D(this,gC)[r].check(e,n);case 4:r++,t.next=1;break;case 7:case"end":return t.stop()}}),t,this)}))),function(t,n){return e.apply(this,arguments)})},{key:"checkSync",value:function(t,e){for(var n=0;n<D(this,gC).length;n++)D(this,gC)[n].check(t,e)}}]),t}(),IC=function(){function t(e,n){u(this,t),d(this,"rule",void 0),d(this,"notification",void 0),this.rule=e,this.notification=n}var e;return f(t,[{key:"check",value:(e=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return");case 1:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)})}]),t}(),mC=function(t){p(n,IC);var e=T(n);function n(t,r){return u(this,n),e.call(this,t,r)}return f(n,[{key:"check",value:function(t){var e=this.rule.getParamsMatchedRule(t.api);if(e&&t.attributes){var n=nC(t.attributes,e);if(void 0!==n)for(var r=0,i=Object.keys(n);r<i.length;r++){var a=i[r];Object.prototype.hasOwnProperty.call(n,a)&&this.notification.notify(t,Iy.ERROR_PARAM_INVALID,n[a])}}}}]),n}(),EC=function(t){p(n,IC);var e=T(n);function n(t,r){return u(this,n),e.call(this,t,r)}return f(n,[{key:"check",value:function(t){if(t.callStatus){var e=this.rule.getStatusMatchedRule(t.api);e&&!e.includes(t.callStatus)&&this.notification.notify(t,Iy.ERROR_REQUEST_REFUSED,by,Dy.ERROR_REQUEST_REFUSED)}}}]),n}(),_C=function(t){p(r,IC);var e,n=T(r);function r(t,e){return u(this,r),n.call(this,t,e)}return f(r,[{key:"check",value:(e=l(a().mark((function t(e){var n,r,i,o=arguments;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=o.length>1&&void 0!==o[1]?o[1]:{},!e.capabilityCode){t.next=21;break}return t.prev=2,t.next=5,n.tim.callExperimentalAPI("isCommercialAbilityEnabled",e.capabilityCode);case 5:!1===t.sent.data.enabled&&this.notification.notify(e,Iy.ERROR_PACKAGE_NOT_SUPPORTED,_y,Dy.ERROR_PACKAGE_NOT_SUPPORTED),t.next=21;break;case 9:if(t.prev=9,t.t0=t.catch(2),wx.$TUICallEngine._callDataReport.setCodeAndMessage(Iy.ERROR_PACKAGE_NOT_SUPPORTED,JSON.stringify(t.t0)),wx.$TUICallEngine._callDataReport.uploadToKibana(),2905!==t.t0.code){t.next=17;break}this.notification.notify(e,Iy.ERROR_TIM_VERSION_OUTDATED,Ty,Dy.ERROR_TIM_VERSION_OUTDATED),t.next=21;break;case 17:throw r=null,i=0,e.capabilityCode===Dg.PRO?(r="".concat((a=e.sdkAppID,s=void 0,s=j_(a)?"".concat(Dy.ERROR_PACKAGE_NOT_SUPPORTED):"".concat(_y),s=s.replace("${purchaseAddress}",V_(a)))," <ERROR_PACKAGE_NOT_SUPPORTED: ").concat(Iy.ERROR_PACKAGE_NOT_SUPPORTED,">"),i=Iy.ERROR_PACKAGE_NOT_SUPPORTED):(r="".concat(fC(e.sdkAppID)," <ERROR_PACKAGE_NOT_PURCHASED: ").concat(Iy.ERROR_PACKAGE_NOT_PURCHASED,">"),i=Iy.ERROR_PACKAGE_NOT_PURCHASED),new hC(i,r);case 21:case"end":return t.stop()}var a,s}),t,this,[[2,9]])}))),function(t){return e.apply(this,arguments)})}]),r}(),TC=function(t){p(n,IC);var e=T(n);function n(t,r){return u(this,n),e.call(this,t,r)}return f(n,[{key:"check",value:function(t,e){void 0!==t.initReady&&this.rule.getInitReadyRule(t.api)!==t.initReady&&this.notification.notify(t,Iy.ERROR_INIT_FAIL,Cy,Dy.ERROR_INIT_FAIL)}}]),n}(),CC=function(){function t(){u(this,t),d(this,"alertRule",void 0),d(this,"notification",void 0),d(this,"alert",void 0)}return f(t,[{key:"initializeBeans",value:function(){this.alertRule=new dC,this.notification=new pC,this.alert=new yC,this.alert.addAlertHandler(new mC(this.alertRule,this.notification)),this.alert.addAlertHandler(new TC(this.alertRule,this.notification)),this.alert.addAlertHandler(new _C(this.alertRule,this.notification)),this.alert.addAlertHandler(new EC(this.alertRule,this.notification))}},{key:"getAlert",value:function(){return this.alert}}],[{key:"getInstance",value:function(){return this.instance||(this.instance=new t,this.instance.initializeBeans()),this.instance}}]),t}();d(CC,"instance",void 0);var bC=X,DC=$t,RC=Et,wC=ve,SC=Ts,xC=P,LC=Function,OC=bC([].concat),kC=bC([].join),AC={},NC=xC?LC.bind:function(t){var e=DC(this),n=e.prototype,r=SC(arguments,1),i=function(){var n=OC(r,SC(arguments));return this instanceof i?function(t,e,n){if(!wC(AC,e)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";AC[e]=LC("C,a","return new C("+kC(r,",")+")")}return AC[e](t,n)}(e,n.length,n):e.apply(t,n)};return RC(n)&&(i.prototype=n),i};function UC(t){var e=wg.UNKNOWN;switch(t){case mg:e=wg.AUDIO;break;case Eg:e=wg.VIDEO}return e}function PC(t){var e=t;return e===gg?e=wg.CALLER:e===yg&&(e=wg.CALLEE),e}xi({target:"Function",proto:!0,forced:Function.bind!==NC},{bind:NC});var MC=function(){function t(e){u(this,t),d(this,"_eventStatController",void 0),d(this,"_callData",void 0),d(this,"_ssoLog",void 0),this._eventStatController=new Q_,K_.bindController(this._eventStatController),this.initializeCallData(e),this._ssoLog=new K_(J_)}return f(t,[{key:"setCallData",value:function(t){this._callData=t}},{key:"getCallData",value:function(){return this._callData}},{key:"setInviteID",value:function(t){this._callData.inviteID=t}},{key:"setTotalTime",value:function(t){this._callData.totalTime="".concat(t)}},{key:"setAbilityBit",value:function(t){this._callData.abilityBit=!!t}},{key:"setEnterRoomTime",value:function(t){this._callData.enterRoomTime=oy(t)}},{key:"setSendSignalingTime",value:function(t){this._callData.sendSignalingTime=oy(t)}},{key:"setCallAcceptTime",value:function(t){this._callData.callAcceptTime=oy(t)}},{key:"setExitRoomTime",value:function(t){this._callData.exitRoomTime=oy(t)}},{key:"setCallEndTime",value:function(t){this._callData.callEndTime=oy(t)}},{key:"setCodeAndMessage",value:function(t,e){this._callData.code=t||0,this._callData.message=e||""}},{key:"setCallScene",value:function(t){this._callData.callScene=t||""}},{key:"getResult",value:function(){return this._callData.result}},{key:"setResult",value:function(t){this._callData.result=t||""}},{key:"setUserID",value:function(t){this._callData.userID=t||""}},{key:"packageCallDataToKibana",value:function(){var t=UC(this._callData.callType),e=PC(this._callData.callRole);return"".concat("CallData{version='").concat(this._callData.version,", platform=").concat(this._callData.platform,", framework=").concat(this._callData.framework,", sdk_app_id=").concat(this._callData.sdkAppId,", user_id=").concat(this._callData.userID,", room_id=").concat(this._callData.roomID,", invite_id=").concat(this._callData.inviteID,", invitee_list=").concat(this._callData.inviteeList,", media_type=").concat(t,", role=").concat(e,", call_scene=").concat(this._callData.callScene,", result=").concat(this._callData.result,", total_time=").concat(this._callData.totalTime,", total_score=").concat(this._callData.totalScore,", ability_bit=").concat(this._callData.abilityBit,", enter_room=").concat(this._callData.enterRoomTime,", send_signaling=").concat(this._callData.sendSignalingTime,", call_accept=").concat(this._callData.callAcceptTime,", exit_room=").concat(this._callData.exitRoomTime,", call_end=").concat(this._callData.callEndTime,", code=").concat(this._callData.code,", message=").concat(this._callData.message,", network=").concat(this._callData.network,", audio=").concat(this._callData.audio,", video=").concat(this._callData.video,"}")}},{key:"initializeCallData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.version,n=void 0===e?"":e,r=t.sdkAppId,i=void 0===r?0:r,a=t.userID,o=void 0===a?"":a,s=A_(),c=m_?"uniminiprogram":"wxminiprogram";this._callData={version:n,platform:s,framework:c,sdkAppId:i,userID:o,roomID:0,inviteID:"",callRole:vg,callScene:"",callType:Ig,inviteeList:[],result:wg.UNKNOWN,totalTime:0,totalScore:0,code:0,message:"",abilityBit:!1,enterRoomTime:"",sendSignalingTime:"",callAcceptTime:"",exitRoomTime:"",callEndTime:"",network:0,audio:0,video:0}}},{key:"reset",value:function(){this.initializeCallData(),this._ssoLog=null}},{key:"clearCallDataAfterUpload",value:function(){var t=this.getCallData(),e=t.version,n=t.sdkAppId,r=t.userID;this.initializeCallData({version:e,sdkAppId:n,userID:r})}},{key:"uploadToKibana",value:function(){try{this._ssoLog.setText(this.packageCallDataToKibana()).setEnd(),this.clearCallDataAfterUpload()}catch(t){}}}]),t}(),jC=function(){function t(e,n){u(this,t),d(this,"_eventEmitter",void 0),d(this,"_callDataReport",void 0),this._eventEmitter=e.emitter,this._callDataReport=n,this.registerListener()}return f(t,[{key:"registerListener",value:function(){this._eventEmitter.on(og.CALL_END,this.onCallEnd.bind(this)),this._eventEmitter.on(og.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.on(og.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.on(og.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.on(og.REJECT,this.onReject.bind(this))}},{key:"removeLister",value:function(){this._eventEmitter.off(og.CALL_END,this.onCallEnd.bind(this)),this._eventEmitter.off(og.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.off(og.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.off(og.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.off(og.REJECT,this.onReject.bind(this))}},{key:"onCallEnd",value:function(t){var e=t.data.totalTime,n=void 0===e?0:e;this._callDataReport.setTotalTime(n),this._callDataReport.setCallEndTime((new Date).getTime()),this._callDataReport.setResult(wg.NORMAL),this._callDataReport.setCodeAndMessage(),this._callDataReport.uploadToKibana()}},{key:"onCallingCancel",value:function(){this._callDataReport.getResult()||this._callDataReport.setResult(wg.CANCEL),this._callDataReport.setCodeAndMessage(),this._callDataReport.uploadToKibana()}},{key:"onNoResponse",value:function(){this._callDataReport.setResult(wg.TIMEOUT)}},{key:"onLineBusy",value:function(){this._callDataReport.setResult(wg.BUSYLINE)}},{key:"onReject",value:function(){this._callDataReport.setResult(wg.REJECT)}}]),t}();function VC(t){return GC.apply(this,arguments)}function GC(){return GC=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e===pg.AUDIO||e===pg.VIDEO){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise(function(){var t=l(a().mark((function t(n,r){var i,o,s,c,l,u;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i={microphone:!0,camera:e===pg.VIDEO},t.next=3,N_(i);case 3:if((o=t.sent)||e!==pg.AUDIO){t.next=16;break}return t.prev=5,t.next=8,wx.authorize({scope:Lg.RECORD});case 8:t.next=16;break;case 10:t.prev=10,t.t0=t.catch(5),s=Sg.MIC_TITLE,c=Sg.MIC_CONTENT,HC(s,c),r();case 16:if(o||e!==pg.VIDEO){t.next=30;break}return t.prev=17,t.next=20,wx.authorize({scope:Lg.RECORD});case 20:return t.next=22,wx.authorize({scope:Lg.CAMERA});case 22:t.next=30;break;case 24:t.prev=24,t.t1=t.catch(17),l=Sg.CAMERA_TITLE,u=Sg.CAMERA_CONTENT,HC(l,u),r();case 30:n();case 31:case"end":return t.stop()}}),t,null,[[5,10],[17,24]])})));return function(e,n){return t.apply(this,arguments)}}()));case 3:case"end":return t.stop()}}),t)}))),GC.apply(this,arguments)}function HC(t,e){wx.showModal({title:t,content:e,confirmText:Sg.CONFIRM_TEXT,success:function(t){t.confirm&&wx.openSetting()}})}var BC=xi,FC=X,KC=kr,zC=lm,JC=Gm,WC=N,$C=RangeError,qC=String,YC=Math.floor,XC=FC(JC),QC=FC("".slice),ZC=FC(1..toFixed),tb=function(t,e,n){return 0===e?n:e%2==1?tb(t,e-1,n*t):tb(t*t,e/2,n)},eb=function(t,e,n){for(var r=-1,i=n;++r<6;)i+=e*t[r],t[r]=i%1e7,i=YC(i/1e7)},nb=function(t,e){for(var n=6,r=0;--n>=0;)r+=t[n],t[n]=YC(r/e),r=r%e*1e7},rb=function(t){for(var e=6,n="";--e>=0;)if(""!==n||0===e||0!==t[e]){var r=qC(t[e]);n=""===n?r:n+XC("0",7-r.length)+r}return n};BC({target:"Number",proto:!0,forced:WC((function(){return"0.000"!==ZC(8e-5,3)||"1"!==ZC(.9,0)||"1.25"!==ZC(1.255,2)||"1000000000000000128"!==ZC(0xde0b6b3a7640080,0)}))||!WC((function(){ZC({})}))},{toFixed:function(t){var e,n,r,i,a=zC(this),o=KC(t),s=[0,0,0,0,0,0],c="",l="0";if(o<0||o>20)throw new $C("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return qC(a);if(a<0&&(c="-",a=-a),a>1e-21)if(n=(e=function(t){for(var e=0,n=t;n>=4096;)e+=12,n/=4096;for(;n>=2;)e+=1,n/=2;return e}(a*tb(2,69,1))-69)<0?a*tb(2,-e,1):a/tb(2,e,1),n*=4503599627370496,(e=52-e)>0){for(eb(s,0,n),r=o;r>=7;)eb(s,1e7,0),r-=7;for(eb(s,tb(10,r,1),0),r=e-1;r>=23;)nb(s,1<<23),r-=23;nb(s,1<<r),eb(s,1,1),nb(s,2),l=rb(s)}else eb(s,0,n),eb(s,1<<-e,0),l=rb(s)+XC("0",o);return l=o>0?c+((i=l.length)<=o?"0."+XC("0",o-i)+l:QC(l,0,i-o)+"."+QC(l,i-o)):c+l}});var ib=function(){function t(){u(this,t)}return f(t,null,[{key:"generateTaskID",value:function(){return this.currentTaskID+=1}},{key:"run",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wg.TIMEOUT,e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;n=i(i({},t===wg.INTERVAL?{delay:2e3,count:0,backgroundTask:!0}:t===wg.RAF?{fps:60,delay:16.6,count:0,backgroundTask:!0}:{delay:2e3,count:0,backgroundTask:!0}),n),w_(e)&&(n=i(i({},n),e)),s(t)===wg.FUNCTION&&(e=t,t=wg.TIMEOUT);var r=i({taskID:this.generateTaskID(),loopCount:0,intervalID:null,timeoutID:null,rafID:null,taskName:t,callback:e},n);return this.taskMap.set(r.taskID,r),this[t](r),r.taskID}},{key:"interval",value:function(t){var e=this;return t.intervalID=setInterval((function(){t.callback(),t.loopCount+=1,e.isBreakLoop(t)}),t.delay)}},{key:"timeout",value:function(t){var e=this;return t.timeoutID=setTimeout((function n(){if(t.callback(),t.loopCount+=1,!e.isBreakLoop(t))return t.timeoutID=setTimeout(n,t.delay)}),t.delay)}},{key:"raf",value:function(t){var e=this;t.delay=(1e3/t.fps).toFixed(2);var n,r=M_(),i=function i(){if(document.hidden&&t.backgroundTask){if(n=M_()-r,r=M_(),t.callback(),t.loopCount+=1,e.isBreakLoop(t))return;return t.timeoutID=setTimeout(i,t.delay-Math.floor(n%t.delay))}if((n=M_()-r)>=t.delay&&(r=M_()-Math.floor(n%t.delay),t.callback(),t.loopCount+=1),!e.isBreakLoop(t))return t.rafID=requestAnimationFrame(i)};if(t.rafID=requestAnimationFrame(i),t.backgroundTask){var a=function(){if(document.hidden){var e=M_()-r;e>=t.delay?i():t.timeoutID=setTimeout(i,t.delay-e)}};document.addEventListener("visibilitychange",a),t.onVisibilitychange=a,document.hidden&&a()}return t.taskID}},{key:"hasTask",value:function(t){return this.taskMap.has(t)}},{key:"clearTask",value:function(t){if(!this.taskMap.has(t))return!0;var e=this.taskMap.get(t),n=e.intervalID,r=e.timeoutID,i=e.onVisibilitychange;return n&&clearInterval(n),r&&clearTimeout(r),i&&document.removeEventListener("visibilitychange",i),this.taskMap.delete(t),!0}},{key:"isBreakLoop",value:function(t){return!this.taskMap.has(t.taskID)||0!==t.count&&t.loopCount>=t.count&&(this.clearTask(t.taskID),!0)}}]),t}();d(ib,"taskMap",new Map),d(ib,"currentTaskID",1);var ab={serviceCommand:"".concat(wg.CALLKIT_RECORDS_SVR,".*")},ob="sendTRTCCustomData",sb=function(){function t(e){u(this,t),d(this,"_callRecordData",void 0),d(this,"_tim",void 0),d(this,"_heartbeat",void 0),d(this,"_lastHeartBeatTime",void 0),d(this,"_bodyStatus",void 0),this._tim=e.tim,this._heartbeat=-1,this._lastHeartBeatTime=-1,this._bodyStatus=wg.WAITING,this.initializeCallData(e)}var e,n,r,o;return f(t,[{key:"getCallRecordData",value:function(){return this._callRecordData}},{key:"initializeCallData",value:function(t){var e=t||{},n=e.version,r=void 0===n?"":n,i=e.userID,a=void 0===i?"":i,o={name:g_.platform,version:g_.version},s={version:1,command:wg.EVENT_REPORT,sdk_version:r,seq:0,os_name:wg.MINI_PROGRAM,os_version:o.version||"",device_name:o.name||"",framework:wg.MINI_PROGRAM,call_type:"",media_type:"",client_ts:0,role:vg,user_id:a,room_id:"",call_id:""};this._callRecordData={head:s,body:{event_type:"",code:0,message:"",invitee_list:[]}}}},{key:"reset",value:function(){this.initializeCallData()}},{key:"_setCallType",value:function(t){t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{call_type:t}))}},{key:"_setMediaType",value:function(t){t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{media_type:UC(t)}))}},{key:"_setCallRole",value:function(t){t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{role:t}))}},{key:"_setUserID",value:function(t){t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{user_id:t}))}},{key:"_setRoomID",value:function(t){t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{room_id:"".concat(t)}))}},{key:"_setInviteID",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{call_id:t}))}},{key:"_setEventType",value:function(t){t&&(this._callRecordData.body=i(i({},this._callRecordData.body),{},{event_type:t}))}},{key:"_setInviteeList",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._callRecordData.body=i(i({},this._callRecordData.body),{},{invitee_list:t})}},{key:"_setSeq",value:function(){var t=this.getCallRecordData().head.seq;this._callRecordData.head=i(i({},this._callRecordData.head),{},{seq:t+1})}},{key:"setBodyStatus",value:function(t){if(t){var e=wg.WAITING;switch(t){case sg.CALLING:e=wg.WAITING;break;case sg.CONNECTED:e=wg.CALLING}this._bodyStatus=e}}},{key:"eventUpload",value:(o=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g,y,I;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.eventType,o=e.callType,s=e.mediaType,c=e.callRole,l=e.userID,u=e.roomID,h=e.inviteID,f=e.inviteeList,d=void 0===f?[]:f,r){t.next=3;break}return t.abrupt("return");case 3:return this._callRecordData.head=i(i({},this._callRecordData.head),{},{command:wg.EVENT_REPORT,client_ts:Math.floor(Date.now()/1e3)}),this._setCallType(o),this._setMediaType(s),this._setCallRole(c),this._setUserID(l),this._setRoomID(u),this._setInviteID(h),this._setEventType(r),this._setInviteeList(d),this._setSeq(),p=this.getCallRecordData(),v=p.head,g=p.body,y={head:i(i({},v),{},{role:PC(v.role)}),body:g},I=i(i({},ab),{},{data:JSON.stringify(y)}),t.next=18,null==this||null===(n=this._tim)||void 0===n?void 0:n.callExperimentalAPI(ob,I);case 18:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"eventUploadNotSave",value:(r=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.eventType,o=e.callType,s=e.mediaType,c=e.callRole,l=e.roomID,u=e.inviteID,this._setSeq(),h=this.getCallRecordData(),f=h.head,d=h.body,p={head:i(i({},f),{},{role:PC(c),call_id:u,call_type:o,media_type:UC(s),room_id:"".concat(l),client_ts:Math.floor(Date.now()/1e3)}),body:i(i({},d),{},{event_type:r})},v=i(i({},ab),{},{data:JSON.stringify(p)}),t.next=7,null==this||null===(n=this._tim)||void 0===n?void 0:n.callExperimentalAPI(ob,v);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"heartBeatUpload",value:(n=l(a().mark((function t(){var e,n,r,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._setSeq(),n=this._callRecordData.head,r={head:i(i({},n),{},{role:PC(n.role),clientTs:Date.now(),command:wg.HEART_BEAT}),body:{status:this._bodyStatus}},o=i(i({},ab),{},{data:r}),t.next=6,null==this||null===(e=this._tim)||void 0===e?void 0:e.callExperimentalAPI(ob,o);case 6:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"startHeartbeat",value:function(){-1===this._heartbeat&&(F_.info("start heart beat..."),this.heartBeatUpload(),this._heartbeat=ib.run(wg.TIMEOUT,this.doHeartbeat.bind(this),{delay:2e3,count:0,backgroundTask:!0}))}},{key:"stopHeartbeat",value:function(){-1!==this._heartbeat&&(F_.info("stop heart beat"),ib.clearTask(this._heartbeat),this._heartbeat=-1,this._lastHeartBeatTime=-1,this._bodyStatus=wg.WAITING)}},{key:"doHeartbeat",value:(e=l(a().mark((function t(){var e;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.heartBeatUpload(),e=Date.now(),this._lastHeartBeatTime>0&&e-this._lastHeartBeatTime>1e4&&F_.warn("heartbeat took ".concat(e-this._lastHeartBeatTime)),this._lastHeartBeatTime=e;case 4:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})}]),t}(),cb=function(){function t(e,n){u(this,t),d(this,"_eventEmitter",void 0),d(this,"_callRecordDataReport",void 0),d(this,"_isCallAccepted",void 0),this._eventEmitter=e,this._callRecordDataReport=n,this._isCallAccepted=!1,this.registerListener()}return f(t,[{key:"registerListener",value:function(){this._eventEmitter.on(og.ON_CALL_RECEIVED,this.onCallReceived.bind(this)),this._eventEmitter.on(og.USER_ACCEPT,this.onCallAccepted.bind(this)),this._eventEmitter.on(og.CALL_END,this.onCallEnd.bind(this)),this._eventEmitter.on(og.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.on(og.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.on(og.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.on(og.REJECT,this.onReject.bind(this))}},{key:"removeLister",value:function(){this._eventEmitter.off(og.ON_CALL_RECEIVED,this.onCallReceived),this._eventEmitter.off(og.USER_ACCEPT,this.onCallAccepted),this._eventEmitter.off(og.CALL_END,this.onCallEnd),this._eventEmitter.off(og.CALLING_CANCEL,this.onCallingCancel),this._eventEmitter.off(og.NO_RESP,this.onNoResponse),this._eventEmitter.off(og.LINE_BUSY,this.onLineBusy),this._eventEmitter.off(og.REJECT,this.onReject)}},{key:"onCallReceived",value:function(){this._callRecordDataReport.startHeartbeat()}},{key:"onCallAccepted",value:function(){var t=this._callRecordDataReport.getCallRecordData().head;if((null==t?void 0:t.role)===wg.INVITER){if(this._isCallAccepted&&t.call_type===wg.GROUP)return;this._isCallAccepted=!0;var e={eventType:wg.CALL_ACCEPTED};this._callRecordDataReport.eventUpload(e),this._callRecordDataReport.setBodyStatus(sg.CONNECTED)}}},{key:"onCallEnd",value:function(){var t={eventType:wg.CALL_END};this._isCallAccepted=!1,this._callRecordDataReport.eventUpload(t),this._callRecordDataReport.stopHeartbeat()}},{key:"onCallingCancel",value:function(t){var e=this._callRecordDataReport.getCallRecordData().head,n=e.role===wg.INVITER?wg.CANCEL_CALL:wg.CALL_CANCELED;this._isCallAccepted=!1;var r=(t.data||{}).reason;((void 0===r?"":r)===wg.NORMAL||e.role===wg.INVITER&&e.call_type===wg.GROUP)&&this._callRecordDataReport.eventUpload({eventType:n}),this._callRecordDataReport.stopHeartbeat()}},{key:"onNoResponse",value:function(){this._uploadInC2C(wg.TIMEOUT)}},{key:"onLineBusy",value:function(){this._uploadInC2C(wg.BUSYLINE)}},{key:"onReject",value:function(){this._uploadInC2C(wg.REJECT)}},{key:"_uploadInC2C",value:function(t){var e=this._callRecordDataReport.getCallRecordData().head;if((null==e?void 0:e.call_type)===wg.SINGLE){var n="";switch(t){case wg.TIMEOUT:n=e.role===wg.INVITER?wg.CALL_MISSED:wg.NOT_ANSWER_CALL;break;case wg.REJECT:n=e.role===wg.INVITER&&wg.CALL_REJECTED;break;case wg.BUSYLINE:n=e.role===wg.INVITER?wg.CALL_BUSY:wg.NOT_ANSWER_CALL;break;default:return}this._callRecordDataReport.eventUpload({eventType:n})}}}]),t}(),lb="TUICallEngine",ub=ly({clsConfig:{endpoint:"https://ap-nanjing.cls.tencentcs.com",topicId:"a1310e66-a3f5-4572-a1c3-7a327a27496d"}}),hb=function(){function r(i){u(this,r),d(this,"_initReady",!1),d(this,"_timExternal",!1),d(this,"_initialCallId",""),this.data={config:{sdkAppID:i.sdkAppID,userID:"",userSig:"",type:1}},this.initData(),this.EVENT=og,this.MEDIA_TYPE=pg,this.CALL_TYPE=pg,this._emitter=new ag,this.TRTC=new e(this,{TUIScene:"TUICallKit"});var a="TUICallKit";try{(wx&&wx._isTIMCallKit||wx&&wx.getStorageSync&&wx.getStorageSync("_isTIMCallKit")||getApp&&getApp()&&getApp().globalData&&getApp().globalData._isTIMCallKit)&&(a="TIMCallKit")}catch(t){console.error(t)}wx.TUIScene=a,this._callDataReport=new MC({version:Ly,sdkAppId:i.sdkAppID}),this._dataReportObserver=new jC({emitter:this._emitter},this._callDataReport),i.tim?(this.tim=i.tim,this._timExternal=!0):wx.$TIM?(this.tim=wx.$TIM,this._timExternal=!0):this.tim=n.create({SDKAppID:i.sdkAppID}),this._callRecordReport=new sb({version:Ly,tim:this.tim}),this._recordReportObserver=new cb(this._emitter,this._callRecordReport),wx.$TSignaling||(wx.$TSignaling=new t({SDKAppID:i.sdkAppID,tim:this.tim,isRejectNotifyAll:!0})),wx.getSystemInfoSync().platform===wg.DEVTOOLS&&F_.warn("".concat(xg)),wx.setStorageSync("sdkAppId",i.sdkAppID),this.TSignalingClient=new Sy({TSignaling:wx.$TSignaling}),this.TRTCCallingDelegate=new xy({emitter:this._emitter}),this._eventStatController=new Q_;var o=new K_(z_);K_.bindController(this._eventStatController),o.setText("version=".concat(Ly)).setEnd(),this._initLogger(i),F_.info("".concat(lb," SDK Version:").concat(Ly,", SDKAppID:").concat(i.sdkAppID))}var o,s,c,h,p,v,g,y,I,m,E,_,T,b,D,R,w,S,x,L,O,k,A,N,U,P,M,j,V,G,H,B,F,K,z,J,W;return f(r,[{key:"destroyInstance",value:function(){if(r.instance){this._callDataReport&&this._callDataReport.reset&&this._callDataReport.reset(),this._dataReportObserver&&this._dataReportObserver.reset&&this._dataReportObserver.removeLister(),this._callRecordReport&&this._callRecordReport.reset(),this._recordReportObserver&&this._recordReportObserver.removeLister(),r.instance.destroyed(),r.instance=null;try{wx.removeStorageSync("sdkAppId"),wx.removeStorageSync("userId")}catch(t){console.error(t)}}}},{key:"_initLogger",value:function(t){var e=this;wx.getSystemInfo({success:function(t){var e=t.brand,n=t.model,r=t.language,i=t.platform,a=t.version;ub.updateGetReportData((function(){return{useragent:{brand:e,model:n,language:r,platform:i,version:a}}}))}}),this._logger=ub,this._logger.updateGetReportData((function(){return{app:"TUICallEngine-mini",version:Ly,platform:wg.MINI_PROGRAM,sdkappid:t.sdkAppID,time:+new Date,userid:e.getUserID(),callinfo:{roomid:e.getRoomID(),inviteid:e.getInitialCallId(),callrole:e.isInviter()?wg.INVITER:wg.INVITEE,groupid:e.getGroupID(),calltype:e.getCallType(),handledInviteeList:e.getHandledInviteeList(),unHandledInviteeList:e.getUnHandledInviteeList()},callkitversion:t.callkitVersion||wg.UNKNOWN,framework:t.frameWork||wg.UNKNOWN,isfromchat:t.chat?"true":"false"}}))}},{key:"setLogLevel",value:function(t){"number"!=typeof t||isNaN(t)?F_.error("".concat(lb,",setLogLevel parameter must be a number(0~4)")):(F_.setLevel(t),this.TSignalingClient.setLogLevel(t),this.TRTC.setLogLevel(t))}},{key:"initData",value:function(){var t={callStatus:sg.IDLE,soundMode:this.data.config.type===pg.AUDIO?bg.EAR:bg.SPEAKER,active:!1,invitation:{inviteID:"",inviter:"",type:"",roomID:""},startTalkTime:0,localUser:null,remoteUsers:[],remoteID:"",timer:null,chatTimeNum:0,chatTime:"00:00:00",screen:"pusher",pusher:{},playerList:[],isInviter:!0,unHandledInviteeList:[],handledInviteeList:[],_inviterInviteID:{},_audioVideoSwitchIdList:[],_acceptedUserObject:{},isGroupCall:!1,groupID:"",switchCallModeStatus:!0,enterRoomStatus:!1,devicePermission:!1};this.data=i(i({},this.data),t)}},{key:"handleNewInvitationReceived",value:(W=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.NEW_INVITATION_RECEIVED",{text:{data:i(i({},e),{},{currentCallStatus:o})},type:"event"}),o=this.getCallStatus(),F_.log("".concat(lb,".onNewInvitationReceived - params:"),e,"currentCallStatus:".concat(o)),s=e.data,c=s.inviter,l=s.inviteeList,u=s.data,h=s.inviteID,f=s.groupID,P_((d=JSON.parse(u)).businessID)){t.next=7;break}return t.abrupt("return");case 7:if(p=(null==d||null===(n=d.data)||void 0===n?void 0:n.initialCallId)||"",this.getUserID()!==c){t.next=10;break}return t.abrupt("return");case 10:if(g={inviter:c,inviteeList:l,inviteID:h,isGroupCall:v=!!f,inviteData:d,groupID:f,initialCallId:p,currentCallStatus:o,inCallUserIDs:(null==d?void 0:d.inCallUserIDs)||[]},"hangup"!==(null==d||null===(r=d.data)||void 0===r?void 0:r.cmd)){t.next=19;break}if(F_.log("".concat(lb,".hangup - params:"),c,d,this.getHandledInviteeList(),this.getUnHandledInviteeList(),o,v),o!==sg.IDLE){t.next=16;break}return t.abrupt("return");case 16:return t.next=18,this.handleHangupSignal(g);case 18:return t.abrupt("return");case 19:if(v||!this.judgeSwitchCallMode(d)){t.next=25;break}if(o===sg.IDLE||d.room_id!==this.data.invitation.roomID){t.next=24;break}return t.next=23,this.handleSwitchCallModeTSignaling(h,d);case 23:this.addAudioVideoSwitchIdList(h);case 24:return t.abrupt("return");case 25:if(o===sg.IDLE){t.next=30;break}return t.next=28,this.TSignalingClient.reject({inviteID:h,type:u.call_type,lineBusy:"line_busy"});case 28:return this.getCallRecordReport().eventUploadNotSave({inviteID:p||h,callRole:wg.INVITEE,eventType:wg.IGNORE_CALL,roomID:d.room_id,mediaType:d.call_type,callType:f?wg.GROUP:wg.SINGLE}),t.abrupt("return");case 30:this.handleInvitedSignal(g);case 31:case"end":return t.stop()}}),t,this)}))),function(t){return W.apply(this,arguments)})},{key:"handleHangupSignal",value:(J=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.inviter,r=e.currentCallStatus,o=e.inviteData,s=e.inviteeList,c=this.isGroupCall(),l=this.isInviter(),r!==sg.CALLING){t.next=11;break}if(u=this.getUnHandledInviteeList(),h=this.getHandledInviteeList(),-1!==u.indexOf(n)&&this.deleteUnHandledInviteeList([n]),-1!==h.indexOf(n)){t.next=9;break}return t.abrupt("return");case 9:t.next=15;break;case 11:if(this.deleteHandledInviteeList([n]),!(-1===(f=this.getHandledInviteeList()).indexOf(n)&&f.length>1)){t.next=15;break}return t.abrupt("return");case 15:if(d=this.generateCallEndData({totalTime:o.call_end||0}),c){t.next=22;break}return this.TRTCCallingDelegate.onCallEnd(d),t.next=20,this._resetTUICallEngine();case 20:case 31:t.next=46;break;case 22:if(this.deleteHandledInviteeList([n]),this.data.playerList=this.data.playerList.filter((function(t){return t.userID!==n})),p=this.getHandledInviteeList(),v=this.getUnHandledInviteeList(),!l){t.next=33;break}if(1!==p.length||0!==v.length){t.next=31;break}return this.TRTCCallingDelegate.onCallEnd(d),t.next=31,this._resetTUICallEngine();case 33:if(r!==sg.CALLING){t.next=41;break}if(-1!==s.indexOf(this.getUserID())&&this.TRTCCallingDelegate.onUserLeave({userID:n,playerList:this.data.playerList}),0!==p.length||1!==v.length){t.next=41;break}return g=this.generateEventData(),this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:this.getUserID(),userID:this.getUserID()},g),{},{reason:wg.NORMAL})),t.next=41,this._resetTUICallEngine();case 41:if(r!==sg.CONNECTED){t.next=46;break}if(1!==p.length||0!==v.length){t.next=46;break}return this.TRTCCallingDelegate.onCallEnd(d),t.next=46,this._resetTUICallEngine();case 46:case"end":return t.stop()}}),t,this)}))),function(t){return J.apply(this,arguments)})},{key:"handleSwitchCallModeTSignaling",value:(z=l(a().mark((function t(e,n){var r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={inviteID:e,type:n.call_type},i={cmd:"switchToVideo"},n.call_type===pg.VIDEO&&(r.switch_to_audio_call="switch_to_audio_call",i.cmd="switchToAudio"),t.next=5,this.TSignalingClient.accept(r,i);case 5:o=t.sent,this.setSwitchCallModeStatus(!1),this.handleCallMode(n.call_type,o);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return z.apply(this,arguments)})},{key:"judgeSwitchCallMode",value:function(t){return t.switch_to_audio_call&&"switch_to_audio_call"===t.switch_to_audio_call||t.data&&"switchToAudio"===t.data.cmd||t.data&&"switchToVideo"===t.data.cmd}},{key:"handleCallMode",value:function(t,e){F_.log("".concat(lb,".handleCallMode - type"),t);var n=t!==pg.VIDEO;this.setPusherAttributesHandler({enableCamera:n}),n?(this.data.config.type=pg.VIDEO,this.data.invitation.type=pg.VIDEO):(this.data.config.type=pg.AUDIO,this.data.invitation.type=pg.AUDIO),this.TRTCCallingDelegate.onCallMode({type:this.data.config.type,message:e.data.message}),this.setSwitchCallModeStatus(!0)}},{key:"handleInvitedSignal",value:(K=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g,y,I;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.inviter,r=e.inviteeList,o=e.isGroupCall,s=e.groupID,c=e.inviteID,l=e.inviteData,u=e.inCallUserIDs,h=void 0===u?[]:u,f=e.initialCallId,d=void 0===f?"":f,this.data.remoteID=n,this.data.config.type=l.call_type,this.data.invitation.inviteID=c,this.data.invitation.inviter=n,this.data.invitation.type=l.call_type,this.data.invitation.roomID=l.room_id,this.data.isInviter=!1,this.data.isGroupCall=o,this.data.roomID=l.room_id,this.addHandledInviteeList([n]),this.addUnHandledInviteeList([].concat(C(r),C(h))),this.addAcceptedUserList(c,[n]),this.addInviterInviteId(c,[n].concat(C(r))),this.setInitialCallId(d),p=h.filter((function(t){return-1===r.indexOf(t)})),o&&(this.data.groupID=s),this.changeCallStatus(sg.CALLING),F_.log("".concat(lb," NEW_INVITATION_RECEIVED invitation: "),this.data.callStatus,this.data.invitation),v={sponsor:n,inviteeList:r,userIDList:[].concat(C(r),C(p)),isFromGroup:o,inviteID:c,groupID:s,inviteData:{version:l.version,callType:l.call_type,roomID:l.room_id},userData:l.userData,calleeIdList:r,callMediaType:l.call_type},this.setPusherAttributesHandler({enableCamera:this.data.config.type===pg.VIDEO}),g=i(i({},g=this.getCallDataReport().getCallData()),{},{userId:this.getUserID(),roomID:l.room_id,inviteID:c,callRole:yg,callType:l.call_type,inviteeList:r}),y={eventType:wg.RECEIVE_CALL,callType:s?wg.GROUP:wg.SINGLE,mediaType:l.call_type,callRole:wg.INVITEE,userID:this.getUserID(),roomID:l.room_id,inviteID:d||c},this.getCallRecordReport().eventUpload(y),this.getCallDataReport().setCallData(g),I=this.generateEventData()||{},this.TRTCCallingDelegate.onInvited(i(i({},I),v)),t.next=30,N_({camera:!0});case 30:this.data.devicePermission=t.sent,this.data.devicePermission&&this.data.config.type===pg.VIDEO&&wx.createLivePusherContext().startPreview();case 32:case"end":return t.stop()}}),t,this)}))),function(t){return K.apply(this,arguments)})},{key:"addInviterInviteId",value:function(t,e){0!==e.length&&(0===(this.data._inviterInviteID[t]||[]).length?this.data._inviterInviteID[t]=e:this.data._inviterInviteID[t]=[].concat(C(this.data._inviterInviteID[t]),C(e)))}},{key:"handleInviteeAccepted",value:(F=l(a().mark((function t(e){var n,r,o,s,c,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITEE_ACCEPTED",{text:{data:i(i({},e),{},{currentCallStatus:this.data.callStatus}),type:"event"}}),F_.log("".concat(lb," onInviteeAccepted - params:"),e),P_(null==(n=JSON.parse(e.data.data))?void 0:n.businessID)){t.next=5;break}return t.abrupt("return");case 5:if(r=e.data.invitee,o=e.data.inviteID,-1!==this.getTotalInviterInviteIdList().indexOf(o)){t.next=9;break}return t.abrupt("return");case 9:if(this.data.callStatus!==sg.IDLE){t.next=11;break}return t.abrupt("return");case 11:if(this.isGroupCall()||!this.judgeSwitchCallMode(n)||this.data.switchCallModeStatus){t.next=14;break}return this.handleCallMode(this.data.invitation.type),t.abrupt("return");case 14:if(s=this.getCallStatus(),r!==this.getUserID()||s!==sg.CALLING){t.next=21;break}return c=this.generateEventData(),this.TRTCCallingDelegate.onCancel(i({inviteID:this.data.invitation.inviteID,invitee:r,userID:r},c)),t.next=20,this._resetTUICallEngine();case 20:return t.abrupt("return");case 21:return this.isInviter()&&this.data.callStatus===sg.CALLING&&this.changeCallStatus(sg.CONNECTED),this.getCallDataReport().setCallAcceptTime((new Date).getTime()),this.addHandledInviteeList([r]),this.deleteUnHandledInviteeList([r]),this.addAcceptedUserList(o,[r]),t.next=28,this.getUserProfile(this.data.unHandledInviteeList.map((function(t){return{userID:t}})));case 28:l=t.sent,this.TRTCCallingDelegate.onUserAccept({userID:r,userList:l});case 30:case"end":return t.stop()}}),t,this)}))),function(t){return F.apply(this,arguments)})},{key:"handleInviteeRejected",value:(B=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g,y,I,m;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITEE_REJECTED",{text:{data:e},type:"event"}),F_.log("".concat(lb," onInviteeRejected - params"),e),r=e.data.inviteID,P_(null==(o=JSON.parse(e.data.data))?void 0:o.businessID)){t.next=6;break}return t.abrupt("return");case 6:if(this.isGroupCall()||this.getSwitchCallModeStatus()||-1===this.getAudioVideoSwitchIdList().indexOf(r)){t.next=10;break}return F_.log("".concat(lb,".onInviteeRejected - Audio and video switching is not available")),this.setSwitchCallModeStatus(!0),t.abrupt("return");case 10:if(s=e.data.invitee,c=e.data.inviter,l=this.getUserID(),u=this.getCallStatus(),-1!==this.getInviterInviteIdList().indexOf(r)){t.next=19;break}if(!this.isInviter()||-1===this.getInviterInviteIdUserList().indexOf(s)){t.next=17;break}return t.abrupt("return");case 17:return this.deleteUnHandledInviteeList([s]),t.abrupt("return");case 19:if(u!==sg.IDLE){t.next=21;break}return t.abrupt("return");case 21:if(h=this.generateEventData(),l!==s||u!==sg.CALLING){t.next=27;break}return this.TRTCCallingDelegate.onCancel(i({inviteID:this.data.invitation.inviteID,invitee:s,userID:s},h)),t.next=26,this._resetTUICallEngine();case 26:return t.abrupt("return");case 27:if(f=this.isGroupCall(),d=this.isInviter(),this.deleteUnHandledInviteeList([s]),p=this.getUnHandledInviteeList(),v=this.getHandledInviteeList(),g=i({inviteID:this.data.invitation.inviteID,invitee:l,userID:l},h),y={inviteID:this.data.invitation.inviteID,invitee:s,userID:s},I=this.data.invitation,u!==sg.CONNECTED){t.next=38;break}if(-1===v.indexOf(s)){t.next=38;break}return t.abrupt("return");case 38:if(!("line_busy"===o.line_busy||""===o.line_busy||null!=o&&null!==(n=o.data)&&void 0!==n&&n.message&&"lineBusy"===o.data.message)){t.next=52;break}if(c===I.inviter&&this.TRTCCallingDelegate.onLineBusy({inviteID:this.data.invitation.inviteID,invitee:s,userID:s}),f){t.next=46;break}return this.TRTCCallingDelegate.onCancel(i(i({},g),{},{reason:wg.BUSYLINE})),t.next=44,this._resetTUICallEngine();case 44:t.next=50;break;case 46:if(0!==p.length||1!==v.length){t.next=50;break}return this.TRTCCallingDelegate.onCancel(i(i({},g),{},{reason:wg.BUSYLINE})),t.next=50,this._resetTUICallEngine();case 50:case 57:t.next=78;break;case 52:if(f){t.next=59;break}return this.TRTCCallingDelegate.onReject(y),this.TRTCCallingDelegate.onCancel(i(i({},g),{},{reason:wg.REJECT})),t.next=57,this._resetTUICallEngine();case 59:if(this.TRTCCallingDelegate.onReject(y),u!==sg.CALLING){t.next=72;break}if(!d){t.next=68;break}if(0!==p.length||1!==v.length){t.next=66;break}return this.TRTCCallingDelegate.onCancel(i(i({},g),{},{reason:wg.REJECT})),t.next=66,this._resetTUICallEngine();case 66:t.next=72;break;case 68:if(1!==p.length||0!==v.length){t.next=72;break}return this.TRTCCallingDelegate.onCancel(i(i({},g),{},{reason:wg.REJECT})),t.next=72,this._resetTUICallEngine();case 72:if(u!==sg.CONNECTED){t.next=78;break}if(0!==p.length||1!==v.length){t.next=78;break}return m=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(m),t.next=78,this._resetTUICallEngine();case 78:case"end":return t.stop()}}),t,this)}))),function(t){return B.apply(this,arguments)})},{key:"handleInvitationCancelled",value:(H=l(a().mark((function t(e){var n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITATION_CANCELLED",{text:{data:e,type:"event"}}),this.data.invitation.inviteID===e.data.inviteID){t.next=3;break}return t.abrupt("return");case 3:if(P_(null==(n=JSON.parse(e.data.data))?void 0:n.businessID)){t.next=6;break}return t.abrupt("return");case 6:if(this.data.callStatus!==sg.IDLE){t.next=8;break}return t.abrupt("return");case 8:if(-1!==this.getInviterInviteIdList().indexOf(e.data.inviteID)){t.next=10;break}return t.abrupt("return");case 10:return F_.log(lb,"onInvitationCancelled","inviteID:".concat(e.data.inviteID," inviter:").concat(e.data.inviter," data:").concat(e.data.data)),r=this.generateEventData(),this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:e.data.inviter,userID:e.data.inviter},r),{},{reason:wg.NORMAL})),t.next=15,this._resetTUICallEngine();case 15:case"end":return t.stop()}}),t,this)}))),function(t){return H.apply(this,arguments)})},{key:"handleInvitationTimeout",value:(G=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g,y,I,m,E,_;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITATION_TIMEOUT",{text:{data:e,type:"event"}}),r=e.data,o=r.inviter,s=r.inviteeList,c=void 0===s?[]:s,l=r.inviteID,u=this.getUserID(),h=this.isGroupCall(),f=this.isInviter(),d=this.getCallStatus(),this.deleteUnHandledInviteeList(c),F_.warn("".concat(lb,".onInvitationTimeout - params:"),e,"currentUserID:".concat(u," isInviter:").concat(f," isGroupCall:").concat(h," \n currentCallStatus:").concat(d," inviteID:").concat(null==this||null===(n=this._newInvitationData)||void 0===n?void 0:n.inviteID)),-1!==this.getInviterInviteIdList().indexOf(l)){t.next=10;break}return t.abrupt("return");case 10:if(d!==sg.IDLE){t.next=12;break}return t.abrupt("return");case 12:if(p=this.getHandledInviteeList(),v=this.getUnHandledInviteeList(),g={groupID:this.data.groupID,inviteID:this.data.invitation.inviteID,sponsor:o,timeoutUserList:c,userIDList:c},y=this.generateEventData(),I=i(i({inviteID:this.data.invitation.inviteID,invitee:u,userID:u},y),{},{reason:wg.TIMEOUT}),h){t.next=23;break}return f?(this.TRTCCallingDelegate.onNoResp(g),this.TRTCCallingDelegate.onCancel(I)):(this.TRTCCallingDelegate.onCancel(I),m=this.getCallRecordReport().getCallRecordData().head,this.getCallRecordReport().eventUpload(i(i({},m),{},{eventType:wg.NOT_ANSWER_CALL,inviteID:this.getInitialCallId()}))),t.next=21,this._resetTUICallEngine();case 21:t.next=48;break;case 23:if(d!==sg.CALLING){t.next=41;break}if(!f){t.next=32;break}if(this.TRTCCallingDelegate.onNoResp(g),0!==v.length){t.next=30;break}return this.TRTCCallingDelegate.onCancel(I),t.next=30,this._resetTUICallEngine();case 30:t.next=41;break;case 32:if(-1!==c.indexOf(u)){t.next=36;break}this.TRTCCallingDelegate.onNoResp(g),t.next=39;break;case 36:return this.TRTCCallingDelegate.onCancel(I),t.next=39,this._resetTUICallEngine();case 39:E=this.getCallRecordReport().getCallRecordData().head,this.getCallRecordReport().eventUpload(i(i({},E),{},{eventType:wg.NOT_ANSWER_CALL,inviteID:this.getInitialCallId()}));case 41:if(d!==sg.CONNECTED){t.next=48;break}if(this.TRTCCallingDelegate.onNoResp(g),1!==p.length||0!==v.length){t.next=48;break}return _=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(_),t.next=48,this._resetTUICallEngine();case 48:case"end":return t.stop()}}),t,this)}))),function(t){return G.apply(this,arguments)})},{key:"handleSDKReady",value:function(){var t=this;this._logger.info("ChatSdkEvent.SDK_READY",{text:{type:"event"}}),F_.log(lb,"TSignaling SDK ready"),this.TSignalingResolve(),this.TRTCCallingDelegate.onSdkReady({message:"SDK ready"}),this.tim.getMyProfile().then((function(e){t.data.localUser=e.data})).catch((function(t){F_.warn("getMyProfile error:",t)}))}},{key:"handleKickedOut",value:(V=l(a().mark((function t(){var e,n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("ChatSdkEvent.KICKED_OUT",{text:{type:"event"}}),this.getCallStatus()!==sg.CONNECTED){t.next=6;break}return e=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(e),t.next=6,this._resetTUICallEngine();case 6:if(this.getCallStatus()!==sg.CALLING){t.next=14;break}return n=this.getUserID(),r=this.generateEventData(),this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:n,userID:n},r),{},{reason:wg.BANNED})),t.next=12,this.cancel();case 12:return t.next=14,this._resetTUICallEngine();case 14:this._initReady=!1,this.TRTCCallingDelegate.onKickedOut({message:"kicked out"});case 16:case"end":return t.stop()}}),t,this)}))),function(){return V.apply(this,arguments)})},{key:"_addTSignalingEvent",value:function(){wx.$TSignaling.on(t.EVENT.NEW_INVITATION_RECEIVED,this.handleNewInvitationReceived,this),wx.$TSignaling.on(t.EVENT.INVITEE_ACCEPTED,this.handleInviteeAccepted,this),wx.$TSignaling.on(t.EVENT.INVITEE_REJECTED,this.handleInviteeRejected,this),wx.$TSignaling.on(t.EVENT.INVITATION_CANCELLED,this.handleInvitationCancelled,this),wx.$TSignaling.on(t.EVENT.INVITATION_TIMEOUT,this.handleInvitationTimeout,this),wx.$TSignaling.on(t.EVENT.SDK_READY,this.handleSDKReady,this),wx.$TSignaling.on(t.EVENT.KICKED_OUT,this.handleKickedOut,this),t.EVENT.MESSAGE_SENT_BY_ME&&wx.$TSignaling.on(t.EVENT.MESSAGE_SENT_BY_ME,this.onMessageSentByMe,this)}},{key:"_removeTSignalingEvent",value:function(){wx.$TSignaling.off(t.EVENT.NEW_INVITATION_RECEIVED,this.handleNewInvitationReceived),wx.$TSignaling.off(t.EVENT.INVITEE_ACCEPTED,this.handleInviteeAccepted),wx.$TSignaling.off(t.EVENT.INVITEE_REJECTED,this.handleInviteeRejected),wx.$TSignaling.off(t.EVENT.INVITATION_CANCELLED,this.handleInvitationCancelled),wx.$TSignaling.off(t.EVENT.INVITATION_TIMEOUT,this.handleInvitationTimeout),wx.$TSignaling.off(t.EVENT.SDK_READY,this.handleSDKReady),wx.$TSignaling.off(t.EVENT.KICKED_OUT,this.handleKickedOut),t.EVENT.MESSAGE_SENT_BY_ME&&wx.$TSignaling.off(t.EVENT.MESSAGE_SENT_BY_ME,this.onMessageSentByMe,this)}},{key:"onLocalJoin",value:function(){var t=this.generateEventData();this.TRTCCallingDelegate.onCallBegin(t)}},{key:"onRemoteUserJoin",value:(j=l(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.data,r=n.userID,i=n.userList,o=n.playerList,F_.log(lb,"REMOTE_USER_JOIN",e,r),this.addHandledInviteeList([r]),this.deleteUnHandledInviteeList([r]),this.changeCallStatus(sg.CONNECTED),!(o.length>0)){t.next=11;break}return t.next=8,this.getUserProfile(o);case 8:t.t0=t.sent,t.next=12;break;case 11:t.t0=this.data.playerList;case 12:this.data.playerList=t.t0,this.data.startTalkTime||(this.data.startTalkTime=Date.now()),this.TRTCCallingDelegate.onUserEnter({userID:e.data.userID,playerList:this.data.playerList}),F_.log(lb,"REMOTE_USER_JOIN","playerList:",this.data.playerList,"userList:",i);case 16:case"end":return t.stop()}}),t,this)}))),function(t){return j.apply(this,arguments)})},{key:"onRemoteUserLeave",value:(M=l(a().mark((function t(e){var n,r,i,o,s,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.getCallStatus()!==sg.IDLE){t.next=2;break}return t.abrupt("return");case 2:if(n=e.data.userID,F_.log(lb,"REMOTE_USER_LEAVE",e,e.data.userID),this.deleteHandledInviteeList([n]),this.data.playerList=this.data.playerList.filter((function(t){return t.userID!==n})),this.TRTCCallingDelegate.onUserLeave({userID:n,playerList:this.data.playerList}),this.getCallDataReport().setExitRoomTime((new Date).getTime()),this.data.isGroupCall){t.next=17;break}return t.next=11,this.TSignalingClient.hangup({userIDList:[n],callType:this.data.config.type,callEnd:this.generateCallTotalTime()});case 11:return r=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(r),F_.log(lb,"REMOTE_USER_LEAVE","playerList:"),t.next=16,this._resetTUICallEngine();case 16:return t.abrupt("return");case 17:if(i=this.getHandledInviteeList(),o=this.getUnHandledInviteeList(),s=this.getUserID(),1!==i.length||i[0]!==s||0!==o.length){t.next=25;break}return c=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(c),t.next=25,this._resetTUICallEngine();case 25:case"end":return t.stop()}}),t,this)}))),function(t){return M.apply(this,arguments)})},{key:"onLocalNetStateUpdate",value:function(t){var e=t.data.pusher.netStatus;F_.log(lb,"onLocalNetStateUpdate",e),this.data.pusher=t.data.pusher,this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"onRemoteNetStateUpdate",value:(P=l(a().mark((function t(e){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.data.playerList,F_.log(lb,"onRemoteNetStateUpdate",n),this.data.playerList=this._updateUserProfile(this.data.playerList,n),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList});case 4:case"end":return t.stop()}}),t,this)}))),function(t){return P.apply(this,arguments)})},{key:"onError",value:function(t){F_.warn(lb,"onError",t),this.TRTCCallingDelegate.onError(t)}},{key:"onRemoteVideoAdd",value:function(t){F_.log("* room REMOTE_VIDEO_ADD",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteVideo:!1})}},{key:"onRemoteVideoRemove",value:function(t){F_.log("* room REMOTE_VIDEO_REMOVE",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteVideo:!0})}},{key:"onRemoteAudioAdd",value:(U=l(a().mark((function t(e){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return F_.log("* room REMOTE_AUDIO_ADD",e),t.next=3,this.getUserProfile([e.data.player]);case 3:n=t.sent,this.setPlayerAttributesHandler(n[0],{muteAudio:!1});case 5:case"end":return t.stop()}}),t,this)}))),function(t){return U.apply(this,arguments)})},{key:"onRemoteAudioRemove",value:function(t){F_.log("* room REMOTE_AUDIO_REMOVE",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteAudio:!0})}},{key:"onRemoteAudioVolumeUpdate",value:(N=l(a().mark((function t(e){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:F_.log("* room REMOTE_AUDIO_VOLUME_UPDATE",e),n=e.data.playerList,this.data.playerList=this._updateUserProfile(this.data.playerList,n),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList});case 4:case"end":return t.stop()}}),t,this)}))),function(t){return N.apply(this,arguments)})},{key:"onLocalAudioVolumeUpdate",value:function(t){var e=t.data.pusher;this.data.pusher=e,this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"onMessageSentByMe",value:function(t){this.TRTCCallingDelegate.onMessageSentByMe(t)}},{key:"_addTRTCEvent",value:function(){this.TRTC.on(this.TRTC.EVENT.LOCAL_JOIN,this.onLocalJoin,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_USER_JOIN,this.onRemoteUserJoin,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_USER_LEAVE,this.onRemoteUserLeave,this),this.TRTC.on(this.TRTC.EVENT.LOCAL_NET_STATE_UPDATE,this.onLocalNetStateUpdate,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_NET_STATE_UPDATE,this.onRemoteNetStateUpdate,this),this.TRTC.on(this.TRTC.EVENT.ERROR,this.onError,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_VIDEO_ADD,this.onRemoteVideoAdd,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_VIDEO_REMOVE,this.onRemoteVideoRemove,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_AUDIO_ADD,this.onRemoteAudioAdd,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_AUDIO_REMOVE,this.onRemoteAudioRemove,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_AUDIO_VOLUME_UPDATE,this.onRemoteAudioVolumeUpdate,this),this.TRTC.on(this.TRTC.EVENT.LOCAL_AUDIO_VOLUME_UPDATE,this.onLocalAudioVolumeUpdate,this)}},{key:"_removeTRTCEvent",value:function(){this.TRTC.off(this.TRTC.EVENT.LOCAL_JOIN,this.onLocalJoin),this.TRTC.off(this.TRTC.EVENT.REMOTE_USER_JOIN,this.onRemoteUserJoin),this.TRTC.off(this.TRTC.EVENT.REMOTE_USER_LEAVE,this.onRemoteUserLeave),this.TRTC.off(this.TRTC.EVENT.LOCAL_NET_STATE_UPDATE,this.onLocalNetStateUpdate),this.TRTC.off(this.TRTC.EVENT.REMOTE_NET_STATE_UPDATE,this.onRemoteNetStateUpdate),this.TRTC.off(this.TRTC.EVENT.ERROR,this.onError),this.TRTC.off(this.TRTC.EVENT.REMOTE_VIDEO_ADD,this.onRemoteVideoAdd),this.TRTC.off(this.TRTC.EVENT.REMOTE_VIDEO_REMOVE,this.onRemoteVideoRemove),this.TRTC.off(this.TRTC.EVENT.REMOTE_AUDIO_ADD,this.onRemoteAudioAdd),this.TRTC.off(this.TRTC.EVENT.REMOTE_AUDIO_REMOVE,this.onRemoteAudioRemove),this.TRTC.off(this.TRTC.EVENT.REMOTE_AUDIO_VOLUME_UPDATE,this.onRemoteAudioVolumeUpdate),this.TRTC.off(this.TRTC.EVENT.LOCAL_AUDIO_VOLUME_UPDATE,this.onLocalAudioVolumeUpdate)}},{key:"initTRTC",value:function(){var t={beautyLevel:5};this._logger.info("".concat(lb,".initTRTC.start"),{type:"api",data:{pusherConfig:t}});var e=this.TRTC.createPusher(t);this.data.pusher=e.pusherAttributes}},{key:"enterRoom",value:function(t){var e=+new Date;this._logger.info("".concat(lb,".enterRoom.start"),{text:{data:t},type:"api"}),this._addTRTCEvent();var n=t.roomID,r=Object.assign(this.data.config,{roomID:n,enableMic:!0,autopush:!0,enableAgc:!0,enableAns:!0,enableCamera:t.callType===pg.VIDEO});this.data.enterRoomStatus=!0,this.data.pusher=this.TRTC.enterRoom(r);var a=+new Date;this._logger.info("".concat(lb,".enterRoom.success"),{text:{data:i(i({},t),{},{cost:a-e})},type:"api"}),wx.createLivePusherContext().startPreview(),this.getCurrentPusherInstance().start()}},{key:"exitRoom",value:(A=l(a().mark((function t(){var e;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".exitRoom.start"),{type:"api"}),t.next=3,this.getCurrentPusherInstance().stop();case 3:return t.next=5,this.TRTC.exitRoom();case 5:e=t.sent,this.data.pusher=e.pusher,this.data.playerList=e.playerList,this.data.unHandledInviteeList=[],this.data.enterRoomStatus=!1,this.initTRTC(),this._removeTRTCEvent();case 12:case"end":return t.stop()}}),t,this)}))),function(){return A.apply(this,arguments)})},{key:"setPusherAttributesHandler",value:function(t){this._logger.info("".concat(lb,".setPusherAttributesHandler.start"),{text:{data:t},type:"api"}),this.data.pusher=this.TRTC.setPusherAttributes(t),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"setPlayerAttributesHandler",value:(k=l(a().mark((function t(e,n){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._logger.info("".concat(lb,".setPlayerAttributesHandler.start"),{text:{data:n},type:"api"}),r=this.TRTC.setPlayerAttributes(e.streamID,n),F_.warn("setPlayerAttributesHandler",r),this.data.playerList=r.length>0?this._updateUserProfile(this.data.playerList,r):this.data.playerList,this.data.playerList.length>0&&0===r.length&&(this.data.playerList[0].hasAudio=!1,this.data.playerList[0].hasVideo=!1),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList});case 6:case"end":return t.stop()}}),t,this)}))),function(t,e){return k.apply(this,arguments)})},{key:"_mutePlayerAudio",value:function(t){this._logger.info("".concat(lb,"._mutePlayerAudio.start"),{text:{data:t},type:"api"});var e=t.currentTarget.dataset.value;e.hasAudio&&e.muteAudio?this.setPlayerAttributesHandler(e,{muteAudio:!1}):!e.hasAudio||e.muteAudio||this.setPlayerAttributesHandler(e,{muteAudio:!0})}},{key:"_mutePlayerVideo",value:function(t){this._logger.info("".concat(lb,"._mutePlayerVideo.start"),{text:{data:t},type:"api"});var e=t.currentTarget.dataset.value;e.hasVideo&&e.muteVideo?this.setPlayerAttributesHandler(e,{muteVideo:!1}):!e.hasVideo||e.muteVideo||this.setPlayerAttributesHandler(e,{muteVideo:!0})}},{key:"_pusherAudioHandler",value:function(){this._logger.info("".concat(lb,"._pusherAudioHandler.start"),{type:"api",text:{data:{enableMic:this.data.pusher.enableMic}}}),this.data.pusher.enableMic?(this.setPusherAttributesHandler({enableMic:!1}),this.getCurrentPusherInstance().setMICVolume({volume:0})):(this.setPusherAttributesHandler({enableMic:!0}),this.getCurrentPusherInstance().setMICVolume({volume:100}))}},{key:"_pusherVideoHandler",value:function(){this._logger.info("".concat(lb,"._pusherVideoHandler.start"),{type:"api",text:{data:{enableCamera:this.data.pusher.enableCamera}}}),this.data.pusher.enableCamera?this.setPusherAttributesHandler({enableCamera:!1}):this.setPusherAttributesHandler({enableCamera:!0})}},{key:"init",value:(O=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return CC.getInstance().getAlert().checkSync(new vC({api:"init",attributes:e})),t.next=3,this.login(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)}))),function(t){return O.apply(this,arguments)})},{key:"login",value:(L=l(a().mark((function t(e){var n=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.updateGetReportData((function(){return{userid:e.userID}})),this._logger.info("".concat(lb,".login.start"),{type:"api",text:i(i({},e),{},{userSig:""})}),this.data.config.userID=e.userID,this.data.config.userSig=e.userSig,t.abrupt("return",new Promise((function(t,r){wx.$TSignaling.login({userID:e.userID,userSig:e.userSig}).then((function(r){return F_.log(lb,"login","IM login success",r),wx.setStorageSync("userId","".concat(e.userID)),n._callDataReport.setUserID(e.userID),n._initReady=!0,n._resetTUICallEngine(),n._addTSignalingEvent(),n.initTRTC(),n.TSignalingResolve=t,r.data.repeatLogin&&t(null),null})).catch((function(t){n._logger.error("".concat(lb,".login.fail"),{type:"api",text:{error:t}}),F_.error("".concat(lb," init failed', error: ").concat(t)),r(t)}))})));case 5:case"end":return t.stop()}}),t,this)}))),function(t){return L.apply(this,arguments)})},{key:"logout",value:(x=l(a().mark((function t(){var e,n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,".logout.start"),{type:"api",text:{data:{userID:this.data.config.userID,initReady:this._initReady}}}),this._initReady){t.next=3;break}return t.abrupt("return");case 3:return e=this.data.config,n=e.userID,r=e.userSig,t.prev=4,t.next=7,wx.$TSignaling.logout({userID:n,userSig:r});case 7:F_.log(lb,"logout","IM logout success"),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(4),this._logger.error("".concat(lb,".logout.fail"),{type:"api",text:{error:t.t0}}),F_.error(lb,"logout","IM logout failure");case 14:case"end":return t.stop()}}),t,this,[[4,10]])}))),function(){return x.apply(this,arguments)})},{key:"on",value:function(t,e,n){CC.getInstance().getAlert().checkSync(new vC({api:"on",attributes:{eventCode:t,handler:e,context:n}})),this._emitter.on(t,e,n)}},{key:"off",value:function(t,e){CC.getInstance().getAlert().checkSync(new vC({api:"off",attributes:{eventCode:t,handler:e}})),this._emitter.off(t,e)}},{key:"call",value:(S=l(a().mark((function t(e){var n,r,o,s,c,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".call.start"),{type:"api",text:{data:e}}),n=e.userID,r=e.type,t.next=4,CC.getInstance().getAlert().check(new vC({api:"call",attributes:e,initReady:this._initReady,callStatus:this.data.callStatus,capabilityCode:Dg.BASE,sdkAppID:this.data.config.sdkAppID}),{tim:this.tim});case 4:return t.prev=4,t.next=7,VC(r);case 7:t.next=13;break;case 9:return t.prev=9,t.t0=t.catch(4),this._logger.error("".concat(lb,".call.fail"),{text:{error:t.t0},type:"api"}),t.abrupt("return");case 13:if(this.getUserID()!==n){t.next=17;break}throw this._logger.error("".concat(lb,".call.fail"),{text:{error:"Called id can not be yourself. userId:".concat(this.getUserID(),", inviteeId:").concat(n)},type:"api"}),F_.log("".concat(lb,".call failed. Called id can't be yourself. userId:").concat(this.getUserID(),", inviteeId:").concat(n)),new Error("".concat(lb,".call failed. Called id can't be yourself. userId:").concat(this.getUserID(),", inviteeId:").concat(n));case 17:return this._callDataReport.setAbilityBit(!0),this._callDataReport.setCallScene(wg.SINGLE_CALL),o={callType:wg.SINGLE,mediaType:r,inviteeList:[n]},t.prev=20,s=e.roomID||Math.floor(2147483646*Math.random()+1),this.data.roomID=s,this.data.config.type=r,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=r,this.data.invitation.roomID=s,this.data.isInviter=!0,this.data.remoteID=n,this.changeCallStatus(sg.CALLING),t.next=32,this.TSignalingClient.invite(i(i({},e),{},{roomID:s}));case 32:if(c=t.sent,this.enterRoom({roomID:s,callType:r}),this._callDataReport.setEnterRoomTime((new Date).getTime()),l=i(i({},l=this._callDataReport.getCallData()),{},{userId:n,roomID:s,callRole:gg,callType:r,inviteeList:[n]}),this._callDataReport.setCallData(l),this._callDataReport.setSendSignalingTime((new Date).getTime()),F_.log("".concat(lb," call(userID: ").concat(n,", type: ").concat(r,") success, ").concat(c)),0!==c.code){t.next=51;break}this.data.invitation.inviteID=c.inviteID,this.addInviterInviteId(c.inviteID,[this.data.config.userID,n]),this.addUnHandledInviteeList([n]),this.addHandledInviteeList([this.getUserID()]),this._callDataReport.setInviteID(c.inviteID),this.setInitialCallId(c.inviteID),this._callRecordUpload(i({eventType:wg.START_CALL},o)),this._callRecordReport.startHeartbeat(),t.next=57;break;case 51:return this._callDataReport.setCodeAndMessage(c.code,c.message),this._callDataReport.uploadToKibana(),this._callRecordUpload(i({eventType:wg.CALL_FAILED},o)),this._logger.error("".concat(lb,".call.fail"),{text:{error:c},type:"api"}),t.next=57,this._resetTUICallEngine();case 57:return t.abrupt("return",{data:c.data,pusher:this.data.pusher});case 60:return t.prev=60,t.t1=t.catch(20),t.t1.code===Iy.ERROR_BLACKLIST?(this.TRTCCallingDelegate.onError(Iy.ERROR_BLACKLIST,t.t1.message),this._callDataReport.setCodeAndMessage(Iy.ERROR_BLACKLIST,t.t1.message)):this._callDataReport.setCodeAndMessage(Iy.UNKNOWN,JSON.stringify(t.t1)),this._callDataReport.uploadToKibana(),this._callRecordUpload(i({eventType:wg.CALL_FAILED},o)),this._logger.error("".concat(lb,".call.fail"),{text:{error:t.t1},type:"api"}),F_.error("".concat(lb," call(userID:").concat(n,",type:").concat(r,") failed', error: ").concat(t.t1)),t.next=69,this._resetTUICallEngine();case 69:throw new Error(t.t1);case 70:case"end":return t.stop()}}),t,this,[[4,9],[20,60]])}))),function(t){return S.apply(this,arguments)})},{key:"groupCall",value:(w=l(a().mark((function t(e){var n,r,o,s,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".groupCall.start"),{type:"api",text:{data:e}}),n=e.type,r=e.userIDList,t.next=4,CC.getInstance().getAlert().check(new vC({api:"groupCall",attributes:e,initReady:this._initReady,callStatus:this.data.callStatus,capabilityCode:Dg.PRO,sdkAppID:this.data.config.sdkAppID}),{tim:this.tim});case 4:return t.prev=4,t.next=7,VC(n);case 7:t.next=13;break;case 9:return t.prev=9,t.t0=t.catch(4),this._logger.error("".concat(lb,".groupCall.fail"),{type:"api",text:{error:t.t0}}),t.abrupt("return");case 13:if(-1===r.indexOf(this.getUserID())){t.next=16;break}throw this._logger.error("".concat(lb,".groupCall.fail"),{type:"api",text:{error:"Called list can not contain yourself"}}),new Error("".concat(lb,".groupCall failed. Called list can't contain yourself. userID:").concat(this.getUserID(),", inviteeIDList:").concat(r));case 16:return this._callDataReport.setCallScene(wg.GROUP_CALL),o=e.roomID||Math.floor(2147483646*Math.random()+1),this.enterRoom({roomID:o,callType:n}),s={callType:wg.GROUP,mediaType:n,inviteeList:e.userIDList},this.data.config.type=e.type,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=n,this.data.invitation.roomID=o,this.data.isInviter=!0,this.data.isGroupCall=!0,this.data.groupID=e.groupID,this.changeCallStatus(sg.CALLING),t.prev=28,t.next=31,this.TSignalingClient.inviteGroup(i(i({},e),{},{roomID:o}));case 31:return c=t.sent,this.data.config.type=e.type,this.data.invitation.inviteID=c.inviteID,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=n,this.data.invitation.roomID=o,this.data.isInviter=!0,this.data.isGroupCall=!0,this.data.groupID=e.groupID,this.data.roomID=o,this.addUnHandledInviteeList(e.userIDList),this.addHandledInviteeList([this.getUserID()]),this.addInviterInviteId(c.inviteID,[this.data.config.userID].concat(C(e.userIDList))),this.setInitialCallId(c.inviteID),this._callRecordUpload(i({eventType:wg.START_CALL},s)),this._callRecordReport.startHeartbeat(),F_.log(lb,"groupCall OK",c),t.abrupt("return",{data:c.data,pusher:this.data.pusher});case 51:return t.prev=51,t.t1=t.catch(28),this._logger.error("".concat(lb,".groupCall.fail"),{type:"api",text:{error:t.t1}}),F_.error(lb,"groupCall failed",t.t1),this._callRecordUpload(i({eventType:wg.CALL_FAILED},s)),t.next=58,this._resetTUICallEngine();case 58:throw new Error(t.t1);case 59:case"end":return t.stop()}}),t,this,[[4,9],[28,51]])}))),function(t){return w.apply(this,arguments)})},{key:"joinInGroupCall",value:(R=l(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".joinInGroupCall.start"),{text:{data:e},type:"api"}),n=e.roomID,r=e.type,i=e.groupID,t.next=4,CC.getInstance().getAlert().check(new vC({api:"joinInGroupCall",attributes:e,initReady:this._initReady,capabilityCode:Dg.PRO,sdkAppID:this.data.config.sdkAppID}),{tim:this.tim});case 4:return t.prev=4,t.next=7,VC(r);case 7:t.next=13;break;case 9:return t.prev=9,t.t0=t.catch(4),this._logger.error("".concat(lb,".joinInGroupCall.fail"),{text:{error:t.t0},type:"api"}),t.abrupt("return");case 13:return t.prev=13,this.data.config.type=r,this.data.invitation.type=r,F_.log("".concat(lb,".joinInGroupCall roomID:").concat(n,",type:").concat(r,",userID:").concat(this.getUserID())),this.changeCallStatus(sg.CALLING),this.addHandledInviteeList([this.getUserID()]),this.data.groupID=i,this.data.roomID=n,this.data.isGroupCall=!0,this.data.isInviter=!1,this.enterRoom({roomID:n,callType:r}),this.changeCallStatus(sg.CONNECTED),this.getCallRecordReport().setBodyStatus(sg.CONNECTED),o={eventType:wg.JOIN_IN_GROUP_CALL,callType:wg.GROUP,mediaType:this._callType},this._callRecordUpload(o),this._callRecordReport.startHeartbeat(),t.abrupt("return",this.data.pusher);case 32:return t.prev=32,t.t1=t.catch(13),this._logger.error("".concat(lb,".joinInGroupCall.fail"),{text:{error:t.t1},type:"api"}),t.next=37,this._resetTUICallEngine();case 37:throw new Error("".concat(lb,".joinInGroupCall failed error: ").concat(t.t1));case 38:case"end":return t.stop()}}),t,this,[[4,9],[13,32]])}))),function(t){return R.apply(this,arguments)})},{key:"inviteUser",value:(D=l(a().mark((function t(e){var n,r,i,o,s,c,l,u,h,f=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".inviteUser.start"),{text:{data:e},type:"api"}),t.next=3,CC.getInstance().getAlert().check(new vC({api:"inviteUser",attributes:e,initReady:this._initReady,capabilityCode:Dg.PRO,sdkAppID:this.data.config.sdkAppID}),{tim:this.tim});case 3:if(n=e.userIDList,r=void 0===n?[]:n,this.isGroupCall()){t.next=8;break}throw this._logger.error("".concat(lb,".inviteUser.fail"),{text:{error:"".concat(lb,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType)},type:"api"}),F_.error("".concat(lb,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType)),new Error("".concat(lb,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType));case 8:if(this.isInviter()||this.data.callStatus===sg.CONNECTED){t.next=12;break}throw this._logger.error("".concat(lb,".inviteUser.fail"),{text:{error:"".concat(lb,".inviteUser - current status:").concat(this.data.callStatus," not support")},type:"api"}),F_.error("".concat(lb,".inviteUser - current status:").concat(this.data.callStatus," not support")),new Error("".concat(lb,".inviteUser - current status:").concat(this.data.callStatus," not support"));case 12:if(0!==r.length){t.next=16;break}throw this._logger.error("".concat(lb,".inviteUser.fail"),{text:{error:"userIDList is empty"},type:"api"}),F_.error("".concat(lb,".inviteUser - userIDList is empty")),new Error("".concat(lb,".inviteUser - userIDList is empty"));case 16:if(i=this.getHandledInviteeList(),o=this.getUnHandledInviteeList(),s=[].concat(C(i),C(o)),0!==(c=r.filter((function(t){return-1===s.indexOf(t)}))).length){t.next=24;break}return this._logger.error("".concat(lb,".inviteUser.fail"),{text:{data:{userIDList:r},error:"userIDList in call list"},type:"api"}),F_.error("".concat(lb,".inviteUser failed - userIDList in call list. userIDList:").concat(JSON.stringify(r))),t.abrupt("return",Promise.reject("".concat(lb,".inviteUser failed - userIDList in call list. userIDList:").concat(JSON.stringify(r))));case 24:return r=c,t.prev=25,l=this.data.handledInviteeList.filter((function(t){return t!==f.getUserID()})),t.next=29,this.TSignalingClient.inviteGroup({groupID:this.data.groupID,userIDList:r,type:this.data.invitation.type,roomID:this.data.roomID,timeout:this.data.callTimeout,inCallUserIDs:[].concat(C(this.data.unHandledInviteeList),C(l)),initialCallId:this.getInitialCallId()});case 29:if(u=t.sent,F_.log("inviteUser res",u),0!==u.code){t.next=38;break}return this.addUnHandledInviteeList(r),this.addInviterInviteId(u.inviteID,[this.data.config.userID].concat(C(r))),h={eventType:wg.INVITE_USER,callType:wg.GROUP,mediaType:this._callType,inviteeList:r},this._callRecordUpload(h),this._callRecordReport.startHeartbeat(),t.abrupt("return",u);case 38:t.next=44;break;case 40:throw t.prev=40,t.t0=t.catch(25),this._logger.error("".concat(lb,".inviteUser.fail"),{text:{error:t.t0},type:"api"}),new Error("".concat(lb,".inviteUser failed, userId:").concat(this.getUserID(),", inviteeIdList:").concat(r,", error: ").concat(t.t0));case 44:case"end":return t.stop()}}),t,this,[[25,40]])}))),function(t){return D.apply(this,arguments)})},{key:"accept",value:(b=l(a().mark((function t(){var e=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".accept.start"),{type:"api"}),t.next=3,CC.getInstance().getAlert().check(new vC({api:"accept",initReady:this._initReady,callStatus:this.data.callStatus,sdkAppID:this.data.config.sdkAppID}));case 3:return t.prev=3,t.next=6,VC(this.data.config.type);case 6:t.next=12;break;case 8:return t.prev=8,t.t0=t.catch(3),this._logger.error("".concat(lb,".accept.fail"),{text:{error:t.t0},type:"api"}),t.abrupt("return");case 12:return t.abrupt("return",new Promise((function(t,n){if(F_.log(lb,"accept() inviteID: ",e.data.invitation.inviteID),e.data.config.type!==pg.VIDEO||e.data.isGroupCall)e.handleAccept(t,n);else if(e.data.devicePermission){wx.createLivePusherContext().stopPreview();var r=setTimeout(l(a().mark((function i(){return a().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:clearTimeout(r),e.handleAccept(t,n);case 2:case"end":return i.stop()}}),i)}))),0)}else e.handleAccept(t,n)})));case 13:case"end":return t.stop()}}),t,this,[[3,8]])}))),function(){return b.apply(this,arguments)})},{key:"handleAccept",value:(T=l(a().mark((function t(e,n){var r,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".handleAccept.start"),{type:"api"}),this._callDataReport.setEnterRoomTime((new Date).getTime()),this.enterRoom({roomID:this.data.invitation.roomID,callType:this.data.config.type}),r=this.data.invitation.inviteID,t.next=6,this.TSignalingClient.accept({inviteID:r,type:this.data.config.type});case 6:0===(i=t.sent).code?(F_.log(lb,"accept OK"),this.addHandledInviteeList([this.getUserID()]),this.deleteUnHandledInviteeList([this.getUserID()]),this.addAcceptedUserList(r,[this.getUserID()]),this._callRecordUpload({eventType:wg.ACCEPT_CALL}),e({message:i.data.message,pusher:this.data.pusher}),this.changeCallStatus(sg.CONNECTED),this.getCallRecordReport().setBodyStatus(sg.CONNECTED)):(this.isGroupCall()&&(this._callDataReport.setCodeAndMessage(Iy.NOT_MEDIA_ACCESS,JSON.stringify(i.data.message)),this._callDataReport.uploadToKibana()),this._logger.error("".concat(lb,".accept.fail"),{text:{error:i},type:"api"}),F_.error(lb,"accept failed",i),n(i),this._resetTUICallEngine());case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return T.apply(this,arguments)})},{key:"reject",value:(_=l(a().mark((function t(){var e,n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".reject.start"),{text:{data:{invitation:this.data.invitation,type:this.data.config.type}},type:"api"}),t.next=3,CC.getInstance().getAlert().checkSync(new vC({api:"reject",callStatus:this.data.callStatus,initReady:this._initReady}));case 3:if(!this.data.invitation.inviteID){t.next=14;break}return t.next=6,this.TSignalingClient.reject({inviteID:this.data.invitation.inviteID,type:this.data.config.type});case 6:return e=t.sent,F_.log(lb,"reject OK",e),n=this.generateEventData(),this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:this.getUserID(),userID:this.getUserID()},n),{},{reason:wg.REJECT})),this._callRecordUpload({eventType:wg.REJECT_CALL}),t.next=13,this._resetTUICallEngine();case 13:return t.abrupt("return",e);case 14:return this._logger.error("".concat(lb,".reject.fail"),{text:{error:"未收到邀请,无法拒绝"},type:"api"}),F_.warn("".concat(lb," 未收到邀请,无法拒绝")),t.abrupt("return","未收到邀请,无法拒绝");case 17:case"end":return t.stop()}}),t,this)}))),function(){return _.apply(this,arguments)})},{key:"hangup",value:(E=l(a().mark((function t(){var e,n,r,o,s,c,l,u,h,f,d,p,v,g,y,I,m,E,_=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".hangup.start"),{text:{data:{isGroupCall:this.isGroupCall(),isInviter:this.isInviter(),currentUserID:this.getUserID(),totalTime:this.generateCallTotalTime(),callType:this.getCallType()}},type:"api"}),t.next=3,CC.getInstance().getAlert().checkSync(new vC({api:"hangup",callStatus:this.data.callStatus,initReady:this._initReady}));case 3:if(F_.warn("".concat(lb,". - callStatus:").concat(this.data.callStatus," _inviterInviteID:").concat(JSON.stringify(this.data.invitation))),this.data.callStatus!==sg.IDLE){t.next=7;break}throw this._logger.error("".concat(lb,".hangup.fail"),{text:{data:{currentStatus:this.data.callStatus},error:"hangup failed. current status:"},type:"api"}),new Error("".concat(lb,".hangup failed. current status:").concat(this.data.callStatus));case 7:if(this.data.callStatus!==sg.CALLING||0!==this.getInviterInviteIdList().length){t.next=10;break}throw this._logger.error("".concat(lb,".hangup.fail"),{text:{error:"call/groupCall incomplete。please wait cancel"},type:"api"}),new Error("".concat(lb,".call/groupCall incomplete。please wait cancel"));case 10:if(e=this.isGroupCall(),n=this.isInviter(),r=this.getUserID(),o=this.generateCallTotalTime(),s=this.getCallType(),l=this.getInviterInviteIdList(),this.data.callStatus!==sg.CONNECTED){t.next=31;break}if(t.prev=17,0!==l.length){t.next=23;break}return u=this.generateCallEndData({callMediaType:s,totalTime:o}),this.TRTCCallingDelegate.onCallEnd(u),t.next=23,this._resetTUICallEngine();case 23:t.next=31;break;case 25:return t.prev=25,t.t0=t.catch(17),this._logger.error("".concat(lb,".hangup.fail"),{text:{error:t.t0},type:"api"}),t.next=30,this._resetTUICallEngine();case 30:throw new Error(t.t0);case 31:if(h=this.getHandledInviteeList(),f=this.getUnHandledInviteeList(),d=this.generateEventData(),t.prev=34,e){t.next=53;break}if(p=this.generateCallEndData(),!n){t.next=48;break}if(1!==f.length){t.next=45;break}return t.next=41,this.cancel();case 41:c=t.sent,this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:r,userID:r},d),{},{reason:wg.NORMAL})),t.next=46;break;case 45:this.TRTCCallingDelegate.onCallEnd(p);case 46:t.next=49;break;case 48:this.TRTCCallingDelegate.onCallEnd(p);case 49:return t.next=51,this._resetTUICallEngine();case 51:t.next=82;break;case 53:if(v=this.getCallStatus(),g={callType:this.getCallType(),isGroupCall:this.isGroupCall(),groupID:this.data.groupID,userIDList:[].concat(C(h.filter((function(t){return t!==r}))),C(f)),callEnd:this.generateCallTotalTime()},!n){t.next=73;break}if(v!==sg.CALLING){t.next=63;break}return t.next=59,this.cancel(this.getInviterInviteIdList());case 59:return c=t.sent,this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:r,userID:r},d),{},{reason:wg.NORMAL})),t.next=63,this._resetTUICallEngine();case 63:if(v!==sg.CONNECTED){t.next=71;break}y=a().mark((function t(){var e,n,i,o,s,u,d;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=l[I],n=_.getInviterInviteIdUserList(e),!((i=_.getAcceptedUserList(e)).length>0)){t.next=22;break}if(o=i.filter((function(t){return-1!==h.indexOf(t)})),s=n.filter((function(t){return-1!==f.indexOf(t)})),g.userIDList=[].concat(C(o),C(s)).filter((function(t){return t!==r})),F_.warn("inviter emit hangup signal, notify userIDList:".concat(JSON.stringify(g.userIDList))),0===g.userIDList.length){t.next=13;break}return t.next=10,_.TSignalingClient.hangup(g);case 10:c=t.sent,t.next=18;break;case 13:if(!(h.length>1)){t.next=18;break}return g.userIDList=h.filter((function(t){return t!==r})),t.next=17,_.TSignalingClient.hangup(g);case 17:c=t.sent;case 18:u=_.generateCallEndData(),_.TRTCCallingDelegate.onCallEnd(u),t.next=29;break;case 22:if(d=_.getUnHandledInviteeList(),!(n.filter((function(t){return-1!==d.indexOf(t)})).length>0)){t.next=29;break}return F_.warn("inviter emit cancel signal, userIdList:".concat(n)),t.next=28,_.cancel([e]);case 28:c=t.sent;case 29:case"end":return t.stop()}}),t)})),I=0;case 66:if(!(I<l.length)){t.next=71;break}return t.delegateYield(y(),"t1",68);case 68:I++,t.next=66;break;case 71:t.next=80;break;case 73:m=a().mark((function t(){var e,n,i,o,s,u,d;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=l[E],n=_.getInviterInviteIdUserList(e),!((i=_.getAcceptedUserList(e)).length>0)){t.next=22;break}if(o=i.filter((function(t){return-1!==h.indexOf(t)})),s=n.filter((function(t){return-1!==f.indexOf(t)})),g.userIDList=[].concat(C(o),C(s)).filter((function(t){return t!==r})),F_.warn("invitee emit hangup signal, notify userIDList:".concat(JSON.stringify(g.userIDList))),0===g.userIDList.length){t.next=13;break}return t.next=10,_.TSignalingClient.hangup(g);case 10:c=t.sent,t.next=18;break;case 13:if(!(h.length>1)){t.next=18;break}return g.userIDList=h.filter((function(t){return t!==r})),t.next=17,_.TSignalingClient.hangup(g);case 17:c=t.sent;case 18:u=_.generateCallEndData(),_.TRTCCallingDelegate.onCallEnd(u),t.next=29;break;case 22:if(d=_.getUnHandledInviteeList(),!(n.filter((function(t){return-1!==d.indexOf(t)})).length>0)){t.next=29;break}return F_.warn("invitee emit cancel signal, inviteID:".concat(e)),t.next=28,_.cancel([e]);case 28:c=t.sent;case 29:case"end":return t.stop()}}),t)})),E=0;case 75:if(!(E<l.length)){t.next=80;break}return t.delegateYield(m(),"t2",77);case 77:E++,t.next=75;break;case 80:return t.next=82,this._resetTUICallEngine();case 82:return t.abrupt("return",c);case 85:throw t.prev=85,t.t3=t.catch(34),this._logger.error("".concat(lb,".hangup.fail"),{text:{error:t.t3},type:"api"}),F_.warn("".concat(lb,".hangup failed, error: ").concat(t.t3)),new Error("".concat(lb,".hangup failed, error: ").concat(t.t3));case 90:case"end":return t.stop()}}),t,this,[[17,25],[34,85]])}))),function(){return E.apply(this,arguments)})},{key:"cancel",value:(m=l(a().mark((function t(e){var n,r,i,o,s;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._logger.info("".concat(lb,".cancel.start"),{text:{data:{inviteIDList:e}},type:"api"}),F_.log("_cancel _inviterInviteID",this.data_inviterInviteID),n=[],t.prev=3,0===(e||[]).length&&(e=this.getInviterInviteIdList().slice(0,1)),r=0;case 6:if(!(r<e.length)){t.next=15;break}return i=e[r],t.next=10,this.TSignalingClient.cancel({inviteID:i,callType:this.data.invitation.type});case 10:o=t.sent,n.push(o);case 12:r++,t.next=6;break;case 15:t.next=21;break;case 17:throw t.prev=17,t.t0=t.catch(3),this._logger.error("".concat(lb,".cancel.fail"),{text:{error:t.t0},type:"api"}),new Error("".concat(lb,"._cancel failed, error: ").concat(t.t0));case 21:return s="cancel ".concat(JSON.stringify(n)," succeeded"),F_.log("".concat(lb,"._cancel ").concat(s)),t.abrupt("return",n);case 24:case"end":return t.stop()}}),t,this,[[3,17]])}))),function(t){return m.apply(this,arguments)})},{key:"getRoomID",value:function(){return this.data.invitation.roomID}},{key:"getCallType",value:function(){return this.data.invitation.type}},{key:"isGroupCall",value:function(){return this.data.isGroupCall}},{key:"getUserID",value:function(){return this.data.config.userID}},{key:"getGroupID",value:function(){return this.data.groupID}},{key:"isInviter",value:function(){return this.data.isInviter}},{key:"getHandledInviteeList",value:function(){return this.data.handledInviteeList||[]}},{key:"getCallDataReport",value:function(){return this._callDataReport}},{key:"getCallRecordReport",value:function(){return this._callRecordReport}},{key:"getUnHandledInviteeList",value:function(){return this.data.unHandledInviteeList||[]}},{key:"getCallStatus",value:function(){return this.data.callStatus}},{key:"getInviterInviteID",value:function(t){return this.data._inviterInviteID[t]||[]}},{key:"addAcceptedUserList",value:function(t,e){var n=this;if(0!==e.length)if(t)0===(this.data._acceptedUserObject[t]||[]).length?this.data._acceptedUserObject[t]=e:e.forEach((function(e){-1===n.data._acceptedUserObject[t].indexOf(e)&&n.data._acceptedUserObject[t].push(e)}));else for(var r=this.getInviterInviteIdList(),i=function(){var t=r[a],i=n.getInviterInviteIdUserList(t),o=e.filter((function(t){return-1!==i.indexOf(t)}));0===(n._acceptedUserObject[t]||[]).length?n.data._acceptedUserObject[t]=o:o.forEach((function(e){-1===n.data._acceptedUserObject[t].indexOf(e)&&n.data._acceptedUserObject[t].push(e)}))},a=0;a<r.length;a++)i()}},{key:"getAcceptedUserList",value:function(t){return this.data._acceptedUserObject[t]||[]}},{key:"getInviterInviteIdList",value:function(){return Object.keys(this.data._inviterInviteID||{})}},{key:"getTotalInviterInviteIdList",value:function(){var t=this.getInviterInviteIdList();return[].concat(C(this.data._audioVideoSwitchIdList),C(t))}},{key:"getInviterInviteIdUserList",value:function(t){var e=this,n=[];return t?n=this.data._inviterInviteID[t]||[]:this.getInviterInviteIdList().forEach((function(t){n=[].concat(C(n),C(e.getInviterInviteIdUserList(t)))})),n}},{key:"addAudioVideoSwitchIdList",value:function(t){t&&this.data._audioVideoSwitchIdList.push(t)}},{key:"getAudioVideoSwitchIdList",value:function(){return this.data._audioVideoSwitchIdList||[]}},{key:"addUnHandledInviteeList",value:function(t){var e=this;0!==t.length&&(t.forEach((function(t){-1===e.data.unHandledInviteeList.indexOf(t)&&e.data.unHandledInviteeList.push(t)})),this.data.unHandledInviteeList=Array.from(new Set(this.data.unHandledInviteeList)))}},{key:"deleteUnHandledInviteeList",value:function(t){var e=this;0!==t.length&&t.forEach((function(t){e.data.unHandledInviteeList=e.data.unHandledInviteeList.filter((function(e){return e!==t}))}))}},{key:"addHandledInviteeList",value:function(t){var e=this;0!==t.length&&(t.forEach((function(t){-1===e.data.handledInviteeList.indexOf(t)&&e.data.handledInviteeList.push(t)})),this.data.handledInviteeList=Array.from(new Set(this.data.handledInviteeList)))}},{key:"deleteHandledInviteeList",value:function(t){var e=this;0!==t.length&&t.forEach((function(t){e.data.handledInviteeList=e.data.handledInviteeList.filter((function(e){return e!==t}))}))}},{key:"getSwitchCallModeStatus",value:function(){return this.data.switchCallModeStatus}},{key:"changeCallStatus",value:function(t){var e=this;switch(this._logger.info("".concat(lb,".changeCallStatus.start"),{text:{data:{status:t}},type:"api"}),F_.log("进入callStatus",t),this.data.callStatus=t,t){case sg.CONNECTED:if(this.data.timer)return;this.data.timer=setInterval((function(){var t,n,r,i,a,o;e.data.chatTime=(t=e.data.chatTimeNum,(o=t)>=3600?(r=parseInt(o/3600)<10?"0".concat(parseInt(o/3600)):parseInt(o/3600),i=parseInt(o%60/60)<10?"0".concat(parseInt(o%60/60)):parseInt(o%60/60),(a=o%3600<10?"0".concat(o%3600):o%3600)>60&&(i=parseInt(a/60)<10?"0".concat(parseInt(a/60)):parseInt(a/60),a=a%60<10?"0".concat(a%60):a%60),n="".concat(r,":").concat(i,":").concat(a)):o>=60&&o<3600?(i=parseInt(o/60)<10?"0".concat(parseInt(o/60)):parseInt(o/60),a=o%60<10?"0".concat(o%60):o%60,n="00:".concat(i,":").concat(a)):o<60&&(a=o<10?"0".concat(o):o,n="00:00:".concat(a)),n),e.data.chatTimeNum+=1,e.data.pusher.chatTime=e.data.chatTime,e.data.pusher.chatTimeNum=e.data.chatTimeNum,e.TRTCCallingDelegate.onUserUpdate({pusher:e.data.pusher,playerList:e.data.playerList})}),1e3);break;case sg.IDLE:clearInterval(this.data.timer),this.data.timer=null,this.data.chatTime="00:00:00",this.data.chatTimeNum=0}}},{key:"_resetTUICallEngine",value:(I=l(a().mark((function t(e,n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,"._resetTUICallEngine.start"),{text:{data:{callEnd:e,type:n}},type:"api"}),this.changeCallStatus(sg.IDLE),F_.log(lb," _resetTUICallEngine()",this.data.enterRoomStatus),!this.data.enterRoomStatus){t.next=6;break}return t.next=6,this.exitRoom(e,n);case 6:this.data.config.type=pg.AUDIO,this._initialCallId="",this.initData();case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return I.apply(this,arguments)})},{key:"startRemoteView",value:(y=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._logger.info("".concat(lb,".startRemoteView.start"),{text:{data:{userID:e}},type:"api"}),this.data.playerList.forEach((function(t){if(t.userID===e)return t.muteVideo=!1,void F_.log("".concat(lb,", startRemoteView(").concat(e,")"))}));case 2:case"end":return t.stop()}}),t,this)}))),function(t){return y.apply(this,arguments)})},{key:"stopRemoteView",value:function(t){this._logger.info("".concat(lb,".stopRemoteView.start"),{text:{data:{userID:t}},type:"api"}),this.data.playerList.forEach((function(e){if(e.userID===t)return e.muteVideo=!0,void F_.log("".concat(lb,", stopRemoteView(").concat(t,")"))}))}},{key:"openCamera",value:function(){this._logger.info("".concat(lb,".openCamera.start"),{text:{data:{enableCamera:this.data.pusher.enableCamera}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"openCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableCamera||this._pusherVideoHandler(),F_.log("".concat(lb,", openCamera() pusher: ").concat(this.data.pusher))}},{key:"closeCamera",value:function(){this._logger.info("".concat(lb,".closeCamera.start"),{text:{data:{enableCamera:this.data.pusher.enableCamera}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"closeCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableCamera&&this._pusherVideoHandler(),F_.log("".concat(lb,", closeCamera() pusher: ").concat(this.data.pusher))}},{key:"switchCamera",value:function(){this._logger.info("".concat(lb,".switchCamera.start"),{text:{data:{frontCamera:this.data.pusher.frontCamera}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"switchCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.getCurrentPusherInstance().switchCamera(),F_.log("".concat(lb,", switchCamera(), frontCamera").concat(this.data.pusher.frontCamera))}},{key:"openMicrophone",value:function(){this._logger.info("".concat(lb,".openMicrophone.start"),{text:{data:{enableMic:this.data.pusher.enableMic}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"openMicrophone",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableMic||this._pusherAudioHandler(),F_.log("".concat(lb,", openMicrophone() pusher: ").concat(this.data.pusher))}},{key:"closeMicrophone",value:function(){this._logger.info("".concat(lb,".closeMicrophone.start"),{text:{data:{enableMic:this.data.pusher.enableMic}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"closeMicrophone",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableMic&&this._pusherAudioHandler(),F_.log("".concat(lb,", closeMicrophone() pusher: ").concat(this.data.pusher))}},{key:"selectAudioPlaybackDevice",value:function(t){this._logger.info("".concat(lb,".selectAudioPlaybackDevice.start"),{text:{data:{type:t}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"selectAudioPlaybackDevice",callStatus:this.data.callStatus,attributes:{type:t},initReady:this._initReady}));var e=!1;switch(t){case"speaker":e=!0;break;case"ear":e=!1}return this.setHandsFree(e)}},{key:"setHandsFree",value:function(t){return this.data.soundMode=t?"speaker":"ear",F_.log("".concat(lb,", setHandsFree() result: ").concat(this.data.soundMode)),this.data.soundMode}},{key:"switchAudioCall",value:(g=l(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,".switchAudioCall.start"),{type:"api"}),!this.isGroupCall()){t.next=5;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"switchToAudioCall is not applicable to groupCall"},type:"api"}),F_.warn("".concat(lb,".switchToAudioCall is not applicable to groupCall.")),t.abrupt("return");case 5:if(this.data.invitation.type!==pg.AUDIO){t.next=9;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"the call mode is audio call"},type:"api"}),F_.warn("".concat(lb," Now the call mode is audio call.")),t.abrupt("return");case 9:if(this.data.switchCallModeStatus){t.next=13;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"audio and video call switching"},type:"api"}),F_.warn("".concat(lb," audio and video call switching.")),t.abrupt("return");case 13:return this.setSwitchCallModeStatus(!1),this.setPusherAttributesHandler({enableCamera:!1}),t.abrupt("return",this.TSignalingClient.switchCallMode({userID:this.data.unHandledInviteeList[0]||this.data.playerList[0].userID,callType:this.data.invitation.type,roomID:this.data.invitation.roomID,mode:Tg}));case 16:case"end":return t.stop()}}),t,this)}))),function(){return g.apply(this,arguments)})},{key:"switchCallMediaType",value:(v=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".closeMicrophone.start"),{text:{data:{type:e}},type:"api"}),t.next=3,CC.getInstance().getAlert().check(new vC({api:"switchCallMediaType",attributes:{type:e},callStatus:this.data.callStatus,initReady:this._initReady,sdkAppID:this.data.config.sdkAppID}));case 3:if(!this.isGroupCall()){t.next=7;break}throw this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"switchToAudioCall is not applicable to groupCall"},type:"api"}),F_.error("".concat(lb,".switchToAudioCall is not applicable to groupCall.")),new hC(Iy.ERROR_SCENE_NOT_SUPPORTED,"".concat(lb,".switchToAudioCall is not applicable to groupCall."));case 7:if(this.data.switchCallModeStatus){t.next=11;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"audio and video call switching"},type:"api"}),F_.warn("".concat(lb," audio and video call switching.")),t.abrupt("return");case 11:t.t0=e,t.next=t.t0===pg.AUDIO?14:t.t0===pg.VIDEO?17:20;break;case 14:return this.setSwitchCallModeStatus(!1),this.setPusherAttributesHandler({enableCamera:!1}),t.abrupt("return",this.TSignalingClient.switchCallMode({userID:this.data.unHandledInviteeList[0]||this.data.playerList[0].userID,callType:this.data.invitation.type,roomID:this.data.invitation.roomID,mode:Tg}));case 17:throw this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"Audio switching Video is not supported yet"},type:"api"}),F_.warn("".concat(lb," Audio switching Video is not supported yet")),new Error("".concat(lb," Audio switching Video is not supported yet"));case 20:case"end":return t.stop()}}),t,this)}))),function(t){return v.apply(this,arguments)})},{key:"setSwitchCallModeStatus",value:function(t){this.data.switchCallModeStatus=t}},{key:"switchVideoCall",value:(p=l(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,".switchVideoCall.start"),{type:"api"}),!this.isGroupCall()){t.next=5;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"switchToAudioCall is not applicable to groupCall"},type:"api"}),F_.warn("".concat(lb,".switchToVideoCall is not applicable to groupCall.")),t.abrupt("return");case 5:if(this.data.invitation.type!==pg.VIDEO){t.next=9;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"Now the call mode is video call"},type:"api"}),F_.warn("".concat(lb," Now the call mode is video call.")),t.abrupt("return");case 9:if(this.data.switchCallModeStatus){t.next=13;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"audio and video call switching"},type:"api"}),F_.warn("".concat(lb," audio and video call switching.")),t.abrupt("return");case 13:return this.setSwitchCallModeStatus(!1),this.setPusherAttributesHandler({enableCamera:!0}),t.abrupt("return",this.TSignalingClient.switchCallMode({userID:this.data.playerList[0].userID,callType:this.data.invitation.type,roomID:this.data.invitation.roomID,mode:Cg}));case 16:case"end":return t.stop()}}),t,this)}))),function(){return p.apply(this,arguments)})},{key:"setSoundMode",value:function(t){var e=!1,n=!1;switch(t||(n=!0,t=this.data.soundMode),t){case"speaker":e=!0;break;case"ear":e=!1}return this.setHandsFree(n?!e:e)}},{key:"_hangUp",value:function(){this.hangup()}},{key:"getCurrentPusherInstance",value:function(){return this.TRTC.getPusherInstance().context=wx.createLivePusherContext(),this.TRTC.getPusherInstance()}},{key:"_pusherStateChangeHandler",value:function(t){this.TRTC.pusherEventHandler(t)}},{key:"_playerStateChange",value:function(t){this._emitter.emit(og.REMOTE_STATE_UPDATE,t)}},{key:"_playerAudioVolumeNotify",value:function(t){this.data.playerList.length>0&&this.TRTC.playerAudioVolumeNotify(t)}},{key:"_pusherAudioVolumeNotify",value:function(t){this.TRTC.pusherAudioVolumeNotify(t)}},{key:"_updateUserProfile",value:function(t,e){return 0===e.length||0===t.length?e:e.map((function(e){var n=e,r=t.filter((function(t){return t.userID===e.userID}));return n.avatar=r[0]&&r[0].avatar?r[0].avatar:"",n.nick=r[0]&&r[0].nick?r[0].nick:"",n}))}},{key:"_getUserProfile",value:function(t){var e=this;this.tim.getUserProfile({userIDList:t}).then((function(t){F_.log("getUserProfile success",t),F_.log(t.data),e.data.remoteUsers=t.data})).catch((function(t){F_.warn("getUserProfile error:",t)}))}},{key:"getUserProfile",value:(h=l(a().mark((function t(e){var n,r,i,o,s=arguments;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=s.length>1&&void 0!==s[1]?s[1]:"array",0!==e.length){t.next=3;break}return t.abrupt("return",[]);case 3:return r=e.map((function(t){return t.userID})),t.next=6,this.tim.getUserProfile({userIDList:r});case 6:i=t.sent,o=null,t.t0=n,t.next="array"===t.t0?11:"map"===t.t0?13:16;break;case 11:return o=e.map((function(t,e){return t.avatar=i.data[e].avatar,t.nick=i.data[e].nick,t})),t.abrupt("break",16);case 13:return o={},e.forEach((function(t,e){t.avatar=i.data[e].avatar,t.nick=i.data[e].nick,o[t.userID]=t})),t.abrupt("break",16);case 16:return t.abrupt("return",o);case 17:case"end":return t.stop()}}),t,this)}))),function(t){return h.apply(this,arguments)})},{key:"setSelfInfo",value:function(t,e){return this._logger.info("".concat(lb,".setSelfInfo.start"),{text:{data:{nickName:t,avatar:e}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"setSelfInfo",attributes:{nickName:t,avatar:e},initReady:this._initReady})),this.tim.updateMyProfile({nick:t,avatar:e})}},{key:"deviceCheck",value:(c=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",N_(e));case 1:case"end":return t.stop()}}),t)}))),function(t){return c.apply(this,arguments)})},{key:"_pusherNetStatus",value:function(t){this.TRTC.pusherNetStatusHandler(t)}},{key:"_playNetStatus",value:function(t){this.TRTC.playerNetStatus(t)}},{key:"_toggleViewSize",value:function(t){var e=t.currentTarget.dataset.screen;return F_.log("get screen",e,t),1===this.data.playerList.length&&e!==this.data.screen&&this.data.invitation.type===pg.VIDEO&&(this.data.screen=e),this.data.screen}},{key:"getTim",value:function(){return this.tim}},{key:"destroyed",value:(s=l(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,".destroyed.start"),{type:"api"}),this.getCallStatus()===sg.IDLE){t.next=4;break}return t.next=4,this.handleExceptionExit();case 4:if(this._resetTUICallEngine(),this._removeTSignalingEvent(),this._removeTRTCEvent(),this._timExternal){t.next=10;break}return t.next=10,this.logout();case 10:this._initReady=!1;case 11:case"end":return t.stop()}}),t,this)}))),function(){return s.apply(this,arguments)})},{key:"handleExceptionExit",value:(o=l(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,".handleExceptionExit.start"),{text:{data:{callStatus:this.getCallStatus()}},type:"api"}),t.prev=1,this.getCallStatus()!==sg.CALLING){t.next=10;break}if(!this.isInviter()){t.next=8;break}return t.next=6,this.hangup();case 6:t.next=10;break;case 8:return t.next=10,this.reject();case 10:if(this.getCallStatus()!==sg.CONNECTED){t.next=13;break}return t.next=13,this.hangup();case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(1),this._logger.error("".concat(lb,".handleExceptionExit.fail"),{text:{data:{error:t.t0}},type:"api"});case 18:case"end":return t.stop()}}),t,this,[[1,15]])}))),function(){return o.apply(this,arguments)})},{key:"_callRecordUpload",value:function(t){var e=i(i({},t),{},{callRole:this.isInviter()?wg.INVITER:wg.INVITEE,userID:this.getUserID(),roomID:this.getRoomID(),inviteID:this.getInitialCallId()});this._callRecordReport.eventUpload(e)}},{key:"generateCallEndData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.roomId,n=t.callMediaType,r=t.callRole,i=t.totalTime,a=t.userId;return e=e||this.getRoomID(),n=n||this.getCallType(),r||(r=this.isInviter()?gg:yg),{roomID:e,callMediaType:n,callRole:r,totalTime:i=S_(i)?this.generateCallTotalTime():i,userID:a=a||this.getUserID(),callEnd:i,message:t.message||""}}},{key:"generateEventData",value:function(){return{callID:this.getInviterInviteIdList()[0],roomID:this.getRoomID(),callRole:this.isInviter()?wg.INVITER:wg.INVITEE,callMediaType:this.getCallType()}}},{key:"setInitialCallId",value:function(t){this._initialCallId=t}},{key:"getInitialCallId",value:function(){return this._initialCallId}},{key:"getConnectStartTime",value:function(){return this.data.startTalkTime}},{key:"generateCallTotalTime",value:function(){return 0===this.getConnectStartTime()?0:Math.round((Date.now()-this.getConnectStartTime())/1e3)}}],[{key:"createInstance",value:function(t){return ub.updateEsConfig({url:"".concat("https://webim.tim.qq.com/v4/imopenstat/tweb_trtccalling_report","?sdkappid=").concat(null==t?void 0:t.sdkAppID),table:"timweb-trtccalling"}),CC.getInstance().getAlert().checkSync(new vC({api:"createInstance",attributes:t})),r.instance||(r.instance=new r(t)),r.instance.initData(),r.instance}}]),r}();d(hb,"instance",null),d(hb,"AUDIO_PLAYBACK_DEVICE",bg),d(hb,"MEDIA_TYPE",pg),d(hb,"EVENT",og),d(hb,"STATUS",sg);export{bg as AUDIO_PLAYBACK_DEVICE,og as EVENT,pg as MEDIA_TYPE,sg as STATUS,hb as TUICallEngine,hb as default};
|