poll-test-widgets 0.0.2 → 0.0.3

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