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