poll-test-widgets 0.0.1
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/README.md +16 -0
- package/dist/poll-test-widgets.es.js +3410 -0
- package/dist/poll-test-widgets.umd.js +30 -0
- package/dist/vite.svg +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,3410 @@
|
|
|
1
|
+
import dt, { memo as Lt, useCallback as V, useMemo as Ft, PureComponent as $t, useState as E, useRef as ct, useEffect as ne } from "react";
|
|
2
|
+
import { useUpdateNodeInternals as pt, useReactFlow as ut, Handle as Ee, Position as Ie } from "@xyflow/react";
|
|
3
|
+
import { flushSync as Ht } from "react-dom";
|
|
4
|
+
var Fe = { exports: {} }, we = {};
|
|
5
|
+
/**
|
|
6
|
+
* @license React
|
|
7
|
+
* react-jsx-runtime.production.min.js
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the MIT license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/
|
|
14
|
+
var rt;
|
|
15
|
+
function Yt() {
|
|
16
|
+
if (rt) return we;
|
|
17
|
+
rt = 1;
|
|
18
|
+
var i = dt, s = Symbol.for("react.element"), r = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, o = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
19
|
+
function u(n, c, g) {
|
|
20
|
+
var y, m = {}, v = null, d = null;
|
|
21
|
+
g !== void 0 && (v = "" + g), c.key !== void 0 && (v = "" + c.key), c.ref !== void 0 && (d = c.ref);
|
|
22
|
+
for (y in c) l.call(c, y) && !a.hasOwnProperty(y) && (m[y] = c[y]);
|
|
23
|
+
if (n && n.defaultProps) for (y in c = n.defaultProps, c) m[y] === void 0 && (m[y] = c[y]);
|
|
24
|
+
return { $$typeof: s, type: n, key: v, ref: d, props: m, _owner: o.current };
|
|
25
|
+
}
|
|
26
|
+
return we.Fragment = r, we.jsx = u, we.jsxs = u, we;
|
|
27
|
+
}
|
|
28
|
+
var je = {};
|
|
29
|
+
/**
|
|
30
|
+
* @license React
|
|
31
|
+
* react-jsx-runtime.development.js
|
|
32
|
+
*
|
|
33
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the MIT license found in the
|
|
36
|
+
* LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/
|
|
38
|
+
var it;
|
|
39
|
+
function Ut() {
|
|
40
|
+
return it || (it = 1, process.env.NODE_ENV !== "production" && function() {
|
|
41
|
+
var i = dt, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), n = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), d = Symbol.for("react.offscreen"), S = Symbol.iterator, b = "@@iterator";
|
|
42
|
+
function x(t) {
|
|
43
|
+
if (t === null || typeof t != "object")
|
|
44
|
+
return null;
|
|
45
|
+
var h = S && t[S] || t[b];
|
|
46
|
+
return typeof h == "function" ? h : null;
|
|
47
|
+
}
|
|
48
|
+
var f = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
49
|
+
function C(t) {
|
|
50
|
+
{
|
|
51
|
+
for (var h = arguments.length, j = new Array(h > 1 ? h - 1 : 0), z = 1; z < h; z++)
|
|
52
|
+
j[z - 1] = arguments[z];
|
|
53
|
+
T("error", t, j);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function T(t, h, j) {
|
|
57
|
+
{
|
|
58
|
+
var z = f.ReactDebugCurrentFrame, $ = z.getStackAddendum();
|
|
59
|
+
$ !== "" && (h += "%s", j = j.concat([$]));
|
|
60
|
+
var H = j.map(function(L) {
|
|
61
|
+
return String(L);
|
|
62
|
+
});
|
|
63
|
+
H.unshift("Warning: " + h), Function.prototype.apply.call(console[t], console, H);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
var I = !1, A = !1, R = !1, k = !1, B = !1, Y;
|
|
67
|
+
Y = Symbol.for("react.module.reference");
|
|
68
|
+
function O(t) {
|
|
69
|
+
return !!(typeof t == "string" || typeof t == "function" || t === l || t === a || B || t === o || t === g || t === y || k || t === d || I || A || R || typeof t == "object" && t !== null && (t.$$typeof === v || t.$$typeof === m || t.$$typeof === u || t.$$typeof === n || t.$$typeof === c || // This needs to include all possible module reference object
|
|
70
|
+
// types supported by any Flight configuration anywhere since
|
|
71
|
+
// we don't know which Flight build this will end up being used
|
|
72
|
+
// with.
|
|
73
|
+
t.$$typeof === Y || t.getModuleId !== void 0));
|
|
74
|
+
}
|
|
75
|
+
function w(t, h, j) {
|
|
76
|
+
var z = t.displayName;
|
|
77
|
+
if (z)
|
|
78
|
+
return z;
|
|
79
|
+
var $ = h.displayName || h.name || "";
|
|
80
|
+
return $ !== "" ? j + "(" + $ + ")" : j;
|
|
81
|
+
}
|
|
82
|
+
function W(t) {
|
|
83
|
+
return t.displayName || "Context";
|
|
84
|
+
}
|
|
85
|
+
function F(t) {
|
|
86
|
+
if (t == null)
|
|
87
|
+
return null;
|
|
88
|
+
if (typeof t.tag == "number" && C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof t == "function")
|
|
89
|
+
return t.displayName || t.name || null;
|
|
90
|
+
if (typeof t == "string")
|
|
91
|
+
return t;
|
|
92
|
+
switch (t) {
|
|
93
|
+
case l:
|
|
94
|
+
return "Fragment";
|
|
95
|
+
case r:
|
|
96
|
+
return "Portal";
|
|
97
|
+
case a:
|
|
98
|
+
return "Profiler";
|
|
99
|
+
case o:
|
|
100
|
+
return "StrictMode";
|
|
101
|
+
case g:
|
|
102
|
+
return "Suspense";
|
|
103
|
+
case y:
|
|
104
|
+
return "SuspenseList";
|
|
105
|
+
}
|
|
106
|
+
if (typeof t == "object")
|
|
107
|
+
switch (t.$$typeof) {
|
|
108
|
+
case n:
|
|
109
|
+
var h = t;
|
|
110
|
+
return W(h) + ".Consumer";
|
|
111
|
+
case u:
|
|
112
|
+
var j = t;
|
|
113
|
+
return W(j._context) + ".Provider";
|
|
114
|
+
case c:
|
|
115
|
+
return w(t, t.render, "ForwardRef");
|
|
116
|
+
case m:
|
|
117
|
+
var z = t.displayName || null;
|
|
118
|
+
return z !== null ? z : F(t.type) || "Memo";
|
|
119
|
+
case v: {
|
|
120
|
+
var $ = t, H = $._payload, L = $._init;
|
|
121
|
+
try {
|
|
122
|
+
return F(L(H));
|
|
123
|
+
} catch {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
var q = Object.assign, U = 0, J, P, G, se, ie, ee, de;
|
|
131
|
+
function ue() {
|
|
132
|
+
}
|
|
133
|
+
ue.__reactDisabledLog = !0;
|
|
134
|
+
function fe() {
|
|
135
|
+
{
|
|
136
|
+
if (U === 0) {
|
|
137
|
+
J = console.log, P = console.info, G = console.warn, se = console.error, ie = console.group, ee = console.groupCollapsed, de = console.groupEnd;
|
|
138
|
+
var t = {
|
|
139
|
+
configurable: !0,
|
|
140
|
+
enumerable: !0,
|
|
141
|
+
value: ue,
|
|
142
|
+
writable: !0
|
|
143
|
+
};
|
|
144
|
+
Object.defineProperties(console, {
|
|
145
|
+
info: t,
|
|
146
|
+
log: t,
|
|
147
|
+
warn: t,
|
|
148
|
+
error: t,
|
|
149
|
+
group: t,
|
|
150
|
+
groupCollapsed: t,
|
|
151
|
+
groupEnd: t
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
U++;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function ge() {
|
|
158
|
+
{
|
|
159
|
+
if (U--, U === 0) {
|
|
160
|
+
var t = {
|
|
161
|
+
configurable: !0,
|
|
162
|
+
enumerable: !0,
|
|
163
|
+
writable: !0
|
|
164
|
+
};
|
|
165
|
+
Object.defineProperties(console, {
|
|
166
|
+
log: q({}, t, {
|
|
167
|
+
value: J
|
|
168
|
+
}),
|
|
169
|
+
info: q({}, t, {
|
|
170
|
+
value: P
|
|
171
|
+
}),
|
|
172
|
+
warn: q({}, t, {
|
|
173
|
+
value: G
|
|
174
|
+
}),
|
|
175
|
+
error: q({}, t, {
|
|
176
|
+
value: se
|
|
177
|
+
}),
|
|
178
|
+
group: q({}, t, {
|
|
179
|
+
value: ie
|
|
180
|
+
}),
|
|
181
|
+
groupCollapsed: q({}, t, {
|
|
182
|
+
value: ee
|
|
183
|
+
}),
|
|
184
|
+
groupEnd: q({}, t, {
|
|
185
|
+
value: de
|
|
186
|
+
})
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
U < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
var ce = f.ReactCurrentDispatcher, pe;
|
|
193
|
+
function le(t, h, j) {
|
|
194
|
+
{
|
|
195
|
+
if (pe === void 0)
|
|
196
|
+
try {
|
|
197
|
+
throw Error();
|
|
198
|
+
} catch ($) {
|
|
199
|
+
var z = $.stack.trim().match(/\n( *(at )?)/);
|
|
200
|
+
pe = z && z[1] || "";
|
|
201
|
+
}
|
|
202
|
+
return `
|
|
203
|
+
` + pe + t;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
var _ = !1, p;
|
|
207
|
+
{
|
|
208
|
+
var M = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
+
p = new M();
|
|
210
|
+
}
|
|
211
|
+
function X(t, h) {
|
|
212
|
+
if (!t || _)
|
|
213
|
+
return "";
|
|
214
|
+
{
|
|
215
|
+
var j = p.get(t);
|
|
216
|
+
if (j !== void 0)
|
|
217
|
+
return j;
|
|
218
|
+
}
|
|
219
|
+
var z;
|
|
220
|
+
_ = !0;
|
|
221
|
+
var $ = Error.prepareStackTrace;
|
|
222
|
+
Error.prepareStackTrace = void 0;
|
|
223
|
+
var H;
|
|
224
|
+
H = ce.current, ce.current = null, fe();
|
|
225
|
+
try {
|
|
226
|
+
if (h) {
|
|
227
|
+
var L = function() {
|
|
228
|
+
throw Error();
|
|
229
|
+
};
|
|
230
|
+
if (Object.defineProperty(L.prototype, "props", {
|
|
231
|
+
set: function() {
|
|
232
|
+
throw Error();
|
|
233
|
+
}
|
|
234
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
235
|
+
try {
|
|
236
|
+
Reflect.construct(L, []);
|
|
237
|
+
} catch (re) {
|
|
238
|
+
z = re;
|
|
239
|
+
}
|
|
240
|
+
Reflect.construct(t, [], L);
|
|
241
|
+
} else {
|
|
242
|
+
try {
|
|
243
|
+
L.call();
|
|
244
|
+
} catch (re) {
|
|
245
|
+
z = re;
|
|
246
|
+
}
|
|
247
|
+
t.call(L.prototype);
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
try {
|
|
251
|
+
throw Error();
|
|
252
|
+
} catch (re) {
|
|
253
|
+
z = re;
|
|
254
|
+
}
|
|
255
|
+
t();
|
|
256
|
+
}
|
|
257
|
+
} catch (re) {
|
|
258
|
+
if (re && z && typeof re.stack == "string") {
|
|
259
|
+
for (var N = re.stack.split(`
|
|
260
|
+
`), te = z.stack.split(`
|
|
261
|
+
`), K = N.length - 1, D = te.length - 1; K >= 1 && D >= 0 && N[K] !== te[D]; )
|
|
262
|
+
D--;
|
|
263
|
+
for (; K >= 1 && D >= 0; K--, D--)
|
|
264
|
+
if (N[K] !== te[D]) {
|
|
265
|
+
if (K !== 1 || D !== 1)
|
|
266
|
+
do
|
|
267
|
+
if (K--, D--, D < 0 || N[K] !== te[D]) {
|
|
268
|
+
var oe = `
|
|
269
|
+
` + N[K].replace(" at new ", " at ");
|
|
270
|
+
return t.displayName && oe.includes("<anonymous>") && (oe = oe.replace("<anonymous>", t.displayName)), typeof t == "function" && p.set(t, oe), oe;
|
|
271
|
+
}
|
|
272
|
+
while (K >= 1 && D >= 0);
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
} finally {
|
|
277
|
+
_ = !1, ce.current = H, ge(), Error.prepareStackTrace = $;
|
|
278
|
+
}
|
|
279
|
+
var ye = t ? t.displayName || t.name : "", he = ye ? le(ye) : "";
|
|
280
|
+
return typeof t == "function" && p.set(t, he), he;
|
|
281
|
+
}
|
|
282
|
+
function Oe(t, h, j) {
|
|
283
|
+
return X(t, !1);
|
|
284
|
+
}
|
|
285
|
+
function xt(t) {
|
|
286
|
+
var h = t.prototype;
|
|
287
|
+
return !!(h && h.isReactComponent);
|
|
288
|
+
}
|
|
289
|
+
function Re(t, h, j) {
|
|
290
|
+
if (t == null)
|
|
291
|
+
return "";
|
|
292
|
+
if (typeof t == "function")
|
|
293
|
+
return X(t, xt(t));
|
|
294
|
+
if (typeof t == "string")
|
|
295
|
+
return le(t);
|
|
296
|
+
switch (t) {
|
|
297
|
+
case g:
|
|
298
|
+
return le("Suspense");
|
|
299
|
+
case y:
|
|
300
|
+
return le("SuspenseList");
|
|
301
|
+
}
|
|
302
|
+
if (typeof t == "object")
|
|
303
|
+
switch (t.$$typeof) {
|
|
304
|
+
case c:
|
|
305
|
+
return Oe(t.render);
|
|
306
|
+
case m:
|
|
307
|
+
return Re(t.type, h, j);
|
|
308
|
+
case v: {
|
|
309
|
+
var z = t, $ = z._payload, H = z._init;
|
|
310
|
+
try {
|
|
311
|
+
return Re(H($), h, j);
|
|
312
|
+
} catch {
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return "";
|
|
317
|
+
}
|
|
318
|
+
var be = Object.prototype.hasOwnProperty, He = {}, Ye = f.ReactDebugCurrentFrame;
|
|
319
|
+
function Ce(t) {
|
|
320
|
+
if (t) {
|
|
321
|
+
var h = t._owner, j = Re(t.type, t._source, h ? h.type : null);
|
|
322
|
+
Ye.setExtraStackFrame(j);
|
|
323
|
+
} else
|
|
324
|
+
Ye.setExtraStackFrame(null);
|
|
325
|
+
}
|
|
326
|
+
function yt(t, h, j, z, $) {
|
|
327
|
+
{
|
|
328
|
+
var H = Function.call.bind(be);
|
|
329
|
+
for (var L in t)
|
|
330
|
+
if (H(t, L)) {
|
|
331
|
+
var N = void 0;
|
|
332
|
+
try {
|
|
333
|
+
if (typeof t[L] != "function") {
|
|
334
|
+
var te = Error((z || "React class") + ": " + j + " type `" + L + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof t[L] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
335
|
+
throw te.name = "Invariant Violation", te;
|
|
336
|
+
}
|
|
337
|
+
N = t[L](h, L, z, j, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
338
|
+
} catch (K) {
|
|
339
|
+
N = K;
|
|
340
|
+
}
|
|
341
|
+
N && !(N instanceof Error) && (Ce($), C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", z || "React class", j, L, typeof N), Ce(null)), N instanceof Error && !(N.message in He) && (He[N.message] = !0, Ce($), C("Failed %s type: %s", j, N.message), Ce(null));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
var mt = Array.isArray;
|
|
346
|
+
function We(t) {
|
|
347
|
+
return mt(t);
|
|
348
|
+
}
|
|
349
|
+
function vt(t) {
|
|
350
|
+
{
|
|
351
|
+
var h = typeof Symbol == "function" && Symbol.toStringTag, j = h && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
352
|
+
return j;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function bt(t) {
|
|
356
|
+
try {
|
|
357
|
+
return Ue(t), !1;
|
|
358
|
+
} catch {
|
|
359
|
+
return !0;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function Ue(t) {
|
|
363
|
+
return "" + t;
|
|
364
|
+
}
|
|
365
|
+
function Ge(t) {
|
|
366
|
+
if (bt(t))
|
|
367
|
+
return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", vt(t)), Ue(t);
|
|
368
|
+
}
|
|
369
|
+
var Xe = f.ReactCurrentOwner, wt = {
|
|
370
|
+
key: !0,
|
|
371
|
+
ref: !0,
|
|
372
|
+
__self: !0,
|
|
373
|
+
__source: !0
|
|
374
|
+
}, Ve, qe;
|
|
375
|
+
function jt(t) {
|
|
376
|
+
if (be.call(t, "ref")) {
|
|
377
|
+
var h = Object.getOwnPropertyDescriptor(t, "ref").get;
|
|
378
|
+
if (h && h.isReactWarning)
|
|
379
|
+
return !1;
|
|
380
|
+
}
|
|
381
|
+
return t.ref !== void 0;
|
|
382
|
+
}
|
|
383
|
+
function St(t) {
|
|
384
|
+
if (be.call(t, "key")) {
|
|
385
|
+
var h = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
386
|
+
if (h && h.isReactWarning)
|
|
387
|
+
return !1;
|
|
388
|
+
}
|
|
389
|
+
return t.key !== void 0;
|
|
390
|
+
}
|
|
391
|
+
function Rt(t, h) {
|
|
392
|
+
typeof t.ref == "string" && Xe.current;
|
|
393
|
+
}
|
|
394
|
+
function Ct(t, h) {
|
|
395
|
+
{
|
|
396
|
+
var j = function() {
|
|
397
|
+
Ve || (Ve = !0, C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
|
|
398
|
+
};
|
|
399
|
+
j.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
400
|
+
get: j,
|
|
401
|
+
configurable: !0
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function _t(t, h) {
|
|
406
|
+
{
|
|
407
|
+
var j = function() {
|
|
408
|
+
qe || (qe = !0, C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
|
|
409
|
+
};
|
|
410
|
+
j.isReactWarning = !0, Object.defineProperty(t, "ref", {
|
|
411
|
+
get: j,
|
|
412
|
+
configurable: !0
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
var Tt = function(t, h, j, z, $, H, L) {
|
|
417
|
+
var N = {
|
|
418
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
419
|
+
$$typeof: s,
|
|
420
|
+
// Built-in properties that belong on the element
|
|
421
|
+
type: t,
|
|
422
|
+
key: h,
|
|
423
|
+
ref: j,
|
|
424
|
+
props: L,
|
|
425
|
+
// Record the component responsible for creating this element.
|
|
426
|
+
_owner: H
|
|
427
|
+
};
|
|
428
|
+
return N._store = {}, Object.defineProperty(N._store, "validated", {
|
|
429
|
+
configurable: !1,
|
|
430
|
+
enumerable: !1,
|
|
431
|
+
writable: !0,
|
|
432
|
+
value: !1
|
|
433
|
+
}), Object.defineProperty(N, "_self", {
|
|
434
|
+
configurable: !1,
|
|
435
|
+
enumerable: !1,
|
|
436
|
+
writable: !1,
|
|
437
|
+
value: z
|
|
438
|
+
}), Object.defineProperty(N, "_source", {
|
|
439
|
+
configurable: !1,
|
|
440
|
+
enumerable: !1,
|
|
441
|
+
writable: !1,
|
|
442
|
+
value: $
|
|
443
|
+
}), Object.freeze && (Object.freeze(N.props), Object.freeze(N)), N;
|
|
444
|
+
};
|
|
445
|
+
function kt(t, h, j, z, $) {
|
|
446
|
+
{
|
|
447
|
+
var H, L = {}, N = null, te = null;
|
|
448
|
+
j !== void 0 && (Ge(j), N = "" + j), St(h) && (Ge(h.key), N = "" + h.key), jt(h) && (te = h.ref, Rt(h, $));
|
|
449
|
+
for (H in h)
|
|
450
|
+
be.call(h, H) && !wt.hasOwnProperty(H) && (L[H] = h[H]);
|
|
451
|
+
if (t && t.defaultProps) {
|
|
452
|
+
var K = t.defaultProps;
|
|
453
|
+
for (H in K)
|
|
454
|
+
L[H] === void 0 && (L[H] = K[H]);
|
|
455
|
+
}
|
|
456
|
+
if (N || te) {
|
|
457
|
+
var D = typeof t == "function" ? t.displayName || t.name || "Unknown" : t;
|
|
458
|
+
N && Ct(L, D), te && _t(L, D);
|
|
459
|
+
}
|
|
460
|
+
return Tt(t, N, te, $, z, Xe.current, L);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
var Ae = f.ReactCurrentOwner, Je = f.ReactDebugCurrentFrame;
|
|
464
|
+
function xe(t) {
|
|
465
|
+
if (t) {
|
|
466
|
+
var h = t._owner, j = Re(t.type, t._source, h ? h.type : null);
|
|
467
|
+
Je.setExtraStackFrame(j);
|
|
468
|
+
} else
|
|
469
|
+
Je.setExtraStackFrame(null);
|
|
470
|
+
}
|
|
471
|
+
var Be;
|
|
472
|
+
Be = !1;
|
|
473
|
+
function Me(t) {
|
|
474
|
+
return typeof t == "object" && t !== null && t.$$typeof === s;
|
|
475
|
+
}
|
|
476
|
+
function Ke() {
|
|
477
|
+
{
|
|
478
|
+
if (Ae.current) {
|
|
479
|
+
var t = F(Ae.current.type);
|
|
480
|
+
if (t)
|
|
481
|
+
return `
|
|
482
|
+
|
|
483
|
+
Check the render method of \`` + t + "`.";
|
|
484
|
+
}
|
|
485
|
+
return "";
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
function zt(t) {
|
|
489
|
+
return "";
|
|
490
|
+
}
|
|
491
|
+
var De = {};
|
|
492
|
+
function Et(t) {
|
|
493
|
+
{
|
|
494
|
+
var h = Ke();
|
|
495
|
+
if (!h) {
|
|
496
|
+
var j = typeof t == "string" ? t : t.displayName || t.name;
|
|
497
|
+
j && (h = `
|
|
498
|
+
|
|
499
|
+
Check the top-level render call using <` + j + ">.");
|
|
500
|
+
}
|
|
501
|
+
return h;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function Ze(t, h) {
|
|
505
|
+
{
|
|
506
|
+
if (!t._store || t._store.validated || t.key != null)
|
|
507
|
+
return;
|
|
508
|
+
t._store.validated = !0;
|
|
509
|
+
var j = Et(h);
|
|
510
|
+
if (De[j])
|
|
511
|
+
return;
|
|
512
|
+
De[j] = !0;
|
|
513
|
+
var z = "";
|
|
514
|
+
t && t._owner && t._owner !== Ae.current && (z = " It was passed a child from " + F(t._owner.type) + "."), xe(t), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', j, z), xe(null);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
function Qe(t, h) {
|
|
518
|
+
{
|
|
519
|
+
if (typeof t != "object")
|
|
520
|
+
return;
|
|
521
|
+
if (We(t))
|
|
522
|
+
for (var j = 0; j < t.length; j++) {
|
|
523
|
+
var z = t[j];
|
|
524
|
+
Me(z) && Ze(z, h);
|
|
525
|
+
}
|
|
526
|
+
else if (Me(t))
|
|
527
|
+
t._store && (t._store.validated = !0);
|
|
528
|
+
else if (t) {
|
|
529
|
+
var $ = x(t);
|
|
530
|
+
if (typeof $ == "function" && $ !== t.entries)
|
|
531
|
+
for (var H = $.call(t), L; !(L = H.next()).done; )
|
|
532
|
+
Me(L.value) && Ze(L.value, h);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
function It(t) {
|
|
537
|
+
{
|
|
538
|
+
var h = t.type;
|
|
539
|
+
if (h == null || typeof h == "string")
|
|
540
|
+
return;
|
|
541
|
+
var j;
|
|
542
|
+
if (typeof h == "function")
|
|
543
|
+
j = h.propTypes;
|
|
544
|
+
else if (typeof h == "object" && (h.$$typeof === c || // Note: Memo only checks outer props here.
|
|
545
|
+
// Inner props are checked in the reconciler.
|
|
546
|
+
h.$$typeof === m))
|
|
547
|
+
j = h.propTypes;
|
|
548
|
+
else
|
|
549
|
+
return;
|
|
550
|
+
if (j) {
|
|
551
|
+
var z = F(h);
|
|
552
|
+
yt(j, t.props, "prop", z, t);
|
|
553
|
+
} else if (h.PropTypes !== void 0 && !Be) {
|
|
554
|
+
Be = !0;
|
|
555
|
+
var $ = F(h);
|
|
556
|
+
C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", $ || "Unknown");
|
|
557
|
+
}
|
|
558
|
+
typeof h.getDefaultProps == "function" && !h.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
function Pt(t) {
|
|
562
|
+
{
|
|
563
|
+
for (var h = Object.keys(t.props), j = 0; j < h.length; j++) {
|
|
564
|
+
var z = h[j];
|
|
565
|
+
if (z !== "children" && z !== "key") {
|
|
566
|
+
xe(t), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", z), xe(null);
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
t.ref !== null && (xe(t), C("Invalid attribute `ref` supplied to `React.Fragment`."), xe(null));
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
var et = {};
|
|
574
|
+
function tt(t, h, j, z, $, H) {
|
|
575
|
+
{
|
|
576
|
+
var L = O(t);
|
|
577
|
+
if (!L) {
|
|
578
|
+
var N = "";
|
|
579
|
+
(t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (N += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
580
|
+
var te = zt();
|
|
581
|
+
te ? N += te : N += Ke();
|
|
582
|
+
var K;
|
|
583
|
+
t === null ? K = "null" : We(t) ? K = "array" : t !== void 0 && t.$$typeof === s ? (K = "<" + (F(t.type) || "Unknown") + " />", N = " Did you accidentally export a JSX literal instead of a component?") : K = typeof t, C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", K, N);
|
|
584
|
+
}
|
|
585
|
+
var D = kt(t, h, j, $, H);
|
|
586
|
+
if (D == null)
|
|
587
|
+
return D;
|
|
588
|
+
if (L) {
|
|
589
|
+
var oe = h.children;
|
|
590
|
+
if (oe !== void 0)
|
|
591
|
+
if (z)
|
|
592
|
+
if (We(oe)) {
|
|
593
|
+
for (var ye = 0; ye < oe.length; ye++)
|
|
594
|
+
Qe(oe[ye], t);
|
|
595
|
+
Object.freeze && Object.freeze(oe);
|
|
596
|
+
} else
|
|
597
|
+
C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
598
|
+
else
|
|
599
|
+
Qe(oe, t);
|
|
600
|
+
}
|
|
601
|
+
if (be.call(h, "key")) {
|
|
602
|
+
var he = F(t), re = Object.keys(h).filter(function(Nt) {
|
|
603
|
+
return Nt !== "key";
|
|
604
|
+
}), Ne = re.length > 0 ? "{key: someKey, " + re.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
605
|
+
if (!et[he + Ne]) {
|
|
606
|
+
var Mt = re.length > 0 ? "{" + re.join(": ..., ") + ": ...}" : "{}";
|
|
607
|
+
C(`A props object containing a "key" prop is being spread into JSX:
|
|
608
|
+
let props = %s;
|
|
609
|
+
<%s {...props} />
|
|
610
|
+
React keys must be passed directly to JSX without using spread:
|
|
611
|
+
let props = %s;
|
|
612
|
+
<%s key={someKey} {...props} />`, Ne, he, Mt, he), et[he + Ne] = !0;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return t === l ? Pt(D) : It(D), D;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
function Ot(t, h, j) {
|
|
619
|
+
return tt(t, h, j, !0);
|
|
620
|
+
}
|
|
621
|
+
function Wt(t, h, j) {
|
|
622
|
+
return tt(t, h, j, !1);
|
|
623
|
+
}
|
|
624
|
+
var At = Wt, Bt = Ot;
|
|
625
|
+
je.Fragment = l, je.jsx = At, je.jsxs = Bt;
|
|
626
|
+
}()), je;
|
|
627
|
+
}
|
|
628
|
+
process.env.NODE_ENV === "production" ? Fe.exports = Yt() : Fe.exports = Ut();
|
|
629
|
+
var e = Fe.exports, Z = function() {
|
|
630
|
+
return Z = Object.assign || function(i) {
|
|
631
|
+
for (var s, r = 1, l = arguments.length; r < l; r++) {
|
|
632
|
+
s = arguments[r];
|
|
633
|
+
for (var o in s) Object.prototype.hasOwnProperty.call(s, o) && (i[o] = s[o]);
|
|
634
|
+
}
|
|
635
|
+
return i;
|
|
636
|
+
}, Z.apply(this, arguments);
|
|
637
|
+
}, ot = {
|
|
638
|
+
width: "100%",
|
|
639
|
+
height: "10px",
|
|
640
|
+
top: "0px",
|
|
641
|
+
left: "0px",
|
|
642
|
+
cursor: "row-resize"
|
|
643
|
+
}, nt = {
|
|
644
|
+
width: "10px",
|
|
645
|
+
height: "100%",
|
|
646
|
+
top: "0px",
|
|
647
|
+
left: "0px",
|
|
648
|
+
cursor: "col-resize"
|
|
649
|
+
}, _e = {
|
|
650
|
+
width: "20px",
|
|
651
|
+
height: "20px",
|
|
652
|
+
position: "absolute",
|
|
653
|
+
zIndex: 1
|
|
654
|
+
}, Gt = {
|
|
655
|
+
top: Z(Z({}, ot), { top: "-5px" }),
|
|
656
|
+
right: Z(Z({}, nt), { left: void 0, right: "-5px" }),
|
|
657
|
+
bottom: Z(Z({}, ot), { top: void 0, bottom: "-5px" }),
|
|
658
|
+
left: Z(Z({}, nt), { left: "-5px" }),
|
|
659
|
+
topRight: Z(Z({}, _e), { right: "-10px", top: "-10px", cursor: "ne-resize" }),
|
|
660
|
+
bottomRight: Z(Z({}, _e), { right: "-10px", bottom: "-10px", cursor: "se-resize" }),
|
|
661
|
+
bottomLeft: Z(Z({}, _e), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }),
|
|
662
|
+
topLeft: Z(Z({}, _e), { left: "-10px", top: "-10px", cursor: "nw-resize" })
|
|
663
|
+
}, Xt = Lt(function(i) {
|
|
664
|
+
var s = i.onResizeStart, r = i.direction, l = i.children, o = i.replaceStyles, a = i.className, u = V(function(g) {
|
|
665
|
+
s(g, r);
|
|
666
|
+
}, [s, r]), n = V(function(g) {
|
|
667
|
+
s(g, r);
|
|
668
|
+
}, [s, r]), c = Ft(function() {
|
|
669
|
+
return Z(Z({ position: "absolute", userSelect: "none" }, Gt[r]), o ?? {});
|
|
670
|
+
}, [o, r]);
|
|
671
|
+
return e.jsx("div", { className: a || void 0, style: c, onMouseDown: u, onTouchStart: n, children: l });
|
|
672
|
+
}), Vt = /* @__PURE__ */ function() {
|
|
673
|
+
var i = function(s, r) {
|
|
674
|
+
return i = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(l, o) {
|
|
675
|
+
l.__proto__ = o;
|
|
676
|
+
} || function(l, o) {
|
|
677
|
+
for (var a in o) Object.prototype.hasOwnProperty.call(o, a) && (l[a] = o[a]);
|
|
678
|
+
}, i(s, r);
|
|
679
|
+
};
|
|
680
|
+
return function(s, r) {
|
|
681
|
+
if (typeof r != "function" && r !== null)
|
|
682
|
+
throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
|
|
683
|
+
i(s, r);
|
|
684
|
+
function l() {
|
|
685
|
+
this.constructor = s;
|
|
686
|
+
}
|
|
687
|
+
s.prototype = r === null ? Object.create(r) : (l.prototype = r.prototype, new l());
|
|
688
|
+
};
|
|
689
|
+
}(), ae = function() {
|
|
690
|
+
return ae = Object.assign || function(i) {
|
|
691
|
+
for (var s, r = 1, l = arguments.length; r < l; r++) {
|
|
692
|
+
s = arguments[r];
|
|
693
|
+
for (var o in s) Object.prototype.hasOwnProperty.call(s, o) && (i[o] = s[o]);
|
|
694
|
+
}
|
|
695
|
+
return i;
|
|
696
|
+
}, ae.apply(this, arguments);
|
|
697
|
+
}, qt = {
|
|
698
|
+
width: "auto",
|
|
699
|
+
height: "auto"
|
|
700
|
+
}, Te = function(i, s, r) {
|
|
701
|
+
return Math.max(Math.min(i, r), s);
|
|
702
|
+
}, st = function(i, s, r) {
|
|
703
|
+
var l = Math.round(i / s);
|
|
704
|
+
return l * s + r * (l - 1);
|
|
705
|
+
}, me = function(i, s) {
|
|
706
|
+
return new RegExp(i, "i").test(s);
|
|
707
|
+
}, ke = function(i) {
|
|
708
|
+
return !!(i.touches && i.touches.length);
|
|
709
|
+
}, Jt = function(i) {
|
|
710
|
+
return !!((i.clientX || i.clientX === 0) && (i.clientY || i.clientY === 0));
|
|
711
|
+
}, lt = function(i, s, r) {
|
|
712
|
+
r === void 0 && (r = 0);
|
|
713
|
+
var l = s.reduce(function(a, u, n) {
|
|
714
|
+
return Math.abs(u - i) < Math.abs(s[a] - i) ? n : a;
|
|
715
|
+
}, 0), o = Math.abs(s[l] - i);
|
|
716
|
+
return r === 0 || o < r ? s[l] : i;
|
|
717
|
+
}, Le = function(i) {
|
|
718
|
+
return i = i.toString(), i === "auto" || i.endsWith("px") || i.endsWith("%") || i.endsWith("vh") || i.endsWith("vw") || i.endsWith("vmax") || i.endsWith("vmin") ? i : "".concat(i, "px");
|
|
719
|
+
}, ze = function(i, s, r, l) {
|
|
720
|
+
if (i && typeof i == "string") {
|
|
721
|
+
if (i.endsWith("px"))
|
|
722
|
+
return Number(i.replace("px", ""));
|
|
723
|
+
if (i.endsWith("%")) {
|
|
724
|
+
var o = Number(i.replace("%", "")) / 100;
|
|
725
|
+
return s * o;
|
|
726
|
+
}
|
|
727
|
+
if (i.endsWith("vw")) {
|
|
728
|
+
var o = Number(i.replace("vw", "")) / 100;
|
|
729
|
+
return r * o;
|
|
730
|
+
}
|
|
731
|
+
if (i.endsWith("vh")) {
|
|
732
|
+
var o = Number(i.replace("vh", "")) / 100;
|
|
733
|
+
return l * o;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
return i;
|
|
737
|
+
}, Kt = function(i, s, r, l, o, a, u) {
|
|
738
|
+
return l = ze(l, i.width, s, r), o = ze(o, i.height, s, r), a = ze(a, i.width, s, r), u = ze(u, i.height, s, r), {
|
|
739
|
+
maxWidth: typeof l > "u" ? void 0 : Number(l),
|
|
740
|
+
maxHeight: typeof o > "u" ? void 0 : Number(o),
|
|
741
|
+
minWidth: typeof a > "u" ? void 0 : Number(a),
|
|
742
|
+
minHeight: typeof u > "u" ? void 0 : Number(u)
|
|
743
|
+
};
|
|
744
|
+
}, Dt = function(i) {
|
|
745
|
+
return Array.isArray(i) ? i : [i, i];
|
|
746
|
+
}, Zt = [
|
|
747
|
+
"as",
|
|
748
|
+
"ref",
|
|
749
|
+
"style",
|
|
750
|
+
"className",
|
|
751
|
+
"grid",
|
|
752
|
+
"gridGap",
|
|
753
|
+
"snap",
|
|
754
|
+
"bounds",
|
|
755
|
+
"boundsByDirection",
|
|
756
|
+
"size",
|
|
757
|
+
"defaultSize",
|
|
758
|
+
"minWidth",
|
|
759
|
+
"minHeight",
|
|
760
|
+
"maxWidth",
|
|
761
|
+
"maxHeight",
|
|
762
|
+
"lockAspectRatio",
|
|
763
|
+
"lockAspectRatioExtraWidth",
|
|
764
|
+
"lockAspectRatioExtraHeight",
|
|
765
|
+
"enable",
|
|
766
|
+
"handleStyles",
|
|
767
|
+
"handleClasses",
|
|
768
|
+
"handleWrapperStyle",
|
|
769
|
+
"handleWrapperClass",
|
|
770
|
+
"children",
|
|
771
|
+
"onResizeStart",
|
|
772
|
+
"onResize",
|
|
773
|
+
"onResizeStop",
|
|
774
|
+
"handleComponent",
|
|
775
|
+
"scale",
|
|
776
|
+
"resizeRatio",
|
|
777
|
+
"snapGap"
|
|
778
|
+
], at = "__resizable_base__", ht = (
|
|
779
|
+
/** @class */
|
|
780
|
+
function(i) {
|
|
781
|
+
Vt(s, i);
|
|
782
|
+
function s(r) {
|
|
783
|
+
var l, o, a, u, n = i.call(this, r) || this;
|
|
784
|
+
return n.ratio = 1, n.resizable = null, n.parentLeft = 0, n.parentTop = 0, n.resizableLeft = 0, n.resizableRight = 0, n.resizableTop = 0, n.resizableBottom = 0, n.targetLeft = 0, n.targetTop = 0, n.delta = {
|
|
785
|
+
width: 0,
|
|
786
|
+
height: 0
|
|
787
|
+
}, n.appendBase = function() {
|
|
788
|
+
if (!n.resizable || !n.window)
|
|
789
|
+
return null;
|
|
790
|
+
var c = n.parentNode;
|
|
791
|
+
if (!c)
|
|
792
|
+
return null;
|
|
793
|
+
var g = n.window.document.createElement("div");
|
|
794
|
+
return g.style.width = "100%", g.style.height = "100%", g.style.position = "absolute", g.style.transform = "scale(0, 0)", g.style.left = "0", g.style.flex = "0 0 100%", g.classList ? g.classList.add(at) : g.className += at, c.appendChild(g), g;
|
|
795
|
+
}, n.removeBase = function(c) {
|
|
796
|
+
var g = n.parentNode;
|
|
797
|
+
g && g.removeChild(c);
|
|
798
|
+
}, n.state = {
|
|
799
|
+
isResizing: !1,
|
|
800
|
+
width: (o = (l = n.propsSize) === null || l === void 0 ? void 0 : l.width) !== null && o !== void 0 ? o : "auto",
|
|
801
|
+
height: (u = (a = n.propsSize) === null || a === void 0 ? void 0 : a.height) !== null && u !== void 0 ? u : "auto",
|
|
802
|
+
direction: "right",
|
|
803
|
+
original: {
|
|
804
|
+
x: 0,
|
|
805
|
+
y: 0,
|
|
806
|
+
width: 0,
|
|
807
|
+
height: 0
|
|
808
|
+
},
|
|
809
|
+
backgroundStyle: {
|
|
810
|
+
height: "100%",
|
|
811
|
+
width: "100%",
|
|
812
|
+
backgroundColor: "rgba(0,0,0,0)",
|
|
813
|
+
cursor: "auto",
|
|
814
|
+
opacity: 0,
|
|
815
|
+
position: "fixed",
|
|
816
|
+
zIndex: 9999,
|
|
817
|
+
top: "0",
|
|
818
|
+
left: "0",
|
|
819
|
+
bottom: "0",
|
|
820
|
+
right: "0"
|
|
821
|
+
},
|
|
822
|
+
flexBasis: void 0
|
|
823
|
+
}, n.onResizeStart = n.onResizeStart.bind(n), n.onMouseMove = n.onMouseMove.bind(n), n.onMouseUp = n.onMouseUp.bind(n), n;
|
|
824
|
+
}
|
|
825
|
+
return Object.defineProperty(s.prototype, "parentNode", {
|
|
826
|
+
get: function() {
|
|
827
|
+
return this.resizable ? this.resizable.parentNode : null;
|
|
828
|
+
},
|
|
829
|
+
enumerable: !1,
|
|
830
|
+
configurable: !0
|
|
831
|
+
}), Object.defineProperty(s.prototype, "window", {
|
|
832
|
+
get: function() {
|
|
833
|
+
return !this.resizable || !this.resizable.ownerDocument ? null : this.resizable.ownerDocument.defaultView;
|
|
834
|
+
},
|
|
835
|
+
enumerable: !1,
|
|
836
|
+
configurable: !0
|
|
837
|
+
}), Object.defineProperty(s.prototype, "propsSize", {
|
|
838
|
+
get: function() {
|
|
839
|
+
return this.props.size || this.props.defaultSize || qt;
|
|
840
|
+
},
|
|
841
|
+
enumerable: !1,
|
|
842
|
+
configurable: !0
|
|
843
|
+
}), Object.defineProperty(s.prototype, "size", {
|
|
844
|
+
get: function() {
|
|
845
|
+
var r = 0, l = 0;
|
|
846
|
+
if (this.resizable && this.window) {
|
|
847
|
+
var o = this.resizable.offsetWidth, a = this.resizable.offsetHeight, u = this.resizable.style.position;
|
|
848
|
+
u !== "relative" && (this.resizable.style.position = "relative"), r = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : o, l = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : a, this.resizable.style.position = u;
|
|
849
|
+
}
|
|
850
|
+
return { width: r, height: l };
|
|
851
|
+
},
|
|
852
|
+
enumerable: !1,
|
|
853
|
+
configurable: !0
|
|
854
|
+
}), Object.defineProperty(s.prototype, "sizeStyle", {
|
|
855
|
+
get: function() {
|
|
856
|
+
var r = this, l = this.props.size, o = function(n) {
|
|
857
|
+
var c;
|
|
858
|
+
if (typeof r.state[n] > "u" || r.state[n] === "auto")
|
|
859
|
+
return "auto";
|
|
860
|
+
if (r.propsSize && r.propsSize[n] && (!((c = r.propsSize[n]) === null || c === void 0) && c.toString().endsWith("%"))) {
|
|
861
|
+
if (r.state[n].toString().endsWith("%"))
|
|
862
|
+
return r.state[n].toString();
|
|
863
|
+
var g = r.getParentSize(), y = Number(r.state[n].toString().replace("px", "")), m = y / g[n] * 100;
|
|
864
|
+
return "".concat(m, "%");
|
|
865
|
+
}
|
|
866
|
+
return Le(r.state[n]);
|
|
867
|
+
}, a = l && typeof l.width < "u" && !this.state.isResizing ? Le(l.width) : o("width"), u = l && typeof l.height < "u" && !this.state.isResizing ? Le(l.height) : o("height");
|
|
868
|
+
return { width: a, height: u };
|
|
869
|
+
},
|
|
870
|
+
enumerable: !1,
|
|
871
|
+
configurable: !0
|
|
872
|
+
}), s.prototype.getParentSize = function() {
|
|
873
|
+
if (!this.parentNode)
|
|
874
|
+
return this.window ? { width: this.window.innerWidth, height: this.window.innerHeight } : { width: 0, height: 0 };
|
|
875
|
+
var r = this.appendBase();
|
|
876
|
+
if (!r)
|
|
877
|
+
return { width: 0, height: 0 };
|
|
878
|
+
var l = !1, o = this.parentNode.style.flexWrap;
|
|
879
|
+
o !== "wrap" && (l = !0, this.parentNode.style.flexWrap = "wrap"), r.style.position = "relative", r.style.minWidth = "100%", r.style.minHeight = "100%";
|
|
880
|
+
var a = {
|
|
881
|
+
width: r.offsetWidth,
|
|
882
|
+
height: r.offsetHeight
|
|
883
|
+
};
|
|
884
|
+
return l && (this.parentNode.style.flexWrap = o), this.removeBase(r), a;
|
|
885
|
+
}, s.prototype.bindEvents = function() {
|
|
886
|
+
this.window && (this.window.addEventListener("mouseup", this.onMouseUp), this.window.addEventListener("mousemove", this.onMouseMove), this.window.addEventListener("mouseleave", this.onMouseUp), this.window.addEventListener("touchmove", this.onMouseMove, {
|
|
887
|
+
capture: !0,
|
|
888
|
+
passive: !1
|
|
889
|
+
}), this.window.addEventListener("touchend", this.onMouseUp));
|
|
890
|
+
}, s.prototype.unbindEvents = function() {
|
|
891
|
+
this.window && (this.window.removeEventListener("mouseup", this.onMouseUp), this.window.removeEventListener("mousemove", this.onMouseMove), this.window.removeEventListener("mouseleave", this.onMouseUp), this.window.removeEventListener("touchmove", this.onMouseMove, !0), this.window.removeEventListener("touchend", this.onMouseUp));
|
|
892
|
+
}, s.prototype.componentDidMount = function() {
|
|
893
|
+
if (!(!this.resizable || !this.window)) {
|
|
894
|
+
var r = this.window.getComputedStyle(this.resizable);
|
|
895
|
+
this.setState({
|
|
896
|
+
width: this.state.width || this.size.width,
|
|
897
|
+
height: this.state.height || this.size.height,
|
|
898
|
+
flexBasis: r.flexBasis !== "auto" ? r.flexBasis : void 0
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
}, s.prototype.componentWillUnmount = function() {
|
|
902
|
+
this.window && this.unbindEvents();
|
|
903
|
+
}, s.prototype.createSizeForCssProperty = function(r, l) {
|
|
904
|
+
var o = this.propsSize && this.propsSize[l];
|
|
905
|
+
return this.state[l] === "auto" && this.state.original[l] === r && (typeof o > "u" || o === "auto") ? "auto" : r;
|
|
906
|
+
}, s.prototype.calculateNewMaxFromBoundary = function(r, l) {
|
|
907
|
+
var o = this.props.boundsByDirection, a = this.state.direction, u = o && me("left", a), n = o && me("top", a), c, g;
|
|
908
|
+
if (this.props.bounds === "parent") {
|
|
909
|
+
var y = this.parentNode;
|
|
910
|
+
y && (c = u ? this.resizableRight - this.parentLeft : y.offsetWidth + (this.parentLeft - this.resizableLeft), g = n ? this.resizableBottom - this.parentTop : y.offsetHeight + (this.parentTop - this.resizableTop));
|
|
911
|
+
} else this.props.bounds === "window" ? this.window && (c = u ? this.resizableRight : this.window.innerWidth - this.resizableLeft, g = n ? this.resizableBottom : this.window.innerHeight - this.resizableTop) : this.props.bounds && (c = u ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft), g = n ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop));
|
|
912
|
+
return c && Number.isFinite(c) && (r = r && r < c ? r : c), g && Number.isFinite(g) && (l = l && l < g ? l : g), { maxWidth: r, maxHeight: l };
|
|
913
|
+
}, s.prototype.calculateNewSizeFromDirection = function(r, l) {
|
|
914
|
+
var o = this.props.scale || 1, a = Dt(this.props.resizeRatio || 1), u = a[0], n = a[1], c = this.state, g = c.direction, y = c.original, m = this.props, v = m.lockAspectRatio, d = m.lockAspectRatioExtraHeight, S = m.lockAspectRatioExtraWidth, b = y.width, x = y.height, f = d || 0, C = S || 0;
|
|
915
|
+
return me("right", g) && (b = y.width + (r - y.x) * u / o, v && (x = (b - C) / this.ratio + f)), me("left", g) && (b = y.width - (r - y.x) * u / o, v && (x = (b - C) / this.ratio + f)), me("bottom", g) && (x = y.height + (l - y.y) * n / o, v && (b = (x - f) * this.ratio + C)), me("top", g) && (x = y.height - (l - y.y) * n / o, v && (b = (x - f) * this.ratio + C)), { newWidth: b, newHeight: x };
|
|
916
|
+
}, s.prototype.calculateNewSizeFromAspectRatio = function(r, l, o, a) {
|
|
917
|
+
var u = this.props, n = u.lockAspectRatio, c = u.lockAspectRatioExtraHeight, g = u.lockAspectRatioExtraWidth, y = typeof a.width > "u" ? 10 : a.width, m = typeof o.width > "u" || o.width < 0 ? r : o.width, v = typeof a.height > "u" ? 10 : a.height, d = typeof o.height > "u" || o.height < 0 ? l : o.height, S = c || 0, b = g || 0;
|
|
918
|
+
if (n) {
|
|
919
|
+
var x = (v - S) * this.ratio + b, f = (d - S) * this.ratio + b, C = (y - b) / this.ratio + S, T = (m - b) / this.ratio + S, I = Math.max(y, x), A = Math.min(m, f), R = Math.max(v, C), k = Math.min(d, T);
|
|
920
|
+
r = Te(r, I, A), l = Te(l, R, k);
|
|
921
|
+
} else
|
|
922
|
+
r = Te(r, y, m), l = Te(l, v, d);
|
|
923
|
+
return { newWidth: r, newHeight: l };
|
|
924
|
+
}, s.prototype.setBoundingClientRect = function() {
|
|
925
|
+
var r = 1 / (this.props.scale || 1);
|
|
926
|
+
if (this.props.bounds === "parent") {
|
|
927
|
+
var l = this.parentNode;
|
|
928
|
+
if (l) {
|
|
929
|
+
var o = l.getBoundingClientRect();
|
|
930
|
+
this.parentLeft = o.left * r, this.parentTop = o.top * r;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
if (this.props.bounds && typeof this.props.bounds != "string") {
|
|
934
|
+
var a = this.props.bounds.getBoundingClientRect();
|
|
935
|
+
this.targetLeft = a.left * r, this.targetTop = a.top * r;
|
|
936
|
+
}
|
|
937
|
+
if (this.resizable) {
|
|
938
|
+
var u = this.resizable.getBoundingClientRect(), n = u.left, c = u.top, g = u.right, y = u.bottom;
|
|
939
|
+
this.resizableLeft = n * r, this.resizableRight = g * r, this.resizableTop = c * r, this.resizableBottom = y * r;
|
|
940
|
+
}
|
|
941
|
+
}, s.prototype.onResizeStart = function(r, l) {
|
|
942
|
+
if (!(!this.resizable || !this.window)) {
|
|
943
|
+
var o = 0, a = 0;
|
|
944
|
+
if (r.nativeEvent && Jt(r.nativeEvent) ? (o = r.nativeEvent.clientX, a = r.nativeEvent.clientY) : r.nativeEvent && ke(r.nativeEvent) && (o = r.nativeEvent.touches[0].clientX, a = r.nativeEvent.touches[0].clientY), this.props.onResizeStart && this.resizable) {
|
|
945
|
+
var u = this.props.onResizeStart(r, l, this.resizable);
|
|
946
|
+
if (u === !1)
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
this.props.size && (typeof this.props.size.height < "u" && this.props.size.height !== this.state.height && this.setState({ height: this.props.size.height }), typeof this.props.size.width < "u" && this.props.size.width !== this.state.width && this.setState({ width: this.props.size.width })), this.ratio = typeof this.props.lockAspectRatio == "number" ? this.props.lockAspectRatio : this.size.width / this.size.height;
|
|
950
|
+
var n, c = this.window.getComputedStyle(this.resizable);
|
|
951
|
+
if (c.flexBasis !== "auto") {
|
|
952
|
+
var g = this.parentNode;
|
|
953
|
+
if (g) {
|
|
954
|
+
var y = this.window.getComputedStyle(g).flexDirection;
|
|
955
|
+
this.flexDir = y.startsWith("row") ? "row" : "column", n = c.flexBasis;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
this.setBoundingClientRect(), this.bindEvents();
|
|
959
|
+
var m = {
|
|
960
|
+
original: {
|
|
961
|
+
x: o,
|
|
962
|
+
y: a,
|
|
963
|
+
width: this.size.width,
|
|
964
|
+
height: this.size.height
|
|
965
|
+
},
|
|
966
|
+
isResizing: !0,
|
|
967
|
+
backgroundStyle: ae(ae({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(r.target).cursor || "auto" }),
|
|
968
|
+
direction: l,
|
|
969
|
+
flexBasis: n
|
|
970
|
+
};
|
|
971
|
+
this.setState(m);
|
|
972
|
+
}
|
|
973
|
+
}, s.prototype.onMouseMove = function(r) {
|
|
974
|
+
var l = this;
|
|
975
|
+
if (!(!this.state.isResizing || !this.resizable || !this.window)) {
|
|
976
|
+
if (this.window.TouchEvent && ke(r))
|
|
977
|
+
try {
|
|
978
|
+
r.preventDefault(), r.stopPropagation();
|
|
979
|
+
} catch {
|
|
980
|
+
}
|
|
981
|
+
var o = this.props, a = o.maxWidth, u = o.maxHeight, n = o.minWidth, c = o.minHeight, g = ke(r) ? r.touches[0].clientX : r.clientX, y = ke(r) ? r.touches[0].clientY : r.clientY, m = this.state, v = m.direction, d = m.original, S = m.width, b = m.height, x = this.getParentSize(), f = Kt(x, this.window.innerWidth, this.window.innerHeight, a, u, n, c);
|
|
982
|
+
a = f.maxWidth, u = f.maxHeight, n = f.minWidth, c = f.minHeight;
|
|
983
|
+
var C = this.calculateNewSizeFromDirection(g, y), T = C.newHeight, I = C.newWidth, A = this.calculateNewMaxFromBoundary(a, u);
|
|
984
|
+
this.props.snap && this.props.snap.x && (I = lt(I, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (T = lt(T, this.props.snap.y, this.props.snapGap));
|
|
985
|
+
var R = this.calculateNewSizeFromAspectRatio(I, T, { width: A.maxWidth, height: A.maxHeight }, { width: n, height: c });
|
|
986
|
+
if (I = R.newWidth, T = R.newHeight, this.props.grid) {
|
|
987
|
+
var k = st(I, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), B = st(T, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), Y = this.props.snapGap || 0, O = Y === 0 || Math.abs(k - I) <= Y ? k : I, w = Y === 0 || Math.abs(B - T) <= Y ? B : T;
|
|
988
|
+
I = O, T = w;
|
|
989
|
+
}
|
|
990
|
+
var W = {
|
|
991
|
+
width: I - d.width,
|
|
992
|
+
height: T - d.height
|
|
993
|
+
};
|
|
994
|
+
if (this.delta = W, S && typeof S == "string") {
|
|
995
|
+
if (S.endsWith("%")) {
|
|
996
|
+
var F = I / x.width * 100;
|
|
997
|
+
I = "".concat(F, "%");
|
|
998
|
+
} else if (S.endsWith("vw")) {
|
|
999
|
+
var q = I / this.window.innerWidth * 100;
|
|
1000
|
+
I = "".concat(q, "vw");
|
|
1001
|
+
} else if (S.endsWith("vh")) {
|
|
1002
|
+
var U = I / this.window.innerHeight * 100;
|
|
1003
|
+
I = "".concat(U, "vh");
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
if (b && typeof b == "string") {
|
|
1007
|
+
if (b.endsWith("%")) {
|
|
1008
|
+
var F = T / x.height * 100;
|
|
1009
|
+
T = "".concat(F, "%");
|
|
1010
|
+
} else if (b.endsWith("vw")) {
|
|
1011
|
+
var q = T / this.window.innerWidth * 100;
|
|
1012
|
+
T = "".concat(q, "vw");
|
|
1013
|
+
} else if (b.endsWith("vh")) {
|
|
1014
|
+
var U = T / this.window.innerHeight * 100;
|
|
1015
|
+
T = "".concat(U, "vh");
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
var J = {
|
|
1019
|
+
width: this.createSizeForCssProperty(I, "width"),
|
|
1020
|
+
height: this.createSizeForCssProperty(T, "height")
|
|
1021
|
+
};
|
|
1022
|
+
this.flexDir === "row" ? J.flexBasis = J.width : this.flexDir === "column" && (J.flexBasis = J.height);
|
|
1023
|
+
var P = this.state.width !== J.width, G = this.state.height !== J.height, se = this.state.flexBasis !== J.flexBasis, ie = P || G || se;
|
|
1024
|
+
ie && Ht(function() {
|
|
1025
|
+
l.setState(J);
|
|
1026
|
+
}), this.props.onResize && ie && this.props.onResize(r, v, this.resizable, W);
|
|
1027
|
+
}
|
|
1028
|
+
}, s.prototype.onMouseUp = function(r) {
|
|
1029
|
+
var l, o, a = this.state, u = a.isResizing, n = a.direction;
|
|
1030
|
+
a.original, !(!u || !this.resizable) && (this.props.onResizeStop && this.props.onResizeStop(r, n, this.resizable, this.delta), this.props.size && this.setState({ width: (l = this.props.size.width) !== null && l !== void 0 ? l : "auto", height: (o = this.props.size.height) !== null && o !== void 0 ? o : "auto" }), this.unbindEvents(), this.setState({
|
|
1031
|
+
isResizing: !1,
|
|
1032
|
+
backgroundStyle: ae(ae({}, this.state.backgroundStyle), { cursor: "auto" })
|
|
1033
|
+
}));
|
|
1034
|
+
}, s.prototype.updateSize = function(r) {
|
|
1035
|
+
var l, o;
|
|
1036
|
+
this.setState({ width: (l = r.width) !== null && l !== void 0 ? l : "auto", height: (o = r.height) !== null && o !== void 0 ? o : "auto" });
|
|
1037
|
+
}, s.prototype.renderResizer = function() {
|
|
1038
|
+
var r = this, l = this.props, o = l.enable, a = l.handleStyles, u = l.handleClasses, n = l.handleWrapperStyle, c = l.handleWrapperClass, g = l.handleComponent;
|
|
1039
|
+
if (!o)
|
|
1040
|
+
return null;
|
|
1041
|
+
var y = Object.keys(o).map(function(m) {
|
|
1042
|
+
return o[m] !== !1 ? e.jsx(Xt, { direction: m, onResizeStart: r.onResizeStart, replaceStyles: a && a[m], className: u && u[m], children: g && g[m] ? g[m] : null }, m) : null;
|
|
1043
|
+
});
|
|
1044
|
+
return e.jsx("div", { className: c, style: n, children: y });
|
|
1045
|
+
}, s.prototype.render = function() {
|
|
1046
|
+
var r = this, l = Object.keys(this.props).reduce(function(u, n) {
|
|
1047
|
+
return Zt.indexOf(n) !== -1 || (u[n] = r.props[n]), u;
|
|
1048
|
+
}, {}), o = ae(ae(ae({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 });
|
|
1049
|
+
this.state.flexBasis && (o.flexBasis = this.state.flexBasis);
|
|
1050
|
+
var a = this.props.as || "div";
|
|
1051
|
+
return e.jsxs(a, ae({ style: o, className: this.props.className }, l, {
|
|
1052
|
+
// `ref` is after `extendsProps` to ensure this one wins over a version
|
|
1053
|
+
// passed in
|
|
1054
|
+
ref: function(u) {
|
|
1055
|
+
u && (r.resizable = u);
|
|
1056
|
+
},
|
|
1057
|
+
children: [this.state.isResizing && e.jsx("div", { style: this.state.backgroundStyle }), this.props.children, this.renderResizer()]
|
|
1058
|
+
}));
|
|
1059
|
+
}, s.defaultProps = {
|
|
1060
|
+
as: "div",
|
|
1061
|
+
onResizeStart: function() {
|
|
1062
|
+
},
|
|
1063
|
+
onResize: function() {
|
|
1064
|
+
},
|
|
1065
|
+
onResizeStop: function() {
|
|
1066
|
+
},
|
|
1067
|
+
enable: {
|
|
1068
|
+
top: !0,
|
|
1069
|
+
right: !0,
|
|
1070
|
+
bottom: !0,
|
|
1071
|
+
left: !0,
|
|
1072
|
+
topRight: !0,
|
|
1073
|
+
bottomRight: !0,
|
|
1074
|
+
bottomLeft: !0,
|
|
1075
|
+
topLeft: !0
|
|
1076
|
+
},
|
|
1077
|
+
style: {},
|
|
1078
|
+
grid: [1, 1],
|
|
1079
|
+
gridGap: [0, 0],
|
|
1080
|
+
lockAspectRatio: !1,
|
|
1081
|
+
lockAspectRatioExtraWidth: 0,
|
|
1082
|
+
lockAspectRatioExtraHeight: 0,
|
|
1083
|
+
scale: 1,
|
|
1084
|
+
resizeRatio: 1,
|
|
1085
|
+
snapGap: 0
|
|
1086
|
+
}, s;
|
|
1087
|
+
}($t)
|
|
1088
|
+
);
|
|
1089
|
+
const ft = (i) => {
|
|
1090
|
+
i || (i = "https://polls-tests-widgets-backend-1357.loca.lt");
|
|
1091
|
+
const [s, r] = E(!1), [l, o] = E(null), a = (b) => `${i ? i.replace(/\/$/, "") : ""}/api/polls${b}`, u = () => {
|
|
1092
|
+
const b = "csrftoken=", x = document.cookie ? document.cookie.split(";") : [];
|
|
1093
|
+
for (let f of x)
|
|
1094
|
+
if (f = f.trim(), f.startsWith(b)) return decodeURIComponent(f.substring(b.length));
|
|
1095
|
+
return null;
|
|
1096
|
+
}, n = async () => {
|
|
1097
|
+
await fetch(a("/csrf/"), { credentials: "include" });
|
|
1098
|
+
}, c = async (b, x = {}) => {
|
|
1099
|
+
const f = {
|
|
1100
|
+
credentials: "include",
|
|
1101
|
+
method: "GET",
|
|
1102
|
+
mode: "cors",
|
|
1103
|
+
headers: {
|
|
1104
|
+
"Content-Type": "application/json",
|
|
1105
|
+
"bypass-tunnel-reminder": "true"
|
|
1106
|
+
}
|
|
1107
|
+
}, C = {
|
|
1108
|
+
...f,
|
|
1109
|
+
...x,
|
|
1110
|
+
headers: {
|
|
1111
|
+
...f.headers,
|
|
1112
|
+
...x.headers || {}
|
|
1113
|
+
}
|
|
1114
|
+
}, T = await fetch(b, C), I = await T.text();
|
|
1115
|
+
let A = null;
|
|
1116
|
+
try {
|
|
1117
|
+
A = I ? JSON.parse(I) : null;
|
|
1118
|
+
} catch {
|
|
1119
|
+
A = I;
|
|
1120
|
+
}
|
|
1121
|
+
if (!T.ok) {
|
|
1122
|
+
const R = new Error(A && (A.detail || A.message) || T.statusText);
|
|
1123
|
+
throw R.status = T.status, R;
|
|
1124
|
+
}
|
|
1125
|
+
return A;
|
|
1126
|
+
}, g = V(async (b, x) => {
|
|
1127
|
+
r(!0), o(null);
|
|
1128
|
+
try {
|
|
1129
|
+
await n();
|
|
1130
|
+
const f = u();
|
|
1131
|
+
return await c(a(`/${b}/`), {
|
|
1132
|
+
method: "DELETE",
|
|
1133
|
+
mode: "cors",
|
|
1134
|
+
headers: {
|
|
1135
|
+
"X-CSRFToken": f,
|
|
1136
|
+
"X-User-ID": x
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
1139
|
+
} catch (f) {
|
|
1140
|
+
throw o(f.message), f;
|
|
1141
|
+
} finally {
|
|
1142
|
+
r(!1);
|
|
1143
|
+
}
|
|
1144
|
+
}, []), y = V(async () => {
|
|
1145
|
+
try {
|
|
1146
|
+
return await c(a("/list/"), { method: "GET" });
|
|
1147
|
+
} catch (b) {
|
|
1148
|
+
throw console.error("Ошибка получения списка опросов:", b), b;
|
|
1149
|
+
}
|
|
1150
|
+
}, [c]), m = V(async (b) => {
|
|
1151
|
+
r(!0), o(null);
|
|
1152
|
+
try {
|
|
1153
|
+
return await c(a(`/${b}/`), { method: "GET", mode: "cors" });
|
|
1154
|
+
} catch (x) {
|
|
1155
|
+
return o(x.message), null;
|
|
1156
|
+
} finally {
|
|
1157
|
+
r(!1);
|
|
1158
|
+
}
|
|
1159
|
+
}, []), v = V(async (b, x) => {
|
|
1160
|
+
r(!0), o(null), await n();
|
|
1161
|
+
const f = u();
|
|
1162
|
+
if (!f) throw new Error("CSRF token missing!");
|
|
1163
|
+
const C = (b.options || []).filter((A) => A.trim() !== "").map((A) => ({ choice_text: A }));
|
|
1164
|
+
let T = null;
|
|
1165
|
+
x.endDate && (T = (/* @__PURE__ */ new Date(`${x.endDate}T${x.endTime || "23:59:59"}`)).toISOString());
|
|
1166
|
+
const I = {
|
|
1167
|
+
owner: b.ownerID,
|
|
1168
|
+
title: b.title,
|
|
1169
|
+
choices: C,
|
|
1170
|
+
is_anonymous: x.isAnonymous,
|
|
1171
|
+
multiple_answers: x.multipleAnswers,
|
|
1172
|
+
end_date: T
|
|
1173
|
+
};
|
|
1174
|
+
try {
|
|
1175
|
+
return await c(a("/create/"), {
|
|
1176
|
+
method: "POST",
|
|
1177
|
+
mode: "cors",
|
|
1178
|
+
headers: {
|
|
1179
|
+
"X-CSRFToken": f
|
|
1180
|
+
},
|
|
1181
|
+
body: JSON.stringify(I)
|
|
1182
|
+
});
|
|
1183
|
+
} catch (A) {
|
|
1184
|
+
throw o(A.message), A;
|
|
1185
|
+
} finally {
|
|
1186
|
+
r(!1);
|
|
1187
|
+
}
|
|
1188
|
+
}, []);
|
|
1189
|
+
V(async (b) => {
|
|
1190
|
+
r(!0), o(null);
|
|
1191
|
+
try {
|
|
1192
|
+
return await c(a(`/${b}/`), { method: "GET" });
|
|
1193
|
+
} catch (x) {
|
|
1194
|
+
return o(x.message), null;
|
|
1195
|
+
} finally {
|
|
1196
|
+
r(!1);
|
|
1197
|
+
}
|
|
1198
|
+
}, []);
|
|
1199
|
+
const d = V(async (b, x) => {
|
|
1200
|
+
r(!0), o(null), await n();
|
|
1201
|
+
const f = u();
|
|
1202
|
+
if (!f) throw new Error("CSRF token missing!");
|
|
1203
|
+
try {
|
|
1204
|
+
return await c(a(`/${b}/vote/`), {
|
|
1205
|
+
method: "POST",
|
|
1206
|
+
headers: { "X-CSRFToken": f },
|
|
1207
|
+
body: JSON.stringify({ choice_id: x.choiceId, user: x.userId })
|
|
1208
|
+
});
|
|
1209
|
+
} catch (C) {
|
|
1210
|
+
throw o(C.message), C;
|
|
1211
|
+
} finally {
|
|
1212
|
+
r(!1);
|
|
1213
|
+
}
|
|
1214
|
+
}, []), S = V(async (b, x) => {
|
|
1215
|
+
r(!0), o(null), await n();
|
|
1216
|
+
const f = u();
|
|
1217
|
+
try {
|
|
1218
|
+
return await c(a(`/${b}/unvote/}`), {
|
|
1219
|
+
method: "POST",
|
|
1220
|
+
headers: { "X-CSRFToken": f },
|
|
1221
|
+
body: JSON.stringify({ user: x })
|
|
1222
|
+
// Передаем ID пользователя
|
|
1223
|
+
});
|
|
1224
|
+
} catch (C) {
|
|
1225
|
+
throw o(C.message), C;
|
|
1226
|
+
} finally {
|
|
1227
|
+
r(!1);
|
|
1228
|
+
}
|
|
1229
|
+
}, []);
|
|
1230
|
+
return {
|
|
1231
|
+
createPoll: v,
|
|
1232
|
+
loading: s,
|
|
1233
|
+
error: l,
|
|
1234
|
+
setError: o,
|
|
1235
|
+
fetchAllPolls: y,
|
|
1236
|
+
fetchPoll: m,
|
|
1237
|
+
createPoll: v,
|
|
1238
|
+
votePoll: d,
|
|
1239
|
+
unvotePoll: S,
|
|
1240
|
+
deletePoll: g
|
|
1241
|
+
};
|
|
1242
|
+
}, Se = ({ placeholder: i, value: s, onChange: r, style: l, autoFocus: o, type: a = "text" }) => /* @__PURE__ */ e.jsx(
|
|
1243
|
+
"input",
|
|
1244
|
+
{
|
|
1245
|
+
type: a,
|
|
1246
|
+
placeholder: i,
|
|
1247
|
+
value: s,
|
|
1248
|
+
onChange: r,
|
|
1249
|
+
autoFocus: o,
|
|
1250
|
+
className: "nodrag",
|
|
1251
|
+
style: {
|
|
1252
|
+
width: "100%",
|
|
1253
|
+
boxSizing: "border-box",
|
|
1254
|
+
padding: "12px 16px",
|
|
1255
|
+
marginBottom: "12px",
|
|
1256
|
+
backgroundColor: "#e0e0e0",
|
|
1257
|
+
border: "none",
|
|
1258
|
+
borderRadius: "0px",
|
|
1259
|
+
fontSize: "16px",
|
|
1260
|
+
color: "#333",
|
|
1261
|
+
outline: "none",
|
|
1262
|
+
fontFamily: "Arial, sans-serif",
|
|
1263
|
+
...l
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
), Q = ({ onClick: i, children: s, style: r, disabled: l }) => /* @__PURE__ */ e.jsx(
|
|
1267
|
+
"button",
|
|
1268
|
+
{
|
|
1269
|
+
onClick: l ? void 0 : i,
|
|
1270
|
+
disabled: l,
|
|
1271
|
+
className: "nodrag",
|
|
1272
|
+
style: {
|
|
1273
|
+
padding: "10px 30px",
|
|
1274
|
+
backgroundColor: l ? "#f0f0f0" : "#d9d9d9",
|
|
1275
|
+
// Светлее, если выключена
|
|
1276
|
+
border: "none",
|
|
1277
|
+
borderRadius: "0px",
|
|
1278
|
+
fontSize: "18px",
|
|
1279
|
+
color: l ? "#999" : "#000",
|
|
1280
|
+
// Серый текст, если выключена
|
|
1281
|
+
cursor: l ? "not-allowed" : "pointer",
|
|
1282
|
+
// Меняем курсор
|
|
1283
|
+
fontWeight: "400",
|
|
1284
|
+
transition: "background-color 0.2s",
|
|
1285
|
+
whiteSpace: "nowrap",
|
|
1286
|
+
opacity: l ? 0.7 : 1,
|
|
1287
|
+
// Добавляем прозрачность
|
|
1288
|
+
...r
|
|
1289
|
+
},
|
|
1290
|
+
onMouseOver: (o) => {
|
|
1291
|
+
l || (o.target.style.backgroundColor = "#c0c0c0");
|
|
1292
|
+
},
|
|
1293
|
+
onMouseOut: (o) => {
|
|
1294
|
+
l || (o.target.style.backgroundColor = (r == null ? void 0 : r.backgroundColor) || "#d9d9d9");
|
|
1295
|
+
},
|
|
1296
|
+
children: s
|
|
1297
|
+
}
|
|
1298
|
+
), ve = ({ checked: i, onChange: s }) => /* @__PURE__ */ e.jsxs(
|
|
1299
|
+
"label",
|
|
1300
|
+
{
|
|
1301
|
+
style: {
|
|
1302
|
+
display: "inline-flex",
|
|
1303
|
+
alignItems: "center",
|
|
1304
|
+
cursor: "pointer",
|
|
1305
|
+
userSelect: "none",
|
|
1306
|
+
position: "relative"
|
|
1307
|
+
},
|
|
1308
|
+
children: [
|
|
1309
|
+
/* @__PURE__ */ e.jsx(
|
|
1310
|
+
"input",
|
|
1311
|
+
{
|
|
1312
|
+
type: "checkbox",
|
|
1313
|
+
checked: i,
|
|
1314
|
+
onChange: s,
|
|
1315
|
+
style: {
|
|
1316
|
+
opacity: 0,
|
|
1317
|
+
width: 0,
|
|
1318
|
+
height: 0,
|
|
1319
|
+
position: "absolute"
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
),
|
|
1323
|
+
/* @__PURE__ */ e.jsx(
|
|
1324
|
+
"span",
|
|
1325
|
+
{
|
|
1326
|
+
style: {
|
|
1327
|
+
display: "inline-block",
|
|
1328
|
+
width: "24px",
|
|
1329
|
+
height: "24px",
|
|
1330
|
+
border: `2px solid ${i ? "#000" : "#6c757d"}`,
|
|
1331
|
+
borderRadius: "4px",
|
|
1332
|
+
backgroundColor: i ? "#000" : "#fff",
|
|
1333
|
+
transition: "background-color 0.2s, border-color 0.2s",
|
|
1334
|
+
position: "relative",
|
|
1335
|
+
flexShrink: 0
|
|
1336
|
+
},
|
|
1337
|
+
children: i && /* @__PURE__ */ e.jsx(
|
|
1338
|
+
"span",
|
|
1339
|
+
{
|
|
1340
|
+
style: {
|
|
1341
|
+
content: '""',
|
|
1342
|
+
position: "absolute",
|
|
1343
|
+
left: "8px",
|
|
1344
|
+
top: "3px",
|
|
1345
|
+
width: "6px",
|
|
1346
|
+
height: "14px",
|
|
1347
|
+
border: "solid white",
|
|
1348
|
+
borderWidth: "0 3px 3px 0",
|
|
1349
|
+
transform: "rotate(45deg)",
|
|
1350
|
+
transition: "opacity 0.2s",
|
|
1351
|
+
opacity: i ? 1 : 0
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
)
|
|
1355
|
+
}
|
|
1356
|
+
)
|
|
1357
|
+
]
|
|
1358
|
+
}
|
|
1359
|
+
), Qt = ({ onClick: i }) => /* @__PURE__ */ e.jsx(
|
|
1360
|
+
"div",
|
|
1361
|
+
{
|
|
1362
|
+
onClick: i,
|
|
1363
|
+
className: "nodrag",
|
|
1364
|
+
style: {
|
|
1365
|
+
display: "flex",
|
|
1366
|
+
gap: "6px",
|
|
1367
|
+
cursor: "pointer",
|
|
1368
|
+
flexShrink: 0,
|
|
1369
|
+
padding: "5px"
|
|
1370
|
+
// For easier clicking
|
|
1371
|
+
},
|
|
1372
|
+
children: [1, 2, 3].map((s) => /* @__PURE__ */ e.jsx(
|
|
1373
|
+
"div",
|
|
1374
|
+
{
|
|
1375
|
+
style: {
|
|
1376
|
+
width: "14px",
|
|
1377
|
+
height: "14px",
|
|
1378
|
+
borderRadius: "50%",
|
|
1379
|
+
backgroundColor: "#757575"
|
|
1380
|
+
}
|
|
1381
|
+
},
|
|
1382
|
+
s
|
|
1383
|
+
))
|
|
1384
|
+
}
|
|
1385
|
+
), Pe = ({ id: i, name: s, value: r, checked: l, onChange: o, children: a }) => /* @__PURE__ */ e.jsxs(
|
|
1386
|
+
"label",
|
|
1387
|
+
{
|
|
1388
|
+
htmlFor: i,
|
|
1389
|
+
style: {
|
|
1390
|
+
display: "inline-flex",
|
|
1391
|
+
alignItems: "center",
|
|
1392
|
+
cursor: "pointer",
|
|
1393
|
+
userSelect: "none"
|
|
1394
|
+
},
|
|
1395
|
+
children: [
|
|
1396
|
+
/* @__PURE__ */ e.jsx(
|
|
1397
|
+
"input",
|
|
1398
|
+
{
|
|
1399
|
+
id: i,
|
|
1400
|
+
type: "radio",
|
|
1401
|
+
name: s,
|
|
1402
|
+
value: r,
|
|
1403
|
+
checked: l,
|
|
1404
|
+
onChange: o,
|
|
1405
|
+
style: {
|
|
1406
|
+
// Полностью скрываем нативный вид, но оставляем функциональность
|
|
1407
|
+
opacity: 0,
|
|
1408
|
+
width: 0,
|
|
1409
|
+
height: 0,
|
|
1410
|
+
position: "absolute"
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
),
|
|
1414
|
+
/* @__PURE__ */ e.jsx(
|
|
1415
|
+
"span",
|
|
1416
|
+
{
|
|
1417
|
+
style: {
|
|
1418
|
+
display: "inline-block",
|
|
1419
|
+
width: "20px",
|
|
1420
|
+
height: "20px",
|
|
1421
|
+
borderRadius: "50%",
|
|
1422
|
+
// Делает его круглым
|
|
1423
|
+
border: `2px solid ${l ? "#000" : "#6c757d"}`,
|
|
1424
|
+
// Синяя рамка при checked
|
|
1425
|
+
backgroundColor: "#fff",
|
|
1426
|
+
position: "relative",
|
|
1427
|
+
flexShrink: 0,
|
|
1428
|
+
transition: "border-color 0.2s"
|
|
1429
|
+
},
|
|
1430
|
+
children: l && /* @__PURE__ */ e.jsx(
|
|
1431
|
+
"span",
|
|
1432
|
+
{
|
|
1433
|
+
style: {
|
|
1434
|
+
position: "absolute",
|
|
1435
|
+
top: "50%",
|
|
1436
|
+
left: "50%",
|
|
1437
|
+
transform: "translate(-50%, -50%)",
|
|
1438
|
+
width: "10px",
|
|
1439
|
+
// Размер внутренней точки
|
|
1440
|
+
height: "10px",
|
|
1441
|
+
borderRadius: "50%",
|
|
1442
|
+
backgroundColor: "#000",
|
|
1443
|
+
// Синяя внутренняя точка
|
|
1444
|
+
transition: "opacity 0.2s",
|
|
1445
|
+
opacity: 1
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
)
|
|
1449
|
+
}
|
|
1450
|
+
),
|
|
1451
|
+
a
|
|
1452
|
+
]
|
|
1453
|
+
}
|
|
1454
|
+
), $e = ({ title: i, children: s, style: r, toggleSettings: l, showMenuDots: o = !0 }) => /* @__PURE__ */ e.jsxs(
|
|
1455
|
+
"div",
|
|
1456
|
+
{
|
|
1457
|
+
style: {
|
|
1458
|
+
width: "100%",
|
|
1459
|
+
height: "100%",
|
|
1460
|
+
backgroundColor: "#fff",
|
|
1461
|
+
padding: "20px 24px",
|
|
1462
|
+
display: "flex",
|
|
1463
|
+
flexDirection: "column",
|
|
1464
|
+
boxSizing: "border-box",
|
|
1465
|
+
boxShadow: "0 2px 10px rgba(0,0,0,0.05)",
|
|
1466
|
+
position: "relative",
|
|
1467
|
+
overflow: "hidden",
|
|
1468
|
+
...r
|
|
1469
|
+
},
|
|
1470
|
+
children: [
|
|
1471
|
+
/* @__PURE__ */ e.jsxs("div", { style: {
|
|
1472
|
+
display: "flex",
|
|
1473
|
+
justifyContent: "space-between",
|
|
1474
|
+
alignItems: "flex-start",
|
|
1475
|
+
marginBottom: "20px",
|
|
1476
|
+
flexShrink: 0
|
|
1477
|
+
}, children: [
|
|
1478
|
+
/* @__PURE__ */ e.jsx("span", { style: {
|
|
1479
|
+
fontSize: "20px",
|
|
1480
|
+
fontWeight: "400",
|
|
1481
|
+
// Not bold
|
|
1482
|
+
color: "#000",
|
|
1483
|
+
lineHeight: "1.2",
|
|
1484
|
+
wordBreak: "break-word",
|
|
1485
|
+
marginRight: "10px"
|
|
1486
|
+
}, children: i }),
|
|
1487
|
+
o && /* @__PURE__ */ e.jsx(Qt, { onClick: l })
|
|
1488
|
+
] }),
|
|
1489
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
1490
|
+
flexGrow: 1,
|
|
1491
|
+
display: "flex",
|
|
1492
|
+
flexDirection: "column",
|
|
1493
|
+
overflow: "hidden",
|
|
1494
|
+
minHeight: 0
|
|
1495
|
+
}, children: s })
|
|
1496
|
+
]
|
|
1497
|
+
}
|
|
1498
|
+
), er = ({ onSave: i, onDataChange: s, initialData: r }) => {
|
|
1499
|
+
var y;
|
|
1500
|
+
const l = r != null && r.options && r.options.length > 0 && r.options.some((m) => m.trim() === "") ? r.options : [...((y = r == null ? void 0 : r.options) == null ? void 0 : y.filter((m) => m.trim() !== "")) || [], ""], [o, a] = E((r == null ? void 0 : r.title) || ""), [u, n] = E(l), c = ct(null);
|
|
1501
|
+
ne(() => {
|
|
1502
|
+
s({ title: o, options: u.filter((m) => m.trim() !== "") });
|
|
1503
|
+
}, [o, u, s]);
|
|
1504
|
+
const g = (m, v) => {
|
|
1505
|
+
let d = [...u];
|
|
1506
|
+
d[m] = v, m === d.length - 1 && v.trim() !== "" && d.push(""), d = d.filter((S, b) => S.trim() !== "" || b === d.length - 1), n(d);
|
|
1507
|
+
};
|
|
1508
|
+
return ne(() => {
|
|
1509
|
+
c.current && u.length > 1 && u[u.length - 1].trim() === "" && c.current.scrollIntoView({ behavior: "smooth" });
|
|
1510
|
+
}, [u.length]), /* @__PURE__ */ e.jsxs("div", { style: {
|
|
1511
|
+
display: "flex",
|
|
1512
|
+
flexDirection: "column",
|
|
1513
|
+
height: "100%",
|
|
1514
|
+
width: "100%",
|
|
1515
|
+
overflow: "hidden"
|
|
1516
|
+
}, children: [
|
|
1517
|
+
/* @__PURE__ */ e.jsx("div", { style: { flexShrink: 0, width: "100%" }, children: /* @__PURE__ */ e.jsx(
|
|
1518
|
+
Se,
|
|
1519
|
+
{
|
|
1520
|
+
placeholder: "Название опроса",
|
|
1521
|
+
value: o,
|
|
1522
|
+
onChange: (m) => a(m.target.value),
|
|
1523
|
+
style: {
|
|
1524
|
+
fontSize: "20px",
|
|
1525
|
+
padding: "14px 16px",
|
|
1526
|
+
marginBottom: "20px",
|
|
1527
|
+
color: "#333",
|
|
1528
|
+
fontWeight: "bold",
|
|
1529
|
+
borderRadius: "15px"
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
) }),
|
|
1533
|
+
/* @__PURE__ */ e.jsxs(
|
|
1534
|
+
"div",
|
|
1535
|
+
{
|
|
1536
|
+
className: "scroll-container nowheel",
|
|
1537
|
+
onWheel: (m) => m.stopPropagation(),
|
|
1538
|
+
style: {
|
|
1539
|
+
flexGrow: 1,
|
|
1540
|
+
overflowY: "auto",
|
|
1541
|
+
overflowX: "hidden",
|
|
1542
|
+
paddingRight: "5px",
|
|
1543
|
+
marginBottom: "10px",
|
|
1544
|
+
width: "100%"
|
|
1545
|
+
},
|
|
1546
|
+
children: [
|
|
1547
|
+
u.map((m, v) => /* @__PURE__ */ e.jsx("div", { style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ e.jsx(
|
|
1548
|
+
Se,
|
|
1549
|
+
{
|
|
1550
|
+
placeholder: `Вариант ${v + 1}`,
|
|
1551
|
+
value: m,
|
|
1552
|
+
onChange: (d) => g(v, d.target.value),
|
|
1553
|
+
style: { flexGrow: 1, marginBottom: "10px", borderRadius: "15px" }
|
|
1554
|
+
}
|
|
1555
|
+
) }, v)),
|
|
1556
|
+
/* @__PURE__ */ e.jsx("div", { ref: c })
|
|
1557
|
+
]
|
|
1558
|
+
}
|
|
1559
|
+
),
|
|
1560
|
+
/* @__PURE__ */ e.jsx("div", { style: { flexShrink: 0, marginTop: "20px" }, children: /* @__PURE__ */ e.jsx(
|
|
1561
|
+
Q,
|
|
1562
|
+
{
|
|
1563
|
+
onClick: () => i(),
|
|
1564
|
+
style: { width: "100%", borderRadius: "15px" },
|
|
1565
|
+
children: "Сохранить опрос"
|
|
1566
|
+
}
|
|
1567
|
+
) })
|
|
1568
|
+
] });
|
|
1569
|
+
}, tr = ({ onDataChange: i, initialData: s, toggleSettings: r, onDelete: l }) => {
|
|
1570
|
+
const [o, a] = E((s == null ? void 0 : s.isAnonymous) || !1), [u, n] = E((s == null ? void 0 : s.multipleAnswers) || !1), [c, g] = E((s == null ? void 0 : s.endDate) || ""), [y, m] = E((s == null ? void 0 : s.endTime) || "");
|
|
1571
|
+
ne(() => {
|
|
1572
|
+
i({ isAnonymous: o, multipleAnswers: u, endDate: c, endTime: y });
|
|
1573
|
+
}, [o, u, c, y, i]);
|
|
1574
|
+
const v = {
|
|
1575
|
+
boxSizing: "border-box",
|
|
1576
|
+
padding: "12px 16px",
|
|
1577
|
+
backgroundColor: "#e0e0e0",
|
|
1578
|
+
border: "none",
|
|
1579
|
+
borderRadius: "15px",
|
|
1580
|
+
fontSize: "16px",
|
|
1581
|
+
color: "#333",
|
|
1582
|
+
outline: "none",
|
|
1583
|
+
fontFamily: "Arial, sans-serif",
|
|
1584
|
+
flex: 1
|
|
1585
|
+
// To take up equal space in the container
|
|
1586
|
+
};
|
|
1587
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "nodrag", style: {
|
|
1588
|
+
display: "flex",
|
|
1589
|
+
flexDirection: "column",
|
|
1590
|
+
height: "100%",
|
|
1591
|
+
width: "100%",
|
|
1592
|
+
paddingRight: "5px",
|
|
1593
|
+
overflowY: "auto",
|
|
1594
|
+
overflowX: "hidden",
|
|
1595
|
+
boxSizing: "border-box"
|
|
1596
|
+
}, children: [
|
|
1597
|
+
/* @__PURE__ */ e.jsx("h3", { style: {
|
|
1598
|
+
fontSize: "20px",
|
|
1599
|
+
fontWeight: "bold",
|
|
1600
|
+
color: "#000",
|
|
1601
|
+
marginBottom: "25px",
|
|
1602
|
+
flexShrink: 0
|
|
1603
|
+
}, children: "Параметры опроса" }),
|
|
1604
|
+
/* @__PURE__ */ e.jsxs("div", { style: {
|
|
1605
|
+
display: "flex",
|
|
1606
|
+
gap: "10px",
|
|
1607
|
+
alignItems: "center",
|
|
1608
|
+
marginBottom: "25px"
|
|
1609
|
+
}, children: [
|
|
1610
|
+
/* @__PURE__ */ e.jsx(ve, { checked: o, onChange: () => a(!o) }),
|
|
1611
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontSize: "18px", color: "#333" }, children: "Анонимность" })
|
|
1612
|
+
] }),
|
|
1613
|
+
/* @__PURE__ */ e.jsxs("div", { style: {
|
|
1614
|
+
display: "flex",
|
|
1615
|
+
gap: "10px",
|
|
1616
|
+
alignItems: "center",
|
|
1617
|
+
marginBottom: "25px"
|
|
1618
|
+
}, children: [
|
|
1619
|
+
/* @__PURE__ */ e.jsx(ve, { checked: u, onChange: () => n(!u) }),
|
|
1620
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontSize: "18px", color: "#333" }, children: "Несколько ответов" })
|
|
1621
|
+
] }),
|
|
1622
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flexShrink: 0 }, children: [
|
|
1623
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontSize: "18px", color: "#333", marginBottom: "10px", display: "block" }, children: "Дата и время окончания" }),
|
|
1624
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", gap: "10px" }, children: [
|
|
1625
|
+
/* @__PURE__ */ e.jsx(
|
|
1626
|
+
"input",
|
|
1627
|
+
{
|
|
1628
|
+
type: "date",
|
|
1629
|
+
className: "nodrag",
|
|
1630
|
+
value: c,
|
|
1631
|
+
onChange: (d) => g(d.target.value),
|
|
1632
|
+
style: v
|
|
1633
|
+
}
|
|
1634
|
+
),
|
|
1635
|
+
/* @__PURE__ */ e.jsx(
|
|
1636
|
+
"input",
|
|
1637
|
+
{
|
|
1638
|
+
type: "time",
|
|
1639
|
+
className: "nodrag",
|
|
1640
|
+
value: y,
|
|
1641
|
+
onChange: (d) => m(d.target.value),
|
|
1642
|
+
style: v
|
|
1643
|
+
}
|
|
1644
|
+
)
|
|
1645
|
+
] })
|
|
1646
|
+
] }),
|
|
1647
|
+
/* @__PURE__ */ e.jsx("div", { style: { flexShrink: 0, display: "flex", justifyContent: "flex-end", marginTop: "auto", paddingTop: "20px" }, children: /* @__PURE__ */ e.jsx(Q, { onClick: r, style: { width: "100%", borderRadius: "15px" }, children: "Назад к опросу" }) })
|
|
1648
|
+
] });
|
|
1649
|
+
}, rr = ({ pollData: i, setPollData: s }) => {
|
|
1650
|
+
var _;
|
|
1651
|
+
const {
|
|
1652
|
+
id: r,
|
|
1653
|
+
title: l,
|
|
1654
|
+
choices: o,
|
|
1655
|
+
// Массив объектов {id, choice_text, votes_count}
|
|
1656
|
+
all_votes: a = [],
|
|
1657
|
+
voted_users: u = [],
|
|
1658
|
+
is_anonymous: n,
|
|
1659
|
+
multiple_answers: c,
|
|
1660
|
+
end_date: g,
|
|
1661
|
+
total_votes: y
|
|
1662
|
+
// Общее кол-во голосов (приходит с бэкенда)
|
|
1663
|
+
} = i, v = (() => {
|
|
1664
|
+
if (!g) return !1;
|
|
1665
|
+
const p = new Date(g);
|
|
1666
|
+
return /* @__PURE__ */ new Date() > p;
|
|
1667
|
+
})(), { votePoll: d, loading: S, error: b, setError: x, fetchPoll: f, unvotePoll: C } = ft(), T = localStorage.getItem("userId") || "Anonymous", I = n ? "Анонимно" : "Неанонимно", A = g ? `До ${g.split("T")[0]}` : "Нет даты", R = (p) => !u || u.length === 0 ? "0%" : `${Math.round(p / u.length * 100)}%`, [k, B] = E(a.some((p) => p.user === String(T))), [Y, O] = E(), [w, W] = E([]), [F, q] = E(a.find((p) => p.user === String(T))), [U, J] = E(!1), [P, G] = E(0), [se, ie] = E(k || S || v || !c && !Y || c && w.length === 0);
|
|
1668
|
+
ne(() => {
|
|
1669
|
+
ie(k || S || v || !c && !Y || c && w.length === 0);
|
|
1670
|
+
}, [k, S, c, Y, w, v]);
|
|
1671
|
+
const ee = (p) => {
|
|
1672
|
+
O(p);
|
|
1673
|
+
}, de = (p) => {
|
|
1674
|
+
W((M) => M.includes(p) ? M.filter((X) => X !== p) : [...M, p]);
|
|
1675
|
+
}, ue = (p) => {
|
|
1676
|
+
n || (J(!0), G(p));
|
|
1677
|
+
}, fe = () => {
|
|
1678
|
+
J(!1);
|
|
1679
|
+
}, ge = async () => {
|
|
1680
|
+
if (v) {
|
|
1681
|
+
alert("Время прохождения теста истекло.");
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
if (!(!c && !Y || c && w.length === 0))
|
|
1685
|
+
try {
|
|
1686
|
+
let p = !0;
|
|
1687
|
+
if (c) {
|
|
1688
|
+
const M = w.map(
|
|
1689
|
+
(X) => d(r, {
|
|
1690
|
+
choiceId: X,
|
|
1691
|
+
userId: T
|
|
1692
|
+
})
|
|
1693
|
+
);
|
|
1694
|
+
try {
|
|
1695
|
+
await Promise.all(M), p = !0;
|
|
1696
|
+
} catch (X) {
|
|
1697
|
+
console.error("Один из голосов не прошел", X), p = !1;
|
|
1698
|
+
}
|
|
1699
|
+
} else
|
|
1700
|
+
p = await d(
|
|
1701
|
+
r,
|
|
1702
|
+
{
|
|
1703
|
+
choiceId: Y,
|
|
1704
|
+
userId: T
|
|
1705
|
+
}
|
|
1706
|
+
);
|
|
1707
|
+
p && (B(!0), f && f(r).then((M) => s(M)));
|
|
1708
|
+
} catch (p) {
|
|
1709
|
+
console.error("Ошибка при голосовании:", p), x("Не удалось сохранить голос");
|
|
1710
|
+
}
|
|
1711
|
+
}, ce = async () => {
|
|
1712
|
+
try {
|
|
1713
|
+
const p = await C(r, T);
|
|
1714
|
+
if (p)
|
|
1715
|
+
s(p);
|
|
1716
|
+
else if (f) {
|
|
1717
|
+
const M = await f(r);
|
|
1718
|
+
s(M);
|
|
1719
|
+
}
|
|
1720
|
+
B(!1), q(null), O(null), W([]);
|
|
1721
|
+
} catch (p) {
|
|
1722
|
+
console.error("Ошибка при отмене голоса:", p), x("Не удалось отменить голос");
|
|
1723
|
+
}
|
|
1724
|
+
}, pe = new Intl.PluralRules("ru-RU");
|
|
1725
|
+
function le(p) {
|
|
1726
|
+
const M = pe.select(p), X = {
|
|
1727
|
+
one: "голос",
|
|
1728
|
+
few: "голоса",
|
|
1729
|
+
many: "голосов",
|
|
1730
|
+
other: "голосов"
|
|
1731
|
+
};
|
|
1732
|
+
return X[M] || X.many;
|
|
1733
|
+
}
|
|
1734
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1735
|
+
"div",
|
|
1736
|
+
{
|
|
1737
|
+
className: "nodrag nowheel",
|
|
1738
|
+
onWheel: (p) => p.stopPropagation(),
|
|
1739
|
+
style: {
|
|
1740
|
+
display: "flex",
|
|
1741
|
+
color: "#000",
|
|
1742
|
+
flexDirection: "column",
|
|
1743
|
+
height: "100%",
|
|
1744
|
+
width: "100%",
|
|
1745
|
+
overflow: "hidden",
|
|
1746
|
+
paddingRight: "5px"
|
|
1747
|
+
},
|
|
1748
|
+
children: [
|
|
1749
|
+
/* @__PURE__ */ e.jsx("div", { style: { flexShrink: 0, width: "100%" }, children: /* @__PURE__ */ e.jsx("h3", { style: { fontSize: "22px", fontWeight: "bold", backgroundColor: "#e0e0e0", padding: "12px 16px", borderRadius: "10px" }, children: l }) }),
|
|
1750
|
+
/* @__PURE__ */ e.jsxs("div", { style: { fontSize: "14px", color: "#666", marginBottom: "10px" }, children: [
|
|
1751
|
+
I,
|
|
1752
|
+
" | ",
|
|
1753
|
+
A,
|
|
1754
|
+
" | Голосов: ",
|
|
1755
|
+
u.length || 0
|
|
1756
|
+
] }),
|
|
1757
|
+
v && /* @__PURE__ */ e.jsx("div", { style: {
|
|
1758
|
+
padding: "10px",
|
|
1759
|
+
backgroundColor: "#ffdddd",
|
|
1760
|
+
color: "red",
|
|
1761
|
+
borderRadius: "10px",
|
|
1762
|
+
textAlign: "center",
|
|
1763
|
+
fontWeight: "bold",
|
|
1764
|
+
marginBottom: "10px"
|
|
1765
|
+
}, children: "Срок прохождения теста истек" }),
|
|
1766
|
+
b && /* @__PURE__ */ e.jsx("p", { style: { color: "red" }, children: b }),
|
|
1767
|
+
U && /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", color: "#000", flexDirection: "column", height: "100%", width: "100%", overflowY: "auto", gap: "10px" }, children: [
|
|
1768
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", justifyContent: "space-between", padding: "12px", position: "relative", overflow: "hidden" }, children: [
|
|
1769
|
+
/* @__PURE__ */ e.jsx("div", { style: { position: "absolute", bottom: 0, left: 0, height: "5px", width: "100%", backgroundColor: "#ccc" } }),
|
|
1770
|
+
/* @__PURE__ */ e.jsx("div", { style: { position: "absolute", bottom: 0, left: 0, height: "5px", width: R(P == null ? void 0 : P.votes_count), backgroundColor: "#000", transition: "width 0.5s" } }),
|
|
1771
|
+
/* @__PURE__ */ e.jsx("span", { style: { zIndex: 1 }, children: P == null ? void 0 : P.choice_text }),
|
|
1772
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontWeight: "bold", zIndex: 1 }, children: `${R(P == null ? void 0 : P.votes_count)}` })
|
|
1773
|
+
] }),
|
|
1774
|
+
/* @__PURE__ */ e.jsxs("span", { style: { marginLeft: "12px", color: "#666" }, children: [
|
|
1775
|
+
P == null ? void 0 : P.votes_count,
|
|
1776
|
+
" ",
|
|
1777
|
+
le(P == null ? void 0 : P.votes_count)
|
|
1778
|
+
] }),
|
|
1779
|
+
/* @__PURE__ */ e.jsx("div", { style: { overflowY: "auto", margin: "12px 16px", display: "flex", flexDirection: "column", gap: "15px" }, children: (_ = a == null ? void 0 : a.filter((p) => p.choice_id === (P == null ? void 0 : P.id))) == null ? void 0 : _.map(
|
|
1780
|
+
(p, M) => /* @__PURE__ */ e.jsx(
|
|
1781
|
+
"div",
|
|
1782
|
+
{
|
|
1783
|
+
style: { display: "flex", alignItems: "center", gap: "10px" },
|
|
1784
|
+
children: /* @__PURE__ */ e.jsx("span", { style: {}, children: p.user })
|
|
1785
|
+
},
|
|
1786
|
+
M
|
|
1787
|
+
)
|
|
1788
|
+
) }),
|
|
1789
|
+
/* @__PURE__ */ e.jsx(
|
|
1790
|
+
Q,
|
|
1791
|
+
{
|
|
1792
|
+
style: { marginTop: "auto" },
|
|
1793
|
+
onClick: fe,
|
|
1794
|
+
children: "Назад"
|
|
1795
|
+
}
|
|
1796
|
+
)
|
|
1797
|
+
] }),
|
|
1798
|
+
!U && /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", color: "#000", flexDirection: "column", height: "100%", width: "100%", overflowY: "auto" }, children: [
|
|
1799
|
+
k ? /* @__PURE__ */ e.jsx(
|
|
1800
|
+
"div",
|
|
1801
|
+
{
|
|
1802
|
+
className: "scroll-container nowheel",
|
|
1803
|
+
style: {
|
|
1804
|
+
flexGrow: 1,
|
|
1805
|
+
overflowY: "auto",
|
|
1806
|
+
minHeight: 0,
|
|
1807
|
+
paddingRight: "5px"
|
|
1808
|
+
},
|
|
1809
|
+
children: o == null ? void 0 : o.map((p) => {
|
|
1810
|
+
const M = R(p.votes_count);
|
|
1811
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1812
|
+
"div",
|
|
1813
|
+
{
|
|
1814
|
+
onClick: () => {
|
|
1815
|
+
ue(p);
|
|
1816
|
+
},
|
|
1817
|
+
style: { display: "flex", flexDirection: "column", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
1818
|
+
children: [
|
|
1819
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flexGrow: 1, display: "flex", justifyContent: "space-between", padding: "12px", position: "relative", overflow: "hidden" }, children: [
|
|
1820
|
+
/* @__PURE__ */ e.jsx("div", { style: { position: "absolute", bottom: 0, left: 0, height: "5px", width: "100%", backgroundColor: "#ccc" } }),
|
|
1821
|
+
/* @__PURE__ */ e.jsx("div", { style: { position: "absolute", bottom: 0, left: 0, height: "5px", width: M, backgroundColor: "#000", transition: "width 0.5s" } }),
|
|
1822
|
+
/* @__PURE__ */ e.jsx("span", { style: { zIndex: 1 }, children: p.choice_text }),
|
|
1823
|
+
/* @__PURE__ */ e.jsx("span", { style: { zIndex: 1, marginLeft: "auto", marginRight: "10px" }, children: (F == null ? void 0 : F.choice_id) === p.id ? "✔" : "" }),
|
|
1824
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontWeight: "bold", zIndex: 1 }, children: `${M}` })
|
|
1825
|
+
] }),
|
|
1826
|
+
/* @__PURE__ */ e.jsxs("span", { style: { marginLeft: "12px", color: "#666" }, children: [
|
|
1827
|
+
p.votes_count,
|
|
1828
|
+
" ",
|
|
1829
|
+
le(p.votes_count)
|
|
1830
|
+
] })
|
|
1831
|
+
]
|
|
1832
|
+
},
|
|
1833
|
+
p.id
|
|
1834
|
+
);
|
|
1835
|
+
})
|
|
1836
|
+
}
|
|
1837
|
+
) : /* @__PURE__ */ e.jsx(
|
|
1838
|
+
"div",
|
|
1839
|
+
{
|
|
1840
|
+
className: "scroll-container nowheel",
|
|
1841
|
+
style: {
|
|
1842
|
+
flexGrow: 1,
|
|
1843
|
+
overflowY: "auto",
|
|
1844
|
+
minHeight: 0,
|
|
1845
|
+
paddingRight: "5px"
|
|
1846
|
+
},
|
|
1847
|
+
children: o == null ? void 0 : o.map((p) => {
|
|
1848
|
+
const M = p.id, X = c ? w.includes(M) : Y === M;
|
|
1849
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1850
|
+
"div",
|
|
1851
|
+
{
|
|
1852
|
+
onClick: () => c ? de(M) : ee(M),
|
|
1853
|
+
style: { display: "flex", alignItems: "center", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
1854
|
+
children: [
|
|
1855
|
+
c && /* @__PURE__ */ e.jsx(ve, { checked: X, onChange: () => de(M) }),
|
|
1856
|
+
!c && /* @__PURE__ */ e.jsx(Pe, { name: `poll-${r}`, checked: X, onChange: () => ee(M) }),
|
|
1857
|
+
/* @__PURE__ */ e.jsxs("div", { style: { flexGrow: 1, display: "flex", justifyContent: "space-between", backgroundColor: X ? "#d0d0d0" : "#e0e0e0", padding: "12px 16px", borderRadius: "10px", position: "relative", overflow: "hidden" }, children: [
|
|
1858
|
+
/* @__PURE__ */ e.jsx("span", { style: { zIndex: 1 }, children: p.choice_text }),
|
|
1859
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontWeight: "bold", zIndex: 1 }, children: "" })
|
|
1860
|
+
] })
|
|
1861
|
+
]
|
|
1862
|
+
},
|
|
1863
|
+
p.id
|
|
1864
|
+
);
|
|
1865
|
+
})
|
|
1866
|
+
}
|
|
1867
|
+
),
|
|
1868
|
+
/* @__PURE__ */ e.jsxs("div", { style: { marginTop: "auto", paddingTop: "20px", display: "flex", flexDirection: "column", gap: "10px" }, children: [
|
|
1869
|
+
!k && /* @__PURE__ */ e.jsx(
|
|
1870
|
+
Q,
|
|
1871
|
+
{
|
|
1872
|
+
onClick: ge,
|
|
1873
|
+
disabled: se,
|
|
1874
|
+
style: { width: "100%", backgroundColor: "#d9d9d9", borderRadius: "10px" },
|
|
1875
|
+
children: S ? "Отправка..." : "Сохранить"
|
|
1876
|
+
}
|
|
1877
|
+
),
|
|
1878
|
+
k && /* @__PURE__ */ e.jsxs("div", { style: { textAlign: "center", width: "100%" }, children: [
|
|
1879
|
+
/* @__PURE__ */ e.jsx("div", { style: { marginBottom: "10px", fontWeight: "bold", color: "#4caf50" }, children: "Голос принят!" }),
|
|
1880
|
+
/* @__PURE__ */ e.jsx(
|
|
1881
|
+
Q,
|
|
1882
|
+
{
|
|
1883
|
+
onClick: ce,
|
|
1884
|
+
disabled: S,
|
|
1885
|
+
style: {
|
|
1886
|
+
width: "100%",
|
|
1887
|
+
borderRadius: "10px"
|
|
1888
|
+
},
|
|
1889
|
+
children: S ? "Отмена..." : "Отменить мой голос"
|
|
1890
|
+
}
|
|
1891
|
+
)
|
|
1892
|
+
] })
|
|
1893
|
+
] })
|
|
1894
|
+
] })
|
|
1895
|
+
]
|
|
1896
|
+
}
|
|
1897
|
+
);
|
|
1898
|
+
}, ir = ({ initialTitle: i, pollId: s, nodeId: r, nodeProps: l, onSaved: o }) => {
|
|
1899
|
+
const [a, u] = E({
|
|
1900
|
+
ownerID: "",
|
|
1901
|
+
title: i || "",
|
|
1902
|
+
options: [""]
|
|
1903
|
+
}), [n, c] = E({
|
|
1904
|
+
isAnonymous: !1,
|
|
1905
|
+
multipleAnswers: !1,
|
|
1906
|
+
endDate: "",
|
|
1907
|
+
endTime: ""
|
|
1908
|
+
}), g = async () => {
|
|
1909
|
+
const O = y == null ? void 0 : y.id;
|
|
1910
|
+
if (localStorage.getItem("userId"), !O) {
|
|
1911
|
+
alert("Ошибка: ID опроса не определен.");
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1914
|
+
if (window.confirm("Вы уверены, что хотите полностью удалить этот опрос?"))
|
|
1915
|
+
try {
|
|
1916
|
+
await C(O, T), alert("Опрос успешно удален из базы"), setTimeout(() => {
|
|
1917
|
+
window.location.reload();
|
|
1918
|
+
}, 100);
|
|
1919
|
+
} catch (w) {
|
|
1920
|
+
console.error("Детали ошибки:", w), w.status === 403 ? alert("У вас нет прав на удаление этого опроса. Удалять может только автор.") : alert("Произошла ошибка при удалении: " + w.message), console.warn("Побочная ошибка (вероятно расширение браузера):", w);
|
|
1921
|
+
}
|
|
1922
|
+
}, [y, m] = E(null), [v, d] = E("creator"), { createPoll: S, loading: b, error: x, fetchPoll: f, deletePoll: C } = ft(), [T, I] = E();
|
|
1923
|
+
ne(() => {
|
|
1924
|
+
let O = localStorage.getItem("userId");
|
|
1925
|
+
O || (O = getCookie("user_id")), O || (O = "anon_" + Math.random().toString(36).substring(2, 11), localStorage.setItem("userId", O)), O && (I(O), console.log("ID пользователя загружен:", O));
|
|
1926
|
+
}, []), V((O) => {
|
|
1927
|
+
if (!O) return;
|
|
1928
|
+
console.log("Poll Widget initialized with:", O);
|
|
1929
|
+
const {
|
|
1930
|
+
widgetId: w,
|
|
1931
|
+
userId: W,
|
|
1932
|
+
role: F,
|
|
1933
|
+
config: q,
|
|
1934
|
+
board: U
|
|
1935
|
+
} = O;
|
|
1936
|
+
w && (async () => {
|
|
1937
|
+
try {
|
|
1938
|
+
const P = await f(w);
|
|
1939
|
+
if (!P) return;
|
|
1940
|
+
m(P);
|
|
1941
|
+
const G = (P.choices || []).map((ee) => ee.choice_text);
|
|
1942
|
+
u({
|
|
1943
|
+
title: P.title,
|
|
1944
|
+
options: [...G.filter((ee) => ee.trim() !== ""), (G.length > 0, "")]
|
|
1945
|
+
});
|
|
1946
|
+
let se = "", ie = "";
|
|
1947
|
+
if (P.end_date) {
|
|
1948
|
+
const ee = P.end_date.split("T");
|
|
1949
|
+
se = ee[0], ie = ee[1] ? ee[1].substring(0, 5) : "";
|
|
1950
|
+
}
|
|
1951
|
+
c({
|
|
1952
|
+
isAnonymous: P.is_anonymous,
|
|
1953
|
+
multipleAnswers: P.multiple_answers,
|
|
1954
|
+
endDate: se,
|
|
1955
|
+
endTime: ie
|
|
1956
|
+
}), d("display");
|
|
1957
|
+
} catch (P) {
|
|
1958
|
+
console.error("Ошибка загрузки опроса:", P);
|
|
1959
|
+
}
|
|
1960
|
+
})();
|
|
1961
|
+
const J = ["admin", "editor", "owner"].includes(F);
|
|
1962
|
+
d(J ? (P) => w ? "display" : "creator" : "display");
|
|
1963
|
+
}, [f]), ne(() => {
|
|
1964
|
+
if (!s) return;
|
|
1965
|
+
let O = !0;
|
|
1966
|
+
return (async () => {
|
|
1967
|
+
try {
|
|
1968
|
+
const w = await f(s);
|
|
1969
|
+
if (!O || !w) return;
|
|
1970
|
+
m(w);
|
|
1971
|
+
const W = (w.choices || []).map((U) => U.choice_text);
|
|
1972
|
+
u({
|
|
1973
|
+
title: w.title,
|
|
1974
|
+
options: [...W.filter((U) => U.trim() !== ""), (W.length > 0, "")]
|
|
1975
|
+
});
|
|
1976
|
+
let F = "", q = "";
|
|
1977
|
+
if (w.end_date) {
|
|
1978
|
+
const U = w.end_date.split("T");
|
|
1979
|
+
F = U[0], q = U[1] ? U[1].substring(0, 5) : "";
|
|
1980
|
+
}
|
|
1981
|
+
c({
|
|
1982
|
+
isAnonymous: w.is_anonymous,
|
|
1983
|
+
multipleAnswers: w.multiple_answers,
|
|
1984
|
+
endDate: F,
|
|
1985
|
+
endTime: q
|
|
1986
|
+
}), d("display");
|
|
1987
|
+
} catch (w) {
|
|
1988
|
+
console.error("Ошибка загрузки опроса:", w);
|
|
1989
|
+
}
|
|
1990
|
+
})(), () => {
|
|
1991
|
+
O = !1;
|
|
1992
|
+
};
|
|
1993
|
+
}, [s, f]);
|
|
1994
|
+
const A = async () => {
|
|
1995
|
+
const O = a.options.filter((w) => w.trim() !== "");
|
|
1996
|
+
if (!a.title.trim() || O.length < 1) {
|
|
1997
|
+
alert("Заполните название и хотя бы один вариант ответа");
|
|
1998
|
+
return;
|
|
1999
|
+
}
|
|
2000
|
+
try {
|
|
2001
|
+
const w = {
|
|
2002
|
+
...a,
|
|
2003
|
+
options: O,
|
|
2004
|
+
ownerID: T
|
|
2005
|
+
// Добавляем имя пользователя как владельца
|
|
2006
|
+
}, W = await S(w, n);
|
|
2007
|
+
m(W), typeof o == "function" && (W != null && W.id) && o(W.id), d("display");
|
|
2008
|
+
} catch (w) {
|
|
2009
|
+
console.error("Ошибка сохранения опроса:", w), alert("Ошибка при сохранении опроса: " + (w.message || w));
|
|
2010
|
+
}
|
|
2011
|
+
}, R = V(() => d((O) => O === "creator" ? "settings" : "creator"), []), k = V(() => d("creator"), []), B = V(() => d("creator"), []), Y = () => "Опрос";
|
|
2012
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2013
|
+
$e,
|
|
2014
|
+
{
|
|
2015
|
+
style: { position: "relative" },
|
|
2016
|
+
title: Y(),
|
|
2017
|
+
onSettingsClick: v === "display" ? B : void 0,
|
|
2018
|
+
toggleSettings: v !== "settings" ? R : void 0,
|
|
2019
|
+
showMenuDots: v === "creator",
|
|
2020
|
+
onTitleClick: v === "display" ? B : void 0,
|
|
2021
|
+
children: [
|
|
2022
|
+
/* @__PURE__ */ e.jsx("p", { style: { color: "red", textAlign: "center" }, children: b ? "Сохранение..." : x }),
|
|
2023
|
+
/* @__PURE__ */ e.jsx("div", { style: { position: "relative" }, children: /* @__PURE__ */ e.jsxs("div", { style: {
|
|
2024
|
+
fontSize: "10px",
|
|
2025
|
+
color: "#999",
|
|
2026
|
+
textAlign: "right",
|
|
2027
|
+
padding: "0 15px"
|
|
2028
|
+
}, children: [
|
|
2029
|
+
"User ID: ",
|
|
2030
|
+
T
|
|
2031
|
+
] }) }),
|
|
2032
|
+
v === "creator" && /* @__PURE__ */ e.jsx(
|
|
2033
|
+
er,
|
|
2034
|
+
{
|
|
2035
|
+
onSave: A,
|
|
2036
|
+
onDataChange: u,
|
|
2037
|
+
initialData: a
|
|
2038
|
+
}
|
|
2039
|
+
),
|
|
2040
|
+
v === "settings" && /* @__PURE__ */ e.jsx(
|
|
2041
|
+
tr,
|
|
2042
|
+
{
|
|
2043
|
+
onDataChange: c,
|
|
2044
|
+
initialData: n,
|
|
2045
|
+
toggleSettings: k
|
|
2046
|
+
}
|
|
2047
|
+
),
|
|
2048
|
+
v === "display" && y && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2049
|
+
(y == null ? void 0 : y.id) && String(y.owner) === String(T) && /* @__PURE__ */ e.jsx(
|
|
2050
|
+
"div",
|
|
2051
|
+
{
|
|
2052
|
+
onClick: g,
|
|
2053
|
+
style: {
|
|
2054
|
+
position: "absolute",
|
|
2055
|
+
top: "15px",
|
|
2056
|
+
right: "15px",
|
|
2057
|
+
width: "24px",
|
|
2058
|
+
height: "24px",
|
|
2059
|
+
backgroundColor: "#ff4d4d",
|
|
2060
|
+
color: "white",
|
|
2061
|
+
borderRadius: "50%",
|
|
2062
|
+
display: "flex",
|
|
2063
|
+
alignItems: "center",
|
|
2064
|
+
justifyContent: "center",
|
|
2065
|
+
cursor: "pointer",
|
|
2066
|
+
fontSize: "18px",
|
|
2067
|
+
fontWeight: "bold",
|
|
2068
|
+
zIndex: 100,
|
|
2069
|
+
boxShadow: "0 2px 5px rgba(0,0,0,0.2)",
|
|
2070
|
+
lineHeight: "1"
|
|
2071
|
+
},
|
|
2072
|
+
title: "Удалить опрос",
|
|
2073
|
+
children: "×"
|
|
2074
|
+
}
|
|
2075
|
+
),
|
|
2076
|
+
/* @__PURE__ */ e.jsx(
|
|
2077
|
+
rr,
|
|
2078
|
+
{
|
|
2079
|
+
pollData: y,
|
|
2080
|
+
setPollData: m
|
|
2081
|
+
}
|
|
2082
|
+
)
|
|
2083
|
+
] })
|
|
2084
|
+
]
|
|
2085
|
+
}
|
|
2086
|
+
);
|
|
2087
|
+
}, or = ({ onSave: i, onDataChange: s, initialData: r }) => {
|
|
2088
|
+
const [l, o] = E((r == null ? void 0 : r.title) || ""), [a, u] = E((r == null ? void 0 : r.tasks) || []), [n, c] = E((r == null ? void 0 : r.activeTaskIndex) || null);
|
|
2089
|
+
ne(() => {
|
|
2090
|
+
s({ title: l, tasks: a, activeTaskIndex: n });
|
|
2091
|
+
}, [l, a, n, s]);
|
|
2092
|
+
const [g, y] = E(!0), m = () => {
|
|
2093
|
+
const R = {
|
|
2094
|
+
id: Date.now(),
|
|
2095
|
+
// Уникальный ID
|
|
2096
|
+
question: "",
|
|
2097
|
+
// Текст вопроса
|
|
2098
|
+
type: "text",
|
|
2099
|
+
// Тип вопроса (по умолчанию) text/single/multiple
|
|
2100
|
+
score: 1,
|
|
2101
|
+
// Баллы
|
|
2102
|
+
correctText: "",
|
|
2103
|
+
options: [""],
|
|
2104
|
+
correctRadioOption: "",
|
|
2105
|
+
correctBoxOptions: []
|
|
2106
|
+
}, k = [...a, R];
|
|
2107
|
+
u(k), c(k.length - 1);
|
|
2108
|
+
}, v = (R, k) => {
|
|
2109
|
+
if (n === null) return;
|
|
2110
|
+
const B = [...a];
|
|
2111
|
+
B[n] = {
|
|
2112
|
+
...B[n],
|
|
2113
|
+
[R]: k
|
|
2114
|
+
}, u(B);
|
|
2115
|
+
}, d = (R, k) => {
|
|
2116
|
+
k.stopPropagation();
|
|
2117
|
+
const B = a.filter((Y, O) => O !== R);
|
|
2118
|
+
u(B), n >= B.length ? c(B.length > 0 ? B.length - 1 : null) : R < n && c(n - 1);
|
|
2119
|
+
}, S = () => {
|
|
2120
|
+
n > 0 && c(n - 1);
|
|
2121
|
+
}, b = () => {
|
|
2122
|
+
n < a.length - 1 && c(n + 1);
|
|
2123
|
+
}, x = (R, k) => {
|
|
2124
|
+
let B = [...a[n].options];
|
|
2125
|
+
B[R] = k;
|
|
2126
|
+
const O = [...B.filter((w) => w.trim() !== ""), ""];
|
|
2127
|
+
v("options", O);
|
|
2128
|
+
}, f = (R) => {
|
|
2129
|
+
v("correctRadioOption", R);
|
|
2130
|
+
}, C = (R, k) => {
|
|
2131
|
+
let B = [];
|
|
2132
|
+
k.includes(R) ? B = k.filter((Y) => Y !== R) : B = [...k, R], v("correctBoxOptions", B);
|
|
2133
|
+
}, T = {
|
|
2134
|
+
display: "flex",
|
|
2135
|
+
gap: "10px",
|
|
2136
|
+
alignItems: "center",
|
|
2137
|
+
whiteSpace: "nowrap"
|
|
2138
|
+
}, I = {
|
|
2139
|
+
boxSizing: "border-box",
|
|
2140
|
+
padding: "10px",
|
|
2141
|
+
backgroundColor: "#e0e0e0",
|
|
2142
|
+
border: "none",
|
|
2143
|
+
fontSize: "14px",
|
|
2144
|
+
outline: "none",
|
|
2145
|
+
color: "#333",
|
|
2146
|
+
width: "100%",
|
|
2147
|
+
borderRadius: "10px"
|
|
2148
|
+
}, A = (R) => ({
|
|
2149
|
+
padding: "8px",
|
|
2150
|
+
cursor: "pointer",
|
|
2151
|
+
backgroundColor: R ? "#00a2ffff" : "#e0e0e0",
|
|
2152
|
+
color: R ? "#ffffffff" : "#333",
|
|
2153
|
+
borderRadius: "10px 10px 0 0",
|
|
2154
|
+
fontSize: "14px",
|
|
2155
|
+
fontWeight: "bold",
|
|
2156
|
+
display: "flex",
|
|
2157
|
+
alignItems: "center",
|
|
2158
|
+
gap: "5px",
|
|
2159
|
+
whiteSpace: "nowrap"
|
|
2160
|
+
});
|
|
2161
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2162
|
+
"div",
|
|
2163
|
+
{
|
|
2164
|
+
style: {
|
|
2165
|
+
display: "flex",
|
|
2166
|
+
flexDirection: "column",
|
|
2167
|
+
height: "100%",
|
|
2168
|
+
width: "100%",
|
|
2169
|
+
overflow: "hidden"
|
|
2170
|
+
// Фиксируем размер, чтобы не раздувало карту
|
|
2171
|
+
},
|
|
2172
|
+
className: "nodrag nowheel",
|
|
2173
|
+
children: [
|
|
2174
|
+
/* @__PURE__ */ e.jsx("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ e.jsx(
|
|
2175
|
+
Se,
|
|
2176
|
+
{
|
|
2177
|
+
placeholder: "Название теста",
|
|
2178
|
+
value: l,
|
|
2179
|
+
onChange: (R) => o(R.target.value),
|
|
2180
|
+
style: {
|
|
2181
|
+
fontSize: "20px",
|
|
2182
|
+
fontWeight: "bold",
|
|
2183
|
+
borderRadius: "10px"
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
) }),
|
|
2187
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", borderBottom: "2px solid #333", flexShrink: 0 }, children: [
|
|
2188
|
+
/* @__PURE__ */ e.jsx(
|
|
2189
|
+
Q,
|
|
2190
|
+
{
|
|
2191
|
+
onClick: S,
|
|
2192
|
+
style: { borderRadius: "10px" },
|
|
2193
|
+
children: "←"
|
|
2194
|
+
}
|
|
2195
|
+
),
|
|
2196
|
+
/* @__PURE__ */ e.jsx("div", { style: { display: "flex", overflowX: "auto" }, children: a.map((R, k) => /* @__PURE__ */ e.jsxs(
|
|
2197
|
+
"div",
|
|
2198
|
+
{
|
|
2199
|
+
style: A(k === n),
|
|
2200
|
+
onClick: () => c(k),
|
|
2201
|
+
children: [
|
|
2202
|
+
"Задание ",
|
|
2203
|
+
k + 1,
|
|
2204
|
+
/* @__PURE__ */ e.jsx(
|
|
2205
|
+
"span",
|
|
2206
|
+
{
|
|
2207
|
+
onClick: (B) => d(k, B),
|
|
2208
|
+
style: {
|
|
2209
|
+
fontSize: "10px",
|
|
2210
|
+
fontWeight: "bold"
|
|
2211
|
+
},
|
|
2212
|
+
children: "✕"
|
|
2213
|
+
}
|
|
2214
|
+
)
|
|
2215
|
+
]
|
|
2216
|
+
},
|
|
2217
|
+
R.id
|
|
2218
|
+
)) }),
|
|
2219
|
+
/* @__PURE__ */ e.jsx(
|
|
2220
|
+
Q,
|
|
2221
|
+
{
|
|
2222
|
+
onClick: b,
|
|
2223
|
+
style: { borderRadius: "10px", marginLeft: "auto" },
|
|
2224
|
+
children: "→"
|
|
2225
|
+
}
|
|
2226
|
+
)
|
|
2227
|
+
] }),
|
|
2228
|
+
/* @__PURE__ */ e.jsx(
|
|
2229
|
+
"div",
|
|
2230
|
+
{
|
|
2231
|
+
className: "nowheel",
|
|
2232
|
+
onWheel: (R) => R.stopPropagation(),
|
|
2233
|
+
style: {
|
|
2234
|
+
padding: "10px",
|
|
2235
|
+
flexGrow: 1,
|
|
2236
|
+
// Занимает все свободное место
|
|
2237
|
+
minHeight: 0,
|
|
2238
|
+
// Нужно для активации overflow в flex-контейнере
|
|
2239
|
+
overflowY: "auto",
|
|
2240
|
+
// Включаем скролл
|
|
2241
|
+
marginBottom: "10px",
|
|
2242
|
+
color: "#333"
|
|
2243
|
+
},
|
|
2244
|
+
children: n !== null && a[n] ? /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
|
|
2245
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", flex: 1, flexDirection: "column", gap: "10px" }, children: [
|
|
2246
|
+
/* @__PURE__ */ e.jsx("label", { style: { fontSize: "18px", fontWeight: "bold" }, children: "Вопрос:" }),
|
|
2247
|
+
/* @__PURE__ */ e.jsx(
|
|
2248
|
+
"textarea",
|
|
2249
|
+
{
|
|
2250
|
+
value: a[n].question,
|
|
2251
|
+
onChange: (R) => v("question", R.target.value),
|
|
2252
|
+
style: {
|
|
2253
|
+
width: "100%",
|
|
2254
|
+
minHeight: "150px",
|
|
2255
|
+
fontSize: "18px",
|
|
2256
|
+
resize: "vertical",
|
|
2257
|
+
color: "#333",
|
|
2258
|
+
backgroundColor: "#ebebebff"
|
|
2259
|
+
},
|
|
2260
|
+
placeholder: "Введите текст вопроса..."
|
|
2261
|
+
}
|
|
2262
|
+
)
|
|
2263
|
+
] }),
|
|
2264
|
+
/* @__PURE__ */ e.jsxs(
|
|
2265
|
+
"div",
|
|
2266
|
+
{
|
|
2267
|
+
onClick: () => y(!g),
|
|
2268
|
+
style: { cursor: "pointer", fontWeight: "bold", marginBottom: "10px", display: "flex", gap: "5px" },
|
|
2269
|
+
children: [
|
|
2270
|
+
/* @__PURE__ */ e.jsx("span", { children: "Параметры задания" }),
|
|
2271
|
+
/* @__PURE__ */ e.jsx("span", { children: g ? "▲" : "▼" })
|
|
2272
|
+
]
|
|
2273
|
+
}
|
|
2274
|
+
),
|
|
2275
|
+
g && /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "10px", width: "50%" }, children: [
|
|
2276
|
+
/* @__PURE__ */ e.jsxs("div", { style: T, children: [
|
|
2277
|
+
/* @__PURE__ */ e.jsx("span", { children: "Тип:" }),
|
|
2278
|
+
/* @__PURE__ */ e.jsxs(
|
|
2279
|
+
"select",
|
|
2280
|
+
{
|
|
2281
|
+
value: a[n].type,
|
|
2282
|
+
onChange: (R) => v("type", R.target.value),
|
|
2283
|
+
style: I,
|
|
2284
|
+
children: [
|
|
2285
|
+
/* @__PURE__ */ e.jsx("option", { value: "text", children: "Текст" }),
|
|
2286
|
+
/* @__PURE__ */ e.jsx("option", { value: "single", children: "Один выбор" }),
|
|
2287
|
+
/* @__PURE__ */ e.jsx("option", { value: "multiple", children: "Множ. выбор" })
|
|
2288
|
+
]
|
|
2289
|
+
}
|
|
2290
|
+
)
|
|
2291
|
+
] }),
|
|
2292
|
+
/* @__PURE__ */ e.jsxs("div", { style: T, children: [
|
|
2293
|
+
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
2294
|
+
"Баллы: ",
|
|
2295
|
+
a[n].score
|
|
2296
|
+
] }),
|
|
2297
|
+
/* @__PURE__ */ e.jsx(
|
|
2298
|
+
"input",
|
|
2299
|
+
{
|
|
2300
|
+
type: "range",
|
|
2301
|
+
min: "1",
|
|
2302
|
+
max: "50",
|
|
2303
|
+
value: a[n].score,
|
|
2304
|
+
onChange: (R) => v("score", R.target.value),
|
|
2305
|
+
style: I
|
|
2306
|
+
}
|
|
2307
|
+
)
|
|
2308
|
+
] })
|
|
2309
|
+
] }),
|
|
2310
|
+
a[n].type === "text" && /* @__PURE__ */ e.jsx(
|
|
2311
|
+
"textarea",
|
|
2312
|
+
{
|
|
2313
|
+
value: a[n].correctText,
|
|
2314
|
+
onChange: (R) => v("correctText", R.target.value),
|
|
2315
|
+
style: {
|
|
2316
|
+
width: "100%",
|
|
2317
|
+
minHeight: "80px",
|
|
2318
|
+
fontSize: "18px",
|
|
2319
|
+
resize: "vertical",
|
|
2320
|
+
color: "#333",
|
|
2321
|
+
backgroundColor: "#ebebebff"
|
|
2322
|
+
},
|
|
2323
|
+
placeholder: "Введите правильные варианты с разделением через ENTER"
|
|
2324
|
+
}
|
|
2325
|
+
),
|
|
2326
|
+
a[n].type === "single" && /* @__PURE__ */ e.jsx("div", { children: a[n].options.map((R, k) => /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", flexDirection: "row", gap: "10px", marginBottom: "5px" }, children: [
|
|
2327
|
+
R !== "" && /* @__PURE__ */ e.jsx(
|
|
2328
|
+
Pe,
|
|
2329
|
+
{
|
|
2330
|
+
checked: a[n].correctRadioOption === R,
|
|
2331
|
+
onChange: () => f(R),
|
|
2332
|
+
name: a[n].id
|
|
2333
|
+
}
|
|
2334
|
+
),
|
|
2335
|
+
/* @__PURE__ */ e.jsx(
|
|
2336
|
+
Se,
|
|
2337
|
+
{
|
|
2338
|
+
placeholder: `Вариант ${k + 1}`,
|
|
2339
|
+
value: R,
|
|
2340
|
+
onChange: (B) => x(k, B.target.value),
|
|
2341
|
+
style: { borderRadius: "15px", marginBottom: "0px" }
|
|
2342
|
+
}
|
|
2343
|
+
)
|
|
2344
|
+
] }, k)) }),
|
|
2345
|
+
a[n].type === "multiple" && /* @__PURE__ */ e.jsx("div", { children: a[n].options.map((R, k) => /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", flexDirection: "row", gap: "10px", marginBottom: "5px" }, children: [
|
|
2346
|
+
R !== "" && /* @__PURE__ */ e.jsx(
|
|
2347
|
+
ve,
|
|
2348
|
+
{
|
|
2349
|
+
checked: a[n].correctBoxOptions.includes(R),
|
|
2350
|
+
onChange: () => C(R, a[n].correctBoxOptions)
|
|
2351
|
+
}
|
|
2352
|
+
),
|
|
2353
|
+
/* @__PURE__ */ e.jsx(
|
|
2354
|
+
Se,
|
|
2355
|
+
{
|
|
2356
|
+
placeholder: `Вариант ${k + 1}`,
|
|
2357
|
+
value: R,
|
|
2358
|
+
onChange: (B) => x(k, B.target.value),
|
|
2359
|
+
style: { borderRadius: "15px", marginBottom: "0px" }
|
|
2360
|
+
}
|
|
2361
|
+
)
|
|
2362
|
+
] }, k)) })
|
|
2363
|
+
] }) : /* @__PURE__ */ e.jsx("div", { style: { color: "#888", textAlign: "center", padding: "20px" }, children: 'Нет активных заданий. Нажмите "Добавить задание".' })
|
|
2364
|
+
}
|
|
2365
|
+
),
|
|
2366
|
+
/* @__PURE__ */ e.jsxs("div", { style: {
|
|
2367
|
+
display: "flex",
|
|
2368
|
+
flexDirection: "row",
|
|
2369
|
+
justifyContent: "space-between",
|
|
2370
|
+
flexShrink: 0,
|
|
2371
|
+
paddingTop: "10px",
|
|
2372
|
+
borderTop: "1px solid #eee"
|
|
2373
|
+
}, children: [
|
|
2374
|
+
/* @__PURE__ */ e.jsx(
|
|
2375
|
+
Q,
|
|
2376
|
+
{
|
|
2377
|
+
onClick: m,
|
|
2378
|
+
style: { borderRadius: "10px" },
|
|
2379
|
+
children: "+ Добавить задание"
|
|
2380
|
+
}
|
|
2381
|
+
),
|
|
2382
|
+
/* @__PURE__ */ e.jsx(
|
|
2383
|
+
Q,
|
|
2384
|
+
{
|
|
2385
|
+
onClick: () => i(),
|
|
2386
|
+
style: { borderRadius: "10px" },
|
|
2387
|
+
children: "Сохранить тест"
|
|
2388
|
+
}
|
|
2389
|
+
)
|
|
2390
|
+
] })
|
|
2391
|
+
]
|
|
2392
|
+
}
|
|
2393
|
+
);
|
|
2394
|
+
}, nr = ({ onDataChange: i, initialData: s, toggleSettings: r }) => {
|
|
2395
|
+
const [l, o] = E((s == null ? void 0 : s.completionTime) || ""), [a, u] = E((s == null ? void 0 : s.endDate) || ""), [n, c] = E((s == null ? void 0 : s.endTime) || ""), [g, y] = E((s == null ? void 0 : s.attemptNumber) || "");
|
|
2396
|
+
ne(() => {
|
|
2397
|
+
i({ completionTime: l, attemptNumber: g, endDate: a, endTime: n });
|
|
2398
|
+
}, [l, g, a, n, i]);
|
|
2399
|
+
const m = {
|
|
2400
|
+
boxSizing: "border-box",
|
|
2401
|
+
padding: "12px 16px",
|
|
2402
|
+
backgroundColor: "#e0e0e0",
|
|
2403
|
+
border: "none",
|
|
2404
|
+
fontSize: "16px",
|
|
2405
|
+
color: "#333",
|
|
2406
|
+
outline: "none",
|
|
2407
|
+
fontFamily: "Arial, sans-serif",
|
|
2408
|
+
flex: 1,
|
|
2409
|
+
// To take up equal space in the container
|
|
2410
|
+
borderRadius: "10px"
|
|
2411
|
+
}, v = {
|
|
2412
|
+
display: "flex",
|
|
2413
|
+
gap: "10px",
|
|
2414
|
+
alignItems: "center",
|
|
2415
|
+
color: "#333"
|
|
2416
|
+
};
|
|
2417
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2418
|
+
"div",
|
|
2419
|
+
{
|
|
2420
|
+
className: "nodrag",
|
|
2421
|
+
style: {
|
|
2422
|
+
display: "flex",
|
|
2423
|
+
flexDirection: "column",
|
|
2424
|
+
height: "100%",
|
|
2425
|
+
width: "100%",
|
|
2426
|
+
paddingRight: "5px",
|
|
2427
|
+
overflowY: "auto",
|
|
2428
|
+
overflowX: "hidden",
|
|
2429
|
+
boxSizing: "border-box"
|
|
2430
|
+
},
|
|
2431
|
+
children: [
|
|
2432
|
+
/* @__PURE__ */ e.jsx("h3", { style: {
|
|
2433
|
+
fontSize: "20px",
|
|
2434
|
+
fontWeight: "bold",
|
|
2435
|
+
color: "#000",
|
|
2436
|
+
marginBottom: "25px",
|
|
2437
|
+
flexShrink: 0
|
|
2438
|
+
}, children: "Параметры теста" }),
|
|
2439
|
+
/* @__PURE__ */ e.jsxs("div", { style: {
|
|
2440
|
+
display: "flex",
|
|
2441
|
+
flexDirection: "column",
|
|
2442
|
+
gap: "10px"
|
|
2443
|
+
}, children: [
|
|
2444
|
+
/* @__PURE__ */ e.jsxs("div", { style: v, children: [
|
|
2445
|
+
/* @__PURE__ */ e.jsx("span", { children: "Время (мин):" }),
|
|
2446
|
+
/* @__PURE__ */ e.jsx(
|
|
2447
|
+
"input",
|
|
2448
|
+
{
|
|
2449
|
+
type: "number",
|
|
2450
|
+
value: l,
|
|
2451
|
+
onChange: (d) => o(d.target.value),
|
|
2452
|
+
placeholder: "Неограниченно",
|
|
2453
|
+
style: m
|
|
2454
|
+
}
|
|
2455
|
+
)
|
|
2456
|
+
] }),
|
|
2457
|
+
/* @__PURE__ */ e.jsxs("div", { style: v, children: [
|
|
2458
|
+
/* @__PURE__ */ e.jsx("span", { style: {}, children: "Пройти до" }),
|
|
2459
|
+
/* @__PURE__ */ e.jsx(
|
|
2460
|
+
"input",
|
|
2461
|
+
{
|
|
2462
|
+
type: "date",
|
|
2463
|
+
value: a,
|
|
2464
|
+
onChange: (d) => u(d.target.value),
|
|
2465
|
+
style: m
|
|
2466
|
+
}
|
|
2467
|
+
),
|
|
2468
|
+
/* @__PURE__ */ e.jsx(
|
|
2469
|
+
"input",
|
|
2470
|
+
{
|
|
2471
|
+
type: "time",
|
|
2472
|
+
value: n,
|
|
2473
|
+
onChange: (d) => c(d.target.value),
|
|
2474
|
+
style: m
|
|
2475
|
+
}
|
|
2476
|
+
)
|
|
2477
|
+
] }),
|
|
2478
|
+
/* @__PURE__ */ e.jsxs("div", { style: v, children: [
|
|
2479
|
+
/* @__PURE__ */ e.jsx("span", { style: {}, children: "Кол-во попыток:" }),
|
|
2480
|
+
/* @__PURE__ */ e.jsx(
|
|
2481
|
+
"input",
|
|
2482
|
+
{
|
|
2483
|
+
type: "number",
|
|
2484
|
+
value: g,
|
|
2485
|
+
onChange: (d) => y(d.target.value),
|
|
2486
|
+
style: m,
|
|
2487
|
+
placeholder: "Неограниченно"
|
|
2488
|
+
}
|
|
2489
|
+
)
|
|
2490
|
+
] })
|
|
2491
|
+
] }),
|
|
2492
|
+
/* @__PURE__ */ e.jsx("div", { style: { flexShrink: 0, display: "flex", justifyContent: "flex-end", marginTop: "auto", paddingTop: "20px" }, children: /* @__PURE__ */ e.jsx(Q, { onClick: r, style: { width: "100%", borderRadius: "5px" }, children: "Назад к тесту" }) })
|
|
2493
|
+
]
|
|
2494
|
+
}
|
|
2495
|
+
);
|
|
2496
|
+
}, gt = (i) => {
|
|
2497
|
+
i || (i = "https://polls-tests-widgets-backend-1357.loca.lt");
|
|
2498
|
+
const [s, r] = E(!1), [l, o] = E(null), a = (v) => `${i ? i.replace(/\/$/, "") : ""}/api/polls/tests${v}`, u = () => {
|
|
2499
|
+
const v = "csrftoken=", d = document.cookie ? document.cookie.split(";") : [];
|
|
2500
|
+
for (let S of d)
|
|
2501
|
+
if (S = S.trim(), S.startsWith(v)) return decodeURIComponent(S.substring(v.length));
|
|
2502
|
+
return null;
|
|
2503
|
+
}, n = async (v, d = {}) => {
|
|
2504
|
+
const S = await fetch(v, {
|
|
2505
|
+
credentials: "include",
|
|
2506
|
+
...d,
|
|
2507
|
+
headers: {
|
|
2508
|
+
"Content-Type": "application/json",
|
|
2509
|
+
"bypass-tunnel-reminder": "true",
|
|
2510
|
+
...d.headers
|
|
2511
|
+
}
|
|
2512
|
+
}), b = await S.json().catch(() => null);
|
|
2513
|
+
if (!S.ok) {
|
|
2514
|
+
const x = new Error((b == null ? void 0 : b.detail) || S.statusText || "Ошибка сервера");
|
|
2515
|
+
throw x.status = S.status, x.data = b, x;
|
|
2516
|
+
}
|
|
2517
|
+
return b;
|
|
2518
|
+
}, c = V(async (v) => {
|
|
2519
|
+
r(!0), o(null);
|
|
2520
|
+
try {
|
|
2521
|
+
return await n(a(`/${v}/`));
|
|
2522
|
+
} catch (d) {
|
|
2523
|
+
throw o(d.message), d;
|
|
2524
|
+
} finally {
|
|
2525
|
+
r(!1);
|
|
2526
|
+
}
|
|
2527
|
+
}, []), g = V(async (v, d) => {
|
|
2528
|
+
r(!0), o(null);
|
|
2529
|
+
try {
|
|
2530
|
+
const S = u();
|
|
2531
|
+
return await n(a(`/${v}/`), {
|
|
2532
|
+
method: "DELETE",
|
|
2533
|
+
headers: {
|
|
2534
|
+
"X-CSRFToken": S
|
|
2535
|
+
},
|
|
2536
|
+
// Передаем owner в теле, если бэкенд проверяет права по нему
|
|
2537
|
+
body: JSON.stringify({ owner: d })
|
|
2538
|
+
});
|
|
2539
|
+
} catch (S) {
|
|
2540
|
+
throw o(S.message), S;
|
|
2541
|
+
} finally {
|
|
2542
|
+
r(!1);
|
|
2543
|
+
}
|
|
2544
|
+
}, []), y = V(async (v, d) => {
|
|
2545
|
+
r(!0), o(null);
|
|
2546
|
+
try {
|
|
2547
|
+
let S = null;
|
|
2548
|
+
d.endDate && (S = (/* @__PURE__ */ new Date(`${d.endDate}T${d.endTime || "23:59:59"}`)).toISOString());
|
|
2549
|
+
const b = {
|
|
2550
|
+
title: v.title,
|
|
2551
|
+
owner: localStorage.getItem("userId") || "Anonymous",
|
|
2552
|
+
tasks: v.tasks.map((x) => ({
|
|
2553
|
+
question: x.question,
|
|
2554
|
+
task_type: x.type,
|
|
2555
|
+
score: x.score,
|
|
2556
|
+
correct_text: x.correctText,
|
|
2557
|
+
options: x.options.filter((f) => f.trim() !== "").map((f) => ({
|
|
2558
|
+
text: f,
|
|
2559
|
+
is_correct: x.type === "single" ? f === x.correctRadioOption : x.correctBoxOptions.includes(f)
|
|
2560
|
+
}))
|
|
2561
|
+
})),
|
|
2562
|
+
// Маппинг настроек из camelCase в snake_case
|
|
2563
|
+
completion_time: d.completionTime === "" ? null : parseInt(d.completionTime),
|
|
2564
|
+
attempt_number: d.attemptNumber === "" ? null : parseInt(d.attemptNumber),
|
|
2565
|
+
// Собираем end_date из даты и времени, если нужно, или передаем как есть
|
|
2566
|
+
end_date: S || null
|
|
2567
|
+
};
|
|
2568
|
+
return await n(a("/"), {
|
|
2569
|
+
method: "POST",
|
|
2570
|
+
body: JSON.stringify(b)
|
|
2571
|
+
});
|
|
2572
|
+
} catch (S) {
|
|
2573
|
+
throw o(S.message), S;
|
|
2574
|
+
} finally {
|
|
2575
|
+
r(!1);
|
|
2576
|
+
}
|
|
2577
|
+
}, []), m = V(async (v) => {
|
|
2578
|
+
r(!0), o(null);
|
|
2579
|
+
try {
|
|
2580
|
+
return await n(a("/submit/"), {
|
|
2581
|
+
method: "POST",
|
|
2582
|
+
body: JSON.stringify(v)
|
|
2583
|
+
});
|
|
2584
|
+
} catch (d) {
|
|
2585
|
+
throw o(d.message), d;
|
|
2586
|
+
} finally {
|
|
2587
|
+
r(!1);
|
|
2588
|
+
}
|
|
2589
|
+
}, []);
|
|
2590
|
+
return {
|
|
2591
|
+
loading: s,
|
|
2592
|
+
error: l,
|
|
2593
|
+
createTest: y,
|
|
2594
|
+
fetchTest: c,
|
|
2595
|
+
submitAttempt: m,
|
|
2596
|
+
deleteTest: g
|
|
2597
|
+
};
|
|
2598
|
+
}, sr = ({ testData: i, setTestData: s }) => {
|
|
2599
|
+
var ee, de, ue, fe, ge, ce, pe, le;
|
|
2600
|
+
const r = i == null ? void 0 : i.id, l = (i == null ? void 0 : i.title) || "", o = (i == null ? void 0 : i.tasks) || [];
|
|
2601
|
+
i != null && i.settings;
|
|
2602
|
+
const { submitAttempt: a, loading: u, fetchTest: n } = gt(), c = localStorage.getItem("userId") || "Anonymous", [g, y] = E(!0), [m, v] = E(!1), [d, S] = E(0), [b, x] = E(null), [f, C] = E([]), T = i == null ? void 0 : i.all_attempts.filter((_) => _.user === String(c)), I = i.attempt_number - T.length, [A, R] = E(!1), [k, B] = E(null), Y = ct(!1), O = () => {
|
|
2603
|
+
if (!i.end_date) return !1;
|
|
2604
|
+
const _ = new Date(i.end_date);
|
|
2605
|
+
return /* @__PURE__ */ new Date() > _;
|
|
2606
|
+
}, w = O();
|
|
2607
|
+
ne(() => {
|
|
2608
|
+
}, []);
|
|
2609
|
+
const W = () => {
|
|
2610
|
+
if (o && Array.isArray(o) && o.length > 0) {
|
|
2611
|
+
console.log("Инициализация задач в Display:", o);
|
|
2612
|
+
const _ = o.map((p) => ({
|
|
2613
|
+
id: p.id,
|
|
2614
|
+
question: p.question,
|
|
2615
|
+
type: p.task_type,
|
|
2616
|
+
score: p.score,
|
|
2617
|
+
options: Array.isArray(p.options) ? p.options : [],
|
|
2618
|
+
completedText: "",
|
|
2619
|
+
completedRadioOptionId: "",
|
|
2620
|
+
completedBoxOptionIds: []
|
|
2621
|
+
}));
|
|
2622
|
+
C(_), S(0);
|
|
2623
|
+
}
|
|
2624
|
+
}, F = (_, p) => {
|
|
2625
|
+
C((M) => {
|
|
2626
|
+
const X = [...M];
|
|
2627
|
+
return X[d] && (X[d] = { ...X[d], [_]: p }), X;
|
|
2628
|
+
});
|
|
2629
|
+
};
|
|
2630
|
+
ne(() => {
|
|
2631
|
+
if (g || m || k === null) return;
|
|
2632
|
+
if (k <= 0) {
|
|
2633
|
+
G();
|
|
2634
|
+
return;
|
|
2635
|
+
}
|
|
2636
|
+
const _ = setInterval(() => {
|
|
2637
|
+
B((p) => p - 1);
|
|
2638
|
+
}, 1e3);
|
|
2639
|
+
return () => clearInterval(_);
|
|
2640
|
+
}, [k, g, m]);
|
|
2641
|
+
const q = (_) => {
|
|
2642
|
+
const p = Math.floor(_ / 60), M = _ % 60;
|
|
2643
|
+
return `${p.toString().padStart(2, "0")}:${M.toString().padStart(2, "0")}`;
|
|
2644
|
+
}, U = () => {
|
|
2645
|
+
d > 0 && S(d - 1);
|
|
2646
|
+
}, J = () => {
|
|
2647
|
+
d < o.length - 1 && S(d + 1);
|
|
2648
|
+
}, P = (_) => {
|
|
2649
|
+
const p = f[d];
|
|
2650
|
+
if (!p) return;
|
|
2651
|
+
const M = p.completedBoxOptionIds || [], X = M.includes(_) ? M.filter((Oe) => Oe !== _) : [...M, _];
|
|
2652
|
+
F("completedBoxOptionIds", X);
|
|
2653
|
+
}, G = async () => {
|
|
2654
|
+
if (Y.current) return;
|
|
2655
|
+
Y.current = !0;
|
|
2656
|
+
const _ = {
|
|
2657
|
+
test: r,
|
|
2658
|
+
user: c,
|
|
2659
|
+
answers: f.map((p) => {
|
|
2660
|
+
let M = [];
|
|
2661
|
+
if (p.type === "single") {
|
|
2662
|
+
const X = p.completedRadioOptionId;
|
|
2663
|
+
X && (M = [X]);
|
|
2664
|
+
} else p.type === "multiple" && (M = p.completedBoxOptionIds);
|
|
2665
|
+
return {
|
|
2666
|
+
task: p.id,
|
|
2667
|
+
answer_text: p.completedText,
|
|
2668
|
+
selected_options: M
|
|
2669
|
+
};
|
|
2670
|
+
})
|
|
2671
|
+
};
|
|
2672
|
+
try {
|
|
2673
|
+
const p = await a(_);
|
|
2674
|
+
p && (x(p), v(!0), y(!1), n && s(await n(r)));
|
|
2675
|
+
} catch (p) {
|
|
2676
|
+
console.error("Ошибка:", p);
|
|
2677
|
+
} finally {
|
|
2678
|
+
Y.current = !1;
|
|
2679
|
+
}
|
|
2680
|
+
}, se = () => {
|
|
2681
|
+
if (O()) {
|
|
2682
|
+
alert("Время прохождения теста истекло.");
|
|
2683
|
+
return;
|
|
2684
|
+
}
|
|
2685
|
+
W(), i.completion_time && i.completion_time > 0 ? B(i.completion_time * 60) : B(null), y(!1);
|
|
2686
|
+
}, ie = () => {
|
|
2687
|
+
v(!1), y(!0);
|
|
2688
|
+
};
|
|
2689
|
+
return b && m ? /* @__PURE__ */ e.jsxs("div", { style: { textAlign: "center", padding: "20px", color: "#000" }, children: [
|
|
2690
|
+
/* @__PURE__ */ e.jsx("h3", { style: { color: "#28a745" }, children: "Тест завершен!" }),
|
|
2691
|
+
/* @__PURE__ */ e.jsxs("p", { style: { fontSize: "18px" }, children: [
|
|
2692
|
+
"Результат: ",
|
|
2693
|
+
/* @__PURE__ */ e.jsx("b", { children: b.score_obtained }),
|
|
2694
|
+
" / ",
|
|
2695
|
+
b.total_score
|
|
2696
|
+
] }),
|
|
2697
|
+
/* @__PURE__ */ e.jsx(Q, { onClick: ie, children: "ОК" })
|
|
2698
|
+
] }) : !g && f.length === 0 ? /* @__PURE__ */ e.jsx("div", { style: { color: "#000", padding: "20px" }, children: "Загрузка..." }) : /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", flexDirection: "column", width: "100%", color: "#000" }, children: [
|
|
2699
|
+
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "15px" }, children: [
|
|
2700
|
+
/* @__PURE__ */ e.jsx("h3", { style: { color: "#000", margin: 0 }, children: l }),
|
|
2701
|
+
!g && !m && k !== null && /* @__PURE__ */ e.jsxs("div", { style: {
|
|
2702
|
+
fontWeight: "bold",
|
|
2703
|
+
fontSize: "18px",
|
|
2704
|
+
color: k < 60 ? "red" : "#00a2ff",
|
|
2705
|
+
// Красный цвет если осталось меньше минуты
|
|
2706
|
+
border: "1px solid #ccc",
|
|
2707
|
+
padding: "5px 10px",
|
|
2708
|
+
borderRadius: "5px"
|
|
2709
|
+
}, children: [
|
|
2710
|
+
"⏱ ",
|
|
2711
|
+
q(k)
|
|
2712
|
+
] })
|
|
2713
|
+
] }),
|
|
2714
|
+
(i == null ? void 0 : i.owner) === c && /* @__PURE__ */ e.jsxs("div", { children: [
|
|
2715
|
+
/* @__PURE__ */ e.jsxs("div", { style: { marginBottom: "15px" }, children: [
|
|
2716
|
+
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
2717
|
+
"Заданий: ",
|
|
2718
|
+
o.length
|
|
2719
|
+
] }),
|
|
2720
|
+
i.completion_time && /* @__PURE__ */ e.jsxs("p", { children: [
|
|
2721
|
+
"Время: ",
|
|
2722
|
+
i.completion_time,
|
|
2723
|
+
" мин."
|
|
2724
|
+
] }),
|
|
2725
|
+
i.end_date && /* @__PURE__ */ e.jsxs("p", { children: [
|
|
2726
|
+
"Доступно до: ",
|
|
2727
|
+
new Date(i.end_date).toLocaleDateString(),
|
|
2728
|
+
" ",
|
|
2729
|
+
new Date(i.end_date).toLocaleTimeString()
|
|
2730
|
+
] }),
|
|
2731
|
+
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
2732
|
+
"Попыток: ",
|
|
2733
|
+
i.attempt_number
|
|
2734
|
+
] })
|
|
2735
|
+
] }),
|
|
2736
|
+
/* @__PURE__ */ e.jsxs(
|
|
2737
|
+
"div",
|
|
2738
|
+
{
|
|
2739
|
+
onClick: () => R((_) => !_),
|
|
2740
|
+
style: { cursor: "pointer", fontWeight: "bold", marginBottom: "10px", display: "flex", gap: "5px" },
|
|
2741
|
+
children: [
|
|
2742
|
+
/* @__PURE__ */ e.jsx("span", { children: "Посмотреть задания" }),
|
|
2743
|
+
/* @__PURE__ */ e.jsx("span", { children: A ? "▲" : "▼" })
|
|
2744
|
+
]
|
|
2745
|
+
}
|
|
2746
|
+
),
|
|
2747
|
+
A && /* @__PURE__ */ e.jsxs("div", { children: [
|
|
2748
|
+
/* @__PURE__ */ e.jsxs("div", { style: {
|
|
2749
|
+
display: "flex",
|
|
2750
|
+
borderBottom: "2px solid #333"
|
|
2751
|
+
}, children: [
|
|
2752
|
+
/* @__PURE__ */ e.jsx(
|
|
2753
|
+
Q,
|
|
2754
|
+
{
|
|
2755
|
+
onClick: U,
|
|
2756
|
+
style: { borderRadius: "10px" },
|
|
2757
|
+
children: "←"
|
|
2758
|
+
}
|
|
2759
|
+
),
|
|
2760
|
+
/* @__PURE__ */ e.jsx("div", { style: { display: "flex", overflowX: "auto" }, children: o.map((_, p) => /* @__PURE__ */ e.jsx(
|
|
2761
|
+
"div",
|
|
2762
|
+
{
|
|
2763
|
+
onClick: () => S(p),
|
|
2764
|
+
style: {
|
|
2765
|
+
padding: "8px 12px",
|
|
2766
|
+
cursor: "pointer",
|
|
2767
|
+
backgroundColor: p === d ? "#00a2ff" : "#eee",
|
|
2768
|
+
color: p === d ? "#fff" : "#000",
|
|
2769
|
+
marginRight: "2px",
|
|
2770
|
+
borderRadius: "5px 5px 0 0",
|
|
2771
|
+
minWidth: "25px",
|
|
2772
|
+
textAlign: "center"
|
|
2773
|
+
},
|
|
2774
|
+
children: p + 1
|
|
2775
|
+
},
|
|
2776
|
+
p
|
|
2777
|
+
)) }),
|
|
2778
|
+
/* @__PURE__ */ e.jsx(
|
|
2779
|
+
Q,
|
|
2780
|
+
{
|
|
2781
|
+
onClick: J,
|
|
2782
|
+
style: { borderRadius: "10px", marginLeft: "auto" },
|
|
2783
|
+
children: "→"
|
|
2784
|
+
}
|
|
2785
|
+
)
|
|
2786
|
+
] }),
|
|
2787
|
+
/* @__PURE__ */ e.jsxs("div", { style: { color: "#000" }, children: [
|
|
2788
|
+
/* @__PURE__ */ e.jsx("p", { style: { fontWeight: "bold" }, children: (ee = o[d]) == null ? void 0 : ee.question }),
|
|
2789
|
+
((de = o[d]) == null ? void 0 : de.task_type) === "text" && /* @__PURE__ */ e.jsxs("span", { children: [
|
|
2790
|
+
"Ответ: ",
|
|
2791
|
+
o[d].correct_text
|
|
2792
|
+
] }),
|
|
2793
|
+
((ue = o[d]) == null ? void 0 : ue.task_type) === "single" && o[d].options.map((_, p) => /* @__PURE__ */ e.jsxs(
|
|
2794
|
+
"div",
|
|
2795
|
+
{
|
|
2796
|
+
style: { display: "flex", alignItems: "center", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
2797
|
+
children: [
|
|
2798
|
+
/* @__PURE__ */ e.jsx(
|
|
2799
|
+
Pe,
|
|
2800
|
+
{
|
|
2801
|
+
checked: _.is_correct,
|
|
2802
|
+
onChange: () => {
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
),
|
|
2806
|
+
/* @__PURE__ */ e.jsx(
|
|
2807
|
+
"div",
|
|
2808
|
+
{
|
|
2809
|
+
style: {
|
|
2810
|
+
flexGrow: 1,
|
|
2811
|
+
display: "flex",
|
|
2812
|
+
justifyContent: "space-between",
|
|
2813
|
+
backgroundColor: _.is_correct ? "#d0d0d0" : "#e0e0e0",
|
|
2814
|
+
padding: "12px 16px",
|
|
2815
|
+
borderRadius: "10px",
|
|
2816
|
+
position: "relative",
|
|
2817
|
+
overflow: "hidden"
|
|
2818
|
+
},
|
|
2819
|
+
children: /* @__PURE__ */ e.jsx("span", { children: _.text })
|
|
2820
|
+
}
|
|
2821
|
+
)
|
|
2822
|
+
]
|
|
2823
|
+
},
|
|
2824
|
+
p
|
|
2825
|
+
)),
|
|
2826
|
+
((fe = o[d]) == null ? void 0 : fe.task_type) === "multiple" && o[d].options.map((_, p) => /* @__PURE__ */ e.jsxs(
|
|
2827
|
+
"div",
|
|
2828
|
+
{
|
|
2829
|
+
style: { display: "flex", alignItems: "center", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
2830
|
+
children: [
|
|
2831
|
+
/* @__PURE__ */ e.jsx(
|
|
2832
|
+
ve,
|
|
2833
|
+
{
|
|
2834
|
+
checked: _.is_correct,
|
|
2835
|
+
onChange: () => {
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
),
|
|
2839
|
+
/* @__PURE__ */ e.jsx(
|
|
2840
|
+
"div",
|
|
2841
|
+
{
|
|
2842
|
+
style: {
|
|
2843
|
+
flexGrow: 1,
|
|
2844
|
+
display: "flex",
|
|
2845
|
+
justifyContent: "space-between",
|
|
2846
|
+
backgroundColor: _.is_correct ? "#d0d0d0" : "#e0e0e0",
|
|
2847
|
+
padding: "12px 16px",
|
|
2848
|
+
borderRadius: "10px",
|
|
2849
|
+
position: "relative",
|
|
2850
|
+
overflow: "hidden"
|
|
2851
|
+
},
|
|
2852
|
+
children: /* @__PURE__ */ e.jsx("span", { children: _.text })
|
|
2853
|
+
}
|
|
2854
|
+
)
|
|
2855
|
+
]
|
|
2856
|
+
},
|
|
2857
|
+
p
|
|
2858
|
+
))
|
|
2859
|
+
] })
|
|
2860
|
+
] }),
|
|
2861
|
+
i != null && i.all_attempts && (i == null ? void 0 : i.all_attempts.length) > 0 ? /* @__PURE__ */ e.jsxs("div", { style: { marginBottom: "20px", textAlign: "left" }, children: [
|
|
2862
|
+
/* @__PURE__ */ e.jsx("h4", { style: { marginBottom: "10px" }, children: "Все результаты:" }),
|
|
2863
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
2864
|
+
display: "flex",
|
|
2865
|
+
flexDirection: "column",
|
|
2866
|
+
backgroundColor: "#f5f5f5",
|
|
2867
|
+
borderRadius: "10px",
|
|
2868
|
+
padding: "10px",
|
|
2869
|
+
maxHeight: "200px",
|
|
2870
|
+
overflowY: "auto",
|
|
2871
|
+
border: "1px solid #ddd"
|
|
2872
|
+
}, children: i == null ? void 0 : i.all_attempts.map((_, p) => /* @__PURE__ */ e.jsxs("div", { style: {
|
|
2873
|
+
display: "flex",
|
|
2874
|
+
justifyContent: "space-between",
|
|
2875
|
+
padding: "10px 5px",
|
|
2876
|
+
borderBottom: p !== (i == null ? void 0 : i.all_attempts.length) - 1 ? "1px solid #ddd" : "none"
|
|
2877
|
+
}, children: [
|
|
2878
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontWeight: "bold", fontSize: "14px" }, children: _.user }),
|
|
2879
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontSize: "14px" }, children: new Date(_.completed_at).toLocaleDateString() }),
|
|
2880
|
+
/* @__PURE__ */ e.jsxs("span", { style: { fontWeight: "bold", fontSize: "14px" }, children: [
|
|
2881
|
+
_.score_obtained,
|
|
2882
|
+
" / ",
|
|
2883
|
+
_.total_score,
|
|
2884
|
+
" баллов"
|
|
2885
|
+
] })
|
|
2886
|
+
] }, p)) })
|
|
2887
|
+
] }) : /* @__PURE__ */ e.jsx("div", { style: { color: "#888", textAlign: "center", padding: "20px" }, children: "Нет результатов" })
|
|
2888
|
+
] }),
|
|
2889
|
+
(i == null ? void 0 : i.owner) !== c && /* @__PURE__ */ e.jsx("div", { children: g ? /* @__PURE__ */ e.jsxs("div", { style: { color: "#000" }, children: [
|
|
2890
|
+
/* @__PURE__ */ e.jsxs("div", { style: { marginBottom: "15px" }, children: [
|
|
2891
|
+
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
2892
|
+
"Автор: ",
|
|
2893
|
+
i.owner
|
|
2894
|
+
] }),
|
|
2895
|
+
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
2896
|
+
"Заданий: ",
|
|
2897
|
+
o.length
|
|
2898
|
+
] }),
|
|
2899
|
+
i.completion_time && /* @__PURE__ */ e.jsxs("p", { children: [
|
|
2900
|
+
"Время: ",
|
|
2901
|
+
i.completion_time,
|
|
2902
|
+
" мин."
|
|
2903
|
+
] }),
|
|
2904
|
+
i.end_date && /* @__PURE__ */ e.jsxs("p", { children: [
|
|
2905
|
+
"Доступно до: ",
|
|
2906
|
+
new Date(i.end_date).toLocaleDateString(),
|
|
2907
|
+
" ",
|
|
2908
|
+
new Date(i.end_date).toLocaleTimeString()
|
|
2909
|
+
] }),
|
|
2910
|
+
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
2911
|
+
"Попыток: ",
|
|
2912
|
+
I,
|
|
2913
|
+
"/",
|
|
2914
|
+
i.attempt_number
|
|
2915
|
+
] })
|
|
2916
|
+
] }),
|
|
2917
|
+
w ? /* @__PURE__ */ e.jsx("div", { style: {
|
|
2918
|
+
padding: "10px",
|
|
2919
|
+
backgroundColor: "#ffdddd",
|
|
2920
|
+
color: "red",
|
|
2921
|
+
borderRadius: "10px",
|
|
2922
|
+
textAlign: "center",
|
|
2923
|
+
fontWeight: "bold"
|
|
2924
|
+
}, children: "Срок прохождения теста истек" }) : /* @__PURE__ */ e.jsx(
|
|
2925
|
+
Q,
|
|
2926
|
+
{
|
|
2927
|
+
onClick: se,
|
|
2928
|
+
style: { borderRadius: "10px" },
|
|
2929
|
+
disabled: I <= 0,
|
|
2930
|
+
children: "Начать тест"
|
|
2931
|
+
}
|
|
2932
|
+
),
|
|
2933
|
+
T && T.length > 0 ? /* @__PURE__ */ e.jsxs("div", { style: { marginBottom: "20px", textAlign: "left" }, children: [
|
|
2934
|
+
/* @__PURE__ */ e.jsx("h4", { style: { marginBottom: "10px" }, children: "Ваши предыдущие результаты:" }),
|
|
2935
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
2936
|
+
display: "flex",
|
|
2937
|
+
flexDirection: "column",
|
|
2938
|
+
backgroundColor: "#f5f5f5",
|
|
2939
|
+
borderRadius: "10px",
|
|
2940
|
+
padding: "10px",
|
|
2941
|
+
maxHeight: "200px",
|
|
2942
|
+
overflowY: "auto",
|
|
2943
|
+
border: "1px solid #ddd"
|
|
2944
|
+
}, children: T.map((_, p) => /* @__PURE__ */ e.jsxs("div", { style: {
|
|
2945
|
+
display: "flex",
|
|
2946
|
+
justifyContent: "space-between",
|
|
2947
|
+
padding: "10px 5px",
|
|
2948
|
+
borderBottom: p !== T.length - 1 ? "1px solid #ddd" : "none"
|
|
2949
|
+
}, children: [
|
|
2950
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontSize: "14px" }, children: new Date(_.completed_at).toLocaleDateString() }),
|
|
2951
|
+
/* @__PURE__ */ e.jsxs("span", { style: { fontWeight: "bold", fontSize: "14px" }, children: [
|
|
2952
|
+
_.score_obtained,
|
|
2953
|
+
" / ",
|
|
2954
|
+
_.total_score,
|
|
2955
|
+
" баллов"
|
|
2956
|
+
] })
|
|
2957
|
+
] }, p)) })
|
|
2958
|
+
] }) : /* @__PURE__ */ e.jsx("div", { style: { color: "#888", textAlign: "center", padding: "20px" }, children: "Нет результатов" })
|
|
2959
|
+
] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2960
|
+
/* @__PURE__ */ e.jsxs("div", { style: {
|
|
2961
|
+
display: "flex",
|
|
2962
|
+
borderBottom: "2px solid #333"
|
|
2963
|
+
}, children: [
|
|
2964
|
+
/* @__PURE__ */ e.jsx(
|
|
2965
|
+
Q,
|
|
2966
|
+
{
|
|
2967
|
+
onClick: U,
|
|
2968
|
+
style: { borderRadius: "10px" },
|
|
2969
|
+
children: "←"
|
|
2970
|
+
}
|
|
2971
|
+
),
|
|
2972
|
+
/* @__PURE__ */ e.jsx("div", { style: { display: "flex", overflowX: "auto" }, children: f.map((_, p) => /* @__PURE__ */ e.jsx(
|
|
2973
|
+
"div",
|
|
2974
|
+
{
|
|
2975
|
+
onClick: () => S(p),
|
|
2976
|
+
style: {
|
|
2977
|
+
padding: "8px 12px",
|
|
2978
|
+
cursor: "pointer",
|
|
2979
|
+
backgroundColor: p === d ? "#00a2ff" : "#eee",
|
|
2980
|
+
color: p === d ? "#fff" : "#000",
|
|
2981
|
+
marginRight: "2px",
|
|
2982
|
+
borderRadius: "5px 5px 0 0",
|
|
2983
|
+
minWidth: "25px",
|
|
2984
|
+
textAlign: "center"
|
|
2985
|
+
},
|
|
2986
|
+
children: p + 1
|
|
2987
|
+
},
|
|
2988
|
+
p
|
|
2989
|
+
)) }),
|
|
2990
|
+
/* @__PURE__ */ e.jsx(
|
|
2991
|
+
Q,
|
|
2992
|
+
{
|
|
2993
|
+
onClick: J,
|
|
2994
|
+
style: { borderRadius: "10px", marginLeft: "auto" },
|
|
2995
|
+
children: "→"
|
|
2996
|
+
}
|
|
2997
|
+
)
|
|
2998
|
+
] }),
|
|
2999
|
+
/* @__PURE__ */ e.jsxs("div", { style: { color: "#000" }, children: [
|
|
3000
|
+
/* @__PURE__ */ e.jsx("p", { style: { fontWeight: "bold" }, children: (ge = f[d]) == null ? void 0 : ge.question }),
|
|
3001
|
+
((ce = f[d]) == null ? void 0 : ce.type) === "text" && /* @__PURE__ */ e.jsx(
|
|
3002
|
+
"textarea",
|
|
3003
|
+
{
|
|
3004
|
+
value: f[d].completedText,
|
|
3005
|
+
onChange: (_) => F("completedText", _.target.value),
|
|
3006
|
+
style: { width: "100%", height: "80px", padding: "5px" }
|
|
3007
|
+
}
|
|
3008
|
+
),
|
|
3009
|
+
((pe = f[d]) == null ? void 0 : pe.type) === "single" && f[d].options.map((_, p) => /* @__PURE__ */ e.jsxs(
|
|
3010
|
+
"div",
|
|
3011
|
+
{
|
|
3012
|
+
style: { display: "flex", alignItems: "center", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
3013
|
+
children: [
|
|
3014
|
+
/* @__PURE__ */ e.jsx(
|
|
3015
|
+
Pe,
|
|
3016
|
+
{
|
|
3017
|
+
checked: f[d].completedRadioOptionId === _.id,
|
|
3018
|
+
onChange: () => F("completedRadioOptionId", _.id)
|
|
3019
|
+
}
|
|
3020
|
+
),
|
|
3021
|
+
/* @__PURE__ */ e.jsx(
|
|
3022
|
+
"div",
|
|
3023
|
+
{
|
|
3024
|
+
onClick: () => F("completedRadioOptionId", _.id),
|
|
3025
|
+
style: {
|
|
3026
|
+
flexGrow: 1,
|
|
3027
|
+
display: "flex",
|
|
3028
|
+
justifyContent: "space-between",
|
|
3029
|
+
backgroundColor: f[d].completedRadioOptionId === _.id ? "#d0d0d0" : "#e0e0e0",
|
|
3030
|
+
padding: "12px 16px",
|
|
3031
|
+
borderRadius: "10px",
|
|
3032
|
+
position: "relative",
|
|
3033
|
+
overflow: "hidden"
|
|
3034
|
+
},
|
|
3035
|
+
children: /* @__PURE__ */ e.jsx("span", { children: _.text })
|
|
3036
|
+
}
|
|
3037
|
+
)
|
|
3038
|
+
]
|
|
3039
|
+
},
|
|
3040
|
+
p
|
|
3041
|
+
)),
|
|
3042
|
+
((le = f[d]) == null ? void 0 : le.type) === "multiple" && f[d].options.map((_, p) => /* @__PURE__ */ e.jsxs(
|
|
3043
|
+
"div",
|
|
3044
|
+
{
|
|
3045
|
+
style: { display: "flex", alignItems: "center", marginBottom: "15px", cursor: "pointer", gap: "10px" },
|
|
3046
|
+
children: [
|
|
3047
|
+
/* @__PURE__ */ e.jsx(
|
|
3048
|
+
ve,
|
|
3049
|
+
{
|
|
3050
|
+
checked: f[d].completedBoxOptionIds.includes(_.id),
|
|
3051
|
+
onChange: () => P(_.id)
|
|
3052
|
+
}
|
|
3053
|
+
),
|
|
3054
|
+
/* @__PURE__ */ e.jsx(
|
|
3055
|
+
"div",
|
|
3056
|
+
{
|
|
3057
|
+
onClick: () => P(_.id),
|
|
3058
|
+
style: {
|
|
3059
|
+
flexGrow: 1,
|
|
3060
|
+
display: "flex",
|
|
3061
|
+
justifyContent: "space-between",
|
|
3062
|
+
backgroundColor: f[d].completedBoxOptionIds.includes(_.id) ? "#d0d0d0" : "#e0e0e0",
|
|
3063
|
+
padding: "12px 16px",
|
|
3064
|
+
borderRadius: "10px",
|
|
3065
|
+
position: "relative",
|
|
3066
|
+
overflow: "hidden"
|
|
3067
|
+
},
|
|
3068
|
+
children: /* @__PURE__ */ e.jsx("span", { children: _.text })
|
|
3069
|
+
}
|
|
3070
|
+
)
|
|
3071
|
+
]
|
|
3072
|
+
},
|
|
3073
|
+
p
|
|
3074
|
+
))
|
|
3075
|
+
] }),
|
|
3076
|
+
/* @__PURE__ */ e.jsx("div", { style: { marginTop: "20px", display: "flex", justifyContent: "flex-end" }, children: d !== f.length - 1 && /* @__PURE__ */ e.jsx(Q, { onClick: J, children: "Дальше" }) }),
|
|
3077
|
+
/* @__PURE__ */ e.jsx("div", { style: { marginTop: "20px", display: "flex", justifyContent: "flex-end" }, children: d === f.length - 1 && /* @__PURE__ */ e.jsx(Q, { onClick: G, disabled: u, children: u ? "Сохранение..." : "Завершить" }) })
|
|
3078
|
+
] }) })
|
|
3079
|
+
] });
|
|
3080
|
+
}, lr = (i) => {
|
|
3081
|
+
const r = `; ${document.cookie}`.split(`; ${i}=`);
|
|
3082
|
+
return r.length === 2 ? r.pop().split(";").shift() : null;
|
|
3083
|
+
}, ar = ({ initialTitle: i, pollId: s, nodeId: r, nodeProps: l, onSaved: o }) => {
|
|
3084
|
+
const { createTest: a, loading: u, error: n, fetchTest: c, deleteTest: g } = gt(), [y, m] = E(s ? "display" : "creator"), [v, d] = E(!1), [S, b] = E(null), [x, f] = E({
|
|
3085
|
+
id: null,
|
|
3086
|
+
owner: "",
|
|
3087
|
+
title: i || "",
|
|
3088
|
+
tasks: []
|
|
3089
|
+
}), [C, T] = E({
|
|
3090
|
+
completionTime: null,
|
|
3091
|
+
attemptNumber: 1,
|
|
3092
|
+
endDate: null,
|
|
3093
|
+
endTime: null
|
|
3094
|
+
}), [I, A] = E(null);
|
|
3095
|
+
ne(() => {
|
|
3096
|
+
let w = localStorage.getItem("userId");
|
|
3097
|
+
w || (w = lr("user_id")), w || (w = "anon_" + Math.random().toString(36).substring(2, 11), localStorage.setItem("userId", w)), b(w);
|
|
3098
|
+
}, []), V((w) => {
|
|
3099
|
+
if (!w) return;
|
|
3100
|
+
console.log("Test Widget initialized with:", w);
|
|
3101
|
+
const {
|
|
3102
|
+
widgetId: W,
|
|
3103
|
+
userId: F,
|
|
3104
|
+
role: q,
|
|
3105
|
+
config: U,
|
|
3106
|
+
board: J
|
|
3107
|
+
} = w;
|
|
3108
|
+
W && (async () => {
|
|
3109
|
+
try {
|
|
3110
|
+
const G = await c(W);
|
|
3111
|
+
if (!G) return;
|
|
3112
|
+
A(G), f({
|
|
3113
|
+
id: G.id,
|
|
3114
|
+
title: G.title,
|
|
3115
|
+
tasks: G.tasks || [],
|
|
3116
|
+
all_attempts: G.all_attempts,
|
|
3117
|
+
owner: G.owner
|
|
3118
|
+
}), G.settings && T(G.settings), d(!0);
|
|
3119
|
+
} catch (G) {
|
|
3120
|
+
console.error("Ошибка загрузки теста:", G);
|
|
3121
|
+
}
|
|
3122
|
+
})();
|
|
3123
|
+
const P = ["admin", "editor", "owner"].includes(q);
|
|
3124
|
+
m(P ? (G) => W ? "display" : "creator" : "display");
|
|
3125
|
+
}, [c]), ne(() => {
|
|
3126
|
+
if (!s) return;
|
|
3127
|
+
let w = !0;
|
|
3128
|
+
return (async () => {
|
|
3129
|
+
try {
|
|
3130
|
+
const W = await c(s);
|
|
3131
|
+
if (!w || !W) return;
|
|
3132
|
+
A(W), f({
|
|
3133
|
+
id: W.id,
|
|
3134
|
+
title: W.title,
|
|
3135
|
+
tasks: W.tasks || [],
|
|
3136
|
+
all_attempts: W.all_attempts,
|
|
3137
|
+
owner: W.owner
|
|
3138
|
+
}), W.settings && T(W.settings), d(!0);
|
|
3139
|
+
} catch (W) {
|
|
3140
|
+
console.error("Ошибка загрузки теста:", W);
|
|
3141
|
+
}
|
|
3142
|
+
})(), () => {
|
|
3143
|
+
w = !1;
|
|
3144
|
+
};
|
|
3145
|
+
}, [s, c]);
|
|
3146
|
+
const R = V(() => m("creator"), []), k = V(() => {
|
|
3147
|
+
m((w) => w === "settings" ? "creator" : "settings");
|
|
3148
|
+
}, []), B = async () => {
|
|
3149
|
+
const w = (x == null ? void 0 : x.id) || pollId, W = localStorage.getItem("userId") || "Anonymous";
|
|
3150
|
+
if (!w) {
|
|
3151
|
+
alert("Ошибка: ID теста не найден");
|
|
3152
|
+
return;
|
|
3153
|
+
}
|
|
3154
|
+
if (window.confirm("Вы уверены, что хотите полностью удалить этот тест?"))
|
|
3155
|
+
try {
|
|
3156
|
+
await g(w, W), alert("Тест успешно удален"), setTimeout(() => {
|
|
3157
|
+
window.location.reload();
|
|
3158
|
+
}, 100);
|
|
3159
|
+
} catch (F) {
|
|
3160
|
+
console.error("Ошибка удаления:", F), F.status === 403 ? alert("У вас нет прав на удаление (вы не автор).") : alert("Не удалось удалить тест: " + F.message);
|
|
3161
|
+
}
|
|
3162
|
+
}, Y = V(async () => {
|
|
3163
|
+
try {
|
|
3164
|
+
const w = await a(x, C);
|
|
3165
|
+
w && w.id && (A(w), d(!0), m("display"), typeof o == "function" && o(w.id));
|
|
3166
|
+
} catch (w) {
|
|
3167
|
+
console.error("Ошибка при сохранении:", w);
|
|
3168
|
+
}
|
|
3169
|
+
}, [a, x, C]), O = () => y === "settings" ? "Настройки" : x.title || "Тест";
|
|
3170
|
+
return s && !v ? /* @__PURE__ */ e.jsx($e, { title: "Загрузка...", children: /* @__PURE__ */ e.jsx("div", { style: { padding: "20px", textAlign: "center" }, children: "Загрузка данных теста..." }) }) : /* @__PURE__ */ e.jsxs(
|
|
3171
|
+
$e,
|
|
3172
|
+
{
|
|
3173
|
+
title: O(),
|
|
3174
|
+
toggleSettings: y !== "display" ? k : void 0,
|
|
3175
|
+
showMenuDots: y === "creator",
|
|
3176
|
+
children: [
|
|
3177
|
+
u && /* @__PURE__ */ e.jsx("p", { style: { color: "blue", textAlign: "center", margin: "5px 0" }, children: "Синхронизация..." }),
|
|
3178
|
+
/* @__PURE__ */ e.jsx("div", { style: { position: "relative" }, children: /* @__PURE__ */ e.jsxs("div", { style: {
|
|
3179
|
+
fontSize: "10px",
|
|
3180
|
+
color: "#999",
|
|
3181
|
+
textAlign: "right",
|
|
3182
|
+
padding: "0 15px"
|
|
3183
|
+
}, children: [
|
|
3184
|
+
"User ID: ",
|
|
3185
|
+
S
|
|
3186
|
+
] }) }),
|
|
3187
|
+
y === "creator" && /* @__PURE__ */ e.jsx(
|
|
3188
|
+
or,
|
|
3189
|
+
{
|
|
3190
|
+
onDataChange: f,
|
|
3191
|
+
initialData: x,
|
|
3192
|
+
onSave: Y
|
|
3193
|
+
}
|
|
3194
|
+
),
|
|
3195
|
+
y === "settings" && /* @__PURE__ */ e.jsx(
|
|
3196
|
+
nr,
|
|
3197
|
+
{
|
|
3198
|
+
onDataChange: T,
|
|
3199
|
+
initialData: C,
|
|
3200
|
+
toggleSettings: R
|
|
3201
|
+
}
|
|
3202
|
+
),
|
|
3203
|
+
y === "display" && v && /* @__PURE__ */ e.jsxs("div", { style: { position: "relative", height: "100%", display: "flex", flexDirection: "column" }, children: [
|
|
3204
|
+
(x == null ? void 0 : x.id) && String(x.owner) === String(S) && /* @__PURE__ */ e.jsx(
|
|
3205
|
+
"div",
|
|
3206
|
+
{
|
|
3207
|
+
onClick: B,
|
|
3208
|
+
style: {
|
|
3209
|
+
position: "absolute",
|
|
3210
|
+
top: "15px",
|
|
3211
|
+
right: "15px",
|
|
3212
|
+
width: "24px",
|
|
3213
|
+
height: "24px",
|
|
3214
|
+
backgroundColor: "#ff4d4d",
|
|
3215
|
+
color: "white",
|
|
3216
|
+
borderRadius: "50%",
|
|
3217
|
+
display: "flex",
|
|
3218
|
+
alignItems: "center",
|
|
3219
|
+
justifyContent: "center",
|
|
3220
|
+
cursor: "pointer",
|
|
3221
|
+
fontSize: "18px",
|
|
3222
|
+
fontWeight: "bold",
|
|
3223
|
+
zIndex: 1e3,
|
|
3224
|
+
// Повыше, чтобы перекрыть контент
|
|
3225
|
+
boxShadow: "0 2px 5px rgba(0,0,0,0.2)",
|
|
3226
|
+
lineHeight: "1"
|
|
3227
|
+
},
|
|
3228
|
+
title: "Удалить тест",
|
|
3229
|
+
children: "×"
|
|
3230
|
+
}
|
|
3231
|
+
),
|
|
3232
|
+
/* @__PURE__ */ e.jsx(
|
|
3233
|
+
sr,
|
|
3234
|
+
{
|
|
3235
|
+
testData: I,
|
|
3236
|
+
setTestData: A
|
|
3237
|
+
}
|
|
3238
|
+
)
|
|
3239
|
+
] }),
|
|
3240
|
+
n && /* @__PURE__ */ e.jsx("div", { style: { color: "red", fontSize: "12px", padding: "10px", textAlign: "center" }, children: n })
|
|
3241
|
+
]
|
|
3242
|
+
}
|
|
3243
|
+
);
|
|
3244
|
+
}, dr = {
|
|
3245
|
+
display: "flex",
|
|
3246
|
+
flexDirection: "column",
|
|
3247
|
+
background: "transparent",
|
|
3248
|
+
pointerEvents: "all",
|
|
3249
|
+
position: "relative"
|
|
3250
|
+
// Важно для абсолютного позиционирования детей
|
|
3251
|
+
}, fr = (i) => {
|
|
3252
|
+
const { id: s, data: r, selected: l, xPos: o, yPos: a, dragging: u } = i, [n, c] = E({ width: 280, height: 450 }), g = pt(), { setNodes: y } = ut(), m = V((b, x, f, C) => {
|
|
3253
|
+
const T = f.offsetWidth, I = f.offsetHeight;
|
|
3254
|
+
c({ width: T, height: I }), g(s);
|
|
3255
|
+
}, []), v = V(() => {
|
|
3256
|
+
}, []), d = {
|
|
3257
|
+
bottom: "nodrag",
|
|
3258
|
+
right: "nodrag",
|
|
3259
|
+
bottomRight: "nodrag"
|
|
3260
|
+
}, S = {
|
|
3261
|
+
bottom: { height: 10, bottom: -5, cursor: "ns-resize", zIndex: 999 },
|
|
3262
|
+
right: { width: 10, right: -5, cursor: "ew-resize", zIndex: 999 },
|
|
3263
|
+
bottomRight: { width: 20, height: 20, right: -5, bottom: -5, cursor: "nwse-resize", zIndex: 1e3 }
|
|
3264
|
+
};
|
|
3265
|
+
return /* @__PURE__ */ e.jsxs(
|
|
3266
|
+
ht,
|
|
3267
|
+
{
|
|
3268
|
+
size: n,
|
|
3269
|
+
minWidth: 800,
|
|
3270
|
+
minHeight: 750,
|
|
3271
|
+
style: dr,
|
|
3272
|
+
onResize: v,
|
|
3273
|
+
handleClasses: d,
|
|
3274
|
+
handleStyles: S,
|
|
3275
|
+
onResizeStop: m,
|
|
3276
|
+
enable: {
|
|
3277
|
+
top: !1,
|
|
3278
|
+
right: !0,
|
|
3279
|
+
bottom: !0,
|
|
3280
|
+
left: !1,
|
|
3281
|
+
topRight: !1,
|
|
3282
|
+
bottomRight: !0,
|
|
3283
|
+
bottomLeft: !1,
|
|
3284
|
+
topLeft: !1
|
|
3285
|
+
},
|
|
3286
|
+
onPointerDown: (b) => b.stopPropagation(),
|
|
3287
|
+
children: [
|
|
3288
|
+
/* @__PURE__ */ e.jsx(
|
|
3289
|
+
"div",
|
|
3290
|
+
{
|
|
3291
|
+
style: {
|
|
3292
|
+
position: "absolute",
|
|
3293
|
+
top: 0,
|
|
3294
|
+
left: 0,
|
|
3295
|
+
right: 0,
|
|
3296
|
+
bottom: 0,
|
|
3297
|
+
overflow: "hidden",
|
|
3298
|
+
outline: l ? "2px solid #007bff" : "none",
|
|
3299
|
+
borderRadius: "2px",
|
|
3300
|
+
boxShadow: "0 4px 15px rgba(0, 0, 0, 0.1)"
|
|
3301
|
+
},
|
|
3302
|
+
children: /* @__PURE__ */ e.jsx(
|
|
3303
|
+
ir,
|
|
3304
|
+
{
|
|
3305
|
+
initialTitle: r.label,
|
|
3306
|
+
pollId: r == null ? void 0 : r.pollId,
|
|
3307
|
+
nodeId: s,
|
|
3308
|
+
onSaved: (b) => {
|
|
3309
|
+
y(
|
|
3310
|
+
(x) => x.map((f) => f.id === s ? {
|
|
3311
|
+
...f,
|
|
3312
|
+
data: { ...f.data, pollId: b }
|
|
3313
|
+
} : f)
|
|
3314
|
+
);
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
)
|
|
3318
|
+
}
|
|
3319
|
+
),
|
|
3320
|
+
/* @__PURE__ */ e.jsx(Ee, { type: "source", position: Ie.Left }),
|
|
3321
|
+
/* @__PURE__ */ e.jsx(Ee, { type: "target", position: Ie.Top })
|
|
3322
|
+
]
|
|
3323
|
+
}
|
|
3324
|
+
);
|
|
3325
|
+
}, cr = {
|
|
3326
|
+
display: "flex",
|
|
3327
|
+
flexDirection: "column",
|
|
3328
|
+
background: "transparent",
|
|
3329
|
+
pointerEvents: "all",
|
|
3330
|
+
position: "relative"
|
|
3331
|
+
}, gr = (i) => {
|
|
3332
|
+
const { id: s, data: r, selected: l, xPos: o, yPos: a, dragging: u } = i, [n, c] = E({ width: 280, height: 450 }), g = pt(), { setNodes: y } = ut(), m = (x) => {
|
|
3333
|
+
y(
|
|
3334
|
+
(f) => f.map((C) => C.id === s ? {
|
|
3335
|
+
...C,
|
|
3336
|
+
data: { ...C.data, pollId: x }
|
|
3337
|
+
} : C)
|
|
3338
|
+
);
|
|
3339
|
+
}, v = V((x, f, C, T) => {
|
|
3340
|
+
const I = C.offsetWidth, A = C.offsetHeight;
|
|
3341
|
+
c({ width: I, height: A }), g(s);
|
|
3342
|
+
}, []), d = V(() => {
|
|
3343
|
+
}, []), S = {
|
|
3344
|
+
bottom: "nodrag",
|
|
3345
|
+
right: "nodrag",
|
|
3346
|
+
bottomRight: "nodrag"
|
|
3347
|
+
}, b = {
|
|
3348
|
+
bottom: { height: 10, bottom: -5, cursor: "ns-resize", zIndex: 999 },
|
|
3349
|
+
right: { width: 10, right: -5, cursor: "ew-resize", zIndex: 999 },
|
|
3350
|
+
bottomRight: { width: 20, height: 20, right: -5, bottom: -5, cursor: "nwse-resize", zIndex: 1e3 }
|
|
3351
|
+
};
|
|
3352
|
+
return /* @__PURE__ */ e.jsxs(
|
|
3353
|
+
ht,
|
|
3354
|
+
{
|
|
3355
|
+
size: n,
|
|
3356
|
+
minWidth: 800,
|
|
3357
|
+
minHeight: 750,
|
|
3358
|
+
style: cr,
|
|
3359
|
+
onResize: d,
|
|
3360
|
+
handleClasses: S,
|
|
3361
|
+
handleStyles: b,
|
|
3362
|
+
onResizeStop: v,
|
|
3363
|
+
enable: {
|
|
3364
|
+
top: !1,
|
|
3365
|
+
right: !0,
|
|
3366
|
+
bottom: !0,
|
|
3367
|
+
left: !1,
|
|
3368
|
+
topRight: !1,
|
|
3369
|
+
bottomRight: !0,
|
|
3370
|
+
bottomLeft: !1,
|
|
3371
|
+
topLeft: !1
|
|
3372
|
+
},
|
|
3373
|
+
onPointerDown: (x) => x.stopPropagation(),
|
|
3374
|
+
children: [
|
|
3375
|
+
/* @__PURE__ */ e.jsx(
|
|
3376
|
+
"div",
|
|
3377
|
+
{
|
|
3378
|
+
style: {
|
|
3379
|
+
position: "absolute",
|
|
3380
|
+
top: 0,
|
|
3381
|
+
left: 0,
|
|
3382
|
+
right: 0,
|
|
3383
|
+
bottom: 0,
|
|
3384
|
+
overflow: "hidden",
|
|
3385
|
+
outline: l ? "2px solid #007bff" : "none",
|
|
3386
|
+
borderRadius: "2px",
|
|
3387
|
+
boxShadow: "0 4px 15px rgba(0, 0, 0, 0.1)"
|
|
3388
|
+
},
|
|
3389
|
+
children: /* @__PURE__ */ e.jsx(
|
|
3390
|
+
ar,
|
|
3391
|
+
{
|
|
3392
|
+
nodeId: s,
|
|
3393
|
+
initialTitle: r.label,
|
|
3394
|
+
pollId: r.pollId,
|
|
3395
|
+
nodeProps: i,
|
|
3396
|
+
onSaved: m
|
|
3397
|
+
}
|
|
3398
|
+
)
|
|
3399
|
+
}
|
|
3400
|
+
),
|
|
3401
|
+
/* @__PURE__ */ e.jsx(Ee, { type: "source", position: Ie.Left }),
|
|
3402
|
+
/* @__PURE__ */ e.jsx(Ee, { type: "target", position: Ie.Top })
|
|
3403
|
+
]
|
|
3404
|
+
}
|
|
3405
|
+
);
|
|
3406
|
+
};
|
|
3407
|
+
export {
|
|
3408
|
+
fr as PollResizable,
|
|
3409
|
+
gr as TestResizable
|
|
3410
|
+
};
|