unifyedx-storybook-new 0.2.12 → 0.2.14

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,6 +1,6 @@
1
1
  import { jsxs as l, jsx as e, Fragment as ee } from "react/jsx-runtime";
2
- import ae, { useState as O, useMemo as ce, useId as ea, Fragment as Q, useEffect as X, useCallback as K, useRef as ue } from "react";
3
- import { a as J, U as ut, X as ye, P as _, L as mt, C as je, b as Ge, f as Ve, d as va, D as Na, F as ht, e as pt, h as gt, T as Ue, u as yt, i as ft, I as bt, j as vt, k as Nt, l as xt, m as kt, n as wt, S as xa, o as ka, M as Ct, p as St, q as wa, r as Dt, A as $t, E as Ft, s as Tt, t as At, v as Et, w as Rt, x as Ca, y as It, z as Sa, B as Da, G as zt, H as Pt, J as Bt, K as qe, N as aa, O as ta, Q as Lt, R as Ot, V as $a, W as Mt, Y as sa, Z as Vt, _ as Ut, $ as Fa, a0 as qt, a1 as jt, a2 as Gt, a3 as _t, a4 as Wt, a5 as Yt, a6 as Jt, a7 as Qt, a8 as Xt, a9 as Zt, aa as Ht, ab as Kt, ac as er, ad as ar, ae as tr } from "./vendor-zgKTz69B.js";
2
+ import ae, { useState as B, useMemo as ce, useId as ea, Fragment as Q, useEffect as X, useCallback as K, useRef as ue } from "react";
3
+ import { a as J, U as ut, X as ye, P as _, L as mt, C as je, b as Ge, f as Ue, d as va, D as Na, F as ht, e as pt, h as gt, T as Ve, u as yt, i as ft, I as bt, j as vt, k as Nt, l as xt, m as kt, n as wt, S as xa, o as ka, M as Ct, p as St, q as wa, r as Dt, A as $t, E as Ft, s as Tt, t as At, v as Et, w as Rt, x as Ca, y as It, z as Sa, B as Da, G as zt, H as Pt, J as Bt, K as qe, N as aa, O as ta, Q as Lt, R as Ot, V as $a, W as Mt, Y as sa, Z as Ut, _ as Vt, $ as Fa, a0 as qt, a1 as jt, a2 as Gt, a3 as _t, a4 as Wt, a5 as Yt, a6 as Jt, a7 as Qt, a8 as Xt, a9 as Zt, aa as Ht, ab as Kt, ac as er, ad as ar, ae as tr } from "./vendor-zgKTz69B.js";
4
4
  import { Popover as rr, PopoverButton as nr, PopoverPanel as sr, Transition as oe, Dialog as me, TransitionChild as ge, DialogPanel as Se, DialogTitle as _e, TabGroup as lr, TabList as or, Tab as re, TabPanels as ir, RadioGroup as ze, Listbox as Z, ListboxButton as cr, ListboxOptions as dr, ListboxOption as ur, SwitchGroup as mr, Switch as Ze, Menu as hr, MenuButton as pr, Portal as gr, MenuItems as yr, MenuItem as fr, DialogBackdrop as br } from "@headlessui/react";
5
5
  import { motion as ne, AnimatePresence as be } from "framer-motion";
6
6
  import { d as vr } from "./vendor-lodash-BD0xlZyL.js";
@@ -8,14 +8,14 @@ import { useFloating as Ta, offset as Aa, flip as Ea, shift as Ra, autoUpdate as
8
8
  import He, { debounce as Cr } from "lodash";
9
9
  import { toast as le, ToastContainer as Sr, Slide as Dr } from "react-toastify";
10
10
  import "react-toastify/dist/ReactToastify.css";
11
- import { P as $r, S as Fr, F as Tr, G as Ar, a as Er, E as Rr, b as Ir, C as zr, R as Pr, c as Br, d as Lr, e as Or, f as Mr, I as Vr, g as ia } from "./vendor-syncfusion-DGcZfoFG.js";
12
- const Ur = (t) => {
11
+ import { P as $r, S as Fr, F as Tr, G as Ar, a as Er, E as Rr, b as Ir, C as zr, R as Pr, c as Br, d as Lr, e as Or, f as Mr, I as Ur, g as ia } from "./vendor-syncfusion-DGcZfoFG.js";
12
+ const Vr = (t) => {
13
13
  let r = 2166136261;
14
14
  for (let s = 0; s < t.length; s++)
15
15
  r ^= t.charCodeAt(s), r += (r << 1) + (r << 4) + (r << 7) + (r << 8) + (r << 24);
16
16
  return r >>> 0;
17
17
  }, qr = (t) => {
18
- const r = (t ?? "").trim().toLowerCase(), s = parseInt((r.match(/\d+$/) ?? [0])[0], 10) || 0, o = Ur(r), n = (o % 360 + 37 * s) % 360, u = 55 + (o >>> 8) % 20, i = 30 + (o >>> 16) % 10, d = 86 + (o >>> 24) % 8, y = `hsl(${n}, ${u}%, ${d}%)`, b = `hsl(${n}, ${u}%, ${i}%)`;
18
+ const r = (t ?? "").trim().toLowerCase(), s = parseInt((r.match(/\d+$/) ?? [0])[0], 10) || 0, o = Vr(r), n = (o % 360 + 37 * s) % 360, u = 55 + (o >>> 8) % 20, i = 30 + (o >>> 16) % 10, d = 86 + (o >>> 24) % 8, y = `hsl(${n}, ${u}%, ${d}%)`, b = `hsl(${n}, ${u}%, ${i}%)`;
19
19
  return { bg: y, text: b };
20
20
  }, jr = (t = "") => t.split(" ").map((r) => r[0]).slice(0, 2).join("").toUpperCase(), za = ({
21
21
  src: t,
@@ -29,7 +29,7 @@ const Ur = (t) => {
29
29
  className: u,
30
30
  ...i
31
31
  }) => {
32
- const [d, y] = O(!1), b = ce(() => qr(r), []), N = t && !d, a = !N && r, k = !N && !r, m = J(
32
+ const [d, y] = B(!1), b = ce(() => qr(r), []), N = t && !d, a = !N && r, k = !N && !r, m = J(
33
33
  "avatar-container",
34
34
  `avatar--size-${s}`,
35
35
  u
@@ -276,10 +276,10 @@ const _r = {
276
276
  "datepicker-trigger--disabled": i
277
277
  }),
278
278
  disabled: i,
279
- "aria-label": t ? `Selected date is ${Ve(t, "PPP")}` : o,
279
+ "aria-label": t ? `Selected date is ${Ue(t, "PPP")}` : o,
280
280
  children: [
281
281
  /* @__PURE__ */ e(va, { className: "datepicker-icon" }),
282
- t ? /* @__PURE__ */ e("span", { className: "datepicker-value", children: Ve(t, "PPP") }) : /* @__PURE__ */ e("span", { className: "datepicker-placeholder", children: o })
282
+ t ? /* @__PURE__ */ e("span", { className: "datepicker-value", children: Ue(t, "PPP") }) : /* @__PURE__ */ e("span", { className: "datepicker-placeholder", children: o })
283
283
  ]
284
284
  }
285
285
  ),
@@ -322,9 +322,9 @@ const _r = {
322
322
  const b = t?.from, N = t?.to, a = (m) => {
323
323
  m.stopPropagation(), m.preventDefault(), s?.();
324
324
  }, k = b && N ? /* @__PURE__ */ l(ee, { children: [
325
- Ve(b, "MMM d, y"),
325
+ Ue(b, "MMM d, y"),
326
326
  " - ",
327
- Ve(N, "MMM d, y")
327
+ Ue(N, "MMM d, y")
328
328
  ] }) : /* @__PURE__ */ e("span", { className: "datepicker-placeholder", children: o });
329
329
  return /* @__PURE__ */ l("div", { className: J("datepicker-wrapper", d), children: [
330
330
  n && /* @__PURE__ */ e("label", { className: "datepicker-label", htmlFor: "daterangepicker-input", children: n }),
@@ -714,7 +714,7 @@ const _r = {
714
714
  $ && /* @__PURE__ */ l("div", { className: "file-list-container", children: [
715
715
  /* @__PURE__ */ e("h3", { children: "Upload Queue" }),
716
716
  /* @__PURE__ */ l("ul", { className: "file-list", children: [
717
- i.map((L, E) => /* @__PURE__ */ l(
717
+ i.map((L, O) => /* @__PURE__ */ l(
718
718
  "li",
719
719
  {
720
720
  className: "file-item",
@@ -735,16 +735,16 @@ const _r = {
735
735
  "button",
736
736
  {
737
737
  type: "button",
738
- onClick: () => y(E),
738
+ onClick: () => y(O),
739
739
  className: "remove-file-button",
740
- children: /* @__PURE__ */ e(Ue, { size: 16 })
740
+ children: /* @__PURE__ */ e(Ve, { size: 16 })
741
741
  }
742
742
  )
743
743
  ]
744
744
  },
745
- `${L.name}-${E}`
745
+ `${L.name}-${O}`
746
746
  )),
747
- d.map(({ file: L, message: E }, C) => /* @__PURE__ */ l(
747
+ d.map(({ file: L, message: O }, C) => /* @__PURE__ */ l(
748
748
  "li",
749
749
  {
750
750
  className: "file-item file-item--rejected",
@@ -759,7 +759,7 @@ const _r = {
759
759
  /* @__PURE__ */ l("div", { children: [
760
760
  /* @__PURE__ */ e("p", { className: "file-item-name", children: L.name }),
761
761
  /* @__PURE__ */ e("p", { className: "file-item-size", children: ua(L.size) }),
762
- /* @__PURE__ */ e("p", { className: "rejection-reason", children: E })
762
+ /* @__PURE__ */ e("p", { className: "rejection-reason", children: O })
763
763
  ] })
764
764
  ] }),
765
765
  /* @__PURE__ */ e(
@@ -768,7 +768,7 @@ const _r = {
768
768
  type: "button",
769
769
  onClick: () => b(C),
770
770
  className: "remove-file-button",
771
- children: /* @__PURE__ */ e(Ue, { size: 16 })
771
+ children: /* @__PURE__ */ e(Ve, { size: 16 })
772
772
  }
773
773
  )
774
774
  ]
@@ -817,63 +817,63 @@ const _r = {
817
817
  fetchCreatedOrUpdatedByUsers: i = async () => []
818
818
  // Mockable fetcher
819
819
  }) => {
820
- const [d, y] = O({
820
+ const [d, y] = B({
821
821
  createdBy: [],
822
822
  updatedBy: []
823
- }), [b, N] = O({
823
+ }), [b, N] = B({
824
824
  createdBy: !1,
825
825
  updatedBy: !1
826
826
  }), a = yt({
827
827
  initialValues: JSON.parse(JSON.stringify(u)),
828
828
  // Deep copy
829
829
  onSubmit: (C) => {
830
- const I = {};
831
- Object.keys(C).forEach((P) => {
832
- I[P] = {
833
- operator: C[P].operator || "in",
834
- values: Array.isArray(C[P].values) ? C[P].values : [],
835
- range: C[P].range || null
830
+ const T = {};
831
+ Object.keys(C).forEach((E) => {
832
+ T[E] = {
833
+ operator: C[E].operator || "in",
834
+ values: Array.isArray(C[E].values) ? C[E].values : [],
835
+ range: C[E].range || null
836
836
  };
837
- }), console.log("[storybook filter] Applied Filters:", I), typeof s == "function" && s({
838
- filters: I,
837
+ }), console.log("[storybook filter] Applied Filters:", T), typeof s == "function" && s({
838
+ filters: T,
839
839
  activeCount: m
840
840
  }), r();
841
841
  },
842
842
  enableReinitialize: !0
843
- }), k = ce(() => n.reduce((C, I) => {
844
- const P = I.key, A = a.values[P];
845
- let U = !1;
846
- if (A)
847
- switch (I.type) {
843
+ }), k = ce(() => n.reduce((C, T) => {
844
+ const E = T.key, R = a.values[E];
845
+ let V = !1;
846
+ if (R)
847
+ switch (T.type) {
848
848
  case "multiselect":
849
849
  case "multiselect-users":
850
- U = Array.isArray(A.values) && A.values.length > 0;
850
+ V = Array.isArray(R.values) && R.values.length > 0;
851
851
  break;
852
852
  case "date":
853
- (A.range && A.range !== "" || Array.isArray(A.values) && A.values.length > 0) && (U = !0);
853
+ (R.range && R.range !== "" || Array.isArray(R.values) && R.values.length > 0) && (V = !0);
854
854
  break;
855
855
  }
856
- return C[P] = U, C;
857
- }, {}), [n, a.values]), m = Object.values(k).filter(Boolean).length, g = async (C, I) => {
856
+ return C[E] = V, C;
857
+ }, {}), [n, a.values]), m = Object.values(k).filter(Boolean).length, g = async (C, T) => {
858
858
  try {
859
- N((A) => ({ ...A, [C]: !0 }));
860
- const P = await i(C, I);
861
- y((A) => ({ ...A, [C]: P }));
862
- } catch (P) {
863
- console.error(`Error fetching ${C} users:`, P);
859
+ N((R) => ({ ...R, [C]: !0 }));
860
+ const E = await i(C, T);
861
+ y((R) => ({ ...R, [C]: E }));
862
+ } catch (E) {
863
+ console.error(`Error fetching ${C} users:`, E);
864
864
  } finally {
865
- N((P) => ({ ...P, [C]: !1 }));
865
+ N((E) => ({ ...E, [C]: !1 }));
866
866
  }
867
867
  }, $ = (C) => {
868
- const I = n[C].key, P = n[C].url;
869
- n[C].type === "multiselect-users" && d[I].length === 0 && !b[I] && g(I, P);
868
+ const T = n[C].key, E = n[C].url;
869
+ n[C].type === "multiselect-users" && d[T].length === 0 && !b[T] && g(T, E);
870
870
  }, L = () => {
871
871
  a.resetForm(), y({ createdBy: [], updatedBy: [] }), o();
872
- }, E = (C) => {
873
- const I = n.find((U) => U.key === C);
874
- if (!I) return null;
875
- const P = a.values[C] || u[C], A = Array.isArray(P.values) ? P.values : [];
876
- switch (I.type) {
872
+ }, O = (C) => {
873
+ const T = n.find((V) => V.key === C);
874
+ if (!T) return null;
875
+ const E = a.values[C] || u[C], R = Array.isArray(E.values) ? E.values : [];
876
+ switch (T.type) {
877
877
  case "multiselect":
878
878
  return /* @__PURE__ */ l("div", { className: "filter-panel-content", children: [
879
879
  /* @__PURE__ */ l("div", { className: "filter-operator-group", children: [
@@ -881,10 +881,10 @@ const _r = {
881
881
  /* @__PURE__ */ e(
882
882
  "select",
883
883
  {
884
- value: P.operator || "in",
884
+ value: E.operator || "in",
885
885
  onChange: (c) => a.setFieldValue(`${C}.operator`, c.target.value),
886
886
  className: "filter-select",
887
- children: I.operators.map((c) => /* @__PURE__ */ e("option", { value: c, children: c === "in" ? "Includes" : "Excludes" }, c))
887
+ children: T.operators.map((c) => /* @__PURE__ */ e("option", { value: c, children: c === "in" ? "Includes" : "Excludes" }, c))
888
888
  }
889
889
  )
890
890
  ] }),
@@ -896,9 +896,9 @@ const _r = {
896
896
  type: "checkbox",
897
897
  id: `select-all-${C}`,
898
898
  className: "filter-checkbox-input",
899
- checked: I.options.length > 0 && A.length === I.options.length,
899
+ checked: T.options.length > 0 && R.length === T.options.length,
900
900
  onChange: (c) => {
901
- const h = c.target.checked ? I.options.map((x) => x.value) : [];
901
+ const h = c.target.checked ? T.options.map((x) => x.value) : [];
902
902
  a.setFieldValue(`${C}.values`, h);
903
903
  }
904
904
  }
@@ -912,16 +912,16 @@ const _r = {
912
912
  }
913
913
  )
914
914
  ] }),
915
- I.options.map((c) => /* @__PURE__ */ l("div", { className: "filter-checkbox-item", children: [
915
+ T.options.map((c) => /* @__PURE__ */ l("div", { className: "filter-checkbox-item", children: [
916
916
  /* @__PURE__ */ e(
917
917
  "input",
918
918
  {
919
919
  type: "checkbox",
920
920
  id: `${C}-${c.value}`,
921
921
  className: "filter-checkbox-input",
922
- checked: A.includes(c.value),
922
+ checked: R.includes(c.value),
923
923
  onChange: (h) => {
924
- const x = h.target.checked ? [...A, c.value] : A.filter((F) => F !== c.value);
924
+ const x = h.target.checked ? [...R, c.value] : R.filter((F) => F !== c.value);
925
925
  a.setFieldValue(`${C}.values`, x);
926
926
  }
927
927
  }
@@ -938,21 +938,21 @@ const _r = {
938
938
  ] })
939
939
  ] });
940
940
  case "multiselect-users":
941
- const U = d[C] || [], q = b[C];
941
+ const V = d[C] || [], q = b[C];
942
942
  return /* @__PURE__ */ l("div", { className: "filter-panel-content", children: [
943
943
  /* @__PURE__ */ l("div", { className: "filter-operator-group", children: [
944
944
  /* @__PURE__ */ e("label", { className: "filter-label", children: "Operator:" }),
945
945
  /* @__PURE__ */ e(
946
946
  "select",
947
947
  {
948
- value: P.operator || "in",
948
+ value: E.operator || "in",
949
949
  onChange: (c) => a.setFieldValue(`${C}.operator`, c.target.value),
950
950
  className: "filter-select",
951
- children: I.operators.map((c) => /* @__PURE__ */ e("option", { value: c, children: c === "in" ? "Includes" : "Excludes" }, c))
951
+ children: T.operators.map((c) => /* @__PURE__ */ e("option", { value: c, children: c === "in" ? "Includes" : "Excludes" }, c))
952
952
  }
953
953
  )
954
954
  ] }),
955
- q ? /* @__PURE__ */ e("div", { className: "loading-spinner", children: /* @__PURE__ */ e("div", {}) }) : /* @__PURE__ */ e("div", { className: "filter-checkbox-list", children: U.length > 0 ? /* @__PURE__ */ l(ee, { children: [
955
+ q ? /* @__PURE__ */ e("div", { className: "loading-spinner", children: /* @__PURE__ */ e("div", {}) }) : /* @__PURE__ */ e("div", { className: "filter-checkbox-list", children: V.length > 0 ? /* @__PURE__ */ l(ee, { children: [
956
956
  /* @__PURE__ */ l("div", { className: "filter-checkbox-item", children: [
957
957
  /* @__PURE__ */ e(
958
958
  "input",
@@ -960,9 +960,9 @@ const _r = {
960
960
  type: "checkbox",
961
961
  id: `select-all-users-${C}`,
962
962
  className: "filter-checkbox-input",
963
- checked: U.length > 0 && A.length === U.length,
963
+ checked: V.length > 0 && R.length === V.length,
964
964
  onChange: (c) => {
965
- const h = c.target.checked ? U.map((x) => x.email) : [];
965
+ const h = c.target.checked ? V.map((x) => x.email) : [];
966
966
  a.setFieldValue(
967
967
  `${C}.values`,
968
968
  h
@@ -979,16 +979,16 @@ const _r = {
979
979
  }
980
980
  )
981
981
  ] }),
982
- U.map((c) => /* @__PURE__ */ l("div", { className: "filter-checkbox-item createdby", children: [
982
+ V.map((c) => /* @__PURE__ */ l("div", { className: "filter-checkbox-item createdby", children: [
983
983
  /* @__PURE__ */ e(
984
984
  "input",
985
985
  {
986
986
  type: "checkbox",
987
987
  id: `${C}-${c.email}`,
988
988
  className: "filter-checkbox-input",
989
- checked: A.includes(c.email),
989
+ checked: R.includes(c.email),
990
990
  onChange: (h) => {
991
- const x = h.target.checked ? [...A, c.email] : A.filter((F) => F !== c.email);
991
+ const x = h.target.checked ? [...R, c.email] : R.filter((F) => F !== c.email);
992
992
  a.setFieldValue(
993
993
  `${C}.values`,
994
994
  x
@@ -1011,7 +1011,7 @@ const _r = {
1011
1011
  ] }) : /* @__PURE__ */ e("div", { className: "text-center py-4 text-gray-500 text-sm", children: "No users loaded." }) })
1012
1012
  ] });
1013
1013
  case "date":
1014
- const G = P.values || [], [v, p] = G, f = v && p, w = {
1014
+ const G = E.values || [], [v, p] = G, f = v && p, w = {
1015
1015
  startDate: v instanceof Date ? v : /* @__PURE__ */ new Date(),
1016
1016
  // Fallback to today
1017
1017
  endDate: p instanceof Date ? p : /* @__PURE__ */ new Date(),
@@ -1024,10 +1024,10 @@ const _r = {
1024
1024
  /* @__PURE__ */ e(
1025
1025
  "select",
1026
1026
  {
1027
- value: P.operator,
1027
+ value: E.operator,
1028
1028
  onChange: (c) => a.setFieldValue(`${C}.operator`, c.target.value),
1029
1029
  className: "filter-select",
1030
- children: I.operators.map((c) => /* @__PURE__ */ e("option", { value: c, children: c === "in" ? "Is" : "Is not" }, c))
1030
+ children: T.operators.map((c) => /* @__PURE__ */ e("option", { value: c, children: c === "in" ? "Is" : "Is not" }, c))
1031
1031
  }
1032
1032
  ),
1033
1033
  f && /* @__PURE__ */ e(
@@ -1140,7 +1140,7 @@ const _r = {
1140
1140
  animate: { opacity: 1, x: 0 },
1141
1141
  transition: { duration: 0.3 },
1142
1142
  className: "h-full",
1143
- children: E(C.key)
1143
+ children: O(C.key)
1144
1144
  },
1145
1145
  C.key
1146
1146
  )
@@ -1213,7 +1213,7 @@ const _r = {
1213
1213
  ] });
1214
1214
  }, ma = {
1215
1215
  delete: {
1216
- icon: Ue,
1216
+ icon: Ve,
1217
1217
  iconClass: "icon--delete",
1218
1218
  primaryButtonCategory: "danger"
1219
1219
  // Assuming you add a 'danger' category to your Button
@@ -1313,7 +1313,7 @@ const _r = {
1313
1313
  onItemsPerPageChange: n,
1314
1314
  itemsPerPageOptions: u = [10, 15, 20]
1315
1315
  }) => {
1316
- const i = Math.ceil(r / s), [d, y] = O(t);
1316
+ const i = Math.ceil(r / s), [d, y] = B(t);
1317
1317
  X(() => {
1318
1318
  y(t);
1319
1319
  }, [t]);
@@ -1401,7 +1401,7 @@ const _r = {
1401
1401
  )
1402
1402
  ] })
1403
1403
  ] });
1404
- }, Va = ({
1404
+ }, Ua = ({
1405
1405
  label: t,
1406
1406
  value: r,
1407
1407
  // The currently selected option's value (e.g., 'work')
@@ -1457,7 +1457,7 @@ const _r = {
1457
1457
  customClass: u = "",
1458
1458
  ...i
1459
1459
  }) => {
1460
- const [d, y] = O(t);
1460
+ const [d, y] = B(t);
1461
1461
  X(() => {
1462
1462
  y(t);
1463
1463
  }, [t]);
@@ -1504,7 +1504,7 @@ const _r = {
1504
1504
  // From RHF's <Controller>
1505
1505
  showSearch: y = !0
1506
1506
  }) => {
1507
- const [b, N] = O(""), a = b === "" ? o : o.filter(
1507
+ const [b, N] = B(""), a = b === "" ? o : o.filter(
1508
1508
  (m) => m.label.toLowerCase().includes(b.toLowerCase())
1509
1509
  ), k = o.find((m) => r?.id ? m.id === r.id : m.id === r || m.value === r);
1510
1510
  return /* @__PURE__ */ e(Z, { value: r, onChange: s, disabled: u, children: /* @__PURE__ */ l("div", { className: "select-wrapper", ref: d, children: [
@@ -1571,7 +1571,7 @@ const _r = {
1571
1571
  i && /* @__PURE__ */ e("p", { className: "select-error-message", children: i })
1572
1572
  ] }) });
1573
1573
  }, Hr = () => {
1574
- const [t, r] = O(window.location.pathname);
1574
+ const [t, r] = B(window.location.pathname);
1575
1575
  return X(() => {
1576
1576
  const s = () => {
1577
1577
  r(window.location.pathname);
@@ -1585,8 +1585,8 @@ const _r = {
1585
1585
  if ((s.href || s.url || s.path) === r || s.children && na(s.children, r))
1586
1586
  return s;
1587
1587
  return null;
1588
- }, Ua = ({ item: t, isCollapsed: r, level: s = 0 }) => {
1589
- const { pathname: o } = Hr(), n = t.href || t.url || t.path, [u, i] = O(!1), d = t.icon;
1588
+ }, Va = ({ item: t, isCollapsed: r, level: s = 0 }) => {
1589
+ const { pathname: o } = Hr(), n = t.href || t.url || t.path, [u, i] = B(!1), d = t.icon;
1590
1590
  X(() => {
1591
1591
  na([t], o) && i(!0);
1592
1592
  }, [t, o]);
@@ -1644,7 +1644,7 @@ const _r = {
1644
1644
  }),
1645
1645
  "aria-hidden": !u || r,
1646
1646
  children: t.children.map((a) => /* @__PURE__ */ e(
1647
- Ua,
1647
+ Va,
1648
1648
  {
1649
1649
  item: a,
1650
1650
  isCollapsed: r,
@@ -1708,7 +1708,7 @@ const _r = {
1708
1708
  }
1709
1709
  )
1710
1710
  ] }),
1711
- /* @__PURE__ */ e("nav", { className: "sidebar-nav", "aria-label": "Primary", children: /* @__PURE__ */ e("ul", { className: "sidebar-nav-list", children: t.map((y) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(Ua, { item: y, isCollapsed: r }) }, y.label || y.name)) }) }),
1711
+ /* @__PURE__ */ e("nav", { className: "sidebar-nav", "aria-label": "Primary", children: /* @__PURE__ */ e("ul", { className: "sidebar-nav-list", children: t.map((y) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(Va, { item: y, isCollapsed: r }) }, y.label || y.name)) }) }),
1712
1712
  /* @__PURE__ */ l("div", { className: "sidebar-footer", children: [
1713
1713
  /* @__PURE__ */ e(za, { src: d.avatar, name: d.name, size: "medium" }),
1714
1714
  /* @__PURE__ */ l("div", { className: "user-info", children: [
@@ -1776,7 +1776,7 @@ const _r = {
1776
1776
  // ✅ New prop to control visibility
1777
1777
  ...d
1778
1778
  }) => {
1779
- const y = r || d.name, [b, N] = O(
1779
+ const y = r || d.name, [b, N] = B(
1780
1780
  d.value?.length || d.defaultValue?.length || 0
1781
1781
  ), a = (m) => {
1782
1782
  N(m.target.value.length), d.onChange && d.onChange(m);
@@ -2425,7 +2425,7 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2425
2425
  return pn(o);
2426
2426
  }
2427
2427
  }, oa = (t, r) => {
2428
- const [s, o] = O(t);
2428
+ const [s, o] = B(t);
2429
2429
  return X(
2430
2430
  () => {
2431
2431
  const n = Cr(() => {
@@ -2497,16 +2497,16 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2497
2497
  },
2498
2498
  isChanged: d = !1
2499
2499
  }) => {
2500
- const [y, b] = O(ga[0]), [N, a] = O(""), k = oa(N, 400), [m, g] = O([]), [$, L] = O(/* @__PURE__ */ new Set()), [E, C] = O(!1), [I, P] = O(ya[0]), {
2501
- control: A,
2502
- handleSubmit: U,
2500
+ const [y, b] = B(ga[0]), [N, a] = B(""), k = oa(N, 400), [m, g] = B([]), [$, L] = B(/* @__PURE__ */ new Set()), [O, C] = B(!1), [T, E] = B(ya[0]), {
2501
+ control: R,
2502
+ handleSubmit: V,
2503
2503
  watch: q,
2504
2504
  formState: { errors: G, isSubmitting: v }
2505
2505
  } = zt({
2506
2506
  defaultValues: { pendingInvites: [] },
2507
2507
  resolver: Lt(yn)
2508
2508
  }), { fields: p, append: f, remove: w, update: c } = Pt({
2509
- control: A,
2509
+ control: R,
2510
2510
  name: "pendingInvites"
2511
2511
  }), h = q("pendingInvites");
2512
2512
  X(() => {
@@ -2516,47 +2516,47 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2516
2516
  }, [k, y]);
2517
2517
  const x = (D) => {
2518
2518
  L((z) => {
2519
- const V = new Set(z);
2520
- return V.has(D) ? V.delete(D) : V.add(D), V;
2519
+ const U = new Set(z);
2520
+ return U.has(D) ? U.delete(D) : U.add(D), U;
2521
2521
  });
2522
2522
  }, F = () => {
2523
2523
  m.filter((D) => $.has(D.id)).forEach((D) => {
2524
- p.find((z) => z.id === D.id) || f({ ...D, permission: I.name });
2524
+ p.find((z) => z.id === D.id) || f({ ...D, permission: T.name });
2525
2525
  }), L(/* @__PURE__ */ new Set()), a("");
2526
- }, R = (D) => {
2527
- P(D), p.forEach(
2528
- (z, V) => c(V, { ...p[V], permission: D.name })
2526
+ }, I = (D) => {
2527
+ E(D), p.forEach(
2528
+ (z, U) => c(U, { ...p[U], permission: D.name })
2529
2529
  );
2530
2530
  }, j = async (D) => {
2531
2531
  try {
2532
2532
  if (n === se.DRIVE) {
2533
2533
  const z = {
2534
2534
  entity: t,
2535
- userGroupRolesObj: D.pendingInvites.map((V) => ({
2536
- id: V.id,
2537
- permission: V.permission,
2538
- type: V.type.toLowerCase()
2535
+ userGroupRolesObj: D.pendingInvites.map((U) => ({
2536
+ id: U.id,
2537
+ permission: U.permission,
2538
+ type: U.type.toLowerCase()
2539
2539
  }))
2540
2540
  };
2541
2541
  i(z, o);
2542
2542
  } else if (n === se.INTEREST) {
2543
- const z = D.pendingInvites.map((V) => ({
2544
- identity: V.id,
2545
- type: V.type.toLowerCase(),
2543
+ const z = D.pendingInvites.map((U) => ({
2544
+ identity: U.id,
2545
+ type: U.type.toLowerCase(),
2546
2546
  opt: !0,
2547
2547
  lock: !1,
2548
2548
  moderator: !1,
2549
- userName: V.name,
2549
+ userName: U.name,
2550
2550
  interestId: t?.data?.id
2551
2551
  }));
2552
2552
  i(z, o);
2553
2553
  } else if (n === se.ARTICLE) {
2554
2554
  const z = {
2555
2555
  entity: t,
2556
- userGroupRolesObj: D.pendingInvites.map((V) => ({
2557
- id: V.id,
2558
- permission: V.permission,
2559
- type: V.type.toLowerCase()
2556
+ userGroupRolesObj: D.pendingInvites.map((U) => ({
2557
+ id: U.id,
2558
+ permission: U.permission,
2559
+ type: U.type.toLowerCase()
2560
2560
  }))
2561
2561
  };
2562
2562
  i(z, o);
@@ -2569,9 +2569,9 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2569
2569
  throw console.error("Failed to submit invites:", z), z;
2570
2570
  }
2571
2571
  }, S = (D) => {
2572
- const z = o[y.code].find((V) => V.name === D.name) || h.find((V) => V.name === D.name);
2572
+ const z = o[y.code].find((U) => U.name === D.name) || h.find((U) => U.name === D.name);
2573
2573
  return z ? `${z.permission}` : "";
2574
- }, T = () => {
2574
+ }, A = () => {
2575
2575
  switch (n) {
2576
2576
  case se.DRIVE:
2577
2577
  return "Share with others";
@@ -2585,7 +2585,7 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2585
2585
  }, M = ce(() => $.size === 0 && !d, [$, d]);
2586
2586
  return /* @__PURE__ */ l("div", { className: "flex flex-col h-full bg-white", children: [
2587
2587
  /* @__PURE__ */ l("header", { className: "flex items-center justify-between p-4 border-b border-gray-300 flex-shrink-0", children: [
2588
- /* @__PURE__ */ e(me.Title, { className: " text-gray-900 !mb-0 text-lg font-semibold", children: T() }),
2588
+ /* @__PURE__ */ e(me.Title, { className: " text-gray-900 !mb-0 text-lg font-semibold", children: A() }),
2589
2589
  /* @__PURE__ */ l("div", { className: "flex items-center gap-4", children: [
2590
2590
  n === se.DRIVE && /* @__PURE__ */ l("button", { className: "flex items-center gap-2 text-sm text-blue-600 hover:text-blue-800 font-semibold hover:cursor-pointer", children: [
2591
2591
  /* @__PURE__ */ e(Bt, { className: "h-5 w-5" }),
@@ -2664,7 +2664,7 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2664
2664
  value: N
2665
2665
  }
2666
2666
  ) }),
2667
- /* @__PURE__ */ e(be, { children: (m?.length > 0 || E) && /* @__PURE__ */ e(
2667
+ /* @__PURE__ */ e(be, { children: (m?.length > 0 || O) && /* @__PURE__ */ e(
2668
2668
  ne.div,
2669
2669
  {
2670
2670
  initial: { opacity: 0, y: -10 },
@@ -2672,7 +2672,7 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2672
2672
  exit: { opacity: 0, y: -10 },
2673
2673
  transition: { duration: 0.2 },
2674
2674
  className: "absolute top-full mt-2 w-full col-span-3 bg-white border border-gray-300 rounded-lg shadow-lg z-10",
2675
- children: E ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500", children: "Loading..." }) : /* @__PURE__ */ l(ee, { children: [
2675
+ children: O ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500", children: "Loading..." }) : /* @__PURE__ */ l(ee, { children: [
2676
2676
  /* @__PURE__ */ e("div", { className: "max-h-60 overflow-y-auto p-2 space-y-1", children: m.map((D) => {
2677
2677
  const z = S(D);
2678
2678
  return /* @__PURE__ */ l(
@@ -2748,15 +2748,15 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2748
2748
  n === se.DRIVE && /* @__PURE__ */ e(
2749
2749
  Z,
2750
2750
  {
2751
- value: I,
2752
- onChange: R,
2751
+ value: T,
2752
+ onChange: I,
2753
2753
  children: /* @__PURE__ */ l("div", { className: "relative", children: [
2754
2754
  /* @__PURE__ */ l(Z.Button, { className: "relative w-full border border-gray-300 bg-white rounded-md shadow-sm pl-3 pr-10 py-2 text-left hover:cursor-pointer focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 sm:text-sm", children: [
2755
2755
  /* @__PURE__ */ l("span", { className: "flex items-center", children: [
2756
- /* @__PURE__ */ e(I.icon, { className: "h-5 w-5 text-gray-400 mr-2" }),
2756
+ /* @__PURE__ */ e(T.icon, { className: "h-5 w-5 text-gray-400 mr-2" }),
2757
2757
  /* @__PURE__ */ l("span", { className: "truncate", children: [
2758
2758
  "Can ",
2759
- I.name
2759
+ T.name
2760
2760
  ] })
2761
2761
  ] }),
2762
2762
  /* @__PURE__ */ e("span", { className: "absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none", children: /* @__PURE__ */ e(aa, { className: "h-5 w-5 text-gray-400" }) })
@@ -2773,7 +2773,7 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2773
2773
  {
2774
2774
  value: D,
2775
2775
  className: ({ active: z }) => `${z ? "text-white bg-blue-600" : "text-gray-900"} hover:cursor-pointer select-none relative py-2 pl-10`,
2776
- children: ({ selected: z, active: V }) => /* @__PURE__ */ l(ee, { children: [
2776
+ children: ({ selected: z, active: U }) => /* @__PURE__ */ l(ee, { children: [
2777
2777
  /* @__PURE__ */ l(
2778
2778
  "span",
2779
2779
  {
@@ -2782,7 +2782,7 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2782
2782
  /* @__PURE__ */ e(
2783
2783
  D.icon,
2784
2784
  {
2785
- className: `h-5 w-5 mr-2 ${V ? "text-white" : "text-gray-400"}`
2785
+ className: `h-5 w-5 mr-2 ${U ? "text-white" : "text-gray-400"}`
2786
2786
  }
2787
2787
  ),
2788
2788
  "Can ",
@@ -2868,7 +2868,7 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2868
2868
  /* @__PURE__ */ e(
2869
2869
  "button",
2870
2870
  {
2871
- onClick: U(j),
2871
+ onClick: V(j),
2872
2872
  disabled: v || h.length === 0 && M,
2873
2873
  className: "px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md shadow-sm hover:bg-blue-700 hover:cursor-pointer focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-blue-300 disabled:cursor-not-allowed",
2874
2874
  children: v ? "Inviting..." : n === se.DRIVE ? "Send Invites" : "Add"
@@ -2882,7 +2882,7 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2882
2882
  { name: "Can manage", icon: Da, value: "edit" },
2883
2883
  { name: "Remove", icon: Ot, isDestructive: !0, value: "remove" }
2884
2884
  ], bn = ({ item: t, allowedPermissions: r, onPermissionChange: s }) => {
2885
- const [o, n] = O(!1), { refs: u, floatingStyles: i, context: d } = Ta({
2885
+ const [o, n] = B(!1), { refs: u, floatingStyles: i, context: d } = Ta({
2886
2886
  open: o,
2887
2887
  onOpenChange: n,
2888
2888
  middleware: [Aa(8), Ea(), Ra({ padding: 8 })],
@@ -2970,28 +2970,34 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
2970
2970
  existingShares: n,
2971
2971
  allowedPermissions: u
2972
2972
  }) => {
2973
- const [i, d] = O(n), [y, b] = O(0), [N, a] = O(""), k = oa(N, 300), m = {
2973
+ const [i, d] = B(n), [y, b] = B(0), [N, a] = B(""), k = oa(N, 300), m = {
2974
2974
  users: i.users.filter(
2975
- (E) => E.name.toLowerCase().includes(k.toLowerCase())
2975
+ (C) => C.name.toLowerCase().includes(k.toLowerCase())
2976
2976
  ),
2977
2977
  groups: i.groups.filter(
2978
- (E) => E.name.toLowerCase().includes(k.toLowerCase())
2978
+ (C) => C.name.toLowerCase().includes(k.toLowerCase())
2979
2979
  ),
2980
2980
  roles: i.roles.filter(
2981
- (E) => E.name.toLowerCase().includes(k.toLowerCase())
2981
+ (C) => C.name.toLowerCase().includes(k.toLowerCase())
2982
2982
  )
2983
- }, g = async (E, C, I, P) => {
2984
- const A = C.value;
2985
- d(A === "Remove" ? (U) => ({
2986
- ...U,
2987
- [I]: U[I].filter((q) => q.id !== E.id)
2988
- }) : (U) => ({
2989
- ...U,
2990
- [I]: U[I].map(
2991
- (q) => q.id === E.id ? { ...q, permission: A } : q
2983
+ }, g = async (C, T, E, R) => {
2984
+ const V = T.value;
2985
+ d((q) => ({
2986
+ ...q,
2987
+ [E]: q[E].map(
2988
+ (G) => G.id === C.id ? { ...G, permission: V } : G
2992
2989
  )
2993
2990
  }));
2994
- }, $ = ["users", "groups", "roles"], L = ["Users", "Groups", "Roles"];
2991
+ }, $ = () => {
2992
+ d((C) => {
2993
+ const T = {
2994
+ users: C.users.filter((E) => E.permission !== "remove"),
2995
+ groups: C.groups.filter((E) => E.permission !== "remove"),
2996
+ roles: C.roles.filter((E) => E.permission !== "remove")
2997
+ };
2998
+ return r(T), T;
2999
+ });
3000
+ }, L = ["users", "groups", "roles"], O = ["Users", "Groups", "Roles"];
2995
3001
  return (
2996
3002
  // The main structure remains the same...
2997
3003
  /* @__PURE__ */ l("div", { className: "flex flex-col h-full bg-gray-50", children: [
@@ -3017,120 +3023,130 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
3017
3023
  }
3018
3024
  )
3019
3025
  ] }),
3020
- /* @__PURE__ */ e("div", { className: "flex flex-col flex-grow", children: /* @__PURE__ */ l(re.Group, { selectedIndex: y, onChange: b, children: [
3021
- /* @__PURE__ */ l("div", { className: "p-4 bg-white border-b border-gray-300", children: [
3022
- /* @__PURE__ */ e(re.List, { className: "flex space-x-1 bg-gray-100 p-1 rounded-lg", children: L.map((E) => /* @__PURE__ */ e(
3023
- re,
3024
- {
3025
- className: ({
3026
- selected: C
3027
- }) => `w-full py-2 text-sm font-medium leading-5 rounded-md
3026
+ /* @__PURE__ */ l("div", { className: "flex flex-col flex-grow", children: [
3027
+ /* @__PURE__ */ l(re.Group, { selectedIndex: y, onChange: b, children: [
3028
+ /* @__PURE__ */ l("div", { className: "p-4 bg-white border-b border-gray-300", children: [
3029
+ /* @__PURE__ */ e(re.List, { className: "flex space-x-1 bg-gray-100 p-1 rounded-lg", children: O.map((C) => /* @__PURE__ */ e(
3030
+ re,
3031
+ {
3032
+ className: ({
3033
+ selected: T
3034
+ }) => `w-full py-2 text-sm font-medium leading-5 rounded-md
3028
3035
  focus:outline-none focus:ring-2 ring-offset-2 ring-offset-blue-400 ring-white ring-opacity-60
3029
- ${C ? "bg-white shadow text-blue-700" : "text-gray-600 hover:bg-white/[0.6]"}`,
3030
- children: E
3031
- },
3032
- E
3033
- )) }),
3034
- /* @__PURE__ */ e("div", { className: "mt-4", children: /* @__PURE__ */ e(
3035
- he,
3036
- {
3037
- onDebouncedChange: a,
3038
- value: N,
3039
- placeholder: `Search in ${L[y]}...`
3040
- }
3041
- ) })
3042
- ] }),
3043
- /* @__PURE__ */ e("div", { className: "flex-grow overflow-y-auto p-4 h-[calc(100vh-330px)]", children: /* @__PURE__ */ e(be, { mode: "wait", children: /* @__PURE__ */ e(
3044
- ne.div,
3045
- {
3046
- initial: { y: 10, opacity: 0 },
3047
- animate: { y: 0, opacity: 1 },
3048
- exit: { y: -10, opacity: 0 },
3049
- transition: { duration: 0.2 },
3050
- children: /* @__PURE__ */ e(re.Panels, { as: Q, children: $.map((E) => /* @__PURE__ */ e(
3051
- re.Panel,
3036
+ ${T ? "bg-white shadow text-blue-700" : "text-gray-600 hover:bg-white/[0.6]"}`,
3037
+ children: C
3038
+ },
3039
+ C
3040
+ )) }),
3041
+ /* @__PURE__ */ e("div", { className: "mt-4", children: /* @__PURE__ */ e(
3042
+ he,
3052
3043
  {
3053
- className: "space-y-3 focus:outline-none",
3054
- children: /* @__PURE__ */ e(be, { children: m[E].length > 0 ? m[E].map((C) => /* @__PURE__ */ l(
3055
- ne.div,
3056
- {
3057
- layout: !0,
3058
- initial: { opacity: 0, y: 20 },
3059
- animate: { opacity: 1, y: 0 },
3060
- exit: {
3061
- opacity: 0,
3062
- x: -20,
3063
- transition: { duration: 0.2 }
3064
- },
3065
- className: "flex items-center justify-between p-3 bg-white border border-gray-300 rounded-lg shadow-sm",
3066
- children: [
3067
- /* @__PURE__ */ l("div", { className: "flex items-center gap-3 overflow-hidden", children: [
3068
- /* @__PURE__ */ e(
3069
- "img",
3070
- {
3071
- src: C.avatarUrl || `https://avatar.vercel.sh/${C.name}.svg?text=${C.name.charAt(0)}`,
3072
- alt: C.name,
3073
- className: "w-10 h-10 rounded-full flex-shrink-0"
3074
- }
3075
- ),
3076
- /* @__PURE__ */ l("div", { className: "overflow-hidden", children: [
3077
- /* @__PURE__ */ e("p", { className: "font-medium text-gray-900 truncate", children: C.name }),
3078
- E !== "users" && /* @__PURE__ */ e(
3079
- "button",
3080
- {
3081
- onClick: () => o({
3082
- id: C.id,
3083
- type: E,
3084
- name: C.name
3085
- }),
3086
- className: "text-sm text-blue-600 hover:underline hover:cursor-pointer",
3087
- children: "View Members"
3088
- }
3089
- )
3090
- ] })
3091
- ] }),
3092
- /* @__PURE__ */ e(
3093
- bn,
3094
- {
3095
- item: C,
3096
- allowedPermissions: u,
3097
- onPermissionChange: (I) => g(
3098
- C,
3099
- I,
3100
- E
3101
- )
3102
- }
3103
- )
3104
- ]
3105
- },
3106
- C.id
3107
- )) : (
3108
- // Empty state is unchanged
3109
- /* @__PURE__ */ l(
3044
+ onDebouncedChange: a,
3045
+ value: N,
3046
+ placeholder: `Search in ${O[y]}...`
3047
+ }
3048
+ ) })
3049
+ ] }),
3050
+ /* @__PURE__ */ e("div", { className: "flex-grow overflow-y-auto p-4 h-[calc(100vh-330px)]", children: /* @__PURE__ */ e(be, { mode: "wait", children: /* @__PURE__ */ e(
3051
+ ne.div,
3052
+ {
3053
+ initial: { y: 10, opacity: 0 },
3054
+ animate: { y: 0, opacity: 1 },
3055
+ exit: { y: -10, opacity: 0 },
3056
+ transition: { duration: 0.2 },
3057
+ children: /* @__PURE__ */ e(re.Panels, { as: Q, children: L.map((C) => /* @__PURE__ */ e(
3058
+ re.Panel,
3059
+ {
3060
+ className: "space-y-3 focus:outline-none",
3061
+ children: /* @__PURE__ */ e(be, { children: m[C].length > 0 ? m[C].map((T) => /* @__PURE__ */ l(
3110
3062
  ne.div,
3111
3063
  {
3112
- initial: { opacity: 0 },
3113
- animate: { opacity: 1 },
3114
- className: "flex flex-col items-center justify-center text-center p-8 mt-10 bg-white rounded-lg border border-gray-300",
3064
+ layout: !0,
3065
+ initial: { opacity: 0, y: 20 },
3066
+ animate: { opacity: 1, y: 0 },
3067
+ exit: {
3068
+ opacity: 0,
3069
+ x: -20,
3070
+ transition: { duration: 0.2 }
3071
+ },
3072
+ className: "flex items-center justify-between p-3 bg-white border border-gray-300 rounded-lg shadow-sm",
3115
3073
  children: [
3116
- /* @__PURE__ */ e(Ca, { className: "h-12 w-12 text-gray-400" }),
3117
- /* @__PURE__ */ l("h3", { className: "mt-2 text-sm font-medium text-gray-900", children: [
3118
- "No ",
3119
- L[y],
3120
- " Found"
3074
+ /* @__PURE__ */ l("div", { className: "flex items-center gap-3 overflow-hidden", children: [
3075
+ /* @__PURE__ */ e(
3076
+ "img",
3077
+ {
3078
+ src: T.avatarUrl || `https://avatar.vercel.sh/${T.name}.svg?text=${T.name.charAt(0)}`,
3079
+ alt: T.name,
3080
+ className: "w-10 h-10 rounded-full flex-shrink-0"
3081
+ }
3082
+ ),
3083
+ /* @__PURE__ */ l("div", { className: "overflow-hidden", children: [
3084
+ /* @__PURE__ */ e("p", { className: "font-medium text-gray-900 truncate", children: T.name }),
3085
+ C !== "users" && /* @__PURE__ */ e(
3086
+ "button",
3087
+ {
3088
+ onClick: () => o({
3089
+ id: T.id,
3090
+ type: C,
3091
+ name: T.name
3092
+ }),
3093
+ className: "text-sm text-blue-600 hover:underline hover:cursor-pointer",
3094
+ children: "View Members"
3095
+ }
3096
+ )
3097
+ ] })
3121
3098
  ] }),
3122
- /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-500", children: N ? `No results for "${N}"` : `There are no ${L[y].toLowerCase()} with access.` })
3099
+ /* @__PURE__ */ e(
3100
+ bn,
3101
+ {
3102
+ item: T,
3103
+ allowedPermissions: u,
3104
+ onPermissionChange: (E) => g(
3105
+ T,
3106
+ E,
3107
+ C
3108
+ )
3109
+ }
3110
+ )
3123
3111
  ]
3124
- }
3125
- )
3126
- ) })
3127
- },
3128
- E
3129
- )) })
3130
- },
3131
- y
3132
- ) }) })
3133
- ] }) })
3112
+ },
3113
+ T.id
3114
+ )) : (
3115
+ // Empty state is unchanged
3116
+ /* @__PURE__ */ l(
3117
+ ne.div,
3118
+ {
3119
+ initial: { opacity: 0 },
3120
+ animate: { opacity: 1 },
3121
+ className: "flex flex-col items-center justify-center text-center p-8 mt-10 bg-white rounded-lg border border-gray-300",
3122
+ children: [
3123
+ /* @__PURE__ */ e(Ca, { className: "h-12 w-12 text-gray-400" }),
3124
+ /* @__PURE__ */ l("h3", { className: "mt-2 text-sm font-medium text-gray-900", children: [
3125
+ "No ",
3126
+ O[y],
3127
+ " Found"
3128
+ ] }),
3129
+ /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-500", children: N ? `No results for "${N}"` : `There are no ${O[y].toLowerCase()} with access.` })
3130
+ ]
3131
+ }
3132
+ )
3133
+ ) })
3134
+ },
3135
+ C
3136
+ )) })
3137
+ },
3138
+ y
3139
+ ) }) })
3140
+ ] }),
3141
+ /* @__PURE__ */ e("div", { className: "p-4 bg-white border-t border-gray-300 flex justify-end", children: /* @__PURE__ */ e(
3142
+ "button",
3143
+ {
3144
+ onClick: $,
3145
+ className: "px-4 py-2 bg-blue-600 text-white rounded-md shadow hover:bg-blue-700",
3146
+ children: "Update"
3147
+ }
3148
+ ) })
3149
+ ] })
3134
3150
  ] })
3135
3151
  );
3136
3152
  }, Nn = () => /* @__PURE__ */ l("div", { className: "flex items-center gap-4 p-4", children: [
@@ -3146,7 +3162,7 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
3146
3162
  onClose: s,
3147
3163
  members: o
3148
3164
  }) => {
3149
- const [n, u] = O(!0), [i, d] = O(""), y = oa(i, 300), b = o.filter(
3165
+ const [n, u] = B(!0), [i, d] = B(""), y = oa(i, 300), b = o.filter(
3150
3166
  (m) => m.name.toLowerCase().includes(y.toLowerCase())
3151
3167
  ), N = {
3152
3168
  hidden: { opacity: 0 },
@@ -3267,9 +3283,9 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
3267
3283
  allowedPermissions: d = [],
3268
3284
  ...y
3269
3285
  }) => {
3270
- const [b, N] = O(de.INVITE), [a, k] = O(t), [m, g] = O(null), [$, L] = O(!1), [E, C] = O([]), [I, P] = O(de.MANAGE), A = () => {
3286
+ const [b, N] = B(de.INVITE), [a, k] = B(t), [m, g] = B(null), [$, L] = B(!1), [O, C] = B([]), [T, E] = B(de.MANAGE), R = () => {
3271
3287
  N(de.INVITE), g(null), u();
3272
- }, U = () => {
3288
+ }, V = () => {
3273
3289
  N(de.MANAGE);
3274
3290
  }, q = async ({ id: p, name: f, type: w }) => {
3275
3291
  if (w === "groups") {
@@ -3280,16 +3296,16 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
3280
3296
  }
3281
3297
  C(resp);
3282
3298
  }
3283
- g({ id: p, type: w, name: f }), P(b), N(de.MEMBERS);
3299
+ g({ id: p, type: w, name: f }), E(b), N(de.MEMBERS);
3284
3300
  }, G = (p) => {
3285
3301
  k(p);
3286
3302
  const f = !He.isEqual(
3287
3303
  He.mapValues(t, (w) => w.map((c) => ({ id: c.id, permission: c.permission }))),
3288
3304
  He.mapValues(p, (w) => w.map((c) => ({ id: c.id, permission: c.permission })))
3289
3305
  );
3290
- L(f), N(b === de.MEMBERS ? I : de.INVITE);
3306
+ L(f), N(b === de.MEMBERS ? T : de.INVITE);
3291
3307
  };
3292
- return /* @__PURE__ */ e(oe, { appear: !0, show: r, as: Q, children: /* @__PURE__ */ l(me, { as: "div", className: "relative z-50", onClose: A, children: [
3308
+ return /* @__PURE__ */ e(oe, { appear: !0, show: r, as: Q, children: /* @__PURE__ */ l(me, { as: "div", className: "relative z-50", onClose: R, children: [
3293
3309
  /* @__PURE__ */ e("div", { className: "filter-modal-overlay", "aria-hidden": "true" }),
3294
3310
  /* @__PURE__ */ e("div", { className: "filter-modal-container", children: /* @__PURE__ */ e("div", { className: "filter-modal-positioner", children: /* @__PURE__ */ e(Se, { className: "filter-modal-panel", style: { background: "white" }, children: (() => {
3295
3311
  switch (b) {
@@ -3307,7 +3323,7 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
3307
3323
  {
3308
3324
  entity: o,
3309
3325
  onBack: G,
3310
- onClose: A,
3326
+ onClose: R,
3311
3327
  onOpenMembers: q,
3312
3328
  existingShares: a,
3313
3329
  calledBy: n,
@@ -3331,10 +3347,10 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
3331
3347
  {
3332
3348
  entity: m,
3333
3349
  onBack: G,
3334
- onClose: A,
3350
+ onClose: R,
3335
3351
  calledBy: n,
3336
3352
  existingShares: a,
3337
- members: E
3353
+ members: O
3338
3354
  }
3339
3355
  )
3340
3356
  },
@@ -3353,8 +3369,8 @@ const De = dn(), Ee = De.axiosGet, un = De.axiosDelete, Re = De.axiosPost, mn =
3353
3369
  fn,
3354
3370
  {
3355
3371
  entity: o,
3356
- onManage: U,
3357
- onClose: A,
3372
+ onManage: V,
3373
+ onClose: R,
3358
3374
  existingShares: a,
3359
3375
  calledBy: n,
3360
3376
  showExistingShares: i,
@@ -3397,22 +3413,22 @@ function Ye({
3397
3413
  getOptionId: m = ($) => String($.id),
3398
3414
  getOptionLabel: g = ($) => $.name
3399
3415
  }) {
3400
- const $ = ea(), L = ea(), [E, C] = O(""), I = ue(""), P = ce(() => {
3416
+ const $ = ea(), L = ea(), [O, C] = B(""), T = ue(""), E = ce(() => {
3401
3417
  const p = /* @__PURE__ */ new Map();
3402
3418
  for (const f of r) p.set(m(f), f);
3403
3419
  return p;
3404
- }, [r, m]), A = ce(() => Array.isArray(s) ? s.map((p) => p && typeof p == "object" ? P.get(m(p)) || null : P.get(String(p))).filter(Boolean) : [], [s, P, m]), U = ce(() => {
3405
- if (!E) return r;
3406
- const p = E.toLowerCase();
3420
+ }, [r, m]), R = ce(() => Array.isArray(s) ? s.map((p) => p && typeof p == "object" ? E.get(m(p)) || null : E.get(String(p))).filter(Boolean) : [], [s, E, m]), V = ce(() => {
3421
+ if (!O) return r;
3422
+ const p = O.toLowerCase();
3407
3423
  return r.filter((f) => g(f).toLowerCase().includes(p));
3408
- }, [r, E, g]);
3424
+ }, [r, O, g]);
3409
3425
  X(() => {
3410
- b === "server" && E.length >= k && E !== I.current && (I.current = E, N && N(E));
3411
- }, [E, b, k, N]);
3412
- const q = b === "client" ? U : r, G = () => {
3413
- if (!A.length)
3426
+ b === "server" && O.length >= k && O !== T.current && (T.current = O, N && N(O));
3427
+ }, [O, b, k, N]);
3428
+ const q = b === "client" ? V : r, G = () => {
3429
+ if (!R.length)
3414
3430
  return /* @__PURE__ */ e("span", { className: "text-gray-500", children: u });
3415
- const p = A.slice(0, d), f = A.length - d;
3431
+ const p = R.slice(0, d), f = R.length - d;
3416
3432
  return /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-2", children: [
3417
3433
  p.map((w) => /* @__PURE__ */ e(
3418
3434
  "span",
@@ -3429,7 +3445,7 @@ function Ye({
3429
3445
  ] })
3430
3446
  ] });
3431
3447
  };
3432
- return /* @__PURE__ */ e(Z, { value: A, onChange: (p) => {
3448
+ return /* @__PURE__ */ e(Z, { value: R, onChange: (p) => {
3433
3449
  const f = Array.from(new Set(p.map((w) => m(w))));
3434
3450
  y !== -1 && f.length > y || o(f);
3435
3451
  }, multiple: !0, by: "id", children: ({ open: p }) => /* @__PURE__ */ l("div", { children: [
@@ -3471,14 +3487,14 @@ function Ye({
3471
3487
  /* @__PURE__ */ e("div", { className: "p-2 sticky top-0 bg-white z-20 shadow-sm", children: /* @__PURE__ */ e(
3472
3488
  he,
3473
3489
  {
3474
- value: E,
3490
+ value: O,
3475
3491
  onDebouncedChange: C,
3476
3492
  placeholder: b === "server" ? `Search (min ${k})…` : "Search options…"
3477
3493
  }
3478
3494
  ) }),
3479
3495
  b === "server" && a && /* @__PURE__ */ e("div", { className: "py-2 px-3 text-gray-500", children: "Loading…" }),
3480
- q.length === 0 && !a ? /* @__PURE__ */ e("div", { className: "py-2 px-3 text-gray-500", children: b === "server" ? E.length < k ? `Type at least ${k} characters to search.` : "No results." : "No options found." }) : q.map((f) => {
3481
- const w = m(f), c = g(f), h = A.some((F) => m(F) === w), x = y !== -1 && A.length >= y && !h;
3496
+ q.length === 0 && !a ? /* @__PURE__ */ e("div", { className: "py-2 px-3 text-gray-500", children: b === "server" ? O.length < k ? `Type at least ${k} characters to search.` : "No results." : "No options found." }) : q.map((f) => {
3497
+ const w = m(f), c = g(f), h = R.some((F) => m(F) === w), x = y !== -1 && R.length >= y && !h;
3482
3498
  return /* @__PURE__ */ e(
3483
3499
  Z.Option,
3484
3500
  {
@@ -3488,7 +3504,7 @@ function Ye({
3488
3504
  x ? " text-gray-400 bg-white cursor-not-allowed" : F ? " bg-gray-200 text-gray-900" : " text-gray-900",
3489
3505
  " relative cursor-default select-none py-2 pl-3 pr-9"
3490
3506
  ),
3491
- children: ({ selected: F, active: R }) => /* @__PURE__ */ l(ee, { children: [
3507
+ children: ({ selected: F, active: I }) => /* @__PURE__ */ l(ee, { children: [
3492
3508
  /* @__PURE__ */ e(
3493
3509
  "span",
3494
3510
  {
@@ -3503,7 +3519,7 @@ function Ye({
3503
3519
  "span",
3504
3520
  {
3505
3521
  className: Pe(
3506
- R ? " text-gray-900" : " text-gray-600",
3522
+ I ? " text-gray-900" : " text-gray-600",
3507
3523
  " absolute inset-y-0 right-0 flex items-center pr-4"
3508
3524
  ),
3509
3525
  children: /* @__PURE__ */ e(Ge, { className: "w-5 h-5", "aria-hidden": "true" })
@@ -3675,9 +3691,9 @@ function Cn({
3675
3691
  dropId: N,
3676
3692
  indent: a = 24
3677
3693
  }) {
3678
- const { setNodeRef: k, isOver: m } = Vt({ id: N }), { attributes: g, listeners: $, setNodeRef: L, transform: E, isDragging: C } = Ut({ id: b }), I = E ? { transform: `translate3d(${Math.round(E.x)}px, ${Math.round(E.y)}px, 0)` } : void 0, [P, A] = O(!1), [U, q] = O(t.name), G = () => {
3679
- const p = U.trim();
3680
- A(!1), p && p !== t.name ? i?.(t, p) : q(t.name);
3694
+ const { setNodeRef: k, isOver: m } = Ut({ id: N }), { attributes: g, listeners: $, setNodeRef: L, transform: O, isDragging: C } = Vt({ id: b }), T = O ? { transform: `translate3d(${Math.round(O.x)}px, ${Math.round(O.y)}px, 0)` } : void 0, [E, R] = B(!1), [V, q] = B(t.name), G = () => {
3695
+ const p = V.trim();
3696
+ R(!1), p && p !== t.name ? i?.(t, p) : q(t.name);
3681
3697
  }, v = ce(() => /* @__PURE__ */ e(
3682
3698
  an,
3683
3699
  {
@@ -3687,7 +3703,7 @@ function Cn({
3687
3703
  { action: "delete", label: "Delete" }
3688
3704
  ],
3689
3705
  onSelect: (f) => {
3690
- f.action === "create" ? u?.(t) : f.action === "rename" ? A(!0) : f.action === "delete" && d?.(t);
3706
+ f.action === "create" ? u?.(t) : f.action === "rename" ? R(!0) : f.action === "delete" && d?.(t);
3691
3707
  }
3692
3708
  }
3693
3709
  ), [t, u, d]);
@@ -3696,30 +3712,30 @@ function Cn({
3696
3712
  {
3697
3713
  ref: k,
3698
3714
  className: `tv-row ${m ? "tv-drop-over" : ""} ${C ? "dragging" : ""}`,
3699
- style: { ...I, paddingLeft: 8 + r * a },
3715
+ style: { ...T, paddingLeft: 8 + r * a },
3700
3716
  onClick: (p) => {
3701
3717
  p.target.closest(".tv-toggle") || p.target.tagName === "INPUT" || n?.(t);
3702
3718
  },
3703
3719
  children: [
3704
3720
  /* @__PURE__ */ e("button", { className: "tv-toggle", onClick: o, "aria-label": "toggle", children: t.children?.length ? s ? /* @__PURE__ */ e(wa, { size: 16 }) : /* @__PURE__ */ e(je, { size: 16 }) : /* @__PURE__ */ e("span", { className: "tv-spacer" }) }),
3705
3721
  /* @__PURE__ */ e(Fa, { size: 16, className: "tv-folder-ic" }),
3706
- /* @__PURE__ */ e("div", { className: "tv-name", ref: L, children: P ? /* @__PURE__ */ e(
3722
+ /* @__PURE__ */ e("div", { className: "tv-name", ref: L, children: E ? /* @__PURE__ */ e(
3707
3723
  "input",
3708
3724
  {
3709
3725
  className: "tv-input",
3710
- value: U,
3726
+ value: V,
3711
3727
  onChange: (p) => q(p.target.value),
3712
3728
  onBlur: G,
3713
3729
  onKeyDown: (p) => {
3714
- p.key === "Enter" && G(), p.key === "Escape" && (A(!1), q(t.name));
3730
+ p.key === "Enter" && G(), p.key === "Escape" && (R(!1), q(t.name));
3715
3731
  },
3716
3732
  autoFocus: !0
3717
3733
  }
3718
- ) : /* @__PURE__ */ e("span", { onDoubleClick: () => A(!0), children: t.name }) }),
3734
+ ) : /* @__PURE__ */ e("span", { onDoubleClick: () => R(!0), children: t.name }) }),
3719
3735
  /* @__PURE__ */ e(wn, { listeners: $, attributes: g }),
3720
3736
  /* @__PURE__ */ e("div", { className: "tv-actions", children: y ? y(t, {
3721
3737
  onCreateChild: () => u?.(t),
3722
- onRename: () => A(!0),
3738
+ onRename: () => R(!0),
3723
3739
  onDelete: () => d?.(t)
3724
3740
  }) : v })
3725
3741
  ]
@@ -3820,93 +3836,93 @@ function ps({
3820
3836
  const { roots: $ } = ce(() => Fn(t) ? An(t, { rootId: r, getId: o, getName: u }) : Tn(
3821
3837
  t.map((x) => ({ ...x })),
3822
3838
  { rootId: r, getId: o, getParent: n, getName: u }
3823
- ), [t, r, o, n, u]), [L, E] = O({}), C = K((x) => {
3839
+ ), [t, r, o, n, u]), [L, O] = B({}), C = K((x) => {
3824
3840
  const F = {};
3825
- return (function R(j) {
3841
+ return (function I(j) {
3826
3842
  j.forEach((S) => {
3827
- F[S.id] = !0, S.children?.length && R(S.children);
3843
+ F[S.id] = !0, S.children?.length && I(S.children);
3828
3844
  });
3829
3845
  })(x), F;
3830
3846
  }, []);
3831
3847
  ae.useEffect(() => {
3832
- E(C($));
3848
+ O(C($));
3833
3849
  }, [$, C]);
3834
- const I = K(
3835
- (x) => E((F) => ({ ...F, [x]: !F[x] })),
3850
+ const T = K(
3851
+ (x) => O((F) => ({ ...F, [x]: !F[x] })),
3836
3852
  []
3837
- ), [P, A] = O(() => Ae($));
3838
- ae.useEffect(() => A(Ae($)), [$]);
3839
- const U = qt(
3853
+ ), [E, R] = B(() => Ae($));
3854
+ ae.useEffect(() => R(Ae($)), [$]);
3855
+ const V = qt(
3840
3856
  jt(Yt, { activationConstraint: { delay: 250, tolerance: 5 } })
3841
- ), q = ue(null), [G, v] = O(null), p = ue(0), f = () => {
3857
+ ), q = ue(null), [G, v] = B(null), p = ue(0), f = () => {
3842
3858
  }, w = ({ delta: x }) => {
3843
3859
  p.current = x?.x ?? 0;
3844
3860
  }, c = K(
3845
3861
  ({ active: x, over: F }) => {
3846
- const R = p.current;
3862
+ const I = p.current;
3847
3863
  if (p.current = 0, v(null), !x || !F) return;
3848
3864
  const j = String(x.id).replace(/^drag-/, ""), S = String(F.id).replace(/^drop-/, "");
3849
3865
  if (!j || !S || j === S) return;
3850
- let T = S;
3851
- const M = Math.max(0, Math.floor(-R / g));
3866
+ let A = S;
3867
+ const M = Math.max(0, Math.floor(-I / g));
3852
3868
  if (M > 0) {
3853
3869
  let ie = S;
3854
3870
  for (let xe = 0; xe < M; xe++) {
3855
- const B = Ka(P, ie, null);
3856
- if (!B) break;
3857
- if (!B.parentId) {
3858
- T = r;
3871
+ const P = Ka(E, ie, null);
3872
+ if (!P) break;
3873
+ if (!P.parentId) {
3874
+ A = r;
3859
3875
  break;
3860
3876
  }
3861
- T = B.parentId, ie = B.parentId;
3877
+ A = P.parentId, ie = P.parentId;
3862
3878
  }
3863
3879
  }
3864
- if (m && T === r) {
3865
- A(Ae($));
3880
+ if (m && A === r) {
3881
+ R(Ae($));
3866
3882
  return;
3867
3883
  }
3868
- const D = Ae(P), { newRoots: z, removed: V } = En(D, j);
3869
- if (!V) return;
3870
- const Ne = Rn(z, T, V);
3871
- A(Ne), a?.({ sourceId: j, destParentId: T, newTree: Ne });
3884
+ const D = Ae(E), { newRoots: z, removed: U } = En(D, j);
3885
+ if (!U) return;
3886
+ const Ne = Rn(z, A, U);
3887
+ R(Ne), a?.({ sourceId: j, destParentId: A, newTree: Ne });
3872
3888
  },
3873
- [P, $, r, m, g, a]
3889
+ [E, $, r, m, g, a]
3874
3890
  ), h = K(
3875
- (x, F = 0) => x.map((R) => /* @__PURE__ */ l(ae.Fragment, { children: [
3891
+ (x, F = 0) => x.map((I) => /* @__PURE__ */ l(ae.Fragment, { children: [
3876
3892
  /* @__PURE__ */ e(
3877
3893
  Cn,
3878
3894
  {
3879
- node: R,
3895
+ node: I,
3880
3896
  depth: F,
3881
- expanded: !!L[R.id],
3882
- onToggle: () => I(R.id),
3897
+ expanded: !!L[I.id],
3898
+ onToggle: () => T(I.id),
3883
3899
  onSelect: i,
3884
3900
  onCreateChild: y,
3885
3901
  onRename: b,
3886
3902
  onDelete: N,
3887
3903
  renderActions: k,
3888
- dragId: `drag-${R.id}`,
3889
- dropId: `drop-${R.id}`,
3904
+ dragId: `drag-${I.id}`,
3905
+ dropId: `drop-${I.id}`,
3890
3906
  indent: g
3891
3907
  }
3892
3908
  ),
3893
- L[R.id] && R.children?.length > 0 ? h(R.children, F + 1) : null
3894
- ] }, R.id)),
3895
- [L, g, y, N, b, i, k, I]
3909
+ L[I.id] && I.children?.length > 0 ? h(I.children, F + 1) : null
3910
+ ] }, I.id)),
3911
+ [L, g, y, N, b, i, k, T]
3896
3912
  );
3897
3913
  return ae.useMemo(() => {
3898
3914
  if (!G) return null;
3899
3915
  const x = String(G).replace(/^drag-/, "");
3900
- function F(R) {
3901
- for (const j of R) {
3916
+ function F(I) {
3917
+ for (const j of I) {
3902
3918
  if (j.id === x) return j;
3903
3919
  const S = j.children?.length ? F(j.children) : null;
3904
3920
  if (S) return S;
3905
3921
  }
3906
3922
  return null;
3907
3923
  }
3908
- return F(P);
3909
- }, [G, P]), /* @__PURE__ */ l("div", { className: "tv", children: [
3924
+ return F(E);
3925
+ }, [G, E]), /* @__PURE__ */ l("div", { className: "tv", children: [
3910
3926
  s !== !1 && /* @__PURE__ */ l("div", { className: "tv-header", children: [
3911
3927
  /* @__PURE__ */ e("div", { className: "tv-title", children: s }),
3912
3928
  /* @__PURE__ */ e("button", { className: "tv-btn", onClick: d, children: "+ New folder" })
@@ -3920,12 +3936,12 @@ function ps({
3920
3936
  Gt,
3921
3937
  {
3922
3938
  collisionDetection: Wt,
3923
- sensors: U,
3939
+ sensors: V,
3924
3940
  onDragStart: f,
3925
3941
  onDragMove: w,
3926
3942
  onDragEnd: c,
3927
3943
  modifiers: [_t],
3928
- children: /* @__PURE__ */ e("div", { ref: q, className: "tv-list", children: h(P, 0) })
3944
+ children: /* @__PURE__ */ e("div", { ref: q, className: "tv-list", children: h(E, 0) })
3929
3945
  }
3930
3946
  )
3931
3947
  ] });
@@ -4251,7 +4267,7 @@ function In({ item: t, data: r, updateHandler: s, validationErrors: o = {} }) {
4251
4267
  ) }),
4252
4268
  a.fieldtype === "radio" && /* @__PURE__ */ l("div", { children: [
4253
4269
  /* @__PURE__ */ e(
4254
- Va,
4270
+ Ua,
4255
4271
  {
4256
4272
  selectedValue: typeof i[a.key] < "u" ? i[a.key] : a.default || "",
4257
4273
  onValueChange: (m) => {
@@ -4440,9 +4456,9 @@ function In({ item: t, data: r, updateHandler: s, validationErrors: o = {} }) {
4440
4456
  const zn = ({ children: t }) => /* @__PURE__ */ e("div", { className: "flex -space-x-2", children: t });
4441
4457
  function Pn({ item: t, data: r, updateHandler: s, validationErrors: o = {} }) {
4442
4458
  console.log(`[DynamicConfig/DataTableRenderer] Component loaded for section: ${t.key}`);
4443
- const [n, u] = O(t), [i, d] = O(null), [y, b] = O(null);
4459
+ const [n, u] = B(t), [i, d] = B(null), [y, b] = B(null);
4444
4460
  console.log(`[DataTableRenderer] ${n.key} - Received props:`, { item: t, initialData: r });
4445
- const [N, a] = O(() => {
4461
+ const [N, a] = B(() => {
4446
4462
  const v = r && r[n.key] || [], p = v.length > 0 ? v : [{ id: 0 }];
4447
4463
  return console.log(`[DataTableRenderer] ${n.key} - Initial data:`, p), p;
4448
4464
  }), k = ue(r);
@@ -4581,12 +4597,12 @@ function Pn({ item: t, data: r, updateHandler: s, validationErrors: o = {} }) {
4581
4597
  return (c, h) => {
4582
4598
  const x = () => {
4583
4599
  if (v.optionsFrom && r) {
4584
- const { config: F, valueField: R, labelField: j } = v.optionsFrom, S = r[F] || [];
4600
+ const { config: F, valueField: I, labelField: j } = v.optionsFrom, S = r[F] || [];
4585
4601
  if (Array.isArray(S))
4586
- return S.map((T) => ({
4587
- id: T[R] || "",
4588
- value: T[R] || "",
4589
- label: T[j] || ""
4602
+ return S.map((A) => ({
4603
+ id: A[I] || "",
4604
+ value: A[I] || "",
4605
+ label: A[j] || ""
4590
4606
  }));
4591
4607
  }
4592
4608
  return v.options || [];
@@ -4680,7 +4696,7 @@ function Pn({ item: t, data: r, updateHandler: s, validationErrors: o = {} }) {
4680
4696
  );
4681
4697
  case "radio":
4682
4698
  return (c, h) => /* @__PURE__ */ e(
4683
- Va,
4699
+ Ua,
4684
4700
  {
4685
4701
  selectedValue: c[v.key] || "",
4686
4702
  onValueChange: (x) => p(h, x),
@@ -4706,12 +4722,12 @@ function Pn({ item: t, data: r, updateHandler: s, validationErrors: o = {} }) {
4706
4722
  ...x.roles || []
4707
4723
  ];
4708
4724
  return /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
4709
- /* @__PURE__ */ e(zn, { children: F.length > 0 ? F.slice(0, 3).map((R, j) => /* @__PURE__ */ e(
4725
+ /* @__PURE__ */ e(zn, { children: F.length > 0 ? F.slice(0, 3).map((I, j) => /* @__PURE__ */ e(
4710
4726
  za,
4711
4727
  {
4712
4728
  size: "small",
4713
- name: R.name || R.displayName || R.id,
4714
- src: R.avatarUrl
4729
+ name: I.name || I.displayName || I.id,
4730
+ src: I.avatarUrl
4715
4731
  },
4716
4732
  j
4717
4733
  )) : null }),
@@ -4804,24 +4820,24 @@ function Pn({ item: t, data: r, updateHandler: s, validationErrors: o = {} }) {
4804
4820
  const f = [...v, p];
4805
4821
  return console.log("[DataTableRenderer] Updated data:", f), f;
4806
4822
  });
4807
- }, [n.fields]), E = K((v) => {
4823
+ }, [n.fields]), O = K((v) => {
4808
4824
  a((p) => {
4809
4825
  if (p.length <= 1)
4810
4826
  return p;
4811
4827
  const f = [...p];
4812
4828
  return f.splice(v, 1), f;
4813
4829
  });
4814
- }, []), [C, I] = O(null), P = K((v, p) => {
4815
- I(p), v.dataTransfer.effectAllowed = "move", v.dataTransfer.setData("text/html", "");
4816
- }, []), A = K((v) => {
4830
+ }, []), [C, T] = B(null), E = K((v, p) => {
4831
+ T(p), v.dataTransfer.effectAllowed = "move", v.dataTransfer.setData("text/html", "");
4832
+ }, []), R = K((v) => {
4817
4833
  v.preventDefault(), v.dataTransfer.dropEffect = "move";
4818
- }, []), U = K((v, p) => {
4834
+ }, []), V = K((v, p) => {
4819
4835
  v.preventDefault(), !(C === null || C === p) && (a((f) => {
4820
4836
  const w = [...f], c = w[C];
4821
4837
  return w.splice(C, 1), w.splice(p, 0, c), w;
4822
- }), I(null));
4838
+ }), T(null));
4823
4839
  }, [C]), q = K(() => {
4824
- I(null);
4840
+ T(null);
4825
4841
  }, []), G = K((v) => {
4826
4842
  console.log("[DataTableRenderer] handleAddAudience called with:", v), a((p) => {
4827
4843
  const f = [...p];
@@ -4869,9 +4885,9 @@ function Pn({ item: t, data: r, updateHandler: s, validationErrors: o = {} }) {
4869
4885
  {
4870
4886
  className: `hover:bg-gray-50 ${C === p ? "opacity-50" : ""}`,
4871
4887
  draggable: !0,
4872
- onDragStart: (f) => P(f, p),
4873
- onDragOver: A,
4874
- onDrop: (f) => U(f, p),
4888
+ onDragStart: (f) => E(f, p),
4889
+ onDragOver: R,
4890
+ onDrop: (f) => V(f, p),
4875
4891
  onDragEnd: q,
4876
4892
  children: [
4877
4893
  /* @__PURE__ */ e("td", { className: "px-4 py-2 ", children: /* @__PURE__ */ e("div", { className: "cursor-move text-gray-400 hover:text-gray-600", children: /* @__PURE__ */ e(sa, { size: 16 }) }) }),
@@ -4879,7 +4895,7 @@ function Pn({ item: t, data: r, updateHandler: s, validationErrors: o = {} }) {
4879
4895
  /* @__PURE__ */ e("td", { className: "px-4 py-2 ", children: /* @__PURE__ */ e(
4880
4896
  "button",
4881
4897
  {
4882
- onClick: () => E(p),
4898
+ onClick: () => O(p),
4883
4899
  className: "text-red-500 hover:text-red-700",
4884
4900
  title: "Delete row",
4885
4901
  children: /* @__PURE__ */ e(Jt, { size: 16 })
@@ -4978,43 +4994,43 @@ const fa = () => {
4978
4994
  initialData: y = null
4979
4995
  // Add prop for initial demo data
4980
4996
  }) => {
4981
- const [b, N] = O(null), [a, k] = O(""), [m, g] = O(() => Array.isArray(y) ? y : []), [$, L] = O(null), [E, C] = O(null), [I, P] = O(""), A = async () => {
4997
+ const [b, N] = B(null), [a, k] = B(""), [m, g] = B(() => Array.isArray(y) ? y : []), [$, L] = B(null), [O, C] = B(null), [T, E] = B(""), R = async () => {
4982
4998
  try {
4983
4999
  const S = await Ee(t.collectionList);
4984
5000
  if (S) {
4985
- const T = S.map((M, D) => ({
5001
+ const A = S.map((M, D) => ({
4986
5002
  ...M,
4987
5003
  order: typeof M.order == "number" ? M.order : D + 1
4988
5004
  }));
4989
- T.sort((M, D) => (M.order ?? 0) - (D.order ?? 0)), g(T), s?.(T);
5005
+ A.sort((M, D) => (M.order ?? 0) - (D.order ?? 0)), g(A), s?.(A);
4990
5006
  }
4991
5007
  } catch (S) {
4992
5008
  console.log("Error loading collections:", S), typeof window < "u" && !window.location.pathname.includes("iframe.html") && le.error("Failed to load collections");
4993
5009
  }
4994
5010
  };
4995
5011
  X(() => {
4996
- (!y || y.length === 0) && A();
5012
+ (!y || y.length === 0) && R();
4997
5013
  }, [y]), X(() => {
4998
5014
  Array.isArray(y) && g(y);
4999
5015
  }, [y]);
5000
- const U = (S) => {
5016
+ const V = (S) => {
5001
5017
  u && (N(S.id), k(S.categoryName || ""));
5002
5018
  }, q = () => {
5003
5019
  if (!n || b !== null) return;
5004
5020
  const S = `temp-${Date.now()}`;
5005
- g((T) => [
5006
- ...T,
5021
+ g((A) => [
5022
+ ...A,
5007
5023
  {
5008
5024
  id: S,
5009
5025
  categoryName: "",
5010
5026
  links: [],
5011
- order: (T.at(-1)?.order ?? 0) + 1,
5027
+ order: (A.at(-1)?.order ?? 0) + 1,
5012
5028
  _temp: !0
5013
5029
  }
5014
5030
  ]), N(S), k("");
5015
5031
  }, G = () => {
5016
5032
  b != null && (g((S) => {
5017
- const T = S.find((D) => D.id === b), M = T && T._temp ? S.filter((D) => D.id !== b) : S;
5033
+ const A = S.find((D) => D.id === b), M = A && A._temp ? S.filter((D) => D.id !== b) : S;
5018
5034
  return s?.(M), M;
5019
5035
  }), N(null), k(""));
5020
5036
  }, v = async () => {
@@ -5022,78 +5038,78 @@ const fa = () => {
5022
5038
  const S = typeof b == "string" && b.startsWith("temp-");
5023
5039
  try {
5024
5040
  if (S) {
5025
- const T = await Re(t.collectionCreate, {
5041
+ const A = await Re(t.collectionCreate, {
5026
5042
  categoryName: a.trim(),
5027
5043
  order: (Array.isArray(m) && m.length > 0 ? m.at(-1)?.order ?? 0 : 0) + 1
5028
5044
  });
5029
- T && (g((M) => {
5030
- const D = M.map((z) => z.id === b ? T : z);
5045
+ A && (g((M) => {
5046
+ const D = M.map((z) => z.id === b ? A : z);
5031
5047
  return s?.(D), D;
5032
5048
  }), ke.success("Collection created successfully"));
5033
5049
  } else {
5034
- const T = await mn(
5050
+ const A = await mn(
5035
5051
  `${t.collectionUpdate}/${b}?newName=${a.trim()}`
5036
5052
  );
5037
5053
  g((M) => {
5038
5054
  const D = M.map(
5039
- (z) => z.id === b ? T && T.id ? { ...z, ...T } : { ...z, categoryName: a.trim() } : z
5055
+ (z) => z.id === b ? A && A.id ? { ...z, ...A } : { ...z, categoryName: a.trim() } : z
5040
5056
  );
5041
5057
  return s?.(D), D;
5042
5058
  }), le.success("Collection updated successfully");
5043
5059
  }
5044
5060
  N(null), k("");
5045
- } catch (T) {
5046
- console.log(T), le.error("Failed to save collection");
5061
+ } catch (A) {
5062
+ console.log(A), le.error("Failed to save collection");
5047
5063
  }
5048
5064
  }, p = async (S) => {
5049
5065
  if (i)
5050
5066
  try {
5051
- await un(`${t.collectionUpdate}/${S.id}`) && (le.success("Deleted successfully", { autoClose: 3e3 }), A());
5052
- } catch (T) {
5053
- console.log(T), le.error("Failed to delete collection");
5067
+ await un(`${t.collectionUpdate}/${S.id}`) && (le.success("Deleted successfully", { autoClose: 3e3 }), R());
5068
+ } catch (A) {
5069
+ console.log(A), le.error("Failed to delete collection");
5054
5070
  }
5055
- }, f = (S, T, M) => {
5056
- if (!d || !T || !M || T === M) return S;
5057
- const D = S.findIndex((ie) => ie.id === T), z = S.findIndex((ie) => ie.id === M);
5071
+ }, f = (S, A, M) => {
5072
+ if (!d || !A || !M || A === M) return S;
5073
+ const D = S.findIndex((ie) => ie.id === A), z = S.findIndex((ie) => ie.id === M);
5058
5074
  if (D === -1 || z === -1) return S;
5059
- const V = [...S], [Ne] = V.splice(D, 1);
5060
- return V.splice(z, 0, Ne), V.map((ie, xe) => ({ ...ie, order: xe + 1 }));
5075
+ const U = [...S], [Ne] = U.splice(D, 1);
5076
+ return U.splice(z, 0, Ne), U.map((ie, xe) => ({ ...ie, order: xe + 1 }));
5061
5077
  }, w = async (S) => {
5062
- const T = S.map((M) => ({
5078
+ const A = S.map((M) => ({
5063
5079
  id: M.id,
5064
5080
  order: M.order,
5065
5081
  categoryName: M.categoryName
5066
5082
  }));
5067
5083
  try {
5068
- await Re(t.updateCollection, T);
5084
+ await Re(t.updateCollection, A);
5069
5085
  } catch (M) {
5070
5086
  console.log(M), le.error("Failed to save order", { autoClose: 2500 });
5071
5087
  }
5072
- }, c = (S, T) => {
5073
- d && (S.dataTransfer.effectAllowed = "move", S.dataTransfer.setData("text/plain", String(T)), L(T));
5088
+ }, c = (S, A) => {
5089
+ d && (S.dataTransfer.effectAllowed = "move", S.dataTransfer.setData("text/plain", String(A)), L(A));
5074
5090
  }, h = (S) => {
5075
- $ && S !== E && C(S);
5091
+ $ && S !== O && C(S);
5076
5092
  }, x = (S) => {
5077
5093
  S.preventDefault();
5078
- }, F = async (S, T) => {
5094
+ }, F = async (S, A) => {
5079
5095
  S.preventDefault();
5080
5096
  const M = S.dataTransfer.getData("text/plain");
5081
5097
  M && (g((D) => {
5082
- const z = f(D, M, T);
5098
+ const z = f(D, M, A);
5083
5099
  return console.log("Reordered", z), w(z), s?.(z), z;
5084
5100
  }), L(null), C(null));
5085
- }, R = () => {
5101
+ }, I = () => {
5086
5102
  L(null), C(null);
5087
5103
  }, j = Array.isArray(m) ? m.filter(
5088
- (S) => S.categoryName?.toLowerCase().includes(I.toLowerCase())
5104
+ (S) => S.categoryName?.toLowerCase().includes(T.toLowerCase())
5089
5105
  ) : [];
5090
5106
  return /* @__PURE__ */ l("div", { className: `manage-collection-list ${r}`, children: [
5091
5107
  /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ l("div", { className: "w-1/2 flex justify-end", children: [
5092
5108
  o && /* @__PURE__ */ e(
5093
5109
  he,
5094
5110
  {
5095
- value: I,
5096
- onDebouncedChange: P,
5111
+ value: T,
5112
+ onDebouncedChange: E,
5097
5113
  placeholder: "Search Collection",
5098
5114
  customClass: "mr-4 searchmanagecollection"
5099
5115
  }
@@ -5112,21 +5128,21 @@ const fa = () => {
5112
5128
  )
5113
5129
  ] }) }),
5114
5130
  /* @__PURE__ */ e("div", { className: "mt-5 flex flex-col", children: j.map((S) => {
5115
- const T = b === S.id, M = S?.links?.length ?? 0, D = $ === S.id, z = E === S.id && $ !== S.id;
5131
+ const A = b === S.id, M = S?.links?.length ?? 0, D = $ === S.id, z = O === S.id && $ !== S.id;
5116
5132
  return /* @__PURE__ */ e(
5117
5133
  "div",
5118
5134
  {
5119
5135
  onDragEnter: () => h(S.id),
5120
5136
  onDragOver: x,
5121
- onDrop: (V) => F(V, S.id),
5122
- onDragEnd: R,
5137
+ onDrop: (U) => F(U, S.id),
5138
+ onDragEnd: I,
5123
5139
  className: [
5124
5140
  "flex items-center justify-between p-3 border rounded-2xl mb-3",
5125
5141
  "border-gray-300",
5126
5142
  z ? "ring-2 ring-gray-800/20" : "",
5127
5143
  D ? "opacity-60" : ""
5128
5144
  ].join(" "),
5129
- children: T ? /* @__PURE__ */ l(ee, { children: [
5145
+ children: A ? /* @__PURE__ */ l(ee, { children: [
5130
5146
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2 flex-1", children: /* @__PURE__ */ e(
5131
5147
  "input",
5132
5148
  {
@@ -5134,9 +5150,9 @@ const fa = () => {
5134
5150
  className: "flex-1 h-10 px-3 max-w-[200px] border border-gray-300 rounded-2xl outline-none focus:ring-2 focus:ring-gray-800/20",
5135
5151
  value: a,
5136
5152
  placeholder: S._temp ? "New collection name" : "Edit collection name",
5137
- onChange: (V) => k(V.target.value),
5138
- onKeyDown: (V) => {
5139
- V.key === "Enter" && v(), V.key === "Escape" && G();
5153
+ onChange: (U) => k(U.target.value),
5154
+ onKeyDown: (U) => {
5155
+ U.key === "Enter" && v(), U.key === "Escape" && G();
5140
5156
  },
5141
5157
  autoFocus: !0
5142
5158
  }
@@ -5175,7 +5191,7 @@ const fa = () => {
5175
5191
  "aria-label": "Drag to reorder",
5176
5192
  className: "cursor-grab active:cursor-grabbing p-1 -m-1 rounded-md hover:bg-gray-50",
5177
5193
  draggable: !0,
5178
- onDragStart: (V) => c(V, S.id),
5194
+ onDragStart: (U) => c(U, S.id),
5179
5195
  children: /* @__PURE__ */ e(sa, {})
5180
5196
  }
5181
5197
  ),
@@ -5187,7 +5203,7 @@ const fa = () => {
5187
5203
  "button",
5188
5204
  {
5189
5205
  className: "cursor-pointer",
5190
- onClick: () => U(S),
5206
+ onClick: () => V(S),
5191
5207
  "aria-label": `Edit ${S.categoryName}`,
5192
5208
  children: /* @__PURE__ */ e(Qt, { color: "#767676" })
5193
5209
  }
@@ -5198,7 +5214,7 @@ const fa = () => {
5198
5214
  className: M === 0 && !S.protected ? "cursor-pointer" : "cursor-not-allowed",
5199
5215
  title: M === 0 && !S.protected ? "Delete" : "Cannot delete this collection",
5200
5216
  onClick: M === 0 ? () => p(S) : null,
5201
- children: /* @__PURE__ */ e(Ue, { color: M === 0 ? "#767676" : "#C2C2C2" })
5217
+ children: /* @__PURE__ */ e(Ve, { color: M === 0 ? "#767676" : "#C2C2C2" })
5202
5218
  }
5203
5219
  )
5204
5220
  ] })
@@ -5259,43 +5275,43 @@ function Mn(t) {
5259
5275
  const r = On(t);
5260
5276
  return Ce[r] || Ce[r.toLowerCase?.()] || Ln;
5261
5277
  }
5262
- function Vn({
5278
+ function Un({
5263
5279
  appid: t,
5264
5280
  configdata: r = null,
5265
5281
  disableApi: s = !1,
5266
5282
  onCancel: o,
5267
5283
  onSave: n
5268
5284
  }) {
5269
- const [u, i] = ae.useState(r), [d, y] = ae.useState(null), [b, N] = O(!1), [a, k] = O(!1), [m, g] = O({}), $ = `${ve()}/unifyedxappmodulemanagement/api/v1/appmanager/${t}/configuration`, L = $, [E, C] = O(1), I = (f) => {
5285
+ const [u, i] = ae.useState(r), [d, y] = ae.useState(null), [b, N] = B(!1), [a, k] = B(!1), [m, g] = B({}), $ = `${ve()}/unifyedxappmodulemanagement/api/v1/appmanager/${t}/configuration`, L = $, [O, C] = B(1), T = (f) => {
5270
5286
  if (!r || !r.configuration)
5271
5287
  return f;
5272
5288
  const w = {}, c = f?.configuration || {};
5273
5289
  return r.configuration.forEach((h) => {
5274
5290
  if (h.key && h.type === "datatable") {
5275
- const F = (c[h.key] || []).map((R, j) => {
5276
- const S = { id: R.id || 0 };
5277
- return h.fields && h.fields.forEach((T) => {
5278
- if (T.fieldtype === "audience") {
5291
+ const F = (c[h.key] || []).map((I, j) => {
5292
+ const S = { id: I.id || 0 };
5293
+ return h.fields && h.fields.forEach((A) => {
5294
+ if (A.fieldtype === "audience") {
5279
5295
  let M = { users: [], groups: [], roles: [] };
5280
- R[T.key] && (Array.isArray(R[T.key]) ? M = { users: [], groups: [], roles: [] } : typeof R[T.key] == "object" && (M = {
5281
- users: R[T.key].users || [],
5282
- groups: R[T.key].groups || [],
5283
- roles: R[T.key].roles || []
5284
- })), S[T.key] = M;
5296
+ I[A.key] && (Array.isArray(I[A.key]) ? M = { users: [], groups: [], roles: [] } : typeof I[A.key] == "object" && (M = {
5297
+ users: I[A.key].users || [],
5298
+ groups: I[A.key].groups || [],
5299
+ roles: I[A.key].roles || []
5300
+ })), S[A.key] = M;
5285
5301
  } else
5286
- S[T.key] = R[T.key] || T.default || "";
5302
+ S[A.key] = I[A.key] || A.default || "";
5287
5303
  }), S;
5288
5304
  });
5289
5305
  if (F.length === 0) {
5290
- const R = { id: 0 };
5306
+ const I = { id: 0 };
5291
5307
  h.fields && h.fields.forEach((j) => {
5292
- j.fieldtype === "audience" ? R[j.key] = { users: [], groups: [], roles: [] } : R[j.key] = j.default || "";
5293
- }), F.push(R);
5308
+ j.fieldtype === "audience" ? I[j.key] = { users: [], groups: [], roles: [] } : I[j.key] = j.default || "";
5309
+ }), F.push(I);
5294
5310
  }
5295
5311
  w[h.key] = F;
5296
5312
  } else h.key && (w[h.key] = c[h.key] || {});
5297
5313
  }), w;
5298
- }, P = () => {
5314
+ }, E = () => {
5299
5315
  if (r && r.configuration) {
5300
5316
  const f = {};
5301
5317
  r.configuration.forEach((w) => {
@@ -5325,10 +5341,10 @@ function Vn({
5325
5341
  N(!0);
5326
5342
  let w = await Ee($);
5327
5343
  if (w) {
5328
- const c = I(w);
5344
+ const c = T(w);
5329
5345
  y(c);
5330
5346
  } else
5331
- P();
5347
+ E();
5332
5348
  } catch (w) {
5333
5349
  console.error("Error fetching configuration:", w);
5334
5350
  let c = "Failed to load configuration";
@@ -5336,14 +5352,14 @@ function Vn({
5336
5352
  const h = w.response.status, x = w.response.data?.message || w.response.data?.error;
5337
5353
  h === 400 ? c = x || "Invalid request. Please check the application ID." : h === 401 ? c = "You are not authorized to access this configuration." : h === 403 ? c = "Access denied. You don't have permission to view this configuration." : h === 404 ? c = "Configuration not found. It may not exist yet or the application ID is incorrect." : h >= 500 ? c = x || "Server error. Please try again later." : c = x || `Failed to load configuration (Error ${h})`;
5338
5354
  } else w.request ? c = "Network error. Please check your connection and try again." : c = w.message || "An unexpected error occurred while loading configuration.";
5339
- ke.error(c), P();
5355
+ ke.error(c), E();
5340
5356
  } finally {
5341
5357
  N(!1);
5342
5358
  }
5343
5359
  };
5344
- r && (i(r), t ? f() : P());
5345
- }, [r, E, t, s]);
5346
- const A = (f, w) => {
5360
+ r && (i(r), t ? f() : E());
5361
+ }, [r, O, t, s]);
5362
+ const R = (f, w) => {
5347
5363
  y((c) => ({
5348
5364
  ...c,
5349
5365
  [f]: w
@@ -5351,7 +5367,7 @@ function Vn({
5351
5367
  const h = { ...c };
5352
5368
  return h[f] && delete h[f], h;
5353
5369
  });
5354
- }, U = () => {
5370
+ }, V = () => {
5355
5371
  const f = {};
5356
5372
  return !u || !d || u.configuration.forEach((w) => {
5357
5373
  if (w.type === "section")
@@ -5366,15 +5382,15 @@ function Vn({
5366
5382
  Array.isArray(c) && c.forEach((h, x) => {
5367
5383
  w.fields.forEach((F) => {
5368
5384
  if (F.required) {
5369
- const R = h[F.key];
5370
- (!R || typeof R == "string" && R.trim() === "") && (f[w.key] || (f[w.key] = {}), f[w.key][x] || (f[w.key][x] = {}), f[w.key][x][F.key] = `${F.label} is required`);
5385
+ const I = h[F.key];
5386
+ (!I || typeof I == "string" && I.trim() === "") && (f[w.key] || (f[w.key] = {}), f[w.key][x] || (f[w.key][x] = {}), f[w.key][x][F.key] = `${F.label} is required`);
5371
5387
  }
5372
5388
  });
5373
5389
  });
5374
5390
  }
5375
5391
  }), f;
5376
5392
  }, q = (f) => Object.keys(f).length > 0, G = () => {
5377
- const f = U();
5393
+ const f = V();
5378
5394
  if (g(f), q(f)) {
5379
5395
  let c = [];
5380
5396
  Object.keys(f).forEach((h) => {
@@ -5392,20 +5408,20 @@ function Vn({
5392
5408
  const c = {};
5393
5409
  d && Object.keys(d).forEach((x) => {
5394
5410
  const F = r?.configuration?.find(
5395
- (R) => R.key === x && R.type === "datatable"
5411
+ (I) => I.key === x && I.type === "datatable"
5396
5412
  );
5397
- F && Array.isArray(d[x]) ? c[x] = d[x].map((R) => {
5398
- const j = { id: R.id || 0 };
5413
+ F && Array.isArray(d[x]) ? c[x] = d[x].map((I) => {
5414
+ const j = { id: I.id || 0 };
5399
5415
  return F.fields && F.fields.forEach((S) => {
5400
5416
  if (S.fieldtype === "audience") {
5401
- let T = { users: [], groups: [], roles: [] };
5402
- R[S.key] && typeof R[S.key] == "object" && !Array.isArray(R[S.key]) && (T = {
5403
- users: R[S.key].users || [],
5404
- groups: R[S.key].groups || [],
5405
- roles: R[S.key].roles || []
5406
- }), j[S.key] = T;
5417
+ let A = { users: [], groups: [], roles: [] };
5418
+ I[S.key] && typeof I[S.key] == "object" && !Array.isArray(I[S.key]) && (A = {
5419
+ users: I[S.key].users || [],
5420
+ groups: I[S.key].groups || [],
5421
+ roles: I[S.key].roles || []
5422
+ }), j[S.key] = A;
5407
5423
  } else
5408
- j[S.key] = R[S.key] || "";
5424
+ j[S.key] = I[S.key] || "";
5409
5425
  }), j;
5410
5426
  }) : c[x] = d[x];
5411
5427
  });
@@ -5435,7 +5451,7 @@ function Vn({
5435
5451
  return /* @__PURE__ */ e("div", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-gray-500", children: "No configuration available" }) });
5436
5452
  const p = r?.configuration || u?.configuration;
5437
5453
  return X(() => {
5438
- s && r ? (!d || Object.keys(d).length === 0) && P() : s && !r && P();
5454
+ s && r ? (!d || Object.keys(d).length === 0) && E() : s && !r && E();
5439
5455
  }, [s, r]), /* @__PURE__ */ l("div", { children: [
5440
5456
  /* @__PURE__ */ l(
5441
5457
  "div",
@@ -5452,7 +5468,7 @@ function Vn({
5452
5468
  {
5453
5469
  item: f,
5454
5470
  data: d,
5455
- updateHandler: A,
5471
+ updateHandler: R,
5456
5472
  validationErrors: m
5457
5473
  },
5458
5474
  w
@@ -5489,7 +5505,7 @@ const ys = ({
5489
5505
  appid: r = "Configuration-Page",
5490
5506
  disableApi: s = !1
5491
5507
  }) => {
5492
- const [o, n] = O(0), [u, i] = O(!1), [d, y] = O(r), {
5508
+ const [o, n] = B(0), [u, i] = B(!1), [d, y] = B(r), {
5493
5509
  pageHeader: b = {},
5494
5510
  appletHeader: N = {},
5495
5511
  breadcrumb: a = [],
@@ -5541,11 +5557,11 @@ const ys = ({
5541
5557
  }, L = a.map((p) => ({
5542
5558
  label: p.text,
5543
5559
  href: p.href || "#"
5544
- })), E = K(() => {
5560
+ })), O = K(() => {
5545
5561
  console.log("handleCancelRequest called - showing modal"), i(!0);
5546
5562
  }, []), C = K((p) => {
5547
5563
  i(!1), p.primary ? (console.log("User confirmed cancel - navigating back"), window.history.back()) : console.log("User cancelled the cancel action - modal closed, data preserved");
5548
- }, []), I = () => {
5564
+ }, []), T = () => {
5549
5565
  for (const p of g)
5550
5566
  if (p.type === "section" && p.fields) {
5551
5567
  const f = p.fields.find((w) => w.key === "displayname");
@@ -5555,20 +5571,20 @@ const ys = ({
5555
5571
  return r;
5556
5572
  };
5557
5573
  ae.useEffect(() => {
5558
- y(I());
5574
+ y(T());
5559
5575
  }, [g]);
5560
- const P = K((p) => {
5576
+ const E = K((p) => {
5561
5577
  console.log("Config saved with data:", p), Object.keys(p).forEach((f) => {
5562
5578
  const w = p[f];
5563
5579
  console.log(`Checking section ${f}:`, w), w && w.displayname && (console.log("Found displayname:", w.displayname), y(w.displayname));
5564
5580
  });
5565
- }, []), A = {
5581
+ }, []), R = {
5566
5582
  subHeading: "Application configuration and details",
5567
5583
  tags: [],
5568
5584
  ...N,
5569
5585
  heading: d
5570
5586
  // Ensure displayname always overrides config heading
5571
- }, U = {
5587
+ }, V = {
5572
5588
  about: "This application provides comprehensive functionality for your organization.",
5573
5589
  images: {
5574
5590
  desktop: "https://via.placeholder.com/600x400?text=Desktop+View",
@@ -5587,8 +5603,8 @@ const ys = ({
5587
5603
  ],
5588
5604
  ...k
5589
5605
  }, q = [
5590
- { label: "Overview", content: v(U) },
5591
- { label: "Configuration", content: /* @__PURE__ */ e(Vn, { appid: r, configdata: { configuration: g }, disableApi: s, onCancel: E, onSave: P }) }
5606
+ { label: "Overview", content: v(V) },
5607
+ { label: "Configuration", content: /* @__PURE__ */ e(Un, { appid: r, configdata: { configuration: g }, disableApi: s, onCancel: O, onSave: E }) }
5592
5608
  ];
5593
5609
  function G(p) {
5594
5610
  return p ? p.includes("<svg") ? /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: p } }) : p : "📱";
@@ -5647,11 +5663,11 @@ const ys = ({
5647
5663
  }
5648
5664
  ),
5649
5665
  /* @__PURE__ */ l("div", { className: "bg-[#ffffff] border border-[#eef2f6] rounded-[12px] px-6 py-5 flex gap-4 items-start mb-4 shadow-sm", children: [
5650
- /* @__PURE__ */ e("div", { className: "icon w-[72px] h-[72px] rounded-full flex items-center justify-center bg-[#F5F5F6] text-[#1C274C] font-bold text-[18px]", children: G(A.icon) }),
5666
+ /* @__PURE__ */ e("div", { className: "icon w-[72px] h-[72px] rounded-full flex items-center justify-center bg-[#F5F5F6] text-[#1C274C] font-bold text-[18px]", children: G(R.icon) }),
5651
5667
  /* @__PURE__ */ l("div", { className: "flex flex-col min-w-0", children: [
5652
- /* @__PURE__ */ e("h2", { className: "text-[24px] font-semibold m-0 leading-tight truncate", children: A.heading }),
5653
- /* @__PURE__ */ e("p", { className: "text-[13px] text-[#101112] mt-1 mb-0 max-w-[800px] leading-normal", children: A.subHeading }),
5654
- /* @__PURE__ */ e("div", { className: "mt-2 flex flex-wrap gap-2", children: A.tags && A.tags.map((p, f) => /* @__PURE__ */ e(
5668
+ /* @__PURE__ */ e("h2", { className: "text-[24px] font-semibold m-0 leading-tight truncate", children: R.heading }),
5669
+ /* @__PURE__ */ e("p", { className: "text-[13px] text-[#101112] mt-1 mb-0 max-w-[800px] leading-normal", children: R.subHeading }),
5670
+ /* @__PURE__ */ e("div", { className: "mt-2 flex flex-wrap gap-2", children: R.tags && R.tags.map((p, f) => /* @__PURE__ */ e(
5655
5671
  "span",
5656
5672
  {
5657
5673
  className: "pill inline-block px-[10px] py-[6px] rounded-[14px] text-[11px] border border-[#e6e9ee] text-[#767676] font-semibold mt-1",
@@ -5735,27 +5751,27 @@ const bs = ({
5735
5751
  showAdd: $ = !1,
5736
5752
  // Additional props
5737
5753
  searchPlaceholder: L = "Search...",
5738
- handleRefreshClick: E = () => {
5754
+ handleRefreshClick: O = () => {
5739
5755
  },
5740
5756
  handleSearchChange: C = () => {
5741
5757
  },
5742
5758
  // Optional: override export file names
5743
- excelFileName: I,
5744
- pdfFileName: P
5759
+ excelFileName: T,
5760
+ pdfFileName: E
5745
5761
  }) => {
5746
- const A = () => n?.current || o?.current, [U, q] = ae.useState(""), G = (t || "export").toString().trim() || "export", v = `${I || G}.xlsx`, p = `${P || G}.pdf`, f = (h, x, F) => Math.max(x, Math.min(h, F)), w = K(
5762
+ const R = () => n?.current || o?.current, [V, q] = ae.useState(""), G = (t || "export").toString().trim() || "export", v = `${T || G}.xlsx`, p = `${E || G}.pdf`, f = (h, x, F) => Math.max(x, Math.min(h, F)), w = K(
5747
5763
  (h) => {
5748
- const x = A();
5764
+ const x = R();
5749
5765
  if (console.log("openColumnChooserNear", x), !!x?.openColumnChooser) {
5750
5766
  if (typeof window > "u" || !h?.currentTarget) {
5751
5767
  x.openColumnChooser();
5752
5768
  return;
5753
5769
  }
5754
5770
  try {
5755
- const F = h.currentTarget.getBoundingClientRect(), R = F.left + window.scrollX, j = F.bottom + window.scrollY;
5756
- let S = R - 120, T = j - 120;
5771
+ const F = h.currentTarget.getBoundingClientRect(), I = F.left + window.scrollX, j = F.bottom + window.scrollY;
5772
+ let S = I - 120, A = j - 120;
5757
5773
  const M = window.innerWidth, D = window.innerHeight;
5758
- S = f(S, window.scrollX + 8, window.scrollX + M - 340), T = f(T, window.scrollY, window.scrollY + D - 120), console.log("openColumnChooserNear", S, T), x.openColumnChooser(S, T);
5774
+ S = f(S, window.scrollX + 8, window.scrollX + M - 340), A = f(A, window.scrollY, window.scrollY + D - 120), console.log("openColumnChooserNear", S, A), x.openColumnChooser(S, A);
5759
5775
  } catch (F) {
5760
5776
  console.log("coloumn choose error", F);
5761
5777
  }
@@ -5765,7 +5781,7 @@ const bs = ({
5765
5781
  // no external deps; reads ref at call time
5766
5782
  ), c = K(
5767
5783
  (h, x) => {
5768
- const F = A();
5784
+ const F = R();
5769
5785
  if (F)
5770
5786
  switch (h) {
5771
5787
  case "ColumnChooser":
@@ -5781,11 +5797,11 @@ const bs = ({
5781
5797
  m && F.pdfExport?.({ fileName: p });
5782
5798
  break;
5783
5799
  case "Refresh":
5784
- g && E();
5800
+ g && O();
5785
5801
  break;
5786
5802
  }
5787
5803
  },
5788
- [b, a, k, m, g, v, p, E, w]
5804
+ [b, a, k, m, g, v, p, O, w]
5789
5805
  );
5790
5806
  return /* @__PURE__ */ l("div", { className: "flex items-center flex-wrap justify-between w-full px-4 py-2 bg-white border border-gray-200 rounded-t-2xl mb-0", children: [
5791
5807
  /* @__PURE__ */ l("div", { className: "flex flex-col", children: [
@@ -5801,7 +5817,7 @@ const bs = ({
5801
5817
  he,
5802
5818
  {
5803
5819
  placeholder: L,
5804
- value: U,
5820
+ value: V,
5805
5821
  onDebouncedChange: (h) => {
5806
5822
  q(h), C(h);
5807
5823
  }
@@ -5911,44 +5927,44 @@ function vs(t) {
5911
5927
  enableSearchApi: g = !1,
5912
5928
  height: $ = "600",
5913
5929
  selectionSettings: L = { type: "Multiple", mode: "Row" },
5914
- enableCheckbox: E = !1,
5930
+ enableCheckbox: O = !1,
5915
5931
  columns: C = [],
5916
- onGridStateChange: I,
5917
- onRowSelected: P,
5918
- onRowDeselected: A,
5919
- onRowDoubleClick: U,
5932
+ onGridStateChange: T,
5933
+ onRowSelected: E,
5934
+ onRowDeselected: R,
5935
+ onRowDoubleClick: V,
5920
5936
  apiRef: q,
5921
5937
  gridProps: G = {}
5922
5938
  } = t, v = ue(null), {
5923
5939
  pageSettings: p,
5924
5940
  sortSettings: f,
5925
5941
  ...w
5926
- } = G || {}, [c, h] = ae.useState(p?.page || 1), [x, F] = ae.useState(f?.pageSize || 20), [R, j] = ae.useState(f?.sortKey || "updatedDate"), [S, T] = ae.useState(f?.direction || "Descending"), M = ce(() => {
5927
- const B = [$r];
5928
- return i && B.push(Fr), d && B.push(Tr), y && B.push(Ar), g && B.push(Er), a && B.push(Rr), k && B.push(Ir), m && B.push(zr), N && B.push(Pr), b && B.push(Br), B.push(Lr), B;
5942
+ } = G || {}, [c, h] = ae.useState(p?.page || 1), [x, F] = ae.useState(f?.pageSize || 20), [I, j] = ae.useState(f?.sortKey || "updatedDate"), [S, A] = ae.useState(f?.direction || "Descending"), M = ce(() => {
5943
+ const P = [$r];
5944
+ return i && P.push(Fr), d && P.push(Tr), y && P.push(Ar), g && P.push(Er), a && P.push(Rr), k && P.push(Ir), m && P.push(zr), N && P.push(Pr), b && P.push(Br), P.push(Lr), P;
5929
5945
  }, [i, d, y, g, a, k, m, N, b]), D = ce(() => {
5930
- const B = () => v.current, te = (W, pe) => {
5946
+ const P = () => v.current, te = (W, pe) => {
5931
5947
  !pe && process.env.NODE_ENV !== "production" && console.warn(`[CustomDataGrid] ${W} requested but related service/feature is disabled.`);
5932
5948
  };
5933
5949
  return {
5934
- getInstance: () => B(),
5935
- refresh: () => B()?.refresh?.(),
5936
- getSelectedRecords: () => B()?.getSelectedRecords?.() ?? [],
5937
- clearSelection: () => B()?.clearSelection?.(),
5938
- selectRow: (W) => B()?.selectRow?.(W),
5939
- selectRows: (W) => B()?.selectRows?.(W),
5950
+ getInstance: () => P(),
5951
+ refresh: () => P()?.refresh?.(),
5952
+ getSelectedRecords: () => P()?.getSelectedRecords?.() ?? [],
5953
+ clearSelection: () => P()?.clearSelection?.(),
5954
+ selectRow: (W) => P()?.selectRow?.(W),
5955
+ selectRows: (W) => P()?.selectRows?.(W),
5940
5956
  search: (W) => {
5941
- te("search()", g), B()?.search?.(W);
5957
+ te("search()", g), P()?.search?.(W);
5942
5958
  },
5943
- print: () => B()?.print?.(),
5959
+ print: () => P()?.print?.(),
5944
5960
  excelExport: (W) => {
5945
- te("excelExport()", a), B()?.excelExport?.(W);
5961
+ te("excelExport()", a), P()?.excelExport?.(W);
5946
5962
  },
5947
5963
  pdfExport: (W) => {
5948
- te("pdfExport()", k), B()?.pdfExport?.(W);
5964
+ te("pdfExport()", k), P()?.pdfExport?.(W);
5949
5965
  },
5950
5966
  openColumnChooser: (W, pe) => {
5951
- te("openColumnChooser()", m), B()?.columnChooserModule?.openColumnChooser?.(W, pe);
5967
+ te("openColumnChooser()", m), P()?.columnChooserModule?.openColumnChooser?.(W, pe);
5952
5968
  }
5953
5969
  };
5954
5970
  }, []);
@@ -5957,14 +5973,14 @@ function vs(t) {
5957
5973
  }, [q, D]), X(() => () => {
5958
5974
  q && (q.current = null);
5959
5975
  }, []);
5960
- const z = (B) => {
5961
- const te = String(B || "");
5976
+ const z = (P) => {
5977
+ const te = String(P || "");
5962
5978
  return te === "Ascending" || te === "Descending" ? te : te.toLowerCase() === "ascending" ? "Ascending" : "Descending";
5963
- }, V = (B) => {
5964
- const te = v.current, W = B?.requestType, pe = W === "paging" ? "paging" : W === "sorting" ? "sorting" : W === "searching" ? "searching" : W === "filtering" ? "filtering" : W === "grouping" ? "grouping" : W === "reorder" ? "reorder" : W === "columnstate" ? "columnstate" : "other", $e = B?.pageSize ?? te?.pageSettings?.pageSize ?? x, Ie = B?.currentPage ?? te?.pageSettings?.currentPage ?? n, Je = B?.columnName && B?.direction ? [{ field: B.columnName, dir: z(B.direction) }] : (te?.sortSettings?.columns || []).map((Fe) => ({
5979
+ }, U = (P) => {
5980
+ const te = v.current, W = P?.requestType, pe = W === "paging" ? "paging" : W === "sorting" ? "sorting" : W === "searching" ? "searching" : W === "filtering" ? "filtering" : W === "grouping" ? "grouping" : W === "reorder" ? "reorder" : W === "columnstate" ? "columnstate" : "other", $e = P?.pageSize ?? te?.pageSettings?.pageSize ?? x, Ie = P?.currentPage ?? te?.pageSettings?.currentPage ?? n, Je = P?.columnName && P?.direction ? [{ field: P.columnName, dir: z(P.direction) }] : (te?.sortSettings?.columns || []).map((Fe) => ({
5965
5981
  field: Fe.field,
5966
5982
  dir: z(Fe.direction ?? Fe.dir)
5967
- })), Qe = B?.searchString ?? "", Xe = B?.columns ?? te?.filterSettings?.columns ?? [];
5983
+ })), Qe = P?.searchString ?? "", Xe = P?.columns ?? te?.filterSettings?.columns ?? [];
5968
5984
  return {
5969
5985
  reason: pe,
5970
5986
  page: { index: Ie, size: $e, skip: (Ie - 1) * $e, take: $e },
@@ -5972,17 +5988,17 @@ function vs(t) {
5972
5988
  // [{ field, dir: 'Ascending'|'Descending' }]
5973
5989
  search: Qe,
5974
5990
  filters: Xe,
5975
- rawEvent: B
5991
+ rawEvent: P
5976
5992
  };
5977
- }, Ne = (B) => {
5993
+ }, Ne = (P) => {
5978
5994
  setTimeout(() => {
5979
5995
  v?.current?.hideSpinner();
5980
- }, 1e3), B.requestType === "paging" && (h(B.currentPage), F(B.pageSize)), B.requestType === "sorting" && (j(B.columnName || "updatedDate"), T(B.direction === "Ascending" ? "ASC" : "DESC")), I && I(V(B), B);
5981
- }, ie = (B) => {
5982
- typeof U == "function" && U(B?.rowData, B);
5996
+ }, 1e3), P.requestType === "paging" && (h(P.currentPage), F(P.pageSize)), P.requestType === "sorting" && (j(P.columnName || "updatedDate"), A(P.direction === "Ascending" ? "ASC" : "DESC")), T && T(U(P), P);
5997
+ }, ie = (P) => {
5998
+ typeof V == "function" && V(P?.rowData, P);
5983
5999
  }, xe = () => {
5984
- const B = [];
5985
- return E && B.push(/* @__PURE__ */ e(ia, { type: "checkbox", width: "50" }, "__checkbox__")), C.forEach((te, W) => {
6000
+ const P = [];
6001
+ return O && P.push(/* @__PURE__ */ e(ia, { type: "checkbox", width: "50" }, "__checkbox__")), C.forEach((te, W) => {
5986
6002
  const {
5987
6003
  field: pe,
5988
6004
  headerText: $e,
@@ -6001,7 +6017,7 @@ function vs(t) {
6001
6017
  customAttributes: ct,
6002
6018
  ...dt
6003
6019
  } = te || {};
6004
- B.push(
6020
+ P.push(
6005
6021
  /* @__PURE__ */ e(
6006
6022
  ia,
6007
6023
  {
@@ -6025,7 +6041,7 @@ function vs(t) {
6025
6041
  pe || `col-${W}`
6026
6042
  )
6027
6043
  );
6028
- }), B;
6044
+ }), P;
6029
6045
  };
6030
6046
  return /* @__PURE__ */ l(
6031
6047
  Or,
@@ -6047,17 +6063,17 @@ function vs(t) {
6047
6063
  selectionSettings: L,
6048
6064
  pageSettings: { pageSize: 10, pageSizes: p?.pageSizes ?? [20, 40, 60, 80, 100] },
6049
6065
  sortSettings: f ?? {
6050
- columns: [{ field: R, direction: z(S) }],
6066
+ columns: [{ field: I, direction: z(S) }],
6051
6067
  allowUnsort: !1
6052
6068
  },
6053
6069
  actionBegin: Ne,
6054
- rowSelected: P,
6055
- rowDeselected: A,
6070
+ rowSelected: E,
6071
+ rowDeselected: R,
6056
6072
  recordDoubleClick: ie,
6057
6073
  ...w,
6058
6074
  children: [
6059
6075
  /* @__PURE__ */ e(Mr, { children: xe() }),
6060
- /* @__PURE__ */ e(Vr, { services: M })
6076
+ /* @__PURE__ */ e(Ur, { services: M })
6061
6077
  ]
6062
6078
  }
6063
6079
  );
@@ -6076,7 +6092,7 @@ export {
6076
6092
  gs as CustomTab,
6077
6093
  Ma as DatePicker,
6078
6094
  Jr as DateRangePicker,
6079
- Vn as DynamicConfig,
6095
+ Un as DynamicConfig,
6080
6096
  es as FileUploadModal,
6081
6097
  ys as FullConfigPage,
6082
6098
  ns as FullScreenLoader,
@@ -6089,7 +6105,7 @@ export {
6089
6105
  en as PageHeader,
6090
6106
  os as PageLayout,
6091
6107
  ts as Pagination,
6092
- Va as RadioGroup,
6108
+ Ua as RadioGroup,
6093
6109
  he as SearchBar,
6094
6110
  ra as Select,
6095
6111
  rs as Sidebar,