ui-admin-lib 1.0.0

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.
Files changed (57) hide show
  1. package/README.md +477 -0
  2. package/dist/components/AdminPanel/AdminPanel.d.ts +27 -0
  3. package/dist/components/AdminPanel/AdminPanel.d.ts.map +1 -0
  4. package/dist/components/Badge/Badge.d.ts +10 -0
  5. package/dist/components/Badge/Badge.d.ts.map +1 -0
  6. package/dist/components/CRUD/CrudForm.d.ts +26 -0
  7. package/dist/components/CRUD/CrudForm.d.ts.map +1 -0
  8. package/dist/components/CRUD/CrudList.d.ts +18 -0
  9. package/dist/components/CRUD/CrudList.d.ts.map +1 -0
  10. package/dist/components/Card/Card.d.ts +11 -0
  11. package/dist/components/Card/Card.d.ts.map +1 -0
  12. package/dist/components/Form/Button.d.ts +10 -0
  13. package/dist/components/Form/Button.d.ts.map +1 -0
  14. package/dist/components/Form/Checkbox.d.ts +7 -0
  15. package/dist/components/Form/Checkbox.d.ts.map +1 -0
  16. package/dist/components/Form/Input.d.ts +9 -0
  17. package/dist/components/Form/Input.d.ts.map +1 -0
  18. package/dist/components/Form/Label.d.ts +8 -0
  19. package/dist/components/Form/Label.d.ts.map +1 -0
  20. package/dist/components/Form/LoginForm.d.ts +10 -0
  21. package/dist/components/Form/LoginForm.d.ts.map +1 -0
  22. package/dist/components/Form/Radio.d.ts +7 -0
  23. package/dist/components/Form/Radio.d.ts.map +1 -0
  24. package/dist/components/Form/Select.d.ts +16 -0
  25. package/dist/components/Form/Select.d.ts.map +1 -0
  26. package/dist/components/Form/Textarea.d.ts +9 -0
  27. package/dist/components/Form/Textarea.d.ts.map +1 -0
  28. package/dist/components/Layout/Content.d.ts +8 -0
  29. package/dist/components/Layout/Content.d.ts.map +1 -0
  30. package/dist/components/Layout/Header.d.ts +9 -0
  31. package/dist/components/Layout/Header.d.ts.map +1 -0
  32. package/dist/components/Layout/PageLayout.d.ts +10 -0
  33. package/dist/components/Layout/PageLayout.d.ts.map +1 -0
  34. package/dist/components/Layout/Sidebar.d.ts +9 -0
  35. package/dist/components/Layout/Sidebar.d.ts.map +1 -0
  36. package/dist/components/Loading/Loading.d.ts +9 -0
  37. package/dist/components/Loading/Loading.d.ts.map +1 -0
  38. package/dist/components/Modal/Modal.d.ts +13 -0
  39. package/dist/components/Modal/Modal.d.ts.map +1 -0
  40. package/dist/components/Navigation/Breadcrumbs.d.ts +14 -0
  41. package/dist/components/Navigation/Breadcrumbs.d.ts.map +1 -0
  42. package/dist/components/Navigation/Menu.d.ts +16 -0
  43. package/dist/components/Navigation/Menu.d.ts.map +1 -0
  44. package/dist/components/Navigation/Tabs.d.ts +17 -0
  45. package/dist/components/Navigation/Tabs.d.ts.map +1 -0
  46. package/dist/components/Table/DataTable.d.ts +20 -0
  47. package/dist/components/Table/DataTable.d.ts.map +1 -0
  48. package/dist/components/Toast/Toast.d.ts +19 -0
  49. package/dist/components/Toast/Toast.d.ts.map +1 -0
  50. package/dist/index.cjs.js +30 -0
  51. package/dist/index.d.ts +51 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.esm.js +1459 -0
  54. package/dist/styles.css +1 -0
  55. package/dist/utils/crud.d.ts +28 -0
  56. package/dist/utils/crud.d.ts.map +1 -0
  57. package/package.json +64 -0
@@ -0,0 +1,1459 @@
1
+ var vr = Object.defineProperty;
2
+ var xr = (o, t, a) => t in o ? vr(o, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[t] = a;
3
+ var Be = (o, t, a) => xr(o, typeof t != "symbol" ? t + "" : t, a);
4
+ import Y, { useEffect as me, useState as F } from "react";
5
+ var ue = { exports: {} }, H = {};
6
+ /**
7
+ * @license React
8
+ * react-jsx-runtime.production.min.js
9
+ *
10
+ * Copyright (c) Facebook, Inc. and its affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+ var Ue;
16
+ function br() {
17
+ if (Ue) return H;
18
+ Ue = 1;
19
+ var o = Y, t = Symbol.for("react.element"), a = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, i = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 };
20
+ function v(x, p, c) {
21
+ var m, h = {}, j = null, _ = null;
22
+ c !== void 0 && (j = "" + c), p.key !== void 0 && (j = "" + p.key), p.ref !== void 0 && (_ = p.ref);
23
+ for (m in p) s.call(p, m) && !d.hasOwnProperty(m) && (h[m] = p[m]);
24
+ if (x && x.defaultProps) for (m in p = x.defaultProps, p) h[m] === void 0 && (h[m] = p[m]);
25
+ return { $$typeof: t, type: x, key: j, ref: _, props: h, _owner: i.current };
26
+ }
27
+ return H.Fragment = a, H.jsx = v, H.jsxs = v, H;
28
+ }
29
+ var X = {};
30
+ /**
31
+ * @license React
32
+ * react-jsx-runtime.development.js
33
+ *
34
+ * Copyright (c) Facebook, Inc. and its affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */
39
+ var Le;
40
+ function gr() {
41
+ return Le || (Le = 1, process.env.NODE_ENV !== "production" && function() {
42
+ var o = Y, t = Symbol.for("react.element"), a = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), v = Symbol.for("react.provider"), x = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), N = Symbol.iterator, $ = "@@iterator";
43
+ function u(e) {
44
+ if (e === null || typeof e != "object")
45
+ return null;
46
+ var n = N && e[N] || e[$];
47
+ return typeof n == "function" ? n : null;
48
+ }
49
+ var S = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
50
+ function y(e) {
51
+ {
52
+ for (var n = arguments.length, l = new Array(n > 1 ? n - 1 : 0), f = 1; f < n; f++)
53
+ l[f - 1] = arguments[f];
54
+ k("error", e, l);
55
+ }
56
+ }
57
+ function k(e, n, l) {
58
+ {
59
+ var f = S.ReactDebugCurrentFrame, E = f.getStackAddendum();
60
+ E !== "" && (n += "%s", l = l.concat([E]));
61
+ var R = l.map(function(g) {
62
+ return String(g);
63
+ });
64
+ R.unshift("Warning: " + n), Function.prototype.apply.call(console[e], console, R);
65
+ }
66
+ }
67
+ var W = !1, V = !1, z = !1, J = !1, C = !1, O;
68
+ O = Symbol.for("react.module.reference");
69
+ function Z(e) {
70
+ return !!(typeof e == "string" || typeof e == "function" || e === s || e === d || C || e === i || e === c || e === m || J || e === _ || W || V || z || typeof e == "object" && e !== null && (e.$$typeof === j || e.$$typeof === h || e.$$typeof === v || e.$$typeof === x || e.$$typeof === p || // This needs to include all possible module reference object
71
+ // types supported by any Flight configuration anywhere since
72
+ // we don't know which Flight build this will end up being used
73
+ // with.
74
+ e.$$typeof === O || e.getModuleId !== void 0));
75
+ }
76
+ function Me(e, n, l) {
77
+ var f = e.displayName;
78
+ if (f)
79
+ return f;
80
+ var E = n.displayName || n.name || "";
81
+ return E !== "" ? l + "(" + E + ")" : l;
82
+ }
83
+ function he(e) {
84
+ return e.displayName || "Context";
85
+ }
86
+ function B(e) {
87
+ if (e == null)
88
+ return null;
89
+ if (typeof e.tag == "number" && y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
90
+ return e.displayName || e.name || null;
91
+ if (typeof e == "string")
92
+ return e;
93
+ switch (e) {
94
+ case s:
95
+ return "Fragment";
96
+ case a:
97
+ return "Portal";
98
+ case d:
99
+ return "Profiler";
100
+ case i:
101
+ return "StrictMode";
102
+ case c:
103
+ return "Suspense";
104
+ case m:
105
+ return "SuspenseList";
106
+ }
107
+ if (typeof e == "object")
108
+ switch (e.$$typeof) {
109
+ case x:
110
+ var n = e;
111
+ return he(n) + ".Consumer";
112
+ case v:
113
+ var l = e;
114
+ return he(l._context) + ".Provider";
115
+ case p:
116
+ return Me(e, e.render, "ForwardRef");
117
+ case h:
118
+ var f = e.displayName || null;
119
+ return f !== null ? f : B(e.type) || "Memo";
120
+ case j: {
121
+ var E = e, R = E._payload, g = E._init;
122
+ try {
123
+ return B(g(R));
124
+ } catch {
125
+ return null;
126
+ }
127
+ }
128
+ }
129
+ return null;
130
+ }
131
+ var U = Object.assign, K = 0, pe, ve, xe, be, ge, ye, je;
132
+ function Ee() {
133
+ }
134
+ Ee.__reactDisabledLog = !0;
135
+ function qe() {
136
+ {
137
+ if (K === 0) {
138
+ pe = console.log, ve = console.info, xe = console.warn, be = console.error, ge = console.group, ye = console.groupCollapsed, je = console.groupEnd;
139
+ var e = {
140
+ configurable: !0,
141
+ enumerable: !0,
142
+ value: Ee,
143
+ writable: !0
144
+ };
145
+ Object.defineProperties(console, {
146
+ info: e,
147
+ log: e,
148
+ warn: e,
149
+ error: e,
150
+ group: e,
151
+ groupCollapsed: e,
152
+ groupEnd: e
153
+ });
154
+ }
155
+ K++;
156
+ }
157
+ }
158
+ function Ye() {
159
+ {
160
+ if (K--, K === 0) {
161
+ var e = {
162
+ configurable: !0,
163
+ enumerable: !0,
164
+ writable: !0
165
+ };
166
+ Object.defineProperties(console, {
167
+ log: U({}, e, {
168
+ value: pe
169
+ }),
170
+ info: U({}, e, {
171
+ value: ve
172
+ }),
173
+ warn: U({}, e, {
174
+ value: xe
175
+ }),
176
+ error: U({}, e, {
177
+ value: be
178
+ }),
179
+ group: U({}, e, {
180
+ value: ge
181
+ }),
182
+ groupCollapsed: U({}, e, {
183
+ value: ye
184
+ }),
185
+ groupEnd: U({}, e, {
186
+ value: je
187
+ })
188
+ });
189
+ }
190
+ K < 0 && y("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
191
+ }
192
+ }
193
+ var ae = S.ReactCurrentDispatcher, ne;
194
+ function Q(e, n, l) {
195
+ {
196
+ if (ne === void 0)
197
+ try {
198
+ throw Error();
199
+ } catch (E) {
200
+ var f = E.stack.trim().match(/\n( *(at )?)/);
201
+ ne = f && f[1] || "";
202
+ }
203
+ return `
204
+ ` + ne + e;
205
+ }
206
+ }
207
+ var se = !1, ee;
208
+ {
209
+ var Ve = typeof WeakMap == "function" ? WeakMap : Map;
210
+ ee = new Ve();
211
+ }
212
+ function Ce(e, n) {
213
+ if (!e || se)
214
+ return "";
215
+ {
216
+ var l = ee.get(e);
217
+ if (l !== void 0)
218
+ return l;
219
+ }
220
+ var f;
221
+ se = !0;
222
+ var E = Error.prepareStackTrace;
223
+ Error.prepareStackTrace = void 0;
224
+ var R;
225
+ R = ae.current, ae.current = null, qe();
226
+ try {
227
+ if (n) {
228
+ var g = function() {
229
+ throw Error();
230
+ };
231
+ if (Object.defineProperty(g.prototype, "props", {
232
+ set: function() {
233
+ throw Error();
234
+ }
235
+ }), typeof Reflect == "object" && Reflect.construct) {
236
+ try {
237
+ Reflect.construct(g, []);
238
+ } catch (I) {
239
+ f = I;
240
+ }
241
+ Reflect.construct(e, [], g);
242
+ } else {
243
+ try {
244
+ g.call();
245
+ } catch (I) {
246
+ f = I;
247
+ }
248
+ e.call(g.prototype);
249
+ }
250
+ } else {
251
+ try {
252
+ throw Error();
253
+ } catch (I) {
254
+ f = I;
255
+ }
256
+ e();
257
+ }
258
+ } catch (I) {
259
+ if (I && f && typeof I.stack == "string") {
260
+ for (var b = I.stack.split(`
261
+ `), P = f.stack.split(`
262
+ `), T = b.length - 1, w = P.length - 1; T >= 1 && w >= 0 && b[T] !== P[w]; )
263
+ w--;
264
+ for (; T >= 1 && w >= 0; T--, w--)
265
+ if (b[T] !== P[w]) {
266
+ if (T !== 1 || w !== 1)
267
+ do
268
+ if (T--, w--, w < 0 || b[T] !== P[w]) {
269
+ var D = `
270
+ ` + b[T].replace(" at new ", " at ");
271
+ return e.displayName && D.includes("<anonymous>") && (D = D.replace("<anonymous>", e.displayName)), typeof e == "function" && ee.set(e, D), D;
272
+ }
273
+ while (T >= 1 && w >= 0);
274
+ break;
275
+ }
276
+ }
277
+ } finally {
278
+ se = !1, ae.current = R, Ye(), Error.prepareStackTrace = E;
279
+ }
280
+ var q = e ? e.displayName || e.name : "", L = q ? Q(q) : "";
281
+ return typeof e == "function" && ee.set(e, L), L;
282
+ }
283
+ function ze(e, n, l) {
284
+ return Ce(e, !1);
285
+ }
286
+ function Je(e) {
287
+ var n = e.prototype;
288
+ return !!(n && n.isReactComponent);
289
+ }
290
+ function re(e, n, l) {
291
+ if (e == null)
292
+ return "";
293
+ if (typeof e == "function")
294
+ return Ce(e, Je(e));
295
+ if (typeof e == "string")
296
+ return Q(e);
297
+ switch (e) {
298
+ case c:
299
+ return Q("Suspense");
300
+ case m:
301
+ return Q("SuspenseList");
302
+ }
303
+ if (typeof e == "object")
304
+ switch (e.$$typeof) {
305
+ case p:
306
+ return ze(e.render);
307
+ case h:
308
+ return re(e.type, n, l);
309
+ case j: {
310
+ var f = e, E = f._payload, R = f._init;
311
+ try {
312
+ return re(R(E), n, l);
313
+ } catch {
314
+ }
315
+ }
316
+ }
317
+ return "";
318
+ }
319
+ var G = Object.prototype.hasOwnProperty, Re = {}, _e = S.ReactDebugCurrentFrame;
320
+ function te(e) {
321
+ if (e) {
322
+ var n = e._owner, l = re(e.type, e._source, n ? n.type : null);
323
+ _e.setExtraStackFrame(l);
324
+ } else
325
+ _e.setExtraStackFrame(null);
326
+ }
327
+ function Ke(e, n, l, f, E) {
328
+ {
329
+ var R = Function.call.bind(G);
330
+ for (var g in e)
331
+ if (R(e, g)) {
332
+ var b = void 0;
333
+ try {
334
+ if (typeof e[g] != "function") {
335
+ var P = Error((f || "React class") + ": " + l + " type `" + g + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[g] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
336
+ throw P.name = "Invariant Violation", P;
337
+ }
338
+ b = e[g](n, g, f, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
339
+ } catch (T) {
340
+ b = T;
341
+ }
342
+ b && !(b instanceof Error) && (te(E), y("%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).", f || "React class", l, g, typeof b), te(null)), b instanceof Error && !(b.message in Re) && (Re[b.message] = !0, te(E), y("Failed %s type: %s", l, b.message), te(null));
343
+ }
344
+ }
345
+ }
346
+ var Ge = Array.isArray;
347
+ function ie(e) {
348
+ return Ge(e);
349
+ }
350
+ function He(e) {
351
+ {
352
+ var n = typeof Symbol == "function" && Symbol.toStringTag, l = n && e[Symbol.toStringTag] || e.constructor.name || "Object";
353
+ return l;
354
+ }
355
+ }
356
+ function Xe(e) {
357
+ try {
358
+ return Se(e), !1;
359
+ } catch {
360
+ return !0;
361
+ }
362
+ }
363
+ function Se(e) {
364
+ return "" + e;
365
+ }
366
+ function ke(e) {
367
+ if (Xe(e))
368
+ return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", He(e)), Se(e);
369
+ }
370
+ var Te = S.ReactCurrentOwner, Ze = {
371
+ key: !0,
372
+ ref: !0,
373
+ __self: !0,
374
+ __source: !0
375
+ }, we, Ne;
376
+ function Qe(e) {
377
+ if (G.call(e, "ref")) {
378
+ var n = Object.getOwnPropertyDescriptor(e, "ref").get;
379
+ if (n && n.isReactWarning)
380
+ return !1;
381
+ }
382
+ return e.ref !== void 0;
383
+ }
384
+ function er(e) {
385
+ if (G.call(e, "key")) {
386
+ var n = Object.getOwnPropertyDescriptor(e, "key").get;
387
+ if (n && n.isReactWarning)
388
+ return !1;
389
+ }
390
+ return e.key !== void 0;
391
+ }
392
+ function rr(e, n) {
393
+ typeof e.ref == "string" && Te.current;
394
+ }
395
+ function tr(e, n) {
396
+ {
397
+ var l = function() {
398
+ we || (we = !0, y("%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)", n));
399
+ };
400
+ l.isReactWarning = !0, Object.defineProperty(e, "key", {
401
+ get: l,
402
+ configurable: !0
403
+ });
404
+ }
405
+ }
406
+ function ar(e, n) {
407
+ {
408
+ var l = function() {
409
+ Ne || (Ne = !0, y("%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)", n));
410
+ };
411
+ l.isReactWarning = !0, Object.defineProperty(e, "ref", {
412
+ get: l,
413
+ configurable: !0
414
+ });
415
+ }
416
+ }
417
+ var nr = function(e, n, l, f, E, R, g) {
418
+ var b = {
419
+ // This tag allows us to uniquely identify this as a React Element
420
+ $$typeof: t,
421
+ // Built-in properties that belong on the element
422
+ type: e,
423
+ key: n,
424
+ ref: l,
425
+ props: g,
426
+ // Record the component responsible for creating this element.
427
+ _owner: R
428
+ };
429
+ return b._store = {}, Object.defineProperty(b._store, "validated", {
430
+ configurable: !1,
431
+ enumerable: !1,
432
+ writable: !0,
433
+ value: !1
434
+ }), Object.defineProperty(b, "_self", {
435
+ configurable: !1,
436
+ enumerable: !1,
437
+ writable: !1,
438
+ value: f
439
+ }), Object.defineProperty(b, "_source", {
440
+ configurable: !1,
441
+ enumerable: !1,
442
+ writable: !1,
443
+ value: E
444
+ }), Object.freeze && (Object.freeze(b.props), Object.freeze(b)), b;
445
+ };
446
+ function sr(e, n, l, f, E) {
447
+ {
448
+ var R, g = {}, b = null, P = null;
449
+ l !== void 0 && (ke(l), b = "" + l), er(n) && (ke(n.key), b = "" + n.key), Qe(n) && (P = n.ref, rr(n, E));
450
+ for (R in n)
451
+ G.call(n, R) && !Ze.hasOwnProperty(R) && (g[R] = n[R]);
452
+ if (e && e.defaultProps) {
453
+ var T = e.defaultProps;
454
+ for (R in T)
455
+ g[R] === void 0 && (g[R] = T[R]);
456
+ }
457
+ if (b || P) {
458
+ var w = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
+ b && tr(g, w), P && ar(g, w);
460
+ }
461
+ return nr(e, b, P, E, f, Te.current, g);
462
+ }
463
+ }
464
+ var oe = S.ReactCurrentOwner, Oe = S.ReactDebugCurrentFrame;
465
+ function M(e) {
466
+ if (e) {
467
+ var n = e._owner, l = re(e.type, e._source, n ? n.type : null);
468
+ Oe.setExtraStackFrame(l);
469
+ } else
470
+ Oe.setExtraStackFrame(null);
471
+ }
472
+ var le;
473
+ le = !1;
474
+ function ce(e) {
475
+ return typeof e == "object" && e !== null && e.$$typeof === t;
476
+ }
477
+ function Pe() {
478
+ {
479
+ if (oe.current) {
480
+ var e = B(oe.current.type);
481
+ if (e)
482
+ return `
483
+
484
+ Check the render method of \`` + e + "`.";
485
+ }
486
+ return "";
487
+ }
488
+ }
489
+ function ir(e) {
490
+ return "";
491
+ }
492
+ var Fe = {};
493
+ function or(e) {
494
+ {
495
+ var n = Pe();
496
+ if (!n) {
497
+ var l = typeof e == "string" ? e : e.displayName || e.name;
498
+ l && (n = `
499
+
500
+ Check the top-level render call using <` + l + ">.");
501
+ }
502
+ return n;
503
+ }
504
+ }
505
+ function Ie(e, n) {
506
+ {
507
+ if (!e._store || e._store.validated || e.key != null)
508
+ return;
509
+ e._store.validated = !0;
510
+ var l = or(n);
511
+ if (Fe[l])
512
+ return;
513
+ Fe[l] = !0;
514
+ var f = "";
515
+ e && e._owner && e._owner !== oe.current && (f = " It was passed a child from " + B(e._owner.type) + "."), M(e), y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, f), M(null);
516
+ }
517
+ }
518
+ function De(e, n) {
519
+ {
520
+ if (typeof e != "object")
521
+ return;
522
+ if (ie(e))
523
+ for (var l = 0; l < e.length; l++) {
524
+ var f = e[l];
525
+ ce(f) && Ie(f, n);
526
+ }
527
+ else if (ce(e))
528
+ e._store && (e._store.validated = !0);
529
+ else if (e) {
530
+ var E = u(e);
531
+ if (typeof E == "function" && E !== e.entries)
532
+ for (var R = E.call(e), g; !(g = R.next()).done; )
533
+ ce(g.value) && Ie(g.value, n);
534
+ }
535
+ }
536
+ }
537
+ function lr(e) {
538
+ {
539
+ var n = e.type;
540
+ if (n == null || typeof n == "string")
541
+ return;
542
+ var l;
543
+ if (typeof n == "function")
544
+ l = n.propTypes;
545
+ else if (typeof n == "object" && (n.$$typeof === p || // Note: Memo only checks outer props here.
546
+ // Inner props are checked in the reconciler.
547
+ n.$$typeof === h))
548
+ l = n.propTypes;
549
+ else
550
+ return;
551
+ if (l) {
552
+ var f = B(n);
553
+ Ke(l, e.props, "prop", f, e);
554
+ } else if (n.PropTypes !== void 0 && !le) {
555
+ le = !0;
556
+ var E = B(n);
557
+ y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", E || "Unknown");
558
+ }
559
+ typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
560
+ }
561
+ }
562
+ function cr(e) {
563
+ {
564
+ for (var n = Object.keys(e.props), l = 0; l < n.length; l++) {
565
+ var f = n[l];
566
+ if (f !== "children" && f !== "key") {
567
+ M(e), y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", f), M(null);
568
+ break;
569
+ }
570
+ }
571
+ e.ref !== null && (M(e), y("Invalid attribute `ref` supplied to `React.Fragment`."), M(null));
572
+ }
573
+ }
574
+ var $e = {};
575
+ function Ae(e, n, l, f, E, R) {
576
+ {
577
+ var g = Z(e);
578
+ if (!g) {
579
+ var b = "";
580
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (b += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
581
+ var P = ir();
582
+ P ? b += P : b += Pe();
583
+ var T;
584
+ e === null ? T = "null" : ie(e) ? T = "array" : e !== void 0 && e.$$typeof === t ? (T = "<" + (B(e.type) || "Unknown") + " />", b = " Did you accidentally export a JSX literal instead of a component?") : T = typeof e, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", T, b);
585
+ }
586
+ var w = sr(e, n, l, E, R);
587
+ if (w == null)
588
+ return w;
589
+ if (g) {
590
+ var D = n.children;
591
+ if (D !== void 0)
592
+ if (f)
593
+ if (ie(D)) {
594
+ for (var q = 0; q < D.length; q++)
595
+ De(D[q], e);
596
+ Object.freeze && Object.freeze(D);
597
+ } else
598
+ y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
599
+ else
600
+ De(D, e);
601
+ }
602
+ if (G.call(n, "key")) {
603
+ var L = B(e), I = Object.keys(n).filter(function(pr) {
604
+ return pr !== "key";
605
+ }), de = I.length > 0 ? "{key: someKey, " + I.join(": ..., ") + ": ...}" : "{key: someKey}";
606
+ if (!$e[L + de]) {
607
+ var hr = I.length > 0 ? "{" + I.join(": ..., ") + ": ...}" : "{}";
608
+ y(`A props object containing a "key" prop is being spread into JSX:
609
+ let props = %s;
610
+ <%s {...props} />
611
+ React keys must be passed directly to JSX without using spread:
612
+ let props = %s;
613
+ <%s key={someKey} {...props} />`, de, L, hr, L), $e[L + de] = !0;
614
+ }
615
+ }
616
+ return e === s ? cr(w) : lr(w), w;
617
+ }
618
+ }
619
+ function dr(e, n, l) {
620
+ return Ae(e, n, l, !0);
621
+ }
622
+ function ur(e, n, l) {
623
+ return Ae(e, n, l, !1);
624
+ }
625
+ var fr = ur, mr = dr;
626
+ X.Fragment = s, X.jsx = fr, X.jsxs = mr;
627
+ }()), X;
628
+ }
629
+ process.env.NODE_ENV === "production" ? ue.exports = br() : ue.exports = gr();
630
+ var r = ue.exports;
631
+ const yr = ({
632
+ logo: o,
633
+ children: t,
634
+ className: a = ""
635
+ }) => {
636
+ const s = ["admin-header", a].filter(Boolean).join(" ");
637
+ return /* @__PURE__ */ r.jsxs("header", { className: s, children: [
638
+ o && /* @__PURE__ */ r.jsx("div", { className: "admin-header-logo", children: o }),
639
+ /* @__PURE__ */ r.jsx("div", { className: "admin-header-content", children: t })
640
+ ] });
641
+ }, jr = ({
642
+ children: o,
643
+ className: t = "",
644
+ width: a
645
+ }) => {
646
+ const s = ["admin-sidebar", t].filter(Boolean).join(" "), i = a ? { width: typeof a == "number" ? `${a}px` : a } : {};
647
+ return /* @__PURE__ */ r.jsx("aside", { className: s, style: i, children: o });
648
+ }, Er = ({
649
+ children: o,
650
+ className: t = ""
651
+ }) => {
652
+ const a = ["admin-content", t].filter(Boolean).join(" ");
653
+ return /* @__PURE__ */ r.jsx("main", { className: a, children: o });
654
+ }, Cr = ({
655
+ header: o,
656
+ sidebar: t,
657
+ children: a,
658
+ className: s = ""
659
+ }) => {
660
+ const i = ["admin-page-layout", s].filter(Boolean).join(" ");
661
+ return /* @__PURE__ */ r.jsxs("div", { className: i, children: [
662
+ o && /* @__PURE__ */ r.jsx(r.Fragment, { children: o }),
663
+ /* @__PURE__ */ r.jsxs("div", { className: "admin-layout-with-sidebar", children: [
664
+ t && /* @__PURE__ */ r.jsx(r.Fragment, { children: t }),
665
+ /* @__PURE__ */ r.jsx(Er, { children: a })
666
+ ] })
667
+ ] });
668
+ }, fe = ({
669
+ error: o = !1,
670
+ label: t,
671
+ helperText: a,
672
+ className: s = "",
673
+ id: i,
674
+ ...d
675
+ }) => {
676
+ const v = i || `input-${Math.random().toString(36).substr(2, 9)}`, x = ["admin-input", o && "admin-input-error", s].filter(Boolean).join(" ");
677
+ return /* @__PURE__ */ r.jsxs("div", { style: { width: "100%" }, children: [
678
+ t && /* @__PURE__ */ r.jsx("label", { htmlFor: v, className: "admin-label", children: t }),
679
+ /* @__PURE__ */ r.jsx("input", { id: v, className: x, ...d }),
680
+ a && /* @__PURE__ */ r.jsx("div", { style: { marginTop: "4px", fontSize: "12px", color: o ? "var(--admin-error)" : "var(--admin-text-secondary)" }, children: a })
681
+ ] });
682
+ }, Rr = ({
683
+ options: o,
684
+ error: t = !1,
685
+ label: a,
686
+ helperText: s,
687
+ placeholder: i,
688
+ className: d = "",
689
+ id: v,
690
+ ...x
691
+ }) => {
692
+ const p = v || `select-${Math.random().toString(36).substr(2, 9)}`, c = ["admin-select", t && "admin-input-error", d].filter(Boolean).join(" ");
693
+ return /* @__PURE__ */ r.jsxs("div", { style: { width: "100%" }, children: [
694
+ a && /* @__PURE__ */ r.jsx("label", { htmlFor: p, className: "admin-label", children: a }),
695
+ /* @__PURE__ */ r.jsxs("select", { id: p, className: c, ...x, children: [
696
+ i && /* @__PURE__ */ r.jsx("option", { value: "", disabled: !0, children: i }),
697
+ o.map((m) => /* @__PURE__ */ r.jsx("option", { value: m.value, disabled: m.disabled, children: m.label }, m.value))
698
+ ] }),
699
+ s && /* @__PURE__ */ r.jsx("div", { style: { marginTop: "4px", fontSize: "12px", color: t ? "var(--admin-error)" : "var(--admin-text-secondary)" }, children: s })
700
+ ] });
701
+ }, A = ({
702
+ variant: o = "default",
703
+ size: t = "medium",
704
+ loading: a = !1,
705
+ children: s,
706
+ className: i = "",
707
+ disabled: d,
708
+ ...v
709
+ }) => {
710
+ const x = "admin-button", p = o !== "default" ? `admin-button-${o}` : "", c = [x, p, i].filter(Boolean).join(" "), m = {
711
+ small: { padding: "4px 12px", fontSize: "12px" },
712
+ medium: {},
713
+ large: { padding: "12px 24px", fontSize: "16px" }
714
+ };
715
+ return /* @__PURE__ */ r.jsxs(
716
+ "button",
717
+ {
718
+ className: c,
719
+ disabled: d || a,
720
+ style: m[t],
721
+ ...v,
722
+ children: [
723
+ a && /* @__PURE__ */ r.jsx("span", { className: "admin-loading-spinner", style: { marginRight: "8px" } }),
724
+ s
725
+ ]
726
+ }
727
+ );
728
+ }, _r = ({
729
+ label: o,
730
+ className: t = "",
731
+ id: a,
732
+ ...s
733
+ }) => {
734
+ const i = a || `checkbox-${Math.random().toString(36).substr(2, 9)}`, d = ["admin-checkbox", t].filter(Boolean).join(" ");
735
+ return /* @__PURE__ */ r.jsxs("label", { htmlFor: i, className: d, children: [
736
+ /* @__PURE__ */ r.jsx(
737
+ "input",
738
+ {
739
+ type: "checkbox",
740
+ id: i,
741
+ className: "admin-checkbox-input",
742
+ ...s
743
+ }
744
+ ),
745
+ /* @__PURE__ */ r.jsx("span", { className: "admin-checkbox-box" }),
746
+ o && /* @__PURE__ */ r.jsx("span", { className: "admin-checkbox-label", children: o })
747
+ ] });
748
+ }, Sr = ({
749
+ label: o,
750
+ className: t = "",
751
+ id: a,
752
+ ...s
753
+ }) => {
754
+ const i = a || `radio-${Math.random().toString(36).substr(2, 9)}`, d = ["admin-radio", t].filter(Boolean).join(" ");
755
+ return /* @__PURE__ */ r.jsxs("label", { htmlFor: i, className: d, children: [
756
+ /* @__PURE__ */ r.jsx(
757
+ "input",
758
+ {
759
+ type: "radio",
760
+ id: i,
761
+ className: "admin-radio-input",
762
+ ...s
763
+ }
764
+ ),
765
+ /* @__PURE__ */ r.jsx("span", { className: "admin-radio-box" }),
766
+ o && /* @__PURE__ */ r.jsx("span", { className: "admin-radio-label", children: o })
767
+ ] });
768
+ }, kr = ({
769
+ error: o = !1,
770
+ label: t,
771
+ helperText: a,
772
+ className: s = "",
773
+ id: i,
774
+ ...d
775
+ }) => {
776
+ const v = i || `textarea-${Math.random().toString(36).substr(2, 9)}`, x = ["admin-textarea", o && "admin-input-error", s].filter(Boolean).join(" ");
777
+ return /* @__PURE__ */ r.jsxs("div", { style: { width: "100%" }, children: [
778
+ t && /* @__PURE__ */ r.jsx("label", { htmlFor: v, className: "admin-label", children: t }),
779
+ /* @__PURE__ */ r.jsx("textarea", { id: v, className: x, ...d }),
780
+ a && /* @__PURE__ */ r.jsx("div", { style: { marginTop: "4px", fontSize: "12px", color: o ? "var(--admin-error)" : "var(--admin-text-secondary)" }, children: a })
781
+ ] });
782
+ }, Br = ({
783
+ required: o = !1,
784
+ children: t,
785
+ className: a = "",
786
+ ...s
787
+ }) => {
788
+ const i = ["admin-label", o && "admin-label-required", a].filter(Boolean).join(" ");
789
+ return /* @__PURE__ */ r.jsx("label", { className: i, ...s, children: t });
790
+ };
791
+ function Tr({
792
+ columns: o,
793
+ data: t,
794
+ className: a = "",
795
+ rowKey: s = "id",
796
+ loading: i = !1,
797
+ onRowClick: d
798
+ }) {
799
+ const v = ["admin-table", a].filter(Boolean).join(" "), x = (c, m) => typeof s == "function" ? s(c) : c[s] ?? m, p = (c, m, h) => {
800
+ if (c.render) {
801
+ const j = c.dataIndex ? m[c.dataIndex] : void 0;
802
+ return c.render(j, m, h);
803
+ }
804
+ return c.dataIndex ? m[c.dataIndex] : null;
805
+ };
806
+ return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative" }, children: [
807
+ i && /* @__PURE__ */ r.jsx("div", { style: {
808
+ position: "absolute",
809
+ top: 0,
810
+ left: 0,
811
+ right: 0,
812
+ bottom: 0,
813
+ background: "rgba(255, 255, 255, 0.8)",
814
+ display: "flex",
815
+ alignItems: "center",
816
+ justifyContent: "center",
817
+ zIndex: 1
818
+ }, children: /* @__PURE__ */ r.jsx("div", { className: "admin-loading-spinner" }) }),
819
+ /* @__PURE__ */ r.jsxs("table", { className: v, children: [
820
+ /* @__PURE__ */ r.jsx("thead", { children: /* @__PURE__ */ r.jsx("tr", { children: o.map((c) => /* @__PURE__ */ r.jsx(
821
+ "th",
822
+ {
823
+ style: {
824
+ width: c.width,
825
+ textAlign: c.align || "left"
826
+ },
827
+ children: c.title
828
+ },
829
+ c.key
830
+ )) }) }),
831
+ /* @__PURE__ */ r.jsx("tbody", { children: t.map((c, m) => /* @__PURE__ */ r.jsx(
832
+ "tr",
833
+ {
834
+ onClick: () => d == null ? void 0 : d(c, m),
835
+ style: { cursor: d ? "pointer" : "default" },
836
+ children: o.map((h) => /* @__PURE__ */ r.jsx(
837
+ "td",
838
+ {
839
+ style: {
840
+ textAlign: h.align || "left"
841
+ },
842
+ children: p(h, c, m)
843
+ },
844
+ h.key
845
+ ))
846
+ },
847
+ x(c, m)
848
+ )) })
849
+ ] })
850
+ ] });
851
+ }
852
+ const We = ({
853
+ open: o,
854
+ onClose: t,
855
+ title: a,
856
+ children: s,
857
+ footer: i,
858
+ width: d,
859
+ className: v = ""
860
+ }) => {
861
+ if (me(() => (o ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
862
+ document.body.style.overflow = "";
863
+ }), [o]), !o) return null;
864
+ const x = d ? { width: typeof d == "number" ? `${d}px` : d } : {}, p = (c) => {
865
+ c.target === c.currentTarget && t();
866
+ };
867
+ return /* @__PURE__ */ r.jsx("div", { className: "admin-modal-overlay", onClick: p, children: /* @__PURE__ */ r.jsxs("div", { className: `admin-modal ${v}`, style: x, children: [
868
+ (a !== void 0 || t !== void 0) && /* @__PURE__ */ r.jsxs("div", { className: "admin-modal-header", children: [
869
+ a && /* @__PURE__ */ r.jsx("h3", { className: "admin-modal-title", children: a }),
870
+ t && /* @__PURE__ */ r.jsx("button", { className: "admin-modal-close", onClick: () => t(), children: "×" })
871
+ ] }),
872
+ /* @__PURE__ */ r.jsx("div", { className: "admin-modal-body", children: s }),
873
+ i && /* @__PURE__ */ r.jsx("div", { className: "admin-modal-footer", children: i })
874
+ ] }) });
875
+ }, wr = ({
876
+ items: o,
877
+ className: t = ""
878
+ }) => {
879
+ const a = ["admin-menu", t].filter(Boolean).join(" ");
880
+ return /* @__PURE__ */ r.jsx("ul", { className: a, children: o.map((s) => {
881
+ const i = ["admin-menu-item", s.active && "admin-menu-item-active"].filter(Boolean).join(" "), d = /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
882
+ s.icon && /* @__PURE__ */ r.jsx("span", { style: { marginRight: "8px" }, children: s.icon }),
883
+ s.label
884
+ ] });
885
+ return s.href ? /* @__PURE__ */ r.jsx("li", { className: i, children: /* @__PURE__ */ r.jsx("a", { href: s.href, className: "admin-menu-link", children: d }) }, s.key) : /* @__PURE__ */ r.jsx("li", { className: i, onClick: s.onClick, children: d }, s.key);
886
+ }) });
887
+ }, Ur = ({
888
+ items: o,
889
+ separator: t = "/",
890
+ className: a = ""
891
+ }) => {
892
+ const s = ["admin-breadcrumbs", a].filter(Boolean).join(" ");
893
+ return /* @__PURE__ */ r.jsx("nav", { className: s, children: o.map((i, d) => {
894
+ const v = d === o.length - 1, x = ["admin-breadcrumbs-item", v && "admin-breadcrumbs-item-active"].filter(Boolean).join(" ");
895
+ return /* @__PURE__ */ r.jsxs(Y.Fragment, { children: [
896
+ i.href ? /* @__PURE__ */ r.jsx("a", { href: i.href, className: x, onClick: i.onClick, children: i.label }) : /* @__PURE__ */ r.jsx("span", { className: x, onClick: i.onClick, style: { cursor: i.onClick ? "pointer" : "default" }, children: i.label }),
897
+ !v && /* @__PURE__ */ r.jsx("span", { className: "admin-breadcrumbs-separator", children: t })
898
+ ] }, d);
899
+ }) });
900
+ }, Lr = ({
901
+ items: o,
902
+ defaultActiveKey: t,
903
+ activeKey: a,
904
+ onChange: s,
905
+ className: i = ""
906
+ }) => {
907
+ var h;
908
+ const [d, v] = F(t || ((h = o[0]) == null ? void 0 : h.key) || ""), x = a !== void 0 ? a : d, p = (j) => {
909
+ a === void 0 && v(j), s == null || s(j);
910
+ }, c = o.find((j) => j.key === x), m = ["admin-tabs", i].filter(Boolean).join(" ");
911
+ return /* @__PURE__ */ r.jsxs("div", { className: m, children: [
912
+ /* @__PURE__ */ r.jsx("ul", { className: "admin-tabs-list", children: o.map((j) => {
913
+ const _ = ["admin-tabs-item", j.key === x && "admin-tabs-item-active"].filter(Boolean).join(" ");
914
+ return /* @__PURE__ */ r.jsx(
915
+ "li",
916
+ {
917
+ className: _,
918
+ onClick: () => !j.disabled && p(j.key),
919
+ style: { cursor: j.disabled ? "not-allowed" : "pointer", opacity: j.disabled ? 0.5 : 1 },
920
+ children: j.label
921
+ },
922
+ j.key
923
+ );
924
+ }) }),
925
+ c && /* @__PURE__ */ r.jsx("div", { className: "admin-tabs-content", children: c.content })
926
+ ] });
927
+ }, Nr = ({
928
+ title: o,
929
+ children: t,
930
+ footer: a,
931
+ className: s = "",
932
+ style: i
933
+ }) => {
934
+ const d = ["admin-card", s].filter(Boolean).join(" ");
935
+ return /* @__PURE__ */ r.jsxs("div", { className: d, style: i, children: [
936
+ o && /* @__PURE__ */ r.jsx("div", { className: "admin-card-header", children: /* @__PURE__ */ r.jsx("h3", { className: "admin-card-title", children: o }) }),
937
+ /* @__PURE__ */ r.jsx("div", { className: "admin-card-body", children: t }),
938
+ a && /* @__PURE__ */ r.jsx("div", { className: "admin-card-footer", children: a })
939
+ ] });
940
+ }, Or = ({
941
+ type: o = "info",
942
+ title: t,
943
+ message: a,
944
+ duration: s = 3e3,
945
+ onClose: i
946
+ }) => {
947
+ const [d, v] = F(!0);
948
+ if (me(() => {
949
+ if (s > 0) {
950
+ const p = setTimeout(() => {
951
+ v(!1), setTimeout(() => i == null ? void 0 : i(), 300);
952
+ }, s);
953
+ return () => clearTimeout(p);
954
+ }
955
+ }, [s, i]), !d) return null;
956
+ const x = ["admin-toast-item", `admin-toast-${o}`].filter(Boolean).join(" ");
957
+ return /* @__PURE__ */ r.jsxs("div", { className: x, children: [
958
+ /* @__PURE__ */ r.jsxs("div", { className: "admin-toast-content", children: [
959
+ t && /* @__PURE__ */ r.jsx("div", { className: "admin-toast-title", children: t }),
960
+ /* @__PURE__ */ r.jsx("div", { className: "admin-toast-message", children: a })
961
+ ] }),
962
+ i && /* @__PURE__ */ r.jsx("button", { className: "admin-toast-close", onClick: () => {
963
+ v(!1), i();
964
+ }, children: "×" })
965
+ ] });
966
+ }, Wr = ({ toasts: o, onRemove: t }) => o.length === 0 ? null : /* @__PURE__ */ r.jsx("div", { className: "admin-toast", children: o.map((a) => /* @__PURE__ */ r.jsx(
967
+ Or,
968
+ {
969
+ ...a,
970
+ onClose: () => t(a.id)
971
+ },
972
+ a.id
973
+ )) }), Pr = ({
974
+ text: o,
975
+ size: t = "medium",
976
+ className: a = ""
977
+ }) => {
978
+ const s = ["admin-loading", a].filter(Boolean).join(" "), i = {
979
+ small: { width: "16px", height: "16px", borderWidth: "2px" },
980
+ medium: { width: "20px", height: "20px", borderWidth: "2px" },
981
+ large: { width: "32px", height: "32px", borderWidth: "3px" }
982
+ };
983
+ return /* @__PURE__ */ r.jsxs("div", { className: s, children: [
984
+ /* @__PURE__ */ r.jsx("div", { className: "admin-loading-spinner", style: i[t] }),
985
+ o && /* @__PURE__ */ r.jsx("span", { className: "admin-loading-text", children: o })
986
+ ] });
987
+ }, Mr = ({
988
+ children: o,
989
+ variant: t = "default",
990
+ className: a = ""
991
+ }) => {
992
+ const s = [
993
+ "admin-badge",
994
+ t !== "default" && `admin-badge-${t}`,
995
+ a
996
+ ].filter(Boolean).join(" ");
997
+ return /* @__PURE__ */ r.jsx("span", { className: s, children: o });
998
+ }, Fr = ({
999
+ onSubmit: o,
1000
+ loading: t = !1,
1001
+ error: a,
1002
+ className: s = ""
1003
+ }) => {
1004
+ const [i, d] = F(""), [v, x] = F(""), p = async (c) => {
1005
+ c.preventDefault(), await o(i, v);
1006
+ };
1007
+ return /* @__PURE__ */ r.jsxs("form", { onSubmit: p, className: `admin-login-form ${s}`, style: { width: "100%", maxWidth: "400px" }, children: [
1008
+ /* @__PURE__ */ r.jsx("h2", { style: { marginBottom: "24px", textAlign: "center", color: "var(--admin-text-primary)" }, children: "Вход в систему" }),
1009
+ a && /* @__PURE__ */ r.jsx("div", { style: {
1010
+ padding: "12px",
1011
+ marginBottom: "16px",
1012
+ backgroundColor: "rgba(255, 77, 79, 0.1)",
1013
+ border: "1px solid var(--admin-error)",
1014
+ borderRadius: "var(--admin-border-radius)",
1015
+ color: "var(--admin-error)",
1016
+ fontSize: "14px"
1017
+ }, children: a }),
1018
+ /* @__PURE__ */ r.jsx(
1019
+ fe,
1020
+ {
1021
+ label: "Имя пользователя",
1022
+ type: "text",
1023
+ value: i,
1024
+ onChange: (c) => d(c.target.value),
1025
+ disabled: t,
1026
+ required: !0,
1027
+ autoFocus: !0,
1028
+ style: { marginBottom: "16px" }
1029
+ }
1030
+ ),
1031
+ /* @__PURE__ */ r.jsx(
1032
+ fe,
1033
+ {
1034
+ label: "Пароль",
1035
+ type: "password",
1036
+ value: v,
1037
+ onChange: (c) => x(c.target.value),
1038
+ disabled: t,
1039
+ required: !0,
1040
+ style: { marginBottom: "24px" }
1041
+ }
1042
+ ),
1043
+ /* @__PURE__ */ r.jsx(
1044
+ A,
1045
+ {
1046
+ type: "submit",
1047
+ variant: "primary",
1048
+ loading: t,
1049
+ style: { width: "100%" },
1050
+ children: "Войти"
1051
+ }
1052
+ )
1053
+ ] });
1054
+ };
1055
+ function Ir({
1056
+ service: o,
1057
+ columns: t,
1058
+ title: a,
1059
+ onCreate: s,
1060
+ onEdit: i,
1061
+ onDelete: d,
1062
+ getItemId: v = (m) => m.id,
1063
+ actions: x,
1064
+ className: p = "",
1065
+ refreshKey: c
1066
+ }) {
1067
+ const [m, h] = F([]), [j, _] = F(!0), [N, $] = F(null), [u, S] = F({
1068
+ open: !1,
1069
+ item: null
1070
+ }), [y, k] = F(!1), W = async () => {
1071
+ try {
1072
+ _(!0), $(null);
1073
+ const C = await o.getList();
1074
+ h(C.data);
1075
+ } catch (C) {
1076
+ $(C instanceof Error ? C.message : "Ошибка загрузки данных");
1077
+ } finally {
1078
+ _(!1);
1079
+ }
1080
+ };
1081
+ me(() => {
1082
+ W();
1083
+ }, [c]);
1084
+ const V = (C) => {
1085
+ S({ open: !0, item: C });
1086
+ }, z = async () => {
1087
+ if (u.item)
1088
+ try {
1089
+ k(!0);
1090
+ const C = v(u.item);
1091
+ d ? await d(u.item) : await o.delete(C), S({ open: !1, item: null }), await W();
1092
+ } catch (C) {
1093
+ $(C instanceof Error ? C.message : "Ошибка удаления");
1094
+ } finally {
1095
+ k(!1);
1096
+ }
1097
+ }, J = [
1098
+ ...t,
1099
+ {
1100
+ key: "actions",
1101
+ title: "Действия",
1102
+ render: (C, O) => /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", gap: "8px" }, children: [
1103
+ i && /* @__PURE__ */ r.jsx(A, { size: "small", onClick: () => i(O), children: "Редактировать" }),
1104
+ (d || o) && /* @__PURE__ */ r.jsx(
1105
+ A,
1106
+ {
1107
+ size: "small",
1108
+ variant: "danger",
1109
+ onClick: () => V(O),
1110
+ children: "Удалить"
1111
+ }
1112
+ ),
1113
+ x && x(O)
1114
+ ] })
1115
+ }
1116
+ ];
1117
+ return j && m.length === 0 ? /* @__PURE__ */ r.jsx("div", { style: { padding: "40px", textAlign: "center" }, children: /* @__PURE__ */ r.jsx(Pr, { text: "Загрузка данных..." }) }) : /* @__PURE__ */ r.jsxs("div", { className: p, children: [
1118
+ /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "24px" }, children: [
1119
+ a && /* @__PURE__ */ r.jsx("h1", { style: { margin: 0, fontSize: "24px", fontWeight: 500 }, children: a }),
1120
+ s && /* @__PURE__ */ r.jsx(A, { variant: "primary", onClick: s, children: "Создать" })
1121
+ ] }),
1122
+ N && /* @__PURE__ */ r.jsx("div", { style: {
1123
+ padding: "12px",
1124
+ marginBottom: "16px",
1125
+ backgroundColor: "rgba(255, 77, 79, 0.1)",
1126
+ border: "1px solid var(--admin-error)",
1127
+ borderRadius: "var(--admin-border-radius)",
1128
+ color: "var(--admin-error)"
1129
+ }, children: N }),
1130
+ /* @__PURE__ */ r.jsx(Tr, { columns: J, data: m, loading: j }),
1131
+ /* @__PURE__ */ r.jsx(
1132
+ We,
1133
+ {
1134
+ open: u.open,
1135
+ onClose: () => S({ open: !1, item: null }),
1136
+ title: "Подтверждение удаления",
1137
+ footer: /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1138
+ /* @__PURE__ */ r.jsx(A, { onClick: () => S({ open: !1, item: null }), disabled: y, children: "Отмена" }),
1139
+ /* @__PURE__ */ r.jsx(A, { variant: "danger", onClick: z, loading: y, children: "Удалить" })
1140
+ ] }),
1141
+ children: "Вы уверены, что хотите удалить этот элемент? Это действие нельзя отменить."
1142
+ }
1143
+ )
1144
+ ] });
1145
+ }
1146
+ function Dr({
1147
+ fields: o,
1148
+ initialValues: t = {},
1149
+ onSubmit: a,
1150
+ onCancel: s,
1151
+ loading: i = !1,
1152
+ title: d,
1153
+ submitLabel: v = "Сохранить",
1154
+ cancelLabel: x = "Отмена",
1155
+ className: p = ""
1156
+ }) {
1157
+ const [c, m] = Y.useState(t || {}), [h, j] = Y.useState({});
1158
+ Y.useEffect(() => {
1159
+ m(t || {});
1160
+ }, [t]);
1161
+ const _ = (u, S) => {
1162
+ m((y) => ({ ...y, [u]: S })), h[u] && j((y) => {
1163
+ const k = { ...y };
1164
+ return delete k[u], k;
1165
+ });
1166
+ }, N = async (u) => {
1167
+ u.preventDefault();
1168
+ const S = {};
1169
+ if (o.forEach((y) => {
1170
+ y.required && !c[y.name] && (S[y.name] = `${y.label} обязателен для заполнения`);
1171
+ }), Object.keys(S).length > 0) {
1172
+ j(S);
1173
+ return;
1174
+ }
1175
+ await a(c);
1176
+ }, $ = (u) => {
1177
+ var y;
1178
+ const S = {
1179
+ label: u.label,
1180
+ error: !!h[u.name],
1181
+ helperText: h[u.name],
1182
+ disabled: i || u.disabled,
1183
+ required: u.required,
1184
+ placeholder: u.placeholder
1185
+ };
1186
+ switch (u.type) {
1187
+ case "textarea":
1188
+ return /* @__PURE__ */ r.jsx(
1189
+ kr,
1190
+ {
1191
+ ...S,
1192
+ value: c[u.name] || "",
1193
+ onChange: (k) => _(u.name, k.target.value)
1194
+ },
1195
+ u.name
1196
+ );
1197
+ case "select":
1198
+ return /* @__PURE__ */ r.jsx(
1199
+ Rr,
1200
+ {
1201
+ ...S,
1202
+ value: c[u.name] || "",
1203
+ onChange: (k) => _(u.name, k.target.value),
1204
+ options: u.options || []
1205
+ },
1206
+ u.name
1207
+ );
1208
+ case "checkbox":
1209
+ return /* @__PURE__ */ r.jsx("div", { style: { marginBottom: "16px" }, children: /* @__PURE__ */ r.jsx(
1210
+ _r,
1211
+ {
1212
+ ...S,
1213
+ checked: !!c[u.name],
1214
+ onChange: (k) => _(u.name, k.target.checked)
1215
+ }
1216
+ ) }, u.name);
1217
+ case "radio":
1218
+ return /* @__PURE__ */ r.jsxs("div", { style: { marginBottom: "16px" }, children: [
1219
+ /* @__PURE__ */ r.jsxs("label", { style: { display: "block", marginBottom: "8px", fontWeight: 500 }, children: [
1220
+ u.label,
1221
+ u.required && /* @__PURE__ */ r.jsx("span", { style: { color: "var(--admin-error)" }, children: " *" })
1222
+ ] }),
1223
+ /* @__PURE__ */ r.jsx("div", { style: { display: "flex", gap: "16px", flexWrap: "wrap" }, children: (y = u.options) == null ? void 0 : y.map((k) => /* @__PURE__ */ r.jsx(
1224
+ Sr,
1225
+ {
1226
+ name: u.name,
1227
+ label: k.label,
1228
+ checked: c[u.name] === k.value,
1229
+ onChange: () => _(u.name, k.value),
1230
+ disabled: i || u.disabled
1231
+ },
1232
+ k.value
1233
+ )) }),
1234
+ h[u.name] && /* @__PURE__ */ r.jsx("div", { style: { marginTop: "4px", fontSize: "12px", color: "var(--admin-error)" }, children: h[u.name] })
1235
+ ] }, u.name);
1236
+ default:
1237
+ return /* @__PURE__ */ r.jsx(
1238
+ fe,
1239
+ {
1240
+ ...S,
1241
+ type: u.type || "text",
1242
+ value: c[u.name] || "",
1243
+ onChange: (k) => _(u.name, k.target.value),
1244
+ style: { marginBottom: "16px" }
1245
+ },
1246
+ u.name
1247
+ );
1248
+ }
1249
+ };
1250
+ return /* @__PURE__ */ r.jsx(Nr, { title: d, className: p, children: /* @__PURE__ */ r.jsxs("form", { onSubmit: N, children: [
1251
+ o.map((u) => /* @__PURE__ */ r.jsx("div", { children: $(u) }, u.name)),
1252
+ /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", gap: "12px", marginTop: "24px", justifyContent: "flex-end" }, children: [
1253
+ s && /* @__PURE__ */ r.jsx(A, { type: "button", onClick: s, disabled: i, children: x }),
1254
+ /* @__PURE__ */ r.jsx(A, { type: "submit", variant: "primary", loading: i, children: v })
1255
+ ] })
1256
+ ] }) });
1257
+ }
1258
+ const qr = ({
1259
+ title: o = "Админ панель",
1260
+ logo: t,
1261
+ models: a,
1262
+ login: s,
1263
+ user: i
1264
+ }) => {
1265
+ const [d, v] = F(!s), [x, p] = F(!1), [c, m] = F(null), [h, j] = F(a[0] || null), [_, N] = F({ open: !1, mode: "create", item: null }), [$, u] = F(0), S = async (C, O) => {
1266
+ if (s) {
1267
+ p(!0), m(null);
1268
+ try {
1269
+ await s.onSubmit(C, O), v(!0);
1270
+ } catch (Z) {
1271
+ m(Z instanceof Error ? Z.message : "Ошибка авторизации");
1272
+ } finally {
1273
+ p(!1);
1274
+ }
1275
+ }
1276
+ }, y = () => {
1277
+ v(!1), j(a[0] || null), N({ open: !1, mode: "create", item: null }), i != null && i.onLogout && i.onLogout();
1278
+ }, k = () => {
1279
+ N({ open: !0, mode: "create", item: null });
1280
+ }, W = (C) => {
1281
+ N({ open: !0, mode: "edit", item: C });
1282
+ }, V = async (C) => {
1283
+ if (h)
1284
+ try {
1285
+ if (p(!0), m(null), _.mode === "create")
1286
+ await h.service.create(C);
1287
+ else if (_.item) {
1288
+ const O = h.getItemId ? h.getItemId(_.item) : _.item.id;
1289
+ await h.service.update(O, C);
1290
+ }
1291
+ N({ open: !1, mode: "create", item: null }), u((O) => O + 1);
1292
+ } catch (O) {
1293
+ m(O instanceof Error ? O.message : "Ошибка сохранения");
1294
+ } finally {
1295
+ p(!1);
1296
+ }
1297
+ };
1298
+ if (!d && s)
1299
+ return /* @__PURE__ */ r.jsx(
1300
+ "div",
1301
+ {
1302
+ style: {
1303
+ display: "flex",
1304
+ alignItems: "center",
1305
+ justifyContent: "center",
1306
+ height: "100vh",
1307
+ background: "var(--admin-bg)"
1308
+ },
1309
+ children: /* @__PURE__ */ r.jsx(Fr, { onSubmit: S, loading: x, error: c || void 0 })
1310
+ }
1311
+ );
1312
+ const z = (C) => {
1313
+ j(C), N({ open: !1, mode: "create", item: null });
1314
+ }, J = a.map((C) => ({
1315
+ key: C.name,
1316
+ label: C.label,
1317
+ active: (h == null ? void 0 : h.name) === C.name,
1318
+ onClick: () => z(C)
1319
+ }));
1320
+ return /* @__PURE__ */ r.jsx(
1321
+ Cr,
1322
+ {
1323
+ header: /* @__PURE__ */ r.jsx(yr, { logo: t || o, children: i && /* @__PURE__ */ r.jsxs("div", { style: { marginLeft: "auto", display: "flex", alignItems: "center", gap: "16px" }, children: [
1324
+ i.name && /* @__PURE__ */ r.jsx("span", { children: i.name }),
1325
+ /* @__PURE__ */ r.jsx(A, { variant: "ghost", onClick: y, children: "Выйти" })
1326
+ ] }) }),
1327
+ sidebar: /* @__PURE__ */ r.jsx(jr, { children: /* @__PURE__ */ r.jsx(wr, { items: J }) }),
1328
+ children: h && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1329
+ /* @__PURE__ */ r.jsx(
1330
+ Ir,
1331
+ {
1332
+ service: h.service,
1333
+ columns: h.columns,
1334
+ title: h.label,
1335
+ onCreate: k,
1336
+ onEdit: W,
1337
+ getItemId: h.getItemId,
1338
+ refreshKey: $
1339
+ },
1340
+ h.name
1341
+ ),
1342
+ /* @__PURE__ */ r.jsx(
1343
+ We,
1344
+ {
1345
+ open: _.open,
1346
+ onClose: () => N({ open: !1, mode: "create", item: null }),
1347
+ title: _.mode === "create" ? `Создать ${h.label}` : `Редактировать ${h.label}`,
1348
+ width: 600,
1349
+ children: /* @__PURE__ */ r.jsx(
1350
+ Dr,
1351
+ {
1352
+ fields: h.fields,
1353
+ initialValues: _.item || {},
1354
+ onSubmit: V,
1355
+ onCancel: () => N({ open: !1, mode: "create", item: null }),
1356
+ loading: x,
1357
+ submitLabel: _.mode === "create" ? "Создать" : "Сохранить"
1358
+ }
1359
+ )
1360
+ }
1361
+ )
1362
+ ] })
1363
+ }
1364
+ );
1365
+ };
1366
+ class Yr {
1367
+ constructor(t) {
1368
+ Be(this, "config");
1369
+ this.config = {
1370
+ baseUrl: t.baseUrl,
1371
+ getListUrl: t.getListUrl || (() => t.baseUrl),
1372
+ getDetailUrl: t.getDetailUrl || ((a) => `${t.baseUrl}/${a}`),
1373
+ getCreateUrl: t.getCreateUrl || (() => t.baseUrl),
1374
+ getUpdateUrl: t.getUpdateUrl || ((a) => `${t.baseUrl}/${a}`),
1375
+ getDeleteUrl: t.getDeleteUrl || ((a) => `${t.baseUrl}/${a}`),
1376
+ transformRequest: t.transformRequest || ((a) => a),
1377
+ transformResponse: t.transformResponse || ((a) => a),
1378
+ headers: t.headers || {}
1379
+ };
1380
+ }
1381
+ async request(t, a = {}) {
1382
+ const s = await fetch(t, {
1383
+ ...a,
1384
+ headers: {
1385
+ "Content-Type": "application/json",
1386
+ ...this.config.headers,
1387
+ ...a.headers
1388
+ }
1389
+ });
1390
+ if (!s.ok)
1391
+ throw new Error(`HTTP error! status: ${s.status}`);
1392
+ return s.json();
1393
+ }
1394
+ async getList(t) {
1395
+ const a = this.config.getListUrl(t), s = await this.request(a);
1396
+ if (Array.isArray(s))
1397
+ return { data: s.map((i) => this.config.transformResponse(i)) };
1398
+ if (s.results || s.data || s.items) {
1399
+ const i = s.results || s.data || s.items;
1400
+ return {
1401
+ data: i.map((d) => this.config.transformResponse(d)),
1402
+ total: s.total || s.count || i.length
1403
+ };
1404
+ }
1405
+ return { data: [this.config.transformResponse(s)] };
1406
+ }
1407
+ async getDetail(t) {
1408
+ const a = this.config.getDetailUrl(t), s = await this.request(a);
1409
+ return this.config.transformResponse(s);
1410
+ }
1411
+ async create(t) {
1412
+ const a = this.config.getCreateUrl(), s = this.config.transformRequest(t), i = await this.request(a, {
1413
+ method: "POST",
1414
+ body: JSON.stringify(s)
1415
+ });
1416
+ return this.config.transformResponse(i);
1417
+ }
1418
+ async update(t, a) {
1419
+ const s = this.config.getUpdateUrl(t), i = this.config.transformRequest(a), d = await this.request(s, {
1420
+ method: "PUT",
1421
+ body: JSON.stringify(i)
1422
+ });
1423
+ return this.config.transformResponse(d);
1424
+ }
1425
+ async delete(t) {
1426
+ const a = this.config.getDeleteUrl(t);
1427
+ await this.request(a, {
1428
+ method: "DELETE"
1429
+ });
1430
+ }
1431
+ }
1432
+ export {
1433
+ qr as AdminPanel,
1434
+ Mr as Badge,
1435
+ Ur as Breadcrumbs,
1436
+ A as Button,
1437
+ Nr as Card,
1438
+ _r as Checkbox,
1439
+ Er as Content,
1440
+ Dr as CrudForm,
1441
+ Ir as CrudList,
1442
+ Yr as CrudService,
1443
+ Tr as DataTable,
1444
+ yr as Header,
1445
+ fe as Input,
1446
+ Br as Label,
1447
+ Pr as Loading,
1448
+ Fr as LoginForm,
1449
+ wr as Menu,
1450
+ We as Modal,
1451
+ Cr as PageLayout,
1452
+ Sr as Radio,
1453
+ Rr as Select,
1454
+ jr as Sidebar,
1455
+ Lr as Tabs,
1456
+ kr as Textarea,
1457
+ Or as Toast,
1458
+ Wr as ToastContainer
1459
+ };