@devtable/settings-form 8.56.0 → 8.57.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,16 @@
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";
1
+ import { Box as v, TextInput as z, Divider as V, Group as w, NumberInput as ie, PasswordInput as F, Button as b, Modal as R, Stack as B, Alert as oe, SegmentedControl as ae, useMantineTheme as se, Tooltip as ce, Text as L, LoadingOverlay as H, Table as $, Select as le, Switch as de } from "@mantine/core";
3
2
  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";
3
+ import * as O from "react";
4
+ import E, { useEffect as G, forwardRef as J, useState as ee, useMemo as te } from "react";
6
5
  import { Recycle as ue, AlertCircle as pe, PlaylistAdd as Q, Trash as W, Edit as ge } from "tabler-icons-react";
7
6
  import me from "axios";
8
7
  import he from "crypto-js";
9
8
  import fe from "lodash";
10
9
  import { useForm as q, Controller as m } from "react-hook-form";
10
+ import * as X from "../../node_modules/react/jsx-runtime.js";
11
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;
12
+ import we, { loader as N } from "@monaco-editor/react";
13
+ import { useModals as j, closeAllModals as Se } from "@mantine/modals";
15
14
  function ze(t) {
16
15
  t = t || {};
17
16
  const n = Object.keys(t).sort(), r = [];
@@ -40,7 +39,7 @@ const f = {
40
39
  getAuthentication(t) {
41
40
  if (!this.app_id || !this.app_secret)
42
41
  return;
43
- const n = (/* @__PURE__ */ new Date()).getTime().toString();
42
+ const n = new Date().getTime().toString();
44
43
  return {
45
44
  app_id: this.app_id,
46
45
  nonce_str: n,
@@ -69,7 +68,7 @@ const f = {
69
68
  };
70
69
  }
71
70
  };
72
- function j(t) {
71
+ function M(t) {
73
72
  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);
74
73
  }
75
74
  const ve = {
@@ -91,13 +90,7 @@ const ve = {
91
90
  pagesize: 100
92
91
  }
93
92
  }),
94
- /**
95
- * get current account
96
- */
97
93
  get: async () => await f.getRequest("GET")("/account/get", {}),
98
- /**
99
- * update current account
100
- */
101
94
  update: async (t, n) => {
102
95
  const r = {
103
96
  name: t,
@@ -105,9 +98,6 @@ const ve = {
105
98
  };
106
99
  return await f.getRequest("PUT")("/account/update", r);
107
100
  },
108
- /**
109
- * change current account's password
110
- */
111
101
  changepassword: async (t, n) => {
112
102
  const r = {
113
103
  old_password: t,
@@ -123,7 +113,7 @@ const ve = {
123
113
  }),
124
114
  edit: async (t) => (t.reset_password || (t.new_password = void 0), await f.getRequest("PUT")("/account/edit", t)),
125
115
  delete: async (t) => {
126
- if (t)
116
+ if (!!t)
127
117
  return f.getRequest("POST")("/account/delete", {
128
118
  id: t
129
119
  });
@@ -147,7 +137,7 @@ const ve = {
147
137
  role_id: n
148
138
  }),
149
139
  delete: async (t) => {
150
- if (t)
140
+ if (!!t)
151
141
  return f.getRequest("POST")("/api/key/delete", {
152
142
  id: t
153
143
  });
@@ -187,7 +177,7 @@ const ve = {
187
177
  button: {
188
178
  size: "xs"
189
179
  }
190
- };
180
+ }, C = X.Fragment, e = X.jsx, d = X.jsxs;
191
181
  function ye({
192
182
  submit: t,
193
183
  styles: n = D,
@@ -212,47 +202,130 @@ function ye({
212
202
  });
213
203
  return G(() => {
214
204
  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: {
224
- 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: {
229
- width: "8em"
230
- }, ...a }) })
231
- ] }),
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" }) })
242
- ] }) });
205
+ }, [s, r]), /* @__PURE__ */ e(v, {
206
+ mx: "auto",
207
+ children: /* @__PURE__ */ d("form", {
208
+ onSubmit: o(t),
209
+ children: [/* @__PURE__ */ e(m, {
210
+ name: "key",
211
+ control: i,
212
+ render: ({
213
+ field: a
214
+ }) => /* @__PURE__ */ e(z, {
215
+ mb: n.spacing,
216
+ size: n.size,
217
+ required: !0,
218
+ label: "Name",
219
+ placeholder: "A unique name",
220
+ ...a
221
+ })
222
+ }), /* @__PURE__ */ e(V, {
223
+ label: "Connection Info",
224
+ labelPosition: "center"
225
+ }), /* @__PURE__ */ d(w, {
226
+ grow: !0,
227
+ children: [/* @__PURE__ */ e(m, {
228
+ name: "config.host",
229
+ control: i,
230
+ render: ({
231
+ field: a
232
+ }) => /* @__PURE__ */ e(z, {
233
+ mb: n.spacing,
234
+ size: n.size,
235
+ required: !0,
236
+ label: "Host",
237
+ sx: {
238
+ flexGrow: 1
239
+ },
240
+ ...a
241
+ })
242
+ }), /* @__PURE__ */ e(m, {
243
+ name: "config.port",
244
+ control: i,
245
+ render: ({
246
+ field: a
247
+ }) => /* @__PURE__ */ e(ie, {
248
+ mb: n.spacing,
249
+ size: n.size,
250
+ required: !0,
251
+ label: "Port",
252
+ hideControls: !0,
253
+ sx: {
254
+ width: "8em"
255
+ },
256
+ ...a
257
+ })
258
+ })]
259
+ }), /* @__PURE__ */ e(m, {
260
+ name: "config.username",
261
+ control: i,
262
+ render: ({
263
+ field: a
264
+ }) => /* @__PURE__ */ e(z, {
265
+ mb: n.spacing,
266
+ size: n.size,
267
+ required: !0,
268
+ label: "Username",
269
+ ...a
270
+ })
271
+ }), /* @__PURE__ */ e(m, {
272
+ name: "config.password",
273
+ control: i,
274
+ render: ({
275
+ field: a
276
+ }) => /* @__PURE__ */ e(F, {
277
+ mb: n.spacing,
278
+ size: n.size,
279
+ required: !0,
280
+ label: "Password",
281
+ ...a
282
+ })
283
+ }), /* @__PURE__ */ e(m, {
284
+ name: "config.database",
285
+ control: i,
286
+ render: ({
287
+ field: a
288
+ }) => /* @__PURE__ */ e(z, {
289
+ mb: n.spacing,
290
+ size: n.size,
291
+ required: !0,
292
+ label: "Database",
293
+ ...a
294
+ })
295
+ }), /* @__PURE__ */ e(w, {
296
+ position: "right",
297
+ mt: n.spacing,
298
+ children: /* @__PURE__ */ e(b, {
299
+ type: "submit",
300
+ size: n.button.size,
301
+ children: "Save"
302
+ })
303
+ })]
304
+ })
305
+ });
243
306
  }
244
307
  const ke = ({
245
308
  value: t,
246
309
  onChange: n
247
- }) => /* @__PURE__ */ e(v, { sx: {
248
- position: "relative"
249
- }, children: /* @__PURE__ */ e(we, { height: "500px", defaultLanguage: "javascript", value: t, onChange: (i) => {
250
- i && n(i);
251
- }, theme: "vs-dark", options: {
252
- minimap: {
253
- enabled: !1
254
- }
255
- } }) }), Y = J(({
310
+ }) => /* @__PURE__ */ e(v, {
311
+ sx: {
312
+ position: "relative"
313
+ },
314
+ children: /* @__PURE__ */ e(we, {
315
+ height: "500px",
316
+ defaultLanguage: "javascript",
317
+ value: t,
318
+ onChange: (i) => {
319
+ !i || n(i);
320
+ },
321
+ theme: "vs-dark",
322
+ options: {
323
+ minimap: {
324
+ enabled: !1
325
+ }
326
+ }
327
+ })
328
+ }), Z = J(({
256
329
  value: t,
257
330
  onChange: n,
258
331
  label: r,
@@ -261,33 +334,62 @@ const ke = ({
261
334
  styles: o
262
335
  }, a) => {
263
336
  const [c, {
264
- setTrue: u,
337
+ setTrue: p,
265
338
  setFalse: g
266
- }] = be(), [l, p] = Z(t), h = () => {
267
- g(), n(l);
339
+ }] = be(), [h, u] = ee(t), l = () => {
340
+ g(), n(h);
268
341
  }, A = () => {
269
- g(), p(t);
342
+ g(), u(t);
270
343
  }, k = () => {
271
- p(s);
344
+ u(s);
272
345
  };
273
346
  return G(() => {
274
- p(t);
275
- }, [t]), /* @__PURE__ */ d(C, { children: [
276
- /* @__PURE__ */ e(b, { variant: "filled", size: o.button.size, onClick: u, sx: {
277
- 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" })
286
- ] })
287
- ] })
288
- ] }) })
289
- ] });
290
- }), R = {
347
+ u(t);
348
+ }, [t]), /* @__PURE__ */ d(C, {
349
+ children: [/* @__PURE__ */ e(b, {
350
+ variant: "filled",
351
+ size: o.button.size,
352
+ onClick: p,
353
+ sx: {
354
+ flexGrow: 1
355
+ },
356
+ children: r
357
+ }), /* @__PURE__ */ e(R, {
358
+ size: 800,
359
+ title: i,
360
+ opened: c,
361
+ onClose: g,
362
+ closeOnClickOutside: !1,
363
+ withCloseButton: !1,
364
+ children: c && /* @__PURE__ */ d(B, {
365
+ children: [/* @__PURE__ */ e(ke, {
366
+ value: h,
367
+ onChange: u
368
+ }), /* @__PURE__ */ d(w, {
369
+ position: "apart",
370
+ children: [/* @__PURE__ */ e(b, {
371
+ onClick: k,
372
+ color: "red",
373
+ leftIcon: /* @__PURE__ */ e(ue, {
374
+ size: 20
375
+ }),
376
+ children: "Rest"
377
+ }), /* @__PURE__ */ d(w, {
378
+ position: "right",
379
+ children: [/* @__PURE__ */ e(b, {
380
+ onClick: A,
381
+ variant: "subtle",
382
+ children: "Cancel"
383
+ }), /* @__PURE__ */ e(b, {
384
+ onClick: l,
385
+ children: "OK"
386
+ })]
387
+ })]
388
+ })]
389
+ })
390
+ })]
391
+ });
392
+ }), I = {
291
393
  pre: ["function pre_process({ method, url, params, headers, data }, utils) {", " // your code goes here", " return { method, url, params, headers, data }", "}"].join(`
292
394
  `),
293
395
  post: ["function post_process(res, utils) {", " // your code goes here", " return data", "}"].join(`
@@ -308,49 +410,109 @@ function De({
308
410
  config: {
309
411
  host: "",
310
412
  processing: {
311
- pre: R.pre,
312
- post: R.post
413
+ pre: I.pre,
414
+ post: I.post
313
415
  }
314
416
  }
315
417
  }
316
418
  });
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: {
325
- 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 }) })
334
- ] }),
335
- /* @__PURE__ */ e(w, { position: "right", mt: n.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: n.button.size, children: "Save" }) })
336
- ] }) });
419
+ return /* @__PURE__ */ e(v, {
420
+ mx: "auto",
421
+ children: /* @__PURE__ */ d("form", {
422
+ onSubmit: s(t),
423
+ children: [/* @__PURE__ */ e(m, {
424
+ name: "key",
425
+ control: r,
426
+ render: ({
427
+ field: o
428
+ }) => /* @__PURE__ */ e(z, {
429
+ mb: n.spacing,
430
+ size: n.size,
431
+ required: !0,
432
+ label: "Name",
433
+ placeholder: "A unique name",
434
+ ...o
435
+ })
436
+ }), /* @__PURE__ */ e(V, {
437
+ label: "Connection Info",
438
+ labelPosition: "center"
439
+ }), /* @__PURE__ */ e(m, {
440
+ name: "config.host",
441
+ control: r,
442
+ render: ({
443
+ field: o
444
+ }) => /* @__PURE__ */ e(z, {
445
+ mb: n.spacing,
446
+ size: n.size,
447
+ required: !0,
448
+ label: "Base URL",
449
+ sx: {
450
+ flexGrow: 1
451
+ },
452
+ ...o
453
+ })
454
+ }), /* @__PURE__ */ d(w, {
455
+ grow: !0,
456
+ children: [/* @__PURE__ */ e(m, {
457
+ name: "config.processing.pre",
458
+ control: r,
459
+ render: ({
460
+ field: o
461
+ }) => /* @__PURE__ */ e(Z, {
462
+ label: "Pre Processing",
463
+ modalTitle: "This function will run before sending the request (for scenarios like encryption)",
464
+ defaultValue: I.pre,
465
+ ...o,
466
+ styles: n
467
+ })
468
+ }), /* @__PURE__ */ e(m, {
469
+ name: "config.processing.post",
470
+ control: r,
471
+ render: ({
472
+ field: o
473
+ }) => /* @__PURE__ */ e(Z, {
474
+ label: "Post Processing",
475
+ modalTitle: "This function will run after sending the request (for scenarios like decryption)",
476
+ defaultValue: I.post,
477
+ ...o,
478
+ styles: n
479
+ })
480
+ })]
481
+ }), /* @__PURE__ */ e(w, {
482
+ position: "right",
483
+ mt: n.spacing,
484
+ children: /* @__PURE__ */ e(b, {
485
+ type: "submit",
486
+ size: n.button.size,
487
+ children: "Save"
488
+ })
489
+ })]
490
+ })
491
+ });
337
492
  }
338
493
  function Te({
339
494
  styles: t = D
340
495
  }) {
341
- return /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d(oe, { mt: t.spacing, icon: /* @__PURE__ */ e(pe, { size: 16 }), children: [
342
- "Only ",
343
- /* @__PURE__ */ e("b", { children: "SELECT" }),
344
- " privilege is needed."
345
- ] }) });
496
+ return /* @__PURE__ */ e(v, {
497
+ mx: "auto",
498
+ children: /* @__PURE__ */ d(oe, {
499
+ mt: t.spacing,
500
+ icon: /* @__PURE__ */ e(pe, {
501
+ size: 16
502
+ }),
503
+ children: ["Only ", /* @__PURE__ */ e("b", {
504
+ children: "SELECT"
505
+ }), " privilege is needed."]
506
+ })
507
+ });
346
508
  }
347
509
  function qe({
348
510
  postSubmit: t,
349
511
  styles: n = D
350
512
  }) {
351
- const [r, i] = Z("postgresql"), s = async ({
513
+ const [r, i] = ee("postgresql"), s = async ({
352
514
  type: c,
353
- key: u,
515
+ key: p,
354
516
  config: g
355
517
  }) => {
356
518
  _({
@@ -362,76 +524,107 @@ function qe({
362
524
  try {
363
525
  console.log({
364
526
  type: c,
365
- key: u,
527
+ key: p,
366
528
  config: g
367
- }), await P.datasource.create(c, u, g), S({
529
+ }), await P.datasource.create(c, p, g), S({
368
530
  id: "for-creating",
369
531
  title: "Successful",
370
532
  message: "Data source is added",
371
533
  color: "green"
372
534
  }), t();
373
- } catch (l) {
535
+ } catch (h) {
374
536
  S({
375
537
  id: "for-creating",
376
538
  title: "Failed",
377
- message: l.message,
539
+ message: h.message,
378
540
  color: "red"
379
541
  });
380
542
  }
381
543
  }, 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: [{
384
- label: "PostgreSQL",
385
- value: "postgresql"
386
- }, {
387
- label: "MySQL",
388
- value: "mysql"
389
- }, {
390
- label: "HTTP",
391
- 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 })
396
- ] });
544
+ return /* @__PURE__ */ d(v, {
545
+ mx: "auto",
546
+ children: [/* @__PURE__ */ e(ae, {
547
+ fullWidth: !0,
548
+ mb: n.spacing,
549
+ size: n.size,
550
+ data: [{
551
+ label: "PostgreSQL",
552
+ value: "postgresql"
553
+ }, {
554
+ label: "MySQL",
555
+ value: "mysql"
556
+ }, {
557
+ label: "HTTP",
558
+ value: "http"
559
+ }],
560
+ value: r,
561
+ onChange: (c) => i(c)
562
+ }), o && /* @__PURE__ */ e(Te, {
563
+ styles: n
564
+ }), o && /* @__PURE__ */ e(ye, {
565
+ submit: s,
566
+ styles: n,
567
+ type: r
568
+ }), a && /* @__PURE__ */ e(De, {
569
+ submit: s,
570
+ styles: n
571
+ })]
572
+ });
397
573
  }
398
574
  function xe({
399
575
  onSuccess: t,
400
576
  styles: n = D
401
577
  }) {
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();
408
- }, styles: n }) }),
409
- /* @__PURE__ */ e(b, { size: n.button.size, onClick: s, leftIcon: /* @__PURE__ */ e(Q, { size: 20 }), children: "Add a Data Source" })
410
- ] });
578
+ const [r, i] = E.useState(!1), s = () => i(!0), o = () => i(!1);
579
+ return /* @__PURE__ */ d(C, {
580
+ children: [/* @__PURE__ */ e(R, {
581
+ overflow: "inside",
582
+ opened: r,
583
+ onClose: () => i(!1),
584
+ title: "Add a data source",
585
+ trapFocus: !0,
586
+ onDragStart: (c) => {
587
+ c.stopPropagation();
588
+ },
589
+ children: /* @__PURE__ */ e(qe, {
590
+ postSubmit: () => {
591
+ t(), o();
592
+ },
593
+ styles: n
594
+ })
595
+ }), /* @__PURE__ */ e(b, {
596
+ size: n.button.size,
597
+ onClick: s,
598
+ leftIcon: /* @__PURE__ */ e(Q, {
599
+ size: 20
600
+ }),
601
+ children: "Add a Data Source"
602
+ })]
603
+ });
411
604
  }
412
605
  const Oe = (t) => t.replace(/([^:])(\/\/+)/g, "$1/");
413
606
  function Re(t) {
414
607
  G(() => {
415
- if (U.__getMonacoInstance())
608
+ if (N.__getMonacoInstance())
416
609
  return;
417
610
  console.log("loading monaco for @devtable/settings-form");
418
611
  const r = Oe(t);
419
- U.config({
612
+ N.config({
420
613
  paths: {
421
614
  vs: r
422
615
  }
423
- }), U.init().then((i) => console.log("monaco instance:", i));
616
+ }), N.init().then((i) => console.log("monaco instance:", i));
424
617
  }, []);
425
618
  }
426
- function N() {
427
- return N = Object.assign ? Object.assign.bind() : function(t) {
619
+ function K() {
620
+ return K = Object.assign ? Object.assign.bind() : function(t) {
428
621
  for (var n = 1; n < arguments.length; n++) {
429
622
  var r = arguments[n];
430
623
  for (var i in r)
431
624
  Object.prototype.hasOwnProperty.call(r, i) && (t[i] = r[i]);
432
625
  }
433
626
  return t;
434
- }, N.apply(this, arguments);
627
+ }, K.apply(this, arguments);
435
628
  }
436
629
  function Ie(t, n) {
437
630
  if (t == null)
@@ -439,10 +632,10 @@ function Ie(t, n) {
439
632
  var r, i, s = function(a, c) {
440
633
  if (a == null)
441
634
  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;
635
+ var p, g, h = {}, u = Object.keys(a);
636
+ for (g = 0; g < u.length; g++)
637
+ p = u[g], c.indexOf(p) >= 0 || (h[p] = a[p]);
638
+ return h;
446
639
  }(t, n);
447
640
  if (Object.getOwnPropertySymbols) {
448
641
  var o = Object.getOwnPropertySymbols(t);
@@ -454,7 +647,7 @@ function Ie(t, n) {
454
647
  var Le = ["size", "color", "stroke"];
455
648
  function Fe(t) {
456
649
  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" }));
650
+ return O.createElement("svg", K({ 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), O.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), O.createElement("rect", { x: 5, y: 11, width: 14, height: 10, rx: 2 }), O.createElement("circle", { cx: 12, cy: 16, r: 1 }), O.createElement("path", { d: "M8 11v-4a4 4 0 0 1 8 0v4" }));
458
651
  }
459
652
  function Ee({
460
653
  id: t,
@@ -463,8 +656,8 @@ function Ee({
463
656
  onSuccess: i,
464
657
  styles: s = D
465
658
  }) {
466
- const o = E(), a = async () => {
467
- t && (_({
659
+ const o = j(), a = async () => {
660
+ !t || (_({
468
661
  id: "for-deleting",
469
662
  title: "Pending",
470
663
  message: "Deleting data source...",
@@ -477,25 +670,46 @@ function Ee({
477
670
  }), i());
478
671
  }, c = () => o.openConfirmModal({
479
672
  title: "Delete this data source?",
480
- children: /* @__PURE__ */ e(I, { size: s.size, children: "This action won't affect your database." }),
673
+ children: /* @__PURE__ */ e(L, {
674
+ size: s.size,
675
+ children: "This action won't affect your database."
676
+ }),
481
677
  labels: {
482
678
  confirm: "Confirm",
483
679
  cancel: "Cancel"
484
680
  },
485
681
  onCancel: () => console.log("Cancel"),
486
682
  onConfirm: a
487
- }), u = se();
488
- return r ? /* @__PURE__ */ e(ce, { withArrow: !0, events: {
489
- hover: !0,
490
- touch: !1,
491
- 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" });
683
+ }), p = se();
684
+ return r ? /* @__PURE__ */ e(ce, {
685
+ withArrow: !0,
686
+ events: {
687
+ hover: !0,
688
+ touch: !1,
689
+ focus: !1
690
+ },
691
+ label: "This is a preset datasource, it can not be deleted",
692
+ children: /* @__PURE__ */ e("span", {
693
+ children: /* @__PURE__ */ e(Fe, {
694
+ size: 16,
695
+ color: p.colors.gray[7]
696
+ })
697
+ })
698
+ }) : /* @__PURE__ */ e(b, {
699
+ size: s.button.size,
700
+ color: "red",
701
+ onClick: c,
702
+ leftIcon: /* @__PURE__ */ e(W, {
703
+ size: 20
704
+ }),
705
+ children: "Delete"
706
+ });
493
707
  }
494
708
  function ot({
495
709
  styles: t = D,
496
710
  config: n
497
711
  }) {
498
- Re(n.monacoPath), j(n);
712
+ Re(n.monacoPath), M(n);
499
713
  const {
500
714
  data: r = [],
501
715
  loading: i,
@@ -508,41 +722,84 @@ function ot({
508
722
  }, {
509
723
  refreshDeps: []
510
724
  });
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: {
514
- position: "relative"
515
- }, 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" })
522
- ] }) }),
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)) })
533
- ] })
534
- ] })
535
- ] });
725
+ return /* @__PURE__ */ d(C, {
726
+ children: [/* @__PURE__ */ e(w, {
727
+ pt: t.spacing,
728
+ position: "right",
729
+ children: /* @__PURE__ */ e(xe, {
730
+ onSuccess: s
731
+ })
732
+ }), /* @__PURE__ */ d(v, {
733
+ mt: t.spacing,
734
+ sx: {
735
+ position: "relative"
736
+ },
737
+ children: [/* @__PURE__ */ e(H, {
738
+ visible: i
739
+ }), /* @__PURE__ */ d($, {
740
+ horizontalSpacing: t.spacing,
741
+ verticalSpacing: t.spacing,
742
+ fontSize: t.size,
743
+ highlightOnHover: !0,
744
+ children: [/* @__PURE__ */ e("thead", {
745
+ children: /* @__PURE__ */ d("tr", {
746
+ children: [/* @__PURE__ */ e("th", {
747
+ children: "Type"
748
+ }), /* @__PURE__ */ e("th", {
749
+ children: "Name"
750
+ }), /* @__PURE__ */ e("th", {
751
+ children: "Action"
752
+ })]
753
+ })
754
+ }), /* @__PURE__ */ e("tbody", {
755
+ children: r.map(({
756
+ id: o,
757
+ key: a,
758
+ type: c,
759
+ is_preset: p
760
+ }) => /* @__PURE__ */ d("tr", {
761
+ children: [/* @__PURE__ */ e("td", {
762
+ width: 200,
763
+ children: c
764
+ }), /* @__PURE__ */ e("td", {
765
+ children: a
766
+ }), /* @__PURE__ */ e("td", {
767
+ width: 200,
768
+ children: /* @__PURE__ */ e(w, {
769
+ position: "left",
770
+ children: /* @__PURE__ */ e(Ee, {
771
+ isProtected: p,
772
+ id: o,
773
+ name: a,
774
+ onSuccess: s
775
+ })
776
+ })
777
+ })]
778
+ }, a))
779
+ })]
780
+ })]
781
+ })]
782
+ });
536
783
  }
537
784
  const je = J(({
538
785
  label: t,
539
786
  value: n,
540
787
  description: r,
541
788
  ...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(({
789
+ }, s) => /* @__PURE__ */ d(B, {
790
+ spacing: 2,
791
+ ref: s,
792
+ ...i,
793
+ children: [/* @__PURE__ */ e(L, {
794
+ size: "sm",
795
+ children: t
796
+ }), /* @__PURE__ */ e(L, {
797
+ size: "xs",
798
+ color: "dimmed",
799
+ className: "role-description",
800
+ children: r
801
+ })]
802
+ })), Y = J(({
546
803
  styles: t,
547
804
  value: n,
548
805
  onChange: r
@@ -555,36 +812,32 @@ const je = J(({
555
812
  value: c.id,
556
813
  description: c.description,
557
814
  disabled: c.id === 50
558
- // SUPERADMIN
559
815
  })), {
560
816
  refreshDeps: []
561
817
  });
562
- return /* @__PURE__ */ e(
563
- le,
564
- {
565
- ref: i,
566
- mb: t.spacing,
567
- size: t.size,
568
- required: !0,
569
- label: "Role",
570
- itemComponent: je,
571
- data: s,
572
- disabled: o,
573
- styles: () => ({
574
- item: {
575
- "&[data-selected]": {
576
- "&, &:hover": {
577
- ".role-description": {
578
- color: "rgba(255,255,255,.8)"
579
- }
818
+ return /* @__PURE__ */ e(le, {
819
+ ref: i,
820
+ mb: t.spacing,
821
+ size: t.size,
822
+ required: !0,
823
+ label: "Role",
824
+ itemComponent: je,
825
+ data: s,
826
+ disabled: o,
827
+ styles: () => ({
828
+ item: {
829
+ "&[data-selected]": {
830
+ "&, &:hover": {
831
+ ".role-description": {
832
+ color: "rgba(255,255,255,.8)"
580
833
  }
581
834
  }
582
835
  }
583
- }),
584
- value: n,
585
- onChange: r
586
- }
587
- );
836
+ }
837
+ }),
838
+ value: n,
839
+ onChange: r
840
+ });
588
841
  }), y = {
589
842
  size: "sm",
590
843
  spacing: "md",
@@ -608,62 +861,126 @@ function Me({
608
861
  password: ""
609
862
  }
610
863
  });
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
616
- }) => {
617
- try {
618
- _({
619
- id: "for-creating",
620
- title: "Pending",
621
- message: "Adding account...",
622
- loading: !0
623
- }), await P.account.create(a, c, u, g), S({
624
- id: "for-creating",
625
- title: "Successful",
626
- message: "Account is added",
627
- color: "green"
628
- }), t();
629
- } catch (l) {
630
- S({
631
- id: "for-creating",
632
- title: "Failed",
633
- message: l.message,
634
- color: "red"
635
- });
636
- }
637
- }), 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" }) })
651
- ] }) });
864
+ return /* @__PURE__ */ e(v, {
865
+ mx: "auto",
866
+ children: /* @__PURE__ */ d("form", {
867
+ onSubmit: s(async ({
868
+ name: a,
869
+ email: c,
870
+ password: p,
871
+ role_id: g
872
+ }) => {
873
+ try {
874
+ _({
875
+ id: "for-creating",
876
+ title: "Pending",
877
+ message: "Adding account...",
878
+ loading: !0
879
+ }), await P.account.create(a, c, p, g), S({
880
+ id: "for-creating",
881
+ title: "Successful",
882
+ message: "Account is added",
883
+ color: "green"
884
+ }), t();
885
+ } catch (h) {
886
+ S({
887
+ id: "for-creating",
888
+ title: "Failed",
889
+ message: h.message,
890
+ color: "red"
891
+ });
892
+ }
893
+ }),
894
+ children: [/* @__PURE__ */ e(m, {
895
+ name: "name",
896
+ control: i,
897
+ render: ({
898
+ field: a
899
+ }) => /* @__PURE__ */ e(z, {
900
+ mb: n.spacing,
901
+ size: n.size,
902
+ required: !0,
903
+ label: "Username",
904
+ ...a
905
+ })
906
+ }), /* @__PURE__ */ e(m, {
907
+ name: "email",
908
+ control: i,
909
+ render: ({
910
+ field: a
911
+ }) => /* @__PURE__ */ e(z, {
912
+ mb: n.spacing,
913
+ size: n.size,
914
+ required: !0,
915
+ label: "Email",
916
+ ...a
917
+ })
918
+ }), /* @__PURE__ */ e(m, {
919
+ name: "password",
920
+ control: i,
921
+ render: ({
922
+ field: a
923
+ }) => /* @__PURE__ */ e(F, {
924
+ mb: n.spacing,
925
+ size: n.size,
926
+ required: !0,
927
+ label: "Password",
928
+ description: "Password must be at least 8 characters long",
929
+ ...a
930
+ })
931
+ }), /* @__PURE__ */ e(m, {
932
+ name: "role_id",
933
+ control: i,
934
+ render: ({
935
+ field: a
936
+ }) => /* @__PURE__ */ e(Y, {
937
+ styles: n,
938
+ ...a
939
+ })
940
+ }), /* @__PURE__ */ e(w, {
941
+ position: "right",
942
+ mt: n.spacing,
943
+ children: /* @__PURE__ */ e(b, {
944
+ type: "submit",
945
+ size: n.button.size,
946
+ children: "Save"
947
+ })
948
+ })]
949
+ })
950
+ });
652
951
  }
653
952
  function Ue({
654
953
  onSuccess: t,
655
954
  styles: n = y,
656
955
  initialRoleID: r
657
956
  }) {
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" })
666
- ] });
957
+ const [i, s] = E.useState(!1), o = () => s(!0), a = () => s(!1);
958
+ return /* @__PURE__ */ d(C, {
959
+ children: [/* @__PURE__ */ e(R, {
960
+ overflow: "inside",
961
+ opened: i,
962
+ onClose: () => s(!1),
963
+ title: "Add an Account",
964
+ trapFocus: !0,
965
+ onDragStart: (p) => {
966
+ p.stopPropagation();
967
+ },
968
+ children: /* @__PURE__ */ e(Me, {
969
+ postSubmit: () => {
970
+ t(), a();
971
+ },
972
+ styles: n,
973
+ initialRoleID: r
974
+ })
975
+ }), /* @__PURE__ */ e(b, {
976
+ size: n.button.size,
977
+ onClick: o,
978
+ leftIcon: /* @__PURE__ */ e(Q, {
979
+ size: 20
980
+ }),
981
+ children: "Add an Account"
982
+ })]
983
+ });
667
984
  }
668
985
  function Ne({
669
986
  id: t,
@@ -671,8 +988,8 @@ function Ne({
671
988
  onSuccess: r,
672
989
  styles: i = y
673
990
  }) {
674
- const s = E(), o = async () => {
675
- if (t) {
991
+ const s = j(), o = async () => {
992
+ if (!!t) {
676
993
  _({
677
994
  id: "for-deleting",
678
995
  title: "Pending",
@@ -704,7 +1021,15 @@ function Ne({
704
1021
  onCancel: () => console.log("Cancel"),
705
1022
  onConfirm: o
706
1023
  });
707
- return /* @__PURE__ */ e(b, { size: i.button.size, color: "red", onClick: a, leftIcon: /* @__PURE__ */ e(W, { size: 20 }), children: "Delete" });
1024
+ return /* @__PURE__ */ e(b, {
1025
+ size: i.button.size,
1026
+ color: "red",
1027
+ onClick: a,
1028
+ leftIcon: /* @__PURE__ */ e(W, {
1029
+ size: 20
1030
+ }),
1031
+ children: "Delete"
1032
+ });
708
1033
  }
709
1034
  function Ke({
710
1035
  id: t,
@@ -717,7 +1042,7 @@ function Ke({
717
1042
  const {
718
1043
  control: a,
719
1044
  handleSubmit: c,
720
- watch: u
1045
+ watch: p
721
1046
  } = q({
722
1047
  defaultValues: {
723
1048
  name: n,
@@ -727,10 +1052,10 @@ function Ke({
727
1052
  new_password: ""
728
1053
  }
729
1054
  }), g = async ({
730
- name: h,
1055
+ name: l,
731
1056
  email: A,
732
1057
  role_id: k,
733
- reset_password: te,
1058
+ reset_password: x,
734
1059
  new_password: ne
735
1060
  }) => {
736
1061
  try {
@@ -741,10 +1066,10 @@ function Ke({
741
1066
  loading: !0
742
1067
  }), await P.account.edit({
743
1068
  id: t,
744
- name: h,
1069
+ name: l,
745
1070
  email: A,
746
1071
  role_id: k,
747
- reset_password: te,
1072
+ reset_password: x,
748
1073
  new_password: ne
749
1074
  }), S({
750
1075
  id: "for-updating",
@@ -760,115 +1085,226 @@ function Ke({
760
1085
  color: "red"
761
1086
  });
762
1087
  }
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: {
778
- label: {
779
- verticalAlign: "middle"
780
- }
781
- } }) }),
782
- l && /* @__PURE__ */ e(
783
- m,
784
- {
1088
+ }, [h, u] = p(["reset_password", "new_password"]);
1089
+ return /* @__PURE__ */ e(v, {
1090
+ mx: "auto",
1091
+ children: /* @__PURE__ */ d("form", {
1092
+ onSubmit: c(g),
1093
+ children: [/* @__PURE__ */ e(m, {
1094
+ name: "name",
1095
+ control: a,
1096
+ render: ({
1097
+ field: l
1098
+ }) => /* @__PURE__ */ e(z, {
1099
+ mb: o.spacing,
1100
+ size: o.size,
1101
+ required: !0,
1102
+ label: "Username",
1103
+ ...l
1104
+ })
1105
+ }), /* @__PURE__ */ e(m, {
1106
+ name: "email",
1107
+ control: a,
1108
+ render: ({
1109
+ field: l
1110
+ }) => /* @__PURE__ */ e(z, {
1111
+ mb: o.spacing,
1112
+ size: o.size,
1113
+ required: !0,
1114
+ label: "Email",
1115
+ ...l
1116
+ })
1117
+ }), /* @__PURE__ */ e(m, {
1118
+ name: "role_id",
1119
+ control: a,
1120
+ render: ({
1121
+ field: l
1122
+ }) => /* @__PURE__ */ e(Y, {
1123
+ styles: o,
1124
+ ...l
1125
+ })
1126
+ }), /* @__PURE__ */ e(V, {
1127
+ my: 20,
1128
+ variant: "dashed",
1129
+ label: "",
1130
+ labelPosition: "center"
1131
+ }), /* @__PURE__ */ e(m, {
1132
+ name: "reset_password",
1133
+ control: a,
1134
+ render: ({
1135
+ field: l
1136
+ }) => /* @__PURE__ */ e(de, {
1137
+ mb: o.spacing,
1138
+ size: o.size,
1139
+ label: "Reset password",
1140
+ checked: l.value,
1141
+ onChange: (A) => l.onChange(A.currentTarget.checked),
1142
+ styles: {
1143
+ label: {
1144
+ verticalAlign: "middle"
1145
+ }
1146
+ }
1147
+ })
1148
+ }), h && /* @__PURE__ */ e(m, {
785
1149
  name: "new_password",
786
1150
  control: a,
787
1151
  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 })
790
- }
791
- ),
792
- /* @__PURE__ */ e(w, { position: "right", mt: o.spacing, children: /* @__PURE__ */ e(b, { type: "submit", size: o.button.size, children: "Submit" }) })
793
- ] }) });
1152
+ field: l
1153
+ }) => /* @__PURE__ */ e(F, {
1154
+ autoComplete: "off",
1155
+ mb: o.spacing,
1156
+ size: o.size,
1157
+ required: !0,
1158
+ description: "Password must be at least 8 characters long",
1159
+ label: "New Password",
1160
+ ...l
1161
+ })
1162
+ }), /* @__PURE__ */ e(w, {
1163
+ position: "right",
1164
+ mt: o.spacing,
1165
+ children: /* @__PURE__ */ e(b, {
1166
+ type: "submit",
1167
+ size: o.button.size,
1168
+ children: "Submit"
1169
+ })
1170
+ })]
1171
+ })
1172
+ });
794
1173
  }
795
1174
  function Ve({
796
1175
  account: t,
797
1176
  onSuccess: n,
798
1177
  styles: r = y
799
1178
  }) {
800
- const [i, s] = F.useState(!1), o = () => s(!0), a = () => s(!1), c = () => {
1179
+ const [i, s] = E.useState(!1), o = () => s(!0), a = () => s(!1), c = () => {
801
1180
  n(), a();
802
1181
  };
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" })
808
- ] });
1182
+ return /* @__PURE__ */ d(C, {
1183
+ children: [/* @__PURE__ */ e(R, {
1184
+ overflow: "inside",
1185
+ opened: i,
1186
+ onClose: () => s(!1),
1187
+ title: `Editing ${t.name}`,
1188
+ trapFocus: !0,
1189
+ onDragStart: (p) => {
1190
+ p.stopPropagation();
1191
+ },
1192
+ children: /* @__PURE__ */ e(Ke, {
1193
+ ...t,
1194
+ postSubmit: c,
1195
+ styles: r
1196
+ })
1197
+ }), /* @__PURE__ */ e(b, {
1198
+ size: r.button.size,
1199
+ onClick: o,
1200
+ leftIcon: /* @__PURE__ */ e(ge, {
1201
+ size: 20
1202
+ }),
1203
+ children: "Edit"
1204
+ })]
1205
+ });
809
1206
  }
810
1207
  function at({
811
1208
  styles: t = y,
812
1209
  config: n
813
1210
  }) {
814
- var g;
815
- j(n);
1211
+ var g, h;
1212
+ M(n);
816
1213
  const {
817
1214
  data: r = [],
818
1215
  loading: i,
819
1216
  refresh: s
820
1217
  } = T(async () => {
821
1218
  const {
822
- data: l
1219
+ data: u
823
1220
  } = await P.account.list();
824
- return l;
1221
+ return u;
825
1222
  }, {
826
1223
  refreshDeps: []
827
1224
  }), {
828
1225
  data: o = [],
829
1226
  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
835
- // SUPERADMIN
1227
+ } = T(async () => (await P.role.list()).map((l) => ({
1228
+ label: l.name,
1229
+ value: l.id,
1230
+ description: l.description,
1231
+ disabled: l.id === 50
836
1232
  })), {
837
1233
  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: {
842
- position: "relative"
843
- }, 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" })
851
- ] }) }),
852
- /* @__PURE__ */ e("tbody", { children: r.map((l) => {
853
- 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 })
866
- ] }) })
867
- ] }, p);
868
- }) })
869
- ] })
870
- ] })
871
- ] });
1234
+ }), c = te(() => o.reduce((u, l) => (u.set(l.value, l.label), u), /* @__PURE__ */ new Map()), [o]), p = (u) => {
1235
+ var l;
1236
+ return (l = c.get(u)) != null ? l : u;
1237
+ };
1238
+ return /* @__PURE__ */ d(C, {
1239
+ children: [/* @__PURE__ */ e(w, {
1240
+ pt: t.spacing,
1241
+ position: "right",
1242
+ children: /* @__PURE__ */ e(Ue, {
1243
+ onSuccess: s,
1244
+ initialRoleID: (h = (g = o == null ? void 0 : o[0]) == null ? void 0 : g.value) != null ? h : 0
1245
+ })
1246
+ }), /* @__PURE__ */ d(v, {
1247
+ mt: t.spacing,
1248
+ sx: {
1249
+ position: "relative"
1250
+ },
1251
+ children: [/* @__PURE__ */ e(H, {
1252
+ visible: i || a
1253
+ }), /* @__PURE__ */ d($, {
1254
+ horizontalSpacing: t.spacing,
1255
+ verticalSpacing: t.spacing,
1256
+ fontSize: t.size,
1257
+ highlightOnHover: !0,
1258
+ children: [/* @__PURE__ */ e("thead", {
1259
+ children: /* @__PURE__ */ d("tr", {
1260
+ children: [/* @__PURE__ */ e("th", {
1261
+ children: "Username"
1262
+ }), /* @__PURE__ */ e("th", {
1263
+ children: "Email"
1264
+ }), /* @__PURE__ */ e("th", {
1265
+ children: "Role"
1266
+ }), /* @__PURE__ */ e("th", {
1267
+ children: "Action"
1268
+ })]
1269
+ })
1270
+ }), /* @__PURE__ */ e("tbody", {
1271
+ children: r.map((u) => {
1272
+ const {
1273
+ id: l,
1274
+ name: A,
1275
+ email: k,
1276
+ role_id: x
1277
+ } = u;
1278
+ return /* @__PURE__ */ d("tr", {
1279
+ children: [/* @__PURE__ */ e("td", {
1280
+ width: 200,
1281
+ children: A
1282
+ }), /* @__PURE__ */ e("td", {
1283
+ width: 200,
1284
+ children: k
1285
+ }), /* @__PURE__ */ e("td", {
1286
+ width: 200,
1287
+ children: p(x)
1288
+ }), /* @__PURE__ */ e("td", {
1289
+ width: 200,
1290
+ children: /* @__PURE__ */ d(w, {
1291
+ position: "left",
1292
+ children: [/* @__PURE__ */ e(Ve, {
1293
+ account: u,
1294
+ onSuccess: s
1295
+ }), /* @__PURE__ */ e(Ne, {
1296
+ id: l,
1297
+ name: A,
1298
+ onSuccess: s
1299
+ })]
1300
+ })
1301
+ })]
1302
+ }, l);
1303
+ })
1304
+ })]
1305
+ })]
1306
+ })]
1307
+ });
872
1308
  }
873
1309
  function Be({
874
1310
  postSubmit: t,
@@ -883,52 +1319,91 @@ function Be({
883
1319
  password: ""
884
1320
  }
885
1321
  });
886
- return /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d("form", { onSubmit: i(async ({
887
- name: o,
888
- password: a
889
- }) => {
890
- try {
891
- _({
892
- id: "for-login",
893
- title: "Pending",
894
- message: "Loggin in...",
895
- loading: !0
896
- });
897
- const c = await P.account.login(o, a);
898
- window.localStorage.setItem("token", c.token), S({
899
- id: "for-login",
900
- title: "Successful",
901
- message: "Logged in",
902
- color: "green"
903
- }), t(c);
904
- } catch (c) {
905
- S({
906
- id: "for-login",
907
- title: "Login Failed",
908
- message: c.message,
909
- color: "red"
910
- });
911
- }
912
- }), 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" }) })
920
- ] }) });
1322
+ return /* @__PURE__ */ e(v, {
1323
+ mx: "auto",
1324
+ children: /* @__PURE__ */ d("form", {
1325
+ onSubmit: i(async ({
1326
+ name: o,
1327
+ password: a
1328
+ }) => {
1329
+ try {
1330
+ _({
1331
+ id: "for-login",
1332
+ title: "Pending",
1333
+ message: "Loggin in...",
1334
+ loading: !0
1335
+ });
1336
+ const c = await P.account.login(o, a);
1337
+ window.localStorage.setItem("token", c.token), S({
1338
+ id: "for-login",
1339
+ title: "Successful",
1340
+ message: "Logged in",
1341
+ color: "green"
1342
+ }), t(c);
1343
+ } catch (c) {
1344
+ S({
1345
+ id: "for-login",
1346
+ title: "Login Failed",
1347
+ message: c.message,
1348
+ color: "red"
1349
+ });
1350
+ }
1351
+ }),
1352
+ children: [/* @__PURE__ */ e(m, {
1353
+ name: "name",
1354
+ control: r,
1355
+ render: ({
1356
+ field: o
1357
+ }) => /* @__PURE__ */ e(z, {
1358
+ mb: n.spacing,
1359
+ size: n.size,
1360
+ required: !0,
1361
+ label: "Username",
1362
+ ...o
1363
+ })
1364
+ }), /* @__PURE__ */ e(m, {
1365
+ name: "password",
1366
+ control: r,
1367
+ render: ({
1368
+ field: o
1369
+ }) => /* @__PURE__ */ e(F, {
1370
+ mb: n.spacing,
1371
+ size: n.size,
1372
+ required: !0,
1373
+ label: "Password",
1374
+ ...o
1375
+ })
1376
+ }), /* @__PURE__ */ e(w, {
1377
+ position: "right",
1378
+ mt: n.spacing,
1379
+ children: /* @__PURE__ */ e(b, {
1380
+ type: "submit",
1381
+ size: n.button.size,
1382
+ children: "Submit"
1383
+ })
1384
+ })]
1385
+ })
1386
+ });
921
1387
  }
922
1388
  function st({
923
1389
  styles: t = y,
924
1390
  config: n,
925
1391
  onSuccess: r
926
1392
  }) {
927
- return j(n), /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(v, { mt: t.spacing, sx: {
928
- position: "relative"
929
- }, children: /* @__PURE__ */ e(Be, { styles: t, postSubmit: r }) }) });
1393
+ return M(n), /* @__PURE__ */ e(C, {
1394
+ children: /* @__PURE__ */ e(v, {
1395
+ mt: t.spacing,
1396
+ sx: {
1397
+ position: "relative"
1398
+ },
1399
+ children: /* @__PURE__ */ e(Be, {
1400
+ styles: t,
1401
+ postSubmit: r
1402
+ })
1403
+ })
1404
+ });
930
1405
  }
931
- const M = {
1406
+ const U = {
932
1407
  size: "sm",
933
1408
  spacing: "md",
934
1409
  button: {
@@ -937,7 +1412,7 @@ const M = {
937
1412
  };
938
1413
  function He({
939
1414
  postSubmit: t,
940
- styles: n = M,
1415
+ styles: n = U,
941
1416
  initialRoleID: r
942
1417
  }) {
943
1418
  const {
@@ -949,89 +1424,148 @@ function He({
949
1424
  role_id: r
950
1425
  }
951
1426
  });
952
- return /* @__PURE__ */ e(v, { mx: "auto", children: /* @__PURE__ */ d("form", { onSubmit: s(async ({
953
- name: a,
954
- role_id: c
955
- }) => {
956
- try {
957
- _({
958
- id: "for-creating",
959
- title: "Pending",
960
- message: "Adding API Key...",
961
- loading: !0
962
- });
963
- const {
964
- app_id: u,
965
- app_secret: g
966
- } = await P.api_key.create(a, c);
967
- S({
968
- id: "for-creating",
969
- title: "Successful",
970
- message: "API Key is added",
971
- color: "green"
972
- }), t(u, g);
973
- } catch (u) {
974
- S({
975
- id: "for-creating",
976
- title: "Failed",
977
- message: u.message,
978
- color: "red"
979
- });
980
- }
981
- }), 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" }) })
989
- ] }) });
1427
+ return /* @__PURE__ */ e(v, {
1428
+ mx: "auto",
1429
+ children: /* @__PURE__ */ d("form", {
1430
+ onSubmit: s(async ({
1431
+ name: a,
1432
+ role_id: c
1433
+ }) => {
1434
+ try {
1435
+ _({
1436
+ id: "for-creating",
1437
+ title: "Pending",
1438
+ message: "Adding API Key...",
1439
+ loading: !0
1440
+ });
1441
+ const {
1442
+ app_id: p,
1443
+ app_secret: g
1444
+ } = await P.api_key.create(a, c);
1445
+ S({
1446
+ id: "for-creating",
1447
+ title: "Successful",
1448
+ message: "API Key is added",
1449
+ color: "green"
1450
+ }), t(p, g);
1451
+ } catch (p) {
1452
+ S({
1453
+ id: "for-creating",
1454
+ title: "Failed",
1455
+ message: p.message,
1456
+ color: "red"
1457
+ });
1458
+ }
1459
+ }),
1460
+ children: [/* @__PURE__ */ e(m, {
1461
+ name: "name",
1462
+ control: i,
1463
+ render: ({
1464
+ field: a
1465
+ }) => /* @__PURE__ */ e(z, {
1466
+ mb: n.spacing,
1467
+ size: n.size,
1468
+ required: !0,
1469
+ label: "Name",
1470
+ ...a
1471
+ })
1472
+ }), /* @__PURE__ */ e(m, {
1473
+ name: "role_id",
1474
+ control: i,
1475
+ render: ({
1476
+ field: a
1477
+ }) => /* @__PURE__ */ e(Y, {
1478
+ styles: n,
1479
+ ...a
1480
+ })
1481
+ }), /* @__PURE__ */ e(w, {
1482
+ position: "right",
1483
+ mt: n.spacing,
1484
+ children: /* @__PURE__ */ e(b, {
1485
+ type: "submit",
1486
+ size: n.button.size,
1487
+ children: "Save"
1488
+ })
1489
+ })]
1490
+ })
1491
+ });
990
1492
  }
991
1493
  function $e({
992
1494
  onSuccess: t,
993
- styles: n = M,
1495
+ styles: n = U,
994
1496
  initialRoleID: r
995
1497
  }) {
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({
1002
- 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: {
1006
- input: {
1007
- cursor: "text !important"
1498
+ const i = j(), [s, o] = E.useState(!1), a = () => o(!0), c = () => o(!1);
1499
+ return /* @__PURE__ */ d(C, {
1500
+ children: [/* @__PURE__ */ e(R, {
1501
+ overflow: "inside",
1502
+ opened: s,
1503
+ onClose: () => o(!1),
1504
+ title: "Add an API Key",
1505
+ trapFocus: !0,
1506
+ onDragStart: (g) => {
1507
+ g.stopPropagation();
1508
+ },
1509
+ children: /* @__PURE__ */ e(He, {
1510
+ postSubmit: (g, h) => {
1511
+ c(), i.openModal({
1512
+ title: "API Key is generated",
1513
+ children: /* @__PURE__ */ d(B, {
1514
+ children: [/* @__PURE__ */ e(L, {
1515
+ color: "dimmed",
1516
+ children: "Make sure you save it - you won't be able to access it again."
1517
+ }), /* @__PURE__ */ e(z, {
1518
+ defaultValue: g,
1519
+ disabled: !0,
1520
+ label: "APP ID",
1521
+ styles: {
1522
+ input: {
1523
+ cursor: "text !important"
1524
+ }
1525
+ }
1526
+ }), /* @__PURE__ */ e(z, {
1527
+ defaultValue: h,
1528
+ disabled: !0,
1529
+ label: "APP Secret",
1530
+ styles: {
1531
+ input: {
1532
+ cursor: "text !important"
1533
+ }
1534
+ }
1535
+ }), /* @__PURE__ */ e(b, {
1536
+ size: "sm",
1537
+ onClick: () => {
1538
+ Se();
1539
+ },
1540
+ children: "I've saved this API Key"
1541
+ })]
1542
+ }),
1543
+ onClose: () => {
1544
+ t();
1008
1545
  }
1009
- } }),
1010
- /* @__PURE__ */ e(z, { defaultValue: l, disabled: !0, label: "APP Secret", styles: {
1011
- input: {
1012
- cursor: "text !important"
1013
- }
1014
- } }),
1015
- /* @__PURE__ */ e(b, { size: "sm", onClick: () => {
1016
- Se();
1017
- }, children: "I've saved this API Key" })
1018
- ] }),
1019
- onClose: () => {
1020
- t();
1021
- }
1022
- });
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" })
1025
- ] });
1546
+ });
1547
+ },
1548
+ styles: n,
1549
+ initialRoleID: r
1550
+ })
1551
+ }), /* @__PURE__ */ e(b, {
1552
+ size: n.button.size,
1553
+ onClick: a,
1554
+ leftIcon: /* @__PURE__ */ e(Q, {
1555
+ size: 20
1556
+ }),
1557
+ children: "Add an API Key"
1558
+ })]
1559
+ });
1026
1560
  }
1027
1561
  function Ge({
1028
1562
  id: t,
1029
1563
  name: n,
1030
1564
  onSuccess: r,
1031
- styles: i = M
1565
+ styles: i = U
1032
1566
  }) {
1033
- const s = E(), o = async () => {
1034
- if (t) {
1567
+ const s = j(), o = async () => {
1568
+ if (!!t) {
1035
1569
  _({
1036
1570
  id: "for-deleting",
1037
1571
  title: "Pending",
@@ -1063,69 +1597,116 @@ function Ge({
1063
1597
  onCancel: () => console.log("Cancel"),
1064
1598
  onConfirm: o
1065
1599
  });
1066
- return /* @__PURE__ */ e(b, { size: i.button.size, color: "red", onClick: a, leftIcon: /* @__PURE__ */ e(W, { size: 20 }), children: "Delete" });
1600
+ return /* @__PURE__ */ e(b, {
1601
+ size: i.button.size,
1602
+ color: "red",
1603
+ onClick: a,
1604
+ leftIcon: /* @__PURE__ */ e(W, {
1605
+ size: 20
1606
+ }),
1607
+ children: "Delete"
1608
+ });
1067
1609
  }
1068
1610
  function ct({
1069
- styles: t = M,
1611
+ styles: t = U,
1070
1612
  config: n
1071
1613
  }) {
1072
- var g;
1073
- j(n);
1614
+ var g, h;
1615
+ M(n);
1074
1616
  const {
1075
1617
  data: r = [],
1076
1618
  loading: i,
1077
1619
  refresh: s
1078
1620
  } = T(async () => {
1079
1621
  const {
1080
- data: l
1622
+ data: u
1081
1623
  } = await P.api_key.list();
1082
- return l;
1624
+ return u;
1083
1625
  }, {
1084
1626
  refreshDeps: []
1085
1627
  }), {
1086
1628
  data: o = [],
1087
1629
  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
1093
- // SUPERADMIN
1630
+ } = T(async () => (await P.role.list()).map((l) => ({
1631
+ label: l.name,
1632
+ value: l.id,
1633
+ description: l.description,
1634
+ disabled: l.id === 50
1094
1635
  })), {
1095
1636
  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: {
1100
- position: "relative"
1101
- }, 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" })
1109
- ] }) }),
1110
- /* @__PURE__ */ e("tbody", { children: r.map((l) => {
1111
- 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);
1123
- }) })
1124
- ] })
1125
- ] })
1126
- ] });
1637
+ }), c = te(() => o.reduce((u, l) => (u.set(l.value, l.label), u), /* @__PURE__ */ new Map()), [o]), p = (u) => {
1638
+ var l;
1639
+ return (l = c.get(u)) != null ? l : u;
1640
+ };
1641
+ return /* @__PURE__ */ d(C, {
1642
+ children: [/* @__PURE__ */ e(w, {
1643
+ pt: t.spacing,
1644
+ position: "right",
1645
+ children: /* @__PURE__ */ e($e, {
1646
+ onSuccess: s,
1647
+ initialRoleID: (h = (g = o == null ? void 0 : o[0]) == null ? void 0 : g.value) != null ? h : 0
1648
+ })
1649
+ }), /* @__PURE__ */ d(v, {
1650
+ mt: t.spacing,
1651
+ sx: {
1652
+ position: "relative"
1653
+ },
1654
+ children: [/* @__PURE__ */ e(H, {
1655
+ visible: i || a
1656
+ }), /* @__PURE__ */ d($, {
1657
+ horizontalSpacing: t.spacing,
1658
+ verticalSpacing: t.spacing,
1659
+ fontSize: t.size,
1660
+ highlightOnHover: !0,
1661
+ children: [/* @__PURE__ */ e("thead", {
1662
+ children: /* @__PURE__ */ d("tr", {
1663
+ children: [/* @__PURE__ */ e("th", {
1664
+ children: "Name"
1665
+ }), /* @__PURE__ */ e("th", {
1666
+ children: "APP ID"
1667
+ }), /* @__PURE__ */ e("th", {
1668
+ children: "Role"
1669
+ }), /* @__PURE__ */ e("th", {
1670
+ children: "Action"
1671
+ })]
1672
+ })
1673
+ }), /* @__PURE__ */ e("tbody", {
1674
+ children: r.map((u) => {
1675
+ const {
1676
+ id: l,
1677
+ name: A,
1678
+ app_id: k,
1679
+ role_id: x
1680
+ } = u;
1681
+ return /* @__PURE__ */ d("tr", {
1682
+ children: [/* @__PURE__ */ e("td", {
1683
+ width: 200,
1684
+ children: A
1685
+ }), /* @__PURE__ */ e("td", {
1686
+ width: 200,
1687
+ children: k
1688
+ }), /* @__PURE__ */ e("td", {
1689
+ width: 200,
1690
+ children: p(x)
1691
+ }), /* @__PURE__ */ e("td", {
1692
+ width: 200,
1693
+ children: /* @__PURE__ */ e(w, {
1694
+ position: "left",
1695
+ children: /* @__PURE__ */ e(Ge, {
1696
+ id: l,
1697
+ name: A,
1698
+ onSuccess: s
1699
+ })
1700
+ })
1701
+ })]
1702
+ }, l);
1703
+ })
1704
+ })]
1705
+ })]
1706
+ })]
1707
+ });
1127
1708
  }
1128
- const lt = () => import("./package-b31012f7.mjs").then(({
1709
+ const lt = () => import("./package.5579293f.mjs").then(({
1129
1710
  version: t
1130
1711
  }) => (console.log(`[@devtable/dashboard] version: ${t}`), t));
1131
1712
  export {