@ylink-sdk/meeting 0.2.0-beta.11 → 0.2.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/meeting.cjs.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(t){n(t)}}function a(e){try{c(s.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))}function t(e){return{all:e=e||new Map,on:function(t,r){var s=e.get(t);s?s.push(r):e.set(t,[r])},off:function(t,r){var s=e.get(t);s&&(r?s.splice(s.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var s=e.get(t);s&&s.slice().map((function(e){e(r)})),(s=e.get("*"))&&s.slice().map((function(e){e(t,r)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(e,t){var s="__lodash_hash_undefined__",i=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",f="[object Promise]",h="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",x="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",w="[object Uint32Array]",A=/\w*$/,S=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[y]=U[b]=U[o]=U[a]=U[E]=U[q]=U[I]=U[D]=U[T]=U[d]=U[l]=U[p]=U[h]=U[m]=U[g]=U[v]=U[O]=U[$]=U[_]=U[w]=!0,U["[object Error]"]=U[c]=U[x]=!1;var j="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof r&&r&&r.Object===Object&&r||j||Function("return this")(),C=t&&!t.nodeType&&t,R=C&&e&&!e.nodeType&&e,k=R&&R.exports===C;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,r,s){var i=-1,n=e?e.length:0;for(s&&n&&(r=e[++i]);++i<n;)r=t(r,e[i],i,e);return r}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function B(e){var t=-1,r=Array(e.size);return e.forEach((function(e,s){r[++t]=[s,e]})),r}function G(e,t){return function(r){return e(t(r))}}function Y(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var Q,W=Array.prototype,F=Function.prototype,X=Object.prototype,z=N["__core-js_shared__"],J=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=F.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=k?N.Buffer:void 0,se=N.Symbol,ie=N.Uint8Array,ne=G(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=W.splice,ue=Object.getOwnPropertySymbols,de=re?re.isBuffer:void 0,le=G(Object.keys,Object),pe=Re(N,"DataView"),fe=Re(N,"Map"),he=Re(N,"Promise"),me=Re(N,"Set"),ge=Re(N,"WeakMap"),ve=Re(Object,"create"),xe=Ve(pe),ye=Ve(fe),be=Ve(he),Ee=Ve(me),qe=Ve(ge),Ie=se?se.prototype:void 0,De=Ie?Ie.valueOf:void 0;function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function $e(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function _e(e){this.__data__=new Oe(e)}function we(e,t){var r=Ge(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var r=-1,s=Array(e);++r<e;)s[r]=t(r);return s}(e.length,String):[],s=r.length,i=!!s;for(var o in e)!t&&!Z.call(e,o)||i&&("length"==o||Me(o,s))||r.push(o);return r}function Ae(e,t,r){var s=e[t];Z.call(e,t)&&Be(s,r)&&(void 0!==r||t in e)||(e[t]=r)}function Se(e,t){for(var r=e.length;r--;)if(Be(e[r][0],t))return r;return-1}function Pe(e,t,r,s,i,f,x){var S;if(s&&(S=f?s(e,i,f,x):s(e)),void 0!==S)return S;if(!Fe(e))return e;var P=Ge(e);if(P){if(S=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,s=e.length;t||(t=Array(s));for(;++r<s;)t[r]=e[r];return t}(e,S)}else{var j=Le(e),N=j==c||j==u;if(Qe(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(j==p||j==n||N&&!f){if(V(e))return f?e:{};if(S=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),Fe(t)?oe(t):{});var t}(N?{}:e),!t)return function(e,t){return Ne(e,ke(e),t)}(e,function(e,t){return e&&Ne(t,Xe(t),e)}(S,e))}else{if(!U[j])return f?e:{};S=function(e,t,r,s){var i=e.constructor;switch(t){case y:return je(e);case o:case a:return new i(+e);case b:return function(e,t){var r=t?je(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,s);case E:case q:case I:case D:case T:case O:case $:case _:case w:return function(e,t){var r=t?je(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,s);case d:return function(e,t,r){return H(t?r(B(e),!0):B(e),L,new e.constructor)}(e,s,r);case l:case g:return new i(e);case h:return function(e){var t=new e.constructor(e.source,A.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,r){return H(t?r(Y(e),!0):Y(e),M,new e.constructor)}(e,s,r);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,j,Pe,t)}}x||(x=new _e);var C=x.get(e);if(C)return C;if(x.set(e,S),!P)var R=r?function(e){return function(e,t,r){var s=t(e);return Ge(e)?s:function(e,t){for(var r=-1,s=t.length,i=e.length;++r<s;)e[i+r]=t[r];return e}(s,r(e))}(e,Xe,ke)}(e):Xe(e);return function(e,t){for(var r=-1,s=e?e.length:0;++r<s&&!1!==t(e[r],r,e););}(R||e,(function(i,n){R&&(i=e[n=i]),Ae(S,n,Pe(i,t,r,s,n,e,x))})),S}function Ue(e){return!(!Fe(e)||(t=e,J&&J in t))&&(We(e)||V(e)?te:S).test(Ve(e));var t}function je(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ne(e,t,r,s){r||(r={});for(var i=-1,n=t.length;++i<n;){var o=t[i],a=s?s(r[o],e[o],o,r,e):void 0;Ae(r,o,void 0===a?e[o]:a)}return r}function Ce(e,t){var r,s,i=e.__data__;return("string"==(s=typeof(r=t))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function Re(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Ue(r)?r:void 0}Te.prototype.clear=function(){this.__data__=ve?ve(null):{}},Te.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Te.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===s?void 0:r}return Z.call(t,e)?t[e]:void 0},Te.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Te.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?s:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,r=Se(t,e);return!(r<0)&&(r==t.length-1?t.pop():ce.call(t,r,1),!0)},Oe.prototype.get=function(e){var t=this.__data__,r=Se(t,e);return r<0?void 0:t[r][1]},Oe.prototype.has=function(e){return Se(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var r=this.__data__,s=Se(r,e);return s<0?r.push([e,t]):r[s][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Te,map:new(fe||Oe),string:new Te}},$e.prototype.delete=function(e){return Ce(this,e).delete(e)},$e.prototype.get=function(e){return Ce(this,e).get(e)},$e.prototype.has=function(e){return Ce(this,e).has(e)},$e.prototype.set=function(e,t){return Ce(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new Oe},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Oe){var s=r.__data__;if(!fe||s.length<199)return s.push([e,t]),this;r=this.__data__=new $e(s)}return r.set(e,t),this};var ke=ue?G(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||P.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Be(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=b||fe&&Le(new fe)!=d||he&&Le(he.resolve())!=f||me&&Le(new me)!=m||ge&&Le(new ge)!=x)&&(Le=function(e){var t=ee.call(e),r=t==p?e.constructor:void 0,s=r?Ve(r):void 0;if(s)switch(s){case xe:return b;case ye:return d;case be:return f;case Ee:return m;case qe:return x}return t});var Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}(e.length)&&!We(e)}var Qe=de||function(){return!1};function We(e){var t=Fe(e)?ee.call(e):"";return t==c||t==u}function Fe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xe(e){return Ye(e)?we(e):function(e){if(!He(e))return le(e);var t=[];for(var r in Object(e))Z.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return Pe(e,!0,!0)}}(s,s.exports);var i=s.exports;const n=e=>({get(t,r,s){if("__isProxy"===r)return!0;const i=Reflect.get(t,r);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(e)):i},set(t,r,s,n){const o=t[r];s=f(s)&&s.__isProxy?i(s):s;const a=Reflect.set(t,r,s,n);return((e,t)=>e!==t&&(e==e||t==t))(s,o)&&e.emit(`${y(r)}Change`,s),a}}),o=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:t="",timeout:r=6e4}=e;let{headers:s={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,t)=>{if(!t)return e;const r=[];Object.keys(t).forEach((e=>{const s=t[e];if(null==s)return;let i;Array.isArray(s)?(i=s,e+="[]"):i=[s],i.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),r.push(`${o(e)}=${o(t)}`)}))}));const s=r.join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e})(t.replace(/^\/+/,""),e.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[e],delete s[e])})),h(e.data)&&(e.data=e.data.buffer),m(e.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=s,e.timeout=r,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx&&void 0!==wx.request?d(e):u(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,r){return this._errorHandler?this._request(Object.assign(r||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(r||{},{url:e,method:"POST",data:t}))}}class c{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new c((t=>{e=t}));return{cancel:e,token:t}}}const u=e=>new Promise(((t,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),i,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){r(new Error("E_JSON_PARSE"+u.responseText))}else r({url:i,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(r({url:i,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{r(new Error("Network Error")),u=null},u.ontimeout=()=>{r(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===s&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),r(e),u=null)})),u.send(s)})),d=e=>new Promise(((t,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:i,data:s,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):r({url:i,statusCode:e.statusCode})},fail(e){r("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=e=>null==e,f=e=>"object"==typeof e&&null!==e,h=e=>{let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t},m=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},g=()=>{const e=[],t="0123456789abcdef";for(let r=0;r<36;r++)e[r]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},v=(e,t)=>e?(Object.entries(e).forEach((e=>{const[r,s]=[e[0],e[1]];if(null!==s)return f(s)&&!l(s)?(t[r]||(t[r]={}),void(t[r]=v(s,t[r]))):void(t[r]=s)})),t):t,x=/-(\w)/g,y=e=>e.replace(x,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:b}=Object.prototype,E=(e,t)=>b.call(e,t),q=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let r;r=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,r);for(const s in e)E(e,s)&&(r[s]=q(e[s],t));return r};var I,D,T,O,$;exports.EVENT=void 0,(I=exports.EVENT||(exports.EVENT={})).REQUEST_ERROR="requestError",I.STATE="state",I.FAILED="failed",exports.STATE=void 0,(D=exports.STATE||(exports.STATE={}))[D.CLOSE=0]="CLOSE",D[D.JOINED=1]="JOINED",D[D.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,(T=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",T.WEBCTRL="webCtrl",T.WECHATMP="weChatMP",T.SUPERVISION="supervision",T.BIGSCREEN="bigScreen",T.DESKTOP="desktop",T.MOBILE="mobile",T.VCS="vcs",T.SIP="sip",T.H323="h323",T.PSTN="pstn",exports.ROLE=void 0,(O=exports.ROLE||(exports.ROLE={})).HOST="host",O.COHOST="coHost",O.ATTENDEE="attendee",O.AUDIENCE="audience",exports.RECORD_STATUS=void 0,($=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",$.PAUSED="paused",$.STARTING="starting",$.STOPPED="stopped";class _{constructor(e,r){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=r,this.ctx=e,this.emitter=t(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},n(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},n(this.emitter))}reactive(e){if(f(e)){const t=new Map,r=(e,s)=>{Object.keys(e).forEach((i=>{!1===s&&i in this.data&&(e[i]=this.data[i]);const n=t=>e[i]=t,o=`${y(i)}Change`;this.emitter.on(o,n),t.set(o,n),f(e[i])&&!l(e[i])&&r(e[i],!0)}))};r(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class w extends _{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:r}=e;("full"===t||"update"===t)&&v(r,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;v({participantCount:t},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:r},headers:{language:e.language}})}}function A(e){const t=[],{isInLobby:r}=e.modules.me.data;return r?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((r=>{const s=e.modules[r]._topic();s&&(Array.isArray(s)?s.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(s)||t.push(s))})),t)}function S(t,r){return e(this,void 0,void 0,(function*(){const{meetingID:e,clientID:s}=r.config.request,i=yield r.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,meetingId:e},inboxes:t}),n=[];return i.data&&Object.keys(i.data).forEach((e=>{n.push({name:e,seqId:i.data[e].maxSeqId,limit:200})})),n}))}function P(t,r){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s,clientID:i}=r.config.request,n=yield r.request.post(`${e}meetings/${s}/subscribe`,{endpointID:i,topics:t}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),r.emitter.emit(e.event,e)}))}))}function U(t,r,s){return e(this,void 0,void 0,(function*(){const{inboxes:i,clientID:n,meetingID:o,cancelToken:a,status:c}=r;yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:i},{cancelToken:a,withResDate:!0});if(!e||!e.data)return;const{data:r={}}=e;Object.keys(r).forEach((e=>{const t=i.find((t=>t.name===e));if(t){if(t.seqId=r[e].maxSeqId,!r[e].items)return;r[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),s(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&U(t,r,s)}),200))}))}const j=(t,r)=>e(void 0,void 0,void 0,(function*(){const{meetingID:e,clientID:s}=r.config.request;r.status.polling.running=!0,U(r.request,{inboxes:t,clientID:s,meetingID:e,cancelToken:r.config.request.cancelToken.token,status:r.status.polling},(e=>{r.emitter.emit(e.event,e)}))}));function N(e){e.status.polling.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=c.source()}function C(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:r},meetingID:s,userID:i}=t.config.request;t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.request.post(`${r}meetings/${s}/users/${i}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token});if(!e||!e.data)return;const{data:n={}}=e,o=n.interval||"";o&&(t.status.keepalive.interval=o)})))(),t.status.keepalive.running&&(t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&C(t)}),1e3*t.status.keepalive.interval))}))}const R=e=>{e.status.keepalive.running=!1,e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null)};var k;exports.MeEvent=void 0,(k=exports.MeEvent||(exports.MeEvent={})).INIT="meInit",k.UPDATE="meUpdate",k.UPDATE_USER_STATE="updateUserState",k.ROLECHANGE="meRoleChange",k.AUDIOCHANGE="meAudioChange",k.HANDUPCHANGE="meHandupChange",k.SETAUDIO="setAudio",k.VIDEOCHANGE="meVideoChange",k.SETVIDEO="setVideo",k.SHARECHANGE="meShareChange",k.DISPLAYNAMECHANGE="meDisplayNameChange",k.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",k.LOBBYCHANGE="meLobbyChange",k.BARRAGECHANGE="meBarrageChange",k.LEAVE="leave";class L extends _{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const t=t=>e(this,void 0,void 0,(function*(){if("role"in t&&t.role!==this.data.role){const e=this.data.role;v({role:t.role},this.data),t.role!==exports.ROLE.AUDIENCE&&e!==exports.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(exports.MeEvent.ROLECHANGE,t.role),this.ctx.emitter.emit(exports.MeEvent.ROLECHANGE,t.role)}})),r=e=>{var t,r,s,i;if("audio"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.audio;(!p(n)&&n!==(null===(t=this.data.audio)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(r=this.data.audio)||void 0===r?void 0:r.sendOn)||!p(a))&&(v({audio:e.audio},this.data),this.emitter.emit(exports.MeEvent.AUDIOCHANGE,{deviceOn:p(n)?null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.audio)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},s=e=>{var t,r,s,i;if("video"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.video;(!p(n)&&n!==(null===(t=this.data.video)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(r=this.data.video)||void 0===r?void 0:r.sendOn))&&(v({video:e.video},this.data),this.emitter.emit(exports.MeEvent.VIDEOCHANGE,{deviceOn:p(n)?null===(s=this.data.video)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.video)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},i=e=>{var t,r,s,i;if("share"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.share;(!p(n)&&n!==(null===(t=this.data.share)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(r=this.data.share)||void 0===r?void 0:r.sendOn))&&(v({share:e.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=e=>{e.displayName&&e.displayName!==this.data.displayName&&(v({displayName:e.displayName},this.data),this.emitter.emit(exports.MeEvent.DISPLAYNAMECHANGE,e.displayName))},o=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(v({isHandUp:e.isHandUp},this.data),this.emitter.emit(exports.MeEvent.HANDUPCHANGE,e.isHandUp))},a=e=>{"isSpotlightVideo"in e&&(v({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(exports.MeEvent.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},c=t=>e(this,void 0,void 0,(function*(){if("isInLobby"in t&&t.isInLobby!==this.data.isInLobby){v({isInLobby:t.isInLobby},this.data);const e=!1===t.isInLobby?"inLobbyChange":void 0;yield this.rePolling(e),this.emitter.emit(exports.MeEvent.LOBBYCHANGE,t.isInLobby),this.ctx.emitter.emit(exports.MeEvent.LOBBYCHANGE,t.isInLobby)}})),u=e=>{if(!e.barrage)return;let t=null;if(!e.barrage.wordsDisplayStatus)return t=null,delete e.barrage,this.data.barrage=t||void 0,void this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t);if(!e.barrage.receiver)return;t={content:e.barrage.content,contentType:e.barrage.contentType,type:e.barrage.type,duration:e.barrage.duration,position:e.barrage.position};let{role:r}=this.data;if(this.data.endpointType===exports.ENDPOINT_TYPE.SUPERVISION){const{info:e}=this.ctx.modules;r="webinar"===e.meetingType?exports.ROLE.AUDIENCE:exports.ROLE.ATTENDEE}r===exports.ROLE.HOST||r===exports.ROLE.COHOST?t=e.barrage.receiver.host?t:null:r===exports.ROLE.ATTENDEE?t=e.barrage.receiver.attendee?t:null:r===exports.ROLE.AUDIENCE&&(t=e.barrage.receiver.audience?t:null),delete e.barrage,this.data.barrage=t||void 0,this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t)},d=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),N(this.ctx),X(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,e.resultInfo),this.ctx.cleanup(e.resultInfo))},l=e=>{t(e),r(e),s(e),i(e),n(e),o(e),c(e),a(e),u(e),d(e)};this.ctx.emitter.on(exports.MeEvent.INIT,(e=>{v(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(exports.MeEvent.UPDATE,(e=>{l(e),v(e,this.data)})),this.ctx.emitter.on(exports.EVENT.STATE,(({state:e})=>{e===exports.STATE.READY&&this.data.endpointType!==exports.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:r={users:[]}}=t;if("delete"===e){const e=r.users[0];return e.leave=!0,void d(e)}const s=r.users.find((e=>e.userID===this.data.userID));s&&(l(s),v(s,this.data))})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(exports.MeEvent.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(exports.MeEvent.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){d({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(e,t=!1){if(!t){const{role:t,initialMediaState:r}=this.data;e.audio.sendOn=e.audio.sendOn&&r.audio.sendOn,e.video.sendOn=e.video.sendOn&&r.video.sendOn,t===exports.ROLE.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(e,this.data),this.ctx.request.post(`${r}meetings/${s}/updateUserState`,e)}rePolling(t){return e(this,void 0,void 0,(function*(){const{ctx:e}=this;N(e);const r=A(e),s=yield S(r,e);if(t&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:t}),yield P(r,e),"undefined"!=typeof Worker&&e.worker){const{meetingID:t,clientID:i}=e.config.request;e.worker.postMessage({inboxes:s,topics:r,meetingID:t,clientID:i,rePolling:!0})}else yield j(s,e)}))}}class M extends _{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:r}=e;if(t&&t.users){if("full"===r)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===r&&-1!==t?v(e,this.data.callRecordUsers[t]):"update"===r&&-1===t&&(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/invite`,e)}}class H extends _{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:t}=this.ctx.modules.me.data;return t===exports.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:e===exports.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:t,state:r})=>{if(e.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=e;if("delete"!==r||"delete"===r&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(exports.MeEvent.UPDATE,e);let i=!1;switch(t){case"interactiveUsers":e.isInLobby||(i=!0);break;case"broadcastUsers":e.isInLobby||e.role!==exports.ROLE.AUDIENCE||(i=!0);break;case"lobbyUsers":e.isInLobby&&(i=!0)}const n={};i&&(n.leave=!0),this.ctx.emitter.emit(exports.MeEvent.UPDATE,Object.assign(Object.assign({},e),n))},t=({updateUsers:t,state:r,sourceKey:s})=>{if("full"===r)return this.data[s]=t.map((t=>(t.displayNamePinyin=H.setDisplayNamePinyinProp?H.setDisplayNamePinyinProp(t.displayName):t.displayName,e(t,{event:s,state:r}),t))),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!0}),this.data[s];void 0===this.data[s]&&(this.data[s]=[]);const{data:i,emitter:n}=this;return t.forEach((t=>{const o=i[s].findIndex((e=>t.userID===e.userID));if("delete"===r&&-1!==o){const[e]=this.data[s].splice(o,1);n.emit(`${s}Delete`,{user:e,resultInfo:t.resultInfo})}else if("update"===r&&-1!==o){const e=this.data[s][o];this.updateUserProps(t,e),v(t,e),this.data[s][o]=q(e),this.emitter.emit(`${s}Update`,{user:this.data[s][o]})}else"update"===r&&-1===o&&(t.displayNamePinyin=H.setDisplayNamePinyinProp?H.setDisplayNamePinyinProp(t.displayName):t.displayName,i[s].push(t),this.emitter.emit(`${s}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:s,state:r})})),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!1}),this.data[s]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=H.setDisplayNamePinyinProp?H.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/users/${e}/callStats`)}callStatsReport(e){if(!e.userID)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/users/${e.userID}/callStats/report`,e)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}function V(e){const{baseURL:r,modules:s,worker:i,singleton:n}=e;s.findIndex((e=>e===L))<0&&s.push(L),s.findIndex((e=>e===w))<0&&s.push(w);const o=`${g()}_${((e=new Date,t)=>{const r={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const s in r)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return t})(new Date,"MMddHHmmss")}`,u={config:{baseURL:r,modules:s,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:i,emitter:t(),request:new a({baseURL:r,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=g()},error:e=>{u.emitter.emit(exports.EVENT.REQUEST_ERROR,e)}}),modules:{},state:exports.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:e=>{u.state!==exports.STATE.CLOSE&&(u.worker&&u.worker.terminate(),u.config.request.location="",u.config.request.meetingID="",u.config.request.ctrlID="",u.config.request.sessionID="",u.config.request.userID=-1,u.config.request.voteTk="",u.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),u.state=exports.STATE.CLOSE,u.emitter.emit(exports.EVENT.STATE,{state:u.state,reason:e}))}};return u}function B(e){const t=V(e);return t.worker&&("undefined"!=typeof Worker?t.worker.postMessage({baseURL:t.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!l(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const r=new e(t);t.modules[r.moduleName]=r}))}(t.config.modules,t),t.emitter.on(exports.EVENT.STATE,(({state:e})=>{e===exports.STATE.CLOSE&&Object.keys(t.modules).forEach((e=>{t.modules[e].cleanup()}))})),Object.assign({config:t.config,request:t.request,get state(){return t.state},on:t.emitter.on,off:t.emitter.off,join:G(t),leave:Y(t),end:Q(t),endMeeting:W(t)},t.modules)}function G(t){return function(r){var s;return e(this,void 0,void 0,(function*(){const{clientID:e}=t.config.request,i=`${null===(s=r.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${e}_${r.meetingNum}`;t.config.request.sessionID=i,t.request.setDefaultHeader("X-Y-Session-Id",i);const{prefix:n}=t.config.request,o=yield t.request.get(`${n.ctrl}credential`,{params:{meetingNum:r.meetingNum,pwd:r.pwd,url:r.url,mobileCode:r.mobileCode,mobile:r.mobile,regEmail:r.regEmail,accEmail:r.accEmail,tk:r.tk,displayName:r.displayName},headers:{"X-Y-Endpoint-Type":r.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return t.emitter.emit(exports.EVENT.FAILED,{bizCode:o.bizCode,data:o.data}),o;t.config.request.location=c,t.request.setDefaultHeader("X-Y-Location",c),delete r.pwd,delete r.url;const u=yield t.request.post(`${n.ctrl}join?meetingNum=${r.meetingNum}&credential=${a}`,r,{headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":e}});if(!u||u&&u.ret<=-1)return t.emitter.emit(exports.EVENT.FAILED,{bizCode:u.bizCode,data:u.data}),u;const{meetingID:d="",ctrlID:l="",user:p={},mediaContent:f={},initialMediaState:h={},tk:m=""}=u.data;t.config.request.meetingID=d,t.config.request.ctrlID=l,t.config.request.userID=p.userID,t.config.request.voteTk=m,t.request.setDefaultHeader("X-Y-Ctrl-Id",l),t.emitter.emit(exports.MeEvent.INIT,Object.assign(Object.assign({},p),{mediaContent:f,initialMediaState:h})),t.state=exports.STATE.JOINED,t.emitter.emit(exports.EVENT.STATE,{state:t.state});const g=()=>{t.state!==exports.STATE.READY&&(t.state=exports.STATE.READY,t.emitter.emit(exports.EVENT.STATE,{state:t.state}))},v=A(t),x=yield S(v,t);return yield P(v,t),"undefined"!=typeof Worker&&t.worker?(t.status.polling.running=!0,t.worker.postMessage({topics:v,meetingID:d,clientID:e,inboxes:x,status:!0}),t.worker.onmessage=e=>{"pollingStarted"!==e.data?"pollingStopped"!==e.data?(console.log("[Polling]",e.data),t.emitter.emit(e.data.event,e.data)):t.status.polling.running=!1:g()}):(t.status.polling.running=!0,j(x,t),g()),t.status.keepalive.running=!0,C(t),u.data=Object.assign(Object.assign({},u.data),o.data),u}))}}function Y(t){return function(r){return e(this,void 0,void 0,(function*(){r||(r={resultInfo:{bizCode:901359}});const{prefix:e,meetingID:s}=t.config.request,i=yield t.request.post(`${e.ctrl}meetings/${s}/leave`,r);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),N(t),R(t),X(t),t.cleanup(),i}))}}function Q(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:r}=t.config.request,s=yield t.request.post(`${e.ctrl}meetings/${r}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),N(t),R(t),X(t),t.cleanup(),s}))}}function W(t){return function(r){return e(this,void 0,void 0,(function*(){const{prefix:e}=t.config.request;return yield t.request.post(`${e.ctrl}meetingNum/${r}/end`)}))}}class F{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=B(e)}static getInstance(e){return this.instance?this.instance:this.instance=new F(e)}}function X(e){if(e.config.singleton){const{baseURL:t,modules:r,singleton:s}=e.config,i={baseURL:t,modules:r,worker:e.worker,singleton:s},n=F.getInstance(i);n&&(n.meeting=B(i))}}Object.defineProperty(F,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.Chat=class extends _{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/chat/historyMsg`,t)}))}},exports.Info=w,exports.Invite=M,exports.LiveStream=class extends _{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:r,body:s,stime:i}=e;if(s){if(i&&(this.data.jetlag=i),"full"===r){const{liveStreams:e=[]}=s;if(!e.length)return;const t=[];this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,t.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return v({status:t,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),s.liveStreams||(this.data.resultInfo={}),null===(t=s.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform));const r=this.data.status.map((e=>e));-1===t?r.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):r.splice(t,1,{platform:r[t].platform||"",status:e.requesting?r[t].status||"stopped":e.status||""}),this.data.status=r})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/liveStream/setting`,t)}))}},exports.Me=L,exports.Qa=class extends _{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;f(t)&&!l(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(e,t){let r=e.get(t.question.id);const{clientID:s}=this.ctx.config.request;switch(t.command){case"addQuestion":r=this.createQuestion(t.question),e.set(t.question.id,r),this.emitter.emit("questionAdd",{question:r,selfSent:r.sender.endpointID===s});break;case"dismissQuestion":if(!r)break;r.sender.endpointID!==s?r.status="close":r.isTop=!1,e.set(t.question.id,r),this.emitter.emit("questionUpdate",{question:r});break;case"reopenQuestion":r?(r.status="open",r.isTop=t.question.isTop,e.set(t.question.id,r)):(r=this.createQuestion(t.question),e.set(t.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"updateQuestion":r?(r=Object.assign(Object.assign(Object.assign({},r),t.question),{topSort:t.question.isTop?this.data.topSort++:0}),e.set(t.question.id,r)):(r=this.createQuestion(t.question),e.set(t.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteQuestion":if(!r)break;r.sender.endpointID!==s?e.delete(t.question.id):(r.status="delete",r.isTop=!1,r.answers.clear(),e.set(t.question.id,r)),this.emitter.emit("questionDelete",{question:r});break;case"answerQuestion":r?r.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(r=this.createQuestion(t.question),r.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteAnswer":r&&(r.answers.delete(t.answer.id),this.emitter.emit("questionUpdate",{question:r}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/qa`,t)}))}},exports.Recording=class extends _{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:r,stime:s}=e;if(r)return s&&(this.data.jetlag=s),this.data.isPracticeSession="started"===r.status&&this.data.status===r.status&&0===r.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),r),"starting"===r.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=r.status||this.data.status),this.data.resultInfo=r.resultInfo||{},["full","update"].includes(t)?(r.recordUsers&&(this.data.recording.recordUsers=r.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/designatedUsers`,t)}))}participantAdd(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/add`,t)}))}participantDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/delete`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}getByIds(t){return e(this,void 0,void 0,(function*(){const{prefix:{user:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/subject/getByIds`,t)}))}recordLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/layout`,t)}))}},exports.Setting=class extends _{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:r}=e;["full","update"].includes(t)&&v(r,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}},exports.SpotlightVideo=class extends _{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:t}=e;if(!t||!t.userIDs)return;this.data.userIDs=t.userIDs;t.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/view/spotlight`,e)}},exports.Transcript=class extends _{constructor(e){super(e,"transcript")}_topic(){return"transcript"}_bindOn(){this.ctx.emitter.on("transcriptMsg",(e=>{const{body:t}=e;this.emitter.emit("transcriptMsg",t)}))}cleanup(){this.emitter.all=new Map}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/transcript/historyMsg`,t)}))}},exports.Users=H,exports.View=class extends _{constructor(e){super(e,"view")}_topic(){const{endpointType:e,role:t}=this.ctx.modules.me.data;return e===exports.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:t===exports.ROLE.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:r,body:s}=e;s&&("meetingView"===r?Object.keys(s).forEach((e=>{this.data[e]=s[e]})):this.data[t]=s)}updatePersonalLayouts(e){const{state:t,body:r}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),r.personalLayouts.forEach((e=>{const{subscriber:r={userID:-1}}=e,s=r.userID||r.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[s]=e:delete this.data.personalLayouts[s]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/layout/template/info`,{params:t})}))}addVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/add`,t)}))}editVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/edit`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}editTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/edit`,t)}))}addTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/add`,t)}))}deleteTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/delete`,t)}))}getDefaultTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getDefaultTemplates`,{params:t})}))}changeDefaultTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/changeDefaultTemplate`,t)}))}perspectiveBind(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/perspective/bind`,t)}))}},exports.Vote=class extends _{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:r}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[r]=t,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:t})})),this.ctx.emitter.on(exports.MeEvent.LOBBYCHANGE,(e=>{e&&(this.data.vote={})}))}getVotes(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${r}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${r}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${r}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${r}meetings/${s}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${r}meetings/${s}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/vote/inProgress`,{params:{tk:e&&e.tk||s}})}},exports.Words=class extends _{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:t,body:r}=e;if(!r)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data});"full"===t&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:r.content,time:(new Date).getTime(),durationType:r.durationType,duration:1e3*r.duration},...this.data.barrageRecord],r.wordsDisplayStatus=!0,-1!==r.duration&&(this.data.timer=setTimeout((()=>{r.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=r.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*r.duration)),v(r,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(exports.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}},exports.createMeeting=function(e){return e.singleton?F.getInstance(e).meeting:B(e)},exports.reset=X;
|
|
1
|
+
"use strict";function e(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(t){n(t)}}function a(e){try{c(s.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))}function t(e){return{all:e=e||new Map,on:function(t,r){var s=e.get(t);s?s.push(r):e.set(t,[r])},off:function(t,r){var s=e.get(t);s&&(r?s.splice(s.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var s=e.get(t);s&&s.slice().map((function(e){e(r)})),(s=e.get("*"))&&s.slice().map((function(e){e(t,r)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(e,t){var s="__lodash_hash_undefined__",i=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",f="[object Promise]",h="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",x="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",w="[object Uint32Array]",A=/\w*$/,S=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[y]=U[b]=U[o]=U[a]=U[E]=U[q]=U[I]=U[D]=U[T]=U[d]=U[l]=U[p]=U[h]=U[m]=U[g]=U[v]=U[O]=U[$]=U[_]=U[w]=!0,U["[object Error]"]=U[c]=U[x]=!1;var j="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof r&&r&&r.Object===Object&&r||j||Function("return this")(),C=t&&!t.nodeType&&t,R=C&&e&&!e.nodeType&&e,k=R&&R.exports===C;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,r,s){var i=-1,n=e?e.length:0;for(s&&n&&(r=e[++i]);++i<n;)r=t(r,e[i],i,e);return r}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function B(e){var t=-1,r=Array(e.size);return e.forEach((function(e,s){r[++t]=[s,e]})),r}function G(e,t){return function(r){return e(t(r))}}function Y(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var Q,W=Array.prototype,F=Function.prototype,X=Object.prototype,z=N["__core-js_shared__"],J=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=F.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=k?N.Buffer:void 0,se=N.Symbol,ie=N.Uint8Array,ne=G(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=W.splice,ue=Object.getOwnPropertySymbols,de=re?re.isBuffer:void 0,le=G(Object.keys,Object),pe=Re(N,"DataView"),fe=Re(N,"Map"),he=Re(N,"Promise"),me=Re(N,"Set"),ge=Re(N,"WeakMap"),ve=Re(Object,"create"),xe=Ve(pe),ye=Ve(fe),be=Ve(he),Ee=Ve(me),qe=Ve(ge),Ie=se?se.prototype:void 0,De=Ie?Ie.valueOf:void 0;function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function $e(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function _e(e){this.__data__=new Oe(e)}function we(e,t){var r=Ge(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var r=-1,s=Array(e);++r<e;)s[r]=t(r);return s}(e.length,String):[],s=r.length,i=!!s;for(var o in e)!t&&!Z.call(e,o)||i&&("length"==o||Me(o,s))||r.push(o);return r}function Ae(e,t,r){var s=e[t];Z.call(e,t)&&Be(s,r)&&(void 0!==r||t in e)||(e[t]=r)}function Se(e,t){for(var r=e.length;r--;)if(Be(e[r][0],t))return r;return-1}function Pe(e,t,r,s,i,f,x){var S;if(s&&(S=f?s(e,i,f,x):s(e)),void 0!==S)return S;if(!Fe(e))return e;var P=Ge(e);if(P){if(S=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,s=e.length;t||(t=Array(s));for(;++r<s;)t[r]=e[r];return t}(e,S)}else{var j=Le(e),N=j==c||j==u;if(Qe(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(j==p||j==n||N&&!f){if(V(e))return f?e:{};if(S=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),Fe(t)?oe(t):{});var t}(N?{}:e),!t)return function(e,t){return Ne(e,ke(e),t)}(e,function(e,t){return e&&Ne(t,Xe(t),e)}(S,e))}else{if(!U[j])return f?e:{};S=function(e,t,r,s){var i=e.constructor;switch(t){case y:return je(e);case o:case a:return new i(+e);case b:return function(e,t){var r=t?je(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,s);case E:case q:case I:case D:case T:case O:case $:case _:case w:return function(e,t){var r=t?je(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,s);case d:return function(e,t,r){return H(t?r(B(e),!0):B(e),L,new e.constructor)}(e,s,r);case l:case g:return new i(e);case h:return function(e){var t=new e.constructor(e.source,A.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,r){return H(t?r(Y(e),!0):Y(e),M,new e.constructor)}(e,s,r);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,j,Pe,t)}}x||(x=new _e);var C=x.get(e);if(C)return C;if(x.set(e,S),!P)var R=r?function(e){return function(e,t,r){var s=t(e);return Ge(e)?s:function(e,t){for(var r=-1,s=t.length,i=e.length;++r<s;)e[i+r]=t[r];return e}(s,r(e))}(e,Xe,ke)}(e):Xe(e);return function(e,t){for(var r=-1,s=e?e.length:0;++r<s&&!1!==t(e[r],r,e););}(R||e,(function(i,n){R&&(i=e[n=i]),Ae(S,n,Pe(i,t,r,s,n,e,x))})),S}function Ue(e){return!(!Fe(e)||(t=e,J&&J in t))&&(We(e)||V(e)?te:S).test(Ve(e));var t}function je(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ne(e,t,r,s){r||(r={});for(var i=-1,n=t.length;++i<n;){var o=t[i],a=s?s(r[o],e[o],o,r,e):void 0;Ae(r,o,void 0===a?e[o]:a)}return r}function Ce(e,t){var r,s,i=e.__data__;return("string"==(s=typeof(r=t))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function Re(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Ue(r)?r:void 0}Te.prototype.clear=function(){this.__data__=ve?ve(null):{}},Te.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Te.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===s?void 0:r}return Z.call(t,e)?t[e]:void 0},Te.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Te.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?s:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,r=Se(t,e);return!(r<0)&&(r==t.length-1?t.pop():ce.call(t,r,1),!0)},Oe.prototype.get=function(e){var t=this.__data__,r=Se(t,e);return r<0?void 0:t[r][1]},Oe.prototype.has=function(e){return Se(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var r=this.__data__,s=Se(r,e);return s<0?r.push([e,t]):r[s][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Te,map:new(fe||Oe),string:new Te}},$e.prototype.delete=function(e){return Ce(this,e).delete(e)},$e.prototype.get=function(e){return Ce(this,e).get(e)},$e.prototype.has=function(e){return Ce(this,e).has(e)},$e.prototype.set=function(e,t){return Ce(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new Oe},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Oe){var s=r.__data__;if(!fe||s.length<199)return s.push([e,t]),this;r=this.__data__=new $e(s)}return r.set(e,t),this};var ke=ue?G(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||P.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Be(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=b||fe&&Le(new fe)!=d||he&&Le(he.resolve())!=f||me&&Le(new me)!=m||ge&&Le(new ge)!=x)&&(Le=function(e){var t=ee.call(e),r=t==p?e.constructor:void 0,s=r?Ve(r):void 0;if(s)switch(s){case xe:return b;case ye:return d;case be:return f;case Ee:return m;case qe:return x}return t});var Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}(e.length)&&!We(e)}var Qe=de||function(){return!1};function We(e){var t=Fe(e)?ee.call(e):"";return t==c||t==u}function Fe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xe(e){return Ye(e)?we(e):function(e){if(!He(e))return le(e);var t=[];for(var r in Object(e))Z.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return Pe(e,!0,!0)}}(s,s.exports);var i=s.exports;const n=e=>({get(t,r,s){if("__isProxy"===r)return!0;const i=Reflect.get(t,r);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(e)):i},set(t,r,s,n){const o=t[r];s=f(s)&&s.__isProxy?i(s):s;const a=Reflect.set(t,r,s,n);return((e,t)=>e!==t&&(e==e||t==t))(s,o)&&e.emit(`${y(r)}Change`,s),a}}),o=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{timeout:t=6e4}=e;let{headers:r={}}=e;return e.url=I(this.baseURL,e.url||""),e.url=((e,t)=>{if(!t)return e;const r=[];Object.keys(t).forEach((e=>{const s=t[e];if(null==s)return;let i;Array.isArray(s)?(i=s,e+="[]"):i=[s],i.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),r.push(`${o(e)}=${o(t)}`)}))}));const s=r.join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e})(e.url.replace(/^\/+/,""),e.params),r=Object.assign(r,this._defaultHeaders),Object.keys(r).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(r["Content-Type"]=r[e],delete r[e])})),h(e.data)&&(e.data=e.data.buffer),m(e.data)&&(r&&!r["Content-Type"]&&(r["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=r,e.timeout=t,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx&&void 0!==wx.request?d(e):u(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,r){return this._errorHandler?this._request(Object.assign(r||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(r||{},{url:e,method:"POST",data:t}))}}class c{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new c((t=>{e=t}));return{cancel:e,token:t}}}const u=e=>new Promise(((t,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),i,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){r(new Error("E_JSON_PARSE"+u.responseText))}else r({url:i,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(r({url:i,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{r(new Error("Network Error")),u=null},u.ontimeout=()=>{r(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===s&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),r(e),u=null)})),u.send(s)})),d=e=>new Promise(((t,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:i,data:s,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):r({url:i,statusCode:e.statusCode})},fail(e){r("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=e=>null==e,f=e=>"object"==typeof e&&null!==e,h=e=>{let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t},m=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},g=()=>{const e=[],t="0123456789abcdef";for(let r=0;r<36;r++)e[r]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},v=(e,t)=>e?(Object.entries(e).forEach((e=>{const[r,s]=[e[0],e[1]];if(null!==s)return f(s)&&!l(s)?(t[r]||(t[r]={}),void(t[r]=v(s,t[r]))):void(t[r]=s)})),t):t,x=/-(\w)/g,y=e=>e.replace(x,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:b}=Object.prototype,E=(e,t)=>b.call(e,t),q=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let r;r=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,r);for(const s in e)E(e,s)&&(r[s]=q(e[s],t));return r},I=(e,t)=>e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?((e,t)=>t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e)(e,t):t;var D,T,O,$,_;exports.EVENT=void 0,(D=exports.EVENT||(exports.EVENT={})).REQUEST_ERROR="requestError",D.STATE="state",D.FAILED="failed",exports.STATE=void 0,(T=exports.STATE||(exports.STATE={}))[T.CLOSE=0]="CLOSE",T[T.JOINED=1]="JOINED",T[T.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,(O=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",O.WEBCTRL="webCtrl",O.WECHATMP="weChatMP",O.SUPERVISION="supervision",O.BIGSCREEN="bigScreen",O.DESKTOP="desktop",O.MOBILE="mobile",O.VCS="vcs",O.SIP="sip",O.H323="h323",O.PSTN="pstn",exports.ROLE=void 0,($=exports.ROLE||(exports.ROLE={})).HOST="host",$.COHOST="coHost",$.ATTENDEE="attendee",$.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(_=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",_.PAUSED="paused",_.STARTING="starting",_.STOPPED="stopped";class w{constructor(e,r){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=r,this.ctx=e,this.emitter=t(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},n(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},n(this.emitter))}reactive(e){if(f(e)){const t=new Map,r=(e,s)=>{Object.keys(e).forEach((i=>{!1===s&&i in this.data&&(e[i]=this.data[i]);const n=t=>e[i]=t,o=`${y(i)}Change`;this.emitter.on(o,n),t.set(o,n),f(e[i])&&!l(e[i])&&r(e[i],!0)}))};r(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class A extends w{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:r}=e;("full"===t||"update"===t)&&v(r,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;v({participantCount:t},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:r},headers:{language:e.language}})}}function S(e){const t=[],{isInLobby:r}=e.modules.me.data;return r?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((r=>{const s=e.modules[r]._topic();s&&(Array.isArray(s)?s.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(s)||t.push(s))})),t)}function P(t,r){return e(this,void 0,void 0,(function*(){const{meetingID:e,clientID:s}=r.config.request,i=yield r.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,meetingId:e},inboxes:t}),n=[];return i.data&&Object.keys(i.data).forEach((e=>{n.push({name:e,seqId:i.data[e].maxSeqId,limit:200})})),n}))}function U(t,r){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s,clientID:i}=r.config.request,n=yield r.request.post(`${e}meetings/${s}/subscribe`,{endpointID:i,topics:t}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),r.emitter.emit(e.event,e)}))}))}function j(t,r,s){return e(this,void 0,void 0,(function*(){const{inboxes:i,clientID:n,meetingID:o,cancelToken:a,status:c}=r;yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:i},{cancelToken:a,withResDate:!0});if(!e||!e.data)return;const{data:r={}}=e;Object.keys(r).forEach((e=>{const t=i.find((t=>t.name===e));if(t){if(t.seqId=r[e].maxSeqId,!r[e].items)return;r[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),s(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&j(t,r,s)}),200))}))}const N=(t,r)=>e(void 0,void 0,void 0,(function*(){const{meetingID:e,clientID:s}=r.config.request;r.status.polling.running=!0,j(r.request,{inboxes:t,clientID:s,meetingID:e,cancelToken:r.config.request.cancelToken.token,status:r.status.polling},(e=>{r.emitter.emit(e.event,e)}))}));function C(e){e.status.polling.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=c.source()}function R(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:r},meetingID:s,userID:i}=t.config.request;t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.request.post(`${r}meetings/${s}/users/${i}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token});if(!e||!e.data)return;const{data:n={}}=e,o=n.interval||"";o&&(t.status.keepalive.interval=o)})))(),t.status.keepalive.running&&(t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&R(t)}),1e3*t.status.keepalive.interval))}))}const k=e=>{e.status.keepalive.running=!1,e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null)};var L;exports.MeEvent=void 0,(L=exports.MeEvent||(exports.MeEvent={})).INIT="meInit",L.UPDATE="meUpdate",L.UPDATE_USER_STATE="updateUserState",L.ROLECHANGE="meRoleChange",L.AUDIOCHANGE="meAudioChange",L.HANDUPCHANGE="meHandupChange",L.SETAUDIO="setAudio",L.VIDEOCHANGE="meVideoChange",L.SETVIDEO="setVideo",L.SHARECHANGE="meShareChange",L.DISPLAYNAMECHANGE="meDisplayNameChange",L.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",L.LOBBYCHANGE="meLobbyChange",L.BARRAGECHANGE="meBarrageChange",L.LEAVE="leave";class M extends w{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const t=t=>e(this,void 0,void 0,(function*(){if("role"in t&&t.role!==this.data.role){const e=this.data.role;v({role:t.role},this.data),t.role!==exports.ROLE.AUDIENCE&&e!==exports.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(exports.MeEvent.ROLECHANGE,t.role),this.ctx.emitter.emit(exports.MeEvent.ROLECHANGE,t.role)}})),r=e=>{var t,r,s,i;if("audio"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.audio;(!p(n)&&n!==(null===(t=this.data.audio)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(r=this.data.audio)||void 0===r?void 0:r.sendOn)||!p(a))&&(v({audio:e.audio},this.data),this.emitter.emit(exports.MeEvent.AUDIOCHANGE,{deviceOn:p(n)?null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.audio)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},s=e=>{var t,r,s,i;if("video"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.video;(!p(n)&&n!==(null===(t=this.data.video)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(r=this.data.video)||void 0===r?void 0:r.sendOn))&&(v({video:e.video},this.data),this.emitter.emit(exports.MeEvent.VIDEOCHANGE,{deviceOn:p(n)?null===(s=this.data.video)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.video)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},i=e=>{var t,r,s,i;if("share"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.share;(!p(n)&&n!==(null===(t=this.data.share)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(r=this.data.share)||void 0===r?void 0:r.sendOn))&&(v({share:e.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=e=>{e.displayName&&e.displayName!==this.data.displayName&&(v({displayName:e.displayName},this.data),this.emitter.emit(exports.MeEvent.DISPLAYNAMECHANGE,e.displayName))},o=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(v({isHandUp:e.isHandUp},this.data),this.emitter.emit(exports.MeEvent.HANDUPCHANGE,e.isHandUp))},a=e=>{"isSpotlightVideo"in e&&(v({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(exports.MeEvent.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},c=t=>e(this,void 0,void 0,(function*(){if("isInLobby"in t&&t.isInLobby!==this.data.isInLobby){v({isInLobby:t.isInLobby},this.data);const e=!1===t.isInLobby?"inLobbyChange":void 0;yield this.rePolling(e),this.emitter.emit(exports.MeEvent.LOBBYCHANGE,t.isInLobby),this.ctx.emitter.emit(exports.MeEvent.LOBBYCHANGE,t.isInLobby)}})),u=e=>{if(!e.barrage)return;let t=null;if(!e.barrage.wordsDisplayStatus)return t=null,delete e.barrage,this.data.barrage=t||void 0,void this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t);if(!e.barrage.receiver)return;t={content:e.barrage.content,contentType:e.barrage.contentType,type:e.barrage.type,duration:e.barrage.duration,position:e.barrage.position};let{role:r}=this.data;if(this.data.endpointType===exports.ENDPOINT_TYPE.SUPERVISION){const{info:e}=this.ctx.modules;r="webinar"===e.meetingType?exports.ROLE.AUDIENCE:exports.ROLE.ATTENDEE}r===exports.ROLE.HOST||r===exports.ROLE.COHOST?t=e.barrage.receiver.host?t:null:r===exports.ROLE.ATTENDEE?t=e.barrage.receiver.attendee?t:null:r===exports.ROLE.AUDIENCE&&(t=e.barrage.receiver.audience?t:null),delete e.barrage,this.data.barrage=t||void 0,this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t)},d=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),C(this.ctx),z(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,e.resultInfo),this.ctx.cleanup(e.resultInfo))},l=e=>{t(e),r(e),s(e),i(e),n(e),o(e),c(e),a(e),u(e),d(e)};this.ctx.emitter.on(exports.MeEvent.INIT,(e=>{v(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(exports.MeEvent.UPDATE,(e=>{l(e),v(e,this.data)})),this.ctx.emitter.on(exports.EVENT.STATE,(({state:e})=>{e===exports.STATE.READY&&this.data.endpointType!==exports.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:r={users:[]}}=t;if("delete"===e){const e=r.users[0];return e.leave=!0,void d(e)}const s=r.users.find((e=>e.userID===this.data.userID));s&&(l(s),v(s,this.data))})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(exports.MeEvent.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(exports.MeEvent.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){d({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(e,t=!1){if(!t){const{role:t,initialMediaState:r}=this.data;e.audio.sendOn=e.audio.sendOn&&r.audio.sendOn,e.video.sendOn=e.video.sendOn&&r.video.sendOn,t===exports.ROLE.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(e,this.data),this.ctx.request.post(`${r}meetings/${s}/updateUserState`,e)}rePolling(t){return e(this,void 0,void 0,(function*(){const{ctx:e}=this;C(e);const r=S(e),s=yield P(r,e);if(t&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:t}),yield U(r,e),"undefined"!=typeof Worker&&e.worker){const{meetingID:t,clientID:i}=e.config.request;e.worker.postMessage({inboxes:s,topics:r,meetingID:t,clientID:i,rePolling:!0})}else yield N(s,e)}))}}class H extends w{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:r}=e;if(t&&t.users){if("full"===r)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=H.setDisplayNamePinyinProp?H.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===r&&-1!==t?v(e,this.data.callRecordUsers[t]):"update"===r&&-1===t&&(e.displayNamePinyin=H.setDisplayNamePinyinProp?H.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/invite`,e)}}class V extends w{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:t}=this.ctx.modules.me.data;return t===exports.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:e===exports.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:t,state:r})=>{if(e.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=e;if("delete"!==r||"delete"===r&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(exports.MeEvent.UPDATE,e);let i=!1;switch(t){case"interactiveUsers":e.isInLobby||(i=!0);break;case"broadcastUsers":e.isInLobby||e.role!==exports.ROLE.AUDIENCE||(i=!0);break;case"lobbyUsers":e.isInLobby&&(i=!0)}const n={};i&&(n.leave=!0),this.ctx.emitter.emit(exports.MeEvent.UPDATE,Object.assign(Object.assign({},e),n))},t=({updateUsers:t,state:r,sourceKey:s})=>{if("full"===r)return this.data[s]=t.map((t=>(t.displayNamePinyin=V.setDisplayNamePinyinProp?V.setDisplayNamePinyinProp(t.displayName):t.displayName,e(t,{event:s,state:r}),t))),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!0}),this.data[s];void 0===this.data[s]&&(this.data[s]=[]);const{data:i,emitter:n}=this;return t.forEach((t=>{const o=i[s].findIndex((e=>t.userID===e.userID));if("delete"===r&&-1!==o){const[e]=this.data[s].splice(o,1);n.emit(`${s}Delete`,{user:e,resultInfo:t.resultInfo})}else if("update"===r&&-1!==o){const e=this.data[s][o];this.updateUserProps(t,e),v(t,e),this.data[s][o]=q(e),this.emitter.emit(`${s}Update`,{user:this.data[s][o]})}else"update"===r&&-1===o&&(t.displayNamePinyin=V.setDisplayNamePinyinProp?V.setDisplayNamePinyinProp(t.displayName):t.displayName,i[s].push(t),this.emitter.emit(`${s}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:s,state:r})})),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!1}),this.data[s]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=V.setDisplayNamePinyinProp?V.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/users/${e}/callStats`)}callStatsReport(e){if(!e.userID)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/users/${e.userID}/callStats/report`,e)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}function B(e){const{baseURL:r,modules:s,worker:i,singleton:n}=e;s.findIndex((e=>e===M))<0&&s.push(M),s.findIndex((e=>e===A))<0&&s.push(A);const o=`${g()}_${((e=new Date,t)=>{const r={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const s in r)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return t})(new Date,"MMddHHmmss")}`,u={config:{baseURL:r,modules:s,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:i,emitter:t(),request:new a({baseURL:r,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=g()},error:e=>{u.emitter.emit(exports.EVENT.REQUEST_ERROR,e)}}),modules:{},state:exports.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:e=>{u.state!==exports.STATE.CLOSE&&(u.worker&&u.worker.terminate(),u.config.request.location="",u.config.request.meetingID="",u.config.request.ctrlID="",u.config.request.sessionID="",u.config.request.userID=-1,u.config.request.voteTk="",u.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),u.state=exports.STATE.CLOSE,u.emitter.emit(exports.EVENT.STATE,{state:u.state,reason:e}))}};return u}function G(e){const t=B(e);return t.worker&&("undefined"!=typeof Worker?t.worker.postMessage({baseURL:t.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!l(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const r=new e(t);t.modules[r.moduleName]=r}))}(t.config.modules,t),t.emitter.on(exports.EVENT.STATE,(({state:e})=>{e===exports.STATE.CLOSE&&Object.keys(t.modules).forEach((e=>{t.modules[e].cleanup()}))})),Object.assign({config:t.config,request:t.request,get state(){return t.state},on:t.emitter.on,off:t.emitter.off,join:Y(t),leave:Q(t),end:W(t),endMeeting:F(t)},t.modules)}function Y(t){return function(r){var s;return e(this,void 0,void 0,(function*(){const{clientID:e}=t.config.request,i=`${null===(s=r.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${e}_${r.meetingNum}`;t.config.request.sessionID=i,t.request.setDefaultHeader("X-Y-Session-Id",i);const{prefix:n}=t.config.request,o=yield t.request.get(`${n.ctrl}credential`,{params:{meetingNum:r.meetingNum,pwd:r.pwd,url:r.url,mobileCode:r.mobileCode,mobile:r.mobile,regEmail:r.regEmail,accEmail:r.accEmail,tk:r.tk,displayName:r.displayName},headers:{"X-Y-Endpoint-Type":r.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return t.emitter.emit(exports.EVENT.FAILED,{bizCode:o.bizCode,data:o.data}),o;t.config.request.location=c,t.request.setDefaultHeader("X-Y-Location",c),delete r.pwd,delete r.url;const u=yield t.request.post(`${n.ctrl}join?meetingNum=${r.meetingNum}&credential=${a}`,r,{headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":e}});if(!u||u&&u.ret<=-1)return t.emitter.emit(exports.EVENT.FAILED,{bizCode:u.bizCode,data:u.data}),u;const{meetingID:d="",ctrlID:l="",user:p={},mediaContent:f={},initialMediaState:h={},tk:m=""}=u.data;t.config.request.meetingID=d,t.config.request.ctrlID=l,t.config.request.userID=p.userID,t.config.request.voteTk=m,t.request.setDefaultHeader("X-Y-Ctrl-Id",l),t.emitter.emit(exports.MeEvent.INIT,Object.assign(Object.assign({},p),{mediaContent:f,initialMediaState:h})),t.state=exports.STATE.JOINED,t.emitter.emit(exports.EVENT.STATE,{state:t.state});const g=()=>{t.state!==exports.STATE.READY&&(t.state=exports.STATE.READY,t.emitter.emit(exports.EVENT.STATE,{state:t.state}))},v=S(t),x=yield P(v,t);return yield U(v,t),"undefined"!=typeof Worker&&t.worker?(t.status.polling.running=!0,t.worker.postMessage({topics:v,meetingID:d,clientID:e,inboxes:x,status:!0}),t.worker.onmessage=e=>{"pollingStarted"!==e.data?"pollingStopped"!==e.data?(console.log("[Polling]",e.data),t.emitter.emit(e.data.event,e.data)):t.status.polling.running=!1:g()}):(t.status.polling.running=!0,N(x,t),g()),t.status.keepalive.running=!0,R(t),u.data=Object.assign(Object.assign({},u.data),o.data),u}))}}function Q(t){return function(r){return e(this,void 0,void 0,(function*(){r||(r={resultInfo:{bizCode:901359}});const{prefix:e,meetingID:s}=t.config.request,i=yield t.request.post(`${e.ctrl}meetings/${s}/leave`,r);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),C(t),k(t),z(t),t.cleanup(),i}))}}function W(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:r}=t.config.request,s=yield t.request.post(`${e.ctrl}meetings/${r}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),C(t),k(t),z(t),t.cleanup(),s}))}}function F(t){return function(r){return e(this,void 0,void 0,(function*(){const{prefix:e}=t.config.request;return yield t.request.post(`${e.ctrl}meetingNum/${r}/end`)}))}}class X{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=G(e)}static getInstance(e){return this.instance?this.instance:this.instance=new X(e)}}function z(e){if(e.config.singleton){const{baseURL:t,modules:r,singleton:s}=e.config,i={baseURL:t,modules:r,worker:e.worker,singleton:s},n=X.getInstance(i);n&&(n.meeting=G(i))}}Object.defineProperty(X,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.Chat=class extends w{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/chat/historyMsg`,t)}))}},exports.Info=A,exports.Invite=H,exports.LiveStream=class extends w{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:r,body:s,stime:i}=e;if(s){if(i&&(this.data.jetlag=i),"full"===r){const{liveStreams:e=[]}=s;if(!e.length)return;const t=[];this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,t.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return v({status:t,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),s.liveStreams||(this.data.resultInfo={}),null===(t=s.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform));const r=this.data.status.map((e=>e));-1===t?r.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):r.splice(t,1,{platform:r[t].platform||"",status:e.requesting?r[t].status||"stopped":e.status||""}),this.data.status=r})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/liveStream/setting`,t)}))}},exports.Me=M,exports.Qa=class extends w{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;f(t)&&!l(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(e,t){let r=e.get(t.question.id);const{clientID:s}=this.ctx.config.request;switch(t.command){case"addQuestion":r=this.createQuestion(t.question),e.set(t.question.id,r),this.emitter.emit("questionAdd",{question:r,selfSent:r.sender.endpointID===s});break;case"dismissQuestion":if(!r)break;r.sender.endpointID!==s?r.status="close":r.isTop=!1,e.set(t.question.id,r),this.emitter.emit("questionUpdate",{question:r});break;case"reopenQuestion":r?(r.status="open",r.isTop=t.question.isTop,e.set(t.question.id,r)):(r=this.createQuestion(t.question),e.set(t.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"updateQuestion":r?(r=Object.assign(Object.assign(Object.assign({},r),t.question),{topSort:t.question.isTop?this.data.topSort++:0}),e.set(t.question.id,r)):(r=this.createQuestion(t.question),e.set(t.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteQuestion":if(!r)break;r.sender.endpointID!==s?e.delete(t.question.id):(r.status="delete",r.isTop=!1,r.answers.clear(),e.set(t.question.id,r)),this.emitter.emit("questionDelete",{question:r});break;case"answerQuestion":r?r.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(r=this.createQuestion(t.question),r.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteAnswer":r&&(r.answers.delete(t.answer.id),this.emitter.emit("questionUpdate",{question:r}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/qa`,t)}))}},exports.Recording=class extends w{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:r,stime:s}=e;if(r)return s&&(this.data.jetlag=s),this.data.isPracticeSession="started"===r.status&&this.data.status===r.status&&0===r.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),r),"starting"===r.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=r.status||this.data.status),this.data.resultInfo=r.resultInfo||{},["full","update"].includes(t)?(r.recordUsers&&(this.data.recording.recordUsers=r.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/designatedUsers`,t)}))}participantAdd(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/add`,t)}))}participantDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/delete`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}getByIds(t){return e(this,void 0,void 0,(function*(){const{prefix:{user:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/subject/getByIds`,t)}))}recordLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/layout`,t)}))}},exports.Setting=class extends w{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:r}=e;["full","update"].includes(t)&&v(r,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}},exports.SpotlightVideo=class extends w{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:t}=e;if(!t||!t.userIDs)return;this.data.userIDs=t.userIDs;t.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/view/spotlight`,e)}},exports.Transcript=class extends w{constructor(e){super(e,"transcript")}_topic(){return"transcript"}_bindOn(){this.ctx.emitter.on("transcriptMsg",(e=>{const{body:t}=e;this.emitter.emit("transcriptMsg",t)}))}cleanup(){this.emitter.all=new Map}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/transcript/historyMsg`,t)}))}},exports.Users=V,exports.View=class extends w{constructor(e){super(e,"view")}_topic(){const{endpointType:e,role:t}=this.ctx.modules.me.data;return e===exports.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:t===exports.ROLE.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:r,body:s}=e;s&&("meetingView"===r?Object.keys(s).forEach((e=>{this.data[e]=s[e]})):this.data[t]=s)}updatePersonalLayouts(e){const{state:t,body:r}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),r.personalLayouts.forEach((e=>{const{subscriber:r={userID:-1}}=e,s=r.userID||r.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[s]=e:delete this.data.personalLayouts[s]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/layout/template/info`,{params:t})}))}addVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/add`,t)}))}editVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/edit`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}editTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/edit`,t)}))}addTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/add`,t)}))}deleteTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/delete`,t)}))}getDefaultTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getDefaultTemplates`,{params:t})}))}changeDefaultTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/changeDefaultTemplate`,t)}))}perspectiveBind(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/perspective/bind`,t)}))}},exports.Vote=class extends w{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:r}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[r]=t,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:t})})),this.ctx.emitter.on(exports.MeEvent.LOBBYCHANGE,(e=>{e&&(this.data.vote={})}))}getVotes(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${r}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${r}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${r}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${r}meetings/${s}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${r}meetings/${s}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/vote/inProgress`,{params:{tk:e&&e.tk||s}})}},exports.Words=class extends w{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:t,body:r}=e;if(!r)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data});"full"===t&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:r.content,time:(new Date).getTime(),durationType:r.durationType,duration:1e3*r.duration},...this.data.barrageRecord],r.wordsDisplayStatus=!0,-1!==r.duration&&(this.data.timer=setTimeout((()=>{r.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=r.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*r.duration)),v(r,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(exports.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}},exports.createMeeting=function(e){return e.singleton?X.getInstance(e).meeting:G(e)},exports.reset=z;
|
package/dist/meeting.esm.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t,i,r){return new(i||(i=Promise))((function(s,n){function o(e){try{c(r.next(e))}catch(t){n(t)}}function a(e){try{c(r.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}function t(e){return{all:e=e||new Map,on:function(t,i){var r=e.get(t);r?r.push(i):e.set(t,[i])},off:function(t,i){var r=e.get(t);r&&(i?r.splice(r.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var r=e.get(t);r&&r.slice().map((function(e){e(i)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,i)}))}}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(e,t){var r="__lodash_hash_undefined__",s=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",f="[object Promise]",h="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",q="[object Float32Array]",I="[object Float64Array]",D="[object Int8Array]",E="[object Int16Array]",$="[object Int32Array]",O="[object Uint8Array]",_="[object Uint8ClampedArray]",w="[object Uint16Array]",A="[object Uint32Array]",T=/\w*$/,S=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[b]=U[x]=U[o]=U[a]=U[q]=U[I]=U[D]=U[E]=U[$]=U[d]=U[l]=U[p]=U[h]=U[m]=U[g]=U[v]=U[O]=U[_]=U[w]=U[A]=!0,U["[object Error]"]=U[c]=U[y]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,C="object"==typeof i&&i&&i.Object===Object&&i||P||Function("return this")(),k=t&&!t.nodeType&&t,N=k&&e&&!e.nodeType&&e,R=N&&N.exports===k;function L(e,t){return e.set(t[0],t[1]),e}function H(e,t){return e.add(t),e}function M(e,t,i,r){var s=-1,n=e?e.length:0;for(r&&n&&(i=e[++s]);++s<n;)i=t(i,e[s],s,e);return i}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(i){}return t}function B(e){var t=-1,i=Array(e.size);return e.forEach((function(e,r){i[++t]=[r,e]})),i}function G(e,t){return function(i){return e(t(i))}}function Y(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var Q,F=Array.prototype,W=Function.prototype,X=Object.prototype,z=C["__core-js_shared__"],J=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=W.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=R?C.Buffer:void 0,re=C.Symbol,se=C.Uint8Array,ne=G(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=F.splice,ue=Object.getOwnPropertySymbols,de=ie?ie.isBuffer:void 0,le=G(Object.keys,Object),pe=Ne(C,"DataView"),fe=Ne(C,"Map"),he=Ne(C,"Promise"),me=Ne(C,"Set"),ge=Ne(C,"WeakMap"),ve=Ne(Object,"create"),ye=Ve(pe),be=Ve(fe),xe=Ve(he),qe=Ve(me),Ie=Ve(ge),De=re?re.prototype:void 0,Ee=De?De.valueOf:void 0;function $e(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function Oe(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function _e(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function we(e){this.__data__=new Oe(e)}function Ae(e,t){var i=Ge(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],r=i.length,s=!!r;for(var o in e)!t&&!Z.call(e,o)||s&&("length"==o||He(o,r))||i.push(o);return i}function Te(e,t,i){var r=e[t];Z.call(e,t)&&Be(r,i)&&(void 0!==i||t in e)||(e[t]=i)}function Se(e,t){for(var i=e.length;i--;)if(Be(e[i][0],t))return i;return-1}function je(e,t,i,r,s,f,y){var S;if(r&&(S=f?r(e,s,f,y):r(e)),void 0!==S)return S;if(!We(e))return e;var j=Ge(e);if(j){if(S=function(e){var t=e.length,i=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(i.index=e.index,i.input=e.input);return i}(e),!t)return function(e,t){var i=-1,r=e.length;t||(t=Array(r));for(;++i<r;)t[i]=e[i];return t}(e,S)}else{var P=Le(e),C=P==c||P==u;if(Qe(e))return function(e,t){if(t)return e.slice();var i=new e.constructor(e.length);return e.copy(i),i}(e,t);if(P==p||P==n||C&&!f){if(V(e))return f?e:{};if(S=function(e){return"function"!=typeof e.constructor||Me(e)?{}:(t=ne(e),We(t)?oe(t):{});var t}(C?{}:e),!t)return function(e,t){return Ce(e,Re(e),t)}(e,function(e,t){return e&&Ce(t,Xe(t),e)}(S,e))}else{if(!U[P])return f?e:{};S=function(e,t,i,r){var s=e.constructor;switch(t){case b:return Pe(e);case o:case a:return new s(+e);case x:return function(e,t){var i=t?Pe(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,r);case q:case I:case D:case E:case $:case O:case _:case w:case A:return function(e,t){var i=t?Pe(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(e,r);case d:return function(e,t,i){return M(t?i(B(e),!0):B(e),L,new e.constructor)}(e,r,i);case l:case g:return new s(e);case h:return function(e){var t=new e.constructor(e.source,T.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,i){return M(t?i(Y(e),!0):Y(e),H,new e.constructor)}(e,r,i);case v:return n=e,Ee?Object(Ee.call(n)):{}}var n}(e,P,je,t)}}y||(y=new we);var k=y.get(e);if(k)return k;if(y.set(e,S),!j)var N=i?function(e){return function(e,t,i){var r=t(e);return Ge(e)?r:function(e,t){for(var i=-1,r=t.length,s=e.length;++i<r;)e[s+i]=t[i];return e}(r,i(e))}(e,Xe,Re)}(e):Xe(e);return function(e,t){for(var i=-1,r=e?e.length:0;++i<r&&!1!==t(e[i],i,e););}(N||e,(function(s,n){N&&(s=e[n=s]),Te(S,n,je(s,t,i,r,n,e,y))})),S}function Ue(e){return!(!We(e)||(t=e,J&&J in t))&&(Fe(e)||V(e)?te:S).test(Ve(e));var t}function Pe(e){var t=new e.constructor(e.byteLength);return new se(t).set(new se(e)),t}function Ce(e,t,i,r){i||(i={});for(var s=-1,n=t.length;++s<n;){var o=t[s],a=r?r(i[o],e[o],o,i,e):void 0;Te(i,o,void 0===a?e[o]:a)}return i}function ke(e,t){var i,r,s=e.__data__;return("string"==(r=typeof(i=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==i:null===i)?s["string"==typeof t?"string":"hash"]:s.map}function Ne(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return Ue(i)?i:void 0}$e.prototype.clear=function(){this.__data__=ve?ve(null):{}},$e.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},$e.prototype.get=function(e){var t=this.__data__;if(ve){var i=t[e];return i===r?void 0:i}return Z.call(t,e)?t[e]:void 0},$e.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},$e.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?r:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,i=Se(t,e);return!(i<0)&&(i==t.length-1?t.pop():ce.call(t,i,1),!0)},Oe.prototype.get=function(e){var t=this.__data__,i=Se(t,e);return i<0?void 0:t[i][1]},Oe.prototype.has=function(e){return Se(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var i=this.__data__,r=Se(i,e);return r<0?i.push([e,t]):i[r][1]=t,this},_e.prototype.clear=function(){this.__data__={hash:new $e,map:new(fe||Oe),string:new $e}},_e.prototype.delete=function(e){return ke(this,e).delete(e)},_e.prototype.get=function(e){return ke(this,e).get(e)},_e.prototype.has=function(e){return ke(this,e).has(e)},_e.prototype.set=function(e,t){return ke(this,e).set(e,t),this},we.prototype.clear=function(){this.__data__=new Oe},we.prototype.delete=function(e){return this.__data__.delete(e)},we.prototype.get=function(e){return this.__data__.get(e)},we.prototype.has=function(e){return this.__data__.has(e)},we.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Oe){var r=i.__data__;if(!fe||r.length<199)return r.push([e,t]),this;i=this.__data__=new _e(r)}return i.set(e,t),this};var Re=ue?G(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function He(e,t){return!!(t=null==t?s:t)&&("number"==typeof e||j.test(e))&&e>-1&&e%1==0&&e<t}function Me(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Be(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=x||fe&&Le(new fe)!=d||he&&Le(he.resolve())!=f||me&&Le(new me)!=m||ge&&Le(new ge)!=y)&&(Le=function(e){var t=ee.call(e),i=t==p?e.constructor:void 0,r=i?Ve(i):void 0;if(r)switch(r){case ye:return x;case be:return d;case xe:return f;case qe:return m;case Ie:return y}return t});var Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}(e.length)&&!Fe(e)}var Qe=de||function(){return!1};function Fe(e){var t=We(e)?ee.call(e):"";return t==c||t==u}function We(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xe(e){return Ye(e)?Ae(e):function(e){if(!Me(e))return le(e);var t=[];for(var i in Object(e))Z.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}e.exports=function(e){return je(e,!0,!0)}}(r,r.exports);var s=r.exports;const n=e=>({get(t,i,r){if("__isProxy"===i)return!0;const s=Reflect.get(t,i);return Array.isArray(s)?s:"object"==typeof s&&null!==s?s.__isProxy?s:new Proxy(s,n(e)):s},set(t,i,r,n){const o=t[i];r=f(r)&&r.__isProxy?s(r):r;const a=Reflect.set(t,i,r,n);return((e,t)=>e!==t&&(e==e||t==t))(r,o)&&e.emit(`${b(i)}Change`,r),a}}),o=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:t="",timeout:i=6e4}=e;let{headers:r={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,t)=>{if(!t)return e;const i=[];Object.keys(t).forEach((e=>{const r=t[e];if(null==r)return;let s;Array.isArray(r)?(s=r,e+="[]"):s=[r],s.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),i.push(`${o(e)}=${o(t)}`)}))}));const r=i.join("&");if(r){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e})(t.replace(/^\/+/,""),e.params),r=Object.assign(r,this._defaultHeaders),Object.keys(r).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(r["Content-Type"]=r[e],delete r[e])})),h(e.data)&&(e.data=e.data.buffer),m(e.data)&&(r&&!r["Content-Type"]&&(r["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=r,e.timeout=i,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx&&void 0!==wx.request?d(e):u(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,i){return this._errorHandler?this._request(Object.assign(i||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(i||{},{url:e,method:"POST",data:t}))}}class c{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new c((t=>{e=t}));return{cancel:e,token:t}}}const u=e=>new Promise(((t,i)=>{const{data:r=null,url:s,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),s,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){i(new Error("E_JSON_PARSE"+u.responseText))}else i({url:s,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(i({url:s,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{i(new Error("Network Error")),u=null},u.ontimeout=()=>{i(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===r&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),i(e),u=null)})),u.send(r)})),d=e=>new Promise(((t,i)=>{const{data:r=null,url:s,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:s,data:r,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):i({url:s,statusCode:e.statusCode})},fail(e){i("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=e=>null==e,f=e=>"object"==typeof e&&null!==e,h=e=>{let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t},m=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},g=()=>{const e=[],t="0123456789abcdef";for(let i=0;i<36;i++)e[i]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},v=(e,t)=>e?(Object.entries(e).forEach((e=>{const[i,r]=[e[0],e[1]];if(null!==r)return f(r)&&!l(r)?(t[i]||(t[i]={}),void(t[i]=v(r,t[i]))):void(t[i]=r)})),t):t,y=/-(\w)/g,b=e=>e.replace(y,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:x}=Object.prototype,q=(e,t)=>x.call(e,t),I=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let i;i=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,i);for(const r in e)q(e,r)&&(i[r]=I(e[r],t));return i};var D,E,$,O,_;!function(e){e.REQUEST_ERROR="requestError",e.STATE="state",e.FAILED="failed"}(D||(D={})),function(e){e[e.CLOSE=0]="CLOSE",e[e.JOINED=1]="JOINED",e[e.READY=2]="READY"}(E||(E={})),function(e){e.WEBAPP="webApp",e.WEBCTRL="webCtrl",e.WECHATMP="weChatMP",e.SUPERVISION="supervision",e.BIGSCREEN="bigScreen",e.DESKTOP="desktop",e.MOBILE="mobile",e.VCS="vcs",e.SIP="sip",e.H323="h323",e.PSTN="pstn"}($||($={})),function(e){e.HOST="host",e.COHOST="coHost",e.ATTENDEE="attendee",e.AUDIENCE="audience"}(O||(O={})),function(e){e.STARTED="started",e.PAUSED="paused",e.STARTING="starting",e.STOPPED="stopped"}(_||(_={}));class w{constructor(e,i){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=i,this.ctx=e,this.emitter=t(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},n(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},n(this.emitter))}reactive(e){if(f(e)){const t=new Map,i=(e,r)=>{Object.keys(e).forEach((s=>{!1===r&&s in this.data&&(e[s]=this.data[s]);const n=t=>e[s]=t,o=`${b(s)}Change`;this.emitter.on(o,n),t.set(o,n),f(e[s])&&!l(e[s])&&i(e[s],!0)}))};i(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class A extends w{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:i}=e;("full"===t||"update"===t)&&v(i,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;v({participantCount:t},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:i},headers:{language:e.language}})}}function T(e){const t=[],{isInLobby:i}=e.modules.me.data;return i?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((i=>{const r=e.modules[i]._topic();r&&(Array.isArray(r)?r.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(r)||t.push(r))})),t)}function S(t,i){return e(this,void 0,void 0,(function*(){const{meetingID:e,clientID:r}=i.config.request,s=yield i.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:r,meetingId:e},inboxes:t}),n=[];return s.data&&Object.keys(s.data).forEach((e=>{n.push({name:e,seqId:s.data[e].maxSeqId,limit:200})})),n}))}function j(t,i){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r,clientID:s}=i.config.request,n=yield i.request.post(`${e}meetings/${r}/subscribe`,{endpointID:s,topics:t}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),i.emitter.emit(e.event,e)}))}))}function U(t,i,r){return e(this,void 0,void 0,(function*(){const{inboxes:s,clientID:n,meetingID:o,cancelToken:a,status:c}=i;yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:s},{cancelToken:a,withResDate:!0});if(!e||!e.data)return;const{data:i={}}=e;Object.keys(i).forEach((e=>{const t=s.find((t=>t.name===e));if(t){if(t.seqId=i[e].maxSeqId,!i[e].items)return;i[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),r(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&U(t,i,r)}),200))}))}const P=(t,i)=>e(void 0,void 0,void 0,(function*(){const{meetingID:e,clientID:r}=i.config.request;i.status.polling.running=!0,U(i.request,{inboxes:t,clientID:r,meetingID:e,cancelToken:i.config.request.cancelToken.token,status:i.status.polling},(e=>{i.emitter.emit(e.event,e)}))}));function C(e){e.status.polling.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=c.source()}function k(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:r,userID:s}=t.config.request;t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.request.post(`${i}meetings/${r}/users/${s}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token});if(!e||!e.data)return;const{data:n={}}=e,o=n.interval||"";o&&(t.status.keepalive.interval=o)})))(),t.status.keepalive.running&&(t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&k(t)}),1e3*t.status.keepalive.interval))}))}const N=e=>{e.status.keepalive.running=!1,e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null)};var R;!function(e){e.INIT="meInit",e.UPDATE="meUpdate",e.UPDATE_USER_STATE="updateUserState",e.ROLECHANGE="meRoleChange",e.AUDIOCHANGE="meAudioChange",e.HANDUPCHANGE="meHandupChange",e.SETAUDIO="setAudio",e.VIDEOCHANGE="meVideoChange",e.SETVIDEO="setVideo",e.SHARECHANGE="meShareChange",e.DISPLAYNAMECHANGE="meDisplayNameChange",e.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",e.LOBBYCHANGE="meLobbyChange",e.BARRAGECHANGE="meBarrageChange",e.LEAVE="leave"}(R||(R={}));class L extends w{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const t=t=>e(this,void 0,void 0,(function*(){if("role"in t&&t.role!==this.data.role){const e=this.data.role;v({role:t.role},this.data),t.role!==O.AUDIENCE&&e!==O.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(R.ROLECHANGE,t.role),this.ctx.emitter.emit(R.ROLECHANGE,t.role)}})),i=e=>{var t,i,r,s;if("audio"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.audio;(!p(n)&&n!==(null===(t=this.data.audio)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(i=this.data.audio)||void 0===i?void 0:i.sendOn)||!p(a))&&(v({audio:e.audio},this.data),this.emitter.emit(R.AUDIOCHANGE,{deviceOn:p(n)?null===(r=this.data.audio)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(s=this.data.audio)||void 0===s?void 0:s.sendOn:o,opBy:a}))}},r=e=>{var t,i,r,s;if("video"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.video;(!p(n)&&n!==(null===(t=this.data.video)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(i=this.data.video)||void 0===i?void 0:i.sendOn))&&(v({video:e.video},this.data),this.emitter.emit(R.VIDEOCHANGE,{deviceOn:p(n)?null===(r=this.data.video)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(s=this.data.video)||void 0===s?void 0:s.sendOn:o,opBy:a}))}},s=e=>{var t,i,r,s;if("share"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.share;(!p(n)&&n!==(null===(t=this.data.share)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(i=this.data.share)||void 0===i?void 0:i.sendOn))&&(v({share:e.share},this.data),this.emitter.emit(R.SHARECHANGE,{deviceOn:p(n)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(s=this.data.share)||void 0===s?void 0:s.sendOn:o,opBy:a}))}},n=e=>{e.displayName&&e.displayName!==this.data.displayName&&(v({displayName:e.displayName},this.data),this.emitter.emit(R.DISPLAYNAMECHANGE,e.displayName))},o=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(v({isHandUp:e.isHandUp},this.data),this.emitter.emit(R.HANDUPCHANGE,e.isHandUp))},a=e=>{"isSpotlightVideo"in e&&(v({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(R.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},c=t=>e(this,void 0,void 0,(function*(){if("isInLobby"in t&&t.isInLobby!==this.data.isInLobby){v({isInLobby:t.isInLobby},this.data);const e=!1===t.isInLobby?"inLobbyChange":void 0;yield this.rePolling(e),this.emitter.emit(R.LOBBYCHANGE,t.isInLobby),this.ctx.emitter.emit(R.LOBBYCHANGE,t.isInLobby)}})),u=e=>{if(!e.barrage)return;let t=null;if(!e.barrage.wordsDisplayStatus)return t=null,delete e.barrage,this.data.barrage=t||void 0,void this.emitter.emit(R.BARRAGECHANGE,t);if(!e.barrage.receiver)return;t={content:e.barrage.content,contentType:e.barrage.contentType,type:e.barrage.type,duration:e.barrage.duration,position:e.barrage.position};let{role:i}=this.data;if(this.data.endpointType===$.SUPERVISION){const{info:e}=this.ctx.modules;i="webinar"===e.meetingType?O.AUDIENCE:O.ATTENDEE}i===O.HOST||i===O.COHOST?t=e.barrage.receiver.host?t:null:i===O.ATTENDEE?t=e.barrage.receiver.attendee?t:null:i===O.AUDIENCE&&(t=e.barrage.receiver.audience?t:null),delete e.barrage,this.data.barrage=t||void 0,this.emitter.emit(R.BARRAGECHANGE,t)},d=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),C(this.ctx),oe(this.ctx),this.emitter.emit(R.LEAVE,e.resultInfo),this.ctx.cleanup(e.resultInfo))},l=e=>{t(e),i(e),r(e),s(e),n(e),o(e),c(e),a(e),u(e),d(e)};this.ctx.emitter.on(R.INIT,(e=>{v(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(R.UPDATE,(e=>{l(e),v(e,this.data)})),this.ctx.emitter.on(D.STATE,(({state:e})=>{e===E.READY&&this.data.endpointType!==$.SUPERVISION&&this.emitter.emit(R.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:i={users:[]}}=t;if("delete"===e){const e=i.users[0];return e.leave=!0,void d(e)}const r=i.users.find((e=>e.userID===this.data.userID));r&&(l(r),v(r,this.data))})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(R.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(R.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){d({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(e,t=!1){if(!t){const{role:t,initialMediaState:i}=this.data;e.audio.sendOn=e.audio.sendOn&&i.audio.sendOn,e.video.sendOn=e.video.sendOn&&i.video.sendOn,t===O.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(e,this.data),this.ctx.request.post(`${i}meetings/${r}/updateUserState`,e)}rePolling(t){return e(this,void 0,void 0,(function*(){const{ctx:e}=this;C(e);const i=T(e),r=yield S(i,e);if(t&&this.emitter.emit(R.UPDATE_USER_STATE,{data:this.data,event:t}),yield j(i,e),"undefined"!=typeof Worker&&e.worker){const{meetingID:t,clientID:s}=e.config.request;e.worker.postMessage({inboxes:r,topics:i,meetingID:t,clientID:s,rePolling:!0})}else yield P(r,e)}))}}class H extends w{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/chat/historyMsg`,t)}))}}class M extends w{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:i}=e;if(t&&t.users){if("full"===i)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===i&&-1!==t?v(e,this.data.callRecordUsers[t]):"update"===i&&-1===t&&(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/invite`,e)}}class V extends w{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:i,body:r,stime:s}=e;if(r){if(s&&(this.data.jetlag=s),"full"===i){const{liveStreams:e=[]}=r;if(!e.length)return;const t=[];this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,t.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return v({status:t,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),r.liveStreams||(this.data.resultInfo={}),null===(t=r.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform));const i=this.data.status.map((e=>e));-1===t?i.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):i.splice(t,1,{platform:i[t].platform||"",status:e.requesting?i[t].status||"stopped":e.status||""}),this.data.status=i})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/liveStream/setting`,t)}))}}class B extends w{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;f(t)&&!l(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(e,t){let i=e.get(t.question.id);const{clientID:r}=this.ctx.config.request;switch(t.command){case"addQuestion":i=this.createQuestion(t.question),e.set(t.question.id,i),this.emitter.emit("questionAdd",{question:i,selfSent:i.sender.endpointID===r});break;case"dismissQuestion":if(!i)break;i.sender.endpointID!==r?i.status="close":i.isTop=!1,e.set(t.question.id,i),this.emitter.emit("questionUpdate",{question:i});break;case"reopenQuestion":i?(i.status="open",i.isTop=t.question.isTop,e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"updateQuestion":i?(i=Object.assign(Object.assign(Object.assign({},i),t.question),{topSort:t.question.isTop?this.data.topSort++:0}),e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"deleteQuestion":if(!i)break;i.sender.endpointID!==r?e.delete(t.question.id):(i.status="delete",i.isTop=!1,i.answers.clear(),e.set(t.question.id,i)),this.emitter.emit("questionDelete",{question:i});break;case"answerQuestion":i?i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(i=this.createQuestion(t.question),i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"deleteAnswer":i&&(i.answers.delete(t.answer.id),this.emitter.emit("questionUpdate",{question:i}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/qa`,t)}))}}class G extends w{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:i,stime:r}=e;if(i)return r&&(this.data.jetlag=r),this.data.isPracticeSession="started"===i.status&&this.data.status===i.status&&0===i.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),i),"starting"===i.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=i.status||this.data.status),this.data.resultInfo=i.resultInfo||{},["full","update"].includes(t)?(i.recordUsers&&(this.data.recording.recordUsers=i.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/designatedUsers`,t)}))}participantAdd(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/add`,t)}))}participantDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/delete`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}getByIds(t){return e(this,void 0,void 0,(function*(){const{prefix:{user:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/subject/getByIds`,t)}))}recordLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/layout`,t)}))}}class Y extends w{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:i}=e;["full","update"].includes(t)&&v(i,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}}class Q extends w{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:t}=e;if(!t||!t.userIDs)return;this.data.userIDs=t.userIDs;t.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(R.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(R.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/view/spotlight`,e)}}class F extends w{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:t}=this.ctx.modules.me.data;return t===$.SUPERVISION?["interactive","broadcast"]:e===O.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:t,state:i})=>{if(e.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:r={}}=e;if("delete"!==i||"delete"===i&&[901357,901358,901352,901351,901350,901349].includes(r.bizCode||-1))return void this.ctx.emitter.emit(R.UPDATE,e);let s=!1;switch(t){case"interactiveUsers":e.isInLobby||(s=!0);break;case"broadcastUsers":e.isInLobby||e.role!==O.AUDIENCE||(s=!0);break;case"lobbyUsers":e.isInLobby&&(s=!0)}const n={};s&&(n.leave=!0),this.ctx.emitter.emit(R.UPDATE,Object.assign(Object.assign({},e),n))},t=({updateUsers:t,state:i,sourceKey:r})=>{if("full"===i)return this.data[r]=t.map((t=>(t.displayNamePinyin=F.setDisplayNamePinyinProp?F.setDisplayNamePinyinProp(t.displayName):t.displayName,e(t,{event:r,state:i}),t))),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!0}),this.data[r];void 0===this.data[r]&&(this.data[r]=[]);const{data:s,emitter:n}=this;return t.forEach((t=>{const o=s[r].findIndex((e=>t.userID===e.userID));if("delete"===i&&-1!==o){const[e]=this.data[r].splice(o,1);n.emit(`${r}Delete`,{user:e,resultInfo:t.resultInfo})}else if("update"===i&&-1!==o){const e=this.data[r][o];this.updateUserProps(t,e),v(t,e),this.data[r][o]=I(e),this.emitter.emit(`${r}Update`,{user:this.data[r][o]})}else"update"===i&&-1===o&&(t.displayNamePinyin=F.setDisplayNamePinyinProp?F.setDisplayNamePinyinProp(t.displayName):t.displayName,s[r].push(t),this.emitter.emit(`${r}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:r,state:i})})),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!1}),this.data[r]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:i,body:r}=e;t({updateUsers:r.users,state:i,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:i,body:r}=e;t({updateUsers:r.users,state:i,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:i,body:r}=e;t({updateUsers:r.users,state:i,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:i,body:r}=e;t({updateUsers:r.users,state:i,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=F.setDisplayNamePinyinProp?F.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/users/${e}/callStats`)}callStatsReport(e){if(!e.userID)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e.userID}/callStats/report`,e)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}class W extends w{constructor(e){super(e,"view")}_topic(){const{endpointType:e,role:t}=this.ctx.modules.me.data;return e===$.WEBCTRL?["hostAttendee","audience","advCtrl"]:t===O.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:i,body:r}=e;r&&("meetingView"===i?Object.keys(r).forEach((e=>{this.data[e]=r[e]})):this.data[t]=r)}updatePersonalLayouts(e){const{state:t,body:i}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),i.personalLayouts.forEach((e=>{const{subscriber:i={userID:-1}}=e,r=i.userID||i.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[r]=e:delete this.data.personalLayouts[r]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/layout/template/info`,{params:t})}))}addVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/add`,t)}))}editVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/edit`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}editTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/edit`,t)}))}addTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/add`,t)}))}deleteTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/delete`,t)}))}getDefaultTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getDefaultTemplates`,{params:t})}))}changeDefaultTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/changeDefaultTemplate`,t)}))}perspectiveBind(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/perspective/bind`,t)}))}}class X extends w{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:i}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[i]=t,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:t})})),this.ctx.emitter.on(R.LOBBYCHANGE,(e=>{e&&(this.data.vote={})}))}getVotes(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:i},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${i}meetings/${r}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:i},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${i}meetings/${r}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/vote/inProgress`,{params:{tk:e&&e.tk||r}})}}class z extends w{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:t,body:i}=e;if(!i)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(R.UPDATE,{barrage:this.data});"full"===t&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:i.content,time:(new Date).getTime(),durationType:i.durationType,duration:1e3*i.duration},...this.data.barrageRecord],i.wordsDisplayStatus=!0,-1!==i.duration&&(this.data.timer=setTimeout((()=>{i.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=i.wordsDisplayStatus,this.ctx.emitter.emit(R.UPDATE,{barrage:this.data})}),1e3*i.duration)),v(i,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(R.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(R.ROLECHANGE,(()=>this.ctx.emitter.emit(R.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}}class J extends w{constructor(e){super(e,"transcript")}_topic(){return"transcript"}_bindOn(){this.ctx.emitter.on("transcriptMsg",(e=>{const{body:t}=e;this.emitter.emit("transcriptMsg",t)}))}cleanup(){this.emitter.all=new Map}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/transcript/historyMsg`,t)}))}}function K(e){const{baseURL:i,modules:r,worker:s,singleton:n}=e;r.findIndex((e=>e===L))<0&&r.push(L),r.findIndex((e=>e===A))<0&&r.push(A);const o=`${g()}_${((e=new Date,t)=>{const i={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const r in i)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[r]:("00"+i[r]).substr((""+i[r]).length)));return t})(new Date,"MMddHHmmss")}`,u={config:{baseURL:i,modules:r,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:s,emitter:t(),request:new a({baseURL:i,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=g()},error:e=>{u.emitter.emit(D.REQUEST_ERROR,e)}}),modules:{},state:E.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:e=>{u.state!==E.CLOSE&&(u.worker&&u.worker.terminate(),u.config.request.location="",u.config.request.meetingID="",u.config.request.ctrlID="",u.config.request.sessionID="",u.config.request.userID=-1,u.config.request.voteTk="",u.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),u.state=E.CLOSE,u.emitter.emit(D.STATE,{state:u.state,reason:e}))}};return u}function Z(e){const t=K(e);return t.worker&&("undefined"!=typeof Worker?t.worker.postMessage({baseURL:t.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!l(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const i=new e(t);t.modules[i.moduleName]=i}))}(t.config.modules,t),t.emitter.on(D.STATE,(({state:e})=>{e===E.CLOSE&&Object.keys(t.modules).forEach((e=>{t.modules[e].cleanup()}))})),Object.assign({config:t.config,request:t.request,get state(){return t.state},on:t.emitter.on,off:t.emitter.off,join:ee(t),leave:te(t),end:ie(t),endMeeting:re(t)},t.modules)}function ee(t){return function(i){var r;return e(this,void 0,void 0,(function*(){const{clientID:e}=t.config.request,s=`${null===(r=i.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${e}_${i.meetingNum}`;t.config.request.sessionID=s,t.request.setDefaultHeader("X-Y-Session-Id",s);const{prefix:n}=t.config.request,o=yield t.request.get(`${n.ctrl}credential`,{params:{meetingNum:i.meetingNum,pwd:i.pwd,url:i.url,mobileCode:i.mobileCode,mobile:i.mobile,regEmail:i.regEmail,accEmail:i.accEmail,tk:i.tk,displayName:i.displayName},headers:{"X-Y-Endpoint-Type":i.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return t.emitter.emit(D.FAILED,{bizCode:o.bizCode,data:o.data}),o;t.config.request.location=c,t.request.setDefaultHeader("X-Y-Location",c),delete i.pwd,delete i.url;const u=yield t.request.post(`${n.ctrl}join?meetingNum=${i.meetingNum}&credential=${a}`,i,{headers:{"X-Y-Endpoint-Type":i.endpointType,"X-Y-Endpoint-Id":e}});if(!u||u&&u.ret<=-1)return t.emitter.emit(D.FAILED,{bizCode:u.bizCode,data:u.data}),u;const{meetingID:d="",ctrlID:l="",user:p={},mediaContent:f={},initialMediaState:h={},tk:m=""}=u.data;t.config.request.meetingID=d,t.config.request.ctrlID=l,t.config.request.userID=p.userID,t.config.request.voteTk=m,t.request.setDefaultHeader("X-Y-Ctrl-Id",l),t.emitter.emit(R.INIT,Object.assign(Object.assign({},p),{mediaContent:f,initialMediaState:h})),t.state=E.JOINED,t.emitter.emit(D.STATE,{state:t.state});const g=()=>{t.state!==E.READY&&(t.state=E.READY,t.emitter.emit(D.STATE,{state:t.state}))},v=T(t),y=yield S(v,t);return yield j(v,t),"undefined"!=typeof Worker&&t.worker?(t.status.polling.running=!0,t.worker.postMessage({topics:v,meetingID:d,clientID:e,inboxes:y,status:!0}),t.worker.onmessage=e=>{"pollingStarted"!==e.data?"pollingStopped"!==e.data?(console.log("[Polling]",e.data),t.emitter.emit(e.data.event,e.data)):t.status.polling.running=!1:g()}):(t.status.polling.running=!0,P(y,t),g()),t.status.keepalive.running=!0,k(t),u.data=Object.assign(Object.assign({},u.data),o.data),u}))}}function te(t){return function(i){return e(this,void 0,void 0,(function*(){i||(i={resultInfo:{bizCode:901359}});const{prefix:e,meetingID:r}=t.config.request,s=yield t.request.post(`${e.ctrl}meetings/${r}/leave`,i);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),C(t),N(t),oe(t),t.cleanup(),s}))}}function ie(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:i}=t.config.request,r=yield t.request.post(`${e.ctrl}meetings/${i}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),C(t),N(t),oe(t),t.cleanup(),r}))}}function re(t){return function(i){return e(this,void 0,void 0,(function*(){const{prefix:e}=t.config.request;return yield t.request.post(`${e.ctrl}meetingNum/${i}/end`)}))}}class se{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=Z(e)}static getInstance(e){return this.instance?this.instance:this.instance=new se(e)}}function ne(e){return e.singleton?se.getInstance(e).meeting:Z(e)}function oe(e){if(e.config.singleton){const{baseURL:t,modules:i,singleton:r}=e.config,s={baseURL:t,modules:i,worker:e.worker,singleton:r},n=se.getInstance(s);n&&(n.meeting=Z(s))}}Object.defineProperty(se,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null});export{H as Chat,$ as ENDPOINT_TYPE,D as EVENT,A as Info,M as Invite,V as LiveStream,L as Me,R as MeEvent,B as Qa,_ as RECORD_STATUS,O as ROLE,G as Recording,E as STATE,Y as Setting,Q as SpotlightVideo,J as Transcript,F as Users,W as View,X as Vote,z as Words,ne as createMeeting,oe as reset};
|
|
1
|
+
function e(e,t,i,r){return new(i||(i=Promise))((function(s,n){function o(e){try{c(r.next(e))}catch(t){n(t)}}function a(e){try{c(r.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}function t(e){return{all:e=e||new Map,on:function(t,i){var r=e.get(t);r?r.push(i):e.set(t,[i])},off:function(t,i){var r=e.get(t);r&&(i?r.splice(r.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var r=e.get(t);r&&r.slice().map((function(e){e(i)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,i)}))}}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(e,t){var r="__lodash_hash_undefined__",s=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",f="[object Promise]",h="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",q="[object Float32Array]",I="[object Float64Array]",D="[object Int8Array]",E="[object Int16Array]",$="[object Int32Array]",O="[object Uint8Array]",_="[object Uint8ClampedArray]",w="[object Uint16Array]",A="[object Uint32Array]",T=/\w*$/,S=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[b]=U[x]=U[o]=U[a]=U[q]=U[I]=U[D]=U[E]=U[$]=U[d]=U[l]=U[p]=U[h]=U[m]=U[g]=U[v]=U[O]=U[_]=U[w]=U[A]=!0,U["[object Error]"]=U[c]=U[y]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,C="object"==typeof i&&i&&i.Object===Object&&i||P||Function("return this")(),k=t&&!t.nodeType&&t,N=k&&e&&!e.nodeType&&e,R=N&&N.exports===k;function L(e,t){return e.set(t[0],t[1]),e}function H(e,t){return e.add(t),e}function M(e,t,i,r){var s=-1,n=e?e.length:0;for(r&&n&&(i=e[++s]);++s<n;)i=t(i,e[s],s,e);return i}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(i){}return t}function B(e){var t=-1,i=Array(e.size);return e.forEach((function(e,r){i[++t]=[r,e]})),i}function G(e,t){return function(i){return e(t(i))}}function Y(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var Q,F=Array.prototype,W=Function.prototype,X=Object.prototype,z=C["__core-js_shared__"],J=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=W.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=R?C.Buffer:void 0,re=C.Symbol,se=C.Uint8Array,ne=G(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=F.splice,ue=Object.getOwnPropertySymbols,de=ie?ie.isBuffer:void 0,le=G(Object.keys,Object),pe=Ne(C,"DataView"),fe=Ne(C,"Map"),he=Ne(C,"Promise"),me=Ne(C,"Set"),ge=Ne(C,"WeakMap"),ve=Ne(Object,"create"),ye=Ve(pe),be=Ve(fe),xe=Ve(he),qe=Ve(me),Ie=Ve(ge),De=re?re.prototype:void 0,Ee=De?De.valueOf:void 0;function $e(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function Oe(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function _e(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function we(e){this.__data__=new Oe(e)}function Ae(e,t){var i=Ge(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],r=i.length,s=!!r;for(var o in e)!t&&!Z.call(e,o)||s&&("length"==o||He(o,r))||i.push(o);return i}function Te(e,t,i){var r=e[t];Z.call(e,t)&&Be(r,i)&&(void 0!==i||t in e)||(e[t]=i)}function Se(e,t){for(var i=e.length;i--;)if(Be(e[i][0],t))return i;return-1}function je(e,t,i,r,s,f,y){var S;if(r&&(S=f?r(e,s,f,y):r(e)),void 0!==S)return S;if(!We(e))return e;var j=Ge(e);if(j){if(S=function(e){var t=e.length,i=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(i.index=e.index,i.input=e.input);return i}(e),!t)return function(e,t){var i=-1,r=e.length;t||(t=Array(r));for(;++i<r;)t[i]=e[i];return t}(e,S)}else{var P=Le(e),C=P==c||P==u;if(Qe(e))return function(e,t){if(t)return e.slice();var i=new e.constructor(e.length);return e.copy(i),i}(e,t);if(P==p||P==n||C&&!f){if(V(e))return f?e:{};if(S=function(e){return"function"!=typeof e.constructor||Me(e)?{}:(t=ne(e),We(t)?oe(t):{});var t}(C?{}:e),!t)return function(e,t){return Ce(e,Re(e),t)}(e,function(e,t){return e&&Ce(t,Xe(t),e)}(S,e))}else{if(!U[P])return f?e:{};S=function(e,t,i,r){var s=e.constructor;switch(t){case b:return Pe(e);case o:case a:return new s(+e);case x:return function(e,t){var i=t?Pe(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,r);case q:case I:case D:case E:case $:case O:case _:case w:case A:return function(e,t){var i=t?Pe(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(e,r);case d:return function(e,t,i){return M(t?i(B(e),!0):B(e),L,new e.constructor)}(e,r,i);case l:case g:return new s(e);case h:return function(e){var t=new e.constructor(e.source,T.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,i){return M(t?i(Y(e),!0):Y(e),H,new e.constructor)}(e,r,i);case v:return n=e,Ee?Object(Ee.call(n)):{}}var n}(e,P,je,t)}}y||(y=new we);var k=y.get(e);if(k)return k;if(y.set(e,S),!j)var N=i?function(e){return function(e,t,i){var r=t(e);return Ge(e)?r:function(e,t){for(var i=-1,r=t.length,s=e.length;++i<r;)e[s+i]=t[i];return e}(r,i(e))}(e,Xe,Re)}(e):Xe(e);return function(e,t){for(var i=-1,r=e?e.length:0;++i<r&&!1!==t(e[i],i,e););}(N||e,(function(s,n){N&&(s=e[n=s]),Te(S,n,je(s,t,i,r,n,e,y))})),S}function Ue(e){return!(!We(e)||(t=e,J&&J in t))&&(Fe(e)||V(e)?te:S).test(Ve(e));var t}function Pe(e){var t=new e.constructor(e.byteLength);return new se(t).set(new se(e)),t}function Ce(e,t,i,r){i||(i={});for(var s=-1,n=t.length;++s<n;){var o=t[s],a=r?r(i[o],e[o],o,i,e):void 0;Te(i,o,void 0===a?e[o]:a)}return i}function ke(e,t){var i,r,s=e.__data__;return("string"==(r=typeof(i=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==i:null===i)?s["string"==typeof t?"string":"hash"]:s.map}function Ne(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return Ue(i)?i:void 0}$e.prototype.clear=function(){this.__data__=ve?ve(null):{}},$e.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},$e.prototype.get=function(e){var t=this.__data__;if(ve){var i=t[e];return i===r?void 0:i}return Z.call(t,e)?t[e]:void 0},$e.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},$e.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?r:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,i=Se(t,e);return!(i<0)&&(i==t.length-1?t.pop():ce.call(t,i,1),!0)},Oe.prototype.get=function(e){var t=this.__data__,i=Se(t,e);return i<0?void 0:t[i][1]},Oe.prototype.has=function(e){return Se(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var i=this.__data__,r=Se(i,e);return r<0?i.push([e,t]):i[r][1]=t,this},_e.prototype.clear=function(){this.__data__={hash:new $e,map:new(fe||Oe),string:new $e}},_e.prototype.delete=function(e){return ke(this,e).delete(e)},_e.prototype.get=function(e){return ke(this,e).get(e)},_e.prototype.has=function(e){return ke(this,e).has(e)},_e.prototype.set=function(e,t){return ke(this,e).set(e,t),this},we.prototype.clear=function(){this.__data__=new Oe},we.prototype.delete=function(e){return this.__data__.delete(e)},we.prototype.get=function(e){return this.__data__.get(e)},we.prototype.has=function(e){return this.__data__.has(e)},we.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Oe){var r=i.__data__;if(!fe||r.length<199)return r.push([e,t]),this;i=this.__data__=new _e(r)}return i.set(e,t),this};var Re=ue?G(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function He(e,t){return!!(t=null==t?s:t)&&("number"==typeof e||j.test(e))&&e>-1&&e%1==0&&e<t}function Me(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Be(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=x||fe&&Le(new fe)!=d||he&&Le(he.resolve())!=f||me&&Le(new me)!=m||ge&&Le(new ge)!=y)&&(Le=function(e){var t=ee.call(e),i=t==p?e.constructor:void 0,r=i?Ve(i):void 0;if(r)switch(r){case ye:return x;case be:return d;case xe:return f;case qe:return m;case Ie:return y}return t});var Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}(e.length)&&!Fe(e)}var Qe=de||function(){return!1};function Fe(e){var t=We(e)?ee.call(e):"";return t==c||t==u}function We(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xe(e){return Ye(e)?Ae(e):function(e){if(!Me(e))return le(e);var t=[];for(var i in Object(e))Z.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}e.exports=function(e){return je(e,!0,!0)}}(r,r.exports);var s=r.exports;const n=e=>({get(t,i,r){if("__isProxy"===i)return!0;const s=Reflect.get(t,i);return Array.isArray(s)?s:"object"==typeof s&&null!==s?s.__isProxy?s:new Proxy(s,n(e)):s},set(t,i,r,n){const o=t[i];r=f(r)&&r.__isProxy?s(r):r;const a=Reflect.set(t,i,r,n);return((e,t)=>e!==t&&(e==e||t==t))(r,o)&&e.emit(`${b(i)}Change`,r),a}}),o=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{timeout:t=6e4}=e;let{headers:i={}}=e;return e.url=D(this.baseURL,e.url||""),e.url=((e,t)=>{if(!t)return e;const i=[];Object.keys(t).forEach((e=>{const r=t[e];if(null==r)return;let s;Array.isArray(r)?(s=r,e+="[]"):s=[r],s.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),i.push(`${o(e)}=${o(t)}`)}))}));const r=i.join("&");if(r){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e})(e.url.replace(/^\/+/,""),e.params),i=Object.assign(i,this._defaultHeaders),Object.keys(i).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(i["Content-Type"]=i[e],delete i[e])})),h(e.data)&&(e.data=e.data.buffer),m(e.data)&&(i&&!i["Content-Type"]&&(i["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=i,e.timeout=t,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx&&void 0!==wx.request?d(e):u(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,i){return this._errorHandler?this._request(Object.assign(i||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(i||{},{url:e,method:"POST",data:t}))}}class c{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new c((t=>{e=t}));return{cancel:e,token:t}}}const u=e=>new Promise(((t,i)=>{const{data:r=null,url:s,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),s,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){i(new Error("E_JSON_PARSE"+u.responseText))}else i({url:s,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(i({url:s,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{i(new Error("Network Error")),u=null},u.ontimeout=()=>{i(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===r&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),i(e),u=null)})),u.send(r)})),d=e=>new Promise(((t,i)=>{const{data:r=null,url:s,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:s,data:r,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):i({url:s,statusCode:e.statusCode})},fail(e){i("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=e=>null==e,f=e=>"object"==typeof e&&null!==e,h=e=>{let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t},m=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},g=()=>{const e=[],t="0123456789abcdef";for(let i=0;i<36;i++)e[i]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},v=(e,t)=>e?(Object.entries(e).forEach((e=>{const[i,r]=[e[0],e[1]];if(null!==r)return f(r)&&!l(r)?(t[i]||(t[i]={}),void(t[i]=v(r,t[i]))):void(t[i]=r)})),t):t,y=/-(\w)/g,b=e=>e.replace(y,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:x}=Object.prototype,q=(e,t)=>x.call(e,t),I=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let i;i=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,i);for(const r in e)q(e,r)&&(i[r]=I(e[r],t));return i},D=(e,t)=>e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?((e,t)=>t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e)(e,t):t;var E,$,O,_,w;!function(e){e.REQUEST_ERROR="requestError",e.STATE="state",e.FAILED="failed"}(E||(E={})),function(e){e[e.CLOSE=0]="CLOSE",e[e.JOINED=1]="JOINED",e[e.READY=2]="READY"}($||($={})),function(e){e.WEBAPP="webApp",e.WEBCTRL="webCtrl",e.WECHATMP="weChatMP",e.SUPERVISION="supervision",e.BIGSCREEN="bigScreen",e.DESKTOP="desktop",e.MOBILE="mobile",e.VCS="vcs",e.SIP="sip",e.H323="h323",e.PSTN="pstn"}(O||(O={})),function(e){e.HOST="host",e.COHOST="coHost",e.ATTENDEE="attendee",e.AUDIENCE="audience"}(_||(_={})),function(e){e.STARTED="started",e.PAUSED="paused",e.STARTING="starting",e.STOPPED="stopped"}(w||(w={}));class A{constructor(e,i){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=i,this.ctx=e,this.emitter=t(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},n(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},n(this.emitter))}reactive(e){if(f(e)){const t=new Map,i=(e,r)=>{Object.keys(e).forEach((s=>{!1===r&&s in this.data&&(e[s]=this.data[s]);const n=t=>e[s]=t,o=`${b(s)}Change`;this.emitter.on(o,n),t.set(o,n),f(e[s])&&!l(e[s])&&i(e[s],!0)}))};i(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class T extends A{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:i}=e;("full"===t||"update"===t)&&v(i,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;v({participantCount:t},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:i},headers:{language:e.language}})}}function S(e){const t=[],{isInLobby:i}=e.modules.me.data;return i?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((i=>{const r=e.modules[i]._topic();r&&(Array.isArray(r)?r.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(r)||t.push(r))})),t)}function j(t,i){return e(this,void 0,void 0,(function*(){const{meetingID:e,clientID:r}=i.config.request,s=yield i.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:r,meetingId:e},inboxes:t}),n=[];return s.data&&Object.keys(s.data).forEach((e=>{n.push({name:e,seqId:s.data[e].maxSeqId,limit:200})})),n}))}function U(t,i){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r,clientID:s}=i.config.request,n=yield i.request.post(`${e}meetings/${r}/subscribe`,{endpointID:s,topics:t}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),i.emitter.emit(e.event,e)}))}))}function P(t,i,r){return e(this,void 0,void 0,(function*(){const{inboxes:s,clientID:n,meetingID:o,cancelToken:a,status:c}=i;yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:s},{cancelToken:a,withResDate:!0});if(!e||!e.data)return;const{data:i={}}=e;Object.keys(i).forEach((e=>{const t=s.find((t=>t.name===e));if(t){if(t.seqId=i[e].maxSeqId,!i[e].items)return;i[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),r(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&P(t,i,r)}),200))}))}const C=(t,i)=>e(void 0,void 0,void 0,(function*(){const{meetingID:e,clientID:r}=i.config.request;i.status.polling.running=!0,P(i.request,{inboxes:t,clientID:r,meetingID:e,cancelToken:i.config.request.cancelToken.token,status:i.status.polling},(e=>{i.emitter.emit(e.event,e)}))}));function k(e){e.status.polling.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=c.source()}function N(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:r,userID:s}=t.config.request;t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.request.post(`${i}meetings/${r}/users/${s}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token});if(!e||!e.data)return;const{data:n={}}=e,o=n.interval||"";o&&(t.status.keepalive.interval=o)})))(),t.status.keepalive.running&&(t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&N(t)}),1e3*t.status.keepalive.interval))}))}const R=e=>{e.status.keepalive.running=!1,e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null)};var L;!function(e){e.INIT="meInit",e.UPDATE="meUpdate",e.UPDATE_USER_STATE="updateUserState",e.ROLECHANGE="meRoleChange",e.AUDIOCHANGE="meAudioChange",e.HANDUPCHANGE="meHandupChange",e.SETAUDIO="setAudio",e.VIDEOCHANGE="meVideoChange",e.SETVIDEO="setVideo",e.SHARECHANGE="meShareChange",e.DISPLAYNAMECHANGE="meDisplayNameChange",e.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",e.LOBBYCHANGE="meLobbyChange",e.BARRAGECHANGE="meBarrageChange",e.LEAVE="leave"}(L||(L={}));class H extends A{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const t=t=>e(this,void 0,void 0,(function*(){if("role"in t&&t.role!==this.data.role){const e=this.data.role;v({role:t.role},this.data),t.role!==_.AUDIENCE&&e!==_.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(L.ROLECHANGE,t.role),this.ctx.emitter.emit(L.ROLECHANGE,t.role)}})),i=e=>{var t,i,r,s;if("audio"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.audio;(!p(n)&&n!==(null===(t=this.data.audio)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(i=this.data.audio)||void 0===i?void 0:i.sendOn)||!p(a))&&(v({audio:e.audio},this.data),this.emitter.emit(L.AUDIOCHANGE,{deviceOn:p(n)?null===(r=this.data.audio)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(s=this.data.audio)||void 0===s?void 0:s.sendOn:o,opBy:a}))}},r=e=>{var t,i,r,s;if("video"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.video;(!p(n)&&n!==(null===(t=this.data.video)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(i=this.data.video)||void 0===i?void 0:i.sendOn))&&(v({video:e.video},this.data),this.emitter.emit(L.VIDEOCHANGE,{deviceOn:p(n)?null===(r=this.data.video)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(s=this.data.video)||void 0===s?void 0:s.sendOn:o,opBy:a}))}},s=e=>{var t,i,r,s;if("share"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.share;(!p(n)&&n!==(null===(t=this.data.share)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(i=this.data.share)||void 0===i?void 0:i.sendOn))&&(v({share:e.share},this.data),this.emitter.emit(L.SHARECHANGE,{deviceOn:p(n)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(s=this.data.share)||void 0===s?void 0:s.sendOn:o,opBy:a}))}},n=e=>{e.displayName&&e.displayName!==this.data.displayName&&(v({displayName:e.displayName},this.data),this.emitter.emit(L.DISPLAYNAMECHANGE,e.displayName))},o=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(v({isHandUp:e.isHandUp},this.data),this.emitter.emit(L.HANDUPCHANGE,e.isHandUp))},a=e=>{"isSpotlightVideo"in e&&(v({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(L.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},c=t=>e(this,void 0,void 0,(function*(){if("isInLobby"in t&&t.isInLobby!==this.data.isInLobby){v({isInLobby:t.isInLobby},this.data);const e=!1===t.isInLobby?"inLobbyChange":void 0;yield this.rePolling(e),this.emitter.emit(L.LOBBYCHANGE,t.isInLobby),this.ctx.emitter.emit(L.LOBBYCHANGE,t.isInLobby)}})),u=e=>{if(!e.barrage)return;let t=null;if(!e.barrage.wordsDisplayStatus)return t=null,delete e.barrage,this.data.barrage=t||void 0,void this.emitter.emit(L.BARRAGECHANGE,t);if(!e.barrage.receiver)return;t={content:e.barrage.content,contentType:e.barrage.contentType,type:e.barrage.type,duration:e.barrage.duration,position:e.barrage.position};let{role:i}=this.data;if(this.data.endpointType===O.SUPERVISION){const{info:e}=this.ctx.modules;i="webinar"===e.meetingType?_.AUDIENCE:_.ATTENDEE}i===_.HOST||i===_.COHOST?t=e.barrage.receiver.host?t:null:i===_.ATTENDEE?t=e.barrage.receiver.attendee?t:null:i===_.AUDIENCE&&(t=e.barrage.receiver.audience?t:null),delete e.barrage,this.data.barrage=t||void 0,this.emitter.emit(L.BARRAGECHANGE,t)},d=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),k(this.ctx),ae(this.ctx),this.emitter.emit(L.LEAVE,e.resultInfo),this.ctx.cleanup(e.resultInfo))},l=e=>{t(e),i(e),r(e),s(e),n(e),o(e),c(e),a(e),u(e),d(e)};this.ctx.emitter.on(L.INIT,(e=>{v(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(L.UPDATE,(e=>{l(e),v(e,this.data)})),this.ctx.emitter.on(E.STATE,(({state:e})=>{e===$.READY&&this.data.endpointType!==O.SUPERVISION&&this.emitter.emit(L.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:i={users:[]}}=t;if("delete"===e){const e=i.users[0];return e.leave=!0,void d(e)}const r=i.users.find((e=>e.userID===this.data.userID));r&&(l(r),v(r,this.data))})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(L.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(L.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){d({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(e,t=!1){if(!t){const{role:t,initialMediaState:i}=this.data;e.audio.sendOn=e.audio.sendOn&&i.audio.sendOn,e.video.sendOn=e.video.sendOn&&i.video.sendOn,t===_.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(e,this.data),this.ctx.request.post(`${i}meetings/${r}/updateUserState`,e)}rePolling(t){return e(this,void 0,void 0,(function*(){const{ctx:e}=this;k(e);const i=S(e),r=yield j(i,e);if(t&&this.emitter.emit(L.UPDATE_USER_STATE,{data:this.data,event:t}),yield U(i,e),"undefined"!=typeof Worker&&e.worker){const{meetingID:t,clientID:s}=e.config.request;e.worker.postMessage({inboxes:r,topics:i,meetingID:t,clientID:s,rePolling:!0})}else yield C(r,e)}))}}class M extends A{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/chat/historyMsg`,t)}))}}class V extends A{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:i}=e;if(t&&t.users){if("full"===i)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=V.setDisplayNamePinyinProp?V.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===i&&-1!==t?v(e,this.data.callRecordUsers[t]):"update"===i&&-1===t&&(e.displayNamePinyin=V.setDisplayNamePinyinProp?V.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/invite`,e)}}class B extends A{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:i,body:r,stime:s}=e;if(r){if(s&&(this.data.jetlag=s),"full"===i){const{liveStreams:e=[]}=r;if(!e.length)return;const t=[];this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,t.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return v({status:t,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),r.liveStreams||(this.data.resultInfo={}),null===(t=r.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform));const i=this.data.status.map((e=>e));-1===t?i.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):i.splice(t,1,{platform:i[t].platform||"",status:e.requesting?i[t].status||"stopped":e.status||""}),this.data.status=i})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/liveStream/setting`,t)}))}}class G extends A{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;f(t)&&!l(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(e,t){let i=e.get(t.question.id);const{clientID:r}=this.ctx.config.request;switch(t.command){case"addQuestion":i=this.createQuestion(t.question),e.set(t.question.id,i),this.emitter.emit("questionAdd",{question:i,selfSent:i.sender.endpointID===r});break;case"dismissQuestion":if(!i)break;i.sender.endpointID!==r?i.status="close":i.isTop=!1,e.set(t.question.id,i),this.emitter.emit("questionUpdate",{question:i});break;case"reopenQuestion":i?(i.status="open",i.isTop=t.question.isTop,e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"updateQuestion":i?(i=Object.assign(Object.assign(Object.assign({},i),t.question),{topSort:t.question.isTop?this.data.topSort++:0}),e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"deleteQuestion":if(!i)break;i.sender.endpointID!==r?e.delete(t.question.id):(i.status="delete",i.isTop=!1,i.answers.clear(),e.set(t.question.id,i)),this.emitter.emit("questionDelete",{question:i});break;case"answerQuestion":i?i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(i=this.createQuestion(t.question),i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"deleteAnswer":i&&(i.answers.delete(t.answer.id),this.emitter.emit("questionUpdate",{question:i}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/qa`,t)}))}}class Y extends A{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:i,stime:r}=e;if(i)return r&&(this.data.jetlag=r),this.data.isPracticeSession="started"===i.status&&this.data.status===i.status&&0===i.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),i),"starting"===i.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=i.status||this.data.status),this.data.resultInfo=i.resultInfo||{},["full","update"].includes(t)?(i.recordUsers&&(this.data.recording.recordUsers=i.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/designatedUsers`,t)}))}participantAdd(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/add`,t)}))}participantDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/delete`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}getByIds(t){return e(this,void 0,void 0,(function*(){const{prefix:{user:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/subject/getByIds`,t)}))}recordLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/layout`,t)}))}}class Q extends A{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:i}=e;["full","update"].includes(t)&&v(i,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}}class F extends A{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:t}=e;if(!t||!t.userIDs)return;this.data.userIDs=t.userIDs;t.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(L.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(L.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/view/spotlight`,e)}}class W extends A{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:t}=this.ctx.modules.me.data;return t===O.SUPERVISION?["interactive","broadcast"]:e===_.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:t,state:i})=>{if(e.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:r={}}=e;if("delete"!==i||"delete"===i&&[901357,901358,901352,901351,901350,901349].includes(r.bizCode||-1))return void this.ctx.emitter.emit(L.UPDATE,e);let s=!1;switch(t){case"interactiveUsers":e.isInLobby||(s=!0);break;case"broadcastUsers":e.isInLobby||e.role!==_.AUDIENCE||(s=!0);break;case"lobbyUsers":e.isInLobby&&(s=!0)}const n={};s&&(n.leave=!0),this.ctx.emitter.emit(L.UPDATE,Object.assign(Object.assign({},e),n))},t=({updateUsers:t,state:i,sourceKey:r})=>{if("full"===i)return this.data[r]=t.map((t=>(t.displayNamePinyin=W.setDisplayNamePinyinProp?W.setDisplayNamePinyinProp(t.displayName):t.displayName,e(t,{event:r,state:i}),t))),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!0}),this.data[r];void 0===this.data[r]&&(this.data[r]=[]);const{data:s,emitter:n}=this;return t.forEach((t=>{const o=s[r].findIndex((e=>t.userID===e.userID));if("delete"===i&&-1!==o){const[e]=this.data[r].splice(o,1);n.emit(`${r}Delete`,{user:e,resultInfo:t.resultInfo})}else if("update"===i&&-1!==o){const e=this.data[r][o];this.updateUserProps(t,e),v(t,e),this.data[r][o]=I(e),this.emitter.emit(`${r}Update`,{user:this.data[r][o]})}else"update"===i&&-1===o&&(t.displayNamePinyin=W.setDisplayNamePinyinProp?W.setDisplayNamePinyinProp(t.displayName):t.displayName,s[r].push(t),this.emitter.emit(`${r}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:r,state:i})})),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!1}),this.data[r]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:i,body:r}=e;t({updateUsers:r.users,state:i,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:i,body:r}=e;t({updateUsers:r.users,state:i,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:i,body:r}=e;t({updateUsers:r.users,state:i,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:i,body:r}=e;t({updateUsers:r.users,state:i,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=W.setDisplayNamePinyinProp?W.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/users/${e}/callStats`)}callStatsReport(e){if(!e.userID)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e.userID}/callStats/report`,e)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}class X extends A{constructor(e){super(e,"view")}_topic(){const{endpointType:e,role:t}=this.ctx.modules.me.data;return e===O.WEBCTRL?["hostAttendee","audience","advCtrl"]:t===_.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:i,body:r}=e;r&&("meetingView"===i?Object.keys(r).forEach((e=>{this.data[e]=r[e]})):this.data[t]=r)}updatePersonalLayouts(e){const{state:t,body:i}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),i.personalLayouts.forEach((e=>{const{subscriber:i={userID:-1}}=e,r=i.userID||i.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[r]=e:delete this.data.personalLayouts[r]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/layout/template/info`,{params:t})}))}addVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/add`,t)}))}editVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/edit`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}editTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/edit`,t)}))}addTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/add`,t)}))}deleteTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/delete`,t)}))}getDefaultTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getDefaultTemplates`,{params:t})}))}changeDefaultTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/changeDefaultTemplate`,t)}))}perspectiveBind(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/perspective/bind`,t)}))}}class z extends A{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:i}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[i]=t,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:t})})),this.ctx.emitter.on(L.LOBBYCHANGE,(e=>{e&&(this.data.vote={})}))}getVotes(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:i},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${i}meetings/${r}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:i},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${i}meetings/${r}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/vote/inProgress`,{params:{tk:e&&e.tk||r}})}}class J extends A{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:t,body:i}=e;if(!i)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(L.UPDATE,{barrage:this.data});"full"===t&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:i.content,time:(new Date).getTime(),durationType:i.durationType,duration:1e3*i.duration},...this.data.barrageRecord],i.wordsDisplayStatus=!0,-1!==i.duration&&(this.data.timer=setTimeout((()=>{i.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=i.wordsDisplayStatus,this.ctx.emitter.emit(L.UPDATE,{barrage:this.data})}),1e3*i.duration)),v(i,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(L.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(L.ROLECHANGE,(()=>this.ctx.emitter.emit(L.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}}class K extends A{constructor(e){super(e,"transcript")}_topic(){return"transcript"}_bindOn(){this.ctx.emitter.on("transcriptMsg",(e=>{const{body:t}=e;this.emitter.emit("transcriptMsg",t)}))}cleanup(){this.emitter.all=new Map}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/transcript/historyMsg`,t)}))}}function Z(e){const{baseURL:i,modules:r,worker:s,singleton:n}=e;r.findIndex((e=>e===H))<0&&r.push(H),r.findIndex((e=>e===T))<0&&r.push(T);const o=`${g()}_${((e=new Date,t)=>{const i={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const r in i)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[r]:("00"+i[r]).substr((""+i[r]).length)));return t})(new Date,"MMddHHmmss")}`,u={config:{baseURL:i,modules:r,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:s,emitter:t(),request:new a({baseURL:i,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=g()},error:e=>{u.emitter.emit(E.REQUEST_ERROR,e)}}),modules:{},state:$.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:e=>{u.state!==$.CLOSE&&(u.worker&&u.worker.terminate(),u.config.request.location="",u.config.request.meetingID="",u.config.request.ctrlID="",u.config.request.sessionID="",u.config.request.userID=-1,u.config.request.voteTk="",u.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),u.state=$.CLOSE,u.emitter.emit(E.STATE,{state:u.state,reason:e}))}};return u}function ee(e){const t=Z(e);return t.worker&&("undefined"!=typeof Worker?t.worker.postMessage({baseURL:t.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!l(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const i=new e(t);t.modules[i.moduleName]=i}))}(t.config.modules,t),t.emitter.on(E.STATE,(({state:e})=>{e===$.CLOSE&&Object.keys(t.modules).forEach((e=>{t.modules[e].cleanup()}))})),Object.assign({config:t.config,request:t.request,get state(){return t.state},on:t.emitter.on,off:t.emitter.off,join:te(t),leave:ie(t),end:re(t),endMeeting:se(t)},t.modules)}function te(t){return function(i){var r;return e(this,void 0,void 0,(function*(){const{clientID:e}=t.config.request,s=`${null===(r=i.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${e}_${i.meetingNum}`;t.config.request.sessionID=s,t.request.setDefaultHeader("X-Y-Session-Id",s);const{prefix:n}=t.config.request,o=yield t.request.get(`${n.ctrl}credential`,{params:{meetingNum:i.meetingNum,pwd:i.pwd,url:i.url,mobileCode:i.mobileCode,mobile:i.mobile,regEmail:i.regEmail,accEmail:i.accEmail,tk:i.tk,displayName:i.displayName},headers:{"X-Y-Endpoint-Type":i.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return t.emitter.emit(E.FAILED,{bizCode:o.bizCode,data:o.data}),o;t.config.request.location=c,t.request.setDefaultHeader("X-Y-Location",c),delete i.pwd,delete i.url;const u=yield t.request.post(`${n.ctrl}join?meetingNum=${i.meetingNum}&credential=${a}`,i,{headers:{"X-Y-Endpoint-Type":i.endpointType,"X-Y-Endpoint-Id":e}});if(!u||u&&u.ret<=-1)return t.emitter.emit(E.FAILED,{bizCode:u.bizCode,data:u.data}),u;const{meetingID:d="",ctrlID:l="",user:p={},mediaContent:f={},initialMediaState:h={},tk:m=""}=u.data;t.config.request.meetingID=d,t.config.request.ctrlID=l,t.config.request.userID=p.userID,t.config.request.voteTk=m,t.request.setDefaultHeader("X-Y-Ctrl-Id",l),t.emitter.emit(L.INIT,Object.assign(Object.assign({},p),{mediaContent:f,initialMediaState:h})),t.state=$.JOINED,t.emitter.emit(E.STATE,{state:t.state});const g=()=>{t.state!==$.READY&&(t.state=$.READY,t.emitter.emit(E.STATE,{state:t.state}))},v=S(t),y=yield j(v,t);return yield U(v,t),"undefined"!=typeof Worker&&t.worker?(t.status.polling.running=!0,t.worker.postMessage({topics:v,meetingID:d,clientID:e,inboxes:y,status:!0}),t.worker.onmessage=e=>{"pollingStarted"!==e.data?"pollingStopped"!==e.data?(console.log("[Polling]",e.data),t.emitter.emit(e.data.event,e.data)):t.status.polling.running=!1:g()}):(t.status.polling.running=!0,C(y,t),g()),t.status.keepalive.running=!0,N(t),u.data=Object.assign(Object.assign({},u.data),o.data),u}))}}function ie(t){return function(i){return e(this,void 0,void 0,(function*(){i||(i={resultInfo:{bizCode:901359}});const{prefix:e,meetingID:r}=t.config.request,s=yield t.request.post(`${e.ctrl}meetings/${r}/leave`,i);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),k(t),R(t),ae(t),t.cleanup(),s}))}}function re(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:i}=t.config.request,r=yield t.request.post(`${e.ctrl}meetings/${i}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),k(t),R(t),ae(t),t.cleanup(),r}))}}function se(t){return function(i){return e(this,void 0,void 0,(function*(){const{prefix:e}=t.config.request;return yield t.request.post(`${e.ctrl}meetingNum/${i}/end`)}))}}class ne{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=ee(e)}static getInstance(e){return this.instance?this.instance:this.instance=new ne(e)}}function oe(e){return e.singleton?ne.getInstance(e).meeting:ee(e)}function ae(e){if(e.config.singleton){const{baseURL:t,modules:i,singleton:r}=e.config,s={baseURL:t,modules:i,worker:e.worker,singleton:r},n=ne.getInstance(s);n&&(n.meeting=ee(s))}}Object.defineProperty(ne,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null});export{M as Chat,O as ENDPOINT_TYPE,E as EVENT,T as Info,V as Invite,B as LiveStream,H as Me,L as MeEvent,G as Qa,w as RECORD_STATUS,_ as ROLE,Y as Recording,$ as STATE,Q as Setting,F as SpotlightVideo,K as Transcript,W as Users,X as View,z as Vote,J as Words,oe as createMeeting,ae as reset};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var YlinkSDKMeeting=function(e){"use strict";function t(e,t,i,r){return new(i||(i=Promise))((function(s,n){function o(e){try{c(r.next(e))}catch(t){n(t)}}function a(e){try{c(r.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}function i(e){return{all:e=e||new Map,on:function(t,i){var r=e.get(t);r?r.push(i):e.set(t,[i])},off:function(t,i){var r=e.get(t);r&&(i?r.splice(r.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var r=e.get(t);r&&r.slice().map((function(e){e(i)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,i)}))}}}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(e,t){var i="__lodash_hash_undefined__",s=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",f="[object Promise]",h="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",w="[object Uint32Array]",A=/\w*$/,S=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[b]=U[x]=U[o]=U[a]=U[E]=U[q]=U[I]=U[D]=U[T]=U[d]=U[l]=U[p]=U[h]=U[m]=U[g]=U[v]=U[O]=U[$]=U[_]=U[w]=!0,U["[object Error]"]=U[c]=U[y]=!1;var j="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof r&&r&&r.Object===Object&&r||j||Function("return this")(),C=t&&!t.nodeType&&t,R=C&&e&&!e.nodeType&&e,k=R&&R.exports===C;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,i,r){var s=-1,n=e?e.length:0;for(r&&n&&(i=e[++s]);++s<n;)i=t(i,e[s],s,e);return i}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(i){}return t}function B(e){var t=-1,i=Array(e.size);return e.forEach((function(e,r){i[++t]=[r,e]})),i}function G(e,t){return function(i){return e(t(i))}}function Y(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var Q,W=Array.prototype,F=Function.prototype,X=Object.prototype,z=N["__core-js_shared__"],J=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=F.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=k?N.Buffer:void 0,re=N.Symbol,se=N.Uint8Array,ne=G(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=W.splice,ue=Object.getOwnPropertySymbols,de=ie?ie.isBuffer:void 0,le=G(Object.keys,Object),pe=Re(N,"DataView"),fe=Re(N,"Map"),he=Re(N,"Promise"),me=Re(N,"Set"),ge=Re(N,"WeakMap"),ve=Re(Object,"create"),ye=Ve(pe),be=Ve(fe),xe=Ve(he),Ee=Ve(me),qe=Ve(ge),Ie=re?re.prototype:void 0,De=Ie?Ie.valueOf:void 0;function Te(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function Oe(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function $e(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function _e(e){this.__data__=new Oe(e)}function we(e,t){var i=Ge(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],r=i.length,s=!!r;for(var o in e)!t&&!Z.call(e,o)||s&&("length"==o||Me(o,r))||i.push(o);return i}function Ae(e,t,i){var r=e[t];Z.call(e,t)&&Be(r,i)&&(void 0!==i||t in e)||(e[t]=i)}function Se(e,t){for(var i=e.length;i--;)if(Be(e[i][0],t))return i;return-1}function Pe(e,t,i,r,s,f,y){var S;if(r&&(S=f?r(e,s,f,y):r(e)),void 0!==S)return S;if(!Fe(e))return e;var P=Ge(e);if(P){if(S=function(e){var t=e.length,i=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(i.index=e.index,i.input=e.input);return i}(e),!t)return function(e,t){var i=-1,r=e.length;t||(t=Array(r));for(;++i<r;)t[i]=e[i];return t}(e,S)}else{var j=Le(e),N=j==c||j==u;if(Qe(e))return function(e,t){if(t)return e.slice();var i=new e.constructor(e.length);return e.copy(i),i}(e,t);if(j==p||j==n||N&&!f){if(V(e))return f?e:{};if(S=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),Fe(t)?oe(t):{});var t}(N?{}:e),!t)return function(e,t){return Ne(e,ke(e),t)}(e,function(e,t){return e&&Ne(t,Xe(t),e)}(S,e))}else{if(!U[j])return f?e:{};S=function(e,t,i,r){var s=e.constructor;switch(t){case b:return je(e);case o:case a:return new s(+e);case x:return function(e,t){var i=t?je(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,r);case E:case q:case I:case D:case T:case O:case $:case _:case w:return function(e,t){var i=t?je(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(e,r);case d:return function(e,t,i){return H(t?i(B(e),!0):B(e),L,new e.constructor)}(e,r,i);case l:case g:return new s(e);case h:return function(e){var t=new e.constructor(e.source,A.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,i){return H(t?i(Y(e),!0):Y(e),M,new e.constructor)}(e,r,i);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,j,Pe,t)}}y||(y=new _e);var C=y.get(e);if(C)return C;if(y.set(e,S),!P)var R=i?function(e){return function(e,t,i){var r=t(e);return Ge(e)?r:function(e,t){for(var i=-1,r=t.length,s=e.length;++i<r;)e[s+i]=t[i];return e}(r,i(e))}(e,Xe,ke)}(e):Xe(e);return function(e,t){for(var i=-1,r=e?e.length:0;++i<r&&!1!==t(e[i],i,e););}(R||e,(function(s,n){R&&(s=e[n=s]),Ae(S,n,Pe(s,t,i,r,n,e,y))})),S}function Ue(e){return!(!Fe(e)||(t=e,J&&J in t))&&(We(e)||V(e)?te:S).test(Ve(e));var t}function je(e){var t=new e.constructor(e.byteLength);return new se(t).set(new se(e)),t}function Ne(e,t,i,r){i||(i={});for(var s=-1,n=t.length;++s<n;){var o=t[s],a=r?r(i[o],e[o],o,i,e):void 0;Ae(i,o,void 0===a?e[o]:a)}return i}function Ce(e,t){var i,r,s=e.__data__;return("string"==(r=typeof(i=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==i:null===i)?s["string"==typeof t?"string":"hash"]:s.map}function Re(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return Ue(i)?i:void 0}Te.prototype.clear=function(){this.__data__=ve?ve(null):{}},Te.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Te.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===i?void 0:r}return Z.call(t,e)?t[e]:void 0},Te.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Te.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?i:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,i=Se(t,e);return!(i<0)&&(i==t.length-1?t.pop():ce.call(t,i,1),!0)},Oe.prototype.get=function(e){var t=this.__data__,i=Se(t,e);return i<0?void 0:t[i][1]},Oe.prototype.has=function(e){return Se(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var i=this.__data__,r=Se(i,e);return r<0?i.push([e,t]):i[r][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Te,map:new(fe||Oe),string:new Te}},$e.prototype.delete=function(e){return Ce(this,e).delete(e)},$e.prototype.get=function(e){return Ce(this,e).get(e)},$e.prototype.has=function(e){return Ce(this,e).has(e)},$e.prototype.set=function(e,t){return Ce(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new Oe},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Oe){var r=i.__data__;if(!fe||r.length<199)return r.push([e,t]),this;i=this.__data__=new $e(r)}return i.set(e,t),this};var ke=ue?G(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?s:t)&&("number"==typeof e||P.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Be(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=x||fe&&Le(new fe)!=d||he&&Le(he.resolve())!=f||me&&Le(new me)!=m||ge&&Le(new ge)!=y)&&(Le=function(e){var t=ee.call(e),i=t==p?e.constructor:void 0,r=i?Ve(i):void 0;if(r)switch(r){case ye:return x;case be:return d;case xe:return f;case Ee:return m;case qe:return y}return t});var Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}(e.length)&&!We(e)}var Qe=de||function(){return!1};function We(e){var t=Fe(e)?ee.call(e):"";return t==c||t==u}function Fe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xe(e){return Ye(e)?we(e):function(e){if(!He(e))return le(e);var t=[];for(var i in Object(e))Z.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}e.exports=function(e){return Pe(e,!0,!0)}}(s,s.exports);var n=s.exports;const o=e=>({get(t,i,r){if("__isProxy"===i)return!0;const s=Reflect.get(t,i);return Array.isArray(s)?s:"object"==typeof s&&null!==s?s.__isProxy?s:new Proxy(s,o(e)):s},set(t,i,r,s){const o=t[i];r=h(r)&&r.__isProxy?n(r):r;const a=Reflect.set(t,i,r,s);return((e,t)=>e!==t&&(e==e||t==t))(r,o)&&e.emit(`${x(i)}Change`,r),a}}),a=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class c{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:t="",timeout:i=6e4}=e;let{headers:r={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,t)=>{if(!t)return e;const i=[];Object.keys(t).forEach((e=>{const r=t[e];if(null==r)return;let s;Array.isArray(r)?(s=r,e+="[]"):s=[r],s.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),i.push(`${a(e)}=${a(t)}`)}))}));const r=i.join("&");if(r){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e})(t.replace(/^\/+/,""),e.params),r=Object.assign(r,this._defaultHeaders),Object.keys(r).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(r["Content-Type"]=r[e],delete r[e])})),m(e.data)&&(e.data=e.data.buffer),g(e.data)&&(r&&!r["Content-Type"]&&(r["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=r,e.timeout=i,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx&&void 0!==wx.request?l(e):d(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,i){return this._errorHandler?this._request(Object.assign(i||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(i||{},{url:e,method:"POST",data:t}))}}class u{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new u((t=>{e=t}));return{cancel:e,token:t}}}const d=e=>new Promise(((t,i)=>{const{data:r=null,url:s,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),s,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){i(new Error("E_JSON_PARSE"+u.responseText))}else i({url:s,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(i({url:s,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{i(new Error("Network Error")),u=null},u.ontimeout=()=>{i(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===r&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),i(e),u=null)})),u.send(r)})),l=e=>new Promise(((t,i)=>{const{data:r=null,url:s,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:s,data:r,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):i({url:s,statusCode:e.statusCode})},fail(e){i("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),p=Array.isArray,f=e=>null==e,h=e=>"object"==typeof e&&null!==e,m=e=>{let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t},g=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},v=()=>{const e=[],t="0123456789abcdef";for(let i=0;i<36;i++)e[i]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},y=(e,t)=>e?(Object.entries(e).forEach((e=>{const[i,r]=[e[0],e[1]];if(null!==r)return h(r)&&!p(r)?(t[i]||(t[i]={}),void(t[i]=y(r,t[i]))):void(t[i]=r)})),t):t,b=/-(\w)/g,x=e=>e.replace(b,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:E}=Object.prototype,q=(e,t)=>E.call(e,t),I=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let i;i=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,i);for(const r in e)q(e,r)&&(i[r]=I(e[r],t));return i};var D,T,O,$,_;e.EVENT=void 0,(D=e.EVENT||(e.EVENT={})).REQUEST_ERROR="requestError",D.STATE="state",D.FAILED="failed",e.STATE=void 0,(T=e.STATE||(e.STATE={}))[T.CLOSE=0]="CLOSE",T[T.JOINED=1]="JOINED",T[T.READY=2]="READY",e.ENDPOINT_TYPE=void 0,(O=e.ENDPOINT_TYPE||(e.ENDPOINT_TYPE={})).WEBAPP="webApp",O.WEBCTRL="webCtrl",O.WECHATMP="weChatMP",O.SUPERVISION="supervision",O.BIGSCREEN="bigScreen",O.DESKTOP="desktop",O.MOBILE="mobile",O.VCS="vcs",O.SIP="sip",O.H323="h323",O.PSTN="pstn",e.ROLE=void 0,($=e.ROLE||(e.ROLE={})).HOST="host",$.COHOST="coHost",$.ATTENDEE="attendee",$.AUDIENCE="audience",e.RECORD_STATUS=void 0,(_=e.RECORD_STATUS||(e.RECORD_STATUS={})).STARTED="started",_.PAUSED="paused",_.STARTING="starting",_.STOPPED="stopped";class w{constructor(e,t){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=t,this.ctx=e,this.emitter=i(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},o(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},o(this.emitter))}reactive(e){if(h(e)){const t=new Map,i=(e,r)=>{Object.keys(e).forEach((s=>{!1===r&&s in this.data&&(e[s]=this.data[s]);const n=t=>e[s]=t,o=`${x(s)}Change`;this.emitter.on(o,n),t.set(o,n),h(e[s])&&!p(e[s])&&i(e[s],!0)}))};i(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class A extends w{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:i}=e;("full"===t||"update"===t)&&y(i,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;y({participantCount:t},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:i},headers:{language:e.language}})}}function S(e){const t=[],{isInLobby:i}=e.modules.me.data;return i?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((i=>{const r=e.modules[i]._topic();r&&(Array.isArray(r)?r.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(r)||t.push(r))})),t)}function P(e,i){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:r}=i.config.request,s=yield i.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:r,meetingId:t},inboxes:e}),n=[];return s.data&&Object.keys(s.data).forEach((e=>{n.push({name:e,seqId:s.data[e].maxSeqId,limit:200})})),n}))}function U(e,i){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r,clientID:s}=i.config.request,n=yield i.request.post(`${t}meetings/${r}/subscribe`,{endpointID:s,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),i.emitter.emit(e.event,e)}))}))}function j(e,i,r){return t(this,void 0,void 0,(function*(){const{inboxes:s,clientID:n,meetingID:o,cancelToken:a,status:c}=i;yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:s},{cancelToken:a,withResDate:!0});if(!t||!t.data)return;const{data:i={}}=t;Object.keys(i).forEach((e=>{const t=s.find((t=>t.name===e));if(t){if(t.seqId=i[e].maxSeqId,!i[e].items)return;i[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),r(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&j(e,i,r)}),200))}))}const N=(e,i)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:r}=i.config.request;i.status.polling.running=!0,j(i.request,{inboxes:e,clientID:r,meetingID:t,cancelToken:i.config.request.cancelToken.token,status:i.status.polling},(e=>{i.emitter.emit(e.event,e)}))}));function C(e){e.status.polling.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=u.source()}function R(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:r,userID:s}=e.config.request;e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.request.post(`${i}meetings/${r}/users/${s}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token});if(!t||!t.data)return;const{data:n={}}=t,o=n.interval||"";o&&(e.status.keepalive.interval=o)})))(),e.status.keepalive.running&&(e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&R(e)}),1e3*e.status.keepalive.interval))}))}const k=e=>{e.status.keepalive.running=!1,e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null)};var L;e.MeEvent=void 0,(L=e.MeEvent||(e.MeEvent={})).INIT="meInit",L.UPDATE="meUpdate",L.UPDATE_USER_STATE="updateUserState",L.ROLECHANGE="meRoleChange",L.AUDIOCHANGE="meAudioChange",L.HANDUPCHANGE="meHandupChange",L.SETAUDIO="setAudio",L.VIDEOCHANGE="meVideoChange",L.SETVIDEO="setVideo",L.SHARECHANGE="meShareChange",L.DISPLAYNAMECHANGE="meDisplayNameChange",L.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",L.LOBBYCHANGE="meLobbyChange",L.BARRAGECHANGE="meBarrageChange",L.LEAVE="leave";class M extends w{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const i=i=>t(this,void 0,void 0,(function*(){if("role"in i&&i.role!==this.data.role){const t=this.data.role;y({role:i.role},this.data),i.role!==e.ROLE.AUDIENCE&&t!==e.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(e.MeEvent.ROLECHANGE,i.role),this.ctx.emitter.emit(e.MeEvent.ROLECHANGE,i.role)}})),r=t=>{var i,r,s,n;if("audio"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.audio;(!f(o)&&o!==(null===(i=this.data.audio)||void 0===i?void 0:i.deviceOn)||!f(a)&&a!==(null===(r=this.data.audio)||void 0===r?void 0:r.sendOn)||!f(c))&&(y({audio:t.audio},this.data),this.emitter.emit(e.MeEvent.AUDIOCHANGE,{deviceOn:f(o)?null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn:o,sendOn:f(a)?null===(n=this.data.audio)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},s=t=>{var i,r,s,n;if("video"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.video;(!f(o)&&o!==(null===(i=this.data.video)||void 0===i?void 0:i.deviceOn)||!f(a)&&a!==(null===(r=this.data.video)||void 0===r?void 0:r.sendOn))&&(y({video:t.video},this.data),this.emitter.emit(e.MeEvent.VIDEOCHANGE,{deviceOn:f(o)?null===(s=this.data.video)||void 0===s?void 0:s.deviceOn:o,sendOn:f(a)?null===(n=this.data.video)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},n=t=>{var i,r,s,n;if("share"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.share;(!f(o)&&o!==(null===(i=this.data.share)||void 0===i?void 0:i.deviceOn)||!f(a)&&a!==(null===(r=this.data.share)||void 0===r?void 0:r.sendOn))&&(y({share:t.share},this.data),this.emitter.emit(e.MeEvent.SHARECHANGE,{deviceOn:f(o)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:o,sendOn:f(a)?null===(n=this.data.share)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},o=t=>{t.displayName&&t.displayName!==this.data.displayName&&(y({displayName:t.displayName},this.data),this.emitter.emit(e.MeEvent.DISPLAYNAMECHANGE,t.displayName))},a=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(y({isHandUp:t.isHandUp},this.data),this.emitter.emit(e.MeEvent.HANDUPCHANGE,t.isHandUp))},c=t=>{"isSpotlightVideo"in t&&(y({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(e.MeEvent.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},u=i=>t(this,void 0,void 0,(function*(){if("isInLobby"in i&&i.isInLobby!==this.data.isInLobby){y({isInLobby:i.isInLobby},this.data);const t=!1===i.isInLobby?"inLobbyChange":void 0;yield this.rePolling(t),this.emitter.emit(e.MeEvent.LOBBYCHANGE,i.isInLobby),this.ctx.emitter.emit(e.MeEvent.LOBBYCHANGE,i.isInLobby)}})),d=t=>{if(!t.barrage)return;let i=null;if(!t.barrage.wordsDisplayStatus)return i=null,delete t.barrage,this.data.barrage=i||void 0,void this.emitter.emit(e.MeEvent.BARRAGECHANGE,i);if(!t.barrage.receiver)return;i={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};let{role:r}=this.data;if(this.data.endpointType===e.ENDPOINT_TYPE.SUPERVISION){const{info:t}=this.ctx.modules;r="webinar"===t.meetingType?e.ROLE.AUDIENCE:e.ROLE.ATTENDEE}r===e.ROLE.HOST||r===e.ROLE.COHOST?i=t.barrage.receiver.host?i:null:r===e.ROLE.ATTENDEE?i=t.barrage.receiver.attendee?i:null:r===e.ROLE.AUDIENCE&&(i=t.barrage.receiver.audience?i:null),delete t.barrage,this.data.barrage=i||void 0,this.emitter.emit(e.MeEvent.BARRAGECHANGE,i)},l=t=>{"leave"in t&&!0===t.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),C(this.ctx),z(this.ctx),this.emitter.emit(e.MeEvent.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},p=e=>{i(e),r(e),s(e),n(e),o(e),a(e),u(e),c(e),d(e),l(e)};this.ctx.emitter.on(e.MeEvent.INIT,(e=>{y(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(e.MeEvent.UPDATE,(e=>{p(e),y(e,this.data)})),this.ctx.emitter.on(e.EVENT.STATE,(({state:t})=>{t===e.STATE.READY&&this.data.endpointType!==e.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:i={users:[]}}=e;if("delete"===t){const e=i.users[0];return e.leave=!0,void l(e)}const r=i.users.find((e=>e.userID===this.data.userID));r&&(p(r),y(r,this.data))})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(e.MeEvent.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(e.MeEvent.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){l({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(t,i=!1){if(!i){const{role:i,initialMediaState:r}=this.data;t.audio.sendOn=t.audio.sendOn&&r.audio.sendOn,t.video.sendOn=t.video.sendOn&&r.video.sendOn,i===e.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,y(t,this.data),this.ctx.request.post(`${r}meetings/${s}/updateUserState`,t)}rePolling(i){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;C(t);const r=S(t),s=yield P(r,t);if(i&&this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data,event:i}),yield U(r,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:i}=t.config.request;t.worker.postMessage({inboxes:s,topics:r,meetingID:e,clientID:i,rePolling:!0})}else yield N(s,t)}))}}class H extends w{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:i}=e;if(t&&t.users){if("full"===i)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=H.setDisplayNamePinyinProp?H.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===i&&-1!==t?y(e,this.data.callRecordUsers[t]):"update"===i&&-1===t&&(e.displayNamePinyin=H.setDisplayNamePinyinProp?H.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/invite`,e)}}class V extends w{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:i}=this.ctx.modules.me.data;return i===e.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:t===e.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:i,state:r})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=t;if("delete"!==r||"delete"===r&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(e.MeEvent.UPDATE,t);let n=!1;switch(i){case"interactiveUsers":t.isInLobby||(n=!0);break;case"broadcastUsers":t.isInLobby||t.role!==e.ROLE.AUDIENCE||(n=!0);break;case"lobbyUsers":t.isInLobby&&(n=!0)}const o={};n&&(o.leave=!0),this.ctx.emitter.emit(e.MeEvent.UPDATE,Object.assign(Object.assign({},t),o))},i=({updateUsers:e,state:i,sourceKey:r})=>{if("full"===i)return this.data[r]=e.map((e=>(e.displayNamePinyin=V.setDisplayNamePinyinProp?V.setDisplayNamePinyinProp(e.displayName):e.displayName,t(e,{event:r,state:i}),e))),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!0}),this.data[r];void 0===this.data[r]&&(this.data[r]=[]);const{data:s,emitter:n}=this;return e.forEach((e=>{const o=s[r].findIndex((t=>e.userID===t.userID));if("delete"===i&&-1!==o){const[t]=this.data[r].splice(o,1);n.emit(`${r}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===i&&-1!==o){const t=this.data[r][o];this.updateUserProps(e,t),y(e,t),this.data[r][o]=I(t),this.emitter.emit(`${r}Update`,{user:this.data[r][o]})}else"update"===i&&-1===o&&(e.displayNamePinyin=V.setDisplayNamePinyinProp?V.setDisplayNamePinyinProp(e.displayName):e.displayName,s[r].push(e),this.emitter.emit(`${r}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:r,state:i})})),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!1}),this.data[r]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:t,body:r}=e;i({updateUsers:r.users,state:t,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:t,body:r}=e;i({updateUsers:r.users,state:t,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:t,body:r}=e;i({updateUsers:r.users,state:t,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:t,body:r}=e;i({updateUsers:r.users,state:t,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=V.setDisplayNamePinyinProp?V.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/users/${e}/callStats`)}callStatsReport(e){if(!e.userID)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e.userID}/callStats/report`,e)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}function B(t){const{baseURL:r,modules:s,worker:n,singleton:o}=t;s.findIndex((e=>e===M))<0&&s.push(M),s.findIndex((e=>e===A))<0&&s.push(A);const a=`${v()}_${((e=new Date,t)=>{const i={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const r in i)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[r]:("00"+i[r]).substr((""+i[r]).length)));return t})(new Date,"MMddHHmmss")}`,d={config:{baseURL:r,modules:s,singleton:o||!1,request:{cancelToken:u.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:a,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:n,emitter:i(),request:new c({baseURL:r,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=v()},error:t=>{d.emitter.emit(e.EVENT.REQUEST_ERROR,t)}}),modules:{},state:e.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:t=>{d.state!==e.STATE.CLOSE&&(d.worker&&d.worker.terminate(),d.config.request.location="",d.config.request.meetingID="",d.config.request.ctrlID="",d.config.request.sessionID="",d.config.request.userID=-1,d.config.request.voteTk="",d.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},d.request.setDefaultHeader("X-Y-Location",""),d.request.setDefaultHeader("X-Y-Ctrl-Id",""),d.request.setDefaultHeader("X-Y-Session-Id",""),d.state=e.STATE.CLOSE,d.emitter.emit(e.EVENT.STATE,{state:d.state,reason:t}))}};return d}function G(t){const i=B(t);return i.worker&&("undefined"!=typeof Worker?i.worker.postMessage({baseURL:i.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!p(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const i=new e(t);t.modules[i.moduleName]=i}))}(i.config.modules,i),i.emitter.on(e.EVENT.STATE,(({state:t})=>{t===e.STATE.CLOSE&&Object.keys(i.modules).forEach((e=>{i.modules[e].cleanup()}))})),Object.assign({config:i.config,request:i.request,get state(){return i.state},on:i.emitter.on,off:i.emitter.off,join:Y(i),leave:Q(i),end:W(i),endMeeting:F(i)},i.modules)}function Y(i){return function(r){var s;return t(this,void 0,void 0,(function*(){const{clientID:t}=i.config.request,n=`${null===(s=r.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${t}_${r.meetingNum}`;i.config.request.sessionID=n,i.request.setDefaultHeader("X-Y-Session-Id",n);const{prefix:o}=i.config.request,a=yield i.request.get(`${o.ctrl}credential`,{params:{meetingNum:r.meetingNum,pwd:r.pwd,url:r.url,mobileCode:r.mobileCode,mobile:r.mobile,regEmail:r.regEmail,accEmail:r.accEmail,tk:r.tk,displayName:r.displayName},headers:{"X-Y-Endpoint-Type":r.endpointType}}),{credential:c="",location:u=""}=a&&a.data||{};if(!c)return i.emitter.emit(e.EVENT.FAILED,{bizCode:a.bizCode,data:a.data}),a;i.config.request.location=u,i.request.setDefaultHeader("X-Y-Location",u),delete r.pwd,delete r.url;const d=yield i.request.post(`${o.ctrl}join?meetingNum=${r.meetingNum}&credential=${c}`,r,{headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":t}});if(!d||d&&d.ret<=-1)return i.emitter.emit(e.EVENT.FAILED,{bizCode:d.bizCode,data:d.data}),d;const{meetingID:l="",ctrlID:p="",user:f={},mediaContent:h={},initialMediaState:m={},tk:g=""}=d.data;i.config.request.meetingID=l,i.config.request.ctrlID=p,i.config.request.userID=f.userID,i.config.request.voteTk=g,i.request.setDefaultHeader("X-Y-Ctrl-Id",p),i.emitter.emit(e.MeEvent.INIT,Object.assign(Object.assign({},f),{mediaContent:h,initialMediaState:m})),i.state=e.STATE.JOINED,i.emitter.emit(e.EVENT.STATE,{state:i.state});const v=()=>{i.state!==e.STATE.READY&&(i.state=e.STATE.READY,i.emitter.emit(e.EVENT.STATE,{state:i.state}))},y=S(i),b=yield P(y,i);return yield U(y,i),"undefined"!=typeof Worker&&i.worker?(i.status.polling.running=!0,i.worker.postMessage({topics:y,meetingID:l,clientID:t,inboxes:b,status:!0}),i.worker.onmessage=e=>{"pollingStarted"!==e.data?"pollingStopped"!==e.data?(console.log("[Polling]",e.data),i.emitter.emit(e.data.event,e.data)):i.status.polling.running=!1:v()}):(i.status.polling.running=!0,N(b,i),v()),i.status.keepalive.running=!0,R(i),d.data=Object.assign(Object.assign({},d.data),a.data),d}))}}function Q(e){return function(i){return t(this,void 0,void 0,(function*(){i||(i={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:r}=e.config.request,s=yield e.request.post(`${t.ctrl}meetings/${r}/leave`,i);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),k(e),z(e),e.cleanup(),s}))}}function W(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:i}=e.config.request,r=yield e.request.post(`${t.ctrl}meetings/${i}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),k(e),z(e),e.cleanup(),r}))}}function F(e){return function(i){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${i}/end`)}))}}class X{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=G(e)}static getInstance(e){return this.instance?this.instance:this.instance=new X(e)}}function z(e){if(e.config.singleton){const{baseURL:t,modules:i,singleton:r}=e.config,s={baseURL:t,modules:i,worker:e.worker,singleton:r},n=X.getInstance(s);n&&(n.meeting=G(s))}}return Object.defineProperty(X,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),e.Chat=class extends w{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/chat/historyMsg`,e)}))}},e.Info=A,e.Invite=H,e.LiveStream=class extends w{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:i,body:r,stime:s}=e;if(r){if(s&&(this.data.jetlag=s),"full"===i){const{liveStreams:e=[]}=r;if(!e.length)return;const t=[];this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,t.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return y({status:t,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),r.liveStreams||(this.data.resultInfo={}),null===(t=r.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform));const i=this.data.status.map((e=>e));-1===t?i.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):i.splice(t,1,{platform:i[t].platform||"",status:e.requesting?i[t].status||"stopped":e.status||""}),this.data.status=i})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/setting`,e)}))}},e.Me=M,e.Qa=class extends w{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;h(t)&&!p(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(e,t){let i=e.get(t.question.id);const{clientID:r}=this.ctx.config.request;switch(t.command){case"addQuestion":i=this.createQuestion(t.question),e.set(t.question.id,i),this.emitter.emit("questionAdd",{question:i,selfSent:i.sender.endpointID===r});break;case"dismissQuestion":if(!i)break;i.sender.endpointID!==r?i.status="close":i.isTop=!1,e.set(t.question.id,i),this.emitter.emit("questionUpdate",{question:i});break;case"reopenQuestion":i?(i.status="open",i.isTop=t.question.isTop,e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"updateQuestion":i?(i=Object.assign(Object.assign(Object.assign({},i),t.question),{topSort:t.question.isTop?this.data.topSort++:0}),e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"deleteQuestion":if(!i)break;i.sender.endpointID!==r?e.delete(t.question.id):(i.status="delete",i.isTop=!1,i.answers.clear(),e.set(t.question.id,i)),this.emitter.emit("questionDelete",{question:i});break;case"answerQuestion":i?i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(i=this.createQuestion(t.question),i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"deleteAnswer":i&&(i.answers.delete(t.answer.id),this.emitter.emit("questionUpdate",{question:i}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/qa`,e)}))}},e.Recording=class extends w{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:i,stime:r}=e;if(i)return r&&(this.data.jetlag=r),this.data.isPracticeSession="started"===i.status&&this.data.status===i.status&&0===i.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),i),"starting"===i.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=i.status||this.data.status),this.data.resultInfo=i.resultInfo||{},["full","update"].includes(t)?(i.recordUsers&&(this.data.recording.recordUsers=i.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/designatedUsers`,e)}))}participantAdd(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/add`,e)}))}participantDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/delete`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}getByIds(e){return t(this,void 0,void 0,(function*(){const{prefix:{user:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/subject/getByIds`,e)}))}recordLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/layout`,e)}))}},e.Setting=class extends w{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:i}=e;["full","update"].includes(t)&&y(i,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}},e.SpotlightVideo=class extends w{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:i}=t;if(!i||!i.userIDs)return;this.data.userIDs=i.userIDs;i.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/view/spotlight`,e)}},e.Transcript=class extends w{constructor(e){super(e,"transcript")}_topic(){return"transcript"}_bindOn(){this.ctx.emitter.on("transcriptMsg",(e=>{const{body:t}=e;this.emitter.emit("transcriptMsg",t)}))}cleanup(){this.emitter.all=new Map}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/transcript/historyMsg`,e)}))}},e.Users=V,e.View=class extends w{constructor(e){super(e,"view")}_topic(){const{endpointType:t,role:i}=this.ctx.modules.me.data;return t===e.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:i===e.ROLE.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:i,body:r}=e;r&&("meetingView"===i?Object.keys(r).forEach((e=>{this.data[e]=r[e]})):this.data[t]=r)}updatePersonalLayouts(e){const{state:t,body:i}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),i.personalLayouts.forEach((e=>{const{subscriber:i={userID:-1}}=e,r=i.userID||i.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[r]=e:delete this.data.personalLayouts[r]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/layout/template/info`,{params:e})}))}addVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/add`,e)}))}editVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/edit`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}editTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/edit`,e)}))}addTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/add`,e)}))}deleteTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/delete`,e)}))}getDefaultTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getDefaultTemplates`,{params:e})}))}changeDefaultTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/changeDefaultTemplate`,e)}))}perspectiveBind(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/perspective/bind`,e)}))}},e.Vote=class extends w{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:i}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[i]=t,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:t})})),this.ctx.emitter.on(e.MeEvent.LOBBYCHANGE,(e=>{e&&(this.data.vote={})}))}getVotes(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:i},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${i}meetings/${r}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:i},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${i}meetings/${r}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/vote/inProgress`,{params:{tk:e&&e.tk||r}})}},e.Words=class extends w{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:i,body:r}=t;if(!r)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data});"full"===i&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:r.content,time:(new Date).getTime(),durationType:r.durationType,duration:1e3*r.duration},...this.data.barrageRecord],r.wordsDisplayStatus=!0,-1!==r.duration&&(this.data.timer=setTimeout((()=>{r.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=r.wordsDisplayStatus,this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})}),1e3*r.duration)),y(r,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(e.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}},e.createMeeting=function(e){return e.singleton?X.getInstance(e).meeting:G(e)},e.reset=z,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
1
|
+
var YlinkSDKMeeting=function(e){"use strict";function t(e,t,i,r){return new(i||(i=Promise))((function(s,n){function o(e){try{c(r.next(e))}catch(t){n(t)}}function a(e){try{c(r.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}function i(e){return{all:e=e||new Map,on:function(t,i){var r=e.get(t);r?r.push(i):e.set(t,[i])},off:function(t,i){var r=e.get(t);r&&(i?r.splice(r.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var r=e.get(t);r&&r.slice().map((function(e){e(i)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,i)}))}}}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(e,t){var i="__lodash_hash_undefined__",s=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",f="[object Promise]",h="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",w="[object Uint32Array]",A=/\w*$/,S=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[b]=U[x]=U[o]=U[a]=U[E]=U[q]=U[I]=U[D]=U[T]=U[d]=U[l]=U[p]=U[h]=U[m]=U[g]=U[v]=U[O]=U[$]=U[_]=U[w]=!0,U["[object Error]"]=U[c]=U[y]=!1;var j="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof r&&r&&r.Object===Object&&r||j||Function("return this")(),C=t&&!t.nodeType&&t,R=C&&e&&!e.nodeType&&e,k=R&&R.exports===C;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,i,r){var s=-1,n=e?e.length:0;for(r&&n&&(i=e[++s]);++s<n;)i=t(i,e[s],s,e);return i}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(i){}return t}function B(e){var t=-1,i=Array(e.size);return e.forEach((function(e,r){i[++t]=[r,e]})),i}function G(e,t){return function(i){return e(t(i))}}function Y(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var Q,W=Array.prototype,F=Function.prototype,X=Object.prototype,z=N["__core-js_shared__"],J=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=F.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=k?N.Buffer:void 0,re=N.Symbol,se=N.Uint8Array,ne=G(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=W.splice,ue=Object.getOwnPropertySymbols,de=ie?ie.isBuffer:void 0,le=G(Object.keys,Object),pe=Re(N,"DataView"),fe=Re(N,"Map"),he=Re(N,"Promise"),me=Re(N,"Set"),ge=Re(N,"WeakMap"),ve=Re(Object,"create"),ye=Ve(pe),be=Ve(fe),xe=Ve(he),Ee=Ve(me),qe=Ve(ge),Ie=re?re.prototype:void 0,De=Ie?Ie.valueOf:void 0;function Te(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function Oe(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function $e(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function _e(e){this.__data__=new Oe(e)}function we(e,t){var i=Ge(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],r=i.length,s=!!r;for(var o in e)!t&&!Z.call(e,o)||s&&("length"==o||Me(o,r))||i.push(o);return i}function Ae(e,t,i){var r=e[t];Z.call(e,t)&&Be(r,i)&&(void 0!==i||t in e)||(e[t]=i)}function Se(e,t){for(var i=e.length;i--;)if(Be(e[i][0],t))return i;return-1}function Pe(e,t,i,r,s,f,y){var S;if(r&&(S=f?r(e,s,f,y):r(e)),void 0!==S)return S;if(!Fe(e))return e;var P=Ge(e);if(P){if(S=function(e){var t=e.length,i=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(i.index=e.index,i.input=e.input);return i}(e),!t)return function(e,t){var i=-1,r=e.length;t||(t=Array(r));for(;++i<r;)t[i]=e[i];return t}(e,S)}else{var j=Le(e),N=j==c||j==u;if(Qe(e))return function(e,t){if(t)return e.slice();var i=new e.constructor(e.length);return e.copy(i),i}(e,t);if(j==p||j==n||N&&!f){if(V(e))return f?e:{};if(S=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),Fe(t)?oe(t):{});var t}(N?{}:e),!t)return function(e,t){return Ne(e,ke(e),t)}(e,function(e,t){return e&&Ne(t,Xe(t),e)}(S,e))}else{if(!U[j])return f?e:{};S=function(e,t,i,r){var s=e.constructor;switch(t){case b:return je(e);case o:case a:return new s(+e);case x:return function(e,t){var i=t?je(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,r);case E:case q:case I:case D:case T:case O:case $:case _:case w:return function(e,t){var i=t?je(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(e,r);case d:return function(e,t,i){return H(t?i(B(e),!0):B(e),L,new e.constructor)}(e,r,i);case l:case g:return new s(e);case h:return function(e){var t=new e.constructor(e.source,A.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,i){return H(t?i(Y(e),!0):Y(e),M,new e.constructor)}(e,r,i);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,j,Pe,t)}}y||(y=new _e);var C=y.get(e);if(C)return C;if(y.set(e,S),!P)var R=i?function(e){return function(e,t,i){var r=t(e);return Ge(e)?r:function(e,t){for(var i=-1,r=t.length,s=e.length;++i<r;)e[s+i]=t[i];return e}(r,i(e))}(e,Xe,ke)}(e):Xe(e);return function(e,t){for(var i=-1,r=e?e.length:0;++i<r&&!1!==t(e[i],i,e););}(R||e,(function(s,n){R&&(s=e[n=s]),Ae(S,n,Pe(s,t,i,r,n,e,y))})),S}function Ue(e){return!(!Fe(e)||(t=e,J&&J in t))&&(We(e)||V(e)?te:S).test(Ve(e));var t}function je(e){var t=new e.constructor(e.byteLength);return new se(t).set(new se(e)),t}function Ne(e,t,i,r){i||(i={});for(var s=-1,n=t.length;++s<n;){var o=t[s],a=r?r(i[o],e[o],o,i,e):void 0;Ae(i,o,void 0===a?e[o]:a)}return i}function Ce(e,t){var i,r,s=e.__data__;return("string"==(r=typeof(i=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==i:null===i)?s["string"==typeof t?"string":"hash"]:s.map}function Re(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return Ue(i)?i:void 0}Te.prototype.clear=function(){this.__data__=ve?ve(null):{}},Te.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Te.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===i?void 0:r}return Z.call(t,e)?t[e]:void 0},Te.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Te.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?i:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,i=Se(t,e);return!(i<0)&&(i==t.length-1?t.pop():ce.call(t,i,1),!0)},Oe.prototype.get=function(e){var t=this.__data__,i=Se(t,e);return i<0?void 0:t[i][1]},Oe.prototype.has=function(e){return Se(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var i=this.__data__,r=Se(i,e);return r<0?i.push([e,t]):i[r][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Te,map:new(fe||Oe),string:new Te}},$e.prototype.delete=function(e){return Ce(this,e).delete(e)},$e.prototype.get=function(e){return Ce(this,e).get(e)},$e.prototype.has=function(e){return Ce(this,e).has(e)},$e.prototype.set=function(e,t){return Ce(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new Oe},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Oe){var r=i.__data__;if(!fe||r.length<199)return r.push([e,t]),this;i=this.__data__=new $e(r)}return i.set(e,t),this};var ke=ue?G(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?s:t)&&("number"==typeof e||P.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Be(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=x||fe&&Le(new fe)!=d||he&&Le(he.resolve())!=f||me&&Le(new me)!=m||ge&&Le(new ge)!=y)&&(Le=function(e){var t=ee.call(e),i=t==p?e.constructor:void 0,r=i?Ve(i):void 0;if(r)switch(r){case ye:return x;case be:return d;case xe:return f;case Ee:return m;case qe:return y}return t});var Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}(e.length)&&!We(e)}var Qe=de||function(){return!1};function We(e){var t=Fe(e)?ee.call(e):"";return t==c||t==u}function Fe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xe(e){return Ye(e)?we(e):function(e){if(!He(e))return le(e);var t=[];for(var i in Object(e))Z.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}e.exports=function(e){return Pe(e,!0,!0)}}(s,s.exports);var n=s.exports;const o=e=>({get(t,i,r){if("__isProxy"===i)return!0;const s=Reflect.get(t,i);return Array.isArray(s)?s:"object"==typeof s&&null!==s?s.__isProxy?s:new Proxy(s,o(e)):s},set(t,i,r,s){const o=t[i];r=h(r)&&r.__isProxy?n(r):r;const a=Reflect.set(t,i,r,s);return((e,t)=>e!==t&&(e==e||t==t))(r,o)&&e.emit(`${x(i)}Change`,r),a}}),a=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class c{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{timeout:t=6e4}=e;let{headers:i={}}=e;return e.url=D(this.baseURL,e.url||""),e.url=((e,t)=>{if(!t)return e;const i=[];Object.keys(t).forEach((e=>{const r=t[e];if(null==r)return;let s;Array.isArray(r)?(s=r,e+="[]"):s=[r],s.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),i.push(`${a(e)}=${a(t)}`)}))}));const r=i.join("&");if(r){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e})(e.url.replace(/^\/+/,""),e.params),i=Object.assign(i,this._defaultHeaders),Object.keys(i).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(i["Content-Type"]=i[e],delete i[e])})),m(e.data)&&(e.data=e.data.buffer),g(e.data)&&(i&&!i["Content-Type"]&&(i["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=i,e.timeout=t,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx&&void 0!==wx.request?l(e):d(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,i){return this._errorHandler?this._request(Object.assign(i||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(i||{},{url:e,method:"POST",data:t}))}}class u{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new u((t=>{e=t}));return{cancel:e,token:t}}}const d=e=>new Promise(((t,i)=>{const{data:r=null,url:s,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),s,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){i(new Error("E_JSON_PARSE"+u.responseText))}else i({url:s,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(i({url:s,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{i(new Error("Network Error")),u=null},u.ontimeout=()=>{i(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===r&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),i(e),u=null)})),u.send(r)})),l=e=>new Promise(((t,i)=>{const{data:r=null,url:s,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:s,data:r,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):i({url:s,statusCode:e.statusCode})},fail(e){i("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),p=Array.isArray,f=e=>null==e,h=e=>"object"==typeof e&&null!==e,m=e=>{let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t},g=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},v=()=>{const e=[],t="0123456789abcdef";for(let i=0;i<36;i++)e[i]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},y=(e,t)=>e?(Object.entries(e).forEach((e=>{const[i,r]=[e[0],e[1]];if(null!==r)return h(r)&&!p(r)?(t[i]||(t[i]={}),void(t[i]=y(r,t[i]))):void(t[i]=r)})),t):t,b=/-(\w)/g,x=e=>e.replace(b,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:E}=Object.prototype,q=(e,t)=>E.call(e,t),I=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let i;i=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,i);for(const r in e)q(e,r)&&(i[r]=I(e[r],t));return i},D=(e,t)=>e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?((e,t)=>t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e)(e,t):t;var T,O,$,_,w;e.EVENT=void 0,(T=e.EVENT||(e.EVENT={})).REQUEST_ERROR="requestError",T.STATE="state",T.FAILED="failed",e.STATE=void 0,(O=e.STATE||(e.STATE={}))[O.CLOSE=0]="CLOSE",O[O.JOINED=1]="JOINED",O[O.READY=2]="READY",e.ENDPOINT_TYPE=void 0,($=e.ENDPOINT_TYPE||(e.ENDPOINT_TYPE={})).WEBAPP="webApp",$.WEBCTRL="webCtrl",$.WECHATMP="weChatMP",$.SUPERVISION="supervision",$.BIGSCREEN="bigScreen",$.DESKTOP="desktop",$.MOBILE="mobile",$.VCS="vcs",$.SIP="sip",$.H323="h323",$.PSTN="pstn",e.ROLE=void 0,(_=e.ROLE||(e.ROLE={})).HOST="host",_.COHOST="coHost",_.ATTENDEE="attendee",_.AUDIENCE="audience",e.RECORD_STATUS=void 0,(w=e.RECORD_STATUS||(e.RECORD_STATUS={})).STARTED="started",w.PAUSED="paused",w.STARTING="starting",w.STOPPED="stopped";class A{constructor(e,t){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=t,this.ctx=e,this.emitter=i(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},o(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},o(this.emitter))}reactive(e){if(h(e)){const t=new Map,i=(e,r)=>{Object.keys(e).forEach((s=>{!1===r&&s in this.data&&(e[s]=this.data[s]);const n=t=>e[s]=t,o=`${x(s)}Change`;this.emitter.on(o,n),t.set(o,n),h(e[s])&&!p(e[s])&&i(e[s],!0)}))};i(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class S extends A{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:i}=e;("full"===t||"update"===t)&&y(i,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;y({participantCount:t},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:i},headers:{language:e.language}})}}function P(e){const t=[],{isInLobby:i}=e.modules.me.data;return i?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((i=>{const r=e.modules[i]._topic();r&&(Array.isArray(r)?r.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(r)||t.push(r))})),t)}function U(e,i){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:r}=i.config.request,s=yield i.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:r,meetingId:t},inboxes:e}),n=[];return s.data&&Object.keys(s.data).forEach((e=>{n.push({name:e,seqId:s.data[e].maxSeqId,limit:200})})),n}))}function j(e,i){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r,clientID:s}=i.config.request,n=yield i.request.post(`${t}meetings/${r}/subscribe`,{endpointID:s,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),i.emitter.emit(e.event,e)}))}))}function N(e,i,r){return t(this,void 0,void 0,(function*(){const{inboxes:s,clientID:n,meetingID:o,cancelToken:a,status:c}=i;yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:s},{cancelToken:a,withResDate:!0});if(!t||!t.data)return;const{data:i={}}=t;Object.keys(i).forEach((e=>{const t=s.find((t=>t.name===e));if(t){if(t.seqId=i[e].maxSeqId,!i[e].items)return;i[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),r(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&N(e,i,r)}),200))}))}const C=(e,i)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:r}=i.config.request;i.status.polling.running=!0,N(i.request,{inboxes:e,clientID:r,meetingID:t,cancelToken:i.config.request.cancelToken.token,status:i.status.polling},(e=>{i.emitter.emit(e.event,e)}))}));function R(e){e.status.polling.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=u.source()}function k(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:r,userID:s}=e.config.request;e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.request.post(`${i}meetings/${r}/users/${s}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token});if(!t||!t.data)return;const{data:n={}}=t,o=n.interval||"";o&&(e.status.keepalive.interval=o)})))(),e.status.keepalive.running&&(e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&k(e)}),1e3*e.status.keepalive.interval))}))}const L=e=>{e.status.keepalive.running=!1,e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null)};var M;e.MeEvent=void 0,(M=e.MeEvent||(e.MeEvent={})).INIT="meInit",M.UPDATE="meUpdate",M.UPDATE_USER_STATE="updateUserState",M.ROLECHANGE="meRoleChange",M.AUDIOCHANGE="meAudioChange",M.HANDUPCHANGE="meHandupChange",M.SETAUDIO="setAudio",M.VIDEOCHANGE="meVideoChange",M.SETVIDEO="setVideo",M.SHARECHANGE="meShareChange",M.DISPLAYNAMECHANGE="meDisplayNameChange",M.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",M.LOBBYCHANGE="meLobbyChange",M.BARRAGECHANGE="meBarrageChange",M.LEAVE="leave";class H extends A{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const i=i=>t(this,void 0,void 0,(function*(){if("role"in i&&i.role!==this.data.role){const t=this.data.role;y({role:i.role},this.data),i.role!==e.ROLE.AUDIENCE&&t!==e.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(e.MeEvent.ROLECHANGE,i.role),this.ctx.emitter.emit(e.MeEvent.ROLECHANGE,i.role)}})),r=t=>{var i,r,s,n;if("audio"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.audio;(!f(o)&&o!==(null===(i=this.data.audio)||void 0===i?void 0:i.deviceOn)||!f(a)&&a!==(null===(r=this.data.audio)||void 0===r?void 0:r.sendOn)||!f(c))&&(y({audio:t.audio},this.data),this.emitter.emit(e.MeEvent.AUDIOCHANGE,{deviceOn:f(o)?null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn:o,sendOn:f(a)?null===(n=this.data.audio)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},s=t=>{var i,r,s,n;if("video"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.video;(!f(o)&&o!==(null===(i=this.data.video)||void 0===i?void 0:i.deviceOn)||!f(a)&&a!==(null===(r=this.data.video)||void 0===r?void 0:r.sendOn))&&(y({video:t.video},this.data),this.emitter.emit(e.MeEvent.VIDEOCHANGE,{deviceOn:f(o)?null===(s=this.data.video)||void 0===s?void 0:s.deviceOn:o,sendOn:f(a)?null===(n=this.data.video)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},n=t=>{var i,r,s,n;if("share"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.share;(!f(o)&&o!==(null===(i=this.data.share)||void 0===i?void 0:i.deviceOn)||!f(a)&&a!==(null===(r=this.data.share)||void 0===r?void 0:r.sendOn))&&(y({share:t.share},this.data),this.emitter.emit(e.MeEvent.SHARECHANGE,{deviceOn:f(o)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:o,sendOn:f(a)?null===(n=this.data.share)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},o=t=>{t.displayName&&t.displayName!==this.data.displayName&&(y({displayName:t.displayName},this.data),this.emitter.emit(e.MeEvent.DISPLAYNAMECHANGE,t.displayName))},a=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(y({isHandUp:t.isHandUp},this.data),this.emitter.emit(e.MeEvent.HANDUPCHANGE,t.isHandUp))},c=t=>{"isSpotlightVideo"in t&&(y({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(e.MeEvent.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},u=i=>t(this,void 0,void 0,(function*(){if("isInLobby"in i&&i.isInLobby!==this.data.isInLobby){y({isInLobby:i.isInLobby},this.data);const t=!1===i.isInLobby?"inLobbyChange":void 0;yield this.rePolling(t),this.emitter.emit(e.MeEvent.LOBBYCHANGE,i.isInLobby),this.ctx.emitter.emit(e.MeEvent.LOBBYCHANGE,i.isInLobby)}})),d=t=>{if(!t.barrage)return;let i=null;if(!t.barrage.wordsDisplayStatus)return i=null,delete t.barrage,this.data.barrage=i||void 0,void this.emitter.emit(e.MeEvent.BARRAGECHANGE,i);if(!t.barrage.receiver)return;i={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};let{role:r}=this.data;if(this.data.endpointType===e.ENDPOINT_TYPE.SUPERVISION){const{info:t}=this.ctx.modules;r="webinar"===t.meetingType?e.ROLE.AUDIENCE:e.ROLE.ATTENDEE}r===e.ROLE.HOST||r===e.ROLE.COHOST?i=t.barrage.receiver.host?i:null:r===e.ROLE.ATTENDEE?i=t.barrage.receiver.attendee?i:null:r===e.ROLE.AUDIENCE&&(i=t.barrage.receiver.audience?i:null),delete t.barrage,this.data.barrage=i||void 0,this.emitter.emit(e.MeEvent.BARRAGECHANGE,i)},l=t=>{"leave"in t&&!0===t.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),R(this.ctx),J(this.ctx),this.emitter.emit(e.MeEvent.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},p=e=>{i(e),r(e),s(e),n(e),o(e),a(e),u(e),c(e),d(e),l(e)};this.ctx.emitter.on(e.MeEvent.INIT,(e=>{y(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(e.MeEvent.UPDATE,(e=>{p(e),y(e,this.data)})),this.ctx.emitter.on(e.EVENT.STATE,(({state:t})=>{t===e.STATE.READY&&this.data.endpointType!==e.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:i={users:[]}}=e;if("delete"===t){const e=i.users[0];return e.leave=!0,void l(e)}const r=i.users.find((e=>e.userID===this.data.userID));r&&(p(r),y(r,this.data))})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(e.MeEvent.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(e.MeEvent.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){l({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(t,i=!1){if(!i){const{role:i,initialMediaState:r}=this.data;t.audio.sendOn=t.audio.sendOn&&r.audio.sendOn,t.video.sendOn=t.video.sendOn&&r.video.sendOn,i===e.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,y(t,this.data),this.ctx.request.post(`${r}meetings/${s}/updateUserState`,t)}rePolling(i){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;R(t);const r=P(t),s=yield U(r,t);if(i&&this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data,event:i}),yield j(r,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:i}=t.config.request;t.worker.postMessage({inboxes:s,topics:r,meetingID:e,clientID:i,rePolling:!0})}else yield C(s,t)}))}}class V extends A{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:i}=e;if(t&&t.users){if("full"===i)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=V.setDisplayNamePinyinProp?V.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===i&&-1!==t?y(e,this.data.callRecordUsers[t]):"update"===i&&-1===t&&(e.displayNamePinyin=V.setDisplayNamePinyinProp?V.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/invite`,e)}}class B extends A{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:i}=this.ctx.modules.me.data;return i===e.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:t===e.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:i,state:r})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=t;if("delete"!==r||"delete"===r&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(e.MeEvent.UPDATE,t);let n=!1;switch(i){case"interactiveUsers":t.isInLobby||(n=!0);break;case"broadcastUsers":t.isInLobby||t.role!==e.ROLE.AUDIENCE||(n=!0);break;case"lobbyUsers":t.isInLobby&&(n=!0)}const o={};n&&(o.leave=!0),this.ctx.emitter.emit(e.MeEvent.UPDATE,Object.assign(Object.assign({},t),o))},i=({updateUsers:e,state:i,sourceKey:r})=>{if("full"===i)return this.data[r]=e.map((e=>(e.displayNamePinyin=B.setDisplayNamePinyinProp?B.setDisplayNamePinyinProp(e.displayName):e.displayName,t(e,{event:r,state:i}),e))),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!0}),this.data[r];void 0===this.data[r]&&(this.data[r]=[]);const{data:s,emitter:n}=this;return e.forEach((e=>{const o=s[r].findIndex((t=>e.userID===t.userID));if("delete"===i&&-1!==o){const[t]=this.data[r].splice(o,1);n.emit(`${r}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===i&&-1!==o){const t=this.data[r][o];this.updateUserProps(e,t),y(e,t),this.data[r][o]=I(t),this.emitter.emit(`${r}Update`,{user:this.data[r][o]})}else"update"===i&&-1===o&&(e.displayNamePinyin=B.setDisplayNamePinyinProp?B.setDisplayNamePinyinProp(e.displayName):e.displayName,s[r].push(e),this.emitter.emit(`${r}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:r,state:i})})),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!1}),this.data[r]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:t,body:r}=e;i({updateUsers:r.users,state:t,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:t,body:r}=e;i({updateUsers:r.users,state:t,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:t,body:r}=e;i({updateUsers:r.users,state:t,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:t,body:r}=e;i({updateUsers:r.users,state:t,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=B.setDisplayNamePinyinProp?B.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${r}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/users/${e}/callStats`)}callStatsReport(e){if(!e.userID)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e.userID}/callStats/report`,e)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}function G(t){const{baseURL:r,modules:s,worker:n,singleton:o}=t;s.findIndex((e=>e===H))<0&&s.push(H),s.findIndex((e=>e===S))<0&&s.push(S);const a=`${v()}_${((e=new Date,t)=>{const i={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const r in i)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[r]:("00"+i[r]).substr((""+i[r]).length)));return t})(new Date,"MMddHHmmss")}`,d={config:{baseURL:r,modules:s,singleton:o||!1,request:{cancelToken:u.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:a,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:n,emitter:i(),request:new c({baseURL:r,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=v()},error:t=>{d.emitter.emit(e.EVENT.REQUEST_ERROR,t)}}),modules:{},state:e.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:t=>{d.state!==e.STATE.CLOSE&&(d.worker&&d.worker.terminate(),d.config.request.location="",d.config.request.meetingID="",d.config.request.ctrlID="",d.config.request.sessionID="",d.config.request.userID=-1,d.config.request.voteTk="",d.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},d.request.setDefaultHeader("X-Y-Location",""),d.request.setDefaultHeader("X-Y-Ctrl-Id",""),d.request.setDefaultHeader("X-Y-Session-Id",""),d.state=e.STATE.CLOSE,d.emitter.emit(e.EVENT.STATE,{state:d.state,reason:t}))}};return d}function Y(t){const i=G(t);return i.worker&&("undefined"!=typeof Worker?i.worker.postMessage({baseURL:i.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!p(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const i=new e(t);t.modules[i.moduleName]=i}))}(i.config.modules,i),i.emitter.on(e.EVENT.STATE,(({state:t})=>{t===e.STATE.CLOSE&&Object.keys(i.modules).forEach((e=>{i.modules[e].cleanup()}))})),Object.assign({config:i.config,request:i.request,get state(){return i.state},on:i.emitter.on,off:i.emitter.off,join:Q(i),leave:W(i),end:F(i),endMeeting:X(i)},i.modules)}function Q(i){return function(r){var s;return t(this,void 0,void 0,(function*(){const{clientID:t}=i.config.request,n=`${null===(s=r.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${t}_${r.meetingNum}`;i.config.request.sessionID=n,i.request.setDefaultHeader("X-Y-Session-Id",n);const{prefix:o}=i.config.request,a=yield i.request.get(`${o.ctrl}credential`,{params:{meetingNum:r.meetingNum,pwd:r.pwd,url:r.url,mobileCode:r.mobileCode,mobile:r.mobile,regEmail:r.regEmail,accEmail:r.accEmail,tk:r.tk,displayName:r.displayName},headers:{"X-Y-Endpoint-Type":r.endpointType}}),{credential:c="",location:u=""}=a&&a.data||{};if(!c)return i.emitter.emit(e.EVENT.FAILED,{bizCode:a.bizCode,data:a.data}),a;i.config.request.location=u,i.request.setDefaultHeader("X-Y-Location",u),delete r.pwd,delete r.url;const d=yield i.request.post(`${o.ctrl}join?meetingNum=${r.meetingNum}&credential=${c}`,r,{headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":t}});if(!d||d&&d.ret<=-1)return i.emitter.emit(e.EVENT.FAILED,{bizCode:d.bizCode,data:d.data}),d;const{meetingID:l="",ctrlID:p="",user:f={},mediaContent:h={},initialMediaState:m={},tk:g=""}=d.data;i.config.request.meetingID=l,i.config.request.ctrlID=p,i.config.request.userID=f.userID,i.config.request.voteTk=g,i.request.setDefaultHeader("X-Y-Ctrl-Id",p),i.emitter.emit(e.MeEvent.INIT,Object.assign(Object.assign({},f),{mediaContent:h,initialMediaState:m})),i.state=e.STATE.JOINED,i.emitter.emit(e.EVENT.STATE,{state:i.state});const v=()=>{i.state!==e.STATE.READY&&(i.state=e.STATE.READY,i.emitter.emit(e.EVENT.STATE,{state:i.state}))},y=P(i),b=yield U(y,i);return yield j(y,i),"undefined"!=typeof Worker&&i.worker?(i.status.polling.running=!0,i.worker.postMessage({topics:y,meetingID:l,clientID:t,inboxes:b,status:!0}),i.worker.onmessage=e=>{"pollingStarted"!==e.data?"pollingStopped"!==e.data?(console.log("[Polling]",e.data),i.emitter.emit(e.data.event,e.data)):i.status.polling.running=!1:v()}):(i.status.polling.running=!0,C(b,i),v()),i.status.keepalive.running=!0,k(i),d.data=Object.assign(Object.assign({},d.data),a.data),d}))}}function W(e){return function(i){return t(this,void 0,void 0,(function*(){i||(i={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:r}=e.config.request,s=yield e.request.post(`${t.ctrl}meetings/${r}/leave`,i);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),R(e),L(e),J(e),e.cleanup(),s}))}}function F(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:i}=e.config.request,r=yield e.request.post(`${t.ctrl}meetings/${i}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),R(e),L(e),J(e),e.cleanup(),r}))}}function X(e){return function(i){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${i}/end`)}))}}class z{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=Y(e)}static getInstance(e){return this.instance?this.instance:this.instance=new z(e)}}function J(e){if(e.config.singleton){const{baseURL:t,modules:i,singleton:r}=e.config,s={baseURL:t,modules:i,worker:e.worker,singleton:r},n=z.getInstance(s);n&&(n.meeting=Y(s))}}return Object.defineProperty(z,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),e.Chat=class extends A{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/chat/historyMsg`,e)}))}},e.Info=S,e.Invite=V,e.LiveStream=class extends A{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:i,body:r,stime:s}=e;if(r){if(s&&(this.data.jetlag=s),"full"===i){const{liveStreams:e=[]}=r;if(!e.length)return;const t=[];this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,t.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return y({status:t,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),r.liveStreams||(this.data.resultInfo={}),null===(t=r.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform));const i=this.data.status.map((e=>e));-1===t?i.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):i.splice(t,1,{platform:i[t].platform||"",status:e.requesting?i[t].status||"stopped":e.status||""}),this.data.status=i})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/setting`,e)}))}},e.Me=H,e.Qa=class extends A{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;h(t)&&!p(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(e,t){let i=e.get(t.question.id);const{clientID:r}=this.ctx.config.request;switch(t.command){case"addQuestion":i=this.createQuestion(t.question),e.set(t.question.id,i),this.emitter.emit("questionAdd",{question:i,selfSent:i.sender.endpointID===r});break;case"dismissQuestion":if(!i)break;i.sender.endpointID!==r?i.status="close":i.isTop=!1,e.set(t.question.id,i),this.emitter.emit("questionUpdate",{question:i});break;case"reopenQuestion":i?(i.status="open",i.isTop=t.question.isTop,e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"updateQuestion":i?(i=Object.assign(Object.assign(Object.assign({},i),t.question),{topSort:t.question.isTop?this.data.topSort++:0}),e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"deleteQuestion":if(!i)break;i.sender.endpointID!==r?e.delete(t.question.id):(i.status="delete",i.isTop=!1,i.answers.clear(),e.set(t.question.id,i)),this.emitter.emit("questionDelete",{question:i});break;case"answerQuestion":i?i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(i=this.createQuestion(t.question),i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"deleteAnswer":i&&(i.answers.delete(t.answer.id),this.emitter.emit("questionUpdate",{question:i}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/qa`,e)}))}},e.Recording=class extends A{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:i,stime:r}=e;if(i)return r&&(this.data.jetlag=r),this.data.isPracticeSession="started"===i.status&&this.data.status===i.status&&0===i.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),i),"starting"===i.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=i.status||this.data.status),this.data.resultInfo=i.resultInfo||{},["full","update"].includes(t)?(i.recordUsers&&(this.data.recording.recordUsers=i.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/designatedUsers`,e)}))}participantAdd(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/add`,e)}))}participantDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/delete`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}getByIds(e){return t(this,void 0,void 0,(function*(){const{prefix:{user:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/subject/getByIds`,e)}))}recordLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/layout`,e)}))}},e.Setting=class extends A{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:i}=e;["full","update"].includes(t)&&y(i,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}},e.SpotlightVideo=class extends A{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:i}=t;if(!i||!i.userIDs)return;this.data.userIDs=i.userIDs;i.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/view/spotlight`,e)}},e.Transcript=class extends A{constructor(e){super(e,"transcript")}_topic(){return"transcript"}_bindOn(){this.ctx.emitter.on("transcriptMsg",(e=>{const{body:t}=e;this.emitter.emit("transcriptMsg",t)}))}cleanup(){this.emitter.all=new Map}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/transcript/historyMsg`,e)}))}},e.Users=B,e.View=class extends A{constructor(e){super(e,"view")}_topic(){const{endpointType:t,role:i}=this.ctx.modules.me.data;return t===e.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:i===e.ROLE.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:i,body:r}=e;r&&("meetingView"===i?Object.keys(r).forEach((e=>{this.data[e]=r[e]})):this.data[t]=r)}updatePersonalLayouts(e){const{state:t,body:i}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),i.personalLayouts.forEach((e=>{const{subscriber:i={userID:-1}}=e,r=i.userID||i.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[r]=e:delete this.data.personalLayouts[r]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/layout/template/info`,{params:e})}))}addVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/add`,e)}))}editVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/edit`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}editTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/edit`,e)}))}addTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/add`,e)}))}deleteTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/delete`,e)}))}getDefaultTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getDefaultTemplates`,{params:e})}))}changeDefaultTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/changeDefaultTemplate`,e)}))}perspectiveBind(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/perspective/bind`,e)}))}},e.Vote=class extends A{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:i}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[i]=t,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:t})})),this.ctx.emitter.on(e.MeEvent.LOBBYCHANGE,(e=>{e&&(this.data.vote={})}))}getVotes(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${i}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:i},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${i}meetings/${r}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:i},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${i}meetings/${r}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:i,voteTk:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/vote/inProgress`,{params:{tk:e&&e.tk||r}})}},e.Words=class extends A{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:i,body:r}=t;if(!r)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data});"full"===i&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:r.content,time:(new Date).getTime(),durationType:r.durationType,duration:1e3*r.duration},...this.data.barrageRecord],r.wordsDisplayStatus=!0,-1!==r.duration&&(this.data.timer=setTimeout((()=>{r.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=r.wordsDisplayStatus,this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})}),1e3*r.duration)),y(r,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(e.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}},e.createMeeting=function(e){return e.singleton?z.getInstance(e).meeting:Y(e)},e.reset=J,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class t{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(t){const{
|
|
1
|
+
"use strict";const e=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class t{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(t){const{timeout:r=6e4}=t;let{headers:u={}}=t;return t.url=i(this.baseURL,t.url||""),t.url=((t,r)=>{if(!r)return t;const n=[];Object.keys(r).forEach((t=>{const s=r[t];if(null==s)return;let a;Array.isArray(s)?(a=s,t+="[]"):a=[s],a.forEach((r=>{null!==r&&"object"==typeof r&&(r=JSON.stringify(r)),n.push(`${e(t)}=${e(r)}`)}))}));const s=n.join("&");if(s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t})(t.url.replace(/^\/+/,""),t.params),u=Object.assign(u,this._defaultHeaders),Object.keys(u).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(u["Content-Type"]=u[e],delete u[e])})),a(t.data)&&(t.data=t.data.buffer),o(t.data)&&(u&&!u["Content-Type"]&&(u["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=u,t.timeout=r,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx&&void 0!==wx.request?s(t):n(t)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,r){return this._errorHandler?this._request(Object.assign(r||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(r||{},{url:e,method:"POST",data:t}))}}class r{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new r((t=>{e=t}));return{cancel:e,token:t}}}const n=e=>new Promise(((t,r)=>{const{data:n=null,url:s,method:a="GET",headers:o,cancelToken:i,withResDate:u}=e;let l=new XMLHttpRequest;l.open(a.toUpperCase(),s,!0),l.timeout=e.timeout;const c=()=>{if(l){if(l.status>=200&&l.status<300)try{const e=JSON.parse(l.responseText);u&&(e.responseDate=new Date(l.getResponseHeader("Date")).getTime()),t(e)}catch(e){r(new Error("E_JSON_PARSE"+l.responseText))}else r({url:s,statusCode:l.status});l=null}};"onloadend"in l?l.onloadend=c:l.onreadystatechange=()=>{l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(c)},l.onabort=()=>{l&&(r({url:s,statusCode:l.status,type:"request abort"}),l=null)},l.onerror=()=>{r(new Error("Network Error")),l=null},l.ontimeout=()=>{r(new Error("timeout of "+e.timeout+"ms exceeded")),l=null},"setRequestHeader"in l&&Object.keys(o).forEach((e=>{null===n&&"content-type"===e.toLowerCase()?delete o[e]:l.setRequestHeader(e,o[e])})),i&&i.promise.then((e=>{l&&(l.abort(),r(e),l=null)})),l.send(n)})),s=e=>new Promise(((t,r)=>{const{data:n=null,url:s,method:a="GET",headers:o,cancelToken:i}=e,u=wx.request({url:s,data:n,method:a.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):r({url:s,statusCode:e.statusCode})},fail(e){r("request:fail abort"===e.errMsg&&i&&i.reason||e)}});i&&i.promise.then((()=>{u&&u.abort()}))})),a=e=>{let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t},o=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},i=(e,t)=>e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?((e,t)=>t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e)(e,t):t;function u(e,t,r,n){return new(r||(r=Promise))((function(s,a){function o(e){try{u(n.next(e))}catch(t){a(t)}}function i(e){try{u(n.throw(e))}catch(t){a(t)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,i)}u((n=n.apply(e,t||[])).next())}))}function l(e,t,r){return u(this,void 0,void 0,(function*(){const{inboxes:n,clientID:s,meetingID:a,cancelToken:o,status:i}=t;yield(()=>u(this,void 0,void 0,(function*(){const t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:s,meetingId:a},inboxes:n},{cancelToken:o,withResDate:!0});if(!t||!t.data)return;const{data:i={}}=t;Object.keys(i).forEach((e=>{const t=n.find((t=>t.name===e));if(t){if(t.seqId=i[e].maxSeqId,!i[e].items)return;i[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),r(t)}))}}))})))(),i.running&&(i.timer=setTimeout((()=>{i.running&&l(e,t,r)}),200))}))}const c=self;let d,f=r.source(),p="",h="",b="";const m={running:!1,timer:null};function g(e){d=new t({baseURL:p}),m.running=!0,l(d,{inboxes:e,clientID:h,meetingID:b,cancelToken:f.token,status:m},(e=>{c.postMessage(e)})),c.postMessage("pollingStarted")}function y(){m.running=!1,m.timer&&(clearTimeout(m.timer),m.timer=null),f.cancel(),f=r.source(),c.postMessage("pollingStopped")}c.addEventListener("message",(e=>{"baseURL"in e.data&&(p=e.data.baseURL),"clientID"in e.data&&(h=e.data.clientID),"meetingID"in e.data&&(b=e.data.meetingID);const{inboxes:t=[]}=e.data;"rePolling"in e.data&&(y(),g(t)),"status"in e.data&&(e.data.status?g(t):y())}),!1);
|