react-sync-board 1.2.3 → 1.2.4
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
|
@@ -28,19 +28,19 @@ function Xr() {
|
|
|
28
28
|
return Ee;
|
|
29
29
|
Pt = 1;
|
|
30
30
|
var e = g, 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
|
-
function
|
|
32
|
-
var f,
|
|
31
|
+
function a(u, l, d) {
|
|
32
|
+
var f, c = {}, h = null, _ = null;
|
|
33
33
|
d !== void 0 && (h = "" + d), l.key !== void 0 && (h = "" + l.key), l.ref !== void 0 && (_ = l.ref);
|
|
34
34
|
for (f in l)
|
|
35
|
-
n.call(l, f) && !s.hasOwnProperty(f) && (
|
|
35
|
+
n.call(l, f) && !s.hasOwnProperty(f) && (c[f] = l[f]);
|
|
36
36
|
if (u && u.defaultProps)
|
|
37
37
|
for (f in l = u.defaultProps, l)
|
|
38
|
-
|
|
39
|
-
return { $$typeof: t, type: u, key: h, ref: _, props:
|
|
38
|
+
c[f] === void 0 && (c[f] = l[f]);
|
|
39
|
+
return { $$typeof: t, type: u, key: h, ref: _, props: c, _owner: o.current };
|
|
40
40
|
}
|
|
41
|
-
return Ee.Fragment = r, Ee.jsx =
|
|
41
|
+
return Ee.Fragment = r, Ee.jsx = a, Ee.jsxs = a, Ee;
|
|
42
42
|
}
|
|
43
|
-
var
|
|
43
|
+
var we = {};
|
|
44
44
|
/**
|
|
45
45
|
* @license React
|
|
46
46
|
* react-jsx-runtime.development.js
|
|
@@ -53,7 +53,7 @@ var Ce = {};
|
|
|
53
53
|
var Mt;
|
|
54
54
|
function Ur() {
|
|
55
55
|
return Mt || (Mt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
56
|
-
var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"),
|
|
56
|
+
var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), 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"), h = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), v = Symbol.iterator, E = "@@iterator";
|
|
57
57
|
function I(i) {
|
|
58
58
|
if (i === null || typeof i != "object")
|
|
59
59
|
return null;
|
|
@@ -61,36 +61,36 @@ function Ur() {
|
|
|
61
61
|
return typeof b == "function" ? b : null;
|
|
62
62
|
}
|
|
63
63
|
var y = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
64
|
-
function
|
|
64
|
+
function C(i) {
|
|
65
65
|
{
|
|
66
|
-
for (var b = arguments.length, R = new Array(b > 1 ? b - 1 : 0),
|
|
67
|
-
R[
|
|
66
|
+
for (var b = arguments.length, R = new Array(b > 1 ? b - 1 : 0), D = 1; D < b; D++)
|
|
67
|
+
R[D - 1] = arguments[D];
|
|
68
68
|
x("error", i, R);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
function x(i, b, R) {
|
|
72
72
|
{
|
|
73
|
-
var
|
|
73
|
+
var D = y.ReactDebugCurrentFrame, X = D.getStackAddendum();
|
|
74
74
|
X !== "" && (b += "%s", R = R.concat([X]));
|
|
75
|
-
var W = R.map(function(
|
|
76
|
-
return String(
|
|
75
|
+
var W = R.map(function(B) {
|
|
76
|
+
return String(B);
|
|
77
77
|
});
|
|
78
78
|
W.unshift("Warning: " + b), Function.prototype.apply.call(console[i], console, W);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
var p = !1,
|
|
81
|
+
var p = !1, w = !1, m = !1, S = !1, O = !1, k;
|
|
82
82
|
k = Symbol.for("react.module.reference");
|
|
83
|
-
function
|
|
84
|
-
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || O || i === o || i === d || i === f || S || i === _ || p ||
|
|
83
|
+
function j(i) {
|
|
84
|
+
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || O || i === o || i === d || i === f || S || i === _ || p || w || m || typeof i == "object" && i !== null && (i.$$typeof === h || 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
88
|
i.$$typeof === k || i.getModuleId !== void 0));
|
|
89
89
|
}
|
|
90
90
|
function M(i, b, R) {
|
|
91
|
-
var
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
91
|
+
var D = i.displayName;
|
|
92
|
+
if (D)
|
|
93
|
+
return D;
|
|
94
94
|
var X = b.displayName || b.name || "";
|
|
95
95
|
return X !== "" ? R + "(" + X + ")" : R;
|
|
96
96
|
}
|
|
@@ -100,7 +100,7 @@ function Ur() {
|
|
|
100
100
|
function N(i) {
|
|
101
101
|
if (i == null)
|
|
102
102
|
return null;
|
|
103
|
-
if (typeof i.tag == "number" &&
|
|
103
|
+
if (typeof i.tag == "number" && C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof i == "function")
|
|
104
104
|
return i.displayName || i.name || null;
|
|
105
105
|
if (typeof i == "string")
|
|
106
106
|
return i;
|
|
@@ -123,18 +123,18 @@ function Ur() {
|
|
|
123
123
|
case u:
|
|
124
124
|
var b = i;
|
|
125
125
|
return L(b) + ".Consumer";
|
|
126
|
-
case
|
|
126
|
+
case a:
|
|
127
127
|
var R = i;
|
|
128
128
|
return L(R._context) + ".Provider";
|
|
129
129
|
case l:
|
|
130
130
|
return M(i, i.render, "ForwardRef");
|
|
131
|
-
case
|
|
132
|
-
var
|
|
133
|
-
return
|
|
131
|
+
case c:
|
|
132
|
+
var D = i.displayName || null;
|
|
133
|
+
return D !== null ? D : N(i.type) || "Memo";
|
|
134
134
|
case h: {
|
|
135
|
-
var X = i, W = X._payload,
|
|
135
|
+
var X = i, W = X._payload, B = X._init;
|
|
136
136
|
try {
|
|
137
|
-
return N(
|
|
137
|
+
return N(B(W));
|
|
138
138
|
} catch {
|
|
139
139
|
return null;
|
|
140
140
|
}
|
|
@@ -142,18 +142,18 @@ function Ur() {
|
|
|
142
142
|
}
|
|
143
143
|
return null;
|
|
144
144
|
}
|
|
145
|
-
var U = Object.assign, J = 0, P, $,
|
|
146
|
-
function
|
|
145
|
+
var U = Object.assign, J = 0, P, $, Y, V, A, F, H;
|
|
146
|
+
function Z() {
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
function
|
|
148
|
+
Z.__reactDisabledLog = !0;
|
|
149
|
+
function te() {
|
|
150
150
|
{
|
|
151
151
|
if (J === 0) {
|
|
152
|
-
P = console.log, $ = console.info,
|
|
152
|
+
P = console.log, $ = console.info, Y = console.warn, V = console.error, A = console.group, F = console.groupCollapsed, H = console.groupEnd;
|
|
153
153
|
var i = {
|
|
154
154
|
configurable: !0,
|
|
155
155
|
enumerable: !0,
|
|
156
|
-
value:
|
|
156
|
+
value: Z,
|
|
157
157
|
writable: !0
|
|
158
158
|
};
|
|
159
159
|
Object.defineProperties(console, {
|
|
@@ -185,7 +185,7 @@ function Ur() {
|
|
|
185
185
|
value: $
|
|
186
186
|
}),
|
|
187
187
|
warn: U({}, i, {
|
|
188
|
-
value:
|
|
188
|
+
value: Y
|
|
189
189
|
}),
|
|
190
190
|
error: U({}, i, {
|
|
191
191
|
value: V
|
|
@@ -194,14 +194,14 @@ function Ur() {
|
|
|
194
194
|
value: A
|
|
195
195
|
}),
|
|
196
196
|
groupCollapsed: U({}, i, {
|
|
197
|
-
value:
|
|
197
|
+
value: F
|
|
198
198
|
}),
|
|
199
199
|
groupEnd: U({}, i, {
|
|
200
|
-
value:
|
|
200
|
+
value: H
|
|
201
201
|
})
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
J < 0 &&
|
|
204
|
+
J < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
var se = y.ReactCurrentDispatcher, me;
|
|
@@ -211,78 +211,78 @@ function Ur() {
|
|
|
211
211
|
try {
|
|
212
212
|
throw Error();
|
|
213
213
|
} catch (X) {
|
|
214
|
-
var
|
|
215
|
-
me =
|
|
214
|
+
var D = X.stack.trim().match(/\n( *(at )?)/);
|
|
215
|
+
me = D && D[1] || "";
|
|
216
216
|
}
|
|
217
217
|
return `
|
|
218
218
|
` + me + i;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
var Ke = !1,
|
|
221
|
+
var Ke = !1, je;
|
|
222
222
|
{
|
|
223
223
|
var mr = typeof WeakMap == "function" ? WeakMap : Map;
|
|
224
|
-
|
|
224
|
+
je = new mr();
|
|
225
225
|
}
|
|
226
226
|
function ht(i, b) {
|
|
227
227
|
if (!i || Ke)
|
|
228
228
|
return "";
|
|
229
229
|
{
|
|
230
|
-
var R =
|
|
230
|
+
var R = je.get(i);
|
|
231
231
|
if (R !== void 0)
|
|
232
232
|
return R;
|
|
233
233
|
}
|
|
234
|
-
var
|
|
234
|
+
var D;
|
|
235
235
|
Ke = !0;
|
|
236
236
|
var X = Error.prepareStackTrace;
|
|
237
237
|
Error.prepareStackTrace = void 0;
|
|
238
238
|
var W;
|
|
239
|
-
W = se.current, se.current = null,
|
|
239
|
+
W = se.current, se.current = null, te();
|
|
240
240
|
try {
|
|
241
241
|
if (b) {
|
|
242
|
-
var
|
|
242
|
+
var B = function() {
|
|
243
243
|
throw Error();
|
|
244
244
|
};
|
|
245
|
-
if (Object.defineProperty(
|
|
245
|
+
if (Object.defineProperty(B.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(B, []);
|
|
252
252
|
} catch (ie) {
|
|
253
|
-
|
|
253
|
+
D = ie;
|
|
254
254
|
}
|
|
255
|
-
Reflect.construct(i, [],
|
|
255
|
+
Reflect.construct(i, [], B);
|
|
256
256
|
} else {
|
|
257
257
|
try {
|
|
258
|
-
|
|
258
|
+
B.call();
|
|
259
259
|
} catch (ie) {
|
|
260
|
-
|
|
260
|
+
D = ie;
|
|
261
261
|
}
|
|
262
|
-
i.call(
|
|
262
|
+
i.call(B.prototype);
|
|
263
263
|
}
|
|
264
264
|
} else {
|
|
265
265
|
try {
|
|
266
266
|
throw Error();
|
|
267
267
|
} catch (ie) {
|
|
268
|
-
|
|
268
|
+
D = ie;
|
|
269
269
|
}
|
|
270
270
|
i();
|
|
271
271
|
}
|
|
272
272
|
} catch (ie) {
|
|
273
|
-
if (ie &&
|
|
273
|
+
if (ie && D && typeof ie.stack == "string") {
|
|
274
274
|
for (var z = ie.stack.split(`
|
|
275
|
-
`),
|
|
276
|
-
`), q = z.length - 1, G =
|
|
275
|
+
`), ee = D.stack.split(`
|
|
276
|
+
`), q = z.length - 1, G = ee.length - 1; q >= 1 && G >= 0 && z[q] !== ee[G]; )
|
|
277
277
|
G--;
|
|
278
278
|
for (; q >= 1 && G >= 0; q--, G--)
|
|
279
|
-
if (z[q] !==
|
|
279
|
+
if (z[q] !== ee[G]) {
|
|
280
280
|
if (q !== 1 || G !== 1)
|
|
281
281
|
do
|
|
282
|
-
if (q--, G--, G < 0 || z[q] !==
|
|
283
|
-
var
|
|
282
|
+
if (q--, G--, G < 0 || z[q] !== ee[G]) {
|
|
283
|
+
var re = `
|
|
284
284
|
` + z[q].replace(" at new ", " at ");
|
|
285
|
-
return i.displayName &&
|
|
285
|
+
return i.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", i.displayName)), typeof i == "function" && je.set(i, re), re;
|
|
286
286
|
}
|
|
287
287
|
while (q >= 1 && G >= 0);
|
|
288
288
|
break;
|
|
@@ -292,7 +292,7 @@ function Ur() {
|
|
|
292
292
|
Ke = !1, se.current = W, le(), Error.prepareStackTrace = X;
|
|
293
293
|
}
|
|
294
294
|
var ve = i ? i.displayName || i.name : "", Tt = ve ? ge(ve) : "";
|
|
295
|
-
return typeof i == "function" &&
|
|
295
|
+
return typeof i == "function" && je.set(i, Tt), Tt;
|
|
296
296
|
}
|
|
297
297
|
function gr(i, b, R) {
|
|
298
298
|
return ht(i, !1);
|
|
@@ -301,7 +301,7 @@ function Ur() {
|
|
|
301
301
|
var b = i.prototype;
|
|
302
302
|
return !!(b && b.isReactComponent);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function De(i, b, R) {
|
|
305
305
|
if (i == null)
|
|
306
306
|
return "";
|
|
307
307
|
if (typeof i == "function")
|
|
@@ -318,12 +318,12 @@ function Ur() {
|
|
|
318
318
|
switch (i.$$typeof) {
|
|
319
319
|
case l:
|
|
320
320
|
return gr(i.render);
|
|
321
|
-
case
|
|
322
|
-
return
|
|
321
|
+
case c:
|
|
322
|
+
return De(i.type, b, R);
|
|
323
323
|
case h: {
|
|
324
|
-
var
|
|
324
|
+
var D = i, X = D._payload, W = D._init;
|
|
325
325
|
try {
|
|
326
|
-
return
|
|
326
|
+
return De(W(X), b, R);
|
|
327
327
|
} catch {
|
|
328
328
|
}
|
|
329
329
|
}
|
|
@@ -333,27 +333,27 @@ function Ur() {
|
|
|
333
333
|
var $e = Object.prototype.hasOwnProperty, vt = {}, yt = y.ReactDebugCurrentFrame;
|
|
334
334
|
function Ae(i) {
|
|
335
335
|
if (i) {
|
|
336
|
-
var b = i._owner, R =
|
|
336
|
+
var b = i._owner, R = De(i.type, i._source, b ? b.type : null);
|
|
337
337
|
yt.setExtraStackFrame(R);
|
|
338
338
|
} else
|
|
339
339
|
yt.setExtraStackFrame(null);
|
|
340
340
|
}
|
|
341
|
-
function vr(i, b, R,
|
|
341
|
+
function vr(i, b, R, D, X) {
|
|
342
342
|
{
|
|
343
343
|
var W = Function.call.bind($e);
|
|
344
|
-
for (var
|
|
345
|
-
if (W(i,
|
|
344
|
+
for (var B in i)
|
|
345
|
+
if (W(i, B)) {
|
|
346
346
|
var z = void 0;
|
|
347
347
|
try {
|
|
348
|
-
if (typeof i[
|
|
349
|
-
var
|
|
350
|
-
throw
|
|
348
|
+
if (typeof i[B] != "function") {
|
|
349
|
+
var ee = Error((D || "React class") + ": " + R + " type `" + B + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof i[B] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
350
|
+
throw ee.name = "Invariant Violation", ee;
|
|
351
351
|
}
|
|
352
|
-
z = i[
|
|
352
|
+
z = i[B](b, B, D, R, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
353
353
|
} catch (q) {
|
|
354
354
|
z = q;
|
|
355
355
|
}
|
|
356
|
-
z && !(z instanceof Error) && (Ae(X),
|
|
356
|
+
z && !(z instanceof Error) && (Ae(X), C("%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).", D || "React class", R, B, typeof z), Ae(null)), z instanceof Error && !(z.message in vt) && (vt[z.message] = !0, Ae(X), C("Failed %s type: %s", R, z.message), Ae(null));
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
|
@@ -379,7 +379,7 @@ function Ur() {
|
|
|
379
379
|
}
|
|
380
380
|
function _t(i) {
|
|
381
381
|
if (_r(i))
|
|
382
|
-
return
|
|
382
|
+
return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Sr(i)), St(i);
|
|
383
383
|
}
|
|
384
384
|
var be = y.ReactCurrentOwner, br = {
|
|
385
385
|
key: !0,
|
|
@@ -396,7 +396,7 @@ function Ur() {
|
|
|
396
396
|
}
|
|
397
397
|
return i.ref !== void 0;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function wr(i) {
|
|
400
400
|
if ($e.call(i, "key")) {
|
|
401
401
|
var b = Object.getOwnPropertyDescriptor(i, "key").get;
|
|
402
402
|
if (b && b.isReactWarning)
|
|
@@ -404,16 +404,16 @@ function Ur() {
|
|
|
404
404
|
}
|
|
405
405
|
return i.key !== void 0;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function Cr(i, b) {
|
|
408
408
|
if (typeof i.ref == "string" && be.current && b && be.current.stateNode !== b) {
|
|
409
409
|
var R = N(be.current.type);
|
|
410
|
-
qe[R] || (
|
|
410
|
+
qe[R] || (C('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', N(be.current.type), i.ref), qe[R] = !0);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
function xr(i, b) {
|
|
414
414
|
{
|
|
415
415
|
var R = function() {
|
|
416
|
-
bt || (bt = !0,
|
|
416
|
+
bt || (bt = !0, C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
|
|
417
417
|
};
|
|
418
418
|
R.isReactWarning = !0, Object.defineProperty(i, "key", {
|
|
419
419
|
get: R,
|
|
@@ -424,7 +424,7 @@ function Ur() {
|
|
|
424
424
|
function Rr(i, b) {
|
|
425
425
|
{
|
|
426
426
|
var R = function() {
|
|
427
|
-
Et || (Et = !0,
|
|
427
|
+
Et || (Et = !0, C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
|
|
428
428
|
};
|
|
429
429
|
R.isReactWarning = !0, Object.defineProperty(i, "ref", {
|
|
430
430
|
get: R,
|
|
@@ -432,7 +432,7 @@ function Ur() {
|
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
var Ir = function(i, b, R,
|
|
435
|
+
var Ir = function(i, b, R, D, X, W, B) {
|
|
436
436
|
var z = {
|
|
437
437
|
// This tag allows us to uniquely identify this as a React Element
|
|
438
438
|
$$typeof: t,
|
|
@@ -440,7 +440,7 @@ function Ur() {
|
|
|
440
440
|
type: i,
|
|
441
441
|
key: b,
|
|
442
442
|
ref: R,
|
|
443
|
-
props:
|
|
443
|
+
props: B,
|
|
444
444
|
// Record the component responsible for creating this element.
|
|
445
445
|
_owner: W
|
|
446
446
|
};
|
|
@@ -453,7 +453,7 @@ function Ur() {
|
|
|
453
453
|
configurable: !1,
|
|
454
454
|
enumerable: !1,
|
|
455
455
|
writable: !1,
|
|
456
|
-
value:
|
|
456
|
+
value: D
|
|
457
457
|
}), Object.defineProperty(z, "_source", {
|
|
458
458
|
configurable: !1,
|
|
459
459
|
enumerable: !1,
|
|
@@ -461,38 +461,38 @@ function Ur() {
|
|
|
461
461
|
value: X
|
|
462
462
|
}), Object.freeze && (Object.freeze(z.props), Object.freeze(z)), z;
|
|
463
463
|
};
|
|
464
|
-
function Or(i, b, R,
|
|
464
|
+
function Or(i, b, R, D, X) {
|
|
465
465
|
{
|
|
466
|
-
var W,
|
|
467
|
-
R !== void 0 && (_t(R), z = "" + R),
|
|
466
|
+
var W, B = {}, z = null, ee = null;
|
|
467
|
+
R !== void 0 && (_t(R), z = "" + R), wr(b) && (_t(b.key), z = "" + b.key), Er(b) && (ee = b.ref, Cr(b, X));
|
|
468
468
|
for (W in b)
|
|
469
|
-
$e.call(b, W) && !br.hasOwnProperty(W) && (
|
|
469
|
+
$e.call(b, W) && !br.hasOwnProperty(W) && (B[W] = b[W]);
|
|
470
470
|
if (i && i.defaultProps) {
|
|
471
471
|
var q = i.defaultProps;
|
|
472
472
|
for (W in q)
|
|
473
|
-
|
|
473
|
+
B[W] === void 0 && (B[W] = q[W]);
|
|
474
474
|
}
|
|
475
|
-
if (z ||
|
|
475
|
+
if (z || ee) {
|
|
476
476
|
var G = typeof i == "function" ? i.displayName || i.name || "Unknown" : i;
|
|
477
|
-
z && xr(
|
|
477
|
+
z && xr(B, G), ee && Rr(B, G);
|
|
478
478
|
}
|
|
479
|
-
return Ir(i, z,
|
|
479
|
+
return Ir(i, z, ee, X, D, be.current, B);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
var Ge = y.ReactCurrentOwner,
|
|
482
|
+
var Ge = y.ReactCurrentOwner, wt = y.ReactDebugCurrentFrame;
|
|
483
483
|
function he(i) {
|
|
484
484
|
if (i) {
|
|
485
|
-
var b = i._owner, R =
|
|
486
|
-
|
|
485
|
+
var b = i._owner, R = De(i.type, i._source, b ? b.type : null);
|
|
486
|
+
wt.setExtraStackFrame(R);
|
|
487
487
|
} else
|
|
488
|
-
|
|
488
|
+
wt.setExtraStackFrame(null);
|
|
489
489
|
}
|
|
490
490
|
var Je;
|
|
491
491
|
Je = !1;
|
|
492
492
|
function Ze(i) {
|
|
493
493
|
return typeof i == "object" && i !== null && i.$$typeof === t;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function Ct() {
|
|
496
496
|
{
|
|
497
497
|
if (Ge.current) {
|
|
498
498
|
var i = N(Ge.current.type);
|
|
@@ -518,7 +518,7 @@ Check your code at ` + b + ":" + R + ".";
|
|
|
518
518
|
var xt = {};
|
|
519
519
|
function kr(i) {
|
|
520
520
|
{
|
|
521
|
-
var b =
|
|
521
|
+
var b = Ct();
|
|
522
522
|
if (!b) {
|
|
523
523
|
var R = typeof i == "string" ? i : i.displayName || i.name;
|
|
524
524
|
R && (b = `
|
|
@@ -537,8 +537,8 @@ Check the top-level render call using <` + R + ">.");
|
|
|
537
537
|
if (xt[R])
|
|
538
538
|
return;
|
|
539
539
|
xt[R] = !0;
|
|
540
|
-
var
|
|
541
|
-
i && i._owner && i._owner !== Ge.current && (
|
|
540
|
+
var D = "";
|
|
541
|
+
i && i._owner && i._owner !== Ge.current && (D = " It was passed a child from " + N(i._owner.type) + "."), he(i), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', R, D), he(null);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
function It(i, b) {
|
|
@@ -547,16 +547,16 @@ Check the top-level render call using <` + R + ">.");
|
|
|
547
547
|
return;
|
|
548
548
|
if (He(i))
|
|
549
549
|
for (var R = 0; R < i.length; R++) {
|
|
550
|
-
var
|
|
551
|
-
Ze(
|
|
550
|
+
var D = i[R];
|
|
551
|
+
Ze(D) && Rt(D, b);
|
|
552
552
|
}
|
|
553
553
|
else if (Ze(i))
|
|
554
554
|
i._store && (i._store.validated = !0);
|
|
555
555
|
else if (i) {
|
|
556
556
|
var X = I(i);
|
|
557
557
|
if (typeof X == "function" && X !== i.entries)
|
|
558
|
-
for (var W = X.call(i),
|
|
559
|
-
Ze(
|
|
558
|
+
for (var W = X.call(i), B; !(B = W.next()).done; )
|
|
559
|
+
Ze(B.value) && Rt(B.value, b);
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
}
|
|
@@ -570,72 +570,72 @@ Check the top-level render call using <` + R + ">.");
|
|
|
570
570
|
R = b.propTypes;
|
|
571
571
|
else if (typeof b == "object" && (b.$$typeof === l || // Note: Memo only checks outer props here.
|
|
572
572
|
// Inner props are checked in the reconciler.
|
|
573
|
-
b.$$typeof ===
|
|
573
|
+
b.$$typeof === c))
|
|
574
574
|
R = b.propTypes;
|
|
575
575
|
else
|
|
576
576
|
return;
|
|
577
577
|
if (R) {
|
|
578
|
-
var
|
|
579
|
-
vr(R, i.props, "prop",
|
|
578
|
+
var D = N(b);
|
|
579
|
+
vr(R, i.props, "prop", D, i);
|
|
580
580
|
} else if (b.PropTypes !== void 0 && !Je) {
|
|
581
581
|
Je = !0;
|
|
582
582
|
var X = N(b);
|
|
583
|
-
|
|
583
|
+
C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", X || "Unknown");
|
|
584
584
|
}
|
|
585
|
-
typeof b.getDefaultProps == "function" && !b.getDefaultProps.isReactClassApproved &&
|
|
585
|
+
typeof b.getDefaultProps == "function" && !b.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
function Mr(i) {
|
|
589
589
|
{
|
|
590
590
|
for (var b = Object.keys(i.props), R = 0; R < b.length; R++) {
|
|
591
|
-
var
|
|
592
|
-
if (
|
|
593
|
-
he(i),
|
|
591
|
+
var D = b[R];
|
|
592
|
+
if (D !== "children" && D !== "key") {
|
|
593
|
+
he(i), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", D), he(null);
|
|
594
594
|
break;
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
i.ref !== null && (he(i),
|
|
597
|
+
i.ref !== null && (he(i), C("Invalid attribute `ref` supplied to `React.Fragment`."), he(null));
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function Ot(i, b, R,
|
|
600
|
+
function Ot(i, b, R, D, X, W) {
|
|
601
601
|
{
|
|
602
|
-
var
|
|
603
|
-
if (!
|
|
602
|
+
var B = j(i);
|
|
603
|
+
if (!B) {
|
|
604
604
|
var z = "";
|
|
605
605
|
(i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (z += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
606
|
-
var
|
|
607
|
-
|
|
606
|
+
var ee = Tr(X);
|
|
607
|
+
ee ? z += ee : z += Ct();
|
|
608
608
|
var q;
|
|
609
|
-
i === null ? q = "null" : He(i) ? q = "array" : i !== void 0 && i.$$typeof === t ? (q = "<" + (N(i.type) || "Unknown") + " />", z = " Did you accidentally export a JSX literal instead of a component?") : q = typeof i,
|
|
609
|
+
i === null ? q = "null" : He(i) ? q = "array" : i !== void 0 && i.$$typeof === t ? (q = "<" + (N(i.type) || "Unknown") + " />", z = " Did you accidentally export a JSX literal instead of a component?") : q = typeof i, C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", q, z);
|
|
610
610
|
}
|
|
611
611
|
var G = Or(i, b, R, X, W);
|
|
612
612
|
if (G == null)
|
|
613
613
|
return G;
|
|
614
|
-
if (
|
|
615
|
-
var
|
|
616
|
-
if (
|
|
617
|
-
if (
|
|
618
|
-
if (He(
|
|
619
|
-
for (var ve = 0; ve <
|
|
620
|
-
It(
|
|
621
|
-
Object.freeze && Object.freeze(
|
|
614
|
+
if (B) {
|
|
615
|
+
var re = b.children;
|
|
616
|
+
if (re !== void 0)
|
|
617
|
+
if (D)
|
|
618
|
+
if (He(re)) {
|
|
619
|
+
for (var ve = 0; ve < re.length; ve++)
|
|
620
|
+
It(re[ve], i);
|
|
621
|
+
Object.freeze && Object.freeze(re);
|
|
622
622
|
} else
|
|
623
|
-
|
|
623
|
+
C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
624
624
|
else
|
|
625
|
-
It(
|
|
625
|
+
It(re, i);
|
|
626
626
|
}
|
|
627
627
|
return i === n ? Mr(G) : Pr(G), G;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function jr(i, b, R) {
|
|
631
631
|
return Ot(i, b, R, !0);
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function Dr(i, b, R) {
|
|
634
634
|
return Ot(i, b, R, !1);
|
|
635
635
|
}
|
|
636
|
-
var $r =
|
|
637
|
-
|
|
638
|
-
}()),
|
|
636
|
+
var $r = Dr, Ar = jr;
|
|
637
|
+
we.Fragment = n, we.jsx = $r, we.jsxs = Ar;
|
|
638
|
+
}()), we;
|
|
639
639
|
}
|
|
640
640
|
(function(e) {
|
|
641
641
|
process.env.NODE_ENV === "production" ? e.exports = Xr() : e.exports = Ur();
|
|
@@ -648,9 +648,9 @@ class Fr {
|
|
|
648
648
|
() => {
|
|
649
649
|
this._socket.off(`${this.room}.isMaster`), this._socket.off(`${this.room}.roomJoined`), this._socket.off(`${this.room}._call`);
|
|
650
650
|
}
|
|
651
|
-
], this._left = !1, this.registeredRPC = {}, this._socket.on(`${this.room}._call`, async ({ callId: o, name: s, params:
|
|
651
|
+
], this._left = !1, this.registeredRPC = {}, this._socket.on(`${this.room}._call`, async ({ callId: o, name: s, params: a }) => {
|
|
652
652
|
try {
|
|
653
|
-
const u = await this.registeredRPC[s](
|
|
653
|
+
const u = await this.registeredRPC[s](a);
|
|
654
654
|
t.emit(`${this.room}._result.${o}`, {
|
|
655
655
|
ok: u || null
|
|
656
656
|
});
|
|
@@ -671,8 +671,8 @@ class Fr {
|
|
|
671
671
|
async _callServerRPC(t, r) {
|
|
672
672
|
const n = Vr();
|
|
673
673
|
return new Promise((o, s) => {
|
|
674
|
-
this._socket.once(`${this.room}._result.${n}`, (
|
|
675
|
-
|
|
674
|
+
this._socket.once(`${this.room}._result.${n}`, (a) => {
|
|
675
|
+
a.hasOwnProperty("ok") ? o(a.ok) : s(a.err);
|
|
676
676
|
}), this._socket.emit(`${this.room}._call`, { callId: n, name: t, params: r });
|
|
677
677
|
});
|
|
678
678
|
}
|
|
@@ -748,12 +748,12 @@ const Kr = ({
|
|
|
748
748
|
userId: o = null
|
|
749
749
|
}) => {
|
|
750
750
|
const s = new Fr(e, t, o);
|
|
751
|
-
return new Promise((
|
|
751
|
+
return new Promise((a) => {
|
|
752
752
|
let u = !0;
|
|
753
753
|
e.on(`${t}.isMaster`, () => {
|
|
754
754
|
s._left || n(t);
|
|
755
755
|
}), e.on(`${t}.roomJoined`, (l) => {
|
|
756
|
-
s._left || (s.userId = l, u = !1, r(s),
|
|
756
|
+
s._left || (s.userId = l, u = !1, r(s), a(s));
|
|
757
757
|
}), e.on("connect", () => {
|
|
758
758
|
s._left || u || e.emit("joinSuperSocket", {
|
|
759
759
|
room: t,
|
|
@@ -782,14 +782,14 @@ const Kr = ({
|
|
|
782
782
|
LoadingComponent: n = Hr,
|
|
783
783
|
children: o
|
|
784
784
|
}) => {
|
|
785
|
-
const [s,
|
|
785
|
+
const [s, a] = g.useState(!1), [u, l] = g.useState(!1), [d, f] = g.useState(null), c = g.useRef(null), h = g.useRef(!1), _ = _e(it), v = g.useRef(!1);
|
|
786
786
|
return g.useEffect(() => (h.current = !0, () => {
|
|
787
787
|
h.current = !1;
|
|
788
788
|
}), []), g.useEffect(() => {
|
|
789
789
|
if (!e)
|
|
790
790
|
return null;
|
|
791
791
|
const E = () => {
|
|
792
|
-
console.log(`Disconnected from ${r}…`), h.current && (
|
|
792
|
+
console.log(`Disconnected from ${r}…`), h.current && (a(!1), l(!1));
|
|
793
793
|
};
|
|
794
794
|
return e.on("disconnect", E), () => {
|
|
795
795
|
e.off("disconnect", E);
|
|
@@ -801,11 +801,11 @@ const Kr = ({
|
|
|
801
801
|
console.log(`Is now master on channel ${r}…`), h.current && l(!0);
|
|
802
802
|
},
|
|
803
803
|
onJoined: (E) => {
|
|
804
|
-
console.log(`Connected on channel ${r}…`),
|
|
804
|
+
console.log(`Connected on channel ${r}…`), c.current = E, h.current && (f(E), a(!0));
|
|
805
805
|
}
|
|
806
806
|
})), () => {
|
|
807
807
|
var E;
|
|
808
|
-
(E =
|
|
808
|
+
(E = c.current) == null || E.leave();
|
|
809
809
|
}) : null, [r, t, e]), !s || !d ? /* @__PURE__ */ T(n, {}) : /* @__PURE__ */ T(
|
|
810
810
|
it.Provider,
|
|
811
811
|
{
|
|
@@ -813,13 +813,13 @@ const Kr = ({
|
|
|
813
813
|
children: o
|
|
814
814
|
}
|
|
815
815
|
);
|
|
816
|
-
}, Xe = (e = "default") => (_e(it) || {})[e],
|
|
816
|
+
}, Xe = (e = "default") => (_e(it) || {})[e], jt = (e) => {
|
|
817
817
|
let t;
|
|
818
818
|
const r = /* @__PURE__ */ new Set(), n = (l, d) => {
|
|
819
819
|
const f = typeof l == "function" ? l(t) : l;
|
|
820
820
|
if (!Object.is(f, t)) {
|
|
821
|
-
const
|
|
822
|
-
t = d ?? typeof f != "object" ? f : Object.assign({}, t, f), r.forEach((h) => h(t,
|
|
821
|
+
const c = t;
|
|
822
|
+
t = d ?? typeof f != "object" ? f : Object.assign({}, t, f), r.forEach((h) => h(t, c));
|
|
823
823
|
}
|
|
824
824
|
}, o = () => t, u = { setState: n, getState: o, subscribe: (l) => (r.add(l), () => r.delete(l)), destroy: () => {
|
|
825
825
|
({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0 } && "production") !== "production" && console.warn(
|
|
@@ -827,7 +827,7 @@ const Kr = ({
|
|
|
827
827
|
), r.clear();
|
|
828
828
|
} };
|
|
829
829
|
return t = e(n, o, u), u;
|
|
830
|
-
}, Ue = (e) => e ?
|
|
830
|
+
}, Ue = (e) => e ? jt(e) : jt;
|
|
831
831
|
var at = {}, qr = {
|
|
832
832
|
get exports() {
|
|
833
833
|
return at;
|
|
@@ -852,37 +852,37 @@ var at = {}, qr = {
|
|
|
852
852
|
* This source code is licensed under the MIT license found in the
|
|
853
853
|
* LICENSE file in the root directory of this source tree.
|
|
854
854
|
*/
|
|
855
|
-
var
|
|
855
|
+
var Dt;
|
|
856
856
|
function Jr() {
|
|
857
|
-
if (
|
|
857
|
+
if (Dt)
|
|
858
858
|
return et;
|
|
859
|
-
|
|
859
|
+
Dt = 1;
|
|
860
860
|
var e = g;
|
|
861
|
-
function t(
|
|
862
|
-
return
|
|
861
|
+
function t(c, h) {
|
|
862
|
+
return c === h && (c !== 0 || 1 / c === 1 / h) || c !== c && h !== h;
|
|
863
863
|
}
|
|
864
|
-
var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, s = e.useLayoutEffect,
|
|
865
|
-
function u(
|
|
864
|
+
var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, s = e.useLayoutEffect, a = e.useDebugValue;
|
|
865
|
+
function u(c, h) {
|
|
866
866
|
var _ = h(), v = n({ inst: { value: _, getSnapshot: h } }), E = v[0].inst, I = v[1];
|
|
867
867
|
return s(function() {
|
|
868
868
|
E.value = _, E.getSnapshot = h, l(E) && I({ inst: E });
|
|
869
|
-
}, [
|
|
870
|
-
return l(E) && I({ inst: E }),
|
|
869
|
+
}, [c, _, h]), o(function() {
|
|
870
|
+
return l(E) && I({ inst: E }), c(function() {
|
|
871
871
|
l(E) && I({ inst: E });
|
|
872
872
|
});
|
|
873
|
-
}, [
|
|
873
|
+
}, [c]), a(_), _;
|
|
874
874
|
}
|
|
875
|
-
function l(
|
|
876
|
-
var h =
|
|
877
|
-
|
|
875
|
+
function l(c) {
|
|
876
|
+
var h = c.getSnapshot;
|
|
877
|
+
c = c.value;
|
|
878
878
|
try {
|
|
879
879
|
var _ = h();
|
|
880
|
-
return !r(
|
|
880
|
+
return !r(c, _);
|
|
881
881
|
} catch {
|
|
882
882
|
return !0;
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
|
-
function d(
|
|
885
|
+
function d(c, h) {
|
|
886
886
|
return h();
|
|
887
887
|
}
|
|
888
888
|
var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : u;
|
|
@@ -905,16 +905,16 @@ function Zr() {
|
|
|
905
905
|
var e = g, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
906
906
|
function r(x) {
|
|
907
907
|
{
|
|
908
|
-
for (var p = arguments.length,
|
|
909
|
-
|
|
910
|
-
n("error", x,
|
|
908
|
+
for (var p = arguments.length, w = new Array(p > 1 ? p - 1 : 0), m = 1; m < p; m++)
|
|
909
|
+
w[m - 1] = arguments[m];
|
|
910
|
+
n("error", x, w);
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
function n(x, p,
|
|
913
|
+
function n(x, p, w) {
|
|
914
914
|
{
|
|
915
915
|
var m = t.ReactDebugCurrentFrame, S = m.getStackAddendum();
|
|
916
|
-
S !== "" && (p += "%s",
|
|
917
|
-
var O =
|
|
916
|
+
S !== "" && (p += "%s", w = w.concat([S]));
|
|
917
|
+
var O = w.map(function(k) {
|
|
918
918
|
return String(k);
|
|
919
919
|
});
|
|
920
920
|
O.unshift("Warning: " + p), Function.prototype.apply.call(console[x], console, O);
|
|
@@ -923,30 +923,30 @@ function Zr() {
|
|
|
923
923
|
function o(x, p) {
|
|
924
924
|
return x === p && (x !== 0 || 1 / x === 1 / p) || x !== x && p !== p;
|
|
925
925
|
}
|
|
926
|
-
var s = typeof Object.is == "function" ? Object.is : o,
|
|
927
|
-
function h(x, p,
|
|
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 h(x, p, w) {
|
|
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
929
|
var m = p();
|
|
930
|
-
if (!
|
|
930
|
+
if (!c) {
|
|
931
931
|
var S = p();
|
|
932
|
-
s(m, S) || (r("The result of getSnapshot should be cached to avoid an infinite loop"),
|
|
932
|
+
s(m, S) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), c = !0);
|
|
933
933
|
}
|
|
934
|
-
var O =
|
|
934
|
+
var O = a({
|
|
935
935
|
inst: {
|
|
936
936
|
value: m,
|
|
937
937
|
getSnapshot: p
|
|
938
938
|
}
|
|
939
|
-
}), k = O[0].inst,
|
|
939
|
+
}), k = O[0].inst, j = O[1];
|
|
940
940
|
return l(function() {
|
|
941
|
-
k.value = m, k.getSnapshot = p, _(k) &&
|
|
941
|
+
k.value = m, k.getSnapshot = p, _(k) && j({
|
|
942
942
|
inst: k
|
|
943
943
|
});
|
|
944
944
|
}, [x, m, p]), u(function() {
|
|
945
|
-
_(k) &&
|
|
945
|
+
_(k) && j({
|
|
946
946
|
inst: k
|
|
947
947
|
});
|
|
948
948
|
var M = function() {
|
|
949
|
-
_(k) &&
|
|
949
|
+
_(k) && j({
|
|
950
950
|
inst: k
|
|
951
951
|
});
|
|
952
952
|
};
|
|
@@ -954,19 +954,19 @@ function Zr() {
|
|
|
954
954
|
}, [x]), d(m), m;
|
|
955
955
|
}
|
|
956
956
|
function _(x) {
|
|
957
|
-
var p = x.getSnapshot,
|
|
957
|
+
var p = x.getSnapshot, w = x.value;
|
|
958
958
|
try {
|
|
959
959
|
var m = p();
|
|
960
|
-
return !s(
|
|
960
|
+
return !s(w, m);
|
|
961
961
|
} catch {
|
|
962
962
|
return !0;
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
|
-
function v(x, p,
|
|
965
|
+
function v(x, p, w) {
|
|
966
966
|
return p();
|
|
967
967
|
}
|
|
968
|
-
var E = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", I = !E, y = I ? v : h,
|
|
969
|
-
tt.useSyncExternalStore =
|
|
968
|
+
var E = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", I = !E, y = I ? v : h, C = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : y;
|
|
969
|
+
tt.useSyncExternalStore = C, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
970
970
|
}()), tt;
|
|
971
971
|
}
|
|
972
972
|
var At;
|
|
@@ -993,8 +993,8 @@ function Qr() {
|
|
|
993
993
|
function r(d, f) {
|
|
994
994
|
return d === f && (d !== 0 || 1 / d === 1 / f) || d !== d && f !== f;
|
|
995
995
|
}
|
|
996
|
-
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef,
|
|
997
|
-
return Qe.useSyncExternalStoreWithSelector = function(d, f,
|
|
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
|
+
return Qe.useSyncExternalStoreWithSelector = function(d, f, c, h, _) {
|
|
998
998
|
var v = s(null);
|
|
999
999
|
if (v.current === null) {
|
|
1000
1000
|
var E = { hasValue: !1, value: null };
|
|
@@ -1003,8 +1003,8 @@ function Qr() {
|
|
|
1003
1003
|
E = v.current;
|
|
1004
1004
|
v = u(function() {
|
|
1005
1005
|
function y(m) {
|
|
1006
|
-
if (!
|
|
1007
|
-
if (
|
|
1006
|
+
if (!C) {
|
|
1007
|
+
if (C = !0, x = m, m = h(m), _ !== void 0 && E.hasValue) {
|
|
1008
1008
|
var S = E.value;
|
|
1009
1009
|
if (_(S, m))
|
|
1010
1010
|
return p = S;
|
|
@@ -1016,15 +1016,15 @@ function Qr() {
|
|
|
1016
1016
|
var O = h(m);
|
|
1017
1017
|
return _ !== void 0 && _(S, O) ? S : (x = m, p = O);
|
|
1018
1018
|
}
|
|
1019
|
-
var
|
|
1019
|
+
var C = !1, x, p, w = c === void 0 ? null : c;
|
|
1020
1020
|
return [function() {
|
|
1021
1021
|
return y(f());
|
|
1022
|
-
},
|
|
1023
|
-
return y(
|
|
1022
|
+
}, w === null ? void 0 : function() {
|
|
1023
|
+
return y(w());
|
|
1024
1024
|
}];
|
|
1025
|
-
}, [f,
|
|
1025
|
+
}, [f, c, h, _]);
|
|
1026
1026
|
var I = o(d, v[0], v[1]);
|
|
1027
|
-
return
|
|
1027
|
+
return a(function() {
|
|
1028
1028
|
E.hasValue = !0, E.value = I;
|
|
1029
1029
|
}, [I]), l(I), I;
|
|
1030
1030
|
}, Qe;
|
|
@@ -1044,20 +1044,20 @@ function en() {
|
|
|
1044
1044
|
return zt || (zt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
1045
1045
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1046
1046
|
var e = g, t = or();
|
|
1047
|
-
function r(f,
|
|
1048
|
-
return f ===
|
|
1047
|
+
function r(f, c) {
|
|
1048
|
+
return f === c && (f !== 0 || 1 / f === 1 / c) || f !== f && c !== c;
|
|
1049
1049
|
}
|
|
1050
|
-
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef,
|
|
1051
|
-
function d(f,
|
|
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, h, _, v) {
|
|
1052
1052
|
var E = s(null), I;
|
|
1053
1053
|
E.current === null ? (I = {
|
|
1054
1054
|
hasValue: !1,
|
|
1055
1055
|
value: null
|
|
1056
1056
|
}, E.current = I) : I = E.current;
|
|
1057
1057
|
var y = u(function() {
|
|
1058
|
-
var
|
|
1059
|
-
if (!
|
|
1060
|
-
|
|
1058
|
+
var w = !1, m, S, O = function(L) {
|
|
1059
|
+
if (!w) {
|
|
1060
|
+
w = !0, m = L;
|
|
1061
1061
|
var N = _(L);
|
|
1062
1062
|
if (v !== void 0 && I.hasValue) {
|
|
1063
1063
|
var U = I.value;
|
|
@@ -1071,14 +1071,14 @@ function en() {
|
|
|
1071
1071
|
return P;
|
|
1072
1072
|
var $ = _(L);
|
|
1073
1073
|
return v !== void 0 && v(P, $) ? P : (m = L, S = $, $);
|
|
1074
|
-
}, k = h === void 0 ? null : h,
|
|
1075
|
-
return O(
|
|
1074
|
+
}, k = h === void 0 ? null : h, j = function() {
|
|
1075
|
+
return O(c());
|
|
1076
1076
|
}, M = k === null ? void 0 : function() {
|
|
1077
1077
|
return O(k());
|
|
1078
1078
|
};
|
|
1079
|
-
return [
|
|
1080
|
-
}, [
|
|
1081
|
-
return
|
|
1079
|
+
return [j, M];
|
|
1080
|
+
}, [c, h, _, v]), C = y[0], x = y[1], p = o(f, C, x);
|
|
1081
|
+
return a(function() {
|
|
1082
1082
|
I.hasValue = !0, I.value = p;
|
|
1083
1083
|
}, [p]), l(p), p;
|
|
1084
1084
|
}
|
|
@@ -1106,17 +1106,17 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1106
1106
|
const n = r * Math.PI / 180, o = e * Math.cos(n) - t * Math.sin(n), s = e * Math.sin(n) + t * Math.cos(n);
|
|
1107
1107
|
return [o, s];
|
|
1108
1108
|
}, ct = ([e, t], { scale: r, rotate: n, translateX: o, translateY: s }) => {
|
|
1109
|
-
const
|
|
1110
|
-
return sr(
|
|
1109
|
+
const a = (e - o) / r, u = (t - s) / r;
|
|
1110
|
+
return sr(a, u, -n);
|
|
1111
1111
|
}, Be = ([e, t], { scale: r, rotate: n, translateX: o, translateY: s }) => {
|
|
1112
|
-
const [
|
|
1113
|
-
return [
|
|
1112
|
+
const [a, u] = sr(e, t, n);
|
|
1113
|
+
return [a * r + o, u * r + s];
|
|
1114
1114
|
}, Yt = (e, t, r, n) => {
|
|
1115
|
-
const o = e.x, s = e.y,
|
|
1115
|
+
const o = e.x, s = e.y, a = t.x, u = t.y, l = r.x, d = r.y, f = a - o, c = u - s, h = o - l, _ = s - d, v = f * f + c * c, E = 2 * (h * f + _ * c), I = h * h + _ * _ - n * n, y = E * E - 4 * v * I;
|
|
1116
1116
|
if (y < 0)
|
|
1117
1117
|
return [];
|
|
1118
|
-
const
|
|
1119
|
-
return
|
|
1118
|
+
const C = (-E + Math.sqrt(y)) / (2 * v), x = (-E - Math.sqrt(y)) / (2 * v), p = [];
|
|
1119
|
+
return C >= 0 && C <= 1 && p.push({ x: o + C * f, y: s + C * c }), x >= 0 && x <= 1 && p.push({ x: o + x * f, y: s + x * c }), p;
|
|
1120
1120
|
}, ft = (e, t) => e.x > t.left && e.x < t.left + t.width && e.y > t.top && e.y < t.top + t.height, nn = (e, t) => Array.from(e.querySelectorAll(".corner")).every((n) => {
|
|
1121
1121
|
const { top: o, left: s } = n.getBoundingClientRect();
|
|
1122
1122
|
return ft({ x: s, y: o }, t);
|
|
@@ -1140,17 +1140,17 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1140
1140
|
const s = Ne(t, o);
|
|
1141
1141
|
if (!s)
|
|
1142
1142
|
return n || null;
|
|
1143
|
-
const { left:
|
|
1143
|
+
const { left: a, right: u, top: l, bottom: d } = s.getBoundingClientRect();
|
|
1144
1144
|
let f;
|
|
1145
1145
|
return n ? f = n : f = {
|
|
1146
|
-
left:
|
|
1146
|
+
left: a,
|
|
1147
1147
|
top: l,
|
|
1148
1148
|
right: u,
|
|
1149
1149
|
bottom: d
|
|
1150
|
-
}, f.left = Math.min(
|
|
1150
|
+
}, f.left = Math.min(a, f.left), f.top = Math.min(l, f.top), f.right = Math.max(u, f.right), f.bottom = Math.max(d, f.bottom), f;
|
|
1151
1151
|
}, null);
|
|
1152
1152
|
return r && (r.width = r.right - r.left, r.height = r.bottom - r.top, r);
|
|
1153
|
-
}, ir = (e, t, r = null) => (r === null && (r = /* @__PURE__ */ new Set()), !t || t.length === 0 ? [] : t.map((n) => r.has(n) ? [] : (r.add(n), [
|
|
1153
|
+
}, ir = (e, t, r = null) => (r === null && (r = /* @__PURE__ */ new Set()), !Array.isArray(t) || t.length === 0 ? [] : t.map((n) => r.has(n) ? [] : (r.add(n), [
|
|
1154
1154
|
n,
|
|
1155
1155
|
...ir(
|
|
1156
1156
|
e,
|
|
@@ -1160,29 +1160,29 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1160
1160
|
])).flat()), Bt = (e, t, r) => {
|
|
1161
1161
|
const n = new Set(ir(e, r));
|
|
1162
1162
|
return t.filter((o) => n.has(o));
|
|
1163
|
-
}, an = ({ x: e, y: t, width: r, height: n }, { type: o = "grid", size: s = 1, offset:
|
|
1163
|
+
}, an = ({ x: e, y: t, width: r, height: n }, { type: o = "grid", size: s = 1, offset: a = { x: 0, y: 0 } }) => {
|
|
1164
1164
|
const [u, l] = [
|
|
1165
|
-
e + r / 2 -
|
|
1166
|
-
t + n / 2 -
|
|
1165
|
+
e + r / 2 - a.x,
|
|
1166
|
+
t + n / 2 - a.y
|
|
1167
1167
|
];
|
|
1168
|
-
let d, f,
|
|
1168
|
+
let d, f, c, h, _, v, E, I, y, C;
|
|
1169
1169
|
const x = s / 1.1547;
|
|
1170
1170
|
switch (o) {
|
|
1171
1171
|
case "grid":
|
|
1172
1172
|
d = Math.round(u / s) * s, f = Math.round(l / s) * s;
|
|
1173
1173
|
break;
|
|
1174
1174
|
case "hexH":
|
|
1175
|
-
|
|
1175
|
+
c = 2 * x, h = 3 * s, _ = Math.round(u / c) * c, E = Math.round(l / h) * h, v = _ > u ? _ - x : _ + x, I = E > l ? E - 1.5 * s : E + 1.5 * s, y = Math.hypot(_ - u, E - l), C = Math.hypot(v - u, I - l), y < C ? (d = _, f = E) : (d = v, f = I);
|
|
1176
1176
|
break;
|
|
1177
1177
|
case "hexV":
|
|
1178
|
-
|
|
1178
|
+
c = 3 * s, h = 2 * x, _ = Math.round(u / c) * c, E = Math.round(l / h) * h, v = _ > u ? _ - 1.5 * s : _ + 1.5 * s, I = E > l ? E - x : E + x, y = Math.hypot(_ - u, E - l), C = Math.hypot(v - u, I - l), y < C ? (d = _, f = E) : (d = v, f = I);
|
|
1179
1179
|
break;
|
|
1180
1180
|
default:
|
|
1181
1181
|
d = e + r / 2, f = t + n / 2;
|
|
1182
1182
|
}
|
|
1183
1183
|
return {
|
|
1184
|
-
x: d +
|
|
1185
|
-
y: f +
|
|
1184
|
+
x: d + a.x - r / 2,
|
|
1185
|
+
y: f + a.y - n / 2
|
|
1186
1186
|
};
|
|
1187
1187
|
}, Nt = [
|
|
1188
1188
|
"#037758",
|
|
@@ -1215,7 +1215,7 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1215
1215
|
"#007a4b",
|
|
1216
1216
|
"#bf0daa",
|
|
1217
1217
|
"#af0ad8"
|
|
1218
|
-
], Xt = () => Nt[Math.floor(Math.random() * Nt.length)], cn = !1, dt = ({ wire: e, storeName: t, noSync: r = [], defaultValue: n }, o) => (s,
|
|
1218
|
+
], Xt = () => Nt[Math.floor(Math.random() * Nt.length)], cn = !1, dt = ({ wire: e, storeName: t, noSync: r = [], defaultValue: n }, o) => (s, a, u) => {
|
|
1219
1219
|
s({ ready: !1 });
|
|
1220
1220
|
const l = [];
|
|
1221
1221
|
(async () => {
|
|
@@ -1229,7 +1229,7 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1229
1229
|
await e.register(
|
|
1230
1230
|
`${t}_getValue`,
|
|
1231
1231
|
() => Object.fromEntries(
|
|
1232
|
-
Object.entries(
|
|
1232
|
+
Object.entries(a()).filter(
|
|
1233
1233
|
([_, v]) => typeof v != "function" && !r.includes(_)
|
|
1234
1234
|
)
|
|
1235
1235
|
),
|
|
@@ -1237,11 +1237,11 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1237
1237
|
)
|
|
1238
1238
|
), l.push(
|
|
1239
1239
|
e.subscribe(`${t}_call`, ([_, v]) => {
|
|
1240
|
-
|
|
1240
|
+
c[_](...v);
|
|
1241
1241
|
})
|
|
1242
1242
|
), s({ ready: !0 });
|
|
1243
1243
|
})();
|
|
1244
|
-
const f = o(s,
|
|
1244
|
+
const f = o(s, a, u), c = { ...f }, h = Object.fromEntries(
|
|
1245
1245
|
// Send the update message on all method calls
|
|
1246
1246
|
Object.entries(f).map(([_, v]) => typeof v == "function" && !_.startsWith("get") && !r.includes(_) ? [_, (...I) => {
|
|
1247
1247
|
const y = v(...I);
|
|
@@ -1285,12 +1285,14 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1285
1285
|
items: {},
|
|
1286
1286
|
getItems: () => t().items,
|
|
1287
1287
|
setItems: (r) => e({ items: r }),
|
|
1288
|
-
updateItems: (r) => e((
|
|
1288
|
+
updateItems: (r, n = !1) => e((o) => n ? { items: Object.fromEntries(
|
|
1289
|
+
Object.entries(o.items).map(([a, u]) => r[a] ? [a, { ...u, ...r[a] }] : [a, u])
|
|
1290
|
+
) } : { items: { ...o.items, ...r } }),
|
|
1289
1291
|
moveItems: (r, n) => e(({ items: o }) => {
|
|
1290
1292
|
const s = { ...o };
|
|
1291
|
-
return r.forEach((
|
|
1292
|
-
const u = o[
|
|
1293
|
-
u && (s[
|
|
1293
|
+
return r.forEach((a) => {
|
|
1294
|
+
const u = o[a];
|
|
1295
|
+
u && (s[a] = {
|
|
1294
1296
|
...u,
|
|
1295
1297
|
x: (u.x || 0) + n.x,
|
|
1296
1298
|
y: (u.y || 0) + n.y,
|
|
@@ -1336,12 +1338,12 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1336
1338
|
}),
|
|
1337
1339
|
insertItems: (r, n) => e((o) => {
|
|
1338
1340
|
let s;
|
|
1339
|
-
const
|
|
1341
|
+
const a = r.map(({ id: u }) => u);
|
|
1340
1342
|
if (n) {
|
|
1341
1343
|
const u = o.itemIds.findIndex((l) => l === n);
|
|
1342
|
-
s = [...o.itemIds], s.splice(u, 0, ...
|
|
1344
|
+
s = [...o.itemIds], s.splice(u, 0, ...a);
|
|
1343
1345
|
} else
|
|
1344
|
-
s = [...o.itemIds, ...
|
|
1346
|
+
s = [...o.itemIds, ...a];
|
|
1345
1347
|
return {
|
|
1346
1348
|
items: {
|
|
1347
1349
|
...o.items,
|
|
@@ -1361,7 +1363,7 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1361
1363
|
setSessionInfo: (r) => e({ session: r }),
|
|
1362
1364
|
updateSessionInfo: (r) => e((n) => ({ session: { ...n.session, ...r } }))
|
|
1363
1365
|
}), Ut = ({ storeName: e, children: t, defaultValue: r }) => {
|
|
1364
|
-
const { wire: n } = Xe("room"), [o, s] = g.useState(!1), [
|
|
1366
|
+
const { wire: n } = Xe("room"), [o, s] = g.useState(!1), [a] = g.useState(
|
|
1365
1367
|
() => Ue(
|
|
1366
1368
|
dt({ wire: n, storeName: e, defaultValue: r }, (...u) => ({
|
|
1367
1369
|
...un(...u),
|
|
@@ -1373,15 +1375,15 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1373
1375
|
)
|
|
1374
1376
|
);
|
|
1375
1377
|
return g.useEffect(() => {
|
|
1376
|
-
const u =
|
|
1378
|
+
const u = a.subscribe((l) => {
|
|
1377
1379
|
l.ready && (u(), s(!0));
|
|
1378
1380
|
});
|
|
1379
|
-
}, [
|
|
1380
|
-
},
|
|
1381
|
+
}, [a]), o ? /* @__PURE__ */ T(ar.Provider, { value: a, children: t }) : null;
|
|
1382
|
+
}, ne = (e, t) => {
|
|
1381
1383
|
const r = _e(ar);
|
|
1382
1384
|
return We(r, e, t || Ve);
|
|
1383
1385
|
}, ns = () => {
|
|
1384
|
-
const [e, t] =
|
|
1386
|
+
const [e, t] = ne((n) => [
|
|
1385
1387
|
n.itemIds,
|
|
1386
1388
|
n.items
|
|
1387
1389
|
]);
|
|
@@ -1390,15 +1392,15 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1390
1392
|
[e, t]
|
|
1391
1393
|
);
|
|
1392
1394
|
}, os = () => {
|
|
1393
|
-
const [e, t, r] =
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1395
|
+
const [e, t, r] = ne((a) => [
|
|
1396
|
+
a.items,
|
|
1397
|
+
a.itemIds,
|
|
1398
|
+
a.getItemList
|
|
1397
1399
|
]), [n, o] = g.useState(r()), [, s] = g.useTransition();
|
|
1398
1400
|
return g.useEffect(() => {
|
|
1399
|
-
const
|
|
1401
|
+
const a = r();
|
|
1400
1402
|
s(() => {
|
|
1401
|
-
o(
|
|
1403
|
+
o(a);
|
|
1402
1404
|
});
|
|
1403
1405
|
}, [e, t, r]), n;
|
|
1404
1406
|
}, cr = 5e4, ur = g.createContext(), mn = (e, t) => ({
|
|
@@ -1438,7 +1440,7 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1438
1440
|
}),
|
|
1439
1441
|
unregister: (r, n) => e((o) => {
|
|
1440
1442
|
const s = (o.interactions[r] || []).filter(
|
|
1441
|
-
(
|
|
1443
|
+
(a) => a !== n
|
|
1442
1444
|
);
|
|
1443
1445
|
return {
|
|
1444
1446
|
interactions: { ...o.interactions, [r]: s }
|
|
@@ -1479,11 +1481,11 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1479
1481
|
}))
|
|
1480
1482
|
);
|
|
1481
1483
|
return /* @__PURE__ */ T(ur.Provider, { value: t, children: e });
|
|
1482
|
-
},
|
|
1484
|
+
}, Q = (e, t) => {
|
|
1483
1485
|
const r = _e(ur);
|
|
1484
1486
|
return We(r, e, t || Ve);
|
|
1485
1487
|
}, ss = () => {
|
|
1486
|
-
const [e] =
|
|
1488
|
+
const [e] = Q((t) => [t.selection]);
|
|
1487
1489
|
return e;
|
|
1488
1490
|
};
|
|
1489
1491
|
function pt(e) {
|
|
@@ -1505,18 +1507,18 @@ function yn(e) {
|
|
|
1505
1507
|
);
|
|
1506
1508
|
}
|
|
1507
1509
|
function mt(e, t, r, n = 0) {
|
|
1508
|
-
const o = Re(), s = Re(),
|
|
1510
|
+
const o = Re(), s = Re(), a = Re(), u = () => {
|
|
1509
1511
|
o.current && (clearTimeout(o.current), o.current = void 0), s.current && (clearTimeout(s.current), s.current = void 0);
|
|
1510
1512
|
};
|
|
1511
1513
|
return yn(u), lt(
|
|
1512
1514
|
() => {
|
|
1513
1515
|
const l = () => {
|
|
1514
|
-
if (!
|
|
1516
|
+
if (!a.current)
|
|
1515
1517
|
return;
|
|
1516
|
-
const f =
|
|
1517
|
-
|
|
1518
|
+
const f = a.current;
|
|
1519
|
+
a.current = void 0, e.apply(f.this, f.args), u();
|
|
1518
1520
|
}, d = function(...f) {
|
|
1519
|
-
o.current && clearTimeout(o.current),
|
|
1521
|
+
o.current && clearTimeout(o.current), a.current = { args: f, this: this }, o.current = setTimeout(l, r), n > 0 && !s.current && (s.current = setTimeout(l, n));
|
|
1520
1522
|
};
|
|
1521
1523
|
return Object.defineProperties(d, {
|
|
1522
1524
|
length: { value: e.length },
|
|
@@ -1534,18 +1536,18 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1534
1536
|
rotate: n,
|
|
1535
1537
|
itemExtent: o,
|
|
1536
1538
|
boardWrapperRect: s,
|
|
1537
|
-
boardSize:
|
|
1539
|
+
boardSize: a
|
|
1538
1540
|
}) => {
|
|
1539
1541
|
let [u, l] = [e, t];
|
|
1540
1542
|
const d = ct(
|
|
1541
1543
|
[s.width / 2, s.height / 2],
|
|
1542
1544
|
{ translateX: u, translateY: l, scale: r, rotate: n }
|
|
1543
1545
|
), f = {
|
|
1544
|
-
x: o.x +
|
|
1545
|
-
y: o.y +
|
|
1546
|
-
},
|
|
1547
|
-
x:
|
|
1548
|
-
y:
|
|
1546
|
+
x: o.x + a / 2,
|
|
1547
|
+
y: o.y + a / 2
|
|
1548
|
+
}, c = {
|
|
1549
|
+
x: a / 2,
|
|
1550
|
+
y: a / 2
|
|
1549
1551
|
}, h = ze(d, [f.x, f.y]), _ = Math.min(s.width, s.height), v = o.radius + _ / 2 / r - Sn / r;
|
|
1550
1552
|
if (h > v) {
|
|
1551
1553
|
const y = Yt(
|
|
@@ -1553,30 +1555,30 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1553
1555
|
f,
|
|
1554
1556
|
f,
|
|
1555
1557
|
v - 1 / r
|
|
1556
|
-
)[0], [
|
|
1558
|
+
)[0], [C, x] = Be([-y.x, -y.y], {
|
|
1557
1559
|
translateX: s.width / 2,
|
|
1558
1560
|
translateY: s.height / 2,
|
|
1559
1561
|
scale: r,
|
|
1560
1562
|
rotate: n
|
|
1561
1563
|
});
|
|
1562
|
-
u =
|
|
1564
|
+
u = C, l = x;
|
|
1563
1565
|
}
|
|
1564
|
-
const E = ze(d, [
|
|
1566
|
+
const E = ze(d, [c.x, c.y]), I = a / 2 - ze([0, 0], [s.width, s.height]) / r;
|
|
1565
1567
|
if (E > I) {
|
|
1566
1568
|
const y = Yt(
|
|
1567
1569
|
{ x: d[0], y: d[1] },
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
+
c,
|
|
1571
|
+
c,
|
|
1570
1572
|
I - 1 / r
|
|
1571
1573
|
)[0];
|
|
1572
1574
|
if (y) {
|
|
1573
|
-
const [
|
|
1575
|
+
const [C, x] = Be([-y.x, -y.y], {
|
|
1574
1576
|
translateX: s.width / 2,
|
|
1575
1577
|
translateY: s.height / 2,
|
|
1576
1578
|
scale: r,
|
|
1577
1579
|
rotate: n
|
|
1578
1580
|
});
|
|
1579
|
-
u =
|
|
1581
|
+
u = C, l = x;
|
|
1580
1582
|
}
|
|
1581
1583
|
}
|
|
1582
1584
|
return [u, l];
|
|
@@ -1587,25 +1589,25 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1587
1589
|
r,
|
|
1588
1590
|
n,
|
|
1589
1591
|
o
|
|
1590
|
-
] =
|
|
1592
|
+
] = Q((p) => [
|
|
1591
1593
|
p.getBoardState,
|
|
1592
1594
|
p.updateBoardState,
|
|
1593
1595
|
p.config.itemExtent,
|
|
1594
1596
|
p.getConfiguration,
|
|
1595
1597
|
p.updateConfiguration
|
|
1596
|
-
]), s = g.useRef([0.15, 5]), [
|
|
1597
|
-
const { translateX: p, translateY:
|
|
1598
|
-
return { translateX: p, translateY:
|
|
1598
|
+
]), s = g.useRef([0.15, 5]), [a] = ne((p) => [p.getItemList]), u = g.useCallback(() => {
|
|
1599
|
+
const { translateX: p, translateY: w, scale: m, rotate: S } = e();
|
|
1600
|
+
return { translateX: p, translateY: w, scale: m, rotate: S };
|
|
1599
1601
|
}, [e]), l = g.useCallback(
|
|
1600
|
-
(p,
|
|
1602
|
+
(p, w) => ct([p, w], e()),
|
|
1601
1603
|
[e]
|
|
1602
1604
|
), d = g.useCallback(
|
|
1603
|
-
(p,
|
|
1605
|
+
(p, w) => Be([p, w], e()),
|
|
1604
1606
|
[e]
|
|
1605
1607
|
), f = g.useCallback(
|
|
1606
|
-
(p,
|
|
1608
|
+
(p, w) => {
|
|
1607
1609
|
const { scale: m, rotate: S } = e();
|
|
1608
|
-
return ct([p,
|
|
1610
|
+
return ct([p, w], {
|
|
1609
1611
|
translateX: 0,
|
|
1610
1612
|
translateY: 0,
|
|
1611
1613
|
rotate: S,
|
|
@@ -1613,24 +1615,24 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1613
1615
|
});
|
|
1614
1616
|
},
|
|
1615
1617
|
[e]
|
|
1616
|
-
),
|
|
1618
|
+
), c = g.useCallback((p) => p > s.current[1] ? s.current[1] : p < s.current[0] ? s.current[0] : p, []), h = g.useCallback(
|
|
1617
1619
|
(p) => {
|
|
1618
|
-
const { itemExtent:
|
|
1620
|
+
const { itemExtent: w, boardWrapperRect: m, boardSize: S } = n(), O = e(), {
|
|
1619
1621
|
translateX: k,
|
|
1620
|
-
translateY:
|
|
1622
|
+
translateY: j,
|
|
1621
1623
|
scale: M,
|
|
1622
1624
|
rotate: L
|
|
1623
1625
|
} = {
|
|
1624
1626
|
...O,
|
|
1625
1627
|
...p(O)
|
|
1626
|
-
}, N =
|
|
1627
|
-
let [U, J] = [k,
|
|
1628
|
-
(k !== O.translateX ||
|
|
1628
|
+
}, N = c(M);
|
|
1629
|
+
let [U, J] = [k, j];
|
|
1630
|
+
(k !== O.translateX || j !== O.translateY) && ([U, J] = En({
|
|
1629
1631
|
x: k,
|
|
1630
|
-
y:
|
|
1632
|
+
y: j,
|
|
1631
1633
|
scale: N,
|
|
1632
1634
|
rotate: L,
|
|
1633
|
-
itemExtent:
|
|
1635
|
+
itemExtent: w,
|
|
1634
1636
|
boardWrapperRect: m,
|
|
1635
1637
|
boardSize: S
|
|
1636
1638
|
})), t({
|
|
@@ -1640,13 +1642,13 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1640
1642
|
rotate: L
|
|
1641
1643
|
});
|
|
1642
1644
|
},
|
|
1643
|
-
[
|
|
1645
|
+
[c, e, n, t]
|
|
1644
1646
|
), _ = g.useCallback(
|
|
1645
1647
|
(p) => {
|
|
1646
|
-
let
|
|
1647
|
-
typeof p == "function" && (
|
|
1648
|
+
let w = (m) => ({ ...m, ...p });
|
|
1649
|
+
typeof p == "function" && (w = p), h((m) => ({
|
|
1648
1650
|
...m,
|
|
1649
|
-
...
|
|
1651
|
+
...w({
|
|
1650
1652
|
translateX: m.translateX,
|
|
1651
1653
|
translateY: m.translateY
|
|
1652
1654
|
})
|
|
@@ -1654,14 +1656,14 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1654
1656
|
},
|
|
1655
1657
|
[h]
|
|
1656
1658
|
), v = g.useCallback(
|
|
1657
|
-
({ to: p, factor:
|
|
1659
|
+
({ to: p, factor: w }) => {
|
|
1658
1660
|
const { boardWrapperRect: m } = n();
|
|
1659
1661
|
let S = p;
|
|
1660
1662
|
S || (S = {
|
|
1661
1663
|
x: m.left + m.width / 2,
|
|
1662
1664
|
y: m.top + m.height / 2
|
|
1663
1665
|
});
|
|
1664
|
-
const O = e(), k =
|
|
1666
|
+
const O = e(), k = c(O.scale * w), j = S.x - m.left, M = S.y - m.top, L = j - (j - O.translateX) * k / O.scale, N = M - (M - O.translateY) * k / O.scale;
|
|
1665
1667
|
h((U) => ({
|
|
1666
1668
|
...U,
|
|
1667
1669
|
translateX: L,
|
|
@@ -1669,11 +1671,11 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1669
1671
|
scale: k
|
|
1670
1672
|
}));
|
|
1671
1673
|
},
|
|
1672
|
-
[
|
|
1674
|
+
[c, e, n, h]
|
|
1673
1675
|
), E = g.useCallback(
|
|
1674
|
-
({ x: p, y:
|
|
1675
|
-
const { rotate: S } = e(), { boardWrapperRect: O, boardSize: k } = n(),
|
|
1676
|
-
[-k / 2 - p, -k / 2 -
|
|
1676
|
+
({ x: p, y: w, radius: m }) => {
|
|
1677
|
+
const { rotate: S } = e(), { boardWrapperRect: O, boardSize: k } = n(), j = O.width / (m * 2), M = O.height / (m * 2), L = c(Math.min(j, M) * bn), [N, U] = Be(
|
|
1678
|
+
[-k / 2 - p, -k / 2 - w],
|
|
1677
1679
|
{
|
|
1678
1680
|
translateX: O.width / 2,
|
|
1679
1681
|
translateY: O.height / 2,
|
|
@@ -1683,25 +1685,25 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1683
1685
|
);
|
|
1684
1686
|
h((J) => ({ ...J, translateX: N, translateY: U, scale: L }));
|
|
1685
1687
|
},
|
|
1686
|
-
[
|
|
1688
|
+
[c, e, n, h]
|
|
1687
1689
|
), I = g.useCallback(() => {
|
|
1688
|
-
const { boardWrapperRect: p, boardSize:
|
|
1690
|
+
const { boardWrapperRect: p, boardSize: w } = n(), [m, S] = l(
|
|
1689
1691
|
p.width / 2,
|
|
1690
1692
|
p.height / 2
|
|
1691
1693
|
);
|
|
1692
1694
|
return {
|
|
1693
|
-
x: m -
|
|
1694
|
-
y: S -
|
|
1695
|
+
x: m - w / 2,
|
|
1696
|
+
y: S - w / 2
|
|
1695
1697
|
};
|
|
1696
1698
|
}, [l, n]), y = g.useCallback(() => {
|
|
1697
|
-
const p =
|
|
1698
|
-
(k,
|
|
1699
|
-
const M = Ne(
|
|
1700
|
-
return k.left = Math.min(
|
|
1701
|
-
|
|
1699
|
+
const p = a(), { boardWrapper: w, boardSize: m } = n(), S = p.reduce(
|
|
1700
|
+
(k, j) => {
|
|
1701
|
+
const M = Ne(w, j.id);
|
|
1702
|
+
return k.left = Math.min(j.x, k.left), k.top = Math.min(j.y, k.top), k.right = Math.max(
|
|
1703
|
+
j.x + M.offsetWidth,
|
|
1702
1704
|
k.right
|
|
1703
1705
|
), k.bottom = Math.max(
|
|
1704
|
-
|
|
1706
|
+
j.y + M.offsetHeight,
|
|
1705
1707
|
k.bottom
|
|
1706
1708
|
), k;
|
|
1707
1709
|
},
|
|
@@ -1719,10 +1721,10 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1719
1721
|
ze([O.x, O.y], [S.left, S.top]),
|
|
1720
1722
|
_n
|
|
1721
1723
|
), o({ itemExtent: O });
|
|
1722
|
-
}, [n,
|
|
1724
|
+
}, [n, a, o]), C = g.useCallback(
|
|
1723
1725
|
(p) => {
|
|
1724
|
-
let
|
|
1725
|
-
typeof p == "function" && (
|
|
1726
|
+
let w = () => p;
|
|
1727
|
+
typeof p == "function" && (w = p), h((m) => ({ ...m, rotate: w(m.rotate) })), y(), E(r);
|
|
1726
1728
|
},
|
|
1727
1729
|
[r, h, y, E]
|
|
1728
1730
|
), x = mt(
|
|
@@ -1732,7 +1734,7 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1732
1734
|
);
|
|
1733
1735
|
return {
|
|
1734
1736
|
setDim: h,
|
|
1735
|
-
rotateBoard:
|
|
1737
|
+
rotateBoard: C,
|
|
1736
1738
|
moveBoard: _,
|
|
1737
1739
|
getDim: u,
|
|
1738
1740
|
zoomTo: v,
|
|
@@ -1745,26 +1747,26 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1745
1747
|
fromBoardToWrapper: d
|
|
1746
1748
|
};
|
|
1747
1749
|
}, Vt = (e) => {
|
|
1748
|
-
const [t, r, n] =
|
|
1749
|
-
({ register:
|
|
1750
|
-
|
|
1750
|
+
const [t, r, n] = Q(
|
|
1751
|
+
({ register: a, unregister: u, callInteractions: l }) => [
|
|
1752
|
+
a,
|
|
1751
1753
|
u,
|
|
1752
1754
|
l
|
|
1753
1755
|
]
|
|
1754
1756
|
), o = g.useCallback(
|
|
1755
|
-
(
|
|
1756
|
-
r(e,
|
|
1757
|
+
(a) => (t(e, a), () => {
|
|
1758
|
+
r(e, a);
|
|
1757
1759
|
}),
|
|
1758
1760
|
[e, t, r]
|
|
1759
1761
|
), s = g.useCallback(
|
|
1760
|
-
(
|
|
1761
|
-
n(e,
|
|
1762
|
+
(a) => {
|
|
1763
|
+
n(e, a);
|
|
1762
1764
|
},
|
|
1763
1765
|
[n, e]
|
|
1764
1766
|
);
|
|
1765
1767
|
return { register: o, call: s };
|
|
1766
1768
|
}, gt = () => {
|
|
1767
|
-
const { call: e } = Vt("place"), { call: t } = Vt("delete"), { getCenter: r, updateItemExtent: n } = Me(), [o, s,
|
|
1769
|
+
const { call: e } = Vt("place"), { call: t } = Vt("delete"), { getCenter: r, updateItemExtent: n } = Me(), [o, s, a, u] = Q((P) => [
|
|
1768
1770
|
P.clear,
|
|
1769
1771
|
P.reverse,
|
|
1770
1772
|
P.unselect,
|
|
@@ -1773,52 +1775,55 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1773
1775
|
getItems: l,
|
|
1774
1776
|
getItemIds: d,
|
|
1775
1777
|
setItemIds: f,
|
|
1776
|
-
updateItems:
|
|
1778
|
+
updateItems: c,
|
|
1777
1779
|
moveItems: h,
|
|
1778
1780
|
removeItemsById: _,
|
|
1779
1781
|
getItemList: v,
|
|
1780
1782
|
insertItems: E,
|
|
1781
1783
|
setItemList: I
|
|
1782
|
-
} =
|
|
1784
|
+
} = ne(
|
|
1783
1785
|
({
|
|
1784
1786
|
getItems: P,
|
|
1785
1787
|
getItemIds: $,
|
|
1786
|
-
setItemIds:
|
|
1788
|
+
setItemIds: Y,
|
|
1787
1789
|
updateItems: V,
|
|
1788
1790
|
moveItems: A,
|
|
1789
|
-
removeItemsById:
|
|
1790
|
-
getItemList:
|
|
1791
|
-
insertItems:
|
|
1792
|
-
setItemList:
|
|
1791
|
+
removeItemsById: F,
|
|
1792
|
+
getItemList: H,
|
|
1793
|
+
insertItems: Z,
|
|
1794
|
+
setItemList: te
|
|
1793
1795
|
}) => ({
|
|
1794
1796
|
getItems: P,
|
|
1795
1797
|
getItemIds: $,
|
|
1796
|
-
setItemIds:
|
|
1798
|
+
setItemIds: Y,
|
|
1797
1799
|
updateItems: V,
|
|
1798
1800
|
moveItems: A,
|
|
1799
|
-
removeItemsById:
|
|
1800
|
-
getItemList:
|
|
1801
|
-
insertItems:
|
|
1802
|
-
setItemList:
|
|
1801
|
+
removeItemsById: F,
|
|
1802
|
+
getItemList: H,
|
|
1803
|
+
insertItems: Z,
|
|
1804
|
+
setItemList: te
|
|
1803
1805
|
})
|
|
1804
1806
|
), y = g.useCallback(
|
|
1805
|
-
(P,
|
|
1806
|
-
let
|
|
1807
|
-
typeof $ == "object" && (
|
|
1808
|
-
const
|
|
1809
|
-
|
|
1807
|
+
(P, $, Y = !1) => {
|
|
1808
|
+
let V = $;
|
|
1809
|
+
typeof $ == "object" && (V = () => $);
|
|
1810
|
+
const A = d().filter((Z) => P.includes(Z)), F = l(), H = Object.fromEntries(
|
|
1811
|
+
A.map((Z) => {
|
|
1812
|
+
const te = F[Z];
|
|
1813
|
+
return Y ? [Z, V(te)] : [Z, V({ ...te })];
|
|
1814
|
+
})
|
|
1810
1815
|
);
|
|
1811
|
-
|
|
1816
|
+
c(H, Y), n();
|
|
1812
1817
|
},
|
|
1813
|
-
[d, l, n,
|
|
1814
|
-
),
|
|
1818
|
+
[d, l, n, c]
|
|
1819
|
+
), C = g.useCallback(
|
|
1815
1820
|
(P) => {
|
|
1816
1821
|
I(P), o(), n();
|
|
1817
1822
|
},
|
|
1818
1823
|
[o, I, n]
|
|
1819
1824
|
), x = g.useCallback(
|
|
1820
|
-
(P,
|
|
1821
|
-
y([P],
|
|
1825
|
+
(P, $, Y = !1) => {
|
|
1826
|
+
y([P], $, Y);
|
|
1822
1827
|
},
|
|
1823
1828
|
[y]
|
|
1824
1829
|
), p = g.useCallback(
|
|
@@ -1829,57 +1834,61 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1829
1834
|
), n();
|
|
1830
1835
|
},
|
|
1831
1836
|
[d, l, h, n]
|
|
1832
|
-
),
|
|
1837
|
+
), w = g.useCallback(
|
|
1833
1838
|
(P) => {
|
|
1834
|
-
const $ = d(),
|
|
1839
|
+
const $ = d(), Y = $.filter((A) => !P.includes(A)), V = $.filter(
|
|
1835
1840
|
(A) => P.includes(A)
|
|
1836
1841
|
);
|
|
1837
|
-
f([...
|
|
1842
|
+
f([...Y, ...V]);
|
|
1838
1843
|
},
|
|
1839
1844
|
[d, f]
|
|
1840
1845
|
), m = g.useCallback(
|
|
1841
|
-
(P, { type: $, size:
|
|
1846
|
+
(P, { type: $, size: Y } = {}) => {
|
|
1842
1847
|
const { boardWrapper: V } = u();
|
|
1843
|
-
y(
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1848
|
+
y(
|
|
1849
|
+
P,
|
|
1850
|
+
(A) => {
|
|
1851
|
+
const F = Ne(V, A.id);
|
|
1852
|
+
if (!F)
|
|
1853
|
+
return;
|
|
1854
|
+
const H = {
|
|
1855
|
+
type: $ || "grid",
|
|
1856
|
+
size: Y || 1,
|
|
1857
|
+
offset: { x: 0, y: 0 },
|
|
1858
|
+
...A.grid
|
|
1859
|
+
};
|
|
1860
|
+
return an(
|
|
1861
|
+
{
|
|
1862
|
+
x: A.x,
|
|
1863
|
+
y: A.y,
|
|
1864
|
+
width: F.clientWidth,
|
|
1865
|
+
height: F.clientHeight
|
|
1866
|
+
},
|
|
1867
|
+
H
|
|
1868
|
+
);
|
|
1869
|
+
},
|
|
1870
|
+
!0
|
|
1871
|
+
);
|
|
1863
1872
|
},
|
|
1864
1873
|
[u, y]
|
|
1865
1874
|
), S = g.useCallback(
|
|
1866
1875
|
(P, $) => {
|
|
1867
|
-
const
|
|
1876
|
+
const Y = Bt(
|
|
1868
1877
|
l(),
|
|
1869
1878
|
d(),
|
|
1870
1879
|
P
|
|
1871
1880
|
);
|
|
1872
|
-
|
|
1881
|
+
w(Y), y(Y, (V) => {
|
|
1873
1882
|
const A = { ...V };
|
|
1874
1883
|
return delete A.moving, A;
|
|
1875
|
-
}), m(
|
|
1884
|
+
}), m(Y, $), e(P), n();
|
|
1876
1885
|
},
|
|
1877
1886
|
[
|
|
1878
1887
|
y,
|
|
1879
1888
|
e,
|
|
1880
1889
|
d,
|
|
1881
1890
|
l,
|
|
1882
|
-
|
|
1891
|
+
w,
|
|
1883
1892
|
m,
|
|
1884
1893
|
n
|
|
1885
1894
|
]
|
|
@@ -1890,36 +1899,36 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1890
1899
|
[f]
|
|
1891
1900
|
), k = g.useCallback(
|
|
1892
1901
|
(P) => {
|
|
1893
|
-
const $ = d(),
|
|
1902
|
+
const $ = d(), Y = $.filter(
|
|
1894
1903
|
(A) => P.includes(A)
|
|
1895
|
-
), V = $.map((A) => P.includes(A) ?
|
|
1904
|
+
), V = $.map((A) => P.includes(A) ? Y.pop() : A);
|
|
1896
1905
|
f(V), s();
|
|
1897
1906
|
},
|
|
1898
1907
|
[d, s, f]
|
|
1899
|
-
),
|
|
1908
|
+
), j = g.useCallback(
|
|
1900
1909
|
(P, $) => {
|
|
1901
|
-
const
|
|
1902
|
-
$.map((
|
|
1903
|
-
const
|
|
1910
|
+
const Y = l(), V = Object.fromEntries(
|
|
1911
|
+
$.map((H, Z) => {
|
|
1912
|
+
const te = Y[P[Z]];
|
|
1904
1913
|
return [
|
|
1905
|
-
|
|
1914
|
+
H,
|
|
1906
1915
|
{
|
|
1907
|
-
x:
|
|
1908
|
-
y:
|
|
1916
|
+
x: te.x,
|
|
1917
|
+
y: te.y
|
|
1909
1918
|
}
|
|
1910
1919
|
];
|
|
1911
1920
|
})
|
|
1912
1921
|
);
|
|
1913
|
-
y(P, (
|
|
1922
|
+
y(P, (H) => ({ ...H, ...V[H.id] }));
|
|
1914
1923
|
const A = Object.fromEntries(
|
|
1915
|
-
P.map((
|
|
1916
|
-
),
|
|
1917
|
-
f(
|
|
1924
|
+
P.map((H, Z) => [H, $[Z]])
|
|
1925
|
+
), F = d().map((H) => P.includes(H) ? A[H] : H);
|
|
1926
|
+
f(F);
|
|
1918
1927
|
},
|
|
1919
1928
|
[l, y, d, f]
|
|
1920
1929
|
), M = g.useCallback(
|
|
1921
1930
|
(P, $) => {
|
|
1922
|
-
const
|
|
1931
|
+
const Y = r(), V = P.map((A, F) => !A.x || !A.y ? { ...A, x: Y.x + 2 * F, y: Y.y + 2 * F } : A);
|
|
1923
1932
|
E(V, $), n();
|
|
1924
1933
|
},
|
|
1925
1934
|
[r, E, n]
|
|
@@ -1930,52 +1939,52 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1930
1939
|
[M]
|
|
1931
1940
|
), N = g.useCallback(
|
|
1932
1941
|
(P) => {
|
|
1933
|
-
|
|
1942
|
+
a(P), _(P), t(P);
|
|
1934
1943
|
},
|
|
1935
|
-
[
|
|
1944
|
+
[a, _, t]
|
|
1936
1945
|
), U = g.useCallback(
|
|
1937
1946
|
(P) => {
|
|
1938
1947
|
const $ = l();
|
|
1939
|
-
return P.map((
|
|
1948
|
+
return P.map((Y) => $[Y]);
|
|
1940
1949
|
},
|
|
1941
1950
|
[l]
|
|
1942
1951
|
), J = g.useCallback(
|
|
1943
|
-
({ target: P, clientX: $, clientY:
|
|
1952
|
+
({ target: P, clientX: $, clientY: Y }, { returnLocked: V = !1, passLocked: A = !1 } = {}) => {
|
|
1944
1953
|
if (["INPUT", "TEXTAREA"].includes(P.tagName))
|
|
1945
1954
|
return null;
|
|
1946
|
-
const
|
|
1947
|
-
if (
|
|
1948
|
-
if (ye(
|
|
1949
|
-
return
|
|
1950
|
-
if (!A && ye(
|
|
1951
|
-
return V ?
|
|
1955
|
+
const F = Oe(P, "item");
|
|
1956
|
+
if (F) {
|
|
1957
|
+
if (ye(F, "selected"))
|
|
1958
|
+
return F;
|
|
1959
|
+
if (!A && ye(F, "locked") && !ye(P, "passthrough"))
|
|
1960
|
+
return V ? F : null;
|
|
1952
1961
|
if (ye(P, "passthrough")) {
|
|
1953
|
-
const
|
|
1954
|
-
const me = Ne(
|
|
1955
|
-
return ft({ x: $, y:
|
|
1962
|
+
const H = d(), { boardWrapper: Z } = u(), te = H.reduce((le, se) => {
|
|
1963
|
+
const me = Ne(Z, se), ge = me.getBoundingClientRect();
|
|
1964
|
+
return ft({ x: $, y: Y }, ge) && le.unshift(me), le;
|
|
1956
1965
|
}, []);
|
|
1957
|
-
for (let le = 0; le <
|
|
1958
|
-
const se =
|
|
1959
|
-
if (se !==
|
|
1966
|
+
for (let le = 0; le < te.length; le += 1) {
|
|
1967
|
+
const se = te[le];
|
|
1968
|
+
if (se !== F && (A || !ye(se, "locked")))
|
|
1960
1969
|
return se;
|
|
1961
1970
|
}
|
|
1962
1971
|
return null;
|
|
1963
1972
|
}
|
|
1964
1973
|
}
|
|
1965
|
-
return
|
|
1974
|
+
return F;
|
|
1966
1975
|
},
|
|
1967
1976
|
[u, d]
|
|
1968
1977
|
);
|
|
1969
1978
|
return {
|
|
1970
|
-
putItemsOnTop:
|
|
1979
|
+
putItemsOnTop: w,
|
|
1971
1980
|
batchUpdateItems: y,
|
|
1972
1981
|
updateItemOrder: O,
|
|
1973
1982
|
moveItems: p,
|
|
1974
1983
|
placeItems: S,
|
|
1975
1984
|
updateItem: x,
|
|
1976
|
-
swapItems:
|
|
1985
|
+
swapItems: j,
|
|
1977
1986
|
reverseItemsOrder: k,
|
|
1978
|
-
setItemList:
|
|
1987
|
+
setItemList: C,
|
|
1979
1988
|
pushItem: L,
|
|
1980
1989
|
pushItems: M,
|
|
1981
1990
|
removeItems: N,
|
|
@@ -1984,7 +1993,7 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1984
1993
|
getItems: U
|
|
1985
1994
|
};
|
|
1986
1995
|
};
|
|
1987
|
-
var
|
|
1996
|
+
var wn = function e(t, r) {
|
|
1988
1997
|
if (t === r)
|
|
1989
1998
|
return !0;
|
|
1990
1999
|
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
@@ -2038,15 +2047,15 @@ var Cn = function e(t, r) {
|
|
|
2038
2047
|
if (!Object.prototype.hasOwnProperty.call(r, s[o]))
|
|
2039
2048
|
return !1;
|
|
2040
2049
|
for (o = n; o-- !== 0; ) {
|
|
2041
|
-
var
|
|
2042
|
-
if (!e(t[
|
|
2050
|
+
var a = s[o];
|
|
2051
|
+
if (!e(t[a], r[a]))
|
|
2043
2052
|
return !1;
|
|
2044
2053
|
}
|
|
2045
2054
|
return !0;
|
|
2046
2055
|
}
|
|
2047
2056
|
return t !== t && r !== r;
|
|
2048
2057
|
};
|
|
2049
|
-
function
|
|
2058
|
+
function Cn(e, t, r, n = 0) {
|
|
2050
2059
|
Pe(mt(e, t, r, n), t);
|
|
2051
2060
|
}
|
|
2052
2061
|
const xn = (e, t) => {
|
|
@@ -2059,46 +2068,46 @@ const xn = (e, t) => {
|
|
|
2059
2068
|
const { actions: r = xn(e, t) } = e;
|
|
2060
2069
|
return r.map((n) => typeof n == "string" ? { name: n } : n);
|
|
2061
2070
|
}, is = () => {
|
|
2062
|
-
const [e, t] =
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
]), [r, n, o] =
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
]), [s,
|
|
2071
|
+
const [e, t] = ne((c) => [
|
|
2072
|
+
c.items,
|
|
2073
|
+
c.getItems
|
|
2074
|
+
]), [r, n, o] = Q((c) => [
|
|
2075
|
+
c.config.itemTemplates,
|
|
2076
|
+
c.selection,
|
|
2077
|
+
c.getSelection
|
|
2078
|
+
]), [s, a] = g.useState([]), u = g.useRef(!1), [, l] = g.useTransition();
|
|
2070
2079
|
g.useEffect(() => (u.current = !0, () => {
|
|
2071
2080
|
u.current = !1;
|
|
2072
2081
|
}), []);
|
|
2073
2082
|
const d = g.useCallback(
|
|
2074
|
-
(
|
|
2083
|
+
(c) => {
|
|
2075
2084
|
const h = t();
|
|
2076
|
-
if (
|
|
2077
|
-
return [
|
|
2085
|
+
if (c)
|
|
2086
|
+
return [c, c.map((v) => h[v])];
|
|
2078
2087
|
const _ = o();
|
|
2079
2088
|
return [_, _.map((v) => h[v])];
|
|
2080
2089
|
},
|
|
2081
2090
|
[t, o]
|
|
2082
2091
|
), f = tr(() => {
|
|
2083
|
-
const [
|
|
2084
|
-
if (
|
|
2092
|
+
const [c, h] = d();
|
|
2093
|
+
if (c.length > 0) {
|
|
2085
2094
|
if (!u.current)
|
|
2086
2095
|
return;
|
|
2087
2096
|
const _ = h.reduce((v, E) => {
|
|
2088
2097
|
const I = Ft(E, r);
|
|
2089
2098
|
return v.filter(
|
|
2090
|
-
(y) => I.some((
|
|
2099
|
+
(y) => I.some((C) => wn(y, C))
|
|
2091
2100
|
);
|
|
2092
2101
|
}, Ft(h[0], r));
|
|
2093
2102
|
l(() => {
|
|
2094
|
-
|
|
2103
|
+
a(_);
|
|
2095
2104
|
});
|
|
2096
2105
|
} else
|
|
2097
2106
|
l(() => {
|
|
2098
|
-
|
|
2107
|
+
a([]);
|
|
2099
2108
|
});
|
|
2100
2109
|
}, [d, r]);
|
|
2101
|
-
return
|
|
2110
|
+
return Cn(
|
|
2102
2111
|
() => f(),
|
|
2103
2112
|
[e, n, f],
|
|
2104
2113
|
100
|
|
@@ -2106,7 +2115,7 @@ const xn = (e, t) => {
|
|
|
2106
2115
|
availableActions: s
|
|
2107
2116
|
};
|
|
2108
2117
|
}, as = () => {
|
|
2109
|
-
const [e] =
|
|
2118
|
+
const [e] = Q((t) => [t.selectionBox]);
|
|
2110
2119
|
return e;
|
|
2111
2120
|
};
|
|
2112
2121
|
let pe = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, r) => (r &= 63, r < 36 ? t += r.toString(36) : r < 62 ? t += (r - 26).toString(36).toUpperCase() : r > 62 ? t += "-" : t += "_", t), "");
|
|
@@ -2144,16 +2153,16 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2144
2153
|
updateUser: (n, o) => t((s) => {
|
|
2145
2154
|
if (!s.users[n])
|
|
2146
2155
|
return {};
|
|
2147
|
-
const
|
|
2156
|
+
const a = {
|
|
2148
2157
|
...s.users[n],
|
|
2149
2158
|
...o,
|
|
2150
2159
|
id: n,
|
|
2151
2160
|
uid: s.users[n].uid
|
|
2152
2161
|
};
|
|
2153
|
-
return
|
|
2162
|
+
return a.id === e && ut(a), setTimeout(() => r().electSpaceMaster(), 100), {
|
|
2154
2163
|
users: {
|
|
2155
2164
|
...s.users,
|
|
2156
|
-
[n]:
|
|
2165
|
+
[n]: a
|
|
2157
2166
|
}
|
|
2158
2167
|
};
|
|
2159
2168
|
}),
|
|
@@ -2169,8 +2178,8 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2169
2178
|
uid: null,
|
|
2170
2179
|
timestamp: Date.now()
|
|
2171
2180
|
};
|
|
2172
|
-
Object.values(n).forEach(({ spaceJoinedTimestamp: s, id:
|
|
2173
|
-
s < o.timestamp && (o.id =
|
|
2181
|
+
Object.values(n).forEach(({ spaceJoinedTimestamp: s, id: a }) => {
|
|
2182
|
+
s < o.timestamp && (o.id = a, o.timestamp = s);
|
|
2174
2183
|
}), t({ isSpaceMaster: o.id === e });
|
|
2175
2184
|
}
|
|
2176
2185
|
}), On = (e) => ({
|
|
@@ -2181,7 +2190,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2181
2190
|
return delete n[t], { cursors: n };
|
|
2182
2191
|
})
|
|
2183
2192
|
}), fr = ({ storeName: e, children: t }) => {
|
|
2184
|
-
const { wire: r, isMaster: n } = Xe("room"), [o, s] = g.useState(null), [
|
|
2193
|
+
const { wire: r, isMaster: n } = Xe("room"), [o, s] = g.useState(null), [a, u] = g.useState(!1), l = g.useRef(!1);
|
|
2185
2194
|
return g.useEffect(() => {
|
|
2186
2195
|
let d = !0;
|
|
2187
2196
|
const f = [];
|
|
@@ -2229,7 +2238,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2229
2238
|
}
|
|
2230
2239
|
}, [n, o, r]), g.useEffect(() => {
|
|
2231
2240
|
n && o && o.getState().updateCurrentUser({ isMaster: n });
|
|
2232
|
-
}, [n, o, r]),
|
|
2241
|
+
}, [n, o, r]), a ? /* @__PURE__ */ T(lr.Provider, { value: o, children: t }) : null;
|
|
2233
2242
|
}, Se = (e, t) => {
|
|
2234
2243
|
const r = _e(lr);
|
|
2235
2244
|
return We(r, e, t || Ve);
|
|
@@ -2240,7 +2249,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2240
2249
|
u.users,
|
|
2241
2250
|
u.updateCurrentUser,
|
|
2242
2251
|
u.joinSpace
|
|
2243
|
-
]), s = g.useMemo(() => Object.values(r), [r]),
|
|
2252
|
+
]), s = g.useMemo(() => Object.values(r), [r]), a = g.useMemo(() => {
|
|
2244
2253
|
const { space: u } = t;
|
|
2245
2254
|
return s.filter(({ space: l }) => l === u);
|
|
2246
2255
|
}, [t, s]);
|
|
@@ -2249,27 +2258,27 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2249
2258
|
currentUser: t,
|
|
2250
2259
|
updateCurrentUser: n,
|
|
2251
2260
|
users: s,
|
|
2252
|
-
localUsers:
|
|
2261
|
+
localUsers: a,
|
|
2253
2262
|
joinSpace: o
|
|
2254
2263
|
};
|
|
2255
2264
|
}, us = () => {
|
|
2256
|
-
const [e, t, r] =
|
|
2265
|
+
const [e, t, r] = ne(
|
|
2257
2266
|
(o) => [o.boardConfig, o.getBoardConfig, o.setBoardConfig]
|
|
2258
2267
|
), n = g.useCallback(
|
|
2259
2268
|
(o) => {
|
|
2260
2269
|
let s = o;
|
|
2261
2270
|
typeof o == "object" && (s = () => o);
|
|
2262
|
-
const
|
|
2271
|
+
const a = t(), u = s(a);
|
|
2263
2272
|
r(u);
|
|
2264
2273
|
},
|
|
2265
2274
|
[t, r]
|
|
2266
2275
|
);
|
|
2267
2276
|
return [e, n];
|
|
2268
2277
|
}, ls = () => {
|
|
2269
|
-
const [e] =
|
|
2278
|
+
const [e] = Q((t) => [t.boardState]);
|
|
2270
2279
|
return e;
|
|
2271
2280
|
}, fs = () => {
|
|
2272
|
-
const [e, t, r, n] =
|
|
2281
|
+
const [e, t, r, n] = ne((o) => [
|
|
2273
2282
|
o.getSessionInfo,
|
|
2274
2283
|
o.setSessionInfo,
|
|
2275
2284
|
o.updateSessionInfo,
|
|
@@ -2324,17 +2333,17 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2324
2333
|
return We(r, e, t || Ve);
|
|
2325
2334
|
}, Mn = () => {
|
|
2326
2335
|
}, ds = (e = Mn) => {
|
|
2327
|
-
const t = Se((
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2336
|
+
const t = Se((a) => a.getUser()), [r, n, o] = Pn((a) => [
|
|
2337
|
+
a.messages,
|
|
2338
|
+
a.setMessages,
|
|
2339
|
+
a.sendMessage
|
|
2331
2340
|
]);
|
|
2332
2341
|
g.useEffect(() => {
|
|
2333
2342
|
r.length && e();
|
|
2334
2343
|
}, [r, e]);
|
|
2335
2344
|
const s = g.useCallback(
|
|
2336
|
-
(
|
|
2337
|
-
o(t,
|
|
2345
|
+
(a) => {
|
|
2346
|
+
o(t, a);
|
|
2338
2347
|
},
|
|
2339
2348
|
[t, o]
|
|
2340
2349
|
);
|
|
@@ -2351,11 +2360,11 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2351
2360
|
items: n = [],
|
|
2352
2361
|
messages: o = [],
|
|
2353
2362
|
LoadingComponent: s,
|
|
2354
|
-
...
|
|
2363
|
+
...a
|
|
2355
2364
|
}) => {
|
|
2356
2365
|
const [u] = g.useState(t || pe()), [l] = g.useState(r || pe()), [d] = g.useState(() => ({
|
|
2357
|
-
itemIds: n.map(({ id:
|
|
2358
|
-
items: Object.fromEntries(n.map((
|
|
2366
|
+
itemIds: n.map(({ id: c }) => c),
|
|
2367
|
+
items: Object.fromEntries(n.map((c) => [c.id, c]))
|
|
2359
2368
|
}));
|
|
2360
2369
|
return Xe("room") ? /* @__PURE__ */ T(
|
|
2361
2370
|
Kt,
|
|
@@ -2367,7 +2376,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2367
2376
|
{
|
|
2368
2377
|
storeName: `${l}_item`,
|
|
2369
2378
|
defaultValue: d,
|
|
2370
|
-
children: /* @__PURE__ */ T(Ht, { ...
|
|
2379
|
+
children: /* @__PURE__ */ T(Ht, { ...a, session: l })
|
|
2371
2380
|
}
|
|
2372
2381
|
) })
|
|
2373
2382
|
}
|
|
@@ -2388,7 +2397,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2388
2397
|
{
|
|
2389
2398
|
storeName: `${l}_item`,
|
|
2390
2399
|
defaultValue: d,
|
|
2391
|
-
children: /* @__PURE__ */ T(Ht, { ...
|
|
2400
|
+
children: /* @__PURE__ */ T(Ht, { ...a, session: l })
|
|
2392
2401
|
}
|
|
2393
2402
|
) })
|
|
2394
2403
|
}
|
|
@@ -2410,7 +2419,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2410
2419
|
}, nt = () => {
|
|
2411
2420
|
const e = navigator.userAgent.toLowerCase();
|
|
2412
2421
|
return /mac os ?x 10/.test(e);
|
|
2413
|
-
},
|
|
2422
|
+
}, jn = () => {
|
|
2414
2423
|
const e = document.createElement("iframe");
|
|
2415
2424
|
e.src = "#", document.body.appendChild(e);
|
|
2416
2425
|
const t = e.contentWindow.document;
|
|
@@ -2419,7 +2428,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2419
2428
|
), t.close();
|
|
2420
2429
|
const r = t.body.firstElementChild.offsetHeight;
|
|
2421
2430
|
return document.body.removeChild(e), r;
|
|
2422
|
-
},
|
|
2431
|
+
}, Dn = jn(), $n = 800, qt = (e, t) => {
|
|
2423
2432
|
const r = Object.keys(e).map((n) => Number(n)).find((n) => n !== t);
|
|
2424
2433
|
return e[r];
|
|
2425
2434
|
}, Gt = ([e, t], [r, n]) => {
|
|
@@ -2446,43 +2455,43 @@ class zn {
|
|
|
2446
2455
|
});
|
|
2447
2456
|
}
|
|
2448
2457
|
}
|
|
2449
|
-
const
|
|
2458
|
+
const oe = new zn(), Fe = ({
|
|
2450
2459
|
children: e,
|
|
2451
2460
|
onDrag: t = de,
|
|
2452
2461
|
onDragStart: r = de,
|
|
2453
2462
|
onDragEnd: n = de,
|
|
2454
2463
|
onPan: o = de,
|
|
2455
2464
|
onTap: s = de,
|
|
2456
|
-
onLongTap:
|
|
2465
|
+
onLongTap: a = de,
|
|
2457
2466
|
onDoubleTap: u = de,
|
|
2458
2467
|
onZoom: l,
|
|
2459
2468
|
mainAction: d = "drag"
|
|
2460
2469
|
}) => {
|
|
2461
|
-
const f = g.useRef(null),
|
|
2470
|
+
const f = g.useRef(null), c = g.useRef({
|
|
2462
2471
|
moving: !1,
|
|
2463
2472
|
pointers: {},
|
|
2464
2473
|
mainPointer: void 0
|
|
2465
2474
|
}), h = (y) => {
|
|
2466
2475
|
const {
|
|
2467
|
-
deltaX:
|
|
2476
|
+
deltaX: C,
|
|
2468
2477
|
deltaY: x,
|
|
2469
2478
|
clientX: p,
|
|
2470
|
-
clientY:
|
|
2479
|
+
clientY: w,
|
|
2471
2480
|
deltaMode: m,
|
|
2472
2481
|
ctrlKey: S,
|
|
2473
2482
|
altKey: O,
|
|
2474
2483
|
metaKey: k,
|
|
2475
|
-
target:
|
|
2484
|
+
target: j
|
|
2476
2485
|
} = y;
|
|
2477
2486
|
if (!(O || S && !nt()))
|
|
2478
2487
|
if (nt() && !S)
|
|
2479
|
-
|
|
2480
|
-
deltaX: -2 *
|
|
2488
|
+
oe.add(o, {
|
|
2489
|
+
deltaX: -2 * C,
|
|
2481
2490
|
deltaY: -2 * x,
|
|
2482
2491
|
button: 1,
|
|
2483
2492
|
ctrlKey: S,
|
|
2484
2493
|
metaKey: k,
|
|
2485
|
-
target:
|
|
2494
|
+
target: j,
|
|
2486
2495
|
event: y
|
|
2487
2496
|
});
|
|
2488
2497
|
else {
|
|
@@ -2491,241 +2500,241 @@ const ne = new zn(), Fe = ({
|
|
|
2491
2500
|
let M = x;
|
|
2492
2501
|
switch (m) {
|
|
2493
2502
|
case 1:
|
|
2494
|
-
M *=
|
|
2503
|
+
M *= Dn;
|
|
2495
2504
|
break;
|
|
2496
2505
|
case 2:
|
|
2497
2506
|
M *= $n;
|
|
2498
2507
|
break;
|
|
2499
2508
|
}
|
|
2500
|
-
nt() && (M *= 2),
|
|
2509
|
+
nt() && (M *= 2), oe.add(l, { scale: M, clientX: p, clientY: w, event: y });
|
|
2501
2510
|
}
|
|
2502
2511
|
}, _ = (y) => {
|
|
2503
2512
|
const {
|
|
2504
|
-
target:
|
|
2513
|
+
target: C,
|
|
2505
2514
|
button: x,
|
|
2506
2515
|
clientX: p,
|
|
2507
|
-
clientY:
|
|
2516
|
+
clientY: w,
|
|
2508
2517
|
pointerId: m,
|
|
2509
2518
|
altKey: S,
|
|
2510
2519
|
ctrlKey: O,
|
|
2511
2520
|
metaKey: k,
|
|
2512
|
-
isPrimary:
|
|
2521
|
+
isPrimary: j
|
|
2513
2522
|
} = y;
|
|
2514
|
-
if (
|
|
2515
|
-
if (
|
|
2523
|
+
if (c.current.pointers[m] = { clientX: p, clientY: w }, j && (c.current.mainPointer = void 0), c.current.mainPointer !== void 0) {
|
|
2524
|
+
if (c.current.mainPointer !== m)
|
|
2516
2525
|
try {
|
|
2517
2526
|
const { clientX: M, clientY: L } = qt(
|
|
2518
|
-
|
|
2527
|
+
c.current.pointers,
|
|
2519
2528
|
m
|
|
2520
|
-
), N = (M + p) / 2, U = (L +
|
|
2529
|
+
), N = (M + p) / 2, U = (L + w) / 2, J = Gt(
|
|
2521
2530
|
[M, L],
|
|
2522
|
-
[p,
|
|
2531
|
+
[p, w]
|
|
2523
2532
|
);
|
|
2524
|
-
Object.assign(
|
|
2533
|
+
Object.assign(c.current, {
|
|
2525
2534
|
pressed: !0,
|
|
2526
2535
|
moving: !1,
|
|
2527
2536
|
gestureStart: !1,
|
|
2528
2537
|
startX: p,
|
|
2529
|
-
startY:
|
|
2538
|
+
startY: w,
|
|
2530
2539
|
prevX: N,
|
|
2531
2540
|
prevY: U,
|
|
2532
2541
|
startDistance: J,
|
|
2533
2542
|
prevDistance: J
|
|
2534
2543
|
});
|
|
2535
2544
|
} catch (M) {
|
|
2536
|
-
console.log("Error while getting other pointer. Ignoring", M),
|
|
2545
|
+
console.log("Error while getting other pointer. Ignoring", M), c.current.mainPointer;
|
|
2537
2546
|
}
|
|
2538
2547
|
return;
|
|
2539
2548
|
}
|
|
2540
|
-
|
|
2549
|
+
c.current.mainPointer = m, Object.assign(c.current, {
|
|
2541
2550
|
pressed: !0,
|
|
2542
2551
|
moving: !1,
|
|
2543
2552
|
gestureStart: !1,
|
|
2544
2553
|
startX: p,
|
|
2545
|
-
startY:
|
|
2554
|
+
startY: w,
|
|
2546
2555
|
prevX: p,
|
|
2547
|
-
prevY:
|
|
2556
|
+
prevY: w,
|
|
2548
2557
|
currentButton: x,
|
|
2549
2558
|
pointerDownEvent: y,
|
|
2550
2559
|
startDistance: 0,
|
|
2551
2560
|
prevDistance: 0,
|
|
2552
|
-
target:
|
|
2561
|
+
target: C,
|
|
2553
2562
|
timeStart: Date.now(),
|
|
2554
2563
|
longTapTimeout: setTimeout(async () => {
|
|
2555
|
-
|
|
2564
|
+
c.current.noTap = !0, oe.add(a, {
|
|
2556
2565
|
clientX: p,
|
|
2557
|
-
clientY:
|
|
2566
|
+
clientY: w,
|
|
2558
2567
|
altKey: S,
|
|
2559
2568
|
ctrlKey: O,
|
|
2560
2569
|
metaKey: k,
|
|
2561
|
-
target:
|
|
2570
|
+
target: C,
|
|
2562
2571
|
event: y
|
|
2563
2572
|
});
|
|
2564
2573
|
}, 750)
|
|
2565
2574
|
});
|
|
2566
2575
|
try {
|
|
2567
|
-
|
|
2576
|
+
C.setPointerCapture(m);
|
|
2568
2577
|
} catch (M) {
|
|
2569
2578
|
console.log("Fail to capture pointer", M);
|
|
2570
2579
|
}
|
|
2571
2580
|
}, v = (y) => {
|
|
2572
|
-
if (
|
|
2581
|
+
if (c.current.pressed) {
|
|
2573
2582
|
const {
|
|
2574
|
-
pointerId:
|
|
2583
|
+
pointerId: C,
|
|
2575
2584
|
clientX: x,
|
|
2576
2585
|
clientY: p,
|
|
2577
|
-
altKey:
|
|
2586
|
+
altKey: w,
|
|
2578
2587
|
shiftKey: m,
|
|
2579
2588
|
ctrlKey: S,
|
|
2580
2589
|
metaKey: O,
|
|
2581
2590
|
buttons: k
|
|
2582
2591
|
} = y;
|
|
2583
|
-
|
|
2592
|
+
c.current.pointers[C] = {
|
|
2584
2593
|
clientX: x,
|
|
2585
2594
|
clientY: p
|
|
2586
|
-
},
|
|
2587
|
-
const
|
|
2595
|
+
}, c.current.moving = !0;
|
|
2596
|
+
const j = Object.keys(c.current.pointers).length === 2;
|
|
2588
2597
|
let M, L, N = 0;
|
|
2589
|
-
if (
|
|
2590
|
-
const { clientX: $, clientY:
|
|
2591
|
-
|
|
2592
|
-
|
|
2598
|
+
if (j) {
|
|
2599
|
+
const { clientX: $, clientY: Y } = qt(
|
|
2600
|
+
c.current.pointers,
|
|
2601
|
+
C
|
|
2593
2602
|
);
|
|
2594
|
-
M = ($ + x) / 2, L = (
|
|
2595
|
-
[$,
|
|
2603
|
+
M = ($ + x) / 2, L = (Y + p) / 2, N = Gt(
|
|
2604
|
+
[$, Y],
|
|
2596
2605
|
[x, p]
|
|
2597
2606
|
);
|
|
2598
2607
|
} else
|
|
2599
2608
|
M = x, L = p;
|
|
2600
|
-
let U = m ||
|
|
2609
|
+
let U = m || w || S || O || k !== 1;
|
|
2601
2610
|
d !== "drag" && (U = !U);
|
|
2602
2611
|
const J = !U, P = U;
|
|
2603
2612
|
if (J) {
|
|
2604
|
-
|
|
2613
|
+
c.current.gestureStart || (f.current.style.cursor = "move", c.current.gestureStart = !0, clearTimeout(c.current.longTapTimeout), oe.add(r, {
|
|
2605
2614
|
deltaX: 0,
|
|
2606
2615
|
deltaY: 0,
|
|
2607
|
-
startX:
|
|
2608
|
-
startY:
|
|
2609
|
-
clientX:
|
|
2610
|
-
clientY:
|
|
2616
|
+
startX: c.current.startX,
|
|
2617
|
+
startY: c.current.startY,
|
|
2618
|
+
clientX: c.current.startX,
|
|
2619
|
+
clientY: c.current.startY,
|
|
2611
2620
|
distanceX: 0,
|
|
2612
2621
|
distanceY: 0,
|
|
2613
|
-
button:
|
|
2614
|
-
altKey:
|
|
2622
|
+
button: c.current.currentButton,
|
|
2623
|
+
altKey: w,
|
|
2615
2624
|
shiftKey: m,
|
|
2616
2625
|
ctrlKey: S,
|
|
2617
2626
|
metaKey: O,
|
|
2618
|
-
target:
|
|
2619
|
-
event:
|
|
2627
|
+
target: c.current.target,
|
|
2628
|
+
event: c.current.pointerDownEvent
|
|
2620
2629
|
}));
|
|
2621
|
-
const $ = M -
|
|
2622
|
-
|
|
2630
|
+
const $ = M - c.current.prevX, Y = L - c.current.prevY, V = M - c.current.startX, A = L - c.current.startY;
|
|
2631
|
+
oe.add(t, {
|
|
2623
2632
|
deltaX: $,
|
|
2624
|
-
deltaY:
|
|
2625
|
-
startX:
|
|
2626
|
-
startY:
|
|
2633
|
+
deltaY: Y,
|
|
2634
|
+
startX: c.current.startX,
|
|
2635
|
+
startY: c.current.startY,
|
|
2627
2636
|
clientX: M,
|
|
2628
2637
|
clientY: L,
|
|
2629
2638
|
distanceX: V,
|
|
2630
2639
|
distanceY: A,
|
|
2631
|
-
button:
|
|
2632
|
-
altKey:
|
|
2640
|
+
button: c.current.currentButton,
|
|
2641
|
+
altKey: w,
|
|
2633
2642
|
shiftKey: m,
|
|
2634
2643
|
ctrlKey: S,
|
|
2635
2644
|
metaKey: O,
|
|
2636
|
-
target:
|
|
2645
|
+
target: c.current.target,
|
|
2637
2646
|
event: y
|
|
2638
2647
|
});
|
|
2639
2648
|
}
|
|
2640
2649
|
if (P) {
|
|
2641
|
-
|
|
2642
|
-
const $ = M -
|
|
2643
|
-
if (
|
|
2650
|
+
c.current.gestureStart || (f.current.style.cursor = "move", c.current.gestureStart = !0, clearTimeout(c.current.longTapTimeout));
|
|
2651
|
+
const $ = M - c.current.prevX, Y = L - c.current.prevY, { target: V } = c.current;
|
|
2652
|
+
if (oe.add(o, {
|
|
2644
2653
|
deltaX: $,
|
|
2645
|
-
deltaY:
|
|
2646
|
-
button:
|
|
2647
|
-
altKey:
|
|
2654
|
+
deltaY: Y,
|
|
2655
|
+
button: c.current.currentButton,
|
|
2656
|
+
altKey: w,
|
|
2648
2657
|
shiftKey: m,
|
|
2649
2658
|
ctrlKey: S,
|
|
2650
2659
|
metaKey: O,
|
|
2651
2660
|
target: V,
|
|
2652
2661
|
event: y
|
|
2653
|
-
}), N !==
|
|
2654
|
-
const A =
|
|
2655
|
-
Math.abs(A) > 0 && (
|
|
2662
|
+
}), N !== c.current.prevDistance && l) {
|
|
2663
|
+
const A = c.current.prevDistance - N;
|
|
2664
|
+
Math.abs(A) > 0 && (oe.add(l, {
|
|
2656
2665
|
scale: A * 3,
|
|
2657
2666
|
clientX: M,
|
|
2658
2667
|
clientY: L,
|
|
2659
2668
|
event: y
|
|
2660
|
-
}),
|
|
2669
|
+
}), c.current.prevDistance = N);
|
|
2661
2670
|
}
|
|
2662
2671
|
}
|
|
2663
|
-
|
|
2672
|
+
c.current.prevX = M, c.current.prevY = L;
|
|
2664
2673
|
}
|
|
2665
2674
|
}, E = (y) => {
|
|
2666
2675
|
const {
|
|
2667
|
-
clientX:
|
|
2676
|
+
clientX: C,
|
|
2668
2677
|
clientY: x,
|
|
2669
2678
|
altKey: p,
|
|
2670
|
-
shiftKey:
|
|
2679
|
+
shiftKey: w,
|
|
2671
2680
|
ctrlKey: m,
|
|
2672
2681
|
metaKey: S,
|
|
2673
2682
|
target: O,
|
|
2674
2683
|
pointerId: k
|
|
2675
2684
|
} = y;
|
|
2676
|
-
if (
|
|
2677
|
-
if (delete
|
|
2678
|
-
const { clientX:
|
|
2679
|
-
Object.assign(
|
|
2680
|
-
prevX:
|
|
2685
|
+
if (c.current.pointers[k]) {
|
|
2686
|
+
if (delete c.current.pointers[k], c.current.mainPointer !== k) {
|
|
2687
|
+
const { clientX: j, clientY: M } = c.current.pointers[c.current.mainPointer];
|
|
2688
|
+
Object.assign(c.current, {
|
|
2689
|
+
prevX: j,
|
|
2681
2690
|
prevY: M,
|
|
2682
2691
|
prevDistance: 0,
|
|
2683
2692
|
startDistance: 0
|
|
2684
2693
|
});
|
|
2685
2694
|
return;
|
|
2686
2695
|
}
|
|
2687
|
-
for (; Object.keys(
|
|
2688
|
-
|
|
2689
|
-
Object.keys(
|
|
2696
|
+
for (; Object.keys(c.current.pointers).length > 0; ) {
|
|
2697
|
+
c.current.mainPointer = Number(
|
|
2698
|
+
Object.keys(c.current.pointers)[0]
|
|
2690
2699
|
);
|
|
2691
2700
|
try {
|
|
2692
|
-
|
|
2693
|
-
const { clientX:
|
|
2694
|
-
Object.assign(
|
|
2695
|
-
prevX:
|
|
2701
|
+
c.current.target.setPointerCapture(c.current.mainPointer);
|
|
2702
|
+
const { clientX: j, clientY: M } = c.current.pointers[c.current.mainPointer];
|
|
2703
|
+
Object.assign(c.current, {
|
|
2704
|
+
prevX: j,
|
|
2696
2705
|
prevY: M,
|
|
2697
2706
|
prevDistance: 0,
|
|
2698
2707
|
startDistance: 0
|
|
2699
2708
|
});
|
|
2700
2709
|
return;
|
|
2701
|
-
} catch (
|
|
2702
|
-
console.log("Fails to set pointer capture",
|
|
2710
|
+
} catch (j) {
|
|
2711
|
+
console.log("Fails to set pointer capture", j), c.current.mainPointer = void 0, delete c.current.pointers[Object.keys(c.current.pointers)[0]];
|
|
2703
2712
|
}
|
|
2704
2713
|
}
|
|
2705
|
-
if (
|
|
2706
|
-
|
|
2707
|
-
deltaX:
|
|
2708
|
-
deltaY: x -
|
|
2709
|
-
startX:
|
|
2710
|
-
startY:
|
|
2711
|
-
clientX:
|
|
2714
|
+
if (c.current.mainPointer = void 0, c.current.pressed = !1, clearTimeout(c.current.longTapTimeout), c.current.moving)
|
|
2715
|
+
c.current.moving = !1, oe.add(n, {
|
|
2716
|
+
deltaX: C - c.current.prevX,
|
|
2717
|
+
deltaY: x - c.current.prevY,
|
|
2718
|
+
startX: c.current.startX,
|
|
2719
|
+
startY: c.current.startY,
|
|
2720
|
+
clientX: C,
|
|
2712
2721
|
clientY: x,
|
|
2713
|
-
distanceX:
|
|
2714
|
-
distanceY: x -
|
|
2715
|
-
button:
|
|
2722
|
+
distanceX: C - c.current.startX,
|
|
2723
|
+
distanceY: x - c.current.startY,
|
|
2724
|
+
button: c.current.currentButton,
|
|
2716
2725
|
altKey: p,
|
|
2717
|
-
shiftKey:
|
|
2726
|
+
shiftKey: w,
|
|
2718
2727
|
ctrlKey: m,
|
|
2719
2728
|
metaKey: S,
|
|
2720
2729
|
event: y
|
|
2721
2730
|
}), f.current.style.cursor = "auto";
|
|
2722
2731
|
else {
|
|
2723
|
-
const
|
|
2724
|
-
|
|
2725
|
-
clientX:
|
|
2732
|
+
const j = Date.now();
|
|
2733
|
+
c.current.noTap ? c.current.noTap = !1 : c.current.timeStart - j < 300 && oe.add(s, {
|
|
2734
|
+
clientX: C,
|
|
2726
2735
|
clientY: x,
|
|
2727
2736
|
altKey: p,
|
|
2728
|
-
shiftKey:
|
|
2737
|
+
shiftKey: w,
|
|
2729
2738
|
ctrlKey: m,
|
|
2730
2739
|
metaKey: S,
|
|
2731
2740
|
target: O,
|
|
@@ -2745,12 +2754,12 @@ const ne = new zn(), Fe = ({
|
|
|
2745
2754
|
onPointerLeave: E,
|
|
2746
2755
|
onPointerCancel: E,
|
|
2747
2756
|
onDoubleClick: (y) => {
|
|
2748
|
-
const { clientX:
|
|
2749
|
-
|
|
2750
|
-
clientX:
|
|
2757
|
+
const { clientX: C, clientY: x, altKey: p, shiftKey: w, ctrlKey: m, metaKey: S, target: O } = y;
|
|
2758
|
+
oe.add(u, {
|
|
2759
|
+
clientX: C,
|
|
2751
2760
|
clientY: x,
|
|
2752
2761
|
altKey: p,
|
|
2753
|
-
shiftKey:
|
|
2762
|
+
shiftKey: w,
|
|
2754
2763
|
ctrlKey: m,
|
|
2755
2764
|
metaKey: S,
|
|
2756
2765
|
target: O,
|
|
@@ -2763,9 +2772,9 @@ const ne = new zn(), Fe = ({
|
|
|
2763
2772
|
}
|
|
2764
2773
|
);
|
|
2765
2774
|
}, ot = ({ onResize: e, ...t }) => {
|
|
2766
|
-
const [r] =
|
|
2767
|
-
return /* @__PURE__ */ T(Fe, { onDrag: ({ deltaX: o, deltaY: s, event:
|
|
2768
|
-
|
|
2775
|
+
const [r] = Q((o) => [o.getBoardState]);
|
|
2776
|
+
return /* @__PURE__ */ T(Fe, { onDrag: ({ deltaX: o, deltaY: s, event: a }) => {
|
|
2777
|
+
a.stopPropagation();
|
|
2769
2778
|
const { scale: u } = r();
|
|
2770
2779
|
e({
|
|
2771
2780
|
width: o / u,
|
|
@@ -2776,8 +2785,8 @@ const ne = new zn(), Fe = ({
|
|
|
2776
2785
|
let Yn = { data: "" }, Bn = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || Yn, Nn = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, Xn = /\/\*[^]*?\*\/| +/g, Jt = /\n+/g, fe = (e, t) => {
|
|
2777
2786
|
let r = "", n = "", o = "";
|
|
2778
2787
|
for (let s in e) {
|
|
2779
|
-
let
|
|
2780
|
-
s[0] == "@" ? s[1] == "i" ? r = s + " " +
|
|
2788
|
+
let a = e[s];
|
|
2789
|
+
s[0] == "@" ? s[1] == "i" ? r = s + " " + a + ";" : n += s[1] == "f" ? fe(a, s) : s + "{" + fe(a, s[1] == "k" ? "" : t) + "}" : typeof a == "object" ? n += fe(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 += fe.p ? fe.p(s, a) : s + ":" + a + ";");
|
|
2781
2790
|
}
|
|
2782
2791
|
return r + (t && o ? t + "{" + o + "}" : o) + n;
|
|
2783
2792
|
}, ae = {}, pr = (e) => {
|
|
@@ -2789,39 +2798,39 @@ let Yn = { data: "" }, Bn = (e) => typeof window == "object" ? ((e ? e.querySele
|
|
|
2789
2798
|
}
|
|
2790
2799
|
return e;
|
|
2791
2800
|
}, Un = (e, t, r, n, o) => {
|
|
2792
|
-
let s = pr(e),
|
|
2801
|
+
let s = pr(e), a = ae[s] || (ae[s] = ((l) => {
|
|
2793
2802
|
let d = 0, f = 11;
|
|
2794
2803
|
for (; d < l.length; )
|
|
2795
2804
|
f = 101 * f + l.charCodeAt(d++) >>> 0;
|
|
2796
2805
|
return "go" + f;
|
|
2797
2806
|
})(s));
|
|
2798
|
-
if (!ae[
|
|
2807
|
+
if (!ae[a]) {
|
|
2799
2808
|
let l = s !== e ? e : ((d) => {
|
|
2800
|
-
let f,
|
|
2809
|
+
let f, c, h = [{}];
|
|
2801
2810
|
for (; f = Nn.exec(d.replace(Xn, "")); )
|
|
2802
|
-
f[4] ? h.shift() : f[3] ? (
|
|
2811
|
+
f[4] ? h.shift() : f[3] ? (c = f[3].replace(Jt, " ").trim(), h.unshift(h[0][c] = h[0][c] || {})) : h[0][f[1]] = f[2].replace(Jt, " ").trim();
|
|
2803
2812
|
return h[0];
|
|
2804
2813
|
})(e);
|
|
2805
|
-
ae[
|
|
2814
|
+
ae[a] = fe(o ? { ["@keyframes " + a]: l } : l, r ? "" : "." + a);
|
|
2806
2815
|
}
|
|
2807
2816
|
let u = r && ae.g ? ae.g : null;
|
|
2808
|
-
return r && (ae.g = ae[
|
|
2809
|
-
|
|
2810
|
-
})(ae[
|
|
2817
|
+
return r && (ae.g = ae[a]), ((l, d, f, c) => {
|
|
2818
|
+
c ? d.data = d.data.replace(c, l) : d.data.indexOf(l) === -1 && (d.data = f ? l + d.data : d.data + l);
|
|
2819
|
+
})(ae[a], t, n, u), a;
|
|
2811
2820
|
}, Wn = (e, t, r) => e.reduce((n, o, s) => {
|
|
2812
|
-
let
|
|
2813
|
-
if (
|
|
2814
|
-
let u =
|
|
2815
|
-
|
|
2821
|
+
let a = t[s];
|
|
2822
|
+
if (a && a.call) {
|
|
2823
|
+
let u = a(r), l = u && u.props && u.props.className || /^go/.test(u) && u;
|
|
2824
|
+
a = l ? "." + l : u && typeof u == "object" ? u.props ? "" : fe(u, "") : u === !1 ? "" : u;
|
|
2816
2825
|
}
|
|
2817
|
-
return n + o + (
|
|
2826
|
+
return n + o + (a ?? "");
|
|
2818
2827
|
}, "");
|
|
2819
|
-
function
|
|
2828
|
+
function K(e) {
|
|
2820
2829
|
let t = this || {}, r = e.call ? e(t.p) : e;
|
|
2821
2830
|
return Un(r.unshift ? r.raw ? Wn(r, [].slice.call(arguments, 1), t.p) : r.reduce((n, o) => Object.assign(n, o && o.call ? o(t.p) : o), {}) : r, Bn(t.target), t.g, t.o, t.k);
|
|
2822
2831
|
}
|
|
2823
|
-
|
|
2824
|
-
|
|
2832
|
+
K.bind({ g: 1 });
|
|
2833
|
+
K.bind({ k: 1 });
|
|
2825
2834
|
function Vn(e, t, r, n) {
|
|
2826
2835
|
fe.p = t;
|
|
2827
2836
|
}
|
|
@@ -2852,44 +2861,44 @@ var Fn = function e(t, r) {
|
|
|
2852
2861
|
if (!Object.prototype.hasOwnProperty.call(r, s[o]))
|
|
2853
2862
|
return !1;
|
|
2854
2863
|
for (o = n; o-- !== 0; ) {
|
|
2855
|
-
var
|
|
2856
|
-
if (!e(t[
|
|
2864
|
+
var a = s[o];
|
|
2865
|
+
if (!e(t[a], r[a]))
|
|
2857
2866
|
return !1;
|
|
2858
2867
|
}
|
|
2859
2868
|
return !0;
|
|
2860
2869
|
}
|
|
2861
2870
|
return t !== t && r !== r;
|
|
2862
2871
|
};
|
|
2863
|
-
const Kn =
|
|
2872
|
+
const Kn = K`
|
|
2864
2873
|
display: inline-block;
|
|
2865
2874
|
transition: transform 150ms;
|
|
2866
2875
|
user-select: none;
|
|
2867
2876
|
padding: 2px;
|
|
2868
2877
|
box-sizing: border-box;
|
|
2869
|
-
`, Hn =
|
|
2878
|
+
`, Hn = K`
|
|
2870
2879
|
border: 2px dashed #db5034;
|
|
2871
2880
|
padding: 0px;
|
|
2872
2881
|
cursor: pointer;
|
|
2873
|
-
`,
|
|
2882
|
+
`, Ce = K`
|
|
2874
2883
|
position: absolute;
|
|
2875
2884
|
width: 0px;
|
|
2876
2885
|
height: 0px;
|
|
2877
|
-
`, qn =
|
|
2886
|
+
`, qn = K`
|
|
2878
2887
|
top: 0;
|
|
2879
2888
|
left: 0;
|
|
2880
|
-
`, Gn =
|
|
2889
|
+
`, Gn = K`
|
|
2881
2890
|
top: 0;
|
|
2882
2891
|
right: 0;
|
|
2883
|
-
`, Jn =
|
|
2892
|
+
`, Jn = K`
|
|
2884
2893
|
bottom: 0;
|
|
2885
2894
|
left: 0;
|
|
2886
|
-
`, Zn =
|
|
2895
|
+
`, Zn = K`
|
|
2887
2896
|
bottom: 0;
|
|
2888
2897
|
right: 0;
|
|
2889
|
-
`, Qn =
|
|
2898
|
+
`, Qn = K`
|
|
2890
2899
|
top: 50%;
|
|
2891
2900
|
left: 50%;
|
|
2892
|
-
`, st =
|
|
2901
|
+
`, st = K`
|
|
2893
2902
|
position: absolute;
|
|
2894
2903
|
|
|
2895
2904
|
width: 10px;
|
|
@@ -2897,22 +2906,22 @@ const Kn = H`
|
|
|
2897
2906
|
border: 2px solid #db5034;
|
|
2898
2907
|
background-color: #db5034;
|
|
2899
2908
|
cursor: move;
|
|
2900
|
-
`, eo =
|
|
2909
|
+
`, eo = K`
|
|
2901
2910
|
cursor: ew-resize;
|
|
2902
2911
|
right: -6px;
|
|
2903
2912
|
top: calc(50% - 5px);
|
|
2904
|
-
`, to =
|
|
2913
|
+
`, to = K`
|
|
2905
2914
|
cursor: ns-resize;
|
|
2906
2915
|
bottom: -6px;
|
|
2907
2916
|
left: calc(50% - 5px);
|
|
2908
|
-
`, ro =
|
|
2917
|
+
`, ro = K`
|
|
2909
2918
|
cursor: nwse-resize;
|
|
2910
2919
|
bottom: -6px;
|
|
2911
2920
|
right: -6px;
|
|
2912
2921
|
`, no = ({ onReload: e }) => /* @__PURE__ */ ue(
|
|
2913
2922
|
"div",
|
|
2914
2923
|
{
|
|
2915
|
-
className: `syncboard-error-item ${
|
|
2924
|
+
className: `syncboard-error-item ${K({
|
|
2916
2925
|
width: "100px",
|
|
2917
2926
|
display: "flex",
|
|
2918
2927
|
flexDirection: "column",
|
|
@@ -2958,21 +2967,21 @@ const so = (e) => {
|
|
|
2958
2967
|
prevState: o,
|
|
2959
2968
|
keepRatio: s
|
|
2960
2969
|
}) => {
|
|
2961
|
-
let { width:
|
|
2962
|
-
if ([
|
|
2963
|
-
parseFloat(
|
|
2970
|
+
let { width: a, height: u } = o;
|
|
2971
|
+
if ([a, u] = [
|
|
2972
|
+
parseFloat(a),
|
|
2964
2973
|
parseFloat(u)
|
|
2965
|
-
], (!
|
|
2966
|
-
const l =
|
|
2974
|
+
], (!a || Number.isNaN(Number(a))) && (a = r), (!u || Number.isNaN(Number(u))) && (u = n), s) {
|
|
2975
|
+
const l = a / u;
|
|
2967
2976
|
return {
|
|
2968
2977
|
...o,
|
|
2969
|
-
width: (
|
|
2978
|
+
width: (a + e).toFixed(1),
|
|
2970
2979
|
height: (u + t / l).toFixed(1)
|
|
2971
2980
|
};
|
|
2972
2981
|
}
|
|
2973
2982
|
return {
|
|
2974
2983
|
...o,
|
|
2975
|
-
width: (
|
|
2984
|
+
width: (a + e).toFixed(1),
|
|
2976
2985
|
height: (u + t).toFixed(1)
|
|
2977
2986
|
};
|
|
2978
2987
|
}, ao = {
|
|
@@ -2981,31 +2990,31 @@ const so = (e) => {
|
|
|
2981
2990
|
b: !0
|
|
2982
2991
|
}, co = ({
|
|
2983
2992
|
setState: e,
|
|
2984
|
-
state: { type: t, rotation: r = 0, id: n, locked: o, extraClasses: s, ...
|
|
2993
|
+
state: { type: t, rotation: r = 0, id: n, locked: o, extraClasses: s, ...a } = {},
|
|
2985
2994
|
animate: u = "hvr-pop",
|
|
2986
2995
|
isSelected: l,
|
|
2987
2996
|
itemMap: d,
|
|
2988
2997
|
showResizeHandle: f = !0
|
|
2989
2998
|
}) => {
|
|
2990
2999
|
var m;
|
|
2991
|
-
const
|
|
3000
|
+
const c = g.useRef(null), {
|
|
2992
3001
|
component: h = () => null,
|
|
2993
3002
|
resizeDirections: _ = ao,
|
|
2994
3003
|
resize: v = io
|
|
2995
3004
|
} = d[t], E = g.useCallback(
|
|
2996
|
-
(S) => e(n, S),
|
|
3005
|
+
(S, O = !1) => e(n, S, O),
|
|
2997
3006
|
[e, n]
|
|
2998
3007
|
);
|
|
2999
3008
|
g.useEffect(() => {
|
|
3000
|
-
|
|
3009
|
+
c.current.className = u;
|
|
3001
3010
|
}, [u]);
|
|
3002
3011
|
const I = ["item", n, Kn];
|
|
3003
3012
|
o && I.push("locked"), l && (I.push("selected"), I.push(Hn));
|
|
3004
|
-
const y = I.join(" "),
|
|
3005
|
-
E((
|
|
3006
|
-
const { offsetWidth: M, offsetHeight: L } =
|
|
3013
|
+
const y = I.join(" "), C = ({ width: S = 0, height: O = 0, keepRatio: k }) => {
|
|
3014
|
+
E((j) => {
|
|
3015
|
+
const { offsetWidth: M, offsetHeight: L } = c.current;
|
|
3007
3016
|
return v({
|
|
3008
|
-
prevState:
|
|
3017
|
+
prevState: j,
|
|
3009
3018
|
width: S,
|
|
3010
3019
|
height: O,
|
|
3011
3020
|
actualHeight: L,
|
|
@@ -3014,11 +3023,11 @@ const so = (e) => {
|
|
|
3014
3023
|
});
|
|
3015
3024
|
});
|
|
3016
3025
|
}, x = ({ width: S }) => {
|
|
3017
|
-
|
|
3026
|
+
C({ width: S });
|
|
3018
3027
|
}, p = ({ height: S }) => {
|
|
3019
|
-
|
|
3020
|
-
},
|
|
3021
|
-
|
|
3028
|
+
C({ height: S });
|
|
3029
|
+
}, w = ({ width: S }) => {
|
|
3030
|
+
C({ height: S, width: S, keepRatio: !0 });
|
|
3022
3031
|
};
|
|
3023
3032
|
return /* @__PURE__ */ T(
|
|
3024
3033
|
"div",
|
|
@@ -3030,7 +3039,7 @@ const so = (e) => {
|
|
|
3030
3039
|
"div",
|
|
3031
3040
|
{
|
|
3032
3041
|
style: { display: "flex" },
|
|
3033
|
-
ref:
|
|
3042
|
+
ref: c,
|
|
3034
3043
|
onAnimationEnd: so,
|
|
3035
3044
|
onKeyDown: (S) => S.stopPropagation(),
|
|
3036
3045
|
onKeyUp: (S) => S.stopPropagation(),
|
|
@@ -3039,22 +3048,22 @@ const so = (e) => {
|
|
|
3039
3048
|
oo,
|
|
3040
3049
|
{
|
|
3041
3050
|
itemId: n,
|
|
3042
|
-
state:
|
|
3051
|
+
state: a,
|
|
3043
3052
|
ErrorComponent: ((m = d == null ? void 0 : d.error) == null ? void 0 : m.component) || no,
|
|
3044
|
-
children: /* @__PURE__ */ T(h, { ...
|
|
3053
|
+
children: /* @__PURE__ */ T(h, { ...a, id: n, setState: E })
|
|
3045
3054
|
}
|
|
3046
3055
|
),
|
|
3047
|
-
/* @__PURE__ */ T("div", { className: `corner ${
|
|
3048
|
-
/* @__PURE__ */ T("div", { className: `corner ${
|
|
3049
|
-
/* @__PURE__ */ T("div", { className: `corner ${
|
|
3050
|
-
/* @__PURE__ */ T("div", { className: `corner ${
|
|
3051
|
-
/* @__PURE__ */ T("div", { className: `center ${
|
|
3056
|
+
/* @__PURE__ */ T("div", { className: `corner ${Ce} ${qn}` }),
|
|
3057
|
+
/* @__PURE__ */ T("div", { className: `corner ${Ce} ${Gn}` }),
|
|
3058
|
+
/* @__PURE__ */ T("div", { className: `corner ${Ce} ${Zn}` }),
|
|
3059
|
+
/* @__PURE__ */ T("div", { className: `corner ${Ce} ${Jn}` }),
|
|
3060
|
+
/* @__PURE__ */ T("div", { className: `center ${Ce} ${Qn}` }),
|
|
3052
3061
|
f && /* @__PURE__ */ ue(Wr, { children: [
|
|
3053
3062
|
_.b && /* @__PURE__ */ T(
|
|
3054
3063
|
ot,
|
|
3055
3064
|
{
|
|
3056
3065
|
className: `${st} ${ro}`,
|
|
3057
|
-
onResize:
|
|
3066
|
+
onResize: w
|
|
3058
3067
|
}
|
|
3059
3068
|
),
|
|
3060
3069
|
_.h && /* @__PURE__ */ T(
|
|
@@ -3087,15 +3096,15 @@ const so = (e) => {
|
|
|
3087
3096
|
}, {
|
|
3088
3097
|
state: o,
|
|
3089
3098
|
setState: s,
|
|
3090
|
-
isSelected:
|
|
3099
|
+
isSelected: a,
|
|
3091
3100
|
showResizeHandle: u
|
|
3092
|
-
}) => r ===
|
|
3101
|
+
}) => r === a && n === u && t === s && Fn(e, o)
|
|
3093
3102
|
), lo = (e) => e, fo = ({ state: e = {}, getCurrentUser: t, className: r, ...n }) => {
|
|
3094
3103
|
if (!n.itemMap[e.type])
|
|
3095
3104
|
return null;
|
|
3096
3105
|
const { stateHook: o = lo } = n.itemMap[e.type], {
|
|
3097
3106
|
x: s = 0,
|
|
3098
|
-
y:
|
|
3107
|
+
y: a = 0,
|
|
3099
3108
|
layer: u = 0,
|
|
3100
3109
|
moving: l,
|
|
3101
3110
|
...d
|
|
@@ -3105,7 +3114,7 @@ const so = (e) => {
|
|
|
3105
3114
|
{
|
|
3106
3115
|
className: r,
|
|
3107
3116
|
style: {
|
|
3108
|
-
transform: `translate(${s}px, ${
|
|
3117
|
+
transform: `translate(${s}px, ${a}px)`,
|
|
3109
3118
|
zIndex: f
|
|
3110
3119
|
},
|
|
3111
3120
|
children: /* @__PURE__ */ T(
|
|
@@ -3119,17 +3128,17 @@ const so = (e) => {
|
|
|
3119
3128
|
}
|
|
3120
3129
|
);
|
|
3121
3130
|
}, po = rr(fo), mo = () => {
|
|
3122
|
-
const { updateItem: e } = gt(), [t, r] =
|
|
3131
|
+
const { updateItem: e } = gt(), [t, r] = ne((d) => [
|
|
3123
3132
|
d.itemIds,
|
|
3124
3133
|
d.items
|
|
3125
|
-
]), [n, o, s,
|
|
3134
|
+
]), [n, o, s, a] = Q(
|
|
3126
3135
|
(d) => [
|
|
3127
3136
|
d.config.boardSize,
|
|
3128
3137
|
d.config.showResizeHandle,
|
|
3129
3138
|
d.config.itemTemplates,
|
|
3130
3139
|
d.selection
|
|
3131
3140
|
]
|
|
3132
|
-
), [u] = Se((d) => [d.getUser]), l =
|
|
3141
|
+
), [u] = Se((d) => [d.getUser]), l = K({
|
|
3133
3142
|
position: "absolute",
|
|
3134
3143
|
top: `${n / 2}px`,
|
|
3135
3144
|
left: `${n / 2}px`,
|
|
@@ -3141,7 +3150,7 @@ const so = (e) => {
|
|
|
3141
3150
|
{
|
|
3142
3151
|
state: r[d],
|
|
3143
3152
|
setState: e,
|
|
3144
|
-
isSelected:
|
|
3153
|
+
isSelected: a.includes(d),
|
|
3145
3154
|
itemMap: s,
|
|
3146
3155
|
boardSize: n,
|
|
3147
3156
|
getCurrentUser: u,
|
|
@@ -3182,11 +3191,11 @@ function ce(e, ...t) {
|
|
|
3182
3191
|
const s = e && yo(e, "current") ? e.current : e;
|
|
3183
3192
|
if (!s)
|
|
3184
3193
|
return;
|
|
3185
|
-
const
|
|
3186
|
-
return ho(s, t[0], o, ...
|
|
3194
|
+
const a = t.slice(2);
|
|
3195
|
+
return ho(s, t[0], o, ...a), () => vo(s, t[0], o, ...a);
|
|
3187
3196
|
}, [e, t[0]]);
|
|
3188
3197
|
}
|
|
3189
|
-
const So =
|
|
3198
|
+
const So = K({
|
|
3190
3199
|
zIndex: 210,
|
|
3191
3200
|
position: "absolute",
|
|
3192
3201
|
backgroundColor: "hsla(0, 40%, 50%, 10%)",
|
|
@@ -3197,7 +3206,7 @@ const So = H({
|
|
|
3197
3206
|
return [];
|
|
3198
3207
|
const o = n[0];
|
|
3199
3208
|
return Array.from(t.getElementsByClassName("item")).filter((s) => {
|
|
3200
|
-
const
|
|
3209
|
+
const a = Te(s), u = e[a];
|
|
3201
3210
|
return !u || !r && u.locked ? !1 : on(s, o);
|
|
3202
3211
|
}).map((s) => Te(s));
|
|
3203
3212
|
}, bo = ({ children: e, moveFirst: t }) => {
|
|
@@ -3206,9 +3215,9 @@ const So = H({
|
|
|
3206
3215
|
n,
|
|
3207
3216
|
o,
|
|
3208
3217
|
s,
|
|
3209
|
-
|
|
3218
|
+
a,
|
|
3210
3219
|
u
|
|
3211
|
-
] =
|
|
3220
|
+
] = Q((m) => [
|
|
3212
3221
|
m.getSelection,
|
|
3213
3222
|
m.clear,
|
|
3214
3223
|
m.setSelection,
|
|
@@ -3216,7 +3225,7 @@ const So = H({
|
|
|
3216
3225
|
m.getConfiguration,
|
|
3217
3226
|
m.getBoardState,
|
|
3218
3227
|
m.updateBoardState
|
|
3219
|
-
]), { findElementUnderPointer: l } = gt(), [d] =
|
|
3228
|
+
]), { findElementUnderPointer: l } = gt(), [d] = ne((m) => [m.getItems]), [f, c] = g.useState({}), [, h] = g.useTransition(), [_, v] = g.useState(!1), E = g.useRef(null), I = g.useRef({
|
|
3220
3229
|
moving: !1
|
|
3221
3230
|
});
|
|
3222
3231
|
return ce(document, "keydown", (m) => {
|
|
@@ -3227,12 +3236,12 @@ const So = H({
|
|
|
3227
3236
|
n();
|
|
3228
3237
|
}), [n]), g.useEffect(() => {
|
|
3229
3238
|
if (I.current.moving) {
|
|
3230
|
-
const m = d(), { boardWrapper: S } =
|
|
3239
|
+
const m = d(), { boardWrapper: S } = a(), O = _o(m, S, _);
|
|
3231
3240
|
h(() => {
|
|
3232
3241
|
o(O);
|
|
3233
3242
|
});
|
|
3234
3243
|
}
|
|
3235
|
-
}, [
|
|
3244
|
+
}, [a, d, f, o, _]), /* @__PURE__ */ T(
|
|
3236
3245
|
Fe,
|
|
3237
3246
|
{
|
|
3238
3247
|
onDragStart: async (m) => {
|
|
@@ -3242,27 +3251,27 @@ const So = H({
|
|
|
3242
3251
|
},
|
|
3243
3252
|
onDrag: ({ distanceY: m, distanceX: S, startX: O, startY: k }) => {
|
|
3244
3253
|
if (I.current.moving) {
|
|
3245
|
-
const { top:
|
|
3246
|
-
S > 0 ? (I.current.left = L, I.current.width = S) : (I.current.left = L + S, I.current.width = -S), m > 0 ? (I.current.top = N, I.current.height = m) : (I.current.top = N + m, I.current.height = -m),
|
|
3254
|
+
const { top: j, left: M } = E.current.getBoundingClientRect(), L = O - M, N = k - j;
|
|
3255
|
+
S > 0 ? (I.current.left = L, I.current.width = S) : (I.current.left = L + S, I.current.width = -S), m > 0 ? (I.current.top = N, I.current.height = m) : (I.current.top = N + m, I.current.height = -m), c({ ...I.current, moving: !0 });
|
|
3247
3256
|
}
|
|
3248
3257
|
},
|
|
3249
3258
|
onDragEnd: () => {
|
|
3250
3259
|
I.current.moving && (h(() => {
|
|
3251
3260
|
u({ selecting: !1 });
|
|
3252
|
-
}), I.current.moving = !1,
|
|
3261
|
+
}), I.current.moving = !1, c({ moving: !1 }), E.current.style.cursor = "auto");
|
|
3253
3262
|
},
|
|
3254
3263
|
onTap: (m) => {
|
|
3255
|
-
const { target: S, ctrlKey: O, metaKey: k } = m,
|
|
3256
|
-
if (!
|
|
3264
|
+
const { target: S, ctrlKey: O, metaKey: k } = m, j = l(m);
|
|
3265
|
+
if (!j && Oe(S, "board"))
|
|
3257
3266
|
n();
|
|
3258
3267
|
else {
|
|
3259
|
-
const M = Te(
|
|
3268
|
+
const M = Te(j);
|
|
3260
3269
|
if (!M) {
|
|
3261
3270
|
n();
|
|
3262
3271
|
return;
|
|
3263
3272
|
}
|
|
3264
3273
|
const L = r();
|
|
3265
|
-
|
|
3274
|
+
j && !L.includes(M) && (O || k ? s([M]) : o([M]));
|
|
3266
3275
|
}
|
|
3267
3276
|
},
|
|
3268
3277
|
onLongTap: ({ target: m }) => {
|
|
@@ -3290,54 +3299,54 @@ const So = H({
|
|
|
3290
3299
|
}
|
|
3291
3300
|
);
|
|
3292
3301
|
}, Eo = ({ children: e }) => {
|
|
3293
|
-
const { moveItems: t, placeItems: r, findElementUnderPointer: n } = gt(), { vectorFromWrapperToBoard: o } = Me(), [s,
|
|
3302
|
+
const { moveItems: t, placeItems: r, findElementUnderPointer: n } = gt(), { vectorFromWrapperToBoard: o } = Me(), [s, a, u, l, d] = Q((y) => [
|
|
3294
3303
|
y.select,
|
|
3295
3304
|
y.setSelection,
|
|
3296
3305
|
y.getSelection,
|
|
3297
3306
|
y.getBoardState,
|
|
3298
3307
|
y.updateBoardState
|
|
3299
|
-
]), [f] =
|
|
3308
|
+
]), [f] = ne((y) => [y.getBoardConfig]), c = g.useRef({}), h = g.useRef({
|
|
3300
3309
|
items: []
|
|
3301
3310
|
}), _ = (y) => {
|
|
3302
|
-
const { ctrlKey:
|
|
3303
|
-
if (
|
|
3311
|
+
const { ctrlKey: C, metaKey: x, event: p } = y, w = n(y);
|
|
3312
|
+
if (w) {
|
|
3304
3313
|
p.stopPropagation();
|
|
3305
3314
|
const m = u();
|
|
3306
3315
|
h.current.items = m;
|
|
3307
|
-
const S = Te(
|
|
3308
|
-
m.includes(S) || (
|
|
3316
|
+
const S = Te(w);
|
|
3317
|
+
m.includes(S) || (C || x ? (h.current.items = [...m, S], s([S])) : (h.current.items = [S], a([S]))), Object.assign(c.current, {
|
|
3309
3318
|
moving: !0
|
|
3310
3319
|
});
|
|
3311
3320
|
}
|
|
3312
|
-
}, v = ({ deltaX: y, deltaY:
|
|
3313
|
-
if (
|
|
3321
|
+
}, v = ({ deltaX: y, deltaY: C, event: x }) => {
|
|
3322
|
+
if (c.current.moving) {
|
|
3314
3323
|
x.stopPropagation();
|
|
3315
|
-
const { movingItems: p } = l(), [
|
|
3324
|
+
const { movingItems: p } = l(), [w, m] = o(y, C);
|
|
3316
3325
|
t(
|
|
3317
3326
|
h.current.items,
|
|
3318
3327
|
{
|
|
3319
|
-
x:
|
|
3328
|
+
x: w,
|
|
3320
3329
|
y: m
|
|
3321
3330
|
},
|
|
3322
3331
|
!0
|
|
3323
3332
|
), p || d({ movingItems: !0 });
|
|
3324
3333
|
}
|
|
3325
3334
|
}, E = () => {
|
|
3326
|
-
if (
|
|
3327
|
-
const { gridSize: y = 1 } = f(),
|
|
3328
|
-
|
|
3335
|
+
if (c.current.moving) {
|
|
3336
|
+
const { gridSize: y = 1 } = f(), C = y || 1;
|
|
3337
|
+
c.current = { moving: !1 }, r(h.current.items, {
|
|
3329
3338
|
type: "grid",
|
|
3330
|
-
size:
|
|
3339
|
+
size: C
|
|
3331
3340
|
}), d({ movingItems: !1 });
|
|
3332
3341
|
}
|
|
3333
3342
|
};
|
|
3334
3343
|
return ce(document, "keydown", (y) => {
|
|
3335
3344
|
if (["INPUT", "TEXTAREA"].includes(y.target.tagName))
|
|
3336
3345
|
return;
|
|
3337
|
-
const
|
|
3338
|
-
if (
|
|
3346
|
+
const C = u();
|
|
3347
|
+
if (C.length) {
|
|
3339
3348
|
const { gridSize: x = 1 } = f();
|
|
3340
|
-
let p = 0,
|
|
3349
|
+
let p = 0, w = 0;
|
|
3341
3350
|
switch (y.key) {
|
|
3342
3351
|
case "ArrowLeft":
|
|
3343
3352
|
p = -10;
|
|
@@ -3346,30 +3355,30 @@ const So = H({
|
|
|
3346
3355
|
p = 10;
|
|
3347
3356
|
break;
|
|
3348
3357
|
case "ArrowUp":
|
|
3349
|
-
|
|
3358
|
+
w = -10;
|
|
3350
3359
|
break;
|
|
3351
3360
|
case "ArrowDown":
|
|
3352
|
-
|
|
3361
|
+
w = 10;
|
|
3353
3362
|
break;
|
|
3354
3363
|
}
|
|
3355
|
-
if (p ||
|
|
3356
|
-
y.shiftKey && (p *= 5,
|
|
3357
|
-
const [m, S] = o(p,
|
|
3364
|
+
if (p || w) {
|
|
3365
|
+
y.shiftKey && (p *= 5, w *= 5), (y.ctrlKey || y.altKey || y.metaKey) && (p /= 10, w /= 10);
|
|
3366
|
+
const [m, S] = o(p, w);
|
|
3358
3367
|
t(
|
|
3359
|
-
|
|
3368
|
+
C,
|
|
3360
3369
|
{
|
|
3361
3370
|
x: m,
|
|
3362
3371
|
y: S
|
|
3363
3372
|
},
|
|
3364
3373
|
!0
|
|
3365
|
-
), r(
|
|
3374
|
+
), r(C, {
|
|
3366
3375
|
type: "grid",
|
|
3367
3376
|
size: x || 1
|
|
3368
3377
|
}), y.preventDefault();
|
|
3369
3378
|
}
|
|
3370
3379
|
}
|
|
3371
3380
|
}), /* @__PURE__ */ T(Fe, { onDragStart: _, onDrag: v, onDragEnd: E, children: e });
|
|
3372
|
-
},
|
|
3381
|
+
}, wo = (e) => {
|
|
3373
3382
|
const t = g.useRef({ hover: !1, x: 0, y: 0 });
|
|
3374
3383
|
return ce(e.current, "mousemove", (n) => {
|
|
3375
3384
|
const { clientX: o, clientY: s } = n;
|
|
@@ -3379,17 +3388,17 @@ const So = H({
|
|
|
3379
3388
|
}), ce(e.current, "mouseleave", () => {
|
|
3380
3389
|
t.current.hover = !1;
|
|
3381
3390
|
}), g.useCallback(() => t.current, []);
|
|
3382
|
-
},
|
|
3383
|
-
const [e, t] = g.useState({}), [r, n] =
|
|
3391
|
+
}, Co = [...Array(5).keys()].map((e) => `Digit${e + 1}`), xo = () => {
|
|
3392
|
+
const [e, t] = g.useState({}), [r, n] = Q((o) => [
|
|
3384
3393
|
o.getBoardState,
|
|
3385
3394
|
o.updateBoardState
|
|
3386
3395
|
]);
|
|
3387
3396
|
return ce(document, "keydown", (o) => {
|
|
3388
|
-
if (!["INPUT", "TEXTAREA"].includes(o.target.tagName) &&
|
|
3389
|
-
const s = o.code, { translateX:
|
|
3397
|
+
if (!["INPUT", "TEXTAREA"].includes(o.target.tagName) && Co.includes(o.code)) {
|
|
3398
|
+
const s = o.code, { translateX: a, translateY: u, scale: l } = r();
|
|
3390
3399
|
o.altKey || o.metaKey || o.ctrlKey || o.shiftKey ? t((d) => ({
|
|
3391
3400
|
...d,
|
|
3392
|
-
[s]: { translateX:
|
|
3401
|
+
[s]: { translateX: a, translateY: u, scale: l }
|
|
3393
3402
|
})) : e[s] && n(e[s]), o.preventDefault();
|
|
3394
3403
|
}
|
|
3395
3404
|
}), null;
|
|
@@ -3398,9 +3407,9 @@ const So = H({
|
|
|
3398
3407
|
n,
|
|
3399
3408
|
o,
|
|
3400
3409
|
s,
|
|
3401
|
-
|
|
3410
|
+
a,
|
|
3402
3411
|
u
|
|
3403
|
-
] =
|
|
3412
|
+
] = Q((p) => [
|
|
3404
3413
|
{
|
|
3405
3414
|
translateX: p.boardState.translateX,
|
|
3406
3415
|
translateY: p.boardState.translateY,
|
|
@@ -3411,36 +3420,36 @@ const So = H({
|
|
|
3411
3420
|
p.getConfiguration,
|
|
3412
3421
|
p.updateBoardState,
|
|
3413
3422
|
p.getSelection
|
|
3414
|
-
]), { zoomToCenter: l, zoomToExtent: d, moveBoard: f } = Me(), [
|
|
3423
|
+
]), { zoomToCenter: l, zoomToExtent: d, moveBoard: f } = Me(), [c, h] = g.useState(!1), _ = g.useRef({}), v = wo(r);
|
|
3415
3424
|
xo();
|
|
3416
3425
|
const E = g.useCallback(() => {
|
|
3417
3426
|
const { itemExtent: p } = s();
|
|
3418
3427
|
d(p);
|
|
3419
3428
|
}, [s, d]);
|
|
3420
3429
|
g.useEffect(() => {
|
|
3421
|
-
!
|
|
3422
|
-
}, [E,
|
|
3423
|
-
const I = ({ clientX: p, clientY:
|
|
3424
|
-
l({ to: { x: p, y:
|
|
3425
|
-
|
|
3426
|
-
}, 200),
|
|
3427
|
-
}, y = ({ deltaX: p, deltaY:
|
|
3430
|
+
!c && o.radius && (E(), h(!0));
|
|
3431
|
+
}, [E, c, o]);
|
|
3432
|
+
const I = ({ clientX: p, clientY: w, scale: m }) => {
|
|
3433
|
+
l({ to: { x: p, y: w }, factor: 1 - m / 500 }), clearTimeout(_.current.zoom), _.current.zoom = setTimeout(() => {
|
|
3434
|
+
a({ zooming: !1 });
|
|
3435
|
+
}, 200), a({ zooming: !0 });
|
|
3436
|
+
}, y = ({ deltaX: p, deltaY: w }) => {
|
|
3428
3437
|
f(({ translateX: m, translateY: S }) => ({
|
|
3429
3438
|
translateX: m + p,
|
|
3430
|
-
translateY: S +
|
|
3439
|
+
translateY: S + w
|
|
3431
3440
|
})), clearTimeout(_.current.pan), _.current.pan = setTimeout(() => {
|
|
3432
|
-
|
|
3433
|
-
}, 200),
|
|
3434
|
-
},
|
|
3441
|
+
a({ panning: !1 });
|
|
3442
|
+
}, 200), a({ panning: !0 });
|
|
3443
|
+
}, C = (p) => {
|
|
3435
3444
|
if (["INPUT", "TEXTAREA"].includes(p.target.tagName))
|
|
3436
3445
|
return;
|
|
3437
|
-
let
|
|
3446
|
+
let w = 0, m = 0, S = 1;
|
|
3438
3447
|
switch (p.key) {
|
|
3439
3448
|
case "ArrowLeft":
|
|
3440
|
-
|
|
3449
|
+
w = -10;
|
|
3441
3450
|
break;
|
|
3442
3451
|
case "ArrowRight":
|
|
3443
|
-
|
|
3452
|
+
w = 10;
|
|
3444
3453
|
break;
|
|
3445
3454
|
case "ArrowUp":
|
|
3446
3455
|
m = -10;
|
|
@@ -3455,20 +3464,20 @@ const So = H({
|
|
|
3455
3464
|
S = 0.8;
|
|
3456
3465
|
break;
|
|
3457
3466
|
}
|
|
3458
|
-
if (
|
|
3467
|
+
if (w || m || S !== 1) {
|
|
3459
3468
|
const O = u();
|
|
3460
3469
|
if (S === 1 && O.length)
|
|
3461
3470
|
return;
|
|
3462
|
-
p.shiftKey && (
|
|
3463
|
-
translateX: k +
|
|
3464
|
-
translateY:
|
|
3471
|
+
p.shiftKey && (w *= 5, m *= 5), (p.ctrlKey || p.altKey || p.metaKey) && (w /= 5, m /= 5), f(({ translateX: k, translateY: j }) => ({
|
|
3472
|
+
translateX: k + w,
|
|
3473
|
+
translateY: j + m
|
|
3465
3474
|
})), l({ factor: S }), p.preventDefault();
|
|
3466
3475
|
}
|
|
3467
3476
|
p.key === " " && !p.repeat && v().hover && l({ factor: 3, to: v() });
|
|
3468
3477
|
}, x = (p) => {
|
|
3469
3478
|
["INPUT", "TEXTAREA"].includes(p.target.tagName) || p.key === " " && v().hover && l({ factor: 1 / 3, to: v() });
|
|
3470
3479
|
};
|
|
3471
|
-
return ce(document, "keydown",
|
|
3480
|
+
return ce(document, "keydown", C), ce(document, "keyup", x), /* @__PURE__ */ T(
|
|
3472
3481
|
Fe,
|
|
3473
3482
|
{
|
|
3474
3483
|
onPan: y,
|
|
@@ -3489,7 +3498,7 @@ const So = H({
|
|
|
3489
3498
|
)
|
|
3490
3499
|
}
|
|
3491
3500
|
);
|
|
3492
|
-
}, Io =
|
|
3501
|
+
}, Io = K({
|
|
3493
3502
|
position: "absolute",
|
|
3494
3503
|
top: 0,
|
|
3495
3504
|
left: 0,
|
|
@@ -3504,33 +3513,33 @@ const So = H({
|
|
|
3504
3513
|
r,
|
|
3505
3514
|
n,
|
|
3506
3515
|
o,
|
|
3507
|
-
{ translateX: s, translateY:
|
|
3508
|
-
] =
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3516
|
+
{ translateX: s, translateY: a, scale: u }
|
|
3517
|
+
] = Q((c) => [
|
|
3518
|
+
c.selection,
|
|
3519
|
+
c.getSelection,
|
|
3520
|
+
c.selectionBox,
|
|
3521
|
+
c.setSelectionBox,
|
|
3522
|
+
c.getConfiguration,
|
|
3514
3523
|
{
|
|
3515
|
-
translateX:
|
|
3516
|
-
translateY:
|
|
3517
|
-
scale:
|
|
3524
|
+
translateX: c.boardState.translateX,
|
|
3525
|
+
translateY: c.boardState.translateY,
|
|
3526
|
+
scale: c.boardState.scale
|
|
3518
3527
|
}
|
|
3519
|
-
]), [l] =
|
|
3520
|
-
const
|
|
3521
|
-
if (
|
|
3528
|
+
]), [l] = ne((c) => [c.items]), d = g.useCallback(() => {
|
|
3529
|
+
const c = t(), { boardWrapperRect: h, boardWrapper: _ } = o();
|
|
3530
|
+
if (c.length === 0) {
|
|
3522
3531
|
n(null);
|
|
3523
3532
|
return;
|
|
3524
3533
|
}
|
|
3525
|
-
const v = sn(
|
|
3534
|
+
const v = sn(c, _);
|
|
3526
3535
|
if (!v) {
|
|
3527
3536
|
n(null);
|
|
3528
3537
|
return;
|
|
3529
3538
|
}
|
|
3530
|
-
const { left: E, top: I, width: y, height:
|
|
3539
|
+
const { left: E, top: I, width: y, height: C } = v, x = {
|
|
3531
3540
|
left: E - h.left,
|
|
3532
3541
|
top: I - h.top,
|
|
3533
|
-
height:
|
|
3542
|
+
height: C,
|
|
3534
3543
|
width: y
|
|
3535
3544
|
};
|
|
3536
3545
|
n(x);
|
|
@@ -3541,7 +3550,7 @@ const So = H({
|
|
|
3541
3550
|
e,
|
|
3542
3551
|
l,
|
|
3543
3552
|
s,
|
|
3544
|
-
|
|
3553
|
+
a,
|
|
3545
3554
|
u,
|
|
3546
3555
|
d,
|
|
3547
3556
|
f
|
|
@@ -3557,7 +3566,7 @@ const So = H({
|
|
|
3557
3566
|
}
|
|
3558
3567
|
);
|
|
3559
3568
|
}, To = () => {
|
|
3560
|
-
const [e] =
|
|
3569
|
+
const [e] = Q((t) => [t.boardState.movingItems]);
|
|
3561
3570
|
return e ? null : /* @__PURE__ */ T(Oo, {});
|
|
3562
3571
|
}, ko = typeof window < "u" && typeof navigator < "u" && typeof document < "u";
|
|
3563
3572
|
let Le;
|
|
@@ -3587,28 +3596,28 @@ function Po() {
|
|
|
3587
3596
|
function Mo(e, t, r = !0) {
|
|
3588
3597
|
const n = r && Po(), o = pt(t), s = e && "current" in e ? e.current : e;
|
|
3589
3598
|
Pe(() => {
|
|
3590
|
-
const
|
|
3591
|
-
if (!n || !
|
|
3599
|
+
const a = e && "current" in e ? e.current : e;
|
|
3600
|
+
if (!n || !a)
|
|
3592
3601
|
return;
|
|
3593
3602
|
let u = !0;
|
|
3594
3603
|
const l = (...d) => {
|
|
3595
3604
|
u && o.current(...d);
|
|
3596
3605
|
};
|
|
3597
|
-
return n.subscribe(
|
|
3598
|
-
u = !1, n.unsubscribe(
|
|
3606
|
+
return n.subscribe(a, l), () => {
|
|
3607
|
+
u = !1, n.unsubscribe(a, l);
|
|
3599
3608
|
};
|
|
3600
3609
|
}, [s, n]);
|
|
3601
3610
|
}
|
|
3602
3611
|
function Zt(e, t, r) {
|
|
3603
3612
|
return Math.min(Math.max(e, r), t);
|
|
3604
3613
|
}
|
|
3605
|
-
class
|
|
3614
|
+
class jo extends Error {
|
|
3606
3615
|
constructor(t) {
|
|
3607
3616
|
super(`Failed to parse color: "${t}"`);
|
|
3608
3617
|
}
|
|
3609
3618
|
}
|
|
3610
|
-
var xe =
|
|
3611
|
-
function
|
|
3619
|
+
var xe = jo;
|
|
3620
|
+
function Do(e) {
|
|
3612
3621
|
if (typeof e != "string")
|
|
3613
3622
|
throw new xe(e);
|
|
3614
3623
|
if (e.trim().toLowerCase() === "transparent")
|
|
@@ -3617,27 +3626,27 @@ function jo(e) {
|
|
|
3617
3626
|
t = Xo.test(e) ? Lo(e) : e;
|
|
3618
3627
|
const r = zo.exec(t);
|
|
3619
3628
|
if (r) {
|
|
3620
|
-
const
|
|
3621
|
-
return [...
|
|
3629
|
+
const a = Array.from(r).slice(1);
|
|
3630
|
+
return [...a.slice(0, 3).map((u) => parseInt(ke(u, 2), 16)), parseInt(ke(a[3] || "f", 2), 16) / 255];
|
|
3622
3631
|
}
|
|
3623
3632
|
const n = Yo.exec(t);
|
|
3624
3633
|
if (n) {
|
|
3625
|
-
const
|
|
3626
|
-
return [...
|
|
3634
|
+
const a = Array.from(n).slice(1);
|
|
3635
|
+
return [...a.slice(0, 3).map((u) => parseInt(u, 16)), parseInt(a[3] || "ff", 16) / 255];
|
|
3627
3636
|
}
|
|
3628
3637
|
const o = Bo.exec(t);
|
|
3629
3638
|
if (o) {
|
|
3630
|
-
const
|
|
3631
|
-
return [...
|
|
3639
|
+
const a = Array.from(o).slice(1);
|
|
3640
|
+
return [...a.slice(0, 3).map((u) => parseInt(u, 10)), parseFloat(a[3] || "1")];
|
|
3632
3641
|
}
|
|
3633
3642
|
const s = No.exec(t);
|
|
3634
3643
|
if (s) {
|
|
3635
|
-
const [
|
|
3644
|
+
const [a, u, l, d] = Array.from(s).slice(1).map(parseFloat);
|
|
3636
3645
|
if (Zt(0, 100, u) !== u)
|
|
3637
3646
|
throw new xe(e);
|
|
3638
3647
|
if (Zt(0, 100, l) !== l)
|
|
3639
3648
|
throw new xe(e);
|
|
3640
|
-
return [...Uo(
|
|
3649
|
+
return [...Uo(a, u, l), Number.isNaN(d) ? 1 : d];
|
|
3641
3650
|
}
|
|
3642
3651
|
throw new xe(e);
|
|
3643
3652
|
}
|
|
@@ -3664,32 +3673,32 @@ const ke = (e, t) => Array.from(Array(t)).map(() => e).join(""), zo = new RegExp
|
|
|
3664
3673
|
let n = r / 100;
|
|
3665
3674
|
if (t === 0)
|
|
3666
3675
|
return [n, n, n].map(er);
|
|
3667
|
-
const o = (e % 360 + 360) % 360 / 60, s = (1 - Math.abs(2 * n - 1)) * (t / 100),
|
|
3676
|
+
const o = (e % 360 + 360) % 360 / 60, s = (1 - Math.abs(2 * n - 1)) * (t / 100), a = s * (1 - Math.abs(o % 2 - 1));
|
|
3668
3677
|
let u = 0, l = 0, d = 0;
|
|
3669
|
-
o >= 0 && o < 1 ? (u = s, l =
|
|
3670
|
-
const f = n - s / 2,
|
|
3671
|
-
return [
|
|
3678
|
+
o >= 0 && o < 1 ? (u = s, l = a) : o >= 1 && o < 2 ? (u = a, l = s) : o >= 2 && o < 3 ? (l = s, d = a) : o >= 3 && o < 4 ? (l = a, d = s) : o >= 4 && o < 5 ? (u = a, d = s) : o >= 5 && o < 6 && (u = s, d = a);
|
|
3679
|
+
const f = n - s / 2, c = u + f, h = l + f, _ = d + f;
|
|
3680
|
+
return [c, h, _].map(er);
|
|
3672
3681
|
};
|
|
3673
3682
|
function Wo(e) {
|
|
3674
3683
|
if (e === "transparent")
|
|
3675
3684
|
return 0;
|
|
3676
3685
|
function t(s) {
|
|
3677
|
-
const
|
|
3678
|
-
return
|
|
3686
|
+
const a = s / 255;
|
|
3687
|
+
return a <= 0.03928 ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4);
|
|
3679
3688
|
}
|
|
3680
|
-
const [r, n, o] =
|
|
3689
|
+
const [r, n, o] = Do(e);
|
|
3681
3690
|
return 0.2126 * t(r) + 0.7152 * t(n) + 0.0722 * t(o);
|
|
3682
3691
|
}
|
|
3683
3692
|
function Vo(e) {
|
|
3684
3693
|
return Wo(e) > 0.179;
|
|
3685
3694
|
}
|
|
3686
|
-
const Fo =
|
|
3695
|
+
const Fo = K({
|
|
3687
3696
|
display: "flex",
|
|
3688
3697
|
flexDirection: "row",
|
|
3689
3698
|
alignItems: "center",
|
|
3690
3699
|
zIndex: 210,
|
|
3691
3700
|
pointerEvents: "none"
|
|
3692
|
-
}), Ko =
|
|
3701
|
+
}), Ko = K({
|
|
3693
3702
|
fontWeight: "bold",
|
|
3694
3703
|
padding: "0 0.5em",
|
|
3695
3704
|
borderRadius: "2px",
|
|
@@ -3747,7 +3756,7 @@ const Fo = H({
|
|
|
3747
3756
|
}
|
|
3748
3757
|
)
|
|
3749
3758
|
] });
|
|
3750
|
-
}, qo = g.memo(Ho), Go =
|
|
3759
|
+
}, qo = g.memo(Ho), Go = K({
|
|
3751
3760
|
top: 0,
|
|
3752
3761
|
left: 0,
|
|
3753
3762
|
zIndex: 210,
|
|
@@ -3763,11 +3772,11 @@ const Fo = H({
|
|
|
3763
3772
|
children: /* @__PURE__ */ T(qo, { ...t })
|
|
3764
3773
|
}
|
|
3765
3774
|
), Zo = ({ children: e }) => {
|
|
3766
|
-
const [t] =
|
|
3775
|
+
const [t] = Q((v) => [
|
|
3767
3776
|
v.getConfiguration,
|
|
3768
3777
|
v.boardState.scale
|
|
3769
3778
|
// We want to update this component when the scale changes
|
|
3770
|
-
]), { fromWrapperToBoard: r, fromBoardToWrapper: n } = Me(), [o, s,
|
|
3779
|
+
]), { fromWrapperToBoard: r, fromBoardToWrapper: n } = Me(), [o, s, a, u] = Se(
|
|
3771
3780
|
(v) => [
|
|
3772
3781
|
v.getUser(),
|
|
3773
3782
|
v.getLocalUsers(),
|
|
@@ -3777,7 +3786,7 @@ const Fo = H({
|
|
|
3777
3786
|
), [l, d] = Se((v) => [
|
|
3778
3787
|
v.moveCursor,
|
|
3779
3788
|
v.removeCursor
|
|
3780
|
-
]), { boardWrapperRect: f } = t(),
|
|
3789
|
+
]), { boardWrapperRect: f } = t(), c = ({ clientX: v, clientY: E }) => {
|
|
3781
3790
|
const [I, y] = r(
|
|
3782
3791
|
v - f.left,
|
|
3783
3792
|
E - f.top
|
|
@@ -3785,18 +3794,18 @@ const Fo = H({
|
|
|
3785
3794
|
l(o.id, { x: I, y });
|
|
3786
3795
|
}, h = () => {
|
|
3787
3796
|
d(o.id);
|
|
3788
|
-
}, _ = s.reduce((v, E) => (E.id !== o.id &&
|
|
3789
|
-
return /* @__PURE__ */ ue("div", { onPointerMove:
|
|
3797
|
+
}, _ = s.reduce((v, E) => (E.id !== o.id && a[E.id] && (v[E.id] = a[E.id]), v), {});
|
|
3798
|
+
return /* @__PURE__ */ ue("div", { onPointerMove: c, onPointerLeave: h, children: [
|
|
3790
3799
|
e,
|
|
3791
3800
|
Object.entries(_).map(([v, E]) => {
|
|
3792
|
-
const [I, y] = n(E.x, E.y),
|
|
3801
|
+
const [I, y] = n(E.x, E.y), C = {
|
|
3793
3802
|
x: I + f.left,
|
|
3794
3803
|
y: y + f.top
|
|
3795
3804
|
};
|
|
3796
|
-
return ft(
|
|
3805
|
+
return ft(C, f) ? /* @__PURE__ */ T(
|
|
3797
3806
|
Jo,
|
|
3798
3807
|
{
|
|
3799
|
-
pos:
|
|
3808
|
+
pos: C,
|
|
3800
3809
|
text: u[v].name,
|
|
3801
3810
|
color: u[v].color
|
|
3802
3811
|
},
|
|
@@ -3815,13 +3824,13 @@ const Fo = H({
|
|
|
3815
3824
|
itemTemplates: n = {},
|
|
3816
3825
|
boardSize: o = cr,
|
|
3817
3826
|
children: s,
|
|
3818
|
-
showResizeHandle:
|
|
3827
|
+
showResizeHandle: a = !1,
|
|
3819
3828
|
Wrapper: u = Qo
|
|
3820
3829
|
}) => {
|
|
3821
|
-
const l = g.useRef(null), [d, f] =
|
|
3830
|
+
const l = g.useRef(null), [d, f] = Q((v) => [
|
|
3822
3831
|
v.config.uid,
|
|
3823
3832
|
v.updateConfiguration
|
|
3824
|
-
]), { updateItemExtent:
|
|
3833
|
+
]), { updateItemExtent: c } = Me(), h = {
|
|
3825
3834
|
userSelect: "none",
|
|
3826
3835
|
width: `${o}px`,
|
|
3827
3836
|
height: `${o}px`,
|
|
@@ -3847,18 +3856,18 @@ const Fo = H({
|
|
|
3847
3856
|
f({
|
|
3848
3857
|
itemTemplates: n,
|
|
3849
3858
|
boardSize: o,
|
|
3850
|
-
showResizeHandle:
|
|
3859
|
+
showResizeHandle: a
|
|
3851
3860
|
});
|
|
3852
|
-
}, [n, o,
|
|
3861
|
+
}, [n, o, a, f]), g.useEffect(() => {
|
|
3853
3862
|
f({
|
|
3854
3863
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3855
|
-
}),
|
|
3856
|
-
}, [f,
|
|
3864
|
+
}), c(), setTimeout(c, 2e3);
|
|
3865
|
+
}, [f, c]), Mo(l, () => {
|
|
3857
3866
|
l.current && f({
|
|
3858
3867
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3859
3868
|
});
|
|
3860
3869
|
});
|
|
3861
|
-
const _ =
|
|
3870
|
+
const _ = K({ ...es, ...r });
|
|
3862
3871
|
return /* @__PURE__ */ ue(
|
|
3863
3872
|
"div",
|
|
3864
3873
|
{
|