@devtable/settings-form 8.57.0 → 8.57.2

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,39 +1,673 @@
1
- import * as K from "/Users/leto/Merico/merico-dev/table/node_modules/react/jsx-runtime.js";
2
- import { Box as v, TextInput as z, Divider as V, Group as w, NumberInput as ie, PasswordInput as L, Button as b, Modal as O, Stack as B, Alert as oe, SegmentedControl as ae, useMantineTheme as se, Tooltip as ce, Text as I, LoadingOverlay as H, Table as $, Select as le, Switch as de } from "@mantine/core";
3
- import { showNotification as _, updateNotification as S } from "@mantine/notifications";
4
- import * as x from "react";
5
- import F, { useEffect as G, forwardRef as J, useState as Z, useMemo as ee } from "react";
6
- import { Recycle as ue, AlertCircle as pe, PlaylistAdd as Q, Trash as W, Edit as ge } from "tabler-icons-react";
7
- import me from "axios";
8
- import he from "crypto-js";
9
- import fe from "lodash";
10
- import { useForm as q, Controller as m } from "react-hook-form";
11
- import { useBoolean as be, useRequest as T } from "ahooks";
12
- import we, { loader as U } from "@monaco-editor/react";
13
- import { useModals as E, closeAllModals as Se } from "@mantine/modals";
14
- const C = K.Fragment, e = K.jsx, d = K.jsxs;
15
- function ze(t) {
1
+ import * as Z from "react";
2
+ import H, { useEffect as Te, forwardRef as ze, useState as lr, useMemo as ur } from "react";
3
+ import { Box as I, TextInput as D, Divider as Oe, Group as z, NumberInput as Wr, PasswordInput as de, Button as T, Modal as ne, Stack as Ae, Alert as Yr, SegmentedControl as Br, useMantineTheme as Kr, Tooltip as Gr, Text as ue, LoadingOverlay as xe, Table as ke, Select as Hr, Switch as Jr } from "@mantine/core";
4
+ import { showNotification as V, updateNotification as x } from "@mantine/notifications";
5
+ import { Recycle as Xr, AlertCircle as Qr, PlaylistAdd as De, Trash as je, Edit as Zr } from "tabler-icons-react";
6
+ import et from "axios";
7
+ import rt from "crypto-js";
8
+ import tt from "lodash";
9
+ import { useForm as J, Controller as R } from "react-hook-form";
10
+ import { useBoolean as nt, useRequest as G } from "ahooks";
11
+ import at, { loader as Ee } from "@monaco-editor/react";
12
+ import { useModals as fe, closeAllModals as it } from "@mantine/modals";
13
+ var te = {}, ot = {
14
+ get exports() {
15
+ return te;
16
+ },
17
+ set exports(t) {
18
+ te = t;
19
+ }
20
+ }, ee = {};
21
+ /**
22
+ * @license React
23
+ * react-jsx-runtime.production.min.js
24
+ *
25
+ * Copyright (c) Facebook, Inc. and its affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */
30
+ var or;
31
+ function st() {
32
+ if (or)
33
+ return ee;
34
+ or = 1;
35
+ var t = H, n = Symbol.for("react.element"), i = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, l = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
36
+ function c(d, p, b) {
37
+ var f, h = {}, _ = null, k = null;
38
+ b !== void 0 && (_ = "" + b), p.key !== void 0 && (_ = "" + p.key), p.ref !== void 0 && (k = p.ref);
39
+ for (f in p)
40
+ o.call(p, f) && !s.hasOwnProperty(f) && (h[f] = p[f]);
41
+ if (d && d.defaultProps)
42
+ for (f in p = d.defaultProps, p)
43
+ h[f] === void 0 && (h[f] = p[f]);
44
+ return { $$typeof: n, type: d, key: _, ref: k, props: h, _owner: l.current };
45
+ }
46
+ return ee.Fragment = i, ee.jsx = c, ee.jsxs = c, ee;
47
+ }
48
+ var re = {};
49
+ /**
50
+ * @license React
51
+ * react-jsx-runtime.development.js
52
+ *
53
+ * Copyright (c) Facebook, Inc. and its affiliates.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE file in the root directory of this source tree.
57
+ */
58
+ var sr;
59
+ function ct() {
60
+ return sr || (sr = 1, process.env.NODE_ENV !== "production" && function() {
61
+ var t = H, n = Symbol.for("react.element"), i = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), c = Symbol.for("react.provider"), d = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), k = Symbol.for("react.offscreen"), q = Symbol.iterator, he = "@@iterator";
62
+ function me(e) {
63
+ if (e === null || typeof e != "object")
64
+ return null;
65
+ var a = q && e[q] || e[he];
66
+ return typeof a == "function" ? a : null;
67
+ }
68
+ var U = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
69
+ function O(e) {
70
+ {
71
+ for (var a = arguments.length, u = new Array(a > 1 ? a - 1 : 0), g = 1; g < a; g++)
72
+ u[g - 1] = arguments[g];
73
+ dr("error", e, u);
74
+ }
75
+ }
76
+ function dr(e, a, u) {
77
+ {
78
+ var g = U.ReactDebugCurrentFrame, S = g.getStackAddendum();
79
+ S !== "" && (a += "%s", u = u.concat([S]));
80
+ var y = u.map(function(w) {
81
+ return String(w);
82
+ });
83
+ y.unshift("Warning: " + a), Function.prototype.apply.call(console[e], console, y);
84
+ }
85
+ }
86
+ var fr = !1, pr = !1, gr = !1, hr = !1, mr = !1, Fe;
87
+ Fe = Symbol.for("react.module.reference");
88
+ function vr(e) {
89
+ return !!(typeof e == "string" || typeof e == "function" || e === o || e === s || mr || e === l || e === b || e === f || hr || e === k || fr || pr || gr || typeof e == "object" && e !== null && (e.$$typeof === _ || e.$$typeof === h || e.$$typeof === c || e.$$typeof === d || e.$$typeof === p || // This needs to include all possible module reference object
90
+ // types supported by any Flight configuration anywhere since
91
+ // we don't know which Flight build this will end up being used
92
+ // with.
93
+ e.$$typeof === Fe || e.getModuleId !== void 0));
94
+ }
95
+ function br(e, a, u) {
96
+ var g = e.displayName;
97
+ if (g)
98
+ return g;
99
+ var S = a.displayName || a.name || "";
100
+ return S !== "" ? u + "(" + S + ")" : u;
101
+ }
102
+ function qe(e) {
103
+ return e.displayName || "Context";
104
+ }
105
+ function L(e) {
106
+ if (e == null)
107
+ return null;
108
+ if (typeof e.tag == "number" && O("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
109
+ return e.displayName || e.name || null;
110
+ if (typeof e == "string")
111
+ return e;
112
+ switch (e) {
113
+ case o:
114
+ return "Fragment";
115
+ case i:
116
+ return "Portal";
117
+ case s:
118
+ return "Profiler";
119
+ case l:
120
+ return "StrictMode";
121
+ case b:
122
+ return "Suspense";
123
+ case f:
124
+ return "SuspenseList";
125
+ }
126
+ if (typeof e == "object")
127
+ switch (e.$$typeof) {
128
+ case d:
129
+ var a = e;
130
+ return qe(a) + ".Consumer";
131
+ case c:
132
+ var u = e;
133
+ return qe(u._context) + ".Provider";
134
+ case p:
135
+ return br(e, e.render, "ForwardRef");
136
+ case h:
137
+ var g = e.displayName || null;
138
+ return g !== null ? g : L(e.type) || "Memo";
139
+ case _: {
140
+ var S = e, y = S._payload, w = S._init;
141
+ try {
142
+ return L(w(y));
143
+ } catch {
144
+ return null;
145
+ }
146
+ }
147
+ }
148
+ return null;
149
+ }
150
+ var W = Object.assign, X = 0, Le, Me, Ne, Ue, Ve, $e, We;
151
+ function Ye() {
152
+ }
153
+ Ye.__reactDisabledLog = !0;
154
+ function wr() {
155
+ {
156
+ if (X === 0) {
157
+ Le = console.log, Me = console.info, Ne = console.warn, Ue = console.error, Ve = console.group, $e = console.groupCollapsed, We = console.groupEnd;
158
+ var e = {
159
+ configurable: !0,
160
+ enumerable: !0,
161
+ value: Ye,
162
+ writable: !0
163
+ };
164
+ Object.defineProperties(console, {
165
+ info: e,
166
+ log: e,
167
+ warn: e,
168
+ error: e,
169
+ group: e,
170
+ groupCollapsed: e,
171
+ groupEnd: e
172
+ });
173
+ }
174
+ X++;
175
+ }
176
+ }
177
+ function Sr() {
178
+ {
179
+ if (X--, X === 0) {
180
+ var e = {
181
+ configurable: !0,
182
+ enumerable: !0,
183
+ writable: !0
184
+ };
185
+ Object.defineProperties(console, {
186
+ log: W({}, e, {
187
+ value: Le
188
+ }),
189
+ info: W({}, e, {
190
+ value: Me
191
+ }),
192
+ warn: W({}, e, {
193
+ value: Ne
194
+ }),
195
+ error: W({}, e, {
196
+ value: Ue
197
+ }),
198
+ group: W({}, e, {
199
+ value: Ve
200
+ }),
201
+ groupCollapsed: W({}, e, {
202
+ value: $e
203
+ }),
204
+ groupEnd: W({}, e, {
205
+ value: We
206
+ })
207
+ });
208
+ }
209
+ X < 0 && O("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
210
+ }
211
+ }
212
+ var ve = U.ReactCurrentDispatcher, be;
213
+ function ae(e, a, u) {
214
+ {
215
+ if (be === void 0)
216
+ try {
217
+ throw Error();
218
+ } catch (S) {
219
+ var g = S.stack.trim().match(/\n( *(at )?)/);
220
+ be = g && g[1] || "";
221
+ }
222
+ return `
223
+ ` + be + e;
224
+ }
225
+ }
226
+ var we = !1, ie;
227
+ {
228
+ var _r = typeof WeakMap == "function" ? WeakMap : Map;
229
+ ie = new _r();
230
+ }
231
+ function Be(e, a) {
232
+ if (!e || we)
233
+ return "";
234
+ {
235
+ var u = ie.get(e);
236
+ if (u !== void 0)
237
+ return u;
238
+ }
239
+ var g;
240
+ we = !0;
241
+ var S = Error.prepareStackTrace;
242
+ Error.prepareStackTrace = void 0;
243
+ var y;
244
+ y = ve.current, ve.current = null, wr();
245
+ try {
246
+ if (a) {
247
+ var w = function() {
248
+ throw Error();
249
+ };
250
+ if (Object.defineProperty(w.prototype, "props", {
251
+ set: function() {
252
+ throw Error();
253
+ }
254
+ }), typeof Reflect == "object" && Reflect.construct) {
255
+ try {
256
+ Reflect.construct(w, []);
257
+ } catch (M) {
258
+ g = M;
259
+ }
260
+ Reflect.construct(e, [], w);
261
+ } else {
262
+ try {
263
+ w.call();
264
+ } catch (M) {
265
+ g = M;
266
+ }
267
+ e.call(w.prototype);
268
+ }
269
+ } else {
270
+ try {
271
+ throw Error();
272
+ } catch (M) {
273
+ g = M;
274
+ }
275
+ e();
276
+ }
277
+ } catch (M) {
278
+ if (M && g && typeof M.stack == "string") {
279
+ for (var m = M.stack.split(`
280
+ `), A = g.stack.split(`
281
+ `), P = m.length - 1, E = A.length - 1; P >= 1 && E >= 0 && m[P] !== A[E]; )
282
+ E--;
283
+ for (; P >= 1 && E >= 0; P--, E--)
284
+ if (m[P] !== A[E]) {
285
+ if (P !== 1 || E !== 1)
286
+ do
287
+ if (P--, E--, E < 0 || m[P] !== A[E]) {
288
+ var F = `
289
+ ` + m[P].replace(" at new ", " at ");
290
+ return e.displayName && F.includes("<anonymous>") && (F = F.replace("<anonymous>", e.displayName)), typeof e == "function" && ie.set(e, F), F;
291
+ }
292
+ while (P >= 1 && E >= 0);
293
+ break;
294
+ }
295
+ }
296
+ } finally {
297
+ we = !1, ve.current = y, Sr(), Error.prepareStackTrace = S;
298
+ }
299
+ var K = e ? e.displayName || e.name : "", ir = K ? ae(K) : "";
300
+ return typeof e == "function" && ie.set(e, ir), ir;
301
+ }
302
+ function yr(e, a, u) {
303
+ return Be(e, !1);
304
+ }
305
+ function Rr(e) {
306
+ var a = e.prototype;
307
+ return !!(a && a.isReactComponent);
308
+ }
309
+ function oe(e, a, u) {
310
+ if (e == null)
311
+ return "";
312
+ if (typeof e == "function")
313
+ return Be(e, Rr(e));
314
+ if (typeof e == "string")
315
+ return ae(e);
316
+ switch (e) {
317
+ case b:
318
+ return ae("Suspense");
319
+ case f:
320
+ return ae("SuspenseList");
321
+ }
322
+ if (typeof e == "object")
323
+ switch (e.$$typeof) {
324
+ case p:
325
+ return yr(e.render);
326
+ case h:
327
+ return oe(e.type, a, u);
328
+ case _: {
329
+ var g = e, S = g._payload, y = g._init;
330
+ try {
331
+ return oe(y(S), a, u);
332
+ } catch {
333
+ }
334
+ }
335
+ }
336
+ return "";
337
+ }
338
+ var se = Object.prototype.hasOwnProperty, Ke = {}, Ge = U.ReactDebugCurrentFrame;
339
+ function ce(e) {
340
+ if (e) {
341
+ var a = e._owner, u = oe(e.type, e._source, a ? a.type : null);
342
+ Ge.setExtraStackFrame(u);
343
+ } else
344
+ Ge.setExtraStackFrame(null);
345
+ }
346
+ function Pr(e, a, u, g, S) {
347
+ {
348
+ var y = Function.call.bind(se);
349
+ for (var w in e)
350
+ if (y(e, w)) {
351
+ var m = void 0;
352
+ try {
353
+ if (typeof e[w] != "function") {
354
+ var A = Error((g || "React class") + ": " + u + " type `" + w + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[w] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
355
+ throw A.name = "Invariant Violation", A;
356
+ }
357
+ m = e[w](a, w, g, u, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
358
+ } catch (P) {
359
+ m = P;
360
+ }
361
+ m && !(m instanceof Error) && (ce(S), O("%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).", g || "React class", u, w, typeof m), ce(null)), m instanceof Error && !(m.message in Ke) && (Ke[m.message] = !0, ce(S), O("Failed %s type: %s", u, m.message), ce(null));
362
+ }
363
+ }
364
+ }
365
+ var Er = Array.isArray;
366
+ function Se(e) {
367
+ return Er(e);
368
+ }
369
+ function Cr(e) {
370
+ {
371
+ var a = typeof Symbol == "function" && Symbol.toStringTag, u = a && e[Symbol.toStringTag] || e.constructor.name || "Object";
372
+ return u;
373
+ }
374
+ }
375
+ function Tr(e) {
376
+ try {
377
+ return He(e), !1;
378
+ } catch {
379
+ return !0;
380
+ }
381
+ }
382
+ function He(e) {
383
+ return "" + e;
384
+ }
385
+ function Je(e) {
386
+ if (Tr(e))
387
+ return O("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Cr(e)), He(e);
388
+ }
389
+ var Q = U.ReactCurrentOwner, zr = {
390
+ key: !0,
391
+ ref: !0,
392
+ __self: !0,
393
+ __source: !0
394
+ }, Xe, Qe, _e;
395
+ _e = {};
396
+ function Or(e) {
397
+ if (se.call(e, "ref")) {
398
+ var a = Object.getOwnPropertyDescriptor(e, "ref").get;
399
+ if (a && a.isReactWarning)
400
+ return !1;
401
+ }
402
+ return e.ref !== void 0;
403
+ }
404
+ function Ar(e) {
405
+ if (se.call(e, "key")) {
406
+ var a = Object.getOwnPropertyDescriptor(e, "key").get;
407
+ if (a && a.isReactWarning)
408
+ return !1;
409
+ }
410
+ return e.key !== void 0;
411
+ }
412
+ function xr(e, a) {
413
+ if (typeof e.ref == "string" && Q.current && a && Q.current.stateNode !== a) {
414
+ var u = L(Q.current.type);
415
+ _e[u] || (O('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', L(Q.current.type), e.ref), _e[u] = !0);
416
+ }
417
+ }
418
+ function kr(e, a) {
419
+ {
420
+ var u = function() {
421
+ Xe || (Xe = !0, O("%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)", a));
422
+ };
423
+ u.isReactWarning = !0, Object.defineProperty(e, "key", {
424
+ get: u,
425
+ configurable: !0
426
+ });
427
+ }
428
+ }
429
+ function Dr(e, a) {
430
+ {
431
+ var u = function() {
432
+ Qe || (Qe = !0, O("%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)", a));
433
+ };
434
+ u.isReactWarning = !0, Object.defineProperty(e, "ref", {
435
+ get: u,
436
+ configurable: !0
437
+ });
438
+ }
439
+ }
440
+ var jr = function(e, a, u, g, S, y, w) {
441
+ var m = {
442
+ // This tag allows us to uniquely identify this as a React Element
443
+ $$typeof: n,
444
+ // Built-in properties that belong on the element
445
+ type: e,
446
+ key: a,
447
+ ref: u,
448
+ props: w,
449
+ // Record the component responsible for creating this element.
450
+ _owner: y
451
+ };
452
+ return m._store = {}, Object.defineProperty(m._store, "validated", {
453
+ configurable: !1,
454
+ enumerable: !1,
455
+ writable: !0,
456
+ value: !1
457
+ }), Object.defineProperty(m, "_self", {
458
+ configurable: !1,
459
+ enumerable: !1,
460
+ writable: !1,
461
+ value: g
462
+ }), Object.defineProperty(m, "_source", {
463
+ configurable: !1,
464
+ enumerable: !1,
465
+ writable: !1,
466
+ value: S
467
+ }), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
468
+ };
469
+ function Ir(e, a, u, g, S) {
470
+ {
471
+ var y, w = {}, m = null, A = null;
472
+ u !== void 0 && (Je(u), m = "" + u), Ar(a) && (Je(a.key), m = "" + a.key), Or(a) && (A = a.ref, xr(a, S));
473
+ for (y in a)
474
+ se.call(a, y) && !zr.hasOwnProperty(y) && (w[y] = a[y]);
475
+ if (e && e.defaultProps) {
476
+ var P = e.defaultProps;
477
+ for (y in P)
478
+ w[y] === void 0 && (w[y] = P[y]);
479
+ }
480
+ if (m || A) {
481
+ var E = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
482
+ m && kr(w, E), A && Dr(w, E);
483
+ }
484
+ return jr(e, m, A, S, g, Q.current, w);
485
+ }
486
+ }
487
+ var ye = U.ReactCurrentOwner, Ze = U.ReactDebugCurrentFrame;
488
+ function B(e) {
489
+ if (e) {
490
+ var a = e._owner, u = oe(e.type, e._source, a ? a.type : null);
491
+ Ze.setExtraStackFrame(u);
492
+ } else
493
+ Ze.setExtraStackFrame(null);
494
+ }
495
+ var Re;
496
+ Re = !1;
497
+ function Pe(e) {
498
+ return typeof e == "object" && e !== null && e.$$typeof === n;
499
+ }
500
+ function er() {
501
+ {
502
+ if (ye.current) {
503
+ var e = L(ye.current.type);
504
+ if (e)
505
+ return `
506
+
507
+ Check the render method of \`` + e + "`.";
508
+ }
509
+ return "";
510
+ }
511
+ }
512
+ function Fr(e) {
513
+ {
514
+ if (e !== void 0) {
515
+ var a = e.fileName.replace(/^.*[\\\/]/, ""), u = e.lineNumber;
516
+ return `
517
+
518
+ Check your code at ` + a + ":" + u + ".";
519
+ }
520
+ return "";
521
+ }
522
+ }
523
+ var rr = {};
524
+ function qr(e) {
525
+ {
526
+ var a = er();
527
+ if (!a) {
528
+ var u = typeof e == "string" ? e : e.displayName || e.name;
529
+ u && (a = `
530
+
531
+ Check the top-level render call using <` + u + ">.");
532
+ }
533
+ return a;
534
+ }
535
+ }
536
+ function tr(e, a) {
537
+ {
538
+ if (!e._store || e._store.validated || e.key != null)
539
+ return;
540
+ e._store.validated = !0;
541
+ var u = qr(a);
542
+ if (rr[u])
543
+ return;
544
+ rr[u] = !0;
545
+ var g = "";
546
+ e && e._owner && e._owner !== ye.current && (g = " It was passed a child from " + L(e._owner.type) + "."), B(e), O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', u, g), B(null);
547
+ }
548
+ }
549
+ function nr(e, a) {
550
+ {
551
+ if (typeof e != "object")
552
+ return;
553
+ if (Se(e))
554
+ for (var u = 0; u < e.length; u++) {
555
+ var g = e[u];
556
+ Pe(g) && tr(g, a);
557
+ }
558
+ else if (Pe(e))
559
+ e._store && (e._store.validated = !0);
560
+ else if (e) {
561
+ var S = me(e);
562
+ if (typeof S == "function" && S !== e.entries)
563
+ for (var y = S.call(e), w; !(w = y.next()).done; )
564
+ Pe(w.value) && tr(w.value, a);
565
+ }
566
+ }
567
+ }
568
+ function Lr(e) {
569
+ {
570
+ var a = e.type;
571
+ if (a == null || typeof a == "string")
572
+ return;
573
+ var u;
574
+ if (typeof a == "function")
575
+ u = a.propTypes;
576
+ else if (typeof a == "object" && (a.$$typeof === p || // Note: Memo only checks outer props here.
577
+ // Inner props are checked in the reconciler.
578
+ a.$$typeof === h))
579
+ u = a.propTypes;
580
+ else
581
+ return;
582
+ if (u) {
583
+ var g = L(a);
584
+ Pr(u, e.props, "prop", g, e);
585
+ } else if (a.PropTypes !== void 0 && !Re) {
586
+ Re = !0;
587
+ var S = L(a);
588
+ O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", S || "Unknown");
589
+ }
590
+ typeof a.getDefaultProps == "function" && !a.getDefaultProps.isReactClassApproved && O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
591
+ }
592
+ }
593
+ function Mr(e) {
594
+ {
595
+ for (var a = Object.keys(e.props), u = 0; u < a.length; u++) {
596
+ var g = a[u];
597
+ if (g !== "children" && g !== "key") {
598
+ B(e), O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", g), B(null);
599
+ break;
600
+ }
601
+ }
602
+ e.ref !== null && (B(e), O("Invalid attribute `ref` supplied to `React.Fragment`."), B(null));
603
+ }
604
+ }
605
+ function ar(e, a, u, g, S, y) {
606
+ {
607
+ var w = vr(e);
608
+ if (!w) {
609
+ var m = "";
610
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (m += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
611
+ var A = Fr(S);
612
+ A ? m += A : m += er();
613
+ var P;
614
+ e === null ? P = "null" : Se(e) ? P = "array" : e !== void 0 && e.$$typeof === n ? (P = "<" + (L(e.type) || "Unknown") + " />", m = " Did you accidentally export a JSX literal instead of a component?") : P = typeof e, O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", P, m);
615
+ }
616
+ var E = Ir(e, a, u, S, y);
617
+ if (E == null)
618
+ return E;
619
+ if (w) {
620
+ var F = a.children;
621
+ if (F !== void 0)
622
+ if (g)
623
+ if (Se(F)) {
624
+ for (var K = 0; K < F.length; K++)
625
+ nr(F[K], e);
626
+ Object.freeze && Object.freeze(F);
627
+ } else
628
+ O("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
629
+ else
630
+ nr(F, e);
631
+ }
632
+ return e === o ? Mr(E) : Lr(E), E;
633
+ }
634
+ }
635
+ function Nr(e, a, u) {
636
+ return ar(e, a, u, !0);
637
+ }
638
+ function Ur(e, a, u) {
639
+ return ar(e, a, u, !1);
640
+ }
641
+ var Vr = Ur, $r = Nr;
642
+ re.Fragment = o, re.jsx = Vr, re.jsxs = $r;
643
+ }()), re;
644
+ }
645
+ (function(t) {
646
+ process.env.NODE_ENV === "production" ? t.exports = st() : t.exports = ct();
647
+ })(ot);
648
+ const N = te.Fragment, r = te.jsx, v = te.jsxs;
649
+ function lt(t) {
16
650
  t = t || {};
17
- const n = Object.keys(t).sort(), r = [];
18
- for (let i = 0; i < n.length; i++) {
19
- const s = n[i];
20
- if (s != "authentication" && t[s])
21
- r.push(n[i] + "=" + (typeof t[s] == "object" ? JSON.stringify(t[s]) : t[s]));
651
+ const n = Object.keys(t).sort(), i = [];
652
+ for (let o = 0; o < n.length; o++) {
653
+ const l = n[o];
654
+ if (l != "authentication" && t[l])
655
+ i.push(n[o] + "=" + (typeof t[l] == "object" ? JSON.stringify(t[l]) : t[l]));
22
656
  else {
23
- const o = Object.keys(t[s]).sort();
24
- for (let a = 0; a < o.length; a++) {
25
- const c = o[a];
26
- c != "sign" && t[s][c] && r.push(o[a] + "=" + (typeof t[s][c] == "object" ? JSON.stringify(t[s][c]) : t[s][c]));
657
+ const s = Object.keys(t[l]).sort();
658
+ for (let c = 0; c < s.length; c++) {
659
+ const d = s[c];
660
+ d != "sign" && t[l][d] && i.push(s[c] + "=" + (typeof t[l][d] == "object" ? JSON.stringify(t[l][d]) : t[l][d]));
27
661
  }
28
662
  }
29
663
  }
30
- return r.sort().join("&");
664
+ return i.sort().join("&");
31
665
  }
32
- function Pe(t, n) {
33
- let r = ze(t);
34
- return r += "&key=" + n, he.MD5(r).toString().toUpperCase();
666
+ function ut(t, n) {
667
+ let i = lt(t);
668
+ return i += "&key=" + n, rt.MD5(i).toString().toUpperCase();
35
669
  }
36
- const f = {
670
+ const C = {
37
671
  baseURL: "http://localhost:31200",
38
672
  app_id: "",
39
673
  app_secret: "",
@@ -44,7 +678,7 @@ const f = {
44
678
  return {
45
679
  app_id: this.app_id,
46
680
  nonce_str: n,
47
- sign: Pe({
681
+ sign: ut({
48
682
  app_id: this.app_id,
49
683
  nonce_str: n,
50
684
  ...t
@@ -52,35 +686,35 @@ const f = {
52
686
  };
53
687
  },
54
688
  getRequest(t) {
55
- return (n, r, i = {}) => {
56
- const s = window.localStorage.getItem("token"), o = {
689
+ return (n, i, o = {}) => {
690
+ const l = window.localStorage.getItem("token"), s = {
57
691
  "X-Requested-With": "XMLHttpRequest",
58
- "Content-Type": i.string ? "application/x-www-form-urlencoded" : "application/json",
59
- authorization: s ? `bearer ${s}` : "",
60
- ...i.headers
61
- }, a = {
692
+ "Content-Type": o.string ? "application/x-www-form-urlencoded" : "application/json",
693
+ authorization: l ? `bearer ${l}` : "",
694
+ ...o.headers
695
+ }, c = {
62
696
  baseURL: this.baseURL,
63
697
  method: t,
64
698
  url: n,
65
- params: t === "GET" ? r : i.params,
66
- headers: o
699
+ params: t === "GET" ? i : o.params,
700
+ headers: s
67
701
  };
68
- return ["POST", "PUT"].includes(t) && (a.data = i.string ? JSON.stringify(r) : r, a.data.authentication = this.getAuthentication(a.data)), me(a).then((c) => c.data).catch((c) => fe.has(c, "response.data.detail.message") ? Promise.reject(new Error(c.response.data.detail.message)) : Promise.reject(c));
702
+ return ["POST", "PUT"].includes(t) && (c.data = o.string ? JSON.stringify(i) : i, c.data.authentication = this.getAuthentication(c.data)), et(c).then((d) => d.data).catch((d) => tt.has(d, "response.data.detail.message") ? Promise.reject(new Error(d.response.data.detail.message)) : Promise.reject(d));
69
703
  };
70
704
  }
71
705
  };
72
- function j(t) {
73
- f.baseURL !== t.apiBaseURL && (f.baseURL = t.apiBaseURL), t.app_id && (f.app_id = t.app_id), t.app_secret && (f.app_secret = t.app_secret);
706
+ function pe(t) {
707
+ C.baseURL !== t.apiBaseURL && (C.baseURL = t.apiBaseURL), t.app_id && (C.app_id = t.app_id), t.app_secret && (C.app_secret = t.app_secret);
74
708
  }
75
- const ve = {
709
+ const dt = {
76
710
  login: async (t, n) => {
77
- const r = {
711
+ const i = {
78
712
  name: t,
79
713
  password: n
80
714
  };
81
- return await f.getRequest("POST")("/account/login", r);
715
+ return await C.getRequest("POST")("/account/login", i);
82
716
  },
83
- list: async () => await f.getRequest("POST")("/account/list", {
717
+ list: async () => await C.getRequest("POST")("/account/list", {
84
718
  filter: {},
85
719
  sort: [{
86
720
  field: "name",
@@ -94,42 +728,42 @@ const ve = {
94
728
  /**
95
729
  * get current account
96
730
  */
97
- get: async () => await f.getRequest("GET")("/account/get", {}),
731
+ get: async () => await C.getRequest("GET")("/account/get", {}),
98
732
  /**
99
733
  * update current account
100
734
  */
101
735
  update: async (t, n) => {
102
- const r = {
736
+ const i = {
103
737
  name: t,
104
738
  email: n
105
739
  };
106
- return await f.getRequest("PUT")("/account/update", r);
740
+ return await C.getRequest("PUT")("/account/update", i);
107
741
  },
108
742
  /**
109
743
  * change current account's password
110
744
  */
111
745
  changepassword: async (t, n) => {
112
- const r = {
746
+ const i = {
113
747
  old_password: t,
114
748
  new_password: n
115
749
  };
116
- return await f.getRequest("POST")("/account/changepassword", r);
750
+ return await C.getRequest("POST")("/account/changepassword", i);
117
751
  },
118
- create: async (t, n, r, i) => await f.getRequest("POST")("/account/create", {
752
+ create: async (t, n, i, o) => await C.getRequest("POST")("/account/create", {
119
753
  name: t,
120
754
  email: n,
121
- password: r,
122
- role_id: i
755
+ password: i,
756
+ role_id: o
123
757
  }),
124
- edit: async (t) => (t.reset_password || (t.new_password = void 0), await f.getRequest("PUT")("/account/edit", t)),
758
+ edit: async (t) => (t.reset_password || (t.new_password = void 0), await C.getRequest("PUT")("/account/edit", t)),
125
759
  delete: async (t) => {
126
760
  if (t)
127
- return f.getRequest("POST")("/account/delete", {
761
+ return C.getRequest("POST")("/account/delete", {
128
762
  id: t
129
763
  });
130
764
  }
131
- }, Ae = {
132
- list: async () => await f.getRequest("POST")("/api/key/list", {
765
+ }, ft = {
766
+ list: async () => await C.getRequest("POST")("/api/key/list", {
133
767
  filter: {
134
768
  search: ""
135
769
  },
@@ -142,18 +776,18 @@ const ve = {
142
776
  pagesize: 100
143
777
  }
144
778
  }),
145
- create: async (t, n) => f.getRequest("POST")("/api/key/create", {
779
+ create: async (t, n) => C.getRequest("POST")("/api/key/create", {
146
780
  name: t,
147
781
  role_id: n
148
782
  }),
149
783
  delete: async (t) => {
150
784
  if (t)
151
- return f.getRequest("POST")("/api/key/delete", {
785
+ return C.getRequest("POST")("/api/key/delete", {
152
786
  id: t
153
787
  });
154
788
  }
155
- }, Ce = {
156
- list: async () => await f.getRequest("POST")("/datasource/list", {
789
+ }, pt = {
790
+ list: async () => await C.getRequest("POST")("/datasource/list", {
157
791
  filter: {},
158
792
  sort: [{
159
793
  field: "create_time",
@@ -164,42 +798,42 @@ const ve = {
164
798
  pagesize: 100
165
799
  }
166
800
  }),
167
- create: async (t, n, r) => await f.getRequest("POST")("/datasource/create", {
801
+ create: async (t, n, i) => await C.getRequest("POST")("/datasource/create", {
168
802
  type: t,
169
803
  key: n,
170
- config: r
804
+ config: i
171
805
  }),
172
806
  delete: async (t) => {
173
- await f.getRequest("POST")("/datasource/delete", {
807
+ await C.getRequest("POST")("/datasource/delete", {
174
808
  id: t
175
809
  });
176
810
  }
177
- }, _e = {
178
- list: async () => await f.getRequest("GET")("/role/list", {})
179
- }, P = {
180
- datasource: Ce,
181
- account: ve,
182
- role: _e,
183
- api_key: Ae
184
- }, D = {
811
+ }, gt = {
812
+ list: async () => await C.getRequest("GET")("/role/list", {})
813
+ }, j = {
814
+ datasource: pt,
815
+ account: dt,
816
+ role: gt,
817
+ api_key: ft
818
+ }, Y = {
185
819
  size: "sm",
186
820
  spacing: "md",
187
821
  button: {
188
822
  size: "xs"
189
823
  }
190
824
  };
191
- function ye({
825
+ function ht({
192
826
  submit: t,
193
- styles: n = D,
194
- type: r
827
+ styles: n = Y,
828
+ type: i
195
829
  }) {
196
830
  const {
197
- control: i,
198
- setValue: s,
199
- handleSubmit: o
200
- } = q({
831
+ control: o,
832
+ setValue: l,
833
+ handleSubmit: s
834
+ } = J({
201
835
  defaultValues: {
202
- type: r,
836
+ type: i,
203
837
  key: "",
204
838
  config: {
205
839
  host: "",
@@ -210,150 +844,150 @@ function ye({
210
844
  }
211
845
  }
212
846
  });
213
- return G(() => {
214
- s("type", r);
215
- }, [s, r]), /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d("form", { onSubmit: o(t), children: [
216
- /* @__PURE__ */ e(m, { name: "key", control: i, render: ({
217
- field: a
218
- }) => /* @__PURE__ */ e(z, { mb: n.spacing, size: n.size, required: !0, label: "Name", placeholder: "A unique name", ...a }) }),
219
- /* @__PURE__ */ e(V, { label: "Connection Info", labelPosition: "center" }),
220
- /* @__PURE__ */ d(w, { grow: !0, children: [
221
- /* @__PURE__ */ e(m, { name: "config.host", control: i, render: ({
222
- field: a
223
- }) => /* @__PURE__ */ e(z, { mb: n.spacing, size: n.size, required: !0, label: "Host", sx: {
847
+ return Te(() => {
848
+ l("type", i);
849
+ }, [l, i]), /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: s(t), children: [
850
+ /* @__PURE__ */ r(R, { name: "key", control: o, render: ({
851
+ field: c
852
+ }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Name", placeholder: "A unique name", ...c }) }),
853
+ /* @__PURE__ */ r(Oe, { label: "Connection Info", labelPosition: "center" }),
854
+ /* @__PURE__ */ v(z, { grow: !0, children: [
855
+ /* @__PURE__ */ r(R, { name: "config.host", control: o, render: ({
856
+ field: c
857
+ }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Host", sx: {
224
858
  flexGrow: 1
225
- }, ...a }) }),
226
- /* @__PURE__ */ e(m, { name: "config.port", control: i, render: ({
227
- field: a
228
- }) => /* @__PURE__ */ e(ie, { mb: n.spacing, size: n.size, required: !0, label: "Port", hideControls: !0, sx: {
859
+ }, ...c }) }),
860
+ /* @__PURE__ */ r(R, { name: "config.port", control: o, render: ({
861
+ field: c
862
+ }) => /* @__PURE__ */ r(Wr, { mb: n.spacing, size: n.size, required: !0, label: "Port", hideControls: !0, sx: {
229
863
  width: "8em"
230
- }, ...a }) })
864
+ }, ...c }) })
231
865
  ] }),
232
- /* @__PURE__ */ e(m, { name: "config.username", control: i, render: ({
233
- field: a
234
- }) => /* @__PURE__ */ e(z, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...a }) }),
235
- /* @__PURE__ */ e(m, { name: "config.password", control: i, render: ({
236
- field: a
237
- }) => /* @__PURE__ */ e(L, { mb: n.spacing, size: n.size, required: !0, label: "Password", ...a }) }),
238
- /* @__PURE__ */ e(m, { name: "config.database", control: i, render: ({
239
- field: a
240
- }) => /* @__PURE__ */ e(z, { mb: n.spacing, size: n.size, required: !0, label: "Database", ...a }) }),
241
- /* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Save" }) })
866
+ /* @__PURE__ */ r(R, { name: "config.username", control: o, render: ({
867
+ field: c
868
+ }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...c }) }),
869
+ /* @__PURE__ */ r(R, { name: "config.password", control: o, render: ({
870
+ field: c
871
+ }) => /* @__PURE__ */ r(de, { mb: n.spacing, size: n.size, required: !0, label: "Password", ...c }) }),
872
+ /* @__PURE__ */ r(R, { name: "config.database", control: o, render: ({
873
+ field: c
874
+ }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Database", ...c }) }),
875
+ /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: n.button.size, children: "Save" }) })
242
876
  ] }) });
243
877
  }
244
- const ke = ({
878
+ const mt = ({
245
879
  value: t,
246
880
  onChange: n
247
- }) => /* @__PURE__ */ e(v, { sx: {
881
+ }) => /* @__PURE__ */ r(I, { sx: {
248
882
  position: "relative"
249
- }, children: /* @__PURE__ */ e(we, { height: "500px", defaultLanguage: "javascript", value: t, onChange: (i) => {
250
- i && n(i);
883
+ }, children: /* @__PURE__ */ r(at, { height: "500px", defaultLanguage: "javascript", value: t, onChange: (o) => {
884
+ o && n(o);
251
885
  }, theme: "vs-dark", options: {
252
886
  minimap: {
253
887
  enabled: !1
254
888
  }
255
- } }) }), Y = J(({
889
+ } }) }), cr = ze(({
256
890
  value: t,
257
891
  onChange: n,
258
- label: r,
259
- modalTitle: i,
260
- defaultValue: s,
261
- styles: o
262
- }, a) => {
263
- const [c, {
264
- setTrue: u,
265
- setFalse: g
266
- }] = be(), [l, p] = Z(t), h = () => {
267
- g(), n(l);
268
- }, A = () => {
269
- g(), p(t);
892
+ label: i,
893
+ modalTitle: o,
894
+ defaultValue: l,
895
+ styles: s
896
+ }, c) => {
897
+ const [d, {
898
+ setTrue: p,
899
+ setFalse: b
900
+ }] = nt(), [f, h] = lr(t), _ = () => {
901
+ b(), n(f);
270
902
  }, k = () => {
271
- p(s);
903
+ b(), h(t);
904
+ }, q = () => {
905
+ h(l);
272
906
  };
273
- return G(() => {
274
- p(t);
275
- }, [t]), /* @__PURE__ */ d(C, { children: [
276
- /* @__PURE__ */ e(b, { variant: "filled", size: o.button.size, onClick: u, sx: {
907
+ return Te(() => {
908
+ h(t);
909
+ }, [t]), /* @__PURE__ */ v(N, { children: [
910
+ /* @__PURE__ */ r(T, { variant: "filled", size: s.button.size, onClick: p, sx: {
277
911
  flexGrow: 1
278
- }, children: r }),
279
- /* @__PURE__ */ e(O, { size: 800, title: i, opened: c, onClose: g, closeOnClickOutside: !1, withCloseButton: !1, children: c && /* @__PURE__ */ d(B, { children: [
280
- /* @__PURE__ */ e(ke, { value: l, onChange: p }),
281
- /* @__PURE__ */ d(w, { position: "apart", children: [
282
- /* @__PURE__ */ e(b, { onClick: k, color: "red", leftIcon: /* @__PURE__ */ e(ue, { size: 20 }), children: "Rest" }),
283
- /* @__PURE__ */ d(w, { position: "right", children: [
284
- /* @__PURE__ */ e(b, { onClick: A, variant: "subtle", children: "Cancel" }),
285
- /* @__PURE__ */ e(b, { onClick: h, children: "OK" })
912
+ }, children: i }),
913
+ /* @__PURE__ */ r(ne, { size: 800, title: o, opened: d, onClose: b, closeOnClickOutside: !1, withCloseButton: !1, children: d && /* @__PURE__ */ v(Ae, { children: [
914
+ /* @__PURE__ */ r(mt, { value: f, onChange: h }),
915
+ /* @__PURE__ */ v(z, { position: "apart", children: [
916
+ /* @__PURE__ */ r(T, { onClick: q, color: "red", leftIcon: /* @__PURE__ */ r(Xr, { size: 20 }), children: "Rest" }),
917
+ /* @__PURE__ */ v(z, { position: "right", children: [
918
+ /* @__PURE__ */ r(T, { onClick: k, variant: "subtle", children: "Cancel" }),
919
+ /* @__PURE__ */ r(T, { onClick: _, children: "OK" })
286
920
  ] })
287
921
  ] })
288
922
  ] }) })
289
923
  ] });
290
- }), R = {
924
+ }), le = {
291
925
  pre: ["function pre_process({ method, url, params, headers, data }, utils) {", " // your code goes here", " return { method, url, params, headers, data }", "}"].join(`
292
926
  `),
293
927
  post: ["function post_process(res, utils) {", " // your code goes here", " return data", "}"].join(`
294
928
  `)
295
929
  };
296
- function De({
930
+ function vt({
297
931
  submit: t,
298
- styles: n = D
932
+ styles: n = Y
299
933
  }) {
300
934
  const {
301
- control: r,
302
- setValue: i,
303
- handleSubmit: s
304
- } = q({
935
+ control: i,
936
+ setValue: o,
937
+ handleSubmit: l
938
+ } = J({
305
939
  defaultValues: {
306
940
  type: "http",
307
941
  key: "",
308
942
  config: {
309
943
  host: "",
310
944
  processing: {
311
- pre: R.pre,
312
- post: R.post
945
+ pre: le.pre,
946
+ post: le.post
313
947
  }
314
948
  }
315
949
  }
316
950
  });
317
- return /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d("form", { onSubmit: s(t), children: [
318
- /* @__PURE__ */ e(m, { name: "key", control: r, render: ({
319
- field: o
320
- }) => /* @__PURE__ */ e(z, { mb: n.spacing, size: n.size, required: !0, label: "Name", placeholder: "A unique name", ...o }) }),
321
- /* @__PURE__ */ e(V, { label: "Connection Info", labelPosition: "center" }),
322
- /* @__PURE__ */ e(m, { name: "config.host", control: r, render: ({
323
- field: o
324
- }) => /* @__PURE__ */ e(z, { mb: n.spacing, size: n.size, required: !0, label: "Base URL", sx: {
951
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: l(t), children: [
952
+ /* @__PURE__ */ r(R, { name: "key", control: i, render: ({
953
+ field: s
954
+ }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Name", placeholder: "A unique name", ...s }) }),
955
+ /* @__PURE__ */ r(Oe, { label: "Connection Info", labelPosition: "center" }),
956
+ /* @__PURE__ */ r(R, { name: "config.host", control: i, render: ({
957
+ field: s
958
+ }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Base URL", sx: {
325
959
  flexGrow: 1
326
- }, ...o }) }),
327
- /* @__PURE__ */ d(w, { grow: !0, children: [
328
- /* @__PURE__ */ e(m, { name: "config.processing.pre", control: r, render: ({
329
- field: o
330
- }) => /* @__PURE__ */ e(Y, { label: "Pre Processing", modalTitle: "This function will run before sending the request (for scenarios like encryption)", defaultValue: R.pre, ...o, styles: n }) }),
331
- /* @__PURE__ */ e(m, { name: "config.processing.post", control: r, render: ({
332
- field: o
333
- }) => /* @__PURE__ */ e(Y, { label: "Post Processing", modalTitle: "This function will run after sending the request (for scenarios like decryption)", defaultValue: R.post, ...o, styles: n }) })
960
+ }, ...s }) }),
961
+ /* @__PURE__ */ v(z, { grow: !0, children: [
962
+ /* @__PURE__ */ r(R, { name: "config.processing.pre", control: i, render: ({
963
+ field: s
964
+ }) => /* @__PURE__ */ r(cr, { label: "Pre Processing", modalTitle: "This function will run before sending the request (for scenarios like encryption)", defaultValue: le.pre, ...s, styles: n }) }),
965
+ /* @__PURE__ */ r(R, { name: "config.processing.post", control: i, render: ({
966
+ field: s
967
+ }) => /* @__PURE__ */ r(cr, { label: "Post Processing", modalTitle: "This function will run after sending the request (for scenarios like decryption)", defaultValue: le.post, ...s, styles: n }) })
334
968
  ] }),
335
- /* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Save" }) })
969
+ /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: n.button.size, children: "Save" }) })
336
970
  ] }) });
337
971
  }
338
- function Te({
339
- styles: t = D
972
+ function bt({
973
+ styles: t = Y
340
974
  }) {
341
- return /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d(oe, { mt: t.spacing, icon: /* @__PURE__ */ e(pe, { size: 16 }), children: [
975
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v(Yr, { mt: t.spacing, icon: /* @__PURE__ */ r(Qr, { size: 16 }), children: [
342
976
  "Only ",
343
- /* @__PURE__ */ e("b", { children: "SELECT" }),
977
+ /* @__PURE__ */ r("b", { children: "SELECT" }),
344
978
  " privilege is needed."
345
979
  ] }) });
346
980
  }
347
- function qe({
981
+ function wt({
348
982
  postSubmit: t,
349
- styles: n = D
983
+ styles: n = Y
350
984
  }) {
351
- const [r, i] = Z("postgresql"), s = async ({
352
- type: c,
353
- key: u,
354
- config: g
985
+ const [i, o] = lr("postgresql"), l = async ({
986
+ type: d,
987
+ key: p,
988
+ config: b
355
989
  }) => {
356
- _({
990
+ V({
357
991
  id: "for-creating",
358
992
  title: "Pending",
359
993
  message: "Adding data source...",
@@ -361,26 +995,26 @@ function qe({
361
995
  });
362
996
  try {
363
997
  console.log({
364
- type: c,
365
- key: u,
366
- config: g
367
- }), await P.datasource.create(c, u, g), S({
998
+ type: d,
999
+ key: p,
1000
+ config: b
1001
+ }), await j.datasource.create(d, p, b), x({
368
1002
  id: "for-creating",
369
1003
  title: "Successful",
370
1004
  message: "Data source is added",
371
1005
  color: "green"
372
1006
  }), t();
373
- } catch (l) {
374
- S({
1007
+ } catch (f) {
1008
+ x({
375
1009
  id: "for-creating",
376
1010
  title: "Failed",
377
- message: l.message,
1011
+ message: f.message,
378
1012
  color: "red"
379
1013
  });
380
1014
  }
381
- }, o = r === "postgresql" || r === "mysql", a = r === "http";
382
- return /* @__PURE__ */ d(v, { mx: "auto", children: [
383
- /* @__PURE__ */ e(ae, { fullWidth: !0, mb: n.spacing, size: n.size, data: [{
1015
+ }, s = i === "postgresql" || i === "mysql", c = i === "http";
1016
+ return /* @__PURE__ */ v(I, { mx: "auto", children: [
1017
+ /* @__PURE__ */ r(Br, { fullWidth: !0, mb: n.spacing, size: n.size, data: [{
384
1018
  label: "PostgreSQL",
385
1019
  value: "postgresql"
386
1020
  }, {
@@ -389,187 +1023,187 @@ function qe({
389
1023
  }, {
390
1024
  label: "HTTP",
391
1025
  value: "http"
392
- }], value: r, onChange: (c) => i(c) }),
393
- o && /* @__PURE__ */ e(Te, { styles: n }),
394
- o && /* @__PURE__ */ e(ye, { submit: s, styles: n, type: r }),
395
- a && /* @__PURE__ */ e(De, { submit: s, styles: n })
1026
+ }], value: i, onChange: (d) => o(d) }),
1027
+ s && /* @__PURE__ */ r(bt, { styles: n }),
1028
+ s && /* @__PURE__ */ r(ht, { submit: l, styles: n, type: i }),
1029
+ c && /* @__PURE__ */ r(vt, { submit: l, styles: n })
396
1030
  ] });
397
1031
  }
398
- function xe({
1032
+ function St({
399
1033
  onSuccess: t,
400
- styles: n = D
1034
+ styles: n = Y
401
1035
  }) {
402
- const [r, i] = F.useState(!1), s = () => i(!0), o = () => i(!1);
403
- return /* @__PURE__ */ d(C, { children: [
404
- /* @__PURE__ */ e(O, { overflow: "inside", opened: r, onClose: () => i(!1), title: "Add a data source", trapFocus: !0, onDragStart: (c) => {
405
- c.stopPropagation();
406
- }, children: /* @__PURE__ */ e(qe, { postSubmit: () => {
407
- t(), o();
1036
+ const [i, o] = H.useState(!1), l = () => o(!0), s = () => o(!1);
1037
+ return /* @__PURE__ */ v(N, { children: [
1038
+ /* @__PURE__ */ r(ne, { overflow: "inside", opened: i, onClose: () => o(!1), title: "Add a data source", trapFocus: !0, onDragStart: (d) => {
1039
+ d.stopPropagation();
1040
+ }, children: /* @__PURE__ */ r(wt, { postSubmit: () => {
1041
+ t(), s();
408
1042
  }, styles: n }) }),
409
- /* @__PURE__ */ e(b, { size: n.button.size, onClick: s, leftIcon: /* @__PURE__ */ e(Q, { size: 20 }), children: "Add a Data Source" })
1043
+ /* @__PURE__ */ r(T, { size: n.button.size, onClick: l, leftIcon: /* @__PURE__ */ r(De, { size: 20 }), children: "Add a Data Source" })
410
1044
  ] });
411
1045
  }
412
- const Oe = (t) => t.replace(/([^:])(\/\/+)/g, "$1/");
413
- function Re(t) {
414
- G(() => {
415
- if (U.__getMonacoInstance())
1046
+ const _t = (t) => t.replace(/([^:])(\/\/+)/g, "$1/");
1047
+ function yt(t) {
1048
+ Te(() => {
1049
+ if (Ee.__getMonacoInstance())
416
1050
  return;
417
1051
  console.log("loading monaco for @devtable/settings-form");
418
- const r = Oe(t);
419
- U.config({
1052
+ const i = _t(t);
1053
+ Ee.config({
420
1054
  paths: {
421
- vs: r
1055
+ vs: i
422
1056
  }
423
- }), U.init().then((i) => console.log("monaco instance:", i));
1057
+ }), Ee.init().then((o) => console.log("monaco instance:", o));
424
1058
  }, []);
425
1059
  }
426
- function N() {
427
- return N = Object.assign ? Object.assign.bind() : function(t) {
1060
+ function Ce() {
1061
+ return Ce = Object.assign ? Object.assign.bind() : function(t) {
428
1062
  for (var n = 1; n < arguments.length; n++) {
429
- var r = arguments[n];
430
- for (var i in r)
431
- Object.prototype.hasOwnProperty.call(r, i) && (t[i] = r[i]);
1063
+ var i = arguments[n];
1064
+ for (var o in i)
1065
+ Object.prototype.hasOwnProperty.call(i, o) && (t[o] = i[o]);
432
1066
  }
433
1067
  return t;
434
- }, N.apply(this, arguments);
1068
+ }, Ce.apply(this, arguments);
435
1069
  }
436
- function Ie(t, n) {
1070
+ function Rt(t, n) {
437
1071
  if (t == null)
438
1072
  return {};
439
- var r, i, s = function(a, c) {
440
- if (a == null)
1073
+ var i, o, l = function(c, d) {
1074
+ if (c == null)
441
1075
  return {};
442
- var u, g, l = {}, p = Object.keys(a);
443
- for (g = 0; g < p.length; g++)
444
- u = p[g], c.indexOf(u) >= 0 || (l[u] = a[u]);
445
- return l;
1076
+ var p, b, f = {}, h = Object.keys(c);
1077
+ for (b = 0; b < h.length; b++)
1078
+ p = h[b], d.indexOf(p) >= 0 || (f[p] = c[p]);
1079
+ return f;
446
1080
  }(t, n);
447
1081
  if (Object.getOwnPropertySymbols) {
448
- var o = Object.getOwnPropertySymbols(t);
449
- for (i = 0; i < o.length; i++)
450
- r = o[i], n.indexOf(r) >= 0 || Object.prototype.propertyIsEnumerable.call(t, r) && (s[r] = t[r]);
1082
+ var s = Object.getOwnPropertySymbols(t);
1083
+ for (o = 0; o < s.length; o++)
1084
+ i = s[o], n.indexOf(i) >= 0 || Object.prototype.propertyIsEnumerable.call(t, i) && (l[i] = t[i]);
451
1085
  }
452
- return s;
1086
+ return l;
453
1087
  }
454
- var Le = ["size", "color", "stroke"];
455
- function Fe(t) {
456
- var n = t.size, r = n === void 0 ? 24 : n, i = t.color, s = i === void 0 ? "currentColor" : i, o = t.stroke, a = o === void 0 ? 2 : o, c = Ie(t, Le);
457
- return x.createElement("svg", N({ xmlns: "http://www.w3.org/2000/svg", className: "icon icon-tabler icon-tabler-lock", width: r, height: r, viewBox: "0 0 24 24", strokeWidth: a, stroke: s, fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, c), x.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), x.createElement("rect", { x: 5, y: 11, width: 14, height: 10, rx: 2 }), x.createElement("circle", { cx: 12, cy: 16, r: 1 }), x.createElement("path", { d: "M8 11v-4a4 4 0 0 1 8 0v4" }));
1088
+ var Pt = ["size", "color", "stroke"];
1089
+ function Et(t) {
1090
+ var n = t.size, i = n === void 0 ? 24 : n, o = t.color, l = o === void 0 ? "currentColor" : o, s = t.stroke, c = s === void 0 ? 2 : s, d = Rt(t, Pt);
1091
+ return Z.createElement("svg", Ce({ xmlns: "http://www.w3.org/2000/svg", className: "icon icon-tabler icon-tabler-lock", width: i, height: i, viewBox: "0 0 24 24", strokeWidth: c, stroke: l, fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, d), Z.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), Z.createElement("rect", { x: 5, y: 11, width: 14, height: 10, rx: 2 }), Z.createElement("circle", { cx: 12, cy: 16, r: 1 }), Z.createElement("path", { d: "M8 11v-4a4 4 0 0 1 8 0v4" }));
458
1092
  }
459
- function Ee({
1093
+ function Ct({
460
1094
  id: t,
461
1095
  name: n,
462
- isProtected: r,
463
- onSuccess: i,
464
- styles: s = D
1096
+ isProtected: i,
1097
+ onSuccess: o,
1098
+ styles: l = Y
465
1099
  }) {
466
- const o = E(), a = async () => {
467
- t && (_({
1100
+ const s = fe(), c = async () => {
1101
+ t && (V({
468
1102
  id: "for-deleting",
469
1103
  title: "Pending",
470
1104
  message: "Deleting data source...",
471
1105
  loading: !0
472
- }), await P.datasource.delete(t), S({
1106
+ }), await j.datasource.delete(t), x({
473
1107
  id: "for-deleting",
474
1108
  title: "Successful",
475
1109
  message: `Data source [${n}] is deleted`,
476
1110
  color: "green"
477
- }), i());
478
- }, c = () => o.openConfirmModal({
1111
+ }), o());
1112
+ }, d = () => s.openConfirmModal({
479
1113
  title: "Delete this data source?",
480
- children: /* @__PURE__ */ e(I, { size: s.size, children: "This action won't affect your database." }),
1114
+ children: /* @__PURE__ */ r(ue, { size: l.size, children: "This action won't affect your database." }),
481
1115
  labels: {
482
1116
  confirm: "Confirm",
483
1117
  cancel: "Cancel"
484
1118
  },
485
1119
  onCancel: () => console.log("Cancel"),
486
- onConfirm: a
487
- }), u = se();
488
- return r ? /* @__PURE__ */ e(ce, { withArrow: !0, events: {
1120
+ onConfirm: c
1121
+ }), p = Kr();
1122
+ return i ? /* @__PURE__ */ r(Gr, { withArrow: !0, events: {
489
1123
  hover: !0,
490
1124
  touch: !1,
491
1125
  focus: !1
492
- }, label: "This is a preset datasource, it can not be deleted", children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(Fe, { size: 16, color: u.colors.gray[7] }) }) }) : /* @__PURE__ */ e(b, { size: s.button.size, color: "red", onClick: c, leftIcon: /* @__PURE__ */ e(W, { size: 20 }), children: "Delete" });
1126
+ }, label: "This is a preset datasource, it can not be deleted", children: /* @__PURE__ */ r("span", { children: /* @__PURE__ */ r(Et, { size: 16, color: p.colors.gray[7] }) }) }) : /* @__PURE__ */ r(T, { size: l.button.size, color: "red", onClick: d, leftIcon: /* @__PURE__ */ r(je, { size: 20 }), children: "Delete" });
493
1127
  }
494
- function ot({
495
- styles: t = D,
1128
+ function Gt({
1129
+ styles: t = Y,
496
1130
  config: n
497
1131
  }) {
498
- Re(n.monacoPath), j(n);
1132
+ yt(n.monacoPath), pe(n);
499
1133
  const {
500
- data: r = [],
501
- loading: i,
502
- refresh: s
503
- } = T(async () => {
1134
+ data: i = [],
1135
+ loading: o,
1136
+ refresh: l
1137
+ } = G(async () => {
504
1138
  const {
505
- data: o
506
- } = await P.datasource.list();
507
- return o;
1139
+ data: s
1140
+ } = await j.datasource.list();
1141
+ return s;
508
1142
  }, {
509
1143
  refreshDeps: []
510
1144
  });
511
- return /* @__PURE__ */ d(C, { children: [
512
- /* @__PURE__ */ e(w, { pt: t.spacing, position: "right", children: /* @__PURE__ */ e(xe, { onSuccess: s }) }),
513
- /* @__PURE__ */ d(v, { mt: t.spacing, sx: {
1145
+ return /* @__PURE__ */ v(N, { children: [
1146
+ /* @__PURE__ */ r(z, { pt: t.spacing, position: "right", children: /* @__PURE__ */ r(St, { onSuccess: l }) }),
1147
+ /* @__PURE__ */ v(I, { mt: t.spacing, sx: {
514
1148
  position: "relative"
515
1149
  }, children: [
516
- /* @__PURE__ */ e(H, { visible: i }),
517
- /* @__PURE__ */ d($, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
518
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ d("tr", { children: [
519
- /* @__PURE__ */ e("th", { children: "Type" }),
520
- /* @__PURE__ */ e("th", { children: "Name" }),
521
- /* @__PURE__ */ e("th", { children: "Action" })
1150
+ /* @__PURE__ */ r(xe, { visible: o }),
1151
+ /* @__PURE__ */ v(ke, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
1152
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ v("tr", { children: [
1153
+ /* @__PURE__ */ r("th", { children: "Type" }),
1154
+ /* @__PURE__ */ r("th", { children: "Name" }),
1155
+ /* @__PURE__ */ r("th", { children: "Action" })
522
1156
  ] }) }),
523
- /* @__PURE__ */ e("tbody", { children: r.map(({
524
- id: o,
525
- key: a,
526
- type: c,
527
- is_preset: u
528
- }) => /* @__PURE__ */ d("tr", { children: [
529
- /* @__PURE__ */ e("td", { width: 200, children: c }),
530
- /* @__PURE__ */ e("td", { children: a }),
531
- /* @__PURE__ */ e("td", { width: 200, children: /* @__PURE__ */ e(w, { position: "left", children: /* @__PURE__ */ e(Ee, { isProtected: u, id: o, name: a, onSuccess: s }) }) })
532
- ] }, a)) })
1157
+ /* @__PURE__ */ r("tbody", { children: i.map(({
1158
+ id: s,
1159
+ key: c,
1160
+ type: d,
1161
+ is_preset: p
1162
+ }) => /* @__PURE__ */ v("tr", { children: [
1163
+ /* @__PURE__ */ r("td", { width: 200, children: d }),
1164
+ /* @__PURE__ */ r("td", { children: c }),
1165
+ /* @__PURE__ */ r("td", { width: 200, children: /* @__PURE__ */ r(z, { position: "left", children: /* @__PURE__ */ r(Ct, { isProtected: p, id: s, name: c, onSuccess: l }) }) })
1166
+ ] }, c)) })
533
1167
  ] })
534
1168
  ] })
535
1169
  ] });
536
1170
  }
537
- const je = J(({
1171
+ const Tt = ze(({
538
1172
  label: t,
539
1173
  value: n,
540
- description: r,
541
- ...i
542
- }, s) => /* @__PURE__ */ d(B, { spacing: 2, ref: s, ...i, children: [
543
- /* @__PURE__ */ e(I, { size: "sm", children: t }),
544
- /* @__PURE__ */ e(I, { size: "xs", color: "dimmed", className: "role-description", children: r })
545
- ] })), X = J(({
1174
+ description: i,
1175
+ ...o
1176
+ }, l) => /* @__PURE__ */ v(Ae, { spacing: 2, ref: l, ...o, children: [
1177
+ /* @__PURE__ */ r(ue, { size: "sm", children: t }),
1178
+ /* @__PURE__ */ r(ue, { size: "xs", color: "dimmed", className: "role-description", children: i })
1179
+ ] })), Ie = ze(({
546
1180
  styles: t,
547
1181
  value: n,
548
- onChange: r
549
- }, i) => {
1182
+ onChange: i
1183
+ }, o) => {
550
1184
  const {
551
- data: s = [],
552
- loading: o
553
- } = T(async () => (await P.role.list()).map((c) => ({
554
- label: c.name,
555
- value: c.id,
556
- description: c.description,
557
- disabled: c.id === 50
1185
+ data: l = [],
1186
+ loading: s
1187
+ } = G(async () => (await j.role.list()).map((d) => ({
1188
+ label: d.name,
1189
+ value: d.id,
1190
+ description: d.description,
1191
+ disabled: d.id === 50
558
1192
  // SUPERADMIN
559
1193
  })), {
560
1194
  refreshDeps: []
561
1195
  });
562
- return /* @__PURE__ */ e(
563
- le,
1196
+ return /* @__PURE__ */ r(
1197
+ Hr,
564
1198
  {
565
- ref: i,
1199
+ ref: o,
566
1200
  mb: t.spacing,
567
1201
  size: t.size,
568
1202
  required: !0,
569
1203
  label: "Role",
570
- itemComponent: je,
571
- data: s,
572
- disabled: o,
1204
+ itemComponent: Tt,
1205
+ data: l,
1206
+ disabled: s,
573
1207
  styles: () => ({
574
1208
  item: {
575
1209
  "&[data-selected]": {
@@ -582,562 +1216,562 @@ const je = J(({
582
1216
  }
583
1217
  }),
584
1218
  value: n,
585
- onChange: r
1219
+ onChange: i
586
1220
  }
587
1221
  );
588
- }), y = {
1222
+ }), $ = {
589
1223
  size: "sm",
590
1224
  spacing: "md",
591
1225
  button: {
592
1226
  size: "xs"
593
1227
  }
594
1228
  };
595
- function Me({
1229
+ function zt({
596
1230
  postSubmit: t,
597
- styles: n = y,
598
- initialRoleID: r
1231
+ styles: n = $,
1232
+ initialRoleID: i
599
1233
  }) {
600
1234
  const {
601
- control: i,
602
- handleSubmit: s
603
- } = q({
1235
+ control: o,
1236
+ handleSubmit: l
1237
+ } = J({
604
1238
  defaultValues: {
605
1239
  name: "",
606
1240
  email: "",
607
- role_id: r,
1241
+ role_id: i,
608
1242
  password: ""
609
1243
  }
610
1244
  });
611
- return /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d("form", { onSubmit: s(async ({
612
- name: a,
613
- email: c,
614
- password: u,
615
- role_id: g
1245
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: l(async ({
1246
+ name: c,
1247
+ email: d,
1248
+ password: p,
1249
+ role_id: b
616
1250
  }) => {
617
1251
  try {
618
- _({
1252
+ V({
619
1253
  id: "for-creating",
620
1254
  title: "Pending",
621
1255
  message: "Adding account...",
622
1256
  loading: !0
623
- }), await P.account.create(a, c, u, g), S({
1257
+ }), await j.account.create(c, d, p, b), x({
624
1258
  id: "for-creating",
625
1259
  title: "Successful",
626
1260
  message: "Account is added",
627
1261
  color: "green"
628
1262
  }), t();
629
- } catch (l) {
630
- S({
1263
+ } catch (f) {
1264
+ x({
631
1265
  id: "for-creating",
632
1266
  title: "Failed",
633
- message: l.message,
1267
+ message: f.message,
634
1268
  color: "red"
635
1269
  });
636
1270
  }
637
1271
  }), children: [
638
- /* @__PURE__ */ e(m, { name: "name", control: i, render: ({
639
- field: a
640
- }) => /* @__PURE__ */ e(z, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...a }) }),
641
- /* @__PURE__ */ e(m, { name: "email", control: i, render: ({
642
- field: a
643
- }) => /* @__PURE__ */ e(z, { mb: n.spacing, size: n.size, required: !0, label: "Email", ...a }) }),
644
- /* @__PURE__ */ e(m, { name: "password", control: i, render: ({
645
- field: a
646
- }) => /* @__PURE__ */ e(L, { mb: n.spacing, size: n.size, required: !0, label: "Password", description: "Password must be at least 8 characters long", ...a }) }),
647
- /* @__PURE__ */ e(m, { name: "role_id", control: i, render: ({
648
- field: a
649
- }) => /* @__PURE__ */ e(X, { styles: n, ...a }) }),
650
- /* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Save" }) })
1272
+ /* @__PURE__ */ r(R, { name: "name", control: o, render: ({
1273
+ field: c
1274
+ }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...c }) }),
1275
+ /* @__PURE__ */ r(R, { name: "email", control: o, render: ({
1276
+ field: c
1277
+ }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Email", ...c }) }),
1278
+ /* @__PURE__ */ r(R, { name: "password", control: o, render: ({
1279
+ field: c
1280
+ }) => /* @__PURE__ */ r(de, { mb: n.spacing, size: n.size, required: !0, label: "Password", description: "Password must be at least 8 characters long", ...c }) }),
1281
+ /* @__PURE__ */ r(R, { name: "role_id", control: o, render: ({
1282
+ field: c
1283
+ }) => /* @__PURE__ */ r(Ie, { styles: n, ...c }) }),
1284
+ /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: n.button.size, children: "Save" }) })
651
1285
  ] }) });
652
1286
  }
653
- function Ue({
1287
+ function Ot({
654
1288
  onSuccess: t,
655
- styles: n = y,
656
- initialRoleID: r
1289
+ styles: n = $,
1290
+ initialRoleID: i
657
1291
  }) {
658
- const [i, s] = F.useState(!1), o = () => s(!0), a = () => s(!1);
659
- return /* @__PURE__ */ d(C, { children: [
660
- /* @__PURE__ */ e(O, { overflow: "inside", opened: i, onClose: () => s(!1), title: "Add an Account", trapFocus: !0, onDragStart: (u) => {
661
- u.stopPropagation();
662
- }, children: /* @__PURE__ */ e(Me, { postSubmit: () => {
663
- t(), a();
664
- }, styles: n, initialRoleID: r }) }),
665
- /* @__PURE__ */ e(b, { size: n.button.size, onClick: o, leftIcon: /* @__PURE__ */ e(Q, { size: 20 }), children: "Add an Account" })
1292
+ const [o, l] = H.useState(!1), s = () => l(!0), c = () => l(!1);
1293
+ return /* @__PURE__ */ v(N, { children: [
1294
+ /* @__PURE__ */ r(ne, { overflow: "inside", opened: o, onClose: () => l(!1), title: "Add an Account", trapFocus: !0, onDragStart: (p) => {
1295
+ p.stopPropagation();
1296
+ }, children: /* @__PURE__ */ r(zt, { postSubmit: () => {
1297
+ t(), c();
1298
+ }, styles: n, initialRoleID: i }) }),
1299
+ /* @__PURE__ */ r(T, { size: n.button.size, onClick: s, leftIcon: /* @__PURE__ */ r(De, { size: 20 }), children: "Add an Account" })
666
1300
  ] });
667
1301
  }
668
- function Ne({
1302
+ function At({
669
1303
  id: t,
670
1304
  name: n,
671
- onSuccess: r,
672
- styles: i = y
1305
+ onSuccess: i,
1306
+ styles: o = $
673
1307
  }) {
674
- const s = E(), o = async () => {
1308
+ const l = fe(), s = async () => {
675
1309
  if (t) {
676
- _({
1310
+ V({
677
1311
  id: "for-deleting",
678
1312
  title: "Pending",
679
1313
  message: "Deleting account...",
680
1314
  loading: !0
681
1315
  });
682
1316
  try {
683
- await P.account.delete(t), S({
1317
+ await j.account.delete(t), x({
684
1318
  id: "for-deleting",
685
1319
  title: "Successful",
686
1320
  message: `Account [${n}] is deleted`,
687
1321
  color: "green"
688
- }), r();
689
- } catch (c) {
690
- S({
1322
+ }), i();
1323
+ } catch (d) {
1324
+ x({
691
1325
  id: "for-deleting",
692
1326
  title: "Failed",
693
- message: c.message,
1327
+ message: d.message,
694
1328
  color: "red"
695
1329
  });
696
1330
  }
697
1331
  }
698
- }, a = () => s.openConfirmModal({
1332
+ }, c = () => l.openConfirmModal({
699
1333
  title: "Delete this account?",
700
1334
  labels: {
701
1335
  confirm: "Confirm",
702
1336
  cancel: "Cancel"
703
1337
  },
704
1338
  onCancel: () => console.log("Cancel"),
705
- onConfirm: o
1339
+ onConfirm: s
706
1340
  });
707
- return /* @__PURE__ */ e(b, { size: i.button.size, color: "red", onClick: a, leftIcon: /* @__PURE__ */ e(W, { size: 20 }), children: "Delete" });
1341
+ return /* @__PURE__ */ r(T, { size: o.button.size, color: "red", onClick: c, leftIcon: /* @__PURE__ */ r(je, { size: 20 }), children: "Delete" });
708
1342
  }
709
- function Ke({
1343
+ function xt({
710
1344
  id: t,
711
1345
  name: n,
712
- email: r,
713
- role_id: i,
714
- postSubmit: s,
715
- styles: o = y
1346
+ email: i,
1347
+ role_id: o,
1348
+ postSubmit: l,
1349
+ styles: s = $
716
1350
  }) {
717
1351
  const {
718
- control: a,
719
- handleSubmit: c,
720
- watch: u
721
- } = q({
1352
+ control: c,
1353
+ handleSubmit: d,
1354
+ watch: p
1355
+ } = J({
722
1356
  defaultValues: {
723
1357
  name: n,
724
- email: r,
725
- role_id: i,
1358
+ email: i,
1359
+ role_id: o,
726
1360
  reset_password: !1,
727
1361
  new_password: ""
728
1362
  }
729
- }), g = async ({
730
- name: h,
731
- email: A,
732
- role_id: k,
733
- reset_password: te,
734
- new_password: ne
1363
+ }), b = async ({
1364
+ name: _,
1365
+ email: k,
1366
+ role_id: q,
1367
+ reset_password: he,
1368
+ new_password: me
735
1369
  }) => {
736
1370
  try {
737
- _({
1371
+ V({
738
1372
  id: "for-updating",
739
1373
  title: "Pending",
740
1374
  message: "Updating account...",
741
1375
  loading: !0
742
- }), await P.account.edit({
1376
+ }), await j.account.edit({
743
1377
  id: t,
744
- name: h,
745
- email: A,
746
- role_id: k,
747
- reset_password: te,
748
- new_password: ne
749
- }), S({
1378
+ name: _,
1379
+ email: k,
1380
+ role_id: q,
1381
+ reset_password: he,
1382
+ new_password: me
1383
+ }), x({
750
1384
  id: "for-updating",
751
1385
  title: "Successful",
752
1386
  message: "Account is updated",
753
1387
  color: "green"
754
- }), s();
755
- } catch (re) {
756
- S({
1388
+ }), l();
1389
+ } catch (U) {
1390
+ x({
757
1391
  id: "for-updating",
758
1392
  title: "Failed",
759
- message: re.message,
1393
+ message: U.message,
760
1394
  color: "red"
761
1395
  });
762
1396
  }
763
- }, [l, p] = u(["reset_password", "new_password"]);
764
- return /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d("form", { onSubmit: c(g), children: [
765
- /* @__PURE__ */ e(m, { name: "name", control: a, render: ({
766
- field: h
767
- }) => /* @__PURE__ */ e(z, { mb: o.spacing, size: o.size, required: !0, label: "Username", ...h }) }),
768
- /* @__PURE__ */ e(m, { name: "email", control: a, render: ({
769
- field: h
770
- }) => /* @__PURE__ */ e(z, { mb: o.spacing, size: o.size, required: !0, label: "Email", ...h }) }),
771
- /* @__PURE__ */ e(m, { name: "role_id", control: a, render: ({
772
- field: h
773
- }) => /* @__PURE__ */ e(X, { styles: o, ...h }) }),
774
- /* @__PURE__ */ e(V, { my: 20, variant: "dashed", label: "", labelPosition: "center" }),
775
- /* @__PURE__ */ e(m, { name: "reset_password", control: a, render: ({
776
- field: h
777
- }) => /* @__PURE__ */ e(de, { mb: o.spacing, size: o.size, label: "Reset password", checked: h.value, onChange: (A) => h.onChange(A.currentTarget.checked), styles: {
1397
+ }, [f, h] = p(["reset_password", "new_password"]);
1398
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: d(b), children: [
1399
+ /* @__PURE__ */ r(R, { name: "name", control: c, render: ({
1400
+ field: _
1401
+ }) => /* @__PURE__ */ r(D, { mb: s.spacing, size: s.size, required: !0, label: "Username", ..._ }) }),
1402
+ /* @__PURE__ */ r(R, { name: "email", control: c, render: ({
1403
+ field: _
1404
+ }) => /* @__PURE__ */ r(D, { mb: s.spacing, size: s.size, required: !0, label: "Email", ..._ }) }),
1405
+ /* @__PURE__ */ r(R, { name: "role_id", control: c, render: ({
1406
+ field: _
1407
+ }) => /* @__PURE__ */ r(Ie, { styles: s, ..._ }) }),
1408
+ /* @__PURE__ */ r(Oe, { my: 20, variant: "dashed", label: "", labelPosition: "center" }),
1409
+ /* @__PURE__ */ r(R, { name: "reset_password", control: c, render: ({
1410
+ field: _
1411
+ }) => /* @__PURE__ */ r(Jr, { mb: s.spacing, size: s.size, label: "Reset password", checked: _.value, onChange: (k) => _.onChange(k.currentTarget.checked), styles: {
778
1412
  label: {
779
1413
  verticalAlign: "middle"
780
1414
  }
781
1415
  } }) }),
782
- l && /* @__PURE__ */ e(
783
- m,
1416
+ f && /* @__PURE__ */ r(
1417
+ R,
784
1418
  {
785
1419
  name: "new_password",
786
- control: a,
1420
+ control: c,
787
1421
  render: ({
788
- field: h
789
- }) => /* @__PURE__ */ e(L, { autoComplete: "off", mb: o.spacing, size: o.size, required: !0, description: "Password must be at least 8 characters long", label: "New Password", ...h })
1422
+ field: _
1423
+ }) => /* @__PURE__ */ r(de, { autoComplete: "off", mb: s.spacing, size: s.size, required: !0, description: "Password must be at least 8 characters long", label: "New Password", ..._ })
790
1424
  }
791
1425
  ),
792
- /* @__PURE__ */ e(w, { position: "right", mt: o.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: o.button.size, children: "Submit" }) })
1426
+ /* @__PURE__ */ r(z, { position: "right", mt: s.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: s.button.size, children: "Submit" }) })
793
1427
  ] }) });
794
1428
  }
795
- function Ve({
1429
+ function kt({
796
1430
  account: t,
797
1431
  onSuccess: n,
798
- styles: r = y
1432
+ styles: i = $
799
1433
  }) {
800
- const [i, s] = F.useState(!1), o = () => s(!0), a = () => s(!1), c = () => {
801
- n(), a();
1434
+ const [o, l] = H.useState(!1), s = () => l(!0), c = () => l(!1), d = () => {
1435
+ n(), c();
802
1436
  };
803
- return /* @__PURE__ */ d(C, { children: [
804
- /* @__PURE__ */ e(O, { overflow: "inside", opened: i, onClose: () => s(!1), title: `Editing ${t.name}`, trapFocus: !0, onDragStart: (u) => {
805
- u.stopPropagation();
806
- }, children: /* @__PURE__ */ e(Ke, { ...t, postSubmit: c, styles: r }) }),
807
- /* @__PURE__ */ e(b, { size: r.button.size, onClick: o, leftIcon: /* @__PURE__ */ e(ge, { size: 20 }), children: "Edit" })
1437
+ return /* @__PURE__ */ v(N, { children: [
1438
+ /* @__PURE__ */ r(ne, { overflow: "inside", opened: o, onClose: () => l(!1), title: `Editing ${t.name}`, trapFocus: !0, onDragStart: (p) => {
1439
+ p.stopPropagation();
1440
+ }, children: /* @__PURE__ */ r(xt, { ...t, postSubmit: d, styles: i }) }),
1441
+ /* @__PURE__ */ r(T, { size: i.button.size, onClick: s, leftIcon: /* @__PURE__ */ r(Zr, { size: 20 }), children: "Edit" })
808
1442
  ] });
809
1443
  }
810
- function at({
811
- styles: t = y,
1444
+ function Ht({
1445
+ styles: t = $,
812
1446
  config: n
813
1447
  }) {
814
- var g;
815
- j(n);
1448
+ var b;
1449
+ pe(n);
816
1450
  const {
817
- data: r = [],
818
- loading: i,
819
- refresh: s
820
- } = T(async () => {
1451
+ data: i = [],
1452
+ loading: o,
1453
+ refresh: l
1454
+ } = G(async () => {
821
1455
  const {
822
- data: l
823
- } = await P.account.list();
824
- return l;
1456
+ data: f
1457
+ } = await j.account.list();
1458
+ return f;
825
1459
  }, {
826
1460
  refreshDeps: []
827
1461
  }), {
828
- data: o = [],
829
- loading: a
830
- } = T(async () => (await P.role.list()).map((p) => ({
831
- label: p.name,
832
- value: p.id,
833
- description: p.description,
834
- disabled: p.id === 50
1462
+ data: s = [],
1463
+ loading: c
1464
+ } = G(async () => (await j.role.list()).map((h) => ({
1465
+ label: h.name,
1466
+ value: h.id,
1467
+ description: h.description,
1468
+ disabled: h.id === 50
835
1469
  // SUPERADMIN
836
1470
  })), {
837
1471
  refreshDeps: []
838
- }), c = ee(() => o.reduce((l, p) => (l.set(p.value, p.label), l), /* @__PURE__ */ new Map()), [o]), u = (l) => c.get(l) ?? l;
839
- return /* @__PURE__ */ d(C, { children: [
840
- /* @__PURE__ */ e(w, { pt: t.spacing, position: "right", children: /* @__PURE__ */ e(Ue, { onSuccess: s, initialRoleID: ((g = o == null ? void 0 : o[0]) == null ? void 0 : g.value) ?? 0 }) }),
841
- /* @__PURE__ */ d(v, { mt: t.spacing, sx: {
1472
+ }), d = ur(() => s.reduce((f, h) => (f.set(h.value, h.label), f), /* @__PURE__ */ new Map()), [s]), p = (f) => d.get(f) ?? f;
1473
+ return /* @__PURE__ */ v(N, { children: [
1474
+ /* @__PURE__ */ r(z, { pt: t.spacing, position: "right", children: /* @__PURE__ */ r(Ot, { onSuccess: l, initialRoleID: ((b = s == null ? void 0 : s[0]) == null ? void 0 : b.value) ?? 0 }) }),
1475
+ /* @__PURE__ */ v(I, { mt: t.spacing, sx: {
842
1476
  position: "relative"
843
1477
  }, children: [
844
- /* @__PURE__ */ e(H, { visible: i || a }),
845
- /* @__PURE__ */ d($, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
846
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ d("tr", { children: [
847
- /* @__PURE__ */ e("th", { children: "Username" }),
848
- /* @__PURE__ */ e("th", { children: "Email" }),
849
- /* @__PURE__ */ e("th", { children: "Role" }),
850
- /* @__PURE__ */ e("th", { children: "Action" })
1478
+ /* @__PURE__ */ r(xe, { visible: o || c }),
1479
+ /* @__PURE__ */ v(ke, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
1480
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ v("tr", { children: [
1481
+ /* @__PURE__ */ r("th", { children: "Username" }),
1482
+ /* @__PURE__ */ r("th", { children: "Email" }),
1483
+ /* @__PURE__ */ r("th", { children: "Role" }),
1484
+ /* @__PURE__ */ r("th", { children: "Action" })
851
1485
  ] }) }),
852
- /* @__PURE__ */ e("tbody", { children: r.map((l) => {
1486
+ /* @__PURE__ */ r("tbody", { children: i.map((f) => {
853
1487
  const {
854
- id: p,
855
- name: h,
856
- email: A,
857
- role_id: k
858
- } = l;
859
- return /* @__PURE__ */ d("tr", { children: [
860
- /* @__PURE__ */ e("td", { width: 200, children: h }),
861
- /* @__PURE__ */ e("td", { width: 200, children: A }),
862
- /* @__PURE__ */ e("td", { width: 200, children: u(k) }),
863
- /* @__PURE__ */ e("td", { width: 200, children: /* @__PURE__ */ d(w, { position: "left", children: [
864
- /* @__PURE__ */ e(Ve, { account: l, onSuccess: s }),
865
- /* @__PURE__ */ e(Ne, { id: p, name: h, onSuccess: s })
1488
+ id: h,
1489
+ name: _,
1490
+ email: k,
1491
+ role_id: q
1492
+ } = f;
1493
+ return /* @__PURE__ */ v("tr", { children: [
1494
+ /* @__PURE__ */ r("td", { width: 200, children: _ }),
1495
+ /* @__PURE__ */ r("td", { width: 200, children: k }),
1496
+ /* @__PURE__ */ r("td", { width: 200, children: p(q) }),
1497
+ /* @__PURE__ */ r("td", { width: 200, children: /* @__PURE__ */ v(z, { position: "left", children: [
1498
+ /* @__PURE__ */ r(kt, { account: f, onSuccess: l }),
1499
+ /* @__PURE__ */ r(At, { id: h, name: _, onSuccess: l })
866
1500
  ] }) })
867
- ] }, p);
1501
+ ] }, h);
868
1502
  }) })
869
1503
  ] })
870
1504
  ] })
871
1505
  ] });
872
1506
  }
873
- function Be({
1507
+ function Dt({
874
1508
  postSubmit: t,
875
- styles: n = y
1509
+ styles: n = $
876
1510
  }) {
877
1511
  const {
878
- control: r,
879
- handleSubmit: i
880
- } = q({
1512
+ control: i,
1513
+ handleSubmit: o
1514
+ } = J({
881
1515
  defaultValues: {
882
1516
  name: "",
883
1517
  password: ""
884
1518
  }
885
1519
  });
886
- return /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d("form", { onSubmit: i(async ({
887
- name: o,
888
- password: a
1520
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: o(async ({
1521
+ name: s,
1522
+ password: c
889
1523
  }) => {
890
1524
  try {
891
- _({
1525
+ V({
892
1526
  id: "for-login",
893
1527
  title: "Pending",
894
1528
  message: "Loggin in...",
895
1529
  loading: !0
896
1530
  });
897
- const c = await P.account.login(o, a);
898
- window.localStorage.setItem("token", c.token), S({
1531
+ const d = await j.account.login(s, c);
1532
+ window.localStorage.setItem("token", d.token), x({
899
1533
  id: "for-login",
900
1534
  title: "Successful",
901
1535
  message: "Logged in",
902
1536
  color: "green"
903
- }), t(c);
904
- } catch (c) {
905
- S({
1537
+ }), t(d);
1538
+ } catch (d) {
1539
+ x({
906
1540
  id: "for-login",
907
1541
  title: "Login Failed",
908
- message: c.message,
1542
+ message: d.message,
909
1543
  color: "red"
910
1544
  });
911
1545
  }
912
1546
  }), children: [
913
- /* @__PURE__ */ e(m, { name: "name", control: r, render: ({
914
- field: o
915
- }) => /* @__PURE__ */ e(z, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...o }) }),
916
- /* @__PURE__ */ e(m, { name: "password", control: r, render: ({
917
- field: o
918
- }) => /* @__PURE__ */ e(L, { mb: n.spacing, size: n.size, required: !0, label: "Password", ...o }) }),
919
- /* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Submit" }) })
1547
+ /* @__PURE__ */ r(R, { name: "name", control: i, render: ({
1548
+ field: s
1549
+ }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Username", ...s }) }),
1550
+ /* @__PURE__ */ r(R, { name: "password", control: i, render: ({
1551
+ field: s
1552
+ }) => /* @__PURE__ */ r(de, { mb: n.spacing, size: n.size, required: !0, label: "Password", ...s }) }),
1553
+ /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: n.button.size, children: "Submit" }) })
920
1554
  ] }) });
921
1555
  }
922
- function st({
923
- styles: t = y,
1556
+ function Jt({
1557
+ styles: t = $,
924
1558
  config: n,
925
- onSuccess: r
1559
+ onSuccess: i
926
1560
  }) {
927
- return j(n), /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(v, { mt: t.spacing, sx: {
1561
+ return pe(n), /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(I, { mt: t.spacing, sx: {
928
1562
  position: "relative"
929
- }, children: /* @__PURE__ */ e(Be, { styles: t, postSubmit: r }) }) });
1563
+ }, children: /* @__PURE__ */ r(Dt, { styles: t, postSubmit: i }) }) });
930
1564
  }
931
- const M = {
1565
+ const ge = {
932
1566
  size: "sm",
933
1567
  spacing: "md",
934
1568
  button: {
935
1569
  size: "xs"
936
1570
  }
937
1571
  };
938
- function He({
1572
+ function jt({
939
1573
  postSubmit: t,
940
- styles: n = M,
941
- initialRoleID: r
1574
+ styles: n = ge,
1575
+ initialRoleID: i
942
1576
  }) {
943
1577
  const {
944
- control: i,
945
- handleSubmit: s
946
- } = q({
1578
+ control: o,
1579
+ handleSubmit: l
1580
+ } = J({
947
1581
  defaultValues: {
948
1582
  name: "",
949
- role_id: r
1583
+ role_id: i
950
1584
  }
951
1585
  });
952
- return /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d("form", { onSubmit: s(async ({
953
- name: a,
954
- role_id: c
1586
+ return /* @__PURE__ */ r(I, { mx: "auto", children: /* @__PURE__ */ v("form", { onSubmit: l(async ({
1587
+ name: c,
1588
+ role_id: d
955
1589
  }) => {
956
1590
  try {
957
- _({
1591
+ V({
958
1592
  id: "for-creating",
959
1593
  title: "Pending",
960
1594
  message: "Adding API Key...",
961
1595
  loading: !0
962
1596
  });
963
1597
  const {
964
- app_id: u,
965
- app_secret: g
966
- } = await P.api_key.create(a, c);
967
- S({
1598
+ app_id: p,
1599
+ app_secret: b
1600
+ } = await j.api_key.create(c, d);
1601
+ x({
968
1602
  id: "for-creating",
969
1603
  title: "Successful",
970
1604
  message: "API Key is added",
971
1605
  color: "green"
972
- }), t(u, g);
973
- } catch (u) {
974
- S({
1606
+ }), t(p, b);
1607
+ } catch (p) {
1608
+ x({
975
1609
  id: "for-creating",
976
1610
  title: "Failed",
977
- message: u.message,
1611
+ message: p.message,
978
1612
  color: "red"
979
1613
  });
980
1614
  }
981
1615
  }), children: [
982
- /* @__PURE__ */ e(m, { name: "name", control: i, render: ({
983
- field: a
984
- }) => /* @__PURE__ */ e(z, { mb: n.spacing, size: n.size, required: !0, label: "Name", ...a }) }),
985
- /* @__PURE__ */ e(m, { name: "role_id", control: i, render: ({
986
- field: a
987
- }) => /* @__PURE__ */ e(X, { styles: n, ...a }) }),
988
- /* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Save" }) })
1616
+ /* @__PURE__ */ r(R, { name: "name", control: o, render: ({
1617
+ field: c
1618
+ }) => /* @__PURE__ */ r(D, { mb: n.spacing, size: n.size, required: !0, label: "Name", ...c }) }),
1619
+ /* @__PURE__ */ r(R, { name: "role_id", control: o, render: ({
1620
+ field: c
1621
+ }) => /* @__PURE__ */ r(Ie, { styles: n, ...c }) }),
1622
+ /* @__PURE__ */ r(z, { position: "right", mt: n.spacing, children: /* @__PURE__ */ r(T, { type: "submit", size: n.button.size, children: "Save" }) })
989
1623
  ] }) });
990
1624
  }
991
- function $e({
1625
+ function It({
992
1626
  onSuccess: t,
993
- styles: n = M,
994
- initialRoleID: r
1627
+ styles: n = ge,
1628
+ initialRoleID: i
995
1629
  }) {
996
- const i = E(), [s, o] = F.useState(!1), a = () => o(!0), c = () => o(!1);
997
- return /* @__PURE__ */ d(C, { children: [
998
- /* @__PURE__ */ e(O, { overflow: "inside", opened: s, onClose: () => o(!1), title: "Add an API Key", trapFocus: !0, onDragStart: (g) => {
999
- g.stopPropagation();
1000
- }, children: /* @__PURE__ */ e(He, { postSubmit: (g, l) => {
1001
- c(), i.openModal({
1630
+ const o = fe(), [l, s] = H.useState(!1), c = () => s(!0), d = () => s(!1);
1631
+ return /* @__PURE__ */ v(N, { children: [
1632
+ /* @__PURE__ */ r(ne, { overflow: "inside", opened: l, onClose: () => s(!1), title: "Add an API Key", trapFocus: !0, onDragStart: (b) => {
1633
+ b.stopPropagation();
1634
+ }, children: /* @__PURE__ */ r(jt, { postSubmit: (b, f) => {
1635
+ d(), o.openModal({
1002
1636
  title: "API Key is generated",
1003
- children: /* @__PURE__ */ d(B, { children: [
1004
- /* @__PURE__ */ e(I, { color: "dimmed", children: "Make sure you save it - you won't be able to access it again." }),
1005
- /* @__PURE__ */ e(z, { defaultValue: g, disabled: !0, label: "APP ID", styles: {
1637
+ children: /* @__PURE__ */ v(Ae, { children: [
1638
+ /* @__PURE__ */ r(ue, { color: "dimmed", children: "Make sure you save it - you won't be able to access it again." }),
1639
+ /* @__PURE__ */ r(D, { defaultValue: b, disabled: !0, label: "APP ID", styles: {
1006
1640
  input: {
1007
1641
  cursor: "text !important"
1008
1642
  }
1009
1643
  } }),
1010
- /* @__PURE__ */ e(z, { defaultValue: l, disabled: !0, label: "APP Secret", styles: {
1644
+ /* @__PURE__ */ r(D, { defaultValue: f, disabled: !0, label: "APP Secret", styles: {
1011
1645
  input: {
1012
1646
  cursor: "text !important"
1013
1647
  }
1014
1648
  } }),
1015
- /* @__PURE__ */ e(b, { size: "sm", onClick: () => {
1016
- Se();
1649
+ /* @__PURE__ */ r(T, { size: "sm", onClick: () => {
1650
+ it();
1017
1651
  }, children: "I've saved this API Key" })
1018
1652
  ] }),
1019
1653
  onClose: () => {
1020
1654
  t();
1021
1655
  }
1022
1656
  });
1023
- }, styles: n, initialRoleID: r }) }),
1024
- /* @__PURE__ */ e(b, { size: n.button.size, onClick: a, leftIcon: /* @__PURE__ */ e(Q, { size: 20 }), children: "Add an API Key" })
1657
+ }, styles: n, initialRoleID: i }) }),
1658
+ /* @__PURE__ */ r(T, { size: n.button.size, onClick: c, leftIcon: /* @__PURE__ */ r(De, { size: 20 }), children: "Add an API Key" })
1025
1659
  ] });
1026
1660
  }
1027
- function Ge({
1661
+ function Ft({
1028
1662
  id: t,
1029
1663
  name: n,
1030
- onSuccess: r,
1031
- styles: i = M
1664
+ onSuccess: i,
1665
+ styles: o = ge
1032
1666
  }) {
1033
- const s = E(), o = async () => {
1667
+ const l = fe(), s = async () => {
1034
1668
  if (t) {
1035
- _({
1669
+ V({
1036
1670
  id: "for-deleting",
1037
1671
  title: "Pending",
1038
1672
  message: "Deleting API Key...",
1039
1673
  loading: !0
1040
1674
  });
1041
1675
  try {
1042
- await P.api_key.delete(t), S({
1676
+ await j.api_key.delete(t), x({
1043
1677
  id: "for-deleting",
1044
1678
  title: "Successful",
1045
1679
  message: `API Key [${n}] is deleted`,
1046
1680
  color: "green"
1047
- }), r();
1048
- } catch (c) {
1049
- S({
1681
+ }), i();
1682
+ } catch (d) {
1683
+ x({
1050
1684
  id: "for-deleting",
1051
1685
  title: "Failed",
1052
- message: c.message,
1686
+ message: d.message,
1053
1687
  color: "red"
1054
1688
  });
1055
1689
  }
1056
1690
  }
1057
- }, a = () => s.openConfirmModal({
1691
+ }, c = () => l.openConfirmModal({
1058
1692
  title: "Delete this api-key?",
1059
1693
  labels: {
1060
1694
  confirm: "Confirm",
1061
1695
  cancel: "Cancel"
1062
1696
  },
1063
1697
  onCancel: () => console.log("Cancel"),
1064
- onConfirm: o
1698
+ onConfirm: s
1065
1699
  });
1066
- return /* @__PURE__ */ e(b, { size: i.button.size, color: "red", onClick: a, leftIcon: /* @__PURE__ */ e(W, { size: 20 }), children: "Delete" });
1700
+ return /* @__PURE__ */ r(T, { size: o.button.size, color: "red", onClick: c, leftIcon: /* @__PURE__ */ r(je, { size: 20 }), children: "Delete" });
1067
1701
  }
1068
- function ct({
1069
- styles: t = M,
1702
+ function Xt({
1703
+ styles: t = ge,
1070
1704
  config: n
1071
1705
  }) {
1072
- var g;
1073
- j(n);
1706
+ var b;
1707
+ pe(n);
1074
1708
  const {
1075
- data: r = [],
1076
- loading: i,
1077
- refresh: s
1078
- } = T(async () => {
1709
+ data: i = [],
1710
+ loading: o,
1711
+ refresh: l
1712
+ } = G(async () => {
1079
1713
  const {
1080
- data: l
1081
- } = await P.api_key.list();
1082
- return l;
1714
+ data: f
1715
+ } = await j.api_key.list();
1716
+ return f;
1083
1717
  }, {
1084
1718
  refreshDeps: []
1085
1719
  }), {
1086
- data: o = [],
1087
- loading: a
1088
- } = T(async () => (await P.role.list()).map((p) => ({
1089
- label: p.name,
1090
- value: p.id,
1091
- description: p.description,
1092
- disabled: p.id === 50
1720
+ data: s = [],
1721
+ loading: c
1722
+ } = G(async () => (await j.role.list()).map((h) => ({
1723
+ label: h.name,
1724
+ value: h.id,
1725
+ description: h.description,
1726
+ disabled: h.id === 50
1093
1727
  // SUPERADMIN
1094
1728
  })), {
1095
1729
  refreshDeps: []
1096
- }), c = ee(() => o.reduce((l, p) => (l.set(p.value, p.label), l), /* @__PURE__ */ new Map()), [o]), u = (l) => c.get(l) ?? l;
1097
- return /* @__PURE__ */ d(C, { children: [
1098
- /* @__PURE__ */ e(w, { pt: t.spacing, position: "right", children: /* @__PURE__ */ e($e, { onSuccess: s, initialRoleID: ((g = o == null ? void 0 : o[0]) == null ? void 0 : g.value) ?? 0 }) }),
1099
- /* @__PURE__ */ d(v, { mt: t.spacing, sx: {
1730
+ }), d = ur(() => s.reduce((f, h) => (f.set(h.value, h.label), f), /* @__PURE__ */ new Map()), [s]), p = (f) => d.get(f) ?? f;
1731
+ return /* @__PURE__ */ v(N, { children: [
1732
+ /* @__PURE__ */ r(z, { pt: t.spacing, position: "right", children: /* @__PURE__ */ r(It, { onSuccess: l, initialRoleID: ((b = s == null ? void 0 : s[0]) == null ? void 0 : b.value) ?? 0 }) }),
1733
+ /* @__PURE__ */ v(I, { mt: t.spacing, sx: {
1100
1734
  position: "relative"
1101
1735
  }, children: [
1102
- /* @__PURE__ */ e(H, { visible: i || a }),
1103
- /* @__PURE__ */ d($, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
1104
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ d("tr", { children: [
1105
- /* @__PURE__ */ e("th", { children: "Name" }),
1106
- /* @__PURE__ */ e("th", { children: "APP ID" }),
1107
- /* @__PURE__ */ e("th", { children: "Role" }),
1108
- /* @__PURE__ */ e("th", { children: "Action" })
1736
+ /* @__PURE__ */ r(xe, { visible: o || c }),
1737
+ /* @__PURE__ */ v(ke, { horizontalSpacing: t.spacing, verticalSpacing: t.spacing, fontSize: t.size, highlightOnHover: !0, children: [
1738
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ v("tr", { children: [
1739
+ /* @__PURE__ */ r("th", { children: "Name" }),
1740
+ /* @__PURE__ */ r("th", { children: "APP ID" }),
1741
+ /* @__PURE__ */ r("th", { children: "Role" }),
1742
+ /* @__PURE__ */ r("th", { children: "Action" })
1109
1743
  ] }) }),
1110
- /* @__PURE__ */ e("tbody", { children: r.map((l) => {
1744
+ /* @__PURE__ */ r("tbody", { children: i.map((f) => {
1111
1745
  const {
1112
- id: p,
1113
- name: h,
1114
- app_id: A,
1115
- role_id: k
1116
- } = l;
1117
- return /* @__PURE__ */ d("tr", { children: [
1118
- /* @__PURE__ */ e("td", { width: 200, children: h }),
1119
- /* @__PURE__ */ e("td", { width: 200, children: A }),
1120
- /* @__PURE__ */ e("td", { width: 200, children: u(k) }),
1121
- /* @__PURE__ */ e("td", { width: 200, children: /* @__PURE__ */ e(w, { position: "left", children: /* @__PURE__ */ e(Ge, { id: p, name: h, onSuccess: s }) }) })
1122
- ] }, p);
1746
+ id: h,
1747
+ name: _,
1748
+ app_id: k,
1749
+ role_id: q
1750
+ } = f;
1751
+ return /* @__PURE__ */ v("tr", { children: [
1752
+ /* @__PURE__ */ r("td", { width: 200, children: _ }),
1753
+ /* @__PURE__ */ r("td", { width: 200, children: k }),
1754
+ /* @__PURE__ */ r("td", { width: 200, children: p(q) }),
1755
+ /* @__PURE__ */ r("td", { width: 200, children: /* @__PURE__ */ r(z, { position: "left", children: /* @__PURE__ */ r(Ft, { id: h, name: _, onSuccess: l }) }) })
1756
+ ] }, h);
1123
1757
  }) })
1124
1758
  ] })
1125
1759
  ] })
1126
1760
  ] });
1127
1761
  }
1128
- const lt = () => import("./package-afe0ca7e.mjs").then(({
1762
+ const Qt = () => import("./package-f74f96aa.mjs").then(({
1129
1763
  version: t
1130
1764
  }) => (console.log(`[@devtable/dashboard] version: ${t}`), t));
1131
1765
  export {
1132
- ct as APIKeyList,
1133
- at as AccountList,
1134
- $e as AddAPIKey,
1135
- Ue as AddAccount,
1136
- xe as AddDataSource,
1137
- ot as DataSourceList,
1138
- Ge as DeleteAPIKey,
1139
- Ne as DeleteAccount,
1140
- Ee as DeleteDataSource,
1141
- st as Login,
1142
- lt as getVersion
1766
+ Xt as APIKeyList,
1767
+ Ht as AccountList,
1768
+ It as AddAPIKey,
1769
+ Ot as AddAccount,
1770
+ St as AddDataSource,
1771
+ Gt as DataSourceList,
1772
+ Ft as DeleteAPIKey,
1773
+ At as DeleteAccount,
1774
+ Ct as DeleteDataSource,
1775
+ Jt as Login,
1776
+ Qt as getVersion
1143
1777
  };