react-sync-board 1.2.6 → 1.2.8
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 +1170 -1157
- package/dist/react-sync-board.js.map +1 -1
- package/dist/react-sync-board.umd.cjs +24 -24
- package/dist/react-sync-board.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/react-sync-board.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import g, { useContext as _e, useDebugValue as
|
|
5
|
-
function
|
|
1
|
+
var zr = Object.defineProperty;
|
|
2
|
+
var Yr = (e, t, r) => t in e ? zr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var Pt = (e, t, r) => (Yr(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import g, { useContext as _e, useDebugValue as Br, useRef as Re, useMemo as ft, useEffect as Pe, useCallback as rr, memo as nr } from "react";
|
|
5
|
+
function Nr(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
7
|
}
|
|
8
|
-
var Ie = {},
|
|
8
|
+
var Ie = {}, Xr = {
|
|
9
9
|
get exports() {
|
|
10
10
|
return Ie;
|
|
11
11
|
},
|
|
@@ -22,21 +22,21 @@ var Ie = {}, Nr = {
|
|
|
22
22
|
* This source code is licensed under the MIT license found in the
|
|
23
23
|
* LICENSE file in the root directory of this source tree.
|
|
24
24
|
*/
|
|
25
|
-
var
|
|
26
|
-
function
|
|
27
|
-
if (
|
|
25
|
+
var Mt;
|
|
26
|
+
function Ur() {
|
|
27
|
+
if (Mt)
|
|
28
28
|
return Ee;
|
|
29
|
-
|
|
29
|
+
Mt = 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
31
|
function a(u, l, d) {
|
|
32
|
-
var f, c = {}, h = null,
|
|
33
|
-
d !== void 0 && (h = "" + d), l.key !== void 0 && (h = "" + l.key), l.ref !== void 0 && (
|
|
32
|
+
var f, c = {}, h = null, S = null;
|
|
33
|
+
d !== void 0 && (h = "" + d), l.key !== void 0 && (h = "" + l.key), l.ref !== void 0 && (S = l.ref);
|
|
34
34
|
for (f in l)
|
|
35
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
38
|
c[f] === void 0 && (c[f] = l[f]);
|
|
39
|
-
return { $$typeof: t, type: u, key: h, ref:
|
|
39
|
+
return { $$typeof: t, type: u, key: h, ref: S, props: c, _owner: o.current };
|
|
40
40
|
}
|
|
41
41
|
return Ee.Fragment = r, Ee.jsx = a, Ee.jsxs = a, Ee;
|
|
42
42
|
}
|
|
@@ -50,57 +50,57 @@ var we = {};
|
|
|
50
50
|
* This source code is licensed under the MIT license found in the
|
|
51
51
|
* LICENSE file in the root directory of this source tree.
|
|
52
52
|
*/
|
|
53
|
-
var
|
|
54
|
-
function
|
|
55
|
-
return
|
|
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"),
|
|
57
|
-
function
|
|
53
|
+
var Dt;
|
|
54
|
+
function Wr() {
|
|
55
|
+
return Dt || (Dt = 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"), 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"), S = Symbol.for("react.offscreen"), v = Symbol.iterator, E = "@@iterator";
|
|
57
|
+
function O(i) {
|
|
58
58
|
if (i === null || typeof i != "object")
|
|
59
59
|
return null;
|
|
60
60
|
var b = v && i[v] || i[E];
|
|
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 x(i) {
|
|
65
65
|
{
|
|
66
|
-
for (var b = arguments.length,
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
for (var b = arguments.length, I = new Array(b > 1 ? b - 1 : 0), j = 1; j < b; j++)
|
|
67
|
+
I[j - 1] = arguments[j];
|
|
68
|
+
C("error", i, I);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function C(i, b, I) {
|
|
72
72
|
{
|
|
73
|
-
var
|
|
74
|
-
X !== "" && (b += "%s",
|
|
75
|
-
var W =
|
|
76
|
-
return String(
|
|
73
|
+
var j = y.ReactDebugCurrentFrame, X = j.getStackAddendum();
|
|
74
|
+
X !== "" && (b += "%s", I = I.concat([X]));
|
|
75
|
+
var W = I.map(function(N) {
|
|
76
|
+
return String(N);
|
|
77
77
|
});
|
|
78
78
|
W.unshift("Warning: " + b), Function.prototype.apply.call(console[i], console, W);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
var p = !1,
|
|
82
|
-
|
|
83
|
-
function
|
|
84
|
-
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s ||
|
|
81
|
+
var p = !1, _ = !1, m = !1, w = !1, R = !1, T;
|
|
82
|
+
T = Symbol.for("react.module.reference");
|
|
83
|
+
function D(i) {
|
|
84
|
+
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || R || i === o || i === d || i === f || w || i === S || p || _ || 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
|
-
i.$$typeof ===
|
|
88
|
+
i.$$typeof === T || i.getModuleId !== void 0));
|
|
89
89
|
}
|
|
90
|
-
function M(i, b,
|
|
91
|
-
var
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
90
|
+
function M(i, b, I) {
|
|
91
|
+
var j = i.displayName;
|
|
92
|
+
if (j)
|
|
93
|
+
return j;
|
|
94
94
|
var X = b.displayName || b.name || "";
|
|
95
|
-
return X !== "" ?
|
|
95
|
+
return X !== "" ? I + "(" + X + ")" : I;
|
|
96
96
|
}
|
|
97
97
|
function A(i) {
|
|
98
98
|
return i.displayName || "Context";
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function Y(i) {
|
|
101
101
|
if (i == null)
|
|
102
102
|
return null;
|
|
103
|
-
if (typeof i.tag == "number" &&
|
|
103
|
+
if (typeof i.tag == "number" && x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof i == "function")
|
|
104
104
|
return i.displayName || i.name || null;
|
|
105
105
|
if (typeof i == "string")
|
|
106
106
|
return i;
|
|
@@ -124,17 +124,17 @@ function Ur() {
|
|
|
124
124
|
var b = i;
|
|
125
125
|
return A(b) + ".Consumer";
|
|
126
126
|
case a:
|
|
127
|
-
var
|
|
128
|
-
return A(
|
|
127
|
+
var I = i;
|
|
128
|
+
return A(I._context) + ".Provider";
|
|
129
129
|
case l:
|
|
130
130
|
return M(i, i.render, "ForwardRef");
|
|
131
131
|
case c:
|
|
132
|
-
var
|
|
133
|
-
return
|
|
132
|
+
var j = i.displayName || null;
|
|
133
|
+
return j !== null ? j : Y(i.type) || "Memo";
|
|
134
134
|
case h: {
|
|
135
|
-
var X = i, W = X._payload,
|
|
135
|
+
var X = i, W = X._payload, N = X._init;
|
|
136
136
|
try {
|
|
137
|
-
return N(
|
|
137
|
+
return Y(N(W));
|
|
138
138
|
} catch {
|
|
139
139
|
return null;
|
|
140
140
|
}
|
|
@@ -142,14 +142,14 @@ function Ur() {
|
|
|
142
142
|
}
|
|
143
143
|
return null;
|
|
144
144
|
}
|
|
145
|
-
var U = Object.assign,
|
|
145
|
+
var U = Object.assign, G = 0, P, $, B, V, L, F, H;
|
|
146
146
|
function te() {
|
|
147
147
|
}
|
|
148
148
|
te.__reactDisabledLog = !0;
|
|
149
|
-
function
|
|
149
|
+
function Q() {
|
|
150
150
|
{
|
|
151
|
-
if (
|
|
152
|
-
P = console.log, $ = console.info,
|
|
151
|
+
if (G === 0) {
|
|
152
|
+
P = console.log, $ = console.info, B = console.warn, V = console.error, L = console.group, F = console.groupCollapsed, H = console.groupEnd;
|
|
153
153
|
var i = {
|
|
154
154
|
configurable: !0,
|
|
155
155
|
enumerable: !0,
|
|
@@ -166,12 +166,12 @@ function Ur() {
|
|
|
166
166
|
groupEnd: i
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
G++;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
function ne() {
|
|
173
173
|
{
|
|
174
|
-
if (
|
|
174
|
+
if (G--, G === 0) {
|
|
175
175
|
var i = {
|
|
176
176
|
configurable: !0,
|
|
177
177
|
enumerable: !0,
|
|
@@ -185,13 +185,13 @@ function Ur() {
|
|
|
185
185
|
value: $
|
|
186
186
|
}),
|
|
187
187
|
warn: U({}, i, {
|
|
188
|
-
value:
|
|
188
|
+
value: B
|
|
189
189
|
}),
|
|
190
190
|
error: U({}, i, {
|
|
191
191
|
value: V
|
|
192
192
|
}),
|
|
193
193
|
group: U({}, i, {
|
|
194
|
-
value:
|
|
194
|
+
value: L
|
|
195
195
|
}),
|
|
196
196
|
groupCollapsed: U({}, i, {
|
|
197
197
|
value: F
|
|
@@ -201,111 +201,111 @@ function Ur() {
|
|
|
201
201
|
})
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
G < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
var ie = y.ReactCurrentDispatcher, me;
|
|
208
|
-
function ge(i, b,
|
|
208
|
+
function ge(i, b, I) {
|
|
209
209
|
{
|
|
210
210
|
if (me === void 0)
|
|
211
211
|
try {
|
|
212
212
|
throw Error();
|
|
213
213
|
} catch (X) {
|
|
214
|
-
var
|
|
215
|
-
me =
|
|
214
|
+
var j = X.stack.trim().match(/\n( *(at )?)/);
|
|
215
|
+
me = j && j[1] || "";
|
|
216
216
|
}
|
|
217
217
|
return `
|
|
218
218
|
` + me + i;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
var Ke = !1,
|
|
221
|
+
var Ke = !1, De;
|
|
222
222
|
{
|
|
223
|
-
var
|
|
224
|
-
|
|
223
|
+
var gr = typeof WeakMap == "function" ? WeakMap : Map;
|
|
224
|
+
De = new gr();
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function vt(i, b) {
|
|
227
227
|
if (!i || Ke)
|
|
228
228
|
return "";
|
|
229
229
|
{
|
|
230
|
-
var
|
|
231
|
-
if (
|
|
232
|
-
return
|
|
230
|
+
var I = De.get(i);
|
|
231
|
+
if (I !== void 0)
|
|
232
|
+
return I;
|
|
233
233
|
}
|
|
234
|
-
var
|
|
234
|
+
var j;
|
|
235
235
|
Ke = !0;
|
|
236
236
|
var X = Error.prepareStackTrace;
|
|
237
237
|
Error.prepareStackTrace = void 0;
|
|
238
238
|
var W;
|
|
239
|
-
W = ie.current, ie.current = null,
|
|
239
|
+
W = ie.current, ie.current = null, Q();
|
|
240
240
|
try {
|
|
241
241
|
if (b) {
|
|
242
|
-
var
|
|
242
|
+
var N = function() {
|
|
243
243
|
throw Error();
|
|
244
244
|
};
|
|
245
|
-
if (Object.defineProperty(
|
|
245
|
+
if (Object.defineProperty(N.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(N, []);
|
|
252
252
|
} catch (ae) {
|
|
253
|
-
|
|
253
|
+
j = ae;
|
|
254
254
|
}
|
|
255
|
-
Reflect.construct(i, [],
|
|
255
|
+
Reflect.construct(i, [], N);
|
|
256
256
|
} else {
|
|
257
257
|
try {
|
|
258
|
-
|
|
258
|
+
N.call();
|
|
259
259
|
} catch (ae) {
|
|
260
|
-
|
|
260
|
+
j = ae;
|
|
261
261
|
}
|
|
262
|
-
i.call(
|
|
262
|
+
i.call(N.prototype);
|
|
263
263
|
}
|
|
264
264
|
} else {
|
|
265
265
|
try {
|
|
266
266
|
throw Error();
|
|
267
267
|
} catch (ae) {
|
|
268
|
-
|
|
268
|
+
j = ae;
|
|
269
269
|
}
|
|
270
270
|
i();
|
|
271
271
|
}
|
|
272
272
|
} catch (ae) {
|
|
273
|
-
if (ae &&
|
|
274
|
-
for (var
|
|
275
|
-
`), ee =
|
|
276
|
-
`), q =
|
|
277
|
-
|
|
278
|
-
for (; q >= 1 &&
|
|
279
|
-
if (
|
|
280
|
-
if (q !== 1 ||
|
|
273
|
+
if (ae && j && typeof ae.stack == "string") {
|
|
274
|
+
for (var z = ae.stack.split(`
|
|
275
|
+
`), ee = j.stack.split(`
|
|
276
|
+
`), q = z.length - 1, J = ee.length - 1; q >= 1 && J >= 0 && z[q] !== ee[J]; )
|
|
277
|
+
J--;
|
|
278
|
+
for (; q >= 1 && J >= 0; q--, J--)
|
|
279
|
+
if (z[q] !== ee[J]) {
|
|
280
|
+
if (q !== 1 || J !== 1)
|
|
281
281
|
do
|
|
282
|
-
if (q--,
|
|
282
|
+
if (q--, J--, J < 0 || z[q] !== ee[J]) {
|
|
283
283
|
var re = `
|
|
284
|
-
` +
|
|
285
|
-
return i.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", i.displayName)), typeof i == "function" &&
|
|
284
|
+
` + z[q].replace(" at new ", " at ");
|
|
285
|
+
return i.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", i.displayName)), typeof i == "function" && De.set(i, re), re;
|
|
286
286
|
}
|
|
287
|
-
while (q >= 1 &&
|
|
287
|
+
while (q >= 1 && J >= 0);
|
|
288
288
|
break;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
} finally {
|
|
292
292
|
Ke = !1, ie.current = W, ne(), Error.prepareStackTrace = X;
|
|
293
293
|
}
|
|
294
|
-
var ve = i ? i.displayName || i.name : "",
|
|
295
|
-
return typeof i == "function" &&
|
|
294
|
+
var ve = i ? i.displayName || i.name : "", kt = ve ? ge(ve) : "";
|
|
295
|
+
return typeof i == "function" && De.set(i, kt), kt;
|
|
296
296
|
}
|
|
297
|
-
function
|
|
298
|
-
return
|
|
297
|
+
function hr(i, b, I) {
|
|
298
|
+
return vt(i, !1);
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function vr(i) {
|
|
301
301
|
var b = i.prototype;
|
|
302
302
|
return !!(b && b.isReactComponent);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function je(i, b, I) {
|
|
305
305
|
if (i == null)
|
|
306
306
|
return "";
|
|
307
307
|
if (typeof i == "function")
|
|
308
|
-
return
|
|
308
|
+
return vt(i, vr(i));
|
|
309
309
|
if (typeof i == "string")
|
|
310
310
|
return ge(i);
|
|
311
311
|
switch (i) {
|
|
@@ -317,78 +317,78 @@ function Ur() {
|
|
|
317
317
|
if (typeof i == "object")
|
|
318
318
|
switch (i.$$typeof) {
|
|
319
319
|
case l:
|
|
320
|
-
return
|
|
320
|
+
return hr(i.render);
|
|
321
321
|
case c:
|
|
322
|
-
return
|
|
322
|
+
return je(i.type, b, I);
|
|
323
323
|
case h: {
|
|
324
|
-
var
|
|
324
|
+
var j = i, X = j._payload, W = j._init;
|
|
325
325
|
try {
|
|
326
|
-
return
|
|
326
|
+
return je(W(X), b, I);
|
|
327
327
|
} catch {
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
return "";
|
|
332
332
|
}
|
|
333
|
-
var $e = Object.prototype.hasOwnProperty,
|
|
333
|
+
var $e = Object.prototype.hasOwnProperty, yt = {}, St = y.ReactDebugCurrentFrame;
|
|
334
334
|
function Ae(i) {
|
|
335
335
|
if (i) {
|
|
336
|
-
var b = i._owner,
|
|
337
|
-
|
|
336
|
+
var b = i._owner, I = je(i.type, i._source, b ? b.type : null);
|
|
337
|
+
St.setExtraStackFrame(I);
|
|
338
338
|
} else
|
|
339
|
-
|
|
339
|
+
St.setExtraStackFrame(null);
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function yr(i, b, I, j, X) {
|
|
342
342
|
{
|
|
343
343
|
var W = Function.call.bind($e);
|
|
344
|
-
for (var
|
|
345
|
-
if (W(i,
|
|
346
|
-
var
|
|
344
|
+
for (var N in i)
|
|
345
|
+
if (W(i, N)) {
|
|
346
|
+
var z = void 0;
|
|
347
347
|
try {
|
|
348
|
-
if (typeof i[
|
|
349
|
-
var ee = Error((
|
|
348
|
+
if (typeof i[N] != "function") {
|
|
349
|
+
var ee = Error((j || "React class") + ": " + I + " type `" + N + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof i[N] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
350
350
|
throw ee.name = "Invariant Violation", ee;
|
|
351
351
|
}
|
|
352
|
-
|
|
352
|
+
z = i[N](b, N, j, I, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
353
353
|
} catch (q) {
|
|
354
|
-
|
|
354
|
+
z = q;
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
z && !(z instanceof Error) && (Ae(X), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", j || "React class", I, N, typeof z), Ae(null)), z instanceof Error && !(z.message in yt) && (yt[z.message] = !0, Ae(X), x("Failed %s type: %s", I, z.message), Ae(null));
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
var
|
|
360
|
+
var Sr = Array.isArray;
|
|
361
361
|
function He(i) {
|
|
362
|
-
return
|
|
362
|
+
return Sr(i);
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function _r(i) {
|
|
365
365
|
{
|
|
366
|
-
var b = typeof Symbol == "function" && Symbol.toStringTag,
|
|
367
|
-
return
|
|
366
|
+
var b = typeof Symbol == "function" && Symbol.toStringTag, I = b && i[Symbol.toStringTag] || i.constructor.name || "Object";
|
|
367
|
+
return I;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function br(i) {
|
|
371
371
|
try {
|
|
372
|
-
return
|
|
372
|
+
return _t(i), !1;
|
|
373
373
|
} catch {
|
|
374
374
|
return !0;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function _t(i) {
|
|
378
378
|
return "" + i;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
381
|
-
if (
|
|
382
|
-
return
|
|
380
|
+
function bt(i) {
|
|
381
|
+
if (br(i))
|
|
382
|
+
return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", _r(i)), _t(i);
|
|
383
383
|
}
|
|
384
|
-
var be = y.ReactCurrentOwner,
|
|
384
|
+
var be = y.ReactCurrentOwner, Er = {
|
|
385
385
|
key: !0,
|
|
386
386
|
ref: !0,
|
|
387
387
|
__self: !0,
|
|
388
388
|
__source: !0
|
|
389
|
-
},
|
|
389
|
+
}, Et, wt, qe;
|
|
390
390
|
qe = {};
|
|
391
|
-
function
|
|
391
|
+
function wr(i) {
|
|
392
392
|
if ($e.call(i, "ref")) {
|
|
393
393
|
var b = Object.getOwnPropertyDescriptor(i, "ref").get;
|
|
394
394
|
if (b && b.isReactWarning)
|
|
@@ -396,7 +396,7 @@ function Ur() {
|
|
|
396
396
|
}
|
|
397
397
|
return i.ref !== void 0;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function xr(i) {
|
|
400
400
|
if ($e.call(i, "key")) {
|
|
401
401
|
var b = Object.getOwnPropertyDescriptor(i, "key").get;
|
|
402
402
|
if (b && b.isReactWarning)
|
|
@@ -406,86 +406,86 @@ function Ur() {
|
|
|
406
406
|
}
|
|
407
407
|
function Cr(i, b) {
|
|
408
408
|
if (typeof i.ref == "string" && be.current && b && be.current.stateNode !== b) {
|
|
409
|
-
var
|
|
410
|
-
qe[
|
|
409
|
+
var I = Y(be.current.type);
|
|
410
|
+
qe[I] || (x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', Y(be.current.type), i.ref), qe[I] = !0);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function Rr(i, b) {
|
|
414
414
|
{
|
|
415
|
-
var
|
|
416
|
-
|
|
415
|
+
var I = function() {
|
|
416
|
+
Et || (Et = !0, x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
|
|
417
417
|
};
|
|
418
|
-
|
|
419
|
-
get:
|
|
418
|
+
I.isReactWarning = !0, Object.defineProperty(i, "key", {
|
|
419
|
+
get: I,
|
|
420
420
|
configurable: !0
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function Ir(i, b) {
|
|
425
425
|
{
|
|
426
|
-
var
|
|
427
|
-
|
|
426
|
+
var I = function() {
|
|
427
|
+
wt || (wt = !0, x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
|
|
428
428
|
};
|
|
429
|
-
|
|
430
|
-
get:
|
|
429
|
+
I.isReactWarning = !0, Object.defineProperty(i, "ref", {
|
|
430
|
+
get: I,
|
|
431
431
|
configurable: !0
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
var
|
|
436
|
-
var
|
|
435
|
+
var Or = function(i, b, I, j, X, W, N) {
|
|
436
|
+
var z = {
|
|
437
437
|
// This tag allows us to uniquely identify this as a React Element
|
|
438
438
|
$$typeof: t,
|
|
439
439
|
// Built-in properties that belong on the element
|
|
440
440
|
type: i,
|
|
441
441
|
key: b,
|
|
442
|
-
ref:
|
|
443
|
-
props:
|
|
442
|
+
ref: I,
|
|
443
|
+
props: N,
|
|
444
444
|
// Record the component responsible for creating this element.
|
|
445
445
|
_owner: W
|
|
446
446
|
};
|
|
447
|
-
return
|
|
447
|
+
return z._store = {}, Object.defineProperty(z._store, "validated", {
|
|
448
448
|
configurable: !1,
|
|
449
449
|
enumerable: !1,
|
|
450
450
|
writable: !0,
|
|
451
451
|
value: !1
|
|
452
|
-
}), Object.defineProperty(
|
|
452
|
+
}), Object.defineProperty(z, "_self", {
|
|
453
453
|
configurable: !1,
|
|
454
454
|
enumerable: !1,
|
|
455
455
|
writable: !1,
|
|
456
|
-
value:
|
|
457
|
-
}), Object.defineProperty(
|
|
456
|
+
value: j
|
|
457
|
+
}), Object.defineProperty(z, "_source", {
|
|
458
458
|
configurable: !1,
|
|
459
459
|
enumerable: !1,
|
|
460
460
|
writable: !1,
|
|
461
461
|
value: X
|
|
462
|
-
}), Object.freeze && (Object.freeze(
|
|
462
|
+
}), Object.freeze && (Object.freeze(z.props), Object.freeze(z)), z;
|
|
463
463
|
};
|
|
464
|
-
function
|
|
464
|
+
function Tr(i, b, I, j, X) {
|
|
465
465
|
{
|
|
466
|
-
var W,
|
|
467
|
-
|
|
466
|
+
var W, N = {}, z = null, ee = null;
|
|
467
|
+
I !== void 0 && (bt(I), z = "" + I), xr(b) && (bt(b.key), z = "" + b.key), wr(b) && (ee = b.ref, Cr(b, X));
|
|
468
468
|
for (W in b)
|
|
469
|
-
$e.call(b, W) && !
|
|
469
|
+
$e.call(b, W) && !Er.hasOwnProperty(W) && (N[W] = b[W]);
|
|
470
470
|
if (i && i.defaultProps) {
|
|
471
471
|
var q = i.defaultProps;
|
|
472
472
|
for (W in q)
|
|
473
|
-
|
|
473
|
+
N[W] === void 0 && (N[W] = q[W]);
|
|
474
474
|
}
|
|
475
|
-
if (
|
|
476
|
-
var
|
|
477
|
-
|
|
475
|
+
if (z || ee) {
|
|
476
|
+
var J = typeof i == "function" ? i.displayName || i.name || "Unknown" : i;
|
|
477
|
+
z && Rr(N, J), ee && Ir(N, J);
|
|
478
478
|
}
|
|
479
|
-
return
|
|
479
|
+
return Or(i, z, ee, X, j, be.current, N);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
var Ge = y.ReactCurrentOwner,
|
|
482
|
+
var Ge = y.ReactCurrentOwner, xt = y.ReactDebugCurrentFrame;
|
|
483
483
|
function he(i) {
|
|
484
484
|
if (i) {
|
|
485
|
-
var b = i._owner,
|
|
486
|
-
|
|
485
|
+
var b = i._owner, I = je(i.type, i._source, b ? b.type : null);
|
|
486
|
+
xt.setExtraStackFrame(I);
|
|
487
487
|
} else
|
|
488
|
-
|
|
488
|
+
xt.setExtraStackFrame(null);
|
|
489
489
|
}
|
|
490
490
|
var Je;
|
|
491
491
|
Je = !1;
|
|
@@ -495,7 +495,7 @@ function Ur() {
|
|
|
495
495
|
function Ct() {
|
|
496
496
|
{
|
|
497
497
|
if (Ge.current) {
|
|
498
|
-
var i =
|
|
498
|
+
var i = Y(Ge.current.type);
|
|
499
499
|
if (i)
|
|
500
500
|
return `
|
|
501
501
|
|
|
@@ -504,145 +504,145 @@ Check the render method of \`` + i + "`.";
|
|
|
504
504
|
return "";
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function kr(i) {
|
|
508
508
|
{
|
|
509
509
|
if (i !== void 0) {
|
|
510
|
-
var b = i.fileName.replace(/^.*[\\\/]/, ""),
|
|
510
|
+
var b = i.fileName.replace(/^.*[\\\/]/, ""), I = i.lineNumber;
|
|
511
511
|
return `
|
|
512
512
|
|
|
513
|
-
Check your code at ` + b + ":" +
|
|
513
|
+
Check your code at ` + b + ":" + I + ".";
|
|
514
514
|
}
|
|
515
515
|
return "";
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
var
|
|
519
|
-
function
|
|
518
|
+
var Rt = {};
|
|
519
|
+
function Pr(i) {
|
|
520
520
|
{
|
|
521
521
|
var b = Ct();
|
|
522
522
|
if (!b) {
|
|
523
|
-
var
|
|
524
|
-
|
|
523
|
+
var I = typeof i == "string" ? i : i.displayName || i.name;
|
|
524
|
+
I && (b = `
|
|
525
525
|
|
|
526
|
-
Check the top-level render call using <` +
|
|
526
|
+
Check the top-level render call using <` + I + ">.");
|
|
527
527
|
}
|
|
528
528
|
return b;
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function It(i, b) {
|
|
532
532
|
{
|
|
533
533
|
if (!i._store || i._store.validated || i.key != null)
|
|
534
534
|
return;
|
|
535
535
|
i._store.validated = !0;
|
|
536
|
-
var
|
|
537
|
-
if (
|
|
536
|
+
var I = Pr(b);
|
|
537
|
+
if (Rt[I])
|
|
538
538
|
return;
|
|
539
|
-
|
|
540
|
-
var
|
|
541
|
-
i && i._owner && i._owner !== Ge.current && (
|
|
539
|
+
Rt[I] = !0;
|
|
540
|
+
var j = "";
|
|
541
|
+
i && i._owner && i._owner !== Ge.current && (j = " It was passed a child from " + Y(i._owner.type) + "."), he(i), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', I, j), he(null);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function Ot(i, b) {
|
|
545
545
|
{
|
|
546
546
|
if (typeof i != "object")
|
|
547
547
|
return;
|
|
548
548
|
if (He(i))
|
|
549
|
-
for (var
|
|
550
|
-
var
|
|
551
|
-
Ze(
|
|
549
|
+
for (var I = 0; I < i.length; I++) {
|
|
550
|
+
var j = i[I];
|
|
551
|
+
Ze(j) && It(j, b);
|
|
552
552
|
}
|
|
553
553
|
else if (Ze(i))
|
|
554
554
|
i._store && (i._store.validated = !0);
|
|
555
555
|
else if (i) {
|
|
556
|
-
var X =
|
|
556
|
+
var X = O(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), N; !(N = W.next()).done; )
|
|
559
|
+
Ze(N.value) && It(N.value, b);
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Mr(i) {
|
|
564
564
|
{
|
|
565
565
|
var b = i.type;
|
|
566
566
|
if (b == null || typeof b == "string")
|
|
567
567
|
return;
|
|
568
|
-
var
|
|
568
|
+
var I;
|
|
569
569
|
if (typeof b == "function")
|
|
570
|
-
|
|
570
|
+
I = 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
573
|
b.$$typeof === c))
|
|
574
|
-
|
|
574
|
+
I = b.propTypes;
|
|
575
575
|
else
|
|
576
576
|
return;
|
|
577
|
-
if (
|
|
578
|
-
var
|
|
579
|
-
|
|
577
|
+
if (I) {
|
|
578
|
+
var j = Y(b);
|
|
579
|
+
yr(I, i.props, "prop", j, i);
|
|
580
580
|
} else if (b.PropTypes !== void 0 && !Je) {
|
|
581
581
|
Je = !0;
|
|
582
|
-
var X =
|
|
583
|
-
|
|
582
|
+
var X = Y(b);
|
|
583
|
+
x("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 && x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function Dr(i) {
|
|
589
589
|
{
|
|
590
|
-
for (var b = Object.keys(i.props),
|
|
591
|
-
var
|
|
592
|
-
if (
|
|
593
|
-
he(i),
|
|
590
|
+
for (var b = Object.keys(i.props), I = 0; I < b.length; I++) {
|
|
591
|
+
var j = b[I];
|
|
592
|
+
if (j !== "children" && j !== "key") {
|
|
593
|
+
he(i), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", j), he(null);
|
|
594
594
|
break;
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
i.ref !== null && (he(i),
|
|
597
|
+
i.ref !== null && (he(i), x("Invalid attribute `ref` supplied to `React.Fragment`."), he(null));
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function Tt(i, b, I, j, X, W) {
|
|
601
601
|
{
|
|
602
|
-
var
|
|
603
|
-
if (!
|
|
604
|
-
var
|
|
605
|
-
(i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (
|
|
606
|
-
var ee =
|
|
607
|
-
ee ?
|
|
602
|
+
var N = D(i);
|
|
603
|
+
if (!N) {
|
|
604
|
+
var z = "";
|
|
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 ee = kr(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 = "<" + (
|
|
609
|
+
i === null ? q = "null" : He(i) ? q = "array" : i !== void 0 && i.$$typeof === t ? (q = "<" + (Y(i.type) || "Unknown") + " />", z = " Did you accidentally export a JSX literal instead of a component?") : q = typeof i, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", q, z);
|
|
610
610
|
}
|
|
611
|
-
var
|
|
612
|
-
if (
|
|
613
|
-
return
|
|
614
|
-
if (
|
|
611
|
+
var J = Tr(i, b, I, X, W);
|
|
612
|
+
if (J == null)
|
|
613
|
+
return J;
|
|
614
|
+
if (N) {
|
|
615
615
|
var re = b.children;
|
|
616
616
|
if (re !== void 0)
|
|
617
|
-
if (
|
|
617
|
+
if (j)
|
|
618
618
|
if (He(re)) {
|
|
619
619
|
for (var ve = 0; ve < re.length; ve++)
|
|
620
|
-
|
|
620
|
+
Ot(re[ve], i);
|
|
621
621
|
Object.freeze && Object.freeze(re);
|
|
622
622
|
} else
|
|
623
|
-
|
|
623
|
+
x("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
|
-
|
|
625
|
+
Ot(re, i);
|
|
626
626
|
}
|
|
627
|
-
return i === n ?
|
|
627
|
+
return i === n ? Dr(J) : Mr(J), J;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
function jr(i, b,
|
|
631
|
-
return
|
|
630
|
+
function jr(i, b, I) {
|
|
631
|
+
return Tt(i, b, I, !0);
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
return
|
|
633
|
+
function $r(i, b, I) {
|
|
634
|
+
return Tt(i, b, I, !1);
|
|
635
635
|
}
|
|
636
|
-
var
|
|
637
|
-
we.Fragment = n, we.jsx =
|
|
636
|
+
var Ar = $r, Lr = jr;
|
|
637
|
+
we.Fragment = n, we.jsx = Ar, we.jsxs = Lr;
|
|
638
638
|
}()), we;
|
|
639
639
|
}
|
|
640
640
|
(function(e) {
|
|
641
|
-
process.env.NODE_ENV === "production" ? e.exports =
|
|
642
|
-
})(
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
class
|
|
641
|
+
process.env.NODE_ENV === "production" ? e.exports = Ur() : e.exports = Wr();
|
|
642
|
+
})(Xr);
|
|
643
|
+
const Vr = Ie.Fragment, k = Ie.jsx, le = Ie.jsxs;
|
|
644
|
+
let Fr = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, r) => (r &= 63, r < 36 ? t += r.toString(36) : r < 62 ? t += (r - 26).toString(36).toUpperCase() : r > 62 ? t += "-" : t += "_", t), "");
|
|
645
|
+
class Kr {
|
|
646
646
|
constructor(t, r, n = null) {
|
|
647
647
|
this._socket = t, this.userId = n, this.room = r, this.toUnregister = [
|
|
648
648
|
() => {
|
|
@@ -669,7 +669,7 @@ class Fr {
|
|
|
669
669
|
* @returns the result of the call.
|
|
670
670
|
*/
|
|
671
671
|
async _callServerRPC(t, r) {
|
|
672
|
-
const n =
|
|
672
|
+
const n = Fr();
|
|
673
673
|
return new Promise((o, s) => {
|
|
674
674
|
this._socket.once(`${this.room}._result.${n}`, (a) => {
|
|
675
675
|
a.hasOwnProperty("ok") ? o(a.ok) : s(a.err);
|
|
@@ -738,7 +738,7 @@ class Fr {
|
|
|
738
738
|
return await this._callServerRPC("call", { name: t, params: r });
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
const
|
|
741
|
+
const Hr = ({
|
|
742
742
|
socket: e,
|
|
743
743
|
room: t,
|
|
744
744
|
onJoined: r = () => {
|
|
@@ -747,7 +747,7 @@ const Kr = ({
|
|
|
747
747
|
},
|
|
748
748
|
userId: o = null
|
|
749
749
|
}) => {
|
|
750
|
-
const s = new
|
|
750
|
+
const s = new Kr(e, t, o);
|
|
751
751
|
return new Promise((a) => {
|
|
752
752
|
let u = !0;
|
|
753
753
|
e.on(`${t}.isMaster`, () => {
|
|
@@ -761,7 +761,7 @@ const Kr = ({
|
|
|
761
761
|
});
|
|
762
762
|
}), e.emit("joinSuperSocket", { room: t, userId: o });
|
|
763
763
|
});
|
|
764
|
-
},
|
|
764
|
+
}, at = g.createContext(), qr = () => /* @__PURE__ */ k(
|
|
765
765
|
"div",
|
|
766
766
|
{
|
|
767
767
|
style: {
|
|
@@ -773,16 +773,16 @@ const Kr = ({
|
|
|
773
773
|
justifyContent: "center",
|
|
774
774
|
alignItems: "center"
|
|
775
775
|
},
|
|
776
|
-
children: /* @__PURE__ */
|
|
776
|
+
children: /* @__PURE__ */ k("h2", { children: "🌀 Loading..." })
|
|
777
777
|
}
|
|
778
|
-
),
|
|
778
|
+
), or = ({
|
|
779
779
|
socket: e,
|
|
780
780
|
room: t,
|
|
781
781
|
channel: r = "default",
|
|
782
|
-
LoadingComponent: n =
|
|
782
|
+
LoadingComponent: n = qr,
|
|
783
783
|
children: o
|
|
784
784
|
}) => {
|
|
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),
|
|
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), S = _e(at), v = g.useRef(!1);
|
|
786
786
|
return g.useEffect(() => (h.current = !0, () => {
|
|
787
787
|
h.current = !1;
|
|
788
788
|
}), []), g.useEffect(() => {
|
|
@@ -794,7 +794,7 @@ const Kr = ({
|
|
|
794
794
|
return e.on("disconnect", E), () => {
|
|
795
795
|
e.off("disconnect", E);
|
|
796
796
|
};
|
|
797
|
-
}, [r, e]), g.useEffect(() => e ? (e.connected || e.connect(), console.log(`Try to connect to wire ${t} on channel ${r}`), v.current || (v.current = !0,
|
|
797
|
+
}, [r, e]), g.useEffect(() => e ? (e.connected || e.connect(), console.log(`Try to connect to wire ${t} on channel ${r}`), v.current || (v.current = !0, Hr({
|
|
798
798
|
socket: e,
|
|
799
799
|
room: t,
|
|
800
800
|
onMaster: () => {
|
|
@@ -806,14 +806,14 @@ const Kr = ({
|
|
|
806
806
|
})), () => {
|
|
807
807
|
var E;
|
|
808
808
|
(E = c.current) == null || E.leave();
|
|
809
|
-
}) : null, [r, t, e]), !s || !d ? /* @__PURE__ */
|
|
810
|
-
|
|
809
|
+
}) : null, [r, t, e]), !s || !d ? /* @__PURE__ */ k(n, {}) : /* @__PURE__ */ k(
|
|
810
|
+
at.Provider,
|
|
811
811
|
{
|
|
812
|
-
value: { ...
|
|
812
|
+
value: { ...S, [r]: { wire: d, joined: s, isMaster: u, room: t } },
|
|
813
813
|
children: o
|
|
814
814
|
}
|
|
815
815
|
);
|
|
816
|
-
}, Xe = (e = "default") => (_e(
|
|
816
|
+
}, Xe = (e = "default") => (_e(at) || {})[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;
|
|
@@ -828,14 +828,14 @@ const Kr = ({
|
|
|
828
828
|
} };
|
|
829
829
|
return t = e(n, o, u), u;
|
|
830
830
|
}, Ue = (e) => e ? jt(e) : jt;
|
|
831
|
-
var
|
|
831
|
+
var ct = {}, Gr = {
|
|
832
832
|
get exports() {
|
|
833
|
-
return
|
|
833
|
+
return ct;
|
|
834
834
|
},
|
|
835
835
|
set exports(e) {
|
|
836
|
-
|
|
836
|
+
ct = e;
|
|
837
837
|
}
|
|
838
|
-
}, Qe = {}, Ye = {},
|
|
838
|
+
}, Qe = {}, Ye = {}, Jr = {
|
|
839
839
|
get exports() {
|
|
840
840
|
return Ye;
|
|
841
841
|
},
|
|
@@ -852,32 +852,32 @@ 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
|
|
856
|
-
function
|
|
857
|
-
if (
|
|
855
|
+
var $t;
|
|
856
|
+
function Zr() {
|
|
857
|
+
if ($t)
|
|
858
858
|
return et;
|
|
859
|
-
|
|
859
|
+
$t = 1;
|
|
860
860
|
var e = g;
|
|
861
861
|
function t(c, h) {
|
|
862
862
|
return c === h && (c !== 0 || 1 / c === 1 / h) || c !== c && h !== h;
|
|
863
863
|
}
|
|
864
864
|
var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, s = e.useLayoutEffect, a = e.useDebugValue;
|
|
865
865
|
function u(c, h) {
|
|
866
|
-
var
|
|
866
|
+
var S = h(), v = n({ inst: { value: S, getSnapshot: h } }), E = v[0].inst, O = v[1];
|
|
867
867
|
return s(function() {
|
|
868
|
-
E.value =
|
|
869
|
-
}, [c,
|
|
870
|
-
return l(E) &&
|
|
871
|
-
l(E) &&
|
|
868
|
+
E.value = S, E.getSnapshot = h, l(E) && O({ inst: E });
|
|
869
|
+
}, [c, S, h]), o(function() {
|
|
870
|
+
return l(E) && O({ inst: E }), c(function() {
|
|
871
|
+
l(E) && O({ inst: E });
|
|
872
872
|
});
|
|
873
|
-
}, [c]), a(
|
|
873
|
+
}, [c]), a(S), S;
|
|
874
874
|
}
|
|
875
875
|
function l(c) {
|
|
876
876
|
var h = c.getSnapshot;
|
|
877
877
|
c = c.value;
|
|
878
878
|
try {
|
|
879
|
-
var
|
|
880
|
-
return !r(c,
|
|
879
|
+
var S = h();
|
|
880
|
+
return !r(c, S);
|
|
881
881
|
} catch {
|
|
882
882
|
return !0;
|
|
883
883
|
}
|
|
@@ -898,82 +898,82 @@ var tt = {};
|
|
|
898
898
|
* This source code is licensed under the MIT license found in the
|
|
899
899
|
* LICENSE file in the root directory of this source tree.
|
|
900
900
|
*/
|
|
901
|
-
var
|
|
902
|
-
function
|
|
903
|
-
return
|
|
901
|
+
var At;
|
|
902
|
+
function Qr() {
|
|
903
|
+
return At || (At = 1, process.env.NODE_ENV !== "production" && function() {
|
|
904
904
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
905
905
|
var e = g, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
906
|
-
function r(
|
|
906
|
+
function r(C) {
|
|
907
907
|
{
|
|
908
|
-
for (var p = arguments.length,
|
|
909
|
-
|
|
910
|
-
n("error",
|
|
908
|
+
for (var p = arguments.length, _ = new Array(p > 1 ? p - 1 : 0), m = 1; m < p; m++)
|
|
909
|
+
_[m - 1] = arguments[m];
|
|
910
|
+
n("error", C, _);
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
function n(
|
|
913
|
+
function n(C, p, _) {
|
|
914
914
|
{
|
|
915
|
-
var m = t.ReactDebugCurrentFrame,
|
|
916
|
-
|
|
917
|
-
var
|
|
918
|
-
return String(
|
|
915
|
+
var m = t.ReactDebugCurrentFrame, w = m.getStackAddendum();
|
|
916
|
+
w !== "" && (p += "%s", _ = _.concat([w]));
|
|
917
|
+
var R = _.map(function(T) {
|
|
918
|
+
return String(T);
|
|
919
919
|
});
|
|
920
|
-
|
|
920
|
+
R.unshift("Warning: " + p), Function.prototype.apply.call(console[C], console, R);
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
-
function o(
|
|
924
|
-
return
|
|
923
|
+
function o(C, p) {
|
|
924
|
+
return C === p && (C !== 0 || 1 / C === 1 / p) || C !== C && p !== p;
|
|
925
925
|
}
|
|
926
926
|
var s = typeof Object.is == "function" ? Object.is : o, a = e.useState, u = e.useEffect, l = e.useLayoutEffect, d = e.useDebugValue, f = !1, c = !1;
|
|
927
|
-
function h(
|
|
927
|
+
function h(C, p, _) {
|
|
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
930
|
if (!c) {
|
|
931
|
-
var
|
|
932
|
-
s(m,
|
|
931
|
+
var w = p();
|
|
932
|
+
s(m, w) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), c = !0);
|
|
933
933
|
}
|
|
934
|
-
var
|
|
934
|
+
var R = a({
|
|
935
935
|
inst: {
|
|
936
936
|
value: m,
|
|
937
937
|
getSnapshot: p
|
|
938
938
|
}
|
|
939
|
-
}),
|
|
939
|
+
}), T = R[0].inst, D = R[1];
|
|
940
940
|
return l(function() {
|
|
941
|
-
|
|
942
|
-
inst:
|
|
941
|
+
T.value = m, T.getSnapshot = p, S(T) && D({
|
|
942
|
+
inst: T
|
|
943
943
|
});
|
|
944
|
-
}, [
|
|
945
|
-
|
|
946
|
-
inst:
|
|
944
|
+
}, [C, m, p]), u(function() {
|
|
945
|
+
S(T) && D({
|
|
946
|
+
inst: T
|
|
947
947
|
});
|
|
948
948
|
var M = function() {
|
|
949
|
-
|
|
950
|
-
inst:
|
|
949
|
+
S(T) && D({
|
|
950
|
+
inst: T
|
|
951
951
|
});
|
|
952
952
|
};
|
|
953
|
-
return
|
|
954
|
-
}, [
|
|
953
|
+
return C(M);
|
|
954
|
+
}, [C]), d(m), m;
|
|
955
955
|
}
|
|
956
|
-
function
|
|
957
|
-
var p =
|
|
956
|
+
function S(C) {
|
|
957
|
+
var p = C.getSnapshot, _ = C.value;
|
|
958
958
|
try {
|
|
959
959
|
var m = p();
|
|
960
|
-
return !s(
|
|
960
|
+
return !s(_, m);
|
|
961
961
|
} catch {
|
|
962
962
|
return !0;
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
|
-
function v(
|
|
965
|
+
function v(C, p, _) {
|
|
966
966
|
return p();
|
|
967
967
|
}
|
|
968
|
-
var E = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u",
|
|
969
|
-
tt.useSyncExternalStore =
|
|
968
|
+
var E = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", O = !E, y = O ? v : h, x = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : y;
|
|
969
|
+
tt.useSyncExternalStore = x, 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
|
-
var
|
|
973
|
-
function
|
|
974
|
-
return
|
|
975
|
-
process.env.NODE_ENV === "production" ? e.exports =
|
|
976
|
-
}(
|
|
972
|
+
var Lt;
|
|
973
|
+
function sr() {
|
|
974
|
+
return Lt || (Lt = 1, function(e) {
|
|
975
|
+
process.env.NODE_ENV === "production" ? e.exports = Zr() : e.exports = Qr();
|
|
976
|
+
}(Jr)), Ye;
|
|
977
977
|
}
|
|
978
978
|
/**
|
|
979
979
|
* @license React
|
|
@@ -984,17 +984,17 @@ function or() {
|
|
|
984
984
|
* This source code is licensed under the MIT license found in the
|
|
985
985
|
* LICENSE file in the root directory of this source tree.
|
|
986
986
|
*/
|
|
987
|
-
var
|
|
988
|
-
function
|
|
989
|
-
if (
|
|
987
|
+
var zt;
|
|
988
|
+
function en() {
|
|
989
|
+
if (zt)
|
|
990
990
|
return Qe;
|
|
991
|
-
|
|
992
|
-
var e = g, t =
|
|
991
|
+
zt = 1;
|
|
992
|
+
var e = g, t = sr();
|
|
993
993
|
function r(d, f) {
|
|
994
994
|
return d === f && (d !== 0 || 1 / d === 1 / f) || d !== d && f !== f;
|
|
995
995
|
}
|
|
996
996
|
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, a = e.useEffect, u = e.useMemo, l = e.useDebugValue;
|
|
997
|
-
return Qe.useSyncExternalStoreWithSelector = function(d, f, c, h,
|
|
997
|
+
return Qe.useSyncExternalStoreWithSelector = function(d, f, c, h, S) {
|
|
998
998
|
var v = s(null);
|
|
999
999
|
if (v.current === null) {
|
|
1000
1000
|
var E = { hasValue: !1, value: null };
|
|
@@ -1003,30 +1003,30 @@ function Qr() {
|
|
|
1003
1003
|
E = v.current;
|
|
1004
1004
|
v = u(function() {
|
|
1005
1005
|
function y(m) {
|
|
1006
|
-
if (!
|
|
1007
|
-
if (
|
|
1008
|
-
var
|
|
1009
|
-
if (
|
|
1010
|
-
return p =
|
|
1006
|
+
if (!x) {
|
|
1007
|
+
if (x = !0, C = m, m = h(m), S !== void 0 && E.hasValue) {
|
|
1008
|
+
var w = E.value;
|
|
1009
|
+
if (S(w, m))
|
|
1010
|
+
return p = w;
|
|
1011
1011
|
}
|
|
1012
1012
|
return p = m;
|
|
1013
1013
|
}
|
|
1014
|
-
if (
|
|
1015
|
-
return
|
|
1016
|
-
var
|
|
1017
|
-
return
|
|
1014
|
+
if (w = p, n(C, m))
|
|
1015
|
+
return w;
|
|
1016
|
+
var R = h(m);
|
|
1017
|
+
return S !== void 0 && S(w, R) ? w : (C = m, p = R);
|
|
1018
1018
|
}
|
|
1019
|
-
var
|
|
1019
|
+
var x = !1, C, p, _ = c === void 0 ? null : c;
|
|
1020
1020
|
return [function() {
|
|
1021
1021
|
return y(f());
|
|
1022
|
-
},
|
|
1023
|
-
return y(
|
|
1022
|
+
}, _ === null ? void 0 : function() {
|
|
1023
|
+
return y(_());
|
|
1024
1024
|
}];
|
|
1025
|
-
}, [f, c, h,
|
|
1026
|
-
var
|
|
1025
|
+
}, [f, c, h, S]);
|
|
1026
|
+
var O = o(d, v[0], v[1]);
|
|
1027
1027
|
return a(function() {
|
|
1028
|
-
E.hasValue = !0, E.value =
|
|
1029
|
-
}, [
|
|
1028
|
+
E.hasValue = !0, E.value = O;
|
|
1029
|
+
}, [O]), l(O), O;
|
|
1030
1030
|
}, Qe;
|
|
1031
1031
|
}
|
|
1032
1032
|
var rt = {};
|
|
@@ -1039,97 +1039,97 @@ var rt = {};
|
|
|
1039
1039
|
* This source code is licensed under the MIT license found in the
|
|
1040
1040
|
* LICENSE file in the root directory of this source tree.
|
|
1041
1041
|
*/
|
|
1042
|
-
var
|
|
1043
|
-
function
|
|
1044
|
-
return
|
|
1042
|
+
var Yt;
|
|
1043
|
+
function tn() {
|
|
1044
|
+
return Yt || (Yt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
1045
1045
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1046
|
-
var e = g, t =
|
|
1046
|
+
var e = g, t = sr();
|
|
1047
1047
|
function r(f, c) {
|
|
1048
1048
|
return f === c && (f !== 0 || 1 / f === 1 / c) || f !== f && c !== c;
|
|
1049
1049
|
}
|
|
1050
1050
|
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, a = e.useEffect, u = e.useMemo, l = e.useDebugValue;
|
|
1051
|
-
function d(f, c, h,
|
|
1052
|
-
var E = s(null),
|
|
1053
|
-
E.current === null ? (
|
|
1051
|
+
function d(f, c, h, S, v) {
|
|
1052
|
+
var E = s(null), O;
|
|
1053
|
+
E.current === null ? (O = {
|
|
1054
1054
|
hasValue: !1,
|
|
1055
1055
|
value: null
|
|
1056
|
-
}, E.current =
|
|
1056
|
+
}, E.current = O) : O = E.current;
|
|
1057
1057
|
var y = u(function() {
|
|
1058
|
-
var
|
|
1059
|
-
if (!
|
|
1060
|
-
|
|
1061
|
-
var
|
|
1062
|
-
if (v !== void 0 &&
|
|
1063
|
-
var U =
|
|
1064
|
-
if (v(U,
|
|
1065
|
-
return
|
|
1058
|
+
var _ = !1, m, w, R = function(A) {
|
|
1059
|
+
if (!_) {
|
|
1060
|
+
_ = !0, m = A;
|
|
1061
|
+
var Y = S(A);
|
|
1062
|
+
if (v !== void 0 && O.hasValue) {
|
|
1063
|
+
var U = O.value;
|
|
1064
|
+
if (v(U, Y))
|
|
1065
|
+
return w = U, U;
|
|
1066
1066
|
}
|
|
1067
|
-
return
|
|
1067
|
+
return w = Y, Y;
|
|
1068
1068
|
}
|
|
1069
|
-
var
|
|
1070
|
-
if (n(
|
|
1069
|
+
var G = m, P = w;
|
|
1070
|
+
if (n(G, A))
|
|
1071
1071
|
return P;
|
|
1072
|
-
var $ =
|
|
1073
|
-
return v !== void 0 && v(P, $) ? P : (m = A,
|
|
1074
|
-
},
|
|
1075
|
-
return
|
|
1076
|
-
}, M =
|
|
1077
|
-
return
|
|
1072
|
+
var $ = S(A);
|
|
1073
|
+
return v !== void 0 && v(P, $) ? P : (m = A, w = $, $);
|
|
1074
|
+
}, T = h === void 0 ? null : h, D = function() {
|
|
1075
|
+
return R(c());
|
|
1076
|
+
}, M = T === null ? void 0 : function() {
|
|
1077
|
+
return R(T());
|
|
1078
1078
|
};
|
|
1079
|
-
return [
|
|
1080
|
-
}, [c, h,
|
|
1079
|
+
return [D, M];
|
|
1080
|
+
}, [c, h, S, v]), x = y[0], C = y[1], p = o(f, x, C);
|
|
1081
1081
|
return a(function() {
|
|
1082
|
-
|
|
1082
|
+
O.hasValue = !0, O.value = p;
|
|
1083
1083
|
}, [p]), l(p), p;
|
|
1084
1084
|
}
|
|
1085
1085
|
rt.useSyncExternalStoreWithSelector = d, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
1086
1086
|
}()), rt;
|
|
1087
1087
|
}
|
|
1088
1088
|
(function(e) {
|
|
1089
|
-
process.env.NODE_ENV === "production" ? e.exports =
|
|
1090
|
-
})(
|
|
1091
|
-
const
|
|
1089
|
+
process.env.NODE_ENV === "production" ? e.exports = en() : e.exports = tn();
|
|
1090
|
+
})(Gr);
|
|
1091
|
+
const rn = /* @__PURE__ */ Nr(ct), { useSyncExternalStoreWithSelector: nn } = rn;
|
|
1092
1092
|
function We(e, t = e.getState, r) {
|
|
1093
|
-
const n =
|
|
1093
|
+
const n = nn(
|
|
1094
1094
|
e.subscribe,
|
|
1095
1095
|
e.getState,
|
|
1096
1096
|
e.getServerState || e.getState,
|
|
1097
1097
|
t,
|
|
1098
1098
|
r
|
|
1099
1099
|
);
|
|
1100
|
-
return
|
|
1100
|
+
return Br(n), n;
|
|
1101
1101
|
}
|
|
1102
1102
|
const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e, t) ? e : e.parentNode ? Oe(e.parentNode, t) : !1, ze = ([e, t], [r, n]) => {
|
|
1103
1103
|
const o = Math.abs(e - r), s = Math.abs(t - n);
|
|
1104
1104
|
return Math.hypot(o, s);
|
|
1105
|
-
},
|
|
1105
|
+
}, ir = (e, t, r) => {
|
|
1106
1106
|
const n = r * Math.PI / 180, o = e * Math.cos(n) - t * Math.sin(n), s = e * Math.sin(n) + t * Math.cos(n);
|
|
1107
1107
|
return [o, s];
|
|
1108
|
-
},
|
|
1108
|
+
}, ut = ([e, t], { scale: r, rotate: n, translateX: o, translateY: s }) => {
|
|
1109
1109
|
const a = (e - o) / r, u = (t - s) / r;
|
|
1110
|
-
return
|
|
1110
|
+
return ir(a, u, -n);
|
|
1111
1111
|
}, Be = ([e, t], { scale: r, rotate: n, translateX: o, translateY: s }) => {
|
|
1112
|
-
const [a, u] =
|
|
1112
|
+
const [a, u] = ir(e, t, n);
|
|
1113
1113
|
return [a * r + o, u * r + s];
|
|
1114
|
-
},
|
|
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,
|
|
1114
|
+
}, Bt = (e, t, r, n) => {
|
|
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 = s - d, v = f * f + c * c, E = 2 * (h * f + S * c), O = h * h + S * S - n * n, y = E * E - 4 * v * O;
|
|
1116
1116
|
if (y < 0)
|
|
1117
1117
|
return [];
|
|
1118
|
-
const
|
|
1119
|
-
return
|
|
1120
|
-
},
|
|
1118
|
+
const x = (-E + Math.sqrt(y)) / (2 * v), C = (-E - Math.sqrt(y)) / (2 * v), p = [];
|
|
1119
|
+
return x >= 0 && x <= 1 && p.push({ x: o + x * f, y: s + x * c }), C >= 0 && C <= 1 && p.push({ x: o + C * f, y: s + C * c }), p;
|
|
1120
|
+
}, dt = (e, t) => e.x > t.left && e.x < t.left + t.width && e.y > t.top && e.y < t.top + t.height, on = (e, t) => Array.from(e.querySelectorAll(".corner")).every((n) => {
|
|
1121
1121
|
const { top: o, left: s } = n.getBoundingClientRect();
|
|
1122
|
-
return
|
|
1123
|
-
}),
|
|
1122
|
+
return dt({ x: s, y: o }, t);
|
|
1123
|
+
}), sn = (e, t) => {
|
|
1124
1124
|
const r = t.getBoundingClientRect();
|
|
1125
|
-
return
|
|
1125
|
+
return on(e, r);
|
|
1126
1126
|
}, Ne = (e, t) => {
|
|
1127
1127
|
try {
|
|
1128
|
-
const
|
|
1129
|
-
return
|
|
1128
|
+
const r = document.getElementById(`${e}__${t}`);
|
|
1129
|
+
return r || console.error(`Missing item ${t}`), r;
|
|
1130
1130
|
} catch {
|
|
1131
1131
|
console.error(
|
|
1132
|
-
`Error while getting item with id ${t}
|
|
1132
|
+
`Error while getting item with id ${t} inside wrapper`,
|
|
1133
1133
|
e
|
|
1134
1134
|
);
|
|
1135
1135
|
return;
|
|
@@ -1143,7 +1143,7 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1143
1143
|
JSON.stringify(e == null ? void 0 : e.dataset),
|
|
1144
1144
|
(n = e == null ? void 0 : e.dataset) == null ? void 0 : n.id
|
|
1145
1145
|
), t;
|
|
1146
|
-
},
|
|
1146
|
+
}, an = (e, t) => {
|
|
1147
1147
|
const r = e.reduce((n, o) => {
|
|
1148
1148
|
const s = Ne(t, o);
|
|
1149
1149
|
if (!s)
|
|
@@ -1158,32 +1158,32 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1158
1158
|
}, 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;
|
|
1159
1159
|
}, null);
|
|
1160
1160
|
return r && (r.width = r.right - r.left, r.height = r.bottom - r.top, r);
|
|
1161
|
-
},
|
|
1161
|
+
}, ar = (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), e[n] ? [
|
|
1162
1162
|
n,
|
|
1163
|
-
...
|
|
1163
|
+
...ar(
|
|
1164
1164
|
e,
|
|
1165
1165
|
e[n].linkedItems,
|
|
1166
1166
|
r
|
|
1167
1167
|
)
|
|
1168
|
-
])).flat()),
|
|
1169
|
-
const n = new Set(
|
|
1168
|
+
] : [])).flat()), Nt = (e, t, r) => {
|
|
1169
|
+
const n = new Set(ar(e, r));
|
|
1170
1170
|
return t.filter((o) => n.has(o));
|
|
1171
|
-
},
|
|
1171
|
+
}, cn = ({ x: e, y: t, width: r, height: n }, { type: o = "grid", size: s = 1, offset: a = { x: 0, y: 0 } }) => {
|
|
1172
1172
|
const [u, l] = [
|
|
1173
1173
|
e + r / 2 - a.x,
|
|
1174
1174
|
t + n / 2 - a.y
|
|
1175
1175
|
];
|
|
1176
|
-
let d, f, c, h,
|
|
1177
|
-
const
|
|
1176
|
+
let d, f, c, h, S, v, E, O, y, x;
|
|
1177
|
+
const C = s / 1.1547;
|
|
1178
1178
|
switch (o) {
|
|
1179
1179
|
case "grid":
|
|
1180
1180
|
d = Math.round(u / s) * s, f = Math.round(l / s) * s;
|
|
1181
1181
|
break;
|
|
1182
1182
|
case "hexH":
|
|
1183
|
-
c = 2 *
|
|
1183
|
+
c = 2 * C, h = 3 * s, S = Math.round(u / c) * c, E = Math.round(l / h) * h, v = S > u ? S - C : S + C, O = E > l ? E - 1.5 * s : E + 1.5 * s, y = Math.hypot(S - u, E - l), x = Math.hypot(v - u, O - l), y < x ? (d = S, f = E) : (d = v, f = O);
|
|
1184
1184
|
break;
|
|
1185
1185
|
case "hexV":
|
|
1186
|
-
c = 3 * s, h = 2 *
|
|
1186
|
+
c = 3 * s, h = 2 * C, S = Math.round(u / c) * c, E = Math.round(l / h) * h, v = S > u ? S - 1.5 * s : S + 1.5 * s, O = E > l ? E - C : E + C, y = Math.hypot(S - u, E - l), x = Math.hypot(v - u, O - l), y < x ? (d = S, f = E) : (d = v, f = O);
|
|
1187
1187
|
break;
|
|
1188
1188
|
default:
|
|
1189
1189
|
d = e + r / 2, f = t + n / 2;
|
|
@@ -1192,7 +1192,7 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1192
1192
|
x: d + a.x - r / 2,
|
|
1193
1193
|
y: f + a.y - n / 2
|
|
1194
1194
|
};
|
|
1195
|
-
},
|
|
1195
|
+
}, Xt = [
|
|
1196
1196
|
"#037758",
|
|
1197
1197
|
"#99092a",
|
|
1198
1198
|
"#067070",
|
|
@@ -1223,13 +1223,13 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1223
1223
|
"#007a4b",
|
|
1224
1224
|
"#bf0daa",
|
|
1225
1225
|
"#af0ad8"
|
|
1226
|
-
],
|
|
1226
|
+
], Ut = () => Xt[Math.floor(Math.random() * Xt.length)], un = !1, pt = ({ wire: e, storeName: t, noSync: r = [], defaultValue: n }, o) => (s, a, u) => {
|
|
1227
1227
|
s({ ready: !1 });
|
|
1228
1228
|
const l = [];
|
|
1229
1229
|
(async () => {
|
|
1230
1230
|
try {
|
|
1231
|
-
const
|
|
1232
|
-
|
|
1231
|
+
const S = await e.call(`${t}_getValue`);
|
|
1232
|
+
un && console.log("init from peer with value", S), s((v) => ({ ...v, ...S }));
|
|
1233
1233
|
} catch {
|
|
1234
1234
|
n !== void 0 && s(n);
|
|
1235
1235
|
}
|
|
@@ -1238,26 +1238,26 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1238
1238
|
`${t}_getValue`,
|
|
1239
1239
|
() => Object.fromEntries(
|
|
1240
1240
|
Object.entries(a()).filter(
|
|
1241
|
-
([
|
|
1241
|
+
([S, v]) => typeof v != "function" && !r.includes(S)
|
|
1242
1242
|
)
|
|
1243
1243
|
),
|
|
1244
1244
|
{ invoke: "first" }
|
|
1245
1245
|
)
|
|
1246
1246
|
), l.push(
|
|
1247
|
-
e.subscribe(`${t}_call`, ([
|
|
1248
|
-
c[
|
|
1247
|
+
e.subscribe(`${t}_call`, ([S, v]) => {
|
|
1248
|
+
c[S](...v);
|
|
1249
1249
|
})
|
|
1250
1250
|
), s({ ready: !0 });
|
|
1251
1251
|
})();
|
|
1252
1252
|
const f = o(s, a, u), c = { ...f }, h = Object.fromEntries(
|
|
1253
1253
|
// Send the update message on all method calls
|
|
1254
|
-
Object.entries(f).map(([
|
|
1255
|
-
const y = v(...
|
|
1256
|
-
return e.publish(`${t}_call`, [
|
|
1257
|
-
}] : [
|
|
1254
|
+
Object.entries(f).map(([S, v]) => typeof v == "function" && !S.startsWith("get") && !r.includes(S) ? [S, (...O) => {
|
|
1255
|
+
const y = v(...O);
|
|
1256
|
+
return e.publish(`${t}_call`, [S, O]), y;
|
|
1257
|
+
}] : [S, v])
|
|
1258
1258
|
);
|
|
1259
1259
|
return h.unsub = () => {
|
|
1260
|
-
l.forEach((
|
|
1260
|
+
l.forEach((S) => S());
|
|
1261
1261
|
}, h;
|
|
1262
1262
|
};
|
|
1263
1263
|
function Ve(e, t) {
|
|
@@ -1289,7 +1289,7 @@ function Ve(e, t) {
|
|
|
1289
1289
|
return !1;
|
|
1290
1290
|
return !0;
|
|
1291
1291
|
}
|
|
1292
|
-
const
|
|
1292
|
+
const cr = g.createContext(), ln = (e, t) => ({
|
|
1293
1293
|
items: {},
|
|
1294
1294
|
getItems: () => t().items,
|
|
1295
1295
|
setItems: (r) => e({ items: r }),
|
|
@@ -1308,7 +1308,7 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1308
1308
|
});
|
|
1309
1309
|
}), { items: s };
|
|
1310
1310
|
})
|
|
1311
|
-
}),
|
|
1311
|
+
}), fn = (e, t) => ({
|
|
1312
1312
|
itemIds: [],
|
|
1313
1313
|
setItemIds: (r) => e({ itemIds: r }),
|
|
1314
1314
|
getItemIds: () => t().itemIds,
|
|
@@ -1327,7 +1327,7 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1327
1327
|
updateManyItemIds: (r) => e((n) => ({
|
|
1328
1328
|
items: n.itemIds.map((o, s) => r[s] !== void 0 ? r[s] : o)
|
|
1329
1329
|
}))
|
|
1330
|
-
}),
|
|
1330
|
+
}), dn = (e, t) => ({
|
|
1331
1331
|
removeItemsById: (r) => e((n) => ({
|
|
1332
1332
|
itemIds: n.itemIds.filter((o) => !r.includes(o)),
|
|
1333
1333
|
items: Object.fromEntries(
|
|
@@ -1360,25 +1360,25 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1360
1360
|
itemIds: s
|
|
1361
1361
|
};
|
|
1362
1362
|
})
|
|
1363
|
-
}),
|
|
1363
|
+
}), pn = (e, t) => ({
|
|
1364
1364
|
boardConfig: {},
|
|
1365
1365
|
getBoardConfig: () => t().boardConfig,
|
|
1366
1366
|
setBoardConfig: (r) => e({ boardConfig: r }),
|
|
1367
1367
|
updateBoardConfig: (r) => e((n) => ({ boardConfig: { ...n.boardConfig, ...r } }))
|
|
1368
|
-
}),
|
|
1368
|
+
}), mn = (e, t) => ({
|
|
1369
1369
|
session: {},
|
|
1370
1370
|
getSessionInfo: () => t().session,
|
|
1371
1371
|
setSessionInfo: (r) => e({ session: r }),
|
|
1372
1372
|
updateSessionInfo: (r) => e((n) => ({ session: { ...n.session, ...r } }))
|
|
1373
|
-
}),
|
|
1373
|
+
}), Wt = ({ storeName: e, children: t, defaultValue: r }) => {
|
|
1374
1374
|
const { wire: n } = Xe("room"), [o, s] = g.useState(!1), [a] = g.useState(
|
|
1375
1375
|
() => Ue(
|
|
1376
|
-
|
|
1377
|
-
...un(...u),
|
|
1376
|
+
pt({ wire: n, storeName: e, defaultValue: r }, (...u) => ({
|
|
1378
1377
|
...ln(...u),
|
|
1379
1378
|
...fn(...u),
|
|
1380
1379
|
...dn(...u),
|
|
1381
|
-
...pn(...u)
|
|
1380
|
+
...pn(...u),
|
|
1381
|
+
...mn(...u)
|
|
1382
1382
|
}))
|
|
1383
1383
|
)
|
|
1384
1384
|
);
|
|
@@ -1386,11 +1386,11 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1386
1386
|
const u = a.subscribe((l) => {
|
|
1387
1387
|
l.ready && (u(), s(!0));
|
|
1388
1388
|
});
|
|
1389
|
-
}, [a]), o ? /* @__PURE__ */
|
|
1389
|
+
}, [a]), o ? /* @__PURE__ */ k(cr.Provider, { value: a, children: t }) : null;
|
|
1390
1390
|
}, oe = (e, t) => {
|
|
1391
|
-
const r = _e(
|
|
1391
|
+
const r = _e(cr);
|
|
1392
1392
|
return We(r, e, t || Ve);
|
|
1393
|
-
},
|
|
1393
|
+
}, os = () => {
|
|
1394
1394
|
const [e, t] = oe((n) => [
|
|
1395
1395
|
n.itemIds,
|
|
1396
1396
|
n.items
|
|
@@ -1399,7 +1399,7 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1399
1399
|
() => e.map((n) => t[n]),
|
|
1400
1400
|
[e, t]
|
|
1401
1401
|
);
|
|
1402
|
-
},
|
|
1402
|
+
}, ss = () => {
|
|
1403
1403
|
const [e, t, r] = oe((a) => [
|
|
1404
1404
|
a.items,
|
|
1405
1405
|
a.itemIds,
|
|
@@ -1411,19 +1411,19 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1411
1411
|
o(a);
|
|
1412
1412
|
});
|
|
1413
1413
|
}, [e, t, r]), n;
|
|
1414
|
-
},
|
|
1414
|
+
}, ur = 5e4, lr = g.createContext(), gn = (e, t) => ({
|
|
1415
1415
|
config: {
|
|
1416
1416
|
itemTemplates: {},
|
|
1417
1417
|
actions: {},
|
|
1418
1418
|
uid: null,
|
|
1419
1419
|
itemExtent: { x: 0, y: 0, radius: 0 },
|
|
1420
1420
|
boardWrapperRect: {},
|
|
1421
|
-
boardSize:
|
|
1421
|
+
boardSize: ur
|
|
1422
1422
|
},
|
|
1423
1423
|
// TODO optimize when same values as before
|
|
1424
1424
|
updateConfiguration: (r) => e((n) => ({ config: { ...n.config, ...r } })),
|
|
1425
1425
|
getConfiguration: () => t().config
|
|
1426
|
-
}),
|
|
1426
|
+
}), hn = (e, t) => ({
|
|
1427
1427
|
boardState: {
|
|
1428
1428
|
movingItems: !1,
|
|
1429
1429
|
selecting: !1,
|
|
@@ -1437,7 +1437,7 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1437
1437
|
// TODO optimize when same values as before
|
|
1438
1438
|
updateBoardState: (r) => e((n) => ({ boardState: { ...n.boardState, ...r } })),
|
|
1439
1439
|
getBoardState: () => t().boardState
|
|
1440
|
-
}),
|
|
1440
|
+
}), vn = (e, t) => ({
|
|
1441
1441
|
interactions: {},
|
|
1442
1442
|
getInteractions: () => t().interactions,
|
|
1443
1443
|
register: (r, n) => e((o) => {
|
|
@@ -1459,7 +1459,7 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1459
1459
|
setTimeout(() => o(n), 0);
|
|
1460
1460
|
});
|
|
1461
1461
|
}
|
|
1462
|
-
}),
|
|
1462
|
+
}), yn = (e, t) => ({
|
|
1463
1463
|
selection: [],
|
|
1464
1464
|
setSelection: (r) => e((n) => JSON.stringify(n.selection) !== JSON.stringify(r) ? { selection: r } : {}),
|
|
1465
1465
|
getSelection: () => t().selection,
|
|
@@ -1479,33 +1479,36 @@ const ar = g.createContext(), un = (e, t) => ({
|
|
|
1479
1479
|
const o = n.selectionBox;
|
|
1480
1480
|
return !o || !r || o.top !== r.top || o.left !== r.left || o.width !== r.width || o.height !== r.height ? { selectionBox: r } : {};
|
|
1481
1481
|
})
|
|
1482
|
-
}),
|
|
1482
|
+
}), Vt = ({ children: e }) => {
|
|
1483
1483
|
const [t] = g.useState(
|
|
1484
1484
|
() => Ue((...r) => ({
|
|
1485
|
-
...mn(...r),
|
|
1486
1485
|
...gn(...r),
|
|
1487
1486
|
...hn(...r),
|
|
1488
|
-
...vn(...r)
|
|
1487
|
+
...vn(...r),
|
|
1488
|
+
...yn(...r)
|
|
1489
1489
|
}))
|
|
1490
1490
|
);
|
|
1491
|
-
return /* @__PURE__ */
|
|
1492
|
-
},
|
|
1493
|
-
const r = _e(
|
|
1491
|
+
return /* @__PURE__ */ k(lr.Provider, { value: t, children: e });
|
|
1492
|
+
}, Z = (e, t) => {
|
|
1493
|
+
const r = _e(lr);
|
|
1494
1494
|
return We(r, e, t || Ve);
|
|
1495
|
-
},
|
|
1496
|
-
const [e] =
|
|
1495
|
+
}, is = () => {
|
|
1496
|
+
const [e] = Z((t) => [t.selection]);
|
|
1497
|
+
return e;
|
|
1498
|
+
}, as = () => {
|
|
1499
|
+
const [e] = Z((t) => [t.getSelection]);
|
|
1497
1500
|
return e;
|
|
1498
1501
|
};
|
|
1499
|
-
function
|
|
1502
|
+
function mt(e) {
|
|
1500
1503
|
const t = Re(e);
|
|
1501
|
-
return t.current = e,
|
|
1504
|
+
return t.current = e, ft(() => Object.freeze({
|
|
1502
1505
|
get current() {
|
|
1503
1506
|
return t.current;
|
|
1504
1507
|
}
|
|
1505
1508
|
}), []);
|
|
1506
1509
|
}
|
|
1507
|
-
function
|
|
1508
|
-
const t =
|
|
1510
|
+
function Sn(e) {
|
|
1511
|
+
const t = mt(e);
|
|
1509
1512
|
Pe(
|
|
1510
1513
|
() => () => {
|
|
1511
1514
|
t.current();
|
|
@@ -1514,11 +1517,11 @@ function yn(e) {
|
|
|
1514
1517
|
[]
|
|
1515
1518
|
);
|
|
1516
1519
|
}
|
|
1517
|
-
function
|
|
1520
|
+
function gt(e, t, r, n = 0) {
|
|
1518
1521
|
const o = Re(), s = Re(), a = Re(), u = () => {
|
|
1519
1522
|
o.current && (clearTimeout(o.current), o.current = void 0), s.current && (clearTimeout(s.current), s.current = void 0);
|
|
1520
1523
|
};
|
|
1521
|
-
return
|
|
1524
|
+
return Sn(u), ft(
|
|
1522
1525
|
() => {
|
|
1523
1526
|
const l = () => {
|
|
1524
1527
|
if (!a.current)
|
|
@@ -1537,7 +1540,9 @@ function mt(e, t, r, n = 0) {
|
|
|
1537
1540
|
[r, n, ...t]
|
|
1538
1541
|
);
|
|
1539
1542
|
}
|
|
1540
|
-
const
|
|
1543
|
+
const _n = 100, bn = 1e3, En = 0.8;
|
|
1544
|
+
let nt = !1;
|
|
1545
|
+
const wn = ({
|
|
1541
1546
|
x: e,
|
|
1542
1547
|
y: t,
|
|
1543
1548
|
scale: r,
|
|
@@ -1547,7 +1552,7 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1547
1552
|
boardSize: a
|
|
1548
1553
|
}) => {
|
|
1549
1554
|
let [u, l] = [e, t];
|
|
1550
|
-
const d =
|
|
1555
|
+
const d = ut(
|
|
1551
1556
|
[s.width / 2, s.height / 2],
|
|
1552
1557
|
{ translateX: u, translateY: l, scale: r, rotate: n }
|
|
1553
1558
|
), f = {
|
|
@@ -1556,37 +1561,37 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1556
1561
|
}, c = {
|
|
1557
1562
|
x: a / 2,
|
|
1558
1563
|
y: a / 2
|
|
1559
|
-
}, h = ze(d, [f.x, f.y]),
|
|
1564
|
+
}, h = ze(d, [f.x, f.y]), S = Math.min(s.width, s.height), v = o.radius + S / 2 / r - _n / r;
|
|
1560
1565
|
if (h > v) {
|
|
1561
|
-
const y =
|
|
1566
|
+
const y = Bt(
|
|
1562
1567
|
{ x: d[0], y: d[1] },
|
|
1563
1568
|
f,
|
|
1564
1569
|
f,
|
|
1565
1570
|
v - 1 / r
|
|
1566
|
-
)[0], [
|
|
1571
|
+
)[0], [x, C] = Be([-y.x, -y.y], {
|
|
1567
1572
|
translateX: s.width / 2,
|
|
1568
1573
|
translateY: s.height / 2,
|
|
1569
1574
|
scale: r,
|
|
1570
1575
|
rotate: n
|
|
1571
1576
|
});
|
|
1572
|
-
u =
|
|
1577
|
+
u = x, l = C;
|
|
1573
1578
|
}
|
|
1574
|
-
const E = ze(d, [c.x, c.y]),
|
|
1575
|
-
if (E >
|
|
1576
|
-
const y =
|
|
1579
|
+
const E = ze(d, [c.x, c.y]), O = a / 2 - ze([0, 0], [s.width, s.height]) / r;
|
|
1580
|
+
if (E > O) {
|
|
1581
|
+
const y = Bt(
|
|
1577
1582
|
{ x: d[0], y: d[1] },
|
|
1578
1583
|
c,
|
|
1579
1584
|
c,
|
|
1580
|
-
|
|
1585
|
+
O - 1 / r
|
|
1581
1586
|
)[0];
|
|
1582
1587
|
if (y) {
|
|
1583
|
-
const [
|
|
1588
|
+
const [x, C] = Be([-y.x, -y.y], {
|
|
1584
1589
|
translateX: s.width / 2,
|
|
1585
1590
|
translateY: s.height / 2,
|
|
1586
1591
|
scale: r,
|
|
1587
1592
|
rotate: n
|
|
1588
1593
|
});
|
|
1589
|
-
u =
|
|
1594
|
+
u = x, l = C;
|
|
1590
1595
|
}
|
|
1591
1596
|
}
|
|
1592
1597
|
return [u, l];
|
|
@@ -1597,66 +1602,68 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1597
1602
|
r,
|
|
1598
1603
|
n,
|
|
1599
1604
|
o
|
|
1600
|
-
] =
|
|
1605
|
+
] = Z((p) => [
|
|
1601
1606
|
p.getBoardState,
|
|
1602
1607
|
p.updateBoardState,
|
|
1603
1608
|
p.config.itemExtent,
|
|
1604
1609
|
p.getConfiguration,
|
|
1605
1610
|
p.updateConfiguration
|
|
1606
1611
|
]), s = g.useRef([0.15, 5]), [a] = oe((p) => [p.getItemList]), u = g.useCallback(() => {
|
|
1607
|
-
const { translateX: p, translateY:
|
|
1608
|
-
return { translateX: p, translateY:
|
|
1612
|
+
const { translateX: p, translateY: _, scale: m, rotate: w } = e();
|
|
1613
|
+
return { translateX: p, translateY: _, scale: m, rotate: w };
|
|
1609
1614
|
}, [e]), l = g.useCallback(
|
|
1610
|
-
(p,
|
|
1615
|
+
(p, _) => ut([p, _], e()),
|
|
1611
1616
|
[e]
|
|
1612
1617
|
), d = g.useCallback(
|
|
1613
|
-
(p,
|
|
1618
|
+
(p, _) => Be([p, _], e()),
|
|
1614
1619
|
[e]
|
|
1615
1620
|
), f = g.useCallback(
|
|
1616
|
-
(p,
|
|
1617
|
-
const { scale: m, rotate:
|
|
1618
|
-
return
|
|
1621
|
+
(p, _) => {
|
|
1622
|
+
const { scale: m, rotate: w } = e();
|
|
1623
|
+
return ut([p, _], {
|
|
1619
1624
|
translateX: 0,
|
|
1620
1625
|
translateY: 0,
|
|
1621
|
-
rotate:
|
|
1626
|
+
rotate: w,
|
|
1622
1627
|
scale: m
|
|
1623
1628
|
});
|
|
1624
1629
|
},
|
|
1625
1630
|
[e]
|
|
1626
1631
|
), c = g.useCallback((p) => p > s.current[1] ? s.current[1] : p < s.current[0] ? s.current[0] : p, []), h = g.useCallback(
|
|
1627
1632
|
(p) => {
|
|
1628
|
-
const { itemExtent:
|
|
1629
|
-
translateX:
|
|
1630
|
-
translateY:
|
|
1633
|
+
const { itemExtent: _, boardWrapperRect: m, boardSize: w } = n(), R = e(), {
|
|
1634
|
+
translateX: T,
|
|
1635
|
+
translateY: D,
|
|
1631
1636
|
scale: M,
|
|
1632
1637
|
rotate: A
|
|
1633
1638
|
} = {
|
|
1634
|
-
...
|
|
1635
|
-
...p(
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1639
|
+
...R,
|
|
1640
|
+
...p(R)
|
|
1641
|
+
};
|
|
1642
|
+
nt && console.log("New expected values: ", T, D, M, A);
|
|
1643
|
+
const Y = c(M);
|
|
1644
|
+
let [U, G] = [T, D];
|
|
1645
|
+
(T !== R.translateX || D !== R.translateY) && ([U, G] = wn({
|
|
1646
|
+
x: T,
|
|
1647
|
+
y: D,
|
|
1648
|
+
scale: Y,
|
|
1642
1649
|
rotate: A,
|
|
1643
|
-
itemExtent:
|
|
1650
|
+
itemExtent: _,
|
|
1644
1651
|
boardWrapperRect: m,
|
|
1645
|
-
boardSize:
|
|
1646
|
-
})), t({
|
|
1652
|
+
boardSize: w
|
|
1653
|
+
})), nt && console.log("New fixed values: ", U, G, Y, A), t({
|
|
1647
1654
|
translateX: U,
|
|
1648
|
-
translateY:
|
|
1649
|
-
scale:
|
|
1655
|
+
translateY: G,
|
|
1656
|
+
scale: Y,
|
|
1650
1657
|
rotate: A
|
|
1651
1658
|
});
|
|
1652
1659
|
},
|
|
1653
1660
|
[c, e, n, t]
|
|
1654
|
-
),
|
|
1661
|
+
), S = g.useCallback(
|
|
1655
1662
|
(p) => {
|
|
1656
|
-
let
|
|
1657
|
-
typeof p == "function" && (
|
|
1663
|
+
let _ = (m) => ({ ...m, ...p });
|
|
1664
|
+
typeof p == "function" && (_ = p), h((m) => ({
|
|
1658
1665
|
...m,
|
|
1659
|
-
...
|
|
1666
|
+
..._({
|
|
1660
1667
|
translateX: m.translateX,
|
|
1661
1668
|
translateY: m.translateY
|
|
1662
1669
|
})
|
|
@@ -1664,98 +1671,102 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1664
1671
|
},
|
|
1665
1672
|
[h]
|
|
1666
1673
|
), v = g.useCallback(
|
|
1667
|
-
({ to: p, factor:
|
|
1674
|
+
({ to: p, factor: _ }) => {
|
|
1668
1675
|
const { boardWrapperRect: m } = n();
|
|
1669
|
-
let
|
|
1670
|
-
|
|
1676
|
+
let w = p;
|
|
1677
|
+
w || (w = {
|
|
1671
1678
|
x: m.left + m.width / 2,
|
|
1672
1679
|
y: m.top + m.height / 2
|
|
1673
1680
|
});
|
|
1674
|
-
const
|
|
1681
|
+
const R = e(), T = c(R.scale * _), D = w.x - m.left, M = w.y - m.top, A = D - (D - R.translateX) * T / R.scale, Y = M - (M - R.translateY) * T / R.scale;
|
|
1675
1682
|
h((U) => ({
|
|
1676
1683
|
...U,
|
|
1677
1684
|
translateX: A,
|
|
1678
|
-
translateY:
|
|
1679
|
-
scale:
|
|
1685
|
+
translateY: Y,
|
|
1686
|
+
scale: T
|
|
1680
1687
|
}));
|
|
1681
1688
|
},
|
|
1682
1689
|
[c, e, n, h]
|
|
1683
1690
|
), E = g.useCallback(
|
|
1684
|
-
({ x: p, y:
|
|
1685
|
-
const { rotate:
|
|
1686
|
-
[-
|
|
1691
|
+
({ x: p, y: _, radius: m }) => {
|
|
1692
|
+
const { rotate: w } = e(), { boardWrapperRect: R, boardSize: T } = n(), D = R.width / (m * 2), M = R.height / (m * 2), A = c(Math.min(D, M) * En), [Y, U] = Be(
|
|
1693
|
+
[-T / 2 - p, -T / 2 - _],
|
|
1687
1694
|
{
|
|
1688
|
-
translateX:
|
|
1689
|
-
translateY:
|
|
1695
|
+
translateX: R.width / 2,
|
|
1696
|
+
translateY: R.height / 2,
|
|
1690
1697
|
scale: A,
|
|
1691
|
-
rotate:
|
|
1698
|
+
rotate: w
|
|
1692
1699
|
}
|
|
1693
1700
|
);
|
|
1694
|
-
h((
|
|
1701
|
+
h((G) => ({ ...G, translateX: Y, translateY: U, scale: A }));
|
|
1695
1702
|
},
|
|
1696
1703
|
[c, e, n, h]
|
|
1697
|
-
),
|
|
1698
|
-
const { boardWrapperRect: p, boardSize:
|
|
1704
|
+
), O = g.useCallback(() => {
|
|
1705
|
+
const { boardWrapperRect: p, boardSize: _ } = n(), [m, w] = l(
|
|
1699
1706
|
p.width / 2,
|
|
1700
1707
|
p.height / 2
|
|
1701
1708
|
);
|
|
1702
1709
|
return {
|
|
1703
|
-
x: m -
|
|
1704
|
-
y:
|
|
1710
|
+
x: m - _ / 2,
|
|
1711
|
+
y: w - _ / 2
|
|
1705
1712
|
};
|
|
1706
1713
|
}, [l, n]), y = g.useCallback(() => {
|
|
1707
|
-
const p = a(), {
|
|
1708
|
-
(
|
|
1709
|
-
const M = Ne(
|
|
1710
|
-
return M && (
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
),
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
)),
|
|
1714
|
+
const p = a(), { boardSize: _, uid: m } = n(), w = p.reduce(
|
|
1715
|
+
(T, D) => {
|
|
1716
|
+
const M = Ne(m, D.id);
|
|
1717
|
+
return M && (T.left = Math.min(D.x, T.left), T.top = Math.min(D.y, T.top), T.right = Math.max(
|
|
1718
|
+
D.x + M.offsetWidth,
|
|
1719
|
+
T.right
|
|
1720
|
+
), T.bottom = Math.max(
|
|
1721
|
+
D.y + M.offsetHeight,
|
|
1722
|
+
T.bottom
|
|
1723
|
+
)), T;
|
|
1717
1724
|
},
|
|
1718
1725
|
{
|
|
1719
|
-
left:
|
|
1720
|
-
top:
|
|
1721
|
-
right: -
|
|
1722
|
-
bottom: -
|
|
1726
|
+
left: _ / 2,
|
|
1727
|
+
top: _ / 2,
|
|
1728
|
+
right: -_ / 2,
|
|
1729
|
+
bottom: -_ / 2
|
|
1723
1730
|
}
|
|
1724
|
-
),
|
|
1725
|
-
x: (
|
|
1726
|
-
y: (
|
|
1731
|
+
), R = {
|
|
1732
|
+
x: (w.right + w.left) / 2,
|
|
1733
|
+
y: (w.bottom + w.top) / 2
|
|
1727
1734
|
};
|
|
1728
|
-
|
|
1729
|
-
ze([
|
|
1730
|
-
|
|
1731
|
-
), o({ itemExtent:
|
|
1732
|
-
}, [n, a, o]),
|
|
1735
|
+
R.radius = Math.max(
|
|
1736
|
+
ze([R.x, R.y], [w.left, w.top]),
|
|
1737
|
+
bn
|
|
1738
|
+
), o({ itemExtent: R });
|
|
1739
|
+
}, [n, a, o]), x = g.useCallback(
|
|
1733
1740
|
(p) => {
|
|
1734
|
-
let
|
|
1735
|
-
typeof p == "function" && (
|
|
1741
|
+
let _ = () => p;
|
|
1742
|
+
typeof p == "function" && (_ = p), h((m) => ({ ...m, rotate: _(m.rotate) })), y(), E(r);
|
|
1736
1743
|
},
|
|
1737
1744
|
[r, h, y, E]
|
|
1738
|
-
),
|
|
1745
|
+
), C = gt(
|
|
1739
1746
|
() => y(),
|
|
1740
1747
|
[y],
|
|
1741
1748
|
200
|
|
1742
1749
|
);
|
|
1743
|
-
return {
|
|
1750
|
+
return g.useEffect(() => {
|
|
1751
|
+
window.debugUpdateExtent = () => y(), window.debugDisplayExtent = () => console.log(n().itemExtent), window.debugSetDebug = () => {
|
|
1752
|
+
nt = !0;
|
|
1753
|
+
};
|
|
1754
|
+
}, [n, y]), {
|
|
1744
1755
|
setDim: h,
|
|
1745
|
-
rotateBoard:
|
|
1746
|
-
moveBoard:
|
|
1756
|
+
rotateBoard: x,
|
|
1757
|
+
moveBoard: S,
|
|
1747
1758
|
getDim: u,
|
|
1748
1759
|
zoomTo: v,
|
|
1749
1760
|
zoomToCenter: v,
|
|
1750
1761
|
zoomToExtent: E,
|
|
1751
|
-
getCenter:
|
|
1752
|
-
updateItemExtent:
|
|
1762
|
+
getCenter: O,
|
|
1763
|
+
updateItemExtent: C,
|
|
1753
1764
|
vectorFromWrapperToBoard: f,
|
|
1754
1765
|
fromWrapperToBoard: l,
|
|
1755
1766
|
fromBoardToWrapper: d
|
|
1756
1767
|
};
|
|
1757
|
-
},
|
|
1758
|
-
const [t, r, n] =
|
|
1768
|
+
}, Ft = (e) => {
|
|
1769
|
+
const [t, r, n] = Z(
|
|
1759
1770
|
({ register: a, unregister: u, callInteractions: l }) => [
|
|
1760
1771
|
a,
|
|
1761
1772
|
u,
|
|
@@ -1773,8 +1784,8 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1773
1784
|
[n, e]
|
|
1774
1785
|
);
|
|
1775
1786
|
return { register: o, call: s };
|
|
1776
|
-
},
|
|
1777
|
-
const { call: e } =
|
|
1787
|
+
}, ht = () => {
|
|
1788
|
+
const { call: e } = Ft("place"), { call: t } = Ft("delete"), { getCenter: r, updateItemExtent: n } = Me(), [o, s, a, u] = Z((P) => [
|
|
1778
1789
|
P.clear,
|
|
1779
1790
|
P.reverse,
|
|
1780
1791
|
P.unselect,
|
|
@@ -1785,91 +1796,91 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1785
1796
|
setItemIds: f,
|
|
1786
1797
|
updateItems: c,
|
|
1787
1798
|
moveItems: h,
|
|
1788
|
-
removeItemsById:
|
|
1799
|
+
removeItemsById: S,
|
|
1789
1800
|
getItemList: v,
|
|
1790
1801
|
insertItems: E,
|
|
1791
|
-
setItemList:
|
|
1802
|
+
setItemList: O
|
|
1792
1803
|
} = oe(
|
|
1793
1804
|
({
|
|
1794
1805
|
getItems: P,
|
|
1795
1806
|
getItemIds: $,
|
|
1796
|
-
setItemIds:
|
|
1807
|
+
setItemIds: B,
|
|
1797
1808
|
updateItems: V,
|
|
1798
|
-
moveItems:
|
|
1809
|
+
moveItems: L,
|
|
1799
1810
|
removeItemsById: F,
|
|
1800
1811
|
getItemList: H,
|
|
1801
1812
|
insertItems: te,
|
|
1802
|
-
setItemList:
|
|
1813
|
+
setItemList: Q
|
|
1803
1814
|
}) => ({
|
|
1804
1815
|
getItems: P,
|
|
1805
1816
|
getItemIds: $,
|
|
1806
|
-
setItemIds:
|
|
1817
|
+
setItemIds: B,
|
|
1807
1818
|
updateItems: V,
|
|
1808
|
-
moveItems:
|
|
1819
|
+
moveItems: L,
|
|
1809
1820
|
removeItemsById: F,
|
|
1810
1821
|
getItemList: H,
|
|
1811
1822
|
insertItems: te,
|
|
1812
|
-
setItemList:
|
|
1823
|
+
setItemList: Q
|
|
1813
1824
|
})
|
|
1814
1825
|
), y = g.useCallback(
|
|
1815
|
-
(P, $,
|
|
1826
|
+
(P, $, B = !1) => {
|
|
1816
1827
|
let V = $;
|
|
1817
1828
|
typeof $ == "object" && (V = () => $);
|
|
1818
|
-
const
|
|
1819
|
-
const ne = F[
|
|
1820
|
-
return
|
|
1821
|
-
}).filter(([,
|
|
1829
|
+
const L = d().filter((Q) => P.includes(Q)), F = l(), H = L.map((Q) => {
|
|
1830
|
+
const ne = F[Q];
|
|
1831
|
+
return B ? [Q, V(ne)] : [Q, V({ ...ne })];
|
|
1832
|
+
}).filter(([, Q]) => Q);
|
|
1822
1833
|
if (H.length === 0)
|
|
1823
1834
|
return;
|
|
1824
1835
|
const te = Object.fromEntries(H);
|
|
1825
|
-
c(te,
|
|
1836
|
+
c(te, B), n();
|
|
1826
1837
|
},
|
|
1827
1838
|
[d, l, n, c]
|
|
1828
|
-
),
|
|
1839
|
+
), x = g.useCallback(
|
|
1829
1840
|
(P) => {
|
|
1830
|
-
|
|
1841
|
+
O(P), o(), n();
|
|
1831
1842
|
},
|
|
1832
|
-
[o,
|
|
1833
|
-
),
|
|
1834
|
-
(P, $,
|
|
1835
|
-
y([P], $,
|
|
1843
|
+
[o, O, n]
|
|
1844
|
+
), C = g.useCallback(
|
|
1845
|
+
(P, $, B = !1) => {
|
|
1846
|
+
y([P], $, B);
|
|
1836
1847
|
},
|
|
1837
1848
|
[y]
|
|
1838
1849
|
), p = g.useCallback(
|
|
1839
1850
|
(P, $) => {
|
|
1840
1851
|
h(
|
|
1841
|
-
|
|
1852
|
+
Nt(l(), d(), P),
|
|
1842
1853
|
$
|
|
1843
|
-
)
|
|
1854
|
+
);
|
|
1844
1855
|
},
|
|
1845
|
-
[d, l, h
|
|
1846
|
-
),
|
|
1856
|
+
[d, l, h]
|
|
1857
|
+
), _ = g.useCallback(
|
|
1847
1858
|
(P) => {
|
|
1848
|
-
const $ = d(),
|
|
1849
|
-
(
|
|
1859
|
+
const $ = d(), B = $.filter((L) => !P.includes(L)), V = $.filter(
|
|
1860
|
+
(L) => P.includes(L)
|
|
1850
1861
|
);
|
|
1851
|
-
f([...
|
|
1862
|
+
f([...B, ...V]);
|
|
1852
1863
|
},
|
|
1853
1864
|
[d, f]
|
|
1854
1865
|
), m = g.useCallback(
|
|
1855
|
-
(P, { type: $, size:
|
|
1856
|
-
const {
|
|
1866
|
+
(P, { type: $, size: B } = {}) => {
|
|
1867
|
+
const { uid: V } = u();
|
|
1857
1868
|
y(
|
|
1858
1869
|
P,
|
|
1859
|
-
(
|
|
1860
|
-
const F = Ne(V,
|
|
1870
|
+
(L) => {
|
|
1871
|
+
const F = Ne(V, L.id);
|
|
1861
1872
|
if (!F)
|
|
1862
1873
|
return;
|
|
1863
1874
|
const H = {
|
|
1864
1875
|
type: $ || "grid",
|
|
1865
|
-
size:
|
|
1876
|
+
size: B || 1,
|
|
1866
1877
|
offset: { x: 0, y: 0 },
|
|
1867
|
-
...
|
|
1878
|
+
...L.grid
|
|
1868
1879
|
};
|
|
1869
|
-
return
|
|
1880
|
+
return cn(
|
|
1870
1881
|
{
|
|
1871
|
-
x:
|
|
1872
|
-
y:
|
|
1882
|
+
x: L.x,
|
|
1883
|
+
y: L.y,
|
|
1873
1884
|
width: F.clientWidth,
|
|
1874
1885
|
height: F.clientHeight
|
|
1875
1886
|
},
|
|
@@ -1880,47 +1891,47 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1880
1891
|
);
|
|
1881
1892
|
},
|
|
1882
1893
|
[u, y]
|
|
1883
|
-
),
|
|
1894
|
+
), w = g.useCallback(
|
|
1884
1895
|
(P, $) => {
|
|
1885
|
-
const
|
|
1896
|
+
const B = Nt(
|
|
1886
1897
|
l(),
|
|
1887
1898
|
d(),
|
|
1888
1899
|
P
|
|
1889
1900
|
);
|
|
1890
|
-
|
|
1901
|
+
_(B), y(B, { moving: !1 }, !0), m(B, $), e(P), n();
|
|
1891
1902
|
},
|
|
1892
1903
|
[
|
|
1893
1904
|
y,
|
|
1894
1905
|
e,
|
|
1895
1906
|
d,
|
|
1896
1907
|
l,
|
|
1897
|
-
|
|
1908
|
+
_,
|
|
1898
1909
|
m,
|
|
1899
1910
|
n
|
|
1900
1911
|
]
|
|
1901
|
-
),
|
|
1912
|
+
), R = g.useCallback(
|
|
1902
1913
|
(P) => {
|
|
1903
1914
|
f(P);
|
|
1904
1915
|
},
|
|
1905
1916
|
[f]
|
|
1906
|
-
),
|
|
1917
|
+
), T = g.useCallback(
|
|
1907
1918
|
(P) => {
|
|
1908
|
-
const $ = d(),
|
|
1909
|
-
(
|
|
1910
|
-
), V = $.map((
|
|
1919
|
+
const $ = d(), B = $.filter(
|
|
1920
|
+
(L) => P.includes(L)
|
|
1921
|
+
), V = $.map((L) => P.includes(L) ? B.pop() : L);
|
|
1911
1922
|
f(V), s();
|
|
1912
1923
|
},
|
|
1913
1924
|
[d, s, f]
|
|
1914
|
-
),
|
|
1925
|
+
), D = g.useCallback(
|
|
1915
1926
|
(P, $) => {
|
|
1916
|
-
const
|
|
1927
|
+
const B = l(), V = Object.fromEntries(
|
|
1917
1928
|
$.map((H, te) => {
|
|
1918
|
-
const
|
|
1929
|
+
const Q = B[P[te]];
|
|
1919
1930
|
return [
|
|
1920
1931
|
H,
|
|
1921
1932
|
{
|
|
1922
|
-
x:
|
|
1923
|
-
y:
|
|
1933
|
+
x: Q.x,
|
|
1934
|
+
y: Q.y
|
|
1924
1935
|
}
|
|
1925
1936
|
];
|
|
1926
1937
|
})
|
|
@@ -1930,52 +1941,52 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1930
1941
|
(H) => V[H.id],
|
|
1931
1942
|
!0
|
|
1932
1943
|
);
|
|
1933
|
-
const
|
|
1944
|
+
const L = Object.fromEntries(
|
|
1934
1945
|
P.map((H, te) => [H, $[te]])
|
|
1935
|
-
), F = d().map((H) => P.includes(H) ?
|
|
1946
|
+
), F = d().map((H) => P.includes(H) ? L[H] : H);
|
|
1936
1947
|
f(F);
|
|
1937
1948
|
},
|
|
1938
1949
|
[l, y, d, f]
|
|
1939
1950
|
), M = g.useCallback(
|
|
1940
1951
|
(P, $) => {
|
|
1941
|
-
const
|
|
1942
|
-
E(V, $),
|
|
1952
|
+
const B = r(), V = P.map((L, F) => !L.x || !L.y ? { ...L, x: B.x + 2 * F, y: B.y + 2 * F } : L);
|
|
1953
|
+
E(V, $), w(P.map(({ id: L }) => L));
|
|
1943
1954
|
},
|
|
1944
|
-
[r, E,
|
|
1955
|
+
[r, E, w]
|
|
1945
1956
|
), A = g.useCallback(
|
|
1946
1957
|
(P, $) => {
|
|
1947
1958
|
M([P], $);
|
|
1948
1959
|
},
|
|
1949
1960
|
[M]
|
|
1950
|
-
),
|
|
1961
|
+
), Y = g.useCallback(
|
|
1951
1962
|
(P) => {
|
|
1952
|
-
a(P),
|
|
1963
|
+
a(P), S(P), t(P);
|
|
1953
1964
|
},
|
|
1954
|
-
[a,
|
|
1965
|
+
[a, S, t]
|
|
1955
1966
|
), U = g.useCallback(
|
|
1956
1967
|
(P) => {
|
|
1957
1968
|
const $ = l();
|
|
1958
|
-
return P.map((
|
|
1969
|
+
return P.map((B) => $[B]);
|
|
1959
1970
|
},
|
|
1960
1971
|
[l]
|
|
1961
|
-
),
|
|
1962
|
-
({ target: P, clientX: $, clientY:
|
|
1972
|
+
), G = g.useCallback(
|
|
1973
|
+
({ target: P, clientX: $, clientY: B }, { returnLocked: V = !1, passLocked: L = !1 } = {}) => {
|
|
1963
1974
|
if (["INPUT", "TEXTAREA"].includes(P.tagName))
|
|
1964
1975
|
return null;
|
|
1965
1976
|
const F = Oe(P, "item");
|
|
1966
1977
|
if (F) {
|
|
1967
1978
|
if (ye(F, "selected"))
|
|
1968
1979
|
return F;
|
|
1969
|
-
if (!
|
|
1980
|
+
if (!L && ye(F, "locked") && !ye(P, "passthrough"))
|
|
1970
1981
|
return V ? F : null;
|
|
1971
1982
|
if (ye(P, "passthrough")) {
|
|
1972
|
-
const H = d(), {
|
|
1983
|
+
const H = d(), { uid: te } = u(), Q = H.reduce((ne, ie) => {
|
|
1973
1984
|
const me = Ne(te, ie), ge = me.getBoundingClientRect();
|
|
1974
|
-
return
|
|
1985
|
+
return dt({ x: $, y: B }, ge) && ne.unshift(me), ne;
|
|
1975
1986
|
}, []);
|
|
1976
|
-
for (let ne = 0; ne <
|
|
1977
|
-
const ie =
|
|
1978
|
-
if (ie !== F && (
|
|
1987
|
+
for (let ne = 0; ne < Q.length; ne += 1) {
|
|
1988
|
+
const ie = Q[ne];
|
|
1989
|
+
if (ie !== F && (L || !ye(ie, "locked")))
|
|
1979
1990
|
return ie;
|
|
1980
1991
|
}
|
|
1981
1992
|
return null;
|
|
@@ -1986,24 +1997,24 @@ const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
|
1986
1997
|
[u, d]
|
|
1987
1998
|
);
|
|
1988
1999
|
return {
|
|
1989
|
-
putItemsOnTop:
|
|
2000
|
+
putItemsOnTop: _,
|
|
1990
2001
|
batchUpdateItems: y,
|
|
1991
|
-
updateItemOrder:
|
|
2002
|
+
updateItemOrder: R,
|
|
1992
2003
|
moveItems: p,
|
|
1993
|
-
placeItems:
|
|
1994
|
-
updateItem:
|
|
1995
|
-
swapItems:
|
|
1996
|
-
reverseItemsOrder:
|
|
1997
|
-
setItemList:
|
|
2004
|
+
placeItems: w,
|
|
2005
|
+
updateItem: C,
|
|
2006
|
+
swapItems: D,
|
|
2007
|
+
reverseItemsOrder: T,
|
|
2008
|
+
setItemList: x,
|
|
1998
2009
|
pushItem: A,
|
|
1999
2010
|
pushItems: M,
|
|
2000
|
-
removeItems:
|
|
2011
|
+
removeItems: Y,
|
|
2001
2012
|
getItemList: v,
|
|
2002
|
-
findElementUnderPointer:
|
|
2013
|
+
findElementUnderPointer: G,
|
|
2003
2014
|
getItems: U
|
|
2004
2015
|
};
|
|
2005
2016
|
};
|
|
2006
|
-
var
|
|
2017
|
+
var xn = function e(t, r) {
|
|
2007
2018
|
if (t === r)
|
|
2008
2019
|
return !0;
|
|
2009
2020
|
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
@@ -2066,22 +2077,22 @@ var wn = function e(t, r) {
|
|
|
2066
2077
|
return t !== t && r !== r;
|
|
2067
2078
|
};
|
|
2068
2079
|
function Cn(e, t, r, n = 0) {
|
|
2069
|
-
Pe(
|
|
2080
|
+
Pe(gt(e, t, r, n), t);
|
|
2070
2081
|
}
|
|
2071
|
-
const
|
|
2082
|
+
const Rn = (e, t) => {
|
|
2072
2083
|
if (e.type in t) {
|
|
2073
2084
|
const r = t[e.type].defaultActions;
|
|
2074
2085
|
return typeof r == "function" ? r(e) : r;
|
|
2075
2086
|
}
|
|
2076
2087
|
return [];
|
|
2077
|
-
},
|
|
2078
|
-
const { actions: r =
|
|
2088
|
+
}, Kt = (e, t) => {
|
|
2089
|
+
const { actions: r = Rn(e, t) } = e;
|
|
2079
2090
|
return r.map((n) => typeof n == "string" ? { name: n } : n);
|
|
2080
|
-
},
|
|
2091
|
+
}, cs = () => {
|
|
2081
2092
|
const [e, t] = oe((c) => [
|
|
2082
2093
|
c.items,
|
|
2083
2094
|
c.getItems
|
|
2084
|
-
]), [r, n, o] =
|
|
2095
|
+
]), [r, n, o] = Z((c) => [
|
|
2085
2096
|
c.config.itemTemplates,
|
|
2086
2097
|
c.selection,
|
|
2087
2098
|
c.getSelection
|
|
@@ -2094,23 +2105,23 @@ const xn = (e, t) => {
|
|
|
2094
2105
|
const h = t();
|
|
2095
2106
|
if (c)
|
|
2096
2107
|
return [c, c.map((v) => h[v])];
|
|
2097
|
-
const
|
|
2098
|
-
return [
|
|
2108
|
+
const S = o();
|
|
2109
|
+
return [S, S.map((v) => h[v])];
|
|
2099
2110
|
},
|
|
2100
2111
|
[t, o]
|
|
2101
|
-
), f =
|
|
2112
|
+
), f = rr(() => {
|
|
2102
2113
|
const [c, h] = d();
|
|
2103
2114
|
if (c.length > 0) {
|
|
2104
2115
|
if (!u.current)
|
|
2105
2116
|
return;
|
|
2106
|
-
const
|
|
2107
|
-
const
|
|
2117
|
+
const S = h.reduce((v, E) => {
|
|
2118
|
+
const O = Kt(E, r);
|
|
2108
2119
|
return v.filter(
|
|
2109
|
-
(y) =>
|
|
2120
|
+
(y) => O.some((x) => xn(y, x))
|
|
2110
2121
|
);
|
|
2111
|
-
},
|
|
2122
|
+
}, Kt(h[0], r));
|
|
2112
2123
|
l(() => {
|
|
2113
|
-
a(
|
|
2124
|
+
a(S);
|
|
2114
2125
|
});
|
|
2115
2126
|
} else
|
|
2116
2127
|
l(() => {
|
|
@@ -2124,30 +2135,30 @@ const xn = (e, t) => {
|
|
|
2124
2135
|
), {
|
|
2125
2136
|
availableActions: s
|
|
2126
2137
|
};
|
|
2127
|
-
},
|
|
2128
|
-
const [e] =
|
|
2138
|
+
}, us = () => {
|
|
2139
|
+
const [e] = Z((t) => [t.selectionBox]);
|
|
2129
2140
|
return e;
|
|
2130
2141
|
};
|
|
2131
2142
|
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), "");
|
|
2132
|
-
const
|
|
2143
|
+
const fr = g.createContext(), lt = (e) => {
|
|
2133
2144
|
localStorage.setItem("user", JSON.stringify(e));
|
|
2134
|
-
},
|
|
2145
|
+
}, In = () => {
|
|
2135
2146
|
if (localStorage.user) {
|
|
2136
2147
|
const t = {
|
|
2137
2148
|
name: "Player",
|
|
2138
|
-
color:
|
|
2149
|
+
color: Ut(),
|
|
2139
2150
|
uid: pe(),
|
|
2140
2151
|
...JSON.parse(localStorage.user)
|
|
2141
2152
|
};
|
|
2142
|
-
return
|
|
2153
|
+
return lt(t), t;
|
|
2143
2154
|
}
|
|
2144
2155
|
const e = {
|
|
2145
2156
|
name: "Player",
|
|
2146
|
-
color:
|
|
2157
|
+
color: Ut(),
|
|
2147
2158
|
uid: pe()
|
|
2148
2159
|
};
|
|
2149
|
-
return
|
|
2150
|
-
},
|
|
2160
|
+
return lt(e), e;
|
|
2161
|
+
}, On = (e) => (t, r) => ({
|
|
2151
2162
|
isSpaceMaster: !1,
|
|
2152
2163
|
users: {},
|
|
2153
2164
|
getUser: () => r().users[e],
|
|
@@ -2169,7 +2180,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2169
2180
|
id: n,
|
|
2170
2181
|
uid: s.users[n].uid
|
|
2171
2182
|
};
|
|
2172
|
-
return a.id === e &&
|
|
2183
|
+
return a.id === e && lt(a), setTimeout(() => r().electSpaceMaster(), 100), {
|
|
2173
2184
|
users: {
|
|
2174
2185
|
...s.users,
|
|
2175
2186
|
[n]: a
|
|
@@ -2192,14 +2203,14 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2192
2203
|
s < o.timestamp && (o.id = a, o.timestamp = s);
|
|
2193
2204
|
}), t({ isSpaceMaster: o.id === e });
|
|
2194
2205
|
}
|
|
2195
|
-
}),
|
|
2206
|
+
}), Tn = (e) => ({
|
|
2196
2207
|
cursors: {},
|
|
2197
2208
|
moveCursor: (t, r) => e((n) => ({ cursors: { ...n.cursors, [t]: r } })),
|
|
2198
2209
|
removeCursor: (t) => e((r) => {
|
|
2199
2210
|
const n = { ...r.cursors };
|
|
2200
2211
|
return delete n[t], { cursors: n };
|
|
2201
2212
|
})
|
|
2202
|
-
}),
|
|
2213
|
+
}), dr = ({ storeName: e, children: t }) => {
|
|
2203
2214
|
const { wire: r, isMaster: n } = Xe("room"), [o, s] = g.useState(null), [a, u] = g.useState(!1), l = g.useRef(!1);
|
|
2204
2215
|
return g.useEffect(() => {
|
|
2205
2216
|
let d = !0;
|
|
@@ -2207,7 +2218,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2207
2218
|
if (!o && !l.current)
|
|
2208
2219
|
return l.current = !0, (() => {
|
|
2209
2220
|
const h = Ue(
|
|
2210
|
-
|
|
2221
|
+
pt(
|
|
2211
2222
|
{
|
|
2212
2223
|
wire: r,
|
|
2213
2224
|
storeName: e,
|
|
@@ -2219,12 +2230,12 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2219
2230
|
]
|
|
2220
2231
|
},
|
|
2221
2232
|
(...v) => ({
|
|
2222
|
-
...
|
|
2223
|
-
...
|
|
2233
|
+
...On(r.userId)(...v),
|
|
2234
|
+
...Tn(...v)
|
|
2224
2235
|
})
|
|
2225
2236
|
)
|
|
2226
|
-
),
|
|
2227
|
-
v.ready && (
|
|
2237
|
+
), S = h.subscribe((v) => {
|
|
2238
|
+
v.ready && (S(), d && s(h));
|
|
2228
2239
|
});
|
|
2229
2240
|
})(), () => {
|
|
2230
2241
|
d = !1, l.current = !1, f.forEach((h) => h());
|
|
@@ -2232,7 +2243,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2232
2243
|
}, [o, e, r, r.userId]), g.useEffect(() => {
|
|
2233
2244
|
if (o)
|
|
2234
2245
|
return o.getState().addUser({
|
|
2235
|
-
...
|
|
2246
|
+
...In(),
|
|
2236
2247
|
id: r.userId
|
|
2237
2248
|
}), u(!0), () => {
|
|
2238
2249
|
o.getState().removeUser(r.userId);
|
|
@@ -2248,11 +2259,11 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2248
2259
|
}
|
|
2249
2260
|
}, [n, o, r]), g.useEffect(() => {
|
|
2250
2261
|
n && o && o.getState().updateCurrentUser({ isMaster: n });
|
|
2251
|
-
}, [n, o, r]), a ? /* @__PURE__ */
|
|
2262
|
+
}, [n, o, r]), a ? /* @__PURE__ */ k(fr.Provider, { value: o, children: t }) : null;
|
|
2252
2263
|
}, Se = (e, t) => {
|
|
2253
|
-
const r = _e(
|
|
2264
|
+
const r = _e(fr);
|
|
2254
2265
|
return We(r, e, t || Ve);
|
|
2255
|
-
},
|
|
2266
|
+
}, ls = () => {
|
|
2256
2267
|
const [e, t, r, n, o] = Se((u) => [
|
|
2257
2268
|
u.isSpaceMaster,
|
|
2258
2269
|
u.getUser(),
|
|
@@ -2271,7 +2282,7 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2271
2282
|
localUsers: a,
|
|
2272
2283
|
joinSpace: o
|
|
2273
2284
|
};
|
|
2274
|
-
},
|
|
2285
|
+
}, fs = () => {
|
|
2275
2286
|
const [e, t, r] = oe(
|
|
2276
2287
|
(o) => [o.boardConfig, o.getBoardConfig, o.setBoardConfig]
|
|
2277
2288
|
), n = g.useCallback(
|
|
@@ -2284,10 +2295,10 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2284
2295
|
[t, r]
|
|
2285
2296
|
);
|
|
2286
2297
|
return [e, n];
|
|
2287
|
-
},
|
|
2288
|
-
const [e] =
|
|
2298
|
+
}, ds = () => {
|
|
2299
|
+
const [e] = Z((t) => [t.boardState]);
|
|
2289
2300
|
return e;
|
|
2290
|
-
},
|
|
2301
|
+
}, ps = () => {
|
|
2291
2302
|
const [e, t, r, n] = oe((o) => [
|
|
2292
2303
|
o.getSessionInfo,
|
|
2293
2304
|
o.setSessionInfo,
|
|
@@ -2295,13 +2306,13 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2295
2306
|
o.session
|
|
2296
2307
|
]);
|
|
2297
2308
|
return { getSessionInfo: e, setSessionInfo: t, sessionInfo: n, updateSessionInfo: r };
|
|
2298
|
-
},
|
|
2309
|
+
}, pr = g.createContext(), kn = ({ user: { name: e, uid: t, color: r }, content: n }) => ({
|
|
2299
2310
|
type: "message",
|
|
2300
2311
|
user: { name: e, uid: t, color: r },
|
|
2301
2312
|
content: n,
|
|
2302
2313
|
uid: pe(),
|
|
2303
2314
|
timestamp: new Date().toISOString()
|
|
2304
|
-
}),
|
|
2315
|
+
}), Pn = (e, t) => ({
|
|
2305
2316
|
messages: [],
|
|
2306
2317
|
setMessages: (r) => e({
|
|
2307
2318
|
messages: r.map((n) => ({
|
|
@@ -2316,34 +2327,34 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2316
2327
|
]
|
|
2317
2328
|
})),
|
|
2318
2329
|
sendMessage: (r, n) => {
|
|
2319
|
-
const o =
|
|
2330
|
+
const o = kn({
|
|
2320
2331
|
user: r,
|
|
2321
2332
|
content: n
|
|
2322
2333
|
});
|
|
2323
2334
|
o && t().addMessage(o);
|
|
2324
2335
|
}
|
|
2325
|
-
}),
|
|
2336
|
+
}), Ht = ({
|
|
2326
2337
|
storeName: e,
|
|
2327
2338
|
children: t,
|
|
2328
2339
|
defaultValue: r = []
|
|
2329
2340
|
}) => {
|
|
2330
2341
|
const { wire: n } = Xe("room"), [o] = g.useState(
|
|
2331
2342
|
() => Ue(
|
|
2332
|
-
|
|
2343
|
+
pt(
|
|
2333
2344
|
{ wire: n, storeName: e, defaultValue: r, noSync: ["sendMessage"] },
|
|
2334
2345
|
(...s) => ({
|
|
2335
|
-
...
|
|
2346
|
+
...Pn(...s)
|
|
2336
2347
|
})
|
|
2337
2348
|
)
|
|
2338
2349
|
)
|
|
2339
2350
|
);
|
|
2340
|
-
return /* @__PURE__ */
|
|
2341
|
-
},
|
|
2342
|
-
const r = _e(
|
|
2351
|
+
return /* @__PURE__ */ k(pr.Provider, { value: o, children: t });
|
|
2352
|
+
}, Mn = (e, t) => {
|
|
2353
|
+
const r = _e(pr);
|
|
2343
2354
|
return We(r, e, t || Ve);
|
|
2344
|
-
},
|
|
2345
|
-
},
|
|
2346
|
-
const t = Se((a) => a.getUser()), [r, n, o] =
|
|
2355
|
+
}, Dn = () => {
|
|
2356
|
+
}, ms = (e = Dn) => {
|
|
2357
|
+
const t = Se((a) => a.getUser()), [r, n, o] = Mn((a) => [
|
|
2347
2358
|
a.messages,
|
|
2348
2359
|
a.setMessages,
|
|
2349
2360
|
a.sendMessage
|
|
@@ -2358,12 +2369,12 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2358
2369
|
[t, o]
|
|
2359
2370
|
);
|
|
2360
2371
|
return { messages: r, setMessages: n, sendMessage: s };
|
|
2361
|
-
},
|
|
2372
|
+
}, qt = ({ children: e, session: t }) => {
|
|
2362
2373
|
const r = Se((n) => n.joinSpace);
|
|
2363
2374
|
return g.useEffect(() => (r(t), () => {
|
|
2364
2375
|
r(null);
|
|
2365
2376
|
}), [r, t]), e;
|
|
2366
|
-
},
|
|
2377
|
+
}, gs = ({
|
|
2367
2378
|
socket: e,
|
|
2368
2379
|
room: t,
|
|
2369
2380
|
session: r,
|
|
@@ -2376,60 +2387,148 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2376
2387
|
itemIds: n.map(({ id: c }) => c),
|
|
2377
2388
|
items: Object.fromEntries(n.map((c) => [c.id, c]))
|
|
2378
2389
|
}));
|
|
2379
|
-
return Xe("room") ? /* @__PURE__ */
|
|
2380
|
-
|
|
2390
|
+
return Xe("room") ? /* @__PURE__ */ k(
|
|
2391
|
+
Ht,
|
|
2381
2392
|
{
|
|
2382
2393
|
storeName: `${l}_messages`,
|
|
2383
2394
|
defaultValue: o,
|
|
2384
|
-
children: /* @__PURE__ */
|
|
2385
|
-
|
|
2395
|
+
children: /* @__PURE__ */ k(Vt, { children: /* @__PURE__ */ k(
|
|
2396
|
+
Wt,
|
|
2386
2397
|
{
|
|
2387
2398
|
storeName: `${l}_item`,
|
|
2388
2399
|
defaultValue: d,
|
|
2389
|
-
children: /* @__PURE__ */
|
|
2400
|
+
children: /* @__PURE__ */ k(qt, { ...a, session: l })
|
|
2390
2401
|
}
|
|
2391
2402
|
) })
|
|
2392
2403
|
}
|
|
2393
|
-
) : /* @__PURE__ */
|
|
2394
|
-
|
|
2404
|
+
) : /* @__PURE__ */ k(
|
|
2405
|
+
or,
|
|
2395
2406
|
{
|
|
2396
2407
|
room: u,
|
|
2397
2408
|
channel: "room",
|
|
2398
2409
|
socket: e,
|
|
2399
2410
|
LoadingComponent: s,
|
|
2400
|
-
children: /* @__PURE__ */
|
|
2401
|
-
|
|
2411
|
+
children: /* @__PURE__ */ k(dr, { storeName: `${u}_users`, children: /* @__PURE__ */ k(
|
|
2412
|
+
Ht,
|
|
2402
2413
|
{
|
|
2403
2414
|
storeName: `${l}_messages`,
|
|
2404
2415
|
defaultValue: o,
|
|
2405
|
-
children: /* @__PURE__ */
|
|
2406
|
-
|
|
2416
|
+
children: /* @__PURE__ */ k(Vt, { children: /* @__PURE__ */ k(
|
|
2417
|
+
Wt,
|
|
2407
2418
|
{
|
|
2408
2419
|
storeName: `${l}_item`,
|
|
2409
2420
|
defaultValue: d,
|
|
2410
|
-
children: /* @__PURE__ */
|
|
2421
|
+
children: /* @__PURE__ */ k(qt, { ...a, session: l })
|
|
2411
2422
|
}
|
|
2412
2423
|
) })
|
|
2413
2424
|
}
|
|
2414
2425
|
) })
|
|
2415
2426
|
}
|
|
2416
2427
|
);
|
|
2417
|
-
},
|
|
2428
|
+
}, hs = ({ socket: e, room: t, children: r, LoadingComponent: n }) => {
|
|
2418
2429
|
const [o] = g.useState(t || pe());
|
|
2419
|
-
return /* @__PURE__ */
|
|
2420
|
-
|
|
2430
|
+
return /* @__PURE__ */ k(
|
|
2431
|
+
or,
|
|
2421
2432
|
{
|
|
2422
2433
|
room: o,
|
|
2423
2434
|
channel: "room",
|
|
2424
2435
|
socket: e,
|
|
2425
2436
|
LoadingComponent: n,
|
|
2426
|
-
children: /* @__PURE__ */
|
|
2437
|
+
children: /* @__PURE__ */ k(dr, { storeName: `${o}_users`, children: r })
|
|
2427
2438
|
}
|
|
2428
2439
|
);
|
|
2429
|
-
}
|
|
2440
|
+
};
|
|
2441
|
+
let jn = { data: "" }, $n = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || jn, An = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, Ln = /\/\*[^]*?\*\/| +/g, Gt = /\n+/g, fe = (e, t) => {
|
|
2442
|
+
let r = "", n = "", o = "";
|
|
2443
|
+
for (let s in e) {
|
|
2444
|
+
let a = e[s];
|
|
2445
|
+
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 + ";");
|
|
2446
|
+
}
|
|
2447
|
+
return r + (t && o ? t + "{" + o + "}" : o) + n;
|
|
2448
|
+
}, ce = {}, mr = (e) => {
|
|
2449
|
+
if (typeof e == "object") {
|
|
2450
|
+
let t = "";
|
|
2451
|
+
for (let r in e)
|
|
2452
|
+
t += r + mr(e[r]);
|
|
2453
|
+
return t;
|
|
2454
|
+
}
|
|
2455
|
+
return e;
|
|
2456
|
+
}, zn = (e, t, r, n, o) => {
|
|
2457
|
+
let s = mr(e), a = ce[s] || (ce[s] = ((l) => {
|
|
2458
|
+
let d = 0, f = 11;
|
|
2459
|
+
for (; d < l.length; )
|
|
2460
|
+
f = 101 * f + l.charCodeAt(d++) >>> 0;
|
|
2461
|
+
return "go" + f;
|
|
2462
|
+
})(s));
|
|
2463
|
+
if (!ce[a]) {
|
|
2464
|
+
let l = s !== e ? e : ((d) => {
|
|
2465
|
+
let f, c, h = [{}];
|
|
2466
|
+
for (; f = An.exec(d.replace(Ln, "")); )
|
|
2467
|
+
f[4] ? h.shift() : f[3] ? (c = f[3].replace(Gt, " ").trim(), h.unshift(h[0][c] = h[0][c] || {})) : h[0][f[1]] = f[2].replace(Gt, " ").trim();
|
|
2468
|
+
return h[0];
|
|
2469
|
+
})(e);
|
|
2470
|
+
ce[a] = fe(o ? { ["@keyframes " + a]: l } : l, r ? "" : "." + a);
|
|
2471
|
+
}
|
|
2472
|
+
let u = r && ce.g ? ce.g : null;
|
|
2473
|
+
return r && (ce.g = ce[a]), ((l, d, f, c) => {
|
|
2474
|
+
c ? d.data = d.data.replace(c, l) : d.data.indexOf(l) === -1 && (d.data = f ? l + d.data : d.data + l);
|
|
2475
|
+
})(ce[a], t, n, u), a;
|
|
2476
|
+
}, Yn = (e, t, r) => e.reduce((n, o, s) => {
|
|
2477
|
+
let a = t[s];
|
|
2478
|
+
if (a && a.call) {
|
|
2479
|
+
let u = a(r), l = u && u.props && u.props.className || /^go/.test(u) && u;
|
|
2480
|
+
a = l ? "." + l : u && typeof u == "object" ? u.props ? "" : fe(u, "") : u === !1 ? "" : u;
|
|
2481
|
+
}
|
|
2482
|
+
return n + o + (a ?? "");
|
|
2483
|
+
}, "");
|
|
2484
|
+
function K(e) {
|
|
2485
|
+
let t = this || {}, r = e.call ? e(t.p) : e;
|
|
2486
|
+
return zn(r.unshift ? r.raw ? Yn(r, [].slice.call(arguments, 1), t.p) : r.reduce((n, o) => Object.assign(n, o && o.call ? o(t.p) : o), {}) : r, $n(t.target), t.g, t.o, t.k);
|
|
2487
|
+
}
|
|
2488
|
+
K.bind({ g: 1 });
|
|
2489
|
+
K.bind({ k: 1 });
|
|
2490
|
+
function Bn(e, t, r, n) {
|
|
2491
|
+
fe.p = t;
|
|
2492
|
+
}
|
|
2493
|
+
var Nn = function e(t, r) {
|
|
2494
|
+
if (t === r)
|
|
2495
|
+
return !0;
|
|
2496
|
+
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
2497
|
+
if (t.constructor !== r.constructor)
|
|
2498
|
+
return !1;
|
|
2499
|
+
var n, o, s;
|
|
2500
|
+
if (Array.isArray(t)) {
|
|
2501
|
+
if (n = t.length, n != r.length)
|
|
2502
|
+
return !1;
|
|
2503
|
+
for (o = n; o-- !== 0; )
|
|
2504
|
+
if (!e(t[o], r[o]))
|
|
2505
|
+
return !1;
|
|
2506
|
+
return !0;
|
|
2507
|
+
}
|
|
2508
|
+
if (t.constructor === RegExp)
|
|
2509
|
+
return t.source === r.source && t.flags === r.flags;
|
|
2510
|
+
if (t.valueOf !== Object.prototype.valueOf)
|
|
2511
|
+
return t.valueOf() === r.valueOf();
|
|
2512
|
+
if (t.toString !== Object.prototype.toString)
|
|
2513
|
+
return t.toString() === r.toString();
|
|
2514
|
+
if (s = Object.keys(t), n = s.length, n !== Object.keys(r).length)
|
|
2515
|
+
return !1;
|
|
2516
|
+
for (o = n; o-- !== 0; )
|
|
2517
|
+
if (!Object.prototype.hasOwnProperty.call(r, s[o]))
|
|
2518
|
+
return !1;
|
|
2519
|
+
for (o = n; o-- !== 0; ) {
|
|
2520
|
+
var a = s[o];
|
|
2521
|
+
if (!e(t[a], r[a]))
|
|
2522
|
+
return !1;
|
|
2523
|
+
}
|
|
2524
|
+
return !0;
|
|
2525
|
+
}
|
|
2526
|
+
return t !== t && r !== r;
|
|
2527
|
+
};
|
|
2528
|
+
const ot = () => {
|
|
2430
2529
|
const e = navigator.userAgent.toLowerCase();
|
|
2431
2530
|
return /mac os ?x 10/.test(e);
|
|
2432
|
-
},
|
|
2531
|
+
}, Xn = () => {
|
|
2433
2532
|
const e = document.createElement("iframe");
|
|
2434
2533
|
e.src = "#", document.body.appendChild(e);
|
|
2435
2534
|
const t = e.contentWindow.document;
|
|
@@ -2438,34 +2537,34 @@ const lr = g.createContext(), ut = (e) => {
|
|
|
2438
2537
|
), t.close();
|
|
2439
2538
|
const r = t.body.firstElementChild.offsetHeight;
|
|
2440
2539
|
return document.body.removeChild(e), r;
|
|
2441
|
-
},
|
|
2540
|
+
}, Un = Xn(), Wn = 800, Jt = (e, t) => {
|
|
2442
2541
|
const r = Object.keys(e).map((n) => Number(n)).find((n) => n !== t);
|
|
2443
2542
|
return e[r];
|
|
2444
|
-
},
|
|
2543
|
+
}, Zt = ([e, t], [r, n]) => {
|
|
2445
2544
|
const o = Math.abs(e - r), s = Math.abs(t - n);
|
|
2446
2545
|
return Math.hypot(o, s);
|
|
2447
2546
|
}, de = () => {
|
|
2448
|
-
},
|
|
2547
|
+
}, Vn = (e) => (t) => {
|
|
2449
2548
|
const { event: r } = t;
|
|
2450
2549
|
return r.isPropagationStopped() ? null : e(t);
|
|
2451
|
-
},
|
|
2550
|
+
}, Fn = (e) => async (...t) => {
|
|
2452
2551
|
try {
|
|
2453
2552
|
await e(...t);
|
|
2454
2553
|
} catch (r) {
|
|
2455
2554
|
console.error(r);
|
|
2456
2555
|
}
|
|
2457
2556
|
};
|
|
2458
|
-
class
|
|
2557
|
+
class Kn {
|
|
2459
2558
|
constructor() {
|
|
2460
|
-
|
|
2559
|
+
Pt(this, "lastPromise", Promise.resolve(!0));
|
|
2461
2560
|
}
|
|
2462
2561
|
add(t, ...r) {
|
|
2463
2562
|
return new Promise((n, o) => {
|
|
2464
|
-
this.lastPromise = this.lastPromise.then(() =>
|
|
2563
|
+
this.lastPromise = this.lastPromise.then(() => Vn(Fn(t))(...r)).then(n).catch(o);
|
|
2465
2564
|
});
|
|
2466
2565
|
}
|
|
2467
2566
|
}
|
|
2468
|
-
const se = new
|
|
2567
|
+
const se = new Kn(), Fe = ({
|
|
2469
2568
|
children: e,
|
|
2470
2569
|
onDrag: t = de,
|
|
2471
2570
|
onDragStart: r = de,
|
|
@@ -2483,73 +2582,73 @@ const se = new zn(), Fe = ({
|
|
|
2483
2582
|
mainPointer: void 0
|
|
2484
2583
|
}), h = (y) => {
|
|
2485
2584
|
const {
|
|
2486
|
-
deltaX:
|
|
2487
|
-
deltaY:
|
|
2585
|
+
deltaX: x,
|
|
2586
|
+
deltaY: C,
|
|
2488
2587
|
clientX: p,
|
|
2489
|
-
clientY:
|
|
2588
|
+
clientY: _,
|
|
2490
2589
|
deltaMode: m,
|
|
2491
|
-
ctrlKey:
|
|
2492
|
-
altKey:
|
|
2493
|
-
metaKey:
|
|
2494
|
-
target:
|
|
2590
|
+
ctrlKey: w,
|
|
2591
|
+
altKey: R,
|
|
2592
|
+
metaKey: T,
|
|
2593
|
+
target: D
|
|
2495
2594
|
} = y;
|
|
2496
|
-
if (!(
|
|
2497
|
-
if (
|
|
2595
|
+
if (!(R || w && !ot()))
|
|
2596
|
+
if (ot() && !w)
|
|
2498
2597
|
se.add(o, {
|
|
2499
|
-
deltaX: -2 *
|
|
2500
|
-
deltaY: -2 *
|
|
2598
|
+
deltaX: -2 * x,
|
|
2599
|
+
deltaY: -2 * C,
|
|
2501
2600
|
button: 1,
|
|
2502
|
-
ctrlKey:
|
|
2503
|
-
metaKey:
|
|
2504
|
-
target:
|
|
2601
|
+
ctrlKey: w,
|
|
2602
|
+
metaKey: T,
|
|
2603
|
+
target: D,
|
|
2505
2604
|
event: y
|
|
2506
2605
|
});
|
|
2507
2606
|
else {
|
|
2508
|
-
if (l === void 0 || !
|
|
2607
|
+
if (l === void 0 || !C)
|
|
2509
2608
|
return;
|
|
2510
|
-
let M =
|
|
2609
|
+
let M = C;
|
|
2511
2610
|
switch (m) {
|
|
2512
2611
|
case 1:
|
|
2513
|
-
M *=
|
|
2612
|
+
M *= Un;
|
|
2514
2613
|
break;
|
|
2515
2614
|
case 2:
|
|
2516
|
-
M *=
|
|
2615
|
+
M *= Wn;
|
|
2517
2616
|
break;
|
|
2518
2617
|
}
|
|
2519
|
-
|
|
2618
|
+
ot() && (M *= 2), se.add(l, { scale: M, clientX: p, clientY: _, event: y });
|
|
2520
2619
|
}
|
|
2521
|
-
},
|
|
2620
|
+
}, S = (y) => {
|
|
2522
2621
|
const {
|
|
2523
|
-
target:
|
|
2524
|
-
button:
|
|
2622
|
+
target: x,
|
|
2623
|
+
button: C,
|
|
2525
2624
|
clientX: p,
|
|
2526
|
-
clientY:
|
|
2625
|
+
clientY: _,
|
|
2527
2626
|
pointerId: m,
|
|
2528
|
-
altKey:
|
|
2529
|
-
ctrlKey:
|
|
2530
|
-
metaKey:
|
|
2531
|
-
isPrimary:
|
|
2627
|
+
altKey: w,
|
|
2628
|
+
ctrlKey: R,
|
|
2629
|
+
metaKey: T,
|
|
2630
|
+
isPrimary: D
|
|
2532
2631
|
} = y;
|
|
2533
|
-
if (c.current.pointers[m] = { clientX: p, clientY:
|
|
2632
|
+
if (c.current.pointers[m] = { clientX: p, clientY: _ }, D && (c.current.mainPointer = void 0), c.current.mainPointer !== void 0) {
|
|
2534
2633
|
if (c.current.mainPointer !== m)
|
|
2535
2634
|
try {
|
|
2536
|
-
const { clientX: M, clientY: A } =
|
|
2635
|
+
const { clientX: M, clientY: A } = Jt(
|
|
2537
2636
|
c.current.pointers,
|
|
2538
2637
|
m
|
|
2539
|
-
),
|
|
2638
|
+
), Y = (M + p) / 2, U = (A + _) / 2, G = Zt(
|
|
2540
2639
|
[M, A],
|
|
2541
|
-
[p,
|
|
2640
|
+
[p, _]
|
|
2542
2641
|
);
|
|
2543
2642
|
Object.assign(c.current, {
|
|
2544
2643
|
pressed: !0,
|
|
2545
2644
|
moving: !1,
|
|
2546
2645
|
gestureStart: !1,
|
|
2547
2646
|
startX: p,
|
|
2548
|
-
startY:
|
|
2549
|
-
prevX:
|
|
2647
|
+
startY: _,
|
|
2648
|
+
prevX: Y,
|
|
2550
2649
|
prevY: U,
|
|
2551
|
-
startDistance:
|
|
2552
|
-
prevDistance:
|
|
2650
|
+
startDistance: G,
|
|
2651
|
+
prevDistance: G
|
|
2553
2652
|
});
|
|
2554
2653
|
} catch (M) {
|
|
2555
2654
|
console.log("Error while getting other pointer. Ignoring", M), c.current.mainPointer;
|
|
@@ -2561,65 +2660,65 @@ const se = new zn(), Fe = ({
|
|
|
2561
2660
|
moving: !1,
|
|
2562
2661
|
gestureStart: !1,
|
|
2563
2662
|
startX: p,
|
|
2564
|
-
startY:
|
|
2663
|
+
startY: _,
|
|
2565
2664
|
prevX: p,
|
|
2566
|
-
prevY:
|
|
2567
|
-
currentButton:
|
|
2665
|
+
prevY: _,
|
|
2666
|
+
currentButton: C,
|
|
2568
2667
|
pointerDownEvent: y,
|
|
2569
2668
|
startDistance: 0,
|
|
2570
2669
|
prevDistance: 0,
|
|
2571
|
-
target:
|
|
2670
|
+
target: x,
|
|
2572
2671
|
timeStart: Date.now(),
|
|
2573
2672
|
longTapTimeout: setTimeout(async () => {
|
|
2574
2673
|
c.current.noTap = !0, se.add(a, {
|
|
2575
2674
|
clientX: p,
|
|
2576
|
-
clientY:
|
|
2577
|
-
altKey:
|
|
2578
|
-
ctrlKey:
|
|
2579
|
-
metaKey:
|
|
2580
|
-
target:
|
|
2675
|
+
clientY: _,
|
|
2676
|
+
altKey: w,
|
|
2677
|
+
ctrlKey: R,
|
|
2678
|
+
metaKey: T,
|
|
2679
|
+
target: x,
|
|
2581
2680
|
event: y
|
|
2582
2681
|
});
|
|
2583
2682
|
}, 750)
|
|
2584
2683
|
});
|
|
2585
2684
|
try {
|
|
2586
|
-
|
|
2685
|
+
x.setPointerCapture(m);
|
|
2587
2686
|
} catch (M) {
|
|
2588
2687
|
console.log("Fail to capture pointer", M);
|
|
2589
2688
|
}
|
|
2590
2689
|
}, v = (y) => {
|
|
2591
2690
|
if (c.current.pressed) {
|
|
2592
2691
|
const {
|
|
2593
|
-
pointerId:
|
|
2594
|
-
clientX:
|
|
2692
|
+
pointerId: x,
|
|
2693
|
+
clientX: C,
|
|
2595
2694
|
clientY: p,
|
|
2596
|
-
altKey:
|
|
2695
|
+
altKey: _,
|
|
2597
2696
|
shiftKey: m,
|
|
2598
|
-
ctrlKey:
|
|
2599
|
-
metaKey:
|
|
2600
|
-
buttons:
|
|
2697
|
+
ctrlKey: w,
|
|
2698
|
+
metaKey: R,
|
|
2699
|
+
buttons: T
|
|
2601
2700
|
} = y;
|
|
2602
|
-
c.current.pointers[
|
|
2603
|
-
clientX:
|
|
2701
|
+
c.current.pointers[x] = {
|
|
2702
|
+
clientX: C,
|
|
2604
2703
|
clientY: p
|
|
2605
2704
|
}, c.current.moving = !0;
|
|
2606
|
-
const
|
|
2607
|
-
let M, A,
|
|
2608
|
-
if (
|
|
2609
|
-
const { clientX: $, clientY:
|
|
2705
|
+
const D = Object.keys(c.current.pointers).length === 2;
|
|
2706
|
+
let M, A, Y = 0;
|
|
2707
|
+
if (D) {
|
|
2708
|
+
const { clientX: $, clientY: B } = Jt(
|
|
2610
2709
|
c.current.pointers,
|
|
2611
|
-
|
|
2710
|
+
x
|
|
2612
2711
|
);
|
|
2613
|
-
M = ($ +
|
|
2614
|
-
[$,
|
|
2615
|
-
[
|
|
2712
|
+
M = ($ + C) / 2, A = (B + p) / 2, Y = Zt(
|
|
2713
|
+
[$, B],
|
|
2714
|
+
[C, p]
|
|
2616
2715
|
);
|
|
2617
2716
|
} else
|
|
2618
|
-
M =
|
|
2619
|
-
let U = m ||
|
|
2717
|
+
M = C, A = p;
|
|
2718
|
+
let U = m || _ || w || R || T !== 1;
|
|
2620
2719
|
d !== "drag" && (U = !U);
|
|
2621
|
-
const
|
|
2622
|
-
if (
|
|
2720
|
+
const G = !U, P = U;
|
|
2721
|
+
if (G) {
|
|
2623
2722
|
c.current.gestureStart || (f.current.style.cursor = "move", c.current.gestureStart = !0, clearTimeout(c.current.longTapTimeout), se.add(r, {
|
|
2624
2723
|
deltaX: 0,
|
|
2625
2724
|
deltaY: 0,
|
|
@@ -2630,73 +2729,73 @@ const se = new zn(), Fe = ({
|
|
|
2630
2729
|
distanceX: 0,
|
|
2631
2730
|
distanceY: 0,
|
|
2632
2731
|
button: c.current.currentButton,
|
|
2633
|
-
altKey:
|
|
2732
|
+
altKey: _,
|
|
2634
2733
|
shiftKey: m,
|
|
2635
|
-
ctrlKey:
|
|
2636
|
-
metaKey:
|
|
2734
|
+
ctrlKey: w,
|
|
2735
|
+
metaKey: R,
|
|
2637
2736
|
target: c.current.target,
|
|
2638
2737
|
event: c.current.pointerDownEvent
|
|
2639
2738
|
}));
|
|
2640
|
-
const $ = M - c.current.prevX,
|
|
2739
|
+
const $ = M - c.current.prevX, B = A - c.current.prevY, V = M - c.current.startX, L = A - c.current.startY;
|
|
2641
2740
|
se.add(t, {
|
|
2642
2741
|
deltaX: $,
|
|
2643
|
-
deltaY:
|
|
2742
|
+
deltaY: B,
|
|
2644
2743
|
startX: c.current.startX,
|
|
2645
2744
|
startY: c.current.startY,
|
|
2646
2745
|
clientX: M,
|
|
2647
2746
|
clientY: A,
|
|
2648
2747
|
distanceX: V,
|
|
2649
|
-
distanceY:
|
|
2748
|
+
distanceY: L,
|
|
2650
2749
|
button: c.current.currentButton,
|
|
2651
|
-
altKey:
|
|
2750
|
+
altKey: _,
|
|
2652
2751
|
shiftKey: m,
|
|
2653
|
-
ctrlKey:
|
|
2654
|
-
metaKey:
|
|
2752
|
+
ctrlKey: w,
|
|
2753
|
+
metaKey: R,
|
|
2655
2754
|
target: c.current.target,
|
|
2656
2755
|
event: y
|
|
2657
2756
|
});
|
|
2658
2757
|
}
|
|
2659
2758
|
if (P) {
|
|
2660
2759
|
c.current.gestureStart || (f.current.style.cursor = "move", c.current.gestureStart = !0, clearTimeout(c.current.longTapTimeout));
|
|
2661
|
-
const $ = M - c.current.prevX,
|
|
2760
|
+
const $ = M - c.current.prevX, B = A - c.current.prevY, { target: V } = c.current;
|
|
2662
2761
|
if (se.add(o, {
|
|
2663
2762
|
deltaX: $,
|
|
2664
|
-
deltaY:
|
|
2763
|
+
deltaY: B,
|
|
2665
2764
|
button: c.current.currentButton,
|
|
2666
|
-
altKey:
|
|
2765
|
+
altKey: _,
|
|
2667
2766
|
shiftKey: m,
|
|
2668
|
-
ctrlKey:
|
|
2669
|
-
metaKey:
|
|
2767
|
+
ctrlKey: w,
|
|
2768
|
+
metaKey: R,
|
|
2670
2769
|
target: V,
|
|
2671
2770
|
event: y
|
|
2672
|
-
}),
|
|
2673
|
-
const
|
|
2674
|
-
Math.abs(
|
|
2675
|
-
scale:
|
|
2771
|
+
}), Y !== c.current.prevDistance && l) {
|
|
2772
|
+
const L = c.current.prevDistance - Y;
|
|
2773
|
+
Math.abs(L) > 0 && (se.add(l, {
|
|
2774
|
+
scale: L * 3,
|
|
2676
2775
|
clientX: M,
|
|
2677
2776
|
clientY: A,
|
|
2678
2777
|
event: y
|
|
2679
|
-
}), c.current.prevDistance =
|
|
2778
|
+
}), c.current.prevDistance = Y);
|
|
2680
2779
|
}
|
|
2681
2780
|
}
|
|
2682
2781
|
c.current.prevX = M, c.current.prevY = A;
|
|
2683
2782
|
}
|
|
2684
2783
|
}, E = (y) => {
|
|
2685
2784
|
const {
|
|
2686
|
-
clientX:
|
|
2687
|
-
clientY:
|
|
2785
|
+
clientX: x,
|
|
2786
|
+
clientY: C,
|
|
2688
2787
|
altKey: p,
|
|
2689
|
-
shiftKey:
|
|
2788
|
+
shiftKey: _,
|
|
2690
2789
|
ctrlKey: m,
|
|
2691
|
-
metaKey:
|
|
2692
|
-
target:
|
|
2693
|
-
pointerId:
|
|
2790
|
+
metaKey: w,
|
|
2791
|
+
target: R,
|
|
2792
|
+
pointerId: T
|
|
2694
2793
|
} = y;
|
|
2695
|
-
if (c.current.pointers[
|
|
2696
|
-
if (delete c.current.pointers[
|
|
2697
|
-
const { clientX:
|
|
2794
|
+
if (c.current.pointers[T]) {
|
|
2795
|
+
if (delete c.current.pointers[T], c.current.mainPointer !== T) {
|
|
2796
|
+
const { clientX: D, clientY: M } = c.current.pointers[c.current.mainPointer];
|
|
2698
2797
|
Object.assign(c.current, {
|
|
2699
|
-
prevX:
|
|
2798
|
+
prevX: D,
|
|
2700
2799
|
prevY: M,
|
|
2701
2800
|
prevDistance: 0,
|
|
2702
2801
|
startDistance: 0
|
|
@@ -2709,70 +2808,70 @@ const se = new zn(), Fe = ({
|
|
|
2709
2808
|
);
|
|
2710
2809
|
try {
|
|
2711
2810
|
c.current.target.setPointerCapture(c.current.mainPointer);
|
|
2712
|
-
const { clientX:
|
|
2811
|
+
const { clientX: D, clientY: M } = c.current.pointers[c.current.mainPointer];
|
|
2713
2812
|
Object.assign(c.current, {
|
|
2714
|
-
prevX:
|
|
2813
|
+
prevX: D,
|
|
2715
2814
|
prevY: M,
|
|
2716
2815
|
prevDistance: 0,
|
|
2717
2816
|
startDistance: 0
|
|
2718
2817
|
});
|
|
2719
2818
|
return;
|
|
2720
|
-
} catch (
|
|
2721
|
-
console.log("Fails to set pointer capture",
|
|
2819
|
+
} catch (D) {
|
|
2820
|
+
console.log("Fails to set pointer capture", D), c.current.mainPointer = void 0, delete c.current.pointers[Object.keys(c.current.pointers)[0]];
|
|
2722
2821
|
}
|
|
2723
2822
|
}
|
|
2724
2823
|
if (c.current.mainPointer = void 0, c.current.pressed = !1, clearTimeout(c.current.longTapTimeout), c.current.moving)
|
|
2725
2824
|
c.current.moving = !1, se.add(n, {
|
|
2726
|
-
deltaX:
|
|
2727
|
-
deltaY:
|
|
2825
|
+
deltaX: x - c.current.prevX,
|
|
2826
|
+
deltaY: C - c.current.prevY,
|
|
2728
2827
|
startX: c.current.startX,
|
|
2729
2828
|
startY: c.current.startY,
|
|
2730
|
-
clientX:
|
|
2731
|
-
clientY:
|
|
2732
|
-
distanceX:
|
|
2733
|
-
distanceY:
|
|
2829
|
+
clientX: x,
|
|
2830
|
+
clientY: C,
|
|
2831
|
+
distanceX: x - c.current.startX,
|
|
2832
|
+
distanceY: C - c.current.startY,
|
|
2734
2833
|
button: c.current.currentButton,
|
|
2735
2834
|
altKey: p,
|
|
2736
|
-
shiftKey:
|
|
2835
|
+
shiftKey: _,
|
|
2737
2836
|
ctrlKey: m,
|
|
2738
|
-
metaKey:
|
|
2837
|
+
metaKey: w,
|
|
2739
2838
|
event: y
|
|
2740
2839
|
}), f.current.style.cursor = "auto";
|
|
2741
2840
|
else {
|
|
2742
|
-
const
|
|
2743
|
-
c.current.noTap ? c.current.noTap = !1 : c.current.timeStart -
|
|
2744
|
-
clientX:
|
|
2745
|
-
clientY:
|
|
2841
|
+
const D = Date.now();
|
|
2842
|
+
c.current.noTap ? c.current.noTap = !1 : c.current.timeStart - D < 300 && se.add(s, {
|
|
2843
|
+
clientX: x,
|
|
2844
|
+
clientY: C,
|
|
2746
2845
|
altKey: p,
|
|
2747
|
-
shiftKey:
|
|
2846
|
+
shiftKey: _,
|
|
2748
2847
|
ctrlKey: m,
|
|
2749
|
-
metaKey:
|
|
2750
|
-
target:
|
|
2848
|
+
metaKey: w,
|
|
2849
|
+
target: R,
|
|
2751
2850
|
event: y
|
|
2752
2851
|
});
|
|
2753
2852
|
}
|
|
2754
2853
|
}
|
|
2755
2854
|
};
|
|
2756
|
-
return /* @__PURE__ */
|
|
2855
|
+
return /* @__PURE__ */ k(
|
|
2757
2856
|
"div",
|
|
2758
2857
|
{
|
|
2759
2858
|
onWheel: h,
|
|
2760
|
-
onPointerDown:
|
|
2859
|
+
onPointerDown: S,
|
|
2761
2860
|
onPointerMove: v,
|
|
2762
2861
|
onPointerUp: E,
|
|
2763
2862
|
onPointerOut: E,
|
|
2764
2863
|
onPointerLeave: E,
|
|
2765
2864
|
onPointerCancel: E,
|
|
2766
2865
|
onDoubleClick: (y) => {
|
|
2767
|
-
const { clientX:
|
|
2866
|
+
const { clientX: x, clientY: C, altKey: p, shiftKey: _, ctrlKey: m, metaKey: w, target: R } = y;
|
|
2768
2867
|
se.add(u, {
|
|
2769
|
-
clientX:
|
|
2770
|
-
clientY:
|
|
2868
|
+
clientX: x,
|
|
2869
|
+
clientY: C,
|
|
2771
2870
|
altKey: p,
|
|
2772
|
-
shiftKey:
|
|
2871
|
+
shiftKey: _,
|
|
2773
2872
|
ctrlKey: m,
|
|
2774
|
-
metaKey:
|
|
2775
|
-
target:
|
|
2873
|
+
metaKey: w,
|
|
2874
|
+
target: R,
|
|
2776
2875
|
event: y
|
|
2777
2876
|
});
|
|
2778
2877
|
},
|
|
@@ -2781,134 +2880,46 @@ const se = new zn(), Fe = ({
|
|
|
2781
2880
|
children: e
|
|
2782
2881
|
}
|
|
2783
2882
|
);
|
|
2784
|
-
},
|
|
2785
|
-
const [r] =
|
|
2786
|
-
return /* @__PURE__ */
|
|
2883
|
+
}, st = ({ onResize: e, ...t }) => {
|
|
2884
|
+
const [r] = Z((o) => [o.getBoardState]);
|
|
2885
|
+
return /* @__PURE__ */ k(Fe, { onDrag: ({ deltaX: o, deltaY: s, event: a }) => {
|
|
2787
2886
|
a.stopPropagation();
|
|
2788
2887
|
const { scale: u } = r();
|
|
2789
2888
|
e({
|
|
2790
2889
|
width: o / u,
|
|
2791
2890
|
height: s / u
|
|
2792
2891
|
});
|
|
2793
|
-
}, children: /* @__PURE__ */
|
|
2794
|
-
}
|
|
2795
|
-
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) => {
|
|
2796
|
-
let r = "", n = "", o = "";
|
|
2797
|
-
for (let s in e) {
|
|
2798
|
-
let a = e[s];
|
|
2799
|
-
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 + ";");
|
|
2800
|
-
}
|
|
2801
|
-
return r + (t && o ? t + "{" + o + "}" : o) + n;
|
|
2802
|
-
}, ce = {}, pr = (e) => {
|
|
2803
|
-
if (typeof e == "object") {
|
|
2804
|
-
let t = "";
|
|
2805
|
-
for (let r in e)
|
|
2806
|
-
t += r + pr(e[r]);
|
|
2807
|
-
return t;
|
|
2808
|
-
}
|
|
2809
|
-
return e;
|
|
2810
|
-
}, Un = (e, t, r, n, o) => {
|
|
2811
|
-
let s = pr(e), a = ce[s] || (ce[s] = ((l) => {
|
|
2812
|
-
let d = 0, f = 11;
|
|
2813
|
-
for (; d < l.length; )
|
|
2814
|
-
f = 101 * f + l.charCodeAt(d++) >>> 0;
|
|
2815
|
-
return "go" + f;
|
|
2816
|
-
})(s));
|
|
2817
|
-
if (!ce[a]) {
|
|
2818
|
-
let l = s !== e ? e : ((d) => {
|
|
2819
|
-
let f, c, h = [{}];
|
|
2820
|
-
for (; f = Nn.exec(d.replace(Xn, "")); )
|
|
2821
|
-
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();
|
|
2822
|
-
return h[0];
|
|
2823
|
-
})(e);
|
|
2824
|
-
ce[a] = fe(o ? { ["@keyframes " + a]: l } : l, r ? "" : "." + a);
|
|
2825
|
-
}
|
|
2826
|
-
let u = r && ce.g ? ce.g : null;
|
|
2827
|
-
return r && (ce.g = ce[a]), ((l, d, f, c) => {
|
|
2828
|
-
c ? d.data = d.data.replace(c, l) : d.data.indexOf(l) === -1 && (d.data = f ? l + d.data : d.data + l);
|
|
2829
|
-
})(ce[a], t, n, u), a;
|
|
2830
|
-
}, Wn = (e, t, r) => e.reduce((n, o, s) => {
|
|
2831
|
-
let a = t[s];
|
|
2832
|
-
if (a && a.call) {
|
|
2833
|
-
let u = a(r), l = u && u.props && u.props.className || /^go/.test(u) && u;
|
|
2834
|
-
a = l ? "." + l : u && typeof u == "object" ? u.props ? "" : fe(u, "") : u === !1 ? "" : u;
|
|
2835
|
-
}
|
|
2836
|
-
return n + o + (a ?? "");
|
|
2837
|
-
}, "");
|
|
2838
|
-
function K(e) {
|
|
2839
|
-
let t = this || {}, r = e.call ? e(t.p) : e;
|
|
2840
|
-
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);
|
|
2841
|
-
}
|
|
2842
|
-
K.bind({ g: 1 });
|
|
2843
|
-
K.bind({ k: 1 });
|
|
2844
|
-
function Vn(e, t, r, n) {
|
|
2845
|
-
fe.p = t;
|
|
2846
|
-
}
|
|
2847
|
-
var Fn = function e(t, r) {
|
|
2848
|
-
if (t === r)
|
|
2849
|
-
return !0;
|
|
2850
|
-
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
2851
|
-
if (t.constructor !== r.constructor)
|
|
2852
|
-
return !1;
|
|
2853
|
-
var n, o, s;
|
|
2854
|
-
if (Array.isArray(t)) {
|
|
2855
|
-
if (n = t.length, n != r.length)
|
|
2856
|
-
return !1;
|
|
2857
|
-
for (o = n; o-- !== 0; )
|
|
2858
|
-
if (!e(t[o], r[o]))
|
|
2859
|
-
return !1;
|
|
2860
|
-
return !0;
|
|
2861
|
-
}
|
|
2862
|
-
if (t.constructor === RegExp)
|
|
2863
|
-
return t.source === r.source && t.flags === r.flags;
|
|
2864
|
-
if (t.valueOf !== Object.prototype.valueOf)
|
|
2865
|
-
return t.valueOf() === r.valueOf();
|
|
2866
|
-
if (t.toString !== Object.prototype.toString)
|
|
2867
|
-
return t.toString() === r.toString();
|
|
2868
|
-
if (s = Object.keys(t), n = s.length, n !== Object.keys(r).length)
|
|
2869
|
-
return !1;
|
|
2870
|
-
for (o = n; o-- !== 0; )
|
|
2871
|
-
if (!Object.prototype.hasOwnProperty.call(r, s[o]))
|
|
2872
|
-
return !1;
|
|
2873
|
-
for (o = n; o-- !== 0; ) {
|
|
2874
|
-
var a = s[o];
|
|
2875
|
-
if (!e(t[a], r[a]))
|
|
2876
|
-
return !1;
|
|
2877
|
-
}
|
|
2878
|
-
return !0;
|
|
2879
|
-
}
|
|
2880
|
-
return t !== t && r !== r;
|
|
2881
|
-
};
|
|
2882
|
-
const Kn = K`
|
|
2892
|
+
}, children: /* @__PURE__ */ k("div", { ...t }) });
|
|
2893
|
+
}, Hn = K`
|
|
2883
2894
|
display: inline-block;
|
|
2884
2895
|
transition: transform 150ms;
|
|
2885
2896
|
user-select: none;
|
|
2886
2897
|
padding: 2px;
|
|
2887
2898
|
box-sizing: border-box;
|
|
2888
|
-
`,
|
|
2899
|
+
`, qn = K`
|
|
2889
2900
|
border: 2px dashed #db5034;
|
|
2890
2901
|
padding: 0px;
|
|
2891
2902
|
cursor: pointer;
|
|
2892
|
-
`,
|
|
2903
|
+
`, xe = K`
|
|
2893
2904
|
position: absolute;
|
|
2894
2905
|
width: 0px;
|
|
2895
2906
|
height: 0px;
|
|
2896
|
-
`,
|
|
2907
|
+
`, Gn = K`
|
|
2897
2908
|
top: 0;
|
|
2898
2909
|
left: 0;
|
|
2899
|
-
`,
|
|
2910
|
+
`, Jn = K`
|
|
2900
2911
|
top: 0;
|
|
2901
2912
|
right: 0;
|
|
2902
|
-
`,
|
|
2913
|
+
`, Zn = K`
|
|
2903
2914
|
bottom: 0;
|
|
2904
2915
|
left: 0;
|
|
2905
|
-
`,
|
|
2916
|
+
`, Qn = K`
|
|
2906
2917
|
bottom: 0;
|
|
2907
2918
|
right: 0;
|
|
2908
|
-
`,
|
|
2919
|
+
`, eo = K`
|
|
2909
2920
|
top: 50%;
|
|
2910
2921
|
left: 50%;
|
|
2911
|
-
`,
|
|
2922
|
+
`, it = K`
|
|
2912
2923
|
position: absolute;
|
|
2913
2924
|
|
|
2914
2925
|
width: 10px;
|
|
@@ -2916,19 +2927,19 @@ const Kn = K`
|
|
|
2916
2927
|
border: 2px solid #db5034;
|
|
2917
2928
|
background-color: #db5034;
|
|
2918
2929
|
cursor: move;
|
|
2919
|
-
`,
|
|
2930
|
+
`, to = K`
|
|
2920
2931
|
cursor: ew-resize;
|
|
2921
2932
|
right: -6px;
|
|
2922
2933
|
top: calc(50% - 5px);
|
|
2923
|
-
`,
|
|
2934
|
+
`, ro = K`
|
|
2924
2935
|
cursor: ns-resize;
|
|
2925
2936
|
bottom: -6px;
|
|
2926
2937
|
left: calc(50% - 5px);
|
|
2927
|
-
`,
|
|
2938
|
+
`, no = K`
|
|
2928
2939
|
cursor: nwse-resize;
|
|
2929
2940
|
bottom: -6px;
|
|
2930
2941
|
right: -6px;
|
|
2931
|
-
`,
|
|
2942
|
+
`, oo = ({ onReload: e }) => /* @__PURE__ */ le(
|
|
2932
2943
|
"div",
|
|
2933
2944
|
{
|
|
2934
2945
|
className: `syncboard-error-item ${K({
|
|
@@ -2941,11 +2952,11 @@ const Kn = K`
|
|
|
2941
2952
|
})}`,
|
|
2942
2953
|
children: [
|
|
2943
2954
|
"Sorry, this item seems broken.",
|
|
2944
|
-
/* @__PURE__ */
|
|
2955
|
+
/* @__PURE__ */ k("button", { onClick: e, children: "Reload it" })
|
|
2945
2956
|
]
|
|
2946
2957
|
}
|
|
2947
2958
|
);
|
|
2948
|
-
class
|
|
2959
|
+
class so extends g.Component {
|
|
2949
2960
|
constructor(t) {
|
|
2950
2961
|
super(t), this.state = { hasError: !1, itemId: t.itemId }, this.onReload = this.onReload.bind(this);
|
|
2951
2962
|
}
|
|
@@ -2964,12 +2975,12 @@ class oo extends g.Component {
|
|
|
2964
2975
|
}
|
|
2965
2976
|
render() {
|
|
2966
2977
|
const { ErrorComponent: t } = this.props;
|
|
2967
|
-
return this.state.hasError ? /* @__PURE__ */
|
|
2978
|
+
return this.state.hasError ? /* @__PURE__ */ k(t, { onReload: this.onReload }) : this.props.children;
|
|
2968
2979
|
}
|
|
2969
2980
|
}
|
|
2970
|
-
const
|
|
2981
|
+
const io = (e) => {
|
|
2971
2982
|
e.target.className = "";
|
|
2972
|
-
},
|
|
2983
|
+
}, ao = ({
|
|
2973
2984
|
width: e,
|
|
2974
2985
|
height: t,
|
|
2975
2986
|
actualWidth: r,
|
|
@@ -2994,11 +3005,11 @@ const so = (e) => {
|
|
|
2994
3005
|
width: (a + e).toFixed(1),
|
|
2995
3006
|
height: (u + t).toFixed(1)
|
|
2996
3007
|
};
|
|
2997
|
-
},
|
|
3008
|
+
}, co = {
|
|
2998
3009
|
w: !0,
|
|
2999
3010
|
h: !0,
|
|
3000
3011
|
b: !0
|
|
3001
|
-
},
|
|
3012
|
+
}, uo = ({
|
|
3002
3013
|
setState: e,
|
|
3003
3014
|
state: { type: t, rotation: r = 0, id: n, locked: o, extraClasses: s, ...a } = {},
|
|
3004
3015
|
animate: u = "hvr-pop",
|
|
@@ -3006,88 +3017,89 @@ const so = (e) => {
|
|
|
3006
3017
|
itemMap: d,
|
|
3007
3018
|
showResizeHandle: f = !0
|
|
3008
3019
|
}) => {
|
|
3009
|
-
var
|
|
3010
|
-
const c = g.useRef(null), {
|
|
3011
|
-
component:
|
|
3012
|
-
resizeDirections:
|
|
3013
|
-
resize:
|
|
3014
|
-
} = d[t],
|
|
3015
|
-
(
|
|
3020
|
+
var w;
|
|
3021
|
+
const c = g.useRef(null), [h] = Z((R) => [R.config.uid]), {
|
|
3022
|
+
component: S = () => null,
|
|
3023
|
+
resizeDirections: v = co,
|
|
3024
|
+
resize: E = ao
|
|
3025
|
+
} = d[t], O = g.useCallback(
|
|
3026
|
+
(R, T = !1) => e(n, R, T),
|
|
3016
3027
|
[e, n]
|
|
3017
3028
|
);
|
|
3018
3029
|
g.useEffect(() => {
|
|
3019
3030
|
c.current.className = u;
|
|
3020
3031
|
}, [u]);
|
|
3021
|
-
const
|
|
3022
|
-
o &&
|
|
3023
|
-
const
|
|
3024
|
-
|
|
3025
|
-
const { offsetWidth:
|
|
3026
|
-
return
|
|
3027
|
-
prevState:
|
|
3028
|
-
width:
|
|
3029
|
-
height:
|
|
3030
|
-
actualHeight:
|
|
3031
|
-
actualWidth:
|
|
3032
|
-
keepRatio:
|
|
3032
|
+
const y = ["item", n, Hn];
|
|
3033
|
+
o && y.push("locked"), l && (y.push("selected"), y.push(qn));
|
|
3034
|
+
const x = y.join(" "), C = ({ width: R = 0, height: T = 0, keepRatio: D }) => {
|
|
3035
|
+
O((M) => {
|
|
3036
|
+
const { offsetWidth: A, offsetHeight: Y } = c.current;
|
|
3037
|
+
return E({
|
|
3038
|
+
prevState: M,
|
|
3039
|
+
width: R,
|
|
3040
|
+
height: T,
|
|
3041
|
+
actualHeight: Y,
|
|
3042
|
+
actualWidth: A,
|
|
3043
|
+
keepRatio: D
|
|
3033
3044
|
});
|
|
3034
3045
|
});
|
|
3035
|
-
},
|
|
3036
|
-
C({ width:
|
|
3037
|
-
},
|
|
3038
|
-
C({ height:
|
|
3039
|
-
},
|
|
3040
|
-
C({ height:
|
|
3046
|
+
}, p = ({ width: R }) => {
|
|
3047
|
+
C({ width: R });
|
|
3048
|
+
}, _ = ({ height: R }) => {
|
|
3049
|
+
C({ height: R });
|
|
3050
|
+
}, m = ({ width: R }) => {
|
|
3051
|
+
C({ height: R, width: R, keepRatio: !0 });
|
|
3041
3052
|
};
|
|
3042
|
-
return /* @__PURE__ */
|
|
3053
|
+
return /* @__PURE__ */ k(
|
|
3043
3054
|
"div",
|
|
3044
3055
|
{
|
|
3045
3056
|
style: { transform: `rotate(${r}deg` },
|
|
3046
3057
|
"data-id": n,
|
|
3047
|
-
|
|
3058
|
+
id: `${h}__${n}`,
|
|
3059
|
+
className: x,
|
|
3048
3060
|
children: /* @__PURE__ */ le(
|
|
3049
3061
|
"div",
|
|
3050
3062
|
{
|
|
3051
3063
|
style: { display: "flex" },
|
|
3052
3064
|
ref: c,
|
|
3053
|
-
onAnimationEnd:
|
|
3054
|
-
onKeyDown: (
|
|
3055
|
-
onKeyUp: (
|
|
3065
|
+
onAnimationEnd: io,
|
|
3066
|
+
onKeyDown: (R) => R.stopPropagation(),
|
|
3067
|
+
onKeyUp: (R) => R.stopPropagation(),
|
|
3056
3068
|
children: [
|
|
3057
|
-
/* @__PURE__ */
|
|
3058
|
-
|
|
3069
|
+
/* @__PURE__ */ k(
|
|
3070
|
+
so,
|
|
3059
3071
|
{
|
|
3060
3072
|
itemId: n,
|
|
3061
3073
|
state: a,
|
|
3062
|
-
ErrorComponent: ((
|
|
3063
|
-
children: /* @__PURE__ */
|
|
3074
|
+
ErrorComponent: ((w = d == null ? void 0 : d.error) == null ? void 0 : w.component) || oo,
|
|
3075
|
+
children: /* @__PURE__ */ k(S, { ...a, id: n, setState: O })
|
|
3064
3076
|
}
|
|
3065
3077
|
),
|
|
3066
|
-
/* @__PURE__ */
|
|
3067
|
-
/* @__PURE__ */
|
|
3068
|
-
/* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3071
|
-
f && /* @__PURE__ */ le(
|
|
3072
|
-
|
|
3073
|
-
|
|
3078
|
+
/* @__PURE__ */ k("div", { className: `corner ${xe} ${Gn}` }),
|
|
3079
|
+
/* @__PURE__ */ k("div", { className: `corner ${xe} ${Jn}` }),
|
|
3080
|
+
/* @__PURE__ */ k("div", { className: `corner ${xe} ${Qn}` }),
|
|
3081
|
+
/* @__PURE__ */ k("div", { className: `corner ${xe} ${Zn}` }),
|
|
3082
|
+
/* @__PURE__ */ k("div", { className: `center ${xe} ${eo}` }),
|
|
3083
|
+
f && /* @__PURE__ */ le(Vr, { children: [
|
|
3084
|
+
v.b && /* @__PURE__ */ k(
|
|
3085
|
+
st,
|
|
3074
3086
|
{
|
|
3075
|
-
className: `${
|
|
3076
|
-
onResize:
|
|
3087
|
+
className: `${it} ${no}`,
|
|
3088
|
+
onResize: m
|
|
3077
3089
|
}
|
|
3078
3090
|
),
|
|
3079
|
-
|
|
3080
|
-
|
|
3091
|
+
v.h && /* @__PURE__ */ k(
|
|
3092
|
+
st,
|
|
3081
3093
|
{
|
|
3082
|
-
className: `${
|
|
3083
|
-
onResize:
|
|
3094
|
+
className: `${it} ${ro}`,
|
|
3095
|
+
onResize: _
|
|
3084
3096
|
}
|
|
3085
3097
|
),
|
|
3086
|
-
|
|
3087
|
-
|
|
3098
|
+
v.w && /* @__PURE__ */ k(
|
|
3099
|
+
st,
|
|
3088
3100
|
{
|
|
3089
|
-
className: `${
|
|
3090
|
-
onResize:
|
|
3101
|
+
className: `${it} ${to}`,
|
|
3102
|
+
onResize: p
|
|
3091
3103
|
}
|
|
3092
3104
|
)
|
|
3093
3105
|
] })
|
|
@@ -3096,8 +3108,8 @@ const so = (e) => {
|
|
|
3096
3108
|
)
|
|
3097
3109
|
}
|
|
3098
3110
|
);
|
|
3099
|
-
},
|
|
3100
|
-
|
|
3111
|
+
}, lo = nr(
|
|
3112
|
+
uo,
|
|
3101
3113
|
({
|
|
3102
3114
|
state: e,
|
|
3103
3115
|
setState: t,
|
|
@@ -3108,18 +3120,18 @@ const so = (e) => {
|
|
|
3108
3120
|
setState: s,
|
|
3109
3121
|
isSelected: a,
|
|
3110
3122
|
showResizeHandle: u
|
|
3111
|
-
}) => r === a && n === u && t === s &&
|
|
3112
|
-
),
|
|
3123
|
+
}) => r === a && n === u && t === s && Nn(e, o)
|
|
3124
|
+
), fo = (e) => e, po = ({ state: e = {}, getCurrentUser: t, className: r, ...n }) => {
|
|
3113
3125
|
if (!n.itemMap[e.type])
|
|
3114
3126
|
return null;
|
|
3115
|
-
const { stateHook: o =
|
|
3127
|
+
const { stateHook: o = fo } = n.itemMap[e.type], {
|
|
3116
3128
|
x: s = 0,
|
|
3117
3129
|
y: a = 0,
|
|
3118
3130
|
layer: u = 0,
|
|
3119
3131
|
moving: l,
|
|
3120
3132
|
...d
|
|
3121
3133
|
} = o(e, { getCurrentUser: t }), f = (u + 4) * 10 + 100 + (l ? 5 : 0);
|
|
3122
|
-
return /* @__PURE__ */
|
|
3134
|
+
return /* @__PURE__ */ k(
|
|
3123
3135
|
"div",
|
|
3124
3136
|
{
|
|
3125
3137
|
className: r,
|
|
@@ -3127,8 +3139,8 @@ const so = (e) => {
|
|
|
3127
3139
|
transform: `translate(${s}px, ${a}px)`,
|
|
3128
3140
|
zIndex: f
|
|
3129
3141
|
},
|
|
3130
|
-
children: /* @__PURE__ */
|
|
3131
|
-
|
|
3142
|
+
children: /* @__PURE__ */ k(
|
|
3143
|
+
lo,
|
|
3132
3144
|
{
|
|
3133
3145
|
...n,
|
|
3134
3146
|
showResizeHandle: n.isSelected && n.showResizeHandle,
|
|
@@ -3137,11 +3149,11 @@ const so = (e) => {
|
|
|
3137
3149
|
)
|
|
3138
3150
|
}
|
|
3139
3151
|
);
|
|
3140
|
-
},
|
|
3141
|
-
const { updateItem: e } =
|
|
3152
|
+
}, mo = nr(po), go = () => {
|
|
3153
|
+
const { updateItem: e } = ht(), [t, r] = oe((d) => [
|
|
3142
3154
|
d.itemIds,
|
|
3143
3155
|
d.items
|
|
3144
|
-
]), [n, o, s, a] =
|
|
3156
|
+
]), [n, o, s, a] = Z(
|
|
3145
3157
|
(d) => [
|
|
3146
3158
|
d.config.boardSize,
|
|
3147
3159
|
d.config.showResizeHandle,
|
|
@@ -3155,8 +3167,8 @@ const so = (e) => {
|
|
|
3155
3167
|
display: "inline-block",
|
|
3156
3168
|
lineHeight: 0
|
|
3157
3169
|
});
|
|
3158
|
-
return t.map((d) => /* @__PURE__ */
|
|
3159
|
-
|
|
3170
|
+
return t.map((d) => /* @__PURE__ */ k(
|
|
3171
|
+
mo,
|
|
3160
3172
|
{
|
|
3161
3173
|
state: r[d],
|
|
3162
3174
|
setState: e,
|
|
@@ -3170,21 +3182,21 @@ const so = (e) => {
|
|
|
3170
3182
|
d
|
|
3171
3183
|
));
|
|
3172
3184
|
};
|
|
3173
|
-
function
|
|
3174
|
-
const t = Re(e), r =
|
|
3185
|
+
function ho(e = !1) {
|
|
3186
|
+
const t = Re(e), r = rr(() => t.current, []);
|
|
3175
3187
|
return Pe(() => (t.current = !0, () => {
|
|
3176
3188
|
t.current = !1;
|
|
3177
3189
|
}), []), r;
|
|
3178
3190
|
}
|
|
3179
|
-
function
|
|
3191
|
+
function vo(e, ...t) {
|
|
3180
3192
|
e && e.addEventListener && e.addEventListener(...t);
|
|
3181
3193
|
}
|
|
3182
|
-
function
|
|
3194
|
+
function yo(e, ...t) {
|
|
3183
3195
|
e && e.removeEventListener && e.removeEventListener(...t);
|
|
3184
3196
|
}
|
|
3185
|
-
const
|
|
3197
|
+
const So = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
|
|
3186
3198
|
function ue(e, ...t) {
|
|
3187
|
-
const r =
|
|
3199
|
+
const r = ho(), n = mt(t[1]), o = ft(
|
|
3188
3200
|
() => (
|
|
3189
3201
|
// as some event listeners designed to be used through `this`
|
|
3190
3202
|
// it is better to make listener a conventional function as it
|
|
@@ -3198,28 +3210,28 @@ function ue(e, ...t) {
|
|
|
3198
3210
|
[]
|
|
3199
3211
|
);
|
|
3200
3212
|
Pe(() => {
|
|
3201
|
-
const s = e &&
|
|
3213
|
+
const s = e && So(e, "current") ? e.current : e;
|
|
3202
3214
|
if (!s)
|
|
3203
3215
|
return;
|
|
3204
3216
|
const a = t.slice(2);
|
|
3205
|
-
return
|
|
3217
|
+
return vo(s, t[0], o, ...a), () => yo(s, t[0], o, ...a);
|
|
3206
3218
|
}, [e, t[0]]);
|
|
3207
3219
|
}
|
|
3208
|
-
const
|
|
3220
|
+
const _o = K({
|
|
3209
3221
|
zIndex: 210,
|
|
3210
3222
|
position: "absolute",
|
|
3211
3223
|
backgroundColor: "hsla(0, 40%, 50%, 10%)",
|
|
3212
3224
|
border: "2px solid hsl(0, 55%, 40%)"
|
|
3213
|
-
}),
|
|
3225
|
+
}), bo = (e, t, r = !1) => {
|
|
3214
3226
|
const n = t.getElementsByClassName("selector");
|
|
3215
3227
|
if (!n.length)
|
|
3216
3228
|
return [];
|
|
3217
3229
|
const o = n[0];
|
|
3218
3230
|
return Array.from(t.getElementsByClassName("item")).filter((s) => {
|
|
3219
3231
|
const a = Te(s), u = e[a];
|
|
3220
|
-
return !u || !r && u.locked ? !1 :
|
|
3232
|
+
return !u || !r && u.locked ? !1 : sn(s, o);
|
|
3221
3233
|
}).map((s) => Te(s));
|
|
3222
|
-
},
|
|
3234
|
+
}, Eo = ({ children: e, moveFirst: t }) => {
|
|
3223
3235
|
const [
|
|
3224
3236
|
r,
|
|
3225
3237
|
n,
|
|
@@ -3227,7 +3239,7 @@ const So = K({
|
|
|
3227
3239
|
s,
|
|
3228
3240
|
a,
|
|
3229
3241
|
u
|
|
3230
|
-
] =
|
|
3242
|
+
] = Z((m) => [
|
|
3231
3243
|
m.getSelection,
|
|
3232
3244
|
m.clear,
|
|
3233
3245
|
m.setSelection,
|
|
@@ -3235,7 +3247,7 @@ const So = K({
|
|
|
3235
3247
|
m.getConfiguration,
|
|
3236
3248
|
m.getBoardState,
|
|
3237
3249
|
m.updateBoardState
|
|
3238
|
-
]), { findElementUnderPointer: l } =
|
|
3250
|
+
]), { findElementUnderPointer: l } = ht(), [d] = oe((m) => [m.getItems]), [f, c] = g.useState({}), [, h] = g.useTransition(), [S, v] = g.useState(!1), E = g.useRef(null), O = g.useRef({
|
|
3239
3251
|
moving: !1
|
|
3240
3252
|
});
|
|
3241
3253
|
return ue(document, "keydown", (m) => {
|
|
@@ -3245,55 +3257,55 @@ const So = K({
|
|
|
3245
3257
|
}), g.useEffect(() => (n(), () => {
|
|
3246
3258
|
n();
|
|
3247
3259
|
}), [n]), g.useEffect(() => {
|
|
3248
|
-
if (
|
|
3249
|
-
const m = d(), { boardWrapper:
|
|
3260
|
+
if (O.current.moving) {
|
|
3261
|
+
const m = d(), { boardWrapper: w } = a(), R = bo(m, w, S);
|
|
3250
3262
|
h(() => {
|
|
3251
|
-
o(
|
|
3263
|
+
o(R);
|
|
3252
3264
|
});
|
|
3253
3265
|
}
|
|
3254
|
-
}, [a, d, f, o,
|
|
3266
|
+
}, [a, d, f, o, S]), /* @__PURE__ */ k(
|
|
3255
3267
|
Fe,
|
|
3256
3268
|
{
|
|
3257
3269
|
onDragStart: async (m) => {
|
|
3258
|
-
await l(m) || (
|
|
3270
|
+
await l(m) || (O.current.moving = !0, h(() => {
|
|
3259
3271
|
u({ selecting: !0 });
|
|
3260
3272
|
}), E.current.style.cursor = "crosshair");
|
|
3261
3273
|
},
|
|
3262
|
-
onDrag: ({ distanceY: m, distanceX:
|
|
3263
|
-
if (
|
|
3264
|
-
const { top:
|
|
3265
|
-
|
|
3274
|
+
onDrag: ({ distanceY: m, distanceX: w, startX: R, startY: T }) => {
|
|
3275
|
+
if (O.current.moving) {
|
|
3276
|
+
const { top: D, left: M } = E.current.getBoundingClientRect(), A = R - M, Y = T - D;
|
|
3277
|
+
w > 0 ? (O.current.left = A, O.current.width = w) : (O.current.left = A + w, O.current.width = -w), m > 0 ? (O.current.top = Y, O.current.height = m) : (O.current.top = Y + m, O.current.height = -m), c({ ...O.current, moving: !0 });
|
|
3266
3278
|
}
|
|
3267
3279
|
},
|
|
3268
3280
|
onDragEnd: () => {
|
|
3269
|
-
|
|
3281
|
+
O.current.moving && (h(() => {
|
|
3270
3282
|
u({ selecting: !1 });
|
|
3271
|
-
}),
|
|
3283
|
+
}), O.current.moving = !1, c({ moving: !1 }), E.current.style.cursor = "auto");
|
|
3272
3284
|
},
|
|
3273
3285
|
onTap: (m) => {
|
|
3274
|
-
const { target:
|
|
3275
|
-
if (!
|
|
3286
|
+
const { target: w, ctrlKey: R, metaKey: T } = m, D = l(m);
|
|
3287
|
+
if (!D && Oe(w, "board"))
|
|
3276
3288
|
n();
|
|
3277
3289
|
else {
|
|
3278
|
-
const M = Te(
|
|
3290
|
+
const M = Te(D);
|
|
3279
3291
|
if (!M) {
|
|
3280
3292
|
n();
|
|
3281
3293
|
return;
|
|
3282
3294
|
}
|
|
3283
3295
|
const A = r();
|
|
3284
|
-
|
|
3296
|
+
D && !A.includes(M) && (R || T ? s([M]) : o([M]));
|
|
3285
3297
|
}
|
|
3286
3298
|
},
|
|
3287
3299
|
onLongTap: ({ target: m }) => {
|
|
3288
|
-
const
|
|
3289
|
-
if (
|
|
3290
|
-
const
|
|
3291
|
-
o([
|
|
3300
|
+
const w = Oe(m, "item");
|
|
3301
|
+
if (w) {
|
|
3302
|
+
const R = Te(w);
|
|
3303
|
+
o([R]);
|
|
3292
3304
|
}
|
|
3293
3305
|
},
|
|
3294
3306
|
mainAction: t ? "pan" : "drag",
|
|
3295
3307
|
children: /* @__PURE__ */ le("div", { ref: E, children: [
|
|
3296
|
-
f.moving && /* @__PURE__ */
|
|
3308
|
+
f.moving && /* @__PURE__ */ k(
|
|
3297
3309
|
"div",
|
|
3298
3310
|
{
|
|
3299
3311
|
style: {
|
|
@@ -3301,15 +3313,15 @@ const So = K({
|
|
|
3301
3313
|
height: `${f.height}px`,
|
|
3302
3314
|
width: `${f.width}px`
|
|
3303
3315
|
},
|
|
3304
|
-
className: `selector ${
|
|
3316
|
+
className: `selector ${_o}`
|
|
3305
3317
|
}
|
|
3306
3318
|
),
|
|
3307
3319
|
e
|
|
3308
3320
|
] })
|
|
3309
3321
|
}
|
|
3310
3322
|
);
|
|
3311
|
-
},
|
|
3312
|
-
const { moveItems: t, placeItems: r, findElementUnderPointer: n } =
|
|
3323
|
+
}, wo = ({ children: e }) => {
|
|
3324
|
+
const { moveItems: t, placeItems: r, findElementUnderPointer: n } = ht(), { vectorFromWrapperToBoard: o } = Me(), [s, a, u, l, d] = Z((y) => [
|
|
3313
3325
|
y.select,
|
|
3314
3326
|
y.setSelection,
|
|
3315
3327
|
y.getSelection,
|
|
@@ -3317,25 +3329,25 @@ const So = K({
|
|
|
3317
3329
|
y.updateBoardState
|
|
3318
3330
|
]), [f] = oe((y) => [y.getBoardConfig]), c = g.useRef({}), h = g.useRef({
|
|
3319
3331
|
items: []
|
|
3320
|
-
}),
|
|
3321
|
-
const { ctrlKey:
|
|
3322
|
-
if (
|
|
3332
|
+
}), S = (y) => {
|
|
3333
|
+
const { ctrlKey: x, metaKey: C, event: p } = y, _ = n(y);
|
|
3334
|
+
if (_) {
|
|
3323
3335
|
p.stopPropagation();
|
|
3324
3336
|
const m = u();
|
|
3325
3337
|
h.current.items = m;
|
|
3326
|
-
const
|
|
3327
|
-
m.includes(
|
|
3338
|
+
const w = Te(_);
|
|
3339
|
+
m.includes(w) || (x || C ? (h.current.items = [...m, w], s([w])) : (h.current.items = [w], a([w]))), Object.assign(c.current, {
|
|
3328
3340
|
moving: !0
|
|
3329
3341
|
});
|
|
3330
3342
|
}
|
|
3331
|
-
}, v = ({ deltaX: y, deltaY:
|
|
3343
|
+
}, v = ({ deltaX: y, deltaY: x, event: C }) => {
|
|
3332
3344
|
if (c.current.moving) {
|
|
3333
|
-
|
|
3334
|
-
const { movingItems: p } = l(), [
|
|
3345
|
+
C.stopPropagation();
|
|
3346
|
+
const { movingItems: p } = l(), [_, m] = o(y, x);
|
|
3335
3347
|
t(
|
|
3336
3348
|
h.current.items,
|
|
3337
3349
|
{
|
|
3338
|
-
x:
|
|
3350
|
+
x: _,
|
|
3339
3351
|
y: m
|
|
3340
3352
|
},
|
|
3341
3353
|
!0
|
|
@@ -3343,20 +3355,20 @@ const So = K({
|
|
|
3343
3355
|
}
|
|
3344
3356
|
}, E = () => {
|
|
3345
3357
|
if (c.current.moving) {
|
|
3346
|
-
const { gridSize: y = 1 } = f(),
|
|
3358
|
+
const { gridSize: y = 1 } = f(), x = y || 1;
|
|
3347
3359
|
c.current = { moving: !1 }, r(h.current.items, {
|
|
3348
3360
|
type: "grid",
|
|
3349
|
-
size:
|
|
3361
|
+
size: x
|
|
3350
3362
|
}), d({ movingItems: !1 });
|
|
3351
3363
|
}
|
|
3352
3364
|
};
|
|
3353
3365
|
return ue(document, "keydown", (y) => {
|
|
3354
3366
|
if (["INPUT", "TEXTAREA"].includes(y.target.tagName))
|
|
3355
3367
|
return;
|
|
3356
|
-
const
|
|
3357
|
-
if (
|
|
3358
|
-
const { gridSize:
|
|
3359
|
-
let p = 0,
|
|
3368
|
+
const x = u();
|
|
3369
|
+
if (x.length) {
|
|
3370
|
+
const { gridSize: C = 1 } = f();
|
|
3371
|
+
let p = 0, _ = 0;
|
|
3360
3372
|
switch (y.key) {
|
|
3361
3373
|
case "ArrowLeft":
|
|
3362
3374
|
p = -10;
|
|
@@ -3365,30 +3377,30 @@ const So = K({
|
|
|
3365
3377
|
p = 10;
|
|
3366
3378
|
break;
|
|
3367
3379
|
case "ArrowUp":
|
|
3368
|
-
|
|
3380
|
+
_ = -10;
|
|
3369
3381
|
break;
|
|
3370
3382
|
case "ArrowDown":
|
|
3371
|
-
|
|
3383
|
+
_ = 10;
|
|
3372
3384
|
break;
|
|
3373
3385
|
}
|
|
3374
|
-
if (p ||
|
|
3375
|
-
y.shiftKey && (p *= 5,
|
|
3376
|
-
const [m,
|
|
3386
|
+
if (p || _) {
|
|
3387
|
+
y.shiftKey && (p *= 5, _ *= 5), (y.ctrlKey || y.altKey || y.metaKey) && (p /= 10, _ /= 10);
|
|
3388
|
+
const [m, w] = o(p, _);
|
|
3377
3389
|
t(
|
|
3378
|
-
|
|
3390
|
+
x,
|
|
3379
3391
|
{
|
|
3380
3392
|
x: m,
|
|
3381
|
-
y:
|
|
3393
|
+
y: w
|
|
3382
3394
|
},
|
|
3383
3395
|
!0
|
|
3384
|
-
), r(
|
|
3396
|
+
), r(x, {
|
|
3385
3397
|
type: "grid",
|
|
3386
|
-
size:
|
|
3398
|
+
size: C || 1
|
|
3387
3399
|
}), y.preventDefault();
|
|
3388
3400
|
}
|
|
3389
3401
|
}
|
|
3390
|
-
}), /* @__PURE__ */
|
|
3391
|
-
},
|
|
3402
|
+
}), /* @__PURE__ */ k(Fe, { onDragStart: S, onDrag: v, onDragEnd: E, children: e });
|
|
3403
|
+
}, xo = (e) => {
|
|
3392
3404
|
const t = g.useRef({ hover: !1, x: 0, y: 0 });
|
|
3393
3405
|
return ue(e.current, "mousemove", (n) => {
|
|
3394
3406
|
const { clientX: o, clientY: s } = n;
|
|
@@ -3398,8 +3410,8 @@ const So = K({
|
|
|
3398
3410
|
}), ue(e.current, "mouseleave", () => {
|
|
3399
3411
|
t.current.hover = !1;
|
|
3400
3412
|
}), g.useCallback(() => t.current, []);
|
|
3401
|
-
}, Co = [...Array(5).keys()].map((e) => `Digit${e + 1}`),
|
|
3402
|
-
const [e, t] = g.useState({}), [r, n] =
|
|
3413
|
+
}, Co = [...Array(5).keys()].map((e) => `Digit${e + 1}`), Ro = () => {
|
|
3414
|
+
const [e, t] = g.useState({}), [r, n] = Z((o) => [
|
|
3403
3415
|
o.getBoardState,
|
|
3404
3416
|
o.updateBoardState
|
|
3405
3417
|
]);
|
|
@@ -3412,14 +3424,14 @@ const So = K({
|
|
|
3412
3424
|
})) : e[s] && n(e[s]), o.preventDefault();
|
|
3413
3425
|
}
|
|
3414
3426
|
}), null;
|
|
3415
|
-
},
|
|
3427
|
+
}, Io = ({ children: e, moveFirst: t = !1 }) => {
|
|
3416
3428
|
const r = g.useRef(null), [
|
|
3417
3429
|
n,
|
|
3418
3430
|
o,
|
|
3419
3431
|
s,
|
|
3420
3432
|
a,
|
|
3421
3433
|
u
|
|
3422
|
-
] =
|
|
3434
|
+
] = Z((p) => [
|
|
3423
3435
|
{
|
|
3424
3436
|
translateX: p.boardState.translateX,
|
|
3425
3437
|
translateY: p.boardState.translateY,
|
|
@@ -3430,8 +3442,8 @@ const So = K({
|
|
|
3430
3442
|
p.getConfiguration,
|
|
3431
3443
|
p.updateBoardState,
|
|
3432
3444
|
p.getSelection
|
|
3433
|
-
]), { zoomToCenter: l, zoomToExtent: d, moveBoard: f } = Me(), [c, h] = g.useState(!1),
|
|
3434
|
-
|
|
3445
|
+
]), { zoomToCenter: l, zoomToExtent: d, moveBoard: f } = Me(), [c, h] = g.useState(!1), S = g.useRef({}), v = xo(r);
|
|
3446
|
+
Ro();
|
|
3435
3447
|
const E = g.useCallback(() => {
|
|
3436
3448
|
const { itemExtent: p } = s();
|
|
3437
3449
|
d(p);
|
|
@@ -3439,27 +3451,27 @@ const So = K({
|
|
|
3439
3451
|
g.useEffect(() => {
|
|
3440
3452
|
!c && o.radius && (E(), h(!0));
|
|
3441
3453
|
}, [E, c, o]);
|
|
3442
|
-
const
|
|
3443
|
-
l({ to: { x: p, y:
|
|
3454
|
+
const O = ({ clientX: p, clientY: _, scale: m }) => {
|
|
3455
|
+
l({ to: { x: p, y: _ }, factor: 1 - m / 500 }), clearTimeout(S.current.zoom), S.current.zoom = setTimeout(() => {
|
|
3444
3456
|
a({ zooming: !1 });
|
|
3445
3457
|
}, 200), a({ zooming: !0 });
|
|
3446
|
-
}, y = ({ deltaX: p, deltaY:
|
|
3447
|
-
f(({ translateX: m, translateY:
|
|
3458
|
+
}, y = ({ deltaX: p, deltaY: _ }) => {
|
|
3459
|
+
f(({ translateX: m, translateY: w }) => ({
|
|
3448
3460
|
translateX: m + p,
|
|
3449
|
-
translateY:
|
|
3450
|
-
})), clearTimeout(
|
|
3461
|
+
translateY: w + _
|
|
3462
|
+
})), clearTimeout(S.current.pan), S.current.pan = setTimeout(() => {
|
|
3451
3463
|
a({ panning: !1 });
|
|
3452
3464
|
}, 200), a({ panning: !0 });
|
|
3453
|
-
},
|
|
3465
|
+
}, x = (p) => {
|
|
3454
3466
|
if (["INPUT", "TEXTAREA"].includes(p.target.tagName))
|
|
3455
3467
|
return;
|
|
3456
|
-
let
|
|
3468
|
+
let _ = 0, m = 0, w = 1;
|
|
3457
3469
|
switch (p.key) {
|
|
3458
3470
|
case "ArrowLeft":
|
|
3459
|
-
|
|
3471
|
+
_ = -10;
|
|
3460
3472
|
break;
|
|
3461
3473
|
case "ArrowRight":
|
|
3462
|
-
|
|
3474
|
+
_ = 10;
|
|
3463
3475
|
break;
|
|
3464
3476
|
case "ArrowUp":
|
|
3465
3477
|
m = -10;
|
|
@@ -3468,32 +3480,32 @@ const So = K({
|
|
|
3468
3480
|
m = 10;
|
|
3469
3481
|
break;
|
|
3470
3482
|
case "PageUp":
|
|
3471
|
-
|
|
3483
|
+
w = 1.2;
|
|
3472
3484
|
break;
|
|
3473
3485
|
case "PageDown":
|
|
3474
|
-
|
|
3486
|
+
w = 0.8;
|
|
3475
3487
|
break;
|
|
3476
3488
|
}
|
|
3477
|
-
if (
|
|
3478
|
-
const
|
|
3479
|
-
if (
|
|
3489
|
+
if (_ || m || w !== 1) {
|
|
3490
|
+
const R = u();
|
|
3491
|
+
if (w === 1 && R.length)
|
|
3480
3492
|
return;
|
|
3481
|
-
p.shiftKey && (
|
|
3482
|
-
translateX:
|
|
3483
|
-
translateY:
|
|
3484
|
-
})), l({ factor:
|
|
3493
|
+
p.shiftKey && (_ *= 5, m *= 5), (p.ctrlKey || p.altKey || p.metaKey) && (_ /= 5, m /= 5), f(({ translateX: T, translateY: D }) => ({
|
|
3494
|
+
translateX: T + _,
|
|
3495
|
+
translateY: D + m
|
|
3496
|
+
})), l({ factor: w }), p.preventDefault();
|
|
3485
3497
|
}
|
|
3486
3498
|
p.key === " " && !p.repeat && v().hover && l({ factor: 3, to: v() });
|
|
3487
|
-
},
|
|
3499
|
+
}, C = (p) => {
|
|
3488
3500
|
["INPUT", "TEXTAREA"].includes(p.target.tagName) || p.key === " " && v().hover && l({ factor: 1 / 3, to: v() });
|
|
3489
3501
|
};
|
|
3490
|
-
return ue(document, "keydown",
|
|
3502
|
+
return ue(document, "keydown", x), ue(document, "keyup", C), /* @__PURE__ */ k(
|
|
3491
3503
|
Fe,
|
|
3492
3504
|
{
|
|
3493
3505
|
onPan: y,
|
|
3494
|
-
onZoom:
|
|
3506
|
+
onZoom: O,
|
|
3495
3507
|
mainAction: t ? "pan" : "drag",
|
|
3496
|
-
children: /* @__PURE__ */
|
|
3508
|
+
children: /* @__PURE__ */ k(
|
|
3497
3509
|
"div",
|
|
3498
3510
|
{
|
|
3499
3511
|
style: {
|
|
@@ -3508,7 +3520,7 @@ const So = K({
|
|
|
3508
3520
|
)
|
|
3509
3521
|
}
|
|
3510
3522
|
);
|
|
3511
|
-
},
|
|
3523
|
+
}, Oo = K({
|
|
3512
3524
|
position: "absolute",
|
|
3513
3525
|
top: 0,
|
|
3514
3526
|
left: 0,
|
|
@@ -3516,7 +3528,7 @@ const So = K({
|
|
|
3516
3528
|
backgroundColor: "hsla(0, 40%, 50%, 0%)",
|
|
3517
3529
|
border: "2px dashed hsl(20, 55%, 40%)",
|
|
3518
3530
|
pointerEvents: "none"
|
|
3519
|
-
}),
|
|
3531
|
+
}), To = () => {
|
|
3520
3532
|
const [
|
|
3521
3533
|
e,
|
|
3522
3534
|
t,
|
|
@@ -3524,7 +3536,7 @@ const So = K({
|
|
|
3524
3536
|
n,
|
|
3525
3537
|
o,
|
|
3526
3538
|
{ translateX: s, translateY: a, scale: u }
|
|
3527
|
-
] =
|
|
3539
|
+
] = Z((c) => [
|
|
3528
3540
|
c.selection,
|
|
3529
3541
|
c.getSelection,
|
|
3530
3542
|
c.selectionBox,
|
|
@@ -3536,24 +3548,24 @@ const So = K({
|
|
|
3536
3548
|
scale: c.boardState.scale
|
|
3537
3549
|
}
|
|
3538
3550
|
]), [l] = oe((c) => [c.items]), d = g.useCallback(() => {
|
|
3539
|
-
const c = t(), { boardWrapperRect: h,
|
|
3551
|
+
const c = t(), { boardWrapperRect: h, uid: S } = o();
|
|
3540
3552
|
if (c.length === 0) {
|
|
3541
3553
|
n(null);
|
|
3542
3554
|
return;
|
|
3543
3555
|
}
|
|
3544
|
-
const v =
|
|
3556
|
+
const v = an(c, S);
|
|
3545
3557
|
if (!v) {
|
|
3546
3558
|
n(null);
|
|
3547
3559
|
return;
|
|
3548
3560
|
}
|
|
3549
|
-
const { left: E, top:
|
|
3561
|
+
const { left: E, top: O, width: y, height: x } = v, C = {
|
|
3550
3562
|
left: E - h.left,
|
|
3551
|
-
top:
|
|
3552
|
-
height:
|
|
3563
|
+
top: O - h.top,
|
|
3564
|
+
height: x,
|
|
3553
3565
|
width: y
|
|
3554
3566
|
};
|
|
3555
|
-
n(
|
|
3556
|
-
}, [o, t, n]), f =
|
|
3567
|
+
n(C);
|
|
3568
|
+
}, [o, t, n]), f = gt(d, [d], 300);
|
|
3557
3569
|
return g.useEffect(() => {
|
|
3558
3570
|
d(), f();
|
|
3559
3571
|
}, [
|
|
@@ -3564,7 +3576,7 @@ const So = K({
|
|
|
3564
3576
|
u,
|
|
3565
3577
|
d,
|
|
3566
3578
|
f
|
|
3567
|
-
]), !r || e.length < 2 ? null : /* @__PURE__ */
|
|
3579
|
+
]), !r || e.length < 2 ? null : /* @__PURE__ */ k(
|
|
3568
3580
|
"div",
|
|
3569
3581
|
{
|
|
3570
3582
|
style: {
|
|
@@ -3572,16 +3584,16 @@ const So = K({
|
|
|
3572
3584
|
height: `${r.height}px`,
|
|
3573
3585
|
width: `${r.width}px`
|
|
3574
3586
|
},
|
|
3575
|
-
className: `selection ${
|
|
3587
|
+
className: `selection ${Oo}`
|
|
3576
3588
|
}
|
|
3577
3589
|
);
|
|
3578
|
-
},
|
|
3579
|
-
const [e] =
|
|
3580
|
-
return e ? null : /* @__PURE__ */
|
|
3581
|
-
},
|
|
3590
|
+
}, ko = () => {
|
|
3591
|
+
const [e] = Z((t) => [t.boardState.movingItems]);
|
|
3592
|
+
return e ? null : /* @__PURE__ */ k(To, {});
|
|
3593
|
+
}, Po = typeof window < "u" && typeof navigator < "u" && typeof document < "u";
|
|
3582
3594
|
let Le;
|
|
3583
|
-
function
|
|
3584
|
-
if (!
|
|
3595
|
+
function Mo() {
|
|
3596
|
+
if (!Po)
|
|
3585
3597
|
return;
|
|
3586
3598
|
if (Le)
|
|
3587
3599
|
return Le;
|
|
@@ -3603,8 +3615,8 @@ function Po() {
|
|
|
3603
3615
|
}
|
|
3604
3616
|
}, Le;
|
|
3605
3617
|
}
|
|
3606
|
-
function
|
|
3607
|
-
const n = r &&
|
|
3618
|
+
function Do(e, t, r = !0) {
|
|
3619
|
+
const n = r && Mo(), o = mt(t), s = e && "current" in e ? e.current : e;
|
|
3608
3620
|
Pe(() => {
|
|
3609
3621
|
const a = e && "current" in e ? e.current : e;
|
|
3610
3622
|
if (!n || !a)
|
|
@@ -3618,7 +3630,7 @@ function Mo(e, t, r = !0) {
|
|
|
3618
3630
|
};
|
|
3619
3631
|
}, [s, n]);
|
|
3620
3632
|
}
|
|
3621
|
-
function
|
|
3633
|
+
function Qt(e, t, r) {
|
|
3622
3634
|
return Math.min(Math.max(e, r), t);
|
|
3623
3635
|
}
|
|
3624
3636
|
class jo extends Error {
|
|
@@ -3626,89 +3638,89 @@ class jo extends Error {
|
|
|
3626
3638
|
super(`Failed to parse color: "${t}"`);
|
|
3627
3639
|
}
|
|
3628
3640
|
}
|
|
3629
|
-
var
|
|
3630
|
-
function
|
|
3641
|
+
var Ce = jo;
|
|
3642
|
+
function $o(e) {
|
|
3631
3643
|
if (typeof e != "string")
|
|
3632
|
-
throw new
|
|
3644
|
+
throw new Ce(e);
|
|
3633
3645
|
if (e.trim().toLowerCase() === "transparent")
|
|
3634
3646
|
return [0, 0, 0, 0];
|
|
3635
3647
|
let t = e.trim();
|
|
3636
|
-
t =
|
|
3637
|
-
const r =
|
|
3648
|
+
t = Uo.test(e) ? zo(e) : e;
|
|
3649
|
+
const r = Yo.exec(t);
|
|
3638
3650
|
if (r) {
|
|
3639
3651
|
const a = Array.from(r).slice(1);
|
|
3640
3652
|
return [...a.slice(0, 3).map((u) => parseInt(ke(u, 2), 16)), parseInt(ke(a[3] || "f", 2), 16) / 255];
|
|
3641
3653
|
}
|
|
3642
|
-
const n =
|
|
3654
|
+
const n = Bo.exec(t);
|
|
3643
3655
|
if (n) {
|
|
3644
3656
|
const a = Array.from(n).slice(1);
|
|
3645
3657
|
return [...a.slice(0, 3).map((u) => parseInt(u, 16)), parseInt(a[3] || "ff", 16) / 255];
|
|
3646
3658
|
}
|
|
3647
|
-
const o =
|
|
3659
|
+
const o = No.exec(t);
|
|
3648
3660
|
if (o) {
|
|
3649
3661
|
const a = Array.from(o).slice(1);
|
|
3650
3662
|
return [...a.slice(0, 3).map((u) => parseInt(u, 10)), parseFloat(a[3] || "1")];
|
|
3651
3663
|
}
|
|
3652
|
-
const s =
|
|
3664
|
+
const s = Xo.exec(t);
|
|
3653
3665
|
if (s) {
|
|
3654
3666
|
const [a, u, l, d] = Array.from(s).slice(1).map(parseFloat);
|
|
3655
|
-
if (
|
|
3656
|
-
throw new
|
|
3657
|
-
if (
|
|
3658
|
-
throw new
|
|
3659
|
-
return [...
|
|
3667
|
+
if (Qt(0, 100, u) !== u)
|
|
3668
|
+
throw new Ce(e);
|
|
3669
|
+
if (Qt(0, 100, l) !== l)
|
|
3670
|
+
throw new Ce(e);
|
|
3671
|
+
return [...Wo(a, u, l), Number.isNaN(d) ? 1 : d];
|
|
3660
3672
|
}
|
|
3661
|
-
throw new
|
|
3673
|
+
throw new Ce(e);
|
|
3662
3674
|
}
|
|
3663
|
-
function
|
|
3675
|
+
function Ao(e) {
|
|
3664
3676
|
let t = 5381, r = e.length;
|
|
3665
3677
|
for (; r; )
|
|
3666
3678
|
t = t * 33 ^ e.charCodeAt(--r);
|
|
3667
3679
|
return (t >>> 0) % 2341;
|
|
3668
3680
|
}
|
|
3669
|
-
const
|
|
3670
|
-
const r =
|
|
3681
|
+
const er = (e) => parseInt(e.replace(/_/g, ""), 36), Lo = "1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e, t) => {
|
|
3682
|
+
const r = er(t.substring(0, 3)), n = er(t.substring(3)).toString(16);
|
|
3671
3683
|
let o = "";
|
|
3672
3684
|
for (let s = 0; s < 6 - n.length; s++)
|
|
3673
3685
|
o += "0";
|
|
3674
3686
|
return e[r] = `${o}${n}`, e;
|
|
3675
3687
|
}, {});
|
|
3676
|
-
function
|
|
3677
|
-
const t = e.toLowerCase().trim(), r = Ao
|
|
3688
|
+
function zo(e) {
|
|
3689
|
+
const t = e.toLowerCase().trim(), r = Lo[Ao(t)];
|
|
3678
3690
|
if (!r)
|
|
3679
|
-
throw new
|
|
3691
|
+
throw new Ce(e);
|
|
3680
3692
|
return `#${r}`;
|
|
3681
3693
|
}
|
|
3682
|
-
const ke = (e, t) => Array.from(Array(t)).map(() => e).join(""),
|
|
3694
|
+
const ke = (e, t) => Array.from(Array(t)).map(() => e).join(""), Yo = new RegExp(`^#${ke("([a-f0-9])", 3)}([a-f0-9])?$`, "i"), Bo = new RegExp(`^#${ke("([a-f0-9]{2})", 3)}([a-f0-9]{2})?$`, "i"), No = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${ke(",\\s*(\\d+)\\s*", 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, "i"), Xo = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i, Uo = /^[a-z]+$/i, tr = (e) => Math.round(e * 255), Wo = (e, t, r) => {
|
|
3683
3695
|
let n = r / 100;
|
|
3684
3696
|
if (t === 0)
|
|
3685
|
-
return [n, n, n].map(
|
|
3697
|
+
return [n, n, n].map(tr);
|
|
3686
3698
|
const o = (e % 360 + 360) % 360 / 60, s = (1 - Math.abs(2 * n - 1)) * (t / 100), a = s * (1 - Math.abs(o % 2 - 1));
|
|
3687
3699
|
let u = 0, l = 0, d = 0;
|
|
3688
3700
|
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);
|
|
3689
|
-
const f = n - s / 2, c = u + f, h = l + f,
|
|
3690
|
-
return [c, h,
|
|
3701
|
+
const f = n - s / 2, c = u + f, h = l + f, S = d + f;
|
|
3702
|
+
return [c, h, S].map(tr);
|
|
3691
3703
|
};
|
|
3692
|
-
function
|
|
3704
|
+
function Vo(e) {
|
|
3693
3705
|
if (e === "transparent")
|
|
3694
3706
|
return 0;
|
|
3695
3707
|
function t(s) {
|
|
3696
3708
|
const a = s / 255;
|
|
3697
3709
|
return a <= 0.03928 ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4);
|
|
3698
3710
|
}
|
|
3699
|
-
const [r, n, o] =
|
|
3711
|
+
const [r, n, o] = $o(e);
|
|
3700
3712
|
return 0.2126 * t(r) + 0.7152 * t(n) + 0.0722 * t(o);
|
|
3701
3713
|
}
|
|
3702
|
-
function
|
|
3703
|
-
return
|
|
3714
|
+
function Fo(e) {
|
|
3715
|
+
return Vo(e) > 0.179;
|
|
3704
3716
|
}
|
|
3705
|
-
const
|
|
3717
|
+
const Ko = K({
|
|
3706
3718
|
display: "flex",
|
|
3707
3719
|
flexDirection: "row",
|
|
3708
3720
|
alignItems: "center",
|
|
3709
3721
|
zIndex: 210,
|
|
3710
3722
|
pointerEvents: "none"
|
|
3711
|
-
}),
|
|
3723
|
+
}), Ho = K({
|
|
3712
3724
|
fontWeight: "bold",
|
|
3713
3725
|
padding: "0 0.5em",
|
|
3714
3726
|
borderRadius: "2px",
|
|
@@ -3719,9 +3731,9 @@ const Fo = K({
|
|
|
3719
3731
|
marginTop: "1.7em",
|
|
3720
3732
|
whitespace: "nowrap",
|
|
3721
3733
|
pointerEvents: "none"
|
|
3722
|
-
}),
|
|
3723
|
-
const n =
|
|
3724
|
-
return /* @__PURE__ */ le("div", { className:
|
|
3734
|
+
}), qo = ({ color: e = "#666", size: t = 40, text: r }) => {
|
|
3735
|
+
const n = Fo(e) ? "#222" : "#EEE";
|
|
3736
|
+
return /* @__PURE__ */ le("div", { className: Ko, children: [
|
|
3725
3737
|
/* @__PURE__ */ le(
|
|
3726
3738
|
"svg",
|
|
3727
3739
|
{
|
|
@@ -3731,7 +3743,7 @@ const Fo = K({
|
|
|
3731
3743
|
width: t,
|
|
3732
3744
|
height: t,
|
|
3733
3745
|
children: [
|
|
3734
|
-
/* @__PURE__ */
|
|
3746
|
+
/* @__PURE__ */ k(
|
|
3735
3747
|
"path",
|
|
3736
3748
|
{
|
|
3737
3749
|
d: "m 1197.1015,869.718 -62.2719,-154.49286 133.3276,-9.05842 -257.6915,-253.12748 1.2392,356.98609 88.2465,-79.47087 61.702,152.78366 z",
|
|
@@ -3740,7 +3752,7 @@ const Fo = K({
|
|
|
3740
3752
|
}
|
|
3741
3753
|
}
|
|
3742
3754
|
),
|
|
3743
|
-
/* @__PURE__ */
|
|
3755
|
+
/* @__PURE__ */ k(
|
|
3744
3756
|
"path",
|
|
3745
3757
|
{
|
|
3746
3758
|
d: "m 1193.0939,861.12419 -62.2719,-154.49286 133.3276,-9.05842 -257.6915,-253.12748 1.2392,356.98609 88.2465,-79.47087 61.702,152.78366 z",
|
|
@@ -3754,35 +3766,35 @@ const Fo = K({
|
|
|
3754
3766
|
]
|
|
3755
3767
|
}
|
|
3756
3768
|
),
|
|
3757
|
-
/* @__PURE__ */
|
|
3769
|
+
/* @__PURE__ */ k(
|
|
3758
3770
|
"div",
|
|
3759
3771
|
{
|
|
3760
3772
|
style: {
|
|
3761
3773
|
color: n,
|
|
3762
3774
|
backgroundColor: e
|
|
3763
3775
|
},
|
|
3764
|
-
className:
|
|
3776
|
+
className: Ho,
|
|
3765
3777
|
children: r
|
|
3766
3778
|
}
|
|
3767
3779
|
)
|
|
3768
3780
|
] });
|
|
3769
|
-
},
|
|
3781
|
+
}, Go = g.memo(qo), Jo = K({
|
|
3770
3782
|
top: 0,
|
|
3771
3783
|
left: 0,
|
|
3772
3784
|
zIndex: 210,
|
|
3773
3785
|
position: "fixed",
|
|
3774
3786
|
pointerEvents: "none"
|
|
3775
|
-
}),
|
|
3787
|
+
}), Zo = ({ pos: e, ...t }) => /* @__PURE__ */ k(
|
|
3776
3788
|
"div",
|
|
3777
3789
|
{
|
|
3778
|
-
className:
|
|
3790
|
+
className: Jo,
|
|
3779
3791
|
style: {
|
|
3780
3792
|
transform: `translate(${e.x - 6}px, ${e.y - 15}px)`
|
|
3781
3793
|
},
|
|
3782
|
-
children: /* @__PURE__ */
|
|
3794
|
+
children: /* @__PURE__ */ k(Go, { ...t })
|
|
3783
3795
|
}
|
|
3784
|
-
),
|
|
3785
|
-
const [t] =
|
|
3796
|
+
), Qo = ({ children: e }) => {
|
|
3797
|
+
const [t] = Z((v) => [
|
|
3786
3798
|
v.getConfiguration,
|
|
3787
3799
|
v.boardState.scale
|
|
3788
3800
|
// We want to update this component when the scale changes
|
|
@@ -3797,25 +3809,25 @@ const Fo = K({
|
|
|
3797
3809
|
v.moveCursor,
|
|
3798
3810
|
v.removeCursor
|
|
3799
3811
|
]), { boardWrapperRect: f } = t(), c = ({ clientX: v, clientY: E }) => {
|
|
3800
|
-
const [
|
|
3812
|
+
const [O, y] = r(
|
|
3801
3813
|
v - f.left,
|
|
3802
3814
|
E - f.top
|
|
3803
3815
|
);
|
|
3804
|
-
l(o.id, { x:
|
|
3816
|
+
l(o.id, { x: O, y });
|
|
3805
3817
|
}, h = () => {
|
|
3806
3818
|
d(o.id);
|
|
3807
|
-
},
|
|
3819
|
+
}, S = s.reduce((v, E) => (E.id !== o.id && a[E.id] && (v[E.id] = a[E.id]), v), {});
|
|
3808
3820
|
return /* @__PURE__ */ le("div", { onPointerMove: c, onPointerLeave: h, children: [
|
|
3809
3821
|
e,
|
|
3810
|
-
Object.entries(
|
|
3811
|
-
const [
|
|
3812
|
-
x:
|
|
3822
|
+
Object.entries(S).map(([v, E]) => {
|
|
3823
|
+
const [O, y] = n(E.x, E.y), x = {
|
|
3824
|
+
x: O + f.left,
|
|
3813
3825
|
y: y + f.top
|
|
3814
3826
|
};
|
|
3815
|
-
return
|
|
3816
|
-
|
|
3827
|
+
return dt(x, f) ? /* @__PURE__ */ k(
|
|
3828
|
+
Zo,
|
|
3817
3829
|
{
|
|
3818
|
-
pos:
|
|
3830
|
+
pos: x,
|
|
3819
3831
|
text: u[v].name,
|
|
3820
3832
|
color: u[v].color
|
|
3821
3833
|
},
|
|
@@ -3823,21 +3835,21 @@ const Fo = K({
|
|
|
3823
3835
|
) : null;
|
|
3824
3836
|
})
|
|
3825
3837
|
] });
|
|
3826
|
-
},
|
|
3838
|
+
}, es = ({ children: e }) => e, ts = {
|
|
3827
3839
|
overflow: "hidden",
|
|
3828
3840
|
position: "absolute",
|
|
3829
3841
|
inset: 0
|
|
3830
|
-
},
|
|
3842
|
+
}, vs = ({
|
|
3831
3843
|
moveFirst: e = !0,
|
|
3832
3844
|
style: t,
|
|
3833
3845
|
wrapperStyle: r,
|
|
3834
3846
|
itemTemplates: n = {},
|
|
3835
|
-
boardSize: o =
|
|
3847
|
+
boardSize: o = ur,
|
|
3836
3848
|
children: s,
|
|
3837
3849
|
showResizeHandle: a = !1,
|
|
3838
|
-
Wrapper: u =
|
|
3850
|
+
Wrapper: u = es
|
|
3839
3851
|
}) => {
|
|
3840
|
-
const l = g.useRef(null), [d, f] =
|
|
3852
|
+
const l = g.useRef(null), [d, f] = Z((v) => [
|
|
3841
3853
|
v.config.uid,
|
|
3842
3854
|
v.updateConfiguration
|
|
3843
3855
|
]), { updateItemExtent: c } = Me(), h = {
|
|
@@ -3872,20 +3884,20 @@ const Fo = K({
|
|
|
3872
3884
|
f({
|
|
3873
3885
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3874
3886
|
}), c(), setTimeout(c, 2e3);
|
|
3875
|
-
}, [f, c]),
|
|
3887
|
+
}, [f, c]), Do(l, () => {
|
|
3876
3888
|
l.current && f({
|
|
3877
3889
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3878
3890
|
});
|
|
3879
3891
|
});
|
|
3880
|
-
const
|
|
3892
|
+
const S = K({ ...ts, ...r });
|
|
3881
3893
|
return /* @__PURE__ */ le(
|
|
3882
3894
|
"div",
|
|
3883
3895
|
{
|
|
3884
3896
|
ref: l,
|
|
3885
3897
|
id: d,
|
|
3886
|
-
className: `sync-board ${
|
|
3898
|
+
className: `sync-board ${S}`,
|
|
3887
3899
|
children: [
|
|
3888
|
-
/* @__PURE__ */
|
|
3900
|
+
/* @__PURE__ */ k(Qo, { children: /* @__PURE__ */ k(Eo, { moveFirst: e, children: /* @__PURE__ */ k(Io, { moveFirst: e, children: /* @__PURE__ */ k(wo, { moveFirst: e, children: /* @__PURE__ */ k(u, { children: /* @__PURE__ */ le(
|
|
3889
3901
|
"div",
|
|
3890
3902
|
{
|
|
3891
3903
|
onContextMenu: (v) => {
|
|
@@ -3894,34 +3906,35 @@ const Fo = K({
|
|
|
3894
3906
|
style: h,
|
|
3895
3907
|
className: "board",
|
|
3896
3908
|
children: [
|
|
3897
|
-
/* @__PURE__ */
|
|
3909
|
+
/* @__PURE__ */ k(go, {}),
|
|
3898
3910
|
s
|
|
3899
3911
|
]
|
|
3900
3912
|
}
|
|
3901
3913
|
) }) }) }) }) }),
|
|
3902
|
-
/* @__PURE__ */
|
|
3914
|
+
/* @__PURE__ */ k(ko, {})
|
|
3903
3915
|
]
|
|
3904
3916
|
}
|
|
3905
3917
|
);
|
|
3906
3918
|
};
|
|
3907
|
-
|
|
3919
|
+
Bn(g.createElement);
|
|
3908
3920
|
export {
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3921
|
+
vs as Board,
|
|
3922
|
+
gs as BoardWrapper,
|
|
3923
|
+
hs as RoomWrapper,
|
|
3924
|
+
cs as useAvailableActions,
|
|
3925
|
+
fs as useBoardConfig,
|
|
3914
3926
|
Me as useBoardPosition,
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3927
|
+
ds as useBoardState,
|
|
3928
|
+
ss as useDebouncedItems,
|
|
3929
|
+
as as useGetSelectedItems,
|
|
3930
|
+
ht as useItemActions,
|
|
3931
|
+
Ft as useItemInteraction,
|
|
3932
|
+
os as useItems,
|
|
3933
|
+
ms as useMessage,
|
|
3934
|
+
is as useSelectedItems,
|
|
3935
|
+
us as useSelectionBox,
|
|
3936
|
+
ps as useSessionInfo,
|
|
3937
|
+
ls as useUsers,
|
|
3925
3938
|
Xe as useWire
|
|
3926
3939
|
};
|
|
3927
3940
|
//# sourceMappingURL=react-sync-board.js.map
|