@netless/fastboard 0.0.10 → 0.2.0

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