fcr-core 3.10.5 → 3.10.6

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.
Files changed (127) hide show
  1. package/lib/engine/index.js +108 -102
  2. package/lib/imports.js +0 -1
  3. package/lib/index.d.ts +1 -1
  4. package/lib/media-control/desktop.js +13 -22
  5. package/lib/media-control/mobile.js +13 -22
  6. package/lib/monitor-control/index.js +7 -17
  7. package/lib/peer-session/index.js +121 -120
  8. package/lib/plugins/chat/chatroom.js +96 -119
  9. package/lib/plugins/chat/connector.js +48 -69
  10. package/lib/remote-control/index.js +216 -194
  11. package/lib/room-control/ability-control/index.js +10 -20
  12. package/lib/room-control/application-control/index.js +75 -82
  13. package/lib/room-control/group-control/index.js +30 -31
  14. package/lib/room-control/helpers/board-init-info-helper.js +10 -16
  15. package/lib/room-control/helpers/validation-helper.js +1 -1
  16. package/lib/room-control/index.js +51 -70
  17. package/lib/room-control/infinity-room-control/index.js +19 -27
  18. package/lib/room-control/interpreter-control/index.js +65 -77
  19. package/lib/room-control/interpreter-control/room.js +4 -6
  20. package/lib/room-control/join-before-host-waitingroom-control/index.js +4 -6
  21. package/lib/room-control/mainroom-control/index.js +25 -37
  22. package/lib/room-control/privilege-control/helper.js +13 -28
  23. package/lib/room-control/privilege-control/index.js +28 -36
  24. package/lib/room-control/room-connector-control/index.js +47 -52
  25. package/lib/room-control/room-control-factory.js +12 -10
  26. package/lib/room-control/room-session/index.js +74 -77
  27. package/lib/room-control/shared-cache.js +56 -63
  28. package/lib/room-control/sharing-control/index.js +57 -65
  29. package/lib/room-control/stream-control/index.js +238 -203
  30. package/lib/room-control/stream-control/type.d.ts +11 -1
  31. package/lib/room-control/stt-control/de-compress-gzip.js +0 -10
  32. package/lib/room-control/stt-control/index.js +86 -93
  33. package/lib/room-control/user-control/index.js +155 -162
  34. package/lib/room-control/waitingroom-control/index.js +9 -18
  35. package/lib/room-control/whiteboard-control/utils.js +2 -4
  36. package/lib/room-control/whiteboard-control-v1/board-subwindow.js +1 -2
  37. package/lib/room-control/whiteboard-control-v1/board-window.js +103 -120
  38. package/lib/room-control/whiteboard-control-v1/factory.js +4 -7
  39. package/lib/room-control/whiteboard-control-v1/index.js +67 -80
  40. package/lib/room-control/whiteboard-control-v1/mount-manager.js +2 -4
  41. package/lib/room-control/whiteboard-control-v1/utils.js +14 -17
  42. package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +10 -14
  43. package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +8 -17
  44. package/lib/room-control/whiteboard-control-v2/base/index.js +53 -61
  45. package/lib/room-control/whiteboard-control-v2/base/main-window.js +30 -39
  46. package/lib/room-control/whiteboard-control-v2/utils.js +10 -10
  47. package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +33 -45
  48. package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +11 -27
  49. package/lib/room-control/widget-control/index.js +33 -43
  50. package/lib/room-router/index.js +58 -66
  51. package/lib/service/api.js +548 -446
  52. package/lib/struct.js +2 -5
  53. package/lib/type.d.ts +1 -1
  54. package/lib/utilities/abortable-retry.js +0 -3
  55. package/lib/utilities/collection.js +11 -15
  56. package/lib/utilities/error-helpers.js +27 -34
  57. package/lib/utilities/error.js +3 -4
  58. package/lib/utilities/join-helper.js +31 -37
  59. package/lib/utilities/logger.js +5 -8
  60. package/lib/utilities/parameters.js +10 -21
  61. package/lib/utilities/retry-helpers.js +0 -1
  62. package/lib/utilities/stream.js +11 -16
  63. package/lib/utilities/user.js +3 -4
  64. package/lib/utilities/validate-params.js +1 -1
  65. package/lib/utilities/video-encoder-config.js +5 -10
  66. package/lib-es/engine/index.js +108 -102
  67. package/lib-es/media-control/desktop.js +13 -22
  68. package/lib-es/media-control/mobile.js +13 -22
  69. package/lib-es/monitor-control/index.js +7 -16
  70. package/lib-es/peer-session/index.js +121 -120
  71. package/lib-es/plugins/chat/chatroom.js +95 -118
  72. package/lib-es/plugins/chat/connector.js +47 -67
  73. package/lib-es/remote-control/index.js +216 -194
  74. package/lib-es/room-control/ability-control/index.js +10 -19
  75. package/lib-es/room-control/application-control/index.js +75 -81
  76. package/lib-es/room-control/group-control/index.js +30 -31
  77. package/lib-es/room-control/helpers/board-init-info-helper.js +10 -15
  78. package/lib-es/room-control/helpers/validation-helper.js +1 -1
  79. package/lib-es/room-control/index.js +51 -69
  80. package/lib-es/room-control/infinity-room-control/index.js +19 -26
  81. package/lib-es/room-control/interpreter-control/index.js +65 -77
  82. package/lib-es/room-control/interpreter-control/room.js +4 -5
  83. package/lib-es/room-control/join-before-host-waitingroom-control/index.js +4 -5
  84. package/lib-es/room-control/mainroom-control/index.js +25 -37
  85. package/lib-es/room-control/privilege-control/helper.js +13 -27
  86. package/lib-es/room-control/privilege-control/index.js +28 -36
  87. package/lib-es/room-control/room-connector-control/index.js +47 -52
  88. package/lib-es/room-control/room-control-factory.js +12 -10
  89. package/lib-es/room-control/room-session/index.js +74 -77
  90. package/lib-es/room-control/shared-cache.js +56 -62
  91. package/lib-es/room-control/sharing-control/index.js +57 -64
  92. package/lib-es/room-control/stream-control/index.js +240 -205
  93. package/lib-es/room-control/stt-control/de-compress-gzip.js +0 -10
  94. package/lib-es/room-control/stt-control/index.js +86 -93
  95. package/lib-es/room-control/user-control/index.js +155 -162
  96. package/lib-es/room-control/waitingroom-control/index.js +9 -18
  97. package/lib-es/room-control/whiteboard-control/utils.js +2 -4
  98. package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +1 -2
  99. package/lib-es/room-control/whiteboard-control-v1/board-window.js +103 -120
  100. package/lib-es/room-control/whiteboard-control-v1/factory.js +4 -6
  101. package/lib-es/room-control/whiteboard-control-v1/index.js +67 -80
  102. package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +2 -3
  103. package/lib-es/room-control/whiteboard-control-v1/utils.js +14 -17
  104. package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +10 -13
  105. package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +8 -16
  106. package/lib-es/room-control/whiteboard-control-v2/base/index.js +53 -60
  107. package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +30 -39
  108. package/lib-es/room-control/whiteboard-control-v2/utils.js +10 -10
  109. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +33 -45
  110. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +11 -26
  111. package/lib-es/room-control/widget-control/index.js +33 -42
  112. package/lib-es/room-router/index.js +58 -66
  113. package/lib-es/service/api.js +548 -445
  114. package/lib-es/struct.js +2 -4
  115. package/lib-es/utilities/abortable-retry.js +0 -3
  116. package/lib-es/utilities/collection.js +11 -14
  117. package/lib-es/utilities/error-helpers.js +26 -33
  118. package/lib-es/utilities/error.js +3 -4
  119. package/lib-es/utilities/join-helper.js +29 -36
  120. package/lib-es/utilities/logger.js +5 -7
  121. package/lib-es/utilities/parameters.js +10 -21
  122. package/lib-es/utilities/retry-helpers.js +0 -1
  123. package/lib-es/utilities/stream.js +11 -15
  124. package/lib-es/utilities/user.js +3 -4
  125. package/lib-es/utilities/validate-params.js +1 -1
  126. package/lib-es/utilities/video-encoder-config.js +5 -10
  127. package/package.json +4 -4
@@ -1,4 +1,3 @@
1
- import "core-js/modules/es.symbol.description.js";
2
1
  import "core-js/modules/es.array.push.js";
3
2
  import "core-js/modules/esnext.function.metadata.js";
4
3
  import "core-js/modules/esnext.map.delete-all.js";
@@ -16,14 +15,8 @@ import "core-js/modules/esnext.map.reduce.js";
16
15
  import "core-js/modules/esnext.map.some.js";
17
16
  import "core-js/modules/esnext.map.update.js";
18
17
  import "core-js/modules/esnext.symbol.metadata.js";
19
- import "core-js/modules/web.dom-collections.iterator.js";
20
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
21
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
22
- var _FcrBaseWhiteboardControlImpl;
23
18
  let _initProto;
24
- import "core-js/modules/es.error.cause.js";
25
19
  import "core-js/modules/es.json.stringify.js";
26
- import "core-js/modules/es.regexp.exec.js";
27
20
  function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
28
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
29
22
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -44,31 +37,34 @@ import { FcrBoardMainWindowImpl } from './main-window';
44
37
 
45
38
  const WHITEBOARD_ROOM_JOIN_TIMEOUT = 20000;
46
39
  export class FcrBaseWhiteboardControlImpl {
40
+ static {
41
+ [_initProto] = _applyDecs(this, [[trace, 2, "open"], [trace, 2, "close"], [trace, 2, "release"], [trace, 2, "getConnectionState"], [trace, 2, "getMainWindow"]], []).e;
42
+ }
43
+ logger = (_initProto(this), createLogger({
44
+ prefix: 'FcrBaseWhiteboardControl'
45
+ }));
46
+ observable = new AgoraObservable();
47
+ boardView = null;
48
+ boardRoom = null;
49
+ whiteboard = null;
50
+ connectState = FcrConnectionState.DISCONNECTED;
51
+ boardRoomConfig = null;
52
+ _waitPromise = null;
53
+ _waitPromiseResolve = null;
54
+ _waitPromiseReject = null;
55
+ _openAbortController = null;
56
+ _openState = {
57
+ isOpen: false,
58
+ isNeedLaunch: undefined
59
+ };
47
60
  constructor(rtmClient, config, boardRoomConfigFetcher, api) {
48
- _defineProperty(this, "logger", (_initProto(this), createLogger({
49
- prefix: 'FcrBaseWhiteboardControl'
50
- })));
51
- _defineProperty(this, "observable", new AgoraObservable());
52
- _defineProperty(this, "boardView", null);
53
- _defineProperty(this, "boardRoom", null);
54
- _defineProperty(this, "whiteboard", null);
55
- _defineProperty(this, "connectState", FcrConnectionState.DISCONNECTED);
56
- _defineProperty(this, "boardRoomConfig", null);
57
- _defineProperty(this, "_waitPromise", null);
58
- _defineProperty(this, "_waitPromiseResolve", null);
59
- _defineProperty(this, "_waitPromiseReject", null);
60
- _defineProperty(this, "_openAbortController", null);
61
- _defineProperty(this, "_openState", {
62
- isOpen: false,
63
- isNeedLaunch: undefined
64
- });
65
61
  this.rtmClient = rtmClient;
66
62
  this.config = config;
67
63
  this.api = api;
68
64
  this.boardRoomConfigFetcherTask = AgoraScheduler.shared.addPollingTask(async () => {
69
65
  const boardRoomConfig = await boardRoomConfigFetcher();
70
66
  this.boardRoomConfig = boardRoomConfig;
71
- this.logger.info("fetch board room config success, config: ".concat(jsonstring(boardRoomConfig)));
67
+ this.logger.info(`fetch board room config success, config: ${jsonstring(boardRoomConfig)}`);
72
68
  this.boardRoomConfigFetcherTask.stop();
73
69
  if (this._openState.isOpen) {
74
70
  this.connect(this._openState.isNeedLaunch);
@@ -153,7 +149,7 @@ export class FcrBaseWhiteboardControlImpl {
153
149
  }
154
150
  const oldState = this.connectState;
155
151
  this.connectState = state;
156
- this.logger.info("Connection state updated: ".concat(FcrConnectionState[oldState], " -> ").concat(FcrConnectionState[state]));
152
+ this.logger.info(`Connection state updated: ${FcrConnectionState[oldState]} -> ${FcrConnectionState[state]}`);
157
153
  this.observable.notifyObservers('onConnectionStateUpdated', state);
158
154
  }
159
155
  async connect(isNeedLaunch) {
@@ -168,15 +164,18 @@ export class FcrBaseWhiteboardControlImpl {
168
164
  abortController.signal.addEventListener('abort', () => {
169
165
  reject(new Error('join board aborted'));
170
166
  });
171
- const _this$config = this.config,
172
- userId = _this$config.userId,
173
- userName = _this$config.userName,
174
- ipList = _this$config.ipList;
175
- const _ref = this.boardRoomConfig || {},
176
- boardAppId = _ref.boardAppId,
177
- boardId = _ref.boardId,
178
- boardRegion = _ref.boardRegion,
179
- boardToken = _ref.boardToken;
167
+ const {
168
+ userId,
169
+ userName,
170
+ ipList
171
+ } = this.config;
172
+ const {
173
+ boardAppId,
174
+ boardId,
175
+ boardRegion,
176
+ boardToken
177
+ // boardPerformance = false,
178
+ } = this.boardRoomConfig || {};
180
179
  if (!boardAppId) {
181
180
  throw generateFcrCoreClientError(ErrorModuleCode.FCR_ROOM_WHITEBOARD, DetailErrorCode.UNDEFINED_ERROR, 'boardAppId is required');
182
181
  }
@@ -190,21 +189,21 @@ export class FcrBaseWhiteboardControlImpl {
190
189
  let width = whiteboardOption.width;
191
190
  let height = whiteboardOption.height;
192
191
  if (!width) {
193
- this.logger.warn("board width is a invalid vlaue: ".concat(width, ", using default value 800"));
192
+ this.logger.warn(`board width is a invalid vlaue: ${width}, using default value 800`);
194
193
  whiteboardOption.width = 800;
195
194
  }
196
195
  if (!height) {
197
- this.logger.warn("board height is a invalid value: ".concat(height, ", using default value 600"));
196
+ this.logger.warn(`board height is a invalid value: ${height}, using default value 600`);
198
197
  whiteboardOption.height = 600;
199
198
  }
200
- this.logger.info("open board with boardId: ".concat(boardId, ", boardToken: ").concat(boardToken, ", region: ").concat(boardRegion, ", appIdentifier: ").concat(boardAppId, " whiteboardOption: ").concat(jsonstring(whiteboardOption)));
199
+ this.logger.info(`open board with boardId: ${boardId}, boardToken: ${boardToken}, region: ${boardRegion}, appIdentifier: ${boardAppId} whiteboardOption: ${jsonstring(whiteboardOption)}`);
201
200
  let endpoint = undefined;
202
201
  if (ipList !== undefined) {
203
202
  if (Array.isArray(ipList) && ipList[0]) {
204
- this.logger.info("use ipList from config: ".concat(jsonstring(ipList)));
203
+ this.logger.info(`use ipList from config: ${jsonstring(ipList)}`);
205
204
  endpoint = ipList[0];
206
205
  } else {
207
- this.logger.error("ipList in config is empty or invalid: ".concat(jsonstring(ipList), ", ignore ipList config"));
206
+ this.logger.error(`ipList in config is empty or invalid: ${jsonstring(ipList)}, ignore ipList config`);
208
207
  }
209
208
  }
210
209
  const rtmProvider = new RTMProvider_2_2(this.rtmClient);
@@ -223,14 +222,14 @@ export class FcrBaseWhiteboardControlImpl {
223
222
  // 第一个开启白板的人需要调用 launch 方法, 其他人监听 launch 事件获取白板实例
224
223
  if (isNeedLaunch) {
225
224
  getWhiteboard = () => {
226
- this.logger.info("ApplicationManager.launchApplication calling, appId: ".concat(appId, ", option: ").concat(jsonstring(whiteboardOption)));
225
+ this.logger.info(`ApplicationManager.launchApplication calling, appId: ${appId}, option: ${jsonstring(whiteboardOption)}`);
227
226
  return wbRoom.applicationManager.launchApplication(WhiteboardApplication, whiteboardOption, appId);
228
227
  };
229
228
  } else {
230
229
  const launchPromise = new Promise((launchPromseResolve, launchPromseReject) => {
231
230
  this.logger.info('ApplicationManager.once launch event listening');
232
231
  wbRoom.applicationManager.once('launch', (appId, app) => {
233
- this.logger.info("ApplicationManager.launch event received, appId: ".concat(appId));
232
+ this.logger.info(`ApplicationManager.launch event received, appId: ${appId}`);
234
233
  launchPromseResolve(app);
235
234
  });
236
235
  });
@@ -238,7 +237,7 @@ export class FcrBaseWhiteboardControlImpl {
238
237
  return launchPromise;
239
238
  };
240
239
  }
241
- var _await$to = await to(retryAttempt(async () => {
240
+ [error] = await to(retryAttempt(async () => {
242
241
  const joinRoomParams = {
243
242
  userId,
244
243
  nickName: userName || userId,
@@ -251,7 +250,7 @@ export class FcrBaseWhiteboardControlImpl {
251
250
  writable: true
252
251
  // verboseLog: true,
253
252
  };
254
- this.logger.info("Room.joinRoom calling, params: ".concat(jsonstring(joinRoomParams), ", timeout: ").concat(WHITEBOARD_ROOM_JOIN_TIMEOUT));
253
+ this.logger.info(`Room.joinRoom calling, params: ${jsonstring(joinRoomParams)}, timeout: ${WHITEBOARD_ROOM_JOIN_TIMEOUT}`);
255
254
 
256
255
  // 20 秒超时
257
256
  await wbRoom.joinRoom(joinRoomParams, WHITEBOARD_ROOM_JOIN_TIMEOUT);
@@ -260,29 +259,28 @@ export class FcrBaseWhiteboardControlImpl {
260
259
  if (isNeedLaunch) {
261
260
  // 在同一个房间内只有第一次调用 launchApplication 时传入的宽高参数会生效, 后续的调用不会生效, 所以需要在这里更新宽高
262
261
  // 只有 launch 的用户需要更新宽、高, 白板会自动同步给后加入的用户
263
- this.logger.info("Whiteboard.updateViewport calling, width: ".concat(width, ", height: ").concat(height));
262
+ this.logger.info(`Whiteboard.updateViewport calling, width: ${width}, height: ${height}`);
264
263
  whiteboard.updateViewport(width, height);
265
264
  }
266
265
  }, [], {
267
266
  retriesMax: 0
268
- }).fail(async _ref2 => {
269
- let error = _ref2.error,
270
- timeFn = _ref2.timeFn,
271
- currentRetry = _ref2.currentRetry;
267
+ }).fail(async ({
268
+ error,
269
+ timeFn,
270
+ currentRetry
271
+ }) => {
272
272
  if (abortController.signal.aborted) {
273
273
  throw new Error('join board aborted');
274
274
  }
275
- this.logger.error("failed to join board, error: ".concat(error.message, ", current retry: ").concat(currentRetry), error);
275
+ this.logger.error(`failed to join board, error: ${error.message}, current retry: ${currentRetry}`, error);
276
276
  await timeFn();
277
277
  return true;
278
278
  }).exec());
279
- var _await$to2 = _slicedToArray(_await$to, 1);
280
- error = _await$to2[0];
281
279
  if (abortController.signal.aborted) {
282
280
  throw new Error('join board aborted');
283
281
  }
284
282
  if (error) {
285
- this.logger.error("join board failed, ".concat(error.message, "-").concat(JSON.stringify(error)));
283
+ this.logger.error(`join board failed, ${error.message}-${JSON.stringify(error)}`);
286
284
  throw error;
287
285
  }
288
286
  this.logger.info('Whiteboard camera settings: enableCameraByMouse=false, enableCameraByTouch=false');
@@ -310,7 +308,7 @@ export class FcrBaseWhiteboardControlImpl {
310
308
  this._clearWaitPromise();
311
309
  }
312
310
  } catch (e) {
313
- this.logger.error("join board failed");
311
+ this.logger.error(`join board failed`);
314
312
  this.updateConnectionState(FcrConnectionState.DISCONNECTED);
315
313
  reject(e);
316
314
  if (this._waitPromiseReject) {
@@ -349,9 +347,4 @@ export class FcrBaseWhiteboardControlImpl {
349
347
  this._waitPromiseReject = null;
350
348
  this._waitPromise = null;
351
349
  }
352
- }
353
- _FcrBaseWhiteboardControlImpl = FcrBaseWhiteboardControlImpl;
354
- var _applyDecs$e = _applyDecs(_FcrBaseWhiteboardControlImpl, [[trace, 2, "open"], [trace, 2, "close"], [trace, 2, "release"], [trace, 2, "getConnectionState"], [trace, 2, "getMainWindow"]], []).e;
355
- var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
356
- _initProto = _applyDecs$e2[0];
357
- _applyDecs$e;
350
+ }
@@ -1,4 +1,3 @@
1
- import "core-js/modules/es.symbol.description.js";
2
1
  import "core-js/modules/es.array.push.js";
3
2
  import "core-js/modules/esnext.function.metadata.js";
4
3
  import "core-js/modules/esnext.map.delete-all.js";
@@ -16,12 +15,7 @@ import "core-js/modules/esnext.map.reduce.js";
16
15
  import "core-js/modules/esnext.map.some.js";
17
16
  import "core-js/modules/esnext.map.update.js";
18
17
  import "core-js/modules/esnext.symbol.metadata.js";
19
- import "core-js/modules/web.dom-collections.iterator.js";
20
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
21
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
22
- var _FcrBoardMainWindowImpl;
23
- let _initProto, _setBackgroundColorDecs, _setToolTypeDecs, _setStrokeWidthDecs, _setStrokeColorDecs, _setTextColorDecs, _setTextSizeDecs, _insertImageDecs, _setContainerSizeRatioDecs, _setBoardTransparentDecs, _updateWindowSizeDecs, _setAutoCancelDrawDecs, _handleApplicationLaunchDecs, _handleApplicationTerminalDecs, _enableAutoCancelDecs, _ref;
24
- import "core-js/modules/es.error.cause.js";
18
+ let _initProto, _setBackgroundColorDecs, _setToolTypeDecs, _setStrokeWidthDecs, _setStrokeColorDecs, _setTextColorDecs, _setTextSizeDecs, _insertImageDecs, _setContainerSizeRatioDecs, _setBoardTransparentDecs, _updateWindowSizeDecs, _setAutoCancelDrawDecs, _handleApplicationLaunchDecs, _handleApplicationTerminalDecs, _enableAutoCancelDecs;
25
19
  function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
26
20
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
27
21
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -38,17 +32,19 @@ import { bound } from 'agora-foundation/lib/decorator';
38
32
  import { FcrReturnCode } from '../../../type';
39
33
  import { handleRequestError } from '../../../utilities/error';
40
34
  import { ErrorModuleCode } from '../../../imports';
41
- _ref = (_setBackgroundColorDecs = [trace(['color']), validateParams(stringSchema)], _setToolTypeDecs = [trace(['type']), validateParams(fcrBoardToolTypeSchema)], _setStrokeWidthDecs = [trace(['strokeWidth']), validateParams(numberSchema)], _setStrokeColorDecs = [trace(['color']), validateParams(z.union([colorSchema, stringSchema]))], _setTextColorDecs = [trace(['color']), validateParams(colorSchema)], _setTextSizeDecs = [trace(['textSize']), validateParams(numberSchema)], _insertImageDecs = [trace(['resourceUrl', 'x', 'y', 'width', 'height']), validateParams(stringSchema, numberSchema, numberSchema, numberSchema, numberSchema)], _setContainerSizeRatioDecs = [trace(['ratio']), validateParams(numberSchema)], _setBoardTransparentDecs = [trace(['isTransparent']), validateParams(booleanSchema)], _updateWindowSizeDecs = [trace(['size']), validateParams(fcrSizeSchema)], _setAutoCancelDrawDecs = [trace(['enable']), validateParams(booleanSchema)], _handleApplicationLaunchDecs = [bound, trace(['appId', 'app'])], _handleApplicationTerminalDecs = [bound, trace(['appId', 'app'])], _enableAutoCancelDecs = trace(['enable']), "logger");
42
35
  export class FcrBoardMainWindowImpl {
36
+ static {
37
+ [_initProto] = _applyDecs(this, [[trace, 2, "addPage"], [trace, 2, "removePage"], [trace, 2, "undo"], [trace, 2, "redo"], [trace, 2, "clean"], [trace, 2, "getSnapshotImage"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [trace, 2, "getPageInfo"], [trace, 2, "prevPage"], [trace, 2, "nextPage"], [_setToolTypeDecs, 2, "setToolType"], [_setStrokeWidthDecs, 2, "setStrokeWidth"], [_setStrokeColorDecs, 2, "setStrokeColor"], [_setTextColorDecs, 2, "setTextColor"], [_setTextSizeDecs, 2, "setTextSize"], [_insertImageDecs, 2, "insertImage"], [trace, 2, "getContentView"], [_setContainerSizeRatioDecs, 2, "setContainerSizeRatio"], [_setBoardTransparentDecs, 2, "setBoardTransparent"], [_updateWindowSizeDecs, 2, "updateWindowSize"], [_setAutoCancelDrawDecs, 2, "setAutoCancelDraw"], [trace, 2, "getWritable"], [_handleApplicationLaunchDecs, 2, "_handleApplicationLaunch"], [_handleApplicationTerminalDecs, 2, "_handleApplicationTerminal"], [_enableAutoCancelDecs, 2, "_enableAutoCancel"]], []).e;
38
+ }
39
+ [(_setBackgroundColorDecs = [trace(['color']), validateParams(stringSchema)], _setToolTypeDecs = [trace(['type']), validateParams(fcrBoardToolTypeSchema)], _setStrokeWidthDecs = [trace(['strokeWidth']), validateParams(numberSchema)], _setStrokeColorDecs = [trace(['color']), validateParams(z.union([colorSchema, stringSchema]))], _setTextColorDecs = [trace(['color']), validateParams(colorSchema)], _setTextSizeDecs = [trace(['textSize']), validateParams(numberSchema)], _insertImageDecs = [trace(['resourceUrl', 'x', 'y', 'width', 'height']), validateParams(stringSchema, numberSchema, numberSchema, numberSchema, numberSchema)], _setContainerSizeRatioDecs = [trace(['ratio']), validateParams(numberSchema)], _setBoardTransparentDecs = [trace(['isTransparent']), validateParams(booleanSchema)], _updateWindowSizeDecs = [trace(['size']), validateParams(fcrSizeSchema)], _setAutoCancelDrawDecs = [trace(['enable']), validateParams(booleanSchema)], _handleApplicationLaunchDecs = [bound, trace(['appId', 'app'])], _handleApplicationTerminalDecs = [bound, trace(['appId', 'app'])], _enableAutoCancelDecs = trace(['enable']), "logger")] = (_initProto(this), createLogger({
40
+ prefix: 'FcrBoardMainWindowImpl'
41
+ }));
42
+ _observable = new AgoraObservable();
43
+ _currentPage = 0;
44
+ _background = 'rgba(0, 0, 0, 0)';
45
+ _isAutoCancelEnabled = false;
46
+ _isWritable = false;
43
47
  constructor(whiteboard, boardRoom, appId, _roomId, _userId, _api) {
44
- _defineProperty(this, _ref, (_initProto(this), createLogger({
45
- prefix: 'FcrBoardMainWindowImpl'
46
- })));
47
- _defineProperty(this, "_observable", new AgoraObservable());
48
- _defineProperty(this, "_currentPage", 0);
49
- _defineProperty(this, "_background", 'rgba(0, 0, 0, 0)');
50
- _defineProperty(this, "_isAutoCancelEnabled", false);
51
- _defineProperty(this, "_isWritable", false);
52
48
  this._roomId = _roomId;
53
49
  this._userId = _userId;
54
50
  this._api = _api;
@@ -56,8 +52,8 @@ export class FcrBoardMainWindowImpl {
56
52
  this._boardView = document.createElement('div');
57
53
  this._boardView.classList.add('fcr-whiteboard-window-view');
58
54
  this._boardView.appendChild(whiteboard.view);
59
- this._boardView.style.height = "100%";
60
- this._boardView.style.width = "100%";
55
+ this._boardView.style.height = `100%`;
56
+ this._boardView.style.width = `100%`;
61
57
  this._boardView.setAttribute('data-app-id', appId);
62
58
  this._whiteboard = whiteboard;
63
59
  this._boardRoom = boardRoom;
@@ -67,17 +63,17 @@ export class FcrBoardMainWindowImpl {
67
63
  boardRoom.applicationManager.on('terminal', this._handleApplicationTerminal);
68
64
 
69
65
  // @ts-ignore
70
- this.logger.info("initialized, room: ".concat(boardRoom.roomId));
66
+ this.logger.info(`initialized, room: ${boardRoom.roomId}`);
71
67
  }
72
68
  internalSetWritable(isWritable) {
73
- this.logger.info("internalSetWritable called, isWritable: ".concat(isWritable, ", previous state: ").concat(this._isWritable));
69
+ this.logger.info(`internalSetWritable called, isWritable: ${isWritable}, previous state: ${this._isWritable}`);
74
70
  this._boardRoom.setWritable(isWritable);
75
71
  this._isWritable = isWritable;
76
72
  this._observable.notifyObservers('onWritable', isWritable);
77
- this.logger.info("Writable state updated to ".concat(isWritable));
73
+ this.logger.info(`Writable state updated to ${isWritable}`);
78
74
  }
79
75
  async setWritable(isWritable) {
80
- this.logger.info("setWritable called, isWritable: ".concat(isWritable, ", current state: ").concat(this._isWritable));
76
+ this.logger.info(`setWritable called, isWritable: ${isWritable}, current state: ${this._isWritable}`);
81
77
  if (!this._api) {
82
78
  // api deops not exist in sub process, directly set writable state
83
79
  this.internalSetWritable(isWritable);
@@ -87,8 +83,8 @@ export class FcrBoardMainWindowImpl {
87
83
  roomId: this._roomId,
88
84
  userId: this._userId,
89
85
  state: isWritable ? 1 : 0
90
- }), ErrorModuleCode.FCR_ROOM_WHITEBOARD, "set whiteboard write permission to ".concat(isWritable, " failed"));
91
- this.logger.info("Set writable to ".concat(isWritable, " successfully"));
86
+ }), ErrorModuleCode.FCR_ROOM_WHITEBOARD, `set whiteboard write permission to ${isWritable} failed`);
87
+ this.logger.info(`Set writable to ${isWritable} successfully`);
92
88
  this.internalSetWritable(isWritable);
93
89
  return FcrReturnCode.SUCCESS;
94
90
  }
@@ -142,7 +138,7 @@ export class FcrBoardMainWindowImpl {
142
138
  }
143
139
  async setBackgroundColor(color) {
144
140
  this._background = color;
145
- this.logger.info("set canvas background color: ".concat(this._background));
141
+ this.logger.info(`set canvas background color: ${this._background}`);
146
142
  this._whiteboard.setCanvasBackgroundColor(color);
147
143
  return FcrReturnCode.SUCCESS;
148
144
  }
@@ -178,7 +174,7 @@ export class FcrBoardMainWindowImpl {
178
174
  return FcrReturnCode.SUCCESS;
179
175
  }
180
176
  async setStrokeColor(color) {
181
- const c = typeof color === 'string' ? color : "rgb(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ")");
177
+ const c = typeof color === 'string' ? color : `rgb(${color.r},${color.g},${color.b})`;
182
178
  if (this._whiteboard) {
183
179
  this._whiteboard.strokeColor = c;
184
180
  } else {
@@ -187,7 +183,7 @@ export class FcrBoardMainWindowImpl {
187
183
  return FcrReturnCode.SUCCESS;
188
184
  }
189
185
  async setTextColor(color) {
190
- const c = typeof color === 'string' ? color : "rgb(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ")");
186
+ const c = typeof color === 'string' ? color : `rgb(${color.r},${color.g},${color.b})`;
191
187
  if (this._whiteboard) {
192
188
  this._whiteboard.fillColor = c;
193
189
  } else {
@@ -255,7 +251,7 @@ export class FcrBoardMainWindowImpl {
255
251
  this._whiteboard = app;
256
252
  this._setBoardViewStyle(app.view);
257
253
  if (this._background) {
258
- this.logger.info("set canvas background color: ".concat(this._background));
254
+ this.logger.info(`set canvas background color: ${this._background}`);
259
255
  this._whiteboard.setCanvasBackgroundColor(this._background);
260
256
  }
261
257
  this._enableAutoCancel(this._isAutoCancelEnabled);
@@ -270,19 +266,19 @@ export class FcrBoardMainWindowImpl {
270
266
  _handleApplicationTerminal(appId, app) {
271
267
  try {
272
268
  if (this._boardView.contains(app.view)) {
273
- this.logger.info("remove application view: ".concat(appId));
269
+ this.logger.info(`remove application view: ${appId}`);
274
270
  this._boardView.removeChild(app.view);
275
271
  } else {
276
- this.logger.warn("application view not found in board view: ".concat(appId));
272
+ this.logger.warn(`application view not found in board view: ${appId}`);
277
273
  }
278
274
  } catch (e) {
279
- this.logger.error("failed to handle terminal: ".concat(appId), e);
275
+ this.logger.error(`failed to handle terminal: ${appId}`, e);
280
276
  }
281
277
  return FcrReturnCode.SUCCESS;
282
278
  }
283
279
  _setBoardViewStyle(view) {
284
- view.style.height = "100%";
285
- view.style.width = "100%";
280
+ view.style.height = `100%`;
281
+ view.style.width = `100%`;
286
282
  view.style.backgroundColor = 'rgba(0, 0, 0, 0)';
287
283
  }
288
284
  _enableAutoCancel(enable) {
@@ -295,9 +291,4 @@ export class FcrBoardMainWindowImpl {
295
291
  _addLogObserver() {
296
292
  this.addObserver(generateLogObserver(this.logger, [['onWritable', ['isWritable']], ['onPageInfoUpdated', ['info']], ['onUndoStateUpdated', ['enable']], ['onRedoStateUpdated', ['enable']]]));
297
293
  }
298
- }
299
- _FcrBoardMainWindowImpl = FcrBoardMainWindowImpl;
300
- var _applyDecs$e = _applyDecs(_FcrBoardMainWindowImpl, [[trace, 2, "addPage"], [trace, 2, "removePage"], [trace, 2, "undo"], [trace, 2, "redo"], [trace, 2, "clean"], [trace, 2, "getSnapshotImage"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [trace, 2, "getPageInfo"], [trace, 2, "prevPage"], [trace, 2, "nextPage"], [_setToolTypeDecs, 2, "setToolType"], [_setStrokeWidthDecs, 2, "setStrokeWidth"], [_setStrokeColorDecs, 2, "setStrokeColor"], [_setTextColorDecs, 2, "setTextColor"], [_setTextSizeDecs, 2, "setTextSize"], [_insertImageDecs, 2, "insertImage"], [trace, 2, "getContentView"], [_setContainerSizeRatioDecs, 2, "setContainerSizeRatio"], [_setBoardTransparentDecs, 2, "setBoardTransparent"], [_updateWindowSizeDecs, 2, "updateWindowSize"], [_setAutoCancelDrawDecs, 2, "setAutoCancelDraw"], [trace, 2, "getWritable"], [_handleApplicationLaunchDecs, 2, "_handleApplicationLaunch"], [_handleApplicationTerminalDecs, 2, "_handleApplicationTerminal"], [_enableAutoCancelDecs, 2, "_enableAutoCancel"]], []).e;
301
- var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
302
- _initProto = _applyDecs$e2[0];
303
- _applyDecs$e;
294
+ }
@@ -40,11 +40,11 @@ export const getAnnotationConfigFromRoomProperties = (properties, logger) => {
40
40
  let width = get(properties, 'widgets.annotation.size.width');
41
41
  let height = get(properties, 'widgets.annotation.size.height');
42
42
  if (typeof width !== 'number') {
43
- logger.warn("got invalid width for annotation board, width: ".concat(width));
43
+ logger.warn(`got invalid width for annotation board, width: ${width}`);
44
44
  width = 0;
45
45
  }
46
46
  if (typeof height !== 'number') {
47
- logger.warn("got invalid height for annotation board, height: ".concat(height));
47
+ logger.warn(`got invalid height for annotation board, height: ${height}`);
48
48
  height = 0;
49
49
  }
50
50
  const boardWidthVal = width;
@@ -52,20 +52,21 @@ export const getAnnotationConfigFromRoomProperties = (properties, logger) => {
52
52
  let boardWidth = 0;
53
53
  let boardHeight = 0;
54
54
  if (boardWidthVal !== 0 && boardHeightVal !== 0) {
55
- var _resizeToMax = resizeToMax(boardWidthVal, boardHeightVal, FCR_ANNOTATION_SCALE_BASE);
56
- boardWidth = _resizeToMax.width;
57
- boardHeight = _resizeToMax.height;
55
+ ({
56
+ width: boardWidth,
57
+ height: boardHeight
58
+ } = resizeToMax(boardWidthVal, boardHeightVal, FCR_ANNOTATION_SCALE_BASE));
58
59
  } else {
59
- logger.warn("got invalid width or height for annotation board, skip resizing, width: ".concat(boardWidthVal, ", height: ").concat(boardHeightVal));
60
+ logger.warn(`got invalid width or height for annotation board, skip resizing, width: ${boardWidthVal}, height: ${boardHeightVal}`);
60
61
  }
61
- logger.info("got board config info, ".concat(jsonstring({
62
+ logger.info(`got board config info, ${jsonstring({
62
63
  boardAppId,
63
64
  boardId,
64
65
  boardToken,
65
66
  boardRegion,
66
67
  boardWidth,
67
68
  boardHeight
68
- })));
69
+ })}`);
69
70
  return {
70
71
  size: {
71
72
  width: boardWidth,
@@ -79,8 +80,7 @@ export const getAnnotationConfigFromRoomProperties = (properties, logger) => {
79
80
  }
80
81
  };
81
82
  };
82
- export const resizeToMax = function (w, h) {
83
- let scaleBase = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : FCR_ANNOTATION_SCALE_BASE;
83
+ export const resizeToMax = (w, h, scaleBase = FCR_ANNOTATION_SCALE_BASE) => {
84
84
  const scale = scaleBase / Math.max(w, h);
85
85
  return {
86
86
  width: Math.round(w * scale),
@@ -1,10 +1,5 @@
1
- import "core-js/modules/es.symbol.description.js";
2
- import "core-js/modules/es.error.cause.js";
3
1
  import "core-js/modules/es.array.push.js";
4
2
  import "core-js/modules/esnext.function.metadata.js";
5
- import "core-js/modules/esnext.iterator.constructor.js";
6
- import "core-js/modules/esnext.iterator.filter.js";
7
- import "core-js/modules/esnext.iterator.for-each.js";
8
3
  import "core-js/modules/esnext.map.delete-all.js";
9
4
  import "core-js/modules/esnext.map.emplace.js";
10
5
  import "core-js/modules/esnext.map.every.js";
@@ -20,13 +15,7 @@ import "core-js/modules/esnext.map.reduce.js";
20
15
  import "core-js/modules/esnext.map.some.js";
21
16
  import "core-js/modules/esnext.map.update.js";
22
17
  import "core-js/modules/esnext.symbol.metadata.js";
23
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
24
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
25
- var _FcrWhiteboardControlImpl, _FcrStandaloneWhiteboardControlImpl;
26
- let _initProto, _setBackgroundColorDecs, _ref, _initProto2;
27
- import "core-js/modules/web.dom-collections.iterator.js";
28
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
+ let _initProto, _setBackgroundColorDecs, _initProto2;
30
19
  function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
31
20
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
32
21
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -46,25 +35,27 @@ import { FcrBoardPropertiesState } from '../../whiteboard-control/type';
46
35
  import { FcrBaseWhiteboardControlImpl } from '../base';
47
36
  import { WHITEBOARD_APP_ID } from '../constant';
48
37
  import { WHITEBOARD_HEIGHT, WHITEBOARD_WIDTH } from '../utils';
49
- _ref = (_setBackgroundColorDecs = [trace(['backgroundColor']), validateParams(stringSchema)], "logger");
50
38
  export class FcrWhiteboardControlImpl extends FcrBaseWhiteboardControlImpl {
39
+ static {
40
+ [_initProto] = _applyDecs(this, [[trace, 2, "open"], [trace, 2, "close"], [trace, 2, "release"], [trace, 2, "active"], [trace, 2, "inactive"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [trace, 2, "getBackgroundColor"], [trace, 2, "getActivity"], [trace, 2, "getOwnerId"], [bound, 2, "_onScenePropertiesUpdated"]], [], 0, void 0, FcrBaseWhiteboardControlImpl).e;
41
+ }
42
+ [(_setBackgroundColorDecs = [trace(['backgroundColor']), validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
43
+ prefix: 'FcrWhiteboardControlImpl'
44
+ }));
45
+ _backgroundColor = '#ffffff';
46
+ _isActive = false;
47
+ _ownerId = null;
48
+ _preloadLock = false;
49
+ _notifyObservers = {
50
+ onScenePropertiesUpdated: this._onScenePropertiesUpdated
51
+ };
51
52
  constructor(rtmClient, config, sharedCache, boardRoomConfigFetcher, _scene, _api) {
52
53
  super(rtmClient, config, boardRoomConfigFetcher, _api);
53
- _defineProperty(this, _ref, (_initProto(this), createLogger({
54
- prefix: 'FcrWhiteboardControlImpl'
55
- })));
56
- _defineProperty(this, "_backgroundColor", '#ffffff');
57
- _defineProperty(this, "_isActive", false);
58
- _defineProperty(this, "_ownerId", null);
59
- _defineProperty(this, "_preloadLock", false);
60
- _defineProperty(this, "_notifyObservers", {
61
- onScenePropertiesUpdated: this._onScenePropertiesUpdated
62
- });
63
54
  this._scene = _scene;
64
55
  this._api = _api;
65
56
  this._roomCache = sharedCache.getRoomCache(config.roomId);
66
57
  this._scene.addObserver(this._notifyObservers);
67
- this.logger.info("Whitebaord Version: forge-whiteboard@".concat(getDependenciesInfo('@netless/forge-whiteboard'), ", forge-room@").concat(getDependenciesInfo('@netless/forge-room'), ", forge-room@").concat(getDependenciesInfo('@netless/forge-rtm')));
58
+ this.logger.info(`Whitebaord Version: forge-whiteboard@${getDependenciesInfo('@netless/forge-whiteboard')}, forge-room@${getDependenciesInfo('@netless/forge-room')}, forge-room@${getDependenciesInfo('@netless/forge-rtm')}`);
68
59
  this._isActive = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard').state === 1;
69
60
  const backgroundColor = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.extra.backgroundColor');
70
61
  if (backgroundColor) {
@@ -115,9 +106,10 @@ export class FcrWhiteboardControlImpl extends FcrBaseWhiteboardControlImpl {
115
106
  return handleRequestError(() => this._api.toggleWhiteboardActivityState(this.config.roomId, FcrSharePermissionState.OFF), ErrorModuleCode.FCR_ROOM_WHITEBOARD, 'inactive failed');
116
107
  }
117
108
  getBoardActiveInfo() {
118
- const _ref2 = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard'),
119
- state = _ref2.state,
120
- ownerUserId = _ref2.ownerUserUuid;
109
+ const {
110
+ state,
111
+ ownerUserUuid: ownerUserId
112
+ } = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard');
121
113
  if (state === FcrBoardPropertiesState.ACTIVE) {
122
114
  return {
123
115
  isActive: true,
@@ -157,12 +149,11 @@ export class FcrWhiteboardControlImpl extends FcrBaseWhiteboardControlImpl {
157
149
  const operatorUser = convertRteUserToFcrUser(event.operatorUser, this._roomCache);
158
150
  const getByKeyPath = value => this._scene.getScenePropertiesByKeyPath(value);
159
151
  if (event.cause && event.cause.cmd === 10) {
160
- var _getByKeyPath;
161
152
  const causeData = event.cause.data;
162
- if (causeData !== null && causeData !== void 0 && causeData.widgetUuid && causeData.widgetUuid !== 'netlessBoard') {
153
+ if (causeData?.widgetUuid && causeData.widgetUuid !== 'netlessBoard') {
163
154
  return;
164
155
  }
165
- const state = (_getByKeyPath = getByKeyPath('widgets.netlessBoard.state')) !== null && _getByKeyPath !== void 0 ? _getByKeyPath : FcrBoardPropertiesState.INACTIVE;
156
+ const state = getByKeyPath('widgets.netlessBoard.state') ?? FcrBoardPropertiesState.INACTIVE;
166
157
  const backgroundColor = getByKeyPath('widgets.netlessBoard.extra.backgroundColor');
167
158
  const widgetCauseReason = get(event.cause.data, 'widgetCause.data.reason');
168
159
  const widgetCauseCmd = get(event.cause.data, 'widgetCause.cmd');
@@ -190,21 +181,22 @@ export class FcrWhiteboardControlImpl extends FcrBaseWhiteboardControlImpl {
190
181
  }
191
182
  }
192
183
  getWhiteboardOption() {
193
- return _objectSpread(_objectSpread({}, super.getWhiteboardOption()), {}, {
184
+ return {
185
+ ...super.getWhiteboardOption(),
194
186
  width: WHITEBOARD_WIDTH,
195
187
  height: WHITEBOARD_HEIGHT
196
- });
188
+ };
197
189
  }
198
190
  addLogObserver() {
199
191
  this.addObserver(generateLogObserver(this.logger, [['onConnectionStateUpdated', ['state']], ['onActive', ['ownerId', 'operatorUser']], ['onInactive', ['reason', 'operatorUser']], ['onBackgroundColorUpdated', ['color', 'operatorUser']]]));
200
192
  }
201
193
  }
202
- _FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
203
- var _applyDecs$e = _slicedToArray(_applyDecs(_FcrWhiteboardControlImpl, [[trace, 2, "open"], [trace, 2, "close"], [trace, 2, "release"], [trace, 2, "active"], [trace, 2, "inactive"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [trace, 2, "getBackgroundColor"], [trace, 2, "getActivity"], [trace, 2, "getOwnerId"], [bound, 2, "_onScenePropertiesUpdated"]], [], 0, void 0, FcrBaseWhiteboardControlImpl).e, 1);
204
- _initProto = _applyDecs$e[0];
205
194
  export class FcrStandaloneWhiteboardControlImpl extends FcrBaseWhiteboardControlImpl {
206
- constructor() {
207
- super(...arguments);
195
+ static {
196
+ [_initProto2] = _applyDecs(this, [[trace, 2, "open"], [trace, 2, "release"]], [], 0, void 0, FcrBaseWhiteboardControlImpl).e;
197
+ }
198
+ constructor(...args) {
199
+ super(...args);
208
200
  _initProto2(this);
209
201
  }
210
202
  async open() {
@@ -217,14 +209,10 @@ export class FcrStandaloneWhiteboardControlImpl extends FcrBaseWhiteboardControl
217
209
  return WHITEBOARD_APP_ID;
218
210
  }
219
211
  getWhiteboardOption() {
220
- return _objectSpread(_objectSpread({}, super.getWhiteboardOption()), {}, {
212
+ return {
213
+ ...super.getWhiteboardOption(),
221
214
  width: WHITEBOARD_WIDTH,
222
215
  height: WHITEBOARD_HEIGHT
223
- });
216
+ };
224
217
  }
225
- }
226
- _FcrStandaloneWhiteboardControlImpl = FcrStandaloneWhiteboardControlImpl;
227
- var _applyDecs$e2 = _applyDecs(_FcrStandaloneWhiteboardControlImpl, [[trace, 2, "open"], [trace, 2, "release"]], [], 0, void 0, FcrBaseWhiteboardControlImpl).e;
228
- var _applyDecs$e3 = _slicedToArray(_applyDecs$e2, 1);
229
- _initProto2 = _applyDecs$e3[0];
230
- _applyDecs$e2;
218
+ }