react-sync-board 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react-sync-board.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var kt = (e, t, r) => (
|
|
4
|
-
import g, { useContext as _e, useDebugValue as
|
|
5
|
-
function
|
|
1
|
+
var Lr = Object.defineProperty;
|
|
2
|
+
var zr = (e, t, r) => t in e ? Lr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var kt = (e, t, r) => (zr(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import g, { useContext as _e, useDebugValue as Yr, useRef as Re, useMemo as lt, useEffect as Pe, useCallback as tr, memo as rr } from "react";
|
|
5
|
+
function Br(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
7
|
}
|
|
8
|
-
var Ie = {},
|
|
8
|
+
var Ie = {}, Nr = {
|
|
9
9
|
get exports() {
|
|
10
10
|
return Ie;
|
|
11
11
|
},
|
|
@@ -23,7 +23,7 @@ var Ie = {}, Yr = {
|
|
|
23
23
|
* LICENSE file in the root directory of this source tree.
|
|
24
24
|
*/
|
|
25
25
|
var Pt;
|
|
26
|
-
function
|
|
26
|
+
function Xr() {
|
|
27
27
|
if (Pt)
|
|
28
28
|
return Ee;
|
|
29
29
|
Pt = 1;
|
|
@@ -51,7 +51,7 @@ var Ce = {};
|
|
|
51
51
|
* LICENSE file in the root directory of this source tree.
|
|
52
52
|
*/
|
|
53
53
|
var Mt;
|
|
54
|
-
function
|
|
54
|
+
function Ur() {
|
|
55
55
|
return Mt || (Mt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
56
56
|
var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), c = Symbol.for("react.provider"), u = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), a = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), v = Symbol.iterator, E = "@@iterator";
|
|
57
57
|
function I(i) {
|
|
@@ -72,10 +72,10 @@ function Nr() {
|
|
|
72
72
|
{
|
|
73
73
|
var j = y.ReactDebugCurrentFrame, X = j.getStackAddendum();
|
|
74
74
|
X !== "" && (b += "%s", R = R.concat([X]));
|
|
75
|
-
var
|
|
75
|
+
var W = R.map(function(Y) {
|
|
76
76
|
return String(Y);
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
W.unshift("Warning: " + b), Function.prototype.apply.call(console[i], console, W);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
var p = !1, C = !1, m = !1, S = !1, O = !1, k;
|
|
@@ -132,9 +132,9 @@ function Nr() {
|
|
|
132
132
|
var j = i.displayName || null;
|
|
133
133
|
return j !== null ? j : N(i.type) || "Memo";
|
|
134
134
|
case h: {
|
|
135
|
-
var X = i,
|
|
135
|
+
var X = i, W = X._payload, Y = X._init;
|
|
136
136
|
try {
|
|
137
|
-
return N(Y(
|
|
137
|
+
return N(Y(W));
|
|
138
138
|
} catch {
|
|
139
139
|
return null;
|
|
140
140
|
}
|
|
@@ -142,14 +142,14 @@ function Nr() {
|
|
|
142
142
|
}
|
|
143
143
|
return null;
|
|
144
144
|
}
|
|
145
|
-
var
|
|
145
|
+
var U = Object.assign, J = 0, P, $, B, V, A, K, F;
|
|
146
146
|
function ee() {
|
|
147
147
|
}
|
|
148
148
|
ee.__reactDisabledLog = !0;
|
|
149
149
|
function oe() {
|
|
150
150
|
{
|
|
151
151
|
if (J === 0) {
|
|
152
|
-
P = console.log, $ = console.info, B = console.warn,
|
|
152
|
+
P = console.log, $ = console.info, B = console.warn, V = console.error, A = console.group, K = console.groupCollapsed, F = console.groupEnd;
|
|
153
153
|
var i = {
|
|
154
154
|
configurable: !0,
|
|
155
155
|
enumerable: !0,
|
|
@@ -178,26 +178,26 @@ function Nr() {
|
|
|
178
178
|
writable: !0
|
|
179
179
|
};
|
|
180
180
|
Object.defineProperties(console, {
|
|
181
|
-
log:
|
|
181
|
+
log: U({}, i, {
|
|
182
182
|
value: P
|
|
183
183
|
}),
|
|
184
|
-
info:
|
|
184
|
+
info: U({}, i, {
|
|
185
185
|
value: $
|
|
186
186
|
}),
|
|
187
|
-
warn:
|
|
187
|
+
warn: U({}, i, {
|
|
188
188
|
value: B
|
|
189
189
|
}),
|
|
190
|
-
error:
|
|
191
|
-
value:
|
|
190
|
+
error: U({}, i, {
|
|
191
|
+
value: V
|
|
192
192
|
}),
|
|
193
|
-
group:
|
|
193
|
+
group: U({}, i, {
|
|
194
194
|
value: A
|
|
195
195
|
}),
|
|
196
|
-
groupCollapsed:
|
|
197
|
-
value: F
|
|
198
|
-
}),
|
|
199
|
-
groupEnd: W({}, i, {
|
|
196
|
+
groupCollapsed: U({}, i, {
|
|
200
197
|
value: K
|
|
198
|
+
}),
|
|
199
|
+
groupEnd: U({}, i, {
|
|
200
|
+
value: F
|
|
201
201
|
})
|
|
202
202
|
});
|
|
203
203
|
}
|
|
@@ -220,8 +220,8 @@ function Nr() {
|
|
|
220
220
|
}
|
|
221
221
|
var Ke = !1, De;
|
|
222
222
|
{
|
|
223
|
-
var
|
|
224
|
-
De = new
|
|
223
|
+
var mr = typeof WeakMap == "function" ? WeakMap : Map;
|
|
224
|
+
De = new mr();
|
|
225
225
|
}
|
|
226
226
|
function ht(i, b) {
|
|
227
227
|
if (!i || Ke)
|
|
@@ -235,8 +235,8 @@ function Nr() {
|
|
|
235
235
|
Ke = !0;
|
|
236
236
|
var X = Error.prepareStackTrace;
|
|
237
237
|
Error.prepareStackTrace = void 0;
|
|
238
|
-
var
|
|
239
|
-
|
|
238
|
+
var W;
|
|
239
|
+
W = se.current, se.current = null, oe();
|
|
240
240
|
try {
|
|
241
241
|
if (b) {
|
|
242
242
|
var Y = function() {
|
|
@@ -289,15 +289,15 @@ function Nr() {
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
} finally {
|
|
292
|
-
Ke = !1, se.current =
|
|
292
|
+
Ke = !1, se.current = W, le(), Error.prepareStackTrace = X;
|
|
293
293
|
}
|
|
294
294
|
var ve = i ? i.displayName || i.name : "", Tt = ve ? ge(ve) : "";
|
|
295
295
|
return typeof i == "function" && De.set(i, Tt), Tt;
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function gr(i, b, R) {
|
|
298
298
|
return ht(i, !1);
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function hr(i) {
|
|
301
301
|
var b = i.prototype;
|
|
302
302
|
return !!(b && b.isReactComponent);
|
|
303
303
|
}
|
|
@@ -305,7 +305,7 @@ function Nr() {
|
|
|
305
305
|
if (i == null)
|
|
306
306
|
return "";
|
|
307
307
|
if (typeof i == "function")
|
|
308
|
-
return ht(i,
|
|
308
|
+
return ht(i, hr(i));
|
|
309
309
|
if (typeof i == "string")
|
|
310
310
|
return ge(i);
|
|
311
311
|
switch (i) {
|
|
@@ -317,13 +317,13 @@ function Nr() {
|
|
|
317
317
|
if (typeof i == "object")
|
|
318
318
|
switch (i.$$typeof) {
|
|
319
319
|
case l:
|
|
320
|
-
return
|
|
320
|
+
return gr(i.render);
|
|
321
321
|
case a:
|
|
322
322
|
return je(i.type, b, R);
|
|
323
323
|
case h: {
|
|
324
|
-
var j = i, X = j._payload,
|
|
324
|
+
var j = i, X = j._payload, W = j._init;
|
|
325
325
|
try {
|
|
326
|
-
return je(
|
|
326
|
+
return je(W(X), b, R);
|
|
327
327
|
} catch {
|
|
328
328
|
}
|
|
329
329
|
}
|
|
@@ -338,11 +338,11 @@ function Nr() {
|
|
|
338
338
|
} else
|
|
339
339
|
yt.setExtraStackFrame(null);
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function vr(i, b, R, j, X) {
|
|
342
342
|
{
|
|
343
|
-
var
|
|
343
|
+
var W = Function.call.bind($e);
|
|
344
344
|
for (var Y in i)
|
|
345
|
-
if (
|
|
345
|
+
if (W(i, Y)) {
|
|
346
346
|
var z = void 0;
|
|
347
347
|
try {
|
|
348
348
|
if (typeof i[Y] != "function") {
|
|
@@ -357,17 +357,17 @@ function Nr() {
|
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
var
|
|
360
|
+
var yr = Array.isArray;
|
|
361
361
|
function He(i) {
|
|
362
|
-
return
|
|
362
|
+
return yr(i);
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function Sr(i) {
|
|
365
365
|
{
|
|
366
366
|
var b = typeof Symbol == "function" && Symbol.toStringTag, R = b && i[Symbol.toStringTag] || i.constructor.name || "Object";
|
|
367
367
|
return R;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function _r(i) {
|
|
371
371
|
try {
|
|
372
372
|
return St(i), !1;
|
|
373
373
|
} catch {
|
|
@@ -378,17 +378,17 @@ function Nr() {
|
|
|
378
378
|
return "" + i;
|
|
379
379
|
}
|
|
380
380
|
function _t(i) {
|
|
381
|
-
if (
|
|
382
|
-
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
381
|
+
if (_r(i))
|
|
382
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Sr(i)), St(i);
|
|
383
383
|
}
|
|
384
|
-
var be = y.ReactCurrentOwner,
|
|
384
|
+
var be = y.ReactCurrentOwner, br = {
|
|
385
385
|
key: !0,
|
|
386
386
|
ref: !0,
|
|
387
387
|
__self: !0,
|
|
388
388
|
__source: !0
|
|
389
389
|
}, bt, Et, qe;
|
|
390
390
|
qe = {};
|
|
391
|
-
function
|
|
391
|
+
function Er(i) {
|
|
392
392
|
if ($e.call(i, "ref")) {
|
|
393
393
|
var b = Object.getOwnPropertyDescriptor(i, "ref").get;
|
|
394
394
|
if (b && b.isReactWarning)
|
|
@@ -396,7 +396,7 @@ function Nr() {
|
|
|
396
396
|
}
|
|
397
397
|
return i.ref !== void 0;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function Cr(i) {
|
|
400
400
|
if ($e.call(i, "key")) {
|
|
401
401
|
var b = Object.getOwnPropertyDescriptor(i, "key").get;
|
|
402
402
|
if (b && b.isReactWarning)
|
|
@@ -404,13 +404,13 @@ function Nr() {
|
|
|
404
404
|
}
|
|
405
405
|
return i.key !== void 0;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function wr(i, b) {
|
|
408
408
|
if (typeof i.ref == "string" && be.current && b && be.current.stateNode !== b) {
|
|
409
409
|
var R = N(be.current.type);
|
|
410
410
|
qe[R] || (w('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', N(be.current.type), i.ref), qe[R] = !0);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function xr(i, b) {
|
|
414
414
|
{
|
|
415
415
|
var R = function() {
|
|
416
416
|
bt || (bt = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
|
|
@@ -421,7 +421,7 @@ function Nr() {
|
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function Rr(i, b) {
|
|
425
425
|
{
|
|
426
426
|
var R = function() {
|
|
427
427
|
Et || (Et = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
|
|
@@ -432,7 +432,7 @@ function Nr() {
|
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
var
|
|
435
|
+
var Ir = function(i, b, R, j, X, W, Y) {
|
|
436
436
|
var z = {
|
|
437
437
|
// This tag allows us to uniquely identify this as a React Element
|
|
438
438
|
$$typeof: t,
|
|
@@ -442,7 +442,7 @@ function Nr() {
|
|
|
442
442
|
ref: R,
|
|
443
443
|
props: Y,
|
|
444
444
|
// Record the component responsible for creating this element.
|
|
445
|
-
_owner:
|
|
445
|
+
_owner: W
|
|
446
446
|
};
|
|
447
447
|
return z._store = {}, Object.defineProperty(z._store, "validated", {
|
|
448
448
|
configurable: !1,
|
|
@@ -461,22 +461,22 @@ function Nr() {
|
|
|
461
461
|
value: X
|
|
462
462
|
}), Object.freeze && (Object.freeze(z.props), Object.freeze(z)), z;
|
|
463
463
|
};
|
|
464
|
-
function
|
|
464
|
+
function Or(i, b, R, j, X) {
|
|
465
465
|
{
|
|
466
|
-
var
|
|
467
|
-
R !== void 0 && (_t(R), z = "" + R),
|
|
468
|
-
for (
|
|
469
|
-
$e.call(b,
|
|
466
|
+
var W, Y = {}, z = null, Q = null;
|
|
467
|
+
R !== void 0 && (_t(R), z = "" + R), Cr(b) && (_t(b.key), z = "" + b.key), Er(b) && (Q = b.ref, wr(b, X));
|
|
468
|
+
for (W in b)
|
|
469
|
+
$e.call(b, W) && !br.hasOwnProperty(W) && (Y[W] = b[W]);
|
|
470
470
|
if (i && i.defaultProps) {
|
|
471
471
|
var q = i.defaultProps;
|
|
472
|
-
for (
|
|
473
|
-
Y[
|
|
472
|
+
for (W in q)
|
|
473
|
+
Y[W] === void 0 && (Y[W] = q[W]);
|
|
474
474
|
}
|
|
475
475
|
if (z || Q) {
|
|
476
476
|
var G = typeof i == "function" ? i.displayName || i.name || "Unknown" : i;
|
|
477
|
-
z &&
|
|
477
|
+
z && xr(Y, G), Q && Rr(Y, G);
|
|
478
478
|
}
|
|
479
|
-
return
|
|
479
|
+
return Ir(i, z, Q, X, j, be.current, Y);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
var Ge = y.ReactCurrentOwner, Ct = y.ReactDebugCurrentFrame;
|
|
@@ -504,7 +504,7 @@ Check the render method of \`` + i + "`.";
|
|
|
504
504
|
return "";
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function Tr(i) {
|
|
508
508
|
{
|
|
509
509
|
if (i !== void 0) {
|
|
510
510
|
var b = i.fileName.replace(/^.*[\\\/]/, ""), R = i.lineNumber;
|
|
@@ -516,7 +516,7 @@ Check your code at ` + b + ":" + R + ".";
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
var xt = {};
|
|
519
|
-
function
|
|
519
|
+
function kr(i) {
|
|
520
520
|
{
|
|
521
521
|
var b = wt();
|
|
522
522
|
if (!b) {
|
|
@@ -533,7 +533,7 @@ Check the top-level render call using <` + R + ">.");
|
|
|
533
533
|
if (!i._store || i._store.validated || i.key != null)
|
|
534
534
|
return;
|
|
535
535
|
i._store.validated = !0;
|
|
536
|
-
var R =
|
|
536
|
+
var R = kr(b);
|
|
537
537
|
if (xt[R])
|
|
538
538
|
return;
|
|
539
539
|
xt[R] = !0;
|
|
@@ -555,12 +555,12 @@ Check the top-level render call using <` + R + ">.");
|
|
|
555
555
|
else if (i) {
|
|
556
556
|
var X = I(i);
|
|
557
557
|
if (typeof X == "function" && X !== i.entries)
|
|
558
|
-
for (var
|
|
558
|
+
for (var W = X.call(i), Y; !(Y = W.next()).done; )
|
|
559
559
|
Ze(Y.value) && Rt(Y.value, b);
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Pr(i) {
|
|
564
564
|
{
|
|
565
565
|
var b = i.type;
|
|
566
566
|
if (b == null || typeof b == "string")
|
|
@@ -576,7 +576,7 @@ Check the top-level render call using <` + R + ">.");
|
|
|
576
576
|
return;
|
|
577
577
|
if (R) {
|
|
578
578
|
var j = N(b);
|
|
579
|
-
|
|
579
|
+
vr(R, i.props, "prop", j, i);
|
|
580
580
|
} else if (b.PropTypes !== void 0 && !Je) {
|
|
581
581
|
Je = !0;
|
|
582
582
|
var X = N(b);
|
|
@@ -585,7 +585,7 @@ Check the top-level render call using <` + R + ">.");
|
|
|
585
585
|
typeof b.getDefaultProps == "function" && !b.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function Mr(i) {
|
|
589
589
|
{
|
|
590
590
|
for (var b = Object.keys(i.props), R = 0; R < b.length; R++) {
|
|
591
591
|
var j = b[R];
|
|
@@ -597,18 +597,18 @@ Check the top-level render call using <` + R + ">.");
|
|
|
597
597
|
i.ref !== null && (he(i), w("Invalid attribute `ref` supplied to `React.Fragment`."), he(null));
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function Ot(i, b, R, j, X,
|
|
600
|
+
function Ot(i, b, R, j, X, W) {
|
|
601
601
|
{
|
|
602
602
|
var Y = D(i);
|
|
603
603
|
if (!Y) {
|
|
604
604
|
var z = "";
|
|
605
605
|
(i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (z += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
606
|
-
var Q =
|
|
606
|
+
var Q = Tr(X);
|
|
607
607
|
Q ? z += Q : z += wt();
|
|
608
608
|
var q;
|
|
609
609
|
i === null ? q = "null" : He(i) ? q = "array" : i !== void 0 && i.$$typeof === t ? (q = "<" + (N(i.type) || "Unknown") + " />", z = " Did you accidentally export a JSX literal instead of a component?") : q = typeof i, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", q, z);
|
|
610
610
|
}
|
|
611
|
-
var G =
|
|
611
|
+
var G = Or(i, b, R, X, W);
|
|
612
612
|
if (G == null)
|
|
613
613
|
return G;
|
|
614
614
|
if (Y) {
|
|
@@ -624,25 +624,25 @@ Check the top-level render call using <` + R + ">.");
|
|
|
624
624
|
else
|
|
625
625
|
It(te, i);
|
|
626
626
|
}
|
|
627
|
-
return i === n ?
|
|
627
|
+
return i === n ? Mr(G) : Pr(G), G;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function Dr(i, b, R) {
|
|
631
631
|
return Ot(i, b, R, !0);
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function jr(i, b, R) {
|
|
634
634
|
return Ot(i, b, R, !1);
|
|
635
635
|
}
|
|
636
|
-
var
|
|
637
|
-
Ce.Fragment = n, Ce.jsx =
|
|
636
|
+
var $r = jr, Ar = Dr;
|
|
637
|
+
Ce.Fragment = n, Ce.jsx = $r, Ce.jsxs = Ar;
|
|
638
638
|
}()), Ce;
|
|
639
639
|
}
|
|
640
640
|
(function(e) {
|
|
641
|
-
process.env.NODE_ENV === "production" ? e.exports =
|
|
642
|
-
})(
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
class
|
|
641
|
+
process.env.NODE_ENV === "production" ? e.exports = Xr() : e.exports = Ur();
|
|
642
|
+
})(Nr);
|
|
643
|
+
const Wr = Ie.Fragment, T = Ie.jsx, ue = Ie.jsxs;
|
|
644
|
+
let Vr = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, r) => (r &= 63, r < 36 ? t += r.toString(36) : r < 62 ? t += (r - 26).toString(36).toUpperCase() : r > 62 ? t += "-" : t += "_", t), "");
|
|
645
|
+
class Fr {
|
|
646
646
|
constructor(t, r, n = null) {
|
|
647
647
|
this._socket = t, this.userId = n, this.room = r, this.toUnregister = [
|
|
648
648
|
() => {
|
|
@@ -669,7 +669,7 @@ class Wr {
|
|
|
669
669
|
* @returns the result of the call.
|
|
670
670
|
*/
|
|
671
671
|
async _callServerRPC(t, r) {
|
|
672
|
-
const n =
|
|
672
|
+
const n = Vr();
|
|
673
673
|
return new Promise((o, s) => {
|
|
674
674
|
this._socket.once(`${this.room}._result.${n}`, (c) => {
|
|
675
675
|
c.hasOwnProperty("ok") ? o(c.ok) : s(c.err);
|
|
@@ -738,7 +738,7 @@ class Wr {
|
|
|
738
738
|
return await this._callServerRPC("call", { name: t, params: r });
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
const
|
|
741
|
+
const Kr = ({
|
|
742
742
|
socket: e,
|
|
743
743
|
room: t,
|
|
744
744
|
onJoined: r = () => {
|
|
@@ -747,7 +747,7 @@ const Vr = ({
|
|
|
747
747
|
},
|
|
748
748
|
userId: o = null
|
|
749
749
|
}) => {
|
|
750
|
-
const s = new
|
|
750
|
+
const s = new Fr(e, t, o);
|
|
751
751
|
return new Promise((c) => {
|
|
752
752
|
let u = !0;
|
|
753
753
|
e.on(`${t}.isMaster`, () => {
|
|
@@ -761,7 +761,7 @@ const Vr = ({
|
|
|
761
761
|
});
|
|
762
762
|
}), e.emit("joinSuperSocket", { room: t, userId: o });
|
|
763
763
|
});
|
|
764
|
-
}, it = g.createContext(),
|
|
764
|
+
}, it = g.createContext(), Hr = () => /* @__PURE__ */ T(
|
|
765
765
|
"div",
|
|
766
766
|
{
|
|
767
767
|
style: {
|
|
@@ -775,11 +775,11 @@ const Vr = ({
|
|
|
775
775
|
},
|
|
776
776
|
children: /* @__PURE__ */ T("h2", { children: "🌀 Loading..." })
|
|
777
777
|
}
|
|
778
|
-
),
|
|
778
|
+
), nr = ({
|
|
779
779
|
socket: e,
|
|
780
780
|
room: t,
|
|
781
781
|
channel: r = "default",
|
|
782
|
-
LoadingComponent: n =
|
|
782
|
+
LoadingComponent: n = Hr,
|
|
783
783
|
children: o
|
|
784
784
|
}) => {
|
|
785
785
|
const [s, c] = g.useState(!1), [u, l] = g.useState(!1), [d, f] = g.useState(null), a = g.useRef(null), h = g.useRef(!1), _ = _e(it), v = g.useRef(!1);
|
|
@@ -794,7 +794,7 @@ const Vr = ({
|
|
|
794
794
|
return e.on("disconnect", E), () => {
|
|
795
795
|
e.off("disconnect", E);
|
|
796
796
|
};
|
|
797
|
-
}, [r, e]), g.useEffect(() => e ? (e.connected || e.connect(), console.log(`Try to connect to wire ${t} on channel ${r}`), v.current || (v.current = !0,
|
|
797
|
+
}, [r, e]), g.useEffect(() => e ? (e.connected || e.connect(), console.log(`Try to connect to wire ${t} on channel ${r}`), v.current || (v.current = !0, Kr({
|
|
798
798
|
socket: e,
|
|
799
799
|
room: t,
|
|
800
800
|
onMaster: () => {
|
|
@@ -828,14 +828,14 @@ const Vr = ({
|
|
|
828
828
|
} };
|
|
829
829
|
return t = e(n, o, u), u;
|
|
830
830
|
}, Ue = (e) => e ? Dt(e) : Dt;
|
|
831
|
-
var at = {},
|
|
831
|
+
var at = {}, qr = {
|
|
832
832
|
get exports() {
|
|
833
833
|
return at;
|
|
834
834
|
},
|
|
835
835
|
set exports(e) {
|
|
836
836
|
at = e;
|
|
837
837
|
}
|
|
838
|
-
}, Qe = {}, Ye = {},
|
|
838
|
+
}, Qe = {}, Ye = {}, Gr = {
|
|
839
839
|
get exports() {
|
|
840
840
|
return Ye;
|
|
841
841
|
},
|
|
@@ -853,7 +853,7 @@ var at = {}, Kr = {
|
|
|
853
853
|
* LICENSE file in the root directory of this source tree.
|
|
854
854
|
*/
|
|
855
855
|
var jt;
|
|
856
|
-
function
|
|
856
|
+
function Jr() {
|
|
857
857
|
if (jt)
|
|
858
858
|
return et;
|
|
859
859
|
jt = 1;
|
|
@@ -899,7 +899,7 @@ var tt = {};
|
|
|
899
899
|
* LICENSE file in the root directory of this source tree.
|
|
900
900
|
*/
|
|
901
901
|
var $t;
|
|
902
|
-
function
|
|
902
|
+
function Zr() {
|
|
903
903
|
return $t || ($t = 1, process.env.NODE_ENV !== "production" && function() {
|
|
904
904
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
905
905
|
var e = g, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
@@ -970,10 +970,10 @@ function Gr() {
|
|
|
970
970
|
}()), tt;
|
|
971
971
|
}
|
|
972
972
|
var At;
|
|
973
|
-
function
|
|
973
|
+
function or() {
|
|
974
974
|
return At || (At = 1, function(e) {
|
|
975
|
-
process.env.NODE_ENV === "production" ? e.exports =
|
|
976
|
-
}(
|
|
975
|
+
process.env.NODE_ENV === "production" ? e.exports = Jr() : e.exports = Zr();
|
|
976
|
+
}(Gr)), Ye;
|
|
977
977
|
}
|
|
978
978
|
/**
|
|
979
979
|
* @license React
|
|
@@ -985,11 +985,11 @@ function nr() {
|
|
|
985
985
|
* LICENSE file in the root directory of this source tree.
|
|
986
986
|
*/
|
|
987
987
|
var Lt;
|
|
988
|
-
function
|
|
988
|
+
function Qr() {
|
|
989
989
|
if (Lt)
|
|
990
990
|
return Qe;
|
|
991
991
|
Lt = 1;
|
|
992
|
-
var e = g, t =
|
|
992
|
+
var e = g, t = or();
|
|
993
993
|
function r(d, f) {
|
|
994
994
|
return d === f && (d !== 0 || 1 / d === 1 / f) || d !== d && f !== f;
|
|
995
995
|
}
|
|
@@ -1040,10 +1040,10 @@ var rt = {};
|
|
|
1040
1040
|
* LICENSE file in the root directory of this source tree.
|
|
1041
1041
|
*/
|
|
1042
1042
|
var zt;
|
|
1043
|
-
function
|
|
1043
|
+
function en() {
|
|
1044
1044
|
return zt || (zt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
1045
1045
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1046
|
-
var e = g, t =
|
|
1046
|
+
var e = g, t = or();
|
|
1047
1047
|
function r(f, a) {
|
|
1048
1048
|
return f === a && (f !== 0 || 1 / f === 1 / a) || f !== f && a !== a;
|
|
1049
1049
|
}
|
|
@@ -1060,9 +1060,9 @@ function Zr() {
|
|
|
1060
1060
|
C = !0, m = L;
|
|
1061
1061
|
var N = _(L);
|
|
1062
1062
|
if (v !== void 0 && I.hasValue) {
|
|
1063
|
-
var
|
|
1064
|
-
if (v(
|
|
1065
|
-
return S =
|
|
1063
|
+
var U = I.value;
|
|
1064
|
+
if (v(U, N))
|
|
1065
|
+
return S = U, U;
|
|
1066
1066
|
}
|
|
1067
1067
|
return S = N, N;
|
|
1068
1068
|
}
|
|
@@ -1086,30 +1086,30 @@ function Zr() {
|
|
|
1086
1086
|
}()), rt;
|
|
1087
1087
|
}
|
|
1088
1088
|
(function(e) {
|
|
1089
|
-
process.env.NODE_ENV === "production" ? e.exports =
|
|
1090
|
-
})(
|
|
1091
|
-
const
|
|
1089
|
+
process.env.NODE_ENV === "production" ? e.exports = Qr() : e.exports = en();
|
|
1090
|
+
})(qr);
|
|
1091
|
+
const tn = /* @__PURE__ */ Br(at), { useSyncExternalStoreWithSelector: rn } = tn;
|
|
1092
1092
|
function We(e, t = e.getState, r) {
|
|
1093
|
-
const n =
|
|
1093
|
+
const n = rn(
|
|
1094
1094
|
e.subscribe,
|
|
1095
1095
|
e.getState,
|
|
1096
1096
|
e.getServerState || e.getState,
|
|
1097
1097
|
t,
|
|
1098
1098
|
r
|
|
1099
1099
|
);
|
|
1100
|
-
return
|
|
1100
|
+
return Yr(n), n;
|
|
1101
1101
|
}
|
|
1102
1102
|
const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e, t) ? e : e.parentNode ? Oe(e.parentNode, t) : !1, ze = ([e, t], [r, n]) => {
|
|
1103
1103
|
const o = Math.abs(e - r), s = Math.abs(t - n);
|
|
1104
1104
|
return Math.hypot(o, s);
|
|
1105
|
-
},
|
|
1105
|
+
}, sr = (e, t, r) => {
|
|
1106
1106
|
const n = r * Math.PI / 180, o = e * Math.cos(n) - t * Math.sin(n), s = e * Math.sin(n) + t * Math.cos(n);
|
|
1107
1107
|
return [o, s];
|
|
1108
1108
|
}, ct = ([e, t], { scale: r, rotate: n, translateX: o, translateY: s }) => {
|
|
1109
1109
|
const c = (e - o) / r, u = (t - s) / r;
|
|
1110
|
-
return
|
|
1110
|
+
return sr(c, u, -n);
|
|
1111
1111
|
}, Be = ([e, t], { scale: r, rotate: n, translateX: o, translateY: s }) => {
|
|
1112
|
-
const [c, u] =
|
|
1112
|
+
const [c, u] = sr(e, t, n);
|
|
1113
1113
|
return [c * r + o, u * r + s];
|
|
1114
1114
|
}, Yt = (e, t, r, n) => {
|
|
1115
1115
|
const o = e.x, s = e.y, c = t.x, u = t.y, l = r.x, d = r.y, f = c - o, a = u - s, h = o - l, _ = s - d, v = f * f + a * a, E = 2 * (h * f + _ * a), I = h * h + _ * _ - n * n, y = E * E - 4 * v * I;
|
|
@@ -1117,12 +1117,12 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1117
1117
|
return [];
|
|
1118
1118
|
const w = (-E + Math.sqrt(y)) / (2 * v), x = (-E - Math.sqrt(y)) / (2 * v), p = [];
|
|
1119
1119
|
return w >= 0 && w <= 1 && p.push({ x: o + w * f, y: s + w * a }), x >= 0 && x <= 1 && p.push({ x: o + x * f, y: s + x * a }), p;
|
|
1120
|
-
}, ft = (e, t) => e.x > t.left && e.x < t.left + t.width && e.y > t.top && e.y < t.top + t.height,
|
|
1120
|
+
}, ft = (e, t) => e.x > t.left && e.x < t.left + t.width && e.y > t.top && e.y < t.top + t.height, nn = (e, t) => Array.from(e.querySelectorAll(".corner")).every((n) => {
|
|
1121
1121
|
const { top: o, left: s } = n.getBoundingClientRect();
|
|
1122
1122
|
return ft({ x: s, y: o }, t);
|
|
1123
|
-
}),
|
|
1123
|
+
}), on = (e, t) => {
|
|
1124
1124
|
const r = t.getBoundingClientRect();
|
|
1125
|
-
return
|
|
1125
|
+
return nn(e, r);
|
|
1126
1126
|
}, Ne = (e, t) => {
|
|
1127
1127
|
const n = e.getElementsByClassName(`item ${t}`)[0];
|
|
1128
1128
|
return n || console.error(`Missing item ${t}`), n;
|
|
@@ -1135,7 +1135,7 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1135
1135
|
JSON.stringify(e == null ? void 0 : e.dataset),
|
|
1136
1136
|
(n = e == null ? void 0 : e.dataset) == null ? void 0 : n.id
|
|
1137
1137
|
), t;
|
|
1138
|
-
},
|
|
1138
|
+
}, sn = (e, t = document) => {
|
|
1139
1139
|
const r = e.reduce((n, o) => {
|
|
1140
1140
|
const s = Ne(t, o);
|
|
1141
1141
|
if (!s)
|
|
@@ -1150,7 +1150,17 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1150
1150
|
}, f.left = Math.min(c, f.left), f.top = Math.min(l, f.top), f.right = Math.max(u, f.right), f.bottom = Math.max(d, f.bottom), f;
|
|
1151
1151
|
}, null);
|
|
1152
1152
|
return r && (r.width = r.right - r.left, r.height = r.bottom - r.top, r);
|
|
1153
|
-
},
|
|
1153
|
+
}, ir = (e, t, r = null) => (r === null && (r = /* @__PURE__ */ new Set()), !t || t.length === 0 ? [] : t.map((n) => r.has(n) ? [] : (r.add(n), [
|
|
1154
|
+
n,
|
|
1155
|
+
...ir(
|
|
1156
|
+
e,
|
|
1157
|
+
e[n].linkedItems,
|
|
1158
|
+
r
|
|
1159
|
+
)
|
|
1160
|
+
])).flat()), Bt = (e, t, r) => {
|
|
1161
|
+
const n = new Set(ir(e, r));
|
|
1162
|
+
return t.filter((o) => n.has(o));
|
|
1163
|
+
}, an = ({ x: e, y: t, width: r, height: n }, { type: o = "grid", size: s = 1, offset: c = { x: 0, y: 0 } }) => {
|
|
1154
1164
|
const [u, l] = [
|
|
1155
1165
|
e + r / 2 - c.x,
|
|
1156
1166
|
t + n / 2 - c.y
|
|
@@ -1174,7 +1184,7 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1174
1184
|
x: d + c.x - r / 2,
|
|
1175
1185
|
y: f + c.y - n / 2
|
|
1176
1186
|
};
|
|
1177
|
-
},
|
|
1187
|
+
}, Nt = [
|
|
1178
1188
|
"#037758",
|
|
1179
1189
|
"#99092a",
|
|
1180
1190
|
"#067070",
|
|
@@ -1205,13 +1215,13 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1205
1215
|
"#007a4b",
|
|
1206
1216
|
"#bf0daa",
|
|
1207
1217
|
"#af0ad8"
|
|
1208
|
-
],
|
|
1218
|
+
], Xt = () => Nt[Math.floor(Math.random() * Nt.length)], cn = !1, dt = ({ wire: e, storeName: t, noSync: r = [], defaultValue: n }, o) => (s, c, u) => {
|
|
1209
1219
|
s({ ready: !1 });
|
|
1210
1220
|
const l = [];
|
|
1211
1221
|
(async () => {
|
|
1212
1222
|
try {
|
|
1213
1223
|
const _ = await e.call(`${t}_getValue`);
|
|
1214
|
-
|
|
1224
|
+
cn && console.log("init from peer with value", _), s((v) => ({ ...v, ..._ }));
|
|
1215
1225
|
} catch {
|
|
1216
1226
|
n !== void 0 && s(n);
|
|
1217
1227
|
}
|
|
@@ -1271,7 +1281,7 @@ function Ve(e, t) {
|
|
|
1271
1281
|
return !1;
|
|
1272
1282
|
return !0;
|
|
1273
1283
|
}
|
|
1274
|
-
const
|
|
1284
|
+
const ar = g.createContext(), un = (e, t) => ({
|
|
1275
1285
|
items: {},
|
|
1276
1286
|
getItems: () => t().items,
|
|
1277
1287
|
setItems: (r) => e({ items: r }),
|
|
@@ -1288,7 +1298,7 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1288
1298
|
});
|
|
1289
1299
|
}), { items: s };
|
|
1290
1300
|
})
|
|
1291
|
-
}),
|
|
1301
|
+
}), ln = (e, t) => ({
|
|
1292
1302
|
itemIds: [],
|
|
1293
1303
|
setItemIds: (r) => e({ itemIds: r }),
|
|
1294
1304
|
getItemIds: () => t().itemIds,
|
|
@@ -1307,7 +1317,7 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1307
1317
|
updateManyItemIds: (r) => e((n) => ({
|
|
1308
1318
|
items: n.itemIds.map((o, s) => r[s] !== void 0 ? r[s] : o)
|
|
1309
1319
|
}))
|
|
1310
|
-
}),
|
|
1320
|
+
}), fn = (e, t) => ({
|
|
1311
1321
|
removeItemsById: (r) => e((n) => ({
|
|
1312
1322
|
itemIds: n.itemIds.filter((o) => !r.includes(o)),
|
|
1313
1323
|
items: Object.fromEntries(
|
|
@@ -1340,25 +1350,25 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1340
1350
|
itemIds: s
|
|
1341
1351
|
};
|
|
1342
1352
|
})
|
|
1343
|
-
}),
|
|
1353
|
+
}), dn = (e, t) => ({
|
|
1344
1354
|
boardConfig: {},
|
|
1345
1355
|
getBoardConfig: () => t().boardConfig,
|
|
1346
1356
|
setBoardConfig: (r) => e({ boardConfig: r }),
|
|
1347
1357
|
updateBoardConfig: (r) => e((n) => ({ boardConfig: { ...n.boardConfig, ...r } }))
|
|
1348
|
-
}),
|
|
1358
|
+
}), pn = (e, t) => ({
|
|
1349
1359
|
session: {},
|
|
1350
1360
|
getSessionInfo: () => t().session,
|
|
1351
1361
|
setSessionInfo: (r) => e({ session: r }),
|
|
1352
1362
|
updateSessionInfo: (r) => e((n) => ({ session: { ...n.session, ...r } }))
|
|
1353
|
-
}),
|
|
1363
|
+
}), Ut = ({ storeName: e, children: t, defaultValue: r }) => {
|
|
1354
1364
|
const { wire: n } = Xe("room"), [o, s] = g.useState(!1), [c] = g.useState(
|
|
1355
1365
|
() => Ue(
|
|
1356
1366
|
dt({ wire: n, storeName: e, defaultValue: r }, (...u) => ({
|
|
1357
|
-
...an(...u),
|
|
1358
|
-
...cn(...u),
|
|
1359
1367
|
...un(...u),
|
|
1360
1368
|
...ln(...u),
|
|
1361
|
-
...fn(...u)
|
|
1369
|
+
...fn(...u),
|
|
1370
|
+
...dn(...u),
|
|
1371
|
+
...pn(...u)
|
|
1362
1372
|
}))
|
|
1363
1373
|
)
|
|
1364
1374
|
);
|
|
@@ -1366,11 +1376,11 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1366
1376
|
const u = c.subscribe((l) => {
|
|
1367
1377
|
l.ready && (u(), s(!0));
|
|
1368
1378
|
});
|
|
1369
|
-
}, [c]), o ? /* @__PURE__ */ T(
|
|
1379
|
+
}, [c]), o ? /* @__PURE__ */ T(ar.Provider, { value: c, children: t }) : null;
|
|
1370
1380
|
}, re = (e, t) => {
|
|
1371
|
-
const r = _e(
|
|
1381
|
+
const r = _e(ar);
|
|
1372
1382
|
return We(r, e, t || Ve);
|
|
1373
|
-
},
|
|
1383
|
+
}, ns = () => {
|
|
1374
1384
|
const [e, t] = re((n) => [
|
|
1375
1385
|
n.itemIds,
|
|
1376
1386
|
n.items
|
|
@@ -1379,7 +1389,7 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1379
1389
|
() => e.map((n) => t[n]),
|
|
1380
1390
|
[e, t]
|
|
1381
1391
|
);
|
|
1382
|
-
},
|
|
1392
|
+
}, os = () => {
|
|
1383
1393
|
const [e, t, r] = re((c) => [
|
|
1384
1394
|
c.items,
|
|
1385
1395
|
c.itemIds,
|
|
@@ -1391,19 +1401,19 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1391
1401
|
o(c);
|
|
1392
1402
|
});
|
|
1393
1403
|
}, [e, t, r]), n;
|
|
1394
|
-
},
|
|
1404
|
+
}, cr = 5e4, ur = g.createContext(), mn = (e, t) => ({
|
|
1395
1405
|
config: {
|
|
1396
1406
|
itemTemplates: {},
|
|
1397
1407
|
actions: {},
|
|
1398
1408
|
uid: null,
|
|
1399
1409
|
itemExtent: { x: 0, y: 0, radius: 0 },
|
|
1400
1410
|
boardWrapperRect: {},
|
|
1401
|
-
boardSize:
|
|
1411
|
+
boardSize: cr
|
|
1402
1412
|
},
|
|
1403
1413
|
// TODO optimize when same values as before
|
|
1404
1414
|
updateConfiguration: (r) => e((n) => ({ config: { ...n.config, ...r } })),
|
|
1405
1415
|
getConfiguration: () => t().config
|
|
1406
|
-
}),
|
|
1416
|
+
}), gn = (e, t) => ({
|
|
1407
1417
|
boardState: {
|
|
1408
1418
|
movingItems: !1,
|
|
1409
1419
|
selecting: !1,
|
|
@@ -1417,7 +1427,7 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1417
1427
|
// TODO optimize when same values as before
|
|
1418
1428
|
updateBoardState: (r) => e((n) => ({ boardState: { ...n.boardState, ...r } })),
|
|
1419
1429
|
getBoardState: () => t().boardState
|
|
1420
|
-
}),
|
|
1430
|
+
}), hn = (e, t) => ({
|
|
1421
1431
|
interactions: {},
|
|
1422
1432
|
getInteractions: () => t().interactions,
|
|
1423
1433
|
register: (r, n) => e((o) => {
|
|
@@ -1439,7 +1449,7 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1439
1449
|
o(n);
|
|
1440
1450
|
});
|
|
1441
1451
|
}
|
|
1442
|
-
}),
|
|
1452
|
+
}), vn = (e, t) => ({
|
|
1443
1453
|
selection: [],
|
|
1444
1454
|
setSelection: (r) => e((n) => JSON.stringify(n.selection) !== JSON.stringify(r) ? { selection: r } : {}),
|
|
1445
1455
|
getSelection: () => t().selection,
|
|
@@ -1459,20 +1469,20 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1459
1469
|
const o = n.selectionBox;
|
|
1460
1470
|
return !o || !r || o.top !== r.top || o.left !== r.left || o.width !== r.width || o.height !== r.height ? { selectionBox: r } : {};
|
|
1461
1471
|
})
|
|
1462
|
-
}),
|
|
1472
|
+
}), Wt = ({ children: e }) => {
|
|
1463
1473
|
const [t] = g.useState(
|
|
1464
1474
|
() => Ue((...r) => ({
|
|
1465
|
-
...dn(...r),
|
|
1466
|
-
...pn(...r),
|
|
1467
1475
|
...mn(...r),
|
|
1468
|
-
...gn(...r)
|
|
1476
|
+
...gn(...r),
|
|
1477
|
+
...hn(...r),
|
|
1478
|
+
...vn(...r)
|
|
1469
1479
|
}))
|
|
1470
1480
|
);
|
|
1471
|
-
return /* @__PURE__ */ T(
|
|
1481
|
+
return /* @__PURE__ */ T(ur.Provider, { value: t, children: e });
|
|
1472
1482
|
}, Z = (e, t) => {
|
|
1473
|
-
const r = _e(
|
|
1483
|
+
const r = _e(ur);
|
|
1474
1484
|
return We(r, e, t || Ve);
|
|
1475
|
-
},
|
|
1485
|
+
}, ss = () => {
|
|
1476
1486
|
const [e] = Z((t) => [t.selection]);
|
|
1477
1487
|
return e;
|
|
1478
1488
|
};
|
|
@@ -1484,7 +1494,7 @@ function pt(e) {
|
|
|
1484
1494
|
}
|
|
1485
1495
|
}), []);
|
|
1486
1496
|
}
|
|
1487
|
-
function
|
|
1497
|
+
function yn(e) {
|
|
1488
1498
|
const t = pt(e);
|
|
1489
1499
|
Pe(
|
|
1490
1500
|
() => () => {
|
|
@@ -1498,7 +1508,7 @@ function mt(e, t, r, n = 0) {
|
|
|
1498
1508
|
const o = Re(), s = Re(), c = Re(), u = () => {
|
|
1499
1509
|
o.current && (clearTimeout(o.current), o.current = void 0), s.current && (clearTimeout(s.current), s.current = void 0);
|
|
1500
1510
|
};
|
|
1501
|
-
return
|
|
1511
|
+
return yn(u), lt(
|
|
1502
1512
|
() => {
|
|
1503
1513
|
const l = () => {
|
|
1504
1514
|
if (!c.current)
|
|
@@ -1517,7 +1527,7 @@ function mt(e, t, r, n = 0) {
|
|
|
1517
1527
|
[r, n, ...t]
|
|
1518
1528
|
);
|
|
1519
1529
|
}
|
|
1520
|
-
const
|
|
1530
|
+
const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
1521
1531
|
x: e,
|
|
1522
1532
|
y: t,
|
|
1523
1533
|
scale: r,
|
|
@@ -1536,7 +1546,7 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1536
1546
|
}, a = {
|
|
1537
1547
|
x: c / 2,
|
|
1538
1548
|
y: c / 2
|
|
1539
|
-
}, h = ze(d, [f.x, f.y]), _ = Math.min(s.width, s.height), v = o.radius + _ / 2 / r -
|
|
1549
|
+
}, h = ze(d, [f.x, f.y]), _ = Math.min(s.width, s.height), v = o.radius + _ / 2 / r - Sn / r;
|
|
1540
1550
|
if (h > v) {
|
|
1541
1551
|
const y = Yt(
|
|
1542
1552
|
{ x: d[0], y: d[1] },
|
|
@@ -1614,8 +1624,8 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1614
1624
|
...O,
|
|
1615
1625
|
...p(O)
|
|
1616
1626
|
}, N = a(M);
|
|
1617
|
-
let [
|
|
1618
|
-
(k !== O.translateX || D !== O.translateY) && ([
|
|
1627
|
+
let [U, J] = [k, D];
|
|
1628
|
+
(k !== O.translateX || D !== O.translateY) && ([U, J] = En({
|
|
1619
1629
|
x: k,
|
|
1620
1630
|
y: D,
|
|
1621
1631
|
scale: N,
|
|
@@ -1624,7 +1634,7 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1624
1634
|
boardWrapperRect: m,
|
|
1625
1635
|
boardSize: S
|
|
1626
1636
|
})), t({
|
|
1627
|
-
translateX:
|
|
1637
|
+
translateX: U,
|
|
1628
1638
|
translateY: J,
|
|
1629
1639
|
scale: N,
|
|
1630
1640
|
rotate: L
|
|
@@ -1652,8 +1662,8 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1652
1662
|
y: m.top + m.height / 2
|
|
1653
1663
|
});
|
|
1654
1664
|
const O = e(), k = a(O.scale * C), D = S.x - m.left, M = S.y - m.top, L = D - (D - O.translateX) * k / O.scale, N = M - (M - O.translateY) * k / O.scale;
|
|
1655
|
-
h((
|
|
1656
|
-
...
|
|
1665
|
+
h((U) => ({
|
|
1666
|
+
...U,
|
|
1657
1667
|
translateX: L,
|
|
1658
1668
|
translateY: N,
|
|
1659
1669
|
scale: k
|
|
@@ -1662,7 +1672,7 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1662
1672
|
[a, e, n, h]
|
|
1663
1673
|
), E = g.useCallback(
|
|
1664
1674
|
({ x: p, y: C, radius: m }) => {
|
|
1665
|
-
const { rotate: S } = e(), { boardWrapperRect: O, boardSize: k } = n(), D = O.width / (m * 2), M = O.height / (m * 2), L = a(Math.min(D, M) *
|
|
1675
|
+
const { rotate: S } = e(), { boardWrapperRect: O, boardSize: k } = n(), D = O.width / (m * 2), M = O.height / (m * 2), L = a(Math.min(D, M) * bn), [N, U] = Be(
|
|
1666
1676
|
[-k / 2 - p, -k / 2 - C],
|
|
1667
1677
|
{
|
|
1668
1678
|
translateX: O.width / 2,
|
|
@@ -1671,7 +1681,7 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1671
1681
|
rotate: S
|
|
1672
1682
|
}
|
|
1673
1683
|
);
|
|
1674
|
-
h((J) => ({ ...J, translateX: N, translateY:
|
|
1684
|
+
h((J) => ({ ...J, translateX: N, translateY: U, scale: L }));
|
|
1675
1685
|
},
|
|
1676
1686
|
[a, e, n, h]
|
|
1677
1687
|
), I = g.useCallback(() => {
|
|
@@ -1707,7 +1717,7 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1707
1717
|
};
|
|
1708
1718
|
O.radius = Math.max(
|
|
1709
1719
|
ze([O.x, O.y], [S.left, S.top]),
|
|
1710
|
-
|
|
1720
|
+
_n
|
|
1711
1721
|
), o({ itemExtent: O });
|
|
1712
1722
|
}, [n, c, o]), w = g.useCallback(
|
|
1713
1723
|
(p) => {
|
|
@@ -1734,7 +1744,7 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1734
1744
|
fromWrapperToBoard: l,
|
|
1735
1745
|
fromBoardToWrapper: d
|
|
1736
1746
|
};
|
|
1737
|
-
},
|
|
1747
|
+
}, Vt = (e) => {
|
|
1738
1748
|
const [t, r, n] = Z(
|
|
1739
1749
|
({ register: c, unregister: u, callInteractions: l }) => [
|
|
1740
1750
|
c,
|
|
@@ -1754,7 +1764,7 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1754
1764
|
);
|
|
1755
1765
|
return { register: o, call: s };
|
|
1756
1766
|
}, gt = () => {
|
|
1757
|
-
const { call: e } =
|
|
1767
|
+
const { call: e } = Vt("place"), { call: t } = Vt("delete"), { getCenter: r, updateItemExtent: n } = Me(), [o, s, c, u] = Z((P) => [
|
|
1758
1768
|
P.clear,
|
|
1759
1769
|
P.reverse,
|
|
1760
1770
|
P.unselect,
|
|
@@ -1774,20 +1784,20 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1774
1784
|
getItems: P,
|
|
1775
1785
|
getItemIds: $,
|
|
1776
1786
|
setItemIds: B,
|
|
1777
|
-
updateItems:
|
|
1787
|
+
updateItems: V,
|
|
1778
1788
|
moveItems: A,
|
|
1779
|
-
removeItemsById:
|
|
1780
|
-
getItemList:
|
|
1789
|
+
removeItemsById: K,
|
|
1790
|
+
getItemList: F,
|
|
1781
1791
|
insertItems: ee,
|
|
1782
1792
|
setItemList: oe
|
|
1783
1793
|
}) => ({
|
|
1784
1794
|
getItems: P,
|
|
1785
1795
|
getItemIds: $,
|
|
1786
1796
|
setItemIds: B,
|
|
1787
|
-
updateItems:
|
|
1797
|
+
updateItems: V,
|
|
1788
1798
|
moveItems: A,
|
|
1789
|
-
removeItemsById:
|
|
1790
|
-
getItemList:
|
|
1799
|
+
removeItemsById: K,
|
|
1800
|
+
getItemList: F,
|
|
1791
1801
|
insertItems: ee,
|
|
1792
1802
|
setItemList: oe
|
|
1793
1803
|
})
|
|
@@ -1795,10 +1805,10 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1795
1805
|
(P, $) => {
|
|
1796
1806
|
let B = $;
|
|
1797
1807
|
typeof $ == "object" && (B = () => $);
|
|
1798
|
-
const
|
|
1799
|
-
|
|
1808
|
+
const V = d().filter((F) => P.includes(F)), A = l(), K = Object.fromEntries(
|
|
1809
|
+
V.map((F) => [F, B({ ...A[F] })])
|
|
1800
1810
|
);
|
|
1801
|
-
a(
|
|
1811
|
+
a(K), n();
|
|
1802
1812
|
},
|
|
1803
1813
|
[d, l, n, a]
|
|
1804
1814
|
), w = g.useCallback(
|
|
@@ -1813,38 +1823,40 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1813
1823
|
[y]
|
|
1814
1824
|
), p = g.useCallback(
|
|
1815
1825
|
(P, $) => {
|
|
1816
|
-
|
|
1817
|
-
|
|
1826
|
+
h(
|
|
1827
|
+
Bt(l(), d(), P),
|
|
1828
|
+
$
|
|
1829
|
+
), n();
|
|
1818
1830
|
},
|
|
1819
|
-
[l, h, n]
|
|
1831
|
+
[d, l, h, n]
|
|
1820
1832
|
), C = g.useCallback(
|
|
1821
1833
|
(P) => {
|
|
1822
|
-
const $ = d(), B = $.filter((A) => !P.includes(A)),
|
|
1834
|
+
const $ = d(), B = $.filter((A) => !P.includes(A)), V = $.filter(
|
|
1823
1835
|
(A) => P.includes(A)
|
|
1824
1836
|
);
|
|
1825
|
-
f([...B, ...
|
|
1837
|
+
f([...B, ...V]);
|
|
1826
1838
|
},
|
|
1827
1839
|
[d, f]
|
|
1828
1840
|
), m = g.useCallback(
|
|
1829
1841
|
(P, { type: $, size: B } = {}) => {
|
|
1830
|
-
const { boardWrapper:
|
|
1842
|
+
const { boardWrapper: V } = u();
|
|
1831
1843
|
y(P, (A) => {
|
|
1832
|
-
const
|
|
1833
|
-
if (!
|
|
1844
|
+
const K = Ne(V, A.id);
|
|
1845
|
+
if (!K)
|
|
1834
1846
|
return;
|
|
1835
|
-
const
|
|
1847
|
+
const F = {
|
|
1836
1848
|
type: $ || "grid",
|
|
1837
1849
|
size: B || 1,
|
|
1838
1850
|
offset: { x: 0, y: 0 },
|
|
1839
1851
|
...A.grid
|
|
1840
|
-
}, ee =
|
|
1852
|
+
}, ee = an(
|
|
1841
1853
|
{
|
|
1842
1854
|
x: A.x,
|
|
1843
1855
|
y: A.y,
|
|
1844
|
-
width:
|
|
1845
|
-
height:
|
|
1856
|
+
width: K.clientWidth,
|
|
1857
|
+
height: K.clientHeight
|
|
1846
1858
|
},
|
|
1847
|
-
|
|
1859
|
+
F
|
|
1848
1860
|
);
|
|
1849
1861
|
return { ...A, ...ee };
|
|
1850
1862
|
});
|
|
@@ -1852,15 +1864,20 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1852
1864
|
[u, y]
|
|
1853
1865
|
), S = g.useCallback(
|
|
1854
1866
|
(P, $) => {
|
|
1855
|
-
const B =
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1867
|
+
const B = Bt(
|
|
1868
|
+
l(),
|
|
1869
|
+
d(),
|
|
1870
|
+
P
|
|
1871
|
+
);
|
|
1872
|
+
C(B), y(B, (V) => {
|
|
1873
|
+
const A = { ...V };
|
|
1874
|
+
return delete A.moving, A;
|
|
1875
|
+
}), m(B, $), e(P), n();
|
|
1860
1876
|
},
|
|
1861
1877
|
[
|
|
1862
1878
|
y,
|
|
1863
1879
|
e,
|
|
1880
|
+
d,
|
|
1864
1881
|
l,
|
|
1865
1882
|
C,
|
|
1866
1883
|
m,
|
|
@@ -1875,17 +1892,17 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1875
1892
|
(P) => {
|
|
1876
1893
|
const $ = d(), B = $.filter(
|
|
1877
1894
|
(A) => P.includes(A)
|
|
1878
|
-
),
|
|
1879
|
-
f(
|
|
1895
|
+
), V = $.map((A) => P.includes(A) ? B.pop() : A);
|
|
1896
|
+
f(V), s();
|
|
1880
1897
|
},
|
|
1881
1898
|
[d, s, f]
|
|
1882
1899
|
), D = g.useCallback(
|
|
1883
1900
|
(P, $) => {
|
|
1884
|
-
const B = l(),
|
|
1885
|
-
$.map((
|
|
1901
|
+
const B = l(), V = Object.fromEntries(
|
|
1902
|
+
$.map((F, ee) => {
|
|
1886
1903
|
const oe = B[P[ee]];
|
|
1887
1904
|
return [
|
|
1888
|
-
|
|
1905
|
+
F,
|
|
1889
1906
|
{
|
|
1890
1907
|
x: oe.x,
|
|
1891
1908
|
y: oe.y
|
|
@@ -1893,17 +1910,17 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1893
1910
|
];
|
|
1894
1911
|
})
|
|
1895
1912
|
);
|
|
1896
|
-
y(P, (
|
|
1913
|
+
y(P, (F) => ({ ...F, ...V[F.id] }));
|
|
1897
1914
|
const A = Object.fromEntries(
|
|
1898
|
-
P.map((
|
|
1899
|
-
),
|
|
1900
|
-
f(
|
|
1915
|
+
P.map((F, ee) => [F, $[ee]])
|
|
1916
|
+
), K = d().map((F) => P.includes(F) ? A[F] : F);
|
|
1917
|
+
f(K);
|
|
1901
1918
|
},
|
|
1902
1919
|
[l, y, d, f]
|
|
1903
1920
|
), M = g.useCallback(
|
|
1904
1921
|
(P, $) => {
|
|
1905
|
-
const B = r(),
|
|
1906
|
-
E(
|
|
1922
|
+
const B = r(), V = P.map((A, K) => !A.x || !A.y ? { ...A, x: B.x + 2 * K, y: B.y + 2 * K } : A);
|
|
1923
|
+
E(V, $), n();
|
|
1907
1924
|
},
|
|
1908
1925
|
[r, E, n]
|
|
1909
1926
|
), L = g.useCallback(
|
|
@@ -1916,36 +1933,36 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1916
1933
|
c(P), _(P), t(P);
|
|
1917
1934
|
},
|
|
1918
1935
|
[c, _, t]
|
|
1919
|
-
),
|
|
1936
|
+
), U = g.useCallback(
|
|
1920
1937
|
(P) => {
|
|
1921
1938
|
const $ = l();
|
|
1922
1939
|
return P.map((B) => $[B]);
|
|
1923
1940
|
},
|
|
1924
1941
|
[l]
|
|
1925
1942
|
), J = g.useCallback(
|
|
1926
|
-
({ target: P, clientX: $, clientY: B }, { returnLocked:
|
|
1943
|
+
({ target: P, clientX: $, clientY: B }, { returnLocked: V = !1, passLocked: A = !1 } = {}) => {
|
|
1927
1944
|
if (["INPUT", "TEXTAREA"].includes(P.tagName))
|
|
1928
1945
|
return null;
|
|
1929
|
-
const
|
|
1930
|
-
if (
|
|
1931
|
-
if (ye(
|
|
1932
|
-
return
|
|
1933
|
-
if (!A && ye(
|
|
1934
|
-
return
|
|
1946
|
+
const K = Oe(P, "item");
|
|
1947
|
+
if (K) {
|
|
1948
|
+
if (ye(K, "selected"))
|
|
1949
|
+
return K;
|
|
1950
|
+
if (!A && ye(K, "locked") && !ye(P, "passthrough"))
|
|
1951
|
+
return V ? K : null;
|
|
1935
1952
|
if (ye(P, "passthrough")) {
|
|
1936
|
-
const
|
|
1953
|
+
const F = d(), { boardWrapper: ee } = u(), oe = F.reduce((le, se) => {
|
|
1937
1954
|
const me = Ne(ee, se), ge = me.getBoundingClientRect();
|
|
1938
1955
|
return ft({ x: $, y: B }, ge) && le.unshift(me), le;
|
|
1939
1956
|
}, []);
|
|
1940
1957
|
for (let le = 0; le < oe.length; le += 1) {
|
|
1941
1958
|
const se = oe[le];
|
|
1942
|
-
if (se !==
|
|
1959
|
+
if (se !== K && (A || !ye(se, "locked")))
|
|
1943
1960
|
return se;
|
|
1944
1961
|
}
|
|
1945
1962
|
return null;
|
|
1946
1963
|
}
|
|
1947
1964
|
}
|
|
1948
|
-
return
|
|
1965
|
+
return K;
|
|
1949
1966
|
},
|
|
1950
1967
|
[u, d]
|
|
1951
1968
|
);
|
|
@@ -1964,10 +1981,10 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1964
1981
|
removeItems: N,
|
|
1965
1982
|
getItemList: v,
|
|
1966
1983
|
findElementUnderPointer: J,
|
|
1967
|
-
getItems:
|
|
1984
|
+
getItems: U
|
|
1968
1985
|
};
|
|
1969
1986
|
};
|
|
1970
|
-
var
|
|
1987
|
+
var Cn = function e(t, r) {
|
|
1971
1988
|
if (t === r)
|
|
1972
1989
|
return !0;
|
|
1973
1990
|
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
@@ -2029,19 +2046,19 @@ var bn = function e(t, r) {
|
|
|
2029
2046
|
}
|
|
2030
2047
|
return t !== t && r !== r;
|
|
2031
2048
|
};
|
|
2032
|
-
function
|
|
2049
|
+
function wn(e, t, r, n = 0) {
|
|
2033
2050
|
Pe(mt(e, t, r, n), t);
|
|
2034
2051
|
}
|
|
2035
|
-
const
|
|
2052
|
+
const xn = (e, t) => {
|
|
2036
2053
|
if (e.type in t) {
|
|
2037
2054
|
const r = t[e.type].defaultActions;
|
|
2038
2055
|
return typeof r == "function" ? r(e) : r;
|
|
2039
2056
|
}
|
|
2040
2057
|
return [];
|
|
2041
|
-
},
|
|
2042
|
-
const { actions: r =
|
|
2058
|
+
}, Ft = (e, t) => {
|
|
2059
|
+
const { actions: r = xn(e, t) } = e;
|
|
2043
2060
|
return r.map((n) => typeof n == "string" ? { name: n } : n);
|
|
2044
|
-
},
|
|
2061
|
+
}, is = () => {
|
|
2045
2062
|
const [e, t] = re((a) => [
|
|
2046
2063
|
a.items,
|
|
2047
2064
|
a.getItems
|
|
@@ -2062,17 +2079,17 @@ const Cn = (e, t) => {
|
|
|
2062
2079
|
return [_, _.map((v) => h[v])];
|
|
2063
2080
|
},
|
|
2064
2081
|
[t, o]
|
|
2065
|
-
), f =
|
|
2082
|
+
), f = tr(() => {
|
|
2066
2083
|
const [a, h] = d();
|
|
2067
2084
|
if (a.length > 0) {
|
|
2068
2085
|
if (!u.current)
|
|
2069
2086
|
return;
|
|
2070
2087
|
const _ = h.reduce((v, E) => {
|
|
2071
|
-
const I =
|
|
2088
|
+
const I = Ft(E, r);
|
|
2072
2089
|
return v.filter(
|
|
2073
|
-
(y) => I.some((w) =>
|
|
2090
|
+
(y) => I.some((w) => Cn(y, w))
|
|
2074
2091
|
);
|
|
2075
|
-
},
|
|
2092
|
+
}, Ft(h[0], r));
|
|
2076
2093
|
l(() => {
|
|
2077
2094
|
c(_);
|
|
2078
2095
|
});
|
|
@@ -2081,25 +2098,25 @@ const Cn = (e, t) => {
|
|
|
2081
2098
|
c([]);
|
|
2082
2099
|
});
|
|
2083
2100
|
}, [d, r]);
|
|
2084
|
-
return
|
|
2101
|
+
return wn(
|
|
2085
2102
|
() => f(),
|
|
2086
2103
|
[e, n, f],
|
|
2087
2104
|
100
|
|
2088
2105
|
), {
|
|
2089
2106
|
availableActions: s
|
|
2090
2107
|
};
|
|
2091
|
-
},
|
|
2108
|
+
}, as = () => {
|
|
2092
2109
|
const [e] = Z((t) => [t.selectionBox]);
|
|
2093
2110
|
return e;
|
|
2094
2111
|
};
|
|
2095
2112
|
let pe = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, r) => (r &= 63, r < 36 ? t += r.toString(36) : r < 62 ? t += (r - 26).toString(36).toUpperCase() : r > 62 ? t += "-" : t += "_", t), "");
|
|
2096
|
-
const
|
|
2113
|
+
const lr = g.createContext(), ut = (e) => {
|
|
2097
2114
|
localStorage.setItem("user", JSON.stringify(e));
|
|
2098
|
-
},
|
|
2115
|
+
}, Rn = () => {
|
|
2099
2116
|
if (localStorage.user) {
|
|
2100
2117
|
const t = {
|
|
2101
2118
|
name: "Player",
|
|
2102
|
-
color:
|
|
2119
|
+
color: Xt(),
|
|
2103
2120
|
uid: pe(),
|
|
2104
2121
|
...JSON.parse(localStorage.user)
|
|
2105
2122
|
};
|
|
@@ -2107,11 +2124,11 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2107
2124
|
}
|
|
2108
2125
|
const e = {
|
|
2109
2126
|
name: "Player",
|
|
2110
|
-
color:
|
|
2127
|
+
color: Xt(),
|
|
2111
2128
|
uid: pe()
|
|
2112
2129
|
};
|
|
2113
2130
|
return ut(e), e;
|
|
2114
|
-
},
|
|
2131
|
+
}, In = (e) => (t, r) => ({
|
|
2115
2132
|
isSpaceMaster: !1,
|
|
2116
2133
|
users: {},
|
|
2117
2134
|
getUser: () => r().users[e],
|
|
@@ -2156,14 +2173,14 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2156
2173
|
s < o.timestamp && (o.id = c, o.timestamp = s);
|
|
2157
2174
|
}), t({ isSpaceMaster: o.id === e });
|
|
2158
2175
|
}
|
|
2159
|
-
}),
|
|
2176
|
+
}), On = (e) => ({
|
|
2160
2177
|
cursors: {},
|
|
2161
2178
|
moveCursor: (t, r) => e((n) => ({ cursors: { ...n.cursors, [t]: r } })),
|
|
2162
2179
|
removeCursor: (t) => e((r) => {
|
|
2163
2180
|
const n = { ...r.cursors };
|
|
2164
2181
|
return delete n[t], { cursors: n };
|
|
2165
2182
|
})
|
|
2166
|
-
}),
|
|
2183
|
+
}), fr = ({ storeName: e, children: t }) => {
|
|
2167
2184
|
const { wire: r, isMaster: n } = Xe("room"), [o, s] = g.useState(null), [c, u] = g.useState(!1), l = g.useRef(!1);
|
|
2168
2185
|
return g.useEffect(() => {
|
|
2169
2186
|
let d = !0;
|
|
@@ -2183,8 +2200,8 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2183
2200
|
]
|
|
2184
2201
|
},
|
|
2185
2202
|
(...v) => ({
|
|
2186
|
-
...
|
|
2187
|
-
...
|
|
2203
|
+
...In(r.userId)(...v),
|
|
2204
|
+
...On(...v)
|
|
2188
2205
|
})
|
|
2189
2206
|
)
|
|
2190
2207
|
), _ = h.subscribe((v) => {
|
|
@@ -2196,7 +2213,7 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2196
2213
|
}, [o, e, r, r.userId]), g.useEffect(() => {
|
|
2197
2214
|
if (o)
|
|
2198
2215
|
return o.getState().addUser({
|
|
2199
|
-
...
|
|
2216
|
+
...Rn(),
|
|
2200
2217
|
id: r.userId
|
|
2201
2218
|
}), u(!0), () => {
|
|
2202
2219
|
o.getState().removeUser(r.userId);
|
|
@@ -2212,11 +2229,11 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2212
2229
|
}
|
|
2213
2230
|
}, [n, o, r]), g.useEffect(() => {
|
|
2214
2231
|
n && o && o.getState().updateCurrentUser({ isMaster: n });
|
|
2215
|
-
}, [n, o, r]), c ? /* @__PURE__ */ T(
|
|
2232
|
+
}, [n, o, r]), c ? /* @__PURE__ */ T(lr.Provider, { value: o, children: t }) : null;
|
|
2216
2233
|
}, Se = (e, t) => {
|
|
2217
|
-
const r = _e(
|
|
2234
|
+
const r = _e(lr);
|
|
2218
2235
|
return We(r, e, t || Ve);
|
|
2219
|
-
},
|
|
2236
|
+
}, cs = () => {
|
|
2220
2237
|
const [e, t, r, n, o] = Se((u) => [
|
|
2221
2238
|
u.isSpaceMaster,
|
|
2222
2239
|
u.getUser(),
|
|
@@ -2235,7 +2252,7 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2235
2252
|
localUsers: c,
|
|
2236
2253
|
joinSpace: o
|
|
2237
2254
|
};
|
|
2238
|
-
},
|
|
2255
|
+
}, us = () => {
|
|
2239
2256
|
const [e, t, r] = re(
|
|
2240
2257
|
(o) => [o.boardConfig, o.getBoardConfig, o.setBoardConfig]
|
|
2241
2258
|
), n = g.useCallback(
|
|
@@ -2248,10 +2265,10 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2248
2265
|
[t, r]
|
|
2249
2266
|
);
|
|
2250
2267
|
return [e, n];
|
|
2251
|
-
},
|
|
2268
|
+
}, ls = () => {
|
|
2252
2269
|
const [e] = Z((t) => [t.boardState]);
|
|
2253
2270
|
return e;
|
|
2254
|
-
},
|
|
2271
|
+
}, fs = () => {
|
|
2255
2272
|
const [e, t, r, n] = re((o) => [
|
|
2256
2273
|
o.getSessionInfo,
|
|
2257
2274
|
o.setSessionInfo,
|
|
@@ -2259,13 +2276,13 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2259
2276
|
o.session
|
|
2260
2277
|
]);
|
|
2261
2278
|
return { getSessionInfo: e, setSessionInfo: t, sessionInfo: n, updateSessionInfo: r };
|
|
2262
|
-
},
|
|
2279
|
+
}, dr = g.createContext(), Tn = ({ user: { name: e, uid: t, color: r }, content: n }) => ({
|
|
2263
2280
|
type: "message",
|
|
2264
2281
|
user: { name: e, uid: t, color: r },
|
|
2265
2282
|
content: n,
|
|
2266
2283
|
uid: pe(),
|
|
2267
2284
|
timestamp: new Date().toISOString()
|
|
2268
|
-
}),
|
|
2285
|
+
}), kn = (e, t) => ({
|
|
2269
2286
|
messages: [],
|
|
2270
2287
|
setMessages: (r) => e({
|
|
2271
2288
|
messages: r.map((n) => ({
|
|
@@ -2280,13 +2297,13 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2280
2297
|
]
|
|
2281
2298
|
})),
|
|
2282
2299
|
sendMessage: (r, n) => {
|
|
2283
|
-
const o =
|
|
2300
|
+
const o = Tn({
|
|
2284
2301
|
user: r,
|
|
2285
2302
|
content: n
|
|
2286
2303
|
});
|
|
2287
2304
|
o && t().addMessage(o);
|
|
2288
2305
|
}
|
|
2289
|
-
}),
|
|
2306
|
+
}), Kt = ({
|
|
2290
2307
|
storeName: e,
|
|
2291
2308
|
children: t,
|
|
2292
2309
|
defaultValue: r = []
|
|
@@ -2296,18 +2313,18 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2296
2313
|
dt(
|
|
2297
2314
|
{ wire: n, storeName: e, defaultValue: r, noSync: ["sendMessage"] },
|
|
2298
2315
|
(...s) => ({
|
|
2299
|
-
...
|
|
2316
|
+
...kn(...s)
|
|
2300
2317
|
})
|
|
2301
2318
|
)
|
|
2302
2319
|
)
|
|
2303
2320
|
);
|
|
2304
|
-
return /* @__PURE__ */ T(
|
|
2305
|
-
},
|
|
2306
|
-
const r = _e(
|
|
2321
|
+
return /* @__PURE__ */ T(dr.Provider, { value: o, children: t });
|
|
2322
|
+
}, Pn = (e, t) => {
|
|
2323
|
+
const r = _e(dr);
|
|
2307
2324
|
return We(r, e, t || Ve);
|
|
2308
|
-
},
|
|
2309
|
-
},
|
|
2310
|
-
const t = Se((c) => c.getUser()), [r, n, o] =
|
|
2325
|
+
}, Mn = () => {
|
|
2326
|
+
}, ds = (e = Mn) => {
|
|
2327
|
+
const t = Se((c) => c.getUser()), [r, n, o] = Pn((c) => [
|
|
2311
2328
|
c.messages,
|
|
2312
2329
|
c.setMessages,
|
|
2313
2330
|
c.sendMessage
|
|
@@ -2322,12 +2339,12 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2322
2339
|
[t, o]
|
|
2323
2340
|
);
|
|
2324
2341
|
return { messages: r, setMessages: n, sendMessage: s };
|
|
2325
|
-
},
|
|
2342
|
+
}, Ht = ({ children: e, session: t }) => {
|
|
2326
2343
|
const r = Se((n) => n.joinSpace);
|
|
2327
2344
|
return g.useEffect(() => (r(t), () => {
|
|
2328
2345
|
r(null);
|
|
2329
2346
|
}), [r, t]), e;
|
|
2330
|
-
},
|
|
2347
|
+
}, ps = ({
|
|
2331
2348
|
socket: e,
|
|
2332
2349
|
room: t,
|
|
2333
2350
|
session: r,
|
|
@@ -2341,59 +2358,59 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2341
2358
|
items: Object.fromEntries(n.map((a) => [a.id, a]))
|
|
2342
2359
|
}));
|
|
2343
2360
|
return Xe("room") ? /* @__PURE__ */ T(
|
|
2344
|
-
|
|
2361
|
+
Kt,
|
|
2345
2362
|
{
|
|
2346
2363
|
storeName: `${l}_messages`,
|
|
2347
2364
|
defaultValue: o,
|
|
2348
|
-
children: /* @__PURE__ */ T(
|
|
2349
|
-
|
|
2365
|
+
children: /* @__PURE__ */ T(Wt, { children: /* @__PURE__ */ T(
|
|
2366
|
+
Ut,
|
|
2350
2367
|
{
|
|
2351
2368
|
storeName: `${l}_item`,
|
|
2352
2369
|
defaultValue: d,
|
|
2353
|
-
children: /* @__PURE__ */ T(
|
|
2370
|
+
children: /* @__PURE__ */ T(Ht, { ...c, session: l })
|
|
2354
2371
|
}
|
|
2355
2372
|
) })
|
|
2356
2373
|
}
|
|
2357
2374
|
) : /* @__PURE__ */ T(
|
|
2358
|
-
|
|
2375
|
+
nr,
|
|
2359
2376
|
{
|
|
2360
2377
|
room: u,
|
|
2361
2378
|
channel: "room",
|
|
2362
2379
|
socket: e,
|
|
2363
2380
|
LoadingComponent: s,
|
|
2364
|
-
children: /* @__PURE__ */ T(
|
|
2365
|
-
|
|
2381
|
+
children: /* @__PURE__ */ T(fr, { storeName: `${u}_users`, children: /* @__PURE__ */ T(
|
|
2382
|
+
Kt,
|
|
2366
2383
|
{
|
|
2367
2384
|
storeName: `${l}_messages`,
|
|
2368
2385
|
defaultValue: o,
|
|
2369
|
-
children: /* @__PURE__ */ T(
|
|
2370
|
-
|
|
2386
|
+
children: /* @__PURE__ */ T(Wt, { children: /* @__PURE__ */ T(
|
|
2387
|
+
Ut,
|
|
2371
2388
|
{
|
|
2372
2389
|
storeName: `${l}_item`,
|
|
2373
2390
|
defaultValue: d,
|
|
2374
|
-
children: /* @__PURE__ */ T(
|
|
2391
|
+
children: /* @__PURE__ */ T(Ht, { ...c, session: l })
|
|
2375
2392
|
}
|
|
2376
2393
|
) })
|
|
2377
2394
|
}
|
|
2378
2395
|
) })
|
|
2379
2396
|
}
|
|
2380
2397
|
);
|
|
2381
|
-
},
|
|
2398
|
+
}, ms = ({ socket: e, room: t, children: r, LoadingComponent: n }) => {
|
|
2382
2399
|
const [o] = g.useState(t || pe());
|
|
2383
2400
|
return /* @__PURE__ */ T(
|
|
2384
|
-
|
|
2401
|
+
nr,
|
|
2385
2402
|
{
|
|
2386
2403
|
room: o,
|
|
2387
2404
|
channel: "room",
|
|
2388
2405
|
socket: e,
|
|
2389
2406
|
LoadingComponent: n,
|
|
2390
|
-
children: /* @__PURE__ */ T(
|
|
2407
|
+
children: /* @__PURE__ */ T(fr, { storeName: `${o}_users`, children: r })
|
|
2391
2408
|
}
|
|
2392
2409
|
);
|
|
2393
2410
|
}, nt = () => {
|
|
2394
2411
|
const e = navigator.userAgent.toLowerCase();
|
|
2395
2412
|
return /mac os ?x 10/.test(e);
|
|
2396
|
-
},
|
|
2413
|
+
}, Dn = () => {
|
|
2397
2414
|
const e = document.createElement("iframe");
|
|
2398
2415
|
e.src = "#", document.body.appendChild(e);
|
|
2399
2416
|
const t = e.contentWindow.document;
|
|
@@ -2402,34 +2419,34 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2402
2419
|
), t.close();
|
|
2403
2420
|
const r = t.body.firstElementChild.offsetHeight;
|
|
2404
2421
|
return document.body.removeChild(e), r;
|
|
2405
|
-
},
|
|
2422
|
+
}, jn = Dn(), $n = 800, qt = (e, t) => {
|
|
2406
2423
|
const r = Object.keys(e).map((n) => Number(n)).find((n) => n !== t);
|
|
2407
2424
|
return e[r];
|
|
2408
|
-
},
|
|
2425
|
+
}, Gt = ([e, t], [r, n]) => {
|
|
2409
2426
|
const o = Math.abs(e - r), s = Math.abs(t - n);
|
|
2410
2427
|
return Math.hypot(o, s);
|
|
2411
2428
|
}, de = () => {
|
|
2412
|
-
},
|
|
2429
|
+
}, An = (e) => (t) => {
|
|
2413
2430
|
const { event: r } = t;
|
|
2414
2431
|
return r.isPropagationStopped() ? null : e(t);
|
|
2415
|
-
},
|
|
2432
|
+
}, Ln = (e) => async (...t) => {
|
|
2416
2433
|
try {
|
|
2417
2434
|
await e(...t);
|
|
2418
2435
|
} catch (r) {
|
|
2419
2436
|
console.error(r);
|
|
2420
2437
|
}
|
|
2421
2438
|
};
|
|
2422
|
-
class
|
|
2439
|
+
class zn {
|
|
2423
2440
|
constructor() {
|
|
2424
2441
|
kt(this, "lastPromise", Promise.resolve(!0));
|
|
2425
2442
|
}
|
|
2426
2443
|
add(t, ...r) {
|
|
2427
2444
|
return new Promise((n, o) => {
|
|
2428
|
-
this.lastPromise = this.lastPromise.then(() =>
|
|
2445
|
+
this.lastPromise = this.lastPromise.then(() => An(Ln(t))(...r)).then(n).catch(o);
|
|
2429
2446
|
});
|
|
2430
2447
|
}
|
|
2431
2448
|
}
|
|
2432
|
-
const ne = new
|
|
2449
|
+
const ne = new zn(), Fe = ({
|
|
2433
2450
|
children: e,
|
|
2434
2451
|
onDrag: t = de,
|
|
2435
2452
|
onDragStart: r = de,
|
|
@@ -2474,10 +2491,10 @@ const ne = new An(), Fe = ({
|
|
|
2474
2491
|
let M = x;
|
|
2475
2492
|
switch (m) {
|
|
2476
2493
|
case 1:
|
|
2477
|
-
M *=
|
|
2494
|
+
M *= jn;
|
|
2478
2495
|
break;
|
|
2479
2496
|
case 2:
|
|
2480
|
-
M *=
|
|
2497
|
+
M *= $n;
|
|
2481
2498
|
break;
|
|
2482
2499
|
}
|
|
2483
2500
|
nt() && (M *= 2), ne.add(l, { scale: M, clientX: p, clientY: C, event: y });
|
|
@@ -2497,10 +2514,10 @@ const ne = new An(), Fe = ({
|
|
|
2497
2514
|
if (a.current.pointers[m] = { clientX: p, clientY: C }, D && (a.current.mainPointer = void 0), a.current.mainPointer !== void 0) {
|
|
2498
2515
|
if (a.current.mainPointer !== m)
|
|
2499
2516
|
try {
|
|
2500
|
-
const { clientX: M, clientY: L } =
|
|
2517
|
+
const { clientX: M, clientY: L } = qt(
|
|
2501
2518
|
a.current.pointers,
|
|
2502
2519
|
m
|
|
2503
|
-
), N = (M + p) / 2,
|
|
2520
|
+
), N = (M + p) / 2, U = (L + C) / 2, J = Gt(
|
|
2504
2521
|
[M, L],
|
|
2505
2522
|
[p, C]
|
|
2506
2523
|
);
|
|
@@ -2511,7 +2528,7 @@ const ne = new An(), Fe = ({
|
|
|
2511
2528
|
startX: p,
|
|
2512
2529
|
startY: C,
|
|
2513
2530
|
prevX: N,
|
|
2514
|
-
prevY:
|
|
2531
|
+
prevY: U,
|
|
2515
2532
|
startDistance: J,
|
|
2516
2533
|
prevDistance: J
|
|
2517
2534
|
});
|
|
@@ -2570,19 +2587,19 @@ const ne = new An(), Fe = ({
|
|
|
2570
2587
|
const D = Object.keys(a.current.pointers).length === 2;
|
|
2571
2588
|
let M, L, N = 0;
|
|
2572
2589
|
if (D) {
|
|
2573
|
-
const { clientX: $, clientY: B } =
|
|
2590
|
+
const { clientX: $, clientY: B } = qt(
|
|
2574
2591
|
a.current.pointers,
|
|
2575
2592
|
w
|
|
2576
2593
|
);
|
|
2577
|
-
M = ($ + x) / 2, L = (B + p) / 2, N =
|
|
2594
|
+
M = ($ + x) / 2, L = (B + p) / 2, N = Gt(
|
|
2578
2595
|
[$, B],
|
|
2579
2596
|
[x, p]
|
|
2580
2597
|
);
|
|
2581
2598
|
} else
|
|
2582
2599
|
M = x, L = p;
|
|
2583
|
-
let
|
|
2584
|
-
d !== "drag" && (
|
|
2585
|
-
const J = !
|
|
2600
|
+
let U = m || C || S || O || k !== 1;
|
|
2601
|
+
d !== "drag" && (U = !U);
|
|
2602
|
+
const J = !U, P = U;
|
|
2586
2603
|
if (J) {
|
|
2587
2604
|
a.current.gestureStart || (f.current.style.cursor = "move", a.current.gestureStart = !0, clearTimeout(a.current.longTapTimeout), ne.add(r, {
|
|
2588
2605
|
deltaX: 0,
|
|
@@ -2601,7 +2618,7 @@ const ne = new An(), Fe = ({
|
|
|
2601
2618
|
target: a.current.target,
|
|
2602
2619
|
event: a.current.pointerDownEvent
|
|
2603
2620
|
}));
|
|
2604
|
-
const $ = M - a.current.prevX, B = L - a.current.prevY,
|
|
2621
|
+
const $ = M - a.current.prevX, B = L - a.current.prevY, V = M - a.current.startX, A = L - a.current.startY;
|
|
2605
2622
|
ne.add(t, {
|
|
2606
2623
|
deltaX: $,
|
|
2607
2624
|
deltaY: B,
|
|
@@ -2609,7 +2626,7 @@ const ne = new An(), Fe = ({
|
|
|
2609
2626
|
startY: a.current.startY,
|
|
2610
2627
|
clientX: M,
|
|
2611
2628
|
clientY: L,
|
|
2612
|
-
distanceX:
|
|
2629
|
+
distanceX: V,
|
|
2613
2630
|
distanceY: A,
|
|
2614
2631
|
button: a.current.currentButton,
|
|
2615
2632
|
altKey: C,
|
|
@@ -2622,7 +2639,7 @@ const ne = new An(), Fe = ({
|
|
|
2622
2639
|
}
|
|
2623
2640
|
if (P) {
|
|
2624
2641
|
a.current.gestureStart || (f.current.style.cursor = "move", a.current.gestureStart = !0, clearTimeout(a.current.longTapTimeout));
|
|
2625
|
-
const $ = M - a.current.prevX, B = L - a.current.prevY, { target:
|
|
2642
|
+
const $ = M - a.current.prevX, B = L - a.current.prevY, { target: V } = a.current;
|
|
2626
2643
|
if (ne.add(o, {
|
|
2627
2644
|
deltaX: $,
|
|
2628
2645
|
deltaY: B,
|
|
@@ -2631,7 +2648,7 @@ const ne = new An(), Fe = ({
|
|
|
2631
2648
|
shiftKey: m,
|
|
2632
2649
|
ctrlKey: S,
|
|
2633
2650
|
metaKey: O,
|
|
2634
|
-
target:
|
|
2651
|
+
target: V,
|
|
2635
2652
|
event: y
|
|
2636
2653
|
}), N !== a.current.prevDistance && l) {
|
|
2637
2654
|
const A = a.current.prevDistance - N;
|
|
@@ -2756,23 +2773,23 @@ const ne = new An(), Fe = ({
|
|
|
2756
2773
|
});
|
|
2757
2774
|
}, children: /* @__PURE__ */ T("div", { ...t }) });
|
|
2758
2775
|
};
|
|
2759
|
-
let
|
|
2776
|
+
let Yn = { data: "" }, Bn = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || Yn, Nn = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, Xn = /\/\*[^]*?\*\/| +/g, Jt = /\n+/g, fe = (e, t) => {
|
|
2760
2777
|
let r = "", n = "", o = "";
|
|
2761
2778
|
for (let s in e) {
|
|
2762
2779
|
let c = e[s];
|
|
2763
2780
|
s[0] == "@" ? s[1] == "i" ? r = s + " " + c + ";" : n += s[1] == "f" ? fe(c, s) : s + "{" + fe(c, s[1] == "k" ? "" : t) + "}" : typeof c == "object" ? n += fe(c, t ? t.replace(/([^,])+/g, (u) => s.replace(/(^:.*)|([^,])+/g, (l) => /&/.test(l) ? l.replace(/&/g, u) : u ? u + " " + l : l)) : s) : c != null && (s = /^--/.test(s) ? s : s.replace(/[A-Z]/g, "-$&").toLowerCase(), o += fe.p ? fe.p(s, c) : s + ":" + c + ";");
|
|
2764
2781
|
}
|
|
2765
2782
|
return r + (t && o ? t + "{" + o + "}" : o) + n;
|
|
2766
|
-
}, ae = {},
|
|
2783
|
+
}, ae = {}, pr = (e) => {
|
|
2767
2784
|
if (typeof e == "object") {
|
|
2768
2785
|
let t = "";
|
|
2769
2786
|
for (let r in e)
|
|
2770
|
-
t += r +
|
|
2787
|
+
t += r + pr(e[r]);
|
|
2771
2788
|
return t;
|
|
2772
2789
|
}
|
|
2773
2790
|
return e;
|
|
2774
|
-
},
|
|
2775
|
-
let s =
|
|
2791
|
+
}, Un = (e, t, r, n, o) => {
|
|
2792
|
+
let s = pr(e), c = ae[s] || (ae[s] = ((l) => {
|
|
2776
2793
|
let d = 0, f = 11;
|
|
2777
2794
|
for (; d < l.length; )
|
|
2778
2795
|
f = 101 * f + l.charCodeAt(d++) >>> 0;
|
|
@@ -2781,8 +2798,8 @@ let Ln = { data: "" }, zn = (e) => typeof window == "object" ? ((e ? e.querySele
|
|
|
2781
2798
|
if (!ae[c]) {
|
|
2782
2799
|
let l = s !== e ? e : ((d) => {
|
|
2783
2800
|
let f, a, h = [{}];
|
|
2784
|
-
for (; f =
|
|
2785
|
-
f[4] ? h.shift() : f[3] ? (a = f[3].replace(
|
|
2801
|
+
for (; f = Nn.exec(d.replace(Xn, "")); )
|
|
2802
|
+
f[4] ? h.shift() : f[3] ? (a = f[3].replace(Jt, " ").trim(), h.unshift(h[0][a] = h[0][a] || {})) : h[0][f[1]] = f[2].replace(Jt, " ").trim();
|
|
2786
2803
|
return h[0];
|
|
2787
2804
|
})(e);
|
|
2788
2805
|
ae[c] = fe(o ? { ["@keyframes " + c]: l } : l, r ? "" : "." + c);
|
|
@@ -2791,7 +2808,7 @@ let Ln = { data: "" }, zn = (e) => typeof window == "object" ? ((e ? e.querySele
|
|
|
2791
2808
|
return r && (ae.g = ae[c]), ((l, d, f, a) => {
|
|
2792
2809
|
a ? d.data = d.data.replace(a, l) : d.data.indexOf(l) === -1 && (d.data = f ? l + d.data : d.data + l);
|
|
2793
2810
|
})(ae[c], t, n, u), c;
|
|
2794
|
-
},
|
|
2811
|
+
}, Wn = (e, t, r) => e.reduce((n, o, s) => {
|
|
2795
2812
|
let c = t[s];
|
|
2796
2813
|
if (c && c.call) {
|
|
2797
2814
|
let u = c(r), l = u && u.props && u.props.className || /^go/.test(u) && u;
|
|
@@ -2801,14 +2818,14 @@ let Ln = { data: "" }, zn = (e) => typeof window == "object" ? ((e ? e.querySele
|
|
|
2801
2818
|
}, "");
|
|
2802
2819
|
function H(e) {
|
|
2803
2820
|
let t = this || {}, r = e.call ? e(t.p) : e;
|
|
2804
|
-
return
|
|
2821
|
+
return Un(r.unshift ? r.raw ? Wn(r, [].slice.call(arguments, 1), t.p) : r.reduce((n, o) => Object.assign(n, o && o.call ? o(t.p) : o), {}) : r, Bn(t.target), t.g, t.o, t.k);
|
|
2805
2822
|
}
|
|
2806
2823
|
H.bind({ g: 1 });
|
|
2807
2824
|
H.bind({ k: 1 });
|
|
2808
|
-
function
|
|
2825
|
+
function Vn(e, t, r, n) {
|
|
2809
2826
|
fe.p = t;
|
|
2810
2827
|
}
|
|
2811
|
-
var
|
|
2828
|
+
var Fn = function e(t, r) {
|
|
2812
2829
|
if (t === r)
|
|
2813
2830
|
return !0;
|
|
2814
2831
|
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
@@ -2843,13 +2860,13 @@ var Wn = function e(t, r) {
|
|
|
2843
2860
|
}
|
|
2844
2861
|
return t !== t && r !== r;
|
|
2845
2862
|
};
|
|
2846
|
-
const
|
|
2863
|
+
const Kn = H`
|
|
2847
2864
|
display: inline-block;
|
|
2848
2865
|
transition: transform 150ms;
|
|
2849
2866
|
user-select: none;
|
|
2850
2867
|
padding: 2px;
|
|
2851
2868
|
box-sizing: border-box;
|
|
2852
|
-
`,
|
|
2869
|
+
`, Hn = H`
|
|
2853
2870
|
border: 2px dashed #db5034;
|
|
2854
2871
|
padding: 0px;
|
|
2855
2872
|
cursor: pointer;
|
|
@@ -2857,19 +2874,19 @@ const Vn = H`
|
|
|
2857
2874
|
position: absolute;
|
|
2858
2875
|
width: 0px;
|
|
2859
2876
|
height: 0px;
|
|
2860
|
-
`,
|
|
2877
|
+
`, qn = H`
|
|
2861
2878
|
top: 0;
|
|
2862
2879
|
left: 0;
|
|
2863
|
-
`,
|
|
2880
|
+
`, Gn = H`
|
|
2864
2881
|
top: 0;
|
|
2865
2882
|
right: 0;
|
|
2866
|
-
`,
|
|
2883
|
+
`, Jn = H`
|
|
2867
2884
|
bottom: 0;
|
|
2868
2885
|
left: 0;
|
|
2869
|
-
`,
|
|
2886
|
+
`, Zn = H`
|
|
2870
2887
|
bottom: 0;
|
|
2871
2888
|
right: 0;
|
|
2872
|
-
`,
|
|
2889
|
+
`, Qn = H`
|
|
2873
2890
|
top: 50%;
|
|
2874
2891
|
left: 50%;
|
|
2875
2892
|
`, st = H`
|
|
@@ -2880,19 +2897,19 @@ const Vn = H`
|
|
|
2880
2897
|
border: 2px solid #db5034;
|
|
2881
2898
|
background-color: #db5034;
|
|
2882
2899
|
cursor: move;
|
|
2883
|
-
`,
|
|
2900
|
+
`, eo = H`
|
|
2884
2901
|
cursor: ew-resize;
|
|
2885
2902
|
right: -6px;
|
|
2886
2903
|
top: calc(50% - 5px);
|
|
2887
|
-
`,
|
|
2904
|
+
`, to = H`
|
|
2888
2905
|
cursor: ns-resize;
|
|
2889
2906
|
bottom: -6px;
|
|
2890
2907
|
left: calc(50% - 5px);
|
|
2891
|
-
`,
|
|
2908
|
+
`, ro = H`
|
|
2892
2909
|
cursor: nwse-resize;
|
|
2893
2910
|
bottom: -6px;
|
|
2894
2911
|
right: -6px;
|
|
2895
|
-
`,
|
|
2912
|
+
`, no = ({ onReload: e }) => /* @__PURE__ */ ue(
|
|
2896
2913
|
"div",
|
|
2897
2914
|
{
|
|
2898
2915
|
className: `syncboard-error-item ${H({
|
|
@@ -2909,7 +2926,7 @@ const Vn = H`
|
|
|
2909
2926
|
]
|
|
2910
2927
|
}
|
|
2911
2928
|
);
|
|
2912
|
-
class
|
|
2929
|
+
class oo extends g.Component {
|
|
2913
2930
|
constructor(t) {
|
|
2914
2931
|
super(t), this.state = { hasError: !1, itemId: t.itemId }, this.onReload = this.onReload.bind(this);
|
|
2915
2932
|
}
|
|
@@ -2931,9 +2948,9 @@ class ro extends g.Component {
|
|
|
2931
2948
|
return this.state.hasError ? /* @__PURE__ */ T(t, { onReload: this.onReload }) : this.props.children;
|
|
2932
2949
|
}
|
|
2933
2950
|
}
|
|
2934
|
-
const
|
|
2951
|
+
const so = (e) => {
|
|
2935
2952
|
e.target.className = "";
|
|
2936
|
-
},
|
|
2953
|
+
}, io = ({
|
|
2937
2954
|
width: e,
|
|
2938
2955
|
height: t,
|
|
2939
2956
|
actualWidth: r,
|
|
@@ -2958,11 +2975,11 @@ const no = (e) => {
|
|
|
2958
2975
|
width: (c + e).toFixed(1),
|
|
2959
2976
|
height: (u + t).toFixed(1)
|
|
2960
2977
|
};
|
|
2961
|
-
},
|
|
2978
|
+
}, ao = {
|
|
2962
2979
|
w: !0,
|
|
2963
2980
|
h: !0,
|
|
2964
2981
|
b: !0
|
|
2965
|
-
},
|
|
2982
|
+
}, co = ({
|
|
2966
2983
|
setState: e,
|
|
2967
2984
|
state: { type: t, rotation: r = 0, id: n, locked: o, extraClasses: s, ...c } = {},
|
|
2968
2985
|
animate: u = "hvr-pop",
|
|
@@ -2973,8 +2990,8 @@ const no = (e) => {
|
|
|
2973
2990
|
var m;
|
|
2974
2991
|
const a = g.useRef(null), {
|
|
2975
2992
|
component: h = () => null,
|
|
2976
|
-
resizeDirections: _ =
|
|
2977
|
-
resize: v =
|
|
2993
|
+
resizeDirections: _ = ao,
|
|
2994
|
+
resize: v = io
|
|
2978
2995
|
} = d[t], E = g.useCallback(
|
|
2979
2996
|
(S) => e(n, S),
|
|
2980
2997
|
[e, n]
|
|
@@ -2982,8 +2999,8 @@ const no = (e) => {
|
|
|
2982
2999
|
g.useEffect(() => {
|
|
2983
3000
|
a.current.className = u;
|
|
2984
3001
|
}, [u]);
|
|
2985
|
-
const I = ["item", n,
|
|
2986
|
-
o && I.push("locked"), l && (I.push("selected"), I.push(
|
|
3002
|
+
const I = ["item", n, Kn];
|
|
3003
|
+
o && I.push("locked"), l && (I.push("selected"), I.push(Hn));
|
|
2987
3004
|
const y = I.join(" "), w = ({ width: S = 0, height: O = 0, keepRatio: k }) => {
|
|
2988
3005
|
E((D) => {
|
|
2989
3006
|
const { offsetWidth: M, offsetHeight: L } = a.current;
|
|
@@ -3014,43 +3031,43 @@ const no = (e) => {
|
|
|
3014
3031
|
{
|
|
3015
3032
|
style: { display: "flex" },
|
|
3016
3033
|
ref: a,
|
|
3017
|
-
onAnimationEnd:
|
|
3034
|
+
onAnimationEnd: so,
|
|
3018
3035
|
onKeyDown: (S) => S.stopPropagation(),
|
|
3019
3036
|
onKeyUp: (S) => S.stopPropagation(),
|
|
3020
3037
|
children: [
|
|
3021
3038
|
/* @__PURE__ */ T(
|
|
3022
|
-
|
|
3039
|
+
oo,
|
|
3023
3040
|
{
|
|
3024
3041
|
itemId: n,
|
|
3025
3042
|
state: c,
|
|
3026
|
-
ErrorComponent: ((m = d == null ? void 0 : d.error) == null ? void 0 : m.component) ||
|
|
3043
|
+
ErrorComponent: ((m = d == null ? void 0 : d.error) == null ? void 0 : m.component) || no,
|
|
3027
3044
|
children: /* @__PURE__ */ T(h, { ...c, id: n, setState: E })
|
|
3028
3045
|
}
|
|
3029
3046
|
),
|
|
3030
|
-
/* @__PURE__ */ T("div", { className: `corner ${we} ${Kn}` }),
|
|
3031
|
-
/* @__PURE__ */ T("div", { className: `corner ${we} ${Hn}` }),
|
|
3032
|
-
/* @__PURE__ */ T("div", { className: `corner ${we} ${Gn}` }),
|
|
3033
3047
|
/* @__PURE__ */ T("div", { className: `corner ${we} ${qn}` }),
|
|
3034
|
-
/* @__PURE__ */ T("div", { className: `
|
|
3035
|
-
|
|
3048
|
+
/* @__PURE__ */ T("div", { className: `corner ${we} ${Gn}` }),
|
|
3049
|
+
/* @__PURE__ */ T("div", { className: `corner ${we} ${Zn}` }),
|
|
3050
|
+
/* @__PURE__ */ T("div", { className: `corner ${we} ${Jn}` }),
|
|
3051
|
+
/* @__PURE__ */ T("div", { className: `center ${we} ${Qn}` }),
|
|
3052
|
+
f && /* @__PURE__ */ ue(Wr, { children: [
|
|
3036
3053
|
_.b && /* @__PURE__ */ T(
|
|
3037
3054
|
ot,
|
|
3038
3055
|
{
|
|
3039
|
-
className: `${st} ${
|
|
3056
|
+
className: `${st} ${ro}`,
|
|
3040
3057
|
onResize: C
|
|
3041
3058
|
}
|
|
3042
3059
|
),
|
|
3043
3060
|
_.h && /* @__PURE__ */ T(
|
|
3044
3061
|
ot,
|
|
3045
3062
|
{
|
|
3046
|
-
className: `${st} ${
|
|
3063
|
+
className: `${st} ${to}`,
|
|
3047
3064
|
onResize: p
|
|
3048
3065
|
}
|
|
3049
3066
|
),
|
|
3050
3067
|
_.w && /* @__PURE__ */ T(
|
|
3051
3068
|
ot,
|
|
3052
3069
|
{
|
|
3053
|
-
className: `${st} ${
|
|
3070
|
+
className: `${st} ${eo}`,
|
|
3054
3071
|
onResize: x
|
|
3055
3072
|
}
|
|
3056
3073
|
)
|
|
@@ -3060,8 +3077,8 @@ const no = (e) => {
|
|
|
3060
3077
|
)
|
|
3061
3078
|
}
|
|
3062
3079
|
);
|
|
3063
|
-
},
|
|
3064
|
-
|
|
3080
|
+
}, uo = rr(
|
|
3081
|
+
co,
|
|
3065
3082
|
({
|
|
3066
3083
|
state: e,
|
|
3067
3084
|
setState: t,
|
|
@@ -3072,11 +3089,11 @@ const no = (e) => {
|
|
|
3072
3089
|
setState: s,
|
|
3073
3090
|
isSelected: c,
|
|
3074
3091
|
showResizeHandle: u
|
|
3075
|
-
}) => r === c && n === u && t === s &&
|
|
3076
|
-
),
|
|
3092
|
+
}) => r === c && n === u && t === s && Fn(e, o)
|
|
3093
|
+
), lo = (e) => e, fo = ({ state: e = {}, getCurrentUser: t, className: r, ...n }) => {
|
|
3077
3094
|
if (!n.itemMap[e.type])
|
|
3078
3095
|
return null;
|
|
3079
|
-
const { stateHook: o =
|
|
3096
|
+
const { stateHook: o = lo } = n.itemMap[e.type], {
|
|
3080
3097
|
x: s = 0,
|
|
3081
3098
|
y: c = 0,
|
|
3082
3099
|
layer: u = 0,
|
|
@@ -3092,7 +3109,7 @@ const no = (e) => {
|
|
|
3092
3109
|
zIndex: f
|
|
3093
3110
|
},
|
|
3094
3111
|
children: /* @__PURE__ */ T(
|
|
3095
|
-
|
|
3112
|
+
uo,
|
|
3096
3113
|
{
|
|
3097
3114
|
...n,
|
|
3098
3115
|
showResizeHandle: n.isSelected && n.showResizeHandle,
|
|
@@ -3101,7 +3118,7 @@ const no = (e) => {
|
|
|
3101
3118
|
)
|
|
3102
3119
|
}
|
|
3103
3120
|
);
|
|
3104
|
-
},
|
|
3121
|
+
}, po = rr(fo), mo = () => {
|
|
3105
3122
|
const { updateItem: e } = gt(), [t, r] = re((d) => [
|
|
3106
3123
|
d.itemIds,
|
|
3107
3124
|
d.items
|
|
@@ -3116,10 +3133,11 @@ const no = (e) => {
|
|
|
3116
3133
|
position: "absolute",
|
|
3117
3134
|
top: `${n / 2}px`,
|
|
3118
3135
|
left: `${n / 2}px`,
|
|
3119
|
-
display: "inline-block"
|
|
3136
|
+
display: "inline-block",
|
|
3137
|
+
lineHeight: 0
|
|
3120
3138
|
});
|
|
3121
3139
|
return t.map((d) => /* @__PURE__ */ T(
|
|
3122
|
-
|
|
3140
|
+
po,
|
|
3123
3141
|
{
|
|
3124
3142
|
state: r[d],
|
|
3125
3143
|
setState: e,
|
|
@@ -3133,21 +3151,21 @@ const no = (e) => {
|
|
|
3133
3151
|
d
|
|
3134
3152
|
));
|
|
3135
3153
|
};
|
|
3136
|
-
function
|
|
3137
|
-
const t = Re(e), r =
|
|
3154
|
+
function go(e = !1) {
|
|
3155
|
+
const t = Re(e), r = tr(() => t.current, []);
|
|
3138
3156
|
return Pe(() => (t.current = !0, () => {
|
|
3139
3157
|
t.current = !1;
|
|
3140
3158
|
}), []), r;
|
|
3141
3159
|
}
|
|
3142
|
-
function
|
|
3160
|
+
function ho(e, ...t) {
|
|
3143
3161
|
e && e.addEventListener && e.addEventListener(...t);
|
|
3144
3162
|
}
|
|
3145
|
-
function
|
|
3163
|
+
function vo(e, ...t) {
|
|
3146
3164
|
e && e.removeEventListener && e.removeEventListener(...t);
|
|
3147
3165
|
}
|
|
3148
|
-
const
|
|
3166
|
+
const yo = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
|
|
3149
3167
|
function ce(e, ...t) {
|
|
3150
|
-
const r =
|
|
3168
|
+
const r = go(), n = pt(t[1]), o = lt(
|
|
3151
3169
|
() => (
|
|
3152
3170
|
// as some event listeners designed to be used through `this`
|
|
3153
3171
|
// it is better to make listener a conventional function as it
|
|
@@ -3161,28 +3179,28 @@ function ce(e, ...t) {
|
|
|
3161
3179
|
[]
|
|
3162
3180
|
);
|
|
3163
3181
|
Pe(() => {
|
|
3164
|
-
const s = e &&
|
|
3182
|
+
const s = e && yo(e, "current") ? e.current : e;
|
|
3165
3183
|
if (!s)
|
|
3166
3184
|
return;
|
|
3167
3185
|
const c = t.slice(2);
|
|
3168
|
-
return
|
|
3186
|
+
return ho(s, t[0], o, ...c), () => vo(s, t[0], o, ...c);
|
|
3169
3187
|
}, [e, t[0]]);
|
|
3170
3188
|
}
|
|
3171
|
-
const
|
|
3189
|
+
const So = H({
|
|
3172
3190
|
zIndex: 210,
|
|
3173
3191
|
position: "absolute",
|
|
3174
3192
|
backgroundColor: "hsla(0, 40%, 50%, 10%)",
|
|
3175
3193
|
border: "2px solid hsl(0, 55%, 40%)"
|
|
3176
|
-
}),
|
|
3194
|
+
}), _o = (e, t, r = !1) => {
|
|
3177
3195
|
const n = t.getElementsByClassName("selector");
|
|
3178
3196
|
if (!n.length)
|
|
3179
3197
|
return [];
|
|
3180
3198
|
const o = n[0];
|
|
3181
3199
|
return Array.from(t.getElementsByClassName("item")).filter((s) => {
|
|
3182
3200
|
const c = Te(s), u = e[c];
|
|
3183
|
-
return !u || !r && u.locked ? !1 :
|
|
3201
|
+
return !u || !r && u.locked ? !1 : on(s, o);
|
|
3184
3202
|
}).map((s) => Te(s));
|
|
3185
|
-
},
|
|
3203
|
+
}, bo = ({ children: e, moveFirst: t }) => {
|
|
3186
3204
|
const [
|
|
3187
3205
|
r,
|
|
3188
3206
|
n,
|
|
@@ -3209,7 +3227,7 @@ const vo = H({
|
|
|
3209
3227
|
n();
|
|
3210
3228
|
}), [n]), g.useEffect(() => {
|
|
3211
3229
|
if (I.current.moving) {
|
|
3212
|
-
const m = d(), { boardWrapper: S } = c(), O =
|
|
3230
|
+
const m = d(), { boardWrapper: S } = c(), O = _o(m, S, _);
|
|
3213
3231
|
h(() => {
|
|
3214
3232
|
o(O);
|
|
3215
3233
|
});
|
|
@@ -3264,14 +3282,14 @@ const vo = H({
|
|
|
3264
3282
|
height: `${f.height}px`,
|
|
3265
3283
|
width: `${f.width}px`
|
|
3266
3284
|
},
|
|
3267
|
-
className: `selector ${
|
|
3285
|
+
className: `selector ${So}`
|
|
3268
3286
|
}
|
|
3269
3287
|
),
|
|
3270
3288
|
e
|
|
3271
3289
|
] })
|
|
3272
3290
|
}
|
|
3273
3291
|
);
|
|
3274
|
-
},
|
|
3292
|
+
}, Eo = ({ children: e }) => {
|
|
3275
3293
|
const { moveItems: t, placeItems: r, findElementUnderPointer: n } = gt(), { vectorFromWrapperToBoard: o } = Me(), [s, c, u, l, d] = Z((y) => [
|
|
3276
3294
|
y.select,
|
|
3277
3295
|
y.setSelection,
|
|
@@ -3351,7 +3369,7 @@ const vo = H({
|
|
|
3351
3369
|
}
|
|
3352
3370
|
}
|
|
3353
3371
|
}), /* @__PURE__ */ T(Fe, { onDragStart: _, onDrag: v, onDragEnd: E, children: e });
|
|
3354
|
-
},
|
|
3372
|
+
}, Co = (e) => {
|
|
3355
3373
|
const t = g.useRef({ hover: !1, x: 0, y: 0 });
|
|
3356
3374
|
return ce(e.current, "mousemove", (n) => {
|
|
3357
3375
|
const { clientX: o, clientY: s } = n;
|
|
@@ -3361,13 +3379,13 @@ const vo = H({
|
|
|
3361
3379
|
}), ce(e.current, "mouseleave", () => {
|
|
3362
3380
|
t.current.hover = !1;
|
|
3363
3381
|
}), g.useCallback(() => t.current, []);
|
|
3364
|
-
},
|
|
3382
|
+
}, wo = [...Array(5).keys()].map((e) => `Digit${e + 1}`), xo = () => {
|
|
3365
3383
|
const [e, t] = g.useState({}), [r, n] = Z((o) => [
|
|
3366
3384
|
o.getBoardState,
|
|
3367
3385
|
o.updateBoardState
|
|
3368
3386
|
]);
|
|
3369
3387
|
return ce(document, "keydown", (o) => {
|
|
3370
|
-
if (!["INPUT", "TEXTAREA"].includes(o.target.tagName) &&
|
|
3388
|
+
if (!["INPUT", "TEXTAREA"].includes(o.target.tagName) && wo.includes(o.code)) {
|
|
3371
3389
|
const s = o.code, { translateX: c, translateY: u, scale: l } = r();
|
|
3372
3390
|
o.altKey || o.metaKey || o.ctrlKey || o.shiftKey ? t((d) => ({
|
|
3373
3391
|
...d,
|
|
@@ -3375,7 +3393,7 @@ const vo = H({
|
|
|
3375
3393
|
})) : e[s] && n(e[s]), o.preventDefault();
|
|
3376
3394
|
}
|
|
3377
3395
|
}), null;
|
|
3378
|
-
},
|
|
3396
|
+
}, Ro = ({ children: e, moveFirst: t = !1 }) => {
|
|
3379
3397
|
const r = g.useRef(null), [
|
|
3380
3398
|
n,
|
|
3381
3399
|
o,
|
|
@@ -3393,8 +3411,8 @@ const vo = H({
|
|
|
3393
3411
|
p.getConfiguration,
|
|
3394
3412
|
p.updateBoardState,
|
|
3395
3413
|
p.getSelection
|
|
3396
|
-
]), { zoomToCenter: l, zoomToExtent: d, moveBoard: f } = Me(), [a, h] = g.useState(!1), _ = g.useRef({}), v =
|
|
3397
|
-
|
|
3414
|
+
]), { zoomToCenter: l, zoomToExtent: d, moveBoard: f } = Me(), [a, h] = g.useState(!1), _ = g.useRef({}), v = Co(r);
|
|
3415
|
+
xo();
|
|
3398
3416
|
const E = g.useCallback(() => {
|
|
3399
3417
|
const { itemExtent: p } = s();
|
|
3400
3418
|
d(p);
|
|
@@ -3471,7 +3489,7 @@ const vo = H({
|
|
|
3471
3489
|
)
|
|
3472
3490
|
}
|
|
3473
3491
|
);
|
|
3474
|
-
},
|
|
3492
|
+
}, Io = H({
|
|
3475
3493
|
position: "absolute",
|
|
3476
3494
|
top: 0,
|
|
3477
3495
|
left: 0,
|
|
@@ -3479,7 +3497,7 @@ const vo = H({
|
|
|
3479
3497
|
backgroundColor: "hsla(0, 40%, 50%, 0%)",
|
|
3480
3498
|
border: "2px dashed hsl(20, 55%, 40%)",
|
|
3481
3499
|
pointerEvents: "none"
|
|
3482
|
-
}),
|
|
3500
|
+
}), Oo = () => {
|
|
3483
3501
|
const [
|
|
3484
3502
|
e,
|
|
3485
3503
|
t,
|
|
@@ -3504,7 +3522,7 @@ const vo = H({
|
|
|
3504
3522
|
n(null);
|
|
3505
3523
|
return;
|
|
3506
3524
|
}
|
|
3507
|
-
const v =
|
|
3525
|
+
const v = sn(a, _);
|
|
3508
3526
|
if (!v) {
|
|
3509
3527
|
n(null);
|
|
3510
3528
|
return;
|
|
@@ -3535,16 +3553,16 @@ const vo = H({
|
|
|
3535
3553
|
height: `${r.height}px`,
|
|
3536
3554
|
width: `${r.width}px`
|
|
3537
3555
|
},
|
|
3538
|
-
className: `selection ${
|
|
3556
|
+
className: `selection ${Io}`
|
|
3539
3557
|
}
|
|
3540
3558
|
);
|
|
3541
|
-
},
|
|
3559
|
+
}, To = () => {
|
|
3542
3560
|
const [e] = Z((t) => [t.boardState.movingItems]);
|
|
3543
|
-
return e ? null : /* @__PURE__ */ T(
|
|
3544
|
-
},
|
|
3561
|
+
return e ? null : /* @__PURE__ */ T(Oo, {});
|
|
3562
|
+
}, ko = typeof window < "u" && typeof navigator < "u" && typeof document < "u";
|
|
3545
3563
|
let Le;
|
|
3546
|
-
function
|
|
3547
|
-
if (!
|
|
3564
|
+
function Po() {
|
|
3565
|
+
if (!ko)
|
|
3548
3566
|
return;
|
|
3549
3567
|
if (Le)
|
|
3550
3568
|
return Le;
|
|
@@ -3566,8 +3584,8 @@ function To() {
|
|
|
3566
3584
|
}
|
|
3567
3585
|
}, Le;
|
|
3568
3586
|
}
|
|
3569
|
-
function
|
|
3570
|
-
const n = r &&
|
|
3587
|
+
function Mo(e, t, r = !0) {
|
|
3588
|
+
const n = r && Po(), o = pt(t), s = e && "current" in e ? e.current : e;
|
|
3571
3589
|
Pe(() => {
|
|
3572
3590
|
const c = e && "current" in e ? e.current : e;
|
|
3573
3591
|
if (!n || !c)
|
|
@@ -3581,97 +3599,97 @@ function ko(e, t, r = !0) {
|
|
|
3581
3599
|
};
|
|
3582
3600
|
}, [s, n]);
|
|
3583
3601
|
}
|
|
3584
|
-
function
|
|
3602
|
+
function Zt(e, t, r) {
|
|
3585
3603
|
return Math.min(Math.max(e, r), t);
|
|
3586
3604
|
}
|
|
3587
|
-
class
|
|
3605
|
+
class Do extends Error {
|
|
3588
3606
|
constructor(t) {
|
|
3589
3607
|
super(`Failed to parse color: "${t}"`);
|
|
3590
3608
|
}
|
|
3591
3609
|
}
|
|
3592
|
-
var xe =
|
|
3593
|
-
function
|
|
3610
|
+
var xe = Do;
|
|
3611
|
+
function jo(e) {
|
|
3594
3612
|
if (typeof e != "string")
|
|
3595
3613
|
throw new xe(e);
|
|
3596
3614
|
if (e.trim().toLowerCase() === "transparent")
|
|
3597
3615
|
return [0, 0, 0, 0];
|
|
3598
3616
|
let t = e.trim();
|
|
3599
|
-
t =
|
|
3600
|
-
const r =
|
|
3617
|
+
t = Xo.test(e) ? Lo(e) : e;
|
|
3618
|
+
const r = zo.exec(t);
|
|
3601
3619
|
if (r) {
|
|
3602
3620
|
const c = Array.from(r).slice(1);
|
|
3603
3621
|
return [...c.slice(0, 3).map((u) => parseInt(ke(u, 2), 16)), parseInt(ke(c[3] || "f", 2), 16) / 255];
|
|
3604
3622
|
}
|
|
3605
|
-
const n =
|
|
3623
|
+
const n = Yo.exec(t);
|
|
3606
3624
|
if (n) {
|
|
3607
3625
|
const c = Array.from(n).slice(1);
|
|
3608
3626
|
return [...c.slice(0, 3).map((u) => parseInt(u, 16)), parseInt(c[3] || "ff", 16) / 255];
|
|
3609
3627
|
}
|
|
3610
|
-
const o =
|
|
3628
|
+
const o = Bo.exec(t);
|
|
3611
3629
|
if (o) {
|
|
3612
3630
|
const c = Array.from(o).slice(1);
|
|
3613
3631
|
return [...c.slice(0, 3).map((u) => parseInt(u, 10)), parseFloat(c[3] || "1")];
|
|
3614
3632
|
}
|
|
3615
|
-
const s =
|
|
3633
|
+
const s = No.exec(t);
|
|
3616
3634
|
if (s) {
|
|
3617
3635
|
const [c, u, l, d] = Array.from(s).slice(1).map(parseFloat);
|
|
3618
|
-
if (
|
|
3636
|
+
if (Zt(0, 100, u) !== u)
|
|
3619
3637
|
throw new xe(e);
|
|
3620
|
-
if (
|
|
3638
|
+
if (Zt(0, 100, l) !== l)
|
|
3621
3639
|
throw new xe(e);
|
|
3622
|
-
return [...
|
|
3640
|
+
return [...Uo(c, u, l), Number.isNaN(d) ? 1 : d];
|
|
3623
3641
|
}
|
|
3624
3642
|
throw new xe(e);
|
|
3625
3643
|
}
|
|
3626
|
-
function
|
|
3644
|
+
function $o(e) {
|
|
3627
3645
|
let t = 5381, r = e.length;
|
|
3628
3646
|
for (; r; )
|
|
3629
3647
|
t = t * 33 ^ e.charCodeAt(--r);
|
|
3630
3648
|
return (t >>> 0) % 2341;
|
|
3631
3649
|
}
|
|
3632
|
-
const
|
|
3633
|
-
const r =
|
|
3650
|
+
const Qt = (e) => parseInt(e.replace(/_/g, ""), 36), Ao = "1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e, t) => {
|
|
3651
|
+
const r = Qt(t.substring(0, 3)), n = Qt(t.substring(3)).toString(16);
|
|
3634
3652
|
let o = "";
|
|
3635
3653
|
for (let s = 0; s < 6 - n.length; s++)
|
|
3636
3654
|
o += "0";
|
|
3637
3655
|
return e[r] = `${o}${n}`, e;
|
|
3638
3656
|
}, {});
|
|
3639
|
-
function
|
|
3640
|
-
const t = e.toLowerCase().trim(), r =
|
|
3657
|
+
function Lo(e) {
|
|
3658
|
+
const t = e.toLowerCase().trim(), r = Ao[$o(t)];
|
|
3641
3659
|
if (!r)
|
|
3642
3660
|
throw new xe(e);
|
|
3643
3661
|
return `#${r}`;
|
|
3644
3662
|
}
|
|
3645
|
-
const ke = (e, t) => Array.from(Array(t)).map(() => e).join(""),
|
|
3663
|
+
const ke = (e, t) => Array.from(Array(t)).map(() => e).join(""), zo = new RegExp(`^#${ke("([a-f0-9])", 3)}([a-f0-9])?$`, "i"), Yo = new RegExp(`^#${ke("([a-f0-9]{2})", 3)}([a-f0-9]{2})?$`, "i"), Bo = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${ke(",\\s*(\\d+)\\s*", 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, "i"), No = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i, Xo = /^[a-z]+$/i, er = (e) => Math.round(e * 255), Uo = (e, t, r) => {
|
|
3646
3664
|
let n = r / 100;
|
|
3647
3665
|
if (t === 0)
|
|
3648
|
-
return [n, n, n].map(
|
|
3666
|
+
return [n, n, n].map(er);
|
|
3649
3667
|
const o = (e % 360 + 360) % 360 / 60, s = (1 - Math.abs(2 * n - 1)) * (t / 100), c = s * (1 - Math.abs(o % 2 - 1));
|
|
3650
3668
|
let u = 0, l = 0, d = 0;
|
|
3651
3669
|
o >= 0 && o < 1 ? (u = s, l = c) : o >= 1 && o < 2 ? (u = c, l = s) : o >= 2 && o < 3 ? (l = s, d = c) : o >= 3 && o < 4 ? (l = c, d = s) : o >= 4 && o < 5 ? (u = c, d = s) : o >= 5 && o < 6 && (u = s, d = c);
|
|
3652
3670
|
const f = n - s / 2, a = u + f, h = l + f, _ = d + f;
|
|
3653
|
-
return [a, h, _].map(
|
|
3671
|
+
return [a, h, _].map(er);
|
|
3654
3672
|
};
|
|
3655
|
-
function
|
|
3673
|
+
function Wo(e) {
|
|
3656
3674
|
if (e === "transparent")
|
|
3657
3675
|
return 0;
|
|
3658
3676
|
function t(s) {
|
|
3659
3677
|
const c = s / 255;
|
|
3660
3678
|
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
3661
3679
|
}
|
|
3662
|
-
const [r, n, o] =
|
|
3680
|
+
const [r, n, o] = jo(e);
|
|
3663
3681
|
return 0.2126 * t(r) + 0.7152 * t(n) + 0.0722 * t(o);
|
|
3664
3682
|
}
|
|
3665
|
-
function
|
|
3666
|
-
return
|
|
3683
|
+
function Vo(e) {
|
|
3684
|
+
return Wo(e) > 0.179;
|
|
3667
3685
|
}
|
|
3668
|
-
const
|
|
3686
|
+
const Fo = H({
|
|
3669
3687
|
display: "flex",
|
|
3670
3688
|
flexDirection: "row",
|
|
3671
3689
|
alignItems: "center",
|
|
3672
3690
|
zIndex: 210,
|
|
3673
3691
|
pointerEvents: "none"
|
|
3674
|
-
}),
|
|
3692
|
+
}), Ko = H({
|
|
3675
3693
|
fontWeight: "bold",
|
|
3676
3694
|
padding: "0 0.5em",
|
|
3677
3695
|
borderRadius: "2px",
|
|
@@ -3682,9 +3700,9 @@ const Wo = H({
|
|
|
3682
3700
|
marginTop: "1.7em",
|
|
3683
3701
|
whitespace: "nowrap",
|
|
3684
3702
|
pointerEvents: "none"
|
|
3685
|
-
}),
|
|
3686
|
-
const n =
|
|
3687
|
-
return /* @__PURE__ */ ue("div", { className:
|
|
3703
|
+
}), Ho = ({ color: e = "#666", size: t = 40, text: r }) => {
|
|
3704
|
+
const n = Vo(e) ? "#222" : "#EEE";
|
|
3705
|
+
return /* @__PURE__ */ ue("div", { className: Fo, children: [
|
|
3688
3706
|
/* @__PURE__ */ ue(
|
|
3689
3707
|
"svg",
|
|
3690
3708
|
{
|
|
@@ -3724,28 +3742,32 @@ const Wo = H({
|
|
|
3724
3742
|
color: n,
|
|
3725
3743
|
backgroundColor: e
|
|
3726
3744
|
},
|
|
3727
|
-
className:
|
|
3745
|
+
className: Ko,
|
|
3728
3746
|
children: r
|
|
3729
3747
|
}
|
|
3730
3748
|
)
|
|
3731
3749
|
] });
|
|
3732
|
-
},
|
|
3750
|
+
}, qo = g.memo(Ho), Go = H({
|
|
3733
3751
|
top: 0,
|
|
3734
3752
|
left: 0,
|
|
3735
3753
|
zIndex: 210,
|
|
3736
3754
|
position: "fixed",
|
|
3737
3755
|
pointerEvents: "none"
|
|
3738
|
-
}),
|
|
3756
|
+
}), Jo = ({ pos: e, ...t }) => /* @__PURE__ */ T(
|
|
3739
3757
|
"div",
|
|
3740
3758
|
{
|
|
3741
|
-
className:
|
|
3759
|
+
className: Go,
|
|
3742
3760
|
style: {
|
|
3743
3761
|
transform: `translate(${e.x - 6}px, ${e.y - 15}px)`
|
|
3744
3762
|
},
|
|
3745
|
-
children: /* @__PURE__ */ T(
|
|
3763
|
+
children: /* @__PURE__ */ T(qo, { ...t })
|
|
3746
3764
|
}
|
|
3747
|
-
),
|
|
3748
|
-
const [t] = Z((v) => [
|
|
3765
|
+
), Zo = ({ children: e }) => {
|
|
3766
|
+
const [t] = Z((v) => [
|
|
3767
|
+
v.getConfiguration,
|
|
3768
|
+
v.boardState.scale
|
|
3769
|
+
// We want to update this component when the scale changes
|
|
3770
|
+
]), { fromWrapperToBoard: r, fromBoardToWrapper: n } = Me(), [o, s, c, u] = Se(
|
|
3749
3771
|
(v) => [
|
|
3750
3772
|
v.getUser(),
|
|
3751
3773
|
v.getLocalUsers(),
|
|
@@ -3772,7 +3794,7 @@ const Wo = H({
|
|
|
3772
3794
|
y: y + f.top
|
|
3773
3795
|
};
|
|
3774
3796
|
return ft(w, f) ? /* @__PURE__ */ T(
|
|
3775
|
-
|
|
3797
|
+
Jo,
|
|
3776
3798
|
{
|
|
3777
3799
|
pos: w,
|
|
3778
3800
|
text: u[v].name,
|
|
@@ -3782,19 +3804,19 @@ const Wo = H({
|
|
|
3782
3804
|
) : null;
|
|
3783
3805
|
})
|
|
3784
3806
|
] });
|
|
3785
|
-
},
|
|
3807
|
+
}, Qo = ({ children: e }) => e, es = {
|
|
3786
3808
|
overflow: "hidden",
|
|
3787
3809
|
position: "absolute",
|
|
3788
3810
|
inset: 0
|
|
3789
|
-
},
|
|
3811
|
+
}, gs = ({
|
|
3790
3812
|
moveFirst: e = !0,
|
|
3791
3813
|
style: t,
|
|
3792
3814
|
wrapperStyle: r,
|
|
3793
3815
|
itemTemplates: n = {},
|
|
3794
|
-
boardSize: o =
|
|
3816
|
+
boardSize: o = cr,
|
|
3795
3817
|
children: s,
|
|
3796
3818
|
showResizeHandle: c = !1,
|
|
3797
|
-
Wrapper: u =
|
|
3819
|
+
Wrapper: u = Qo
|
|
3798
3820
|
}) => {
|
|
3799
3821
|
const l = g.useRef(null), [d, f] = Z((v) => [
|
|
3800
3822
|
v.config.uid,
|
|
@@ -3831,12 +3853,12 @@ const Wo = H({
|
|
|
3831
3853
|
f({
|
|
3832
3854
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3833
3855
|
}), a(), setTimeout(a, 2e3);
|
|
3834
|
-
}, [f, a]),
|
|
3856
|
+
}, [f, a]), Mo(l, () => {
|
|
3835
3857
|
l.current && f({
|
|
3836
3858
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3837
3859
|
});
|
|
3838
3860
|
});
|
|
3839
|
-
const _ = H({ ...
|
|
3861
|
+
const _ = H({ ...es, ...r });
|
|
3840
3862
|
return /* @__PURE__ */ ue(
|
|
3841
3863
|
"div",
|
|
3842
3864
|
{
|
|
@@ -3844,7 +3866,7 @@ const Wo = H({
|
|
|
3844
3866
|
id: d,
|
|
3845
3867
|
className: `sync-board ${_}`,
|
|
3846
3868
|
children: [
|
|
3847
|
-
/* @__PURE__ */ T(
|
|
3869
|
+
/* @__PURE__ */ T(Zo, { children: /* @__PURE__ */ T(bo, { moveFirst: e, children: /* @__PURE__ */ T(Ro, { moveFirst: e, children: /* @__PURE__ */ T(Eo, { moveFirst: e, children: /* @__PURE__ */ T(u, { children: /* @__PURE__ */ ue(
|
|
3848
3870
|
"div",
|
|
3849
3871
|
{
|
|
3850
3872
|
onContextMenu: (v) => {
|
|
@@ -3853,34 +3875,34 @@ const Wo = H({
|
|
|
3853
3875
|
style: h,
|
|
3854
3876
|
className: "board",
|
|
3855
3877
|
children: [
|
|
3856
|
-
/* @__PURE__ */ T(
|
|
3878
|
+
/* @__PURE__ */ T(mo, {}),
|
|
3857
3879
|
s
|
|
3858
3880
|
]
|
|
3859
3881
|
}
|
|
3860
3882
|
) }) }) }) }) }),
|
|
3861
|
-
/* @__PURE__ */ T(
|
|
3883
|
+
/* @__PURE__ */ T(To, {})
|
|
3862
3884
|
]
|
|
3863
3885
|
}
|
|
3864
3886
|
);
|
|
3865
3887
|
};
|
|
3866
|
-
|
|
3888
|
+
Vn(g.createElement);
|
|
3867
3889
|
export {
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3890
|
+
gs as Board,
|
|
3891
|
+
ps as BoardWrapper,
|
|
3892
|
+
ms as RoomWrapper,
|
|
3893
|
+
is as useAvailableActions,
|
|
3894
|
+
us as useBoardConfig,
|
|
3873
3895
|
Me as useBoardPosition,
|
|
3874
|
-
|
|
3875
|
-
|
|
3896
|
+
ls as useBoardState,
|
|
3897
|
+
os as useDebouncedItems,
|
|
3876
3898
|
gt as useItemActions,
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3899
|
+
Vt as useItemInteraction,
|
|
3900
|
+
ns as useItems,
|
|
3901
|
+
ds as useMessage,
|
|
3902
|
+
ss as useSelectedItems,
|
|
3903
|
+
as as useSelectionBox,
|
|
3904
|
+
fs as useSessionInfo,
|
|
3905
|
+
cs as useUsers,
|
|
3884
3906
|
Xe as useWire
|
|
3885
3907
|
};
|
|
3886
3908
|
//# sourceMappingURL=react-sync-board.js.map
|