@ylink-sdk/meeting 0.4.0-beta.12 → 0.4.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/meeting.cjs.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t,e,r,s){return new(r||(r=Promise))((function(i,n){function o(t){try{c(s.next(t))}catch(e){n(e)}}function a(t){try{c(s.throw(t))}catch(e){n(e)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}c((s=s.apply(t,e||[])).next())}))}function e(t){return{all:t=t||new Map,on:function(e,r){var s=t.get(e);s?s.push(r):t.set(e,[r])},off:function(e,r){var s=t.get(e);s&&(r?s.splice(s.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var s=t.get(e);s&&s.slice().map((function(t){t(r)})),(s=t.get("*"))&&s.slice().map((function(t){t(e,r)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(t,e){var s="__lodash_hash_undefined__",i=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",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 r&&r&&r.Object===Object&&r||N||Function("return this")(),j=e&&!e.nodeType&&e,L=j&&t&&!t.nodeType&&t,C=L&&L.exports===j;function k(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function H(t,e,r,s){var i=-1,n=t?t.length:0;for(s&&n&&(r=t[++i]);++i<n;)r=e(r,t[i],i,t);return r}function V(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(r){}return e}function B(t){var e=-1,r=Array(t.size);return t.forEach((function(t,s){r[++e]=[s,t]})),r}function G(t,e){return function(r){return t(e(r))}}function Y(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}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.*?")+"$"),rt=C?R.Buffer:void 0,st=R.Symbol,it=R.Uint8Array,nt=G(Object.getPrototypeOf,Object),ot=Object.create,at=W.propertyIsEnumerable,ct=F.splice,ut=Object.getOwnPropertySymbols,dt=rt?rt.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=st?st.prototype:void 0,Dt=It?It.valueOf:void 0;function Ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}function $t(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}function Tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}function _t(t){this.__data__=new $t(t)}function At(t,e){var r=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 r=-1,s=Array(t);++r<t;)s[r]=e(r);return s}(t.length,String):[],s=r.length,i=!!s;for(var o in t)!e&&!Z.call(t,o)||i&&("length"==o||Mt(o,s))||r.push(o);return r}function St(t,e,r){var s=t[e];Z.call(t,e)&&Bt(s,r)&&(void 0!==r||e in t)||(t[e]=r)}function wt(t,e){for(var r=t.length;r--;)if(Bt(t[r][0],e))return r;return-1}function Pt(t,e,r,s,i,h,x){var w;if(s&&(w=h?s(t,i,h,x):s(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,r=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,s=t.length;e||(e=Array(s));for(;++r<s;)e[r]=t[r];return e}(t,w)}else{var N=kt(t),R=N==c||N==u;if(Qt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(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,Ct(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,r,s){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 r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,s);case E:case q:case I:case D:case O:case $:case T:case _:case A:return function(t,e){var r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,s);case d:return function(t,e,r){return H(e?r(B(t),!0):B(t),k,new t.constructor)}(t,s,r);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,r){return H(e?r(Y(t),!0):Y(t),M,new t.constructor)}(t,s,r);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=r?function(t){return function(t,e,r){var s=e(t);return Gt(t)?s:function(t,e){for(var r=-1,s=e.length,i=t.length;++r<s;)t[i+r]=e[r];return t}(s,r(t))}(t,Wt,Ct)}(t):Wt(t);return function(t,e){for(var r=-1,s=t?t.length:0;++r<s&&!1!==e(t[r],r,t););}(L||t,(function(i,n){L&&(i=t[n=i]),St(w,n,Pt(i,e,r,s,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,r,s){r||(r={});for(var i=-1,n=e.length;++i<n;){var o=e[i],a=s?s(r[o],t[o],o,r,t):void 0;St(r,o,void 0===a?t[o]:a)}return r}function jt(t,e){var r,s,i=t.__data__;return("string"==(s=typeof(r=e))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Lt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Ut(r)?r: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 r=e[t];return r===s?void 0:r}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__,r=wt(e,t);return!(r<0)&&(r==e.length-1?e.pop():ct.call(e,r,1),!0)},$t.prototype.get=function(t){var e=this.__data__,r=wt(e,t);return r<0?void 0:e[r][1]},$t.prototype.has=function(t){return wt(this.__data__,t)>-1},$t.prototype.set=function(t,e){var r=this.__data__,s=wt(r,t);return s<0?r.push([t,e]):r[s][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 r=this.__data__;if(r instanceof $t){var s=r.__data__;if(!ht||s.length<199)return s.push([t,e]),this;r=this.__data__=new Tt(s)}return r.set(t,e),this};var Ct=ut?G(ut,Object):function(){return[]},kt=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&&kt(new pt(new ArrayBuffer(1)))!=b||ht&&kt(new ht)!=d||ft&&kt(ft.resolve())!=h||mt&&kt(new mt)!=m||gt&&kt(new gt)!=x)&&(kt=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,s=r?Vt(r):void 0;if(s)switch(s){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 r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}}(s,s.exports);var i=s.exports;const n=t=>({get(e,r,s){if("__isProxy"===r)return!0;const i=Reflect.get(e,r);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(t)):i},set(e,r,s,n){const o=e[r];s=h(s)&&s.__isProxy?i(s):s;const a=Reflect.set(e,r,s,n);return((t,e)=>t!==e&&(t==t||e==e))(s,o)&&t.emit(`${y(r)}Change`,s),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 r=t.headers||{};return t.url=I(this.baseURL,t.url||""),t.url=((t,e)=>{if(!e)return t;const r=[];Object.keys(e).forEach((t=>{const s=e[t];if(null==s)return;let i;Array.isArray(s)?(i=s,t+="[]"):i=[s],i.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),r.push(`${o(t)}=${o(e)}`)}))}));const s=r.join("&");if(s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t})(t.url,t.params),r=Object.assign(r,this._defaultHeaders),Object.keys(r).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(r["Content-Type"]=r[t],delete r[t])})),f(t.data)&&(t.data=t.data.buffer),m(t.data)&&(r&&!r["Content-Type"]&&(r["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=r,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,r){return this._errorHandler?this._request(Object.assign(r||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(r||{},{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,r)=>{const{data:s=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){r(new Error("E_JSON_PARSE"+c.responseText))}else r({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&&(r({url:i,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{r(new Error("Network Error")),c=null},c.ontimeout=()=>{r(new Error("timeout of "+t.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(o).forEach((t=>{null===s&&"content-type"===t.toLowerCase()?delete o[t]:c.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{c&&(c.abort(),r(t),c=null)})),c.send(s)})),d=t=>new Promise(((e,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:i,data:s,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):r({url:i,statusCode:t.statusCode})},fail(t){r("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 r=0;r<36;r++)t[r]=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[r,s]=[t[0],t[1]];if(null!==s)return h(s)&&!l(s)?(e[r]||(e[r]={}),void(e[r]=v(s,e[r]))):void(e[r]=s)})),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 r;r=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,r);for(const s in t)E(t,s)&&(r[s]=q(t[s],e));return r},I=(t,e)=>t&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)?((t,e)=>e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e):e,D=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 O,$,T,_,A;exports.EVENT=void 0,(O=exports.EVENT||(exports.EVENT={})).STATE="state",O.FAILED="failed",O.REQUEST_ERROR="requestError",O.POLLING_ERROR="pollingError",O.KEEPALIVE_ERROR="keepaliveError",exports.STATE=void 0,($=exports.STATE||(exports.STATE={}))[$.CLOSE=0]="CLOSE",$[$.JOINED=1]="JOINED",$[$.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,(T=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",T.WEBCTRL="webCtrl",T.WECHATMP="weChatMP",T.SUPERVISION="supervision",T.BIGSCREEN="bigScreen",T.DESKTOP="desktop",T.MOBILE="mobile",T.VCS="vcs",T.SIP="sip",T.H323="h323",T.PSTN="pstn",T.MULTI_STREAM="multiStream",T.MEETING_TOUCH="meetingTouch",T.MEETING_ROOMS="meetingRooms",exports.ROLE=void 0,(_=exports.ROLE||(exports.ROLE={})).HOST="host",_.COHOST="coHost",_.ATTENDEE="attendee",_.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(A=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",A.PAUSED="paused",A.STARTING="starting",A.STOPPED="stopped";class S{constructor(t,r){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=r,this.ctx=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,r=(t,s)=>{Object.keys(t).forEach((i=>{!1===s&&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])&&r(t[i],!0)}))};return r(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:r}=t;("full"===e||"update"===e)&&v(r,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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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:r}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${r}/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:r}=this.ctx.config.request;return this.ctx.request.get(`${e}mailTemplate`,{params:{meetingID:r},headers:{language:t.language}})}}function P(t){const e=[],{isInLobby:r}=t.modules.me.data;return r?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((r=>{const s=t.modules[r]._topic();s&&(Array.isArray(s)?s.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(s)||e.push(s))})),e)}function U(e,r){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:s}=r.config.request,i=yield r.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,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 N(e,r){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s,clientID:i}=r.config.request,n=yield r.request.post(`${t}meetings/${s}/subscribe`,{endpointID:i,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((t=>{r.emitter.emit(t.event,t)}))}))}function R(e,r,s){return t(this,void 0,void 0,(function*(){const{inboxes:i,clientID:n,meetingID:o,cancelToken:a,status:c}=r;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:r={},bizCode:u,error:d}=t;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,r&&Object.keys(r).forEach((t=>{const e=i.find((e=>e.name===t));e&&(e.seqId=r[t].maxSeqId,r[t].items&&r[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),e.pollingSeqId=t.seqId,s(e)})))}))})))(),!c.running)return;if(c.attempts>6)return console.error("polling Max Attempts"),void(r.onError&&r.onError({message:"polling Max Attempts"}));const u=c.attempts?D(c.attempts):0;c.timer=setTimeout((()=>{c.running&&R(e,r,s)}),u)}))}const j=(e,r)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:s}=r.config.request;r.status.polling.running=!0,R(r.request,{inboxes:e,clientID:s,meetingID:t,cancelToken:r.config.request.cancelToken.token,status:r.status.polling,onError:t=>{r.emitter.emit(exports.EVENT.POLLING_ERROR,t)}},(t=>{r.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=c.source()}function C(e,r){return t(this,void 0,void 0,(function*(){const{meetingID:s,userID:i,status:n,cancelToken:o,onError:a}=r;if(n.timer&&(clearTimeout(n.timer),n.timer=null),yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.post(`/meeting-ctrl/api/v1/meetings/${s}/users/${i}/keepalive`,{},{cancelToken:o.token})}catch(c){return n.attempts++,void console.error(c)}if(!t)return;const{data:r={},bizCode:a,error:c}=t;if(900200!==a&&900408!==a&&901323!==a)return n.attempts++,void console.error("keepalive ",a,c);const u=r.interval||"";if(!u)return n.attempts++,void console.error("keepalive ",a,c);n.interval=u,n.attempts=0})))(),!n.running)return;if(n.attempts>10)return console.error("keepalive Max Attempts"),void(a&&a({message:"keepalive Max Attempts"}));const c=n.attempts?D(n.attempts):1e3*n.interval;n.timer=setTimeout((()=>{n.running&&C(e,r)}),c)}))}function k(e){return t(this,void 0,void 0,(function*(){const{meetingID:t,userID:r}=e.config.request;e.status.keepalive.running=!0,C(e.request,{meetingID:t,userID:r,cancelToken:e.config.request.cancelToken.token,status:e.status.keepalive,onError:t=>{e.emitter.emit(exports.EVENT.KEEPALIVE_ERROR,t)}})}))}const M=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)};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 S{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)}})),r=t=>{var e,r,s,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===(r=this.data.audio)||void 0===r?void 0:r.sendOn)||!p(u)&&c!==(null===(s=this.data.audio)||void 0===s?void 0:s.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)}))}},s=t=>{var e,r,s,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===(r=this.data.video)||void 0===r?void 0:r.sendOn)||!p(d)&&d!==(null===(s=this.data.video)||void 0===s?void 0:s.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,r,s,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===(r=this.data.share)||void 0===r?void 0:r.sendOn))&&(v({share:t.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=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:r,body:s}=e;"personalLayout"===t&&("full"===r?v({personalLayout:s},this.data):"delete"===r&&(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:r}=this.data;if(this.data.endpointType===exports.ENDPOINT_TYPE.SUPERVISION){const{info:t}=this.ctx.modules;r="webinar"===t.meetingType?exports.ROLE.AUDIENCE:exports.ROLE.ATTENDEE}r===exports.ROLE.HOST||r===exports.ROLE.COHOST?e=t.barrage.receiver.host?e:null:r===exports.ROLE.ATTENDEE?e=t.barrage.receiver.attendee?e:null:r===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}),L(this.ctx),M(this.ctx),K(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},h=t=>{e(t),r(t),s(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:r={users:[]}}=e;if("delete"===t){const t=r.users[0];return t.leave=!0,void l(t)}let s=r.users.find((t=>t.userID===this.data.userID));s||r.users.length&&(s=r.users[0]),s?(h(s),v(s,this.data)):console.warn("me ",t,r)})))),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:r}=this.data;t.audio.sendOn=t.audio.sendOn&&r.audio.sendOn,t.video.sendOn=t.video.sendOn&&r.video.sendOn,e===exports.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${r}meetings/${s}/updateUserState`,t)}rePolling(e){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;L(t);const r=P(t),s=yield U(r,t);if(e&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:e}),yield N(r,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:i,userID:n}=t.config.request;t.worker.postMessage({inboxes:s,topics:r,clientID:i,meetingID:e,userID:n,rePolling:!0})}else yield j(s,t)}))}}class B extends S{constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:r}=t;if(e&&e.users){if("full"===r)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"===r&&-1!==e?v(t,this.data.callRecordUsers[e]):"update"===r&&-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:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/invite`,t)}cancelInvite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/cancelInvite`,t)}}class G extends S{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:r})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=t;if("delete"!==r||"delete"===r&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(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:r,sourceKey:s})=>{if("full"===r)return this.data[s]=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:s,state:r}),e))),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!0}),this.data[s];void 0===this.data[s]&&(this.data[s]=[]);const{data:i,emitter:n}=this;return e.forEach((e=>{const o=i[s].findIndex((t=>e.userID===t.userID));if("delete"===r&&-1!==o){const[t]=this.data[s].splice(o,1);n.emit(`${s}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===r&&-1!==o){const t=this.data[s][o];this.updateUserProps(e,t),v(e,t),this.data[s][o]=q(t),this.emitter.emit(`${s}Update`,{user:this.data[s][o]})}else"update"===r&&-1===o&&(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(e.displayName):e.displayName,i[s].push(e),this.emitter.emit(`${s}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:s,state:r})})),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!1}),this.data[s]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"advCtrlUsers"})}))}reactive(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,r=(t,s)=>{Object.keys(t).forEach((i=>{!1===s&&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])&&r(t[i],!0)}))};return r(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:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${r}/users/${t}/callStats`)}callStatsReport(t){if(!t.userID)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/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:r}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${r}/users/${t}/sendLayout`)}setSendLayout(t,e){const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/sendLayout`,e)}setSendLayoutEnabled(t,e){const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/sendLayoutEnabled`,e)}pauseAudio(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/users/${t}/pauseAudio`)}resumeAudio(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/users/${t}/resumeAudio`)}modifyRoleBatch(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/modifyRoleBatch `,t)}modifyVideoBatch(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/modifyVideoBatch `,t)}putInLobbyBatch(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/putInLobbyBatch `,t)}removeBatch(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/removeBatch `,t)}}function Y(t){const{baseURL:r,modules:s,worker:i,singleton:n}=t;s.findIndex((t=>t===V))<0&&s.push(V),s.findIndex((t=>t===w))<0&&s.push(w);const o=t.clientID||`${g()}_${((t=new Date,e)=>{const r={"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 s in r)new RegExp("("+s+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return e})(new Date,"MMddHHmmss")}`,u={config:{baseURL:r,modules:s,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:i,emitter:e(),request:new a({baseURL:r,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},u.status.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 r=new t(e);e.modules[r.moduleName]=r}))}(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(r){var s;return t(this,void 0,void 0,(function*(){const{clientID:t}=e.config.request,i=`${null===(s=r.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${t}_${r.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:r.meetingNum,pwd:r.pwd,url:r.url,mobileCode:r.mobileCode,mobile:r.mobile,regEmail:r.regEmail,accEmail:r.accEmail,tk:r.tk,displayName:r.displayName,userAgent:r.userAgent},headers:{"X-Y-Endpoint-Type":r.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 r.pwd,delete r.url;const u={displayName:r.displayName,userAgent:r.userAgent,clientID:t};r.groupIDs&&r.account&&(u.groupIDs=r.groupIDs,u.account=r.account,u.groupName=r.groupName);const d=yield e.request.post(`${n.ctrl}join?meetingNum=${r.meetingNum}&credential=${a}`,u,{headers:{"X-Y-Endpoint-Type":r.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=P(e),y=yield U(x,e);return yield N(x,e),"undefined"!=typeof Worker&&e.worker?(e.status.polling.running=!0,e.status.keepalive.running=!0,e.worker.postMessage({ctrlID:p,location:c,sessionID:i,inboxes:y,topics:x,clientID:t,meetingID:l,userID:h.userID,status:!0}),e.worker.onmessage=t=>{"pollingStarted"!==t.data?"keepaliveStarted"!==t.data&&("pollingStopped"!==t.data?"keepaliveStopped"!==t.data?"pollingError"!==t.data?"keepaliveError"!==t.data?e.emitter.emit(t.data.event,t.data):J(e)({resultInfo:{message:"keepalive Max Attempts"}}):J(e)({resultInfo:{message:"polling Max Attempts"}}):e.status.keepalive.running=!1:e.status.polling.running=!1):v()}):(j(y,e),v(),k(e)),d.data=Object.assign(Object.assign({},d.data),o.data),d}))}}function J(e){return function(r){return t(this,void 0,void 0,(function*(){const t=r&&r.resultInfo;r||(r={resultInfo:{bizCode:901359}});const{prefix:s,meetingID:i}=e.config.request;let n;try{n=yield e.request.post(`${s.ctrl}meetings/${i}/leave`,r)}catch(o){console.error(o)}return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),L(e),M(e),K(e),e.cleanup(t),n}))}}function W(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:r}=e.config.request,s=yield e.request.post(`${t.ctrl}meetings/${r}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),L(e),M(e),K(e),e.cleanup(),s}))}}function z(e){return function(r){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${r}/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:r,singleton:s}=t.config,i={baseURL:e,modules:r,worker:t.worker,singleton:s},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 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"}),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:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/transcript/status`,e)}))}},exports.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(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/chat/historyMsg`,e)}))}},exports.Info=w,exports.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:r}=t;"full"===r?(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:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/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 S{constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:r,body:s,stime:i}=t;if(s){if(i&&(this.data.jetlag=i),"full"===r){const{liveStreams:t=[]}=s;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=[]),s.liveStreams||(this.data.resultInfo={}),null===(e=s.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 r=this.data.status.map((t=>t));-1===e?r.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):r.splice(e,1,{platform:r[e].platform||"",status:t.requesting?r[e].status||"stopped":t.status||""}),this.data.status=r})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/liveStream/setting`,e)}))}},exports.Me=V,exports.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;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 r=t.get(e.question.id);const{clientID:s}=this.ctx.config.request;switch(e.command){case"addQuestion":r=this.createQuestion(e.question),t.set(e.question.id,r),this.emitter.emit("questionAdd",{question:r,selfSent:r.sender.endpointID===s});break;case"dismissQuestion":if(!r)break;r.sender.endpointID!==s?r.status="close":r.isTop=!1,t.set(e.question.id,r),this.emitter.emit("questionUpdate",{question:r});break;case"reopenQuestion":r?(r.status="open",r.isTop=e.question.isTop,t.set(e.question.id,r)):(r=this.createQuestion(e.question),t.set(e.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"updateQuestion":r?(r=Object.assign(Object.assign(Object.assign({},r),e.question),{topSort:e.question.isTop?this.data.topSort++:0}),t.set(e.question.id,r)):(r=this.createQuestion(e.question),t.set(e.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteQuestion":if(!r)break;r.sender.endpointID!==s?t.delete(e.question.id):(r.status="delete",r.isTop=!1,r.answers.clear(),t.set(e.question.id,r)),this.emitter.emit("questionDelete",{question:r});break;case"answerQuestion":r?r.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)):(r=this.createQuestion(e.question),r.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)),t.set(e.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteAnswer":r&&(r.answers.delete(e.answer.id),this.emitter.emit("questionUpdate",{question:r}))}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:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/qa`,e)}))}},exports.Recording=class extends S{constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:r,stime:s}=t;if(r)return s&&(this.data.stime=s),this.data.isPracticeSession="started"===r.status&&this.data.status===r.status&&0===r.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),r),"starting"===r.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=r.status||this.data.status),this.data.resultInfo=r.resultInfo||{},["full","update"].includes(e)?(r.recordUsers&&(this.data.recording.recordUsers=r.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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/layout`,e)}))}},exports.Setting=class extends S{constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:r}=t;["full","update"].includes(e)&&v(r,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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 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:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/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 S{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:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/view/spotlight`,t)}},exports.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(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/transcript/historyMsg`,e)}))}},exports.Users=G,exports.View=class extends S{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:r,body:s}=t;s&&("meetingView"===r?Object.keys(s).forEach((t=>{this.data[t]=s[t]})):this.data[e]=s)}updatePersonalLayouts(t){const{state:e,body:r}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),r.personalLayouts.forEach((t=>{const{subscriber:r={userID:-1}}=t,s=r.userID||r.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[s]=t:delete this.data.personalLayouts[s]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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 S{constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:r}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[r]=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:r,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.get(`${e}meetings/${r}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:r,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.get(`${e}meetings/${r}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:r,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.get(`${e}meetings/${r}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${r}meetings/${s}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${r}meetings/${s}/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:r,voteTk:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${r}/vote/inProgress`,{params:{tk:t&&t.tk||s}})}},exports.Words=class extends S{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:r,pollingSeqId:s}=t;if(!r)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(),s&&(this.data.barrageRecord=[{id:s,content:r.content,time:(new Date).getTime(),durationType:r.durationType,duration:1e3*r.duration},...this.data.barrageRecord]),r.wordsDisplayStatus=!0,-1!==r.duration&&(this.data.timer=setTimeout((()=>{r.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=r.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*r.duration)),v(r,this.data),this.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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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,r,s){return new(r||(r=Promise))((function(i,n){function o(t){try{c(s.next(t))}catch(e){n(e)}}function a(t){try{c(s.throw(t))}catch(e){n(e)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}c((s=s.apply(t,e||[])).next())}))}function e(t){return{all:t=t||new Map,on:function(e,r){var s=t.get(e);s?s.push(r):t.set(e,[r])},off:function(e,r){var s=t.get(e);s&&(r?s.splice(s.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var s=t.get(e);s&&s.slice().map((function(t){t(r)})),(s=t.get("*"))&&s.slice().map((function(t){t(e,r)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(t,e){var s="__lodash_hash_undefined__",i=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",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 r&&r&&r.Object===Object&&r||N||Function("return this")(),j=e&&!e.nodeType&&e,L=j&&t&&!t.nodeType&&t,C=L&&L.exports===j;function k(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function H(t,e,r,s){var i=-1,n=t?t.length:0;for(s&&n&&(r=t[++i]);++i<n;)r=e(r,t[i],i,t);return r}function V(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(r){}return e}function B(t){var e=-1,r=Array(t.size);return t.forEach((function(t,s){r[++e]=[s,t]})),r}function G(t,e){return function(r){return t(e(r))}}function Y(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}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.*?")+"$"),rt=C?R.Buffer:void 0,st=R.Symbol,it=R.Uint8Array,nt=G(Object.getPrototypeOf,Object),ot=Object.create,at=W.propertyIsEnumerable,ct=F.splice,ut=Object.getOwnPropertySymbols,dt=rt?rt.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=st?st.prototype:void 0,Dt=It?It.valueOf:void 0;function Ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}function $t(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}function Tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}function _t(t){this.__data__=new $t(t)}function At(t,e){var r=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 r=-1,s=Array(t);++r<t;)s[r]=e(r);return s}(t.length,String):[],s=r.length,i=!!s;for(var o in t)!e&&!Z.call(t,o)||i&&("length"==o||Mt(o,s))||r.push(o);return r}function St(t,e,r){var s=t[e];Z.call(t,e)&&Bt(s,r)&&(void 0!==r||e in t)||(t[e]=r)}function wt(t,e){for(var r=t.length;r--;)if(Bt(t[r][0],e))return r;return-1}function Pt(t,e,r,s,i,h,x){var w;if(s&&(w=h?s(t,i,h,x):s(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,r=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,s=t.length;e||(e=Array(s));for(;++r<s;)e[r]=t[r];return e}(t,w)}else{var N=kt(t),R=N==c||N==u;if(Qt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(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,Ct(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,r,s){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 r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,s);case E:case q:case I:case D:case O:case $:case T:case _:case A:return function(t,e){var r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,s);case d:return function(t,e,r){return H(e?r(B(t),!0):B(t),k,new t.constructor)}(t,s,r);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,r){return H(e?r(Y(t),!0):Y(t),M,new t.constructor)}(t,s,r);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=r?function(t){return function(t,e,r){var s=e(t);return Gt(t)?s:function(t,e){for(var r=-1,s=e.length,i=t.length;++r<s;)t[i+r]=e[r];return t}(s,r(t))}(t,Wt,Ct)}(t):Wt(t);return function(t,e){for(var r=-1,s=t?t.length:0;++r<s&&!1!==e(t[r],r,t););}(L||t,(function(i,n){L&&(i=t[n=i]),St(w,n,Pt(i,e,r,s,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,r,s){r||(r={});for(var i=-1,n=e.length;++i<n;){var o=e[i],a=s?s(r[o],t[o],o,r,t):void 0;St(r,o,void 0===a?t[o]:a)}return r}function jt(t,e){var r,s,i=t.__data__;return("string"==(s=typeof(r=e))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Lt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Ut(r)?r: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 r=e[t];return r===s?void 0:r}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__,r=wt(e,t);return!(r<0)&&(r==e.length-1?e.pop():ct.call(e,r,1),!0)},$t.prototype.get=function(t){var e=this.__data__,r=wt(e,t);return r<0?void 0:e[r][1]},$t.prototype.has=function(t){return wt(this.__data__,t)>-1},$t.prototype.set=function(t,e){var r=this.__data__,s=wt(r,t);return s<0?r.push([t,e]):r[s][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 r=this.__data__;if(r instanceof $t){var s=r.__data__;if(!ht||s.length<199)return s.push([t,e]),this;r=this.__data__=new Tt(s)}return r.set(t,e),this};var Ct=ut?G(ut,Object):function(){return[]},kt=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&&kt(new pt(new ArrayBuffer(1)))!=b||ht&&kt(new ht)!=d||ft&&kt(ft.resolve())!=h||mt&&kt(new mt)!=m||gt&&kt(new gt)!=x)&&(kt=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,s=r?Vt(r):void 0;if(s)switch(s){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 r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}}(s,s.exports);var i=s.exports;const n=t=>({get(e,r,s){if("__isProxy"===r)return!0;const i=Reflect.get(e,r);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(t)):i},set(e,r,s,n){const o=e[r];s=h(s)&&s.__isProxy?i(s):s;const a=Reflect.set(e,r,s,n);return((t,e)=>t!==e&&(t==t||e==e))(s,o)&&t.emit(`${y(r)}Change`,s),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 r=t.headers||{};return t.url=I(this.baseURL,t.url||""),t.url=((t,e)=>{if(!e)return t;const r=[];Object.keys(e).forEach((t=>{const s=e[t];if(null==s)return;let i;Array.isArray(s)?(i=s,t+="[]"):i=[s],i.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),r.push(`${o(t)}=${o(e)}`)}))}));const s=r.join("&");if(s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t})(t.url,t.params),r=Object.assign(r,this._defaultHeaders),Object.keys(r).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(r["Content-Type"]=r[t],delete r[t])})),f(t.data)&&(t.data=t.data.buffer),m(t.data)&&(r&&!r["Content-Type"]&&(r["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=r,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,r){return this._errorHandler?this._request(Object.assign(r||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(r||{},{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,r)=>{const{data:s=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){r(new Error("E_JSON_PARSE"+c.responseText))}else r({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&&(r({url:i,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{r(new Error("Network Error")),c=null},c.ontimeout=()=>{r(new Error("timeout of "+t.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(o).forEach((t=>{null===s&&"content-type"===t.toLowerCase()?delete o[t]:c.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{c&&(c.abort(),r(t),c=null)})),c.send(s)})),d=t=>new Promise(((e,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:i,data:s,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):r({url:i,statusCode:t.statusCode})},fail(t){r("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 r=0;r<36;r++)t[r]=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[r,s]=[t[0],t[1]];if(null!==s)return h(s)&&!l(s)?(e[r]||(e[r]={}),void(e[r]=v(s,e[r]))):void(e[r]=s)})),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 r;r=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,r);for(const s in t)E(t,s)&&(r[s]=q(t[s],e));return r},I=(t,e)=>t&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)?((t,e)=>e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e):e,D=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 O,$,T,_,A;exports.EVENT=void 0,(O=exports.EVENT||(exports.EVENT={})).STATE="state",O.FAILED="failed",O.REQUEST_ERROR="requestError",O.POLLING_ERROR="pollingError",O.KEEPALIVE_ERROR="keepaliveError",exports.STATE=void 0,($=exports.STATE||(exports.STATE={}))[$.CLOSE=0]="CLOSE",$[$.JOINED=1]="JOINED",$[$.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,(T=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",T.WEBCTRL="webCtrl",T.WECHATMP="weChatMP",T.SUPERVISION="supervision",T.BIGSCREEN="bigScreen",T.DESKTOP="desktop",T.MOBILE="mobile",T.VCS="vcs",T.SIP="sip",T.H323="h323",T.PSTN="pstn",T.MULTI_STREAM="multiStream",T.MEETING_TOUCH="meetingTouch",T.MEETING_ROOMS="meetingRooms",T.RTSP="rtsp",T.RTMP_PULLER="rtmpPuller",exports.ROLE=void 0,(_=exports.ROLE||(exports.ROLE={})).HOST="host",_.COHOST="coHost",_.ATTENDEE="attendee",_.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(A=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",A.PAUSED="paused",A.STARTING="starting",A.STOPPED="stopped";class S{constructor(t,r){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=r,this.ctx=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,r=(t,s)=>{Object.keys(t).forEach((i=>{!1===s&&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])&&r(t[i],!0)}))};return r(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:r}=t;("full"===e||"update"===e)&&v(r,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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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:r}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${r}/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:r}=this.ctx.config.request;return this.ctx.request.get(`${e}mailTemplate`,{params:{meetingID:r},headers:{language:t.language}})}operateRecord(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/operationRecord`,t)}}function P(t){const e=[],{isInLobby:r}=t.modules.me.data;return r?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((r=>{const s=t.modules[r]._topic();s&&(Array.isArray(s)?s.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(s)||e.push(s))})),e)}function U(e,r){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:s}=r.config.request,i=yield r.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,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 N(e,r){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s,clientID:i}=r.config.request,n=yield r.request.post(`${t}meetings/${s}/subscribe`,{endpointID:i,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((t=>{r.emitter.emit(t.event,t)}))}))}function R(e,r,s){return t(this,void 0,void 0,(function*(){const{inboxes:i,clientID:n,meetingID:o,cancelToken:a,status:c}=r;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(d&&"request abort"!==d.type&&console.error(d))}if(!t)return console.error("polling error: ","response is null"),void c.attempts++;const{data:r={},bizCode:u,error:d}=t;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,r&&Object.keys(r).forEach((t=>{const e=i.find((e=>e.name===t));e&&(e.seqId=r[t].maxSeqId,r[t].items&&r[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),e.pollingSeqId=t.seqId,s(e)})))}))})))(),!c.running)return;if(c.attempts>6)return console.error("polling Max Attempts"),void(r.onError&&r.onError({message:"polling Max Attempts"}));const u=c.attempts?D(c.attempts):0;c.timer=setTimeout((()=>{c.running&&R(e,r,s)}),u)}))}const j=(e,r)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:s}=r.config.request;r.status.polling.running=!0,R(r.request,{inboxes:e,clientID:s,meetingID:t,cancelToken:r.config.request.cancelToken.token,status:r.status.polling,onError:t=>{r.emitter.emit(exports.EVENT.POLLING_ERROR,t)}},(t=>{r.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=c.source()}function C(e,r){return t(this,void 0,void 0,(function*(){const{meetingID:s,userID:i,status:n,cancelToken:o,onError:a}=r;if(n.timer&&(clearTimeout(n.timer),n.timer=null),yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.post(`/meeting-ctrl/api/v1/meetings/${s}/users/${i}/keepalive`,{},{cancelToken:o.token})}catch(c){return n.attempts++,void console.error(c)}if(!t)return;const{data:r={},bizCode:a,error:c}=t;if(900200!==a&&900408!==a&&901323!==a)return n.attempts++,void console.error("keepalive ",a,c);const u=r.interval||"";if(!u)return n.attempts++,void console.error("keepalive ",a,c);n.interval=u,n.attempts=0})))(),!n.running)return;if(n.attempts>10)return console.error("keepalive Max Attempts"),void(a&&a({message:"keepalive Max Attempts"}));const c=n.attempts?D(n.attempts):1e3*n.interval;n.timer=setTimeout((()=>{n.running&&C(e,r)}),c)}))}function k(e){return t(this,void 0,void 0,(function*(){const{meetingID:t,userID:r}=e.config.request;e.status.keepalive.running=!0,C(e.request,{meetingID:t,userID:r,cancelToken:e.config.request.cancelToken.token,status:e.status.keepalive,onError:t=>{e.emitter.emit(exports.EVENT.KEEPALIVE_ERROR,t)}})}))}const M=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)};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 S{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)}})),r=t=>{var e,r,s,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===(r=this.data.audio)||void 0===r?void 0:r.sendOn)||!p(u)&&c!==(null===(s=this.data.audio)||void 0===s?void 0:s.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)}))}},s=t=>{var e,r,s,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===(r=this.data.video)||void 0===r?void 0:r.sendOn)||!p(d)&&d!==(null===(s=this.data.video)||void 0===s?void 0:s.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,r,s,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===(r=this.data.share)||void 0===r?void 0:r.sendOn))&&(v({share:t.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=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:r,body:s}=e;"personalLayout"===t&&("full"===r?v({personalLayout:s},this.data):"delete"===r&&(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:r}=this.data;if(this.data.endpointType===exports.ENDPOINT_TYPE.SUPERVISION){const{info:t}=this.ctx.modules;r="webinar"===t.meetingType?exports.ROLE.AUDIENCE:exports.ROLE.ATTENDEE}r===exports.ROLE.HOST||r===exports.ROLE.COHOST?e=t.barrage.receiver.host?e:null:r===exports.ROLE.ATTENDEE?e=t.barrage.receiver.attendee?e:null:r===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}),L(this.ctx),M(this.ctx),K(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},h=t=>{e(t),r(t),s(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:r={users:[]}}=e;if("delete"===t){const t=r.users[0];return t.leave=!0,void l(t)}let s=r.users.find((t=>t.userID===this.data.userID));s||r.users.length&&(s=r.users[0]),s?(h(s),v(s,this.data)):console.warn("me ",t,r)})))),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:r}=this.data;t.audio.sendOn=t.audio.sendOn&&r.audio.sendOn,t.video.sendOn=t.video.sendOn&&r.video.sendOn,e===exports.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${r}meetings/${s}/updateUserState`,t)}rePolling(e){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;L(t);const r=P(t),s=yield U(r,t);if(e&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:e}),yield N(r,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:i,userID:n}=t.config.request;t.worker.postMessage({inboxes:s,topics:r,clientID:i,meetingID:e,userID:n,rePolling:!0})}else yield j(s,t)}))}}class B extends S{constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:r}=t;if(e&&e.users){if("full"===r)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"===r&&-1!==e?v(t,this.data.callRecordUsers[e]):"update"===r&&-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:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/invite`,t)}cancelInvite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/cancelInvite`,t)}}class G extends S{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:r})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=t;if("delete"!==r||"delete"===r&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(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:r,sourceKey:s})=>{if("full"===r)return this.data[s]=e.map((e=>(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(e.displayName):e.displayName,e.groupIDs=G.setUserGroupIDs?G.setUserGroupIDs(e.groupIDs||[],e.endpointType):e.groupIDs,t(e,{event:s,state:r}),e))),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!0}),this.data[s];void 0===this.data[s]&&(this.data[s]=[]);const{data:i,emitter:n}=this;return e.forEach((e=>{const o=i[s].findIndex((t=>e.userID===t.userID));if("delete"===r&&-1!==o){const[t]=this.data[s].splice(o,1);n.emit(`${s}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===r&&-1!==o){const t=this.data[s][o];this.updateUserProps(e,t),v(e,t),this.data[s][o]=q(t),this.emitter.emit(`${s}Update`,{user:this.data[s][o]})}else"update"===r&&-1===o&&(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(e.displayName):e.displayName,i[s].push(e),this.emitter.emit(`${s}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:s,state:r})})),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!1}),this.data[s]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"advCtrlUsers"})}))}reactive(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,r=(t,s)=>{Object.keys(t).forEach((i=>{!1===s&&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])&&r(t[i],!0)}))};return r(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:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${r}/users/${t}/callStats`)}callStatsReport(t){if(!t.userID)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/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:r}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${r}/users/${t}/sendLayout`)}setSendLayout(t,e){const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/sendLayout`,e)}setSendLayoutEnabled(t,e){const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${t}/sendLayoutEnabled`,e)}pauseAudio(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/users/${t}/pauseAudio`)}resumeAudio(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/users/${t}/resumeAudio`)}modifyRoleBatch(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/modifyRoleBatch `,t)}modifyVideoBatch(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/modifyVideoBatch `,t)}putInLobbyBatch(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/putInLobbyBatch `,t)}removeBatch(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/removeBatch `,t)}}function Y(t){const{baseURL:r,modules:s,worker:i,singleton:n}=t;s.findIndex((t=>t===V))<0&&s.push(V),s.findIndex((t=>t===w))<0&&s.push(w);const o=t.clientID||`${g()}_${((t=new Date,e)=>{const r={"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 s in r)new RegExp("("+s+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return e})(new Date,"MMddHHmmss")}`,u={config:{baseURL:r,modules:s,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:i,emitter:e(),request:new a({baseURL:r,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},u.status.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 r=new t(e);e.modules[r.moduleName]=r}))}(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(r){var s;return t(this,void 0,void 0,(function*(){const{clientID:t}=e.config.request,i=`${null===(s=r.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${t}_${r.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:r.meetingNum,pwd:r.pwd,url:r.url,mobileCode:r.mobileCode,mobile:r.mobile,regEmail:r.regEmail,accEmail:r.accEmail,tk:r.tk,displayName:r.displayName,userAgent:r.userAgent},headers:{"X-Y-Endpoint-Type":r.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 r.pwd,delete r.url;const u={displayName:r.displayName,userAgent:r.userAgent,clientID:t};r.groupIDs&&r.account&&(u.groupIDs=r.groupIDs,u.account=r.account,u.groupName=r.groupName);const d=yield e.request.post(`${n.ctrl}join?meetingNum=${r.meetingNum}&credential=${a}`,u,{headers:{"X-Y-Endpoint-Type":r.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=P(e),y=yield U(x,e);return yield N(x,e),"undefined"!=typeof Worker&&e.worker?(e.status.polling.running=!0,e.status.keepalive.running=!0,e.worker.postMessage({ctrlID:p,location:c,sessionID:i,inboxes:y,topics:x,clientID:t,meetingID:l,userID:h.userID,status:!0}),e.worker.onmessage=t=>{"pollingStarted"!==t.data?"keepaliveStarted"!==t.data&&("pollingStopped"!==t.data?"keepaliveStopped"!==t.data?"pollingError"!==t.data?"keepaliveError"!==t.data?e.emitter.emit(t.data.event,t.data):J(e)({resultInfo:{message:"keepalive Max Attempts"}}):J(e)({resultInfo:{message:"polling Max Attempts"}}):e.status.keepalive.running=!1:e.status.polling.running=!1):v()}):(j(y,e),v(),k(e)),d.data=Object.assign(Object.assign({},d.data),o.data),d}))}}function J(e){return function(r){return t(this,void 0,void 0,(function*(){const t=r&&r.resultInfo;r||(r={resultInfo:{bizCode:901359}});const{prefix:s,meetingID:i}=e.config.request;let n;try{n=yield e.request.post(`${s.ctrl}meetings/${i}/leave`,r)}catch(o){console.error(o)}return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),L(e),M(e),K(e),e.cleanup(t),n}))}}function W(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:r}=e.config.request,s=yield e.request.post(`${t.ctrl}meetings/${r}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),L(e),M(e),K(e),e.cleanup(),s}))}}function z(e){return function(r){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${r}/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:r,singleton:s}=t.config,i={baseURL:e,modules:r,worker:t.worker,singleton:s},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 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"}),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:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/transcript/status`,e)}))}},exports.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(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/chat/historyMsg`,e)}))}},exports.Info=w,exports.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:r}=t;"full"===r?(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:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/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 S{constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:r,body:s,stime:i}=t;if(s){if(i&&(this.data.jetlag=i),"full"===r){const{liveStreams:t=[]}=s;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=[]),s.liveStreams||(this.data.resultInfo={}),null===(e=s.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 r=this.data.status.map((t=>t));-1===e?r.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):r.splice(e,1,{platform:r[e].platform||"",status:t.requesting?r[e].status||"stopped":t.status||""}),this.data.status=r})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/liveStream/setting`,e)}))}liveStreamLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/liveStream/layout`,e)}))}},exports.Me=V,exports.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;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 r=t.get(e.question.id);const{clientID:s}=this.ctx.config.request;switch(e.command){case"addQuestion":r=this.createQuestion(e.question),t.set(e.question.id,r),this.emitter.emit("questionAdd",{question:r,selfSent:r.sender.endpointID===s});break;case"dismissQuestion":if(!r)break;r.sender.endpointID!==s?r.status="close":r.isTop=!1,t.set(e.question.id,r),this.emitter.emit("questionUpdate",{question:r});break;case"reopenQuestion":r?(r.status="open",r.isTop=e.question.isTop,t.set(e.question.id,r)):(r=this.createQuestion(e.question),t.set(e.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"updateQuestion":r?(r=Object.assign(Object.assign(Object.assign({},r),e.question),{topSort:e.question.isTop?this.data.topSort++:0}),t.set(e.question.id,r)):(r=this.createQuestion(e.question),t.set(e.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteQuestion":if(!r)break;r.sender.endpointID!==s?t.delete(e.question.id):(r.status="delete",r.isTop=!1,r.answers.clear(),t.set(e.question.id,r)),this.emitter.emit("questionDelete",{question:r});break;case"answerQuestion":r?r.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)):(r=this.createQuestion(e.question),r.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)),t.set(e.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteAnswer":r&&(r.answers.delete(e.answer.id),this.emitter.emit("questionUpdate",{question:r}))}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:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/qa`,e)}))}},exports.Recording=class extends S{constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:r,stime:s}=t;if(r)return s&&(this.data.stime=s),this.data.isPracticeSession="started"===r.status&&this.data.status===r.status&&0===r.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),r),"starting"===r.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=r.status||this.data.status),this.data.resultInfo=r.resultInfo||{},["full","update"].includes(e)?(r.recordUsers&&(this.data.recording.recordUsers=r.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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/layout`,e)}))}},exports.Setting=class extends S{constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:r}=t;["full","update"].includes(e)&&v(r,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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 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:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/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 S{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:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/view/spotlight`,t)}},exports.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(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/transcript/historyMsg`,e)}))}},exports.Users=G,exports.View=class extends S{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:r,body:s}=t;s&&("meetingView"===r?Object.keys(s).forEach((t=>{this.data[t]=s[t]})):this.data[e]=s)}updatePersonalLayouts(t){const{state:e,body:r}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),r.personalLayouts.forEach((t=>{const{subscriber:r={userID:-1}}=t,s=r.userID||r.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[s]=t:delete this.data.personalLayouts[s]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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 S{constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:r}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[r]=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:r,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.get(`${e}meetings/${r}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:r,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.get(`${e}meetings/${r}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:r,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.get(`${e}meetings/${r}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${r}meetings/${s}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${r}meetings/${s}/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:r,voteTk:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${r}/vote/inProgress`,{params:{tk:t&&t.tk||s}})}},exports.Words=class extends S{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:r,pollingSeqId:s}=t;if(!r)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(),s&&(this.data.barrageRecord=[{id:s,content:r.content,time:(new Date).getTime(),durationType:r.durationType,duration:1e3*r.duration},...this.data.barrageRecord]),r.wordsDisplayStatus=!0,-1!==r.duration&&(this.data.timer=setTimeout((()=>{r.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=r.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*r.duration)),v(r,this.data),this.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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/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;
|