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