@v1ct0rbr/minivault-web 0.4.2 → 0.5.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.
@@ -135,6 +135,9 @@ var h = class extends Error {
135
135
  listDbRelationships() {
136
136
  return this.request("/api/db/relationships");
137
137
  }
138
+ getDiagnostics() {
139
+ return this.request("/api/diagnostics");
140
+ }
138
141
  listStorageFiles(e, t, n) {
139
142
  let r = new URLSearchParams({ type: e });
140
143
  return t && r.set("prefix", t), n && (n.endpoint && r.set("endpoint", n.endpoint), n.bucketName && r.set("bucketName", n.bucketName), n.accessKey && r.set("accessKey", n.accessKey), n.secretKey && r.set("secretKey", n.secretKey), n.region && r.set("region", n.region), n.pathStyleEnabled && r.set("pathStyleEnabled", "true"), n.localPath && r.set("localPath", n.localPath)), this.request(`/api/storage/files?${r.toString()}`);
@@ -202,9 +205,18 @@ function x() {
202
205
  //#region src/hooks/useBackups.ts
203
206
  var S = {
204
207
  all: ["minivault", "backups"],
205
- db: ["minivault", "db"]
208
+ db: ["minivault", "db"],
209
+ diagnostics: ["minivault", "diagnostics"]
206
210
  };
207
- function C(e = 0, t = 10, n = !0) {
211
+ function C(e = !0) {
212
+ let t = x();
213
+ return u({
214
+ queryKey: S.diagnostics,
215
+ queryFn: () => t.getDiagnostics(),
216
+ enabled: e && !!t
217
+ });
218
+ }
219
+ function w(e = 0, t = 10, n = !0) {
208
220
  let r = x();
209
221
  return u({
210
222
  queryKey: [
@@ -216,7 +228,7 @@ function C(e = 0, t = 10, n = !0) {
216
228
  enabled: n && !!r
217
229
  });
218
230
  }
219
- function w(e = !0) {
231
+ function T(e = !0) {
220
232
  let t = x();
221
233
  return u({
222
234
  queryKey: [...S.db, "info"],
@@ -224,7 +236,7 @@ function w(e = !0) {
224
236
  enabled: e && !!t
225
237
  });
226
238
  }
227
- function T(e = !0) {
239
+ function E(e = !0) {
228
240
  let t = x();
229
241
  return u({
230
242
  queryKey: [...S.db, "tables"],
@@ -232,7 +244,7 @@ function T(e = !0) {
232
244
  enabled: e && !!t
233
245
  });
234
246
  }
235
- function E(e, t = !0) {
247
+ function D(e, t = !0) {
236
248
  let n = x();
237
249
  return u({
238
250
  queryKey: [
@@ -244,7 +256,7 @@ function E(e, t = !0) {
244
256
  enabled: t && !!n && !!e
245
257
  });
246
258
  }
247
- function D(e = !0) {
259
+ function O(e = !0) {
248
260
  let t = x();
249
261
  return u({
250
262
  queryKey: [...S.db, "relationships"],
@@ -252,74 +264,74 @@ function D(e = !0) {
252
264
  enabled: e && !!t
253
265
  });
254
266
  }
255
- function O() {
267
+ function k() {
256
268
  let e = b(), t = d();
257
269
  return l({
258
270
  mutationFn: (t) => e.createBackup(t.database, t.originStorage, t.dumpOptions),
259
271
  onSuccess: () => t.invalidateQueries({ queryKey: S.all })
260
272
  });
261
273
  }
262
- function k() {
274
+ function A() {
263
275
  let e = b(), t = d();
264
276
  return l({
265
277
  mutationFn: (t) => e.restoreBackup(t.id, t.database, t.originStorage),
266
278
  onSuccess: () => t.invalidateQueries({ queryKey: S.all })
267
279
  });
268
280
  }
269
- function A() {
281
+ function j() {
270
282
  let e = b(), t = d();
271
283
  return l({
272
284
  mutationFn: (t) => e.deleteBackup(t),
273
285
  onSuccess: () => t.invalidateQueries({ queryKey: S.all })
274
286
  });
275
287
  }
276
- function j() {
288
+ function M() {
277
289
  let e = b(), t = d();
278
290
  return l({
279
291
  mutationFn: (t) => e.verifyBackup(t),
280
292
  onSuccess: () => t.invalidateQueries({ queryKey: S.all })
281
293
  });
282
294
  }
283
- function M() {
295
+ function N() {
284
296
  let e = b();
285
297
  return l({ mutationFn: (t) => e.downloadBackup(t.id) });
286
298
  }
287
- function N() {
299
+ function P() {
288
300
  let e = b();
289
301
  return l({ mutationFn: (t) => e.importDump(t.file, t.database) });
290
302
  }
291
- function P() {
303
+ function F() {
292
304
  let e = b();
293
305
  return l({ mutationFn: (t) => e.importFromStorage(t.storageType, t.storagePath, t.database, t.storageConfig) });
294
306
  }
295
307
  //#endregion
296
308
  //#region src/utils/format.ts
297
- var F = new Intl.DateTimeFormat("pt-BR", {
309
+ var I = new Intl.DateTimeFormat("pt-BR", {
298
310
  day: "2-digit",
299
311
  month: "2-digit",
300
312
  year: "numeric",
301
313
  hour: "2-digit",
302
314
  minute: "2-digit"
303
- }), I = [
315
+ }), L = [
304
316
  "B",
305
317
  "KB",
306
318
  "MB",
307
319
  "GB",
308
320
  "TB"
309
321
  ];
310
- function L(e) {
322
+ function R(e) {
311
323
  if (e == null || e < 0) return "—";
312
324
  if (e < 1024) return `${e} B`;
313
325
  let t = e, n = 0;
314
- for (; t >= 1024 && n < I.length - 1;) t /= 1024, n += 1;
315
- return `${Number.isInteger(t) ? t : Number(t.toFixed(1))} ${I[n]}`;
326
+ for (; t >= 1024 && n < L.length - 1;) t /= 1024, n += 1;
327
+ return `${Number.isInteger(t) ? t : Number(t.toFixed(1))} ${L[n]}`;
316
328
  }
317
- function R(e) {
329
+ function z(e) {
318
330
  if (!e) return "—";
319
331
  let t = new Date(e);
320
- return Number.isNaN(t.getTime()) ? "—" : F.format(t);
332
+ return Number.isNaN(t.getTime()) ? "—" : I.format(t);
321
333
  }
322
- var z = {
334
+ var B = {
323
335
  PENDING: "Pendente",
324
336
  IN_PROGRESS: "Em andamento",
325
337
  COMPLETED: "Concluído",
@@ -327,7 +339,7 @@ var z = {
327
339
  RESTORING: "Restaurando",
328
340
  RESTORED: "Restaurado",
329
341
  RESTORE_FAILED: "Falha na restauração"
330
- }, B = {
342
+ }, V = {
331
343
  PENDING: "text-bg-secondary",
332
344
  IN_PROGRESS: "text-bg-primary",
333
345
  COMPLETED: "text-bg-success",
@@ -335,7 +347,7 @@ var z = {
335
347
  RESTORING: "text-bg-warning",
336
348
  RESTORED: "text-bg-info",
337
349
  RESTORE_FAILED: "text-bg-danger"
338
- }, V = {
350
+ }, H = {
339
351
  postgresql: "PostgreSQL",
340
352
  postgres: "PostgreSQL",
341
353
  mysql: "MySQL",
@@ -344,8 +356,8 @@ var z = {
344
356
  };
345
357
  //#endregion
346
358
  //#region src/components/StatusBadge.tsx
347
- function H({ status: e }) {
348
- let t = B[e] ?? "text-bg-secondary", n = z[e] ?? e;
359
+ function U({ status: e }) {
360
+ let t = V[e] ?? "text-bg-secondary", n = B[e] ?? e;
349
361
  return /* @__PURE__ */ p("span", {
350
362
  className: `badge rounded-pill ${t}`,
351
363
  children: n
@@ -353,7 +365,7 @@ function H({ status: e }) {
353
365
  }
354
366
  //#endregion
355
367
  //#region src/components/DatabaseBanner.tsx
356
- function U({ dbInfo: e, isLoading: t, error: n, label: r }) {
368
+ function W({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
357
369
  if (t) return /* @__PURE__ */ p("div", {
358
370
  className: "mb-3",
359
371
  children: /* @__PURE__ */ m("small", {
@@ -372,10 +384,16 @@ function U({ dbInfo: e, isLoading: t, error: n, label: r }) {
372
384
  "aria-hidden": !0
373
385
  }),
374
386
  "Não foi possível consultar o banco configurado: ",
375
- G(n)
387
+ K(n)
376
388
  ]
377
389
  });
378
- if (!e || !e.configured) return /* @__PURE__ */ m("div", {
390
+ if (!e || !e.configured) return i ? /* @__PURE__ */ m("div", {
391
+ className: "alert alert-danger mb-3 py-2 small",
392
+ children: [/* @__PURE__ */ p("i", {
393
+ className: "bi bi-x-octagon me-2",
394
+ "aria-hidden": !0
395
+ }), "Banco do servidor não configurado. Não é possível criar backups."]
396
+ }) : /* @__PURE__ */ m("div", {
379
397
  className: "alert alert-danger mb-3 py-2 small",
380
398
  children: [
381
399
  /* @__PURE__ */ p("i", {
@@ -388,8 +406,57 @@ function U({ dbInfo: e, isLoading: t, error: n, label: r }) {
388
406
  "). A criação e a importação usam esse banco."
389
407
  ]
390
408
  });
391
- let i = V[e.databaseType ?? ""] ?? e.databaseType ?? "postgresql";
392
- return /* @__PURE__ */ m("div", {
409
+ let a = H[e.databaseType ?? ""] ?? e.databaseType ?? "postgresql";
410
+ return i ? /* @__PURE__ */ m("div", {
411
+ className: "mb-3",
412
+ children: [
413
+ /* @__PURE__ */ m("div", {
414
+ className: "d-flex flex-wrap align-items-center gap-2 small text-body-secondary",
415
+ children: [/* @__PURE__ */ p("i", {
416
+ className: "bi bi-database-check text-success",
417
+ "aria-hidden": !0
418
+ }), /* @__PURE__ */ m("span", { children: [
419
+ r,
420
+ ": ",
421
+ /* @__PURE__ */ p("strong", { children: "banco do servidor disponível" })
422
+ ] })]
423
+ }),
424
+ e.exportExcludedTables.length > 0 && /* @__PURE__ */ m("div", {
425
+ className: "mt-1 small",
426
+ children: [
427
+ /* @__PURE__ */ p("i", {
428
+ className: "bi bi-shield-lock me-1",
429
+ "aria-hidden": !0
430
+ }),
431
+ /* @__PURE__ */ p("span", {
432
+ className: "text-body-secondary",
433
+ children: "Exportação sempre ignora: "
434
+ }),
435
+ e.exportExcludedTables.map((e) => /* @__PURE__ */ p("span", {
436
+ className: "badge text-bg-secondary me-1",
437
+ children: e
438
+ }, `ex-${e}`))
439
+ ]
440
+ }),
441
+ e.importExcludedTables.length > 0 && /* @__PURE__ */ m("div", {
442
+ className: "mt-1 small",
443
+ children: [
444
+ /* @__PURE__ */ p("i", {
445
+ className: "bi bi-shield-lock me-1",
446
+ "aria-hidden": !0
447
+ }),
448
+ /* @__PURE__ */ p("span", {
449
+ className: "text-body-secondary",
450
+ children: "Importação sempre ignora: "
451
+ }),
452
+ e.importExcludedTables.map((e) => /* @__PURE__ */ p("span", {
453
+ className: "badge text-bg-secondary me-1",
454
+ children: e
455
+ }, `im-${e}`))
456
+ ]
457
+ })
458
+ ]
459
+ }) : /* @__PURE__ */ m("div", {
393
460
  className: "mb-3",
394
461
  children: [
395
462
  /* @__PURE__ */ m("div", {
@@ -402,7 +469,7 @@ function U({ dbInfo: e, isLoading: t, error: n, label: r }) {
402
469
  /* @__PURE__ */ m("span", { children: [
403
470
  r,
404
471
  ": ",
405
- /* @__PURE__ */ p("strong", { children: i }),
472
+ /* @__PURE__ */ p("strong", { children: a }),
406
473
  " em ",
407
474
  /* @__PURE__ */ m("code", { children: [
408
475
  e.host,
@@ -457,8 +524,8 @@ function U({ dbInfo: e, isLoading: t, error: n, label: r }) {
457
524
  }
458
525
  //#endregion
459
526
  //#region src/components/RestoreModal.tsx
460
- function W({ backup: e, onClose: t }) {
461
- let n = k(), r = w(), i = () => {
527
+ function G({ backup: e, onClose: t }) {
528
+ let n = A(), r = T(), i = () => {
462
529
  n.mutate({ id: e.id });
463
530
  }, a = n.isPending;
464
531
  return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "modal-backdrop show" }), /* @__PURE__ */ p("div", {
@@ -504,7 +571,7 @@ function W({ backup: e, onClose: t }) {
504
571
  " será aplicado no banco configurado abaixo."
505
572
  ]
506
573
  }),
507
- /* @__PURE__ */ p(U, {
574
+ /* @__PURE__ */ p(W, {
508
575
  label: "Banco de destino",
509
576
  dbInfo: r.data,
510
577
  isLoading: r.isLoading,
@@ -515,7 +582,7 @@ function W({ backup: e, onClose: t }) {
515
582
  children: [/* @__PURE__ */ p("i", {
516
583
  className: "bi bi-x-circle me-2",
517
584
  "aria-hidden": !0
518
- }), G(n.error)]
585
+ }), K(n.error)]
519
586
  }),
520
587
  n.isSuccess && /* @__PURE__ */ m("div", {
521
588
  className: "alert alert-success mt-3 mb-0",
@@ -550,19 +617,19 @@ function W({ backup: e, onClose: t }) {
550
617
  })
551
618
  })] });
552
619
  }
553
- function G(e) {
620
+ function K(e) {
554
621
  return e instanceof Error ? e.message : String(e);
555
622
  }
556
623
  //#endregion
557
624
  //#region src/components/BackupsTab.tsx
558
- function K() {
559
- let [e, t] = o(0), [n, a] = o(null), [s, c] = o(null), [l, u] = o({}), { data: d, isLoading: f, isError: h, error: g, refetch: _, isFetching: v } = C(e, 10, !0), y = M(), b = A(), x = j();
625
+ function q() {
626
+ let [e, t] = o(0), [n, a] = o(null), [s, c] = o(null), [l, u] = o({}), { data: d, isLoading: f, isError: h, error: g, refetch: _, isFetching: v } = w(e, 10, !0), y = N(), b = j(), x = M();
560
627
  r(() => {
561
628
  if (!y.data || !y.variables) return;
562
629
  let e = URL.createObjectURL(y.data), t = document.createElement("a");
563
630
  t.href = e, t.download = y.variables.filename, document.body.appendChild(t), t.click(), t.remove(), setTimeout(() => URL.revokeObjectURL(e), 1e4);
564
631
  }, [y.data, y.variables]);
565
- let S = i(() => d?.content ?? [], [d]), w = d?.totalPages ?? 0;
632
+ let S = i(() => d?.content ?? [], [d]), C = d?.totalPages ?? 0;
566
633
  return /* @__PURE__ */ m("div", { children: [
567
634
  /* @__PURE__ */ m("div", {
568
635
  className: "d-flex align-items-center justify-content-between flex-wrap gap-2 mb-3",
@@ -719,12 +786,12 @@ function K() {
719
786
  "aria-hidden": !0
720
787
  }), e.filename]
721
788
  }),
722
- /* @__PURE__ */ p("td", { children: V[e.databaseType] ?? e.databaseType }),
789
+ /* @__PURE__ */ p("td", { children: H[e.databaseType] ?? e.databaseType }),
723
790
  /* @__PURE__ */ p("td", {
724
791
  className: "text-end",
725
- children: L(e.fileSize)
792
+ children: R(e.fileSize)
726
793
  }),
727
- /* @__PURE__ */ p("td", { children: /* @__PURE__ */ p(H, { status: e.status }) }),
794
+ /* @__PURE__ */ p("td", { children: /* @__PURE__ */ p(U, { status: e.status }) }),
728
795
  /* @__PURE__ */ p("td", { children: e.sha256 ? /* @__PURE__ */ m("code", {
729
796
  title: e.sha256,
730
797
  style: { fontSize: "0.8em" },
@@ -747,7 +814,7 @@ function K() {
747
814
  className: "text-muted",
748
815
  children: "—"
749
816
  }) }),
750
- /* @__PURE__ */ p("td", { children: R(e.createdAt) }),
817
+ /* @__PURE__ */ p("td", { children: z(e.createdAt) }),
751
818
  /* @__PURE__ */ m("td", {
752
819
  className: "text-end text-nowrap",
753
820
  children: [
@@ -815,7 +882,7 @@ function K() {
815
882
  "Página ",
816
883
  e + 1,
817
884
  " de ",
818
- Math.max(w, 1)
885
+ Math.max(C, 1)
819
886
  ]
820
887
  }), /* @__PURE__ */ m("div", {
821
888
  className: "btn-group",
@@ -831,7 +898,7 @@ function K() {
831
898
  }), /* @__PURE__ */ p("button", {
832
899
  type: "button",
833
900
  className: "btn btn-outline-secondary btn-sm",
834
- disabled: e + 1 >= w,
901
+ disabled: e + 1 >= C,
835
902
  onClick: () => t((e) => e + 1),
836
903
  children: /* @__PURE__ */ p("i", {
837
904
  className: "bi bi-chevron-right",
@@ -840,21 +907,21 @@ function K() {
840
907
  })]
841
908
  })]
842
909
  }),
843
- n && /* @__PURE__ */ p(W, {
910
+ n && /* @__PURE__ */ p(G, {
844
911
  backup: n,
845
912
  onClose: () => a(null)
846
913
  }),
847
- s && /* @__PURE__ */ p(q, {
914
+ s && /* @__PURE__ */ p(ee, {
848
915
  backup: s,
849
916
  busy: b.isPending,
850
917
  onCancel: () => c(null),
851
918
  onConfirm: () => {
852
- b.mutate(s.id), c(null);
919
+ b.mutate(s.id, { onSettled: () => c(null) });
853
920
  }
854
921
  })
855
922
  ] });
856
923
  }
857
- function q(e) {
924
+ function ee(e) {
858
925
  let { backup: t, busy: n, onCancel: r, onConfirm: i } = e;
859
926
  return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "modal-backdrop show" }), /* @__PURE__ */ p("div", {
860
927
  className: "modal show d-block",
@@ -926,7 +993,7 @@ function J(e) {
926
993
  //#endregion
927
994
  //#region src/components/CreateBackupTab.tsx
928
995
  function Y() {
929
- let e = O(), t = w(), n = T(t.data?.configured), [r, a] = o(!1), [s, c] = o(() => ({
996
+ let e = k(), t = T(), n = E(t.data?.configured), [r, a] = o(!1), [s, c] = o(() => ({
930
997
  type: "LOCAL",
931
998
  localPath: ""
932
999
  })), [l, u] = o(!0), [d, h] = o({
@@ -937,7 +1004,7 @@ function Y() {
937
1004
  includeIndexes: !0,
938
1005
  includeConstraints: !0,
939
1006
  includeRelatedTables: !1
940
- }), [g, _] = o(() => /* @__PURE__ */ new Set()), [v, y] = o(null), [b, x] = o({}), [S, C] = o(""), D = E(v, t.data?.configured), k = i(() => new Set((t.data?.exportExcludedTables ?? []).map(te)), [t.data?.exportExcludedTables]), A = i(() => {
1007
+ }), [g, _] = o(() => /* @__PURE__ */ new Set()), [v, y] = o(null), [b, x] = o({}), [S, C] = o(""), w = D(v, t.data?.configured), O = i(() => new Set((t.data?.exportExcludedTables ?? []).map(ne)), [t.data?.exportExcludedTables]), A = i(() => {
941
1008
  let e = n.data ?? [], t = S.trim().toLowerCase();
942
1009
  return t ? e.filter((e) => e.fullName.toLowerCase().includes(t)) : e;
943
1010
  }, [n.data, S]), j = i(() => Object.values(b).reduce((e, t) => e + t.length, 0), [b]), M = (e) => {
@@ -975,14 +1042,15 @@ function Y() {
975
1042
  children: "Criar novo backup"
976
1043
  }), /* @__PURE__ */ p("p", {
977
1044
  className: "text-muted small mb-0",
978
- children: "O minivault usa o banco configurado no servidor (via variáveis de ambiente). Selecione as tabelas no grid e expanda um card para marcar colunas cujo conteúdo será nulificado na exportação."
1045
+ children: "Selecione as tabelas no grid e expanda um card para marcar colunas cujo conteúdo será nulificado na exportação."
979
1046
  })]
980
1047
  }),
981
- /* @__PURE__ */ p(U, {
1048
+ /* @__PURE__ */ p(W, {
982
1049
  label: "Banco de origem",
983
1050
  dbInfo: t.data,
984
1051
  isLoading: t.isLoading,
985
- error: t.error
1052
+ error: t.error,
1053
+ compact: !0
986
1054
  }),
987
1055
  /* @__PURE__ */ m("div", {
988
1056
  className: "card mb-3",
@@ -996,7 +1064,7 @@ function Y() {
996
1064
  "aria-hidden": !0
997
1065
  }),
998
1066
  "Tabelas do banco (",
999
- n.data?.filter((e) => !k.has(e.fullName)).length ?? 0,
1067
+ n.data?.filter((e) => !O.has(e.fullName)).length ?? 0,
1000
1068
  " disponíveis)"
1001
1069
  ]
1002
1070
  }), /* @__PURE__ */ m("div", {
@@ -1036,7 +1104,7 @@ function Y() {
1036
1104
  "aria-hidden": !0
1037
1105
  }),
1038
1106
  "Falha ao listar tabelas: ",
1039
- G(n.error)
1107
+ K(n.error)
1040
1108
  ]
1041
1109
  }),
1042
1110
  A.length === 0 && !n.isLoading && /* @__PURE__ */ p("div", {
@@ -1052,16 +1120,16 @@ function Y() {
1052
1120
  maxHeight: 420,
1053
1121
  overflow: "auto"
1054
1122
  },
1055
- children: A.map((e) => /* @__PURE__ */ p(ee, {
1123
+ children: A.map((e) => /* @__PURE__ */ p(te, {
1056
1124
  table: e,
1057
- disabled: k.has(e.fullName),
1125
+ disabled: O.has(e.fullName),
1058
1126
  selected: g.has(e.fullName),
1059
1127
  expanded: v === e.fullName,
1060
1128
  excluded: b[e.fullName] ?? [],
1061
1129
  onToggleTable: () => M(e.fullName),
1062
1130
  onToggleExpand: () => y(v === e.fullName ? null : e.fullName),
1063
1131
  onToggleColumn: (t) => N(e.fullName, t),
1064
- detail: v === e.fullName ? D : void 0
1132
+ detail: v === e.fullName ? w : void 0
1065
1133
  }, e.fullName))
1066
1134
  }),
1067
1135
  /* @__PURE__ */ m("div", {
@@ -1374,7 +1442,7 @@ function Y() {
1374
1442
  "aria-hidden": !0
1375
1443
  }),
1376
1444
  "Falha ao criar backup: ",
1377
- G(e.error)
1445
+ K(e.error)
1378
1446
  ]
1379
1447
  }),
1380
1448
  e.isSuccess && /* @__PURE__ */ m("div", {
@@ -1413,7 +1481,7 @@ function Y() {
1413
1481
  })
1414
1482
  ] });
1415
1483
  }
1416
- function ee({ table: e, disabled: t, selected: n, expanded: r, excluded: i, detail: a, onToggleTable: o, onToggleExpand: s, onToggleColumn: c }) {
1484
+ function te({ table: e, disabled: t, selected: n, expanded: r, excluded: i, detail: a, onToggleTable: o, onToggleExpand: s, onToggleColumn: c }) {
1417
1485
  return /* @__PURE__ */ p("div", {
1418
1486
  className: `card h-100 ${n ? "border-primary" : ""}`,
1419
1487
  style: { minWidth: 0 },
@@ -1477,7 +1545,7 @@ function ee({ table: e, disabled: t, selected: n, expanded: r, excluded: i, deta
1477
1545
  }),
1478
1546
  a?.isError && /* @__PURE__ */ m("small", {
1479
1547
  className: "text-danger",
1480
- children: ["Erro: ", G(a.error)]
1548
+ children: ["Erro: ", K(a.error)]
1481
1549
  }),
1482
1550
  a?.data && /* @__PURE__ */ m(f, { children: [a.data.columns.map((e) => /* @__PURE__ */ m("div", {
1483
1551
  className: "d-flex align-items-center gap-2 py-1",
@@ -1528,50 +1596,172 @@ function ee({ table: e, disabled: t, selected: n, expanded: r, excluded: i, deta
1528
1596
  })
1529
1597
  });
1530
1598
  }
1531
- function te(e) {
1599
+ function ne(e) {
1532
1600
  let t = e.trim();
1533
1601
  return t.includes(".") ? t : `public.${t}`;
1534
1602
  }
1535
1603
  //#endregion
1604
+ //#region src/components/DiagnosticsTab.tsx
1605
+ function X() {
1606
+ let { data: e, isLoading: t, isError: n, error: r, refetch: a, isFetching: o } = C(), s = i(() => e ? {
1607
+ total: e.length,
1608
+ okCount: e.filter((e) => e.ok).length,
1609
+ notConfigured: e.filter((e) => !e.configured).length
1610
+ } : null, [e]);
1611
+ return /* @__PURE__ */ m("div", { children: [
1612
+ /* @__PURE__ */ m("div", {
1613
+ className: "d-flex align-items-center justify-content-between flex-wrap gap-2 mb-3",
1614
+ children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h5", {
1615
+ className: "mb-0",
1616
+ children: "Diagnóstico do servidor"
1617
+ }), /* @__PURE__ */ p("span", {
1618
+ className: "text-muted small",
1619
+ children: "Verifica conexões de banco, storages e servidor de e-mail configurados."
1620
+ })] }), /* @__PURE__ */ m("button", {
1621
+ type: "button",
1622
+ className: "btn btn-outline-secondary btn-sm",
1623
+ onClick: () => a(),
1624
+ disabled: o,
1625
+ children: [
1626
+ o && /* @__PURE__ */ p("span", {
1627
+ className: "spinner-border spinner-border-sm me-2",
1628
+ "aria-hidden": !0
1629
+ }),
1630
+ /* @__PURE__ */ p("i", {
1631
+ className: "bi bi-arrow-repeat me-1",
1632
+ "aria-hidden": !0
1633
+ }),
1634
+ "Executar testes novamente"
1635
+ ]
1636
+ })]
1637
+ }),
1638
+ n && /* @__PURE__ */ m("div", {
1639
+ className: "alert alert-danger",
1640
+ children: [
1641
+ /* @__PURE__ */ p("i", {
1642
+ className: "bi bi-exclamation-triangle me-2",
1643
+ "aria-hidden": !0
1644
+ }),
1645
+ "Não foi possível executar as checagens: ",
1646
+ K(r)
1647
+ ]
1648
+ }),
1649
+ s && /* @__PURE__ */ m("div", {
1650
+ className: "d-flex flex-wrap gap-2 mb-3",
1651
+ children: [
1652
+ /* @__PURE__ */ m("span", {
1653
+ className: "badge text-bg-success",
1654
+ children: [
1655
+ /* @__PURE__ */ p("i", {
1656
+ className: "bi bi-check-circle me-1",
1657
+ "aria-hidden": !0
1658
+ }),
1659
+ s.okCount,
1660
+ " OK"
1661
+ ]
1662
+ }),
1663
+ /* @__PURE__ */ m("span", {
1664
+ className: "badge text-bg-warning",
1665
+ children: [s.total - s.okCount - s.notConfigured, " com falha"]
1666
+ }),
1667
+ /* @__PURE__ */ m("span", {
1668
+ className: "badge text-bg-secondary",
1669
+ children: [s.notConfigured, " não configurado(s)"]
1670
+ })
1671
+ ]
1672
+ }),
1673
+ t && !e ? /* @__PURE__ */ m("div", {
1674
+ className: "text-center py-5 text-muted",
1675
+ children: [/* @__PURE__ */ p("div", {
1676
+ className: "spinner-border mb-2",
1677
+ "aria-hidden": !0
1678
+ }), /* @__PURE__ */ p("div", { children: "Executando checagens…" })]
1679
+ }) : /* @__PURE__ */ p("div", {
1680
+ className: "card",
1681
+ children: /* @__PURE__ */ m("ul", {
1682
+ className: "list-group list-group-flush",
1683
+ children: [(e ?? []).map((e) => /* @__PURE__ */ p(re, { check: e }, e.name)), e && e.length === 0 && /* @__PURE__ */ p("li", {
1684
+ className: "list-group-item text-center text-muted py-4",
1685
+ children: "Nenhuma checagem retornada."
1686
+ })]
1687
+ })
1688
+ })
1689
+ ] });
1690
+ }
1691
+ function re({ check: e }) {
1692
+ let t = e.configured ? e.ok ? "bi-check-circle-fill text-success" : "bi-x-octagon-fill text-danger" : "bi-dash-circle text-secondary", n = e.configured ? e.ok ? "text-bg-success" : "text-bg-danger" : "text-bg-secondary", r = e.configured ? e.ok ? "OK" : "Falha" : "Não configurado";
1693
+ return /* @__PURE__ */ m("li", {
1694
+ className: "list-group-item d-flex align-items-start gap-3",
1695
+ children: [/* @__PURE__ */ p("i", {
1696
+ className: `bi ${t} fs-4 mt-1`,
1697
+ "aria-hidden": !0
1698
+ }), /* @__PURE__ */ m("div", {
1699
+ className: "flex-grow-1",
1700
+ style: { minWidth: 0 },
1701
+ children: [/* @__PURE__ */ m("div", {
1702
+ className: "d-flex align-items-center flex-wrap gap-2",
1703
+ children: [
1704
+ /* @__PURE__ */ p("strong", { children: e.label }),
1705
+ /* @__PURE__ */ p("span", {
1706
+ className: "badge text-bg-light border",
1707
+ children: e.type
1708
+ }),
1709
+ /* @__PURE__ */ p("span", {
1710
+ className: `badge ${n}`,
1711
+ children: r
1712
+ }),
1713
+ /* @__PURE__ */ m("small", {
1714
+ className: "text-muted",
1715
+ children: [e.latencyMs, " ms"]
1716
+ })
1717
+ ]
1718
+ }), /* @__PURE__ */ p("div", {
1719
+ className: "small text-muted mt-1",
1720
+ children: e.message
1721
+ })]
1722
+ })]
1723
+ });
1724
+ }
1725
+ //#endregion
1536
1726
  //#region src/components/StorageExplorerTab.tsx
1537
- function X({ storageType: e = "LOCAL", storageConfig: n }) {
1538
- let i = b(), a = d(), [s, c] = o(""), [h, g] = o([]), [_, v] = o(/* @__PURE__ */ new Set()), [y, x] = o(null), S = n?.type ?? e, { data: C, isLoading: w } = u({
1727
+ function Z({ storageType: e = "LOCAL", storageConfig: n }) {
1728
+ let i = b(), s = d(), [c, h] = o(""), [g, _] = o([]), [v, y] = o(/* @__PURE__ */ new Set()), [x, S] = o(null), C = n?.type ?? e, { data: w, isLoading: T } = u({
1539
1729
  queryKey: [
1540
1730
  "storage-files",
1541
- S,
1542
- s,
1731
+ C,
1732
+ c,
1543
1733
  n
1544
1734
  ],
1545
- queryFn: () => i.listStorageFiles(S, s || void 0, n)
1546
- }), T = l({
1547
- mutationFn: (e) => i.deleteStorageFile(e, S, n),
1735
+ queryFn: () => i.listStorageFiles(C, c || void 0, n)
1736
+ }), E = l({
1737
+ mutationFn: (e) => i.deleteStorageFile(e, C, n),
1548
1738
  onSuccess: () => {
1549
- a.invalidateQueries({ queryKey: ["storage-files"] }), x(null);
1739
+ s.invalidateQueries({ queryKey: ["storage-files"] }), S(null);
1550
1740
  }
1551
- }), E = t((e) => {
1552
- c(e), g(e ? e.split("/").filter(Boolean) : []), v(/* @__PURE__ */ new Set());
1553
- }, []), D = t((e) => {
1554
- let t = h.slice(0, e + 1).join("/");
1555
- E(t);
1556
- }, [h, E]);
1741
+ }), D = a(!1), O = t((e) => {
1742
+ h(e), _(e ? e.split("/").filter(Boolean) : []), y(/* @__PURE__ */ new Set());
1743
+ }, []), k = t((e) => {
1744
+ let t = g.slice(0, e + 1).join("/");
1745
+ O(t);
1746
+ }, [g, O]);
1557
1747
  r(() => {
1558
- g(s ? s.split("/").filter(Boolean) : []);
1559
- }, [s]);
1560
- let O = (e) => {
1561
- v((t) => {
1748
+ _(c ? c.split("/").filter(Boolean) : []);
1749
+ }, [c]);
1750
+ let A = (e) => {
1751
+ y((t) => {
1562
1752
  let n = new Set(t);
1563
1753
  return n.has(e) ? n.delete(e) : n.add(e), n;
1564
1754
  });
1565
- }, k = () => {
1566
- C && (_.size === C.length ? v(/* @__PURE__ */ new Set()) : v(new Set(C.map((e) => e.path))));
1567
- }, A = async (e) => {
1755
+ }, j = () => {
1756
+ w && (v.size === w.length ? y(/* @__PURE__ */ new Set()) : y(new Set(w.map((e) => e.path))));
1757
+ }, M = async (e) => {
1568
1758
  try {
1569
- let t = await i.downloadStorageFile(e, S, n), r = e.split("/").pop() ?? e, a = window.URL.createObjectURL(t), o = document.createElement("a");
1759
+ let t = await i.downloadStorageFile(e, C, n), r = e.split("/").pop() ?? e, a = window.URL.createObjectURL(t), o = document.createElement("a");
1570
1760
  o.href = a, o.download = r, document.body.appendChild(o), o.click(), o.remove(), window.URL.revokeObjectURL(a);
1571
1761
  } catch {}
1572
- }, j = async () => {
1573
- for (let e of _) await A(e);
1574
- }, M = (e) => e ? R(e) : "-";
1762
+ }, N = async () => {
1763
+ for (let e of v) await M(e);
1764
+ }, P = (e) => e ? z(e) : "-";
1575
1765
  return /* @__PURE__ */ m("div", {
1576
1766
  className: "space-y-3",
1577
1767
  children: [
@@ -1584,27 +1774,27 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1584
1774
  "Explorador de Storage",
1585
1775
  /* @__PURE__ */ p("span", {
1586
1776
  className: "badge bg-secondary ms-2",
1587
- children: S
1777
+ children: C
1588
1778
  })
1589
1779
  ]
1590
1780
  }), /* @__PURE__ */ p("div", {
1591
1781
  className: "d-flex gap-2",
1592
- children: _.size > 0 && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("button", {
1782
+ children: v.size > 0 && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("button", {
1593
1783
  className: "btn btn-sm btn-outline-primary",
1594
- onClick: j,
1784
+ onClick: N,
1595
1785
  children: [
1596
1786
  /* @__PURE__ */ p("i", { className: "bi bi-download me-1" }),
1597
1787
  "Baixar (",
1598
- _.size,
1788
+ v.size,
1599
1789
  ")"
1600
1790
  ]
1601
1791
  }), /* @__PURE__ */ m("button", {
1602
1792
  className: "btn btn-sm btn-outline-danger",
1603
- onClick: () => x("multiple"),
1793
+ onClick: () => S("multiple"),
1604
1794
  children: [
1605
1795
  /* @__PURE__ */ p("i", { className: "bi bi-trash me-1" }),
1606
1796
  "Excluir (",
1607
- _.size,
1797
+ v.size,
1608
1798
  ")"
1609
1799
  ]
1610
1800
  })] })
@@ -1615,19 +1805,19 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1615
1805
  children: /* @__PURE__ */ m("ol", {
1616
1806
  className: "breadcrumb mb-0 small",
1617
1807
  children: [/* @__PURE__ */ p("li", {
1618
- className: `breadcrumb-item ${h.length === 0 ? "active" : ""}`,
1619
- style: { cursor: h.length > 0 ? "pointer" : "default" },
1620
- onClick: () => E(""),
1808
+ className: `breadcrumb-item ${g.length === 0 ? "active" : ""}`,
1809
+ style: { cursor: g.length > 0 ? "pointer" : "default" },
1810
+ onClick: () => O(""),
1621
1811
  children: /* @__PURE__ */ p("i", { className: "bi bi-house" })
1622
- }), h.map((e, t) => /* @__PURE__ */ p("li", {
1623
- className: `breadcrumb-item ${t === h.length - 1 ? "active" : ""}`,
1624
- style: { cursor: t < h.length - 1 ? "pointer" : "default" },
1625
- onClick: () => t < h.length - 1 && D(t),
1812
+ }), g.map((e, t) => /* @__PURE__ */ p("li", {
1813
+ className: `breadcrumb-item ${t === g.length - 1 ? "active" : ""}`,
1814
+ style: { cursor: t < g.length - 1 ? "pointer" : "default" },
1815
+ onClick: () => t < g.length - 1 && k(t),
1626
1816
  children: e
1627
1817
  }, t))]
1628
1818
  })
1629
1819
  }),
1630
- w ? /* @__PURE__ */ m("div", {
1820
+ T ? /* @__PURE__ */ m("div", {
1631
1821
  className: "text-center py-5",
1632
1822
  children: [/* @__PURE__ */ p("div", {
1633
1823
  className: "spinner-border text-primary",
@@ -1636,14 +1826,14 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1636
1826
  className: "mt-2 small text-muted",
1637
1827
  children: "Carregando arquivos..."
1638
1828
  })]
1639
- }) : !C || C.length === 0 ? /* @__PURE__ */ m("div", {
1829
+ }) : !w || w.length === 0 ? /* @__PURE__ */ m("div", {
1640
1830
  className: "text-center py-5 text-muted",
1641
1831
  children: [
1642
1832
  /* @__PURE__ */ p("i", { className: "bi bi-folder-x fs-1 d-block mb-2" }),
1643
1833
  "Nenhum arquivo encontrado",
1644
- s && /* @__PURE__ */ p("button", {
1834
+ c && /* @__PURE__ */ p("button", {
1645
1835
  className: "btn btn-sm btn-link mt-2",
1646
- onClick: () => E(""),
1836
+ onClick: () => O(""),
1647
1837
  children: "Voltar ao inicio"
1648
1838
  })
1649
1839
  ]
@@ -1651,11 +1841,11 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1651
1841
  className: "d-flex align-items-center gap-2 mb-2",
1652
1842
  children: [/* @__PURE__ */ m("button", {
1653
1843
  className: "btn btn-sm btn-outline-secondary",
1654
- onClick: k,
1655
- children: [_.size === C.length ? "Desmarcar" : "Selecionar", " Todos"]
1844
+ onClick: j,
1845
+ children: [v.size === w.length ? "Desmarcar" : "Selecionar", " Todos"]
1656
1846
  }), /* @__PURE__ */ m("span", {
1657
1847
  className: "small text-muted",
1658
- children: [C.length, " item(ns)"]
1848
+ children: [w.length, " item(ns)"]
1659
1849
  })]
1660
1850
  }), /* @__PURE__ */ p("div", {
1661
1851
  className: "table-responsive",
@@ -1679,18 +1869,18 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1679
1869
  children: "Acoes"
1680
1870
  })
1681
1871
  ] })
1682
- }), /* @__PURE__ */ p("tbody", { children: C.map((e) => /* @__PURE__ */ m("tr", {
1683
- className: _.has(e.path) ? "table-active" : "",
1872
+ }), /* @__PURE__ */ p("tbody", { children: w.map((e) => /* @__PURE__ */ m("tr", {
1873
+ className: v.has(e.path) ? "table-active" : "",
1684
1874
  children: [
1685
1875
  /* @__PURE__ */ p("td", { children: /* @__PURE__ */ p("input", {
1686
1876
  type: "checkbox",
1687
1877
  className: "form-check-input",
1688
- checked: _.has(e.path),
1689
- onChange: () => O(e.path)
1878
+ checked: v.has(e.path),
1879
+ onChange: () => A(e.path)
1690
1880
  }) }),
1691
1881
  /* @__PURE__ */ p("td", { children: e.directory ? /* @__PURE__ */ m("button", {
1692
1882
  className: "btn btn-sm btn-link text-decoration-none p-0 text-start",
1693
- onClick: () => E(e.path),
1883
+ onClick: () => O(e.path),
1694
1884
  children: [/* @__PURE__ */ p("i", { className: "bi bi-folder-fill text-warning me-2" }), /* @__PURE__ */ p("span", {
1695
1885
  className: "font-monospace",
1696
1886
  children: e.name
@@ -1701,23 +1891,23 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1701
1891
  }) }),
1702
1892
  /* @__PURE__ */ p("td", {
1703
1893
  className: "text-muted small",
1704
- children: e.directory ? "-" : L(e.size)
1894
+ children: e.directory ? "-" : R(e.size)
1705
1895
  }),
1706
1896
  /* @__PURE__ */ p("td", {
1707
1897
  className: "text-muted small",
1708
- children: M(e.lastModified)
1898
+ children: P(e.lastModified)
1709
1899
  }),
1710
1900
  /* @__PURE__ */ p("td", { children: !e.directory && /* @__PURE__ */ m("div", {
1711
1901
  className: "d-flex gap-1",
1712
1902
  children: [/* @__PURE__ */ p("button", {
1713
1903
  className: "btn btn-sm btn-outline-primary py-0",
1714
1904
  title: "Baixar",
1715
- onClick: () => A(e.path),
1905
+ onClick: () => M(e.path),
1716
1906
  children: /* @__PURE__ */ p("i", { className: "bi bi-download" })
1717
1907
  }), /* @__PURE__ */ p("button", {
1718
1908
  className: "btn btn-sm btn-outline-danger py-0",
1719
1909
  title: "Excluir",
1720
- onClick: () => x(e.path),
1910
+ onClick: () => S(e.path),
1721
1911
  children: /* @__PURE__ */ p("i", { className: "bi bi-trash" })
1722
1912
  })]
1723
1913
  }) })
@@ -1725,7 +1915,7 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1725
1915
  }, e.path)) })]
1726
1916
  })
1727
1917
  })] }),
1728
- y && /* @__PURE__ */ p("div", {
1918
+ x && /* @__PURE__ */ p("div", {
1729
1919
  className: "modal d-block",
1730
1920
  tabIndex: -1,
1731
1921
  style: { background: "rgba(0,0,0,.5)" },
@@ -1741,38 +1931,60 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1741
1931
  children: "Confirmar exclusao"
1742
1932
  }), /* @__PURE__ */ p("button", {
1743
1933
  className: "btn-close",
1744
- onClick: () => x(null)
1934
+ onClick: () => S(null)
1745
1935
  })]
1746
1936
  }),
1747
1937
  /* @__PURE__ */ m("div", {
1748
1938
  className: "modal-body",
1749
- children: [y === "multiple" ? /* @__PURE__ */ m("p", { children: [
1750
- "Excluir ",
1751
- _.size,
1752
- " arquivo(s) selecionado(s)?"
1753
- ] }) : /* @__PURE__ */ m("p", { children: [
1754
- "Excluir ",
1755
- /* @__PURE__ */ p("code", { children: y.split("/").pop() }),
1756
- "?"
1757
- ] }), /* @__PURE__ */ p("p", {
1758
- className: "text-danger small mb-0",
1759
- children: "Esta acao nao pode ser desfeita."
1760
- })]
1939
+ children: [
1940
+ x === "multiple" ? /* @__PURE__ */ m("p", { children: [
1941
+ "Excluir ",
1942
+ v.size,
1943
+ " arquivo(s) selecionado(s)?"
1944
+ ] }) : /* @__PURE__ */ m("p", { children: [
1945
+ "Excluir ",
1946
+ /* @__PURE__ */ p("code", { children: x.split("/").pop() }),
1947
+ "?"
1948
+ ] }),
1949
+ /* @__PURE__ */ p("p", {
1950
+ className: "text-danger small mb-0",
1951
+ children: "Esta acao nao pode ser desfeita."
1952
+ }),
1953
+ E.isError && /* @__PURE__ */ m("div", {
1954
+ className: "alert alert-danger small mt-2 mb-0 py-1",
1955
+ children: [
1956
+ /* @__PURE__ */ p("i", {
1957
+ className: "bi bi-exclamation-triangle me-1",
1958
+ "aria-hidden": !0
1959
+ }),
1960
+ "Falha ao excluir:",
1961
+ " ",
1962
+ E.error instanceof Error ? E.error.message : String(E.error)
1963
+ ]
1964
+ })
1965
+ ]
1761
1966
  }),
1762
1967
  /* @__PURE__ */ m("div", {
1763
1968
  className: "modal-footer",
1764
1969
  children: [/* @__PURE__ */ p("button", {
1765
1970
  className: "btn btn-sm btn-secondary",
1766
- onClick: () => x(null),
1971
+ onClick: () => S(null),
1767
1972
  children: "Cancelar"
1768
1973
  }), /* @__PURE__ */ p("button", {
1769
1974
  className: "btn btn-sm btn-danger",
1770
- disabled: T.isPending,
1975
+ disabled: E.isPending,
1771
1976
  onClick: async () => {
1772
- if (y === "multiple") for (let e of _) await T.mutateAsync(e);
1773
- else await T.mutateAsync(y);
1977
+ if (!D.current) {
1978
+ D.current = !0;
1979
+ try {
1980
+ if (x === "multiple") for (let e of v) await E.mutateAsync(e);
1981
+ else await E.mutateAsync(x);
1982
+ } finally {
1983
+ D.current = !1;
1984
+ }
1985
+ }
1774
1986
  },
1775
- children: T.isPending ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", { className: "spinner-border spinner-border-sm me-1" }), "Excluindo..."] }) : "Excluir"
1987
+ children: E.isPending ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", { className: "spinner-border spinner-border-sm me-1" }), "Excluindo..."] }) : "Excluir"
1776
1988
  })]
1777
1989
  })
1778
1990
  ]
@@ -1784,8 +1996,8 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1784
1996
  }
1785
1997
  //#endregion
1786
1998
  //#region src/components/ImportDumpTab.tsx
1787
- function Z() {
1788
- let e = N(), t = P(), n = w(), r = a(null), [i, s] = o("upload"), [c, l] = o(null), [u, d] = o(""), [f, h] = o(!1), g = () => {
1999
+ function Q() {
2000
+ let e = P(), t = F(), n = T(), r = a(null), [i, s] = o("upload"), [c, l] = o(null), [u, d] = o(""), [f, h] = o(!1), g = () => {
1789
2001
  i === "upload" && c ? e.mutate({ file: c }) : i === "storage" && u && t.mutate({
1790
2002
  storageType: "LOCAL",
1791
2003
  storagePath: u
@@ -1907,7 +2119,7 @@ function Z() {
1907
2119
  maxHeight: 350,
1908
2120
  overflow: "auto"
1909
2121
  },
1910
- children: /* @__PURE__ */ p(X, {
2122
+ children: /* @__PURE__ */ p(Z, {
1911
2123
  storageType: "LOCAL",
1912
2124
  storageConfig: {
1913
2125
  type: "LOCAL",
@@ -1930,7 +2142,7 @@ function Z() {
1930
2142
  children: [/* @__PURE__ */ p("p", {
1931
2143
  className: "small text-body-secondary mb-3",
1932
2144
  children: "O dump será aplicado no banco configurado no servidor. Tabelas bloqueadas por segurança são ignoradas automaticamente na importação."
1933
- }), /* @__PURE__ */ p(U, {
2145
+ }), /* @__PURE__ */ p(W, {
1934
2146
  label: "Banco de destino",
1935
2147
  dbInfo: n.data,
1936
2148
  isLoading: n.isLoading,
@@ -1946,7 +2158,7 @@ function Z() {
1946
2158
  "aria-hidden": !0
1947
2159
  }),
1948
2160
  "Falha na importacao: ",
1949
- G(y)
2161
+ K(y)
1950
2162
  ]
1951
2163
  }),
1952
2164
  v && /* @__PURE__ */ m("div", {
@@ -1988,13 +2200,13 @@ function Z() {
1988
2200
  }
1989
2201
  //#endregion
1990
2202
  //#region src/hooks/useAutoTheme.ts
1991
- function Q() {
2203
+ function $() {
1992
2204
  return typeof document < "u" && document.documentElement.classList.contains("dark");
1993
2205
  }
1994
- function ne(e) {
1995
- let [t, n] = o(Q), [i, a] = o(() => typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)")?.matches === !0);
2206
+ function ie(e) {
2207
+ let [t, n] = o($), [i, a] = o(() => typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)")?.matches === !0);
1996
2208
  return r(() => {
1997
- let e = document.documentElement, t = new MutationObserver(() => n(Q()));
2209
+ let e = document.documentElement, t = new MutationObserver(() => n($()));
1998
2210
  return t.observe(e, {
1999
2211
  attributes: !0,
2000
2212
  attributeFilter: ["class"]
@@ -2007,8 +2219,8 @@ function ne(e) {
2007
2219
  }
2008
2220
  //#endregion
2009
2221
  //#region src/components/MinivaultModule.tsx
2010
- function re(e) {
2011
- let { companyAcronym: t = "Minivault", theme: n, refetchIntervalMs: r = 15e3, storageType: i = "LOCAL", ...a } = e, l = ne(n), [u] = o(() => new s({ defaultOptions: { queries: {
2222
+ function ae(e) {
2223
+ let { companyAcronym: t = "Minivault", theme: n, refetchIntervalMs: r = 15e3, storageType: i = "LOCAL", ...a } = e, l = ie(n), [u] = o(() => new s({ defaultOptions: { queries: {
2012
2224
  refetchInterval: r,
2013
2225
  retry: 1
2014
2226
  } } }));
@@ -2019,15 +2231,15 @@ function re(e) {
2019
2231
  children: /* @__PURE__ */ m("div", {
2020
2232
  className: "minivault-module h-full w-full overflow-auto",
2021
2233
  "data-minivault-theme": l,
2022
- children: [/* @__PURE__ */ p(ie, {
2234
+ children: [/* @__PURE__ */ p(oe, {
2023
2235
  companyAcronym: t,
2024
2236
  theme: l
2025
- }), /* @__PURE__ */ p(ae, { storageType: i })]
2237
+ }), /* @__PURE__ */ p(se, { storageType: i })]
2026
2238
  })
2027
2239
  })
2028
2240
  });
2029
2241
  }
2030
- function ie({ companyAcronym: e, theme: t }) {
2242
+ function oe({ companyAcronym: e, theme: t }) {
2031
2243
  return /* @__PURE__ */ m("div", {
2032
2244
  className: "d-flex align-items-center justify-content-between flex-wrap gap-2 px-3 py-2 border-bottom",
2033
2245
  style: {
@@ -2056,7 +2268,7 @@ function ie({ companyAcronym: e, theme: t }) {
2056
2268
  })]
2057
2269
  });
2058
2270
  }
2059
- function ae({ storageType: e }) {
2271
+ function se({ storageType: e }) {
2060
2272
  let [t, n] = o("backups");
2061
2273
  return /* @__PURE__ */ m("div", {
2062
2274
  className: "p-3",
@@ -2111,24 +2323,37 @@ function ae({ storageType: e }) {
2111
2323
  "aria-hidden": !0
2112
2324
  }), "Storage"]
2113
2325
  })
2326
+ }),
2327
+ /* @__PURE__ */ p("li", {
2328
+ className: "nav-item",
2329
+ children: /* @__PURE__ */ m("button", {
2330
+ type: "button",
2331
+ className: `nav-link ${t === "diagnostics" ? "active" : ""}`,
2332
+ onClick: () => n("diagnostics"),
2333
+ children: [/* @__PURE__ */ p("i", {
2334
+ className: "bi bi-heart-pulse me-1",
2335
+ "aria-hidden": !0
2336
+ }), "Diagnóstico"]
2337
+ })
2114
2338
  })
2115
2339
  ]
2116
2340
  }),
2117
- t === "backups" && /* @__PURE__ */ p(K, {}),
2341
+ t === "backups" && /* @__PURE__ */ p(q, {}),
2118
2342
  t === "create" && /* @__PURE__ */ p(Y, {}),
2119
- t === "import" && /* @__PURE__ */ p(Z, {}),
2120
- t === "storage" && /* @__PURE__ */ p(X, { storageType: e })
2343
+ t === "import" && /* @__PURE__ */ p(Q, {}),
2344
+ t === "storage" && /* @__PURE__ */ p(Z, { storageType: e }),
2345
+ t === "diagnostics" && /* @__PURE__ */ p(X, {})
2121
2346
  ]
2122
2347
  });
2123
2348
  }
2124
2349
  //#endregion
2125
2350
  //#region src/components/CredentialsFields.tsx
2126
- var oe = [
2351
+ var ce = [
2127
2352
  "postgresql",
2128
2353
  "mysql",
2129
2354
  "sqlserver"
2130
2355
  ];
2131
- function se() {
2356
+ function le() {
2132
2357
  return {
2133
2358
  host: "localhost",
2134
2359
  port: 5432,
@@ -2138,19 +2363,19 @@ function se() {
2138
2363
  databaseType: "postgresql"
2139
2364
  };
2140
2365
  }
2141
- function $(e) {
2366
+ function ue(e) {
2142
2367
  return e === "postgresql" || e === "postgres" ? 5432 : e === "mysql" ? 3306 : 1433;
2143
2368
  }
2144
- function ce({ value: e, onChange: t, onValidatedChange: n }) {
2369
+ function de({ value: e, onChange: t, onValidatedChange: n }) {
2145
2370
  let r = {
2146
- ...se(),
2371
+ ...le(),
2147
2372
  ...e
2148
2373
  }, i = (e) => {
2149
2374
  let n = {
2150
2375
  ...r,
2151
2376
  databaseType: e
2152
2377
  };
2153
- (r.port === $(r.databaseType) || !r.port) && (n.port = $(e)), t(n);
2378
+ (r.port === ue(r.databaseType) || !r.port) && (n.port = ue(e)), t(n);
2154
2379
  }, a = (e) => {
2155
2380
  let i = {
2156
2381
  ...r,
@@ -2172,9 +2397,9 @@ function ce({ value: e, onChange: t, onValidatedChange: n }) {
2172
2397
  className: "form-select",
2173
2398
  value: r.databaseType,
2174
2399
  onChange: (e) => i(e.target.value),
2175
- children: oe.map((e) => /* @__PURE__ */ p("option", {
2400
+ children: ce.map((e) => /* @__PURE__ */ p("option", {
2176
2401
  value: e,
2177
- children: V[e] ?? e
2402
+ children: H[e] ?? e
2178
2403
  }, e))
2179
2404
  })]
2180
2405
  }),
@@ -2246,4 +2471,4 @@ function ce({ value: e, onChange: t, onValidatedChange: n }) {
2246
2471
  });
2247
2472
  }
2248
2473
  //#endregion
2249
- export { K as BackupsTab, Y as CreateBackupTab, ce as CredentialsFields, V as DATABASE_TYPE_LABELS, U as DatabaseBanner, Z as ImportDumpTab, g as MinivaultApi, h as MinivaultApiError, y as MinivaultApiProvider, re as MinivaultModule, W as RestoreModal, B as STATUS_BADGE, z as STATUS_LABELS, H as StatusBadge, X as StorageExplorerTab, R as formatDate, L as formatFileSize, C as useBackups, O as useCreateBackup, w as useDbInfo, D as useDbRelationships, E as useDbTableDetail, T as useDbTables, A as useDeleteBackup, M as useDownloadBackup, N as useImportDump, P as useImportFromStorage, b as useMinivaultApi, k as useRestoreBackup };
2474
+ export { q as BackupsTab, Y as CreateBackupTab, de as CredentialsFields, H as DATABASE_TYPE_LABELS, W as DatabaseBanner, X as DiagnosticsTab, Q as ImportDumpTab, g as MinivaultApi, h as MinivaultApiError, y as MinivaultApiProvider, ae as MinivaultModule, G as RestoreModal, V as STATUS_BADGE, B as STATUS_LABELS, U as StatusBadge, Z as StorageExplorerTab, z as formatDate, R as formatFileSize, w as useBackups, k as useCreateBackup, T as useDbInfo, O as useDbRelationships, D as useDbTableDetail, E as useDbTables, j as useDeleteBackup, C as useDiagnostics, N as useDownloadBackup, P as useImportDump, F as useImportFromStorage, b as useMinivaultApi, A as useRestoreBackup };