react-sync-board 1.1.1 → 1.1.2
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
1
|
var Dr = Object.defineProperty;
|
|
2
2
|
var $r = (e, t, r) => t in e ? Dr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var Ot = (e, t, r) => ($r(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
-
import
|
|
5
|
-
function
|
|
4
|
+
import m, { useContext as be, useDebugValue as Ar, useRef as Ie, useMemo as ct, useEffect as Me, useCallback as Jt, memo as Zt } from "react";
|
|
5
|
+
function Lr(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
7
|
}
|
|
8
|
-
var Oe = {},
|
|
8
|
+
var Oe = {}, zr = {
|
|
9
9
|
get exports() {
|
|
10
10
|
return Oe;
|
|
11
11
|
},
|
|
@@ -27,7 +27,7 @@ function Yr() {
|
|
|
27
27
|
if (Tt)
|
|
28
28
|
return we;
|
|
29
29
|
Tt = 1;
|
|
30
|
-
var e =
|
|
30
|
+
var e = m, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
31
31
|
function a(u, l, d) {
|
|
32
32
|
var f, c = {}, b = null, _ = null;
|
|
33
33
|
d !== void 0 && (b = "" + d), l.key !== void 0 && (b = "" + l.key), l.ref !== void 0 && (_ = l.ref);
|
|
@@ -53,51 +53,51 @@ var Ce = {};
|
|
|
53
53
|
var kt;
|
|
54
54
|
function Br() {
|
|
55
55
|
return kt || (kt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
56
|
-
var e =
|
|
57
|
-
function
|
|
56
|
+
var e = m, 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"), a = 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"), c = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), C = Symbol.iterator, h = "@@iterator";
|
|
57
|
+
function S(i) {
|
|
58
58
|
if (i === null || typeof i != "object")
|
|
59
59
|
return null;
|
|
60
|
-
var
|
|
61
|
-
return typeof
|
|
60
|
+
var y = C && i[C] || i[h];
|
|
61
|
+
return typeof y == "function" ? y : null;
|
|
62
62
|
}
|
|
63
|
-
var
|
|
63
|
+
var E = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
64
64
|
function x(i) {
|
|
65
65
|
{
|
|
66
|
-
for (var
|
|
66
|
+
for (var y = arguments.length, I = new Array(y > 1 ? y - 1 : 0), j = 1; j < y; j++)
|
|
67
67
|
I[j - 1] = arguments[j];
|
|
68
|
-
|
|
68
|
+
v("error", i, I);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function v(i, y, I) {
|
|
72
72
|
{
|
|
73
|
-
var j =
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
return String(
|
|
73
|
+
var j = E.ReactDebugCurrentFrame, U = j.getStackAddendum();
|
|
74
|
+
U !== "" && (y += "%s", I = I.concat([U]));
|
|
75
|
+
var W = I.map(function(Y) {
|
|
76
|
+
return String(Y);
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
W.unshift("Warning: " + y), Function.prototype.apply.call(console[i], console, W);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
var p = !1,
|
|
82
|
-
|
|
83
|
-
function
|
|
84
|
-
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s ||
|
|
81
|
+
var p = !1, R = !1, w = !1, g = !1, k = !1, P;
|
|
82
|
+
P = Symbol.for("react.module.reference");
|
|
83
|
+
function M(i) {
|
|
84
|
+
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || k || i === o || i === d || i === f || g || i === _ || p || R || w || typeof i == "object" && i !== null && (i.$$typeof === b || i.$$typeof === c || i.$$typeof === a || i.$$typeof === u || i.$$typeof === l || // This needs to include all possible module reference object
|
|
85
85
|
// types supported by any Flight configuration anywhere since
|
|
86
86
|
// we don't know which Flight build this will end up being used
|
|
87
87
|
// with.
|
|
88
|
-
i.$$typeof ===
|
|
88
|
+
i.$$typeof === P || i.getModuleId !== void 0));
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function $(i, y, I) {
|
|
91
91
|
var j = i.displayName;
|
|
92
92
|
if (j)
|
|
93
93
|
return j;
|
|
94
|
-
var
|
|
95
|
-
return
|
|
94
|
+
var U = y.displayName || y.name || "";
|
|
95
|
+
return U !== "" ? I + "(" + U + ")" : I;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function B(i) {
|
|
98
98
|
return i.displayName || "Context";
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function N(i) {
|
|
101
101
|
if (i == null)
|
|
102
102
|
return null;
|
|
103
103
|
if (typeof i.tag == "number" && x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof i == "function")
|
|
@@ -121,20 +121,20 @@ function Br() {
|
|
|
121
121
|
if (typeof i == "object")
|
|
122
122
|
switch (i.$$typeof) {
|
|
123
123
|
case u:
|
|
124
|
-
var
|
|
125
|
-
return
|
|
124
|
+
var y = i;
|
|
125
|
+
return B(y) + ".Consumer";
|
|
126
126
|
case a:
|
|
127
127
|
var I = i;
|
|
128
|
-
return
|
|
128
|
+
return B(I._context) + ".Provider";
|
|
129
129
|
case l:
|
|
130
|
-
return
|
|
130
|
+
return $(i, i.render, "ForwardRef");
|
|
131
131
|
case c:
|
|
132
132
|
var j = i.displayName || null;
|
|
133
|
-
return j !== null ? j :
|
|
133
|
+
return j !== null ? j : N(i.type) || "Memo";
|
|
134
134
|
case b: {
|
|
135
|
-
var
|
|
135
|
+
var U = i, W = U._payload, Y = U._init;
|
|
136
136
|
try {
|
|
137
|
-
return
|
|
137
|
+
return N(Y(W));
|
|
138
138
|
} catch {
|
|
139
139
|
return null;
|
|
140
140
|
}
|
|
@@ -142,14 +142,14 @@ function Br() {
|
|
|
142
142
|
}
|
|
143
143
|
return null;
|
|
144
144
|
}
|
|
145
|
-
var K = Object.assign, O = 0,
|
|
145
|
+
var K = Object.assign, O = 0, D, A, X, z, F, H, te;
|
|
146
146
|
function re() {
|
|
147
147
|
}
|
|
148
148
|
re.__reactDisabledLog = !0;
|
|
149
149
|
function ne() {
|
|
150
150
|
{
|
|
151
151
|
if (O === 0) {
|
|
152
|
-
|
|
152
|
+
D = console.log, A = console.info, X = console.warn, z = console.error, F = console.group, H = console.groupCollapsed, te = console.groupEnd;
|
|
153
153
|
var i = {
|
|
154
154
|
configurable: !0,
|
|
155
155
|
enumerable: !0,
|
|
@@ -179,22 +179,22 @@ function Br() {
|
|
|
179
179
|
};
|
|
180
180
|
Object.defineProperties(console, {
|
|
181
181
|
log: K({}, i, {
|
|
182
|
-
value:
|
|
182
|
+
value: D
|
|
183
183
|
}),
|
|
184
184
|
info: K({}, i, {
|
|
185
185
|
value: A
|
|
186
186
|
}),
|
|
187
187
|
warn: K({}, i, {
|
|
188
|
-
value:
|
|
188
|
+
value: X
|
|
189
189
|
}),
|
|
190
190
|
error: K({}, i, {
|
|
191
|
-
value:
|
|
191
|
+
value: z
|
|
192
192
|
}),
|
|
193
193
|
group: K({}, i, {
|
|
194
|
-
value:
|
|
194
|
+
value: F
|
|
195
195
|
}),
|
|
196
196
|
groupCollapsed: K({}, i, {
|
|
197
|
-
value:
|
|
197
|
+
value: H
|
|
198
198
|
}),
|
|
199
199
|
groupEnd: K({}, i, {
|
|
200
200
|
value: te
|
|
@@ -204,18 +204,18 @@ function Br() {
|
|
|
204
204
|
O < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
var ee =
|
|
208
|
-
function he(i,
|
|
207
|
+
var ee = E.ReactCurrentDispatcher, fe;
|
|
208
|
+
function he(i, y, I) {
|
|
209
209
|
{
|
|
210
|
-
if (
|
|
210
|
+
if (fe === void 0)
|
|
211
211
|
try {
|
|
212
212
|
throw Error();
|
|
213
|
-
} catch (
|
|
214
|
-
var j =
|
|
215
|
-
|
|
213
|
+
} catch (U) {
|
|
214
|
+
var j = U.stack.trim().match(/\n( *(at )?)/);
|
|
215
|
+
fe = j && j[1] || "";
|
|
216
216
|
}
|
|
217
217
|
return `
|
|
218
|
-
` +
|
|
218
|
+
` + fe + i;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
var Ve = !1, je;
|
|
@@ -223,7 +223,7 @@ function Br() {
|
|
|
223
223
|
var fr = typeof WeakMap == "function" ? WeakMap : Map;
|
|
224
224
|
je = new fr();
|
|
225
225
|
}
|
|
226
|
-
function mt(i,
|
|
226
|
+
function mt(i, y) {
|
|
227
227
|
if (!i || Ve)
|
|
228
228
|
return "";
|
|
229
229
|
{
|
|
@@ -233,33 +233,33 @@ function Br() {
|
|
|
233
233
|
}
|
|
234
234
|
var j;
|
|
235
235
|
Ve = !0;
|
|
236
|
-
var
|
|
236
|
+
var U = Error.prepareStackTrace;
|
|
237
237
|
Error.prepareStackTrace = void 0;
|
|
238
|
-
var
|
|
239
|
-
|
|
238
|
+
var W;
|
|
239
|
+
W = ee.current, ee.current = null, ne();
|
|
240
240
|
try {
|
|
241
|
-
if (
|
|
242
|
-
var
|
|
241
|
+
if (y) {
|
|
242
|
+
var Y = function() {
|
|
243
243
|
throw Error();
|
|
244
244
|
};
|
|
245
|
-
if (Object.defineProperty(
|
|
245
|
+
if (Object.defineProperty(Y.prototype, "props", {
|
|
246
246
|
set: function() {
|
|
247
247
|
throw Error();
|
|
248
248
|
}
|
|
249
249
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
250
250
|
try {
|
|
251
|
-
Reflect.construct(
|
|
251
|
+
Reflect.construct(Y, []);
|
|
252
252
|
} catch (ae) {
|
|
253
253
|
j = ae;
|
|
254
254
|
}
|
|
255
|
-
Reflect.construct(i, [],
|
|
255
|
+
Reflect.construct(i, [], Y);
|
|
256
256
|
} else {
|
|
257
257
|
try {
|
|
258
|
-
|
|
258
|
+
Y.call();
|
|
259
259
|
} catch (ae) {
|
|
260
260
|
j = ae;
|
|
261
261
|
}
|
|
262
|
-
i.call(
|
|
262
|
+
i.call(Y.prototype);
|
|
263
263
|
}
|
|
264
264
|
} else {
|
|
265
265
|
try {
|
|
@@ -271,37 +271,37 @@ function Br() {
|
|
|
271
271
|
}
|
|
272
272
|
} catch (ae) {
|
|
273
273
|
if (ae && j && typeof ae.stack == "string") {
|
|
274
|
-
for (var
|
|
274
|
+
for (var L = ae.stack.split(`
|
|
275
275
|
`), Q = j.stack.split(`
|
|
276
|
-
`),
|
|
277
|
-
|
|
278
|
-
for (;
|
|
279
|
-
if (
|
|
280
|
-
if (
|
|
276
|
+
`), G = L.length - 1, J = Q.length - 1; G >= 1 && J >= 0 && L[G] !== Q[J]; )
|
|
277
|
+
J--;
|
|
278
|
+
for (; G >= 1 && J >= 0; G--, J--)
|
|
279
|
+
if (L[G] !== Q[J]) {
|
|
280
|
+
if (G !== 1 || J !== 1)
|
|
281
281
|
do
|
|
282
|
-
if (
|
|
282
|
+
if (G--, J--, J < 0 || L[G] !== Q[J]) {
|
|
283
283
|
var oe = `
|
|
284
|
-
` +
|
|
284
|
+
` + L[G].replace(" at new ", " at ");
|
|
285
285
|
return i.displayName && oe.includes("<anonymous>") && (oe = oe.replace("<anonymous>", i.displayName)), typeof i == "function" && je.set(i, oe), oe;
|
|
286
286
|
}
|
|
287
|
-
while (
|
|
287
|
+
while (G >= 1 && J >= 0);
|
|
288
288
|
break;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
} finally {
|
|
292
|
-
Ve = !1, ee.current =
|
|
292
|
+
Ve = !1, ee.current = W, V(), Error.prepareStackTrace = U;
|
|
293
293
|
}
|
|
294
294
|
var ye = i ? i.displayName || i.name : "", It = ye ? he(ye) : "";
|
|
295
295
|
return typeof i == "function" && je.set(i, It), It;
|
|
296
296
|
}
|
|
297
|
-
function dr(i,
|
|
297
|
+
function dr(i, y, I) {
|
|
298
298
|
return mt(i, !1);
|
|
299
299
|
}
|
|
300
300
|
function pr(i) {
|
|
301
|
-
var
|
|
302
|
-
return !!(
|
|
301
|
+
var y = i.prototype;
|
|
302
|
+
return !!(y && y.isReactComponent);
|
|
303
303
|
}
|
|
304
|
-
function De(i,
|
|
304
|
+
function De(i, y, I) {
|
|
305
305
|
if (i == null)
|
|
306
306
|
return "";
|
|
307
307
|
if (typeof i == "function")
|
|
@@ -319,41 +319,41 @@ function Br() {
|
|
|
319
319
|
case l:
|
|
320
320
|
return dr(i.render);
|
|
321
321
|
case c:
|
|
322
|
-
return De(i.type,
|
|
322
|
+
return De(i.type, y, I);
|
|
323
323
|
case b: {
|
|
324
|
-
var j = i,
|
|
324
|
+
var j = i, U = j._payload, W = j._init;
|
|
325
325
|
try {
|
|
326
|
-
return De(
|
|
326
|
+
return De(W(U), y, I);
|
|
327
327
|
} catch {
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
return "";
|
|
332
332
|
}
|
|
333
|
-
var $e = Object.prototype.hasOwnProperty, gt = {}, ht =
|
|
333
|
+
var $e = Object.prototype.hasOwnProperty, gt = {}, ht = E.ReactDebugCurrentFrame;
|
|
334
334
|
function Ae(i) {
|
|
335
335
|
if (i) {
|
|
336
|
-
var
|
|
336
|
+
var y = i._owner, I = De(i.type, i._source, y ? y.type : null);
|
|
337
337
|
ht.setExtraStackFrame(I);
|
|
338
338
|
} else
|
|
339
339
|
ht.setExtraStackFrame(null);
|
|
340
340
|
}
|
|
341
|
-
function mr(i,
|
|
341
|
+
function mr(i, y, I, j, U) {
|
|
342
342
|
{
|
|
343
|
-
var
|
|
344
|
-
for (var
|
|
345
|
-
if (
|
|
346
|
-
var
|
|
343
|
+
var W = Function.call.bind($e);
|
|
344
|
+
for (var Y in i)
|
|
345
|
+
if (W(i, Y)) {
|
|
346
|
+
var L = void 0;
|
|
347
347
|
try {
|
|
348
|
-
if (typeof i[
|
|
349
|
-
var Q = Error((j || "React class") + ": " + I + " type `" +
|
|
348
|
+
if (typeof i[Y] != "function") {
|
|
349
|
+
var Q = Error((j || "React class") + ": " + I + " type `" + Y + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof i[Y] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
350
350
|
throw Q.name = "Invariant Violation", Q;
|
|
351
351
|
}
|
|
352
|
-
|
|
353
|
-
} catch (
|
|
354
|
-
|
|
352
|
+
L = i[Y](y, Y, j, I, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
353
|
+
} catch (G) {
|
|
354
|
+
L = G;
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
L && !(L instanceof Error) && (Ae(U), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", j || "React class", I, Y, typeof L), Ae(null)), L instanceof Error && !(L.message in gt) && (gt[L.message] = !0, Ae(U), x("Failed %s type: %s", I, L.message), Ae(null));
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
|
@@ -363,7 +363,7 @@ function Br() {
|
|
|
363
363
|
}
|
|
364
364
|
function hr(i) {
|
|
365
365
|
{
|
|
366
|
-
var
|
|
366
|
+
var y = typeof Symbol == "function" && Symbol.toStringTag, I = y && i[Symbol.toStringTag] || i.constructor.name || "Object";
|
|
367
367
|
return I;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
@@ -381,7 +381,7 @@ function Br() {
|
|
|
381
381
|
if (vr(i))
|
|
382
382
|
return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", hr(i)), vt(i);
|
|
383
383
|
}
|
|
384
|
-
var Ee =
|
|
384
|
+
var Ee = E.ReactCurrentOwner, yr = {
|
|
385
385
|
key: !0,
|
|
386
386
|
ref: !0,
|
|
387
387
|
__self: !0,
|
|
@@ -390,30 +390,30 @@ function Br() {
|
|
|
390
390
|
Ke = {};
|
|
391
391
|
function Sr(i) {
|
|
392
392
|
if ($e.call(i, "ref")) {
|
|
393
|
-
var
|
|
394
|
-
if (
|
|
393
|
+
var y = Object.getOwnPropertyDescriptor(i, "ref").get;
|
|
394
|
+
if (y && y.isReactWarning)
|
|
395
395
|
return !1;
|
|
396
396
|
}
|
|
397
397
|
return i.ref !== void 0;
|
|
398
398
|
}
|
|
399
399
|
function _r(i) {
|
|
400
400
|
if ($e.call(i, "key")) {
|
|
401
|
-
var
|
|
402
|
-
if (
|
|
401
|
+
var y = Object.getOwnPropertyDescriptor(i, "key").get;
|
|
402
|
+
if (y && y.isReactWarning)
|
|
403
403
|
return !1;
|
|
404
404
|
}
|
|
405
405
|
return i.key !== void 0;
|
|
406
406
|
}
|
|
407
|
-
function br(i,
|
|
408
|
-
if (typeof i.ref == "string" && Ee.current &&
|
|
409
|
-
var I =
|
|
410
|
-
Ke[I] || (x('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',
|
|
407
|
+
function br(i, y) {
|
|
408
|
+
if (typeof i.ref == "string" && Ee.current && y && Ee.current.stateNode !== y) {
|
|
409
|
+
var I = N(Ee.current.type);
|
|
410
|
+
Ke[I] || (x('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(Ee.current.type), i.ref), Ke[I] = !0);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function Er(i,
|
|
413
|
+
function Er(i, y) {
|
|
414
414
|
{
|
|
415
415
|
var I = function() {
|
|
416
|
-
St || (St = !0, x("%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)",
|
|
416
|
+
St || (St = !0, x("%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)", y));
|
|
417
417
|
};
|
|
418
418
|
I.isReactWarning = !0, Object.defineProperty(i, "key", {
|
|
419
419
|
get: I,
|
|
@@ -421,10 +421,10 @@ function Br() {
|
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
function wr(i,
|
|
424
|
+
function wr(i, y) {
|
|
425
425
|
{
|
|
426
426
|
var I = function() {
|
|
427
|
-
_t || (_t = !0, x("%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)",
|
|
427
|
+
_t || (_t = !0, x("%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)", y));
|
|
428
428
|
};
|
|
429
429
|
I.isReactWarning = !0, Object.defineProperty(i, "ref", {
|
|
430
430
|
get: I,
|
|
@@ -432,57 +432,57 @@ function Br() {
|
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
var Cr = function(i,
|
|
436
|
-
var
|
|
435
|
+
var Cr = function(i, y, I, j, U, W, Y) {
|
|
436
|
+
var L = {
|
|
437
437
|
// This tag allows us to uniquely identify this as a React Element
|
|
438
438
|
$$typeof: t,
|
|
439
439
|
// Built-in properties that belong on the element
|
|
440
440
|
type: i,
|
|
441
|
-
key:
|
|
441
|
+
key: y,
|
|
442
442
|
ref: I,
|
|
443
|
-
props:
|
|
443
|
+
props: Y,
|
|
444
444
|
// Record the component responsible for creating this element.
|
|
445
|
-
_owner:
|
|
445
|
+
_owner: W
|
|
446
446
|
};
|
|
447
|
-
return
|
|
447
|
+
return L._store = {}, Object.defineProperty(L._store, "validated", {
|
|
448
448
|
configurable: !1,
|
|
449
449
|
enumerable: !1,
|
|
450
450
|
writable: !0,
|
|
451
451
|
value: !1
|
|
452
|
-
}), Object.defineProperty(
|
|
452
|
+
}), Object.defineProperty(L, "_self", {
|
|
453
453
|
configurable: !1,
|
|
454
454
|
enumerable: !1,
|
|
455
455
|
writable: !1,
|
|
456
456
|
value: j
|
|
457
|
-
}), Object.defineProperty(
|
|
457
|
+
}), Object.defineProperty(L, "_source", {
|
|
458
458
|
configurable: !1,
|
|
459
459
|
enumerable: !1,
|
|
460
460
|
writable: !1,
|
|
461
|
-
value:
|
|
462
|
-
}), Object.freeze && (Object.freeze(
|
|
461
|
+
value: U
|
|
462
|
+
}), Object.freeze && (Object.freeze(L.props), Object.freeze(L)), L;
|
|
463
463
|
};
|
|
464
|
-
function xr(i,
|
|
464
|
+
function xr(i, y, I, j, U) {
|
|
465
465
|
{
|
|
466
|
-
var
|
|
467
|
-
I !== void 0 && (yt(I),
|
|
468
|
-
for (
|
|
469
|
-
$e.call(
|
|
466
|
+
var W, Y = {}, L = null, Q = null;
|
|
467
|
+
I !== void 0 && (yt(I), L = "" + I), _r(y) && (yt(y.key), L = "" + y.key), Sr(y) && (Q = y.ref, br(y, U));
|
|
468
|
+
for (W in y)
|
|
469
|
+
$e.call(y, W) && !yr.hasOwnProperty(W) && (Y[W] = y[W]);
|
|
470
470
|
if (i && i.defaultProps) {
|
|
471
|
-
var
|
|
472
|
-
for (
|
|
473
|
-
|
|
471
|
+
var G = i.defaultProps;
|
|
472
|
+
for (W in G)
|
|
473
|
+
Y[W] === void 0 && (Y[W] = G[W]);
|
|
474
474
|
}
|
|
475
|
-
if (
|
|
476
|
-
var
|
|
477
|
-
|
|
475
|
+
if (L || Q) {
|
|
476
|
+
var J = typeof i == "function" ? i.displayName || i.name || "Unknown" : i;
|
|
477
|
+
L && Er(Y, J), Q && wr(Y, J);
|
|
478
478
|
}
|
|
479
|
-
return Cr(i,
|
|
479
|
+
return Cr(i, L, Q, U, j, Ee.current, Y);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
var He =
|
|
482
|
+
var He = E.ReactCurrentOwner, bt = E.ReactDebugCurrentFrame;
|
|
483
483
|
function ve(i) {
|
|
484
484
|
if (i) {
|
|
485
|
-
var
|
|
485
|
+
var y = i._owner, I = De(i.type, i._source, y ? y.type : null);
|
|
486
486
|
bt.setExtraStackFrame(I);
|
|
487
487
|
} else
|
|
488
488
|
bt.setExtraStackFrame(null);
|
|
@@ -495,7 +495,7 @@ function Br() {
|
|
|
495
495
|
function Et() {
|
|
496
496
|
{
|
|
497
497
|
if (He.current) {
|
|
498
|
-
var i =
|
|
498
|
+
var i = N(He.current.type);
|
|
499
499
|
if (i)
|
|
500
500
|
return `
|
|
501
501
|
|
|
@@ -507,10 +507,10 @@ Check the render method of \`` + i + "`.";
|
|
|
507
507
|
function Rr(i) {
|
|
508
508
|
{
|
|
509
509
|
if (i !== void 0) {
|
|
510
|
-
var
|
|
510
|
+
var y = i.fileName.replace(/^.*[\\\/]/, ""), I = i.lineNumber;
|
|
511
511
|
return `
|
|
512
512
|
|
|
513
|
-
Check your code at ` +
|
|
513
|
+
Check your code at ` + y + ":" + I + ".";
|
|
514
514
|
}
|
|
515
515
|
return "";
|
|
516
516
|
}
|
|
@@ -518,77 +518,77 @@ Check your code at ` + S + ":" + I + ".";
|
|
|
518
518
|
var wt = {};
|
|
519
519
|
function Ir(i) {
|
|
520
520
|
{
|
|
521
|
-
var
|
|
522
|
-
if (!
|
|
521
|
+
var y = Et();
|
|
522
|
+
if (!y) {
|
|
523
523
|
var I = typeof i == "string" ? i : i.displayName || i.name;
|
|
524
|
-
I && (
|
|
524
|
+
I && (y = `
|
|
525
525
|
|
|
526
526
|
Check the top-level render call using <` + I + ">.");
|
|
527
527
|
}
|
|
528
|
-
return
|
|
528
|
+
return y;
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
-
function Ct(i,
|
|
531
|
+
function Ct(i, y) {
|
|
532
532
|
{
|
|
533
533
|
if (!i._store || i._store.validated || i.key != null)
|
|
534
534
|
return;
|
|
535
535
|
i._store.validated = !0;
|
|
536
|
-
var I = Ir(
|
|
536
|
+
var I = Ir(y);
|
|
537
537
|
if (wt[I])
|
|
538
538
|
return;
|
|
539
539
|
wt[I] = !0;
|
|
540
540
|
var j = "";
|
|
541
|
-
i && i._owner && i._owner !== He.current && (j = " It was passed a child from " +
|
|
541
|
+
i && i._owner && i._owner !== He.current && (j = " It was passed a child from " + N(i._owner.type) + "."), ve(i), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', I, j), ve(null);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
function xt(i,
|
|
544
|
+
function xt(i, y) {
|
|
545
545
|
{
|
|
546
546
|
if (typeof i != "object")
|
|
547
547
|
return;
|
|
548
548
|
if (Fe(i))
|
|
549
549
|
for (var I = 0; I < i.length; I++) {
|
|
550
550
|
var j = i[I];
|
|
551
|
-
Ge(j) && Ct(j,
|
|
551
|
+
Ge(j) && Ct(j, y);
|
|
552
552
|
}
|
|
553
553
|
else if (Ge(i))
|
|
554
554
|
i._store && (i._store.validated = !0);
|
|
555
555
|
else if (i) {
|
|
556
|
-
var
|
|
557
|
-
if (typeof
|
|
558
|
-
for (var
|
|
559
|
-
Ge(
|
|
556
|
+
var U = S(i);
|
|
557
|
+
if (typeof U == "function" && U !== i.entries)
|
|
558
|
+
for (var W = U.call(i), Y; !(Y = W.next()).done; )
|
|
559
|
+
Ge(Y.value) && Ct(Y.value, y);
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
563
|
function Or(i) {
|
|
564
564
|
{
|
|
565
|
-
var
|
|
566
|
-
if (
|
|
565
|
+
var y = i.type;
|
|
566
|
+
if (y == null || typeof y == "string")
|
|
567
567
|
return;
|
|
568
568
|
var I;
|
|
569
|
-
if (typeof
|
|
570
|
-
I =
|
|
571
|
-
else if (typeof
|
|
569
|
+
if (typeof y == "function")
|
|
570
|
+
I = y.propTypes;
|
|
571
|
+
else if (typeof y == "object" && (y.$$typeof === l || // Note: Memo only checks outer props here.
|
|
572
572
|
// Inner props are checked in the reconciler.
|
|
573
|
-
|
|
574
|
-
I =
|
|
573
|
+
y.$$typeof === c))
|
|
574
|
+
I = y.propTypes;
|
|
575
575
|
else
|
|
576
576
|
return;
|
|
577
577
|
if (I) {
|
|
578
|
-
var j =
|
|
578
|
+
var j = N(y);
|
|
579
579
|
mr(I, i.props, "prop", j, i);
|
|
580
|
-
} else if (
|
|
580
|
+
} else if (y.PropTypes !== void 0 && !qe) {
|
|
581
581
|
qe = !0;
|
|
582
|
-
var
|
|
583
|
-
x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
582
|
+
var U = N(y);
|
|
583
|
+
x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", U || "Unknown");
|
|
584
584
|
}
|
|
585
|
-
typeof
|
|
585
|
+
typeof y.getDefaultProps == "function" && !y.getDefaultProps.isReactClassApproved && x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
function Tr(i) {
|
|
589
589
|
{
|
|
590
|
-
for (var
|
|
591
|
-
var j =
|
|
590
|
+
for (var y = Object.keys(i.props), I = 0; I < y.length; I++) {
|
|
591
|
+
var j = y[I];
|
|
592
592
|
if (j !== "children" && j !== "key") {
|
|
593
593
|
ve(i), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", j), ve(null);
|
|
594
594
|
break;
|
|
@@ -597,22 +597,22 @@ Check the top-level render call using <` + I + ">.");
|
|
|
597
597
|
i.ref !== null && (ve(i), x("Invalid attribute `ref` supplied to `React.Fragment`."), ve(null));
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function Rt(i,
|
|
600
|
+
function Rt(i, y, I, j, U, W) {
|
|
601
601
|
{
|
|
602
|
-
var
|
|
603
|
-
if (!
|
|
604
|
-
var
|
|
605
|
-
(i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (
|
|
606
|
-
var Q = Rr(
|
|
607
|
-
Q ?
|
|
608
|
-
var
|
|
609
|
-
i === null ?
|
|
602
|
+
var Y = M(i);
|
|
603
|
+
if (!Y) {
|
|
604
|
+
var L = "";
|
|
605
|
+
(i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (L += " 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 = Rr(U);
|
|
607
|
+
Q ? L += Q : L += Et();
|
|
608
|
+
var G;
|
|
609
|
+
i === null ? G = "null" : Fe(i) ? G = "array" : i !== void 0 && i.$$typeof === t ? (G = "<" + (N(i.type) || "Unknown") + " />", L = " Did you accidentally export a JSX literal instead of a component?") : G = typeof i, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", G, L);
|
|
610
610
|
}
|
|
611
|
-
var
|
|
612
|
-
if (
|
|
613
|
-
return
|
|
614
|
-
if (
|
|
615
|
-
var oe =
|
|
611
|
+
var J = xr(i, y, I, U, W);
|
|
612
|
+
if (J == null)
|
|
613
|
+
return J;
|
|
614
|
+
if (Y) {
|
|
615
|
+
var oe = y.children;
|
|
616
616
|
if (oe !== void 0)
|
|
617
617
|
if (j)
|
|
618
618
|
if (Fe(oe)) {
|
|
@@ -624,14 +624,14 @@ Check the top-level render call using <` + I + ">.");
|
|
|
624
624
|
else
|
|
625
625
|
xt(oe, i);
|
|
626
626
|
}
|
|
627
|
-
return i === n ? Tr(
|
|
627
|
+
return i === n ? Tr(J) : Or(J), J;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
function kr(i,
|
|
631
|
-
return Rt(i,
|
|
630
|
+
function kr(i, y, I) {
|
|
631
|
+
return Rt(i, y, I, !0);
|
|
632
632
|
}
|
|
633
|
-
function Pr(i,
|
|
634
|
-
return Rt(i,
|
|
633
|
+
function Pr(i, y, I) {
|
|
634
|
+
return Rt(i, y, I, !1);
|
|
635
635
|
}
|
|
636
636
|
var Mr = Pr, jr = kr;
|
|
637
637
|
Ce.Fragment = n, Ce.jsx = Mr, Ce.jsxs = jr;
|
|
@@ -639,8 +639,8 @@ Check the top-level render call using <` + I + ">.");
|
|
|
639
639
|
}
|
|
640
640
|
(function(e) {
|
|
641
641
|
process.env.NODE_ENV === "production" ? e.exports = Yr() : e.exports = Br();
|
|
642
|
-
})(
|
|
643
|
-
const Qt = Oe.Fragment, T = Oe.jsx,
|
|
642
|
+
})(zr);
|
|
643
|
+
const Qt = Oe.Fragment, T = Oe.jsx, le = Oe.jsxs;
|
|
644
644
|
let Nr = (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
645
|
class Ur {
|
|
646
646
|
constructor(t, r, n = null) {
|
|
@@ -761,7 +761,7 @@ const Xr = ({
|
|
|
761
761
|
});
|
|
762
762
|
}), e.emit("joinSuperSocket", { room: t, userId: o });
|
|
763
763
|
});
|
|
764
|
-
}, ot =
|
|
764
|
+
}, ot = m.createContext(), Wr = () => /* @__PURE__ */ T(
|
|
765
765
|
"div",
|
|
766
766
|
{
|
|
767
767
|
style: {
|
|
@@ -782,30 +782,30 @@ const Xr = ({
|
|
|
782
782
|
LoadingComponent: n = Wr,
|
|
783
783
|
children: o
|
|
784
784
|
}) => {
|
|
785
|
-
const [s, a] =
|
|
786
|
-
return
|
|
785
|
+
const [s, a] = m.useState(!1), [u, l] = m.useState(!1), [d, f] = m.useState(null), c = m.useRef(null), b = m.useRef(!1), _ = be(ot), C = m.useRef(!1);
|
|
786
|
+
return m.useEffect(() => (b.current = !0, () => {
|
|
787
787
|
b.current = !1;
|
|
788
|
-
}), []),
|
|
788
|
+
}), []), m.useEffect(() => {
|
|
789
789
|
if (!e)
|
|
790
790
|
return null;
|
|
791
|
-
const
|
|
791
|
+
const h = () => {
|
|
792
792
|
console.log(`Disconnected from ${r}…`), b.current && (a(!1), l(!1));
|
|
793
793
|
};
|
|
794
|
-
return e.on("disconnect",
|
|
795
|
-
e.off("disconnect",
|
|
794
|
+
return e.on("disconnect", h), () => {
|
|
795
|
+
e.off("disconnect", h);
|
|
796
796
|
};
|
|
797
|
-
}, [r, e]),
|
|
797
|
+
}, [r, e]), m.useEffect(() => e ? (e.connected || e.connect(), console.log(`Try to connect to wire ${t} on channel ${r}`), C.current || (C.current = !0, Xr({
|
|
798
798
|
socket: e,
|
|
799
799
|
room: t,
|
|
800
800
|
onMaster: () => {
|
|
801
801
|
console.log(`Is now master on channel ${r}…`), b.current && l(!0);
|
|
802
802
|
},
|
|
803
|
-
onJoined: (
|
|
804
|
-
console.log(`Connected on channel ${r}…`), c.current =
|
|
803
|
+
onJoined: (h) => {
|
|
804
|
+
console.log(`Connected on channel ${r}…`), c.current = h, b.current && (f(h), a(!0));
|
|
805
805
|
}
|
|
806
806
|
})), () => {
|
|
807
|
-
var
|
|
808
|
-
(
|
|
807
|
+
var h;
|
|
808
|
+
(h = c.current) == null || h.leave();
|
|
809
809
|
}) : null, [r, t, e]), !s || !d ? /* @__PURE__ */ T(n, {}) : /* @__PURE__ */ T(
|
|
810
810
|
ot.Provider,
|
|
811
811
|
{
|
|
@@ -857,18 +857,18 @@ function Kr() {
|
|
|
857
857
|
if (Mt)
|
|
858
858
|
return Ze;
|
|
859
859
|
Mt = 1;
|
|
860
|
-
var e =
|
|
860
|
+
var e = m;
|
|
861
861
|
function t(c, b) {
|
|
862
862
|
return c === b && (c !== 0 || 1 / c === 1 / b) || c !== c && b !== b;
|
|
863
863
|
}
|
|
864
864
|
var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, s = e.useLayoutEffect, a = e.useDebugValue;
|
|
865
865
|
function u(c, b) {
|
|
866
|
-
var _ = b(),
|
|
866
|
+
var _ = b(), C = n({ inst: { value: _, getSnapshot: b } }), h = C[0].inst, S = C[1];
|
|
867
867
|
return s(function() {
|
|
868
|
-
|
|
868
|
+
h.value = _, h.getSnapshot = b, l(h) && S({ inst: h });
|
|
869
869
|
}, [c, _, b]), o(function() {
|
|
870
|
-
return l(
|
|
871
|
-
l(
|
|
870
|
+
return l(h) && S({ inst: h }), c(function() {
|
|
871
|
+
l(h) && S({ inst: h });
|
|
872
872
|
});
|
|
873
873
|
}, [c]), a(_), _;
|
|
874
874
|
}
|
|
@@ -902,70 +902,70 @@ var jt;
|
|
|
902
902
|
function Hr() {
|
|
903
903
|
return jt || (jt = 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
|
-
var e =
|
|
906
|
-
function r(
|
|
905
|
+
var e = m, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
906
|
+
function r(v) {
|
|
907
907
|
{
|
|
908
|
-
for (var p = arguments.length,
|
|
909
|
-
|
|
910
|
-
n("error",
|
|
908
|
+
for (var p = arguments.length, R = new Array(p > 1 ? p - 1 : 0), w = 1; w < p; w++)
|
|
909
|
+
R[w - 1] = arguments[w];
|
|
910
|
+
n("error", v, R);
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
function n(
|
|
913
|
+
function n(v, p, R) {
|
|
914
914
|
{
|
|
915
|
-
var
|
|
916
|
-
|
|
917
|
-
var
|
|
918
|
-
return String(
|
|
915
|
+
var w = t.ReactDebugCurrentFrame, g = w.getStackAddendum();
|
|
916
|
+
g !== "" && (p += "%s", R = R.concat([g]));
|
|
917
|
+
var k = R.map(function(P) {
|
|
918
|
+
return String(P);
|
|
919
919
|
});
|
|
920
|
-
|
|
920
|
+
k.unshift("Warning: " + p), Function.prototype.apply.call(console[v], console, k);
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
-
function o(
|
|
924
|
-
return
|
|
923
|
+
function o(v, p) {
|
|
924
|
+
return v === p && (v !== 0 || 1 / v === 1 / p) || v !== v && p !== p;
|
|
925
925
|
}
|
|
926
926
|
var s = typeof Object.is == "function" ? Object.is : o, a = e.useState, u = e.useEffect, l = e.useLayoutEffect, d = e.useDebugValue, f = !1, c = !1;
|
|
927
|
-
function b(
|
|
927
|
+
function b(v, p, R) {
|
|
928
928
|
f || e.startTransition !== void 0 && (f = !0, r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
929
|
-
var
|
|
929
|
+
var w = p();
|
|
930
930
|
if (!c) {
|
|
931
|
-
var
|
|
932
|
-
s(
|
|
931
|
+
var g = p();
|
|
932
|
+
s(w, g) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), c = !0);
|
|
933
933
|
}
|
|
934
|
-
var
|
|
934
|
+
var k = a({
|
|
935
935
|
inst: {
|
|
936
|
-
value:
|
|
936
|
+
value: w,
|
|
937
937
|
getSnapshot: p
|
|
938
938
|
}
|
|
939
|
-
}),
|
|
939
|
+
}), P = k[0].inst, M = k[1];
|
|
940
940
|
return l(function() {
|
|
941
|
-
|
|
942
|
-
inst:
|
|
941
|
+
P.value = w, P.getSnapshot = p, _(P) && M({
|
|
942
|
+
inst: P
|
|
943
943
|
});
|
|
944
|
-
}, [
|
|
945
|
-
_(
|
|
946
|
-
inst:
|
|
944
|
+
}, [v, w, p]), u(function() {
|
|
945
|
+
_(P) && M({
|
|
946
|
+
inst: P
|
|
947
947
|
});
|
|
948
|
-
var
|
|
949
|
-
_(
|
|
950
|
-
inst:
|
|
948
|
+
var $ = function() {
|
|
949
|
+
_(P) && M({
|
|
950
|
+
inst: P
|
|
951
951
|
});
|
|
952
952
|
};
|
|
953
|
-
return
|
|
954
|
-
}, [
|
|
953
|
+
return v($);
|
|
954
|
+
}, [v]), d(w), w;
|
|
955
955
|
}
|
|
956
|
-
function _(
|
|
957
|
-
var p =
|
|
956
|
+
function _(v) {
|
|
957
|
+
var p = v.getSnapshot, R = v.value;
|
|
958
958
|
try {
|
|
959
|
-
var
|
|
960
|
-
return !s(
|
|
959
|
+
var w = p();
|
|
960
|
+
return !s(R, w);
|
|
961
961
|
} catch {
|
|
962
962
|
return !0;
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
|
-
function
|
|
965
|
+
function C(v, p, R) {
|
|
966
966
|
return p();
|
|
967
967
|
}
|
|
968
|
-
var
|
|
968
|
+
var h = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", S = !h, E = S ? C : b, x = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : E;
|
|
969
969
|
Qe.useSyncExternalStore = x, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
970
970
|
}()), Qe;
|
|
971
971
|
}
|
|
@@ -989,44 +989,44 @@ function qr() {
|
|
|
989
989
|
if ($t)
|
|
990
990
|
return Je;
|
|
991
991
|
$t = 1;
|
|
992
|
-
var e =
|
|
992
|
+
var e = m, t = tr();
|
|
993
993
|
function r(d, f) {
|
|
994
994
|
return d === f && (d !== 0 || 1 / d === 1 / f) || d !== d && f !== f;
|
|
995
995
|
}
|
|
996
996
|
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, a = e.useEffect, u = e.useMemo, l = e.useDebugValue;
|
|
997
997
|
return Je.useSyncExternalStoreWithSelector = function(d, f, c, b, _) {
|
|
998
|
-
var
|
|
999
|
-
if (
|
|
1000
|
-
var
|
|
1001
|
-
|
|
998
|
+
var C = s(null);
|
|
999
|
+
if (C.current === null) {
|
|
1000
|
+
var h = { hasValue: !1, value: null };
|
|
1001
|
+
C.current = h;
|
|
1002
1002
|
} else
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
function
|
|
1003
|
+
h = C.current;
|
|
1004
|
+
C = u(function() {
|
|
1005
|
+
function E(w) {
|
|
1006
1006
|
if (!x) {
|
|
1007
|
-
if (x = !0,
|
|
1008
|
-
var
|
|
1009
|
-
if (_(
|
|
1010
|
-
return p =
|
|
1007
|
+
if (x = !0, v = w, w = b(w), _ !== void 0 && h.hasValue) {
|
|
1008
|
+
var g = h.value;
|
|
1009
|
+
if (_(g, w))
|
|
1010
|
+
return p = g;
|
|
1011
1011
|
}
|
|
1012
|
-
return p =
|
|
1012
|
+
return p = w;
|
|
1013
1013
|
}
|
|
1014
|
-
if (
|
|
1015
|
-
return
|
|
1016
|
-
var
|
|
1017
|
-
return _ !== void 0 && _(
|
|
1014
|
+
if (g = p, n(v, w))
|
|
1015
|
+
return g;
|
|
1016
|
+
var k = b(w);
|
|
1017
|
+
return _ !== void 0 && _(g, k) ? g : (v = w, p = k);
|
|
1018
1018
|
}
|
|
1019
|
-
var x = !1,
|
|
1019
|
+
var x = !1, v, p, R = c === void 0 ? null : c;
|
|
1020
1020
|
return [function() {
|
|
1021
|
-
return
|
|
1022
|
-
},
|
|
1023
|
-
return R(
|
|
1021
|
+
return E(f());
|
|
1022
|
+
}, R === null ? void 0 : function() {
|
|
1023
|
+
return E(R());
|
|
1024
1024
|
}];
|
|
1025
1025
|
}, [f, c, b, _]);
|
|
1026
|
-
var
|
|
1026
|
+
var S = o(d, C[0], C[1]);
|
|
1027
1027
|
return a(function() {
|
|
1028
|
-
|
|
1029
|
-
}, [
|
|
1028
|
+
h.hasValue = !0, h.value = S;
|
|
1029
|
+
}, [S]), l(S), S;
|
|
1030
1030
|
}, Je;
|
|
1031
1031
|
}
|
|
1032
1032
|
var et = {};
|
|
@@ -1043,43 +1043,43 @@ var At;
|
|
|
1043
1043
|
function Gr() {
|
|
1044
1044
|
return At || (At = 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 =
|
|
1046
|
+
var e = m, t = tr();
|
|
1047
1047
|
function r(f, c) {
|
|
1048
1048
|
return f === c && (f !== 0 || 1 / f === 1 / c) || f !== f && c !== c;
|
|
1049
1049
|
}
|
|
1050
1050
|
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, a = e.useEffect, u = e.useMemo, l = e.useDebugValue;
|
|
1051
|
-
function d(f, c, b, _,
|
|
1052
|
-
var
|
|
1053
|
-
|
|
1051
|
+
function d(f, c, b, _, C) {
|
|
1052
|
+
var h = s(null), S;
|
|
1053
|
+
h.current === null ? (S = {
|
|
1054
1054
|
hasValue: !1,
|
|
1055
1055
|
value: null
|
|
1056
|
-
},
|
|
1057
|
-
var
|
|
1058
|
-
var
|
|
1059
|
-
if (!
|
|
1060
|
-
|
|
1061
|
-
var
|
|
1062
|
-
if (
|
|
1063
|
-
var K =
|
|
1064
|
-
if (
|
|
1065
|
-
return
|
|
1056
|
+
}, h.current = S) : S = h.current;
|
|
1057
|
+
var E = u(function() {
|
|
1058
|
+
var R = !1, w, g, k = function(B) {
|
|
1059
|
+
if (!R) {
|
|
1060
|
+
R = !0, w = B;
|
|
1061
|
+
var N = _(B);
|
|
1062
|
+
if (C !== void 0 && S.hasValue) {
|
|
1063
|
+
var K = S.value;
|
|
1064
|
+
if (C(K, N))
|
|
1065
|
+
return g = K, K;
|
|
1066
1066
|
}
|
|
1067
|
-
return
|
|
1067
|
+
return g = N, N;
|
|
1068
1068
|
}
|
|
1069
|
-
var O =
|
|
1070
|
-
if (n(O,
|
|
1071
|
-
return
|
|
1072
|
-
var A = _(
|
|
1073
|
-
return
|
|
1074
|
-
},
|
|
1075
|
-
return
|
|
1076
|
-
},
|
|
1077
|
-
return
|
|
1069
|
+
var O = w, D = g;
|
|
1070
|
+
if (n(O, B))
|
|
1071
|
+
return D;
|
|
1072
|
+
var A = _(B);
|
|
1073
|
+
return C !== void 0 && C(D, A) ? D : (w = B, g = A, A);
|
|
1074
|
+
}, P = b === void 0 ? null : b, M = function() {
|
|
1075
|
+
return k(c());
|
|
1076
|
+
}, $ = P === null ? void 0 : function() {
|
|
1077
|
+
return k(P());
|
|
1078
1078
|
};
|
|
1079
|
-
return [
|
|
1080
|
-
}, [c, b, _,
|
|
1079
|
+
return [M, $];
|
|
1080
|
+
}, [c, b, _, C]), x = E[0], v = E[1], p = o(f, x, v);
|
|
1081
1081
|
return a(function() {
|
|
1082
|
-
|
|
1082
|
+
S.hasValue = !0, S.value = p;
|
|
1083
1083
|
}, [p]), l(p), p;
|
|
1084
1084
|
}
|
|
1085
1085
|
et.useSyncExternalStoreWithSelector = d, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
@@ -1088,7 +1088,7 @@ function Gr() {
|
|
|
1088
1088
|
(function(e) {
|
|
1089
1089
|
process.env.NODE_ENV === "production" ? e.exports = qr() : e.exports = Gr();
|
|
1090
1090
|
})(Vr);
|
|
1091
|
-
const Jr = /* @__PURE__ */
|
|
1091
|
+
const Jr = /* @__PURE__ */ Lr(st), { useSyncExternalStoreWithSelector: Zr } = Jr;
|
|
1092
1092
|
function Ue(e, t = e.getState, r) {
|
|
1093
1093
|
const n = Zr(
|
|
1094
1094
|
e.subscribe,
|
|
@@ -1137,17 +1137,17 @@ const _e = (e, t) => e.classList && e.classList.contains(t), Te = (e, t) => _e(e
|
|
|
1137
1137
|
e + r / 2 - a.x,
|
|
1138
1138
|
t + n / 2 - a.y
|
|
1139
1139
|
];
|
|
1140
|
-
let d, f, c, b, _,
|
|
1141
|
-
const
|
|
1140
|
+
let d, f, c, b, _, C, h, S, E, x;
|
|
1141
|
+
const v = s / 1.1547;
|
|
1142
1142
|
switch (o) {
|
|
1143
1143
|
case "grid":
|
|
1144
1144
|
d = Math.round(u / s) * s, f = Math.round(l / s) * s;
|
|
1145
1145
|
break;
|
|
1146
1146
|
case "hexH":
|
|
1147
|
-
c = 2 *
|
|
1147
|
+
c = 2 * v, b = 3 * s, _ = Math.round(u / c) * c, h = Math.round(l / b) * b, C = _ > u ? _ - v : _ + v, S = h > l ? h - 1.5 * s : h + 1.5 * s, E = Math.hypot(_ - u, h - l), x = Math.hypot(C - u, S - l), E < x ? (d = _, f = h) : (d = C, f = S);
|
|
1148
1148
|
break;
|
|
1149
1149
|
case "hexV":
|
|
1150
|
-
c = 3 * s, b = 2 *
|
|
1150
|
+
c = 3 * s, b = 2 * v, _ = Math.round(u / c) * c, h = Math.round(l / b) * b, C = _ > u ? _ - 1.5 * s : _ + 1.5 * s, S = h > l ? h - v : h + v, E = Math.hypot(_ - u, h - l), x = Math.hypot(C - u, S - l), E < x ? (d = _, f = h) : (d = C, f = S);
|
|
1151
1151
|
break;
|
|
1152
1152
|
default:
|
|
1153
1153
|
d = e + r / 2, f = t + n / 2;
|
|
@@ -1156,7 +1156,7 @@ const _e = (e, t) => e.classList && e.classList.contains(t), Te = (e, t) => _e(e
|
|
|
1156
1156
|
x: d + a.x - r / 2,
|
|
1157
1157
|
y: f + a.y - n / 2
|
|
1158
1158
|
};
|
|
1159
|
-
},
|
|
1159
|
+
}, Lt = [
|
|
1160
1160
|
"#037758",
|
|
1161
1161
|
"#99092a",
|
|
1162
1162
|
"#067070",
|
|
@@ -1187,13 +1187,13 @@ const _e = (e, t) => e.classList && e.classList.contains(t), Te = (e, t) => _e(e
|
|
|
1187
1187
|
"#007a4b",
|
|
1188
1188
|
"#bf0daa",
|
|
1189
1189
|
"#af0ad8"
|
|
1190
|
-
],
|
|
1190
|
+
], zt = () => Lt[Math.floor(Math.random() * Lt.length)], rn = !1, ut = ({ wire: e, storeName: t, noSync: r = [], defaultValue: n }, o) => (s, a, u) => {
|
|
1191
1191
|
s({ ready: !1 });
|
|
1192
1192
|
const l = [];
|
|
1193
1193
|
(async () => {
|
|
1194
1194
|
try {
|
|
1195
1195
|
const _ = await e.call(`${t}_getValue`);
|
|
1196
|
-
rn && console.log("init from peer with value", _), s((
|
|
1196
|
+
rn && console.log("init from peer with value", _), s((C) => ({ ...C, ..._ }));
|
|
1197
1197
|
} catch {
|
|
1198
1198
|
n !== void 0 && s(n);
|
|
1199
1199
|
}
|
|
@@ -1202,23 +1202,23 @@ const _e = (e, t) => e.classList && e.classList.contains(t), Te = (e, t) => _e(e
|
|
|
1202
1202
|
`${t}_getValue`,
|
|
1203
1203
|
() => Object.fromEntries(
|
|
1204
1204
|
Object.entries(a()).filter(
|
|
1205
|
-
([_,
|
|
1205
|
+
([_, C]) => typeof C != "function" && !r.includes(_)
|
|
1206
1206
|
)
|
|
1207
1207
|
),
|
|
1208
1208
|
{ invoke: "first" }
|
|
1209
1209
|
)
|
|
1210
1210
|
), l.push(
|
|
1211
|
-
e.subscribe(`${t}_call`, ([_,
|
|
1212
|
-
c[_](...
|
|
1211
|
+
e.subscribe(`${t}_call`, ([_, C]) => {
|
|
1212
|
+
c[_](...C);
|
|
1213
1213
|
})
|
|
1214
1214
|
), s({ ready: !0 });
|
|
1215
1215
|
})();
|
|
1216
1216
|
const f = o(s, a, u), c = { ...f }, b = Object.fromEntries(
|
|
1217
1217
|
// Send the update message on all method calls
|
|
1218
|
-
Object.entries(f).map(([_,
|
|
1219
|
-
const
|
|
1220
|
-
return e.publish(`${t}_call`, [_,
|
|
1221
|
-
}] : [_,
|
|
1218
|
+
Object.entries(f).map(([_, C]) => typeof C == "function" && !_.startsWith("get") && !r.includes(_) ? [_, (...S) => {
|
|
1219
|
+
const E = C(...S);
|
|
1220
|
+
return e.publish(`${t}_call`, [_, S]), E;
|
|
1221
|
+
}] : [_, C])
|
|
1222
1222
|
);
|
|
1223
1223
|
return b.unsub = () => {
|
|
1224
1224
|
l.forEach((_) => _());
|
|
@@ -1253,7 +1253,7 @@ function Xe(e, t) {
|
|
|
1253
1253
|
return !1;
|
|
1254
1254
|
return !0;
|
|
1255
1255
|
}
|
|
1256
|
-
const or =
|
|
1256
|
+
const or = m.createContext(), nn = (e, t) => ({
|
|
1257
1257
|
items: {},
|
|
1258
1258
|
getItems: () => t().items,
|
|
1259
1259
|
setItems: (r) => e({ items: r }),
|
|
@@ -1333,7 +1333,7 @@ const or = g.createContext(), nn = (e, t) => ({
|
|
|
1333
1333
|
setSessionInfo: (r) => e({ session: r }),
|
|
1334
1334
|
updateSessionInfo: (r) => e((n) => ({ session: { ...n.session, ...r } }))
|
|
1335
1335
|
}), Yt = ({ storeName: e, children: t, defaultValue: r }) => {
|
|
1336
|
-
const { wire: n } = Be("room"), [o] =
|
|
1336
|
+
const { wire: n } = Be("room"), [o] = m.useState(
|
|
1337
1337
|
() => Ne(
|
|
1338
1338
|
ut({ wire: n, storeName: e, defaultValue: r }, (...s) => ({
|
|
1339
1339
|
...nn(...s),
|
|
@@ -1353,7 +1353,7 @@ const or = g.createContext(), nn = (e, t) => ({
|
|
|
1353
1353
|
n.itemIds,
|
|
1354
1354
|
n.items
|
|
1355
1355
|
]);
|
|
1356
|
-
return
|
|
1356
|
+
return m.useMemo(
|
|
1357
1357
|
() => e.map((n) => t[n]),
|
|
1358
1358
|
[e, t]
|
|
1359
1359
|
);
|
|
@@ -1362,14 +1362,14 @@ const or = g.createContext(), nn = (e, t) => ({
|
|
|
1362
1362
|
a.items,
|
|
1363
1363
|
a.itemIds,
|
|
1364
1364
|
a.getItemList
|
|
1365
|
-
]), [n, o] =
|
|
1366
|
-
return
|
|
1365
|
+
]), [n, o] = m.useState(r()), [, s] = m.useTransition();
|
|
1366
|
+
return m.useEffect(() => {
|
|
1367
1367
|
const a = r();
|
|
1368
1368
|
s(() => {
|
|
1369
1369
|
o(a);
|
|
1370
1370
|
});
|
|
1371
1371
|
}, [e, t, r]), n;
|
|
1372
|
-
}, sr = 5e4, ir =
|
|
1372
|
+
}, sr = 5e4, ir = m.createContext(), un = (e, t) => ({
|
|
1373
1373
|
config: {
|
|
1374
1374
|
itemTemplates: {},
|
|
1375
1375
|
actions: {},
|
|
@@ -1436,7 +1436,7 @@ const or = g.createContext(), nn = (e, t) => ({
|
|
|
1436
1436
|
return !o || !r || o.top !== r.top || o.left !== r.left || o.width !== r.width || o.height !== r.height ? { selectionBox: r } : {};
|
|
1437
1437
|
})
|
|
1438
1438
|
}), Bt = ({ children: e }) => {
|
|
1439
|
-
const [t] =
|
|
1439
|
+
const [t] = m.useState(
|
|
1440
1440
|
() => Ne((...r) => ({
|
|
1441
1441
|
...un(...r),
|
|
1442
1442
|
...ln(...r),
|
|
@@ -1493,7 +1493,7 @@ function ft(e, t, r, n = 0) {
|
|
|
1493
1493
|
[r, n, ...t]
|
|
1494
1494
|
);
|
|
1495
1495
|
}
|
|
1496
|
-
const
|
|
1496
|
+
const Le = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
1497
1497
|
x: e,
|
|
1498
1498
|
y: t,
|
|
1499
1499
|
scale: r,
|
|
@@ -1502,10 +1502,10 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1502
1502
|
boardSize: l
|
|
1503
1503
|
}) => {
|
|
1504
1504
|
const d = {
|
|
1505
|
-
left: -n * r +
|
|
1506
|
-
right: u.width - o * r -
|
|
1507
|
-
top: -a * r +
|
|
1508
|
-
bottom: u.height - s * r -
|
|
1505
|
+
left: -n * r + Le * r,
|
|
1506
|
+
right: u.width - o * r - Le * r,
|
|
1507
|
+
top: -a * r + Le * r,
|
|
1508
|
+
bottom: u.height - s * r - Le * r,
|
|
1509
1509
|
maxRight: u.width - l * r,
|
|
1510
1510
|
maxLeft: u.height - l * r
|
|
1511
1511
|
}, f = Math.min(
|
|
@@ -1525,119 +1525,119 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1525
1525
|
r,
|
|
1526
1526
|
n,
|
|
1527
1527
|
o
|
|
1528
|
-
] = Z((
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
]), s =
|
|
1535
|
-
const { translateX:
|
|
1536
|
-
return { translateX:
|
|
1537
|
-
}, [e]), l =
|
|
1538
|
-
(
|
|
1539
|
-
const { itemExtent:
|
|
1540
|
-
...
|
|
1541
|
-
...
|
|
1528
|
+
] = Z((h) => [
|
|
1529
|
+
h.getBoardState,
|
|
1530
|
+
h.updateBoardState,
|
|
1531
|
+
h.config.itemExtent,
|
|
1532
|
+
h.getConfiguration,
|
|
1533
|
+
h.updateConfiguration
|
|
1534
|
+
]), s = m.useRef([0.1, 8]), [a] = se((h) => [h.getItemList]), u = m.useCallback(() => {
|
|
1535
|
+
const { translateX: h, translateY: S, scale: E } = e();
|
|
1536
|
+
return { translateX: h, translateY: S, scale: E };
|
|
1537
|
+
}, [e]), l = m.useCallback(
|
|
1538
|
+
(h) => {
|
|
1539
|
+
const { itemExtent: S, boardWrapperRect: E, boardSize: x } = n(), v = e(), { translateX: p, translateY: R, scale: w } = {
|
|
1540
|
+
...v,
|
|
1541
|
+
...h(v)
|
|
1542
1542
|
};
|
|
1543
|
-
let
|
|
1544
|
-
|
|
1545
|
-
let [
|
|
1546
|
-
(p !==
|
|
1543
|
+
let g = w;
|
|
1544
|
+
w !== v.scale && (g > s.current[1] && ([, g] = s.current), g < s.current[0] && ([g] = s.current));
|
|
1545
|
+
let [k, P] = [p, R];
|
|
1546
|
+
(p !== v.translateX || R !== v.translateY) && ([k, P] = Nt({
|
|
1547
1547
|
x: p,
|
|
1548
|
-
y:
|
|
1549
|
-
scale:
|
|
1550
|
-
itemExtent:
|
|
1551
|
-
boardWrapperRect:
|
|
1548
|
+
y: R,
|
|
1549
|
+
scale: g,
|
|
1550
|
+
itemExtent: S,
|
|
1551
|
+
boardWrapperRect: E,
|
|
1552
1552
|
boardSize: x
|
|
1553
1553
|
})), t({
|
|
1554
|
-
translateX:
|
|
1555
|
-
translateY:
|
|
1556
|
-
scale:
|
|
1554
|
+
translateX: k,
|
|
1555
|
+
translateY: P,
|
|
1556
|
+
scale: g
|
|
1557
1557
|
});
|
|
1558
1558
|
},
|
|
1559
1559
|
[e, n, t]
|
|
1560
|
-
), d =
|
|
1561
|
-
(
|
|
1562
|
-
const { itemExtent:
|
|
1563
|
-
let p =
|
|
1560
|
+
), d = m.useCallback(
|
|
1561
|
+
(h, S) => {
|
|
1562
|
+
const { itemExtent: E, boardWrapperRect: x, boardSize: v } = n();
|
|
1563
|
+
let p = S;
|
|
1564
1564
|
p || (p = {
|
|
1565
1565
|
x: x.width / 2,
|
|
1566
1566
|
y: x.height / 2
|
|
1567
1567
|
});
|
|
1568
|
-
const
|
|
1569
|
-
let
|
|
1570
|
-
|
|
1571
|
-
const
|
|
1572
|
-
x:
|
|
1573
|
-
y:
|
|
1574
|
-
scale:
|
|
1575
|
-
itemExtent:
|
|
1568
|
+
const R = e();
|
|
1569
|
+
let w = R.scale * h;
|
|
1570
|
+
w > s.current[1] && ([, w] = s.current), w < s.current[0] && ([w] = s.current);
|
|
1571
|
+
const g = p.x - x.left, k = p.y - x.top, P = g - (g - R.translateX) * w / R.scale, M = k - (k - R.translateY) * w / R.scale, [$, B] = Nt({
|
|
1572
|
+
x: P,
|
|
1573
|
+
y: M,
|
|
1574
|
+
scale: w,
|
|
1575
|
+
itemExtent: E,
|
|
1576
1576
|
boardWrapperRect: x,
|
|
1577
|
-
boardSize:
|
|
1577
|
+
boardSize: v
|
|
1578
1578
|
});
|
|
1579
1579
|
t({
|
|
1580
|
-
scale:
|
|
1581
|
-
translateX:
|
|
1582
|
-
translateY:
|
|
1580
|
+
scale: w,
|
|
1581
|
+
translateX: $,
|
|
1582
|
+
translateY: B
|
|
1583
1583
|
});
|
|
1584
1584
|
},
|
|
1585
1585
|
[e, n, t]
|
|
1586
|
-
), f =
|
|
1587
|
-
({ left:
|
|
1588
|
-
const { boardWrapperRect:
|
|
1586
|
+
), f = m.useCallback(
|
|
1587
|
+
({ left: h, top: S, width: E, height: x }) => {
|
|
1588
|
+
const { boardWrapperRect: v } = n(), p = v.width / E, R = v.height / x, g = Math.min(p, R) * mn, k = v.width / 2 - (h + E / 2) * g, P = v.height / 2 - (S + x / 2) * g;
|
|
1589
1589
|
t({
|
|
1590
|
-
translateX:
|
|
1591
|
-
translateY:
|
|
1592
|
-
scale:
|
|
1590
|
+
translateX: k,
|
|
1591
|
+
translateY: P,
|
|
1592
|
+
scale: g
|
|
1593
1593
|
});
|
|
1594
1594
|
},
|
|
1595
1595
|
[n, t]
|
|
1596
|
-
), c =
|
|
1596
|
+
), c = m.useCallback(async () => {
|
|
1597
1597
|
const {
|
|
1598
|
-
itemExtent: { width:
|
|
1599
|
-
boardWrapperRect:
|
|
1600
|
-
} = n(), x =
|
|
1598
|
+
itemExtent: { width: h, height: S },
|
|
1599
|
+
boardWrapperRect: E
|
|
1600
|
+
} = n(), x = E.width / h, v = E.height / S, p = Math.min(x, v);
|
|
1601
1601
|
s.current = [
|
|
1602
1602
|
Math.max(p * 0.5, 0.05),
|
|
1603
1603
|
Math.max(p * 10, 10)
|
|
1604
1604
|
];
|
|
1605
|
-
}, [n]), b =
|
|
1606
|
-
const { boardWrapperRect:
|
|
1605
|
+
}, [n]), b = m.useCallback(() => {
|
|
1606
|
+
const { boardWrapperRect: h, boardSize: S } = n(), { translateX: E, translateY: x, scale: v } = e();
|
|
1607
1607
|
return {
|
|
1608
|
-
x: (
|
|
1609
|
-
y: (
|
|
1608
|
+
x: (h.width / 2 - E) / v - S / 2,
|
|
1609
|
+
y: (h.height / 2 - x) / v - S / 2
|
|
1610
1610
|
};
|
|
1611
|
-
}, [e, n]), _ =
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1614
|
-
|
|
1611
|
+
}, [e, n]), _ = m.useCallback(() => {
|
|
1612
|
+
const h = a(), { boardWrapperRect: S, boardWrapper: E, boardSize: x } = n(), { scale: v, translateX: p, translateY: R } = e(), { left: w, top: g, width: k, height: P } = nr(
|
|
1613
|
+
h.map(({ id: $ }) => $),
|
|
1614
|
+
E
|
|
1615
1615
|
) || {
|
|
1616
|
-
left: x / 2 *
|
|
1617
|
-
top: x / 2 *
|
|
1616
|
+
left: x / 2 * v + S.left + p,
|
|
1617
|
+
top: x / 2 * v + S.top + R,
|
|
1618
1618
|
width: 0,
|
|
1619
1619
|
height: 0
|
|
1620
|
-
},
|
|
1621
|
-
left: (
|
|
1622
|
-
top: (
|
|
1623
|
-
width:
|
|
1624
|
-
height:
|
|
1620
|
+
}, M = {
|
|
1621
|
+
left: (w - S.left - p) / v,
|
|
1622
|
+
top: (g - S.top - R) / v,
|
|
1623
|
+
width: k / v,
|
|
1624
|
+
height: P / v
|
|
1625
1625
|
};
|
|
1626
|
-
if (
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1626
|
+
if (M.right = M.left + M.width, M.bottom = M.top + M.height, M.width < Se) {
|
|
1627
|
+
const $ = (Se - M.width) / 2;
|
|
1628
|
+
M.left -= $, M.right += $, M.width = Se;
|
|
1629
1629
|
}
|
|
1630
|
-
if (
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1630
|
+
if (M.height < Se) {
|
|
1631
|
+
const $ = (Se - M.height) / 2;
|
|
1632
|
+
M.top -= $, M.bottom += $, M.height = Se;
|
|
1633
1633
|
}
|
|
1634
|
-
o({ itemExtent:
|
|
1635
|
-
}, [e, n, a, o]),
|
|
1634
|
+
o({ itemExtent: M });
|
|
1635
|
+
}, [e, n, a, o]), C = ft(
|
|
1636
1636
|
() => _(),
|
|
1637
1637
|
[_],
|
|
1638
1638
|
200
|
|
1639
1639
|
);
|
|
1640
|
-
return
|
|
1640
|
+
return m.useEffect(() => {
|
|
1641
1641
|
r.left && c();
|
|
1642
1642
|
}, [c, r]), {
|
|
1643
1643
|
setDim: l,
|
|
@@ -1646,7 +1646,7 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1646
1646
|
zoomToCenter: d,
|
|
1647
1647
|
zoomToExtent: f,
|
|
1648
1648
|
getCenter: b,
|
|
1649
|
-
updateItemExtent:
|
|
1649
|
+
updateItemExtent: C
|
|
1650
1650
|
};
|
|
1651
1651
|
}, gn = (e) => {
|
|
1652
1652
|
const [t, r, n] = Z(
|
|
@@ -1655,12 +1655,12 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1655
1655
|
u,
|
|
1656
1656
|
l
|
|
1657
1657
|
]
|
|
1658
|
-
), o =
|
|
1658
|
+
), o = m.useCallback(
|
|
1659
1659
|
(a) => (t(e, a), () => {
|
|
1660
1660
|
r(e, a);
|
|
1661
1661
|
}),
|
|
1662
1662
|
[e, t, r]
|
|
1663
|
-
), s =
|
|
1663
|
+
), s = m.useCallback(
|
|
1664
1664
|
(a) => {
|
|
1665
1665
|
n(e, a);
|
|
1666
1666
|
},
|
|
@@ -1681,72 +1681,72 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1681
1681
|
moveItems: c,
|
|
1682
1682
|
removeItemsById: b,
|
|
1683
1683
|
getItemList: _,
|
|
1684
|
-
insertItems:
|
|
1685
|
-
setItemList:
|
|
1684
|
+
insertItems: C,
|
|
1685
|
+
setItemList: h
|
|
1686
1686
|
} = se(
|
|
1687
1687
|
({
|
|
1688
1688
|
getItems: O,
|
|
1689
|
-
getItemIds:
|
|
1689
|
+
getItemIds: D,
|
|
1690
1690
|
setItemIds: A,
|
|
1691
|
-
updateItems:
|
|
1692
|
-
moveItems:
|
|
1693
|
-
removeItemsById:
|
|
1694
|
-
getItemList:
|
|
1691
|
+
updateItems: X,
|
|
1692
|
+
moveItems: z,
|
|
1693
|
+
removeItemsById: F,
|
|
1694
|
+
getItemList: H,
|
|
1695
1695
|
insertItems: te,
|
|
1696
1696
|
setItemList: re
|
|
1697
1697
|
}) => ({
|
|
1698
1698
|
getItems: O,
|
|
1699
|
-
getItemIds:
|
|
1699
|
+
getItemIds: D,
|
|
1700
1700
|
setItemIds: A,
|
|
1701
|
-
updateItems:
|
|
1702
|
-
moveItems:
|
|
1703
|
-
removeItemsById:
|
|
1704
|
-
getItemList:
|
|
1701
|
+
updateItems: X,
|
|
1702
|
+
moveItems: z,
|
|
1703
|
+
removeItemsById: F,
|
|
1704
|
+
getItemList: H,
|
|
1705
1705
|
insertItems: te,
|
|
1706
1706
|
setItemList: re
|
|
1707
1707
|
})
|
|
1708
|
-
),
|
|
1709
|
-
(O,
|
|
1710
|
-
let A =
|
|
1711
|
-
typeof
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1708
|
+
), S = m.useCallback(
|
|
1709
|
+
(O, D) => {
|
|
1710
|
+
let A = D;
|
|
1711
|
+
typeof D == "object" && (A = () => D);
|
|
1712
|
+
const X = l().filter((H) => O.includes(H)), z = u(), F = Object.fromEntries(
|
|
1713
|
+
X.map((H) => [H, A({ ...z[H] })])
|
|
1714
1714
|
);
|
|
1715
|
-
f(
|
|
1715
|
+
f(F), r();
|
|
1716
1716
|
},
|
|
1717
1717
|
[l, u, r, f]
|
|
1718
|
-
),
|
|
1718
|
+
), E = m.useCallback(
|
|
1719
1719
|
(O) => {
|
|
1720
|
-
|
|
1720
|
+
h(O), n(), r();
|
|
1721
1721
|
},
|
|
1722
|
-
[n,
|
|
1723
|
-
), x =
|
|
1724
|
-
(O,
|
|
1725
|
-
|
|
1722
|
+
[n, h, r]
|
|
1723
|
+
), x = m.useCallback(
|
|
1724
|
+
(O, D) => {
|
|
1725
|
+
S([O], D);
|
|
1726
1726
|
},
|
|
1727
|
-
[
|
|
1728
|
-
),
|
|
1729
|
-
(O,
|
|
1730
|
-
c(O,
|
|
1727
|
+
[S]
|
|
1728
|
+
), v = m.useCallback(
|
|
1729
|
+
(O, D) => {
|
|
1730
|
+
c(O, D), r();
|
|
1731
1731
|
},
|
|
1732
1732
|
[c, r]
|
|
1733
|
-
), p =
|
|
1733
|
+
), p = m.useCallback(
|
|
1734
1734
|
(O) => {
|
|
1735
|
-
const
|
|
1736
|
-
(
|
|
1735
|
+
const D = l(), A = D.filter((z) => !O.includes(z)), X = D.filter(
|
|
1736
|
+
(z) => O.includes(z)
|
|
1737
1737
|
);
|
|
1738
|
-
d([...A, ...
|
|
1738
|
+
d([...A, ...X]);
|
|
1739
1739
|
},
|
|
1740
1740
|
[l, d]
|
|
1741
|
-
),
|
|
1742
|
-
(O, { type:
|
|
1743
|
-
const { boardWrapper:
|
|
1744
|
-
O.forEach((
|
|
1745
|
-
const te =
|
|
1741
|
+
), R = m.useCallback(
|
|
1742
|
+
(O, { type: D, size: A } = {}) => {
|
|
1743
|
+
const { boardWrapper: X } = a(), z = {}, F = u();
|
|
1744
|
+
O.forEach((H) => {
|
|
1745
|
+
const te = F[H], re = it(X, H);
|
|
1746
1746
|
if (!re)
|
|
1747
1747
|
return;
|
|
1748
1748
|
const ne = {
|
|
1749
|
-
type:
|
|
1749
|
+
type: D || "grid",
|
|
1750
1750
|
size: A || 1,
|
|
1751
1751
|
offset: { x: 0, y: 0 },
|
|
1752
1752
|
...te.grid
|
|
@@ -1759,117 +1759,117 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1759
1759
|
},
|
|
1760
1760
|
ne
|
|
1761
1761
|
);
|
|
1762
|
-
|
|
1763
|
-
}), f(
|
|
1762
|
+
z[H] = { ...te, ...V };
|
|
1763
|
+
}), f(z);
|
|
1764
1764
|
},
|
|
1765
1765
|
[a, u, f]
|
|
1766
|
-
),
|
|
1767
|
-
(O,
|
|
1768
|
-
p(O),
|
|
1769
|
-
const
|
|
1770
|
-
return delete
|
|
1771
|
-
}),
|
|
1766
|
+
), w = m.useCallback(
|
|
1767
|
+
(O, D) => {
|
|
1768
|
+
p(O), S(O, (A) => {
|
|
1769
|
+
const X = { ...A };
|
|
1770
|
+
return delete X.moving, X;
|
|
1771
|
+
}), R(O, D), e(O), r();
|
|
1772
1772
|
},
|
|
1773
1773
|
[
|
|
1774
|
-
|
|
1774
|
+
S,
|
|
1775
1775
|
e,
|
|
1776
1776
|
p,
|
|
1777
|
-
|
|
1777
|
+
R,
|
|
1778
1778
|
r
|
|
1779
1779
|
]
|
|
1780
|
-
),
|
|
1780
|
+
), g = m.useCallback(
|
|
1781
1781
|
(O) => {
|
|
1782
1782
|
d(O);
|
|
1783
1783
|
},
|
|
1784
1784
|
[d]
|
|
1785
|
-
),
|
|
1785
|
+
), k = m.useCallback(
|
|
1786
1786
|
(O) => {
|
|
1787
|
-
const
|
|
1788
|
-
(
|
|
1789
|
-
),
|
|
1790
|
-
d(
|
|
1787
|
+
const D = l(), A = D.filter(
|
|
1788
|
+
(z) => O.includes(z)
|
|
1789
|
+
), X = D.map((z) => O.includes(z) ? A.pop() : z);
|
|
1790
|
+
d(X), o();
|
|
1791
1791
|
},
|
|
1792
1792
|
[l, o, d]
|
|
1793
|
-
),
|
|
1794
|
-
(O,
|
|
1795
|
-
const A = u(),
|
|
1796
|
-
const
|
|
1793
|
+
), P = m.useCallback(
|
|
1794
|
+
(O, D) => {
|
|
1795
|
+
const A = u(), X = O.map((V) => A[V]), z = D.map((V) => A[V]), F = D.reduce((V, ee) => (V[ee] = X.shift(), V), {}), H = z.reduce((V, ee) => {
|
|
1796
|
+
const fe = F[ee.id], he = {
|
|
1797
1797
|
...ee,
|
|
1798
|
-
x:
|
|
1799
|
-
y:
|
|
1798
|
+
x: fe.x,
|
|
1799
|
+
y: fe.y
|
|
1800
1800
|
};
|
|
1801
1801
|
return V[ee.id] = he, V;
|
|
1802
1802
|
}, {});
|
|
1803
|
-
f(
|
|
1804
|
-
const te = O.reduce((V, ee) => (V[ee] =
|
|
1803
|
+
f(H);
|
|
1804
|
+
const te = O.reduce((V, ee) => (V[ee] = D.shift(), V), {}), ne = l().map((V) => O.includes(V) ? te[V] : V);
|
|
1805
1805
|
d(ne);
|
|
1806
1806
|
},
|
|
1807
1807
|
[u, f, l, d]
|
|
1808
|
-
),
|
|
1809
|
-
(O,
|
|
1810
|
-
const A = t(),
|
|
1811
|
-
|
|
1808
|
+
), M = m.useCallback(
|
|
1809
|
+
(O, D) => {
|
|
1810
|
+
const A = t(), X = O.map((z, F) => !z.x || !z.y ? { ...z, x: A.x + 2 * F, y: A.y + 2 * F } : z);
|
|
1811
|
+
C(X, D), r();
|
|
1812
1812
|
},
|
|
1813
|
-
[t,
|
|
1814
|
-
),
|
|
1815
|
-
(O,
|
|
1816
|
-
|
|
1813
|
+
[t, C, r]
|
|
1814
|
+
), $ = m.useCallback(
|
|
1815
|
+
(O, D) => {
|
|
1816
|
+
M([O], D);
|
|
1817
1817
|
},
|
|
1818
|
-
[
|
|
1819
|
-
),
|
|
1818
|
+
[M]
|
|
1819
|
+
), B = m.useCallback(
|
|
1820
1820
|
(O) => {
|
|
1821
1821
|
s(O), b(O);
|
|
1822
1822
|
},
|
|
1823
1823
|
[s, b]
|
|
1824
|
-
),
|
|
1824
|
+
), N = m.useCallback(
|
|
1825
1825
|
(O) => {
|
|
1826
|
-
const
|
|
1827
|
-
return O.map((A) =>
|
|
1826
|
+
const D = u();
|
|
1827
|
+
return O.map((A) => D[A]);
|
|
1828
1828
|
},
|
|
1829
1829
|
[u]
|
|
1830
|
-
), K =
|
|
1831
|
-
({ target: O, clientX:
|
|
1830
|
+
), K = m.useCallback(
|
|
1831
|
+
({ target: O, clientX: D, clientY: A }, { returnLocked: X = !1, passLocked: z = !1 } = {}) => {
|
|
1832
1832
|
if (["INPUT", "TEXTAREA"].includes(O.tagName))
|
|
1833
1833
|
return null;
|
|
1834
|
-
const
|
|
1835
|
-
if (
|
|
1836
|
-
if (_e(
|
|
1837
|
-
return
|
|
1838
|
-
if (!
|
|
1839
|
-
return
|
|
1834
|
+
const F = Te(O, "item");
|
|
1835
|
+
if (F) {
|
|
1836
|
+
if (_e(F, "selected"))
|
|
1837
|
+
return F;
|
|
1838
|
+
if (!z && _e(F, "locked") && !_e(O, "passthrough"))
|
|
1839
|
+
return X ? F : null;
|
|
1840
1840
|
if (_e(O, "passthrough")) {
|
|
1841
|
-
const
|
|
1842
|
-
const ee = it(te, V),
|
|
1843
|
-
return rr({ x:
|
|
1841
|
+
const H = l(), { boardWrapper: te } = a(), re = H.reduce((ne, V) => {
|
|
1842
|
+
const ee = it(te, V), fe = ee.getBoundingClientRect();
|
|
1843
|
+
return rr({ x: D, y: A }, fe) && ne.unshift(ee), ne;
|
|
1844
1844
|
}, []);
|
|
1845
1845
|
for (let ne = 0; ne < re.length; ne += 1) {
|
|
1846
1846
|
const V = re[ne];
|
|
1847
|
-
if (V !==
|
|
1847
|
+
if (V !== F && (z || !_e(V, "locked")))
|
|
1848
1848
|
return V;
|
|
1849
1849
|
}
|
|
1850
1850
|
return null;
|
|
1851
1851
|
}
|
|
1852
1852
|
}
|
|
1853
|
-
return
|
|
1853
|
+
return F;
|
|
1854
1854
|
},
|
|
1855
1855
|
[a, l]
|
|
1856
1856
|
);
|
|
1857
1857
|
return {
|
|
1858
1858
|
putItemsOnTop: p,
|
|
1859
|
-
batchUpdateItems:
|
|
1860
|
-
updateItemOrder:
|
|
1861
|
-
moveItems:
|
|
1862
|
-
placeItems:
|
|
1859
|
+
batchUpdateItems: S,
|
|
1860
|
+
updateItemOrder: g,
|
|
1861
|
+
moveItems: v,
|
|
1862
|
+
placeItems: w,
|
|
1863
1863
|
updateItem: x,
|
|
1864
|
-
swapItems:
|
|
1865
|
-
reverseItemsOrder:
|
|
1866
|
-
setItemList:
|
|
1867
|
-
pushItem:
|
|
1868
|
-
pushItems:
|
|
1869
|
-
removeItems:
|
|
1864
|
+
swapItems: P,
|
|
1865
|
+
reverseItemsOrder: k,
|
|
1866
|
+
setItemList: E,
|
|
1867
|
+
pushItem: $,
|
|
1868
|
+
pushItems: M,
|
|
1869
|
+
removeItems: B,
|
|
1870
1870
|
getItemList: _,
|
|
1871
1871
|
findElementUnderPointer: K,
|
|
1872
|
-
getItems:
|
|
1872
|
+
getItems: N
|
|
1873
1873
|
};
|
|
1874
1874
|
};
|
|
1875
1875
|
var hn = function e(t, r) {
|
|
@@ -1954,17 +1954,17 @@ const yn = (e, t) => {
|
|
|
1954
1954
|
c.config.itemTemplates,
|
|
1955
1955
|
c.selection,
|
|
1956
1956
|
c.getSelection
|
|
1957
|
-
]), [s, a] =
|
|
1958
|
-
|
|
1957
|
+
]), [s, a] = m.useState([]), u = m.useRef(!1), [, l] = m.useTransition();
|
|
1958
|
+
m.useEffect(() => (u.current = !0, () => {
|
|
1959
1959
|
u.current = !1;
|
|
1960
1960
|
}), []);
|
|
1961
|
-
const d =
|
|
1961
|
+
const d = m.useCallback(
|
|
1962
1962
|
(c) => {
|
|
1963
1963
|
const b = t();
|
|
1964
1964
|
if (c)
|
|
1965
|
-
return [c, c.map((
|
|
1965
|
+
return [c, c.map((C) => b[C])];
|
|
1966
1966
|
const _ = o();
|
|
1967
|
-
return [_, _.map((
|
|
1967
|
+
return [_, _.map((C) => b[C])];
|
|
1968
1968
|
},
|
|
1969
1969
|
[t, o]
|
|
1970
1970
|
), f = Jt(() => {
|
|
@@ -1972,10 +1972,10 @@ const yn = (e, t) => {
|
|
|
1972
1972
|
if (c.length > 0) {
|
|
1973
1973
|
if (!u.current)
|
|
1974
1974
|
return;
|
|
1975
|
-
const _ = b.reduce((
|
|
1976
|
-
const
|
|
1977
|
-
return
|
|
1978
|
-
(
|
|
1975
|
+
const _ = b.reduce((C, h) => {
|
|
1976
|
+
const S = Ut(h, r);
|
|
1977
|
+
return C.filter(
|
|
1978
|
+
(E) => S.some((x) => hn(E, x))
|
|
1979
1979
|
);
|
|
1980
1980
|
}, Ut(b[0], r));
|
|
1981
1981
|
l(() => {
|
|
@@ -1998,13 +1998,13 @@ const yn = (e, t) => {
|
|
|
1998
1998
|
return e;
|
|
1999
1999
|
};
|
|
2000
2000
|
let me = (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), "");
|
|
2001
|
-
const ar =
|
|
2001
|
+
const ar = m.createContext(), at = (e) => {
|
|
2002
2002
|
localStorage.setItem("user", JSON.stringify(e));
|
|
2003
2003
|
}, Sn = () => {
|
|
2004
2004
|
if (localStorage.user) {
|
|
2005
2005
|
const t = {
|
|
2006
2006
|
name: "Player",
|
|
2007
|
-
color:
|
|
2007
|
+
color: zt(),
|
|
2008
2008
|
uid: me(),
|
|
2009
2009
|
...JSON.parse(localStorage.user)
|
|
2010
2010
|
};
|
|
@@ -2012,7 +2012,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2012
2012
|
}
|
|
2013
2013
|
const e = {
|
|
2014
2014
|
name: "Player",
|
|
2015
|
-
color:
|
|
2015
|
+
color: zt(),
|
|
2016
2016
|
uid: me()
|
|
2017
2017
|
};
|
|
2018
2018
|
return at(e), e;
|
|
@@ -2069,8 +2069,8 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2069
2069
|
return delete n[t], { cursors: n };
|
|
2070
2070
|
})
|
|
2071
2071
|
}), cr = ({ storeName: e, children: t }) => {
|
|
2072
|
-
const { wire: r, isMaster: n } = Be("room"), [o, s] =
|
|
2073
|
-
return
|
|
2072
|
+
const { wire: r, isMaster: n } = Be("room"), [o, s] = m.useState(null), [a, u] = m.useState(!1), l = m.useRef(!1);
|
|
2073
|
+
return m.useEffect(() => {
|
|
2074
2074
|
let d = !0;
|
|
2075
2075
|
const f = [];
|
|
2076
2076
|
if (!o && !l.current)
|
|
@@ -2087,18 +2087,18 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2087
2087
|
"electSpaceMaster"
|
|
2088
2088
|
]
|
|
2089
2089
|
},
|
|
2090
|
-
(...
|
|
2091
|
-
..._n(r.userId)(...
|
|
2092
|
-
...bn(...
|
|
2090
|
+
(...C) => ({
|
|
2091
|
+
..._n(r.userId)(...C),
|
|
2092
|
+
...bn(...C)
|
|
2093
2093
|
})
|
|
2094
2094
|
)
|
|
2095
|
-
), _ = b.subscribe((
|
|
2096
|
-
|
|
2095
|
+
), _ = b.subscribe((C) => {
|
|
2096
|
+
C.ready && (_(), d && s(b));
|
|
2097
2097
|
});
|
|
2098
2098
|
})(), () => {
|
|
2099
2099
|
d = !1, l.current = !1, f.forEach((b) => b());
|
|
2100
2100
|
};
|
|
2101
|
-
}, [o, e, r, r.userId]),
|
|
2101
|
+
}, [o, e, r, r.userId]), m.useEffect(() => {
|
|
2102
2102
|
if (o)
|
|
2103
2103
|
return o.getState().addUser({
|
|
2104
2104
|
...Sn(),
|
|
@@ -2106,7 +2106,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2106
2106
|
}), u(!0), () => {
|
|
2107
2107
|
o.getState().removeUser(r.userId);
|
|
2108
2108
|
};
|
|
2109
|
-
}, [n, o, r]),
|
|
2109
|
+
}, [n, o, r]), m.useEffect(() => {
|
|
2110
2110
|
if (o) {
|
|
2111
2111
|
const d = r.subscribe("userLeave", (f) => {
|
|
2112
2112
|
o.getState().removeUser(f);
|
|
@@ -2115,7 +2115,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2115
2115
|
d();
|
|
2116
2116
|
};
|
|
2117
2117
|
}
|
|
2118
|
-
}, [n, o, r]),
|
|
2118
|
+
}, [n, o, r]), m.useEffect(() => {
|
|
2119
2119
|
n && o && o.getState().updateCurrentUser({ isMaster: n });
|
|
2120
2120
|
}, [n, o, r]), a ? /* @__PURE__ */ T(ar.Provider, { value: o, children: t }) : null;
|
|
2121
2121
|
}, ge = (e, t) => {
|
|
@@ -2128,7 +2128,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2128
2128
|
u.users,
|
|
2129
2129
|
u.updateCurrentUser,
|
|
2130
2130
|
u.joinSpace
|
|
2131
|
-
]), s =
|
|
2131
|
+
]), s = m.useMemo(() => Object.values(r), [r]), a = m.useMemo(() => {
|
|
2132
2132
|
const { space: u } = t;
|
|
2133
2133
|
return s.filter(({ space: l }) => l === u);
|
|
2134
2134
|
}, [t, s]);
|
|
@@ -2143,7 +2143,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2143
2143
|
}, ns = () => {
|
|
2144
2144
|
const [e, t, r] = se(
|
|
2145
2145
|
(o) => [o.boardConfig, o.getBoardConfig, o.setBoardConfig]
|
|
2146
|
-
), n =
|
|
2146
|
+
), n = m.useCallback(
|
|
2147
2147
|
(o) => {
|
|
2148
2148
|
let s = o;
|
|
2149
2149
|
typeof o == "object" && (s = () => o);
|
|
@@ -2164,7 +2164,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2164
2164
|
o.session
|
|
2165
2165
|
]);
|
|
2166
2166
|
return { getSessionInfo: e, setSessionInfo: t, sessionInfo: n, updateSessionInfo: r };
|
|
2167
|
-
}, ur =
|
|
2167
|
+
}, ur = m.createContext(), En = ({ user: { name: e, uid: t, color: r }, content: n }) => ({
|
|
2168
2168
|
type: "message",
|
|
2169
2169
|
user: { name: e, uid: t, color: r },
|
|
2170
2170
|
content: n,
|
|
@@ -2196,7 +2196,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2196
2196
|
children: t,
|
|
2197
2197
|
defaultValue: r = []
|
|
2198
2198
|
}) => {
|
|
2199
|
-
const { wire: n } = Be("room"), [o] =
|
|
2199
|
+
const { wire: n } = Be("room"), [o] = m.useState(
|
|
2200
2200
|
() => Ne(
|
|
2201
2201
|
ut(
|
|
2202
2202
|
{ wire: n, storeName: e, defaultValue: r, noSync: ["sendMessage"] },
|
|
@@ -2217,10 +2217,10 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2217
2217
|
a.setMessages,
|
|
2218
2218
|
a.sendMessage
|
|
2219
2219
|
]);
|
|
2220
|
-
|
|
2220
|
+
m.useEffect(() => {
|
|
2221
2221
|
r.length && e();
|
|
2222
2222
|
}, [r, e]);
|
|
2223
|
-
const s =
|
|
2223
|
+
const s = m.useCallback(
|
|
2224
2224
|
(a) => {
|
|
2225
2225
|
o(t, a);
|
|
2226
2226
|
},
|
|
@@ -2229,7 +2229,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2229
2229
|
return { messages: r, setMessages: n, sendMessage: s };
|
|
2230
2230
|
}, Wt = ({ children: e, session: t }) => {
|
|
2231
2231
|
const r = ge((n) => n.joinSpace);
|
|
2232
|
-
return
|
|
2232
|
+
return m.useEffect(() => (r(t), () => {
|
|
2233
2233
|
r(null);
|
|
2234
2234
|
}), [r, t]), e;
|
|
2235
2235
|
}, as = ({
|
|
@@ -2241,7 +2241,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2241
2241
|
LoadingComponent: s,
|
|
2242
2242
|
...a
|
|
2243
2243
|
}) => {
|
|
2244
|
-
const [u] =
|
|
2244
|
+
const [u] = m.useState(t || me()), [l] = m.useState(r || me()), [d] = m.useState(() => ({
|
|
2245
2245
|
itemIds: n.map(({ id: c }) => c),
|
|
2246
2246
|
items: Object.fromEntries(n.map((c) => [c.id, c]))
|
|
2247
2247
|
}));
|
|
@@ -2284,7 +2284,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2284
2284
|
}
|
|
2285
2285
|
);
|
|
2286
2286
|
}, cs = ({ socket: e, room: t, children: r, LoadingComponent: n }) => {
|
|
2287
|
-
const [o] =
|
|
2287
|
+
const [o] = m.useState(t || me());
|
|
2288
2288
|
return /* @__PURE__ */ T(
|
|
2289
2289
|
er,
|
|
2290
2290
|
{
|
|
@@ -2313,7 +2313,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2313
2313
|
}, Ft = ([e, t], [r, n]) => {
|
|
2314
2314
|
const o = Math.abs(e - r), s = Math.abs(t - n);
|
|
2315
2315
|
return Math.hypot(o, s);
|
|
2316
|
-
},
|
|
2316
|
+
}, pe = () => {
|
|
2317
2317
|
}, Tn = (e) => (t) => {
|
|
2318
2318
|
const { event: r } = t;
|
|
2319
2319
|
return r.isPropagationStopped() ? null : e(t);
|
|
@@ -2336,157 +2336,158 @@ class Pn {
|
|
|
2336
2336
|
}
|
|
2337
2337
|
const ie = new Pn(), We = ({
|
|
2338
2338
|
children: e,
|
|
2339
|
-
onDrag: t =
|
|
2340
|
-
onDragStart: r =
|
|
2341
|
-
onDragEnd: n =
|
|
2342
|
-
onPan: o =
|
|
2343
|
-
onTap: s =
|
|
2344
|
-
onLongTap: a =
|
|
2345
|
-
onDoubleTap: u =
|
|
2339
|
+
onDrag: t = pe,
|
|
2340
|
+
onDragStart: r = pe,
|
|
2341
|
+
onDragEnd: n = pe,
|
|
2342
|
+
onPan: o = pe,
|
|
2343
|
+
onTap: s = pe,
|
|
2344
|
+
onLongTap: a = pe,
|
|
2345
|
+
onDoubleTap: u = pe,
|
|
2346
2346
|
onZoom: l,
|
|
2347
2347
|
mainAction: d = "drag"
|
|
2348
2348
|
}) => {
|
|
2349
|
-
const f =
|
|
2349
|
+
const f = m.useRef(null), c = m.useRef({
|
|
2350
2350
|
moving: !1,
|
|
2351
2351
|
pointers: {},
|
|
2352
2352
|
mainPointer: void 0
|
|
2353
|
-
}), b = (
|
|
2353
|
+
}), b = (E) => {
|
|
2354
2354
|
const {
|
|
2355
2355
|
deltaX: x,
|
|
2356
|
-
deltaY:
|
|
2356
|
+
deltaY: v,
|
|
2357
2357
|
clientX: p,
|
|
2358
|
-
clientY:
|
|
2359
|
-
deltaMode:
|
|
2360
|
-
ctrlKey:
|
|
2361
|
-
altKey:
|
|
2362
|
-
metaKey:
|
|
2363
|
-
target:
|
|
2364
|
-
} =
|
|
2365
|
-
if (!(
|
|
2366
|
-
if (tt() && !
|
|
2358
|
+
clientY: R,
|
|
2359
|
+
deltaMode: w,
|
|
2360
|
+
ctrlKey: g,
|
|
2361
|
+
altKey: k,
|
|
2362
|
+
metaKey: P,
|
|
2363
|
+
target: M
|
|
2364
|
+
} = E;
|
|
2365
|
+
if (!(k || g && !tt()))
|
|
2366
|
+
if (tt() && !g)
|
|
2367
2367
|
ie.add(o, {
|
|
2368
2368
|
deltaX: -2 * x,
|
|
2369
|
-
deltaY: -2 *
|
|
2369
|
+
deltaY: -2 * v,
|
|
2370
2370
|
button: 1,
|
|
2371
|
-
ctrlKey:
|
|
2372
|
-
metaKey:
|
|
2373
|
-
target:
|
|
2374
|
-
event:
|
|
2371
|
+
ctrlKey: g,
|
|
2372
|
+
metaKey: P,
|
|
2373
|
+
target: M,
|
|
2374
|
+
event: E
|
|
2375
2375
|
});
|
|
2376
2376
|
else {
|
|
2377
|
-
if (l === void 0 || !
|
|
2377
|
+
if (l === void 0 || !v)
|
|
2378
2378
|
return;
|
|
2379
|
-
let
|
|
2380
|
-
switch (
|
|
2379
|
+
let $ = v;
|
|
2380
|
+
switch (w) {
|
|
2381
2381
|
case 1:
|
|
2382
|
-
|
|
2382
|
+
$ *= In;
|
|
2383
2383
|
break;
|
|
2384
2384
|
case 2:
|
|
2385
|
-
|
|
2385
|
+
$ *= On;
|
|
2386
2386
|
break;
|
|
2387
2387
|
}
|
|
2388
|
-
tt() && (
|
|
2388
|
+
tt() && ($ *= 2), ie.add(l, { scale: $, clientX: p, clientY: R, event: E });
|
|
2389
2389
|
}
|
|
2390
|
-
}, _ = (
|
|
2390
|
+
}, _ = (E) => {
|
|
2391
2391
|
const {
|
|
2392
2392
|
target: x,
|
|
2393
|
-
button:
|
|
2393
|
+
button: v,
|
|
2394
2394
|
clientX: p,
|
|
2395
|
-
clientY:
|
|
2396
|
-
pointerId:
|
|
2397
|
-
altKey:
|
|
2398
|
-
ctrlKey:
|
|
2399
|
-
metaKey:
|
|
2400
|
-
isPrimary:
|
|
2401
|
-
} =
|
|
2402
|
-
if (c.current.pointers[
|
|
2403
|
-
if (c.current.mainPointer !==
|
|
2395
|
+
clientY: R,
|
|
2396
|
+
pointerId: w,
|
|
2397
|
+
altKey: g,
|
|
2398
|
+
ctrlKey: k,
|
|
2399
|
+
metaKey: P,
|
|
2400
|
+
isPrimary: M
|
|
2401
|
+
} = E;
|
|
2402
|
+
if (c.current.pointers[w] = { clientX: p, clientY: R }, M && (c.current.mainPointer = void 0), c.current.mainPointer !== void 0) {
|
|
2403
|
+
if (c.current.mainPointer !== w)
|
|
2404
2404
|
try {
|
|
2405
|
-
const { clientX:
|
|
2405
|
+
const { clientX: $, clientY: B } = Vt(
|
|
2406
2406
|
c.current.pointers,
|
|
2407
|
-
|
|
2408
|
-
),
|
|
2409
|
-
[
|
|
2410
|
-
[p,
|
|
2407
|
+
w
|
|
2408
|
+
), N = ($ + p) / 2, K = (B + R) / 2, O = Ft(
|
|
2409
|
+
[$, B],
|
|
2410
|
+
[p, R]
|
|
2411
2411
|
);
|
|
2412
2412
|
Object.assign(c.current, {
|
|
2413
2413
|
pressed: !0,
|
|
2414
2414
|
moving: !1,
|
|
2415
2415
|
gestureStart: !1,
|
|
2416
2416
|
startX: p,
|
|
2417
|
-
startY:
|
|
2418
|
-
prevX:
|
|
2417
|
+
startY: R,
|
|
2418
|
+
prevX: N,
|
|
2419
2419
|
prevY: K,
|
|
2420
2420
|
startDistance: O,
|
|
2421
2421
|
prevDistance: O
|
|
2422
2422
|
});
|
|
2423
|
-
} catch (
|
|
2424
|
-
console.log("Error while getting other pointer. Ignoring",
|
|
2423
|
+
} catch ($) {
|
|
2424
|
+
console.log("Error while getting other pointer. Ignoring", $), c.current.mainPointer;
|
|
2425
2425
|
}
|
|
2426
2426
|
return;
|
|
2427
2427
|
}
|
|
2428
|
-
c.current.mainPointer =
|
|
2428
|
+
c.current.mainPointer = w, Object.assign(c.current, {
|
|
2429
2429
|
pressed: !0,
|
|
2430
2430
|
moving: !1,
|
|
2431
2431
|
gestureStart: !1,
|
|
2432
2432
|
startX: p,
|
|
2433
|
-
startY:
|
|
2433
|
+
startY: R,
|
|
2434
2434
|
prevX: p,
|
|
2435
|
-
prevY:
|
|
2436
|
-
currentButton:
|
|
2437
|
-
pointerDownEvent:
|
|
2435
|
+
prevY: R,
|
|
2436
|
+
currentButton: v,
|
|
2437
|
+
pointerDownEvent: E,
|
|
2438
2438
|
target: x,
|
|
2439
2439
|
timeStart: Date.now(),
|
|
2440
2440
|
longTapTimeout: setTimeout(async () => {
|
|
2441
2441
|
c.current.noTap = !0, ie.add(a, {
|
|
2442
2442
|
clientX: p,
|
|
2443
|
-
clientY:
|
|
2444
|
-
altKey:
|
|
2445
|
-
ctrlKey:
|
|
2446
|
-
metaKey:
|
|
2443
|
+
clientY: R,
|
|
2444
|
+
altKey: g,
|
|
2445
|
+
ctrlKey: k,
|
|
2446
|
+
metaKey: P,
|
|
2447
2447
|
target: x,
|
|
2448
|
-
event:
|
|
2448
|
+
event: E
|
|
2449
2449
|
});
|
|
2450
2450
|
}, 750)
|
|
2451
2451
|
});
|
|
2452
2452
|
try {
|
|
2453
|
-
x.setPointerCapture(
|
|
2454
|
-
} catch (
|
|
2455
|
-
console.log("Fail to capture pointer",
|
|
2453
|
+
x.setPointerCapture(w);
|
|
2454
|
+
} catch ($) {
|
|
2455
|
+
console.log("Fail to capture pointer", $);
|
|
2456
2456
|
}
|
|
2457
|
-
},
|
|
2457
|
+
}, C = (E) => {
|
|
2458
2458
|
if (c.current.pressed) {
|
|
2459
2459
|
const {
|
|
2460
2460
|
pointerId: x,
|
|
2461
|
-
clientX:
|
|
2461
|
+
clientX: v,
|
|
2462
2462
|
clientY: p,
|
|
2463
|
-
altKey:
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2463
|
+
altKey: R,
|
|
2464
|
+
shiftKey: w,
|
|
2465
|
+
ctrlKey: g,
|
|
2466
|
+
metaKey: k,
|
|
2467
|
+
buttons: P,
|
|
2468
|
+
pointerType: M
|
|
2469
|
+
} = E;
|
|
2469
2470
|
c.current.pointers[x] = {
|
|
2470
|
-
clientX:
|
|
2471
|
+
clientX: v,
|
|
2471
2472
|
clientY: p
|
|
2472
2473
|
}, c.current.moving = !0;
|
|
2473
|
-
const
|
|
2474
|
-
let
|
|
2475
|
-
if (
|
|
2476
|
-
const { clientX:
|
|
2474
|
+
const $ = Object.keys(c.current.pointers).length === 2;
|
|
2475
|
+
let B, N, K;
|
|
2476
|
+
if ($) {
|
|
2477
|
+
const { clientX: X, clientY: z } = Vt(
|
|
2477
2478
|
c.current.pointers,
|
|
2478
2479
|
x
|
|
2479
2480
|
);
|
|
2480
|
-
|
|
2481
|
-
[
|
|
2482
|
-
[
|
|
2481
|
+
B = (X + v) / 2, N = (z + p) / 2, K = Ft(
|
|
2482
|
+
[X, z],
|
|
2483
|
+
[v, p]
|
|
2483
2484
|
);
|
|
2484
2485
|
} else
|
|
2485
|
-
|
|
2486
|
-
let
|
|
2487
|
-
d !== "drag" && (
|
|
2488
|
-
const
|
|
2489
|
-
if (
|
|
2486
|
+
B = v, N = p;
|
|
2487
|
+
let O = w || R || g || k || P !== 1;
|
|
2488
|
+
d !== "drag" && (O = !O);
|
|
2489
|
+
const D = M !== "touch" ? !O : !$, A = M !== "touch" ? O : $;
|
|
2490
|
+
if (D) {
|
|
2490
2491
|
c.current.gestureStart || (f.current.style.cursor = "move", c.current.gestureStart = !0, clearTimeout(c.current.longTapTimeout), ie.add(r, {
|
|
2491
2492
|
deltaX: 0,
|
|
2492
2493
|
deltaY: 0,
|
|
@@ -2497,57 +2498,69 @@ const ie = new Pn(), We = ({
|
|
|
2497
2498
|
distanceX: 0,
|
|
2498
2499
|
distanceY: 0,
|
|
2499
2500
|
button: c.current.currentButton,
|
|
2500
|
-
altKey:
|
|
2501
|
-
|
|
2502
|
-
|
|
2501
|
+
altKey: R,
|
|
2502
|
+
shiftKey: w,
|
|
2503
|
+
ctrlKey: g,
|
|
2504
|
+
metaKey: k,
|
|
2503
2505
|
target: c.current.target,
|
|
2504
2506
|
event: c.current.pointerDownEvent
|
|
2505
2507
|
}));
|
|
2506
|
-
const
|
|
2508
|
+
const X = B - c.current.prevX, z = N - c.current.prevY, F = B - c.current.startX, H = N - c.current.startY;
|
|
2507
2509
|
ie.add(t, {
|
|
2508
|
-
deltaX:
|
|
2509
|
-
deltaY:
|
|
2510
|
+
deltaX: X,
|
|
2511
|
+
deltaY: z,
|
|
2510
2512
|
startX: c.current.startX,
|
|
2511
2513
|
startY: c.current.startY,
|
|
2512
|
-
clientX:
|
|
2514
|
+
clientX: B,
|
|
2513
2515
|
clientY: N,
|
|
2514
|
-
distanceX:
|
|
2515
|
-
distanceY:
|
|
2516
|
+
distanceX: F,
|
|
2517
|
+
distanceY: H,
|
|
2516
2518
|
button: c.current.currentButton,
|
|
2517
|
-
altKey:
|
|
2518
|
-
|
|
2519
|
-
|
|
2519
|
+
altKey: R,
|
|
2520
|
+
shiftKey: w,
|
|
2521
|
+
ctrlKey: g,
|
|
2522
|
+
metaKey: k,
|
|
2520
2523
|
target: c.current.target,
|
|
2521
|
-
event:
|
|
2524
|
+
event: E
|
|
2522
2525
|
});
|
|
2523
2526
|
}
|
|
2524
|
-
if (
|
|
2527
|
+
if (A) {
|
|
2525
2528
|
c.current.gestureStart || (f.current.style.cursor = "move", c.current.gestureStart = !0, clearTimeout(c.current.longTapTimeout));
|
|
2526
|
-
const
|
|
2529
|
+
const X = B - c.current.prevX, z = N - c.current.prevY, { target: F } = c.current;
|
|
2527
2530
|
if (ie.add(o, {
|
|
2528
|
-
deltaX:
|
|
2529
|
-
deltaY:
|
|
2531
|
+
deltaX: X,
|
|
2532
|
+
deltaY: z,
|
|
2530
2533
|
button: c.current.currentButton,
|
|
2531
|
-
altKey:
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2534
|
+
altKey: R,
|
|
2535
|
+
shiftKey: w,
|
|
2536
|
+
ctrlKey: g,
|
|
2537
|
+
metaKey: k,
|
|
2538
|
+
target: F,
|
|
2539
|
+
event: E
|
|
2540
|
+
}), K !== c.current.prevDistance && l) {
|
|
2541
|
+
const H = c.current.prevDistance - K;
|
|
2542
|
+
Math.abs(H) > 0 && (ie.add(l, {
|
|
2543
|
+
scale: H * 3,
|
|
2544
|
+
clientX: B,
|
|
2541
2545
|
clientY: N,
|
|
2542
|
-
event:
|
|
2543
|
-
}), c.current.prevDistance =
|
|
2546
|
+
event: E
|
|
2547
|
+
}), c.current.prevDistance = K);
|
|
2544
2548
|
}
|
|
2545
2549
|
}
|
|
2546
|
-
c.current.prevX =
|
|
2550
|
+
c.current.prevX = B, c.current.prevY = N;
|
|
2547
2551
|
}
|
|
2548
|
-
},
|
|
2549
|
-
const {
|
|
2550
|
-
|
|
2552
|
+
}, h = (E) => {
|
|
2553
|
+
const {
|
|
2554
|
+
clientX: x,
|
|
2555
|
+
clientY: v,
|
|
2556
|
+
altKey: p,
|
|
2557
|
+
shiftKey: R,
|
|
2558
|
+
ctrlKey: w,
|
|
2559
|
+
metaKey: g,
|
|
2560
|
+
target: k,
|
|
2561
|
+
pointerId: P
|
|
2562
|
+
} = E;
|
|
2563
|
+
if (c.current.pointers[P] && (delete c.current.pointers[P], c.current.mainPointer === P)) {
|
|
2551
2564
|
for (; Object.keys(c.current.pointers).length > 0; ) {
|
|
2552
2565
|
c.current.mainPointer = Number(
|
|
2553
2566
|
Object.keys(c.current.pointers)[0]
|
|
@@ -2555,36 +2568,38 @@ const ie = new Pn(), We = ({
|
|
|
2555
2568
|
try {
|
|
2556
2569
|
c.current.target.setPointerCapture(c.current.mainPointer);
|
|
2557
2570
|
return;
|
|
2558
|
-
} catch (
|
|
2559
|
-
console.log("Fails to set pointer capture",
|
|
2571
|
+
} catch (M) {
|
|
2572
|
+
console.log("Fails to set pointer capture", M), c.current.mainPointer = void 0, delete c.current.pointers[Object.keys(c.current.pointers)[0]];
|
|
2560
2573
|
}
|
|
2561
2574
|
}
|
|
2562
2575
|
if (c.current.mainPointer = void 0, c.current.pressed = !1, clearTimeout(c.current.longTapTimeout), c.current.moving)
|
|
2563
2576
|
c.current.moving = !1, ie.add(n, {
|
|
2564
2577
|
deltaX: x - c.current.prevX,
|
|
2565
|
-
deltaY:
|
|
2578
|
+
deltaY: v - c.current.prevY,
|
|
2566
2579
|
startX: c.current.startX,
|
|
2567
2580
|
startY: c.current.startY,
|
|
2568
2581
|
clientX: x,
|
|
2569
|
-
clientY:
|
|
2582
|
+
clientY: v,
|
|
2570
2583
|
distanceX: x - c.current.startX,
|
|
2571
|
-
distanceY:
|
|
2584
|
+
distanceY: v - c.current.startY,
|
|
2572
2585
|
button: c.current.currentButton,
|
|
2573
2586
|
altKey: p,
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2587
|
+
shiftKey: R,
|
|
2588
|
+
ctrlKey: w,
|
|
2589
|
+
metaKey: g,
|
|
2590
|
+
event: E
|
|
2577
2591
|
}), f.current.style.cursor = "auto";
|
|
2578
2592
|
else {
|
|
2579
|
-
const
|
|
2580
|
-
c.current.noTap ? c.current.noTap = !1 : c.current.timeStart -
|
|
2593
|
+
const M = Date.now();
|
|
2594
|
+
c.current.noTap ? c.current.noTap = !1 : c.current.timeStart - M < 300 && ie.add(s, {
|
|
2581
2595
|
clientX: x,
|
|
2582
|
-
clientY:
|
|
2596
|
+
clientY: v,
|
|
2583
2597
|
altKey: p,
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2598
|
+
shiftKey: R,
|
|
2599
|
+
ctrlKey: w,
|
|
2600
|
+
metaKey: g,
|
|
2601
|
+
target: k,
|
|
2602
|
+
event: E
|
|
2588
2603
|
});
|
|
2589
2604
|
}
|
|
2590
2605
|
}
|
|
@@ -2594,21 +2609,22 @@ const ie = new Pn(), We = ({
|
|
|
2594
2609
|
{
|
|
2595
2610
|
onWheel: b,
|
|
2596
2611
|
onPointerDown: _,
|
|
2597
|
-
onPointerMove:
|
|
2598
|
-
onPointerUp:
|
|
2599
|
-
onPointerOut:
|
|
2600
|
-
onPointerLeave:
|
|
2601
|
-
onPointerCancel:
|
|
2602
|
-
onDoubleClick: (
|
|
2603
|
-
const { clientX: x, clientY:
|
|
2612
|
+
onPointerMove: C,
|
|
2613
|
+
onPointerUp: h,
|
|
2614
|
+
onPointerOut: h,
|
|
2615
|
+
onPointerLeave: h,
|
|
2616
|
+
onPointerCancel: h,
|
|
2617
|
+
onDoubleClick: (E) => {
|
|
2618
|
+
const { clientX: x, clientY: v, altKey: p, shiftKey: R, ctrlKey: w, metaKey: g, target: k } = E;
|
|
2604
2619
|
ie.add(u, {
|
|
2605
2620
|
clientX: x,
|
|
2606
|
-
clientY:
|
|
2621
|
+
clientY: v,
|
|
2607
2622
|
altKey: p,
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2623
|
+
shiftKey: R,
|
|
2624
|
+
ctrlKey: w,
|
|
2625
|
+
metaKey: g,
|
|
2626
|
+
target: k,
|
|
2627
|
+
event: E
|
|
2612
2628
|
});
|
|
2613
2629
|
},
|
|
2614
2630
|
style: { touchAction: "none" },
|
|
@@ -2627,11 +2643,11 @@ const ie = new Pn(), We = ({
|
|
|
2627
2643
|
});
|
|
2628
2644
|
}, children: /* @__PURE__ */ T("div", { ...t }) });
|
|
2629
2645
|
};
|
|
2630
|
-
let Mn = { data: "" }, jn = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || Mn, Dn = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, $n = /\/\*[^]*?\*\/| +/g, Kt = /\n+/g,
|
|
2646
|
+
let Mn = { data: "" }, jn = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || Mn, Dn = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, $n = /\/\*[^]*?\*\/| +/g, Kt = /\n+/g, de = (e, t) => {
|
|
2631
2647
|
let r = "", n = "", o = "";
|
|
2632
2648
|
for (let s in e) {
|
|
2633
2649
|
let a = e[s];
|
|
2634
|
-
s[0] == "@" ? s[1] == "i" ? r = s + " " + a + ";" : n += s[1] == "f" ?
|
|
2650
|
+
s[0] == "@" ? s[1] == "i" ? r = s + " " + a + ";" : n += s[1] == "f" ? de(a, s) : s + "{" + de(a, s[1] == "k" ? "" : t) + "}" : typeof a == "object" ? n += de(a, t ? t.replace(/([^,])+/g, (u) => s.replace(/(^:.*)|([^,])+/g, (l) => /&/.test(l) ? l.replace(/&/g, u) : u ? u + " " + l : l)) : s) : a != null && (s = /^--/.test(s) ? s : s.replace(/[A-Z]/g, "-$&").toLowerCase(), o += de.p ? de.p(s, a) : s + ":" + a + ";");
|
|
2635
2651
|
}
|
|
2636
2652
|
return r + (t && o ? t + "{" + o + "}" : o) + n;
|
|
2637
2653
|
}, ce = {}, lr = (e) => {
|
|
@@ -2656,28 +2672,28 @@ let Mn = { data: "" }, jn = (e) => typeof window == "object" ? ((e ? e.querySele
|
|
|
2656
2672
|
f[4] ? b.shift() : f[3] ? (c = f[3].replace(Kt, " ").trim(), b.unshift(b[0][c] = b[0][c] || {})) : b[0][f[1]] = f[2].replace(Kt, " ").trim();
|
|
2657
2673
|
return b[0];
|
|
2658
2674
|
})(e);
|
|
2659
|
-
ce[a] =
|
|
2675
|
+
ce[a] = de(o ? { ["@keyframes " + a]: l } : l, r ? "" : "." + a);
|
|
2660
2676
|
}
|
|
2661
2677
|
let u = r && ce.g ? ce.g : null;
|
|
2662
2678
|
return r && (ce.g = ce[a]), ((l, d, f, c) => {
|
|
2663
2679
|
c ? d.data = d.data.replace(c, l) : d.data.indexOf(l) === -1 && (d.data = f ? l + d.data : d.data + l);
|
|
2664
2680
|
})(ce[a], t, n, u), a;
|
|
2665
|
-
},
|
|
2681
|
+
}, Ln = (e, t, r) => e.reduce((n, o, s) => {
|
|
2666
2682
|
let a = t[s];
|
|
2667
2683
|
if (a && a.call) {
|
|
2668
2684
|
let u = a(r), l = u && u.props && u.props.className || /^go/.test(u) && u;
|
|
2669
|
-
a = l ? "." + l : u && typeof u == "object" ? u.props ? "" :
|
|
2685
|
+
a = l ? "." + l : u && typeof u == "object" ? u.props ? "" : de(u, "") : u === !1 ? "" : u;
|
|
2670
2686
|
}
|
|
2671
2687
|
return n + o + (a ?? "");
|
|
2672
2688
|
}, "");
|
|
2673
|
-
function
|
|
2689
|
+
function q(e) {
|
|
2674
2690
|
let t = this || {}, r = e.call ? e(t.p) : e;
|
|
2675
|
-
return An(r.unshift ? r.raw ?
|
|
2691
|
+
return An(r.unshift ? r.raw ? Ln(r, [].slice.call(arguments, 1), t.p) : r.reduce((n, o) => Object.assign(n, o && o.call ? o(t.p) : o), {}) : r, jn(t.target), t.g, t.o, t.k);
|
|
2676
2692
|
}
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
function
|
|
2680
|
-
|
|
2693
|
+
q.bind({ g: 1 });
|
|
2694
|
+
q.bind({ k: 1 });
|
|
2695
|
+
function zn(e, t, r, n) {
|
|
2696
|
+
de.p = t;
|
|
2681
2697
|
}
|
|
2682
2698
|
var Yn = function e(t, r) {
|
|
2683
2699
|
if (t === r)
|
|
@@ -2714,36 +2730,36 @@ var Yn = function e(t, r) {
|
|
|
2714
2730
|
}
|
|
2715
2731
|
return t !== t && r !== r;
|
|
2716
2732
|
};
|
|
2717
|
-
const Bn =
|
|
2733
|
+
const Bn = q`
|
|
2718
2734
|
display: inline-block;
|
|
2719
2735
|
transition: transform 150ms;
|
|
2720
2736
|
user-select: none;
|
|
2721
2737
|
padding: 2px;
|
|
2722
2738
|
box-sizing: border-box;
|
|
2723
|
-
`, Nn =
|
|
2739
|
+
`, Nn = q`
|
|
2724
2740
|
border: 2px dashed #db5034;
|
|
2725
2741
|
padding: 0px;
|
|
2726
2742
|
cursor: pointer;
|
|
2727
|
-
`, xe =
|
|
2743
|
+
`, xe = q`
|
|
2728
2744
|
position: absolute;
|
|
2729
2745
|
width: 0px;
|
|
2730
2746
|
height: 0px;
|
|
2731
|
-
`, Un =
|
|
2747
|
+
`, Un = q`
|
|
2732
2748
|
top: 0;
|
|
2733
2749
|
left: 0;
|
|
2734
|
-
`, Xn =
|
|
2750
|
+
`, Xn = q`
|
|
2735
2751
|
top: 0;
|
|
2736
2752
|
right: 0;
|
|
2737
|
-
`, Wn =
|
|
2753
|
+
`, Wn = q`
|
|
2738
2754
|
bottom: 0;
|
|
2739
2755
|
left: 0;
|
|
2740
|
-
`, Vn =
|
|
2756
|
+
`, Vn = q`
|
|
2741
2757
|
bottom: 0;
|
|
2742
2758
|
right: 0;
|
|
2743
|
-
`, Fn =
|
|
2759
|
+
`, Fn = q`
|
|
2744
2760
|
top: 50%;
|
|
2745
2761
|
left: 50%;
|
|
2746
|
-
`, nt =
|
|
2762
|
+
`, nt = q`
|
|
2747
2763
|
position: absolute;
|
|
2748
2764
|
|
|
2749
2765
|
width: 10px;
|
|
@@ -2751,22 +2767,22 @@ const Bn = H`
|
|
|
2751
2767
|
border: 2px solid #db5034;
|
|
2752
2768
|
background-color: #db5034;
|
|
2753
2769
|
cursor: move;
|
|
2754
|
-
`, Kn =
|
|
2770
|
+
`, Kn = q`
|
|
2755
2771
|
cursor: ew-resize;
|
|
2756
2772
|
right: -6px;
|
|
2757
2773
|
top: calc(50% - 5px);
|
|
2758
|
-
`, Hn =
|
|
2774
|
+
`, Hn = q`
|
|
2759
2775
|
cursor: ns-resize;
|
|
2760
2776
|
bottom: -6px;
|
|
2761
2777
|
left: calc(50% - 5px);
|
|
2762
|
-
`, qn =
|
|
2778
|
+
`, qn = q`
|
|
2763
2779
|
cursor: nwse-resize;
|
|
2764
2780
|
bottom: -6px;
|
|
2765
2781
|
right: -6px;
|
|
2766
|
-
`, Gn = ({ onReload: e }) => /* @__PURE__ */
|
|
2782
|
+
`, Gn = ({ onReload: e }) => /* @__PURE__ */ le(
|
|
2767
2783
|
"div",
|
|
2768
2784
|
{
|
|
2769
|
-
className: `syncboard-error-item ${
|
|
2785
|
+
className: `syncboard-error-item ${q({
|
|
2770
2786
|
width: "100px",
|
|
2771
2787
|
display: "flex",
|
|
2772
2788
|
flexDirection: "column",
|
|
@@ -2780,7 +2796,7 @@ const Bn = H`
|
|
|
2780
2796
|
]
|
|
2781
2797
|
}
|
|
2782
2798
|
);
|
|
2783
|
-
class Jn extends
|
|
2799
|
+
class Jn extends m.Component {
|
|
2784
2800
|
constructor(t) {
|
|
2785
2801
|
super(t), this.state = { hasError: !1, itemId: t.itemId }, this.onReload = this.onReload.bind(this);
|
|
2786
2802
|
}
|
|
@@ -2841,61 +2857,61 @@ const Zn = (e) => {
|
|
|
2841
2857
|
itemMap: d,
|
|
2842
2858
|
showResizeHandle: f = !0
|
|
2843
2859
|
}) => {
|
|
2844
|
-
var
|
|
2845
|
-
const c =
|
|
2860
|
+
var w;
|
|
2861
|
+
const c = m.useRef(null), {
|
|
2846
2862
|
component: b = () => null,
|
|
2847
2863
|
resizeDirections: _ = eo,
|
|
2848
|
-
resize:
|
|
2849
|
-
} = d[t],
|
|
2850
|
-
(
|
|
2864
|
+
resize: C = Qn
|
|
2865
|
+
} = d[t], h = m.useCallback(
|
|
2866
|
+
(g) => e(n, g),
|
|
2851
2867
|
[e, n]
|
|
2852
2868
|
);
|
|
2853
|
-
|
|
2869
|
+
m.useEffect(() => {
|
|
2854
2870
|
c.current.className = u;
|
|
2855
2871
|
}, [u]);
|
|
2856
|
-
const
|
|
2857
|
-
o &&
|
|
2858
|
-
const
|
|
2859
|
-
|
|
2860
|
-
const { offsetWidth:
|
|
2861
|
-
return
|
|
2862
|
-
prevState:
|
|
2863
|
-
width:
|
|
2864
|
-
height:
|
|
2865
|
-
actualHeight:
|
|
2866
|
-
actualWidth:
|
|
2867
|
-
keepRatio:
|
|
2872
|
+
const S = ["item", n, Bn];
|
|
2873
|
+
o && S.push("locked"), l && (S.push("selected"), S.push(Nn));
|
|
2874
|
+
const E = S.join(" "), x = ({ width: g = 0, height: k = 0, keepRatio: P }) => {
|
|
2875
|
+
h((M) => {
|
|
2876
|
+
const { offsetWidth: $, offsetHeight: B } = c.current;
|
|
2877
|
+
return C({
|
|
2878
|
+
prevState: M,
|
|
2879
|
+
width: g,
|
|
2880
|
+
height: k,
|
|
2881
|
+
actualHeight: B,
|
|
2882
|
+
actualWidth: $,
|
|
2883
|
+
keepRatio: P
|
|
2868
2884
|
});
|
|
2869
2885
|
});
|
|
2870
|
-
},
|
|
2871
|
-
x({ width:
|
|
2872
|
-
}, p = ({ height:
|
|
2873
|
-
x({ height:
|
|
2874
|
-
},
|
|
2875
|
-
x({ height:
|
|
2886
|
+
}, v = ({ width: g }) => {
|
|
2887
|
+
x({ width: g });
|
|
2888
|
+
}, p = ({ height: g }) => {
|
|
2889
|
+
x({ height: g });
|
|
2890
|
+
}, R = ({ width: g }) => {
|
|
2891
|
+
x({ height: g, width: g, keepRatio: !0 });
|
|
2876
2892
|
};
|
|
2877
2893
|
return /* @__PURE__ */ T(
|
|
2878
2894
|
"div",
|
|
2879
2895
|
{
|
|
2880
2896
|
style: { transform: `rotate(${r}deg` },
|
|
2881
2897
|
"data-id": n,
|
|
2882
|
-
className:
|
|
2883
|
-
children: /* @__PURE__ */
|
|
2898
|
+
className: E,
|
|
2899
|
+
children: /* @__PURE__ */ le(
|
|
2884
2900
|
"div",
|
|
2885
2901
|
{
|
|
2886
2902
|
style: { display: "flex" },
|
|
2887
2903
|
ref: c,
|
|
2888
2904
|
onAnimationEnd: Zn,
|
|
2889
|
-
onKeyDown: (
|
|
2890
|
-
onKeyUp: (
|
|
2905
|
+
onKeyDown: (g) => g.stopPropagation(),
|
|
2906
|
+
onKeyUp: (g) => g.stopPropagation(),
|
|
2891
2907
|
children: [
|
|
2892
2908
|
/* @__PURE__ */ T(
|
|
2893
2909
|
Jn,
|
|
2894
2910
|
{
|
|
2895
2911
|
itemId: n,
|
|
2896
2912
|
state: a,
|
|
2897
|
-
ErrorComponent: ((
|
|
2898
|
-
children: /* @__PURE__ */ T(b, { ...a, id: n, setState:
|
|
2913
|
+
ErrorComponent: ((w = d == null ? void 0 : d.error) == null ? void 0 : w.component) || Gn,
|
|
2914
|
+
children: /* @__PURE__ */ T(b, { ...a, id: n, setState: h })
|
|
2899
2915
|
}
|
|
2900
2916
|
),
|
|
2901
2917
|
/* @__PURE__ */ T("div", { className: `corner ${xe} ${Un}` }),
|
|
@@ -2903,12 +2919,12 @@ const Zn = (e) => {
|
|
|
2903
2919
|
/* @__PURE__ */ T("div", { className: `corner ${xe} ${Vn}` }),
|
|
2904
2920
|
/* @__PURE__ */ T("div", { className: `corner ${xe} ${Wn}` }),
|
|
2905
2921
|
/* @__PURE__ */ T("div", { className: `${xe} ${Fn}` }),
|
|
2906
|
-
f && /* @__PURE__ */
|
|
2922
|
+
f && /* @__PURE__ */ le(Qt, { children: [
|
|
2907
2923
|
_.b && /* @__PURE__ */ T(
|
|
2908
2924
|
rt,
|
|
2909
2925
|
{
|
|
2910
2926
|
className: `${nt} ${qn}`,
|
|
2911
|
-
onResize:
|
|
2927
|
+
onResize: R
|
|
2912
2928
|
}
|
|
2913
2929
|
),
|
|
2914
2930
|
_.h && /* @__PURE__ */ T(
|
|
@@ -2922,7 +2938,7 @@ const Zn = (e) => {
|
|
|
2922
2938
|
rt,
|
|
2923
2939
|
{
|
|
2924
2940
|
className: `${nt} ${Kn}`,
|
|
2925
|
-
onResize:
|
|
2941
|
+
onResize: v
|
|
2926
2942
|
}
|
|
2927
2943
|
)
|
|
2928
2944
|
] })
|
|
@@ -2983,7 +2999,7 @@ const Zn = (e) => {
|
|
|
2983
2999
|
d.config.itemTemplates,
|
|
2984
3000
|
d.selection
|
|
2985
3001
|
]
|
|
2986
|
-
), [u] = ge((d) => [d.getUser]), l =
|
|
3002
|
+
), [u] = ge((d) => [d.getUser]), l = q({
|
|
2987
3003
|
position: "absolute",
|
|
2988
3004
|
top: `${n / 2}px`,
|
|
2989
3005
|
left: `${n / 2}px`,
|
|
@@ -3003,21 +3019,57 @@ const Zn = (e) => {
|
|
|
3003
3019
|
},
|
|
3004
3020
|
d
|
|
3005
3021
|
));
|
|
3006
|
-
}
|
|
3022
|
+
};
|
|
3023
|
+
function ao(e = !1) {
|
|
3024
|
+
const t = Ie(e), r = Jt(() => t.current, []);
|
|
3025
|
+
return Me(() => (t.current = !0, () => {
|
|
3026
|
+
t.current = !1;
|
|
3027
|
+
}), []), r;
|
|
3028
|
+
}
|
|
3029
|
+
function co(e, ...t) {
|
|
3030
|
+
e && e.addEventListener && e.addEventListener(...t);
|
|
3031
|
+
}
|
|
3032
|
+
function uo(e, ...t) {
|
|
3033
|
+
e && e.removeEventListener && e.removeEventListener(...t);
|
|
3034
|
+
}
|
|
3035
|
+
const lo = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
|
|
3036
|
+
function ue(e, ...t) {
|
|
3037
|
+
const r = ao(), n = lt(t[1]), o = ct(
|
|
3038
|
+
() => (
|
|
3039
|
+
// as some event listeners designed to be used through `this`
|
|
3040
|
+
// it is better to make listener a conventional function as it
|
|
3041
|
+
// infers call context
|
|
3042
|
+
// eslint-disable-next-line func-names
|
|
3043
|
+
function(...s) {
|
|
3044
|
+
r() && (typeof n.current == "function" ? n.current.apply(this, s) : typeof n.current.handleEvent == "function" && n.current.handleEvent.apply(this, s));
|
|
3045
|
+
}
|
|
3046
|
+
),
|
|
3047
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3048
|
+
[]
|
|
3049
|
+
);
|
|
3050
|
+
Me(() => {
|
|
3051
|
+
const s = e && lo(e, "current") ? e.current : e;
|
|
3052
|
+
if (!s)
|
|
3053
|
+
return;
|
|
3054
|
+
const a = t.slice(2);
|
|
3055
|
+
return co(s, t[0], o, ...a), () => uo(s, t[0], o, ...a);
|
|
3056
|
+
}, [e, t[0]]);
|
|
3057
|
+
}
|
|
3058
|
+
const fo = q({
|
|
3007
3059
|
zIndex: 210,
|
|
3008
3060
|
position: "absolute",
|
|
3009
3061
|
backgroundColor: "hsla(0, 40%, 50%, 10%)",
|
|
3010
3062
|
border: "2px solid hsl(0, 55%, 40%)"
|
|
3011
|
-
}),
|
|
3012
|
-
const
|
|
3013
|
-
if (!
|
|
3063
|
+
}), po = (e, t, r = !1) => {
|
|
3064
|
+
const n = t.getElementsByClassName("selector");
|
|
3065
|
+
if (!n.length)
|
|
3014
3066
|
return [];
|
|
3015
|
-
const
|
|
3016
|
-
return Array.from(t.getElementsByClassName("item")).filter((
|
|
3017
|
-
const
|
|
3018
|
-
return !
|
|
3019
|
-
}).map((
|
|
3020
|
-
},
|
|
3067
|
+
const o = n[0];
|
|
3068
|
+
return Array.from(t.getElementsByClassName("item")).filter((s) => {
|
|
3069
|
+
const a = ke(s), u = e[a];
|
|
3070
|
+
return !u || !r && u.locked ? !1 : en(s, o);
|
|
3071
|
+
}).map((s) => ke(s));
|
|
3072
|
+
}, mo = ({ children: e, moveFirst: t }) => {
|
|
3021
3073
|
const [
|
|
3022
3074
|
r,
|
|
3023
3075
|
n,
|
|
@@ -3026,68 +3078,72 @@ const Zn = (e) => {
|
|
|
3026
3078
|
a,
|
|
3027
3079
|
u,
|
|
3028
3080
|
l
|
|
3029
|
-
] = Z((
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
]), { findElementUnderPointer: d } = pt(), [f] = se((
|
|
3081
|
+
] = Z((g) => [
|
|
3082
|
+
g.getSelection,
|
|
3083
|
+
g.clear,
|
|
3084
|
+
g.setSelection,
|
|
3085
|
+
g.select,
|
|
3086
|
+
g.getConfiguration,
|
|
3087
|
+
g.getBoardState,
|
|
3088
|
+
g.updateBoardState
|
|
3089
|
+
]), { findElementUnderPointer: d } = pt(), [f] = se((g) => [g.getItems]), [c, b] = m.useState({}), [, _] = m.useTransition(), [C, h] = m.useState(!1), S = m.useRef(null), E = m.useRef({
|
|
3038
3090
|
moving: !1
|
|
3039
3091
|
});
|
|
3040
|
-
return
|
|
3092
|
+
return ue(document, "keydown", (g) => {
|
|
3093
|
+
g.key === "l" && h(!0);
|
|
3094
|
+
}), ue(document, "keyup", (g) => {
|
|
3095
|
+
g.key === "l" && h(!1);
|
|
3096
|
+
}), m.useEffect(() => (n(), () => {
|
|
3041
3097
|
n();
|
|
3042
|
-
}), [n]),
|
|
3043
|
-
if (
|
|
3044
|
-
const
|
|
3098
|
+
}), [n]), m.useEffect(() => {
|
|
3099
|
+
if (E.current.moving) {
|
|
3100
|
+
const g = f(), { boardWrapper: k } = a(), P = po(g, k, C);
|
|
3045
3101
|
_(() => {
|
|
3046
|
-
o(
|
|
3102
|
+
o(P);
|
|
3047
3103
|
});
|
|
3048
3104
|
}
|
|
3049
|
-
}, [a, f, c, o]), /* @__PURE__ */ T(
|
|
3105
|
+
}, [a, f, c, o, C]), /* @__PURE__ */ T(
|
|
3050
3106
|
We,
|
|
3051
3107
|
{
|
|
3052
|
-
onDragStart: async (
|
|
3053
|
-
await d(
|
|
3108
|
+
onDragStart: async (g) => {
|
|
3109
|
+
await d(g) || (E.current.moving = !0, _(() => {
|
|
3054
3110
|
l({ selecting: !0 });
|
|
3055
|
-
}),
|
|
3111
|
+
}), S.current.style.cursor = "crosshair");
|
|
3056
3112
|
},
|
|
3057
|
-
onDrag: ({ distanceY:
|
|
3058
|
-
if (
|
|
3059
|
-
const { top:
|
|
3060
|
-
|
|
3113
|
+
onDrag: ({ distanceY: g, distanceX: k, startX: P, startY: M }) => {
|
|
3114
|
+
if (E.current.moving) {
|
|
3115
|
+
const { top: $, left: B } = S.current.getBoundingClientRect(), { scale: N } = u(), K = (P - B) / N, O = (M - $) / N, D = k / N, A = g / N;
|
|
3116
|
+
D > 0 ? (E.current.left = K, E.current.width = D) : (E.current.left = K + D, E.current.width = -D), A > 0 ? (E.current.top = O, E.current.height = A) : (E.current.top = O + A, E.current.height = -A), b({ ...E.current, moving: !0 });
|
|
3061
3117
|
}
|
|
3062
3118
|
},
|
|
3063
3119
|
onDragEnd: () => {
|
|
3064
|
-
|
|
3120
|
+
E.current.moving && (_(() => {
|
|
3065
3121
|
l({ selecting: !1 });
|
|
3066
|
-
}),
|
|
3122
|
+
}), E.current.moving = !1, b({ moving: !1 }), S.current.style.cursor = "auto");
|
|
3067
3123
|
},
|
|
3068
|
-
onTap: (
|
|
3069
|
-
const { target:
|
|
3070
|
-
if (
|
|
3124
|
+
onTap: (g) => {
|
|
3125
|
+
const { target: k, ctrlKey: P, metaKey: M } = g, $ = d(g);
|
|
3126
|
+
if (!$ && Te(k, "board"))
|
|
3071
3127
|
n();
|
|
3072
3128
|
else {
|
|
3073
|
-
const
|
|
3074
|
-
if (!
|
|
3129
|
+
const B = ke($);
|
|
3130
|
+
if (!B) {
|
|
3075
3131
|
n();
|
|
3076
3132
|
return;
|
|
3077
3133
|
}
|
|
3078
|
-
const
|
|
3079
|
-
|
|
3134
|
+
const N = r();
|
|
3135
|
+
$ && !N.includes(B) && (P || M ? s([B]) : o([B]));
|
|
3080
3136
|
}
|
|
3081
3137
|
},
|
|
3082
|
-
onLongTap: ({ target:
|
|
3083
|
-
const
|
|
3084
|
-
if (
|
|
3085
|
-
const
|
|
3086
|
-
o([
|
|
3138
|
+
onLongTap: ({ target: g }) => {
|
|
3139
|
+
const k = Te(g, "item");
|
|
3140
|
+
if (k) {
|
|
3141
|
+
const P = ke(k);
|
|
3142
|
+
o([P]);
|
|
3087
3143
|
}
|
|
3088
3144
|
},
|
|
3089
3145
|
mainAction: t ? "pan" : "drag",
|
|
3090
|
-
children: /* @__PURE__ */
|
|
3146
|
+
children: /* @__PURE__ */ le("div", { ref: S, children: [
|
|
3091
3147
|
c.moving && /* @__PURE__ */ T(
|
|
3092
3148
|
"div",
|
|
3093
3149
|
{
|
|
@@ -3096,106 +3152,70 @@ const Zn = (e) => {
|
|
|
3096
3152
|
height: `${c.height}px`,
|
|
3097
3153
|
width: `${c.width}px`
|
|
3098
3154
|
},
|
|
3099
|
-
className: `selector ${
|
|
3155
|
+
className: `selector ${fo}`
|
|
3100
3156
|
}
|
|
3101
3157
|
),
|
|
3102
3158
|
e
|
|
3103
3159
|
] })
|
|
3104
3160
|
}
|
|
3105
3161
|
);
|
|
3106
|
-
}
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
e && e.addEventListener && e.addEventListener(...t);
|
|
3115
|
-
}
|
|
3116
|
-
function po(e, ...t) {
|
|
3117
|
-
e && e.removeEventListener && e.removeEventListener(...t);
|
|
3118
|
-
}
|
|
3119
|
-
const mo = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
|
|
3120
|
-
function pe(e, ...t) {
|
|
3121
|
-
const r = lo(), n = lt(t[1]), o = ct(
|
|
3122
|
-
() => (
|
|
3123
|
-
// as some event listeners designed to be used through `this`
|
|
3124
|
-
// it is better to make listener a conventional function as it
|
|
3125
|
-
// infers call context
|
|
3126
|
-
// eslint-disable-next-line func-names
|
|
3127
|
-
function(...s) {
|
|
3128
|
-
r() && (typeof n.current == "function" ? n.current.apply(this, s) : typeof n.current.handleEvent == "function" && n.current.handleEvent.apply(this, s));
|
|
3129
|
-
}
|
|
3130
|
-
),
|
|
3131
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3132
|
-
[]
|
|
3133
|
-
);
|
|
3134
|
-
Me(() => {
|
|
3135
|
-
const s = e && mo(e, "current") ? e.current : e;
|
|
3136
|
-
if (!s)
|
|
3137
|
-
return;
|
|
3138
|
-
const a = t.slice(2);
|
|
3139
|
-
return fo(s, t[0], o, ...a), () => po(s, t[0], o, ...a);
|
|
3140
|
-
}, [e, t[0]]);
|
|
3141
|
-
}
|
|
3142
|
-
const go = ({ children: e }) => {
|
|
3143
|
-
const { moveItems: t, placeItems: r, findElementUnderPointer: n } = pt(), [o, s, a, u, l] = Z((E) => [
|
|
3144
|
-
E.select,
|
|
3145
|
-
E.setSelection,
|
|
3146
|
-
E.getSelection,
|
|
3147
|
-
E.getBoardState,
|
|
3148
|
-
E.updateBoardState
|
|
3149
|
-
]), [d] = se((E) => [E.getBoardConfig]), f = g.useRef({}), c = g.useRef({
|
|
3162
|
+
}, go = ({ children: e }) => {
|
|
3163
|
+
const { moveItems: t, placeItems: r, findElementUnderPointer: n } = pt(), [o, s, a, u, l] = Z((S) => [
|
|
3164
|
+
S.select,
|
|
3165
|
+
S.setSelection,
|
|
3166
|
+
S.getSelection,
|
|
3167
|
+
S.getBoardState,
|
|
3168
|
+
S.updateBoardState
|
|
3169
|
+
]), [d] = se((S) => [S.getBoardConfig]), f = m.useRef({}), c = m.useRef({
|
|
3150
3170
|
items: []
|
|
3151
|
-
}), b = (
|
|
3152
|
-
const { ctrlKey:
|
|
3171
|
+
}), b = (S) => {
|
|
3172
|
+
const { ctrlKey: E, metaKey: x, event: v } = S, p = n(S);
|
|
3153
3173
|
if (p) {
|
|
3154
|
-
|
|
3155
|
-
const
|
|
3156
|
-
c.current.items =
|
|
3157
|
-
const
|
|
3158
|
-
|
|
3174
|
+
v.stopPropagation();
|
|
3175
|
+
const R = a();
|
|
3176
|
+
c.current.items = R;
|
|
3177
|
+
const w = ke(p);
|
|
3178
|
+
R.includes(w) || (E || x ? (c.current.items = [...R, w], o([w])) : (c.current.items = [w], s([w]))), Object.assign(f.current, {
|
|
3159
3179
|
moving: !0,
|
|
3160
3180
|
remainX: 0,
|
|
3161
3181
|
remainY: 0
|
|
3162
3182
|
});
|
|
3163
3183
|
}
|
|
3164
|
-
}, _ = ({ deltaX:
|
|
3184
|
+
}, _ = ({ deltaX: S, deltaY: E, event: x }) => {
|
|
3165
3185
|
if (f.current.moving) {
|
|
3166
3186
|
x.stopPropagation();
|
|
3167
|
-
const { scale:
|
|
3187
|
+
const { scale: v } = u(), p = f.current.remainX + S / v, R = f.current.remainY + E / v;
|
|
3168
3188
|
t(
|
|
3169
3189
|
c.current.items,
|
|
3170
3190
|
{
|
|
3171
3191
|
x: p,
|
|
3172
|
-
y:
|
|
3192
|
+
y: R
|
|
3173
3193
|
},
|
|
3174
3194
|
!0
|
|
3175
3195
|
), l({ movingItems: !0 });
|
|
3176
3196
|
}
|
|
3177
|
-
},
|
|
3197
|
+
}, C = () => {
|
|
3178
3198
|
if (f.current.moving) {
|
|
3179
|
-
const { gridSize:
|
|
3199
|
+
const { gridSize: S = 1 } = d(), E = S || 1;
|
|
3180
3200
|
f.current = { moving: !1 }, r(c.current.items, {
|
|
3181
3201
|
type: "grid",
|
|
3182
|
-
size:
|
|
3202
|
+
size: E
|
|
3183
3203
|
}), l({ movingItems: !1 });
|
|
3184
3204
|
}
|
|
3185
3205
|
};
|
|
3186
|
-
return
|
|
3187
|
-
if (["INPUT", "TEXTAREA"].includes(
|
|
3206
|
+
return ue(document, "keydown", (S) => {
|
|
3207
|
+
if (["INPUT", "TEXTAREA"].includes(S.target.tagName))
|
|
3188
3208
|
return;
|
|
3189
|
-
const
|
|
3190
|
-
if (
|
|
3209
|
+
const E = a();
|
|
3210
|
+
if (E.length) {
|
|
3191
3211
|
const { gridSize: x = 1 } = d();
|
|
3192
|
-
let
|
|
3193
|
-
switch (
|
|
3212
|
+
let v = 0, p = 0;
|
|
3213
|
+
switch (S.key) {
|
|
3194
3214
|
case "ArrowLeft":
|
|
3195
|
-
|
|
3215
|
+
v = -10;
|
|
3196
3216
|
break;
|
|
3197
3217
|
case "ArrowRight":
|
|
3198
|
-
|
|
3218
|
+
v = 10;
|
|
3199
3219
|
break;
|
|
3200
3220
|
case "ArrowUp":
|
|
3201
3221
|
p = -10;
|
|
@@ -3204,45 +3224,45 @@ const go = ({ children: e }) => {
|
|
|
3204
3224
|
p = 10;
|
|
3205
3225
|
break;
|
|
3206
3226
|
}
|
|
3207
|
-
(
|
|
3208
|
-
|
|
3227
|
+
(v || p) && (S.shiftKey && (v *= 5, p *= 5), (S.ctrlKey || S.altKey || S.metaKey) && (v /= 10, p /= 10), t(
|
|
3228
|
+
E,
|
|
3209
3229
|
{
|
|
3210
|
-
x:
|
|
3230
|
+
x: v,
|
|
3211
3231
|
y: p
|
|
3212
3232
|
},
|
|
3213
3233
|
!0
|
|
3214
|
-
), r(
|
|
3234
|
+
), r(E, {
|
|
3215
3235
|
type: "grid",
|
|
3216
3236
|
size: x || 1
|
|
3217
|
-
}),
|
|
3237
|
+
}), S.preventDefault());
|
|
3218
3238
|
}
|
|
3219
|
-
}), /* @__PURE__ */ T(We, { onDragStart: b, onDrag: _, onDragEnd:
|
|
3239
|
+
}), /* @__PURE__ */ T(We, { onDragStart: b, onDrag: _, onDragEnd: C, children: e });
|
|
3220
3240
|
}, ho = (e) => {
|
|
3221
|
-
const t =
|
|
3222
|
-
return
|
|
3241
|
+
const t = m.useRef({ hover: !1, x: 0, y: 0 });
|
|
3242
|
+
return ue(e.current, "mousemove", (n) => {
|
|
3223
3243
|
const { clientX: o, clientY: s } = n;
|
|
3224
3244
|
t.current.x = o, t.current.y = s;
|
|
3225
|
-
}),
|
|
3245
|
+
}), ue(e.current, "mouseenter", () => {
|
|
3226
3246
|
t.current.hover = !0;
|
|
3227
|
-
}),
|
|
3247
|
+
}), ue(e.current, "mouseleave", () => {
|
|
3228
3248
|
t.current.hover = !1;
|
|
3229
|
-
}),
|
|
3249
|
+
}), m.useCallback(() => t.current, []);
|
|
3230
3250
|
}, vo = [...Array(5).keys()].map((e) => `Digit${e + 1}`), yo = () => {
|
|
3231
|
-
const [e, t] =
|
|
3251
|
+
const [e, t] = m.useState({}), [r, n] = Z((o) => [
|
|
3232
3252
|
o.getBoardState,
|
|
3233
3253
|
o.updateBoardState
|
|
3234
3254
|
]);
|
|
3235
|
-
return
|
|
3255
|
+
return ue(document, "keydown", (o) => {
|
|
3236
3256
|
if (!["INPUT", "TEXTAREA"].includes(o.target.tagName) && vo.includes(o.code)) {
|
|
3237
3257
|
const s = o.code, { translateX: a, translateY: u, scale: l } = r();
|
|
3238
|
-
o.altKey || o.metaKey || o.ctrlKey ? t((d) => ({
|
|
3258
|
+
o.altKey || o.metaKey || o.ctrlKey || o.shiftKey ? t((d) => ({
|
|
3239
3259
|
...d,
|
|
3240
3260
|
[s]: { translateX: a, translateY: u, scale: l }
|
|
3241
3261
|
})) : e[s] && n(e[s]), o.preventDefault();
|
|
3242
3262
|
}
|
|
3243
3263
|
}), null;
|
|
3244
3264
|
}, So = ({ children: e, moveFirst: t = !1 }) => {
|
|
3245
|
-
const r =
|
|
3265
|
+
const r = m.useRef(null), [
|
|
3246
3266
|
n,
|
|
3247
3267
|
o,
|
|
3248
3268
|
s,
|
|
@@ -3258,70 +3278,70 @@ const go = ({ children: e }) => {
|
|
|
3258
3278
|
p.getConfiguration,
|
|
3259
3279
|
p.updateBoardState,
|
|
3260
3280
|
p.getSelection
|
|
3261
|
-
]), { setDim: l, zoomToCenter: d, zoomToExtent: f } = dt(), [c, b] =
|
|
3281
|
+
]), { setDim: l, zoomToCenter: d, zoomToExtent: f } = dt(), [c, b] = m.useState(!1), _ = m.useRef({}), C = ho(r);
|
|
3262
3282
|
yo();
|
|
3263
|
-
const
|
|
3283
|
+
const h = m.useCallback(() => {
|
|
3264
3284
|
const { itemExtent: p } = s();
|
|
3265
3285
|
f(p);
|
|
3266
3286
|
}, [s, f]);
|
|
3267
|
-
|
|
3268
|
-
!c && o.left && (
|
|
3269
|
-
}, [
|
|
3270
|
-
const
|
|
3271
|
-
d(1 -
|
|
3287
|
+
m.useEffect(() => {
|
|
3288
|
+
!c && o.left && (h(), b(!0));
|
|
3289
|
+
}, [h, c, o]);
|
|
3290
|
+
const S = ({ clientX: p, clientY: R, scale: w }) => {
|
|
3291
|
+
d(1 - w / 500, { x: p, y: R }), clearTimeout(_.current.zoom), _.current.zoom = setTimeout(() => {
|
|
3272
3292
|
a({ zooming: !1 });
|
|
3273
3293
|
}, 200), a({ zooming: !0 });
|
|
3274
|
-
},
|
|
3275
|
-
l((
|
|
3276
|
-
...
|
|
3277
|
-
translateX:
|
|
3278
|
-
translateY:
|
|
3294
|
+
}, E = ({ deltaX: p, deltaY: R }) => {
|
|
3295
|
+
l((w) => ({
|
|
3296
|
+
...w,
|
|
3297
|
+
translateX: w.translateX + p,
|
|
3298
|
+
translateY: w.translateY + R
|
|
3279
3299
|
})), clearTimeout(_.current.pan), _.current.pan = setTimeout(() => {
|
|
3280
3300
|
a({ panning: !1 });
|
|
3281
3301
|
}, 200), a({ panning: !0 });
|
|
3282
3302
|
}, x = (p) => {
|
|
3283
3303
|
if (["INPUT", "TEXTAREA"].includes(p.target.tagName))
|
|
3284
3304
|
return;
|
|
3285
|
-
let
|
|
3305
|
+
let R = 0, w = 0, g = 1;
|
|
3286
3306
|
switch (p.key) {
|
|
3287
3307
|
case "ArrowLeft":
|
|
3288
|
-
|
|
3308
|
+
R = -10;
|
|
3289
3309
|
break;
|
|
3290
3310
|
case "ArrowRight":
|
|
3291
|
-
|
|
3311
|
+
R = 10;
|
|
3292
3312
|
break;
|
|
3293
3313
|
case "ArrowUp":
|
|
3294
|
-
|
|
3314
|
+
w = -10;
|
|
3295
3315
|
break;
|
|
3296
3316
|
case "ArrowDown":
|
|
3297
|
-
|
|
3317
|
+
w = 10;
|
|
3298
3318
|
break;
|
|
3299
3319
|
case "PageUp":
|
|
3300
|
-
|
|
3320
|
+
g = 1.2;
|
|
3301
3321
|
break;
|
|
3302
3322
|
case "PageDown":
|
|
3303
|
-
|
|
3323
|
+
g = 0.8;
|
|
3304
3324
|
break;
|
|
3305
3325
|
}
|
|
3306
|
-
if (
|
|
3307
|
-
const
|
|
3308
|
-
if (
|
|
3326
|
+
if (R || w || g !== 1) {
|
|
3327
|
+
const k = u();
|
|
3328
|
+
if (g === 1 && k.length)
|
|
3309
3329
|
return;
|
|
3310
|
-
p.shiftKey && (
|
|
3311
|
-
...
|
|
3312
|
-
translateY:
|
|
3313
|
-
translateX:
|
|
3314
|
-
})), d(
|
|
3315
|
-
}
|
|
3316
|
-
p.key === " " && !p.repeat &&
|
|
3317
|
-
},
|
|
3318
|
-
["INPUT", "TEXTAREA"].includes(p.target.tagName) || p.key === " " &&
|
|
3330
|
+
p.shiftKey && (R *= 5, w *= 5), (p.ctrlKey || p.altKey || p.metaKey) && (R /= 5, w /= 5), l((P) => ({
|
|
3331
|
+
...P,
|
|
3332
|
+
translateY: P.translateY + w,
|
|
3333
|
+
translateX: P.translateX + R
|
|
3334
|
+
})), d(g), p.preventDefault();
|
|
3335
|
+
}
|
|
3336
|
+
p.key === " " && !p.repeat && C().hover && d(3, C());
|
|
3337
|
+
}, v = (p) => {
|
|
3338
|
+
["INPUT", "TEXTAREA"].includes(p.target.tagName) || p.key === " " && C().hover && d(1 / 3, C());
|
|
3319
3339
|
};
|
|
3320
|
-
return
|
|
3340
|
+
return ue(document, "keydown", x), ue(document, "keyup", v), /* @__PURE__ */ T(
|
|
3321
3341
|
We,
|
|
3322
3342
|
{
|
|
3323
|
-
onPan:
|
|
3324
|
-
onZoom:
|
|
3343
|
+
onPan: E,
|
|
3344
|
+
onZoom: S,
|
|
3325
3345
|
mainAction: t ? "pan" : "drag",
|
|
3326
3346
|
children: /* @__PURE__ */ T(
|
|
3327
3347
|
"div",
|
|
@@ -3338,7 +3358,7 @@ const go = ({ children: e }) => {
|
|
|
3338
3358
|
)
|
|
3339
3359
|
}
|
|
3340
3360
|
);
|
|
3341
|
-
}, _o =
|
|
3361
|
+
}, _o = q({
|
|
3342
3362
|
position: "absolute",
|
|
3343
3363
|
top: 0,
|
|
3344
3364
|
left: 0,
|
|
@@ -3365,26 +3385,26 @@ const go = ({ children: e }) => {
|
|
|
3365
3385
|
translateY: c.boardState.translateY,
|
|
3366
3386
|
scale: c.boardState.scale
|
|
3367
3387
|
}
|
|
3368
|
-
]), [l] = se((c) => [c.items]), d =
|
|
3388
|
+
]), [l] = se((c) => [c.items]), d = m.useCallback(() => {
|
|
3369
3389
|
const c = t(), { boardWrapperRect: b, boardWrapper: _ } = o();
|
|
3370
3390
|
if (c.length === 0) {
|
|
3371
3391
|
n(null);
|
|
3372
3392
|
return;
|
|
3373
3393
|
}
|
|
3374
|
-
const
|
|
3375
|
-
if (!
|
|
3394
|
+
const C = nr(c, _);
|
|
3395
|
+
if (!C) {
|
|
3376
3396
|
n(null);
|
|
3377
3397
|
return;
|
|
3378
3398
|
}
|
|
3379
|
-
const { left:
|
|
3380
|
-
left:
|
|
3381
|
-
top:
|
|
3399
|
+
const { left: h, top: S, width: E, height: x } = C, v = {
|
|
3400
|
+
left: h - b.left,
|
|
3401
|
+
top: S - b.top,
|
|
3382
3402
|
height: x,
|
|
3383
|
-
width:
|
|
3403
|
+
width: E
|
|
3384
3404
|
};
|
|
3385
|
-
n(
|
|
3405
|
+
n(v);
|
|
3386
3406
|
}, [o, t, n]), f = ft(d, [d], 300);
|
|
3387
|
-
return
|
|
3407
|
+
return m.useEffect(() => {
|
|
3388
3408
|
d(), f();
|
|
3389
3409
|
}, [
|
|
3390
3410
|
e,
|
|
@@ -3409,19 +3429,19 @@ const go = ({ children: e }) => {
|
|
|
3409
3429
|
const [e] = Z((t) => [t.boardState.movingItems]);
|
|
3410
3430
|
return e ? null : /* @__PURE__ */ T(bo, {});
|
|
3411
3431
|
}, wo = typeof window < "u" && typeof navigator < "u" && typeof document < "u";
|
|
3412
|
-
let
|
|
3432
|
+
let ze;
|
|
3413
3433
|
function Co() {
|
|
3414
3434
|
if (!wo)
|
|
3415
3435
|
return;
|
|
3416
|
-
if (
|
|
3417
|
-
return
|
|
3436
|
+
if (ze)
|
|
3437
|
+
return ze;
|
|
3418
3438
|
const e = /* @__PURE__ */ new Map(), t = new ResizeObserver((r) => {
|
|
3419
3439
|
r.forEach((n) => {
|
|
3420
3440
|
var o;
|
|
3421
3441
|
return (o = e.get(n.target)) == null ? void 0 : o.forEach((s) => setTimeout(() => s(n), 0));
|
|
3422
3442
|
});
|
|
3423
3443
|
});
|
|
3424
|
-
return
|
|
3444
|
+
return ze = {
|
|
3425
3445
|
observer: t,
|
|
3426
3446
|
subscribe: (r, n) => {
|
|
3427
3447
|
let o = e.get(r);
|
|
@@ -3431,7 +3451,7 @@ function Co() {
|
|
|
3431
3451
|
const o = e.get(r);
|
|
3432
3452
|
o && (o.delete(n), o.size || (e.delete(r), t.unobserve(r)));
|
|
3433
3453
|
}
|
|
3434
|
-
},
|
|
3454
|
+
}, ze;
|
|
3435
3455
|
}
|
|
3436
3456
|
function xo(e, t, r = !0) {
|
|
3437
3457
|
const n = r && Co(), o = lt(t), s = e && "current" in e ? e.current : e;
|
|
@@ -3519,7 +3539,7 @@ const Pe = (e, t) => Array.from(Array(t)).map(() => e).join(""), Po = new RegExp
|
|
|
3519
3539
|
const f = n - s / 2, c = u + f, b = l + f, _ = d + f;
|
|
3520
3540
|
return [c, b, _].map(Gt);
|
|
3521
3541
|
};
|
|
3522
|
-
function
|
|
3542
|
+
function Lo(e) {
|
|
3523
3543
|
if (e === "transparent")
|
|
3524
3544
|
return 0;
|
|
3525
3545
|
function t(s) {
|
|
@@ -3529,16 +3549,16 @@ function zo(e) {
|
|
|
3529
3549
|
const [r, n, o] = Io(e);
|
|
3530
3550
|
return 0.2126 * t(r) + 0.7152 * t(n) + 0.0722 * t(o);
|
|
3531
3551
|
}
|
|
3532
|
-
function
|
|
3533
|
-
return
|
|
3552
|
+
function zo(e) {
|
|
3553
|
+
return Lo(e) > 0.179;
|
|
3534
3554
|
}
|
|
3535
|
-
const Yo =
|
|
3555
|
+
const Yo = q({
|
|
3536
3556
|
display: "flex",
|
|
3537
3557
|
flexDirection: "row",
|
|
3538
3558
|
alignItems: "center",
|
|
3539
3559
|
zIndex: 210,
|
|
3540
3560
|
pointerEvents: "none"
|
|
3541
|
-
}), Bo =
|
|
3561
|
+
}), Bo = q({
|
|
3542
3562
|
fontWeight: "bold",
|
|
3543
3563
|
padding: "0 0.5em",
|
|
3544
3564
|
borderRadius: "2px",
|
|
@@ -3550,9 +3570,9 @@ const Yo = H({
|
|
|
3550
3570
|
whitespace: "nowrap",
|
|
3551
3571
|
pointerEvents: "none"
|
|
3552
3572
|
}), No = ({ color: e = "#666", size: t = 40, text: r }) => {
|
|
3553
|
-
const n =
|
|
3554
|
-
return /* @__PURE__ */
|
|
3555
|
-
/* @__PURE__ */
|
|
3573
|
+
const n = zo(e) ? "#222" : "#EEE";
|
|
3574
|
+
return /* @__PURE__ */ le("div", { className: Yo, children: [
|
|
3575
|
+
/* @__PURE__ */ le(
|
|
3556
3576
|
"svg",
|
|
3557
3577
|
{
|
|
3558
3578
|
version: "1.1",
|
|
@@ -3596,7 +3616,7 @@ const Yo = H({
|
|
|
3596
3616
|
}
|
|
3597
3617
|
)
|
|
3598
3618
|
] });
|
|
3599
|
-
}, Uo =
|
|
3619
|
+
}, Uo = m.memo(No), Xo = q({
|
|
3600
3620
|
top: 0,
|
|
3601
3621
|
left: 0,
|
|
3602
3622
|
zIndex: 210,
|
|
@@ -3635,14 +3655,14 @@ const Yo = H({
|
|
|
3635
3655
|
l.getConfiguration,
|
|
3636
3656
|
l.getBoardState
|
|
3637
3657
|
]);
|
|
3638
|
-
return /* @__PURE__ */
|
|
3658
|
+
return /* @__PURE__ */ le("div", { onPointerMove: ({ clientX: l, clientY: d }) => {
|
|
3639
3659
|
const { scale: f, translateX: c, translateY: b } = s(), {
|
|
3640
|
-
boardWrapperRect: { left: _, top:
|
|
3641
|
-
} = o(),
|
|
3660
|
+
boardWrapperRect: { left: _, top: C }
|
|
3661
|
+
} = o(), h = {
|
|
3642
3662
|
x: (l - _ - c) / f,
|
|
3643
|
-
y: (d -
|
|
3663
|
+
y: (d - C - b) / f
|
|
3644
3664
|
};
|
|
3645
|
-
r(t.id,
|
|
3665
|
+
r(t.id, h);
|
|
3646
3666
|
}, onPointerLeave: () => {
|
|
3647
3667
|
n(t.id);
|
|
3648
3668
|
}, children: [
|
|
@@ -3663,9 +3683,9 @@ const Yo = H({
|
|
|
3663
3683
|
showResizeHandle: a = !1,
|
|
3664
3684
|
Wrapper: u = Ko
|
|
3665
3685
|
}) => {
|
|
3666
|
-
const l =
|
|
3667
|
-
|
|
3668
|
-
|
|
3686
|
+
const l = m.useRef(null), [d, f] = Z((C) => [
|
|
3687
|
+
C.config.uid,
|
|
3688
|
+
C.updateConfiguration
|
|
3669
3689
|
]), { updateItemExtent: c } = dt(), b = {
|
|
3670
3690
|
userSelect: "none",
|
|
3671
3691
|
width: `${o}px`,
|
|
@@ -3673,28 +3693,28 @@ const Yo = H({
|
|
|
3673
3693
|
backgroundColor: "#333",
|
|
3674
3694
|
...t
|
|
3675
3695
|
};
|
|
3676
|
-
|
|
3677
|
-
const
|
|
3678
|
-
Te(
|
|
3696
|
+
m.useEffect(() => {
|
|
3697
|
+
const C = (h) => {
|
|
3698
|
+
Te(h.target, "board") && h.preventDefault();
|
|
3679
3699
|
};
|
|
3680
|
-
return document.body.addEventListener("wheel",
|
|
3681
|
-
document.body.removeEventListener("wheel",
|
|
3700
|
+
return document.body.addEventListener("wheel", C, { passive: !1 }), () => {
|
|
3701
|
+
document.body.removeEventListener("wheel", C);
|
|
3682
3702
|
};
|
|
3683
|
-
}, []),
|
|
3703
|
+
}, []), m.useEffect(() => {
|
|
3684
3704
|
f({
|
|
3685
3705
|
boardWrapper: l.current
|
|
3686
3706
|
});
|
|
3687
|
-
}, [f]),
|
|
3707
|
+
}, [f]), m.useEffect(() => {
|
|
3688
3708
|
d || f({
|
|
3689
3709
|
uid: me()
|
|
3690
3710
|
});
|
|
3691
|
-
}, [d, f]),
|
|
3711
|
+
}, [d, f]), m.useEffect(() => {
|
|
3692
3712
|
f({
|
|
3693
3713
|
itemTemplates: n,
|
|
3694
3714
|
boardSize: o,
|
|
3695
3715
|
showResizeHandle: a
|
|
3696
3716
|
});
|
|
3697
|
-
}, [n, o, a, f]),
|
|
3717
|
+
}, [n, o, a, f]), m.useEffect(() => {
|
|
3698
3718
|
f({
|
|
3699
3719
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3700
3720
|
}), c(), setTimeout(c, 2e3);
|
|
@@ -3703,19 +3723,19 @@ const Yo = H({
|
|
|
3703
3723
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3704
3724
|
});
|
|
3705
3725
|
});
|
|
3706
|
-
const _ =
|
|
3707
|
-
return /* @__PURE__ */
|
|
3726
|
+
const _ = q({ ...Ho, ...r });
|
|
3727
|
+
return /* @__PURE__ */ le(
|
|
3708
3728
|
"div",
|
|
3709
3729
|
{
|
|
3710
3730
|
ref: l,
|
|
3711
3731
|
id: d,
|
|
3712
3732
|
className: `sync-board ${_}`,
|
|
3713
3733
|
children: [
|
|
3714
|
-
/* @__PURE__ */ T(So, { moveFirst: e, children: /* @__PURE__ */ T(
|
|
3734
|
+
/* @__PURE__ */ T(So, { moveFirst: e, children: /* @__PURE__ */ T(mo, { moveFirst: e, children: /* @__PURE__ */ T(go, { moveFirst: e, children: /* @__PURE__ */ T(Fo, { children: /* @__PURE__ */ T(u, { children: /* @__PURE__ */ le(
|
|
3715
3735
|
"div",
|
|
3716
3736
|
{
|
|
3717
|
-
onContextMenu: (
|
|
3718
|
-
|
|
3737
|
+
onContextMenu: (C) => {
|
|
3738
|
+
C.preventDefault();
|
|
3719
3739
|
},
|
|
3720
3740
|
style: b,
|
|
3721
3741
|
className: "board",
|
|
@@ -3730,7 +3750,7 @@ const Yo = H({
|
|
|
3730
3750
|
}
|
|
3731
3751
|
);
|
|
3732
3752
|
};
|
|
3733
|
-
|
|
3753
|
+
zn(m.createElement);
|
|
3734
3754
|
export {
|
|
3735
3755
|
us as Board,
|
|
3736
3756
|
as as BoardWrapper,
|