fcr-ui-scene 3.6.1 → 3.6.3

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 (257) hide show
  1. package/lib/creator.d.ts +6 -0
  2. package/lib/creator.js +125 -24
  3. package/lib/electron/app.js +5 -4
  4. package/lib/electron/bootstrap-dev.js +3 -0
  5. package/lib/electron/bootstrap-sdk.js +4 -0
  6. package/lib/electron/injections.d.ts +5 -0
  7. package/lib/electron/injections.js +36 -8
  8. package/lib/electron/ipc/ipc.d.ts +1 -0
  9. package/lib/electron/ipc/ipc.js +4 -0
  10. package/lib/electron/main.js +16 -8
  11. package/lib/electron/plugins/screenshot.js +4 -2
  12. package/lib/electron/preload.js +7 -2
  13. package/lib/electron/window.js +4 -6
  14. package/lib/fragments/annotation/index.d.ts +11 -0
  15. package/lib/fragments/annotation/index.js +121 -0
  16. package/lib/fragments/annotation/libs.d.ts +55 -0
  17. package/lib/fragments/annotation/libs.js +93 -0
  18. package/lib/fragments/annotation/store.d.ts +30 -0
  19. package/lib/fragments/annotation/store.js +565 -0
  20. package/lib/fragments/annotation/view.d.ts +3 -0
  21. package/lib/fragments/annotation/view.js +31 -0
  22. package/lib/fragments/base.d.ts +10 -0
  23. package/lib/fragments/base.js +44 -0
  24. package/lib/modules/action-bar/components/screen-share/submenu.js +7 -6
  25. package/lib/modules/action-bar/index.css +11 -0
  26. package/lib/modules/action-bar/index.d.ts +2 -0
  27. package/lib/modules/action-bar/index.js +1 -0
  28. package/lib/modules/action-bar/store.d.ts +7 -9
  29. package/lib/modules/action-bar/store.js +49 -90
  30. package/lib/modules/annotation/board-cursor.css +76 -0
  31. package/lib/modules/annotation/components/control-bar/index.css +48 -0
  32. package/lib/modules/annotation/components/control-bar/index.d.ts +3 -0
  33. package/lib/modules/annotation/components/control-bar/index.js +141 -0
  34. package/lib/modules/annotation/components/toolbar/components/color-tool/color-panel/index.d.ts +3 -0
  35. package/lib/modules/annotation/components/toolbar/components/color-tool/color-panel/index.js +46 -0
  36. package/lib/modules/annotation/components/toolbar/components/color-tool/index.d.ts +1 -0
  37. package/lib/modules/annotation/components/toolbar/components/color-tool/index.js +52 -0
  38. package/lib/modules/annotation/components/toolbar/components/graphic-tool/graphic-panel/index.d.ts +3 -0
  39. package/lib/modules/annotation/components/toolbar/components/graphic-tool/graphic-panel/index.js +61 -0
  40. package/lib/modules/annotation/components/toolbar/components/graphic-tool/graphic-panel/libs.d.ts +12 -0
  41. package/lib/modules/annotation/components/toolbar/components/graphic-tool/graphic-panel/libs.js +65 -0
  42. package/lib/modules/annotation/components/toolbar/components/graphic-tool/index.d.ts +1 -0
  43. package/lib/modules/annotation/components/toolbar/components/graphic-tool/index.js +68 -0
  44. package/lib/modules/annotation/components/toolbar/components/item/item.d.ts +18 -0
  45. package/lib/modules/annotation/components/toolbar/components/item/item.js +116 -0
  46. package/lib/modules/annotation/components/toolbar/components/item/style.css +43 -0
  47. package/lib/modules/annotation/components/toolbar/components/panel/index.d.ts +5 -0
  48. package/lib/modules/annotation/components/toolbar/components/panel/index.js +22 -0
  49. package/lib/modules/annotation/components/toolbar/components/panel/style.css +24 -0
  50. package/lib/modules/annotation/components/toolbar/components/pen-tool/index.d.ts +1 -0
  51. package/lib/modules/annotation/components/toolbar/components/pen-tool/index.js +58 -0
  52. package/lib/modules/annotation/components/toolbar/components/pen-tool/pen-panel/index.d.ts +3 -0
  53. package/lib/modules/annotation/components/toolbar/components/pen-tool/pen-panel/index.js +34 -0
  54. package/lib/modules/annotation/components/toolbar/components/tips/index.d.ts +2 -0
  55. package/lib/modules/annotation/components/toolbar/components/tips/index.js +25 -0
  56. package/lib/modules/annotation/components/toolbar/components/tips/style.css +19 -0
  57. package/lib/modules/annotation/components/toolbar/index.d.ts +0 -0
  58. package/lib/modules/annotation/components/toolbar/index.js +1 -0
  59. package/lib/modules/annotation/components/toolbar/store.d.ts +40 -0
  60. package/lib/modules/annotation/components/toolbar/store.js +279 -0
  61. package/lib/modules/annotation/components/toolbar/style.css +55 -0
  62. package/lib/modules/annotation/components/toolbar/view.d.ts +2 -0
  63. package/lib/modules/annotation/components/toolbar/view.js +120 -0
  64. package/lib/modules/annotation/index.d.ts +38 -0
  65. package/lib/modules/annotation/index.js +169 -0
  66. package/lib/modules/annotation/store.d.ts +93 -0
  67. package/lib/modules/annotation/store.js +673 -0
  68. package/lib/modules/annotation/style.css +26 -0
  69. package/lib/modules/annotation/view.d.ts +3 -0
  70. package/lib/modules/annotation/view.js +49 -0
  71. package/lib/modules/chat/view.js +112 -100
  72. package/lib/modules/components/annotation-menu/index.d.ts +7 -0
  73. package/lib/modules/components/annotation-menu/index.js +119 -0
  74. package/lib/modules/components/leave-meeting/components/assign-host.js +26 -23
  75. package/lib/modules/components/member-window/components/member-actions/components/audio-control.d.ts +0 -1
  76. package/lib/modules/components/member-window/components/member-actions/components/audio-control.js +10 -4
  77. package/lib/modules/components/member-window/components/member-actions/components/icon-buttons/index.d.ts +4 -2
  78. package/lib/modules/components/member-window/components/member-actions/components/icon-buttons/index.js +10 -6
  79. package/lib/modules/components/member-window/components/member-actions/components/icon-status.d.ts +0 -2
  80. package/lib/modules/components/member-window/components/member-actions/components/icon-status.js +3 -4
  81. package/lib/modules/components/member-window/components/member-actions/components/more-actions.d.ts +0 -3
  82. package/lib/modules/components/member-window/components/member-actions/components/more-actions.js +6 -32
  83. package/lib/modules/components/member-window/components/member-actions/components/share-status.js +11 -3
  84. package/lib/modules/components/member-window/components/member-actions/components/user-info.d.ts +0 -1
  85. package/lib/modules/components/member-window/components/member-actions/components/user-info.js +7 -10
  86. package/lib/modules/components/member-window/components/member-actions/components/user-tag.d.ts +0 -1
  87. package/lib/modules/components/member-window/components/member-actions/components/user-tag.js +0 -2
  88. package/lib/modules/components/member-window/components/member-actions/index.js +1 -32
  89. package/lib/modules/components/member-window/components/member-actions/store.d.ts +38 -1
  90. package/lib/modules/components/member-window/components/member-actions/store.js +130 -23
  91. package/lib/modules/components/member-window/components/video-player/components/remote-video-player.d.ts +2 -1
  92. package/lib/modules/components/member-window/components/video-player/components/remote-video-player.js +6 -1
  93. package/lib/modules/components/member-window/components/video-player/index.d.ts +1 -0
  94. package/lib/modules/components/member-window/index.css +37 -0
  95. package/lib/modules/components/member-window/index.d.ts +1 -1
  96. package/lib/modules/components/member-window/index.js +8 -5
  97. package/lib/modules/components/member-window/types.d.ts +2 -0
  98. package/lib/modules/components/security-menu/index.js +7 -6
  99. package/lib/modules/control-bar/components/annotation-button/index.d.ts +1 -0
  100. package/lib/modules/control-bar/components/annotation-button/index.js +59 -0
  101. package/lib/modules/control-bar/index.d.ts +6 -6
  102. package/lib/modules/control-bar/index.js +5 -34
  103. package/lib/modules/control-bar/store.d.ts +27 -13
  104. package/lib/modules/control-bar/store.js +121 -126
  105. package/lib/modules/control-bar/view.js +50 -4
  106. package/lib/modules/dialog/components/annotation-tool/index.d.ts +4 -0
  107. package/lib/modules/dialog/components/annotation-tool/index.js +53 -0
  108. package/lib/modules/dialog/components/chat/index.js +1 -1
  109. package/lib/modules/dialog/components/control-bar/index.d.ts +0 -2
  110. package/lib/modules/dialog/components/control-bar/index.js +1 -3
  111. package/lib/modules/dialog/components/host-area-container/index.d.ts +12 -0
  112. package/lib/modules/dialog/components/host-area-container/index.js +214 -0
  113. package/lib/modules/dialog/components/participant/index.js +1 -1
  114. package/lib/modules/dialog/components/system-preference/index.js +1 -1
  115. package/lib/modules/dialog/components/video-window/index.js +1 -0
  116. package/lib/modules/dialog/hooks/use-popover-watcher.d.ts +14 -0
  117. package/lib/modules/dialog/hooks/use-popover-watcher.js +112 -0
  118. package/lib/modules/dialog/hooks/useElectron.d.ts +1 -0
  119. package/lib/modules/dialog/hooks/useElectron.js +13 -3
  120. package/lib/modules/dialog/index.d.ts +2 -3
  121. package/lib/modules/dialog/index.js +3 -26
  122. package/lib/modules/dialog/store.d.ts +14 -9
  123. package/lib/modules/dialog/store.js +56 -50
  124. package/lib/modules/event-confirm/components/window/index.d.ts +7 -0
  125. package/lib/modules/event-confirm/components/window/index.js +188 -0
  126. package/lib/modules/event-confirm/index.d.ts +4 -4
  127. package/lib/modules/event-confirm/index.js +6 -4
  128. package/lib/modules/event-confirm/store.d.ts +4 -5
  129. package/lib/modules/event-confirm/store.js +35 -26
  130. package/lib/modules/event-confirm/view.js +23 -171
  131. package/lib/modules/event-sound/index.js +1 -1
  132. package/lib/modules/layout/components/CommonVideoRenderer.js +33 -16
  133. package/lib/modules/layout/index.d.ts +4 -0
  134. package/lib/modules/layout/index.js +2 -0
  135. package/lib/modules/layout/store.d.ts +14 -2
  136. package/lib/modules/layout/store.js +77 -45
  137. package/lib/modules/layout/type.d.ts +7 -0
  138. package/lib/modules/participant/index.d.ts +2 -0
  139. package/lib/modules/participant/index.js +2 -1
  140. package/lib/modules/participant/store.d.ts +5 -2
  141. package/lib/modules/participant/store.js +73 -25
  142. package/lib/modules/setting/audio-settings/audio-settings.js +3 -14
  143. package/lib/modules/setting/index.d.ts +2 -0
  144. package/lib/modules/setting/index.js +3 -3
  145. package/lib/modules/setting/store.d.ts +8 -10
  146. package/lib/modules/setting/store.js +22 -20
  147. package/lib/modules/share-screen/components/selection/index.js +18 -42
  148. package/lib/modules/share-screen/index.d.ts +6 -2
  149. package/lib/modules/share-screen/index.js +4 -2
  150. package/lib/modules/share-screen/store.d.ts +41 -46
  151. package/lib/modules/share-screen/store.js +297 -718
  152. package/lib/modules/share-screen/view.js +2 -2
  153. package/lib/modules/state-bar/assets/fcr_grid_big.svg +1 -1
  154. package/lib/modules/state-bar/assets/fcr_listontop_big.svg +1 -1
  155. package/lib/modules/state-bar/index.css +8 -6
  156. package/lib/modules/state-bar/index.d.ts +4 -0
  157. package/lib/modules/state-bar/index.js +3 -1
  158. package/lib/modules/state-bar/layout-config.d.ts +1 -0
  159. package/lib/modules/state-bar/layout-config.js +15 -5
  160. package/lib/modules/state-bar/store.d.ts +9 -1
  161. package/lib/modules/state-bar/store.js +17 -2
  162. package/lib/modules/state-bar/view.js +9 -4
  163. package/lib/modules/video-window/components/members/index.js +2 -1
  164. package/lib/modules/waiting-room-layout/store.js +1 -1
  165. package/lib/modules/whiteboard/components/control-bar/store.d.ts +5 -1
  166. package/lib/modules/whiteboard/components/control-bar/store.js +10 -1
  167. package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/picker.js +16 -5
  168. package/lib/modules/whiteboard/components/toolbar/components/eraser-picker.js +67 -12
  169. package/lib/modules/whiteboard/components/toolbar/components/expansion/index.js +22 -2
  170. package/lib/modules/whiteboard/components/toolbar/components/history.js +46 -14
  171. package/lib/modules/whiteboard/components/toolbar/components/item/index.js +3 -2
  172. package/lib/modules/whiteboard/components/toolbar/components/move-handle.js +1 -1
  173. package/lib/modules/whiteboard/components/toolbar/components/pen-picker.js +58 -16
  174. package/lib/modules/whiteboard/components/toolbar/components/screen-capture-picker.js +15 -4
  175. package/lib/modules/whiteboard/components/toolbar/components/shape-picker.js +45 -2
  176. package/lib/modules/whiteboard/components/toolbar/hooks/index.d.ts +14 -0
  177. package/lib/modules/whiteboard/components/toolbar/hooks/index.js +235 -7
  178. package/lib/modules/whiteboard/components/toolbar/index.d.ts +1 -1
  179. package/lib/modules/whiteboard/components/toolbar/index.js +1 -1
  180. package/lib/modules/whiteboard/components/toolbar/store.d.ts +13 -2
  181. package/lib/modules/whiteboard/components/toolbar/store.js +74 -24
  182. package/lib/modules/whiteboard/components/toolbar/{ style.css → style.css} +1 -0
  183. package/lib/modules/whiteboard/index.d.ts +2 -0
  184. package/lib/modules/whiteboard/index.js +22 -21
  185. package/lib/modules/whiteboard/style.css +0 -4
  186. package/lib/modules/whiteboard/view.js +8 -2
  187. package/lib/plugins/browser-runtime-plugin.js +10 -1
  188. package/lib/providers/annotation-provider.d.ts +128 -0
  189. package/lib/providers/annotation-provider.js +421 -0
  190. package/lib/providers/device-provider.d.ts +3 -3
  191. package/lib/providers/device-provider.js +8 -6
  192. package/lib/providers/event-provider.d.ts +3 -3
  193. package/lib/providers/interpreter-provider.d.ts +1 -0
  194. package/lib/providers/interpreter-provider.js +182 -154
  195. package/lib/providers/privilege-provider.d.ts +35 -6
  196. package/lib/providers/privilege-provider.js +105 -49
  197. package/lib/providers/renderer-provider.js +3 -7
  198. package/lib/providers/room-provider.d.ts +13 -1
  199. package/lib/providers/room-provider.js +21 -7
  200. package/lib/providers/screen-share-provider.d.ts +131 -34
  201. package/lib/providers/screen-share-provider.js +554 -173
  202. package/lib/providers/sharing-provider.d.ts +37 -0
  203. package/lib/{shared-data-source/screen-share-data-source.js → providers/sharing-provider.js} +102 -39
  204. package/lib/providers/user-setting-storage-provider.d.ts +20 -0
  205. package/lib/providers/user-setting-storage-provider.js +74 -0
  206. package/lib/runtime.d.ts +6 -1
  207. package/lib/scenes/main-scene.d.ts +7 -2
  208. package/lib/scenes/main-scene.js +55 -27
  209. package/lib/scenes/waiting-scene.d.ts +6 -0
  210. package/lib/scenes/waiting-scene.js +15 -5
  211. package/lib/shared-data-source/config.d.ts +1 -5
  212. package/lib/shared-data-source/config.js +11 -81
  213. package/lib/shared-data-source/member-data.d.ts +21 -5
  214. package/lib/shared-data-source/member-data.js +69 -17
  215. package/lib/shared-data-source/screen-share-data.d.ts +274 -0
  216. package/lib/shared-data-source/screen-share-data.js +390 -0
  217. package/lib/shared-data-source/security-data.d.ts +4 -1
  218. package/lib/shared-data-source/security-data.js +5 -2
  219. package/lib/shared-data-source/setting.d.ts +13 -13
  220. package/lib/shared-data-source/setting.js +16 -10
  221. package/lib/shared-data-source/video-window.d.ts +2 -1
  222. package/lib/shared-data-source/video-window.js +56 -36
  223. package/lib/translations/enUS.d.ts +8 -0
  224. package/lib/translations/enUS.js +9 -1
  225. package/lib/translations/zhCN.d.ts +8 -0
  226. package/lib/translations/zhCN.js +11 -3
  227. package/lib/type.d.ts +55 -1
  228. package/lib/ui-manager.d.ts +3 -2
  229. package/lib/ui-manager.js +6 -4
  230. package/lib/ui-scene.js +70 -50
  231. package/lib/utilities/constant.d.ts +10 -2
  232. package/lib/utilities/constant.js +8 -0
  233. package/lib/utilities/logger.d.ts +4 -0
  234. package/lib/utilities/logger.js +8 -1
  235. package/lib/utilities/renderer-event.d.ts +3 -0
  236. package/lib/utilities/renderer-event.js +14 -1
  237. package/lib/utilities/screen.js +2 -1
  238. package/lib/utilities/setting-config-storage.d.ts +5 -6
  239. package/lib/utilities/setting-config-storage.js +33 -39
  240. package/lib/utilities/tools.d.ts +19 -1
  241. package/lib/utilities/tools.js +51 -4
  242. package/package.json +9 -7
  243. package/public/assets/cursors/fcr_whiteboard_input.ico +0 -0
  244. package/public/assets/cursors/fcr_whiteboard_pen.ico +0 -0
  245. package/public/assets/cursors/fcr_whiteboard_shape_-straightline.ico +0 -0
  246. package/public/assets/cursors/fcr_whiteboard_shape_arrow.ico +0 -0
  247. package/public/assets/cursors/fcr_whiteboard_shape_circle.ico +0 -0
  248. package/public/assets/cursors/fcr_whiteboard_shape_rectangle.ico +0 -0
  249. package/public/assets/cursors/fcr_whiteboard_shape_triangle.ico +0 -0
  250. package/public/assets/fcr_chat_reddot.svg +3 -3
  251. package/public/assets/fcr_grid_big.svg +1 -1
  252. package/public/assets/fcr_leave2.svg +14 -14
  253. package/public/assets/fcr_listontop_big.svg +1 -1
  254. package/public/assets/step-gradient.svg +1 -1
  255. package/public/fragment.html +10 -0
  256. package/public/index.html +3 -1
  257. package/lib/shared-data-source/screen-share-data-source.d.ts +0 -37
@@ -0,0 +1,673 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol.js");
4
+ require("core-js/modules/es.symbol.description.js");
5
+ require("core-js/modules/es.symbol.iterator.js");
6
+ require("core-js/modules/es.symbol.to-primitive.js");
7
+ require("core-js/modules/es.error.cause.js");
8
+ require("core-js/modules/es.error.to-string.js");
9
+ require("core-js/modules/es.array.from.js");
10
+ require("core-js/modules/es.array.is-array.js");
11
+ require("core-js/modules/es.array.slice.js");
12
+ require("core-js/modules/es.date.to-primitive.js");
13
+ require("core-js/modules/es.date.to-string.js");
14
+ require("core-js/modules/es.function.bind.js");
15
+ require("core-js/modules/es.function.name.js");
16
+ require("core-js/modules/es.map.js");
17
+ require("core-js/modules/es.number.constructor.js");
18
+ require("core-js/modules/es.object.create.js");
19
+ require("core-js/modules/es.object.define-property.js");
20
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
21
+ require("core-js/modules/esnext.function.metadata.js");
22
+ require("core-js/modules/esnext.map.delete-all.js");
23
+ require("core-js/modules/esnext.map.emplace.js");
24
+ require("core-js/modules/esnext.map.every.js");
25
+ require("core-js/modules/esnext.map.filter.js");
26
+ require("core-js/modules/esnext.map.find.js");
27
+ require("core-js/modules/esnext.map.find-key.js");
28
+ require("core-js/modules/esnext.map.includes.js");
29
+ require("core-js/modules/esnext.map.key-of.js");
30
+ require("core-js/modules/esnext.map.map-keys.js");
31
+ require("core-js/modules/esnext.map.map-values.js");
32
+ require("core-js/modules/esnext.map.merge.js");
33
+ require("core-js/modules/esnext.map.reduce.js");
34
+ require("core-js/modules/esnext.map.some.js");
35
+ require("core-js/modules/esnext.map.update.js");
36
+ require("core-js/modules/esnext.symbol.metadata.js");
37
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
38
+ var _typeof = require("@babel/runtime/helpers/typeof");
39
+ Object.defineProperty(exports, "__esModule", {
40
+ value: true
41
+ });
42
+ exports.AnnotationStoreContext = exports.AnnotationStore = void 0;
43
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
44
+ require("core-js/modules/es.array.concat.js");
45
+ require("core-js/modules/es.array.find.js");
46
+ require("core-js/modules/es.array.for-each.js");
47
+ require("core-js/modules/es.array.includes.js");
48
+ require("core-js/modules/es.array.iterator.js");
49
+ require("core-js/modules/es.array.push.js");
50
+ require("core-js/modules/es.date.to-json.js");
51
+ require("core-js/modules/es.json.stringify.js");
52
+ require("core-js/modules/es.object.to-string.js");
53
+ require("core-js/modules/es.promise.js");
54
+ require("core-js/modules/es.regexp.constructor.js");
55
+ require("core-js/modules/es.regexp.dot-all.js");
56
+ require("core-js/modules/es.regexp.exec.js");
57
+ require("core-js/modules/es.regexp.sticky.js");
58
+ require("core-js/modules/es.regexp.test.js");
59
+ require("core-js/modules/es.regexp.to-string.js");
60
+ require("core-js/modules/es.string.includes.js");
61
+ require("core-js/modules/es.string.iterator.js");
62
+ require("core-js/modules/es.weak-map.js");
63
+ require("core-js/modules/esnext.async-iterator.find.js");
64
+ require("core-js/modules/esnext.async-iterator.for-each.js");
65
+ require("core-js/modules/esnext.iterator.constructor.js");
66
+ require("core-js/modules/esnext.iterator.find.js");
67
+ require("core-js/modules/esnext.iterator.for-each.js");
68
+ require("core-js/modules/esnext.weak-map.delete-all.js");
69
+ require("core-js/modules/esnext.weak-map.emplace.js");
70
+ require("core-js/modules/web.dom-collections.for-each.js");
71
+ require("core-js/modules/web.dom-collections.iterator.js");
72
+ require("core-js/modules/web.timers.js");
73
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
74
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
75
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
76
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
77
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
78
+ var _react = require("react");
79
+ var _constant = require("../../utilities/constant");
80
+ var _decorator = require("agora-foundation/lib/decorator");
81
+ var _rendererEvent = require("../../utilities/renderer-event");
82
+ var _type = require("agora-rte-sdk/lib/core/rtc/type");
83
+ var _annotationProvider = require("../../providers/annotation-provider");
84
+ var _mobx = require("mobx");
85
+ var _fcrCore = require("fcr-core");
86
+ var _type2 = require("fcr-core/lib/room-control/sharing-control/type");
87
+ var _store = require("../whiteboard/components/toolbar/store");
88
+ var _i18n = require("agora-ui-foundation/lib/i18n");
89
+ var _logger = require("../../utilities/logger");
90
+ var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
91
+ var _env = require("agora-foundation/lib/utilities/env");
92
+ var _type3 = require("../whiteboard/type");
93
+ var _AnnotationStore;
94
+ var _initProto, _init_annotationMainWindow, _init_resetToolbarStore, _init_isShowToolbar, _setToolsShowDecs, _zoomInDecs, _zoomOutDecs, _fullContainerDecs, _setOriginScalcDecs, _drawReceiverBoardDecs, _handleBoardDomLoadDecs, _handleBoardContainerDomLoadDecs, _annotationEndedDecs, _mountDecs, _unmountDecs, _ref;
95
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
96
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
97
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
98
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
99
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
100
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
101
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
102
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
103
+ 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 set(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 k(e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { return e[n]; }, (o < 2 || 4 === o) && (F = function F(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 s(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)]; } }; }
104
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
105
+ 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); }
106
+ function _setFunctionName(e, t, n) { "symbol" == _typeof(t) && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
107
+ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); return e; }
108
+ var _A = /*#__PURE__*/new WeakMap();
109
+ var _B = /*#__PURE__*/new WeakMap();
110
+ var _C = /*#__PURE__*/new WeakMap();
111
+ _ref = (_setToolsShowDecs = [_mobx.action, _mobx.action.bound], _zoomInDecs = [_mobx.action, _mobx.action.bound], _zoomOutDecs = [_mobx.action, _mobx.action.bound], _fullContainerDecs = [_mobx.action, _mobx.action.bound], _setOriginScalcDecs = [_mobx.action, _mobx.action.bound], _drawReceiverBoardDecs = [_mobx.action, _mobx.action.bound], _handleBoardDomLoadDecs = [_mobx.action, _mobx.action.bound], _handleBoardContainerDomLoadDecs = [_mobx.action, _mobx.action.bound], _annotationEndedDecs = [_mobx.action, _mobx.action.bound], _mountDecs = [_mobx.action, _mobx.action.bound], _unmountDecs = [_mobx.action, _mobx.action.bound], "logger");
112
+ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
113
+ function AnnotationStore(_ref2) {
114
+ var _this = this;
115
+ var dialogProvider = _ref2.dialogProvider,
116
+ deviceProvider = _ref2.deviceProvider,
117
+ annotationProvider = _ref2.annotationProvider,
118
+ sharingProvider = _ref2.sharingProvider,
119
+ memberDataSource = _ref2.memberDataSource,
120
+ roomControl = _ref2.roomControl,
121
+ sharedSecuritySharedDataSource = _ref2.sharedSecuritySharedDataSource,
122
+ sharedScreenSharedDataSource = _ref2.sharedScreenSharedDataSource,
123
+ privilegeProvider = _ref2.privilegeProvider,
124
+ messageProvider = _ref2.messageProvider,
125
+ localStorageProvider = _ref2.localStorageProvider,
126
+ eventProvider = _ref2.eventProvider;
127
+ (0, _classCallCheck2["default"])(this, AnnotationStore);
128
+ (0, _defineProperty2["default"])(this, _ref, (_initProto(this), (0, _logger.createLogger)({
129
+ prefix: 'AnnotationStore'
130
+ })));
131
+ (0, _defineProperty2["default"])(this, "_disposers", []);
132
+ (0, _defineProperty2["default"])(this, "_annotationControl", undefined);
133
+ (0, _defineProperty2["default"])(this, "_resizeWatcherTimer", null);
134
+ (0, _defineProperty2["default"])(this, "_currentShareInfo", {
135
+ id: '',
136
+ type: _type.AgoraRtcScreenCaptureType.SCREEN,
137
+ bounds: {
138
+ x: 0,
139
+ y: 0,
140
+ width: 0,
141
+ height: 0
142
+ }
143
+ });
144
+ (0, _defineProperty2["default"])(this, "_dialogObserver", {
145
+ onDialogClosed: function onDialogClosed(dialogId) {
146
+ var matchAnnotationId = new RegExp(_constant.FcrUIDialogKey.ANNOTATION, 'ig');
147
+ if (matchAnnotationId.test(dialogId)) {
148
+ if (_this.annotating) {
149
+ _this._annotationProvider.toggleAnnotation();
150
+ }
151
+ }
152
+ }
153
+ });
154
+ _classPrivateFieldInitSpec(this, _A, _init_annotationMainWindow(this, undefined));
155
+ _classPrivateFieldInitSpec(this, _B, _init_resetToolbarStore(this, false));
156
+ _classPrivateFieldInitSpec(this, _C, _init_isShowToolbar(this, false));
157
+ (0, _defineProperty2["default"])(this, "_toolbarStore", undefined);
158
+ (0, _defineProperty2["default"])(this, "_boardOriginWidth", 0);
159
+ (0, _defineProperty2["default"])(this, "_mounted", false);
160
+ (0, _defineProperty2["default"])(this, "_boardContainerObserver", new ResizeObserver(function (entries) {
161
+ var _iterator = _createForOfIteratorHelper(entries),
162
+ _step;
163
+ try {
164
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
165
+ var entry = _step.value;
166
+ var height = entry.contentRect.height;
167
+ // 大小变化后的处理逻辑
168
+ if (height > 0 && _this._memberDataSource.shareScreenVideoRatio > 0 && _this._boardDom) {
169
+ var ratio = _this._memberDataSource.shareScreenVideoRatio;
170
+ var newWidth = height * ratio;
171
+ _this._boardOriginWidth = newWidth;
172
+ _this._boardDom.style.width = "".concat(newWidth, "px");
173
+ }
174
+ }
175
+ } catch (err) {
176
+ _iterator.e(err);
177
+ } finally {
178
+ _iterator.f();
179
+ }
180
+ }));
181
+ localStorageProvider.write('annotation_nickname', memberDataSource.localUser.userName);
182
+ this._dialogProvider = dialogProvider;
183
+ this._deviceProvider = deviceProvider;
184
+ this._annotationProvider = annotationProvider;
185
+ this._sharingProvider = sharingProvider;
186
+ this._memberDataSource = memberDataSource;
187
+ this._roomControl = roomControl;
188
+ this._sharedSecuritySharedDataSource = sharedSecuritySharedDataSource;
189
+ this._sharedScreenSharedDataSource = sharedScreenSharedDataSource;
190
+ this._dialogProvider.addObserver(this._dialogObserver);
191
+ this._privilegeProvider = privilegeProvider;
192
+ this._messageProvider = messageProvider;
193
+ this._eventProvider = eventProvider;
194
+ this._disposers.push((0, _mobx.reaction)(function () {
195
+ return _this.annotating;
196
+ }, function (annotating) {
197
+ if (_this._isLocalUserSharingOwner) {
198
+ if (annotating) {
199
+ _this._removeWindowResizeListenner();
200
+ } else {
201
+ _this._addWindowResizeListenner();
202
+ }
203
+ }
204
+ }), (0, _mobx.reaction)(function () {
205
+ return _this.isSeizeStream;
206
+ }, function (state) {
207
+ _this.logger.info('[Annotation]: isSeizeStream changed to ', state);
208
+ if (state) {
209
+ _this._sharedScreenSharedDataSource.setIsSeizeStream(false);
210
+ if (_this._isLocalUserSharingOwner) {
211
+ _this._annotationProvider.hideAnnotationWindow();
212
+ _this._removeWindowResizeListenner();
213
+ } else {
214
+ _this._annotationEnded();
215
+ }
216
+ }
217
+ }), (0, _mobx.reaction)(function () {
218
+ return _this._memberDataSource.shareScreenVideoRatio;
219
+ }, function (ratio) {
220
+ if (ratio > 0) {
221
+ _this.drawReceiverBoard(ratio);
222
+ }
223
+ }),
224
+ // reaction(
225
+ // () => this._memberDataSource.shareScreenVideoSize,
226
+ // (size) => {
227
+ // if (size && this._boardDom) {
228
+ // this.logger.info('annotation shareScreenVideoSize: ', size);
229
+ // calcAnnotationAreaSize(this._boardDom, size.width, size.height);
230
+ // }
231
+ // },
232
+ // ),
233
+ (0, _mobx.reaction)(function () {
234
+ return _this.isScreenSharing;
235
+ }, function (sharing) {
236
+ _this.logger.info("[Annotation]: screen sharing reaction sharing changed to ".concat(sharing, ", isReplaceScreen is ").concat(_this.isReplaceScreen, ", isSeizeStream is ").concat(_this.isSeizeStream));
237
+ // web 开启屏幕共享时不需要走这个逻辑
238
+ if (_this.isReplaceScreen || _this.isSeizeStream || !(0, _env.isElectron)()) return;
239
+ if (_this._isLocalUserSharingOwner) {
240
+ if (sharing) {
241
+ _this.screenSharingStarted();
242
+ } else {
243
+ _this._removeWindowResizeListenner();
244
+ }
245
+ }
246
+ }), (0, _mobx.reaction)(function () {
247
+ return _this.isReplaceScreen;
248
+ }, /*#__PURE__*/function () {
249
+ var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(isReplaceScreen) {
250
+ return _regenerator["default"].wrap(function _callee$(_context) {
251
+ while (1) switch (_context.prev = _context.next) {
252
+ case 0:
253
+ if (!(isReplaceScreen && (0, _env.isElectron)())) {
254
+ _context.next = 9;
255
+ break;
256
+ }
257
+ _context.next = 3;
258
+ return new Promise(function (resolve) {
259
+ // 延迟两秒,等待标注内容清理,清理方法在 sdk 中虽然看起来是同步的,但是实际上会有无法清理的情况出现
260
+ (0, _rendererEvent.sendEvent)({
261
+ action: _type3.ToolbarEvents.CLEAN,
262
+ payload: null
263
+ });
264
+ setTimeout(function () {
265
+ return resolve(true);
266
+ }, 2000);
267
+ });
268
+ case 3:
269
+ _this.logger.info("[Annotation]: isReplaceScreen changed to ".concat(isReplaceScreen, ", currentShareInfo is ").concat(JSON.stringify(_this._currentShareInfo)));
270
+ _this._removeWindowResizeListenner();
271
+ _this._annotationProvider.hideAnnotationWindow();
272
+ _this._annotationProvider.setBoundsToAnnotationWindow();
273
+ setTimeout(_this.screenSharingStarted);
274
+ _this._sharedScreenSharedDataSource.setIsReplaceScreen(false);
275
+ case 9:
276
+ case "end":
277
+ return _context.stop();
278
+ }
279
+ }, _callee);
280
+ }));
281
+ return function (_x) {
282
+ return _ref3.apply(this, arguments);
283
+ };
284
+ }()), (0, _mobx.reaction)(function () {
285
+ return _this._annotationProvider.annotationState;
286
+ }, function (state) {
287
+ _this.logger.info('annotation transaction state: ', state);
288
+ if (!_this._isLocalUserSharingOwner) {
289
+ if (state === _annotationProvider.FcrAnnotationState.START) {
290
+ _this.logger.info('annotation transaction start');
291
+ _this._annotationControl = _this._annotationProvider.annotationControl;
292
+ _this._toolbarStore = new _store.ToolbarStore(_this._annotationControl, _this._roomControl, _this._annotationProvider, eventProvider);
293
+ _this.resetToolbarStore = true;
294
+ } else {
295
+ _this._annotationEnded();
296
+ }
297
+ }
298
+ }), (0, _mobx.reaction)(function () {
299
+ return _this._sharedScreenSharedDataSource.screenSharingState;
300
+ }, function (state) {
301
+ if (state === _fcrCore.FcrMediaSourceState.CLOSE && _this._isLocalUserSharingOwner) {
302
+ _this.logger.info('[Annotation]: screenSharingState is close, isReplaceScreen is ', _this.isReplaceScreen);
303
+ if (!_this.isReplaceScreen && (0, _env.isElectron)()) {
304
+ _this._annotationProvider.hideAnnotationWindow();
305
+ _this._removeWindowResizeListenner();
306
+ }
307
+ }
308
+ }), (0, _mobx.reaction)(function () {
309
+ return _this.allowAnnotationWriteState;
310
+ }, function (canWrite) {
311
+ if (!_this._isLocalUserSharingOwner) {
312
+ var toastText = canWrite ? (0, _i18n.transI18n)('fmt_screenshare_toast_host_enabled_annotations') : (0, _i18n.transI18n)('fmt_screenshare_toast_host_disabled_annotations');
313
+ _this._messageProvider.showToast({
314
+ type: 'info',
315
+ message: toastText
316
+ });
317
+ }
318
+ if (!canWrite) {
319
+ _this.isShowToolbar = false;
320
+ }
321
+ }), (0, _mobx.reaction)(function () {
322
+ return _this.isShowToolbar;
323
+ }, function (isShow) {
324
+ var _this$_toolbarStore;
325
+ (_this$_toolbarStore = _this._toolbarStore) === null || _this$_toolbarStore === void 0 || _this$_toolbarStore.resetToolbarVars();
326
+ }));
327
+ }
328
+ return (0, _createClass2["default"])(AnnotationStore, [{
329
+ key: "annotationMainWindow",
330
+ get: function get() {
331
+ return _classPrivateFieldGet(_A, this);
332
+ },
333
+ set: function set(v) {
334
+ _classPrivateFieldSet(_A, this, v);
335
+ }
336
+ }, {
337
+ key: "resetToolbarStore",
338
+ get: function get() {
339
+ return _classPrivateFieldGet(_B, this);
340
+ },
341
+ set: function set(v) {
342
+ _classPrivateFieldSet(_B, this, v);
343
+ }
344
+ }, {
345
+ key: "isShowToolbar",
346
+ get: function get() {
347
+ return _classPrivateFieldGet(_C, this);
348
+ },
349
+ set: function set(v) {
350
+ _classPrivateFieldSet(_C, this, v);
351
+ }
352
+ }, {
353
+ key: "hasAnnotationWritePermission",
354
+ get: function get() {
355
+ return this._sharedSecuritySharedDataSource.checkedStateMap.hasAnnotationWritePermission;
356
+ }
357
+ }, {
358
+ key: "isLocalUserHost",
359
+ get: function get() {
360
+ return this._memberDataSource.isLocalUserHost;
361
+ }
362
+ }, {
363
+ key: "screenSharingOwner",
364
+ get: function get() {
365
+ return this._sharedScreenSharedDataSource.screenSharingOwner;
366
+ }
367
+ }, {
368
+ key: "screenShareWindowData",
369
+ get: function get() {
370
+ return this._annotationProvider.screenShareWindowData;
371
+ }
372
+ }, {
373
+ key: "isScreenSharing",
374
+ get: function get() {
375
+ return [_type2.FcrScreenSharingState.START_WHIT_ANNOTATION, _type2.FcrScreenSharingState.START_ONLY_SCREEN].includes(this._sharingProvider.screenSharingState);
376
+ }
377
+ }, {
378
+ key: "ownerId",
379
+ get: function get() {
380
+ return this._sharingProvider.screenSharingOwnerId;
381
+ }
382
+ }, {
383
+ key: "_isLocalUserSharingOwner",
384
+ get: function get() {
385
+ return this._memberDataSource.localUser.userId === this.ownerId;
386
+ }
387
+ }, {
388
+ key: "shareWithAudio",
389
+ get: function get() {
390
+ return this._sharedScreenSharedDataSource.shareWithAudio;
391
+ }
392
+ }, {
393
+ key: "localUser",
394
+ get: function get() {
395
+ return this._memberDataSource.localUser;
396
+ }
397
+ }, {
398
+ key: "scalcValue",
399
+ get: function get() {
400
+ return this._annotationProvider.scalcValue;
401
+ }
402
+ }, {
403
+ key: "annotationHasStart",
404
+ get: function get() {
405
+ return this._annotationProvider.annotationHasStart;
406
+ }
407
+ }, {
408
+ key: "annotating",
409
+ get: function get() {
410
+ return this._annotationProvider.annotating;
411
+ }
412
+ }, {
413
+ key: "allowAnnotation",
414
+ get: function get() {
415
+ return this._sharedSecuritySharedDataSource.checkedStateMap.enableAnnotation;
416
+ }
417
+ }, {
418
+ key: "allowAnnotationWriteState",
419
+ get: function get() {
420
+ var _this$screenSharingOw;
421
+ return this._privilegeProvider.allowAnnotationWriteState() || this.isLocalUserHost || ((_this$screenSharingOw = this.screenSharingOwner) === null || _this$screenSharingOw === void 0 ? void 0 : _this$screenSharingOw.userId) === this.localUser.userId;
422
+ }
423
+ }, {
424
+ key: "isReplaceScreen",
425
+ get: function get() {
426
+ return this._sharedScreenSharedDataSource.isReplaceScreen;
427
+ }
428
+ }, {
429
+ key: "isSeizeStream",
430
+ get: function get() {
431
+ return this._sharedScreenSharedDataSource.isSeizeStream;
432
+ }
433
+ }, {
434
+ key: "getToolbarStore",
435
+ value: function getToolbarStore() {
436
+ return this._toolbarStore;
437
+ }
438
+ }, {
439
+ key: "currentTool",
440
+ get: function get() {
441
+ var _this$_toolbarStore2;
442
+ return (_this$_toolbarStore2 = this._toolbarStore) === null || _this$_toolbarStore2 === void 0 ? void 0 : _this$_toolbarStore2.observables.currentTool;
443
+ }
444
+ }, {
445
+ key: "setToolsShow",
446
+ value: function setToolsShow() {
447
+ this.logger.info('setToolsShow ', this.allowAnnotationWriteState);
448
+ if (this.allowAnnotationWriteState) {
449
+ var currentFlag = this.isShowToolbar;
450
+ this.isShowToolbar = !currentFlag;
451
+ }
452
+ }
453
+ }, {
454
+ key: "zoomIn",
455
+ value: function zoomIn() {
456
+ this._annotationProvider.zoomIn();
457
+ }
458
+ }, {
459
+ key: "zoomOut",
460
+ value: function zoomOut() {
461
+ this._annotationProvider.zoomOut();
462
+ }
463
+ }, {
464
+ key: "fullContainer",
465
+ value: function fullContainer() {
466
+ var ratio = this._memberDataSource.shareScreenVideoRatio;
467
+ if (ratio > 0 && this._boardContainerDom) {
468
+ var _this$_boardContainer = this._boardContainerDom.getBoundingClientRect(),
469
+ width = _this$_boardContainer.width,
470
+ height = _this$_boardContainer.height;
471
+ var _getBoundingClientRec = this._boardDom.getBoundingClientRect(),
472
+ boardWidth = _getBoundingClientRec.width,
473
+ boardHeight = _getBoundingClientRec.height;
474
+ var scalc = width / boardWidth;
475
+ this._annotationProvider.fullContainer(scalc);
476
+ }
477
+ }
478
+ }, {
479
+ key: "setOriginScalc",
480
+ value: function setOriginScalc() {
481
+ this._annotationProvider.setOriginScalc();
482
+ }
483
+ }, {
484
+ key: "drawReceiverBoard",
485
+ value: function drawReceiverBoard(paramRatio) {
486
+ if (this._boardContainerDom && this._boardDom) {
487
+ var _this$_boardContainer2 = this._boardContainerDom.getBoundingClientRect(),
488
+ height = _this$_boardContainer2.height;
489
+ var ratio = (0, _isNumber["default"])(paramRatio) ? paramRatio : this._memberDataSource.shareScreenVideoRatio;
490
+ var newWidth = height * ratio;
491
+ this._boardOriginWidth = newWidth;
492
+ this._boardDom.style.width = "".concat(newWidth, "px");
493
+ this._boardDom.style.height = "".concat(height, "px");
494
+ }
495
+ }
496
+ }, {
497
+ key: "handleBoardDomLoad",
498
+ value: function handleBoardDomLoad(ref) {
499
+ this._boardDom = ref;
500
+ this.logger.info('handleBoardDomLoad: ', this._boardDom);
501
+ if (this._boardDom) {
502
+ var _this$_boardDom$getBo = this._boardDom.getBoundingClientRect(),
503
+ height = _this$_boardDom$getBo.height;
504
+ this._boardOriginWidth = height * this._memberDataSource.shareScreenVideoRatio;
505
+ this._mount();
506
+ } else {
507
+ this._mounted = false;
508
+ }
509
+ }
510
+ }, {
511
+ key: "handleBoardContainerDomLoad",
512
+ value: function handleBoardContainerDomLoad(ref) {
513
+ if (ref) {
514
+ this._boardContainerDom = ref;
515
+ this._boardContainerObserver.observe(ref);
516
+ }
517
+ }
518
+ }, {
519
+ key: "screenSharingStarted",
520
+ value: function screenSharingStarted() {
521
+ this._currentShareInfo = this._annotationProvider.currentShareInfo;
522
+ this.logger.info("[Annotation]: screenSharingStarting with currentShareInfo: ".concat(JSON.stringify(this._currentShareInfo)));
523
+ this._annotationProvider.setBoundsToAnnotationWindow();
524
+ (0, _rendererEvent.sendEvent)({
525
+ action: _constant.FcrUIRendererEventAction.SET_ANNOTATION_TO_SHOW,
526
+ payload: true
527
+ });
528
+ this.logger.info('[Annotation]: screenSharingStarted will add window resize listenner');
529
+ this._addWindowResizeListenner();
530
+ }
531
+ }, {
532
+ key: "release",
533
+ value: function release() {
534
+ this._disposers.forEach(function (disposer) {
535
+ return disposer();
536
+ });
537
+ this._dialogProvider.removeObserver(this._dialogObserver);
538
+ this._removeWindowResizeListenner();
539
+ this._unmount();
540
+ this._boardContainerObserver.disconnect();
541
+ }
542
+ }, {
543
+ key: "_annotationEnded",
544
+ value: function _annotationEnded() {
545
+ var _this$_toolbarStore3;
546
+ this.logger.info('[Annotation]: annotation transaction end');
547
+ (_this$_toolbarStore3 = this._toolbarStore) === null || _this$_toolbarStore3 === void 0 || _this$_toolbarStore3.resetToolbarVars();
548
+ this.resetToolbarStore = false;
549
+ this._boardContainerObserver.disconnect();
550
+ this._messageProvider.showToast({
551
+ message: (0, _i18n.transI18n)('fmt_screenshare_toast_annotation_controls_screen_sharing_disabled'),
552
+ type: 'info'
553
+ });
554
+ this.isShowToolbar = false;
555
+ this._toolbarStore = undefined;
556
+ this._unmount();
557
+ }
558
+ }, {
559
+ key: "_mount",
560
+ value: function _mount() {
561
+ this.logger.info('annotation mount boardMainWindow: ', this._annotationProvider.boardMainWindow);
562
+ this.logger.info('annotation mount boardDom: ', this._boardDom);
563
+ if (this._annotationProvider.boardMainWindow && this._boardDom && !this._mounted) {
564
+ var _this$_toolbarStore4;
565
+ this.logger.info('annotation mount start: ', this._boardDom);
566
+ this._mounted = true;
567
+ var view = this._annotationProvider.boardMainWindow.getContentView();
568
+ this._boardDom.appendChild(view);
569
+ this.logger.info('annotation mount boardMainWindow contentView append: ', view);
570
+ this.logger.info('annotation mount success');
571
+ (_this$_toolbarStore4 = this._toolbarStore) === null || _this$_toolbarStore4 === void 0 || _this$_toolbarStore4.resetToolbarVars();
572
+ }
573
+ }
574
+ }, {
575
+ key: "_unmount",
576
+ value: function _unmount() {
577
+ this.logger.info('annotation unmount ');
578
+ if (this._mounted && this._annotationProvider.boardMainWindow) {
579
+ var _this$_boardDom;
580
+ (_this$_boardDom = this._boardDom) === null || _this$_boardDom === void 0 || _this$_boardDom.removeChild(this._annotationProvider.boardMainWindow.getContentView());
581
+ this.logger.info('annotation unmount remove mainWindow contentView');
582
+ this._close();
583
+ }
584
+ this._mounted = false;
585
+ }
586
+ }, {
587
+ key: "_close",
588
+ value: function _close() {
589
+ if (this._annotationControl) {
590
+ this._annotationControl.close();
591
+ this.logger.info('annotation close');
592
+ }
593
+ }
594
+ }, {
595
+ key: "_updateAnnotationBounds",
596
+ value: function _updateAnnotationBounds(bounds) {
597
+ if (bounds) this._currentShareInfo.bounds = bounds;
598
+ this.logger.info("[Annotation][updateAnnotationBounds]: bounds: ".concat(JSON.stringify(bounds), ", currentShareInfo: ").concat(JSON.stringify(this._currentShareInfo)));
599
+ (0, _rendererEvent.sendEvent)({
600
+ action: _constant.FcrUIRendererEventAction.SET_CURRENT_SHARE_SCREEN_BOUNDS,
601
+ payload: bounds || this._annotationProvider.currentShareInfo.bounds
602
+ });
603
+ }
604
+
605
+ // 使用第三方 node-window-manager 提供的获取窗口列表功能
606
+ }, {
607
+ key: "_updateBoundsByActiveWindow",
608
+ value: function _updateBoundsByActiveWindow() {
609
+ var _this2 = this;
610
+ var windows = window.runtime.getWindows();
611
+ var activeWindow = windows.find(function (win) {
612
+ return win.id === +_this2._currentShareInfo.id;
613
+ });
614
+ var _this$_currentShareIn = this._currentShareInfo,
615
+ id = _this$_currentShareIn.id,
616
+ bounds = _this$_currentShareIn.bounds;
617
+ var width = bounds.width,
618
+ height = bounds.height,
619
+ x = bounds.x,
620
+ y = bounds.y;
621
+ var activeBounds = activeWindow === null || activeWindow === void 0 ? void 0 : activeWindow.getBounds();
622
+ var isSharingWindow = activeWindow && activeWindow.id === +id;
623
+ var _ref4 = (activeWindow === null || activeWindow === void 0 ? void 0 : activeWindow.getBounds()) || {},
624
+ aw = _ref4.width,
625
+ ah = _ref4.height,
626
+ ax = _ref4.x,
627
+ ay = _ref4.y;
628
+ var isNewBounds = aw !== width || ah !== height || ax !== x || ay !== y;
629
+ this.logger.info("updateBoundsByActiveWindow ".concat(JSON.stringify({
630
+ activeBounds: activeBounds,
631
+ width: width,
632
+ height: height,
633
+ isSharingWindow: isSharingWindow,
634
+ isNewBounds: isNewBounds,
635
+ activeWindow: activeWindow,
636
+ id: id
637
+ })));
638
+ if (isSharingWindow && isNewBounds) {
639
+ this._updateAnnotationBounds(activeBounds);
640
+ this.logger.info('The window bounds is the different as the current share bounds');
641
+ }
642
+ }
643
+ }, {
644
+ key: "_addWindowResizeListenner",
645
+ value: function _addWindowResizeListenner() {
646
+ var _this3 = this;
647
+ var isDisplay = this._currentShareInfo.type === _type.AgoraRtcScreenCaptureType.SCREEN;
648
+ this.logger.info("current sharing type is screen: ".concat(isDisplay, ", has watch resize timer: ").concat(!!this._resizeWatcherTimer));
649
+ if (isDisplay) return;
650
+ if (!this._resizeWatcherTimer) {
651
+ this._resizeWatcherTimer = setInterval(function () {
652
+ _this3.logger.info("addWindowResizeListenner interval ".concat(_this3._currentShareInfo));
653
+ _this3._updateBoundsByActiveWindow();
654
+ }, 3000);
655
+ }
656
+ }
657
+ }, {
658
+ key: "_removeWindowResizeListenner",
659
+ value: function _removeWindowResizeListenner() {
660
+ if (this._resizeWatcherTimer) {
661
+ clearInterval(this._resizeWatcherTimer);
662
+ this._resizeWatcherTimer = null;
663
+ }
664
+ }
665
+ }]);
666
+ }();
667
+ _AnnotationStore = AnnotationStore;
668
+ var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AnnotationStore, [[_mobx.observable, 1, "annotationMainWindow"], [_mobx.observable, 1, "resetToolbarStore"], [_mobx.observable, 1, "isShowToolbar"], [_mobx.computed, 3, "scalcValue"], [_mobx.computed, 3, "annotating"], [_decorator.bound, 2, "getToolbarStore"], [_setToolsShowDecs, 18, "setToolsShow"], [_zoomInDecs, 18, "zoomIn"], [_zoomOutDecs, 18, "zoomOut"], [_fullContainerDecs, 18, "fullContainer"], [_setOriginScalcDecs, 18, "setOriginScalc"], [_drawReceiverBoardDecs, 18, "drawReceiverBoard"], [_handleBoardDomLoadDecs, 18, "handleBoardDomLoad"], [_handleBoardContainerDomLoadDecs, 18, "handleBoardContainerDomLoad"], [_decorator.bound, 2, "screenSharingStarted"], [_decorator.bound, 2, "release"], [_annotationEndedDecs, 18, "_annotationEnded"], [_mountDecs, 18, "_mount"], [_unmountDecs, 18, "_unmount"], [_decorator.bound, 2, "_close"], [_decorator.bound, 2, "_updateAnnotationBounds"], [_decorator.bound, 2, "_updateBoundsByActiveWindow"], [_decorator.bound, 2, "_addWindowResizeListenner"], [_decorator.bound, 2, "_removeWindowResizeListenner"]], []).e, 4);
669
+ _init_annotationMainWindow = _applyDecs$e[0];
670
+ _init_resetToolbarStore = _applyDecs$e[1];
671
+ _init_isShowToolbar = _applyDecs$e[2];
672
+ _initProto = _applyDecs$e[3];
673
+ var AnnotationStoreContext = exports.AnnotationStoreContext = /*#__PURE__*/(0, _react.createContext)({});