@ylink-sdk/meeting 0.1.13 → 0.2.0-beta.10
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/README.md +1 -1
- package/dist/meeting.cjs.prod.js +1 -0
- package/dist/meeting.d.ts +2349 -0
- package/dist/meeting.esm.prod.js +1 -0
- package/dist/meeting.global.prod.js +1 -0
- package/dist/worker/polling.worker.prod.js +1 -0
- package/index.js +3 -0
- package/package.json +17 -46
- package/LICENSE +0 -21
- package/dist/index.d.ts +0 -161
- package/dist/types/ctrl.d.ts +0 -1026
- package/dist/types/data.d.ts +0 -737
- package/dist/types/enums.d.ts +0 -240
- package/dist/ylink-sdk-meeting.es.js +0 -1
- package/dist/ylink-sdk-meeting.umd.js +0 -1
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(t){n(t)}}function a(e){try{c(r.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}function t(e){return{all:e=e||new Map,on:function(t,s){var r=e.get(t);r?r.push(s):e.set(t,[s])},off:function(t,s){var r=e.get(t);r&&(s?r.splice(r.indexOf(s)>>>0,1):e.set(t,[]))},emit:function(t,s){var r=e.get(t);r&&r.slice().map((function(e){e(s)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,s)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(e,t){var r="__lodash_hash_undefined__",i=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",x="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",w="[object Uint32Array]",S=/\w*$/,A=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,j={};j[n]=j["[object Array]"]=j[y]=j[b]=j[o]=j[a]=j[E]=j[q]=j[I]=j[D]=j[T]=j[d]=j[l]=j[p]=j[f]=j[m]=j[g]=j[v]=j[O]=j[$]=j[_]=j[w]=!0,j["[object Error]"]=j[c]=j[x]=!1;var U="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof s&&s&&s.Object===Object&&s||U||Function("return this")(),C=t&&!t.nodeType&&t,R=C&&e&&!e.nodeType&&e,k=R&&R.exports===C;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,s,r){var i=-1,n=e?e.length:0;for(r&&n&&(s=e[++i]);++i<n;)s=t(s,e[i],i,e);return s}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(s){}return t}function B(e){var t=-1,s=Array(e.size);return e.forEach((function(e,r){s[++t]=[r,e]})),s}function G(e,t){return function(s){return e(t(s))}}function Y(e){var t=-1,s=Array(e.size);return e.forEach((function(e){s[++t]=e})),s}var Q,W=Array.prototype,F=Function.prototype,X=Object.prototype,z=N["__core-js_shared__"],J=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=F.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=k?N.Buffer:void 0,re=N.Symbol,ie=N.Uint8Array,ne=G(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=W.splice,ue=Object.getOwnPropertySymbols,de=se?se.isBuffer:void 0,le=G(Object.keys,Object),pe=Re(N,"DataView"),he=Re(N,"Map"),fe=Re(N,"Promise"),me=Re(N,"Set"),ge=Re(N,"WeakMap"),ve=Re(Object,"create"),xe=Ve(pe),ye=Ve(he),be=Ve(fe),Ee=Ve(me),qe=Ve(ge),Ie=re?re.prototype:void 0,De=Ie?Ie.valueOf:void 0;function Te(e){var t=-1,s=e?e.length:0;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}function Oe(e){var t=-1,s=e?e.length:0;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}function $e(e){var t=-1,s=e?e.length:0;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}function _e(e){this.__data__=new Oe(e)}function we(e,t){var s=Ge(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var s=-1,r=Array(e);++s<e;)r[s]=t(s);return r}(e.length,String):[],r=s.length,i=!!r;for(var o in e)!t&&!Z.call(e,o)||i&&("length"==o||Me(o,r))||s.push(o);return s}function Se(e,t,s){var r=e[t];Z.call(e,t)&&Be(r,s)&&(void 0!==s||t in e)||(e[t]=s)}function Ae(e,t){for(var s=e.length;s--;)if(Be(e[s][0],t))return s;return-1}function Pe(e,t,s,r,i,h,x){var A;if(r&&(A=h?r(e,i,h,x):r(e)),void 0!==A)return A;if(!Fe(e))return e;var P=Ge(e);if(P){if(A=function(e){var t=e.length,s=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(s.index=e.index,s.input=e.input);return s}(e),!t)return function(e,t){var s=-1,r=e.length;t||(t=Array(r));for(;++s<r;)t[s]=e[s];return t}(e,A)}else{var U=Le(e),N=U==c||U==u;if(Qe(e))return function(e,t){if(t)return e.slice();var s=new e.constructor(e.length);return e.copy(s),s}(e,t);if(U==p||U==n||N&&!h){if(V(e))return h?e:{};if(A=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),Fe(t)?oe(t):{});var t}(N?{}:e),!t)return function(e,t){return Ne(e,ke(e),t)}(e,function(e,t){return e&&Ne(t,Xe(t),e)}(A,e))}else{if(!j[U])return h?e:{};A=function(e,t,s,r){var i=e.constructor;switch(t){case y:return Ue(e);case o:case a:return new i(+e);case b:return function(e,t){var s=t?Ue(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}(e,r);case E:case q:case I:case D:case T:case O:case $:case _:case w:return function(e,t){var s=t?Ue(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}(e,r);case d:return function(e,t,s){return H(t?s(B(e),!0):B(e),L,new e.constructor)}(e,r,s);case l:case g:return new i(e);case f:return function(e){var t=new e.constructor(e.source,S.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,s){return H(t?s(Y(e),!0):Y(e),M,new e.constructor)}(e,r,s);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,U,Pe,t)}}x||(x=new _e);var C=x.get(e);if(C)return C;if(x.set(e,A),!P)var R=s?function(e){return function(e,t,s){var r=t(e);return Ge(e)?r:function(e,t){for(var s=-1,r=t.length,i=e.length;++s<r;)e[i+s]=t[s];return e}(r,s(e))}(e,Xe,ke)}(e):Xe(e);return function(e,t){for(var s=-1,r=e?e.length:0;++s<r&&!1!==t(e[s],s,e););}(R||e,(function(i,n){R&&(i=e[n=i]),Se(A,n,Pe(i,t,s,r,n,e,x))})),A}function je(e){return!(!Fe(e)||(t=e,J&&J in t))&&(We(e)||V(e)?te:A).test(Ve(e));var t}function Ue(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ne(e,t,s,r){s||(s={});for(var i=-1,n=t.length;++i<n;){var o=t[i],a=r?r(s[o],e[o],o,s,e):void 0;Se(s,o,void 0===a?e[o]:a)}return s}function Ce(e,t){var s,r,i=e.__data__;return("string"==(r=typeof(s=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==s:null===s)?i["string"==typeof t?"string":"hash"]:i.map}function Re(e,t){var s=function(e,t){return null==e?void 0:e[t]}(e,t);return je(s)?s:void 0}Te.prototype.clear=function(){this.__data__=ve?ve(null):{}},Te.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Te.prototype.get=function(e){var t=this.__data__;if(ve){var s=t[e];return s===r?void 0:s}return Z.call(t,e)?t[e]:void 0},Te.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Te.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?r:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,s=Ae(t,e);return!(s<0)&&(s==t.length-1?t.pop():ce.call(t,s,1),!0)},Oe.prototype.get=function(e){var t=this.__data__,s=Ae(t,e);return s<0?void 0:t[s][1]},Oe.prototype.has=function(e){return Ae(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var s=this.__data__,r=Ae(s,e);return r<0?s.push([e,t]):s[r][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Te,map:new(he||Oe),string:new Te}},$e.prototype.delete=function(e){return Ce(this,e).delete(e)},$e.prototype.get=function(e){return Ce(this,e).get(e)},$e.prototype.has=function(e){return Ce(this,e).has(e)},$e.prototype.set=function(e,t){return Ce(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new Oe},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var s=this.__data__;if(s instanceof Oe){var r=s.__data__;if(!he||r.length<199)return r.push([e,t]),this;s=this.__data__=new $e(r)}return s.set(e,t),this};var ke=ue?G(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||P.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Be(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=b||he&&Le(new he)!=d||fe&&Le(fe.resolve())!=h||me&&Le(new me)!=m||ge&&Le(new ge)!=x)&&(Le=function(e){var t=ee.call(e),s=t==p?e.constructor:void 0,r=s?Ve(s):void 0;if(r)switch(r){case xe:return b;case ye:return d;case be:return h;case Ee:return m;case qe:return x}return t});var Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}(e.length)&&!We(e)}var Qe=de||function(){return!1};function We(e){var t=Fe(e)?ee.call(e):"";return t==c||t==u}function Fe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xe(e){return Ye(e)?we(e):function(e){if(!He(e))return le(e);var t=[];for(var s in Object(e))Z.call(e,s)&&"constructor"!=s&&t.push(s);return t}(e)}e.exports=function(e){return Pe(e,!0,!0)}}(r,r.exports);var i=r.exports;const n=e=>({get(t,s,r){if("__isProxy"===s)return!0;const i=Reflect.get(t,s);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(e)):i},set(t,s,r,n){const o=t[s];r=h(r)&&r.__isProxy?i(r):r;const a=Reflect.set(t,s,r,n);return((e,t)=>e!==t&&(e==e||t==t))(r,o)&&e.emit(`${x(s)}Change`,r),a}}),o=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:t="",timeout:s=6e4}=e;let{headers:r={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,t)=>{if(!t)return e;const s=[];Object.keys(t).forEach((e=>{const r=t[e];if(null==r)return;let i;Array.isArray(r)?(i=r,e+="[]"):i=[r],i.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),s.push(`${o(e)}=${o(t)}`)}))}));const r=s.join("&");if(r){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e})(t.replace(/^\/+/,""),e.params),r=Object.assign(r,this._defaultHeaders),Object.keys(r).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(r["Content-Type"]=r[e],delete r[e])})),f(e.data)&&(r&&!r["Content-Type"]&&(r["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=r,e.timeout=s,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx?d(e):u(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,s){return this._errorHandler?this._request(Object.assign(s||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(s||{},{url:e,method:"POST",data:t}))}}class c{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new c((t=>{e=t}));return{cancel:e,token:t}}}const u=e=>new Promise(((t,s)=>{const{data:r=null,url:i,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),i,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){s(new Error("E_JSON_PARSE"+u.responseText))}else s({url:i,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(s({url:i,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{s(new Error("Network Error")),u=null},u.ontimeout=()=>{s(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===r&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),s(e),u=null)})),u.send(r)})),d=e=>new Promise(((t,s)=>{const{data:r=null,url:i,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:i,data:r,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):s({url:i,statusCode:e.statusCode})},fail(e){s("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=e=>null==e,h=e=>"object"==typeof e&&null!==e,f=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},m=()=>{const e=[],t="0123456789abcdef";for(let s=0;s<36;s++)e[s]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},g=(e,t)=>e?(Object.entries(e).forEach((e=>{const[s,r]=[e[0],e[1]];if(null!==r)return h(r)&&!l(r)?(t[s]||(t[s]={}),void(t[s]=g(r,t[s]))):void(t[s]=r)})),t):t,v=/-(\w)/g,x=e=>e.replace(v,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:y}=Object.prototype,b=(e,t)=>y.call(e,t),E=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let s;s=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,s);for(const r in e)b(e,r)&&(s[r]=E(e[r],t));return s};var q,I,D,T,O;exports.EVENT=void 0,(q=exports.EVENT||(exports.EVENT={})).REQUEST_ERROR="requestError",q.STATE="state",q.FAILED="failed",exports.STATE=void 0,(I=exports.STATE||(exports.STATE={}))[I.CLOSE=0]="CLOSE",I[I.JOINED=1]="JOINED",I[I.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,(D=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",D.WEBCTRL="webCtrl",D.WECHATMP="weChatMP",D.SUPERVISION="supervision",D.BIGSCREEN="bigScreen",D.DESKTOP="desktop",D.MOBILE="mobile",D.VCS="vcs",D.SIP="sip",D.H323="h323",D.PSTN="pstn",exports.ROLE=void 0,(T=exports.ROLE||(exports.ROLE={})).HOST="host",T.COHOST="coHost",T.ATTENDEE="attendee",T.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(O=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",O.PAUSED="paused",O.STARTING="starting",O.STOPPED="stopped";class ${constructor(e,s){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=s,this.ctx=e,this.emitter=t(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},n(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},n(this.emitter))}reactive(e){if(h(e)){const t=new Map,s=(e,r)=>{Object.keys(e).forEach((i=>{!1===r&&i in this.data&&(e[i]=this.data[i]);const n=t=>e[i]=t,o=`${x(i)}Change`;this.emitter.on(o,n),t.set(o,n),h(e[i])&&!l(e[i])&&s(e[i],!0)}))};s(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class _ extends ${constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:s}=e;("full"===t||"update"===t)&&g(s,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;g({participantCount:t},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${s}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:s},headers:{language:e.language}})}}function w(e){const t=[],{isInLobby:s}=e.modules.me.data;return s?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((s=>{const r=e.modules[s]._topic();r&&(Array.isArray(r)?r.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(r)||t.push(r))})),t)}function S(t,s){return e(this,void 0,void 0,(function*(){const{meetingID:e,clientID:r}=s.config.request,i=yield s.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:r,meetingId:e},inboxes:t}),n=[];return i.data&&Object.keys(i.data).forEach((e=>{n.push({name:e,seqId:i.data[e].maxSeqId,limit:200})})),n}))}function A(t,s){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r,clientID:i}=s.config.request,n=yield s.request.post(`${e}meetings/${r}/subscribe`,{endpointID:i,topics:t}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),s.emitter.emit(e.event,e)}))}))}function P(t,s,r){return e(this,void 0,void 0,(function*(){const{inboxes:i,clientID:n,meetingID:o,cancelToken:a,status:c}=s;yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:i},{cancelToken:a,withResDate:!0});if(!e||!e.data)return;const{data:s={}}=e;Object.keys(s).forEach((e=>{const t=i.find((t=>t.name===e));if(t){if(t.seqId=s[e].maxSeqId,!s[e].items)return;s[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),r(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&P(t,s,r)}),200))}))}const j=(t,s)=>e(void 0,void 0,void 0,(function*(){const{meetingID:e,clientID:r}=s.config.request;s.status.polling.running=!0,P(s.request,{inboxes:t,clientID:r,meetingID:e,cancelToken:s.config.request.cancelToken.token,status:s.status.polling},(e=>{s.emitter.emit(e.event,e)}))}));function U(e){e.status.polling.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=c.source()}function N(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:s},meetingID:r,userID:i}=t.config.request;t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.request.post(`${s}meetings/${r}/users/${i}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token});if(!e||!e.data)return;const{data:n={}}=e,o=n.interval||"";o&&(t.status.keepalive.interval=o)})))(),t.status.keepalive.running&&(t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&N(t)}),1e3*t.status.keepalive.interval))}))}const C=e=>{e.status.keepalive.running=!1,e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null)};var R;exports.MeEvent=void 0,(R=exports.MeEvent||(exports.MeEvent={})).INIT="meInit",R.UPDATE="meUpdate",R.UPDATE_USER_STATE="updateUserState",R.ROLECHANGE="meRoleChange",R.AUDIOCHANGE="meAudioChange",R.HANDUPCHANGE="meHandupChange",R.SETAUDIO="setAudio",R.VIDEOCHANGE="meVideoChange",R.SETVIDEO="setVideo",R.SHARECHANGE="meShareChange",R.DISPLAYNAMECHANGE="meDisplayNameChange",R.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",R.LOBBYCHANGE="meLobbyChange",R.BARRAGECHANGE="meBarrageChange",R.LEAVE="leave";class k extends ${constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const t=t=>e(this,void 0,void 0,(function*(){if("role"in t&&t.role!==this.data.role){const e=this.data.role;g({role:t.role},this.data),t.role!==exports.ROLE.AUDIENCE&&e!==exports.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(exports.MeEvent.ROLECHANGE,t.role),this.ctx.emitter.emit(exports.MeEvent.ROLECHANGE,t.role)}})),s=e=>{var t,s,r,i;if("audio"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.audio;(!p(n)&&n!==(null===(t=this.data.audio)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(s=this.data.audio)||void 0===s?void 0:s.sendOn)||!p(a))&&(g({audio:e.audio},this.data),this.emitter.emit(exports.MeEvent.AUDIOCHANGE,{deviceOn:p(n)?null===(r=this.data.audio)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(i=this.data.audio)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},r=e=>{var t,s,r,i;if("video"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.video;(!p(n)&&n!==(null===(t=this.data.video)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(s=this.data.video)||void 0===s?void 0:s.sendOn))&&(g({video:e.video},this.data),this.emitter.emit(exports.MeEvent.VIDEOCHANGE,{deviceOn:p(n)?null===(r=this.data.video)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(i=this.data.video)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},i=e=>{var t,s,r,i;if("share"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.share;(!p(n)&&n!==(null===(t=this.data.share)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(s=this.data.share)||void 0===s?void 0:s.sendOn))&&(g({share:e.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=e=>{e.displayName&&e.displayName!==this.data.displayName&&(g({displayName:e.displayName},this.data),this.emitter.emit(exports.MeEvent.DISPLAYNAMECHANGE,e.displayName))},o=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(g({isHandUp:e.isHandUp},this.data),this.emitter.emit(exports.MeEvent.HANDUPCHANGE,e.isHandUp))},a=e=>{"isSpotlightVideo"in e&&(g({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(exports.MeEvent.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},c=t=>e(this,void 0,void 0,(function*(){if("isInLobby"in t&&t.isInLobby!==this.data.isInLobby){g({isInLobby:t.isInLobby},this.data);const e=!1===t.isInLobby?"inLobbyChange":void 0;yield this.rePolling(e),this.emitter.emit(exports.MeEvent.LOBBYCHANGE,t.isInLobby),this.ctx.emitter.emit(exports.MeEvent.LOBBYCHANGE,t.isInLobby)}})),u=e=>{if(!e.barrage)return;let t=null;if(!e.barrage.wordsDisplayStatus)return t=null,delete e.barrage,this.data.barrage=t||void 0,void this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t);t={content:e.barrage.content,contentType:e.barrage.contentType,type:e.barrage.type,duration:e.barrage.duration,position:e.barrage.position};const{role:s}=this.data;e.barrage.receiver&&(s===exports.ROLE.HOST||s===exports.ROLE.COHOST?t=e.barrage.receiver.host?t:null:s===exports.ROLE.ATTENDEE?t=e.barrage.receiver.attendee?t:null:s===exports.ROLE.AUDIENCE&&(t=e.barrage.receiver.audience?t:null),delete e.barrage,this.data.barrage=t||void 0,this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t))},d=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),U(this.ctx),F(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,e.resultInfo),this.ctx.cleanup(e.resultInfo))},l=e=>{t(e),s(e),r(e),i(e),n(e),o(e),c(e),a(e),u(e),d(e)};this.ctx.emitter.on(exports.MeEvent.INIT,(e=>{g(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(exports.MeEvent.UPDATE,(e=>{l(e),g(e,this.data)})),this.ctx.emitter.on(exports.EVENT.STATE,(({state:e})=>{e===exports.STATE.READY&&this.data.endpointType!==exports.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:s={users:[]}}=t;if("delete"===e){const e=s.users[0];return e.leave=!0,void d(e)}const r=s.users.find((e=>e.userID===this.data.userID));r&&(l(r),g(r,this.data))})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(exports.MeEvent.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(exports.MeEvent.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){d({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(e,t=!1){if(!t){const{role:t,initialMediaState:s}=this.data;e.audio.sendOn=e.audio.sendOn&&s.audio.sendOn,e.video.sendOn=e.video.sendOn&&s.video.sendOn,t===exports.ROLE.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,g(e,this.data),this.ctx.request.post(`${s}meetings/${r}/updateUserState`,e)}rePolling(t){return e(this,void 0,void 0,(function*(){const{ctx:e}=this;U(e);const s=w(e),r=yield S(s,e);if(t&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:t}),yield A(s,e),"undefined"!=typeof Worker&&e.worker){const{meetingID:t,clientID:i}=e.config.request;e.worker.postMessage({inboxes:r,topics:s,meetingID:t,clientID:i,rePolling:!0})}else yield j(r,e)}))}}class L extends ${constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:s}=e;if(t&&t.users){if("full"===s)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=L.setDisplayNamePinyinProp?L.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===s&&-1!==t?g(e,this.data.callRecordUsers[t]):"update"===s&&-1===t&&(e.displayNamePinyin=L.setDisplayNamePinyinProp?L.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/invite`,e)}}class M extends ${constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:t}=this.ctx.modules.me.data;return t===exports.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:e===exports.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:t,state:s})=>{if(e.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:r={}}=e;if("delete"!==s||"delete"===s&&[901357,901358,901352,901351,901350,901349].includes(r.bizCode||-1))return void this.ctx.emitter.emit(exports.MeEvent.UPDATE,e);let i=!1;switch(t){case"interactiveUsers":e.isInLobby||(i=!0);break;case"broadcastUsers":e.isInLobby||e.role!==exports.ROLE.AUDIENCE||(i=!0);break;case"lobbyUsers":e.isInLobby&&(i=!0)}const n={};i&&(n.leave=!0),this.ctx.emitter.emit(exports.MeEvent.UPDATE,Object.assign(Object.assign({},e),n))},t=({updateUsers:t,state:s,sourceKey:r})=>{if("full"===s)return this.data[r]=t.map((t=>(t.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(t.displayName):t.displayName,e(t,{event:r,state:s}),t))),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!0}),this.data[r];void 0===this.data[r]&&(this.data[r]=[]);const{data:i,emitter:n}=this;return t.forEach((t=>{const o=i[r].findIndex((e=>t.userID===e.userID));if("delete"===s&&-1!==o){const[e]=this.data[r].splice(o,1);n.emit(`${r}Delete`,{user:e,resultInfo:t.resultInfo})}else if("update"===s&&-1!==o){const e=this.data[r][o];this.updateUserProps(t,e),g(t,e),this.data[r][o]=E(e),this.emitter.emit(`${r}Update`,{user:this.data[r][o]})}else"update"===s&&-1===o&&(t.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(t.displayName):t.displayName,i[r].push(t),this.emitter.emit(`${r}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:r,state:s})})),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!1}),this.data[r]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:s,body:r}=e;t({updateUsers:r.users,state:s,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:s,body:r}=e;t({updateUsers:r.users,state:s,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:s,body:r}=e;t({updateUsers:r.users,state:s,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:s,body:r}=e;t({updateUsers:r.users,state:s,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${s}/users/${e}/callStats`)}callStatsReport(e){if(!e.userID)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/users/${e.userID}/callStats/report`,e)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}function H(e){const{baseURL:s,modules:r,worker:i,singleton:n}=e;r.findIndex((e=>e===k))<0&&r.push(k),r.findIndex((e=>e===_))<0&&r.push(_);const o=`${m()}_${((e=new Date,t)=>{const s={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const r in s)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[r]:("00"+s[r]).substr((""+s[r]).length)));return t})(new Date,"MMddHHmmss")}`,u={config:{baseURL:s,modules:r,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:i,emitter:t(),request:new a({baseURL:s,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=m()},error:e=>{u.emitter.emit(exports.EVENT.REQUEST_ERROR,e)}}),modules:{},state:exports.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:e=>{u.state!==exports.STATE.CLOSE&&(u.worker&&u.worker.terminate(),u.config.request.location="",u.config.request.meetingID="",u.config.request.ctrlID="",u.config.request.sessionID="",u.config.request.userID=-1,u.config.request.voteTk="",u.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),u.state=exports.STATE.CLOSE,u.emitter.emit(exports.EVENT.STATE,{state:u.state,reason:e}))}};return u}function V(e){const t=H(e);return t.worker&&("undefined"!=typeof Worker?t.worker.postMessage({baseURL:t.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!l(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const s=new e(t);t.modules[s.moduleName]=s}))}(t.config.modules,t),t.emitter.on(exports.EVENT.STATE,(({state:e})=>{e===exports.STATE.CLOSE&&Object.keys(t.modules).forEach((e=>{t.modules[e].cleanup()}))})),Object.assign({config:t.config,request:t.request,get state(){return t.state},on:t.emitter.on,off:t.emitter.off,join:B(t),leave:G(t),end:Y(t),endMeeting:Q(t)},t.modules)}function B(t){return function(s){var r;return e(this,void 0,void 0,(function*(){const{clientID:e}=t.config.request,i=`${null===(r=s.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${e}_${s.meetingNum}`;t.config.request.sessionID=i,t.request.setDefaultHeader("X-Y-Session-Id",i);const{prefix:n}=t.config.request,o=yield t.request.get(`${n.ctrl}credential`,{params:{meetingNum:s.meetingNum,pwd:s.pwd,url:s.url,mobileCode:s.mobileCode,mobile:s.mobile,regEmail:s.regEmail,accEmail:s.accEmail,tk:s.tk,displayName:s.displayName},headers:{"X-Y-Endpoint-Type":s.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return t.emitter.emit(exports.EVENT.FAILED,{bizCode:o.bizCode,data:o.data}),o;t.config.request.location=c,t.request.setDefaultHeader("X-Y-Location",c),delete s.pwd,delete s.url;const u=yield t.request.post(`${n.ctrl}join?meetingNum=${s.meetingNum}&credential=${a}`,s,{headers:{"X-Y-Endpoint-Type":s.endpointType,"X-Y-Endpoint-Id":e}});if(!u||u&&u.ret<=-1)return t.emitter.emit(exports.EVENT.FAILED,{bizCode:u.bizCode,data:u.data}),u;const{meetingID:d="",ctrlID:l="",user:p={},mediaContent:h={},initialMediaState:f={},tk:m=""}=u.data;t.config.request.meetingID=d,t.config.request.ctrlID=l,t.config.request.userID=p.userID,t.config.request.voteTk=m,t.request.setDefaultHeader("X-Y-Ctrl-Id",l),t.emitter.emit(exports.MeEvent.INIT,Object.assign(Object.assign({},p),{mediaContent:h,initialMediaState:f})),t.state=exports.STATE.JOINED,t.emitter.emit(exports.EVENT.STATE,{state:t.state});const g=()=>{t.state!==exports.STATE.READY&&(t.state=exports.STATE.READY,t.emitter.emit(exports.EVENT.STATE,{state:t.state}))},v=w(t),x=yield S(v,t);return yield A(v,t),"undefined"!=typeof Worker&&t.worker?(t.status.polling.running=!0,t.worker.postMessage({topics:v,meetingID:d,clientID:e,inboxes:x,status:!0}),t.worker.onmessage=e=>{"pollingStarted"!==e.data?"pollingStopped"!==e.data?(console.log("[Polling]",e.data),t.emitter.emit(e.data.event,e.data)):t.status.polling.running=!1:g()}):(t.status.polling.running=!0,j(x,t),g()),t.status.keepalive.running=!0,N(t),u.data=Object.assign(Object.assign({},u.data),o.data),u}))}}function G(t){return function(s){return e(this,void 0,void 0,(function*(){s||(s={resultInfo:{bizCode:901359}});const{prefix:e,meetingID:r}=t.config.request,i=yield t.request.post(`${e.ctrl}meetings/${r}/leave`,s);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),U(t),C(t),F(t),t.cleanup(),i}))}}function Y(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:s}=t.config.request,r=yield t.request.post(`${e.ctrl}meetings/${s}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),U(t),C(t),F(t),t.cleanup(),r}))}}function Q(t){return function(s){return e(this,void 0,void 0,(function*(){const{prefix:e}=t.config.request;return yield t.request.post(`${e.ctrl}meetingNum/${s}/end`)}))}}class W{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=V(e)}static getInstance(e){return this.instance?this.instance:this.instance=new W(e)}}function F(e){if(e.config.singleton){const{baseURL:t,modules:s,singleton:r}=e.config,i={baseURL:t,modules:s,worker:e.worker,singleton:r},n=W.getInstance(i);n&&(n.meeting=V(i))}}Object.defineProperty(W,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.Chat=class extends ${constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/chat/historyMsg`,t)}))}},exports.Info=_,exports.Invite=L,exports.LiveStream=class extends ${constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:s,body:r,stime:i}=e;if(r){if(i&&(this.data.jetlag=i),"full"===s){const{liveStreams:e=[]}=r;if(!e.length)return;const t=[];this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,t.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return g({status:t,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),r.liveStreams||(this.data.resultInfo={}),null===(t=r.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform));const s=this.data.status.map((e=>e));-1===t?s.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):s.splice(t,1,{platform:s[t].platform||"",status:e.requesting?s[t].status||"stopped":e.status||""}),this.data.status=s})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/setting`,t)}))}},exports.Me=k,exports.Qa=class extends ${constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;h(t)&&!l(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(e,t){let s=e.get(t.question.id);const{clientID:r}=this.ctx.config.request;switch(t.command){case"addQuestion":s=this.createQuestion(t.question),e.set(t.question.id,s),this.emitter.emit("questionAdd",{question:s,selfSent:s.sender.endpointID===r});break;case"dismissQuestion":if(!s)break;s.sender.endpointID!==r?s.status="close":s.isTop=!1,e.set(t.question.id,s),this.emitter.emit("questionUpdate",{question:s});break;case"reopenQuestion":s?(s.status="open",s.isTop=t.question.isTop,e.set(t.question.id,s)):(s=this.createQuestion(t.question),e.set(t.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"updateQuestion":s?(s=Object.assign(Object.assign(Object.assign({},s),t.question),{topSort:t.question.isTop?this.data.topSort++:0}),e.set(t.question.id,s)):(s=this.createQuestion(t.question),e.set(t.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteQuestion":if(!s)break;s.sender.endpointID!==r?e.delete(t.question.id):(s.status="delete",s.isTop=!1,s.answers.clear(),e.set(t.question.id,s)),this.emitter.emit("questionDelete",{question:s});break;case"answerQuestion":s?s.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(s=this.createQuestion(t.question),s.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteAnswer":s&&(s.answers.delete(t.answer.id),this.emitter.emit("questionUpdate",{question:s}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/qa`,t)}))}},exports.Recording=class extends ${constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:s,stime:r}=e;if(s)return r&&(this.data.jetlag=r),this.data.isPracticeSession="started"===s.status&&this.data.status===s.status&&0===s.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),s),"starting"===s.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=s.status||this.data.status),this.data.resultInfo=s.resultInfo||{},["full","update"].includes(t)?(s.recordUsers&&(this.data.recording.recordUsers=s.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/designatedUsers`,t)}))}participantAdd(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/add`,t)}))}participantDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/delete`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}getByIds(t){return e(this,void 0,void 0,(function*(){const{prefix:{user:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/subject/getByIds`,t)}))}recordLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/layout`,t)}))}},exports.Setting=class extends ${constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:s}=e;["full","update"].includes(t)&&g(s,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}},exports.SpotlightVideo=class extends ${constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:t}=e;if(!t||!t.userIDs)return;this.data.userIDs=t.userIDs;t.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/view/spotlight`,e)}},exports.Transcript=class extends ${constructor(e){super(e,"transcript")}_topic(){return"transcript"}_bindOn(){this.ctx.emitter.on("transcriptMsg",(e=>{const{body:t}=e;this.emitter.emit("transcriptMsg",t)}))}cleanup(){this.emitter.all=new Map}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/transcript/historyMsg`,t)}))}},exports.Users=M,exports.View=class extends ${constructor(e){super(e,"view")}_topic(){const{endpointType:e,role:t}=this.ctx.modules.me.data;return e===exports.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:t===exports.ROLE.AUDIENCE?["audience"]:["hostAttendee","audience"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:s,body:r}=e;r&&("meetingView"===s?Object.keys(r).forEach((e=>{this.data[e]=r[e]})):this.data[t]=r)}updatePersonalLayouts(e){const{state:t,body:s}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),s.personalLayouts.forEach((e=>{const{subscriber:s={userID:-1}}=e,r=s.userID||s.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[r]=e:delete this.data.personalLayouts[r]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/layout/template/info`,{params:t})}))}addVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/add`,t)}))}editVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/edit`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}editTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/edit`,t)}))}addTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/add`,t)}))}deleteTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/delete`,t)}))}getDefaultTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getDefaultTemplates`,{params:t})}))}changeDefaultTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/changeDefaultTemplate`,t)}))}perspectiveBind(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/perspective/bind`,t)}))}},exports.Vote=class extends ${constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:s}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[s]=t,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:t})})),this.ctx.emitter.on(exports.MeEvent.LOBBYCHANGE,(e=>{e&&(this.data.vote={})}))}getVotes(e){const{prefix:{vote:t},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${s}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${s}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${s}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:s},meetingID:r,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${s}meetings/${r}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:s},meetingID:r,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${s}meetings/${r}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:s,voteTk:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${s}/vote/inProgress`,{params:{tk:e&&e.tk||r}})}},exports.Words=class extends ${constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:t,body:s}=e;if(!s)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data});"full"===t&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:s.content,time:(new Date).getTime(),durationType:s.durationType,duration:1e3*s.duration},...this.data.barrageRecord],s.wordsDisplayStatus=!0,-1!==s.duration&&(this.data.timer=setTimeout((()=>{s.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=s.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*s.duration)),g(s,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(exports.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}},exports.createMeeting=function(e){return e.singleton?W.getInstance(e).meeting:V(e)},exports.reset=F;
|