@ylink-sdk/meeting 0.4.0-beta.7 → 0.4.0-beta.8

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.
@@ -1 +1 @@
1
- "use strict";function t(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{c(r.next(t))}catch(e){n(e)}}function a(t){try{c(r.throw(t))}catch(e){n(e)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))}function e(t){return{all:t=t||new Map,on:function(e,s){var r=t.get(e);r?r.push(s):t.set(e,[s])},off:function(e,s){var r=t.get(e);r&&(s?r.splice(r.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var r=t.get(e);r&&r.slice().map((function(t){t(s)})),(r=t.get("*"))&&r.slice().map((function(t){t(e,s)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(t,e){var r="__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]",h="[object Promise]",f="[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]",O="[object Int32Array]",$="[object Uint8Array]",T="[object Uint8ClampedArray]",_="[object Uint16Array]",A="[object Uint32Array]",S=/\w*$/,w=/^\[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[O]=U[d]=U[l]=U[p]=U[f]=U[m]=U[g]=U[v]=U[$]=U[T]=U[_]=U[A]=!0,U["[object Error]"]=U[c]=U[x]=!1;var N="object"==typeof self&&self&&self.Object===Object&&self,j="object"==typeof s&&s&&s.Object===Object&&s||N||Function("return this")(),R=e&&!e.nodeType&&e,L=R&&t&&!t.nodeType&&t,k=L&&L.exports===R;function C(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function H(t,e,s,r){var i=-1,n=t?t.length:0;for(r&&n&&(s=t[++i]);++i<n;)s=e(s,t[i],i,t);return s}function V(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(s){}return e}function B(t){var e=-1,s=Array(t.size);return t.forEach((function(t,r){s[++e]=[r,t]})),s}function G(t,e){return function(s){return t(e(s))}}function Y(t){var e=-1,s=Array(t.size);return t.forEach((function(t){s[++e]=t})),s}var Q,F=Array.prototype,J=Function.prototype,W=Object.prototype,z=j["__core-js_shared__"],X=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=J.toString,Z=W.hasOwnProperty,tt=W.toString,et=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),st=k?j.Buffer:void 0,rt=j.Symbol,it=j.Uint8Array,nt=G(Object.getPrototypeOf,Object),ot=Object.create,at=W.propertyIsEnumerable,ct=F.splice,ut=Object.getOwnPropertySymbols,dt=st?st.isBuffer:void 0,lt=G(Object.keys,Object),pt=Lt(j,"DataView"),ht=Lt(j,"Map"),ft=Lt(j,"Promise"),mt=Lt(j,"Set"),gt=Lt(j,"WeakMap"),vt=Lt(Object,"create"),xt=Vt(pt),yt=Vt(ht),bt=Vt(ft),Et=Vt(mt),qt=Vt(gt),It=rt?rt.prototype:void 0,Dt=It?It.valueOf:void 0;function Ot(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var r=t[e];this.set(r[0],r[1])}}function $t(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var r=t[e];this.set(r[0],r[1])}}function Tt(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var r=t[e];this.set(r[0],r[1])}}function _t(t){this.__data__=new $t(t)}function At(t,e){var s=Gt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Yt(t)}(t)&&Z.call(t,"callee")&&(!at.call(t,"callee")||tt.call(t)==n)}(t)?function(t,e){for(var s=-1,r=Array(t);++s<t;)r[s]=e(s);return r}(t.length,String):[],r=s.length,i=!!r;for(var o in t)!e&&!Z.call(t,o)||i&&("length"==o||Mt(o,r))||s.push(o);return s}function St(t,e,s){var r=t[e];Z.call(t,e)&&Bt(r,s)&&(void 0!==s||e in t)||(t[e]=s)}function wt(t,e){for(var s=t.length;s--;)if(Bt(t[s][0],e))return s;return-1}function Pt(t,e,s,r,i,h,x){var w;if(r&&(w=h?r(t,i,h,x):r(t)),void 0!==w)return w;if(!Jt(t))return t;var P=Gt(t);if(P){if(w=function(t){var e=t.length,s=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(s.index=t.index,s.input=t.input);return s}(t),!e)return function(t,e){var s=-1,r=t.length;e||(e=Array(r));for(;++s<r;)e[s]=t[s];return e}(t,w)}else{var N=Ct(t),j=N==c||N==u;if(Qt(t))return function(t,e){if(e)return t.slice();var s=new t.constructor(t.length);return t.copy(s),s}(t,e);if(N==p||N==n||j&&!h){if(V(t))return h?t:{};if(w=function(t){return"function"!=typeof t.constructor||Ht(t)?{}:(e=nt(t),Jt(e)?ot(e):{});var e}(j?{}:t),!e)return function(t,e){return jt(t,kt(t),e)}(t,function(t,e){return t&&jt(e,Wt(e),t)}(w,t))}else{if(!U[N])return h?t:{};w=function(t,e,s,r){var i=t.constructor;switch(e){case y:return Nt(t);case o:case a:return new i(+t);case b:return function(t,e){var s=e?Nt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.byteLength)}(t,r);case E:case q:case I:case D:case O:case $:case T:case _:case A:return function(t,e){var s=e?Nt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.length)}(t,r);case d:return function(t,e,s){return H(e?s(B(t),!0):B(t),C,new t.constructor)}(t,r,s);case l:case g:return new i(t);case f:return function(t){var e=new t.constructor(t.source,S.exec(t));return e.lastIndex=t.lastIndex,e}(t);case m:return function(t,e,s){return H(e?s(Y(t),!0):Y(t),M,new t.constructor)}(t,r,s);case v:return n=t,Dt?Object(Dt.call(n)):{}}var n}(t,N,Pt,e)}}x||(x=new _t);var R=x.get(t);if(R)return R;if(x.set(t,w),!P)var L=s?function(t){return function(t,e,s){var r=e(t);return Gt(t)?r:function(t,e){for(var s=-1,r=e.length,i=t.length;++s<r;)t[i+s]=e[s];return t}(r,s(t))}(t,Wt,kt)}(t):Wt(t);return function(t,e){for(var s=-1,r=t?t.length:0;++s<r&&!1!==e(t[s],s,t););}(L||t,(function(i,n){L&&(i=t[n=i]),St(w,n,Pt(i,e,s,r,n,t,x))})),w}function Ut(t){return!(!Jt(t)||(e=t,X&&X in e))&&(Ft(t)||V(t)?et:w).test(Vt(t));var e}function Nt(t){var e=new t.constructor(t.byteLength);return new it(e).set(new it(t)),e}function jt(t,e,s,r){s||(s={});for(var i=-1,n=e.length;++i<n;){var o=e[i],a=r?r(s[o],t[o],o,s,t):void 0;St(s,o,void 0===a?t[o]:a)}return s}function Rt(t,e){var s,r,i=t.__data__;return("string"==(r=typeof(s=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==s:null===s)?i["string"==typeof e?"string":"hash"]:i.map}function Lt(t,e){var s=function(t,e){return null==t?void 0:t[e]}(t,e);return Ut(s)?s:void 0}Ot.prototype.clear=function(){this.__data__=vt?vt(null):{}},Ot.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Ot.prototype.get=function(t){var e=this.__data__;if(vt){var s=e[t];return s===r?void 0:s}return Z.call(e,t)?e[t]:void 0},Ot.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:Z.call(e,t)},Ot.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?r:e,this},$t.prototype.clear=function(){this.__data__=[]},$t.prototype.delete=function(t){var e=this.__data__,s=wt(e,t);return!(s<0)&&(s==e.length-1?e.pop():ct.call(e,s,1),!0)},$t.prototype.get=function(t){var e=this.__data__,s=wt(e,t);return s<0?void 0:e[s][1]},$t.prototype.has=function(t){return wt(this.__data__,t)>-1},$t.prototype.set=function(t,e){var s=this.__data__,r=wt(s,t);return r<0?s.push([t,e]):s[r][1]=e,this},Tt.prototype.clear=function(){this.__data__={hash:new Ot,map:new(ht||$t),string:new Ot}},Tt.prototype.delete=function(t){return Rt(this,t).delete(t)},Tt.prototype.get=function(t){return Rt(this,t).get(t)},Tt.prototype.has=function(t){return Rt(this,t).has(t)},Tt.prototype.set=function(t,e){return Rt(this,t).set(t,e),this},_t.prototype.clear=function(){this.__data__=new $t},_t.prototype.delete=function(t){return this.__data__.delete(t)},_t.prototype.get=function(t){return this.__data__.get(t)},_t.prototype.has=function(t){return this.__data__.has(t)},_t.prototype.set=function(t,e){var s=this.__data__;if(s instanceof $t){var r=s.__data__;if(!ht||r.length<199)return r.push([t,e]),this;s=this.__data__=new Tt(r)}return s.set(t,e),this};var kt=ut?G(ut,Object):function(){return[]},Ct=function(t){return tt.call(t)};function Mt(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<e}function Ht(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||W)}function Vt(t){if(null!=t){try{return K.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Bt(t,e){return t===e||t!=t&&e!=e}(pt&&Ct(new pt(new ArrayBuffer(1)))!=b||ht&&Ct(new ht)!=d||ft&&Ct(ft.resolve())!=h||mt&&Ct(new mt)!=m||gt&&Ct(new gt)!=x)&&(Ct=function(t){var e=tt.call(t),s=e==p?t.constructor:void 0,r=s?Vt(s):void 0;if(r)switch(r){case xt:return b;case yt:return d;case bt:return h;case Et:return m;case qt:return x}return e});var Gt=Array.isArray;function Yt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Ft(t)}var Qt=dt||function(){return!1};function Ft(t){var e=Jt(t)?tt.call(t):"";return e==c||e==u}function Jt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return Yt(t)?At(t):function(t){if(!Ht(t))return lt(t);var e=[];for(var s in Object(t))Z.call(t,s)&&"constructor"!=s&&e.push(s);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}}(r,r.exports);var i=r.exports;const n=t=>({get(e,s,r){if("__isProxy"===s)return!0;const i=Reflect.get(e,s);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(t)):i},set(e,s,r,n){const o=e[s];r=h(r)&&r.__isProxy?i(r):r;const a=Reflect.set(e,s,r,n);return((t,e)=>t!==e&&(t==t||e==e))(r,o)&&t.emit(`${y(s)}Change`,r),a}}),o=t=>encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(t){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=t.baseURL,this._beforeRequest=t.beforeRequest,this._errorHandler=t.error}_request(t){const e=t.timeout||18e5;let s=t.headers||{};return t.url=I(this.baseURL,t.url||""),t.url=((t,e)=>{if(!e)return t;const s=[];Object.keys(e).forEach((t=>{const r=e[t];if(null==r)return;let i;Array.isArray(r)?(i=r,t+="[]"):i=[r],i.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),s.push(`${o(t)}=${o(e)}`)}))}));const r=s.join("&");if(r){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t})(t.url,t.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[t],delete s[t])})),f(t.data)&&(t.data=t.data.buffer),m(t.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=s,t.timeout=e,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx&&void 0!==wx.request?d(t):u(t)}setDefaultHeader(t,e){t in this._defaultHeaders&&(""===e||null===e)?delete this._defaultHeaders[t]:this._defaultHeaders[t]=e}get(t,e){return this._errorHandler?this._request(Object.assign(e||{},{url:t,method:"GET"})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(e||{},{url:t,method:"GET"}))}post(t,e,s){return this._errorHandler?this._request(Object.assign(s||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(s||{},{url:t,method:"POST",data:e}))}}class c{constructor(t){let e;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((t=>{e=t})),t((t=>{this.reason||(this.reason=t,e(this.reason))}))}static source(){let t;const e=new c((e=>{t=e}));return{cancel:t,token:e}}}const u=t=>new Promise(((e,s)=>{const{data:r=null,url:i,method:n="GET",headers:o,cancelToken:a}=t;let c=new XMLHttpRequest;c.open(n.toUpperCase(),i,!0),c.timeout=t.timeout;const u=()=>{if(c){if(c.status>=200&&c.status<300)try{const t=JSON.parse(c.responseText);e(t)}catch(t){s(new Error("E_JSON_PARSE"+c.responseText))}else s({url:i,statusCode:c.status});c=null}};"onloadend"in c?c.onloadend=u:c.onreadystatechange=()=>{c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=()=>{c&&(s({url:i,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{s(new Error("Network Error")),c=null},c.ontimeout=()=>{s(new Error("timeout of "+t.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(o).forEach((t=>{null===r&&"content-type"===t.toLowerCase()?delete o[t]:c.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{c&&(c.abort(),s(t),c=null)})),c.send(r)})),d=t=>new Promise(((e,s)=>{const{data:r=null,url:i,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:i,data:r,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):s({url:i,statusCode:t.statusCode})},fail(t){s("request:fail abort"===t.errMsg&&a&&a.reason||t)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=t=>null==t,h=t=>"object"==typeof t&&null!==t,f=t=>{let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer,e},m=t=>{if("[object Object]"!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},g=()=>{const t=[],e="0123456789abcdef";for(let s=0;s<36;s++)t[s]=e.substr(Math.floor(16*Math.random()),1);t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-";return t.join("").split("-").join("")},v=(t,e)=>t?(Object.entries(t).forEach((t=>{const[s,r]=[t[0],t[1]];if(null!==r)return h(r)&&!l(r)?(e[s]||(e[s]={}),void(e[s]=v(r,e[s]))):void(e[s]=r)})),e):e,x=/-(\w)/g,y=t=>t.replace(x,((t,e)=>e?e.toUpperCase():"")),{hasOwnProperty:b}=Object.prototype,E=(t,e)=>b.call(t,e),q=(t,e=new Map)=>{if(e.get(t))return e.get(t);if(!(t instanceof Object))return t;let s;s=t instanceof Array?[]:t instanceof Function?()=>t():t instanceof RegExp?new RegExp(t.source,t.flags):t instanceof Date?new Date(t):{},e.set(t,s);for(const r in t)E(t,r)&&(s[r]=q(t[r],e));return s},I=(t,e)=>t&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)?((t,e)=>e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e):e;var D,O,$,T,_;exports.EVENT=void 0,(D=exports.EVENT||(exports.EVENT={})).STATE="state",D.FAILED="failed",D.REQUEST_ERROR="requestError",D.POLLING_ERROR="pollingError",D.KEEPALIVE_ERROR="keepaliveError",exports.STATE=void 0,(O=exports.STATE||(exports.STATE={}))[O.CLOSE=0]="CLOSE",O[O.JOINED=1]="JOINED",O[O.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,($=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",$.WEBCTRL="webCtrl",$.WECHATMP="weChatMP",$.SUPERVISION="supervision",$.BIGSCREEN="bigScreen",$.DESKTOP="desktop",$.MOBILE="mobile",$.VCS="vcs",$.SIP="sip",$.H323="h323",$.PSTN="pstn",$.MULTI_STREAM="multiStream",$.MEETING_TOUCH="meetingTouch",exports.ROLE=void 0,(T=exports.ROLE||(exports.ROLE={})).HOST="host",T.COHOST="coHost",T.ATTENDEE="attendee",T.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(_=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",_.PAUSED="paused",_.STARTING="starting",_.STOPPED="stopped";class A{constructor(t,s){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=s,this.ctx=t,this.emitter=e(),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(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,r)=>{Object.keys(t).forEach((i=>{!1===r&&i in this.data&&(t[i]=this.data[i]);const n=e=>t[i]=e,o=`${y(i)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[i])&&!l(t[i])&&s(t[i],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}}class S extends A{constructor(t){super(t,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(t=>{const{state:e,body:s}=t;("full"===e||"update"===e)&&v(s,this.data)})),this.ctx.emitter.on("participantCount",(t=>{const{body:e}=t;v({participantCount:e},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/info/practiceSession`)}))}shareInfo(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/shareInfo`,{params:t})}meetings(t){if(!t)return Promise.reject();const{prefix:{ctrl:e}}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings`,{params:t})}mailTemplate(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}mailTemplate`,{params:{meetingID:s},headers:{language:t.language}})}}function w(t){const e=[],{isInLobby:s}=t.modules.me.data;return s?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((s=>{const r=t.modules[s]._topic();r&&(Array.isArray(r)?r.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(r)||e.push(r))})),e)}function P(e,s){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:r}=s.config.request,i=yield s.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:r,meetingId:t},inboxes:e}),n=[];return i.data&&Object.keys(i.data).forEach((t=>{n.push({name:t,seqId:i.data[t].maxSeqId,limit:200})})),n}))}function U(e,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r,clientID:i}=s.config.request,n=yield s.request.post(`${t}meetings/${r}/subscribe`,{endpointID:i,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((t=>{s.emitter.emit(t.event,t)}))}))}function N(e,s,r){return t(this,void 0,void 0,(function*(){const{inboxes:i,clientID:n,meetingID:o,cancelToken:a,status:c}=s;if(yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:i},{cancelToken:a})}catch(d){return c.attempts++,void console.error(d)}if(!t)return console.error("polling error: ","response is null"),void c.attempts++;const{data:s={},bizCode:u,error:d}=t;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,s&&Object.keys(s).forEach((t=>{const e=i.find((e=>e.name===t));e&&(e.seqId=s[t].maxSeqId,s[t].items&&s[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),e.pollingSeqId=t.seqId,r(e)})))}))})))(),!c.running)return;if(c.attempts>C)return console.error("polling Max Attempts"),void(s.onError&&s.onError({message:"polling Max Attempts"}));const u=c.attempts?M(c.attempts):0;c.timer=setTimeout((()=>{c.running&&N(e,s,r)}),u)}))}const j=(e,s)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:r}=s.config.request;s.status.polling.running=!0,N(s.request,{inboxes:e,clientID:r,meetingID:t,cancelToken:s.config.request.cancelToken.token,status:s.status.polling,onError:t=>{s.emitter.emit(exports.EVENT.POLLING_ERROR,t)}},(t=>{s.emitter.emit(t.event,t)}))}));function R(t){t.status.polling.running=!1,t.status.polling.attempts=0,t.status.polling.timer&&(clearTimeout(t.status.polling.timer),t.status.polling.timer=null),t.config.request.cancelToken.cancel(),t.config.request.cancelToken=c.source()}function L(e,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:r},meetingID:i,userID:n}=e.config.request;if(e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.request.post(`${r}meetings/${i}/users/${n}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token})}catch(a){return e.status.keepalive.attempts++,void console.error(a)}if(!t||!t.data)return;const{data:s={},bizCode:o,error:a}=t;if(900200!==o&&900408!==o&&901323!==o)return e.status.keepalive.attempts++,void console.error("keepalive ",o,a);const c=s.interval||"";c?(e.status.keepalive.interval=c,e.status.keepalive.attempts=0):console.error("keepalive ",o,a)})))(),!e.status.keepalive.running)return;if(e.status.keepalive.attempts>C)return console.error("keepalive Max Attempts"),void(s&&s({message:"keepalive Max Attempts"}));const o=e.status.keepalive.attempts?M(e.status.keepalive.attempts):1e3*e.status.keepalive.interval;e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&L(e,s)}),o)}))}const k=t=>{t.status.keepalive.running=!1,t.status.keepalive.attempts=0,t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null)},C=5,M=t=>{console.log(`computeNextTimeout attempts: ${t}`);let e=Math.floor(Math.random()*Math.pow(2,t)+1);return e<2&&(e=2),e>30&&(e=30),1e3*e};var H;exports.MeEvent=void 0,(H=exports.MeEvent||(exports.MeEvent={})).INIT="meInit",H.UPDATE="meUpdate",H.UPDATE_USER_STATE="updateUserState",H.ROLECHANGE="meRoleChange",H.AUDIOCHANGE="meAudioChange",H.HANDUPCHANGE="meHandupChange",H.SETAUDIO="setAudio",H.VIDEOCHANGE="meVideoChange",H.SETVIDEO="setVideo",H.SHARECHANGE="meShareChange",H.DISPLAYNAMECHANGE="meDisplayNameChange",H.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",H.LOBBYCHANGE="meLobbyChange",H.BARRAGECHANGE="meBarrageChange",H.PERSONALLAYOUTCHANGE="personalLayoutChange",H.LEAVE="leave";class V extends A{constructor(t){super(t,"me")}_topic(){return""}_bindOn(){const e=e=>t(this,void 0,void 0,(function*(){if("role"in e&&e.role!==this.data.role){const t=this.data.role;v({role:e.role},this.data),e.role!==exports.ROLE.AUDIENCE&&t!==exports.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(exports.MeEvent.ROLECHANGE,e.role),this.ctx.emitter.emit(exports.MeEvent.ROLECHANGE,e.role)}})),s=t=>{var e,s,r,i,n,o;if("audio"in t){const{deviceOn:a,sendOn:c,recvOn:u,opBy:d}=t.audio;(!p(a)&&a!==(null===(e=this.data.audio)||void 0===e?void 0:e.deviceOn)||!p(c)&&c!==(null===(s=this.data.audio)||void 0===s?void 0:s.sendOn)||!p(u)&&c!==(null===(r=this.data.audio)||void 0===r?void 0:r.recvOn)||!p(d))&&(v({audio:t.audio},this.data),this.emitter.emit(exports.MeEvent.AUDIOCHANGE,{deviceOn:p(a)?null===(i=this.data.audio)||void 0===i?void 0:i.deviceOn:a,sendOn:p(c)?null===(n=this.data.audio)||void 0===n?void 0:n.sendOn:c,recvOn:p(c)?null===(o=this.data.audio)||void 0===o?void 0:o.recvOn:u,opBy:d,changeData:Object.assign({},t.audio)}))}},r=t=>{var e,s,r,i,n,o;if("video"in t){const{deviceOn:a,sendOn:c,opBy:u,blocked:d}=t.video;(!p(a)&&a!==(null===(e=this.data.video)||void 0===e?void 0:e.deviceOn)||!p(c)&&c!==(null===(s=this.data.video)||void 0===s?void 0:s.sendOn)||!p(d)&&d!==(null===(r=this.data.video)||void 0===r?void 0:r.blocked))&&(v({video:t.video},this.data),this.emitter.emit(exports.MeEvent.VIDEOCHANGE,{deviceOn:p(a)?null===(i=this.data.video)||void 0===i?void 0:i.deviceOn:a,sendOn:p(c)?null===(n=this.data.video)||void 0===n?void 0:n.sendOn:c,blocked:p(c)?null===(o=this.data.video)||void 0===o?void 0:o.blocked:d,opBy:u,changeData:Object.assign({},t.video)}))}},i=t=>{var e,s,r,i;if("share"in t){const{deviceOn:n,sendOn:o,opBy:a}=t.share;(!p(n)&&n!==(null===(e=this.data.share)||void 0===e?void 0:e.deviceOn)||!p(o)&&o!==(null===(s=this.data.share)||void 0===s?void 0:s.sendOn))&&(v({share:t.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=t=>{t.displayName&&t.displayName!==this.data.displayName&&(v({displayName:t.displayName},this.data),this.emitter.emit(exports.MeEvent.DISPLAYNAMECHANGE,t.displayName))},o=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(v({isHandUp:t.isHandUp},this.data),this.emitter.emit(exports.MeEvent.HANDUPCHANGE,t.isHandUp))},a=t=>{"isSpotlightVideo"in t&&(v({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(exports.MeEvent.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},c=e=>t(this,void 0,void 0,(function*(){if("isInLobby"in e&&e.isInLobby!==this.data.isInLobby){v({isInLobby:e.isInLobby},this.data);const t=!1===e.isInLobby?"inLobbyChange":void 0;yield this.rePolling(t),this.emitter.emit(exports.MeEvent.LOBBYCHANGE,e.isInLobby),this.ctx.emitter.emit(exports.MeEvent.LOBBYCHANGE,e.isInLobby)}})),u=e=>t(this,void 0,void 0,(function*(){const{event:t,state:s,body:r}=e;"personalLayout"===t&&("full"===s?v({personalLayout:r},this.data):"delete"===s&&(this.data.personalLayout=void 0),console.log(this.data.personalLayout),this.emitter.emit(exports.MeEvent.PERSONALLAYOUTCHANGE,this.data.personalLayout))})),d=t=>{if(!t.barrage)return;let e=null;if(!t.barrage.wordsDisplayStatus)return e=null,delete t.barrage,this.data.barrage=e||void 0,void this.emitter.emit(exports.MeEvent.BARRAGECHANGE,e);if(!t.barrage.receiver)return;e={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};let{role:s}=this.data;if(this.data.endpointType===exports.ENDPOINT_TYPE.SUPERVISION){const{info:t}=this.ctx.modules;s="webinar"===t.meetingType?exports.ROLE.AUDIENCE:exports.ROLE.ATTENDEE}s===exports.ROLE.HOST||s===exports.ROLE.COHOST?e=t.barrage.receiver.host?e:null:s===exports.ROLE.ATTENDEE?e=t.barrage.receiver.attendee?e:null:s===exports.ROLE.AUDIENCE&&(e=t.barrage.receiver.audience?e:null),delete t.barrage,this.data.barrage=e||void 0,this.emitter.emit(exports.MeEvent.BARRAGECHANGE,e)},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),K(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},h=t=>{e(t),s(t),r(t),i(t),n(t),o(t),c(t),a(t),d(t),l(t),(this.data.isInLobby||this.data.role===exports.ROLE.AUDIENCE)&&this.data.share&&this.data.share.sendOn&&i({share:{deviceOn:!0,sendOn:!1,recvOn:!1}})};this.ctx.emitter.on(exports.MeEvent.INIT,(t=>{v(t,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(exports.MeEvent.UPDATE,(t=>{h(t),v(t,this.data)})),this.ctx.emitter.on(exports.EVENT.STATE,(({state:t})=>{t===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",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:s={users:[]}}=e;if("delete"===t){const t=s.users[0];return t.leave=!0,void l(t)}let r=s.users.find((t=>t.userID===this.data.userID));r||s.users.length&&(r=s.users[0]),r?(h(r),v(r,this.data)):console.warn("me ",t,s)})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(exports.MeEvent.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(exports.MeEvent.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(t=>{const{body:e={}}=t;if("ended"===e.state){l({leave:!0,resultInfo:e.resultInfo})}})),this.ctx.emitter.on("personalLayout",(t=>{u(t)}))}updateUserState(t,e=!1){if(!e){const{role:e,initialMediaState:s}=this.data;t.audio.sendOn=t.audio.sendOn&&s.audio.sendOn,t.video.sendOn=t.video.sendOn&&s.video.sendOn,e===exports.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${s}meetings/${r}/updateUserState`,t)}rePolling(e){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;R(t);const s=w(t),r=yield P(s,t);if(e&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:e}),yield U(s,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:i}=t.config.request;t.worker.postMessage({inboxes:r,topics:s,meetingID:e,clientID:i,rePolling:!0})}else yield j(r,t)}))}}class B extends A{constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:s}=t;if(e&&e.users){if("full"===s)return this.data.callRecordUsers=e.users.map((t=>(t.displayNamePinyin=B.setDisplayNamePinyinProp?B.setDisplayNamePinyinProp(t.displayName||""):t.displayName,t))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);this.data.callRecordUsers||(this.data.callRecordUsers=[]),e.users.forEach((t=>{const e=this.data.callRecordUsers.findIndex((e=>t.inviteTransID===e.inviteTransID));"update"===s&&-1!==e?v(t,this.data.callRecordUsers[e]):"update"===s&&-1===e&&(t.displayNamePinyin=B.setDisplayNamePinyinProp?B.setDisplayNamePinyinProp(t.displayName||""):t.displayName,this.data.callRecordUsers.push(t))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/invite`,t)}cancelInvite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/cancelInvite`,t)}}class G extends A{constructor(t){super(t,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:e}=this.ctx.modules.me.data;return e===exports.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:t===exports.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:e,state:s})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:r={}}=t;if("delete"!==s||"delete"===s&&[901357,901358,901352,901351,901350,901349].includes(r.bizCode||-1))return void this.ctx.emitter.emit(exports.MeEvent.UPDATE,t);let i=!1;switch(e){case"interactiveUsers":t.isInLobby||(i=!0);break;case"broadcastUsers":t.isInLobby||t.role!==exports.ROLE.AUDIENCE||(i=!0);break;case"lobbyUsers":t.isInLobby&&(i=!0)}const n={};i&&(n.leave=!0),this.ctx.emitter.emit(exports.MeEvent.UPDATE,Object.assign(Object.assign({},t),n))},e=({updateUsers:e,state:s,sourceKey:r})=>{if("full"===s)return this.data[r]=e.map((e=>(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(e.displayName):e.displayName,e.groupIDs=G.setUserGroupIDs?G.setUserGroupIDs(e.groupIDs||[]):e.groupIDs,t(e,{event:r,state:s}),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:i,emitter:n}=this;return e.forEach((e=>{const o=i[r].findIndex((t=>e.userID===t.userID));if("delete"===s&&-1!==o){const[t]=this.data[r].splice(o,1);n.emit(`${r}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===s&&-1!==o){const t=this.data[r][o];this.updateUserProps(e,t),v(e,t),this.data[r][o]=q(t),this.emitter.emit(`${r}Update`,{user:this.data[r][o]})}else"update"===s&&-1===o&&(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(e.displayName):e.displayName,i[r].push(e),this.emitter.emit(`${r}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:r,state:s})})),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!1}),this.data[r]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"advCtrlUsers"})}))}reactive(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,r)=>{Object.keys(t).forEach((i=>{!1===r&&i in this.data&&(t[i]=this.data[i]);const n=e=>t[i]=e.users.map((t=>t)),o=`${y(i)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[i])&&!l(t[i])&&s(t[i],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(t,e){t.displayName&&t.displayName!==e.displayName&&(t.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(t.displayName):t.displayName)}setAudio(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/users/${t}/callStats`)}callStatsReport(t){if(!t.userID)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t.userID}/callStats/report`,t)}replyAllHandUp(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/refuseAll`)}getSendLayout(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/sendLayout`)}setSendLayout(t,e){const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/sendLayout`,e)}setSendLayoutEnabled(t,e){const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/sendLayoutEnabled`,e)}pauseAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/pauseAudio`)}resumeAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/resumeAudio`)}modifyRoleBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyRoleBatch `,t)}modifyVideoBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyVideoBatch `,t)}putInLobbyBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/putInLobbyBatch `,t)}removeBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/removeBatch `,t)}}function Y(t){const{baseURL:s,modules:r,worker:i,singleton:n}=t;r.findIndex((t=>t===V))<0&&r.push(V),r.findIndex((t=>t===S))<0&&r.push(S);const o=t.clientID||`${g()}_${((t=new Date,e)=>{const s={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(const r in s)new RegExp("("+r+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[r]:("00"+s[r]).substr((""+s[r]).length)));return e})(new Date,"MMddHHmmss")}`,u={config:{baseURL:s,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:i,emitter:e(),request:new a({baseURL:s,beforeRequest:t=>{t.headers["X-Y-Request-Id"]=g(),t.timeout=18e5},error:t=>{u.emitter.emit(exports.EVENT.REQUEST_ERROR,t)}}),modules:{},state:exports.STATE.CLOSE,status:{polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},cleanup:t=>{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,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),Object.keys(u.modules).forEach((t=>{u.modules[t].cleanup()})),u.state=exports.STATE.CLOSE,u.emitter.emit(exports.EVENT.STATE,{state:u.state,reason:t}))}};return u}function Q(t){const e=Y(t);return e.worker&&("undefined"!=typeof Worker?e.worker.postMessage({baseURL:e.config.baseURL}):console.error("The current environment does not support worker")),function(t,e){if(!l(t))return void console.error("The modules parameter requires an array type");t.forEach((t=>{const s=new t(e);e.modules[s.moduleName]=s}))}(e.config.modules,e),e.emitter.on(exports.EVENT.POLLING_ERROR,(t=>{J(e)({resultInfo:t})})),e.emitter.on(exports.EVENT.KEEPALIVE_ERROR,(t=>{J(e)({resultInfo:t})})),Object.assign({config:e.config,request:e.request,get state(){return e.state},on:e.emitter.on,off:e.emitter.off,join:F(e),leave:J(e),end:W(e),endMeeting:z(e)},e.modules)}function F(e){return function(s){var r;return t(this,void 0,void 0,(function*(){const{clientID:t}=e.config.request,i=`${null===(r=s.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${t}_${s.meetingNum}`;e.config.request.sessionID=i,e.request.setDefaultHeader("X-Y-Session-Id",i);const{prefix:n}=e.config.request,o=yield e.request.get(`${n.ctrl}credential`,{params:{meetingNum:s.meetingNum,pwd:s.pwd,url:s.url,mobileCode:s.mobileCode,mobile:s.mobile,regEmail:s.regEmail,accEmail:s.accEmail,tk:s.tk,displayName:s.displayName,userAgent:s.userAgent},headers:{"X-Y-Endpoint-Type":s.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return e.emitter.emit(exports.EVENT.FAILED,{bizCode:o.bizCode,data:o.data}),o;e.config.request.location=c,e.request.setDefaultHeader("X-Y-Location",c),delete s.pwd,delete s.url;const u={displayName:s.displayName,userAgent:s.userAgent,clientID:t};s.groupIDs&&s.account&&(u.groupIDs=s.groupIDs,u.account=s.account,u.groupName=s.groupName);const d=yield e.request.post(`${n.ctrl}join?meetingNum=${s.meetingNum}&credential=${a}`,u,{headers:{"X-Y-Endpoint-Type":s.endpointType,"X-Y-Endpoint-Id":t}});if(!d||d&&d.ret<=-1)return e.emitter.emit(exports.EVENT.FAILED,{bizCode:d.bizCode,data:d.data}),d;const{meetingID:l="",ctrlID:p="",user:h={},mediaContent:f={},initialMediaState:m={},tk:g=""}=d.data;e.config.request.meetingID=l,e.config.request.ctrlID=p,e.config.request.userID=h.userID,e.config.request.voteTk=g,e.request.setDefaultHeader("X-Y-Ctrl-Id",p),e.emitter.emit(exports.MeEvent.INIT,Object.assign(Object.assign({},h),{mediaContent:f,initialMediaState:m})),e.state=exports.STATE.JOINED,e.emitter.emit(exports.EVENT.STATE,{state:e.state});const v=()=>{e.state!==exports.STATE.READY&&(e.state=exports.STATE.READY,e.emitter.emit(exports.EVENT.STATE,{state:e.state}))},x=w(e),y=yield P(x,e);return yield U(x,e),"undefined"!=typeof Worker&&e.worker?(e.status.polling.running=!0,e.worker.postMessage({topics:x,meetingID:l,clientID:t,inboxes:y,status:!0}),e.worker.onmessage=t=>{"pollingStarted"!==t.data?"pollingStopped"!==t.data?(console.log("[Polling]",t.data),e.emitter.emit(t.data.event,t.data)):e.status.polling.running=!1:v()}):(e.status.polling.running=!0,j(y,e),v()),e.status.keepalive.running=!0,L(e,(t=>{e.emitter.emit(exports.EVENT.KEEPALIVE_ERROR,t)})),d.data=Object.assign(Object.assign({},d.data),o.data),d}))}}function J(e){return function(s){return t(this,void 0,void 0,(function*(){s||(s={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:r}=e.config.request;let i;try{i=yield e.request.post(`${t.ctrl}meetings/${r}/leave`,s)}catch(n){console.error(n)}return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),R(e),k(e),K(e),e.cleanup(),i}))}}function W(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:s}=e.config.request,r=yield e.request.post(`${t.ctrl}meetings/${s}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),R(e),k(e),K(e),e.cleanup(),r}))}}function z(e){return function(s){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${s}/end`)}))}}class X{constructor(t){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=Q(t)}static getInstance(t){return this.instance?this.instance:this.instance=new X(t)}}function K(t){if(t.config.singleton){const{baseURL:e,modules:s,singleton:r}=t.config,i={baseURL:e,modules:s,worker:t.worker,singleton:r},n=X.getInstance(i);n&&(n.meeting=Q(i))}}Object.defineProperty(X,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.Asr=class extends A{constructor(t){super(t,"asr")}_topic(){return["meeting"]}_bindOn(){this.ctx.emitter.on("asr",(t=>{const{body:e}=t;void 0===this.data.asr&&(this.data.asr={status:"stopped"}),v(e,this.data.asr),this.emitter.emit("asrChange",{asr:this.data.asr,changeData:e})}))}cleanup(){this.emitter.all=new Map}transcriptStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/transcript/status`,e)}))}},exports.Chat=class extends A{constructor(t){super(t,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(t=>{const{body:e}=t;this.emitter.emit("chatMsg",e)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/chat/historyMsg`,e)}))}},exports.Info=S,exports.Interpretation=class extends A{constructor(t){super(t,"interpretation"),this.data={status:"stopped",interpreters:[]}}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("interpretation",(t=>{const{body:e,state:s}=t;"full"===s?(this.data.interpreters=e.interpreters,this.data.status=e.status):this.data.status=e.status,this.emitter.emit("interpretationChange",this.data)}))}interpretationStart(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/interpretation/start`,t)}interpretationEnd(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/interpretation/stop`)}},exports.Invite=B,exports.LiveStream=class extends A{constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:s,body:r,stime:i}=t;if(r){if(i&&(this.data.jetlag=i),"full"===s){const{liveStreams:t=[]}=r;if(!t.length)return;const e=[];this.data.liveStreams=t.map((t=>(t.requesting="starting"===t.status,e.push({platform:t.platform||"",status:(t.requesting?"stopped":t.status)||""}),t)));return v({status:e,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),r.liveStreams||(this.data.resultInfo={}),null===(e=r.liveStreams)||void 0===e||e.forEach((t=>{this.data.resultInfo=t.resultInfo||{};let e=this.data.liveStreams.findIndex((e=>e.platform===t.platform));-1===e?(t.requesting="starting"===t.status,this.data.liveStreams.push(t)):(t.requesting="starting"===t.status,t=Object.assign(Object.assign({},this.data.liveStreams[e]),t),this.data.liveStreams.splice(e,1,t)),e=this.data.status.findIndex((e=>e.platform===t.platform));const s=this.data.status.map((t=>t));-1===e?s.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):s.splice(e,1,{platform:s[e].platform||"",status:t.requesting?s[e].status||"stopped":t.status||""}),this.data.status=s})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/setting`,e)}))}},exports.Me=V,exports.Qa=class extends A{constructor(t){super(t,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(t=>{const{body:e}=t;h(e)&&!l(e)?this.qaUpdate(this.data.questions,e):e.forEach((t=>this.qaUpdate(this.data.questions,t)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(t,e){let s=t.get(e.question.id);const{clientID:r}=this.ctx.config.request;switch(e.command){case"addQuestion":s=this.createQuestion(e.question),t.set(e.question.id,s),this.emitter.emit("questionAdd",{question:s,selfSent:s.sender.endpointID===r});break;case"dismissQuestion":if(!s)break;s.sender.endpointID!==r?s.status="close":s.isTop=!1,t.set(e.question.id,s),this.emitter.emit("questionUpdate",{question:s});break;case"reopenQuestion":s?(s.status="open",s.isTop=e.question.isTop,t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"updateQuestion":s?(s=Object.assign(Object.assign(Object.assign({},s),e.question),{topSort:e.question.isTop?this.data.topSort++:0}),t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteQuestion":if(!s)break;s.sender.endpointID!==r?t.delete(e.question.id):(s.status="delete",s.isTop=!1,s.answers.clear(),t.set(e.question.id,s)),this.emitter.emit("questionDelete",{question:s});break;case"answerQuestion":s?s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)):(s=this.createQuestion(e.question),s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteAnswer":s&&(s.answers.delete(e.answer.id),this.emitter.emit("questionUpdate",{question:s}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(t){return{isAnonymous:t.isAnonymous,isTop:t.isTop,id:t.id,content:t.content,sender:t.sender,timestamp:t.timestamp||-1,status:t.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(t){return{isPrivate:t.isPrivate,content:t.content,id:t.id,sender:t.sender,timestamp:t.timestamp||-1}}qa(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/qa`,e)}))}},exports.Recording=class extends A{constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:s,stime:r}=t;if(s)return r&&(this.data.stime=r),this.data.isPracticeSession="started"===s.status&&this.data.status===s.status&&0===s.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),s),"starting"===s.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=s.status||this.data.status),this.data.resultInfo=s.resultInfo||{},["full","update"].includes(e)?(s.recordUsers&&(this.data.recording.recordUsers=s.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/layout`,e)}))}},exports.Setting=class extends A{constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:s}=t;["full","update"].includes(e)&&v(s,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/unmuteAll`)}))}},exports.ShouldJoinUsers=class extends A{constructor(t){super(t,"shouldJoinUsers")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("shouldJoinUsers",(t=>{const{state:e}=t;"update"===e&&this.emitter.emit("shouldJoinUsersChange")}))}modifyUser(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/attendance/shouldJoin`,t)}getUser(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/attendance/getShouldJoin`)}},exports.SpotlightVideo=class extends A{constructor(t){super(t,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:e}=t;if(!e||!e.userIDs)return;this.data.userIDs=e.userIDs;e.userIDs.findIndex((t=>t===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(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/view/spotlight`,t)}},exports.Transcript=class extends A{constructor(t){super(t,"transcript"),this.data={asr:{status:"stopped"}}}_topic(){return["transcript"]}_bindOn(){this.ctx.emitter.on("transcriptMsg",(t=>{const{body:e}=t;this.emitter.emit("transcriptMsg",e)}))}cleanup(){this.emitter.all=new Map}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/transcript/historyMsg`,e)}))}},exports.Users=G,exports.View=class extends A{constructor(t){super(t,"view")}_topic(){const{endpointType:t,role:e}=this.ctx.modules.me.data;return t===exports.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:e===exports.ROLE.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((t=>{this.ctx.emitter.on(t,(e=>{"personalView"!==t?this.updateLayout(e,t):this.updatePersonalLayouts(e)}))})),this.ctx.emitter.on("videoSourcesUpdated",(()=>{this.emitter.emit("videoSourcesUpdated")}))}updateLayout(t,e){const{event:s,body:r}=t;r&&("meetingView"===s?Object.keys(r).forEach((t=>{this.data[t]=r[t]})):this.data[e]=r)}updatePersonalLayouts(t){const{state:e,body:s}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),s.personalLayouts.forEach((t=>{const{subscriber:s={userID:-1}}=t,r=s.userID||s.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[r]=t: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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/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)}))}setSavedBackground(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/recentBackgroundFile`,e)}))}getSavedBackground(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/view/recentBackgroundFile`)}))}},exports.Vote=class extends A{constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:s}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[s]=e,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:e})})),this.ctx.emitter.on(exports.MeEvent.LOBBYCHANGE,(t=>{t&&(this.data.vote={})}))}getVotes(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.get(`${e}meetings/${s}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.get(`${e}meetings/${s}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.get(`${e}meetings/${s}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:s},meetingID:r,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${s}meetings/${r}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:s},meetingID:r,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${s}meetings/${r}/vote/submit?tk=${t.tk}&voteID=${t.voteID}`,e)}voteAdd(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/add`,t)}voteEdit(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/edit`,t)}voteDelete(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/delete`,t)}voteInProgress(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/vote/inProgress`,{params:{tk:t&&t.tk||r}})}},exports.Words=class extends A{constructor(t){super(t,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:e,body:s,pollingSeqId:r}=t;if(!s)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data});"full"===e&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),r&&(this.data.barrageRecord=[{id:r,content:s.content,time:(new Date).getTime(),durationType:s.durationType,duration:1e3*s.duration},...this.data.barrageRecord]),s.wordsDisplayStatus=!0,-1!==s.duration&&(this.data.timer=setTimeout((()=>{s.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=s.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*s.duration)),v(s,this.data),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(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/deleteBarrage`)}))}},exports.createMeeting=function(t){return t.singleton?X.getInstance(t).meeting:Q(t)},exports.reset=K;
1
+ "use strict";function t(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{c(r.next(t))}catch(e){n(e)}}function a(t){try{c(r.throw(t))}catch(e){n(e)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))}function e(t){return{all:t=t||new Map,on:function(e,s){var r=t.get(e);r?r.push(s):t.set(e,[s])},off:function(e,s){var r=t.get(e);r&&(s?r.splice(r.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var r=t.get(e);r&&r.slice().map((function(t){t(s)})),(r=t.get("*"))&&r.slice().map((function(t){t(e,s)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(t,e){var r="__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]",h="[object Promise]",f="[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]",O="[object Int32Array]",$="[object Uint8Array]",T="[object Uint8ClampedArray]",_="[object Uint16Array]",A="[object Uint32Array]",S=/\w*$/,w=/^\[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[O]=U[d]=U[l]=U[p]=U[f]=U[m]=U[g]=U[v]=U[$]=U[T]=U[_]=U[A]=!0,U["[object Error]"]=U[c]=U[x]=!1;var N="object"==typeof self&&self&&self.Object===Object&&self,R="object"==typeof s&&s&&s.Object===Object&&s||N||Function("return this")(),j=e&&!e.nodeType&&e,L=j&&t&&!t.nodeType&&t,k=L&&L.exports===j;function C(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function H(t,e,s,r){var i=-1,n=t?t.length:0;for(r&&n&&(s=t[++i]);++i<n;)s=e(s,t[i],i,t);return s}function V(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(s){}return e}function B(t){var e=-1,s=Array(t.size);return t.forEach((function(t,r){s[++e]=[r,t]})),s}function G(t,e){return function(s){return t(e(s))}}function Y(t){var e=-1,s=Array(t.size);return t.forEach((function(t){s[++e]=t})),s}var Q,F=Array.prototype,J=Function.prototype,W=Object.prototype,z=R["__core-js_shared__"],X=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=J.toString,Z=W.hasOwnProperty,tt=W.toString,et=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),st=k?R.Buffer:void 0,rt=R.Symbol,it=R.Uint8Array,nt=G(Object.getPrototypeOf,Object),ot=Object.create,at=W.propertyIsEnumerable,ct=F.splice,ut=Object.getOwnPropertySymbols,dt=st?st.isBuffer:void 0,lt=G(Object.keys,Object),pt=Lt(R,"DataView"),ht=Lt(R,"Map"),ft=Lt(R,"Promise"),mt=Lt(R,"Set"),gt=Lt(R,"WeakMap"),vt=Lt(Object,"create"),xt=Vt(pt),yt=Vt(ht),bt=Vt(ft),Et=Vt(mt),qt=Vt(gt),It=rt?rt.prototype:void 0,Dt=It?It.valueOf:void 0;function Ot(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var r=t[e];this.set(r[0],r[1])}}function $t(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var r=t[e];this.set(r[0],r[1])}}function Tt(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var r=t[e];this.set(r[0],r[1])}}function _t(t){this.__data__=new $t(t)}function At(t,e){var s=Gt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Yt(t)}(t)&&Z.call(t,"callee")&&(!at.call(t,"callee")||tt.call(t)==n)}(t)?function(t,e){for(var s=-1,r=Array(t);++s<t;)r[s]=e(s);return r}(t.length,String):[],r=s.length,i=!!r;for(var o in t)!e&&!Z.call(t,o)||i&&("length"==o||Mt(o,r))||s.push(o);return s}function St(t,e,s){var r=t[e];Z.call(t,e)&&Bt(r,s)&&(void 0!==s||e in t)||(t[e]=s)}function wt(t,e){for(var s=t.length;s--;)if(Bt(t[s][0],e))return s;return-1}function Pt(t,e,s,r,i,h,x){var w;if(r&&(w=h?r(t,i,h,x):r(t)),void 0!==w)return w;if(!Jt(t))return t;var P=Gt(t);if(P){if(w=function(t){var e=t.length,s=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(s.index=t.index,s.input=t.input);return s}(t),!e)return function(t,e){var s=-1,r=t.length;e||(e=Array(r));for(;++s<r;)e[s]=t[s];return e}(t,w)}else{var N=Ct(t),R=N==c||N==u;if(Qt(t))return function(t,e){if(e)return t.slice();var s=new t.constructor(t.length);return t.copy(s),s}(t,e);if(N==p||N==n||R&&!h){if(V(t))return h?t:{};if(w=function(t){return"function"!=typeof t.constructor||Ht(t)?{}:(e=nt(t),Jt(e)?ot(e):{});var e}(R?{}:t),!e)return function(t,e){return Rt(t,kt(t),e)}(t,function(t,e){return t&&Rt(e,Wt(e),t)}(w,t))}else{if(!U[N])return h?t:{};w=function(t,e,s,r){var i=t.constructor;switch(e){case y:return Nt(t);case o:case a:return new i(+t);case b:return function(t,e){var s=e?Nt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.byteLength)}(t,r);case E:case q:case I:case D:case O:case $:case T:case _:case A:return function(t,e){var s=e?Nt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.length)}(t,r);case d:return function(t,e,s){return H(e?s(B(t),!0):B(t),C,new t.constructor)}(t,r,s);case l:case g:return new i(t);case f:return function(t){var e=new t.constructor(t.source,S.exec(t));return e.lastIndex=t.lastIndex,e}(t);case m:return function(t,e,s){return H(e?s(Y(t),!0):Y(t),M,new t.constructor)}(t,r,s);case v:return n=t,Dt?Object(Dt.call(n)):{}}var n}(t,N,Pt,e)}}x||(x=new _t);var j=x.get(t);if(j)return j;if(x.set(t,w),!P)var L=s?function(t){return function(t,e,s){var r=e(t);return Gt(t)?r:function(t,e){for(var s=-1,r=e.length,i=t.length;++s<r;)t[i+s]=e[s];return t}(r,s(t))}(t,Wt,kt)}(t):Wt(t);return function(t,e){for(var s=-1,r=t?t.length:0;++s<r&&!1!==e(t[s],s,t););}(L||t,(function(i,n){L&&(i=t[n=i]),St(w,n,Pt(i,e,s,r,n,t,x))})),w}function Ut(t){return!(!Jt(t)||(e=t,X&&X in e))&&(Ft(t)||V(t)?et:w).test(Vt(t));var e}function Nt(t){var e=new t.constructor(t.byteLength);return new it(e).set(new it(t)),e}function Rt(t,e,s,r){s||(s={});for(var i=-1,n=e.length;++i<n;){var o=e[i],a=r?r(s[o],t[o],o,s,t):void 0;St(s,o,void 0===a?t[o]:a)}return s}function jt(t,e){var s,r,i=t.__data__;return("string"==(r=typeof(s=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==s:null===s)?i["string"==typeof e?"string":"hash"]:i.map}function Lt(t,e){var s=function(t,e){return null==t?void 0:t[e]}(t,e);return Ut(s)?s:void 0}Ot.prototype.clear=function(){this.__data__=vt?vt(null):{}},Ot.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Ot.prototype.get=function(t){var e=this.__data__;if(vt){var s=e[t];return s===r?void 0:s}return Z.call(e,t)?e[t]:void 0},Ot.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:Z.call(e,t)},Ot.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?r:e,this},$t.prototype.clear=function(){this.__data__=[]},$t.prototype.delete=function(t){var e=this.__data__,s=wt(e,t);return!(s<0)&&(s==e.length-1?e.pop():ct.call(e,s,1),!0)},$t.prototype.get=function(t){var e=this.__data__,s=wt(e,t);return s<0?void 0:e[s][1]},$t.prototype.has=function(t){return wt(this.__data__,t)>-1},$t.prototype.set=function(t,e){var s=this.__data__,r=wt(s,t);return r<0?s.push([t,e]):s[r][1]=e,this},Tt.prototype.clear=function(){this.__data__={hash:new Ot,map:new(ht||$t),string:new Ot}},Tt.prototype.delete=function(t){return jt(this,t).delete(t)},Tt.prototype.get=function(t){return jt(this,t).get(t)},Tt.prototype.has=function(t){return jt(this,t).has(t)},Tt.prototype.set=function(t,e){return jt(this,t).set(t,e),this},_t.prototype.clear=function(){this.__data__=new $t},_t.prototype.delete=function(t){return this.__data__.delete(t)},_t.prototype.get=function(t){return this.__data__.get(t)},_t.prototype.has=function(t){return this.__data__.has(t)},_t.prototype.set=function(t,e){var s=this.__data__;if(s instanceof $t){var r=s.__data__;if(!ht||r.length<199)return r.push([t,e]),this;s=this.__data__=new Tt(r)}return s.set(t,e),this};var kt=ut?G(ut,Object):function(){return[]},Ct=function(t){return tt.call(t)};function Mt(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<e}function Ht(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||W)}function Vt(t){if(null!=t){try{return K.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Bt(t,e){return t===e||t!=t&&e!=e}(pt&&Ct(new pt(new ArrayBuffer(1)))!=b||ht&&Ct(new ht)!=d||ft&&Ct(ft.resolve())!=h||mt&&Ct(new mt)!=m||gt&&Ct(new gt)!=x)&&(Ct=function(t){var e=tt.call(t),s=e==p?t.constructor:void 0,r=s?Vt(s):void 0;if(r)switch(r){case xt:return b;case yt:return d;case bt:return h;case Et:return m;case qt:return x}return e});var Gt=Array.isArray;function Yt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Ft(t)}var Qt=dt||function(){return!1};function Ft(t){var e=Jt(t)?tt.call(t):"";return e==c||e==u}function Jt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return Yt(t)?At(t):function(t){if(!Ht(t))return lt(t);var e=[];for(var s in Object(t))Z.call(t,s)&&"constructor"!=s&&e.push(s);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}}(r,r.exports);var i=r.exports;const n=t=>({get(e,s,r){if("__isProxy"===s)return!0;const i=Reflect.get(e,s);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(t)):i},set(e,s,r,n){const o=e[s];r=h(r)&&r.__isProxy?i(r):r;const a=Reflect.set(e,s,r,n);return((t,e)=>t!==e&&(t==t||e==e))(r,o)&&t.emit(`${y(s)}Change`,r),a}}),o=t=>encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(t){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=t.baseURL,this._beforeRequest=t.beforeRequest,this._errorHandler=t.error}_request(t){const e=t.timeout||18e5;let s=t.headers||{};return t.url=I(this.baseURL,t.url||""),t.url=((t,e)=>{if(!e)return t;const s=[];Object.keys(e).forEach((t=>{const r=e[t];if(null==r)return;let i;Array.isArray(r)?(i=r,t+="[]"):i=[r],i.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),s.push(`${o(t)}=${o(e)}`)}))}));const r=s.join("&");if(r){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t})(t.url,t.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[t],delete s[t])})),f(t.data)&&(t.data=t.data.buffer),m(t.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=s,t.timeout=e,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx&&void 0!==wx.request?d(t):u(t)}setDefaultHeader(t,e){t in this._defaultHeaders&&(""===e||null===e)?delete this._defaultHeaders[t]:this._defaultHeaders[t]=e}get(t,e){return this._errorHandler?this._request(Object.assign(e||{},{url:t,method:"GET"})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(e||{},{url:t,method:"GET"}))}post(t,e,s){return this._errorHandler?this._request(Object.assign(s||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(s||{},{url:t,method:"POST",data:e}))}}class c{constructor(t){let e;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((t=>{e=t})),t((t=>{this.reason||(this.reason=t,e(this.reason))}))}static source(){let t;const e=new c((e=>{t=e}));return{cancel:t,token:e}}}const u=t=>new Promise(((e,s)=>{const{data:r=null,url:i,method:n="GET",headers:o,cancelToken:a}=t;let c=new XMLHttpRequest;c.open(n.toUpperCase(),i,!0),c.timeout=t.timeout;const u=()=>{if(c){if(c.status>=200&&c.status<300)try{const t=JSON.parse(c.responseText);e(t)}catch(t){s(new Error("E_JSON_PARSE"+c.responseText))}else s({url:i,statusCode:c.status});c=null}};"onloadend"in c?c.onloadend=u:c.onreadystatechange=()=>{c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=()=>{c&&(s({url:i,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{s(new Error("Network Error")),c=null},c.ontimeout=()=>{s(new Error("timeout of "+t.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(o).forEach((t=>{null===r&&"content-type"===t.toLowerCase()?delete o[t]:c.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{c&&(c.abort(),s(t),c=null)})),c.send(r)})),d=t=>new Promise(((e,s)=>{const{data:r=null,url:i,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:i,data:r,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):s({url:i,statusCode:t.statusCode})},fail(t){s("request:fail abort"===t.errMsg&&a&&a.reason||t)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=t=>null==t,h=t=>"object"==typeof t&&null!==t,f=t=>{let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer,e},m=t=>{if("[object Object]"!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},g=()=>{const t=[],e="0123456789abcdef";for(let s=0;s<36;s++)t[s]=e.substr(Math.floor(16*Math.random()),1);t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-";return t.join("").split("-").join("")},v=(t,e)=>t?(Object.entries(t).forEach((t=>{const[s,r]=[t[0],t[1]];if(null!==r)return h(r)&&!l(r)?(e[s]||(e[s]={}),void(e[s]=v(r,e[s]))):void(e[s]=r)})),e):e,x=/-(\w)/g,y=t=>t.replace(x,((t,e)=>e?e.toUpperCase():"")),{hasOwnProperty:b}=Object.prototype,E=(t,e)=>b.call(t,e),q=(t,e=new Map)=>{if(e.get(t))return e.get(t);if(!(t instanceof Object))return t;let s;s=t instanceof Array?[]:t instanceof Function?()=>t():t instanceof RegExp?new RegExp(t.source,t.flags):t instanceof Date?new Date(t):{},e.set(t,s);for(const r in t)E(t,r)&&(s[r]=q(t[r],e));return s},I=(t,e)=>t&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)?((t,e)=>e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e):e;var D,O,$,T,_;exports.EVENT=void 0,(D=exports.EVENT||(exports.EVENT={})).STATE="state",D.FAILED="failed",D.REQUEST_ERROR="requestError",D.POLLING_ERROR="pollingError",D.KEEPALIVE_ERROR="keepaliveError",exports.STATE=void 0,(O=exports.STATE||(exports.STATE={}))[O.CLOSE=0]="CLOSE",O[O.JOINED=1]="JOINED",O[O.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,($=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",$.WEBCTRL="webCtrl",$.WECHATMP="weChatMP",$.SUPERVISION="supervision",$.BIGSCREEN="bigScreen",$.DESKTOP="desktop",$.MOBILE="mobile",$.VCS="vcs",$.SIP="sip",$.H323="h323",$.PSTN="pstn",$.MULTI_STREAM="multiStream",$.MEETING_TOUCH="meetingTouch",$.MEETING_ROOMS="meetingRooms",exports.ROLE=void 0,(T=exports.ROLE||(exports.ROLE={})).HOST="host",T.COHOST="coHost",T.ATTENDEE="attendee",T.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(_=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",_.PAUSED="paused",_.STARTING="starting",_.STOPPED="stopped";class A{constructor(t,s){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=s,this.ctx=t,this.emitter=e(),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(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,r)=>{Object.keys(t).forEach((i=>{!1===r&&i in this.data&&(t[i]=this.data[i]);const n=e=>t[i]=e,o=`${y(i)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[i])&&!l(t[i])&&s(t[i],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}}class S extends A{constructor(t){super(t,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(t=>{const{state:e,body:s}=t;("full"===e||"update"===e)&&v(s,this.data)})),this.ctx.emitter.on("participantCount",(t=>{const{body:e}=t;v({participantCount:e},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/info/practiceSession`)}))}shareInfo(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/shareInfo`,{params:t})}meetings(t){if(!t)return Promise.reject();const{prefix:{ctrl:e}}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings`,{params:t})}mailTemplate(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}mailTemplate`,{params:{meetingID:s},headers:{language:t.language}})}}function w(t){const e=[],{isInLobby:s}=t.modules.me.data;return s?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((s=>{const r=t.modules[s]._topic();r&&(Array.isArray(r)?r.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(r)||e.push(r))})),e)}function P(e,s){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:r}=s.config.request,i=yield s.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:r,meetingId:t},inboxes:e}),n=[];return i.data&&Object.keys(i.data).forEach((t=>{n.push({name:t,seqId:i.data[t].maxSeqId,limit:200})})),n}))}function U(e,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r,clientID:i}=s.config.request,n=yield s.request.post(`${t}meetings/${r}/subscribe`,{endpointID:i,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((t=>{s.emitter.emit(t.event,t)}))}))}function N(e,s,r){return t(this,void 0,void 0,(function*(){const{inboxes:i,clientID:n,meetingID:o,cancelToken:a,status:c}=s;if(yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:i},{cancelToken:a})}catch(d){return c.attempts++,void console.error(d)}if(!t)return console.error("polling error: ","response is null"),void c.attempts++;const{data:s={},bizCode:u,error:d}=t;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,s&&Object.keys(s).forEach((t=>{const e=i.find((e=>e.name===t));e&&(e.seqId=s[t].maxSeqId,s[t].items&&s[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),e.pollingSeqId=t.seqId,r(e)})))}))})))(),!c.running)return;if(c.attempts>C)return console.error("polling Max Attempts"),void(s.onError&&s.onError({message:"polling Max Attempts"}));const u=c.attempts?M(c.attempts):0;c.timer=setTimeout((()=>{c.running&&N(e,s,r)}),u)}))}const R=(e,s)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:r}=s.config.request;s.status.polling.running=!0,N(s.request,{inboxes:e,clientID:r,meetingID:t,cancelToken:s.config.request.cancelToken.token,status:s.status.polling,onError:t=>{s.emitter.emit(exports.EVENT.POLLING_ERROR,t)}},(t=>{s.emitter.emit(t.event,t)}))}));function j(t){t.status.polling.running=!1,t.status.polling.attempts=0,t.status.polling.timer&&(clearTimeout(t.status.polling.timer),t.status.polling.timer=null),t.config.request.cancelToken.cancel(),t.config.request.cancelToken=c.source()}function L(e,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:r},meetingID:i,userID:n}=e.config.request;if(e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.request.post(`${r}meetings/${i}/users/${n}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token})}catch(a){return e.status.keepalive.attempts++,void console.error(a)}if(!t||!t.data)return;const{data:s={},bizCode:o,error:a}=t;if(900200!==o&&900408!==o&&901323!==o)return e.status.keepalive.attempts++,void console.error("keepalive ",o,a);const c=s.interval||"";if(!c)return e.status.keepalive.attempts++,void console.error("keepalive ",o,a);e.status.keepalive.interval=c,e.status.keepalive.attempts=0})))(),!e.status.keepalive.running)return;if(e.status.keepalive.attempts>C)return console.error("keepalive Max Attempts"),void(s&&s({message:"keepalive Max Attempts"}));const o=e.status.keepalive.attempts?M(e.status.keepalive.attempts):1e3*e.status.keepalive.interval;e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&L(e,s)}),o)}))}const k=t=>{t.status.keepalive.running=!1,t.status.keepalive.attempts=0,t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null)},C=5,M=t=>{console.log(`computeNextTimeout attempts: ${t}`);let e=Math.floor(Math.random()*Math.pow(2,t)+1);return e<2&&(e=2),e>30&&(e=30),1e3*e};var H;exports.MeEvent=void 0,(H=exports.MeEvent||(exports.MeEvent={})).INIT="meInit",H.UPDATE="meUpdate",H.UPDATE_USER_STATE="updateUserState",H.ROLECHANGE="meRoleChange",H.AUDIOCHANGE="meAudioChange",H.HANDUPCHANGE="meHandupChange",H.SETAUDIO="setAudio",H.VIDEOCHANGE="meVideoChange",H.SETVIDEO="setVideo",H.SHARECHANGE="meShareChange",H.DISPLAYNAMECHANGE="meDisplayNameChange",H.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",H.LOBBYCHANGE="meLobbyChange",H.BARRAGECHANGE="meBarrageChange",H.PERSONALLAYOUTCHANGE="personalLayoutChange",H.LEAVE="leave";class V extends A{constructor(t){super(t,"me")}_topic(){return""}_bindOn(){const e=e=>t(this,void 0,void 0,(function*(){if("role"in e&&e.role!==this.data.role){const t=this.data.role;v({role:e.role},this.data),e.role!==exports.ROLE.AUDIENCE&&t!==exports.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(exports.MeEvent.ROLECHANGE,e.role),this.ctx.emitter.emit(exports.MeEvent.ROLECHANGE,e.role)}})),s=t=>{var e,s,r,i,n,o;if("audio"in t){const{deviceOn:a,sendOn:c,recvOn:u,opBy:d}=t.audio;(!p(a)&&a!==(null===(e=this.data.audio)||void 0===e?void 0:e.deviceOn)||!p(c)&&c!==(null===(s=this.data.audio)||void 0===s?void 0:s.sendOn)||!p(u)&&c!==(null===(r=this.data.audio)||void 0===r?void 0:r.recvOn)||!p(d))&&(v({audio:t.audio},this.data),this.emitter.emit(exports.MeEvent.AUDIOCHANGE,{deviceOn:p(a)?null===(i=this.data.audio)||void 0===i?void 0:i.deviceOn:a,sendOn:p(c)?null===(n=this.data.audio)||void 0===n?void 0:n.sendOn:c,recvOn:p(c)?null===(o=this.data.audio)||void 0===o?void 0:o.recvOn:u,opBy:d,changeData:Object.assign({},t.audio)}))}},r=t=>{var e,s,r,i,n,o;if("video"in t){const{deviceOn:a,sendOn:c,opBy:u,blocked:d}=t.video;(!p(a)&&a!==(null===(e=this.data.video)||void 0===e?void 0:e.deviceOn)||!p(c)&&c!==(null===(s=this.data.video)||void 0===s?void 0:s.sendOn)||!p(d)&&d!==(null===(r=this.data.video)||void 0===r?void 0:r.blocked))&&(v({video:t.video},this.data),this.emitter.emit(exports.MeEvent.VIDEOCHANGE,{deviceOn:p(a)?null===(i=this.data.video)||void 0===i?void 0:i.deviceOn:a,sendOn:p(c)?null===(n=this.data.video)||void 0===n?void 0:n.sendOn:c,blocked:p(c)?null===(o=this.data.video)||void 0===o?void 0:o.blocked:d,opBy:u,changeData:Object.assign({},t.video)}))}},i=t=>{var e,s,r,i;if("share"in t){const{deviceOn:n,sendOn:o,opBy:a}=t.share;(!p(n)&&n!==(null===(e=this.data.share)||void 0===e?void 0:e.deviceOn)||!p(o)&&o!==(null===(s=this.data.share)||void 0===s?void 0:s.sendOn))&&(v({share:t.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=t=>{t.displayName&&t.displayName!==this.data.displayName&&(v({displayName:t.displayName},this.data),this.emitter.emit(exports.MeEvent.DISPLAYNAMECHANGE,t.displayName))},o=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(v({isHandUp:t.isHandUp},this.data),this.emitter.emit(exports.MeEvent.HANDUPCHANGE,t.isHandUp))},a=t=>{"isSpotlightVideo"in t&&(v({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(exports.MeEvent.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},c=e=>t(this,void 0,void 0,(function*(){if("isInLobby"in e&&e.isInLobby!==this.data.isInLobby){v({isInLobby:e.isInLobby},this.data);const t=!1===e.isInLobby?"inLobbyChange":void 0;yield this.rePolling(t),this.emitter.emit(exports.MeEvent.LOBBYCHANGE,e.isInLobby),this.ctx.emitter.emit(exports.MeEvent.LOBBYCHANGE,e.isInLobby)}})),u=e=>t(this,void 0,void 0,(function*(){const{event:t,state:s,body:r}=e;"personalLayout"===t&&("full"===s?v({personalLayout:r},this.data):"delete"===s&&(this.data.personalLayout=void 0),console.log(this.data.personalLayout),this.emitter.emit(exports.MeEvent.PERSONALLAYOUTCHANGE,this.data.personalLayout))})),d=t=>{if(!t.barrage)return;let e=null;if(!t.barrage.wordsDisplayStatus)return e=null,delete t.barrage,this.data.barrage=e||void 0,void this.emitter.emit(exports.MeEvent.BARRAGECHANGE,e);if(!t.barrage.receiver)return;e={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};let{role:s}=this.data;if(this.data.endpointType===exports.ENDPOINT_TYPE.SUPERVISION){const{info:t}=this.ctx.modules;s="webinar"===t.meetingType?exports.ROLE.AUDIENCE:exports.ROLE.ATTENDEE}s===exports.ROLE.HOST||s===exports.ROLE.COHOST?e=t.barrage.receiver.host?e:null:s===exports.ROLE.ATTENDEE?e=t.barrage.receiver.attendee?e:null:s===exports.ROLE.AUDIENCE&&(e=t.barrage.receiver.audience?e:null),delete t.barrage,this.data.barrage=e||void 0,this.emitter.emit(exports.MeEvent.BARRAGECHANGE,e)},l=t=>{"leave"in t&&!0===t.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),j(this.ctx),K(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},h=t=>{e(t),s(t),r(t),i(t),n(t),o(t),c(t),a(t),d(t),l(t),(this.data.isInLobby||this.data.role===exports.ROLE.AUDIENCE)&&this.data.share&&this.data.share.sendOn&&i({share:{deviceOn:!0,sendOn:!1,recvOn:!1}})};this.ctx.emitter.on(exports.MeEvent.INIT,(t=>{v(t,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(exports.MeEvent.UPDATE,(t=>{h(t),v(t,this.data)})),this.ctx.emitter.on(exports.EVENT.STATE,(({state:t})=>{t===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",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:s={users:[]}}=e;if("delete"===t){const t=s.users[0];return t.leave=!0,void l(t)}let r=s.users.find((t=>t.userID===this.data.userID));r||s.users.length&&(r=s.users[0]),r?(h(r),v(r,this.data)):console.warn("me ",t,s)})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(exports.MeEvent.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(exports.MeEvent.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(t=>{const{body:e={}}=t;if("ended"===e.state){l({leave:!0,resultInfo:e.resultInfo})}})),this.ctx.emitter.on("personalLayout",(t=>{u(t)}))}updateUserState(t,e=!1){if(!e){const{role:e,initialMediaState:s}=this.data;t.audio.sendOn=t.audio.sendOn&&s.audio.sendOn,t.video.sendOn=t.video.sendOn&&s.video.sendOn,e===exports.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${s}meetings/${r}/updateUserState`,t)}rePolling(e){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;j(t);const s=w(t),r=yield P(s,t);if(e&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:e}),yield U(s,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:i}=t.config.request;t.worker.postMessage({inboxes:r,topics:s,meetingID:e,clientID:i,rePolling:!0})}else yield R(r,t)}))}}class B extends A{constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:s}=t;if(e&&e.users){if("full"===s)return this.data.callRecordUsers=e.users.map((t=>(t.displayNamePinyin=B.setDisplayNamePinyinProp?B.setDisplayNamePinyinProp(t.displayName||""):t.displayName,t))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);this.data.callRecordUsers||(this.data.callRecordUsers=[]),e.users.forEach((t=>{const e=this.data.callRecordUsers.findIndex((e=>t.inviteTransID===e.inviteTransID));"update"===s&&-1!==e?v(t,this.data.callRecordUsers[e]):"update"===s&&-1===e&&(t.displayNamePinyin=B.setDisplayNamePinyinProp?B.setDisplayNamePinyinProp(t.displayName||""):t.displayName,this.data.callRecordUsers.push(t))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/invite`,t)}cancelInvite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/cancelInvite`,t)}}class G extends A{constructor(t){super(t,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:e}=this.ctx.modules.me.data;return e===exports.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:t===exports.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:e,state:s})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:r={}}=t;if("delete"!==s||"delete"===s&&[901357,901358,901352,901351,901350,901349].includes(r.bizCode||-1))return void this.ctx.emitter.emit(exports.MeEvent.UPDATE,t);let i=!1;switch(e){case"interactiveUsers":t.isInLobby||(i=!0);break;case"broadcastUsers":t.isInLobby||t.role!==exports.ROLE.AUDIENCE||(i=!0);break;case"lobbyUsers":t.isInLobby&&(i=!0)}const n={};i&&(n.leave=!0),this.ctx.emitter.emit(exports.MeEvent.UPDATE,Object.assign(Object.assign({},t),n))},e=({updateUsers:e,state:s,sourceKey:r})=>{if("full"===s)return this.data[r]=e.map((e=>(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(e.displayName):e.displayName,e.groupIDs=G.setUserGroupIDs?G.setUserGroupIDs(e.groupIDs||[]):e.groupIDs,t(e,{event:r,state:s}),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:i,emitter:n}=this;return e.forEach((e=>{const o=i[r].findIndex((t=>e.userID===t.userID));if("delete"===s&&-1!==o){const[t]=this.data[r].splice(o,1);n.emit(`${r}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===s&&-1!==o){const t=this.data[r][o];this.updateUserProps(e,t),v(e,t),this.data[r][o]=q(t),this.emitter.emit(`${r}Update`,{user:this.data[r][o]})}else"update"===s&&-1===o&&(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(e.displayName):e.displayName,i[r].push(e),this.emitter.emit(`${r}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:r,state:s})})),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!1}),this.data[r]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"advCtrlUsers"})}))}reactive(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,r)=>{Object.keys(t).forEach((i=>{!1===r&&i in this.data&&(t[i]=this.data[i]);const n=e=>t[i]=e.users.map((t=>t)),o=`${y(i)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[i])&&!l(t[i])&&s(t[i],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(t,e){t.displayName&&t.displayName!==e.displayName&&(t.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(t.displayName):t.displayName)}setAudio(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/users/${t}/callStats`)}callStatsReport(t){if(!t.userID)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t.userID}/callStats/report`,t)}replyAllHandUp(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/refuseAll`)}getSendLayout(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/sendLayout`)}setSendLayout(t,e){const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/sendLayout`,e)}setSendLayoutEnabled(t,e){const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/sendLayoutEnabled`,e)}pauseAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/pauseAudio`)}resumeAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/resumeAudio`)}modifyRoleBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyRoleBatch `,t)}modifyVideoBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyVideoBatch `,t)}putInLobbyBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/putInLobbyBatch `,t)}removeBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/removeBatch `,t)}}function Y(t){const{baseURL:s,modules:r,worker:i,singleton:n}=t;r.findIndex((t=>t===V))<0&&r.push(V),r.findIndex((t=>t===S))<0&&r.push(S);const o=t.clientID||`${g()}_${((t=new Date,e)=>{const s={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(const r in s)new RegExp("("+r+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[r]:("00"+s[r]).substr((""+s[r]).length)));return e})(new Date,"MMddHHmmss")}`,u={config:{baseURL:s,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:i,emitter:e(),request:new a({baseURL:s,beforeRequest:t=>{t.headers["X-Y-Request-Id"]=g(),t.timeout=18e5},error:t=>{u.emitter.emit(exports.EVENT.REQUEST_ERROR,t)}}),modules:{},state:exports.STATE.CLOSE,status:{polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},cleanup:t=>{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,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),Object.keys(u.modules).forEach((t=>{u.modules[t].cleanup()})),u.state=exports.STATE.CLOSE,u.emitter.emit(exports.EVENT.STATE,{state:u.state,reason:t}))}};return u}function Q(t){const e=Y(t);return e.worker&&("undefined"!=typeof Worker?e.worker.postMessage({baseURL:e.config.baseURL}):console.error("The current environment does not support worker")),function(t,e){if(!l(t))return void console.error("The modules parameter requires an array type");t.forEach((t=>{const s=new t(e);e.modules[s.moduleName]=s}))}(e.config.modules,e),e.emitter.on(exports.EVENT.POLLING_ERROR,(t=>{J(e)({resultInfo:t})})),e.emitter.on(exports.EVENT.KEEPALIVE_ERROR,(t=>{J(e)({resultInfo:t})})),Object.assign({config:e.config,request:e.request,get state(){return e.state},on:e.emitter.on,off:e.emitter.off,join:F(e),leave:J(e),end:W(e),endMeeting:z(e)},e.modules)}function F(e){return function(s){var r;return t(this,void 0,void 0,(function*(){const{clientID:t}=e.config.request,i=`${null===(r=s.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${t}_${s.meetingNum}`;e.config.request.sessionID=i,e.request.setDefaultHeader("X-Y-Session-Id",i);const{prefix:n}=e.config.request,o=yield e.request.get(`${n.ctrl}credential`,{params:{meetingNum:s.meetingNum,pwd:s.pwd,url:s.url,mobileCode:s.mobileCode,mobile:s.mobile,regEmail:s.regEmail,accEmail:s.accEmail,tk:s.tk,displayName:s.displayName,userAgent:s.userAgent},headers:{"X-Y-Endpoint-Type":s.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return e.emitter.emit(exports.EVENT.FAILED,{bizCode:o.bizCode,data:o.data}),o;e.config.request.location=c,e.request.setDefaultHeader("X-Y-Location",c),delete s.pwd,delete s.url;const u={displayName:s.displayName,userAgent:s.userAgent,clientID:t};s.groupIDs&&s.account&&(u.groupIDs=s.groupIDs,u.account=s.account,u.groupName=s.groupName);const d=yield e.request.post(`${n.ctrl}join?meetingNum=${s.meetingNum}&credential=${a}`,u,{headers:{"X-Y-Endpoint-Type":s.endpointType,"X-Y-Endpoint-Id":t}});if(!d||d&&d.ret<=-1)return e.emitter.emit(exports.EVENT.FAILED,{bizCode:d.bizCode,data:d.data}),d;const{meetingID:l="",ctrlID:p="",user:h={},mediaContent:f={},initialMediaState:m={},tk:g=""}=d.data;e.config.request.meetingID=l,e.config.request.ctrlID=p,e.config.request.userID=h.userID,e.config.request.voteTk=g,e.request.setDefaultHeader("X-Y-Ctrl-Id",p),e.emitter.emit(exports.MeEvent.INIT,Object.assign(Object.assign({},h),{mediaContent:f,initialMediaState:m})),e.state=exports.STATE.JOINED,e.emitter.emit(exports.EVENT.STATE,{state:e.state});const v=()=>{e.state!==exports.STATE.READY&&(e.state=exports.STATE.READY,e.emitter.emit(exports.EVENT.STATE,{state:e.state}))},x=w(e),y=yield P(x,e);return yield U(x,e),"undefined"!=typeof Worker&&e.worker?(e.status.polling.running=!0,e.worker.postMessage({topics:x,meetingID:l,clientID:t,inboxes:y,status:!0}),e.worker.onmessage=t=>{"pollingStarted"!==t.data?"pollingStopped"!==t.data?(console.log("[Polling]",t.data),e.emitter.emit(t.data.event,t.data)):e.status.polling.running=!1:v()}):(e.status.polling.running=!0,R(y,e),v()),e.status.keepalive.running=!0,L(e,(t=>{e.emitter.emit(exports.EVENT.KEEPALIVE_ERROR,t)})),d.data=Object.assign(Object.assign({},d.data),o.data),d}))}}function J(e){return function(s){return t(this,void 0,void 0,(function*(){s||(s={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:r}=e.config.request;let i;try{i=yield e.request.post(`${t.ctrl}meetings/${r}/leave`,s)}catch(n){console.error(n)}return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),j(e),k(e),K(e),e.cleanup(),i}))}}function W(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:s}=e.config.request,r=yield e.request.post(`${t.ctrl}meetings/${s}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),j(e),k(e),K(e),e.cleanup(),r}))}}function z(e){return function(s){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${s}/end`)}))}}class X{constructor(t){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=Q(t)}static getInstance(t){return this.instance?this.instance:this.instance=new X(t)}}function K(t){if(t.config.singleton){const{baseURL:e,modules:s,singleton:r}=t.config,i={baseURL:e,modules:s,worker:t.worker,singleton:r},n=X.getInstance(i);n&&(n.meeting=Q(i))}}Object.defineProperty(X,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.Asr=class extends A{constructor(t){super(t,"asr")}_topic(){return["meeting"]}_bindOn(){this.ctx.emitter.on("asr",(t=>{const{body:e}=t;void 0===this.data.asr&&(this.data.asr={status:"stopped"}),v(e,this.data.asr),this.emitter.emit("asrChange",{asr:this.data.asr,changeData:e})}))}cleanup(){this.emitter.all=new Map}transcriptStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/transcript/status`,e)}))}},exports.Chat=class extends A{constructor(t){super(t,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(t=>{const{body:e}=t;this.emitter.emit("chatMsg",e)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/chat/historyMsg`,e)}))}},exports.Info=S,exports.Interpretation=class extends A{constructor(t){super(t,"interpretation"),this.data={status:"stopped",interpreters:[]}}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("interpretation",(t=>{const{body:e,state:s}=t;"full"===s?(this.data.interpreters=e.interpreters,this.data.status=e.status):this.data.status=e.status,this.emitter.emit("interpretationChange",this.data)}))}interpretationStart(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/interpretation/start`,t)}interpretationEnd(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/interpretation/stop`)}},exports.Invite=B,exports.LiveStream=class extends A{constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:s,body:r,stime:i}=t;if(r){if(i&&(this.data.jetlag=i),"full"===s){const{liveStreams:t=[]}=r;if(!t.length)return;const e=[];this.data.liveStreams=t.map((t=>(t.requesting="starting"===t.status,e.push({platform:t.platform||"",status:(t.requesting?"stopped":t.status)||""}),t)));return v({status:e,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),r.liveStreams||(this.data.resultInfo={}),null===(e=r.liveStreams)||void 0===e||e.forEach((t=>{this.data.resultInfo=t.resultInfo||{};let e=this.data.liveStreams.findIndex((e=>e.platform===t.platform));-1===e?(t.requesting="starting"===t.status,this.data.liveStreams.push(t)):(t.requesting="starting"===t.status,t=Object.assign(Object.assign({},this.data.liveStreams[e]),t),this.data.liveStreams.splice(e,1,t)),e=this.data.status.findIndex((e=>e.platform===t.platform));const s=this.data.status.map((t=>t));-1===e?s.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):s.splice(e,1,{platform:s[e].platform||"",status:t.requesting?s[e].status||"stopped":t.status||""}),this.data.status=s})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/setting`,e)}))}},exports.Me=V,exports.Qa=class extends A{constructor(t){super(t,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(t=>{const{body:e}=t;h(e)&&!l(e)?this.qaUpdate(this.data.questions,e):e.forEach((t=>this.qaUpdate(this.data.questions,t)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(t,e){let s=t.get(e.question.id);const{clientID:r}=this.ctx.config.request;switch(e.command){case"addQuestion":s=this.createQuestion(e.question),t.set(e.question.id,s),this.emitter.emit("questionAdd",{question:s,selfSent:s.sender.endpointID===r});break;case"dismissQuestion":if(!s)break;s.sender.endpointID!==r?s.status="close":s.isTop=!1,t.set(e.question.id,s),this.emitter.emit("questionUpdate",{question:s});break;case"reopenQuestion":s?(s.status="open",s.isTop=e.question.isTop,t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"updateQuestion":s?(s=Object.assign(Object.assign(Object.assign({},s),e.question),{topSort:e.question.isTop?this.data.topSort++:0}),t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteQuestion":if(!s)break;s.sender.endpointID!==r?t.delete(e.question.id):(s.status="delete",s.isTop=!1,s.answers.clear(),t.set(e.question.id,s)),this.emitter.emit("questionDelete",{question:s});break;case"answerQuestion":s?s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)):(s=this.createQuestion(e.question),s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteAnswer":s&&(s.answers.delete(e.answer.id),this.emitter.emit("questionUpdate",{question:s}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(t){return{isAnonymous:t.isAnonymous,isTop:t.isTop,id:t.id,content:t.content,sender:t.sender,timestamp:t.timestamp||-1,status:t.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(t){return{isPrivate:t.isPrivate,content:t.content,id:t.id,sender:t.sender,timestamp:t.timestamp||-1}}qa(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/qa`,e)}))}},exports.Recording=class extends A{constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:s,stime:r}=t;if(s)return r&&(this.data.stime=r),this.data.isPracticeSession="started"===s.status&&this.data.status===s.status&&0===s.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),s),"starting"===s.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=s.status||this.data.status),this.data.resultInfo=s.resultInfo||{},["full","update"].includes(e)?(s.recordUsers&&(this.data.recording.recordUsers=s.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/layout`,e)}))}},exports.Setting=class extends A{constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:s}=t;["full","update"].includes(e)&&v(s,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/unmuteAll`)}))}},exports.ShouldJoinUsers=class extends A{constructor(t){super(t,"shouldJoinUsers")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("shouldJoinUsers",(t=>{const{state:e}=t;"update"===e&&this.emitter.emit("shouldJoinUsersChange")}))}modifyUser(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/attendance/shouldJoin`,t)}getUser(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/attendance/getShouldJoin`)}},exports.SpotlightVideo=class extends A{constructor(t){super(t,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:e}=t;if(!e||!e.userIDs)return;this.data.userIDs=e.userIDs;e.userIDs.findIndex((t=>t===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(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/view/spotlight`,t)}},exports.Transcript=class extends A{constructor(t){super(t,"transcript"),this.data={asr:{status:"stopped"}}}_topic(){return["transcript"]}_bindOn(){this.ctx.emitter.on("transcriptMsg",(t=>{const{body:e}=t;this.emitter.emit("transcriptMsg",e)}))}cleanup(){this.emitter.all=new Map}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/transcript/historyMsg`,e)}))}},exports.Users=G,exports.View=class extends A{constructor(t){super(t,"view")}_topic(){const{endpointType:t,role:e}=this.ctx.modules.me.data;return t===exports.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:e===exports.ROLE.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((t=>{this.ctx.emitter.on(t,(e=>{"personalView"!==t?this.updateLayout(e,t):this.updatePersonalLayouts(e)}))})),this.ctx.emitter.on("videoSourcesUpdated",(()=>{this.emitter.emit("videoSourcesUpdated")}))}updateLayout(t,e){const{event:s,body:r}=t;r&&("meetingView"===s?Object.keys(r).forEach((t=>{this.data[t]=r[t]})):this.data[e]=r)}updatePersonalLayouts(t){const{state:e,body:s}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),s.personalLayouts.forEach((t=>{const{subscriber:s={userID:-1}}=t,r=s.userID||s.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[r]=t: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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/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)}))}setSavedBackground(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/recentBackgroundFile`,e)}))}getSavedBackground(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/view/recentBackgroundFile`)}))}},exports.Vote=class extends A{constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:s}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[s]=e,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:e})})),this.ctx.emitter.on(exports.MeEvent.LOBBYCHANGE,(t=>{t&&(this.data.vote={})}))}getVotes(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.get(`${e}meetings/${s}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.get(`${e}meetings/${s}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.get(`${e}meetings/${s}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:s},meetingID:r,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${s}meetings/${r}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:s},meetingID:r,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${s}meetings/${r}/vote/submit?tk=${t.tk}&voteID=${t.voteID}`,e)}voteAdd(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/add`,t)}voteEdit(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/edit`,t)}voteDelete(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/delete`,t)}voteInProgress(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/vote/inProgress`,{params:{tk:t&&t.tk||r}})}},exports.Words=class extends A{constructor(t){super(t,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:e,body:s,pollingSeqId:r}=t;if(!s)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data});"full"===e&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),r&&(this.data.barrageRecord=[{id:r,content:s.content,time:(new Date).getTime(),durationType:s.durationType,duration:1e3*s.duration},...this.data.barrageRecord]),s.wordsDisplayStatus=!0,-1!==s.duration&&(this.data.timer=setTimeout((()=>{s.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=s.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*s.duration)),v(s,this.data),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(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/deleteBarrage`)}))}},exports.createMeeting=function(t){return t.singleton?X.getInstance(t).meeting:Q(t)},exports.reset=K;
package/dist/meeting.d.ts CHANGED
@@ -406,7 +406,11 @@ export declare enum ENDPOINT_TYPE {
406
406
  /**
407
407
  * 亿联会议平板
408
408
  */
409
- MEETING_TOUCH = "meetingTouch"
409
+ MEETING_TOUCH = "meetingTouch",
410
+ /**
411
+ * 硬件终端
412
+ */
413
+ MEETING_ROOMS = "meetingRooms"
410
414
  }
411
415
 
412
416
  /**
@@ -931,6 +935,11 @@ export declare interface LayoutContent {
931
935
  fileID: string;
932
936
  fileURL: string;
933
937
  };
938
+ backgroundFileList?: {
939
+ fileID: string;
940
+ fileURL: string;
941
+ }[];
942
+ type2?: string;
934
943
  hideNoPictureEnabled?: boolean;
935
944
  }
936
945
 
@@ -1779,7 +1788,7 @@ declare interface ShouldJoinUser {
1779
1788
  groupNames: string[];
1780
1789
  groupIDs: string[];
1781
1790
  accountType: number;
1782
- userID: number;
1791
+ userIDs: number[];
1783
1792
  }
1784
1793
 
1785
1794
  export declare class ShouldJoinUsers extends Module<ShouldJoinUsersData, Events_5> {
@@ -1 +1 @@
1
- function t(t,e,s,i){return new(s||(s=Promise))((function(r,n){function o(t){try{c(i.next(t))}catch(e){n(e)}}function a(t){try{c(i.throw(t))}catch(e){n(e)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,a)}c((i=i.apply(t,e||[])).next())}))}function e(t){return{all:t=t||new Map,on:function(e,s){var i=t.get(e);i?i.push(s):t.set(e,[s])},off:function(e,s){var i=t.get(e);i&&(s?i.splice(i.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var i=t.get(e);i&&i.slice().map((function(t){t(s)})),(i=t.get("*"))&&i.slice().map((function(t){t(e,s)}))}}}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i={exports:{}};!function(t,e){var i="__lodash_hash_undefined__",r=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]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",x="[object ArrayBuffer]",b="[object DataView]",q="[object Float32Array]",I="[object Float64Array]",D="[object Int8Array]",$="[object Int16Array]",E="[object Int32Array]",O="[object Uint8Array]",_="[object Uint8ClampedArray]",A="[object Uint16Array]",w="[object Uint32Array]",S=/\w*$/,T=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,j={};j[n]=j["[object Array]"]=j[x]=j[b]=j[o]=j[a]=j[q]=j[I]=j[D]=j[$]=j[E]=j[d]=j[l]=j[p]=j[f]=j[m]=j[g]=j[v]=j[O]=j[_]=j[A]=j[w]=!0,j["[object Error]"]=j[c]=j[y]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,k="object"==typeof s&&s&&s.Object===Object&&s||P||Function("return this")(),C=e&&!e.nodeType&&e,N=C&&t&&!t.nodeType&&t,R=N&&N.exports===C;function L(t,e){return t.set(e[0],e[1]),t}function H(t,e){return t.add(e),t}function M(t,e,s,i){var r=-1,n=t?t.length:0;for(i&&n&&(s=t[++r]);++r<n;)s=e(s,t[r],r,t);return s}function B(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(s){}return e}function V(t){var e=-1,s=Array(t.size);return t.forEach((function(t,i){s[++e]=[i,t]})),s}function G(t,e){return function(s){return t(e(s))}}function Y(t){var e=-1,s=Array(t.size);return t.forEach((function(t){s[++e]=t})),s}var Q,F=Array.prototype,J=Function.prototype,W=Object.prototype,z=k["__core-js_shared__"],X=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=J.toString,Z=W.hasOwnProperty,tt=W.toString,et=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),st=R?k.Buffer:void 0,it=k.Symbol,rt=k.Uint8Array,nt=G(Object.getPrototypeOf,Object),ot=Object.create,at=W.propertyIsEnumerable,ct=F.splice,ut=Object.getOwnPropertySymbols,dt=st?st.isBuffer:void 0,lt=G(Object.keys,Object),pt=Nt(k,"DataView"),ht=Nt(k,"Map"),ft=Nt(k,"Promise"),mt=Nt(k,"Set"),gt=Nt(k,"WeakMap"),vt=Nt(Object,"create"),yt=Bt(pt),xt=Bt(ht),bt=Bt(ft),qt=Bt(mt),It=Bt(gt),Dt=it?it.prototype:void 0,$t=Dt?Dt.valueOf:void 0;function Et(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function Ot(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function _t(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function At(t){this.__data__=new Ot(t)}function wt(t,e){var s=Gt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Yt(t)}(t)&&Z.call(t,"callee")&&(!at.call(t,"callee")||tt.call(t)==n)}(t)?function(t,e){for(var s=-1,i=Array(t);++s<t;)i[s]=e(s);return i}(t.length,String):[],i=s.length,r=!!i;for(var o in t)!e&&!Z.call(t,o)||r&&("length"==o||Ht(o,i))||s.push(o);return s}function St(t,e,s){var i=t[e];Z.call(t,e)&&Vt(i,s)&&(void 0!==s||e in t)||(t[e]=s)}function Tt(t,e){for(var s=t.length;s--;)if(Vt(t[s][0],e))return s;return-1}function Ut(t,e,s,i,r,h,y){var T;if(i&&(T=h?i(t,r,h,y):i(t)),void 0!==T)return T;if(!Jt(t))return t;var U=Gt(t);if(U){if(T=function(t){var e=t.length,s=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(s.index=t.index,s.input=t.input);return s}(t),!e)return function(t,e){var s=-1,i=t.length;e||(e=Array(i));for(;++s<i;)e[s]=t[s];return e}(t,T)}else{var P=Lt(t),k=P==c||P==u;if(Qt(t))return function(t,e){if(e)return t.slice();var s=new t.constructor(t.length);return t.copy(s),s}(t,e);if(P==p||P==n||k&&!h){if(B(t))return h?t:{};if(T=function(t){return"function"!=typeof t.constructor||Mt(t)?{}:(e=nt(t),Jt(e)?ot(e):{});var e}(k?{}:t),!e)return function(t,e){return kt(t,Rt(t),e)}(t,function(t,e){return t&&kt(e,Wt(e),t)}(T,t))}else{if(!j[P])return h?t:{};T=function(t,e,s,i){var r=t.constructor;switch(e){case x:return Pt(t);case o:case a:return new r(+t);case b:return function(t,e){var s=e?Pt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.byteLength)}(t,i);case q:case I:case D:case $:case E:case O:case _:case A:case w:return function(t,e){var s=e?Pt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.length)}(t,i);case d:return function(t,e,s){return M(e?s(V(t),!0):V(t),L,new t.constructor)}(t,i,s);case l:case g:return new r(t);case f:return function(t){var e=new t.constructor(t.source,S.exec(t));return e.lastIndex=t.lastIndex,e}(t);case m:return function(t,e,s){return M(e?s(Y(t),!0):Y(t),H,new t.constructor)}(t,i,s);case v:return n=t,$t?Object($t.call(n)):{}}var n}(t,P,Ut,e)}}y||(y=new At);var C=y.get(t);if(C)return C;if(y.set(t,T),!U)var N=s?function(t){return function(t,e,s){var i=e(t);return Gt(t)?i:function(t,e){for(var s=-1,i=e.length,r=t.length;++s<i;)t[r+s]=e[s];return t}(i,s(t))}(t,Wt,Rt)}(t):Wt(t);return function(t,e){for(var s=-1,i=t?t.length:0;++s<i&&!1!==e(t[s],s,t););}(N||t,(function(r,n){N&&(r=t[n=r]),St(T,n,Ut(r,e,s,i,n,t,y))})),T}function jt(t){return!(!Jt(t)||(e=t,X&&X in e))&&(Ft(t)||B(t)?et:T).test(Bt(t));var e}function Pt(t){var e=new t.constructor(t.byteLength);return new rt(e).set(new rt(t)),e}function kt(t,e,s,i){s||(s={});for(var r=-1,n=e.length;++r<n;){var o=e[r],a=i?i(s[o],t[o],o,s,t):void 0;St(s,o,void 0===a?t[o]:a)}return s}function Ct(t,e){var s,i,r=t.__data__;return("string"==(i=typeof(s=e))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==s:null===s)?r["string"==typeof e?"string":"hash"]:r.map}function Nt(t,e){var s=function(t,e){return null==t?void 0:t[e]}(t,e);return jt(s)?s:void 0}Et.prototype.clear=function(){this.__data__=vt?vt(null):{}},Et.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Et.prototype.get=function(t){var e=this.__data__;if(vt){var s=e[t];return s===i?void 0:s}return Z.call(e,t)?e[t]:void 0},Et.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:Z.call(e,t)},Et.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?i:e,this},Ot.prototype.clear=function(){this.__data__=[]},Ot.prototype.delete=function(t){var e=this.__data__,s=Tt(e,t);return!(s<0)&&(s==e.length-1?e.pop():ct.call(e,s,1),!0)},Ot.prototype.get=function(t){var e=this.__data__,s=Tt(e,t);return s<0?void 0:e[s][1]},Ot.prototype.has=function(t){return Tt(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var s=this.__data__,i=Tt(s,t);return i<0?s.push([t,e]):s[i][1]=e,this},_t.prototype.clear=function(){this.__data__={hash:new Et,map:new(ht||Ot),string:new Et}},_t.prototype.delete=function(t){return Ct(this,t).delete(t)},_t.prototype.get=function(t){return Ct(this,t).get(t)},_t.prototype.has=function(t){return Ct(this,t).has(t)},_t.prototype.set=function(t,e){return Ct(this,t).set(t,e),this},At.prototype.clear=function(){this.__data__=new Ot},At.prototype.delete=function(t){return this.__data__.delete(t)},At.prototype.get=function(t){return this.__data__.get(t)},At.prototype.has=function(t){return this.__data__.has(t)},At.prototype.set=function(t,e){var s=this.__data__;if(s instanceof Ot){var i=s.__data__;if(!ht||i.length<199)return i.push([t,e]),this;s=this.__data__=new _t(i)}return s.set(t,e),this};var Rt=ut?G(ut,Object):function(){return[]},Lt=function(t){return tt.call(t)};function Ht(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||U.test(t))&&t>-1&&t%1==0&&t<e}function Mt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||W)}function Bt(t){if(null!=t){try{return K.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Vt(t,e){return t===e||t!=t&&e!=e}(pt&&Lt(new pt(new ArrayBuffer(1)))!=b||ht&&Lt(new ht)!=d||ft&&Lt(ft.resolve())!=h||mt&&Lt(new mt)!=m||gt&&Lt(new gt)!=y)&&(Lt=function(t){var e=tt.call(t),s=e==p?t.constructor:void 0,i=s?Bt(s):void 0;if(i)switch(i){case yt:return b;case xt:return d;case bt:return h;case qt:return m;case It:return y}return e});var Gt=Array.isArray;function Yt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}(t.length)&&!Ft(t)}var Qt=dt||function(){return!1};function Ft(t){var e=Jt(t)?tt.call(t):"";return e==c||e==u}function Jt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return Yt(t)?wt(t):function(t){if(!Mt(t))return lt(t);var e=[];for(var s in Object(t))Z.call(t,s)&&"constructor"!=s&&e.push(s);return e}(t)}t.exports=function(t){return Ut(t,!0,!0)}}(i,i.exports);var r=i.exports;const n=t=>({get(e,s,i){if("__isProxy"===s)return!0;const r=Reflect.get(e,s);return Array.isArray(r)?r:"object"==typeof r&&null!==r?r.__isProxy?r:new Proxy(r,n(t)):r},set(e,s,i,n){const o=e[s];i=h(i)&&i.__isProxy?r(i):i;const a=Reflect.set(e,s,i,n);return((t,e)=>t!==e&&(t==t||e==e))(i,o)&&t.emit(`${x(s)}Change`,i),a}}),o=t=>encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(t){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=t.baseURL,this._beforeRequest=t.beforeRequest,this._errorHandler=t.error}_request(t){const e=t.timeout||18e5;let s=t.headers||{};return t.url=D(this.baseURL,t.url||""),t.url=((t,e)=>{if(!e)return t;const s=[];Object.keys(e).forEach((t=>{const i=e[t];if(null==i)return;let r;Array.isArray(i)?(r=i,t+="[]"):r=[i],r.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),s.push(`${o(t)}=${o(e)}`)}))}));const i=s.join("&");if(i){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t})(t.url,t.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[t],delete s[t])})),f(t.data)&&(t.data=t.data.buffer),m(t.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=s,t.timeout=e,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx&&void 0!==wx.request?d(t):u(t)}setDefaultHeader(t,e){t in this._defaultHeaders&&(""===e||null===e)?delete this._defaultHeaders[t]:this._defaultHeaders[t]=e}get(t,e){return this._errorHandler?this._request(Object.assign(e||{},{url:t,method:"GET"})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(e||{},{url:t,method:"GET"}))}post(t,e,s){return this._errorHandler?this._request(Object.assign(s||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(s||{},{url:t,method:"POST",data:e}))}}class c{constructor(t){let e;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((t=>{e=t})),t((t=>{this.reason||(this.reason=t,e(this.reason))}))}static source(){let t;const e=new c((e=>{t=e}));return{cancel:t,token:e}}}const u=t=>new Promise(((e,s)=>{const{data:i=null,url:r,method:n="GET",headers:o,cancelToken:a}=t;let c=new XMLHttpRequest;c.open(n.toUpperCase(),r,!0),c.timeout=t.timeout;const u=()=>{if(c){if(c.status>=200&&c.status<300)try{const t=JSON.parse(c.responseText);e(t)}catch(t){s(new Error("E_JSON_PARSE"+c.responseText))}else s({url:r,statusCode:c.status});c=null}};"onloadend"in c?c.onloadend=u:c.onreadystatechange=()=>{c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=()=>{c&&(s({url:r,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{s(new Error("Network Error")),c=null},c.ontimeout=()=>{s(new Error("timeout of "+t.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(o).forEach((t=>{null===i&&"content-type"===t.toLowerCase()?delete o[t]:c.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{c&&(c.abort(),s(t),c=null)})),c.send(i)})),d=t=>new Promise(((e,s)=>{const{data:i=null,url:r,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:r,data:i,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):s({url:r,statusCode:t.statusCode})},fail(t){s("request:fail abort"===t.errMsg&&a&&a.reason||t)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=t=>null==t,h=t=>"object"==typeof t&&null!==t,f=t=>{let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer,e},m=t=>{if("[object Object]"!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},g=()=>{const t=[],e="0123456789abcdef";for(let s=0;s<36;s++)t[s]=e.substr(Math.floor(16*Math.random()),1);t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-";return t.join("").split("-").join("")},v=(t,e)=>t?(Object.entries(t).forEach((t=>{const[s,i]=[t[0],t[1]];if(null!==i)return h(i)&&!l(i)?(e[s]||(e[s]={}),void(e[s]=v(i,e[s]))):void(e[s]=i)})),e):e,y=/-(\w)/g,x=t=>t.replace(y,((t,e)=>e?e.toUpperCase():"")),{hasOwnProperty:b}=Object.prototype,q=(t,e)=>b.call(t,e),I=(t,e=new Map)=>{if(e.get(t))return e.get(t);if(!(t instanceof Object))return t;let s;s=t instanceof Array?[]:t instanceof Function?()=>t():t instanceof RegExp?new RegExp(t.source,t.flags):t instanceof Date?new Date(t):{},e.set(t,s);for(const i in t)q(t,i)&&(s[i]=I(t[i],e));return s},D=(t,e)=>t&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)?((t,e)=>e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e):e;var $,E,O,_,A;!function(t){t.STATE="state",t.FAILED="failed",t.REQUEST_ERROR="requestError",t.POLLING_ERROR="pollingError",t.KEEPALIVE_ERROR="keepaliveError"}($||($={})),function(t){t[t.CLOSE=0]="CLOSE",t[t.JOINED=1]="JOINED",t[t.READY=2]="READY"}(E||(E={})),function(t){t.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",t.MULTI_STREAM="multiStream",t.MEETING_TOUCH="meetingTouch"}(O||(O={})),function(t){t.HOST="host",t.COHOST="coHost",t.ATTENDEE="attendee",t.AUDIENCE="audience"}(_||(_={})),function(t){t.STARTED="started",t.PAUSED="paused",t.STARTING="starting",t.STOPPED="stopped"}(A||(A={}));class w{constructor(t,s){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=s,this.ctx=t,this.emitter=e(),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(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,i)=>{Object.keys(t).forEach((r=>{!1===i&&r in this.data&&(t[r]=this.data[r]);const n=e=>t[r]=e,o=`${x(r)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[r])&&!l(t[r])&&s(t[r],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}}class S extends w{constructor(t){super(t,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(t=>{const{state:e,body:s}=t;("full"===e||"update"===e)&&v(s,this.data)})),this.ctx.emitter.on("participantCount",(t=>{const{body:e}=t;v({participantCount:e},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/info/practiceSession`)}))}shareInfo(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/shareInfo`,{params:t})}meetings(t){if(!t)return Promise.reject();const{prefix:{ctrl:e}}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings`,{params:t})}mailTemplate(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}mailTemplate`,{params:{meetingID:s},headers:{language:t.language}})}}function T(t){const e=[],{isInLobby:s}=t.modules.me.data;return s?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((s=>{const i=t.modules[s]._topic();i&&(Array.isArray(i)?i.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(i)||e.push(i))})),e)}function U(e,s){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:i}=s.config.request,r=yield s.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:i,meetingId:t},inboxes:e}),n=[];return r.data&&Object.keys(r.data).forEach((t=>{n.push({name:t,seqId:r.data[t].maxSeqId,limit:200})})),n}))}function j(e,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i,clientID:r}=s.config.request,n=yield s.request.post(`${t}meetings/${i}/subscribe`,{endpointID:r,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((t=>{s.emitter.emit(t.event,t)}))}))}function P(e,s,i){return t(this,void 0,void 0,(function*(){const{inboxes:r,clientID:n,meetingID:o,cancelToken:a,status:c}=s;if(yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:r},{cancelToken:a})}catch(d){return c.attempts++,void console.error(d)}if(!t)return console.error("polling error: ","response is null"),void c.attempts++;const{data:s={},bizCode:u,error:d}=t;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,s&&Object.keys(s).forEach((t=>{const e=r.find((e=>e.name===t));e&&(e.seqId=s[t].maxSeqId,s[t].items&&s[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),e.pollingSeqId=t.seqId,i(e)})))}))})))(),!c.running)return;if(c.attempts>L)return console.error("polling Max Attempts"),void(s.onError&&s.onError({message:"polling Max Attempts"}));const u=c.attempts?H(c.attempts):0;c.timer=setTimeout((()=>{c.running&&P(e,s,i)}),u)}))}const k=(e,s)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:i}=s.config.request;s.status.polling.running=!0,P(s.request,{inboxes:e,clientID:i,meetingID:t,cancelToken:s.config.request.cancelToken.token,status:s.status.polling,onError:t=>{s.emitter.emit($.POLLING_ERROR,t)}},(t=>{s.emitter.emit(t.event,t)}))}));function C(t){t.status.polling.running=!1,t.status.polling.attempts=0,t.status.polling.timer&&(clearTimeout(t.status.polling.timer),t.status.polling.timer=null),t.config.request.cancelToken.cancel(),t.config.request.cancelToken=c.source()}function N(e,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:r,userID:n}=e.config.request;if(e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.request.post(`${i}meetings/${r}/users/${n}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token})}catch(a){return e.status.keepalive.attempts++,void console.error(a)}if(!t||!t.data)return;const{data:s={},bizCode:o,error:a}=t;if(900200!==o&&900408!==o&&901323!==o)return e.status.keepalive.attempts++,void console.error("keepalive ",o,a);const c=s.interval||"";c?(e.status.keepalive.interval=c,e.status.keepalive.attempts=0):console.error("keepalive ",o,a)})))(),!e.status.keepalive.running)return;if(e.status.keepalive.attempts>L)return console.error("keepalive Max Attempts"),void(s&&s({message:"keepalive Max Attempts"}));const o=e.status.keepalive.attempts?H(e.status.keepalive.attempts):1e3*e.status.keepalive.interval;e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&N(e,s)}),o)}))}const R=t=>{t.status.keepalive.running=!1,t.status.keepalive.attempts=0,t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null)},L=5,H=t=>{console.log(`computeNextTimeout attempts: ${t}`);let e=Math.floor(Math.random()*Math.pow(2,t)+1);return e<2&&(e=2),e>30&&(e=30),1e3*e};var M;!function(t){t.INIT="meInit",t.UPDATE="meUpdate",t.UPDATE_USER_STATE="updateUserState",t.ROLECHANGE="meRoleChange",t.AUDIOCHANGE="meAudioChange",t.HANDUPCHANGE="meHandupChange",t.SETAUDIO="setAudio",t.VIDEOCHANGE="meVideoChange",t.SETVIDEO="setVideo",t.SHARECHANGE="meShareChange",t.DISPLAYNAMECHANGE="meDisplayNameChange",t.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",t.LOBBYCHANGE="meLobbyChange",t.BARRAGECHANGE="meBarrageChange",t.PERSONALLAYOUTCHANGE="personalLayoutChange",t.LEAVE="leave"}(M||(M={}));class B extends w{constructor(t){super(t,"me")}_topic(){return""}_bindOn(){const e=e=>t(this,void 0,void 0,(function*(){if("role"in e&&e.role!==this.data.role){const t=this.data.role;v({role:e.role},this.data),e.role!==_.AUDIENCE&&t!==_.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(M.ROLECHANGE,e.role),this.ctx.emitter.emit(M.ROLECHANGE,e.role)}})),s=t=>{var e,s,i,r,n,o;if("audio"in t){const{deviceOn:a,sendOn:c,recvOn:u,opBy:d}=t.audio;(!p(a)&&a!==(null===(e=this.data.audio)||void 0===e?void 0:e.deviceOn)||!p(c)&&c!==(null===(s=this.data.audio)||void 0===s?void 0:s.sendOn)||!p(u)&&c!==(null===(i=this.data.audio)||void 0===i?void 0:i.recvOn)||!p(d))&&(v({audio:t.audio},this.data),this.emitter.emit(M.AUDIOCHANGE,{deviceOn:p(a)?null===(r=this.data.audio)||void 0===r?void 0:r.deviceOn:a,sendOn:p(c)?null===(n=this.data.audio)||void 0===n?void 0:n.sendOn:c,recvOn:p(c)?null===(o=this.data.audio)||void 0===o?void 0:o.recvOn:u,opBy:d,changeData:Object.assign({},t.audio)}))}},i=t=>{var e,s,i,r,n,o;if("video"in t){const{deviceOn:a,sendOn:c,opBy:u,blocked:d}=t.video;(!p(a)&&a!==(null===(e=this.data.video)||void 0===e?void 0:e.deviceOn)||!p(c)&&c!==(null===(s=this.data.video)||void 0===s?void 0:s.sendOn)||!p(d)&&d!==(null===(i=this.data.video)||void 0===i?void 0:i.blocked))&&(v({video:t.video},this.data),this.emitter.emit(M.VIDEOCHANGE,{deviceOn:p(a)?null===(r=this.data.video)||void 0===r?void 0:r.deviceOn:a,sendOn:p(c)?null===(n=this.data.video)||void 0===n?void 0:n.sendOn:c,blocked:p(c)?null===(o=this.data.video)||void 0===o?void 0:o.blocked:d,opBy:u,changeData:Object.assign({},t.video)}))}},r=t=>{var e,s,i,r;if("share"in t){const{deviceOn:n,sendOn:o,opBy:a}=t.share;(!p(n)&&n!==(null===(e=this.data.share)||void 0===e?void 0:e.deviceOn)||!p(o)&&o!==(null===(s=this.data.share)||void 0===s?void 0:s.sendOn))&&(v({share:t.share},this.data),this.emitter.emit(M.SHARECHANGE,{deviceOn:p(n)?null===(i=this.data.share)||void 0===i?void 0:i.deviceOn:n,sendOn:p(o)?null===(r=this.data.share)||void 0===r?void 0:r.sendOn:o,opBy:a}))}},n=t=>{t.displayName&&t.displayName!==this.data.displayName&&(v({displayName:t.displayName},this.data),this.emitter.emit(M.DISPLAYNAMECHANGE,t.displayName))},o=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(v({isHandUp:t.isHandUp},this.data),this.emitter.emit(M.HANDUPCHANGE,t.isHandUp))},a=t=>{"isSpotlightVideo"in t&&(v({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(M.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},c=e=>t(this,void 0,void 0,(function*(){if("isInLobby"in e&&e.isInLobby!==this.data.isInLobby){v({isInLobby:e.isInLobby},this.data);const t=!1===e.isInLobby?"inLobbyChange":void 0;yield this.rePolling(t),this.emitter.emit(M.LOBBYCHANGE,e.isInLobby),this.ctx.emitter.emit(M.LOBBYCHANGE,e.isInLobby)}})),u=e=>t(this,void 0,void 0,(function*(){const{event:t,state:s,body:i}=e;"personalLayout"===t&&("full"===s?v({personalLayout:i},this.data):"delete"===s&&(this.data.personalLayout=void 0),console.log(this.data.personalLayout),this.emitter.emit(M.PERSONALLAYOUTCHANGE,this.data.personalLayout))})),d=t=>{if(!t.barrage)return;let e=null;if(!t.barrage.wordsDisplayStatus)return e=null,delete t.barrage,this.data.barrage=e||void 0,void this.emitter.emit(M.BARRAGECHANGE,e);if(!t.barrage.receiver)return;e={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};let{role:s}=this.data;if(this.data.endpointType===O.SUPERVISION){const{info:t}=this.ctx.modules;s="webinar"===t.meetingType?_.AUDIENCE:_.ATTENDEE}s===_.HOST||s===_.COHOST?e=t.barrage.receiver.host?e:null:s===_.ATTENDEE?e=t.barrage.receiver.attendee?e:null:s===_.AUDIENCE&&(e=t.barrage.receiver.audience?e:null),delete t.barrage,this.data.barrage=e||void 0,this.emitter.emit(M.BARRAGECHANGE,e)},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),pt(this.ctx),this.emitter.emit(M.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},h=t=>{e(t),s(t),i(t),r(t),n(t),o(t),c(t),a(t),d(t),l(t),(this.data.isInLobby||this.data.role===_.AUDIENCE)&&this.data.share&&this.data.share.sendOn&&r({share:{deviceOn:!0,sendOn:!1,recvOn:!1}})};this.ctx.emitter.on(M.INIT,(t=>{v(t,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(M.UPDATE,(t=>{h(t),v(t,this.data)})),this.ctx.emitter.on($.STATE,(({state:t})=>{t===E.READY&&this.data.endpointType!==O.SUPERVISION&&this.emitter.emit(M.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:s={users:[]}}=e;if("delete"===t){const t=s.users[0];return t.leave=!0,void l(t)}let i=s.users.find((t=>t.userID===this.data.userID));i||s.users.length&&(i=s.users[0]),i?(h(i),v(i,this.data)):console.warn("me ",t,s)})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(M.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(M.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(t=>{const{body:e={}}=t;if("ended"===e.state){l({leave:!0,resultInfo:e.resultInfo})}})),this.ctx.emitter.on("personalLayout",(t=>{u(t)}))}updateUserState(t,e=!1){if(!e){const{role:e,initialMediaState:s}=this.data;t.audio.sendOn=t.audio.sendOn&&s.audio.sendOn,t.video.sendOn=t.video.sendOn&&s.video.sendOn,e===_.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${s}meetings/${i}/updateUserState`,t)}rePolling(e){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;C(t);const s=T(t),i=yield U(s,t);if(e&&this.emitter.emit(M.UPDATE_USER_STATE,{data:this.data,event:e}),yield j(s,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:r}=t.config.request;t.worker.postMessage({inboxes:i,topics:s,meetingID:e,clientID:r,rePolling:!0})}else yield k(i,t)}))}}class V extends w{constructor(t){super(t,"asr")}_topic(){return["meeting"]}_bindOn(){this.ctx.emitter.on("asr",(t=>{const{body:e}=t;void 0===this.data.asr&&(this.data.asr={status:"stopped"}),v(e,this.data.asr),this.emitter.emit("asrChange",{asr:this.data.asr,changeData:e})}))}cleanup(){this.emitter.all=new Map}transcriptStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/transcript/status`,e)}))}}class G extends w{constructor(t){super(t,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(t=>{const{body:e}=t;this.emitter.emit("chatMsg",e)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/chat/historyMsg`,e)}))}}class Y extends w{constructor(t){super(t,"interpretation"),this.data={status:"stopped",interpreters:[]}}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("interpretation",(t=>{const{body:e,state:s}=t;"full"===s?(this.data.interpreters=e.interpreters,this.data.status=e.status):this.data.status=e.status,this.emitter.emit("interpretationChange",this.data)}))}interpretationStart(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/interpretation/start`,t)}interpretationEnd(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/interpretation/stop`)}}class Q extends w{constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:s}=t;if(e&&e.users){if("full"===s)return this.data.callRecordUsers=e.users.map((t=>(t.displayNamePinyin=Q.setDisplayNamePinyinProp?Q.setDisplayNamePinyinProp(t.displayName||""):t.displayName,t))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);this.data.callRecordUsers||(this.data.callRecordUsers=[]),e.users.forEach((t=>{const e=this.data.callRecordUsers.findIndex((e=>t.inviteTransID===e.inviteTransID));"update"===s&&-1!==e?v(t,this.data.callRecordUsers[e]):"update"===s&&-1===e&&(t.displayNamePinyin=Q.setDisplayNamePinyinProp?Q.setDisplayNamePinyinProp(t.displayName||""):t.displayName,this.data.callRecordUsers.push(t))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/invite`,t)}cancelInvite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/cancelInvite`,t)}}class F extends w{constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:s,body:i,stime:r}=t;if(i){if(r&&(this.data.jetlag=r),"full"===s){const{liveStreams:t=[]}=i;if(!t.length)return;const e=[];this.data.liveStreams=t.map((t=>(t.requesting="starting"===t.status,e.push({platform:t.platform||"",status:(t.requesting?"stopped":t.status)||""}),t)));return v({status:e,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),i.liveStreams||(this.data.resultInfo={}),null===(e=i.liveStreams)||void 0===e||e.forEach((t=>{this.data.resultInfo=t.resultInfo||{};let e=this.data.liveStreams.findIndex((e=>e.platform===t.platform));-1===e?(t.requesting="starting"===t.status,this.data.liveStreams.push(t)):(t.requesting="starting"===t.status,t=Object.assign(Object.assign({},this.data.liveStreams[e]),t),this.data.liveStreams.splice(e,1,t)),e=this.data.status.findIndex((e=>e.platform===t.platform));const s=this.data.status.map((t=>t));-1===e?s.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):s.splice(e,1,{platform:s[e].platform||"",status:t.requesting?s[e].status||"stopped":t.status||""}),this.data.status=s})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/setting`,e)}))}}class J extends w{constructor(t){super(t,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(t=>{const{body:e}=t;h(e)&&!l(e)?this.qaUpdate(this.data.questions,e):e.forEach((t=>this.qaUpdate(this.data.questions,t)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(t,e){let s=t.get(e.question.id);const{clientID:i}=this.ctx.config.request;switch(e.command){case"addQuestion":s=this.createQuestion(e.question),t.set(e.question.id,s),this.emitter.emit("questionAdd",{question:s,selfSent:s.sender.endpointID===i});break;case"dismissQuestion":if(!s)break;s.sender.endpointID!==i?s.status="close":s.isTop=!1,t.set(e.question.id,s),this.emitter.emit("questionUpdate",{question:s});break;case"reopenQuestion":s?(s.status="open",s.isTop=e.question.isTop,t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"updateQuestion":s?(s=Object.assign(Object.assign(Object.assign({},s),e.question),{topSort:e.question.isTop?this.data.topSort++:0}),t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteQuestion":if(!s)break;s.sender.endpointID!==i?t.delete(e.question.id):(s.status="delete",s.isTop=!1,s.answers.clear(),t.set(e.question.id,s)),this.emitter.emit("questionDelete",{question:s});break;case"answerQuestion":s?s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)):(s=this.createQuestion(e.question),s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteAnswer":s&&(s.answers.delete(e.answer.id),this.emitter.emit("questionUpdate",{question:s}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(t){return{isAnonymous:t.isAnonymous,isTop:t.isTop,id:t.id,content:t.content,sender:t.sender,timestamp:t.timestamp||-1,status:t.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(t){return{isPrivate:t.isPrivate,content:t.content,id:t.id,sender:t.sender,timestamp:t.timestamp||-1}}qa(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/qa`,e)}))}}class W extends w{constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:s,stime:i}=t;if(s)return i&&(this.data.stime=i),this.data.isPracticeSession="started"===s.status&&this.data.status===s.status&&0===s.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),s),"starting"===s.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=s.status||this.data.status),this.data.resultInfo=s.resultInfo||{},["full","update"].includes(e)?(s.recordUsers&&(this.data.recording.recordUsers=s.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/layout`,e)}))}}class z extends w{constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:s}=t;["full","update"].includes(e)&&v(s,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/unmuteAll`)}))}}class X extends w{constructor(t){super(t,"shouldJoinUsers")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("shouldJoinUsers",(t=>{const{state:e}=t;"update"===e&&this.emitter.emit("shouldJoinUsersChange")}))}modifyUser(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/attendance/shouldJoin`,t)}getUser(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/attendance/getShouldJoin`)}}class K extends w{constructor(t){super(t,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:e}=t;if(!e||!e.userIDs)return;this.data.userIDs=e.userIDs;e.userIDs.findIndex((t=>t===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(M.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(M.UPDATE,{isSpotlightVideo:!1})}))}spotlight(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/view/spotlight`,t)}}class Z extends w{constructor(t){super(t,"transcript"),this.data={asr:{status:"stopped"}}}_topic(){return["transcript"]}_bindOn(){this.ctx.emitter.on("transcriptMsg",(t=>{const{body:e}=t;this.emitter.emit("transcriptMsg",e)}))}cleanup(){this.emitter.all=new Map}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/transcript/historyMsg`,e)}))}}class tt extends w{constructor(t){super(t,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:e}=this.ctx.modules.me.data;return e===O.SUPERVISION?["interactive","broadcast"]:t===_.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:e,state:s})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:i={}}=t;if("delete"!==s||"delete"===s&&[901357,901358,901352,901351,901350,901349].includes(i.bizCode||-1))return void this.ctx.emitter.emit(M.UPDATE,t);let r=!1;switch(e){case"interactiveUsers":t.isInLobby||(r=!0);break;case"broadcastUsers":t.isInLobby||t.role!==_.AUDIENCE||(r=!0);break;case"lobbyUsers":t.isInLobby&&(r=!0)}const n={};r&&(n.leave=!0),this.ctx.emitter.emit(M.UPDATE,Object.assign(Object.assign({},t),n))},e=({updateUsers:e,state:s,sourceKey:i})=>{if("full"===s)return this.data[i]=e.map((e=>(e.displayNamePinyin=tt.setDisplayNamePinyinProp?tt.setDisplayNamePinyinProp(e.displayName):e.displayName,e.groupIDs=tt.setUserGroupIDs?tt.setUserGroupIDs(e.groupIDs||[]):e.groupIDs,t(e,{event:i,state:s}),e))),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!0}),this.data[i];void 0===this.data[i]&&(this.data[i]=[]);const{data:r,emitter:n}=this;return e.forEach((e=>{const o=r[i].findIndex((t=>e.userID===t.userID));if("delete"===s&&-1!==o){const[t]=this.data[i].splice(o,1);n.emit(`${i}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===s&&-1!==o){const t=this.data[i][o];this.updateUserProps(e,t),v(e,t),this.data[i][o]=I(t),this.emitter.emit(`${i}Update`,{user:this.data[i][o]})}else"update"===s&&-1===o&&(e.displayNamePinyin=tt.setDisplayNamePinyinProp?tt.setDisplayNamePinyinProp(e.displayName):e.displayName,r[i].push(e),this.emitter.emit(`${i}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:i,state:s})})),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!1}),this.data[i]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:s,body:i}=t;e({updateUsers:i.users,state:s,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:s,body:i}=t;e({updateUsers:i.users,state:s,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:s,body:i}=t;e({updateUsers:i.users,state:s,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:s,body:i}=t;e({updateUsers:i.users,state:s,sourceKey:"advCtrlUsers"})}))}reactive(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,i)=>{Object.keys(t).forEach((r=>{!1===i&&r in this.data&&(t[r]=this.data[r]);const n=e=>t[r]=e.users.map((t=>t)),o=`${x(r)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[r])&&!l(t[r])&&s(t[r],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(t,e){t.displayName&&t.displayName!==e.displayName&&(t.displayNamePinyin=tt.setDisplayNamePinyinProp?tt.setDisplayNamePinyinProp(t.displayName):t.displayName)}setAudio(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/users/${t}/callStats`)}callStatsReport(t){if(!t.userID)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t.userID}/callStats/report`,t)}replyAllHandUp(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/refuseAll`)}getSendLayout(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/sendLayout`)}setSendLayout(t,e){const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/sendLayout`,e)}setSendLayoutEnabled(t,e){const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/sendLayoutEnabled`,e)}pauseAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/pauseAudio`)}resumeAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/resumeAudio`)}modifyRoleBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyRoleBatch `,t)}modifyVideoBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyVideoBatch `,t)}putInLobbyBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/putInLobbyBatch `,t)}removeBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/removeBatch `,t)}}class et extends w{constructor(t){super(t,"view")}_topic(){const{endpointType:t,role:e}=this.ctx.modules.me.data;return t===O.WEBCTRL?["hostAttendee","audience","advCtrl"]:e===_.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((t=>{this.ctx.emitter.on(t,(e=>{"personalView"!==t?this.updateLayout(e,t):this.updatePersonalLayouts(e)}))})),this.ctx.emitter.on("videoSourcesUpdated",(()=>{this.emitter.emit("videoSourcesUpdated")}))}updateLayout(t,e){const{event:s,body:i}=t;i&&("meetingView"===s?Object.keys(i).forEach((t=>{this.data[t]=i[t]})):this.data[e]=i)}updatePersonalLayouts(t){const{state:e,body:s}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),s.personalLayouts.forEach((t=>{const{subscriber:s={userID:-1}}=t,i=s.userID||s.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[i]=t:delete this.data.personalLayouts[i]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/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)}))}setSavedBackground(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/recentBackgroundFile`,e)}))}getSavedBackground(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/view/recentBackgroundFile`)}))}}class st extends w{constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:s}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[s]=e,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:e})})),this.ctx.emitter.on(M.LOBBYCHANGE,(t=>{t&&(this.data.vote={})}))}getVotes(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:s},meetingID:i,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.post(`${s}meetings/${i}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:s},meetingID:i,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.post(`${s}meetings/${i}/vote/submit?tk=${t.tk}&voteID=${t.voteID}`,e)}voteAdd(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/add`,t)}voteEdit(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/edit`,t)}voteDelete(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/delete`,t)}voteInProgress(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/vote/inProgress`,{params:{tk:t&&t.tk||i}})}}class it extends w{constructor(t){super(t,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:e,body:s,pollingSeqId:i}=t;if(!s)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(M.UPDATE,{barrage:this.data});"full"===e&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),i&&(this.data.barrageRecord=[{id:i,content:s.content,time:(new Date).getTime(),durationType:s.durationType,duration:1e3*s.duration},...this.data.barrageRecord]),s.wordsDisplayStatus=!0,-1!==s.duration&&(this.data.timer=setTimeout((()=>{s.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=s.wordsDisplayStatus,this.ctx.emitter.emit(M.UPDATE,{barrage:this.data})}),1e3*s.duration)),v(s,this.data),this.ctx.emitter.emit(M.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(M.ROLECHANGE,(()=>this.ctx.emitter.emit(M.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/deleteBarrage`)}))}}function rt(t){const{baseURL:s,modules:i,worker:r,singleton:n}=t;i.findIndex((t=>t===B))<0&&i.push(B),i.findIndex((t=>t===S))<0&&i.push(S);const o=t.clientID||`${g()}_${((t=new Date,e)=>{const s={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(const i in s)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[i]:("00"+s[i]).substr((""+s[i]).length)));return e})(new Date,"MMddHHmmss")}`,u={config:{baseURL:s,modules:i,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:r,emitter:e(),request:new a({baseURL:s,beforeRequest:t=>{t.headers["X-Y-Request-Id"]=g(),t.timeout=18e5},error:t=>{u.emitter.emit($.REQUEST_ERROR,t)}}),modules:{},state:E.CLOSE,status:{polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},cleanup:t=>{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,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),Object.keys(u.modules).forEach((t=>{u.modules[t].cleanup()})),u.state=E.CLOSE,u.emitter.emit($.STATE,{state:u.state,reason:t}))}};return u}function nt(t){const e=rt(t);return e.worker&&("undefined"!=typeof Worker?e.worker.postMessage({baseURL:e.config.baseURL}):console.error("The current environment does not support worker")),function(t,e){if(!l(t))return void console.error("The modules parameter requires an array type");t.forEach((t=>{const s=new t(e);e.modules[s.moduleName]=s}))}(e.config.modules,e),e.emitter.on($.POLLING_ERROR,(t=>{at(e)({resultInfo:t})})),e.emitter.on($.KEEPALIVE_ERROR,(t=>{at(e)({resultInfo:t})})),Object.assign({config:e.config,request:e.request,get state(){return e.state},on:e.emitter.on,off:e.emitter.off,join:ot(e),leave:at(e),end:ct(e),endMeeting:ut(e)},e.modules)}function ot(e){return function(s){var i;return t(this,void 0,void 0,(function*(){const{clientID:t}=e.config.request,r=`${null===(i=s.endpointType)||void 0===i?void 0:i.toLocaleUpperCase()}${t}_${s.meetingNum}`;e.config.request.sessionID=r,e.request.setDefaultHeader("X-Y-Session-Id",r);const{prefix:n}=e.config.request,o=yield e.request.get(`${n.ctrl}credential`,{params:{meetingNum:s.meetingNum,pwd:s.pwd,url:s.url,mobileCode:s.mobileCode,mobile:s.mobile,regEmail:s.regEmail,accEmail:s.accEmail,tk:s.tk,displayName:s.displayName,userAgent:s.userAgent},headers:{"X-Y-Endpoint-Type":s.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return e.emitter.emit($.FAILED,{bizCode:o.bizCode,data:o.data}),o;e.config.request.location=c,e.request.setDefaultHeader("X-Y-Location",c),delete s.pwd,delete s.url;const u={displayName:s.displayName,userAgent:s.userAgent,clientID:t};s.groupIDs&&s.account&&(u.groupIDs=s.groupIDs,u.account=s.account,u.groupName=s.groupName);const d=yield e.request.post(`${n.ctrl}join?meetingNum=${s.meetingNum}&credential=${a}`,u,{headers:{"X-Y-Endpoint-Type":s.endpointType,"X-Y-Endpoint-Id":t}});if(!d||d&&d.ret<=-1)return e.emitter.emit($.FAILED,{bizCode:d.bizCode,data:d.data}),d;const{meetingID:l="",ctrlID:p="",user:h={},mediaContent:f={},initialMediaState:m={},tk:g=""}=d.data;e.config.request.meetingID=l,e.config.request.ctrlID=p,e.config.request.userID=h.userID,e.config.request.voteTk=g,e.request.setDefaultHeader("X-Y-Ctrl-Id",p),e.emitter.emit(M.INIT,Object.assign(Object.assign({},h),{mediaContent:f,initialMediaState:m})),e.state=E.JOINED,e.emitter.emit($.STATE,{state:e.state});const v=()=>{e.state!==E.READY&&(e.state=E.READY,e.emitter.emit($.STATE,{state:e.state}))},y=T(e),x=yield U(y,e);return yield j(y,e),"undefined"!=typeof Worker&&e.worker?(e.status.polling.running=!0,e.worker.postMessage({topics:y,meetingID:l,clientID:t,inboxes:x,status:!0}),e.worker.onmessage=t=>{"pollingStarted"!==t.data?"pollingStopped"!==t.data?(console.log("[Polling]",t.data),e.emitter.emit(t.data.event,t.data)):e.status.polling.running=!1:v()}):(e.status.polling.running=!0,k(x,e),v()),e.status.keepalive.running=!0,N(e,(t=>{e.emitter.emit($.KEEPALIVE_ERROR,t)})),d.data=Object.assign(Object.assign({},d.data),o.data),d}))}}function at(e){return function(s){return t(this,void 0,void 0,(function*(){s||(s={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:i}=e.config.request;let r;try{r=yield e.request.post(`${t.ctrl}meetings/${i}/leave`,s)}catch(n){console.error(n)}return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),R(e),pt(e),e.cleanup(),r}))}}function ct(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:s}=e.config.request,i=yield e.request.post(`${t.ctrl}meetings/${s}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),R(e),pt(e),e.cleanup(),i}))}}function ut(e){return function(s){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${s}/end`)}))}}class dt{constructor(t){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=nt(t)}static getInstance(t){return this.instance?this.instance:this.instance=new dt(t)}}function lt(t){return t.singleton?dt.getInstance(t).meeting:nt(t)}function pt(t){if(t.config.singleton){const{baseURL:e,modules:s,singleton:i}=t.config,r={baseURL:e,modules:s,worker:t.worker,singleton:i},n=dt.getInstance(r);n&&(n.meeting=nt(r))}}Object.defineProperty(dt,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null});export{V as Asr,G as Chat,O as ENDPOINT_TYPE,$ as EVENT,S as Info,Y as Interpretation,Q as Invite,F as LiveStream,B as Me,M as MeEvent,J as Qa,A as RECORD_STATUS,_ as ROLE,W as Recording,E as STATE,z as Setting,X as ShouldJoinUsers,K as SpotlightVideo,Z as Transcript,tt as Users,et as View,st as Vote,it as Words,lt as createMeeting,pt as reset};
1
+ function t(t,e,s,i){return new(s||(s=Promise))((function(r,n){function o(t){try{c(i.next(t))}catch(e){n(e)}}function a(t){try{c(i.throw(t))}catch(e){n(e)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,a)}c((i=i.apply(t,e||[])).next())}))}function e(t){return{all:t=t||new Map,on:function(e,s){var i=t.get(e);i?i.push(s):t.set(e,[s])},off:function(e,s){var i=t.get(e);i&&(s?i.splice(i.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var i=t.get(e);i&&i.slice().map((function(t){t(s)})),(i=t.get("*"))&&i.slice().map((function(t){t(e,s)}))}}}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i={exports:{}};!function(t,e){var i="__lodash_hash_undefined__",r=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]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",x="[object ArrayBuffer]",b="[object DataView]",q="[object Float32Array]",I="[object Float64Array]",D="[object Int8Array]",$="[object Int16Array]",E="[object Int32Array]",O="[object Uint8Array]",_="[object Uint8ClampedArray]",A="[object Uint16Array]",w="[object Uint32Array]",S=/\w*$/,T=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,j={};j[n]=j["[object Array]"]=j[x]=j[b]=j[o]=j[a]=j[q]=j[I]=j[D]=j[$]=j[E]=j[d]=j[l]=j[p]=j[f]=j[m]=j[g]=j[v]=j[O]=j[_]=j[A]=j[w]=!0,j["[object Error]"]=j[c]=j[y]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,k="object"==typeof s&&s&&s.Object===Object&&s||P||Function("return this")(),C=e&&!e.nodeType&&e,N=C&&t&&!t.nodeType&&t,R=N&&N.exports===C;function L(t,e){return t.set(e[0],e[1]),t}function H(t,e){return t.add(e),t}function M(t,e,s,i){var r=-1,n=t?t.length:0;for(i&&n&&(s=t[++r]);++r<n;)s=e(s,t[r],r,t);return s}function B(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(s){}return e}function V(t){var e=-1,s=Array(t.size);return t.forEach((function(t,i){s[++e]=[i,t]})),s}function G(t,e){return function(s){return t(e(s))}}function Y(t){var e=-1,s=Array(t.size);return t.forEach((function(t){s[++e]=t})),s}var Q,F=Array.prototype,J=Function.prototype,W=Object.prototype,z=k["__core-js_shared__"],X=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=J.toString,Z=W.hasOwnProperty,tt=W.toString,et=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),st=R?k.Buffer:void 0,it=k.Symbol,rt=k.Uint8Array,nt=G(Object.getPrototypeOf,Object),ot=Object.create,at=W.propertyIsEnumerable,ct=F.splice,ut=Object.getOwnPropertySymbols,dt=st?st.isBuffer:void 0,lt=G(Object.keys,Object),pt=Nt(k,"DataView"),ht=Nt(k,"Map"),ft=Nt(k,"Promise"),mt=Nt(k,"Set"),gt=Nt(k,"WeakMap"),vt=Nt(Object,"create"),yt=Bt(pt),xt=Bt(ht),bt=Bt(ft),qt=Bt(mt),It=Bt(gt),Dt=it?it.prototype:void 0,$t=Dt?Dt.valueOf:void 0;function Et(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function Ot(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function _t(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function At(t){this.__data__=new Ot(t)}function wt(t,e){var s=Gt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Yt(t)}(t)&&Z.call(t,"callee")&&(!at.call(t,"callee")||tt.call(t)==n)}(t)?function(t,e){for(var s=-1,i=Array(t);++s<t;)i[s]=e(s);return i}(t.length,String):[],i=s.length,r=!!i;for(var o in t)!e&&!Z.call(t,o)||r&&("length"==o||Ht(o,i))||s.push(o);return s}function St(t,e,s){var i=t[e];Z.call(t,e)&&Vt(i,s)&&(void 0!==s||e in t)||(t[e]=s)}function Tt(t,e){for(var s=t.length;s--;)if(Vt(t[s][0],e))return s;return-1}function Ut(t,e,s,i,r,h,y){var T;if(i&&(T=h?i(t,r,h,y):i(t)),void 0!==T)return T;if(!Jt(t))return t;var U=Gt(t);if(U){if(T=function(t){var e=t.length,s=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(s.index=t.index,s.input=t.input);return s}(t),!e)return function(t,e){var s=-1,i=t.length;e||(e=Array(i));for(;++s<i;)e[s]=t[s];return e}(t,T)}else{var P=Lt(t),k=P==c||P==u;if(Qt(t))return function(t,e){if(e)return t.slice();var s=new t.constructor(t.length);return t.copy(s),s}(t,e);if(P==p||P==n||k&&!h){if(B(t))return h?t:{};if(T=function(t){return"function"!=typeof t.constructor||Mt(t)?{}:(e=nt(t),Jt(e)?ot(e):{});var e}(k?{}:t),!e)return function(t,e){return kt(t,Rt(t),e)}(t,function(t,e){return t&&kt(e,Wt(e),t)}(T,t))}else{if(!j[P])return h?t:{};T=function(t,e,s,i){var r=t.constructor;switch(e){case x:return Pt(t);case o:case a:return new r(+t);case b:return function(t,e){var s=e?Pt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.byteLength)}(t,i);case q:case I:case D:case $:case E:case O:case _:case A:case w:return function(t,e){var s=e?Pt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.length)}(t,i);case d:return function(t,e,s){return M(e?s(V(t),!0):V(t),L,new t.constructor)}(t,i,s);case l:case g:return new r(t);case f:return function(t){var e=new t.constructor(t.source,S.exec(t));return e.lastIndex=t.lastIndex,e}(t);case m:return function(t,e,s){return M(e?s(Y(t),!0):Y(t),H,new t.constructor)}(t,i,s);case v:return n=t,$t?Object($t.call(n)):{}}var n}(t,P,Ut,e)}}y||(y=new At);var C=y.get(t);if(C)return C;if(y.set(t,T),!U)var N=s?function(t){return function(t,e,s){var i=e(t);return Gt(t)?i:function(t,e){for(var s=-1,i=e.length,r=t.length;++s<i;)t[r+s]=e[s];return t}(i,s(t))}(t,Wt,Rt)}(t):Wt(t);return function(t,e){for(var s=-1,i=t?t.length:0;++s<i&&!1!==e(t[s],s,t););}(N||t,(function(r,n){N&&(r=t[n=r]),St(T,n,Ut(r,e,s,i,n,t,y))})),T}function jt(t){return!(!Jt(t)||(e=t,X&&X in e))&&(Ft(t)||B(t)?et:T).test(Bt(t));var e}function Pt(t){var e=new t.constructor(t.byteLength);return new rt(e).set(new rt(t)),e}function kt(t,e,s,i){s||(s={});for(var r=-1,n=e.length;++r<n;){var o=e[r],a=i?i(s[o],t[o],o,s,t):void 0;St(s,o,void 0===a?t[o]:a)}return s}function Ct(t,e){var s,i,r=t.__data__;return("string"==(i=typeof(s=e))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==s:null===s)?r["string"==typeof e?"string":"hash"]:r.map}function Nt(t,e){var s=function(t,e){return null==t?void 0:t[e]}(t,e);return jt(s)?s:void 0}Et.prototype.clear=function(){this.__data__=vt?vt(null):{}},Et.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Et.prototype.get=function(t){var e=this.__data__;if(vt){var s=e[t];return s===i?void 0:s}return Z.call(e,t)?e[t]:void 0},Et.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:Z.call(e,t)},Et.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?i:e,this},Ot.prototype.clear=function(){this.__data__=[]},Ot.prototype.delete=function(t){var e=this.__data__,s=Tt(e,t);return!(s<0)&&(s==e.length-1?e.pop():ct.call(e,s,1),!0)},Ot.prototype.get=function(t){var e=this.__data__,s=Tt(e,t);return s<0?void 0:e[s][1]},Ot.prototype.has=function(t){return Tt(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var s=this.__data__,i=Tt(s,t);return i<0?s.push([t,e]):s[i][1]=e,this},_t.prototype.clear=function(){this.__data__={hash:new Et,map:new(ht||Ot),string:new Et}},_t.prototype.delete=function(t){return Ct(this,t).delete(t)},_t.prototype.get=function(t){return Ct(this,t).get(t)},_t.prototype.has=function(t){return Ct(this,t).has(t)},_t.prototype.set=function(t,e){return Ct(this,t).set(t,e),this},At.prototype.clear=function(){this.__data__=new Ot},At.prototype.delete=function(t){return this.__data__.delete(t)},At.prototype.get=function(t){return this.__data__.get(t)},At.prototype.has=function(t){return this.__data__.has(t)},At.prototype.set=function(t,e){var s=this.__data__;if(s instanceof Ot){var i=s.__data__;if(!ht||i.length<199)return i.push([t,e]),this;s=this.__data__=new _t(i)}return s.set(t,e),this};var Rt=ut?G(ut,Object):function(){return[]},Lt=function(t){return tt.call(t)};function Ht(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||U.test(t))&&t>-1&&t%1==0&&t<e}function Mt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||W)}function Bt(t){if(null!=t){try{return K.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Vt(t,e){return t===e||t!=t&&e!=e}(pt&&Lt(new pt(new ArrayBuffer(1)))!=b||ht&&Lt(new ht)!=d||ft&&Lt(ft.resolve())!=h||mt&&Lt(new mt)!=m||gt&&Lt(new gt)!=y)&&(Lt=function(t){var e=tt.call(t),s=e==p?t.constructor:void 0,i=s?Bt(s):void 0;if(i)switch(i){case yt:return b;case xt:return d;case bt:return h;case qt:return m;case It:return y}return e});var Gt=Array.isArray;function Yt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}(t.length)&&!Ft(t)}var Qt=dt||function(){return!1};function Ft(t){var e=Jt(t)?tt.call(t):"";return e==c||e==u}function Jt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return Yt(t)?wt(t):function(t){if(!Mt(t))return lt(t);var e=[];for(var s in Object(t))Z.call(t,s)&&"constructor"!=s&&e.push(s);return e}(t)}t.exports=function(t){return Ut(t,!0,!0)}}(i,i.exports);var r=i.exports;const n=t=>({get(e,s,i){if("__isProxy"===s)return!0;const r=Reflect.get(e,s);return Array.isArray(r)?r:"object"==typeof r&&null!==r?r.__isProxy?r:new Proxy(r,n(t)):r},set(e,s,i,n){const o=e[s];i=h(i)&&i.__isProxy?r(i):i;const a=Reflect.set(e,s,i,n);return((t,e)=>t!==e&&(t==t||e==e))(i,o)&&t.emit(`${x(s)}Change`,i),a}}),o=t=>encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(t){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=t.baseURL,this._beforeRequest=t.beforeRequest,this._errorHandler=t.error}_request(t){const e=t.timeout||18e5;let s=t.headers||{};return t.url=D(this.baseURL,t.url||""),t.url=((t,e)=>{if(!e)return t;const s=[];Object.keys(e).forEach((t=>{const i=e[t];if(null==i)return;let r;Array.isArray(i)?(r=i,t+="[]"):r=[i],r.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),s.push(`${o(t)}=${o(e)}`)}))}));const i=s.join("&");if(i){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t})(t.url,t.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[t],delete s[t])})),f(t.data)&&(t.data=t.data.buffer),m(t.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=s,t.timeout=e,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx&&void 0!==wx.request?d(t):u(t)}setDefaultHeader(t,e){t in this._defaultHeaders&&(""===e||null===e)?delete this._defaultHeaders[t]:this._defaultHeaders[t]=e}get(t,e){return this._errorHandler?this._request(Object.assign(e||{},{url:t,method:"GET"})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(e||{},{url:t,method:"GET"}))}post(t,e,s){return this._errorHandler?this._request(Object.assign(s||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(s||{},{url:t,method:"POST",data:e}))}}class c{constructor(t){let e;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((t=>{e=t})),t((t=>{this.reason||(this.reason=t,e(this.reason))}))}static source(){let t;const e=new c((e=>{t=e}));return{cancel:t,token:e}}}const u=t=>new Promise(((e,s)=>{const{data:i=null,url:r,method:n="GET",headers:o,cancelToken:a}=t;let c=new XMLHttpRequest;c.open(n.toUpperCase(),r,!0),c.timeout=t.timeout;const u=()=>{if(c){if(c.status>=200&&c.status<300)try{const t=JSON.parse(c.responseText);e(t)}catch(t){s(new Error("E_JSON_PARSE"+c.responseText))}else s({url:r,statusCode:c.status});c=null}};"onloadend"in c?c.onloadend=u:c.onreadystatechange=()=>{c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=()=>{c&&(s({url:r,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{s(new Error("Network Error")),c=null},c.ontimeout=()=>{s(new Error("timeout of "+t.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(o).forEach((t=>{null===i&&"content-type"===t.toLowerCase()?delete o[t]:c.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{c&&(c.abort(),s(t),c=null)})),c.send(i)})),d=t=>new Promise(((e,s)=>{const{data:i=null,url:r,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:r,data:i,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):s({url:r,statusCode:t.statusCode})},fail(t){s("request:fail abort"===t.errMsg&&a&&a.reason||t)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=t=>null==t,h=t=>"object"==typeof t&&null!==t,f=t=>{let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer,e},m=t=>{if("[object Object]"!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},g=()=>{const t=[],e="0123456789abcdef";for(let s=0;s<36;s++)t[s]=e.substr(Math.floor(16*Math.random()),1);t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-";return t.join("").split("-").join("")},v=(t,e)=>t?(Object.entries(t).forEach((t=>{const[s,i]=[t[0],t[1]];if(null!==i)return h(i)&&!l(i)?(e[s]||(e[s]={}),void(e[s]=v(i,e[s]))):void(e[s]=i)})),e):e,y=/-(\w)/g,x=t=>t.replace(y,((t,e)=>e?e.toUpperCase():"")),{hasOwnProperty:b}=Object.prototype,q=(t,e)=>b.call(t,e),I=(t,e=new Map)=>{if(e.get(t))return e.get(t);if(!(t instanceof Object))return t;let s;s=t instanceof Array?[]:t instanceof Function?()=>t():t instanceof RegExp?new RegExp(t.source,t.flags):t instanceof Date?new Date(t):{},e.set(t,s);for(const i in t)q(t,i)&&(s[i]=I(t[i],e));return s},D=(t,e)=>t&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)?((t,e)=>e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e):e;var $,E,O,_,A;!function(t){t.STATE="state",t.FAILED="failed",t.REQUEST_ERROR="requestError",t.POLLING_ERROR="pollingError",t.KEEPALIVE_ERROR="keepaliveError"}($||($={})),function(t){t[t.CLOSE=0]="CLOSE",t[t.JOINED=1]="JOINED",t[t.READY=2]="READY"}(E||(E={})),function(t){t.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",t.MULTI_STREAM="multiStream",t.MEETING_TOUCH="meetingTouch",t.MEETING_ROOMS="meetingRooms"}(O||(O={})),function(t){t.HOST="host",t.COHOST="coHost",t.ATTENDEE="attendee",t.AUDIENCE="audience"}(_||(_={})),function(t){t.STARTED="started",t.PAUSED="paused",t.STARTING="starting",t.STOPPED="stopped"}(A||(A={}));class w{constructor(t,s){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=s,this.ctx=t,this.emitter=e(),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(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,i)=>{Object.keys(t).forEach((r=>{!1===i&&r in this.data&&(t[r]=this.data[r]);const n=e=>t[r]=e,o=`${x(r)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[r])&&!l(t[r])&&s(t[r],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}}class S extends w{constructor(t){super(t,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(t=>{const{state:e,body:s}=t;("full"===e||"update"===e)&&v(s,this.data)})),this.ctx.emitter.on("participantCount",(t=>{const{body:e}=t;v({participantCount:e},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/info/practiceSession`)}))}shareInfo(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/shareInfo`,{params:t})}meetings(t){if(!t)return Promise.reject();const{prefix:{ctrl:e}}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings`,{params:t})}mailTemplate(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}mailTemplate`,{params:{meetingID:s},headers:{language:t.language}})}}function T(t){const e=[],{isInLobby:s}=t.modules.me.data;return s?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((s=>{const i=t.modules[s]._topic();i&&(Array.isArray(i)?i.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(i)||e.push(i))})),e)}function U(e,s){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:i}=s.config.request,r=yield s.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:i,meetingId:t},inboxes:e}),n=[];return r.data&&Object.keys(r.data).forEach((t=>{n.push({name:t,seqId:r.data[t].maxSeqId,limit:200})})),n}))}function j(e,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i,clientID:r}=s.config.request,n=yield s.request.post(`${t}meetings/${i}/subscribe`,{endpointID:r,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((t=>{s.emitter.emit(t.event,t)}))}))}function P(e,s,i){return t(this,void 0,void 0,(function*(){const{inboxes:r,clientID:n,meetingID:o,cancelToken:a,status:c}=s;if(yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:r},{cancelToken:a})}catch(d){return c.attempts++,void console.error(d)}if(!t)return console.error("polling error: ","response is null"),void c.attempts++;const{data:s={},bizCode:u,error:d}=t;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,s&&Object.keys(s).forEach((t=>{const e=r.find((e=>e.name===t));e&&(e.seqId=s[t].maxSeqId,s[t].items&&s[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),e.pollingSeqId=t.seqId,i(e)})))}))})))(),!c.running)return;if(c.attempts>L)return console.error("polling Max Attempts"),void(s.onError&&s.onError({message:"polling Max Attempts"}));const u=c.attempts?H(c.attempts):0;c.timer=setTimeout((()=>{c.running&&P(e,s,i)}),u)}))}const k=(e,s)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:i}=s.config.request;s.status.polling.running=!0,P(s.request,{inboxes:e,clientID:i,meetingID:t,cancelToken:s.config.request.cancelToken.token,status:s.status.polling,onError:t=>{s.emitter.emit($.POLLING_ERROR,t)}},(t=>{s.emitter.emit(t.event,t)}))}));function C(t){t.status.polling.running=!1,t.status.polling.attempts=0,t.status.polling.timer&&(clearTimeout(t.status.polling.timer),t.status.polling.timer=null),t.config.request.cancelToken.cancel(),t.config.request.cancelToken=c.source()}function N(e,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:r,userID:n}=e.config.request;if(e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.request.post(`${i}meetings/${r}/users/${n}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token})}catch(a){return e.status.keepalive.attempts++,void console.error(a)}if(!t||!t.data)return;const{data:s={},bizCode:o,error:a}=t;if(900200!==o&&900408!==o&&901323!==o)return e.status.keepalive.attempts++,void console.error("keepalive ",o,a);const c=s.interval||"";if(!c)return e.status.keepalive.attempts++,void console.error("keepalive ",o,a);e.status.keepalive.interval=c,e.status.keepalive.attempts=0})))(),!e.status.keepalive.running)return;if(e.status.keepalive.attempts>L)return console.error("keepalive Max Attempts"),void(s&&s({message:"keepalive Max Attempts"}));const o=e.status.keepalive.attempts?H(e.status.keepalive.attempts):1e3*e.status.keepalive.interval;e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&N(e,s)}),o)}))}const R=t=>{t.status.keepalive.running=!1,t.status.keepalive.attempts=0,t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null)},L=5,H=t=>{console.log(`computeNextTimeout attempts: ${t}`);let e=Math.floor(Math.random()*Math.pow(2,t)+1);return e<2&&(e=2),e>30&&(e=30),1e3*e};var M;!function(t){t.INIT="meInit",t.UPDATE="meUpdate",t.UPDATE_USER_STATE="updateUserState",t.ROLECHANGE="meRoleChange",t.AUDIOCHANGE="meAudioChange",t.HANDUPCHANGE="meHandupChange",t.SETAUDIO="setAudio",t.VIDEOCHANGE="meVideoChange",t.SETVIDEO="setVideo",t.SHARECHANGE="meShareChange",t.DISPLAYNAMECHANGE="meDisplayNameChange",t.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",t.LOBBYCHANGE="meLobbyChange",t.BARRAGECHANGE="meBarrageChange",t.PERSONALLAYOUTCHANGE="personalLayoutChange",t.LEAVE="leave"}(M||(M={}));class B extends w{constructor(t){super(t,"me")}_topic(){return""}_bindOn(){const e=e=>t(this,void 0,void 0,(function*(){if("role"in e&&e.role!==this.data.role){const t=this.data.role;v({role:e.role},this.data),e.role!==_.AUDIENCE&&t!==_.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(M.ROLECHANGE,e.role),this.ctx.emitter.emit(M.ROLECHANGE,e.role)}})),s=t=>{var e,s,i,r,n,o;if("audio"in t){const{deviceOn:a,sendOn:c,recvOn:u,opBy:d}=t.audio;(!p(a)&&a!==(null===(e=this.data.audio)||void 0===e?void 0:e.deviceOn)||!p(c)&&c!==(null===(s=this.data.audio)||void 0===s?void 0:s.sendOn)||!p(u)&&c!==(null===(i=this.data.audio)||void 0===i?void 0:i.recvOn)||!p(d))&&(v({audio:t.audio},this.data),this.emitter.emit(M.AUDIOCHANGE,{deviceOn:p(a)?null===(r=this.data.audio)||void 0===r?void 0:r.deviceOn:a,sendOn:p(c)?null===(n=this.data.audio)||void 0===n?void 0:n.sendOn:c,recvOn:p(c)?null===(o=this.data.audio)||void 0===o?void 0:o.recvOn:u,opBy:d,changeData:Object.assign({},t.audio)}))}},i=t=>{var e,s,i,r,n,o;if("video"in t){const{deviceOn:a,sendOn:c,opBy:u,blocked:d}=t.video;(!p(a)&&a!==(null===(e=this.data.video)||void 0===e?void 0:e.deviceOn)||!p(c)&&c!==(null===(s=this.data.video)||void 0===s?void 0:s.sendOn)||!p(d)&&d!==(null===(i=this.data.video)||void 0===i?void 0:i.blocked))&&(v({video:t.video},this.data),this.emitter.emit(M.VIDEOCHANGE,{deviceOn:p(a)?null===(r=this.data.video)||void 0===r?void 0:r.deviceOn:a,sendOn:p(c)?null===(n=this.data.video)||void 0===n?void 0:n.sendOn:c,blocked:p(c)?null===(o=this.data.video)||void 0===o?void 0:o.blocked:d,opBy:u,changeData:Object.assign({},t.video)}))}},r=t=>{var e,s,i,r;if("share"in t){const{deviceOn:n,sendOn:o,opBy:a}=t.share;(!p(n)&&n!==(null===(e=this.data.share)||void 0===e?void 0:e.deviceOn)||!p(o)&&o!==(null===(s=this.data.share)||void 0===s?void 0:s.sendOn))&&(v({share:t.share},this.data),this.emitter.emit(M.SHARECHANGE,{deviceOn:p(n)?null===(i=this.data.share)||void 0===i?void 0:i.deviceOn:n,sendOn:p(o)?null===(r=this.data.share)||void 0===r?void 0:r.sendOn:o,opBy:a}))}},n=t=>{t.displayName&&t.displayName!==this.data.displayName&&(v({displayName:t.displayName},this.data),this.emitter.emit(M.DISPLAYNAMECHANGE,t.displayName))},o=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(v({isHandUp:t.isHandUp},this.data),this.emitter.emit(M.HANDUPCHANGE,t.isHandUp))},a=t=>{"isSpotlightVideo"in t&&(v({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(M.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},c=e=>t(this,void 0,void 0,(function*(){if("isInLobby"in e&&e.isInLobby!==this.data.isInLobby){v({isInLobby:e.isInLobby},this.data);const t=!1===e.isInLobby?"inLobbyChange":void 0;yield this.rePolling(t),this.emitter.emit(M.LOBBYCHANGE,e.isInLobby),this.ctx.emitter.emit(M.LOBBYCHANGE,e.isInLobby)}})),u=e=>t(this,void 0,void 0,(function*(){const{event:t,state:s,body:i}=e;"personalLayout"===t&&("full"===s?v({personalLayout:i},this.data):"delete"===s&&(this.data.personalLayout=void 0),console.log(this.data.personalLayout),this.emitter.emit(M.PERSONALLAYOUTCHANGE,this.data.personalLayout))})),d=t=>{if(!t.barrage)return;let e=null;if(!t.barrage.wordsDisplayStatus)return e=null,delete t.barrage,this.data.barrage=e||void 0,void this.emitter.emit(M.BARRAGECHANGE,e);if(!t.barrage.receiver)return;e={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};let{role:s}=this.data;if(this.data.endpointType===O.SUPERVISION){const{info:t}=this.ctx.modules;s="webinar"===t.meetingType?_.AUDIENCE:_.ATTENDEE}s===_.HOST||s===_.COHOST?e=t.barrage.receiver.host?e:null:s===_.ATTENDEE?e=t.barrage.receiver.attendee?e:null:s===_.AUDIENCE&&(e=t.barrage.receiver.audience?e:null),delete t.barrage,this.data.barrage=e||void 0,this.emitter.emit(M.BARRAGECHANGE,e)},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),pt(this.ctx),this.emitter.emit(M.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},h=t=>{e(t),s(t),i(t),r(t),n(t),o(t),c(t),a(t),d(t),l(t),(this.data.isInLobby||this.data.role===_.AUDIENCE)&&this.data.share&&this.data.share.sendOn&&r({share:{deviceOn:!0,sendOn:!1,recvOn:!1}})};this.ctx.emitter.on(M.INIT,(t=>{v(t,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(M.UPDATE,(t=>{h(t),v(t,this.data)})),this.ctx.emitter.on($.STATE,(({state:t})=>{t===E.READY&&this.data.endpointType!==O.SUPERVISION&&this.emitter.emit(M.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:s={users:[]}}=e;if("delete"===t){const t=s.users[0];return t.leave=!0,void l(t)}let i=s.users.find((t=>t.userID===this.data.userID));i||s.users.length&&(i=s.users[0]),i?(h(i),v(i,this.data)):console.warn("me ",t,s)})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(M.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(M.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(t=>{const{body:e={}}=t;if("ended"===e.state){l({leave:!0,resultInfo:e.resultInfo})}})),this.ctx.emitter.on("personalLayout",(t=>{u(t)}))}updateUserState(t,e=!1){if(!e){const{role:e,initialMediaState:s}=this.data;t.audio.sendOn=t.audio.sendOn&&s.audio.sendOn,t.video.sendOn=t.video.sendOn&&s.video.sendOn,e===_.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${s}meetings/${i}/updateUserState`,t)}rePolling(e){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;C(t);const s=T(t),i=yield U(s,t);if(e&&this.emitter.emit(M.UPDATE_USER_STATE,{data:this.data,event:e}),yield j(s,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:r}=t.config.request;t.worker.postMessage({inboxes:i,topics:s,meetingID:e,clientID:r,rePolling:!0})}else yield k(i,t)}))}}class V extends w{constructor(t){super(t,"asr")}_topic(){return["meeting"]}_bindOn(){this.ctx.emitter.on("asr",(t=>{const{body:e}=t;void 0===this.data.asr&&(this.data.asr={status:"stopped"}),v(e,this.data.asr),this.emitter.emit("asrChange",{asr:this.data.asr,changeData:e})}))}cleanup(){this.emitter.all=new Map}transcriptStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/transcript/status`,e)}))}}class G extends w{constructor(t){super(t,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(t=>{const{body:e}=t;this.emitter.emit("chatMsg",e)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/chat/historyMsg`,e)}))}}class Y extends w{constructor(t){super(t,"interpretation"),this.data={status:"stopped",interpreters:[]}}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("interpretation",(t=>{const{body:e,state:s}=t;"full"===s?(this.data.interpreters=e.interpreters,this.data.status=e.status):this.data.status=e.status,this.emitter.emit("interpretationChange",this.data)}))}interpretationStart(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/interpretation/start`,t)}interpretationEnd(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/interpretation/stop`)}}class Q extends w{constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:s}=t;if(e&&e.users){if("full"===s)return this.data.callRecordUsers=e.users.map((t=>(t.displayNamePinyin=Q.setDisplayNamePinyinProp?Q.setDisplayNamePinyinProp(t.displayName||""):t.displayName,t))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);this.data.callRecordUsers||(this.data.callRecordUsers=[]),e.users.forEach((t=>{const e=this.data.callRecordUsers.findIndex((e=>t.inviteTransID===e.inviteTransID));"update"===s&&-1!==e?v(t,this.data.callRecordUsers[e]):"update"===s&&-1===e&&(t.displayNamePinyin=Q.setDisplayNamePinyinProp?Q.setDisplayNamePinyinProp(t.displayName||""):t.displayName,this.data.callRecordUsers.push(t))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/invite`,t)}cancelInvite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/cancelInvite`,t)}}class F extends w{constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:s,body:i,stime:r}=t;if(i){if(r&&(this.data.jetlag=r),"full"===s){const{liveStreams:t=[]}=i;if(!t.length)return;const e=[];this.data.liveStreams=t.map((t=>(t.requesting="starting"===t.status,e.push({platform:t.platform||"",status:(t.requesting?"stopped":t.status)||""}),t)));return v({status:e,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),i.liveStreams||(this.data.resultInfo={}),null===(e=i.liveStreams)||void 0===e||e.forEach((t=>{this.data.resultInfo=t.resultInfo||{};let e=this.data.liveStreams.findIndex((e=>e.platform===t.platform));-1===e?(t.requesting="starting"===t.status,this.data.liveStreams.push(t)):(t.requesting="starting"===t.status,t=Object.assign(Object.assign({},this.data.liveStreams[e]),t),this.data.liveStreams.splice(e,1,t)),e=this.data.status.findIndex((e=>e.platform===t.platform));const s=this.data.status.map((t=>t));-1===e?s.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):s.splice(e,1,{platform:s[e].platform||"",status:t.requesting?s[e].status||"stopped":t.status||""}),this.data.status=s})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/setting`,e)}))}}class J extends w{constructor(t){super(t,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(t=>{const{body:e}=t;h(e)&&!l(e)?this.qaUpdate(this.data.questions,e):e.forEach((t=>this.qaUpdate(this.data.questions,t)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(t,e){let s=t.get(e.question.id);const{clientID:i}=this.ctx.config.request;switch(e.command){case"addQuestion":s=this.createQuestion(e.question),t.set(e.question.id,s),this.emitter.emit("questionAdd",{question:s,selfSent:s.sender.endpointID===i});break;case"dismissQuestion":if(!s)break;s.sender.endpointID!==i?s.status="close":s.isTop=!1,t.set(e.question.id,s),this.emitter.emit("questionUpdate",{question:s});break;case"reopenQuestion":s?(s.status="open",s.isTop=e.question.isTop,t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"updateQuestion":s?(s=Object.assign(Object.assign(Object.assign({},s),e.question),{topSort:e.question.isTop?this.data.topSort++:0}),t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteQuestion":if(!s)break;s.sender.endpointID!==i?t.delete(e.question.id):(s.status="delete",s.isTop=!1,s.answers.clear(),t.set(e.question.id,s)),this.emitter.emit("questionDelete",{question:s});break;case"answerQuestion":s?s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)):(s=this.createQuestion(e.question),s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteAnswer":s&&(s.answers.delete(e.answer.id),this.emitter.emit("questionUpdate",{question:s}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(t){return{isAnonymous:t.isAnonymous,isTop:t.isTop,id:t.id,content:t.content,sender:t.sender,timestamp:t.timestamp||-1,status:t.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(t){return{isPrivate:t.isPrivate,content:t.content,id:t.id,sender:t.sender,timestamp:t.timestamp||-1}}qa(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/qa`,e)}))}}class W extends w{constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:s,stime:i}=t;if(s)return i&&(this.data.stime=i),this.data.isPracticeSession="started"===s.status&&this.data.status===s.status&&0===s.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),s),"starting"===s.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=s.status||this.data.status),this.data.resultInfo=s.resultInfo||{},["full","update"].includes(e)?(s.recordUsers&&(this.data.recording.recordUsers=s.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/layout`,e)}))}}class z extends w{constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:s}=t;["full","update"].includes(e)&&v(s,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/unmuteAll`)}))}}class X extends w{constructor(t){super(t,"shouldJoinUsers")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("shouldJoinUsers",(t=>{const{state:e}=t;"update"===e&&this.emitter.emit("shouldJoinUsersChange")}))}modifyUser(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/attendance/shouldJoin`,t)}getUser(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/attendance/getShouldJoin`)}}class K extends w{constructor(t){super(t,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:e}=t;if(!e||!e.userIDs)return;this.data.userIDs=e.userIDs;e.userIDs.findIndex((t=>t===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(M.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(M.UPDATE,{isSpotlightVideo:!1})}))}spotlight(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/view/spotlight`,t)}}class Z extends w{constructor(t){super(t,"transcript"),this.data={asr:{status:"stopped"}}}_topic(){return["transcript"]}_bindOn(){this.ctx.emitter.on("transcriptMsg",(t=>{const{body:e}=t;this.emitter.emit("transcriptMsg",e)}))}cleanup(){this.emitter.all=new Map}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/transcript/historyMsg`,e)}))}}class tt extends w{constructor(t){super(t,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:e}=this.ctx.modules.me.data;return e===O.SUPERVISION?["interactive","broadcast"]:t===_.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:e,state:s})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:i={}}=t;if("delete"!==s||"delete"===s&&[901357,901358,901352,901351,901350,901349].includes(i.bizCode||-1))return void this.ctx.emitter.emit(M.UPDATE,t);let r=!1;switch(e){case"interactiveUsers":t.isInLobby||(r=!0);break;case"broadcastUsers":t.isInLobby||t.role!==_.AUDIENCE||(r=!0);break;case"lobbyUsers":t.isInLobby&&(r=!0)}const n={};r&&(n.leave=!0),this.ctx.emitter.emit(M.UPDATE,Object.assign(Object.assign({},t),n))},e=({updateUsers:e,state:s,sourceKey:i})=>{if("full"===s)return this.data[i]=e.map((e=>(e.displayNamePinyin=tt.setDisplayNamePinyinProp?tt.setDisplayNamePinyinProp(e.displayName):e.displayName,e.groupIDs=tt.setUserGroupIDs?tt.setUserGroupIDs(e.groupIDs||[]):e.groupIDs,t(e,{event:i,state:s}),e))),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!0}),this.data[i];void 0===this.data[i]&&(this.data[i]=[]);const{data:r,emitter:n}=this;return e.forEach((e=>{const o=r[i].findIndex((t=>e.userID===t.userID));if("delete"===s&&-1!==o){const[t]=this.data[i].splice(o,1);n.emit(`${i}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===s&&-1!==o){const t=this.data[i][o];this.updateUserProps(e,t),v(e,t),this.data[i][o]=I(t),this.emitter.emit(`${i}Update`,{user:this.data[i][o]})}else"update"===s&&-1===o&&(e.displayNamePinyin=tt.setDisplayNamePinyinProp?tt.setDisplayNamePinyinProp(e.displayName):e.displayName,r[i].push(e),this.emitter.emit(`${i}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:i,state:s})})),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!1}),this.data[i]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:s,body:i}=t;e({updateUsers:i.users,state:s,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:s,body:i}=t;e({updateUsers:i.users,state:s,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:s,body:i}=t;e({updateUsers:i.users,state:s,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:s,body:i}=t;e({updateUsers:i.users,state:s,sourceKey:"advCtrlUsers"})}))}reactive(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,i)=>{Object.keys(t).forEach((r=>{!1===i&&r in this.data&&(t[r]=this.data[r]);const n=e=>t[r]=e.users.map((t=>t)),o=`${x(r)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[r])&&!l(t[r])&&s(t[r],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(t,e){t.displayName&&t.displayName!==e.displayName&&(t.displayNamePinyin=tt.setDisplayNamePinyinProp?tt.setDisplayNamePinyinProp(t.displayName):t.displayName)}setAudio(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/users/${t}/callStats`)}callStatsReport(t){if(!t.userID)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t.userID}/callStats/report`,t)}replyAllHandUp(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/refuseAll`)}getSendLayout(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/sendLayout`)}setSendLayout(t,e){const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/sendLayout`,e)}setSendLayoutEnabled(t,e){const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/sendLayoutEnabled`,e)}pauseAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/pauseAudio`)}resumeAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/resumeAudio`)}modifyRoleBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyRoleBatch `,t)}modifyVideoBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyVideoBatch `,t)}putInLobbyBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/putInLobbyBatch `,t)}removeBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/removeBatch `,t)}}class et extends w{constructor(t){super(t,"view")}_topic(){const{endpointType:t,role:e}=this.ctx.modules.me.data;return t===O.WEBCTRL?["hostAttendee","audience","advCtrl"]:e===_.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((t=>{this.ctx.emitter.on(t,(e=>{"personalView"!==t?this.updateLayout(e,t):this.updatePersonalLayouts(e)}))})),this.ctx.emitter.on("videoSourcesUpdated",(()=>{this.emitter.emit("videoSourcesUpdated")}))}updateLayout(t,e){const{event:s,body:i}=t;i&&("meetingView"===s?Object.keys(i).forEach((t=>{this.data[t]=i[t]})):this.data[e]=i)}updatePersonalLayouts(t){const{state:e,body:s}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),s.personalLayouts.forEach((t=>{const{subscriber:s={userID:-1}}=t,i=s.userID||s.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[i]=t:delete this.data.personalLayouts[i]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/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)}))}setSavedBackground(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/recentBackgroundFile`,e)}))}getSavedBackground(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/view/recentBackgroundFile`)}))}}class st extends w{constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:s}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[s]=e,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:e})})),this.ctx.emitter.on(M.LOBBYCHANGE,(t=>{t&&(this.data.vote={})}))}getVotes(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:s},meetingID:i,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.post(`${s}meetings/${i}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:s},meetingID:i,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.post(`${s}meetings/${i}/vote/submit?tk=${t.tk}&voteID=${t.voteID}`,e)}voteAdd(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/add`,t)}voteEdit(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/edit`,t)}voteDelete(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/delete`,t)}voteInProgress(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/vote/inProgress`,{params:{tk:t&&t.tk||i}})}}class it extends w{constructor(t){super(t,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:e,body:s,pollingSeqId:i}=t;if(!s)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(M.UPDATE,{barrage:this.data});"full"===e&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),i&&(this.data.barrageRecord=[{id:i,content:s.content,time:(new Date).getTime(),durationType:s.durationType,duration:1e3*s.duration},...this.data.barrageRecord]),s.wordsDisplayStatus=!0,-1!==s.duration&&(this.data.timer=setTimeout((()=>{s.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=s.wordsDisplayStatus,this.ctx.emitter.emit(M.UPDATE,{barrage:this.data})}),1e3*s.duration)),v(s,this.data),this.ctx.emitter.emit(M.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(M.ROLECHANGE,(()=>this.ctx.emitter.emit(M.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/deleteBarrage`)}))}}function rt(t){const{baseURL:s,modules:i,worker:r,singleton:n}=t;i.findIndex((t=>t===B))<0&&i.push(B),i.findIndex((t=>t===S))<0&&i.push(S);const o=t.clientID||`${g()}_${((t=new Date,e)=>{const s={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(const i in s)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[i]:("00"+s[i]).substr((""+s[i]).length)));return e})(new Date,"MMddHHmmss")}`,u={config:{baseURL:s,modules:i,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:r,emitter:e(),request:new a({baseURL:s,beforeRequest:t=>{t.headers["X-Y-Request-Id"]=g(),t.timeout=18e5},error:t=>{u.emitter.emit($.REQUEST_ERROR,t)}}),modules:{},state:E.CLOSE,status:{polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},cleanup:t=>{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,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),Object.keys(u.modules).forEach((t=>{u.modules[t].cleanup()})),u.state=E.CLOSE,u.emitter.emit($.STATE,{state:u.state,reason:t}))}};return u}function nt(t){const e=rt(t);return e.worker&&("undefined"!=typeof Worker?e.worker.postMessage({baseURL:e.config.baseURL}):console.error("The current environment does not support worker")),function(t,e){if(!l(t))return void console.error("The modules parameter requires an array type");t.forEach((t=>{const s=new t(e);e.modules[s.moduleName]=s}))}(e.config.modules,e),e.emitter.on($.POLLING_ERROR,(t=>{at(e)({resultInfo:t})})),e.emitter.on($.KEEPALIVE_ERROR,(t=>{at(e)({resultInfo:t})})),Object.assign({config:e.config,request:e.request,get state(){return e.state},on:e.emitter.on,off:e.emitter.off,join:ot(e),leave:at(e),end:ct(e),endMeeting:ut(e)},e.modules)}function ot(e){return function(s){var i;return t(this,void 0,void 0,(function*(){const{clientID:t}=e.config.request,r=`${null===(i=s.endpointType)||void 0===i?void 0:i.toLocaleUpperCase()}${t}_${s.meetingNum}`;e.config.request.sessionID=r,e.request.setDefaultHeader("X-Y-Session-Id",r);const{prefix:n}=e.config.request,o=yield e.request.get(`${n.ctrl}credential`,{params:{meetingNum:s.meetingNum,pwd:s.pwd,url:s.url,mobileCode:s.mobileCode,mobile:s.mobile,regEmail:s.regEmail,accEmail:s.accEmail,tk:s.tk,displayName:s.displayName,userAgent:s.userAgent},headers:{"X-Y-Endpoint-Type":s.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return e.emitter.emit($.FAILED,{bizCode:o.bizCode,data:o.data}),o;e.config.request.location=c,e.request.setDefaultHeader("X-Y-Location",c),delete s.pwd,delete s.url;const u={displayName:s.displayName,userAgent:s.userAgent,clientID:t};s.groupIDs&&s.account&&(u.groupIDs=s.groupIDs,u.account=s.account,u.groupName=s.groupName);const d=yield e.request.post(`${n.ctrl}join?meetingNum=${s.meetingNum}&credential=${a}`,u,{headers:{"X-Y-Endpoint-Type":s.endpointType,"X-Y-Endpoint-Id":t}});if(!d||d&&d.ret<=-1)return e.emitter.emit($.FAILED,{bizCode:d.bizCode,data:d.data}),d;const{meetingID:l="",ctrlID:p="",user:h={},mediaContent:f={},initialMediaState:m={},tk:g=""}=d.data;e.config.request.meetingID=l,e.config.request.ctrlID=p,e.config.request.userID=h.userID,e.config.request.voteTk=g,e.request.setDefaultHeader("X-Y-Ctrl-Id",p),e.emitter.emit(M.INIT,Object.assign(Object.assign({},h),{mediaContent:f,initialMediaState:m})),e.state=E.JOINED,e.emitter.emit($.STATE,{state:e.state});const v=()=>{e.state!==E.READY&&(e.state=E.READY,e.emitter.emit($.STATE,{state:e.state}))},y=T(e),x=yield U(y,e);return yield j(y,e),"undefined"!=typeof Worker&&e.worker?(e.status.polling.running=!0,e.worker.postMessage({topics:y,meetingID:l,clientID:t,inboxes:x,status:!0}),e.worker.onmessage=t=>{"pollingStarted"!==t.data?"pollingStopped"!==t.data?(console.log("[Polling]",t.data),e.emitter.emit(t.data.event,t.data)):e.status.polling.running=!1:v()}):(e.status.polling.running=!0,k(x,e),v()),e.status.keepalive.running=!0,N(e,(t=>{e.emitter.emit($.KEEPALIVE_ERROR,t)})),d.data=Object.assign(Object.assign({},d.data),o.data),d}))}}function at(e){return function(s){return t(this,void 0,void 0,(function*(){s||(s={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:i}=e.config.request;let r;try{r=yield e.request.post(`${t.ctrl}meetings/${i}/leave`,s)}catch(n){console.error(n)}return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),R(e),pt(e),e.cleanup(),r}))}}function ct(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:s}=e.config.request,i=yield e.request.post(`${t.ctrl}meetings/${s}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),R(e),pt(e),e.cleanup(),i}))}}function ut(e){return function(s){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${s}/end`)}))}}class dt{constructor(t){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=nt(t)}static getInstance(t){return this.instance?this.instance:this.instance=new dt(t)}}function lt(t){return t.singleton?dt.getInstance(t).meeting:nt(t)}function pt(t){if(t.config.singleton){const{baseURL:e,modules:s,singleton:i}=t.config,r={baseURL:e,modules:s,worker:t.worker,singleton:i},n=dt.getInstance(r);n&&(n.meeting=nt(r))}}Object.defineProperty(dt,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null});export{V as Asr,G as Chat,O as ENDPOINT_TYPE,$ as EVENT,S as Info,Y as Interpretation,Q as Invite,F as LiveStream,B as Me,M as MeEvent,J as Qa,A as RECORD_STATUS,_ as ROLE,W as Recording,E as STATE,z as Setting,X as ShouldJoinUsers,K as SpotlightVideo,Z as Transcript,tt as Users,et as View,st as Vote,it as Words,lt as createMeeting,pt as reset};
@@ -1 +1 @@
1
- var YlinkSDKMeeting=function(t){"use strict";function e(t,e,s,i){return new(s||(s=Promise))((function(r,n){function o(t){try{c(i.next(t))}catch(e){n(e)}}function a(t){try{c(i.throw(t))}catch(e){n(e)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,a)}c((i=i.apply(t,e||[])).next())}))}function s(t){return{all:t=t||new Map,on:function(e,s){var i=t.get(e);i?i.push(s):t.set(e,[s])},off:function(e,s){var i=t.get(e);i&&(s?i.splice(i.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var i=t.get(e);i&&i.slice().map((function(t){t(s)})),(i=t.get("*"))&&i.slice().map((function(t){t(e,s)}))}}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(t,e){var s="__lodash_hash_undefined__",r=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]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",x="[object ArrayBuffer]",b="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",$="[object Uint8Array]",T="[object Uint8ClampedArray]",_="[object Uint16Array]",A="[object Uint32Array]",S=/\w*$/,w=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[x]=U[b]=U[o]=U[a]=U[E]=U[q]=U[I]=U[D]=U[O]=U[d]=U[l]=U[p]=U[f]=U[m]=U[g]=U[v]=U[$]=U[T]=U[_]=U[A]=!0,U["[object Error]"]=U[c]=U[y]=!1;var N="object"==typeof self&&self&&self.Object===Object&&self,j="object"==typeof i&&i&&i.Object===Object&&i||N||Function("return this")(),R=e&&!e.nodeType&&e,L=R&&t&&!t.nodeType&&t,k=L&&L.exports===R;function C(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function H(t,e,s,i){var r=-1,n=t?t.length:0;for(i&&n&&(s=t[++r]);++r<n;)s=e(s,t[r],r,t);return s}function V(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(s){}return e}function B(t){var e=-1,s=Array(t.size);return t.forEach((function(t,i){s[++e]=[i,t]})),s}function G(t,e){return function(s){return t(e(s))}}function Y(t){var e=-1,s=Array(t.size);return t.forEach((function(t){s[++e]=t})),s}var Q,F=Array.prototype,J=Function.prototype,W=Object.prototype,z=j["__core-js_shared__"],X=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=J.toString,Z=W.hasOwnProperty,tt=W.toString,et=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),st=k?j.Buffer:void 0,it=j.Symbol,rt=j.Uint8Array,nt=G(Object.getPrototypeOf,Object),ot=Object.create,at=W.propertyIsEnumerable,ct=F.splice,ut=Object.getOwnPropertySymbols,dt=st?st.isBuffer:void 0,lt=G(Object.keys,Object),pt=Lt(j,"DataView"),ht=Lt(j,"Map"),ft=Lt(j,"Promise"),mt=Lt(j,"Set"),gt=Lt(j,"WeakMap"),vt=Lt(Object,"create"),yt=Vt(pt),xt=Vt(ht),bt=Vt(ft),Et=Vt(mt),qt=Vt(gt),It=it?it.prototype:void 0,Dt=It?It.valueOf:void 0;function Ot(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function $t(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function Tt(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function _t(t){this.__data__=new $t(t)}function At(t,e){var s=Gt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Yt(t)}(t)&&Z.call(t,"callee")&&(!at.call(t,"callee")||tt.call(t)==n)}(t)?function(t,e){for(var s=-1,i=Array(t);++s<t;)i[s]=e(s);return i}(t.length,String):[],i=s.length,r=!!i;for(var o in t)!e&&!Z.call(t,o)||r&&("length"==o||Mt(o,i))||s.push(o);return s}function St(t,e,s){var i=t[e];Z.call(t,e)&&Bt(i,s)&&(void 0!==s||e in t)||(t[e]=s)}function wt(t,e){for(var s=t.length;s--;)if(Bt(t[s][0],e))return s;return-1}function Pt(t,e,s,i,r,h,y){var w;if(i&&(w=h?i(t,r,h,y):i(t)),void 0!==w)return w;if(!Jt(t))return t;var P=Gt(t);if(P){if(w=function(t){var e=t.length,s=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(s.index=t.index,s.input=t.input);return s}(t),!e)return function(t,e){var s=-1,i=t.length;e||(e=Array(i));for(;++s<i;)e[s]=t[s];return e}(t,w)}else{var N=Ct(t),j=N==c||N==u;if(Qt(t))return function(t,e){if(e)return t.slice();var s=new t.constructor(t.length);return t.copy(s),s}(t,e);if(N==p||N==n||j&&!h){if(V(t))return h?t:{};if(w=function(t){return"function"!=typeof t.constructor||Ht(t)?{}:(e=nt(t),Jt(e)?ot(e):{});var e}(j?{}:t),!e)return function(t,e){return jt(t,kt(t),e)}(t,function(t,e){return t&&jt(e,Wt(e),t)}(w,t))}else{if(!U[N])return h?t:{};w=function(t,e,s,i){var r=t.constructor;switch(e){case x:return Nt(t);case o:case a:return new r(+t);case b:return function(t,e){var s=e?Nt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.byteLength)}(t,i);case E:case q:case I:case D:case O:case $:case T:case _:case A:return function(t,e){var s=e?Nt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.length)}(t,i);case d:return function(t,e,s){return H(e?s(B(t),!0):B(t),C,new t.constructor)}(t,i,s);case l:case g:return new r(t);case f:return function(t){var e=new t.constructor(t.source,S.exec(t));return e.lastIndex=t.lastIndex,e}(t);case m:return function(t,e,s){return H(e?s(Y(t),!0):Y(t),M,new t.constructor)}(t,i,s);case v:return n=t,Dt?Object(Dt.call(n)):{}}var n}(t,N,Pt,e)}}y||(y=new _t);var R=y.get(t);if(R)return R;if(y.set(t,w),!P)var L=s?function(t){return function(t,e,s){var i=e(t);return Gt(t)?i:function(t,e){for(var s=-1,i=e.length,r=t.length;++s<i;)t[r+s]=e[s];return t}(i,s(t))}(t,Wt,kt)}(t):Wt(t);return function(t,e){for(var s=-1,i=t?t.length:0;++s<i&&!1!==e(t[s],s,t););}(L||t,(function(r,n){L&&(r=t[n=r]),St(w,n,Pt(r,e,s,i,n,t,y))})),w}function Ut(t){return!(!Jt(t)||(e=t,X&&X in e))&&(Ft(t)||V(t)?et:w).test(Vt(t));var e}function Nt(t){var e=new t.constructor(t.byteLength);return new rt(e).set(new rt(t)),e}function jt(t,e,s,i){s||(s={});for(var r=-1,n=e.length;++r<n;){var o=e[r],a=i?i(s[o],t[o],o,s,t):void 0;St(s,o,void 0===a?t[o]:a)}return s}function Rt(t,e){var s,i,r=t.__data__;return("string"==(i=typeof(s=e))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==s:null===s)?r["string"==typeof e?"string":"hash"]:r.map}function Lt(t,e){var s=function(t,e){return null==t?void 0:t[e]}(t,e);return Ut(s)?s:void 0}Ot.prototype.clear=function(){this.__data__=vt?vt(null):{}},Ot.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Ot.prototype.get=function(t){var e=this.__data__;if(vt){var i=e[t];return i===s?void 0:i}return Z.call(e,t)?e[t]:void 0},Ot.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:Z.call(e,t)},Ot.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?s:e,this},$t.prototype.clear=function(){this.__data__=[]},$t.prototype.delete=function(t){var e=this.__data__,s=wt(e,t);return!(s<0)&&(s==e.length-1?e.pop():ct.call(e,s,1),!0)},$t.prototype.get=function(t){var e=this.__data__,s=wt(e,t);return s<0?void 0:e[s][1]},$t.prototype.has=function(t){return wt(this.__data__,t)>-1},$t.prototype.set=function(t,e){var s=this.__data__,i=wt(s,t);return i<0?s.push([t,e]):s[i][1]=e,this},Tt.prototype.clear=function(){this.__data__={hash:new Ot,map:new(ht||$t),string:new Ot}},Tt.prototype.delete=function(t){return Rt(this,t).delete(t)},Tt.prototype.get=function(t){return Rt(this,t).get(t)},Tt.prototype.has=function(t){return Rt(this,t).has(t)},Tt.prototype.set=function(t,e){return Rt(this,t).set(t,e),this},_t.prototype.clear=function(){this.__data__=new $t},_t.prototype.delete=function(t){return this.__data__.delete(t)},_t.prototype.get=function(t){return this.__data__.get(t)},_t.prototype.has=function(t){return this.__data__.has(t)},_t.prototype.set=function(t,e){var s=this.__data__;if(s instanceof $t){var i=s.__data__;if(!ht||i.length<199)return i.push([t,e]),this;s=this.__data__=new Tt(i)}return s.set(t,e),this};var kt=ut?G(ut,Object):function(){return[]},Ct=function(t){return tt.call(t)};function Mt(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<e}function Ht(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||W)}function Vt(t){if(null!=t){try{return K.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Bt(t,e){return t===e||t!=t&&e!=e}(pt&&Ct(new pt(new ArrayBuffer(1)))!=b||ht&&Ct(new ht)!=d||ft&&Ct(ft.resolve())!=h||mt&&Ct(new mt)!=m||gt&&Ct(new gt)!=y)&&(Ct=function(t){var e=tt.call(t),s=e==p?t.constructor:void 0,i=s?Vt(s):void 0;if(i)switch(i){case yt:return b;case xt:return d;case bt:return h;case Et:return m;case qt:return y}return e});var Gt=Array.isArray;function Yt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}(t.length)&&!Ft(t)}var Qt=dt||function(){return!1};function Ft(t){var e=Jt(t)?tt.call(t):"";return e==c||e==u}function Jt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return Yt(t)?At(t):function(t){if(!Ht(t))return lt(t);var e=[];for(var s in Object(t))Z.call(t,s)&&"constructor"!=s&&e.push(s);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}}(r,r.exports);var n=r.exports;const o=t=>({get(e,s,i){if("__isProxy"===s)return!0;const r=Reflect.get(e,s);return Array.isArray(r)?r:"object"==typeof r&&null!==r?r.__isProxy?r:new Proxy(r,o(t)):r},set(e,s,i,r){const o=e[s];i=f(i)&&i.__isProxy?n(i):i;const a=Reflect.set(e,s,i,r);return((t,e)=>t!==e&&(t==t||e==e))(i,o)&&t.emit(`${b(s)}Change`,i),a}}),a=t=>encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class c{constructor(t){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=t.baseURL,this._beforeRequest=t.beforeRequest,this._errorHandler=t.error}_request(t){const e=t.timeout||18e5;let s=t.headers||{};return t.url=D(this.baseURL,t.url||""),t.url=((t,e)=>{if(!e)return t;const s=[];Object.keys(e).forEach((t=>{const i=e[t];if(null==i)return;let r;Array.isArray(i)?(r=i,t+="[]"):r=[i],r.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),s.push(`${a(t)}=${a(e)}`)}))}));const i=s.join("&");if(i){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t})(t.url,t.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[t],delete s[t])})),m(t.data)&&(t.data=t.data.buffer),g(t.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=s,t.timeout=e,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx&&void 0!==wx.request?l(t):d(t)}setDefaultHeader(t,e){t in this._defaultHeaders&&(""===e||null===e)?delete this._defaultHeaders[t]:this._defaultHeaders[t]=e}get(t,e){return this._errorHandler?this._request(Object.assign(e||{},{url:t,method:"GET"})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(e||{},{url:t,method:"GET"}))}post(t,e,s){return this._errorHandler?this._request(Object.assign(s||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(s||{},{url:t,method:"POST",data:e}))}}class u{constructor(t){let e;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((t=>{e=t})),t((t=>{this.reason||(this.reason=t,e(this.reason))}))}static source(){let t;const e=new u((e=>{t=e}));return{cancel:t,token:e}}}const d=t=>new Promise(((e,s)=>{const{data:i=null,url:r,method:n="GET",headers:o,cancelToken:a}=t;let c=new XMLHttpRequest;c.open(n.toUpperCase(),r,!0),c.timeout=t.timeout;const u=()=>{if(c){if(c.status>=200&&c.status<300)try{const t=JSON.parse(c.responseText);e(t)}catch(t){s(new Error("E_JSON_PARSE"+c.responseText))}else s({url:r,statusCode:c.status});c=null}};"onloadend"in c?c.onloadend=u:c.onreadystatechange=()=>{c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=()=>{c&&(s({url:r,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{s(new Error("Network Error")),c=null},c.ontimeout=()=>{s(new Error("timeout of "+t.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(o).forEach((t=>{null===i&&"content-type"===t.toLowerCase()?delete o[t]:c.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{c&&(c.abort(),s(t),c=null)})),c.send(i)})),l=t=>new Promise(((e,s)=>{const{data:i=null,url:r,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:r,data:i,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):s({url:r,statusCode:t.statusCode})},fail(t){s("request:fail abort"===t.errMsg&&a&&a.reason||t)}});a&&a.promise.then((()=>{c&&c.abort()}))})),p=Array.isArray,h=t=>null==t,f=t=>"object"==typeof t&&null!==t,m=t=>{let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer,e},g=t=>{if("[object Object]"!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},v=()=>{const t=[],e="0123456789abcdef";for(let s=0;s<36;s++)t[s]=e.substr(Math.floor(16*Math.random()),1);t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-";return t.join("").split("-").join("")},y=(t,e)=>t?(Object.entries(t).forEach((t=>{const[s,i]=[t[0],t[1]];if(null!==i)return f(i)&&!p(i)?(e[s]||(e[s]={}),void(e[s]=y(i,e[s]))):void(e[s]=i)})),e):e,x=/-(\w)/g,b=t=>t.replace(x,((t,e)=>e?e.toUpperCase():"")),{hasOwnProperty:E}=Object.prototype,q=(t,e)=>E.call(t,e),I=(t,e=new Map)=>{if(e.get(t))return e.get(t);if(!(t instanceof Object))return t;let s;s=t instanceof Array?[]:t instanceof Function?()=>t():t instanceof RegExp?new RegExp(t.source,t.flags):t instanceof Date?new Date(t):{},e.set(t,s);for(const i in t)q(t,i)&&(s[i]=I(t[i],e));return s},D=(t,e)=>t&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)?((t,e)=>e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e):e;var O,$,T,_,A;t.EVENT=void 0,(O=t.EVENT||(t.EVENT={})).STATE="state",O.FAILED="failed",O.REQUEST_ERROR="requestError",O.POLLING_ERROR="pollingError",O.KEEPALIVE_ERROR="keepaliveError",t.STATE=void 0,($=t.STATE||(t.STATE={}))[$.CLOSE=0]="CLOSE",$[$.JOINED=1]="JOINED",$[$.READY=2]="READY",t.ENDPOINT_TYPE=void 0,(T=t.ENDPOINT_TYPE||(t.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",T.MULTI_STREAM="multiStream",T.MEETING_TOUCH="meetingTouch",t.ROLE=void 0,(_=t.ROLE||(t.ROLE={})).HOST="host",_.COHOST="coHost",_.ATTENDEE="attendee",_.AUDIENCE="audience",t.RECORD_STATUS=void 0,(A=t.RECORD_STATUS||(t.RECORD_STATUS={})).STARTED="started",A.PAUSED="paused",A.STARTING="starting",A.STOPPED="stopped";class S{constructor(t,e){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=e,this.ctx=t,this.emitter=s(),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(t){if(!f(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,i)=>{Object.keys(t).forEach((r=>{!1===i&&r in this.data&&(t[r]=this.data[r]);const n=e=>t[r]=e,o=`${b(r)}Change`;this.emitter.on(o,n),e.set(o,n),f(t[r])&&!p(t[r])&&s(t[r],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}}class w extends S{constructor(t){super(t,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(t=>{const{state:e,body:s}=t;("full"===e||"update"===e)&&y(s,this.data)})),this.ctx.emitter.on("participantCount",(t=>{const{body:e}=t;y({participantCount:e},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/info/practiceSession`)}))}shareInfo(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/shareInfo`,{params:t})}meetings(t){if(!t)return Promise.reject();const{prefix:{ctrl:e}}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings`,{params:t})}mailTemplate(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}mailTemplate`,{params:{meetingID:s},headers:{language:t.language}})}}function P(t){const e=[],{isInLobby:s}=t.modules.me.data;return s?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((s=>{const i=t.modules[s]._topic();i&&(Array.isArray(i)?i.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(i)||e.push(i))})),e)}function U(t,s){return e(this,void 0,void 0,(function*(){const{meetingID:e,clientID:i}=s.config.request,r=yield s.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:i,meetingId:e},inboxes:t}),n=[];return r.data&&Object.keys(r.data).forEach((t=>{n.push({name:t,seqId:r.data[t].maxSeqId,limit:200})})),n}))}function N(t,s){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i,clientID:r}=s.config.request,n=yield s.request.post(`${e}meetings/${i}/subscribe`,{endpointID:r,topics:t}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((t=>{s.emitter.emit(t.event,t)}))}))}function j(t,s,i){return e(this,void 0,void 0,(function*(){const{inboxes:r,clientID:n,meetingID:o,cancelToken:a,status:c}=s;if(yield(()=>e(this,void 0,void 0,(function*(){let e;try{e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:r},{cancelToken:a})}catch(d){return c.attempts++,void console.error(d)}if(!e)return console.error("polling error: ","response is null"),void c.attempts++;const{data:s={},bizCode:u,error:d}=e;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,s&&Object.keys(s).forEach((t=>{const e=r.find((e=>e.name===t));e&&(e.seqId=s[t].maxSeqId,s[t].items&&s[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),e.pollingSeqId=t.seqId,i(e)})))}))})))(),!c.running)return;if(c.attempts>M)return console.error("polling Max Attempts"),void(s.onError&&s.onError({message:"polling Max Attempts"}));const u=c.attempts?H(c.attempts):0;c.timer=setTimeout((()=>{c.running&&j(t,s,i)}),u)}))}const R=(s,i)=>e(void 0,void 0,void 0,(function*(){const{meetingID:e,clientID:r}=i.config.request;i.status.polling.running=!0,j(i.request,{inboxes:s,clientID:r,meetingID:e,cancelToken:i.config.request.cancelToken.token,status:i.status.polling,onError:e=>{i.emitter.emit(t.EVENT.POLLING_ERROR,e)}},(t=>{i.emitter.emit(t.event,t)}))}));function L(t){t.status.polling.running=!1,t.status.polling.attempts=0,t.status.polling.timer&&(clearTimeout(t.status.polling.timer),t.status.polling.timer=null),t.config.request.cancelToken.cancel(),t.config.request.cancelToken=u.source()}function k(t,s){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:r,userID:n}=t.config.request;if(t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){let e;try{e=yield t.request.post(`${i}meetings/${r}/users/${n}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token})}catch(a){return t.status.keepalive.attempts++,void console.error(a)}if(!e||!e.data)return;const{data:s={},bizCode:o,error:a}=e;if(900200!==o&&900408!==o&&901323!==o)return t.status.keepalive.attempts++,void console.error("keepalive ",o,a);const c=s.interval||"";c?(t.status.keepalive.interval=c,t.status.keepalive.attempts=0):console.error("keepalive ",o,a)})))(),!t.status.keepalive.running)return;if(t.status.keepalive.attempts>M)return console.error("keepalive Max Attempts"),void(s&&s({message:"keepalive Max Attempts"}));const o=t.status.keepalive.attempts?H(t.status.keepalive.attempts):1e3*t.status.keepalive.interval;t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&k(t,s)}),o)}))}const C=t=>{t.status.keepalive.running=!1,t.status.keepalive.attempts=0,t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null)},M=5,H=t=>{console.log(`computeNextTimeout attempts: ${t}`);let e=Math.floor(Math.random()*Math.pow(2,t)+1);return e<2&&(e=2),e>30&&(e=30),1e3*e};var V;t.MeEvent=void 0,(V=t.MeEvent||(t.MeEvent={})).INIT="meInit",V.UPDATE="meUpdate",V.UPDATE_USER_STATE="updateUserState",V.ROLECHANGE="meRoleChange",V.AUDIOCHANGE="meAudioChange",V.HANDUPCHANGE="meHandupChange",V.SETAUDIO="setAudio",V.VIDEOCHANGE="meVideoChange",V.SETVIDEO="setVideo",V.SHARECHANGE="meShareChange",V.DISPLAYNAMECHANGE="meDisplayNameChange",V.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",V.LOBBYCHANGE="meLobbyChange",V.BARRAGECHANGE="meBarrageChange",V.PERSONALLAYOUTCHANGE="personalLayoutChange",V.LEAVE="leave";class B extends S{constructor(t){super(t,"me")}_topic(){return""}_bindOn(){const s=s=>e(this,void 0,void 0,(function*(){if("role"in s&&s.role!==this.data.role){const e=this.data.role;y({role:s.role},this.data),s.role!==t.ROLE.AUDIENCE&&e!==t.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(t.MeEvent.ROLECHANGE,s.role),this.ctx.emitter.emit(t.MeEvent.ROLECHANGE,s.role)}})),i=e=>{var s,i,r,n,o,a;if("audio"in e){const{deviceOn:c,sendOn:u,recvOn:d,opBy:l}=e.audio;(!h(c)&&c!==(null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn)||!h(u)&&u!==(null===(i=this.data.audio)||void 0===i?void 0:i.sendOn)||!h(d)&&u!==(null===(r=this.data.audio)||void 0===r?void 0:r.recvOn)||!h(l))&&(y({audio:e.audio},this.data),this.emitter.emit(t.MeEvent.AUDIOCHANGE,{deviceOn:h(c)?null===(n=this.data.audio)||void 0===n?void 0:n.deviceOn:c,sendOn:h(u)?null===(o=this.data.audio)||void 0===o?void 0:o.sendOn:u,recvOn:h(u)?null===(a=this.data.audio)||void 0===a?void 0:a.recvOn:d,opBy:l,changeData:Object.assign({},e.audio)}))}},r=e=>{var s,i,r,n,o,a;if("video"in e){const{deviceOn:c,sendOn:u,opBy:d,blocked:l}=e.video;(!h(c)&&c!==(null===(s=this.data.video)||void 0===s?void 0:s.deviceOn)||!h(u)&&u!==(null===(i=this.data.video)||void 0===i?void 0:i.sendOn)||!h(l)&&l!==(null===(r=this.data.video)||void 0===r?void 0:r.blocked))&&(y({video:e.video},this.data),this.emitter.emit(t.MeEvent.VIDEOCHANGE,{deviceOn:h(c)?null===(n=this.data.video)||void 0===n?void 0:n.deviceOn:c,sendOn:h(u)?null===(o=this.data.video)||void 0===o?void 0:o.sendOn:u,blocked:h(u)?null===(a=this.data.video)||void 0===a?void 0:a.blocked:l,opBy:d,changeData:Object.assign({},e.video)}))}},n=e=>{var s,i,r,n;if("share"in e){const{deviceOn:o,sendOn:a,opBy:c}=e.share;(!h(o)&&o!==(null===(s=this.data.share)||void 0===s?void 0:s.deviceOn)||!h(a)&&a!==(null===(i=this.data.share)||void 0===i?void 0:i.sendOn))&&(y({share:e.share},this.data),this.emitter.emit(t.MeEvent.SHARECHANGE,{deviceOn:h(o)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:o,sendOn:h(a)?null===(n=this.data.share)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},o=e=>{e.displayName&&e.displayName!==this.data.displayName&&(y({displayName:e.displayName},this.data),this.emitter.emit(t.MeEvent.DISPLAYNAMECHANGE,e.displayName))},a=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(y({isHandUp:e.isHandUp},this.data),this.emitter.emit(t.MeEvent.HANDUPCHANGE,e.isHandUp))},c=e=>{"isSpotlightVideo"in e&&(y({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(t.MeEvent.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},u=s=>e(this,void 0,void 0,(function*(){if("isInLobby"in s&&s.isInLobby!==this.data.isInLobby){y({isInLobby:s.isInLobby},this.data);const e=!1===s.isInLobby?"inLobbyChange":void 0;yield this.rePolling(e),this.emitter.emit(t.MeEvent.LOBBYCHANGE,s.isInLobby),this.ctx.emitter.emit(t.MeEvent.LOBBYCHANGE,s.isInLobby)}})),d=s=>e(this,void 0,void 0,(function*(){const{event:e,state:i,body:r}=s;"personalLayout"===e&&("full"===i?y({personalLayout:r},this.data):"delete"===i&&(this.data.personalLayout=void 0),console.log(this.data.personalLayout),this.emitter.emit(t.MeEvent.PERSONALLAYOUTCHANGE,this.data.personalLayout))})),l=e=>{if(!e.barrage)return;let s=null;if(!e.barrage.wordsDisplayStatus)return s=null,delete e.barrage,this.data.barrage=s||void 0,void this.emitter.emit(t.MeEvent.BARRAGECHANGE,s);if(!e.barrage.receiver)return;s={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===t.ENDPOINT_TYPE.SUPERVISION){const{info:e}=this.ctx.modules;i="webinar"===e.meetingType?t.ROLE.AUDIENCE:t.ROLE.ATTENDEE}i===t.ROLE.HOST||i===t.ROLE.COHOST?s=e.barrage.receiver.host?s:null:i===t.ROLE.ATTENDEE?s=e.barrage.receiver.attendee?s:null:i===t.ROLE.AUDIENCE&&(s=e.barrage.receiver.audience?s:null),delete e.barrage,this.data.barrage=s||void 0,this.emitter.emit(t.MeEvent.BARRAGECHANGE,s)},p=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),L(this.ctx),Z(this.ctx),this.emitter.emit(t.MeEvent.LEAVE,e.resultInfo),this.ctx.cleanup(e.resultInfo))},f=e=>{s(e),i(e),r(e),n(e),o(e),a(e),u(e),c(e),l(e),p(e),(this.data.isInLobby||this.data.role===t.ROLE.AUDIENCE)&&this.data.share&&this.data.share.sendOn&&n({share:{deviceOn:!0,sendOn:!1,recvOn:!1}})};this.ctx.emitter.on(t.MeEvent.INIT,(t=>{y(t,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(t.MeEvent.UPDATE,(t=>{f(t),y(t,this.data)})),this.ctx.emitter.on(t.EVENT.STATE,(({state:e})=>{e===t.STATE.READY&&this.data.endpointType!==t.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(t.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:s={users:[]}}=t;if("delete"===e){const t=s.users[0];return t.leave=!0,void p(t)}let i=s.users.find((t=>t.userID===this.data.userID));i||s.users.length&&(i=s.users[0]),i?(f(i),y(i,this.data)):console.warn("me ",e,s)})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(t.MeEvent.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(t.MeEvent.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(t=>{const{body:e={}}=t;if("ended"===e.state){p({leave:!0,resultInfo:e.resultInfo})}})),this.ctx.emitter.on("personalLayout",(t=>{d(t)}))}updateUserState(e,s=!1){if(!s){const{role:s,initialMediaState:i}=this.data;e.audio.sendOn=e.audio.sendOn&&i.audio.sendOn,e.video.sendOn=e.video.sendOn&&i.video.sendOn,s===t.ROLE.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,y(e,this.data),this.ctx.request.post(`${i}meetings/${r}/updateUserState`,e)}rePolling(s){return e(this,void 0,void 0,(function*(){const{ctx:e}=this;L(e);const i=P(e),r=yield U(i,e);if(s&&this.emitter.emit(t.MeEvent.UPDATE_USER_STATE,{data:this.data,event:s}),yield N(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 R(r,e)}))}}class G extends S{constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:s}=t;if(e&&e.users){if("full"===s)return this.data.callRecordUsers=e.users.map((t=>(t.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(t.displayName||""):t.displayName,t))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);this.data.callRecordUsers||(this.data.callRecordUsers=[]),e.users.forEach((t=>{const e=this.data.callRecordUsers.findIndex((e=>t.inviteTransID===e.inviteTransID));"update"===s&&-1!==e?y(t,this.data.callRecordUsers[e]):"update"===s&&-1===e&&(t.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(t.displayName||""):t.displayName,this.data.callRecordUsers.push(t))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/invite`,t)}cancelInvite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/cancelInvite`,t)}}class Y extends S{constructor(t){super(t,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:s}=this.ctx.modules.me.data;return s===t.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:e===t.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:s,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(t.MeEvent.UPDATE,e);let n=!1;switch(s){case"interactiveUsers":e.isInLobby||(n=!0);break;case"broadcastUsers":e.isInLobby||e.role!==t.ROLE.AUDIENCE||(n=!0);break;case"lobbyUsers":e.isInLobby&&(n=!0)}const o={};n&&(o.leave=!0),this.ctx.emitter.emit(t.MeEvent.UPDATE,Object.assign(Object.assign({},e),o))},s=({updateUsers:t,state:s,sourceKey:i})=>{if("full"===s)return this.data[i]=t.map((t=>(t.displayNamePinyin=Y.setDisplayNamePinyinProp?Y.setDisplayNamePinyinProp(t.displayName):t.displayName,t.groupIDs=Y.setUserGroupIDs?Y.setUserGroupIDs(t.groupIDs||[]):t.groupIDs,e(t,{event:i,state:s}),t))),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!0}),this.data[i];void 0===this.data[i]&&(this.data[i]=[]);const{data:r,emitter:n}=this;return t.forEach((t=>{const o=r[i].findIndex((e=>t.userID===e.userID));if("delete"===s&&-1!==o){const[e]=this.data[i].splice(o,1);n.emit(`${i}Delete`,{user:e,resultInfo:t.resultInfo})}else if("update"===s&&-1!==o){const e=this.data[i][o];this.updateUserProps(t,e),y(t,e),this.data[i][o]=I(e),this.emitter.emit(`${i}Update`,{user:this.data[i][o]})}else"update"===s&&-1===o&&(t.displayNamePinyin=Y.setDisplayNamePinyinProp?Y.setDisplayNamePinyinProp(t.displayName):t.displayName,r[i].push(t),this.emitter.emit(`${i}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:i,state:s})})),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!1}),this.data[i]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:e,body:i}=t;s({updateUsers:i.users,state:e,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:e,body:i}=t;s({updateUsers:i.users,state:e,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:e,body:i}=t;s({updateUsers:i.users,state:e,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:e,body:i}=t;s({updateUsers:i.users,state:e,sourceKey:"advCtrlUsers"})}))}reactive(t){if(!f(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,i)=>{Object.keys(t).forEach((r=>{!1===i&&r in this.data&&(t[r]=this.data[r]);const n=e=>t[r]=e.users.map((t=>t)),o=`${b(r)}Change`;this.emitter.on(o,n),e.set(o,n),f(t[r])&&!p(t[r])&&s(t[r],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(t,e){t.displayName&&t.displayName!==e.displayName&&(t.displayNamePinyin=Y.setDisplayNamePinyinProp?Y.setDisplayNamePinyinProp(t.displayName):t.displayName)}setAudio(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/users/${t}/callStats`)}callStatsReport(t){if(!t.userID)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t.userID}/callStats/report`,t)}replyAllHandUp(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/refuseAll`)}getSendLayout(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/sendLayout`)}setSendLayout(t,e){const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/sendLayout`,e)}setSendLayoutEnabled(t,e){const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/sendLayoutEnabled`,e)}pauseAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/pauseAudio`)}resumeAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/resumeAudio`)}modifyRoleBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyRoleBatch `,t)}modifyVideoBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyVideoBatch `,t)}putInLobbyBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/putInLobbyBatch `,t)}removeBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/removeBatch `,t)}}function Q(e){const{baseURL:i,modules:r,worker:n,singleton:o}=e;r.findIndex((t=>t===B))<0&&r.push(B),r.findIndex((t=>t===w))<0&&r.push(w);const a=e.clientID||`${v()}_${((t=new Date,e)=>{const s={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(const i in s)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[i]:("00"+s[i]).substr((""+s[i]).length)));return e})(new Date,"MMddHHmmss")}`,d={config:{baseURL:i,modules:r,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:s(),request:new c({baseURL:i,beforeRequest:t=>{t.headers["X-Y-Request-Id"]=v(),t.timeout=18e5},error:e=>{d.emitter.emit(t.EVENT.REQUEST_ERROR,e)}}),modules:{},state:t.STATE.CLOSE,status:{polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},cleanup:e=>{d.state!==t.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,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},d.request.setDefaultHeader("X-Y-Location",""),d.request.setDefaultHeader("X-Y-Ctrl-Id",""),d.request.setDefaultHeader("X-Y-Session-Id",""),Object.keys(d.modules).forEach((t=>{d.modules[t].cleanup()})),d.state=t.STATE.CLOSE,d.emitter.emit(t.EVENT.STATE,{state:d.state,reason:e}))}};return d}function F(e){const s=Q(e);return s.worker&&("undefined"!=typeof Worker?s.worker.postMessage({baseURL:s.config.baseURL}):console.error("The current environment does not support worker")),function(t,e){if(!p(t))return void console.error("The modules parameter requires an array type");t.forEach((t=>{const s=new t(e);e.modules[s.moduleName]=s}))}(s.config.modules,s),s.emitter.on(t.EVENT.POLLING_ERROR,(t=>{W(s)({resultInfo:t})})),s.emitter.on(t.EVENT.KEEPALIVE_ERROR,(t=>{W(s)({resultInfo:t})})),Object.assign({config:s.config,request:s.request,get state(){return s.state},on:s.emitter.on,off:s.emitter.off,join:J(s),leave:W(s),end:z(s),endMeeting:X(s)},s.modules)}function J(s){return function(i){var r;return e(this,void 0,void 0,(function*(){const{clientID:e}=s.config.request,n=`${null===(r=i.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${e}_${i.meetingNum}`;s.config.request.sessionID=n,s.request.setDefaultHeader("X-Y-Session-Id",n);const{prefix:o}=s.config.request,a=yield s.request.get(`${o.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,userAgent:i.userAgent},headers:{"X-Y-Endpoint-Type":i.endpointType}}),{credential:c="",location:u=""}=a&&a.data||{};if(!c)return s.emitter.emit(t.EVENT.FAILED,{bizCode:a.bizCode,data:a.data}),a;s.config.request.location=u,s.request.setDefaultHeader("X-Y-Location",u),delete i.pwd,delete i.url;const d={displayName:i.displayName,userAgent:i.userAgent,clientID:e};i.groupIDs&&i.account&&(d.groupIDs=i.groupIDs,d.account=i.account,d.groupName=i.groupName);const l=yield s.request.post(`${o.ctrl}join?meetingNum=${i.meetingNum}&credential=${c}`,d,{headers:{"X-Y-Endpoint-Type":i.endpointType,"X-Y-Endpoint-Id":e}});if(!l||l&&l.ret<=-1)return s.emitter.emit(t.EVENT.FAILED,{bizCode:l.bizCode,data:l.data}),l;const{meetingID:p="",ctrlID:h="",user:f={},mediaContent:m={},initialMediaState:g={},tk:v=""}=l.data;s.config.request.meetingID=p,s.config.request.ctrlID=h,s.config.request.userID=f.userID,s.config.request.voteTk=v,s.request.setDefaultHeader("X-Y-Ctrl-Id",h),s.emitter.emit(t.MeEvent.INIT,Object.assign(Object.assign({},f),{mediaContent:m,initialMediaState:g})),s.state=t.STATE.JOINED,s.emitter.emit(t.EVENT.STATE,{state:s.state});const y=()=>{s.state!==t.STATE.READY&&(s.state=t.STATE.READY,s.emitter.emit(t.EVENT.STATE,{state:s.state}))},x=P(s),b=yield U(x,s);return yield N(x,s),"undefined"!=typeof Worker&&s.worker?(s.status.polling.running=!0,s.worker.postMessage({topics:x,meetingID:p,clientID:e,inboxes:b,status:!0}),s.worker.onmessage=t=>{"pollingStarted"!==t.data?"pollingStopped"!==t.data?(console.log("[Polling]",t.data),s.emitter.emit(t.data.event,t.data)):s.status.polling.running=!1:y()}):(s.status.polling.running=!0,R(b,s),y()),s.status.keepalive.running=!0,k(s,(e=>{s.emitter.emit(t.EVENT.KEEPALIVE_ERROR,e)})),l.data=Object.assign(Object.assign({},l.data),a.data),l}))}}function W(t){return function(s){return e(this,void 0,void 0,(function*(){s||(s={resultInfo:{bizCode:901359}});const{prefix:e,meetingID:i}=t.config.request;let r;try{r=yield t.request.post(`${e.ctrl}meetings/${i}/leave`,s)}catch(n){console.error(n)}return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),L(t),C(t),Z(t),t.cleanup(),r}))}}function z(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:s}=t.config.request,i=yield t.request.post(`${e.ctrl}meetings/${s}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),L(t),C(t),Z(t),t.cleanup(),i}))}}function X(t){return function(s){return e(this,void 0,void 0,(function*(){const{prefix:e}=t.config.request;return yield t.request.post(`${e.ctrl}meetingNum/${s}/end`)}))}}class K{constructor(t){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=F(t)}static getInstance(t){return this.instance?this.instance:this.instance=new K(t)}}function Z(t){if(t.config.singleton){const{baseURL:e,modules:s,singleton:i}=t.config,r={baseURL:e,modules:s,worker:t.worker,singleton:i},n=K.getInstance(r);n&&(n.meeting=F(r))}}return Object.defineProperty(K,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),t.Asr=class extends S{constructor(t){super(t,"asr")}_topic(){return["meeting"]}_bindOn(){this.ctx.emitter.on("asr",(t=>{const{body:e}=t;void 0===this.data.asr&&(this.data.asr={status:"stopped"}),y(e,this.data.asr),this.emitter.emit("asrChange",{asr:this.data.asr,changeData:e})}))}cleanup(){this.emitter.all=new Map}transcriptStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/transcript/status`,t)}))}},t.Chat=class extends S{constructor(t){super(t,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(t=>{const{body:e}=t;this.emitter.emit("chatMsg",e)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/chat/historyMsg`,t)}))}},t.Info=w,t.Interpretation=class extends S{constructor(t){super(t,"interpretation"),this.data={status:"stopped",interpreters:[]}}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("interpretation",(t=>{const{body:e,state:s}=t;"full"===s?(this.data.interpreters=e.interpreters,this.data.status=e.status):this.data.status=e.status,this.emitter.emit("interpretationChange",this.data)}))}interpretationStart(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/interpretation/start`,t)}interpretationEnd(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/interpretation/stop`)}},t.Invite=G,t.LiveStream=class extends S{constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:s,body:i,stime:r}=t;if(i){if(r&&(this.data.jetlag=r),"full"===s){const{liveStreams:t=[]}=i;if(!t.length)return;const e=[];this.data.liveStreams=t.map((t=>(t.requesting="starting"===t.status,e.push({platform:t.platform||"",status:(t.requesting?"stopped":t.status)||""}),t)));return y({status:e,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),i.liveStreams||(this.data.resultInfo={}),null===(e=i.liveStreams)||void 0===e||e.forEach((t=>{this.data.resultInfo=t.resultInfo||{};let e=this.data.liveStreams.findIndex((e=>e.platform===t.platform));-1===e?(t.requesting="starting"===t.status,this.data.liveStreams.push(t)):(t.requesting="starting"===t.status,t=Object.assign(Object.assign({},this.data.liveStreams[e]),t),this.data.liveStreams.splice(e,1,t)),e=this.data.status.findIndex((e=>e.platform===t.platform));const s=this.data.status.map((t=>t));-1===e?s.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):s.splice(e,1,{platform:s[e].platform||"",status:t.requesting?s[e].status||"stopped":t.status||""}),this.data.status=s})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/setting`,t)}))}},t.Me=B,t.Qa=class extends S{constructor(t){super(t,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(t=>{const{body:e}=t;f(e)&&!p(e)?this.qaUpdate(this.data.questions,e):e.forEach((t=>this.qaUpdate(this.data.questions,t)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(t,e){let s=t.get(e.question.id);const{clientID:i}=this.ctx.config.request;switch(e.command){case"addQuestion":s=this.createQuestion(e.question),t.set(e.question.id,s),this.emitter.emit("questionAdd",{question:s,selfSent:s.sender.endpointID===i});break;case"dismissQuestion":if(!s)break;s.sender.endpointID!==i?s.status="close":s.isTop=!1,t.set(e.question.id,s),this.emitter.emit("questionUpdate",{question:s});break;case"reopenQuestion":s?(s.status="open",s.isTop=e.question.isTop,t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"updateQuestion":s?(s=Object.assign(Object.assign(Object.assign({},s),e.question),{topSort:e.question.isTop?this.data.topSort++:0}),t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteQuestion":if(!s)break;s.sender.endpointID!==i?t.delete(e.question.id):(s.status="delete",s.isTop=!1,s.answers.clear(),t.set(e.question.id,s)),this.emitter.emit("questionDelete",{question:s});break;case"answerQuestion":s?s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)):(s=this.createQuestion(e.question),s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteAnswer":s&&(s.answers.delete(e.answer.id),this.emitter.emit("questionUpdate",{question:s}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(t){return{isAnonymous:t.isAnonymous,isTop:t.isTop,id:t.id,content:t.content,sender:t.sender,timestamp:t.timestamp||-1,status:t.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(t){return{isPrivate:t.isPrivate,content:t.content,id:t.id,sender:t.sender,timestamp:t.timestamp||-1}}qa(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/qa`,t)}))}},t.Recording=class extends S{constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:s,stime:i}=t;if(s)return i&&(this.data.stime=i),this.data.isPracticeSession="started"===s.status&&this.data.status===s.status&&0===s.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),s),"starting"===s.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=s.status||this.data.status),this.data.resultInfo=s.resultInfo||{},["full","update"].includes(e)?(s.recordUsers&&(this.data.recording.recordUsers=s.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/layout`,t)}))}},t.Setting=class extends S{constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:s}=t;["full","update"].includes(e)&&y(s,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/unmuteAll`)}))}},t.ShouldJoinUsers=class extends S{constructor(t){super(t,"shouldJoinUsers")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("shouldJoinUsers",(t=>{const{state:e}=t;"update"===e&&this.emitter.emit("shouldJoinUsersChange")}))}modifyUser(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/attendance/shouldJoin`,t)}getUser(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/attendance/getShouldJoin`)}},t.SpotlightVideo=class extends S{constructor(t){super(t,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:s}=e;if(!s||!s.userIDs)return;this.data.userIDs=s.userIDs;s.userIDs.findIndex((t=>t===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(t.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(t.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/view/spotlight`,t)}},t.Transcript=class extends S{constructor(t){super(t,"transcript"),this.data={asr:{status:"stopped"}}}_topic(){return["transcript"]}_bindOn(){this.ctx.emitter.on("transcriptMsg",(t=>{const{body:e}=t;this.emitter.emit("transcriptMsg",e)}))}cleanup(){this.emitter.all=new Map}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/transcript/historyMsg`,t)}))}},t.Users=Y,t.View=class extends S{constructor(t){super(t,"view")}_topic(){const{endpointType:e,role:s}=this.ctx.modules.me.data;return e===t.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:s===t.ROLE.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((t=>{this.ctx.emitter.on(t,(e=>{"personalView"!==t?this.updateLayout(e,t):this.updatePersonalLayouts(e)}))})),this.ctx.emitter.on("videoSourcesUpdated",(()=>{this.emitter.emit("videoSourcesUpdated")}))}updateLayout(t,e){const{event:s,body:i}=t;i&&("meetingView"===s?Object.keys(i).forEach((t=>{this.data[t]=i[t]})):this.data[e]=i)}updatePersonalLayouts(t){const{state:e,body:s}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),s.personalLayouts.forEach((t=>{const{subscriber:s={userID:-1}}=t,i=s.userID||s.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[i]=t:delete this.data.personalLayouts[i]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/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)}))}setSavedBackground(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/recentBackgroundFile`,t)}))}getSavedBackground(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/view/recentBackgroundFile`)}))}},t.Vote=class extends S{constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:s}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[s]=e,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:e})})),this.ctx.emitter.on(t.MeEvent.LOBBYCHANGE,(t=>{t&&(this.data.vote={})}))}getVotes(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:s},meetingID:i,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.post(`${s}meetings/${i}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:s},meetingID:i,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.post(`${s}meetings/${i}/vote/submit?tk=${t.tk}&voteID=${t.voteID}`,e)}voteAdd(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/add`,t)}voteEdit(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/edit`,t)}voteDelete(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/delete`,t)}voteInProgress(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/vote/inProgress`,{params:{tk:t&&t.tk||i}})}},t.Words=class extends S{constructor(t){super(t,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:s,body:i,pollingSeqId:r}=e;if(!i)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(t.MeEvent.UPDATE,{barrage:this.data});"full"===s&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),r&&(this.data.barrageRecord=[{id:r,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(t.MeEvent.UPDATE,{barrage:this.data})}),1e3*i.duration)),y(i,this.data),this.ctx.emitter.emit(t.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(t.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(t.MeEvent.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/deleteBarrage`)}))}},t.createMeeting=function(t){return t.singleton?K.getInstance(t).meeting:F(t)},t.reset=Z,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
1
+ var YlinkSDKMeeting=function(t){"use strict";function e(t,e,s,i){return new(s||(s=Promise))((function(r,n){function o(t){try{c(i.next(t))}catch(e){n(e)}}function a(t){try{c(i.throw(t))}catch(e){n(e)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,a)}c((i=i.apply(t,e||[])).next())}))}function s(t){return{all:t=t||new Map,on:function(e,s){var i=t.get(e);i?i.push(s):t.set(e,[s])},off:function(e,s){var i=t.get(e);i&&(s?i.splice(i.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var i=t.get(e);i&&i.slice().map((function(t){t(s)})),(i=t.get("*"))&&i.slice().map((function(t){t(e,s)}))}}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(t,e){var s="__lodash_hash_undefined__",r=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]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",x="[object ArrayBuffer]",b="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",$="[object Uint8Array]",T="[object Uint8ClampedArray]",_="[object Uint16Array]",A="[object Uint32Array]",S=/\w*$/,w=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[x]=U[b]=U[o]=U[a]=U[E]=U[q]=U[I]=U[D]=U[O]=U[d]=U[l]=U[p]=U[f]=U[m]=U[g]=U[v]=U[$]=U[T]=U[_]=U[A]=!0,U["[object Error]"]=U[c]=U[y]=!1;var N="object"==typeof self&&self&&self.Object===Object&&self,R="object"==typeof i&&i&&i.Object===Object&&i||N||Function("return this")(),j=e&&!e.nodeType&&e,L=j&&t&&!t.nodeType&&t,k=L&&L.exports===j;function C(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function H(t,e,s,i){var r=-1,n=t?t.length:0;for(i&&n&&(s=t[++r]);++r<n;)s=e(s,t[r],r,t);return s}function V(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(s){}return e}function B(t){var e=-1,s=Array(t.size);return t.forEach((function(t,i){s[++e]=[i,t]})),s}function G(t,e){return function(s){return t(e(s))}}function Y(t){var e=-1,s=Array(t.size);return t.forEach((function(t){s[++e]=t})),s}var Q,F=Array.prototype,J=Function.prototype,W=Object.prototype,z=R["__core-js_shared__"],X=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=J.toString,Z=W.hasOwnProperty,tt=W.toString,et=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),st=k?R.Buffer:void 0,it=R.Symbol,rt=R.Uint8Array,nt=G(Object.getPrototypeOf,Object),ot=Object.create,at=W.propertyIsEnumerable,ct=F.splice,ut=Object.getOwnPropertySymbols,dt=st?st.isBuffer:void 0,lt=G(Object.keys,Object),pt=Lt(R,"DataView"),ht=Lt(R,"Map"),ft=Lt(R,"Promise"),mt=Lt(R,"Set"),gt=Lt(R,"WeakMap"),vt=Lt(Object,"create"),yt=Vt(pt),xt=Vt(ht),bt=Vt(ft),Et=Vt(mt),qt=Vt(gt),It=it?it.prototype:void 0,Dt=It?It.valueOf:void 0;function Ot(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function $t(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function Tt(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var i=t[e];this.set(i[0],i[1])}}function _t(t){this.__data__=new $t(t)}function At(t,e){var s=Gt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Yt(t)}(t)&&Z.call(t,"callee")&&(!at.call(t,"callee")||tt.call(t)==n)}(t)?function(t,e){for(var s=-1,i=Array(t);++s<t;)i[s]=e(s);return i}(t.length,String):[],i=s.length,r=!!i;for(var o in t)!e&&!Z.call(t,o)||r&&("length"==o||Mt(o,i))||s.push(o);return s}function St(t,e,s){var i=t[e];Z.call(t,e)&&Bt(i,s)&&(void 0!==s||e in t)||(t[e]=s)}function wt(t,e){for(var s=t.length;s--;)if(Bt(t[s][0],e))return s;return-1}function Pt(t,e,s,i,r,h,y){var w;if(i&&(w=h?i(t,r,h,y):i(t)),void 0!==w)return w;if(!Jt(t))return t;var P=Gt(t);if(P){if(w=function(t){var e=t.length,s=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(s.index=t.index,s.input=t.input);return s}(t),!e)return function(t,e){var s=-1,i=t.length;e||(e=Array(i));for(;++s<i;)e[s]=t[s];return e}(t,w)}else{var N=Ct(t),R=N==c||N==u;if(Qt(t))return function(t,e){if(e)return t.slice();var s=new t.constructor(t.length);return t.copy(s),s}(t,e);if(N==p||N==n||R&&!h){if(V(t))return h?t:{};if(w=function(t){return"function"!=typeof t.constructor||Ht(t)?{}:(e=nt(t),Jt(e)?ot(e):{});var e}(R?{}:t),!e)return function(t,e){return Rt(t,kt(t),e)}(t,function(t,e){return t&&Rt(e,Wt(e),t)}(w,t))}else{if(!U[N])return h?t:{};w=function(t,e,s,i){var r=t.constructor;switch(e){case x:return Nt(t);case o:case a:return new r(+t);case b:return function(t,e){var s=e?Nt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.byteLength)}(t,i);case E:case q:case I:case D:case O:case $:case T:case _:case A:return function(t,e){var s=e?Nt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.length)}(t,i);case d:return function(t,e,s){return H(e?s(B(t),!0):B(t),C,new t.constructor)}(t,i,s);case l:case g:return new r(t);case f:return function(t){var e=new t.constructor(t.source,S.exec(t));return e.lastIndex=t.lastIndex,e}(t);case m:return function(t,e,s){return H(e?s(Y(t),!0):Y(t),M,new t.constructor)}(t,i,s);case v:return n=t,Dt?Object(Dt.call(n)):{}}var n}(t,N,Pt,e)}}y||(y=new _t);var j=y.get(t);if(j)return j;if(y.set(t,w),!P)var L=s?function(t){return function(t,e,s){var i=e(t);return Gt(t)?i:function(t,e){for(var s=-1,i=e.length,r=t.length;++s<i;)t[r+s]=e[s];return t}(i,s(t))}(t,Wt,kt)}(t):Wt(t);return function(t,e){for(var s=-1,i=t?t.length:0;++s<i&&!1!==e(t[s],s,t););}(L||t,(function(r,n){L&&(r=t[n=r]),St(w,n,Pt(r,e,s,i,n,t,y))})),w}function Ut(t){return!(!Jt(t)||(e=t,X&&X in e))&&(Ft(t)||V(t)?et:w).test(Vt(t));var e}function Nt(t){var e=new t.constructor(t.byteLength);return new rt(e).set(new rt(t)),e}function Rt(t,e,s,i){s||(s={});for(var r=-1,n=e.length;++r<n;){var o=e[r],a=i?i(s[o],t[o],o,s,t):void 0;St(s,o,void 0===a?t[o]:a)}return s}function jt(t,e){var s,i,r=t.__data__;return("string"==(i=typeof(s=e))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==s:null===s)?r["string"==typeof e?"string":"hash"]:r.map}function Lt(t,e){var s=function(t,e){return null==t?void 0:t[e]}(t,e);return Ut(s)?s:void 0}Ot.prototype.clear=function(){this.__data__=vt?vt(null):{}},Ot.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Ot.prototype.get=function(t){var e=this.__data__;if(vt){var i=e[t];return i===s?void 0:i}return Z.call(e,t)?e[t]:void 0},Ot.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:Z.call(e,t)},Ot.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?s:e,this},$t.prototype.clear=function(){this.__data__=[]},$t.prototype.delete=function(t){var e=this.__data__,s=wt(e,t);return!(s<0)&&(s==e.length-1?e.pop():ct.call(e,s,1),!0)},$t.prototype.get=function(t){var e=this.__data__,s=wt(e,t);return s<0?void 0:e[s][1]},$t.prototype.has=function(t){return wt(this.__data__,t)>-1},$t.prototype.set=function(t,e){var s=this.__data__,i=wt(s,t);return i<0?s.push([t,e]):s[i][1]=e,this},Tt.prototype.clear=function(){this.__data__={hash:new Ot,map:new(ht||$t),string:new Ot}},Tt.prototype.delete=function(t){return jt(this,t).delete(t)},Tt.prototype.get=function(t){return jt(this,t).get(t)},Tt.prototype.has=function(t){return jt(this,t).has(t)},Tt.prototype.set=function(t,e){return jt(this,t).set(t,e),this},_t.prototype.clear=function(){this.__data__=new $t},_t.prototype.delete=function(t){return this.__data__.delete(t)},_t.prototype.get=function(t){return this.__data__.get(t)},_t.prototype.has=function(t){return this.__data__.has(t)},_t.prototype.set=function(t,e){var s=this.__data__;if(s instanceof $t){var i=s.__data__;if(!ht||i.length<199)return i.push([t,e]),this;s=this.__data__=new Tt(i)}return s.set(t,e),this};var kt=ut?G(ut,Object):function(){return[]},Ct=function(t){return tt.call(t)};function Mt(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<e}function Ht(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||W)}function Vt(t){if(null!=t){try{return K.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Bt(t,e){return t===e||t!=t&&e!=e}(pt&&Ct(new pt(new ArrayBuffer(1)))!=b||ht&&Ct(new ht)!=d||ft&&Ct(ft.resolve())!=h||mt&&Ct(new mt)!=m||gt&&Ct(new gt)!=y)&&(Ct=function(t){var e=tt.call(t),s=e==p?t.constructor:void 0,i=s?Vt(s):void 0;if(i)switch(i){case yt:return b;case xt:return d;case bt:return h;case Et:return m;case qt:return y}return e});var Gt=Array.isArray;function Yt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}(t.length)&&!Ft(t)}var Qt=dt||function(){return!1};function Ft(t){var e=Jt(t)?tt.call(t):"";return e==c||e==u}function Jt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return Yt(t)?At(t):function(t){if(!Ht(t))return lt(t);var e=[];for(var s in Object(t))Z.call(t,s)&&"constructor"!=s&&e.push(s);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}}(r,r.exports);var n=r.exports;const o=t=>({get(e,s,i){if("__isProxy"===s)return!0;const r=Reflect.get(e,s);return Array.isArray(r)?r:"object"==typeof r&&null!==r?r.__isProxy?r:new Proxy(r,o(t)):r},set(e,s,i,r){const o=e[s];i=f(i)&&i.__isProxy?n(i):i;const a=Reflect.set(e,s,i,r);return((t,e)=>t!==e&&(t==t||e==e))(i,o)&&t.emit(`${b(s)}Change`,i),a}}),a=t=>encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class c{constructor(t){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=t.baseURL,this._beforeRequest=t.beforeRequest,this._errorHandler=t.error}_request(t){const e=t.timeout||18e5;let s=t.headers||{};return t.url=D(this.baseURL,t.url||""),t.url=((t,e)=>{if(!e)return t;const s=[];Object.keys(e).forEach((t=>{const i=e[t];if(null==i)return;let r;Array.isArray(i)?(r=i,t+="[]"):r=[i],r.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),s.push(`${a(t)}=${a(e)}`)}))}));const i=s.join("&");if(i){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t})(t.url,t.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[t],delete s[t])})),m(t.data)&&(t.data=t.data.buffer),g(t.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=s,t.timeout=e,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx&&void 0!==wx.request?l(t):d(t)}setDefaultHeader(t,e){t in this._defaultHeaders&&(""===e||null===e)?delete this._defaultHeaders[t]:this._defaultHeaders[t]=e}get(t,e){return this._errorHandler?this._request(Object.assign(e||{},{url:t,method:"GET"})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(e||{},{url:t,method:"GET"}))}post(t,e,s){return this._errorHandler?this._request(Object.assign(s||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(s||{},{url:t,method:"POST",data:e}))}}class u{constructor(t){let e;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((t=>{e=t})),t((t=>{this.reason||(this.reason=t,e(this.reason))}))}static source(){let t;const e=new u((e=>{t=e}));return{cancel:t,token:e}}}const d=t=>new Promise(((e,s)=>{const{data:i=null,url:r,method:n="GET",headers:o,cancelToken:a}=t;let c=new XMLHttpRequest;c.open(n.toUpperCase(),r,!0),c.timeout=t.timeout;const u=()=>{if(c){if(c.status>=200&&c.status<300)try{const t=JSON.parse(c.responseText);e(t)}catch(t){s(new Error("E_JSON_PARSE"+c.responseText))}else s({url:r,statusCode:c.status});c=null}};"onloadend"in c?c.onloadend=u:c.onreadystatechange=()=>{c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=()=>{c&&(s({url:r,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{s(new Error("Network Error")),c=null},c.ontimeout=()=>{s(new Error("timeout of "+t.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(o).forEach((t=>{null===i&&"content-type"===t.toLowerCase()?delete o[t]:c.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{c&&(c.abort(),s(t),c=null)})),c.send(i)})),l=t=>new Promise(((e,s)=>{const{data:i=null,url:r,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:r,data:i,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):s({url:r,statusCode:t.statusCode})},fail(t){s("request:fail abort"===t.errMsg&&a&&a.reason||t)}});a&&a.promise.then((()=>{c&&c.abort()}))})),p=Array.isArray,h=t=>null==t,f=t=>"object"==typeof t&&null!==t,m=t=>{let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer,e},g=t=>{if("[object Object]"!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},v=()=>{const t=[],e="0123456789abcdef";for(let s=0;s<36;s++)t[s]=e.substr(Math.floor(16*Math.random()),1);t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-";return t.join("").split("-").join("")},y=(t,e)=>t?(Object.entries(t).forEach((t=>{const[s,i]=[t[0],t[1]];if(null!==i)return f(i)&&!p(i)?(e[s]||(e[s]={}),void(e[s]=y(i,e[s]))):void(e[s]=i)})),e):e,x=/-(\w)/g,b=t=>t.replace(x,((t,e)=>e?e.toUpperCase():"")),{hasOwnProperty:E}=Object.prototype,q=(t,e)=>E.call(t,e),I=(t,e=new Map)=>{if(e.get(t))return e.get(t);if(!(t instanceof Object))return t;let s;s=t instanceof Array?[]:t instanceof Function?()=>t():t instanceof RegExp?new RegExp(t.source,t.flags):t instanceof Date?new Date(t):{},e.set(t,s);for(const i in t)q(t,i)&&(s[i]=I(t[i],e));return s},D=(t,e)=>t&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)?((t,e)=>e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e):e;var O,$,T,_,A;t.EVENT=void 0,(O=t.EVENT||(t.EVENT={})).STATE="state",O.FAILED="failed",O.REQUEST_ERROR="requestError",O.POLLING_ERROR="pollingError",O.KEEPALIVE_ERROR="keepaliveError",t.STATE=void 0,($=t.STATE||(t.STATE={}))[$.CLOSE=0]="CLOSE",$[$.JOINED=1]="JOINED",$[$.READY=2]="READY",t.ENDPOINT_TYPE=void 0,(T=t.ENDPOINT_TYPE||(t.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",T.MULTI_STREAM="multiStream",T.MEETING_TOUCH="meetingTouch",T.MEETING_ROOMS="meetingRooms",t.ROLE=void 0,(_=t.ROLE||(t.ROLE={})).HOST="host",_.COHOST="coHost",_.ATTENDEE="attendee",_.AUDIENCE="audience",t.RECORD_STATUS=void 0,(A=t.RECORD_STATUS||(t.RECORD_STATUS={})).STARTED="started",A.PAUSED="paused",A.STARTING="starting",A.STOPPED="stopped";class S{constructor(t,e){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=e,this.ctx=t,this.emitter=s(),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(t){if(!f(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,i)=>{Object.keys(t).forEach((r=>{!1===i&&r in this.data&&(t[r]=this.data[r]);const n=e=>t[r]=e,o=`${b(r)}Change`;this.emitter.on(o,n),e.set(o,n),f(t[r])&&!p(t[r])&&s(t[r],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}}class w extends S{constructor(t){super(t,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(t=>{const{state:e,body:s}=t;("full"===e||"update"===e)&&y(s,this.data)})),this.ctx.emitter.on("participantCount",(t=>{const{body:e}=t;y({participantCount:e},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/info/practiceSession`)}))}shareInfo(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/shareInfo`,{params:t})}meetings(t){if(!t)return Promise.reject();const{prefix:{ctrl:e}}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings`,{params:t})}mailTemplate(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}mailTemplate`,{params:{meetingID:s},headers:{language:t.language}})}}function P(t){const e=[],{isInLobby:s}=t.modules.me.data;return s?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((s=>{const i=t.modules[s]._topic();i&&(Array.isArray(i)?i.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(i)||e.push(i))})),e)}function U(t,s){return e(this,void 0,void 0,(function*(){const{meetingID:e,clientID:i}=s.config.request,r=yield s.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:i,meetingId:e},inboxes:t}),n=[];return r.data&&Object.keys(r.data).forEach((t=>{n.push({name:t,seqId:r.data[t].maxSeqId,limit:200})})),n}))}function N(t,s){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i,clientID:r}=s.config.request,n=yield s.request.post(`${e}meetings/${i}/subscribe`,{endpointID:r,topics:t}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((t=>{s.emitter.emit(t.event,t)}))}))}function R(t,s,i){return e(this,void 0,void 0,(function*(){const{inboxes:r,clientID:n,meetingID:o,cancelToken:a,status:c}=s;if(yield(()=>e(this,void 0,void 0,(function*(){let e;try{e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:r},{cancelToken:a})}catch(d){return c.attempts++,void console.error(d)}if(!e)return console.error("polling error: ","response is null"),void c.attempts++;const{data:s={},bizCode:u,error:d}=e;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,s&&Object.keys(s).forEach((t=>{const e=r.find((e=>e.name===t));e&&(e.seqId=s[t].maxSeqId,s[t].items&&s[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),e.pollingSeqId=t.seqId,i(e)})))}))})))(),!c.running)return;if(c.attempts>M)return console.error("polling Max Attempts"),void(s.onError&&s.onError({message:"polling Max Attempts"}));const u=c.attempts?H(c.attempts):0;c.timer=setTimeout((()=>{c.running&&R(t,s,i)}),u)}))}const j=(s,i)=>e(void 0,void 0,void 0,(function*(){const{meetingID:e,clientID:r}=i.config.request;i.status.polling.running=!0,R(i.request,{inboxes:s,clientID:r,meetingID:e,cancelToken:i.config.request.cancelToken.token,status:i.status.polling,onError:e=>{i.emitter.emit(t.EVENT.POLLING_ERROR,e)}},(t=>{i.emitter.emit(t.event,t)}))}));function L(t){t.status.polling.running=!1,t.status.polling.attempts=0,t.status.polling.timer&&(clearTimeout(t.status.polling.timer),t.status.polling.timer=null),t.config.request.cancelToken.cancel(),t.config.request.cancelToken=u.source()}function k(t,s){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:r,userID:n}=t.config.request;if(t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){let e;try{e=yield t.request.post(`${i}meetings/${r}/users/${n}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token})}catch(a){return t.status.keepalive.attempts++,void console.error(a)}if(!e||!e.data)return;const{data:s={},bizCode:o,error:a}=e;if(900200!==o&&900408!==o&&901323!==o)return t.status.keepalive.attempts++,void console.error("keepalive ",o,a);const c=s.interval||"";if(!c)return t.status.keepalive.attempts++,void console.error("keepalive ",o,a);t.status.keepalive.interval=c,t.status.keepalive.attempts=0})))(),!t.status.keepalive.running)return;if(t.status.keepalive.attempts>M)return console.error("keepalive Max Attempts"),void(s&&s({message:"keepalive Max Attempts"}));const o=t.status.keepalive.attempts?H(t.status.keepalive.attempts):1e3*t.status.keepalive.interval;t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&k(t,s)}),o)}))}const C=t=>{t.status.keepalive.running=!1,t.status.keepalive.attempts=0,t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null)},M=5,H=t=>{console.log(`computeNextTimeout attempts: ${t}`);let e=Math.floor(Math.random()*Math.pow(2,t)+1);return e<2&&(e=2),e>30&&(e=30),1e3*e};var V;t.MeEvent=void 0,(V=t.MeEvent||(t.MeEvent={})).INIT="meInit",V.UPDATE="meUpdate",V.UPDATE_USER_STATE="updateUserState",V.ROLECHANGE="meRoleChange",V.AUDIOCHANGE="meAudioChange",V.HANDUPCHANGE="meHandupChange",V.SETAUDIO="setAudio",V.VIDEOCHANGE="meVideoChange",V.SETVIDEO="setVideo",V.SHARECHANGE="meShareChange",V.DISPLAYNAMECHANGE="meDisplayNameChange",V.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",V.LOBBYCHANGE="meLobbyChange",V.BARRAGECHANGE="meBarrageChange",V.PERSONALLAYOUTCHANGE="personalLayoutChange",V.LEAVE="leave";class B extends S{constructor(t){super(t,"me")}_topic(){return""}_bindOn(){const s=s=>e(this,void 0,void 0,(function*(){if("role"in s&&s.role!==this.data.role){const e=this.data.role;y({role:s.role},this.data),s.role!==t.ROLE.AUDIENCE&&e!==t.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(t.MeEvent.ROLECHANGE,s.role),this.ctx.emitter.emit(t.MeEvent.ROLECHANGE,s.role)}})),i=e=>{var s,i,r,n,o,a;if("audio"in e){const{deviceOn:c,sendOn:u,recvOn:d,opBy:l}=e.audio;(!h(c)&&c!==(null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn)||!h(u)&&u!==(null===(i=this.data.audio)||void 0===i?void 0:i.sendOn)||!h(d)&&u!==(null===(r=this.data.audio)||void 0===r?void 0:r.recvOn)||!h(l))&&(y({audio:e.audio},this.data),this.emitter.emit(t.MeEvent.AUDIOCHANGE,{deviceOn:h(c)?null===(n=this.data.audio)||void 0===n?void 0:n.deviceOn:c,sendOn:h(u)?null===(o=this.data.audio)||void 0===o?void 0:o.sendOn:u,recvOn:h(u)?null===(a=this.data.audio)||void 0===a?void 0:a.recvOn:d,opBy:l,changeData:Object.assign({},e.audio)}))}},r=e=>{var s,i,r,n,o,a;if("video"in e){const{deviceOn:c,sendOn:u,opBy:d,blocked:l}=e.video;(!h(c)&&c!==(null===(s=this.data.video)||void 0===s?void 0:s.deviceOn)||!h(u)&&u!==(null===(i=this.data.video)||void 0===i?void 0:i.sendOn)||!h(l)&&l!==(null===(r=this.data.video)||void 0===r?void 0:r.blocked))&&(y({video:e.video},this.data),this.emitter.emit(t.MeEvent.VIDEOCHANGE,{deviceOn:h(c)?null===(n=this.data.video)||void 0===n?void 0:n.deviceOn:c,sendOn:h(u)?null===(o=this.data.video)||void 0===o?void 0:o.sendOn:u,blocked:h(u)?null===(a=this.data.video)||void 0===a?void 0:a.blocked:l,opBy:d,changeData:Object.assign({},e.video)}))}},n=e=>{var s,i,r,n;if("share"in e){const{deviceOn:o,sendOn:a,opBy:c}=e.share;(!h(o)&&o!==(null===(s=this.data.share)||void 0===s?void 0:s.deviceOn)||!h(a)&&a!==(null===(i=this.data.share)||void 0===i?void 0:i.sendOn))&&(y({share:e.share},this.data),this.emitter.emit(t.MeEvent.SHARECHANGE,{deviceOn:h(o)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:o,sendOn:h(a)?null===(n=this.data.share)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},o=e=>{e.displayName&&e.displayName!==this.data.displayName&&(y({displayName:e.displayName},this.data),this.emitter.emit(t.MeEvent.DISPLAYNAMECHANGE,e.displayName))},a=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(y({isHandUp:e.isHandUp},this.data),this.emitter.emit(t.MeEvent.HANDUPCHANGE,e.isHandUp))},c=e=>{"isSpotlightVideo"in e&&(y({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(t.MeEvent.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},u=s=>e(this,void 0,void 0,(function*(){if("isInLobby"in s&&s.isInLobby!==this.data.isInLobby){y({isInLobby:s.isInLobby},this.data);const e=!1===s.isInLobby?"inLobbyChange":void 0;yield this.rePolling(e),this.emitter.emit(t.MeEvent.LOBBYCHANGE,s.isInLobby),this.ctx.emitter.emit(t.MeEvent.LOBBYCHANGE,s.isInLobby)}})),d=s=>e(this,void 0,void 0,(function*(){const{event:e,state:i,body:r}=s;"personalLayout"===e&&("full"===i?y({personalLayout:r},this.data):"delete"===i&&(this.data.personalLayout=void 0),console.log(this.data.personalLayout),this.emitter.emit(t.MeEvent.PERSONALLAYOUTCHANGE,this.data.personalLayout))})),l=e=>{if(!e.barrage)return;let s=null;if(!e.barrage.wordsDisplayStatus)return s=null,delete e.barrage,this.data.barrage=s||void 0,void this.emitter.emit(t.MeEvent.BARRAGECHANGE,s);if(!e.barrage.receiver)return;s={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===t.ENDPOINT_TYPE.SUPERVISION){const{info:e}=this.ctx.modules;i="webinar"===e.meetingType?t.ROLE.AUDIENCE:t.ROLE.ATTENDEE}i===t.ROLE.HOST||i===t.ROLE.COHOST?s=e.barrage.receiver.host?s:null:i===t.ROLE.ATTENDEE?s=e.barrage.receiver.attendee?s:null:i===t.ROLE.AUDIENCE&&(s=e.barrage.receiver.audience?s:null),delete e.barrage,this.data.barrage=s||void 0,this.emitter.emit(t.MeEvent.BARRAGECHANGE,s)},p=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),L(this.ctx),Z(this.ctx),this.emitter.emit(t.MeEvent.LEAVE,e.resultInfo),this.ctx.cleanup(e.resultInfo))},f=e=>{s(e),i(e),r(e),n(e),o(e),a(e),u(e),c(e),l(e),p(e),(this.data.isInLobby||this.data.role===t.ROLE.AUDIENCE)&&this.data.share&&this.data.share.sendOn&&n({share:{deviceOn:!0,sendOn:!1,recvOn:!1}})};this.ctx.emitter.on(t.MeEvent.INIT,(t=>{y(t,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(t.MeEvent.UPDATE,(t=>{f(t),y(t,this.data)})),this.ctx.emitter.on(t.EVENT.STATE,(({state:e})=>{e===t.STATE.READY&&this.data.endpointType!==t.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(t.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:s={users:[]}}=t;if("delete"===e){const t=s.users[0];return t.leave=!0,void p(t)}let i=s.users.find((t=>t.userID===this.data.userID));i||s.users.length&&(i=s.users[0]),i?(f(i),y(i,this.data)):console.warn("me ",e,s)})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(t.MeEvent.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(t.MeEvent.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(t=>{const{body:e={}}=t;if("ended"===e.state){p({leave:!0,resultInfo:e.resultInfo})}})),this.ctx.emitter.on("personalLayout",(t=>{d(t)}))}updateUserState(e,s=!1){if(!s){const{role:s,initialMediaState:i}=this.data;e.audio.sendOn=e.audio.sendOn&&i.audio.sendOn,e.video.sendOn=e.video.sendOn&&i.video.sendOn,s===t.ROLE.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:i},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,y(e,this.data),this.ctx.request.post(`${i}meetings/${r}/updateUserState`,e)}rePolling(s){return e(this,void 0,void 0,(function*(){const{ctx:e}=this;L(e);const i=P(e),r=yield U(i,e);if(s&&this.emitter.emit(t.MeEvent.UPDATE_USER_STATE,{data:this.data,event:s}),yield N(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 j(r,e)}))}}class G extends S{constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:s}=t;if(e&&e.users){if("full"===s)return this.data.callRecordUsers=e.users.map((t=>(t.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(t.displayName||""):t.displayName,t))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);this.data.callRecordUsers||(this.data.callRecordUsers=[]),e.users.forEach((t=>{const e=this.data.callRecordUsers.findIndex((e=>t.inviteTransID===e.inviteTransID));"update"===s&&-1!==e?y(t,this.data.callRecordUsers[e]):"update"===s&&-1===e&&(t.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(t.displayName||""):t.displayName,this.data.callRecordUsers.push(t))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/invite`,t)}cancelInvite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/cancelInvite`,t)}}class Y extends S{constructor(t){super(t,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:s}=this.ctx.modules.me.data;return s===t.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:e===t.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:s,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(t.MeEvent.UPDATE,e);let n=!1;switch(s){case"interactiveUsers":e.isInLobby||(n=!0);break;case"broadcastUsers":e.isInLobby||e.role!==t.ROLE.AUDIENCE||(n=!0);break;case"lobbyUsers":e.isInLobby&&(n=!0)}const o={};n&&(o.leave=!0),this.ctx.emitter.emit(t.MeEvent.UPDATE,Object.assign(Object.assign({},e),o))},s=({updateUsers:t,state:s,sourceKey:i})=>{if("full"===s)return this.data[i]=t.map((t=>(t.displayNamePinyin=Y.setDisplayNamePinyinProp?Y.setDisplayNamePinyinProp(t.displayName):t.displayName,t.groupIDs=Y.setUserGroupIDs?Y.setUserGroupIDs(t.groupIDs||[]):t.groupIDs,e(t,{event:i,state:s}),t))),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!0}),this.data[i];void 0===this.data[i]&&(this.data[i]=[]);const{data:r,emitter:n}=this;return t.forEach((t=>{const o=r[i].findIndex((e=>t.userID===e.userID));if("delete"===s&&-1!==o){const[e]=this.data[i].splice(o,1);n.emit(`${i}Delete`,{user:e,resultInfo:t.resultInfo})}else if("update"===s&&-1!==o){const e=this.data[i][o];this.updateUserProps(t,e),y(t,e),this.data[i][o]=I(e),this.emitter.emit(`${i}Update`,{user:this.data[i][o]})}else"update"===s&&-1===o&&(t.displayNamePinyin=Y.setDisplayNamePinyinProp?Y.setDisplayNamePinyinProp(t.displayName):t.displayName,r[i].push(t),this.emitter.emit(`${i}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:i,state:s})})),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!1}),this.data[i]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:e,body:i}=t;s({updateUsers:i.users,state:e,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:e,body:i}=t;s({updateUsers:i.users,state:e,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:e,body:i}=t;s({updateUsers:i.users,state:e,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:e,body:i}=t;s({updateUsers:i.users,state:e,sourceKey:"advCtrlUsers"})}))}reactive(t){if(!f(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,i)=>{Object.keys(t).forEach((r=>{!1===i&&r in this.data&&(t[r]=this.data[r]);const n=e=>t[r]=e.users.map((t=>t)),o=`${b(r)}Change`;this.emitter.on(o,n),e.set(o,n),f(t[r])&&!p(t[r])&&s(t[r],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(t,e){t.displayName&&t.displayName!==e.displayName&&(t.displayNamePinyin=Y.setDisplayNamePinyinProp?Y.setDisplayNamePinyinProp(t.displayName):t.displayName)}setAudio(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/users/${t}/callStats`)}callStatsReport(t){if(!t.userID)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t.userID}/callStats/report`,t)}replyAllHandUp(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/lobby/refuseAll`)}getSendLayout(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/sendLayout`)}setSendLayout(t,e){const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/sendLayout`,e)}setSendLayoutEnabled(t,e){const{prefix:{ctrl:s},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${i}/users/${t}/sendLayoutEnabled`,e)}pauseAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/pauseAudio`)}resumeAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/resumeAudio`)}modifyRoleBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyRoleBatch `,t)}modifyVideoBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyVideoBatch `,t)}putInLobbyBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/putInLobbyBatch `,t)}removeBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/removeBatch `,t)}}function Q(e){const{baseURL:i,modules:r,worker:n,singleton:o}=e;r.findIndex((t=>t===B))<0&&r.push(B),r.findIndex((t=>t===w))<0&&r.push(w);const a=e.clientID||`${v()}_${((t=new Date,e)=>{const s={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(const i in s)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[i]:("00"+s[i]).substr((""+s[i]).length)));return e})(new Date,"MMddHHmmss")}`,d={config:{baseURL:i,modules:r,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:s(),request:new c({baseURL:i,beforeRequest:t=>{t.headers["X-Y-Request-Id"]=v(),t.timeout=18e5},error:e=>{d.emitter.emit(t.EVENT.REQUEST_ERROR,e)}}),modules:{},state:t.STATE.CLOSE,status:{polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},cleanup:e=>{d.state!==t.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,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},d.request.setDefaultHeader("X-Y-Location",""),d.request.setDefaultHeader("X-Y-Ctrl-Id",""),d.request.setDefaultHeader("X-Y-Session-Id",""),Object.keys(d.modules).forEach((t=>{d.modules[t].cleanup()})),d.state=t.STATE.CLOSE,d.emitter.emit(t.EVENT.STATE,{state:d.state,reason:e}))}};return d}function F(e){const s=Q(e);return s.worker&&("undefined"!=typeof Worker?s.worker.postMessage({baseURL:s.config.baseURL}):console.error("The current environment does not support worker")),function(t,e){if(!p(t))return void console.error("The modules parameter requires an array type");t.forEach((t=>{const s=new t(e);e.modules[s.moduleName]=s}))}(s.config.modules,s),s.emitter.on(t.EVENT.POLLING_ERROR,(t=>{W(s)({resultInfo:t})})),s.emitter.on(t.EVENT.KEEPALIVE_ERROR,(t=>{W(s)({resultInfo:t})})),Object.assign({config:s.config,request:s.request,get state(){return s.state},on:s.emitter.on,off:s.emitter.off,join:J(s),leave:W(s),end:z(s),endMeeting:X(s)},s.modules)}function J(s){return function(i){var r;return e(this,void 0,void 0,(function*(){const{clientID:e}=s.config.request,n=`${null===(r=i.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${e}_${i.meetingNum}`;s.config.request.sessionID=n,s.request.setDefaultHeader("X-Y-Session-Id",n);const{prefix:o}=s.config.request,a=yield s.request.get(`${o.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,userAgent:i.userAgent},headers:{"X-Y-Endpoint-Type":i.endpointType}}),{credential:c="",location:u=""}=a&&a.data||{};if(!c)return s.emitter.emit(t.EVENT.FAILED,{bizCode:a.bizCode,data:a.data}),a;s.config.request.location=u,s.request.setDefaultHeader("X-Y-Location",u),delete i.pwd,delete i.url;const d={displayName:i.displayName,userAgent:i.userAgent,clientID:e};i.groupIDs&&i.account&&(d.groupIDs=i.groupIDs,d.account=i.account,d.groupName=i.groupName);const l=yield s.request.post(`${o.ctrl}join?meetingNum=${i.meetingNum}&credential=${c}`,d,{headers:{"X-Y-Endpoint-Type":i.endpointType,"X-Y-Endpoint-Id":e}});if(!l||l&&l.ret<=-1)return s.emitter.emit(t.EVENT.FAILED,{bizCode:l.bizCode,data:l.data}),l;const{meetingID:p="",ctrlID:h="",user:f={},mediaContent:m={},initialMediaState:g={},tk:v=""}=l.data;s.config.request.meetingID=p,s.config.request.ctrlID=h,s.config.request.userID=f.userID,s.config.request.voteTk=v,s.request.setDefaultHeader("X-Y-Ctrl-Id",h),s.emitter.emit(t.MeEvent.INIT,Object.assign(Object.assign({},f),{mediaContent:m,initialMediaState:g})),s.state=t.STATE.JOINED,s.emitter.emit(t.EVENT.STATE,{state:s.state});const y=()=>{s.state!==t.STATE.READY&&(s.state=t.STATE.READY,s.emitter.emit(t.EVENT.STATE,{state:s.state}))},x=P(s),b=yield U(x,s);return yield N(x,s),"undefined"!=typeof Worker&&s.worker?(s.status.polling.running=!0,s.worker.postMessage({topics:x,meetingID:p,clientID:e,inboxes:b,status:!0}),s.worker.onmessage=t=>{"pollingStarted"!==t.data?"pollingStopped"!==t.data?(console.log("[Polling]",t.data),s.emitter.emit(t.data.event,t.data)):s.status.polling.running=!1:y()}):(s.status.polling.running=!0,j(b,s),y()),s.status.keepalive.running=!0,k(s,(e=>{s.emitter.emit(t.EVENT.KEEPALIVE_ERROR,e)})),l.data=Object.assign(Object.assign({},l.data),a.data),l}))}}function W(t){return function(s){return e(this,void 0,void 0,(function*(){s||(s={resultInfo:{bizCode:901359}});const{prefix:e,meetingID:i}=t.config.request;let r;try{r=yield t.request.post(`${e.ctrl}meetings/${i}/leave`,s)}catch(n){console.error(n)}return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),L(t),C(t),Z(t),t.cleanup(),r}))}}function z(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:s}=t.config.request,i=yield t.request.post(`${e.ctrl}meetings/${s}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),L(t),C(t),Z(t),t.cleanup(),i}))}}function X(t){return function(s){return e(this,void 0,void 0,(function*(){const{prefix:e}=t.config.request;return yield t.request.post(`${e.ctrl}meetingNum/${s}/end`)}))}}class K{constructor(t){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=F(t)}static getInstance(t){return this.instance?this.instance:this.instance=new K(t)}}function Z(t){if(t.config.singleton){const{baseURL:e,modules:s,singleton:i}=t.config,r={baseURL:e,modules:s,worker:t.worker,singleton:i},n=K.getInstance(r);n&&(n.meeting=F(r))}}return Object.defineProperty(K,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),t.Asr=class extends S{constructor(t){super(t,"asr")}_topic(){return["meeting"]}_bindOn(){this.ctx.emitter.on("asr",(t=>{const{body:e}=t;void 0===this.data.asr&&(this.data.asr={status:"stopped"}),y(e,this.data.asr),this.emitter.emit("asrChange",{asr:this.data.asr,changeData:e})}))}cleanup(){this.emitter.all=new Map}transcriptStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/transcript/status`,t)}))}},t.Chat=class extends S{constructor(t){super(t,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(t=>{const{body:e}=t;this.emitter.emit("chatMsg",e)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/chat/historyMsg`,t)}))}},t.Info=w,t.Interpretation=class extends S{constructor(t){super(t,"interpretation"),this.data={status:"stopped",interpreters:[]}}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("interpretation",(t=>{const{body:e,state:s}=t;"full"===s?(this.data.interpreters=e.interpreters,this.data.status=e.status):this.data.status=e.status,this.emitter.emit("interpretationChange",this.data)}))}interpretationStart(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/interpretation/start`,t)}interpretationEnd(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/interpretation/stop`)}},t.Invite=G,t.LiveStream=class extends S{constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:s,body:i,stime:r}=t;if(i){if(r&&(this.data.jetlag=r),"full"===s){const{liveStreams:t=[]}=i;if(!t.length)return;const e=[];this.data.liveStreams=t.map((t=>(t.requesting="starting"===t.status,e.push({platform:t.platform||"",status:(t.requesting?"stopped":t.status)||""}),t)));return y({status:e,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),i.liveStreams||(this.data.resultInfo={}),null===(e=i.liveStreams)||void 0===e||e.forEach((t=>{this.data.resultInfo=t.resultInfo||{};let e=this.data.liveStreams.findIndex((e=>e.platform===t.platform));-1===e?(t.requesting="starting"===t.status,this.data.liveStreams.push(t)):(t.requesting="starting"===t.status,t=Object.assign(Object.assign({},this.data.liveStreams[e]),t),this.data.liveStreams.splice(e,1,t)),e=this.data.status.findIndex((e=>e.platform===t.platform));const s=this.data.status.map((t=>t));-1===e?s.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):s.splice(e,1,{platform:s[e].platform||"",status:t.requesting?s[e].status||"stopped":t.status||""}),this.data.status=s})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/setting`,t)}))}},t.Me=B,t.Qa=class extends S{constructor(t){super(t,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(t=>{const{body:e}=t;f(e)&&!p(e)?this.qaUpdate(this.data.questions,e):e.forEach((t=>this.qaUpdate(this.data.questions,t)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(t,e){let s=t.get(e.question.id);const{clientID:i}=this.ctx.config.request;switch(e.command){case"addQuestion":s=this.createQuestion(e.question),t.set(e.question.id,s),this.emitter.emit("questionAdd",{question:s,selfSent:s.sender.endpointID===i});break;case"dismissQuestion":if(!s)break;s.sender.endpointID!==i?s.status="close":s.isTop=!1,t.set(e.question.id,s),this.emitter.emit("questionUpdate",{question:s});break;case"reopenQuestion":s?(s.status="open",s.isTop=e.question.isTop,t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"updateQuestion":s?(s=Object.assign(Object.assign(Object.assign({},s),e.question),{topSort:e.question.isTop?this.data.topSort++:0}),t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteQuestion":if(!s)break;s.sender.endpointID!==i?t.delete(e.question.id):(s.status="delete",s.isTop=!1,s.answers.clear(),t.set(e.question.id,s)),this.emitter.emit("questionDelete",{question:s});break;case"answerQuestion":s?s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)):(s=this.createQuestion(e.question),s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteAnswer":s&&(s.answers.delete(e.answer.id),this.emitter.emit("questionUpdate",{question:s}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(t){return{isAnonymous:t.isAnonymous,isTop:t.isTop,id:t.id,content:t.content,sender:t.sender,timestamp:t.timestamp||-1,status:t.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(t){return{isPrivate:t.isPrivate,content:t.content,id:t.id,sender:t.sender,timestamp:t.timestamp||-1}}qa(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/qa`,t)}))}},t.Recording=class extends S{constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:s,stime:i}=t;if(s)return i&&(this.data.stime=i),this.data.isPracticeSession="started"===s.status&&this.data.status===s.status&&0===s.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),s),"starting"===s.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=s.status||this.data.status),this.data.resultInfo=s.resultInfo||{},["full","update"].includes(e)?(s.recordUsers&&(this.data.recording.recordUsers=s.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/layout`,t)}))}},t.Setting=class extends S{constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:s}=t;["full","update"].includes(e)&&y(s,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/unmuteAll`)}))}},t.ShouldJoinUsers=class extends S{constructor(t){super(t,"shouldJoinUsers")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("shouldJoinUsers",(t=>{const{state:e}=t;"update"===e&&this.emitter.emit("shouldJoinUsersChange")}))}modifyUser(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/attendance/shouldJoin`,t)}getUser(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/attendance/getShouldJoin`)}},t.SpotlightVideo=class extends S{constructor(t){super(t,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:s}=e;if(!s||!s.userIDs)return;this.data.userIDs=s.userIDs;s.userIDs.findIndex((t=>t===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(t.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(t.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/view/spotlight`,t)}},t.Transcript=class extends S{constructor(t){super(t,"transcript"),this.data={asr:{status:"stopped"}}}_topic(){return["transcript"]}_bindOn(){this.ctx.emitter.on("transcriptMsg",(t=>{const{body:e}=t;this.emitter.emit("transcriptMsg",e)}))}cleanup(){this.emitter.all=new Map}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/transcript/historyMsg`,t)}))}},t.Users=Y,t.View=class extends S{constructor(t){super(t,"view")}_topic(){const{endpointType:e,role:s}=this.ctx.modules.me.data;return e===t.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:s===t.ROLE.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((t=>{this.ctx.emitter.on(t,(e=>{"personalView"!==t?this.updateLayout(e,t):this.updatePersonalLayouts(e)}))})),this.ctx.emitter.on("videoSourcesUpdated",(()=>{this.emitter.emit("videoSourcesUpdated")}))}updateLayout(t,e){const{event:s,body:i}=t;i&&("meetingView"===s?Object.keys(i).forEach((t=>{this.data[t]=i[t]})):this.data[e]=i)}updatePersonalLayouts(t){const{state:e,body:s}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),s.personalLayouts.forEach((t=>{const{subscriber:s={userID:-1}}=t,i=s.userID||s.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[i]=t:delete this.data.personalLayouts[i]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/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)}))}setSavedBackground(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/recentBackgroundFile`,t)}))}getSavedBackground(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/view/recentBackgroundFile`)}))}},t.Vote=class extends S{constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:s}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[s]=e,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:e})})),this.ctx.emitter.on(t.MeEvent.LOBBYCHANGE,(t=>{t&&(this.data.vote={})}))}getVotes(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}meetings/${s}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:s},meetingID:i,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.post(`${s}meetings/${i}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:s},meetingID:i,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.post(`${s}meetings/${i}/vote/submit?tk=${t.tk}&voteID=${t.voteID}`,e)}voteAdd(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/add`,t)}voteEdit(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/edit`,t)}voteDelete(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}personal/vote/delete`,t)}voteInProgress(t){const{prefix:{vote:e},meetingID:s,voteTk:i}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/vote/inProgress`,{params:{tk:t&&t.tk||i}})}},t.Words=class extends S{constructor(t){super(t,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:s,body:i,pollingSeqId:r}=e;if(!i)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(t.MeEvent.UPDATE,{barrage:this.data});"full"===s&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),r&&(this.data.barrageRecord=[{id:r,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(t.MeEvent.UPDATE,{barrage:this.data})}),1e3*i.duration)),y(i,this.data),this.ctx.emitter.emit(t.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(t.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(t.MeEvent.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/deleteBarrage`)}))}},t.createMeeting=function(t){return t.singleton?K.getInstance(t).meeting:F(t)},t.reset=Z,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ylink-sdk/meeting",
3
- "version": "0.4.0-beta.7",
3
+ "version": "0.4.0-beta.8",
4
4
  "description": "Meeting control of yealink",
5
5
  "main": "index.js",
6
6
  "module": "dist/meeting.esm.prod.js",