@netless/fastboard 0.0.11 → 0.2.1

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 (113) hide show
  1. package/LICENSE.txt +1 -1
  2. package/dist/index.js +32 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.mjs +7 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +24 -85
  7. package/src/index.ts +2 -49
  8. package/README.md +0 -136
  9. package/dist/index.cjs.js +0 -14
  10. package/dist/index.cjs.js.map +0 -1
  11. package/dist/index.es.js +0 -2804
  12. package/dist/index.es.js.map +0 -1
  13. package/dist/svelte.cjs.js +0 -2
  14. package/dist/svelte.cjs.js.map +0 -1
  15. package/dist/svelte.es.js +0 -32
  16. package/dist/svelte.es.js.map +0 -1
  17. package/dist/vue.cjs.js +0 -2
  18. package/dist/vue.cjs.js.map +0 -1
  19. package/dist/vue.es.js +0 -43
  20. package/dist/vue.es.js.map +0 -1
  21. package/src/WhiteboardApp.ts +0 -146
  22. package/src/behaviors/register-apps.ts +0 -39
  23. package/src/behaviors/style.ts +0 -17
  24. package/src/components/PageControl/PageControl.scss +0 -80
  25. package/src/components/PageControl/PageControl.tsx +0 -110
  26. package/src/components/PageControl/hooks.ts +0 -70
  27. package/src/components/PageControl/index.ts +0 -2
  28. package/src/components/PlayerControl/PlayerControl.scss +0 -145
  29. package/src/components/PlayerControl/PlayerControl.tsx +0 -157
  30. package/src/components/PlayerControl/components/Button.tsx +0 -55
  31. package/src/components/PlayerControl/hooks.ts +0 -88
  32. package/src/components/PlayerControl/icons/Loading.tsx +0 -13
  33. package/src/components/PlayerControl/icons/Pause.tsx +0 -13
  34. package/src/components/PlayerControl/icons/Play.tsx +0 -13
  35. package/src/components/PlayerControl/icons/index.ts +0 -10
  36. package/src/components/PlayerControl/index.ts +0 -2
  37. package/src/components/RedoUndo/RedoUndo.scss +0 -56
  38. package/src/components/RedoUndo/RedoUndo.tsx +0 -79
  39. package/src/components/RedoUndo/hooks.ts +0 -50
  40. package/src/components/RedoUndo/index.ts +0 -2
  41. package/src/components/Root.scss +0 -55
  42. package/src/components/Root.tsx +0 -65
  43. package/src/components/Toolbar/Content.tsx +0 -94
  44. package/src/components/Toolbar/Toolbar.scss +0 -281
  45. package/src/components/Toolbar/Toolbar.tsx +0 -132
  46. package/src/components/Toolbar/components/ApplianceButtons.tsx +0 -132
  47. package/src/components/Toolbar/components/AppsButton.tsx +0 -106
  48. package/src/components/Toolbar/components/Button.tsx +0 -54
  49. package/src/components/Toolbar/components/ColorBox.tsx +0 -56
  50. package/src/components/Toolbar/components/CutLine.tsx +0 -8
  51. package/src/components/Toolbar/components/Mask.tsx +0 -44
  52. package/src/components/Toolbar/components/PencilButton.tsx +0 -70
  53. package/src/components/Toolbar/components/ShapesButton.tsx +0 -143
  54. package/src/components/Toolbar/components/Slider.tsx +0 -27
  55. package/src/components/Toolbar/components/TextButton.tsx +0 -66
  56. package/src/components/Toolbar/components/UpDownButtons.tsx +0 -49
  57. package/src/components/Toolbar/components/assets/cocos.png +0 -0
  58. package/src/components/Toolbar/components/assets/collapsed.png +0 -0
  59. package/src/components/Toolbar/components/assets/countdown.png +0 -0
  60. package/src/components/Toolbar/components/assets/expanded.png +0 -0
  61. package/src/components/Toolbar/components/assets/geogebra.png +0 -0
  62. package/src/components/Toolbar/components/assets/vscode.png +0 -0
  63. package/src/components/Toolbar/const.ts +0 -32
  64. package/src/components/Toolbar/hooks.ts +0 -112
  65. package/src/components/Toolbar/icons/Apps.tsx +0 -16
  66. package/src/components/Toolbar/icons/Arrow.tsx +0 -16
  67. package/src/components/Toolbar/icons/Circle.tsx +0 -21
  68. package/src/components/Toolbar/icons/Clean.tsx +0 -16
  69. package/src/components/Toolbar/icons/Clicker.tsx +0 -19
  70. package/src/components/Toolbar/icons/Collapse.tsx +0 -17
  71. package/src/components/Toolbar/icons/Diamond.tsx +0 -17
  72. package/src/components/Toolbar/icons/Down.tsx +0 -17
  73. package/src/components/Toolbar/icons/Eraser.tsx +0 -16
  74. package/src/components/Toolbar/icons/Expand.tsx +0 -17
  75. package/src/components/Toolbar/icons/Line.tsx +0 -13
  76. package/src/components/Toolbar/icons/Pencil.tsx +0 -16
  77. package/src/components/Toolbar/icons/Rectangle.tsx +0 -13
  78. package/src/components/Toolbar/icons/Selector.tsx +0 -16
  79. package/src/components/Toolbar/icons/SpeechBalloon.tsx +0 -17
  80. package/src/components/Toolbar/icons/Star.tsx +0 -17
  81. package/src/components/Toolbar/icons/Text.tsx +0 -16
  82. package/src/components/Toolbar/icons/Triangle.tsx +0 -17
  83. package/src/components/Toolbar/icons/Up.tsx +0 -17
  84. package/src/components/Toolbar/icons/index.ts +0 -42
  85. package/src/components/Toolbar/index.ts +0 -2
  86. package/src/components/ZoomControl/ZoomControl.scss +0 -80
  87. package/src/components/ZoomControl/ZoomControl.tsx +0 -109
  88. package/src/components/ZoomControl/hooks.ts +0 -111
  89. package/src/components/ZoomControl/index.ts +0 -2
  90. package/src/components/hooks.ts +0 -80
  91. package/src/i18n/en.json +0 -31
  92. package/src/i18n/index.ts +0 -22
  93. package/src/i18n/zh-CN.json +0 -32
  94. package/src/icons/ChevronLeft.tsx +0 -21
  95. package/src/icons/ChevronRight.tsx +0 -21
  96. package/src/icons/FilePlus.tsx +0 -18
  97. package/src/icons/Minus.tsx +0 -21
  98. package/src/icons/Plus.tsx +0 -21
  99. package/src/icons/Redo.tsx +0 -24
  100. package/src/icons/Reset.tsx +0 -23
  101. package/src/icons/Undo.tsx +0 -24
  102. package/src/icons/index.tsx +0 -11
  103. package/src/internal/Instance.tsx +0 -275
  104. package/src/internal/helpers.ts +0 -86
  105. package/src/internal/hooks.ts +0 -9
  106. package/src/internal/index.ts +0 -3
  107. package/src/internal/mount-whiteboard.ts +0 -90
  108. package/src/react.tsx +0 -52
  109. package/src/style.scss +0 -35
  110. package/src/svelte.ts +0 -45
  111. package/src/theme/index.ts +0 -36
  112. package/src/types/index.ts +0 -22
  113. package/src/vue.ts +0 -74
package/dist/index.es.js DELETED
@@ -1,2804 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
- var __publicField = (obj, key, value) => {
33
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
- return value;
35
- };
36
- import { WindowManager, BuiltinApps } from "@netless/window-manager";
37
- import { WhiteWebSdk, DefaultHotKeys, ApplianceNames, ShapeType, PlayerPhase } from "white-web-sdk";
38
- import i18next from "i18next";
39
- import React, { useState, useEffect, useCallback, memo, forwardRef, useContext, useRef, createContext } from "react";
40
- import ReactDOM from "react-dom";
41
- import { AnimatePresence, motion } from "framer-motion";
42
- import clsx from "clsx";
43
- import Tippy from "@tippyjs/react";
44
- import RcSlider from "rc-slider";
45
- WindowManager.register({
46
- kind: "Slide",
47
- appOptions: {
48
- debug: false
49
- },
50
- src: async () => {
51
- var _a;
52
- const app = await import("@netless/app-slide");
53
- return (_a = app.default) != null ? _a : app;
54
- }
55
- });
56
- WindowManager.register({
57
- kind: "Monaco",
58
- src: async () => {
59
- var _a;
60
- const app = await import("@netless/app-monaco");
61
- return (_a = app.default) != null ? _a : app;
62
- }
63
- });
64
- WindowManager.register({
65
- kind: "Countdown",
66
- src: async () => {
67
- var _a;
68
- const app = await import("@netless/app-countdown");
69
- return (_a = app.default) != null ? _a : app;
70
- }
71
- });
72
- WindowManager.register({
73
- kind: "GeoGebra",
74
- src: async () => {
75
- var _a;
76
- const app = await import("@netless/app-geogebra");
77
- return (_a = app.default) != null ? _a : app;
78
- },
79
- appOptions: {
80
- HTML5Codebase: "https://flat-storage-cn-hz.whiteboard.agora.io/GeoGebra/HTML5/5.0/web3d"
81
- }
82
- });
83
- function noop() {
84
- return;
85
- }
86
- function applyStyles(css) {
87
- const el = document.createElement("style");
88
- el.appendChild(document.createTextNode(css));
89
- document.head.appendChild(el);
90
- return el;
91
- }
92
- function clamp(value, min, max) {
93
- return value < min ? min : value > max ? max : value;
94
- }
95
- function isEqualArray(a, b) {
96
- return a.length === b.length && a.every((e, i) => e === b[i]);
97
- }
98
- class Lock {
99
- constructor() {
100
- __publicField(this, "running", false);
101
- __publicField(this, "nextFn", null);
102
- __publicField(this, "step", () => {
103
- if (this.nextFn) {
104
- const fn = this.nextFn;
105
- this.nextFn = null;
106
- Promise.resolve(fn()).then(this.step);
107
- } else {
108
- this.running = false;
109
- }
110
- });
111
- }
112
- schedule(fn) {
113
- if (this.running) {
114
- this.nextFn = fn;
115
- } else {
116
- this.running = true;
117
- Promise.resolve(fn()).then(this.step);
118
- }
119
- }
120
- }
121
- const SOUP = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
122
- const SOUP_LEN = SOUP.length;
123
- const ID_LEN = 20;
124
- const reusedIdCarrier = Array(ID_LEN);
125
- const genUID = () => {
126
- for (let i = 0; i < ID_LEN; i++) {
127
- reusedIdCarrier[i] = SOUP.charAt(Math.random() * SOUP_LEN);
128
- }
129
- return reusedIdCarrier.join("");
130
- };
131
- function makeSlideParams(scenes) {
132
- const scenesWithoutPPT = [];
133
- let taskId = "";
134
- let url = "";
135
- const pptSrcRE = /^pptx?(?<prefix>:\/\/\S+?dynamicConvert)\/(?<taskId>\w+)\//;
136
- for (const { name: name2, ppt } of scenes) {
137
- scenesWithoutPPT.push({ name: name2 });
138
- if (!ppt || !ppt.src.startsWith("ppt")) {
139
- continue;
140
- }
141
- const match = pptSrcRE.exec(ppt.src);
142
- if (!match || !match.groups) {
143
- continue;
144
- }
145
- taskId = match.groups.taskId;
146
- url = "https" + match.groups.prefix;
147
- break;
148
- }
149
- return { scenesWithoutPPT, taskId, url };
150
- }
151
- const translation$1 = {
152
- clicker: "clicker",
153
- selector: "selector",
154
- text: "text",
155
- pencil: "pencil",
156
- arrow: "arrow",
157
- hand: "hand",
158
- eraser: "eraser",
159
- laser: "laser",
160
- collapse: "Collapse",
161
- expand: "Expand",
162
- zoomIn: "Zoom In",
163
- zoomOut: "Zoom Out",
164
- reset: "Reset",
165
- prevPage: "Prev Page",
166
- nextPage: "Next Page",
167
- addPage: "Add Page",
168
- redo: "Redo",
169
- undo: "Undo",
170
- shape: "Shape",
171
- triangle: "Triangle",
172
- rhombus: "Rhombus",
173
- pentagram: "Pentagram",
174
- speechBalloon: "Speech Balloon",
175
- rectangle: "Rectangle",
176
- ellipse: "Ellipse",
177
- straight: "Straight",
178
- speed: "Speed"
179
- };
180
- var en = {
181
- translation: translation$1
182
- };
183
- const translation = {
184
- clicker: "\u70B9\u51FB",
185
- selector: "\u9009\u62E9",
186
- text: "\u6587\u5B57",
187
- pencil: "\u94C5\u7B14",
188
- arrow: "\u7BAD\u5934",
189
- hand: "\u6293\u624B",
190
- eraser: "\u6A61\u76AE",
191
- laser: "\u6FC0\u5149\u7B14",
192
- zoomIn: "\u653E\u5927",
193
- zoomOut: "\u7F29\u5C0F",
194
- reset: "\u91CD\u7F6E",
195
- prevPage: "\u4E0A\u4E00\u9875",
196
- nextPage: "\u4E0B\u4E00\u9875",
197
- addPage: "\u6DFB\u52A0\u9875\u9762",
198
- redo: "\u91CD\u505A",
199
- undo: "\u64A4\u9500",
200
- collapse: "\u6536\u8D77",
201
- expand: "\u5C55\u5F00",
202
- clean: "\u6E05\u5C4F",
203
- shape: "\u5F62\u72B6",
204
- triangle: "\u4E09\u89D2\u5F62",
205
- rhombus: "\u83F1\u5F62",
206
- pentagram: "\u4E94\u89D2\u661F",
207
- speechBalloon: "\u6C14\u7403",
208
- rectangle: "\u77E9\u5F62",
209
- ellipse: "\u692D\u5706",
210
- straight: "\u76F4\u7EBF",
211
- speed: "\u901F\u5EA6"
212
- };
213
- var zhCN = {
214
- translation
215
- };
216
- const createI18n = async (params) => {
217
- const defaultLang = navigator.language || "zh-CN";
218
- const lng = params.language || defaultLang;
219
- await i18next.init({
220
- lng,
221
- resources: {
222
- en,
223
- "zh-CN": zhCN
224
- }
225
- });
226
- return i18next;
227
- };
228
- function ensureWindowManager(joinRoom) {
229
- if (!joinRoom.invisiblePlugins || !joinRoom.invisiblePlugins.includes(WindowManager)) {
230
- joinRoom.invisiblePlugins = [
231
- ...joinRoom.invisiblePlugins || [],
232
- WindowManager
233
- ];
234
- }
235
- }
236
- const defaultHotKeys = {
237
- changeToSelector: "s",
238
- changeToLaserPointer: "z",
239
- changeToPencil: "p",
240
- changeToRectangle: "r",
241
- changeToEllipse: "c",
242
- changeToEraser: "e",
243
- changeToText: "t",
244
- changeToStraight: "l",
245
- changeToArrow: "a",
246
- changeToHand: "h"
247
- };
248
- async function mountWhiteboard(sdkConfig, joinRoom, managerConfig, language) {
249
- const sdk = new WhiteWebSdk(__spreadProps(__spreadValues({}, sdkConfig), {
250
- useMobXState: true
251
- }));
252
- ensureWindowManager(joinRoom);
253
- joinRoom = __spreadValues({}, joinRoom);
254
- const callbacks = joinRoom.callbacks;
255
- delete joinRoom.callbacks;
256
- const joinRoomParams = __spreadProps(__spreadValues({
257
- floatBar: true,
258
- hotKeys: __spreadValues(__spreadValues({}, DefaultHotKeys), defaultHotKeys)
259
- }, joinRoom), {
260
- useMultiViews: true,
261
- disableNewPencil: false,
262
- disableMagixEventDispatchLimit: true
263
- });
264
- const room = await sdk.joinRoom(joinRoomParams, callbacks);
265
- const manager = await WindowManager.mount(__spreadProps(__spreadValues({
266
- cursor: true,
267
- debug: false
268
- }, managerConfig), {
269
- room
270
- }));
271
- const i18n = await createI18n({ language });
272
- return { sdk, room, manager, i18n };
273
- }
274
- function useWritable(room) {
275
- const [writable, setWritable] = useState(false);
276
- useEffect(() => {
277
- if (room) {
278
- setWritable(room.isWritable);
279
- room.isWritable && (room.disableSerialization = false);
280
- const updateWritable = () => setWritable(room.isWritable);
281
- room.callbacks.on("onEnableWriteNowChanged", updateWritable);
282
- return () => {
283
- room.callbacks.off("onEnableWriteNowChanged", updateWritable);
284
- };
285
- }
286
- }, [room]);
287
- return writable;
288
- }
289
- function useBoxState(manager) {
290
- const [boxState, setBoxState] = useState();
291
- useEffect(() => {
292
- if (manager) {
293
- setBoxState(manager.boxState);
294
- manager.emitter.on("boxStateChange", setBoxState);
295
- return () => {
296
- manager.emitter.off("boxStateChange", setBoxState);
297
- };
298
- }
299
- }, [manager]);
300
- return boxState;
301
- }
302
- function useFocusedApp(manager) {
303
- const [focused, setFocused] = useState();
304
- useEffect(() => {
305
- if (manager) {
306
- setFocused(manager.focused);
307
- manager.emitter.on("focusedChange", setFocused);
308
- return () => {
309
- manager.emitter.off("focusedChange", setFocused);
310
- };
311
- }
312
- }, [manager]);
313
- return focused;
314
- }
315
- function useMaximized(manager) {
316
- return useBoxState(manager) === "maximized";
317
- }
318
- function useHideControls(manager) {
319
- const maximized = useMaximized(manager);
320
- const focusedApp = useFocusedApp(manager);
321
- if (maximized) {
322
- if (Object.values(BuiltinApps).some((kind) => focusedApp == null ? void 0 : focusedApp.includes(kind))) {
323
- return "toolbar-only";
324
- } else {
325
- return true;
326
- }
327
- }
328
- return false;
329
- }
330
- function useRoomState(room) {
331
- const [memberState, setMemberState] = useState(void 0);
332
- useEffect(() => {
333
- if (room) {
334
- setMemberState(room.state.memberState);
335
- const onRoomStateChanged = (diff) => {
336
- if (diff.memberState)
337
- setMemberState(diff.memberState);
338
- };
339
- room.callbacks.on("onRoomStateChanged", onRoomStateChanged);
340
- return () => room.callbacks.off("onRoomStateChanged", onRoomStateChanged);
341
- }
342
- }, [room]);
343
- return { memberState };
344
- }
345
- function useToolbar(room, manager) {
346
- const writable = useWritable(room);
347
- const { memberState } = useRoomState(room);
348
- const cleanCurrentScene = useCallback(() => {
349
- if (manager) {
350
- manager.mainView.cleanCurrentScene();
351
- } else if (room) {
352
- room.cleanCurrentScene();
353
- }
354
- }, [manager, room]);
355
- const setAppliance = useCallback((appliance, shape) => {
356
- const memberState2 = {
357
- currentApplianceName: appliance,
358
- shapeType: shape
359
- };
360
- if (manager) {
361
- manager.mainView.setMemberState(memberState2);
362
- } else if (room) {
363
- room.setMemberState(memberState2);
364
- }
365
- }, [manager, room]);
366
- const setStrokeWidth = useCallback((strokeWidth) => {
367
- if (manager) {
368
- manager.mainView.setMemberState({ strokeWidth });
369
- } else if (room) {
370
- room.setMemberState({ strokeWidth });
371
- }
372
- }, [manager, room]);
373
- const setStrokeColor = useCallback((strokeColor) => {
374
- if (manager) {
375
- manager.mainView.setMemberState({ strokeColor });
376
- } else if (room) {
377
- room.setMemberState({ strokeColor });
378
- }
379
- }, [manager, room]);
380
- return {
381
- writable,
382
- memberState,
383
- cleanCurrentScene,
384
- setAppliance,
385
- setStrokeWidth,
386
- setStrokeColor
387
- };
388
- }
389
- const EmptyToolbarHook = {
390
- writable: false,
391
- memberState: void 0,
392
- cleanCurrentScene: noop,
393
- setAppliance: noop,
394
- setStrokeWidth: noop,
395
- setStrokeColor: noop
396
- };
397
- var jsxRuntime = { exports: {} };
398
- var reactJsxRuntime_production_min = {};
399
- /*
400
- object-assign
401
- (c) Sindre Sorhus
402
- @license MIT
403
- */
404
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
405
- var hasOwnProperty = Object.prototype.hasOwnProperty;
406
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
407
- function toObject(val) {
408
- if (val === null || val === void 0) {
409
- throw new TypeError("Object.assign cannot be called with null or undefined");
410
- }
411
- return Object(val);
412
- }
413
- function shouldUseNative() {
414
- try {
415
- if (!Object.assign) {
416
- return false;
417
- }
418
- var test1 = new String("abc");
419
- test1[5] = "de";
420
- if (Object.getOwnPropertyNames(test1)[0] === "5") {
421
- return false;
422
- }
423
- var test2 = {};
424
- for (var i = 0; i < 10; i++) {
425
- test2["_" + String.fromCharCode(i)] = i;
426
- }
427
- var order2 = Object.getOwnPropertyNames(test2).map(function(n2) {
428
- return test2[n2];
429
- });
430
- if (order2.join("") !== "0123456789") {
431
- return false;
432
- }
433
- var test3 = {};
434
- "abcdefghijklmnopqrst".split("").forEach(function(letter) {
435
- test3[letter] = letter;
436
- });
437
- if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
438
- return false;
439
- }
440
- return true;
441
- } catch (err) {
442
- return false;
443
- }
444
- }
445
- shouldUseNative() ? Object.assign : function(target, source) {
446
- var from;
447
- var to = toObject(target);
448
- var symbols;
449
- for (var s = 1; s < arguments.length; s++) {
450
- from = Object(arguments[s]);
451
- for (var key in from) {
452
- if (hasOwnProperty.call(from, key)) {
453
- to[key] = from[key];
454
- }
455
- }
456
- if (getOwnPropertySymbols) {
457
- symbols = getOwnPropertySymbols(from);
458
- for (var i = 0; i < symbols.length; i++) {
459
- if (propIsEnumerable.call(from, symbols[i])) {
460
- to[symbols[i]] = from[symbols[i]];
461
- }
462
- }
463
- }
464
- }
465
- return to;
466
- };
467
- /** @license React v17.0.2
468
- * react-jsx-runtime.production.min.js
469
- *
470
- * Copyright (c) Facebook, Inc. and its affiliates.
471
- *
472
- * This source code is licensed under the MIT license found in the
473
- * LICENSE file in the root directory of this source tree.
474
- */
475
- var f = React, g = 60103;
476
- reactJsxRuntime_production_min.Fragment = 60107;
477
- if (typeof Symbol === "function" && Symbol.for) {
478
- var h = Symbol.for;
479
- g = h("react.element");
480
- reactJsxRuntime_production_min.Fragment = h("react.fragment");
481
- }
482
- var m = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = Object.prototype.hasOwnProperty, p = { key: true, ref: true, __self: true, __source: true };
483
- function q(c, a, k) {
484
- var b, d = {}, e = null, l = null;
485
- k !== void 0 && (e = "" + k);
486
- a.key !== void 0 && (e = "" + a.key);
487
- a.ref !== void 0 && (l = a.ref);
488
- for (b in a)
489
- n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
490
- if (c && c.defaultProps)
491
- for (b in a = c.defaultProps, a)
492
- d[b] === void 0 && (d[b] = a[b]);
493
- return { $$typeof: g, type: c, key: e, ref: l, props: d, _owner: m.current };
494
- }
495
- reactJsxRuntime_production_min.jsx = q;
496
- reactJsxRuntime_production_min.jsxs = q;
497
- {
498
- jsxRuntime.exports = reactJsxRuntime_production_min;
499
- }
500
- const jsx = jsxRuntime.exports.jsx;
501
- const jsxs = jsxRuntime.exports.jsxs;
502
- const Fragment = jsxRuntime.exports.Fragment;
503
- function Icon({
504
- fallback,
505
- src,
506
- alt = "[icon]"
507
- }) {
508
- return src ? /* @__PURE__ */ jsx("img", {
509
- src,
510
- alt,
511
- title: alt
512
- }) : fallback;
513
- }
514
- const light = {
515
- color: "#5D5D5D",
516
- activeColor: "#3381FF",
517
- backgroundColor: "#fff",
518
- hoverBackgroundColor: "rgba(51, 129, 255, 0.1)"
519
- };
520
- const dark = __spreadProps(__spreadValues({}, light), {
521
- color: "#eee",
522
- backgroundColor: "#111"
523
- });
524
- const themes = { light, dark };
525
- const getStroke = (props) => {
526
- let config;
527
- if (props.theme) {
528
- config = themes[props.theme];
529
- } else {
530
- config = themes.light;
531
- }
532
- return props.active ? config.activeColor : config.color;
533
- };
534
- const TopOffset = [0, 11];
535
- const RightOffset = [0, 11];
536
- const Apps = (props) => {
537
- const stroke = getStroke(props);
538
- return /* @__PURE__ */ jsx("svg", {
539
- viewBox: "0 0 24 24",
540
- children: /* @__PURE__ */ jsxs("g", {
541
- fill: stroke,
542
- children: [/* @__PURE__ */ jsx("path", {
543
- d: "M17.667 4.5h-3.334c-1.012 0-1.833.82-1.833 1.833V11.5h5.167c1.012 0 1.833-.82 1.833-1.833V6.333c0-1.012-.82-1.833-1.833-1.833Zm-3.334 1h3.334c.46 0 .833.373.833.833v3.334l-.006.104a.833.833 0 0 1-.827.729H13.5V6.333c0-.46.373-.833.833-.833Z"
544
- }), /* @__PURE__ */ jsx("path", {
545
- d: "M6.333 19.5A1.833 1.833 0 0 1 4.5 17.667v-3.334c0-.525.221-1 .576-1.334a1.822 1.822 0 0 1-.576-1.332V8.333c0-1.012.82-1.833 1.833-1.833H10A1.5 1.5 0 0 1 11.5 8v4.5h4.167c.962 0 1.75.74 1.827 1.683l.006.15v3.334c0 1.012-.82 1.833-1.833 1.833Zm4.167-6H6.333a.833.833 0 0 0-.827.729l-.006.104v3.334c0 .46.373.833.833.833H10.5v-5Zm5.167 0H11.5v5h4.167c.46 0 .833-.373.833-.833v-3.334a.833.833 0 0 0-.833-.833ZM10 7.5H6.333a.833.833 0 0 0-.833.833v3.334c0 .46.373.833.833.833H10.5V8a.5.5 0 0 0-.41-.492L10 7.5Z"
546
- })]
547
- })
548
- });
549
- };
550
- const Arrow = (props) => {
551
- const stroke = getStroke(props);
552
- return /* @__PURE__ */ jsx("svg", {
553
- viewBox: "0 0 24 24",
554
- children: /* @__PURE__ */ jsx("path", {
555
- fill: stroke,
556
- d: "M19 5v6l-2.647-2.646L5.99 18.718l-.708-.708L15.645 7.646 13 5h6Z"
557
- })
558
- });
559
- };
560
- const Circle = (props) => {
561
- const stroke = getStroke(props);
562
- return /* @__PURE__ */ jsx("svg", {
563
- viewBox: "0 0 24 24",
564
- children: /* @__PURE__ */ jsx("rect", {
565
- width: "15",
566
- height: "15",
567
- x: "4.5",
568
- y: "4.5",
569
- fill: "none",
570
- stroke,
571
- rx: "7.5"
572
- })
573
- });
574
- };
575
- const Clean = (props) => {
576
- const stroke = getStroke(props);
577
- return /* @__PURE__ */ jsx("svg", {
578
- viewBox: "0 0 24 24",
579
- children: /* @__PURE__ */ jsx("path", {
580
- fill: stroke,
581
- d: "M9.754 11.99c0 1.856-.711 3.62-1.96 4.951l-.151.155h1.403l.855-.853h.707l.853.853h2.635l.094-.064a6.237 6.237 0 0 0 2.559-4.781l.005-.26h1a7.237 7.237 0 0 1-2.994 5.862l-.229.16-.277.083h-3l-.353-.146-.647-.647-.646.647-.354.146h-3l-.286-.91.214-.148a6.237 6.237 0 0 0 2.567-4.787l.005-.26h1Zm4.772-6.502v2l.35.039a2.98 2.98 0 0 1 2.644 2.78l.006.181h-8a2.98 2.98 0 0 1 2.65-2.961l.35-.039v-2h2Z"
582
- })
583
- });
584
- };
585
- const Clicker = (props) => {
586
- const stroke = getStroke(props);
587
- return /* @__PURE__ */ jsx("svg", {
588
- viewBox: "0 0 24 24",
589
- children: /* @__PURE__ */ jsxs("g", {
590
- fill: "none",
591
- children: [/* @__PURE__ */ jsx("path", {
592
- d: "M0 0h24v24H0z"
593
- }), /* @__PURE__ */ jsx("path", {
594
- fill: stroke,
595
- d: "m7 5.072 10.33 7.892-4.879.549 3.232 5.598-.866.5-3.233-5.597-2.914 3.95L7 5.072Z"
596
- })]
597
- })
598
- });
599
- };
600
- const Collapse = (props) => {
601
- const stroke = getStroke(props);
602
- return /* @__PURE__ */ jsx("svg", {
603
- viewBox: "0 0 24 24",
604
- children: /* @__PURE__ */ jsx("path", {
605
- fill: "none",
606
- stroke,
607
- d: "m8 10-2 2 2 2m10-8H6m12 12H6m12-4h-8m8-4h-8"
608
- })
609
- });
610
- };
611
- const Diamond = (props) => {
612
- const stroke = getStroke(props);
613
- return /* @__PURE__ */ jsx("svg", {
614
- viewBox: "0 0 24 24",
615
- children: /* @__PURE__ */ jsx("path", {
616
- fill: "none",
617
- stroke,
618
- d: "M4.222 12 12 4.222 19.778 12 12 19.778z"
619
- })
620
- });
621
- };
622
- const Down = (props) => {
623
- const stroke = getStroke(props);
624
- return /* @__PURE__ */ jsx("svg", {
625
- viewBox: "0 0 24 24",
626
- children: /* @__PURE__ */ jsx("path", {
627
- fill: "none",
628
- stroke,
629
- d: "m16 13-2 2-2 2-2-2-2-2m8-6-2 2-2 2-2-2-2-2"
630
- })
631
- });
632
- };
633
- const Eraser = (props) => {
634
- const stroke = getStroke(props);
635
- return /* @__PURE__ */ jsx("svg", {
636
- viewBox: "0 0 24 24",
637
- children: /* @__PURE__ */ jsx("path", {
638
- fill: stroke,
639
- d: "m14.333 5.183.165.007c.494.037.978.245 1.356.623l2.333 2.333a2.15 2.15 0 0 1 0 3.04l-5.833 5.834a3.8 3.8 0 0 1-5.374 0l-1.167-1.166a2.15 2.15 0 0 1 0-3.04l7-7c.42-.42.97-.63 1.52-.63ZM11.52 8.52l-4.999 5a1.15 1.15 0 0 0 0 1.626l1.167 1.167a2.8 2.8 0 0 0 3.96 0l3.832-3.833-3.96-3.96Z"
640
- })
641
- });
642
- };
643
- const Expand = (props) => {
644
- const stroke = getStroke(props);
645
- return /* @__PURE__ */ jsx("svg", {
646
- viewBox: "0 0 24 24",
647
- children: /* @__PURE__ */ jsx("path", {
648
- fill: "none",
649
- stroke,
650
- d: "m16 10 2 2-2 2M6 6h12M6 18h12M6 14h8m-8-4h8"
651
- })
652
- });
653
- };
654
- const Line = (props) => {
655
- const stroke = getStroke(props);
656
- return /* @__PURE__ */ jsx("svg", {
657
- viewBox: "0 0 24 24",
658
- children: /* @__PURE__ */ jsx("path", {
659
- fill: stroke,
660
- d: "m18.01 5.282.708.708L5.99 18.718l-.708-.708z"
661
- })
662
- });
663
- };
664
- const Pencil = (props) => {
665
- const stroke = getStroke(props);
666
- return /* @__PURE__ */ jsx("svg", {
667
- viewBox: "0 0 24 24",
668
- children: /* @__PURE__ */ jsx("path", {
669
- fill: stroke,
670
- d: "m17.497 4.84.116.105 1.442 1.442a1.52 1.52 0 0 1 .104 2.034l-.104.116L8.733 18.858l-4.347.756.756-4.347L15.463 4.945a1.52 1.52 0 0 1 2.034-.104ZM5.967 16.349l-.353 2.037 2.037-.354-1.683-1.683Zm8.407-8.901-7.946 7.946 2.178 2.178 7.946-7.946-2.178-2.178Zm-.728 2.2.708.707-5 5-.708-.708 5-5Zm2.596-4.055-.072.06-1.09 1.088 2.179 2.178 1.089-1.088a.52.52 0 0 0 .105-.584l-.045-.08-.06-.072-1.442-1.442a.52.52 0 0 0-.664-.06Z"
671
- })
672
- });
673
- };
674
- const Rectangle = (props) => {
675
- const stroke = getStroke(props);
676
- return /* @__PURE__ */ jsx("svg", {
677
- viewBox: "0 0 24 24",
678
- children: /* @__PURE__ */ jsx("path", {
679
- fill: "none",
680
- stroke,
681
- d: "M5.5 5.5h13v13h-13z"
682
- })
683
- });
684
- };
685
- const Selector = (props) => {
686
- const stroke = getStroke(props);
687
- return /* @__PURE__ */ jsx("svg", {
688
- viewBox: "0 0 24 24",
689
- children: /* @__PURE__ */ jsx("path", {
690
- fill: stroke,
691
- d: "m12 12 8 2.667-3.556 1.777L14.667 20 12 12Zm3-8v7.5h-1V5H5v9h6.5v1H4V4h11Z"
692
- })
693
- });
694
- };
695
- const SpeechBalloon = (props) => {
696
- const stroke = getStroke(props);
697
- return /* @__PURE__ */ jsx("svg", {
698
- viewBox: "0 0 24 24",
699
- children: /* @__PURE__ */ jsx("path", {
700
- fill: "none",
701
- stroke,
702
- d: "M17 4.5c.414 0 .79.168 1.06.44.272.27.44.646.44 1.06v9c0 .414-.168.79-.44 1.06a1.49 1.49 0 0 1-1.06.44h-4.207l-2.715 2.715-1.81-2.715H7a1.49 1.49 0 0 1-1.06-.44A1.495 1.495 0 0 1 5.5 15V6c0-.414.168-.79.44-1.06A1.49 1.49 0 0 1 7 4.5Z"
703
- })
704
- });
705
- };
706
- const Star = (props) => {
707
- const stroke = getStroke(props);
708
- return /* @__PURE__ */ jsx("svg", {
709
- viewBox: "0 0 24 24",
710
- children: /* @__PURE__ */ jsx("path", {
711
- fill: "none",
712
- stroke,
713
- d: "m12 3.523 1.993 5.734 6.07.123-4.838 3.668 1.758 5.81L12 15.391l-4.983 3.467 1.758-5.81L3.938 9.38l6.069-.123L12 3.523Z"
714
- })
715
- });
716
- };
717
- const Text = (props) => {
718
- const stroke = getStroke(props);
719
- return /* @__PURE__ */ jsx("svg", {
720
- viewBox: "0 0 24 24",
721
- children: /* @__PURE__ */ jsx("path", {
722
- fill: stroke,
723
- d: "M18.5 5.5V8h-1V6.5H13v11h2v1H9v-1h2v-11H6.5V8h-1V5.5h13Z"
724
- })
725
- });
726
- };
727
- const Triangle = (props) => {
728
- const stroke = getStroke(props);
729
- return /* @__PURE__ */ jsx("svg", {
730
- viewBox: "0 0 24 24",
731
- children: /* @__PURE__ */ jsx("path", {
732
- fill: "none",
733
- stroke,
734
- d: "M12 6.008 19.138 18.5H4.862L12 6.008Z"
735
- })
736
- });
737
- };
738
- const Up = (props) => {
739
- const stroke = getStroke(props);
740
- return /* @__PURE__ */ jsx("svg", {
741
- viewBox: "0 0 24 24",
742
- children: /* @__PURE__ */ jsx("path", {
743
- fill: "none",
744
- stroke,
745
- d: "m16 11-2-2-2-2-2 2-2 2m8 6-2-2-2-2-2 2-2 2"
746
- })
747
- });
748
- };
749
- const Icons$1 = {
750
- Clicker: memo(Clicker),
751
- Collapse: memo(Collapse),
752
- Eraser: memo(Eraser),
753
- Expand: memo(Expand),
754
- Pencil: memo(Pencil),
755
- Selector: memo(Selector),
756
- Rectangle: memo(Rectangle),
757
- Text: memo(Text),
758
- Apps: memo(Apps),
759
- Clean: memo(Clean),
760
- Circle: memo(Circle),
761
- Line: memo(Line),
762
- Arrow: memo(Arrow),
763
- Star: memo(Star),
764
- Diamond: memo(Diamond),
765
- SpeechBalloon: memo(SpeechBalloon),
766
- Triangle: memo(Triangle),
767
- Up: memo(Up),
768
- Down: memo(Down)
769
- };
770
- const ShapesMap = {
771
- [ApplianceNames.rectangle]: Icons$1.Rectangle,
772
- [ApplianceNames.ellipse]: Icons$1.Circle,
773
- [ApplianceNames.straight]: Icons$1.Line,
774
- [ApplianceNames.arrow]: Icons$1.Arrow,
775
- [ShapeType.Pentagram]: Icons$1.Star,
776
- [ShapeType.Rhombus]: Icons$1.Diamond,
777
- [ShapeType.Triangle]: Icons$1.Triangle,
778
- [ShapeType.SpeechBalloon]: Icons$1.SpeechBalloon
779
- };
780
- const ApplianceShapes = [
781
- ApplianceNames.rectangle,
782
- ApplianceNames.ellipse,
783
- ApplianceNames.straight,
784
- ApplianceNames.arrow
785
- ];
786
- const Shapes = [
787
- ShapeType.Pentagram,
788
- ShapeType.Rhombus,
789
- ShapeType.Triangle,
790
- ShapeType.SpeechBalloon
791
- ];
792
- const ItemHeight = 32 + 4;
793
- const ItemsCount = 8;
794
- const MaxHeight = ItemHeight * ItemsCount - 4;
795
- const MinHeight = ItemHeight * 2 - 4;
796
- const Button$1 = forwardRef((props, ref) => {
797
- const {
798
- content,
799
- disabled,
800
- active,
801
- onClick,
802
- interactive,
803
- placement = "right",
804
- children
805
- } = props;
806
- const {
807
- writable,
808
- theme
809
- } = useContext(ToolbarContext);
810
- return /* @__PURE__ */ jsx(Tippy, {
811
- className: "fastboard-tip",
812
- content,
813
- interactive,
814
- theme,
815
- disabled: disabled || !writable,
816
- placement,
817
- offset: placement.includes("right") ? RightOffset : void 0,
818
- duration: 300,
819
- children: /* @__PURE__ */ jsx("button", {
820
- ref,
821
- className: clsx("fastboard-toolbar-btn", theme, {
822
- active
823
- }),
824
- onClick,
825
- disabled: disabled || !writable,
826
- children
827
- })
828
- });
829
- });
830
- function CutLine() {
831
- const {
832
- theme
833
- } = useContext(ToolbarContext);
834
- return /* @__PURE__ */ jsx("span", {
835
- className: clsx(`${name$4}-cut-line`, theme)
836
- });
837
- }
838
- function UpButton({
839
- disabled,
840
- scrollTo
841
- }) {
842
- const {
843
- theme,
844
- icons
845
- } = useContext(ToolbarContext);
846
- const scrollUp = useCallback(() => scrollTo(-ItemHeight), [scrollTo]);
847
- return /* @__PURE__ */ jsxs(Fragment, {
848
- children: [/* @__PURE__ */ jsx(Button$1, {
849
- content: "Up",
850
- disabled,
851
- onClick: scrollUp,
852
- children: /* @__PURE__ */ jsx(Icon, {
853
- fallback: /* @__PURE__ */ jsx(Icons$1.Up, {
854
- theme
855
- }),
856
- src: disabled ? icons == null ? void 0 : icons.upIconDisable : icons == null ? void 0 : icons.upIcon,
857
- alt: "[up]"
858
- })
859
- }), /* @__PURE__ */ jsx(CutLine, {})]
860
- });
861
- }
862
- function DownButton({
863
- disabled,
864
- scrollTo
865
- }) {
866
- const {
867
- theme,
868
- icons
869
- } = useContext(ToolbarContext);
870
- const scrollDown = useCallback(() => scrollTo(ItemHeight), [scrollTo]);
871
- return /* @__PURE__ */ jsxs(Fragment, {
872
- children: [/* @__PURE__ */ jsx(CutLine, {}), /* @__PURE__ */ jsx(Button$1, {
873
- content: "Down",
874
- disabled,
875
- onClick: scrollDown,
876
- children: /* @__PURE__ */ jsx(Icon, {
877
- fallback: /* @__PURE__ */ jsx(Icons$1.Down, {
878
- theme
879
- }),
880
- src: disabled ? icons == null ? void 0 : icons.downIconDisable : icons == null ? void 0 : icons.downIcon,
881
- alt: "[down]"
882
- })
883
- })]
884
- });
885
- }
886
- function renderToolTip(text, hotkey) {
887
- if (!(typeof hotkey === "string"))
888
- return text;
889
- return /* @__PURE__ */ jsxs("span", {
890
- className: "fastboard-toolbar-tooltip",
891
- children: [/* @__PURE__ */ jsx("span", {
892
- children: text
893
- }), /* @__PURE__ */ jsx("span", {
894
- className: "fastboard-toolbar-hotkey",
895
- children: hotkey.toUpperCase()
896
- })]
897
- });
898
- }
899
- function ClickerButton() {
900
- var _a;
901
- const app = useInstance();
902
- const {
903
- theme,
904
- icons,
905
- writable,
906
- setAppliance,
907
- memberState,
908
- i18n
909
- } = useContext(ToolbarContext);
910
- const changeAppliance = useCallback(() => setAppliance(ApplianceNames.clicker), [setAppliance]);
911
- const shortcut = (_a = app == null ? void 0 : app.config.joinRoom.hotKeys) == null ? void 0 : _a.changeToClick;
912
- const appliance = memberState == null ? void 0 : memberState.currentApplianceName;
913
- const active = appliance === ApplianceNames.clicker;
914
- const disabled = !writable;
915
- return /* @__PURE__ */ jsx(Button$1, {
916
- content: renderToolTip(i18n == null ? void 0 : i18n.t("clicker"), shortcut),
917
- onClick: changeAppliance,
918
- active,
919
- children: /* @__PURE__ */ jsx(Icon, {
920
- fallback: /* @__PURE__ */ jsx(Icons$1.Clicker, {
921
- theme,
922
- active
923
- }),
924
- src: disabled ? icons == null ? void 0 : icons.clickerIconDisable : icons == null ? void 0 : icons.clickerIcon,
925
- alt: "[clicker]"
926
- })
927
- });
928
- }
929
- function SelectorButton() {
930
- const app = useInstance();
931
- const {
932
- theme,
933
- icons,
934
- writable,
935
- setAppliance,
936
- memberState,
937
- i18n
938
- } = useContext(ToolbarContext);
939
- const changeAppliance = useCallback(() => setAppliance(ApplianceNames.selector), [setAppliance]);
940
- const appliance = memberState == null ? void 0 : memberState.currentApplianceName;
941
- const active = appliance === ApplianceNames.selector;
942
- const disabled = !writable;
943
- const shortcut = ((app == null ? void 0 : app.config.joinRoom.hotKeys) || defaultHotKeys).changeToSelector;
944
- return /* @__PURE__ */ jsx(Button$1, {
945
- content: renderToolTip(i18n == null ? void 0 : i18n.t("selector"), shortcut),
946
- onClick: changeAppliance,
947
- active,
948
- children: /* @__PURE__ */ jsx(Icon, {
949
- fallback: /* @__PURE__ */ jsx(Icons$1.Selector, {
950
- theme,
951
- active
952
- }),
953
- src: disabled ? icons == null ? void 0 : icons.selectorIconDisable : icons == null ? void 0 : icons.selectorIcon,
954
- alt: "[selector]"
955
- })
956
- });
957
- }
958
- function EraserButton() {
959
- const app = useInstance();
960
- const {
961
- theme,
962
- icons,
963
- writable,
964
- setAppliance,
965
- memberState,
966
- i18n
967
- } = useContext(ToolbarContext);
968
- const changeAppliance = useCallback(() => setAppliance(ApplianceNames.eraser), [setAppliance]);
969
- const appliance = memberState == null ? void 0 : memberState.currentApplianceName;
970
- const active = appliance === ApplianceNames.eraser;
971
- const disabled = !writable;
972
- const shortcut = ((app == null ? void 0 : app.config.joinRoom.hotKeys) || defaultHotKeys).changeToEraser;
973
- return /* @__PURE__ */ jsx(Button$1, {
974
- content: renderToolTip(i18n == null ? void 0 : i18n.t("eraser"), shortcut),
975
- onClick: changeAppliance,
976
- active,
977
- children: /* @__PURE__ */ jsx(Icon, {
978
- fallback: /* @__PURE__ */ jsx(Icons$1.Eraser, {
979
- theme,
980
- active
981
- }),
982
- src: disabled ? icons == null ? void 0 : icons.eraserIconDisable : icons == null ? void 0 : icons.eraserIcon,
983
- alt: "[eraser]"
984
- })
985
- });
986
- }
987
- function CleanButton() {
988
- const {
989
- theme,
990
- icons,
991
- writable,
992
- cleanCurrentScene,
993
- i18n
994
- } = useContext(ToolbarContext);
995
- const disabled = !writable;
996
- return /* @__PURE__ */ jsx(Button$1, {
997
- content: i18n == null ? void 0 : i18n.t("clean"),
998
- onClick: cleanCurrentScene,
999
- children: /* @__PURE__ */ jsx(Icon, {
1000
- fallback: /* @__PURE__ */ jsx(Icons$1.Clean, {
1001
- theme
1002
- }),
1003
- src: disabled ? icons == null ? void 0 : icons.cleanIconDisable : icons == null ? void 0 : icons.cleanIcon,
1004
- alt: "[clean]"
1005
- })
1006
- });
1007
- }
1008
- var vscodePNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAAXNSR0IArs4c6QAABnxJREFUWMPtWWlsVFUUPve+ZTY6HUoLpS1tEUrLVooKLgWVTQGVfRWhiUpAECGGEgOJShRj9I9EjSEQIMhSBIKBQoBgQCMEKEuo1LKV7rRl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2L83O6G0MsZoK8X5/wJrIFDCXoNIdZJ2aNIEpiZu6Iw3TjISoPwgPwtb12uaZP565VduE5hLusnGE4M7xwDXrtF13iu85Q2F6KEEsKLPM23zhbpOLUYkTEevLuN3qa1CCGOe3zM4Ze8rzCi2qHUzkGq8G63hR7YJtF+/ZnAwIJwKnIicSWiq5zRxicZvLs/pYde7xGruHBUQaWAiPhK28CxVLdl5usbv8QUJAQjkVUJCwqcbotSKQEAHdfbVhys7SEos7IIjqFsBYR1jbzpSu3l/oVrztmSBABE7lcZmpv60Y+eWrCYIg+LvhYMiK6hyTd5QeLGqMMIbh28DP8os8jAVSKIli7oQBK8b2FyjJGa4zaYWVR+863YpaajY63O8frrxQ7fhkTLxOom0C8S9nENOzkgBIu9dHiI/W57333KrxaQL1F5mpA007ZiZH6WTVaCIwxrdcrJ+ys6TM6ob/eBK/mZW58PkU9PW6AEjIy+k9T6waPTottsOTL6V2Ozg/tZdRGwIZ53i5qmXClr+OFJlDXuMiuL5yxA1Hizf+elugZOXY/rmvpYdomu9Y3DP3lJZZXSEuXOB1U2SJaUMJISrSgYULoyO6VRdWN8qCkBEfFTYPamzKnL1lhTWO4BKEjCgewpWEAcMIJWqX3qJF0RHJaWaiKRJMANA7Sjq0oG92ahQCCZo3vr4UH1apjty668R9c1PeHGhiAB3KOSJy7t9YFVbnjd0MsrBterJJK2y9VH//67d95AhqNzKJduaQUhbId68nrhnVixDappX+e75/OhJU4smMNE3nDikpIevH9Y7RCx+fuMsY950pisB9oDrKANVLdPYA6aMsuStmpytf6BmrF5cdrnZ7FETgiAQA4b4oEmqUydw0MWeQHG8Qum6ku2BYTA+d+Na+ima7AzgIiIgEAIBSk4YszJAWDZRjtF0+pPSPTytapu0qMVuaJYEkpA/rqSc5GeL8DNmkoY9y0gwAN+tdn542W6HbvEGG2WmSQXoMBuBP/lx5Auuxs78BCY9M0wbXBY0AAAAASUVORK5CYII=";
1009
- var geogebraPNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhE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QkIb7tEvP9V4JkDmcNuLdAkkUMYUN27PhLFkhYWBHnTkVFxYdLppCEQJ2hHNrYjBPx29DD/TEx14X7h3Ac97ZKoahgkYmJNbJAgoL28yZCGPko7ffw4cPs/tDQAlmF3dPzV05KTe7HTIHymZubyxs0f37XlOfnlyKr4I8f78Me1+bMRC0QJDV2LTm5TnbXwsO7hAuEYklJCZ0/f57Kysro7NmzTC8gQKM/QJlUPk5A2UVCr19frgSmgxYtShP31efi8tHHChCdcbOEhGpZICEhXV6D3qtoXArTdAaCkLS0tGThw80thO8FadTZ+Sd+LqZBTWVXKyAIBSxywYJkle7HZxACMFkqlEhNpjhuA0FFEqNQYAaCUI2eYmxszNoAZo7eHJzqaeI77u7uIgcshfsrZIW7iRMnqvUAvsOEl56ezmVXeUxV5BCODEBUP6Q/aVTjHz58yD3E2Nicj52Dg/PZ/S4uvtxTPDw86MGDB3T58mUWvkE0kRtFRUV07tw59iqOCfrqWLpX5yNwP5QLlGKFJINExcmVrrTgT3r0hjMP7DC6ubZJ+OWfar4A+cztHyyv+3VOTz+jAAAAAElFTkSuQmCC";
1010
- var countdownPNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAAXNSR0IArs4c6QAADAhJREFUWMOtmYlXk1cWwPkr5pyZM2faOTPOjFu1omyyKdICyqoFpBAFFAggQQgJqChUW0dFhEERFNmXLAREqcqmgFbErW60CLIlAglhSSAhybcxN3whfllQoL7zzjtfPt57+eW+e++792IxZ9iENTl9F8LVXJaGy4aR7BoemxyxW2cI2ejcp1r/u3cNd+68/f03xcw0gaFzy28WRp+V73u7zoRNlcSTHCSQAVnDeWJm/CM7Dg4OpKelFRcV37179213t1gslsumlIoZgsBXjjVHENLHt3szD6g4SXppUcWmJWvKIpSyxXasq7uekpxcWlLS0tLS1tb26tWrd7290IWDg9iSJWdh+orA8ZHG8pG8aD2HXlQLnYU0ZRMqhdkdm5sak5jM7Kyspqamlvl27969Vm1rGx0eXj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fW3IgNl5yaQSinTcNGj7b7P2lS6Sq2eCHJCVMsHxxCVPF0b5BKMU604q10VbaTQxrJJ+u2EDMg3WUI/zkT/5iamKiWeSSNatbiOAoMS1ZJhaITDOLtxeYki32NYvRmIXWuoa7uXOG5XGLJdZYIaHFO8pIso8ch4FGL+TyptMMCv01x/AFL7psLF269kspulCj+qRszN56ph2tSydmpCvHmifTYC/rUcExsxpmFtGs8zSovFWnQB7/h7B0l9RoN9aYRZb29BUEs8f6EYl+8FjVKVjfoz+MpT/Qvk7s3mVUcFRtkugtxWD1f4KIFHt+/fNgfciXVNOQm+tNYTHBUP/bYJoYY235nxWLZJNL4HZf7P8J5l0J1+BP+J1zoBqfGQu8Gnb7jGnlwjhG4JqLSsibpy6NUM98bixUg9+7ZJqzf8QpGCgflw21U8ikqXv+H7p3tGfM9Tp+AAAAAElFTkSuQmCC";
1011
- function AppsButton({
1012
- content,
1013
- onClick
1014
- }) {
1015
- const {
1016
- theme,
1017
- icons,
1018
- writable
1019
- } = useContext(ToolbarContext);
1020
- const disabled = !writable;
1021
- const button = /* @__PURE__ */ jsx(Button$1, {
1022
- content: "Apps",
1023
- onClick,
1024
- children: /* @__PURE__ */ jsx(Icon, {
1025
- fallback: /* @__PURE__ */ jsx(Icons$1.Apps, {
1026
- theme
1027
- }),
1028
- src: disabled ? icons == null ? void 0 : icons.appsIconDisable : icons == null ? void 0 : icons.appsIcon,
1029
- alt: "[apps]"
1030
- })
1031
- });
1032
- return content === false ? button : /* @__PURE__ */ jsx("span", {
1033
- className: "fastboard-toolbar-btn-interactive",
1034
- children: /* @__PURE__ */ jsx(Tippy, {
1035
- className: "fastboard-tip",
1036
- content: renderAppsButtonContent(content),
1037
- theme,
1038
- placement: "right-end",
1039
- trigger: "click",
1040
- offset: RightOffset,
1041
- arrow: false,
1042
- interactive: true,
1043
- children: button
1044
- })
1045
- });
1046
- }
1047
- function renderAppsButtonContent(content) {
1048
- return /* @__PURE__ */ jsx("div", {
1049
- className: "fastboard-toolbar-panel apps",
1050
- children: /* @__PURE__ */ jsx("div", {
1051
- className: "fastboard-toolbar-apps",
1052
- children: content || /* @__PURE__ */ jsx(DefaultApps, {})
1053
- })
1054
- });
1055
- }
1056
- function DefaultApps() {
1057
- const app = useInstance();
1058
- return /* @__PURE__ */ jsxs(Fragment, {
1059
- children: [/* @__PURE__ */ jsx(AppIcon, {
1060
- title: "Code Editor",
1061
- src: vscodePNG,
1062
- alt: "[code editor]",
1063
- onClick: app == null ? void 0 : app.insertCodeEditor.bind(app)
1064
- }), /* @__PURE__ */ jsx(AppIcon, {
1065
- title: "GeoGebra",
1066
- src: geogebraPNG,
1067
- alt: "[geogebra]",
1068
- onClick: app == null ? void 0 : app.insertGeoGebra.bind(app)
1069
- }), /* @__PURE__ */ jsx(AppIcon, {
1070
- title: "Countdown",
1071
- src: countdownPNG,
1072
- alt: "[countdown]",
1073
- onClick: app == null ? void 0 : app.insertCountdown.bind(app)
1074
- })]
1075
- });
1076
- }
1077
- function AppIcon({
1078
- title,
1079
- src,
1080
- alt,
1081
- onClick
1082
- }) {
1083
- return /* @__PURE__ */ jsxs("span", {
1084
- className: "fastboard-toolbar-app-icon",
1085
- children: [/* @__PURE__ */ jsx(Button$1, {
1086
- placement: "top",
1087
- content: title,
1088
- onClick,
1089
- children: /* @__PURE__ */ jsx("img", {
1090
- src,
1091
- alt,
1092
- title
1093
- })
1094
- }), /* @__PURE__ */ jsx("span", {
1095
- className: "fastboard-toolbar-app-icon-text",
1096
- children: title
1097
- })]
1098
- });
1099
- }
1100
- const colors = {
1101
- "#E02020": [224, 32, 32],
1102
- "#F7B500": [247, 181, 0],
1103
- "#6DD400": [109, 212, 0],
1104
- "#32C5FF": [50, 197, 255],
1105
- "#0091FF": [0, 145, 255],
1106
- "#6236FF": [98, 54, 255],
1107
- "#B620E0": [182, 32, 224],
1108
- "#6D7278": [109, 114, 120]
1109
- };
1110
- const colorKeys = Object.keys(colors);
1111
- function ColorBox() {
1112
- const {
1113
- theme,
1114
- memberState,
1115
- setStrokeColor,
1116
- writable
1117
- } = useContext(ToolbarContext);
1118
- const strokeColor = memberState == null ? void 0 : memberState.strokeColor;
1119
- const disabled = !writable;
1120
- return /* @__PURE__ */ jsx("div", {
1121
- className: clsx("fastboard-toolbar-color-box", theme),
1122
- children: colorKeys.map((key) => /* @__PURE__ */ jsx("div", {
1123
- className: clsx("fastboard-toolbar-color-item", theme),
1124
- onClick: () => setStrokeColor(colors[key]),
1125
- children: /* @__PURE__ */ jsx("div", {
1126
- className: clsx("fastboard-toolbar-color-border", theme, {
1127
- active: strokeColor && isEqualArray(strokeColor, colors[key])
1128
- }),
1129
- children: /* @__PURE__ */ jsx("button", {
1130
- className: clsx("fastboard-toolbar-color-btn"),
1131
- style: {
1132
- background: key
1133
- },
1134
- disabled,
1135
- onClick: (ev) => {
1136
- ev.stopPropagation();
1137
- setStrokeColor(colors[key]);
1138
- }
1139
- })
1140
- })
1141
- }, key))
1142
- });
1143
- }
1144
- function Slider() {
1145
- const {
1146
- theme,
1147
- writable,
1148
- memberState,
1149
- setStrokeWidth
1150
- } = useContext(ToolbarContext);
1151
- const {
1152
- activeColor
1153
- } = themes[theme];
1154
- const strokeWidth = (memberState == null ? void 0 : memberState.strokeWidth) || 0;
1155
- return /* @__PURE__ */ jsx(RcSlider, {
1156
- disabled: !writable,
1157
- className: clsx("fastboard-toolbar-slider", theme),
1158
- trackStyle: {
1159
- background: activeColor
1160
- },
1161
- handleStyle: {
1162
- border: `1px solid ${activeColor}`
1163
- },
1164
- value: strokeWidth,
1165
- onChange: setStrokeWidth,
1166
- min: 1,
1167
- max: 32
1168
- });
1169
- }
1170
- function PencilButton() {
1171
- const app = useInstance();
1172
- const {
1173
- theme,
1174
- icons,
1175
- writable,
1176
- setAppliance,
1177
- memberState,
1178
- i18n
1179
- } = useContext(ToolbarContext);
1180
- const changeAppliance = useCallback(() => {
1181
- setAppliance(ApplianceNames.pencil);
1182
- }, [setAppliance]);
1183
- const appliance = memberState == null ? void 0 : memberState.currentApplianceName;
1184
- const active = appliance === ApplianceNames.pencil;
1185
- const disabled = !writable;
1186
- const shortcut = ((app == null ? void 0 : app.config.joinRoom.hotKeys) || defaultHotKeys).changeToPencil;
1187
- return /* @__PURE__ */ jsx("span", {
1188
- className: "fastboard-toolbar-btn-interactive",
1189
- children: /* @__PURE__ */ jsx(Tippy, {
1190
- className: "fastboard-tip",
1191
- content: renderPencilButtonContent(),
1192
- theme,
1193
- placement: "right-start",
1194
- trigger: "click",
1195
- offset: RightOffset,
1196
- arrow: false,
1197
- interactive: true,
1198
- children: /* @__PURE__ */ jsxs(Button$1, {
1199
- content: renderToolTip(i18n == null ? void 0 : i18n.t("pencil"), shortcut),
1200
- active,
1201
- onClick: changeAppliance,
1202
- children: [/* @__PURE__ */ jsx(Icon, {
1203
- fallback: /* @__PURE__ */ jsx(Icons$1.Pencil, {
1204
- theme,
1205
- active
1206
- }),
1207
- src: disabled ? icons == null ? void 0 : icons.pencilIconDisable : icons == null ? void 0 : icons.pencilIcon,
1208
- alt: "[pencil]"
1209
- }), /* @__PURE__ */ jsx("span", {
1210
- className: "fastboard-toolbar-triangle"
1211
- })]
1212
- })
1213
- })
1214
- });
1215
- }
1216
- function renderPencilButtonContent() {
1217
- return /* @__PURE__ */ jsxs("div", {
1218
- className: "fastboard-toolbar-panel pencil",
1219
- children: [/* @__PURE__ */ jsx(Slider, {}), /* @__PURE__ */ jsx(CutLine, {}), /* @__PURE__ */ jsx(ColorBox, {})]
1220
- });
1221
- }
1222
- function TextButton() {
1223
- const app = useInstance();
1224
- const {
1225
- theme,
1226
- icons,
1227
- writable,
1228
- setAppliance,
1229
- memberState,
1230
- i18n
1231
- } = useContext(ToolbarContext);
1232
- const changeAppliance = useCallback(() => {
1233
- setAppliance(ApplianceNames.text);
1234
- }, [setAppliance]);
1235
- const appliance = memberState == null ? void 0 : memberState.currentApplianceName;
1236
- const active = appliance === ApplianceNames.text;
1237
- const disabled = !writable;
1238
- const shortcut = ((app == null ? void 0 : app.config.joinRoom.hotKeys) || defaultHotKeys).changeToText;
1239
- return /* @__PURE__ */ jsx("span", {
1240
- className: "fastboard-toolbar-btn-interactive",
1241
- children: /* @__PURE__ */ jsx(Tippy, {
1242
- className: "fastboard-tip",
1243
- content: renderTextButtonContent(),
1244
- theme,
1245
- placement: "right-start",
1246
- trigger: "click",
1247
- offset: RightOffset,
1248
- arrow: false,
1249
- interactive: true,
1250
- children: /* @__PURE__ */ jsxs(Button$1, {
1251
- content: renderToolTip(i18n == null ? void 0 : i18n.t("text"), shortcut),
1252
- active,
1253
- onClick: changeAppliance,
1254
- children: [/* @__PURE__ */ jsx(Icon, {
1255
- fallback: /* @__PURE__ */ jsx(Icons$1.Text, {
1256
- theme,
1257
- active
1258
- }),
1259
- src: disabled ? icons == null ? void 0 : icons.textIconDisable : icons == null ? void 0 : icons.textIcon,
1260
- alt: "[text]"
1261
- }), /* @__PURE__ */ jsx("span", {
1262
- className: "fastboard-toolbar-triangle"
1263
- })]
1264
- })
1265
- })
1266
- });
1267
- }
1268
- function renderTextButtonContent() {
1269
- return /* @__PURE__ */ jsx("div", {
1270
- className: "fastboard-toolbar-panel text",
1271
- children: /* @__PURE__ */ jsx(ColorBox, {})
1272
- });
1273
- }
1274
- const ShapeTypes = new Set([...ApplianceShapes, ...Shapes]);
1275
- function ShapesButton() {
1276
- const {
1277
- theme,
1278
- memberState,
1279
- i18n
1280
- } = useContext(ToolbarContext);
1281
- const appliance = memberState == null ? void 0 : memberState.currentApplianceName;
1282
- const shape = memberState == null ? void 0 : memberState.shapeType;
1283
- const key = appliance === ApplianceNames.shape ? shape : appliance;
1284
- const active = ShapeTypes.has(key);
1285
- const CurrentIcon = ShapesMap[key] || Icons$1.Rectangle;
1286
- return /* @__PURE__ */ jsx("span", {
1287
- className: "fastboard-toolbar-btn-interactive",
1288
- children: /* @__PURE__ */ jsx(Tippy, {
1289
- className: "fastboard-tip",
1290
- content: renderShapesButtonContent(),
1291
- theme,
1292
- placement: "right-start",
1293
- trigger: "click",
1294
- offset: RightOffset,
1295
- arrow: false,
1296
- interactive: true,
1297
- children: /* @__PURE__ */ jsxs(Button$1, {
1298
- content: i18n == null ? void 0 : i18n.t("shape"),
1299
- active,
1300
- children: [/* @__PURE__ */ jsx(CurrentIcon, {
1301
- theme,
1302
- active
1303
- }), /* @__PURE__ */ jsx("span", {
1304
- className: "fastboard-toolbar-triangle"
1305
- })]
1306
- })
1307
- })
1308
- });
1309
- }
1310
- function renderShapesButtonContent() {
1311
- return /* @__PURE__ */ jsxs("div", {
1312
- className: "fastboard-toolbar-panel shapes",
1313
- children: [/* @__PURE__ */ jsx(ShapesBox, {}), /* @__PURE__ */ jsx(CutLine, {}), /* @__PURE__ */ jsx(Slider, {}), /* @__PURE__ */ jsx(CutLine, {}), /* @__PURE__ */ jsx(ColorBox, {})]
1314
- });
1315
- }
1316
- function ShapesBox() {
1317
- const {
1318
- i18n
1319
- } = useContext(ToolbarContext);
1320
- return /* @__PURE__ */ jsxs("div", {
1321
- className: "fastboard-toolbar-shapes",
1322
- children: [ApplianceShapes.map((Appliance) => /* @__PURE__ */ jsx(ApplianceShapeButton, {
1323
- content: i18n == null ? void 0 : i18n.t(Appliance),
1324
- Appliance,
1325
- Icon: ShapesMap[Appliance]
1326
- }, Appliance)), Shapes.map((shape) => /* @__PURE__ */ jsx(ShapeShapeButton, {
1327
- content: i18n == null ? void 0 : i18n.t(shape),
1328
- shape,
1329
- Icon: ShapesMap[shape]
1330
- }, shape))]
1331
- });
1332
- }
1333
- function ApplianceShapeButton({
1334
- content,
1335
- Appliance,
1336
- Icon: Icon2
1337
- }) {
1338
- const {
1339
- theme,
1340
- writable,
1341
- setAppliance,
1342
- memberState
1343
- } = useContext(ToolbarContext);
1344
- const current = memberState == null ? void 0 : memberState.currentApplianceName;
1345
- const disabled = !writable;
1346
- return /* @__PURE__ */ jsx(Button$1, {
1347
- content,
1348
- disabled,
1349
- placement: "top",
1350
- onClick: () => setAppliance(Appliance),
1351
- children: /* @__PURE__ */ jsx(Icon2, {
1352
- theme,
1353
- active: current === Appliance
1354
- })
1355
- });
1356
- }
1357
- function ShapeShapeButton({
1358
- content,
1359
- shape,
1360
- Icon: Icon2
1361
- }) {
1362
- const {
1363
- theme,
1364
- writable,
1365
- setAppliance,
1366
- memberState
1367
- } = useContext(ToolbarContext);
1368
- const appliance = memberState == null ? void 0 : memberState.currentApplianceName;
1369
- const current = appliance === ApplianceNames.shape && (memberState == null ? void 0 : memberState.shapeType);
1370
- const disabled = !writable;
1371
- return /* @__PURE__ */ jsx(Button$1, {
1372
- content,
1373
- disabled,
1374
- placement: "top",
1375
- onClick: () => setAppliance(ApplianceNames.shape, shape),
1376
- children: /* @__PURE__ */ jsx(Icon2, {
1377
- theme,
1378
- active: current === shape
1379
- })
1380
- });
1381
- }
1382
- const Content = React.memo(() => {
1383
- var _a, _b, _c, _d, _e, _f, _g;
1384
- const app = useInstance();
1385
- const ref = useRef(null);
1386
- const [scrollTop, setScrollTop] = useState(0);
1387
- const [parentHeight, setParentHeight] = useState(0);
1388
- const hasAppButton = (_c = (_b = (_a = app == null ? void 0 : app.config.toolbar) == null ? void 0 : _a.apps) == null ? void 0 : _b.enable) != null ? _c : true;
1389
- const needScroll = parentHeight < ItemHeight * ItemsCount + 48;
1390
- const sectionHeight = clamp(parentHeight - 48 * (needScroll ? 3 : 1), MinHeight, MaxHeight);
1391
- const scrollBuffer = Math.max(parentHeight - sectionHeight - 1, 0);
1392
- const disableScrollUp = scrollTop === 0;
1393
- const disableScrollDown = scrollTop === scrollBuffer;
1394
- const scrollTo = useCallback((height) => {
1395
- setScrollTop(clamp(scrollTop + height, 0, scrollBuffer));
1396
- }, [scrollBuffer, scrollTop]);
1397
- useEffect(() => {
1398
- if (ref.current) {
1399
- ref.current.scrollTop = scrollTop;
1400
- }
1401
- }, [scrollTop]);
1402
- useEffect(() => {
1403
- var _a2, _b2;
1404
- const container = (_b2 = (_a2 = ref.current) == null ? void 0 : _a2.parentElement) == null ? void 0 : _b2.parentElement;
1405
- if (container) {
1406
- const {
1407
- paddingTop,
1408
- paddingBottom
1409
- } = getComputedStyle(container);
1410
- const padding = parseInt(paddingTop) + parseInt(paddingBottom) || 0;
1411
- const resizeObserver = new ResizeObserver(() => {
1412
- setParentHeight(container.getBoundingClientRect().height - padding);
1413
- });
1414
- resizeObserver.observe(container);
1415
- return () => resizeObserver.disconnect();
1416
- }
1417
- }, []);
1418
- return /* @__PURE__ */ jsxs(Fragment, {
1419
- children: [needScroll && /* @__PURE__ */ jsx(UpButton, {
1420
- scrollTo,
1421
- disabled: disableScrollUp
1422
- }), /* @__PURE__ */ jsxs("div", {
1423
- ref,
1424
- className: clsx(`${name$4}-section`),
1425
- style: {
1426
- height: `${sectionHeight}px`,
1427
- overflow: needScroll ? "hidden" : "visible"
1428
- },
1429
- children: [/* @__PURE__ */ jsx(ClickerButton, {}), /* @__PURE__ */ jsx(SelectorButton, {}), /* @__PURE__ */ jsx(PencilButton, {}), /* @__PURE__ */ jsx(TextButton, {}), /* @__PURE__ */ jsx(ShapesButton, {}), /* @__PURE__ */ jsx(EraserButton, {}), /* @__PURE__ */ jsx(CleanButton, {}), hasAppButton && /* @__PURE__ */ jsx(AppsButton, {
1430
- content: (_e = (_d = app == null ? void 0 : app.config.toolbar) == null ? void 0 : _d.apps) == null ? void 0 : _e.content,
1431
- onClick: (_g = (_f = app == null ? void 0 : app.config.toolbar) == null ? void 0 : _f.apps) == null ? void 0 : _g.onClick
1432
- })]
1433
- }), needScroll && /* @__PURE__ */ jsx(DownButton, {
1434
- scrollTo,
1435
- disabled: disableScrollDown
1436
- })]
1437
- });
1438
- });
1439
- var collapsePNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAB8CAYAAAAMw2JFAAAAAXNSR0IArs4c6QAAA49JREFUeF7tnLFv00AUh5/TFVYkxIDEnKFjJ/gb2CIqpUPagYXNEV2LRGk7tAiRSA0bWcC0QzowwQKuVDnCLE2KTZCMSNLkHCLalCpBkdFVMTKh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AsIRUkKijsTSkdi0f8WmIS42LYKxaJqMRRtpLBpr8URTpK3GrrEYU1GUx6E3X7sHhUzTfJZKpV5cNFvBrY10NDqFEFKz2ex6Pp/3nDZhDuIaJrMPDg425ufncac3HrXzHCZjCuIar9vJZDI5TdPweN2lJpKYgLhlLBQKqzQDh4FA/MhI2ptQg/iVkTkIrYxMQdwyyrK8pet6uONxLGQMlAhLGalBXDK+z2azG6TKSFqIdNxrzNZXZSQtRDp+0eDxDmsZLwUSxvQqEWQ4nN4n3aZJLxT0uLS3t7cdhowk0Ph8gQGJNKzjvwGKWUjXcvHclAAAAABJRU5ErkJggg==";
1441
- const Mask = React.memo(({
1442
- toolbar,
1443
- children
1444
- }) => {
1445
- const [rootElement] = useState(() => {
1446
- const element = document.createElement("div");
1447
- element.style.position = "absolute";
1448
- return element;
1449
- });
1450
- useEffect(() => {
1451
- if (toolbar && rootElement) {
1452
- toolbar.appendChild(rootElement);
1453
- }
1454
- }, [rootElement, toolbar]);
1455
- useEffect(() => {
1456
- if (rootElement && toolbar) {
1457
- toolbar.appendChild(rootElement);
1458
- const toolbarRect = toolbar.getBoundingClientRect();
1459
- const halfHeight = toolbarRect.height / 2 - 31;
1460
- rootElement.style.top = halfHeight + "px";
1461
- rootElement.style.left = "41px";
1462
- rootElement.style.width = "17px";
1463
- rootElement.style.height = "62px";
1464
- return () => {
1465
- toolbar.removeChild(rootElement);
1466
- };
1467
- }
1468
- }, [rootElement, toolbar]);
1469
- if (rootElement) {
1470
- return ReactDOM.createPortal(children, rootElement);
1471
- } else {
1472
- return null;
1473
- }
1474
- });
1475
- const ToolbarContext = createContext(__spreadValues({
1476
- theme: "light"
1477
- }, EmptyToolbarHook));
1478
- const name$4 = "fastboard-toolbar";
1479
- const Toolbar = ({
1480
- theme = "light",
1481
- icons,
1482
- room,
1483
- manager,
1484
- i18n
1485
- }) => {
1486
- const [expanded, setExpanded] = useState(true);
1487
- const hook = useToolbar(room, manager);
1488
- const [toolbar, toolbarRef] = useState(null);
1489
- const [onHover, setOnHover] = useState(false);
1490
- const [pointEvents, setPointEvents] = useState(true);
1491
- const disabled = !hook.writable;
1492
- const toggle = useCallback(() => {
1493
- setExpanded((e) => !e);
1494
- }, []);
1495
- return /* @__PURE__ */ jsx(ToolbarContext.Provider, {
1496
- value: __spreadProps(__spreadValues({
1497
- theme,
1498
- icons
1499
- }, hook), {
1500
- i18n
1501
- }),
1502
- children: /* @__PURE__ */ jsx(AnimatePresence, {
1503
- children: expanded ? /* @__PURE__ */ jsxs(motion.div, {
1504
- initial: {
1505
- x: -100
1506
- },
1507
- animate: {
1508
- x: 0,
1509
- transition: {
1510
- duration: 0.5
1511
- }
1512
- },
1513
- ref: toolbarRef,
1514
- className: clsx(name$4, theme),
1515
- onPointerEnter: () => {
1516
- if (expanded) {
1517
- setOnHover(true);
1518
- }
1519
- },
1520
- onMouseLeave: () => setOnHover(false),
1521
- exit: {
1522
- x: -100,
1523
- transition: {
1524
- duration: 0.5
1525
- }
1526
- },
1527
- onAnimationStart: () => setPointEvents(false),
1528
- onAnimationComplete: () => setPointEvents(true),
1529
- style: {
1530
- pointerEvents: pointEvents ? "auto" : "none"
1531
- },
1532
- children: [/* @__PURE__ */ jsx(Content, {}), expanded && onHover && /* @__PURE__ */ jsx(Mask, {
1533
- toolbar,
1534
- children: /* @__PURE__ */ jsx("div", {
1535
- onClick: toggle,
1536
- children: /* @__PURE__ */ jsx("img", {
1537
- draggable: false,
1538
- className: clsx(`${name$4}-mask-btn`, theme),
1539
- src: collapsePNG
1540
- })
1541
- })
1542
- })]
1543
- }, "toolbar") : /* @__PURE__ */ jsx(motion.div, {
1544
- className: clsx(`${name$4}-expand-btn`, theme),
1545
- onClick: toggle,
1546
- initial: {
1547
- x: -100
1548
- },
1549
- animate: {
1550
- x: 0,
1551
- transition: {
1552
- duration: 0.5
1553
- }
1554
- },
1555
- children: !expanded && /* @__PURE__ */ jsx(Icon, {
1556
- fallback: /* @__PURE__ */ jsx("img", {
1557
- draggable: false,
1558
- src: expandPNG,
1559
- className: clsx(`${name$4}-mask-btn`, theme)
1560
- }),
1561
- src: disabled ? icons == null ? void 0 : icons.expandIconDisable : icons == null ? void 0 : icons.expandIcon
1562
- })
1563
- }, "expand")
1564
- })
1565
- });
1566
- };
1567
- function useRedoUndo(room, manager) {
1568
- const [undoSteps, setUndoSteps] = useState(0);
1569
- const [redoSteps, setRedoSteps] = useState(0);
1570
- useEffect(() => {
1571
- if (manager) {
1572
- manager.mainView.callbacks.on("onCanUndoStepsUpdate", setUndoSteps);
1573
- manager.mainView.callbacks.on("onCanRedoStepsUpdate", setRedoSteps);
1574
- return () => {
1575
- manager.mainView.callbacks.off("onCanUndoStepsUpdate", setUndoSteps);
1576
- manager.mainView.callbacks.off("onCanRedoStepsUpdate", setRedoSteps);
1577
- };
1578
- }
1579
- if (room) {
1580
- room.callbacks.on("onCanUndoStepsUpdate", setUndoSteps);
1581
- room.callbacks.on("onCanRedoStepsUpdate", setRedoSteps);
1582
- return () => {
1583
- room.callbacks.off("onCanUndoStepsUpdate", setUndoSteps);
1584
- room.callbacks.off("onCanRedoStepsUpdate", setRedoSteps);
1585
- };
1586
- }
1587
- }, [room, manager]);
1588
- const undo = useCallback(() => {
1589
- if (manager) {
1590
- manager.mainView.undo();
1591
- } else if (room) {
1592
- room.undo();
1593
- }
1594
- }, [manager, room]);
1595
- const redo = useCallback(() => {
1596
- if (manager) {
1597
- manager.mainView.redo();
1598
- } else if (room) {
1599
- room.redo();
1600
- }
1601
- }, [manager, room]);
1602
- return { redoSteps, undoSteps, redo, undo };
1603
- }
1604
- function Undo({
1605
- theme = "light",
1606
- active
1607
- }) {
1608
- const config = themes[theme];
1609
- const stroke = active ? config.activeColor : config.color;
1610
- return /* @__PURE__ */ jsx("svg", {
1611
- viewBox: "0 0 24 24",
1612
- children: /* @__PURE__ */ jsxs("g", {
1613
- fill: "none",
1614
- fillRule: "evenodd",
1615
- stroke,
1616
- strokeLinecap: "round",
1617
- strokeLinejoin: "round",
1618
- children: [/* @__PURE__ */ jsx("path", {
1619
- d: "M10 14H6v-4"
1620
- }), /* @__PURE__ */ jsx("path", {
1621
- d: "m6 14 .788-.9A7.005 7.005 0 0 1 18 14h0"
1622
- })]
1623
- })
1624
- });
1625
- }
1626
- function Redo({
1627
- theme = "light",
1628
- active
1629
- }) {
1630
- const config = themes[theme];
1631
- const stroke = active ? config.activeColor : config.color;
1632
- return /* @__PURE__ */ jsx("svg", {
1633
- viewBox: "0 0 24 24",
1634
- children: /* @__PURE__ */ jsxs("g", {
1635
- fill: "none",
1636
- fillRule: "evenodd",
1637
- stroke,
1638
- strokeLinecap: "round",
1639
- strokeLinejoin: "round",
1640
- children: [/* @__PURE__ */ jsx("path", {
1641
- d: "M14 14h4v-4"
1642
- }), /* @__PURE__ */ jsx("path", {
1643
- d: "m18 14-.788-.9A7.005 7.005 0 0 0 6 14h0"
1644
- })]
1645
- })
1646
- });
1647
- }
1648
- const name$3 = "fastboard-redo-undo";
1649
- function RedoUndo({
1650
- room,
1651
- manager,
1652
- theme = "light",
1653
- undoIcon,
1654
- undoIconDisable,
1655
- redoIcon,
1656
- redoIconDisable,
1657
- i18n
1658
- }) {
1659
- const writable = useWritable(room);
1660
- const {
1661
- redoSteps,
1662
- undoSteps,
1663
- redo,
1664
- undo
1665
- } = useRedoUndo(room, manager);
1666
- const disabled = !writable;
1667
- return /* @__PURE__ */ jsxs("div", {
1668
- className: clsx(name$3, theme),
1669
- children: [/* @__PURE__ */ jsx(Tippy, {
1670
- className: "fastboard-tip",
1671
- content: i18n == null ? void 0 : i18n.t("undo"),
1672
- theme,
1673
- disabled,
1674
- placement: "top",
1675
- duration: 300,
1676
- offset: TopOffset,
1677
- children: /* @__PURE__ */ jsx("button", {
1678
- className: clsx(`${name$3}-btn`, "undo", theme),
1679
- disabled: disabled || undoSteps === 0,
1680
- onClick: undo,
1681
- children: /* @__PURE__ */ jsx(Icon, {
1682
- fallback: /* @__PURE__ */ jsx(Undo, {
1683
- theme
1684
- }),
1685
- src: undoSteps === 0 ? undoIconDisable : undoIcon,
1686
- alt: "[undo]"
1687
- })
1688
- })
1689
- }), /* @__PURE__ */ jsx(Tippy, {
1690
- className: "fastboard-tip",
1691
- content: i18n == null ? void 0 : i18n.t("redo"),
1692
- theme,
1693
- disabled,
1694
- placement: "top",
1695
- duration: 300,
1696
- offset: TopOffset,
1697
- children: /* @__PURE__ */ jsx("button", {
1698
- className: clsx(`${name$3}-btn`, "redo", theme),
1699
- disabled: disabled || redoSteps === 0,
1700
- onClick: redo,
1701
- children: /* @__PURE__ */ jsx(Icon, {
1702
- fallback: /* @__PURE__ */ jsx(Redo, {
1703
- theme
1704
- }),
1705
- src: redoSteps === 0 ? redoIconDisable : redoIcon,
1706
- alt: "[redo]"
1707
- })
1708
- })
1709
- })]
1710
- });
1711
- }
1712
- const ScalePoints = [
1713
- 0.10737418240000011,
1714
- 0.13421772800000012,
1715
- 0.16777216000000014,
1716
- 0.20971520000000016,
1717
- 0.26214400000000015,
1718
- 0.3276800000000002,
1719
- 0.4096000000000002,
1720
- 0.5120000000000001,
1721
- 0.6400000000000001,
1722
- 0.8,
1723
- 1,
1724
- 1.26,
1725
- 1.5876000000000001,
1726
- 2.000376,
1727
- 2.5204737600000002,
1728
- 3.1757969376000004,
1729
- 4.001504141376,
1730
- 5.041895218133761,
1731
- 6.352787974848539,
1732
- 8.00451284830916,
1733
- 10
1734
- ];
1735
- function nextScale(scale, delta) {
1736
- const { length } = ScalePoints;
1737
- const last = length - 1;
1738
- if (scale < ScalePoints[0])
1739
- return ScalePoints[0];
1740
- if (scale > ScalePoints[last])
1741
- return ScalePoints[last];
1742
- for (let i = 0; i < length; ++i) {
1743
- const curr = ScalePoints[i];
1744
- const prev = i === 0 ? -Infinity : (ScalePoints[i - 1] + curr) / 2;
1745
- const next = i === last ? Infinity : (ScalePoints[i + 1] + curr) / 2;
1746
- if (prev <= scale && scale <= next)
1747
- return ScalePoints[clamp(i + delta, 0, last)];
1748
- }
1749
- return 1;
1750
- }
1751
- function useZoomControl(room, manager) {
1752
- const [scale, setScale] = useState(1);
1753
- const resetCamera = useCallback(() => {
1754
- if (manager) {
1755
- manager.mainView.moveCamera({ scale: 1, centerX: 0, centerY: 0 });
1756
- } else if (room) {
1757
- const { scenes, index } = room.state.sceneState;
1758
- if (scenes[index].ppt) {
1759
- room.scalePptToFit();
1760
- } else {
1761
- room.moveCamera({ scale: 1, centerX: 0, centerY: 0 });
1762
- }
1763
- }
1764
- }, [room, manager]);
1765
- const zoomIn = useCallback(() => {
1766
- if (manager) {
1767
- manager.mainView.moveCamera({
1768
- scale: nextScale(scale, 1),
1769
- centerX: 0,
1770
- centerY: 0
1771
- });
1772
- } else if (room) {
1773
- room.moveCamera({
1774
- scale: nextScale(scale, 1),
1775
- centerX: 0,
1776
- centerY: 0
1777
- });
1778
- }
1779
- }, [room, manager, scale]);
1780
- const zoomOut = useCallback(() => {
1781
- if (manager) {
1782
- manager.mainView.moveCamera({
1783
- scale: nextScale(scale, -1),
1784
- centerX: 0,
1785
- centerY: 0
1786
- });
1787
- } else if (room) {
1788
- room.moveCamera({
1789
- scale: nextScale(scale, -1),
1790
- centerX: 0,
1791
- centerY: 0
1792
- });
1793
- }
1794
- }, [room, manager, scale]);
1795
- useEffect(() => {
1796
- if (manager) {
1797
- setScale(manager.mainView.camera.scale);
1798
- const onCameraUpdated = ({ scale: scale2 }) => setScale(scale2);
1799
- manager.mainView.callbacks.on("onCameraUpdated", onCameraUpdated);
1800
- return () => {
1801
- manager.mainView.callbacks.off("onCameraUpdated", onCameraUpdated);
1802
- };
1803
- }
1804
- if (room) {
1805
- setScale(room.state.cameraState.scale);
1806
- const onRoomStateChanged = (modifyState) => {
1807
- if (modifyState.cameraState) {
1808
- setScale(modifyState.cameraState.scale);
1809
- }
1810
- };
1811
- room.callbacks.on("onRoomStateChanged", onRoomStateChanged);
1812
- return () => {
1813
- room.callbacks.off("onRoomStateChanged", onRoomStateChanged);
1814
- };
1815
- }
1816
- }, [room, manager]);
1817
- return { scale, resetCamera, zoomIn, zoomOut };
1818
- }
1819
- function Minus({
1820
- theme = "light",
1821
- active
1822
- }) {
1823
- const config = themes[theme];
1824
- const stroke = active ? config.activeColor : config.color;
1825
- return /* @__PURE__ */ jsx("svg", {
1826
- viewBox: "0 0 24 24",
1827
- children: /* @__PURE__ */ jsx("path", {
1828
- fill: "none",
1829
- stroke,
1830
- strokeLinecap: "round",
1831
- strokeLinejoin: "round",
1832
- d: "M7 12h10"
1833
- })
1834
- });
1835
- }
1836
- function Plus({
1837
- theme = "light",
1838
- active
1839
- }) {
1840
- const config = themes[theme];
1841
- const stroke = active ? config.activeColor : config.color;
1842
- return /* @__PURE__ */ jsx("svg", {
1843
- viewBox: "0 0 24 24",
1844
- children: /* @__PURE__ */ jsx("path", {
1845
- fill: "none",
1846
- stroke,
1847
- strokeLinecap: "round",
1848
- strokeLinejoin: "round",
1849
- d: "M12 7v10m-5-5h10"
1850
- })
1851
- });
1852
- }
1853
- function Reset({
1854
- theme = "light",
1855
- active
1856
- }) {
1857
- const config = themes[theme];
1858
- const stroke = active ? config.activeColor : config.color;
1859
- return /* @__PURE__ */ jsx("svg", {
1860
- viewBox: "0 0 24 24",
1861
- children: /* @__PURE__ */ jsxs("g", {
1862
- fill: "none",
1863
- fillRule: "evenodd",
1864
- transform: "translate(-176 -684)",
1865
- children: [/* @__PURE__ */ jsx("path", {
1866
- stroke,
1867
- strokeLinejoin: "round",
1868
- d: "M188 688v4m0 8v4m8-8h-4m-8 0h-4"
1869
- }), /* @__PURE__ */ jsx("circle", {
1870
- cx: "188",
1871
- cy: "696",
1872
- r: "6",
1873
- stroke
1874
- }), /* @__PURE__ */ jsx("circle", {
1875
- cx: "188",
1876
- cy: "696",
1877
- r: "1",
1878
- fill: stroke
1879
- })]
1880
- })
1881
- });
1882
- }
1883
- const name$2 = "fastboard-zoom-control";
1884
- function ZoomControl({
1885
- room,
1886
- manager,
1887
- theme = "light",
1888
- resetIcon,
1889
- resetIconDisable,
1890
- minusIcon,
1891
- minusIconDisable,
1892
- plusIcon,
1893
- plusIconDisable,
1894
- i18n
1895
- }) {
1896
- const writable = useWritable(room);
1897
- const {
1898
- scale,
1899
- resetCamera,
1900
- zoomIn,
1901
- zoomOut
1902
- } = useZoomControl(room, manager);
1903
- const disabled = !writable;
1904
- return /* @__PURE__ */ jsxs("div", {
1905
- className: clsx(name$2, theme),
1906
- children: [/* @__PURE__ */ jsx(Tippy, {
1907
- className: "fastboard-tip",
1908
- content: i18n == null ? void 0 : i18n.t("zoomOut"),
1909
- theme,
1910
- disabled,
1911
- placement: "top",
1912
- duration: 300,
1913
- offset: TopOffset,
1914
- children: /* @__PURE__ */ jsx("button", {
1915
- className: clsx(`${name$2}-btn`, "minus", theme),
1916
- disabled,
1917
- onClick: zoomOut,
1918
- children: /* @__PURE__ */ jsx(Icon, {
1919
- fallback: /* @__PURE__ */ jsx(Minus, {
1920
- theme
1921
- }),
1922
- src: disabled ? minusIconDisable : minusIcon,
1923
- alt: "[minus]"
1924
- })
1925
- })
1926
- }), /* @__PURE__ */ jsx("span", {
1927
- className: clsx(`${name$2}-scale`, theme),
1928
- children: Math.ceil(scale * 100)
1929
- }), /* @__PURE__ */ jsx("span", {
1930
- className: clsx(`${name$2}-percent`, theme),
1931
- children: "%"
1932
- }), /* @__PURE__ */ jsx(Tippy, {
1933
- className: "fastboard-tip",
1934
- content: i18n == null ? void 0 : i18n.t("zoomIn"),
1935
- theme,
1936
- disabled,
1937
- placement: "top",
1938
- duration: 300,
1939
- offset: TopOffset,
1940
- children: /* @__PURE__ */ jsx("button", {
1941
- className: clsx(`${name$2}-btn`, "plus", theme),
1942
- disabled,
1943
- onClick: zoomIn,
1944
- children: /* @__PURE__ */ jsx(Icon, {
1945
- fallback: /* @__PURE__ */ jsx(Plus, {
1946
- theme
1947
- }),
1948
- src: disabled ? plusIconDisable : plusIcon,
1949
- alt: "[plus]"
1950
- })
1951
- })
1952
- }), /* @__PURE__ */ jsx(Tippy, {
1953
- className: "fastboard-tip",
1954
- content: i18n == null ? void 0 : i18n.t("reset"),
1955
- theme,
1956
- disabled,
1957
- placement: "top",
1958
- duration: 300,
1959
- offset: TopOffset,
1960
- children: /* @__PURE__ */ jsx("button", {
1961
- className: clsx(`${name$2}-btn`, "reset", theme),
1962
- disabled,
1963
- onClick: resetCamera,
1964
- children: /* @__PURE__ */ jsx(Icon, {
1965
- fallback: /* @__PURE__ */ jsx(Reset, {
1966
- theme
1967
- }),
1968
- src: disabled ? resetIconDisable : resetIcon,
1969
- alt: "[reset]"
1970
- })
1971
- })
1972
- })]
1973
- });
1974
- }
1975
- function usePageControl(room, manager) {
1976
- const [pageIndex, setPageIndex] = useState(0);
1977
- const [pageCount, setPageCount] = useState(0);
1978
- const addPage = useCallback(async () => {
1979
- if (manager && room) {
1980
- await manager.switchMainViewToWriter();
1981
- const path = room.state.sceneState.contextPath;
1982
- room.putScenes(path, [{}], pageIndex + 1);
1983
- await manager.setMainViewSceneIndex(pageIndex + 1);
1984
- } else if (!manager && room) {
1985
- const path = room.state.sceneState.contextPath;
1986
- room.putScenes(path, [{}], pageIndex + 1);
1987
- room.setSceneIndex(pageIndex + 1);
1988
- }
1989
- }, [room, manager, pageIndex]);
1990
- const prevPage = useCallback(() => {
1991
- if (manager) {
1992
- manager.setMainViewSceneIndex(pageIndex - 1);
1993
- } else if (room) {
1994
- room.pptPreviousStep();
1995
- }
1996
- }, [room, manager, pageIndex]);
1997
- const nextPage = useCallback(() => {
1998
- if (manager) {
1999
- manager.setMainViewSceneIndex(pageIndex + 1);
2000
- } else if (room) {
2001
- room.pptNextStep();
2002
- }
2003
- }, [room, manager, pageIndex]);
2004
- useEffect(() => {
2005
- if (room) {
2006
- setPageIndex(room.state.sceneState.index);
2007
- setPageCount(room.state.sceneState.scenes.length);
2008
- if (manager) {
2009
- manager.emitter.on("mainViewSceneIndexChange", setPageIndex);
2010
- return () => {
2011
- manager.emitter.off("mainViewSceneIndexChange", setPageIndex);
2012
- };
2013
- } else {
2014
- const onRoomStateChanged = (modifyState) => {
2015
- if (modifyState.sceneState) {
2016
- setPageIndex(modifyState.sceneState.index);
2017
- setPageCount(modifyState.sceneState.scenes.length);
2018
- }
2019
- };
2020
- room.callbacks.on("onRoomStateChanged", onRoomStateChanged);
2021
- return () => {
2022
- room.callbacks.off("onRoomStateChanged", onRoomStateChanged);
2023
- };
2024
- }
2025
- }
2026
- }, [room, manager]);
2027
- return { pageIndex, pageCount, prevPage, nextPage, addPage };
2028
- }
2029
- function FilePlus({
2030
- theme = "light",
2031
- active
2032
- }) {
2033
- const config = themes[theme];
2034
- const stroke = active ? config.activeColor : config.color;
2035
- return /* @__PURE__ */ jsx("svg", {
2036
- viewBox: "0 0 24 24",
2037
- children: /* @__PURE__ */ jsx("path", {
2038
- fill: stroke,
2039
- d: "M12 7.5a.5.5 0 0 1 .09.992L12 8.5H8a1.5 1.5 0 0 0-1.493 1.356L6.5 10v6a1.5 1.5 0 0 0 1.356 1.493L8 17.5h6a1.5 1.5 0 0 0 1.493-1.356L15.5 16v-4a.5.5 0 0 1 .992-.09l.008.09v4a2.5 2.5 0 0 1-2.336 2.495L14 18.5H8a2.5 2.5 0 0 1-2.495-2.336L5.5 16v-6a2.5 2.5 0 0 1 2.336-2.495L8 7.5h4Zm4-2a.5.5 0 0 1 .492.41L16.5 6v1.5H18a.5.5 0 0 1 .09.992L18 8.5h-1.5V10a.5.5 0 0 1-.992.09L15.5 10V8.5H14a.5.5 0 0 1-.09-.992L14 7.5h1.5V6a.5.5 0 0 1 .5-.5Z"
2040
- })
2041
- });
2042
- }
2043
- function ChevronLeft({
2044
- theme = "light",
2045
- active
2046
- }) {
2047
- const config = themes[theme];
2048
- const stroke = active ? config.activeColor : config.color;
2049
- return /* @__PURE__ */ jsx("svg", {
2050
- viewBox: "0 0 24 24",
2051
- children: /* @__PURE__ */ jsx("path", {
2052
- fill: "none",
2053
- stroke,
2054
- strokeLinecap: "round",
2055
- strokeLinejoin: "round",
2056
- d: "m14 16-2-2-2-2 2-2 2-2"
2057
- })
2058
- });
2059
- }
2060
- function ChevronRight({
2061
- theme = "light",
2062
- active
2063
- }) {
2064
- const config = themes[theme];
2065
- const stroke = active ? config.activeColor : config.color;
2066
- return /* @__PURE__ */ jsx("svg", {
2067
- viewBox: "0 0 24 24",
2068
- children: /* @__PURE__ */ jsx("path", {
2069
- fill: "none",
2070
- stroke,
2071
- strokeLinecap: "round",
2072
- strokeLinejoin: "round",
2073
- d: "m10 16 2-2 2-2-2-2-2-2"
2074
- })
2075
- });
2076
- }
2077
- const name$1 = "fastboard-page-control";
2078
- function PageControl({
2079
- room,
2080
- manager,
2081
- theme = "light",
2082
- addIcon,
2083
- addIconDisable,
2084
- prevIcon,
2085
- prevIconDisable,
2086
- nextIcon,
2087
- nextIconDisable,
2088
- i18n
2089
- }) {
2090
- const writable = useWritable(room);
2091
- const _a = usePageControl(room, manager), {
2092
- pageIndex,
2093
- pageCount
2094
- } = _a, actions = __objRest(_a, [
2095
- "pageIndex",
2096
- "pageCount"
2097
- ]);
2098
- const disabled = !writable;
2099
- return /* @__PURE__ */ jsxs("div", {
2100
- className: clsx(name$1, theme),
2101
- children: [/* @__PURE__ */ jsx(Tippy, {
2102
- className: "fastboard-tip",
2103
- content: i18n == null ? void 0 : i18n.t("prevPage"),
2104
- theme,
2105
- disabled,
2106
- placement: "top",
2107
- duration: 300,
2108
- offset: TopOffset,
2109
- children: /* @__PURE__ */ jsx("button", {
2110
- className: clsx(`${name$1}-btn`, "prev", theme),
2111
- disabled: disabled || pageIndex === 0,
2112
- onClick: actions.prevPage,
2113
- children: /* @__PURE__ */ jsx(Icon, {
2114
- fallback: /* @__PURE__ */ jsx(ChevronLeft, {
2115
- theme
2116
- }),
2117
- src: disabled ? prevIconDisable : prevIcon,
2118
- alt: "[prev]"
2119
- })
2120
- })
2121
- }), /* @__PURE__ */ jsx("span", {
2122
- className: clsx(`${name$1}-page`, theme),
2123
- children: pageCount === 0 ? "\u2026" : pageIndex + 1
2124
- }), /* @__PURE__ */ jsx("span", {
2125
- className: clsx(`${name$1}-slash`, theme),
2126
- children: "/"
2127
- }), /* @__PURE__ */ jsx("span", {
2128
- className: clsx(`${name$1}-page-count`, theme),
2129
- children: pageCount
2130
- }), /* @__PURE__ */ jsx(Tippy, {
2131
- className: "fastboard-tip",
2132
- content: i18n == null ? void 0 : i18n.t("nextPage"),
2133
- theme,
2134
- disabled,
2135
- placement: "top",
2136
- duration: 300,
2137
- offset: TopOffset,
2138
- children: /* @__PURE__ */ jsx("button", {
2139
- className: clsx(`${name$1}-btn`, "next", theme),
2140
- disabled: disabled || pageIndex === pageCount - 1,
2141
- onClick: actions.nextPage,
2142
- children: /* @__PURE__ */ jsx(Icon, {
2143
- fallback: /* @__PURE__ */ jsx(ChevronRight, {
2144
- theme
2145
- }),
2146
- src: disabled ? nextIconDisable : nextIcon,
2147
- alt: "[next]"
2148
- })
2149
- })
2150
- }), /* @__PURE__ */ jsx(Tippy, {
2151
- className: "fastboard-tip",
2152
- content: i18n == null ? void 0 : i18n.t("addPage"),
2153
- theme,
2154
- disabled,
2155
- placement: "top",
2156
- duration: 300,
2157
- offset: TopOffset,
2158
- children: /* @__PURE__ */ jsx("button", {
2159
- className: clsx(`${name$1}-btn`, "add", theme),
2160
- disabled,
2161
- onClick: actions.addPage,
2162
- children: /* @__PURE__ */ jsx(Icon, {
2163
- fallback: /* @__PURE__ */ jsx(FilePlus, {
2164
- theme
2165
- }),
2166
- src: disabled ? addIconDisable : addIcon,
2167
- alt: "[add]"
2168
- })
2169
- })
2170
- })]
2171
- });
2172
- }
2173
- function Root({
2174
- instance: app
2175
- }) {
2176
- const [mux] = useState(() => new Lock());
2177
- const useWhiteboard = useCallback((container) => mux.schedule(container ? () => app.mount(container) : () => app.unmount()), [app, mux]);
2178
- const hideControls = useHideControls(app.manager);
2179
- const showControls = !hideControls;
2180
- const props = {
2181
- room: app.room,
2182
- manager: app.manager,
2183
- i18n: app.i18n
2184
- };
2185
- const {
2186
- Toolbar: toolbar = showControls || hideControls === "toolbar-only",
2187
- RedoUndo: redo_undo = showControls,
2188
- ZoomControl: zoom_control = showControls,
2189
- PageControl: page_control = showControls
2190
- } = app.config.layout || {};
2191
- return /* @__PURE__ */ jsx(Instance.Context.Provider, {
2192
- value: app,
2193
- children: /* @__PURE__ */ jsxs("div", {
2194
- className: "fastboard-root",
2195
- children: [!app.room && /* @__PURE__ */ jsx("div", {
2196
- className: "fastboard-loading",
2197
- children: "Loading\u2026"
2198
- }), /* @__PURE__ */ jsx("div", {
2199
- className: "fastboard-view",
2200
- ref: useWhiteboard
2201
- }), toolbar && /* @__PURE__ */ jsx("div", {
2202
- className: "fastboard-left",
2203
- children: /* @__PURE__ */ jsx(Toolbar, __spreadValues({}, props))
2204
- }), (redo_undo || zoom_control) && /* @__PURE__ */ jsxs("div", {
2205
- className: "fastboard-bottom-left",
2206
- children: [redo_undo && /* @__PURE__ */ jsx(RedoUndo, __spreadValues({}, props)), zoom_control && /* @__PURE__ */ jsx(ZoomControl, __spreadValues({}, props))]
2207
- }), page_control && /* @__PURE__ */ jsx("div", {
2208
- className: "fastboard-bottom-right",
2209
- children: /* @__PURE__ */ jsx(PageControl, __spreadValues({}, props))
2210
- })]
2211
- })
2212
- });
2213
- }
2214
- class Instance {
2215
- constructor(config) {
2216
- __publicField(this, "config");
2217
- __publicField(this, "sdk", null);
2218
- __publicField(this, "room", null);
2219
- __publicField(this, "manager", null);
2220
- __publicField(this, "i18n", null);
2221
- __publicField(this, "ready", false);
2222
- __publicField(this, "resolveReady");
2223
- __publicField(this, "readyPromise");
2224
- __publicField(this, "target", null);
2225
- __publicField(this, "collector", null);
2226
- this.config = __spreadValues({}, config);
2227
- this.refreshReadyPromise();
2228
- this.initialize();
2229
- }
2230
- refreshReadyPromise() {
2231
- this.readyPromise = new Promise((resolve) => {
2232
- this.resolveReady = () => {
2233
- this.resolveReady = noop;
2234
- this.ready = true;
2235
- resolve();
2236
- };
2237
- });
2238
- }
2239
- async initialize() {
2240
- const essentials = await mountWhiteboard(this.config.sdkConfig, this.config.joinRoom, this.config.managerConfig || {}, this.config.language || "en-US");
2241
- this.accept(essentials);
2242
- this.resolveReady();
2243
- }
2244
- bindElement(target) {
2245
- if (this.target && this.target !== target) {
2246
- ReactDOM.unmountComponentAtNode(this.target);
2247
- }
2248
- this.target = target;
2249
- this.forceUpdate();
2250
- }
2251
- bindCollector(collector) {
2252
- this.collector = collector;
2253
- if (this.manager && collector) {
2254
- this.manager.bindCollectorContainer(collector);
2255
- }
2256
- }
2257
- updateLayout(layout) {
2258
- this.config.layout = layout;
2259
- this.forceUpdate();
2260
- }
2261
- async forceUpdate() {
2262
- await this.readyPromise;
2263
- if (this.target) {
2264
- ReactDOM.render(/* @__PURE__ */ jsx(Root, {
2265
- instance: this
2266
- }), this.target);
2267
- }
2268
- }
2269
- accept({
2270
- sdk,
2271
- room,
2272
- manager,
2273
- i18n
2274
- }) {
2275
- this.sdk = sdk;
2276
- this.room = room;
2277
- this.manager = manager;
2278
- this.i18n = i18n;
2279
- this.forceUpdate();
2280
- }
2281
- async dispose() {
2282
- if (this.room) {
2283
- await this.unmount();
2284
- }
2285
- if (this.target) {
2286
- ReactDOM.unmountComponentAtNode(this.target);
2287
- this.sdk = this.room = this.manager = this.target = null;
2288
- }
2289
- }
2290
- async mount(node) {
2291
- await this.readyPromise;
2292
- if (!this.manager) {
2293
- throw new Error(`[WhiteboardApp] mounted, but not found window manager`);
2294
- }
2295
- this.manager.bindContainer(node);
2296
- if (this.collector) {
2297
- this.manager.bindCollectorContainer(this.collector);
2298
- }
2299
- }
2300
- async unmount() {
2301
- if (this.manager) {
2302
- this.manager.destroy();
2303
- this.manager = null;
2304
- }
2305
- if (this.room) {
2306
- try {
2307
- await this.room.disconnect();
2308
- } catch {
2309
- }
2310
- this.room = null;
2311
- }
2312
- this.refreshReadyPromise();
2313
- }
2314
- insertDocs(params) {
2315
- if (!this.manager) {
2316
- throw new Error(`[WhiteboardApp] cannot insert doc before mounted`);
2317
- }
2318
- switch (params.fileType) {
2319
- case "pdf":
2320
- case "ppt":
2321
- return this.manager.addApp({
2322
- kind: "DocsViewer",
2323
- options: {
2324
- scenePath: params.scenePath,
2325
- title: params.title,
2326
- scenes: params.scenes
2327
- }
2328
- });
2329
- case "pptx":
2330
- return this.manager.addApp({
2331
- kind: "Slide",
2332
- options: {
2333
- scenePath: params.scenePath,
2334
- title: params.title,
2335
- scenes: params.scenes
2336
- },
2337
- attributes: {
2338
- taskId: params.taskId,
2339
- url: params.url
2340
- }
2341
- });
2342
- }
2343
- }
2344
- insertCodeEditor() {
2345
- if (!this.manager) {
2346
- throw new Error(`[WhiteboardApp] cannot insert app before mounted`);
2347
- }
2348
- return this.manager.addApp({
2349
- kind: "Monaco",
2350
- options: {
2351
- title: "Code Editor"
2352
- }
2353
- });
2354
- }
2355
- insertGeoGebra() {
2356
- if (!this.manager) {
2357
- throw new Error(`[WhiteboardApp] cannot insert app before mounted`);
2358
- }
2359
- return this.manager.addApp({
2360
- kind: "GeoGebra",
2361
- options: {
2362
- title: "GeoGebra"
2363
- }
2364
- });
2365
- }
2366
- insertCountdown() {
2367
- if (!this.manager) {
2368
- throw new Error(`[WhiteboardApp] cannot insert app before mounted`);
2369
- }
2370
- return this.manager.addApp({
2371
- kind: "Countdown",
2372
- options: {
2373
- title: "Countdown"
2374
- }
2375
- });
2376
- }
2377
- insertMedia({
2378
- title,
2379
- src
2380
- }) {
2381
- if (!this.manager) {
2382
- throw new Error(`[WhiteboardApp] cannot insert app before mounted`);
2383
- }
2384
- return this.manager.addApp({
2385
- kind: BuiltinApps.MediaPlayer,
2386
- options: {
2387
- title
2388
- },
2389
- attributes: {
2390
- src
2391
- }
2392
- });
2393
- }
2394
- async changeLanguage(language) {
2395
- var _a;
2396
- try {
2397
- await ((_a = this.i18n) == null ? void 0 : _a.changeLanguage(language));
2398
- } finally {
2399
- await this.forceUpdate();
2400
- }
2401
- }
2402
- }
2403
- __publicField(Instance, "Context", createContext(null));
2404
- function useInstance() {
2405
- return useContext(Instance.Context);
2406
- }
2407
- var style = '.page-renderer-pages-container{position:relative;overflow:hidden}.page-renderer-page{position:absolute;top:0;left:0;will-change:transform;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;will-change:transform,height;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-window-manager-playground{width:100%;height:100%;position:relative;z-index:1;overflow:hidden;user-select:none}.netless-window-manager-sizer{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;overflow:hidden;display:flex}.netless-window-manager-sizer-horizontal{flex-direction:column}.netless-window-manager-sizer:before,.netless-window-manager-sizer:after{flex:1;content:"";display:block}.netless-window-manager-chess-sizer:before,.netless-window-manager-chess-sizer:after{background-image:linear-gradient(45deg,#b0b0b0 25%,transparent 25%),linear-gradient(-45deg,#b0b0b0 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#b0b0b0 75%),linear-gradient(-45deg,transparent 75%,#b0b0b0 75%);background-color:#fff;background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0px}.netless-window-manager-wrapper{position:relative;z-index:1;width:100%;height:100%;overflow:hidden}.netless-window-manager-main-view{width:100%;height:100%}.netless-window-manager-cursor-pencil-image,.netless-window-manager-cursor-eraser-image{width:26px;height:26px}.netless-window-manager-cursor-selector-image{width:24px;height:24px}.netless-window-manager-cursor-selector-avatar{border-radius:50%;border-style:solid;border-width:2px;border-color:#fff;margin-bottom:2px}.netless-window-manager-cursor-selector-avatar img{width:12px}.netless-window-manager-cursor-inner{border-radius:4px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:4px;padding-right:4px;font-size:12px}.netless-window-manager-cursor-inner-mellow{height:32px;border-radius:16px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:16px;padding-right:16px}.netless-window-manager-cursor-tag-name{font-size:12px;margin-left:4px;padding:2px 8px;border-radius:4px}.netless-window-manager-cursor-mid{display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:26px;height:26px;z-index:2147483647;left:0;top:0;will-change:transform;transition:transform .05s;transform-origin:0 0;user-select:none}.netless-window-manager-cursor-pencil-offset{margin-left:-20px}.netless-window-manager-cursor-selector-offset{margin-left:-22px;margin-top:56px}.netless-window-manager-cursor-text-offset{margin-left:-30px;margin-top:18px}.netless-window-manager-cursor-shape-offset{display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:180px;height:64px;margin-left:-30px;margin-top:12px}.netless-window-manager-cursor-name{width:100%;height:48px;display:flex;align-items:center;justify-content:center;position:absolute;top:-40px}.cursor-image-wrapper{display:flex;justify-content:center}.telebox-collector{position:absolute;right:10px;bottom:15px}.tele-fancy-scrollbar{overscroll-behavior:contain;overflow:auto;overflow-y:scroll;overflow-y:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.tele-fancy-scrollbar::-webkit-scrollbar{height:8px;width:8px}.tele-fancy-scrollbar::-webkit-scrollbar-track{background-color:transparent}.tele-fancy-scrollbar::-webkit-scrollbar-thumb{background-color:#444e601a;background-color:transparent;border-radius:4px;transition:background-color .4s}.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb{background-color:#444e601a}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#444e6033}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active{background-color:#444e6033}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical{min-height:50px}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-box{position:absolute;top:0;left:0;z-index:100;will-change:transform;transition:width .4s cubic-bezier(.4,.9,.71,1.02),height .4s cubic-bezier(.55,.82,.63,.95),opacity .6s cubic-bezier(.7,0,.84,0),transform .4s ease}.telebox-box-main{position:relative;width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;background:#f9f9fc;box-shadow:0 4px 10px #2f419226;border-radius:6px;border:1px solid #e3e3ec}.telebox-titlebar-wrap{flex-shrink:0;position:relative;z-index:1}.telebox-content-wrap{flex:1;width:100%;overflow:hidden;display:flex;justify-content:center;align-items:center}.telebox-content{width:100%;height:100%;position:relative}.telebox-footer-wrap{flex-shrink:0;display:flex;flex-direction:column}.telebox-footer-wrap:before{content:"";display:block;flex:1}.telebox-resize-handle{position:absolute;z-index:2147483647}.telebox-n{width:100%;height:5px;left:0;top:-5px;cursor:n-resize}.telebox-s{width:100%;height:5px;left:0;bottom:-5px;cursor:s-resize}.telebox-w{width:5px;height:100%;left:-5px;top:0;cursor:w-resize}.telebox-e{width:5px;height:100%;right:-5px;top:0;cursor:e-resize}.telebox-nw{width:15px;height:15px;top:-5px;left:-5px;cursor:nw-resize}.telebox-ne{width:15px;height:15px;top:-5px;right:-5px;cursor:ne-resize}.telebox-se{width:15px;height:15px;bottom:-5px;right:-5px;cursor:se-resize}.telebox-sw{width:15px;height:15px;bottom:-5px;left:-5px;cursor:sw-resize}.telebox-track-mask{position:fixed;top:0;left:0;z-index:2147483647;width:100%;height:100%;background:rgba(0,0,0,.0001);cursor:move}.telebox-cursor-n{cursor:n-resize}.telebox-cursor-s{cursor:s-resize}.telebox-cursor-w{cursor:w-resize}.telebox-cursor-e{cursor:e-resize}.telebox-cursor-nw{cursor:nw-resize}.telebox-cursor-ne{cursor:ne-resize}.telebox-cursor-se{cursor:se-resize}.telebox-cursor-sw{cursor:sw-resize}.telebox-maximized .telebox-resize-handles,.telebox-no-resize .telebox-resize-handles{display:none}.telebox-maximized{box-shadow:none;transition:none}.telebox-minimized{will-change:transform;transition:width 50ms cubic-bezier(.4,.9,.71,1.02),height 50ms cubic-bezier(.55,.82,.63,.95),opacity .6s cubic-bezier(.7,0,.84,0),transform .6s ease;opacity:0;pointer-events:none;user-select:none}.telebox-transforming{will-change:transform;transition:opacity .6s cubic-bezier(.7,0,.84,0)}.telebox-readonly .telebox-resize-handle{cursor:initial!important;pointer-events:none!important}.telebox-color-scheme-dark .telebox-box-main{color:#e9e9e9;background:#212126;border-color:#43434d}.telebox-titlebar{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;background:#fff;user-select:none;border-bottom:1px solid #eeeef7}.telebox-title{overflow:hidden;margin:0 24px 0 0;padding:0;font-size:14px;font-weight:400;font-family:PingFangSC-Regular,PingFang SC;white-space:nowrap;word-break:keep-all;text-overflow:ellipsis;color:#191919}.telebox-titlebar-btns{white-space:nowrap;word-break:keep-all;margin-left:auto;font-size:0}.telebox-titlebar-btn{width:22px;height:22px;padding:0;outline:0;border:none;background:0 0;cursor:pointer}.telebox-titlebar-btn~.telebox-titlebar-btn{margin-left:10px}.telebox-titlebar-btn-icon{width:22px;height:22px}.telebox-readonly .telebox-titlebar-btn{cursor:not-allowed}.telebox-titlebar-icon-minimize{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPHBhdGggZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNOSAxM2gxMHYxLjZIOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=)}.telebox-titlebar-icon-maximize{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPGcgZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBtYXNrPSJ1cmwoI2IpIj4KICAgICAgICAgICAgPHBhdGgKICAgICAgICAgICAgICAgIGQ9Ik0yMC40ODEgMTcuMWgxLjJ2NC41ODFIMTcuMXYtMS4yaDMuMzgxVjE3LjF6bS0xNC4xOTA1LS4wMDloMS4ydjMuMzgxaDMuMzgwOXYxLjJoLTQuNTgxdi00LjU4MXpNMTcuMSA2LjE5MDVoNC41ODF2NC41ODA5aC0xLjJ2LTMuMzgxSDE3LjF2LTEuMnptLTEwLjcwMDguMTA4N2g0Ljc5ODV2MS4ySDcuNTk5MnYzLjU5ODVoLTEuMlY2LjI5OTJ6IiAvPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==)}.telebox-titlebar-icon-maximize.is-active{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjZ2MjZIMHoiIC8+CiAgICAgICAgPHBhdGggaWQ9ImMiIGQ9Ik0yNi44NjkgMEwyOCAxLjEzMVYyNi44N0wyNi44NjkgMjhIMS4xM0wwIDI2Ljg3VjEuMTMxTDEuMTMgMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPgogICAgICAgICAgICA8bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNhIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tNC42NDI5LTQuNjQyOWgzNS4yODU4djM1LjI4NThILTQuNjQyOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxnPgogICAgICAgICAgICA8bWFzayBpZD0iZCIgZmlsbD0iI2ZmZiI+CiAgICAgICAgICAgICAgICA8dXNlIHhsaW5rOmhyZWY9IiNjIiAvPgogICAgICAgICAgICA8L21hc2s+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0tMTcuNTE2OCAxNEwxNC0xNy41MTY4IDQ1LjUxNjggMTQgMTQgNDUuNTE2OHoiIG1hc2s9InVybCgjZCkiIC8+CiAgICAgICAgPC9nPgogICAgICAgIDxwYXRoIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjIiCiAgICAgICAgICAgIGQ9Ik0xMC4wODg2IDIxLjQ4NjV2LTMuNjk2Nkg2LjM5Mk0yMS4zODU1IDEwLjE4OTVoLTMuNjk2NlY2LjQ5M00yMS40MDIgMTcuNzk4M2gtMy42OTY2djMuNjk2Nk0xMC4yNTAzIDYuMTQ5OHYzLjg5ODVINi4zNTE3IiAvPgogICAgPC9nPgo8L3N2Zz4K)}.telebox-titlebar-icon-close{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOCAyOCI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjQiPgogICAgICAgIDxwYXRoIGQ9Ik04LjM1MyAyMC4zMzIxTDIwLjMzMiA4LjM1M00yMC4zMzIyIDIwLjMzMjFMOC4zNTMgOC4zNTMiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=)}.telebox-color-scheme-dark .telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-collector{visibility:hidden;display:block;position:absolute;z-index:200;width:40px;height:40px;margin:0;padding:0;border:none;outline:0;font-size:0;border-radius:50%;background:#fff;box-shadow:0 2px 6px #2f419226;cursor:pointer;user-select:none;pointer-events:none;background-repeat:no-repeat;background-size:18px 16px;background-position:center}.telebox-collector-visible{visibility:visible;pointer-events:initial}.telebox-collector-readonly{cursor:not-allowed}.telebox-color-scheme-dark.telebox-collector{background-color:#43434d}.telebox-max-titlebar{display:none;position:absolute;top:0;left:0;z-index:50000;user-select:none}.telebox-max-titlebar-maximized{display:flex}.telebox-titles{flex:1;height:100%;margin:0 16px 0 -16px;overflow-y:hidden;overflow-x:scroll;overflow-x:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.telebox-titles::-webkit-scrollbar{height:8px;width:8px}.telebox-titles::-webkit-scrollbar-track{background-color:transparent}.telebox-titles::-webkit-scrollbar-thumb{background-color:#eeeef7cc;background-color:transparent;border-radius:4px;transition:background-color .4s}.telebox-titles:hover::-webkit-scrollbar-thumb{background-color:#eeeef7cc}.telebox-titles::-webkit-scrollbar-thumb:hover{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:active{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:vertical{min-height:50px}.telebox-titles::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-titles-content{height:100%;display:flex;flex-wrap:nowrap;align-items:center;padding:0}.telebox-titles-tab{overflow:hidden;max-width:182px;min-width:50px;padding:0 26px 0 16px;outline:0;font-size:13px;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;border:none;border-right:1px solid #e5e5f0;color:#7b88a0;background:0 0;cursor:pointer}.telebox-titles-tab~.telebox-titles-tab{margin-left:2px}.telebox-titles-tab-focus{color:#357bf6}.telebox-readonly .telebox-titles-tab{cursor:not-allowed}.telebox-color-scheme-dark{color-scheme:dark}.telebox-color-scheme-dark.telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-color-scheme-dark .telebox-titles-tab{border-right-color:#7b88a0}.telebox-color-scheme-dark .telebox-title{color:#e9e9e9}.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}.tippy-box[data-theme~=light]{color:#26323d;box-shadow:0 0 20px 4px #9aa1b126,0 4px 80px -8px #24282f40,0 4px 4px -2px #5b5e6926;background-color:#fff}.tippy-box[data-theme~=light][data-placement^=top]>.tippy-arrow:before{border-top-color:#fff}.tippy-box[data-theme~=light][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#fff}.tippy-box[data-theme~=light][data-placement^=left]>.tippy-arrow:before{border-left-color:#fff}.tippy-box[data-theme~=light][data-placement^=right]>.tippy-arrow:before{border-right-color:#fff}.tippy-box[data-theme~=light]>.tippy-backdrop{background-color:#fff}.tippy-box[data-theme~=light]>.tippy-svg-arrow{fill:#fff}.rc-slider{position:relative;height:14px;padding:5px 0;width:100%;border-radius:6px;touch-action:none;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.rc-slider *{box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.rc-slider-rail{position:absolute;width:100%;background-color:#e9e9e9;height:4px;border-radius:6px}.rc-slider-track{position:absolute;left:0;height:4px;border-radius:6px;background-color:#abe2fb}.rc-slider-handle{position:absolute;width:14px;height:14px;cursor:pointer;cursor:-webkit-grab;margin-top:-5px;cursor:grab;border-radius:50%;border:solid 2px #96dbfa;background-color:#fff;touch-action:pan-x}.rc-slider-handle-dragging.rc-slider-handle-dragging.rc-slider-handle-dragging{border-color:#57c5f7;box-shadow:0 0 0 5px #96dbfa}.rc-slider-handle:focus{outline:none}.rc-slider-handle-click-focused:focus{border-color:#96dbfa;box-shadow:unset}.rc-slider-handle:hover{border-color:#57c5f7}.rc-slider-handle:active{border-color:#57c5f7;box-shadow:0 0 5px #57c5f7;cursor:-webkit-grabbing;cursor:grabbing}.rc-slider-mark{position:absolute;top:18px;left:0;width:100%;font-size:12px}.rc-slider-mark-text{position:absolute;display:inline-block;vertical-align:middle;text-align:center;cursor:pointer;color:#999}.rc-slider-mark-text-active{color:#666}.rc-slider-step{position:absolute;width:100%;height:4px;background:transparent}.rc-slider-dot{position:absolute;bottom:-2px;margin-left:-4px;width:8px;height:8px;border:2px solid #e9e9e9;background-color:#fff;cursor:pointer;border-radius:50%;vertical-align:middle}.rc-slider-dot-active{border-color:#96dbfa}.rc-slider-dot-reverse{margin-right:-4px}.rc-slider-disabled{background-color:#e9e9e9}.rc-slider-disabled .rc-slider-track{background-color:#ccc}.rc-slider-disabled .rc-slider-handle,.rc-slider-disabled .rc-slider-dot{border-color:#ccc;box-shadow:none;background-color:#fff;cursor:not-allowed}.rc-slider-disabled .rc-slider-mark-text,.rc-slider-disabled .rc-slider-dot{cursor:not-allowed!important}.rc-slider-vertical{width:14px;height:100%;padding:0 5px}.rc-slider-vertical .rc-slider-rail{height:100%;width:4px}.rc-slider-vertical .rc-slider-track{left:5px;bottom:0;width:4px}.rc-slider-vertical .rc-slider-handle{margin-left:-5px;touch-action:pan-y}.rc-slider-vertical .rc-slider-mark{top:0;left:18px;height:100%}.rc-slider-vertical .rc-slider-step{height:100%;width:4px}.rc-slider-vertical .rc-slider-dot{left:2px;margin-bottom:-4px}.rc-slider-vertical .rc-slider-dot:first-child{margin-bottom:-4px}.rc-slider-vertical .rc-slider-dot:last-child{margin-bottom:-4px}.rc-slider-tooltip-zoom-down-enter,.rc-slider-tooltip-zoom-down-appear,.rc-slider-tooltip-zoom-down-leave{animation-duration:.3s;animation-fill-mode:both;display:block!important;animation-play-state:paused}.rc-slider-tooltip-zoom-down-enter.rc-slider-tooltip-zoom-down-enter-active,.rc-slider-tooltip-zoom-down-appear.rc-slider-tooltip-zoom-down-appear-active{animation-name:rcSliderTooltipZoomDownIn;animation-play-state:running}.rc-slider-tooltip-zoom-down-leave.rc-slider-tooltip-zoom-down-leave-active{animation-name:rcSliderTooltipZoomDownOut;animation-play-state:running}.rc-slider-tooltip-zoom-down-enter,.rc-slider-tooltip-zoom-down-appear{transform:scale(0);animation-timing-function:cubic-bezier(.23,1,.32,1)}.rc-slider-tooltip-zoom-down-leave{animation-timing-function:cubic-bezier(.755,.05,.855,.06)}@keyframes rcSliderTooltipZoomDownIn{0%{opacity:0;transform-origin:50% 100%;transform:scale(0)}to{transform-origin:50% 100%;transform:scale(1)}}@keyframes rcSliderTooltipZoomDownOut{0%{transform-origin:50% 100%;transform:scale(1)}to{opacity:0;transform-origin:50% 100%;transform:scale(0)}}.rc-slider-tooltip{position:absolute;left:-9999px;top:-9999px;visibility:visible;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.rc-slider-tooltip *{box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.rc-slider-tooltip-hidden{display:none}.rc-slider-tooltip-placement-top{padding:4px 0 8px}.rc-slider-tooltip-inner{padding:6px 2px;min-width:24px;height:24px;font-size:12px;line-height:1;color:#fff;text-align:center;text-decoration:none;background-color:#6c6c6c;border-radius:6px;box-shadow:0 0 4px #d9d9d9}.rc-slider-tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow{bottom:4px;left:50%;margin-left:-4px;border-width:4px 4px 0;border-top-color:#6c6c6c}.fastboard-root{position:relative;width:100%;height:100%;overflow:hidden}.fastboard-loading{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;opacity:.6}.fastboard-view{position:absolute;top:0;left:0;width:100%;height:100%}.fastboard-left{position:absolute;top:0;left:0;height:calc(100% - 48px);padding:16px;z-index:201;display:flex;align-items:center}.fastboard-bottom-left,.fastboard-bottom-right{display:flex;gap:10px;position:absolute;bottom:8px;left:8px;padding:8px;z-index:200}.fastboard-bottom-right{left:initial;right:8px}.fastboard-redo-undo{display:inline-flex;align-items:center;gap:4px;padding:4px;border-radius:4px;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}.fastboard-redo-undo.light{color:#333;background-color:#ffffffd9;border:1px solid rgba(0,0,0,.15)}.fastboard-redo-undo.dark{color:#ddd;background-color:#333333d9;border:1px solid rgba(0,0,0,.45)}.fastboard-redo-undo-btn{appearance:none;cursor:pointer;margin:0;border:0;padding:0;width:24px;height:24px;background-color:transparent;border-radius:4px;font-size:24px;line-height:1}.fastboard-redo-undo-btn svg,.fastboard-redo-undo-btn img{width:1em;height:1em}.fastboard-redo-undo-btn:disabled{opacity:.5;cursor:not-allowed}.fastboard-redo-undo-btn.light:not(:disabled):hover{background-color:#3381ff1a}.fastboard-redo-undo-btn.dark:not(:disabled):hover{background-color:#3381ff40}.fastboard-page-control{display:inline-flex;align-items:center;gap:4px;padding:4px;border-radius:4px;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}.fastboard-page-control.light{color:#333;background-color:#ffffffd9;border:1px solid rgba(0,0,0,.15)}.fastboard-page-control.dark{color:#ddd;background-color:#333333d9;border:1px solid rgba(0,0,0,.45)}.fastboard-page-control-btn{appearance:none;cursor:pointer;margin:0;border:0;padding:0;width:24px;height:24px;background-color:transparent;border-radius:4px;font-size:24px;line-height:1}.fastboard-page-control-btn svg,.fastboard-page-control-btn img{width:1em;height:1em}.fastboard-page-control-btn:disabled{opacity:.5;cursor:not-allowed}.fastboard-page-control-btn.light:not(:disabled):hover{background-color:#3381ff1a}.fastboard-page-control-btn.dark:not(:disabled):hover{background-color:#3381ff40}.fastboard-page-control-cut-line{height:24px;width:.5px}.fastboard-page-control-cut-line.light{background-color:#e7e7e7}.fastboard-page-control-cut-line.dark{background-color:#ffffff26}.fastboard-page-control-slash{opacity:.6}.fastboard-page-control-page,.fastboard-page-control-slash,.fastboard-page-control-page-count{font-size:12px;font-variant-numeric:tabular-nums}.fastboard-zoom-control{position:relative;display:inline-flex;align-items:center;gap:4px;padding:4px;border-radius:4px;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}.fastboard-zoom-control.light{color:#333;background-color:#ffffffd9;border:1px solid rgba(0,0,0,.15)}.fastboard-zoom-control.dark{color:#ddd;background-color:#333333d9;border:1px solid rgba(0,0,0,.45)}.fastboard-zoom-control-btn{appearance:none;cursor:pointer;margin:0;border:0;padding:0;width:24px;height:24px;background-color:transparent;border-radius:4px;font-size:24px;line-height:1}.fastboard-zoom-control-btn svg,.fastboard-zoom-control-btn img{width:1em;height:1em}.fastboard-zoom-control-btn:disabled{opacity:.5;cursor:not-allowed}.fastboard-zoom-control-btn.light:not(:disabled):hover{background-color:#3381ff1a}.fastboard-zoom-control-btn.dark:not(:disabled):hover{background-color:#3381ff40}.fastboard-zoom-control-cut-line{height:24px;width:.5px}.fastboard-zoom-control-cut-line.light{background-color:#e7e7e7}.fastboard-zoom-control-cut-line.dark{background-color:#ffffff26}.fastboard-zoom-control-percent{opacity:.6}.fastboard-zoom-control-scale,.fastboard-zoom-control-percent{font-size:12px;font-variant-numeric:tabular-nums}.fastboard-toolbar{display:flex;align-items:center;padding:4px;border-radius:4px;flex-direction:column;gap:4px;position:absolute;z-index:100;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}.fastboard-toolbar .rc-slider{padding:6px 0}.fastboard-toolbar .rc-slider-rail,.fastboard-toolbar .rc-slider-track{height:2px}.fastboard-toolbar .tippy-content{padding:8px}.fastboard-toolbar .tippy-box{border:1px solid rgba(0,0,0,.15);background-color:#333333f2;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}.fastboard-toolbar .tippy-box[data-theme~=light]{background-color:#fffffff2;box-shadow:0 5px 10px #00000040}.fastboard-toolbar.light{color:#333;background-color:#ffffffd9;border:1px solid rgba(0,0,0,.15)}.fastboard-toolbar.expanded{border:1px solid rgba(0,0,0,.15)}.fastboard-toolbar.dark{color:#ddd;background-color:#333333d9}.fastboard-toolbar.expanded:hover{box-shadow:0 0 5px #00000040;transform:translate(0)}.fastboard-toolbar.collapsed{padding:0;background-color:transparent}.fastboard-toolbar-tooltip{display:inline-flex;align-items:center;gap:4px}.fastboard-toolbar-hotkey{margin-right:-4px;width:24px;height:24px;border-radius:4px;background-color:#ffffff1a;display:inline-flex;align-items:center;justify-content:center}.fastboard-toolbar-btn{appearance:none;cursor:pointer;margin:0;border:0;padding:4px;width:32px;height:32px;background-color:transparent;border-radius:4px;font-size:24px;line-height:1;position:relative}.fastboard-toolbar-btn-interactive{display:inline-block;width:32px;height:32px}.fastboard-toolbar-btn svg,.fastboard-toolbar-btn img{width:1em;height:1em}.fastboard-toolbar-btn:disabled{opacity:.5;cursor:not-allowed}.fastboard-toolbar-btn.light:not(:disabled):hover{background-color:#3381ff1a}.fastboard-toolbar-btn.dark:not(:disabled):hover{background-color:#3381ff40}.fastboard-toolbar-triangle{width:0px;height:0px;border-bottom:4px solid;border-left:4px solid transparent;position:absolute;bottom:0;right:0}.fastboard-toolbar-cut-line{display:inline-block;height:.5px;width:100%}.fastboard-toolbar-cut-line.light{background-color:#e7e7e7}.fastboard-toolbar-cut-line.dark{background-color:#ffffff26}.fastboard-toolbar-section{display:inline-flex;flex-flow:column nowrap;gap:4px;scroll-behavior:smooth}.fastboard-toolbar-section.collapsed{transform:translate(-100%);transition:1s transform}.fastboard-toolbar-panel{width:120px;padding:0;display:flex;flex-flow:column nowrap;align-items:center;gap:8px}.fastboard-toolbar-panel.apps{width:224px}.fastboard-toolbar-color-box,.fastboard-toolbar-shapes{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;align-items:center;justify-items:center}.fastboard-toolbar-color-box .fastboard-toolbar-btn,.fastboard-toolbar-shapes .fastboard-toolbar-btn{padding:0;width:24px;height:24px}.fastboard-toolbar-apps{width:100%;display:grid;grid-template-columns:repeat(3,1fr);gap:8px;align-items:center;justify-items:center}.fastboard-toolbar-apps .fastboard-toolbar-btn{width:40px;height:40px;font-size:40px}.fastboard-toolbar-app-icon{padding-top:4px;display:inline-flex;flex-flow:column nowrap;align-items:center;gap:4px}.fastboard-toolbar-app-icon .fastboard-toolbar-btn{padding:0}.fastboard-toolbar-app-icon-text{font-size:12px;color:#5d5d5d;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.fastboard-toolbar-color-item{width:24px;height:24px;border-radius:4px;cursor:pointer}.fastboard-toolbar-color-item *.light:hover{background-color:#f5f5f5}.fastboard-toolbar-color-item *.dark:hover{background-color:#333}.fastboard-toolbar-color-border{width:24px;height:24px;border:1px solid transparent;border-radius:4px;display:inline-flex;align-items:center;justify-content:center}.fastboard-toolbar-color-border.active.light,.fastboard-toolbar-color-border.active.dark{border:1px solid rgba(51,129,255,.8)}.fastboard-toolbar-color-btn{margin:0;border:1px solid rgba(0,0,0,.24);padding:0;appearance:none;width:16px;height:16px;border-radius:4px;cursor:pointer}.fastboard-toolbar-color-btn:focus-visible{outline-offset:2px}.fastboard-toolbar-mask-btn{width:17px;height:62px;cursor:pointer}.fastboard-toolbar-mask-btn.dark{filter:invert(.8)}.fastboard-toolbar-expand-btn{display:flex;align-items:center;position:absolute;left:0}.fastboard-player-control{width:100%;display:inline-flex;align-items:center;gap:4px;padding:4px;border-radius:4px;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}.fastboard-player-control.auto-hide{opacity:0;transition:opacity .2s}.fastboard-player-control.auto-hide:hover{opacity:1}.fastboard-player-control .rc-slider-disabled{background:transparent;opacity:.5}.fastboard-player-control .rc-slider-rail,.fastboard-player-control .rc-slider-track{height:2px}.fastboard-player-control .tippy-content{padding:8px}.fastboard-player-control .tippy-box{border:1px solid rgba(0,0,0,.15);background-color:#333333f2;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}.fastboard-player-control .tippy-box[data-theme~=light]{background-color:#fffffff2;box-shadow:0 5px 10px #00000040}.fastboard-player-control.light{color:#333;background-color:#ffffffd9;border:1px solid rgba(0,0,0,.15)}.fastboard-player-control.dark{color:#ddd;background-color:#333333d9;border:1px solid rgba(0,0,0,.45)}.fastboard-player-control-btn{appearance:none;cursor:pointer;margin:0;border:0;padding:0;min-width:24px;height:24px;background-color:transparent;border-radius:4px;font-size:24px;line-height:1;display:inline-flex;align-items:center;justify-content:center}.fastboard-player-control-btn svg,.fastboard-player-control-btn img{width:1em;height:1em}.fastboard-player-control-btn:disabled{opacity:.5;cursor:not-allowed}.fastboard-player-control-btn.light:not(:disabled):hover{background-color:#3381ff1a}.fastboard-player-control-btn.dark:not(:disabled):hover{background-color:#3381ff40}.fastboard-player-control-btn.loading{animation:fastboard-player-control-rotate .5s linear infinite}@keyframes fastboard-player-control-rotate{to{transform:rotate(360deg)}}.fastboard-player-control-panel{padding:0;display:flex;flex-flow:column nowrap;align-items:stretch;gap:4px}.fastboard-player-control-panel .fastboard-player-control-btn{width:initial;height:initial;user-select:none;font-size:12px;padding:4px;justify-content:flex-end}.fastboard-player-control-panel .fastboard-player-control-btn.active{color:#3381ff}.fastboard-player-control-slider{width:100%;padding:0 7px}.fastboard-player-control-slider.loading{cursor:not-allowed}.fastboard-player-control-slash{opacity:.6}.fastboard-player-control-current,.fastboard-player-control-slash,.fastboard-player-control-total,.fastboard-player-control-speed-text{font-size:12px;font-variant-numeric:tabular-nums}.fastboard{width:100%;height:100%;position:relative}.tippy-box.fastboard-tip{color:#eee;background-color:#000000f2;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}.tippy-box.fastboard-tip[data-placement^=right]>.tippy-arrow:before{top:4px;border-width:4px;border-right-color:#000}.tippy-box.fastboard-tip[data-placement^=top]>.tippy-arrow:before{left:4px;border-width:4px;border-top-color:#000}\n';
2408
- applyStyles(style);
2409
- class WhiteboardApp {
2410
- constructor(config) {
2411
- __publicField(this, "_instance");
2412
- this.config = config;
2413
- this._instance = new Instance(config);
2414
- }
2415
- get room() {
2416
- return this._instance.room;
2417
- }
2418
- get manager() {
2419
- return this._instance.manager;
2420
- }
2421
- get sdk() {
2422
- return this._instance.sdk;
2423
- }
2424
- get i18n() {
2425
- return this._instance.i18n;
2426
- }
2427
- get target() {
2428
- return this._instance.target;
2429
- }
2430
- get collector() {
2431
- return this._instance.collector;
2432
- }
2433
- bindElement(target) {
2434
- this._instance.bindElement(target || null);
2435
- }
2436
- bindCollector(collector) {
2437
- this._instance.bindCollector(collector || null);
2438
- }
2439
- get layout() {
2440
- return this._instance.config.layout;
2441
- }
2442
- updateLayout(layout) {
2443
- this._instance.updateLayout(layout);
2444
- }
2445
- insertMedia(params) {
2446
- this._instance.insertMedia(params);
2447
- }
2448
- insertDocs(arg1, arg2) {
2449
- if (typeof arg1 === "object" && "fileType" in arg1) {
2450
- return this._instance.insertDocs(arg1);
2451
- } else if (arg2 && arg2.status !== "Finished") {
2452
- throw new Error("[WhiteboardApp] cannot insert a converting doc");
2453
- } else if (arg2 && arg2.progress) {
2454
- const scenes = arg2.progress.convertedFileList.map((f2, i) => ({
2455
- name: String(i + 1),
2456
- ppt: {
2457
- src: f2.conversionFileUrl,
2458
- width: f2.width,
2459
- height: f2.height,
2460
- previewURL: f2.preview
2461
- }
2462
- }));
2463
- const uid = genUID();
2464
- const scenePath = `/${arg2.uuid}/${uid}`;
2465
- const { scenesWithoutPPT, taskId, url } = makeSlideParams(scenes);
2466
- if (taskId && url) {
2467
- return this._instance.insertDocs({
2468
- fileType: "pptx",
2469
- scenePath,
2470
- taskId,
2471
- title: arg1,
2472
- url,
2473
- scenes: scenesWithoutPPT
2474
- });
2475
- } else {
2476
- return this._instance.insertDocs({
2477
- fileType: "pdf",
2478
- scenePath,
2479
- scenes,
2480
- title: arg1
2481
- });
2482
- }
2483
- }
2484
- }
2485
- insertCodeEditor() {
2486
- return this._instance.insertCodeEditor();
2487
- }
2488
- insertGeoGebra() {
2489
- return this._instance.insertGeoGebra();
2490
- }
2491
- insertCountdown() {
2492
- return this._instance.insertCountdown();
2493
- }
2494
- changeLanguage(language) {
2495
- return this._instance.changeLanguage(language);
2496
- }
2497
- dispose() {
2498
- return this._instance.dispose();
2499
- }
2500
- }
2501
- const version = "0.0.11";
2502
- function useLastValue(value) {
2503
- const ref = useRef(value);
2504
- useEffect(() => {
2505
- ref.current = value;
2506
- }, [value]);
2507
- return ref.current;
2508
- }
2509
- const EMPTY_ARRAY = [];
2510
- function useForceUpdate() {
2511
- const [, forceUpdate_] = useState({});
2512
- return useCallback(() => forceUpdate_({}), EMPTY_ARRAY);
2513
- }
2514
- function usePlayerControl(player) {
2515
- const togglePlay = useCallback(() => {
2516
- if (player) {
2517
- switch (player.phase) {
2518
- case PlayerPhase.WaitingFirstFrame:
2519
- case PlayerPhase.Pause:
2520
- case PlayerPhase.Ended: {
2521
- player.play();
2522
- break;
2523
- }
2524
- case PlayerPhase.Playing: {
2525
- player.pause();
2526
- break;
2527
- }
2528
- }
2529
- }
2530
- }, [player]);
2531
- const seekToProgressTime = useCallback((time) => {
2532
- if (player) {
2533
- player.seekToProgressTime(time);
2534
- }
2535
- }, [player]);
2536
- const lastPlayer = useLastValue(player);
2537
- const forceUpdate = useForceUpdate();
2538
- const setSpeed = useCallback((speed2) => {
2539
- if (player) {
2540
- player.playbackSpeed = speed2;
2541
- forceUpdate();
2542
- }
2543
- }, [forceUpdate, player]);
2544
- useEffect(() => {
2545
- if (!lastPlayer && player) {
2546
- forceUpdate();
2547
- }
2548
- }, [forceUpdate, lastPlayer, player]);
2549
- useEffect(() => {
2550
- if (player) {
2551
- player.callbacks.on("onPhaseChanged", forceUpdate);
2552
- player.callbacks.on("onProgressTimeChanged", forceUpdate);
2553
- return () => {
2554
- player.callbacks.off("onPhaseChanged", forceUpdate);
2555
- player.callbacks.off("onProgressTimeChanged", forceUpdate);
2556
- };
2557
- }
2558
- }, [forceUpdate, player]);
2559
- const phase = player ? player.phase : PlayerPhase.WaitingFirstFrame;
2560
- const currentTime = player ? player.progressTime : 0;
2561
- const totalTime = player ? player.timeDuration : 0;
2562
- const speed = player ? player.playbackSpeed : 1;
2563
- return {
2564
- phase,
2565
- currentTime,
2566
- totalTime,
2567
- speed,
2568
- setSpeed,
2569
- togglePlay,
2570
- seekToProgressTime
2571
- };
2572
- }
2573
- const Button = forwardRef((props, ref) => {
2574
- const {
2575
- theme,
2576
- content,
2577
- disabled,
2578
- active,
2579
- onClick,
2580
- interactive,
2581
- placement = "top",
2582
- children
2583
- } = props;
2584
- return /* @__PURE__ */ jsx(Tippy, {
2585
- className: "fastboard-tip",
2586
- content,
2587
- interactive,
2588
- theme,
2589
- disabled,
2590
- placement,
2591
- offset: TopOffset,
2592
- duration: 300,
2593
- children: /* @__PURE__ */ jsx("button", {
2594
- ref,
2595
- className: clsx("fastboard-player-control-btn", theme, {
2596
- active
2597
- }),
2598
- onClick,
2599
- disabled,
2600
- children
2601
- })
2602
- });
2603
- });
2604
- const Loading = (props) => {
2605
- const stroke = getStroke(props);
2606
- return /* @__PURE__ */ jsx("svg", {
2607
- viewBox: "0 0 24 24",
2608
- children: /* @__PURE__ */ jsx("path", {
2609
- d: "M12 4V2A10 10 0 0 0 2 12h2a8 8 0 0 1 8-8z",
2610
- fill: stroke
2611
- })
2612
- });
2613
- };
2614
- const Pause = (props) => {
2615
- const stroke = getStroke(props);
2616
- return /* @__PURE__ */ jsx("svg", {
2617
- viewBox: "0 0 24 24",
2618
- children: /* @__PURE__ */ jsx("path", {
2619
- d: "M14 19h4V5h-4M6 19h4V5H6v14z",
2620
- fill: stroke
2621
- })
2622
- });
2623
- };
2624
- const Play = (props) => {
2625
- const stroke = getStroke(props);
2626
- return /* @__PURE__ */ jsx("svg", {
2627
- viewBox: "0 0 24 24",
2628
- children: /* @__PURE__ */ jsx("path", {
2629
- d: "M8 5.14v14l11-7l-11-7z",
2630
- fill: stroke
2631
- })
2632
- });
2633
- };
2634
- const Icons = {
2635
- Play: memo(Play),
2636
- Pause: memo(Pause),
2637
- Loading: memo(Loading)
2638
- };
2639
- const name = "fastboard-player-control";
2640
- function PlayerControl(_a) {
2641
- var _b = _a, {
2642
- autoHide = false,
2643
- player: player_,
2644
- theme = "light",
2645
- i18n
2646
- } = _b, icons = __objRest(_b, [
2647
- "autoHide",
2648
- "player",
2649
- "theme",
2650
- "i18n"
2651
- ]);
2652
- const [currentTime, setCurrentTime] = useState(0);
2653
- const player = usePlayerControl(player_);
2654
- useEffect(() => {
2655
- setCurrentTime(player.currentTime);
2656
- }, [player.currentTime]);
2657
- useEffect(() => {
2658
- if (player.currentTime !== currentTime) {
2659
- player.seekToProgressTime(currentTime);
2660
- }
2661
- }, [currentTime]);
2662
- const isLoading = player.phase === PlayerPhase.WaitingFirstFrame || player.phase === PlayerPhase.Buffering;
2663
- const isPlaying = player.phase === PlayerPhase.Playing;
2664
- const {
2665
- activeColor
2666
- } = themes[theme];
2667
- return /* @__PURE__ */ jsxs("div", {
2668
- className: clsx(name, theme, {
2669
- "auto-hide": autoHide
2670
- }),
2671
- children: [/* @__PURE__ */ jsx("button", {
2672
- className: clsx(`${name}-btn`, isLoading ? "loading" : isPlaying ? "pause" : "play", theme),
2673
- disabled: isLoading,
2674
- onClick: player.togglePlay,
2675
- children: /* @__PURE__ */ jsx(Icon, {
2676
- fallback: isLoading ? /* @__PURE__ */ jsx(Icons.Loading, {
2677
- theme
2678
- }) : isPlaying ? /* @__PURE__ */ jsx(Icons.Pause, {
2679
- theme
2680
- }) : /* @__PURE__ */ jsx(Icons.Play, {
2681
- theme
2682
- }),
2683
- src: isLoading ? icons.loadingIcon : isPlaying ? icons.pauseIcon : icons.playIcon,
2684
- alt: isLoading ? "[loading]" : isPlaying ? "[pause]" : "[play]"
2685
- })
2686
- }), /* @__PURE__ */ jsx("span", {
2687
- className: clsx(`${name}-slider`, {
2688
- loading: isLoading
2689
- }, theme),
2690
- children: /* @__PURE__ */ jsx(RcSlider, {
2691
- disabled: isLoading,
2692
- trackStyle: {
2693
- background: activeColor
2694
- },
2695
- handleStyle: {
2696
- border: `1px solid ${activeColor}`
2697
- },
2698
- value: currentTime,
2699
- onChange: setCurrentTime,
2700
- min: 0,
2701
- max: player.totalTime,
2702
- step: 100
2703
- })
2704
- }), /* @__PURE__ */ jsx("span", {
2705
- className: clsx(`${name}-current`, theme),
2706
- children: renderTime(player.currentTime)
2707
- }), /* @__PURE__ */ jsx("span", {
2708
- className: clsx(`${name}-slash`, theme),
2709
- children: "/"
2710
- }), /* @__PURE__ */ jsx("span", {
2711
- className: clsx(`${name}-total`, theme),
2712
- children: renderTime(player.totalTime)
2713
- }), /* @__PURE__ */ jsx("span", {
2714
- className: `${name}-btn-interactive`,
2715
- children: /* @__PURE__ */ jsx(Tippy, {
2716
- className: "fastboard-tip",
2717
- content: renderSpeeds(player),
2718
- theme,
2719
- placement: "top-end",
2720
- trigger: "click",
2721
- offset: TopOffset,
2722
- arrow: false,
2723
- interactive: true,
2724
- children: /* @__PURE__ */ jsx(Button, {
2725
- content: i18n == null ? void 0 : i18n.t("speed"),
2726
- theme,
2727
- disabled: isLoading,
2728
- children: /* @__PURE__ */ jsxs("span", {
2729
- className: clsx(`${name}-speed-text`, theme),
2730
- children: [player.speed, "x"]
2731
- })
2732
- })
2733
- })
2734
- })]
2735
- });
2736
- }
2737
- function renderTime(ms) {
2738
- let seconds = ms / 1e3;
2739
- const minutes = Math.floor(seconds / 60);
2740
- seconds = Math.floor(seconds) % 60;
2741
- return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
2742
- }
2743
- const Speeds = [2, 1.5, 1.25, 1, 0.75, 0.5];
2744
- function renderSpeeds({
2745
- speed: current,
2746
- setSpeed
2747
- }) {
2748
- return /* @__PURE__ */ jsx("div", {
2749
- className: clsx(`${name}-panel`, "speed"),
2750
- children: Speeds.map((speed) => /* @__PURE__ */ jsxs("button", {
2751
- className: clsx(`${name}-btn`, "speed", {
2752
- active: speed === current
2753
- }),
2754
- onClick: () => setSpeed(speed),
2755
- children: [speed, "x"]
2756
- }, speed))
2757
- });
2758
- }
2759
- function useCombinedRefs(...refs) {
2760
- const targetRef = useRef(null);
2761
- useEffect(() => {
2762
- for (const ref of refs) {
2763
- if (!ref)
2764
- continue;
2765
- if (typeof ref === "function") {
2766
- ref(targetRef.current);
2767
- } else {
2768
- ref.current = targetRef.current;
2769
- }
2770
- }
2771
- }, [refs]);
2772
- return targetRef;
2773
- }
2774
- const Fastboard = forwardRef((_c, outerRef) => {
2775
- var _d = _c, {
2776
- app
2777
- } = _d, restProps = __objRest(_d, [
2778
- "app"
2779
- ]);
2780
- const innerRef = useRef(null);
2781
- const ref = useCombinedRefs(outerRef, innerRef);
2782
- const previous = useLastValue(app);
2783
- useEffect(() => {
2784
- if (previous && previous !== app) {
2785
- previous.bindElement(null);
2786
- }
2787
- if (app) {
2788
- app.bindElement(ref.current);
2789
- }
2790
- }, [app, previous, ref]);
2791
- return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({
2792
- className: "fastboard"
2793
- }, restProps), {
2794
- ref
2795
- }));
2796
- });
2797
- const register = WindowManager.register.bind(WindowManager);
2798
- async function createWhiteboardApp(config) {
2799
- const app = new WhiteboardApp(config);
2800
- await app._instance.readyPromise;
2801
- return app;
2802
- }
2803
- export { Fastboard, PageControl, PlayerControl, RedoUndo, Toolbar, WhiteboardApp, ZoomControl, createWhiteboardApp, register, usePageControl, usePlayerControl, useRedoUndo, useToolbar, useZoomControl, version };
2804
- //# sourceMappingURL=index.es.js.map