unifyedx-storybook-new 0.2.76 → 0.2.77

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.
@@ -160,7 +160,7 @@ const Dn = {
160
160
  onClick: F,
161
161
  ...E
162
162
  }) => {
163
- const I = h || m, P = u && !y, j = H(
163
+ const R = h || m, P = u && !y, j = H(
164
164
  "btn-base",
165
165
  Dn[N],
166
166
  $n[o],
@@ -176,7 +176,7 @@ const Dn = {
176
176
  "data-testid": t,
177
177
  type: s,
178
178
  className: j,
179
- disabled: I,
179
+ disabled: R,
180
180
  onClick: F,
181
181
  title: a || P && i || (typeof y == "string" ? y : void 0),
182
182
  "aria-label": i || P && a || (typeof y == "string" ? y : void 0),
@@ -718,7 +718,7 @@ const Dn = {
718
718
  },
719
719
  `${F.name}-${E}`
720
720
  )),
721
- u.map(({ file: F, message: E }, I) => /* @__PURE__ */ n(
721
+ u.map(({ file: F, message: E }, R) => /* @__PURE__ */ n(
722
722
  "li",
723
723
  {
724
724
  className: "file-item file-item--rejected",
@@ -740,14 +740,14 @@ const Dn = {
740
740
  "button",
741
741
  {
742
742
  type: "button",
743
- onClick: () => N(I),
743
+ onClick: () => N(R),
744
744
  className: "remove-file-button",
745
745
  children: /* @__PURE__ */ e(Le, { size: 16 })
746
746
  }
747
747
  )
748
748
  ]
749
749
  },
750
- `${F.name}-${I}`
750
+ `${F.name}-${R}`
751
751
  ))
752
752
  ] })
753
753
  ] })
@@ -855,7 +855,7 @@ const Dn = {
855
855
  };
856
856
  }), console.log("[storybook filter] Applied Filters:", x), typeof s == "function" && s({
857
857
  filters: x,
858
- activeCount: I
858
+ activeCount: R
859
859
  }), a();
860
860
  },
861
861
  enableReinitialize: !0
@@ -873,14 +873,14 @@ const Dn = {
873
873
  break;
874
874
  }
875
875
  return $[b] = O, $;
876
- }, {}), [l, F.values]), I = Object.values(E).filter(Boolean).length, P = ae(() => l.some(($) => {
876
+ }, {}), [l, F.values]), R = Object.values(E).filter(Boolean).length, P = ae(() => l.some(($) => {
877
877
  if ($.type !== "date") return !1;
878
878
  const x = F.values?.[$.key]?.values;
879
879
  if (!Array.isArray(x) || x.length < 2) return !1;
880
880
  const [b, S] = x;
881
881
  if (!b || !S) return !1;
882
- const O = b instanceof Date ? b : new Date(b), R = S instanceof Date ? S : new Date(S);
883
- return O > R;
882
+ const O = b instanceof Date ? b : new Date(b), I = S instanceof Date ? S : new Date(S);
883
+ return O > I;
884
884
  }), [l, F.values]), j = async ($, x) => {
885
885
  try {
886
886
  r((S) => ({ ...S, [$]: !0 }));
@@ -965,7 +965,7 @@ const Dn = {
965
965
  ] })
966
966
  ] });
967
967
  case "multiselect-users":
968
- const O = h[$] || [], R = y[$];
968
+ const O = h[$] || [], I = y[$];
969
969
  return /* @__PURE__ */ n("div", { className: "filter-panel-content", children: [
970
970
  /* @__PURE__ */ n("div", { className: "filter-operator-group", children: [
971
971
  /* @__PURE__ */ e("label", { className: "filter-label", children: "Operator:" }),
@@ -979,7 +979,7 @@ const Dn = {
979
979
  }
980
980
  )
981
981
  ] }),
982
- R ? /* @__PURE__ */ e("div", { className: "loading-spinner", children: /* @__PURE__ */ e("div", {}) }) : /* @__PURE__ */ e("div", { className: "filter-checkbox-list", children: O.length > 0 ? /* @__PURE__ */ n(te, { children: [
982
+ I ? /* @__PURE__ */ e("div", { className: "loading-spinner", children: /* @__PURE__ */ e("div", {}) }) : /* @__PURE__ */ e("div", { className: "filter-checkbox-list", children: O.length > 0 ? /* @__PURE__ */ n(te, { children: [
983
983
  /* @__PURE__ */ n("div", { className: "filter-checkbox-item", children: [
984
984
  /* @__PURE__ */ e(
985
985
  "input",
@@ -1038,9 +1038,9 @@ const Dn = {
1038
1038
  ] }) : /* @__PURE__ */ e("div", { className: "text-center py-4 text-gray-500 text-sm", children: "No users loaded." }) })
1039
1039
  ] });
1040
1040
  case "date":
1041
- const D = b.values || [], [f, g] = D, w = f && g, k = D[0] || null, T = D[1] || null, L = {
1042
- startDate: k instanceof Date ? k.toISOString().slice(0, 10) : null,
1043
- endDate: k instanceof Date ? k.toISOString().slice(0, 10) : null
1041
+ const D = b.values || [], [f, g] = D, k = f && g, w = D[0] || null, T = D[1] || null, L = {
1042
+ startDate: w instanceof Date ? w.toISOString().slice(0, 10) : null,
1043
+ endDate: w instanceof Date ? w.toISOString().slice(0, 10) : null
1044
1044
  }, C = {
1045
1045
  startDate: T instanceof Date ? T.toISOString().slice(0, 10) : null,
1046
1046
  endDate: T instanceof Date ? T.toISOString().slice(0, 10) : null
@@ -1076,7 +1076,7 @@ const Dn = {
1076
1076
  children: x.operators.map((A) => /* @__PURE__ */ e("option", { value: A, children: A === "in" ? "Is" : "Is not" }, A))
1077
1077
  }
1078
1078
  ),
1079
- w && /* @__PURE__ */ e(
1079
+ k && /* @__PURE__ */ e(
1080
1080
  "button",
1081
1081
  {
1082
1082
  type: "button",
@@ -1164,7 +1164,7 @@ const Dn = {
1164
1164
  }
1165
1165
  )
1166
1166
  ] }),
1167
- k && T && k > T && /* @__PURE__ */ e("div", { className: "text-red-500 text-xs mt-2", children: "End date must be after start date" })
1167
+ w && T && w > T && /* @__PURE__ */ e("div", { className: "text-red-500 text-xs mt-2", children: "End date must be after start date" })
1168
1168
  ] })
1169
1169
  ] });
1170
1170
  default:
@@ -1272,7 +1272,7 @@ const Dn = {
1272
1272
  children: [
1273
1273
  "Apply Filters",
1274
1274
  " ",
1275
- I > 0 ? `(${I})` : ""
1275
+ R > 0 ? `(${R})` : ""
1276
1276
  ]
1277
1277
  }
1278
1278
  )
@@ -2666,7 +2666,7 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
2666
2666
  },
2667
2667
  isChanged: u = !1
2668
2668
  }) => {
2669
- const [h, N] = B(Mt[0]), [y, r] = B(""), v = zt(y, 400), [d, p] = B([]), [z, F] = B(/* @__PURE__ */ new Set()), [E, I] = B(!1), [P, j] = B(Lt[0]), {
2669
+ const [h, N] = B(Mt[0]), [y, r] = B(""), v = zt(y, 400), [d, p] = B([]), [z, F] = B(/* @__PURE__ */ new Set()), [E, R] = B(!1), [P, j] = B(Lt[0]), {
2670
2670
  control: U,
2671
2671
  handleSubmit: Y,
2672
2672
  watch: q,
@@ -2674,14 +2674,14 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
2674
2674
  } = nr({
2675
2675
  defaultValues: { pendingInvites: [] },
2676
2676
  resolver: ir(rs)
2677
- }), { fields: b, append: S, remove: O, update: R } = sr({
2677
+ }), { fields: b, append: S, remove: O, update: I } = sr({
2678
2678
  control: U,
2679
2679
  name: "pendingInvites"
2680
2680
  }), D = q("pendingInvites");
2681
2681
  Z(() => {
2682
- v.length > 1 ? (I(!0), es(h.name, v).then((C) => {
2682
+ v.length > 1 ? (R(!0), es(h.name, v).then((C) => {
2683
2683
  p(C);
2684
- }).catch((C) => console.error("Search failed:", C)).finally(() => I(!1))) : (p([]), F(/* @__PURE__ */ new Set()));
2684
+ }).catch((C) => console.error("Search failed:", C)).finally(() => R(!1))) : (p([]), F(/* @__PURE__ */ new Set()));
2685
2685
  }, [v, h]);
2686
2686
  const f = (C) => {
2687
2687
  F((M) => {
@@ -2692,11 +2692,11 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
2692
2692
  d.filter((C) => z.has(C.id)).forEach((C) => {
2693
2693
  b.find((M) => M.id === C.id) || S({ ...C, permission: P.name });
2694
2694
  }), F(/* @__PURE__ */ new Set()), r("");
2695
- }, w = (C) => {
2695
+ }, k = (C) => {
2696
2696
  j(C), b.forEach(
2697
- (M, _) => R(_, { ...b[_], permission: C.name })
2697
+ (M, _) => I(_, { ...b[_], permission: C.name })
2698
2698
  );
2699
- }, k = async (C) => {
2699
+ }, w = async (C) => {
2700
2700
  try {
2701
2701
  if (l === ue.DRIVE) {
2702
2702
  const M = C.pendingInvites.map((A) => ({
@@ -2919,7 +2919,7 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
2919
2919
  K,
2920
2920
  {
2921
2921
  value: P,
2922
- onChange: w,
2922
+ onChange: k,
2923
2923
  children: /* @__PURE__ */ n("div", { className: "relative", children: [
2924
2924
  /* @__PURE__ */ n(K.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: [
2925
2925
  /* @__PURE__ */ n("span", { className: "flex items-center", children: [
@@ -3038,7 +3038,7 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
3038
3038
  /* @__PURE__ */ e(
3039
3039
  le,
3040
3040
  {
3041
- onClick: () => Y(k)(),
3041
+ onClick: () => Y(w)(),
3042
3042
  disabled: x || D.length === 0 && !u,
3043
3043
  label: x ? "Inviting..." : l === ue.DRIVE ? "Send Invites" : "Add"
3044
3044
  }
@@ -3141,29 +3141,29 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
3141
3141
  }) => {
3142
3142
  const [o, u] = B(l), [h, N] = B(0), [y, r] = B(""), v = zt(y, 300), d = {
3143
3143
  users: o.users.filter(
3144
- (I) => I.name.toLowerCase().includes(v.toLowerCase())
3144
+ (R) => R.name.toLowerCase().includes(v.toLowerCase())
3145
3145
  ),
3146
3146
  groups: o.groups.filter(
3147
- (I) => I.name.toLowerCase().includes(v.toLowerCase())
3147
+ (R) => R.name.toLowerCase().includes(v.toLowerCase())
3148
3148
  ),
3149
3149
  roles: o.roles.filter(
3150
- (I) => I.name.toLowerCase().includes(v.toLowerCase())
3150
+ (R) => R.name.toLowerCase().includes(v.toLowerCase())
3151
3151
  )
3152
- }, p = async (I, P, j, U) => {
3152
+ }, p = async (R, P, j, U) => {
3153
3153
  const Y = P.value;
3154
3154
  u((q) => ({
3155
3155
  ...q,
3156
3156
  [j]: q[j].map(
3157
- ($) => $.id === I.id ? { ...$, permission: Y } : $
3157
+ ($) => $.id === R.id ? { ...$, permission: Y } : $
3158
3158
  )
3159
3159
  }));
3160
3160
  }, z = () => {
3161
- const I = {
3161
+ const R = {
3162
3162
  users: o.users.filter((P) => P.permission !== "remove"),
3163
3163
  groups: o.groups.filter((P) => P.permission !== "remove"),
3164
3164
  roles: o.roles.filter((P) => P.permission !== "remove")
3165
3165
  };
3166
- a(I);
3166
+ a(R);
3167
3167
  }, F = ["users", "groups", "roles"], E = ["Users", "Groups", "Roles"];
3168
3168
  return (
3169
3169
  // The main structure remains the same...
@@ -3193,7 +3193,7 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
3193
3193
  /* @__PURE__ */ n("div", { className: "flex flex-col flex-grow", children: [
3194
3194
  /* @__PURE__ */ n(se.Group, { selectedIndex: h, onChange: N, children: [
3195
3195
  /* @__PURE__ */ n("div", { className: "p-4 bg-white border-b border-gray-300", children: [
3196
- /* @__PURE__ */ e(se.List, { className: "flex space-x-1 bg-gray-100 p-1 rounded-lg", children: E.map((I) => /* @__PURE__ */ e(
3196
+ /* @__PURE__ */ e(se.List, { className: "flex space-x-1 bg-gray-100 p-1 rounded-lg", children: E.map((R) => /* @__PURE__ */ e(
3197
3197
  se,
3198
3198
  {
3199
3199
  className: ({
@@ -3201,9 +3201,9 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
3201
3201
  }) => `w-full py-2 text-sm font-medium leading-5 rounded-md
3202
3202
  focus:outline-none focus:ring-2 ring-offset-2 ring-offset-blue-400 ring-white ring-opacity-60
3203
3203
  ${P ? "bg-white shadow text-blue-700" : "text-gray-600 hover:bg-white/[0.6]"}`,
3204
- children: I
3204
+ children: R
3205
3205
  },
3206
- I
3206
+ R
3207
3207
  )) }),
3208
3208
  /* @__PURE__ */ e("div", { className: "mt-4", children: /* @__PURE__ */ e(
3209
3209
  ge,
@@ -3221,11 +3221,11 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
3221
3221
  animate: { y: 0, opacity: 1 },
3222
3222
  exit: { y: -10, opacity: 0 },
3223
3223
  transition: { duration: 0.2 },
3224
- children: /* @__PURE__ */ e(se.Panels, { as: Q, children: F.map((I) => /* @__PURE__ */ e(
3224
+ children: /* @__PURE__ */ e(se.Panels, { as: Q, children: F.map((R) => /* @__PURE__ */ e(
3225
3225
  se.Panel,
3226
3226
  {
3227
3227
  className: "space-y-3 focus:outline-none",
3228
- children: /* @__PURE__ */ e(Se, { children: d[I].length > 0 ? d[I].map((P) => /* @__PURE__ */ n(
3228
+ children: /* @__PURE__ */ e(Se, { children: d[R].length > 0 ? d[R].map((P) => /* @__PURE__ */ n(
3229
3229
  ie.div,
3230
3230
  {
3231
3231
  layout: !0,
@@ -3249,12 +3249,12 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
3249
3249
  ),
3250
3250
  /* @__PURE__ */ n("div", { className: "overflow-hidden", children: [
3251
3251
  /* @__PURE__ */ e("p", { className: "font-medium text-gray-900 truncate", children: P.name }),
3252
- I !== "users" && /* @__PURE__ */ e(
3252
+ R !== "users" && /* @__PURE__ */ e(
3253
3253
  "button",
3254
3254
  {
3255
3255
  onClick: () => i({
3256
3256
  id: P.id,
3257
- type: I,
3257
+ type: R,
3258
3258
  name: P.name
3259
3259
  }),
3260
3260
  className: "text-sm text-blue-600 hover:underline hover:cursor-pointer",
@@ -3271,7 +3271,7 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
3271
3271
  onPermissionChange: (j) => p(
3272
3272
  P,
3273
3273
  j,
3274
- I
3274
+ R
3275
3275
  )
3276
3276
  }
3277
3277
  )
@@ -3299,7 +3299,7 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
3299
3299
  )
3300
3300
  ) })
3301
3301
  },
3302
- I
3302
+ R
3303
3303
  )) })
3304
3304
  },
3305
3305
  h
@@ -3450,26 +3450,26 @@ const Ee = Kn(), Ze = Ee.axiosGet, ql = Ee.axiosDelete, xt = Ee.axiosPost, Yl =
3450
3450
  allowedPermissions: u = [],
3451
3451
  ...h
3452
3452
  }) => {
3453
- const [N, y] = B(be.INVITE), [r, v] = B(t), [d, p] = B(null), [z, F] = B(!1), [E, I] = B([]), [P, j] = B(be.MANAGE), U = () => {
3453
+ const [N, y] = B(be.INVITE), [r, v] = B(t), [d, p] = B(null), [z, F] = B(!1), [E, R] = B([]), [P, j] = B(be.MANAGE), U = () => {
3454
3454
  y(be.INVITE), p(null), m();
3455
3455
  }, Y = () => {
3456
3456
  y(be.MANAGE);
3457
3457
  }, q = async ({ id: b, name: S, type: O }) => {
3458
3458
  if (O === "groups") {
3459
3459
  try {
3460
- const R = await Ze(`${Je.getMembersForGroup(S)}`);
3461
- } catch (R) {
3462
- console.log("Error searching entities:", R);
3460
+ const I = await Ze(`${Je.getMembersForGroup(S)}`);
3461
+ } catch (I) {
3462
+ console.log("Error searching entities:", I);
3463
3463
  }
3464
- I(resp);
3464
+ R(resp);
3465
3465
  }
3466
3466
  p({ id: b, type: O, name: S }), j(N), y(be.MEMBERS);
3467
3467
  }, $ = (b) => {
3468
3468
  console.log("changedExistingShares", b), v(b);
3469
3469
  const S = it.mapValues(t, (D) => D.map((f) => ({ id: f.id, permission: f.permission })).sort((f, g) => f.id - g.id)), O = it.mapValues(b, (D) => D.map((f) => ({ id: f.id, permission: f.permission })).sort((f, g) => f.id - g.id));
3470
3470
  console.log("Existing data:", S), console.log("Changed data:", O);
3471
- const R = !it.isEqual(S, O);
3472
- console.log("hasPermissionChanged:", R), F(R), y(N === be.MEMBERS ? P : be.INVITE);
3471
+ const I = !it.isEqual(S, O);
3472
+ console.log("hasPermissionChanged:", I), F(I), y(N === be.MEMBERS ? P : be.INVITE);
3473
3473
  };
3474
3474
  return /* @__PURE__ */ e(he, { appear: !0, show: a, as: Q, children: /* @__PURE__ */ n(ye, { as: "div", className: "relative z-50", onClose: U, children: [
3475
3475
  /* @__PURE__ */ e("div", { className: "filter-modal-overlay", "aria-hidden": "true" }),
@@ -3579,7 +3579,7 @@ function at({
3579
3579
  getOptionId: d = (z) => String(z.id),
3580
3580
  getOptionLabel: p = (z) => z.name
3581
3581
  }) {
3582
- const z = He(), F = He(), [E, I] = B(""), P = fe(""), j = ae(() => {
3582
+ const z = He(), F = He(), [E, R] = B(""), P = fe(""), j = ae(() => {
3583
3583
  const b = /* @__PURE__ */ new Map();
3584
3584
  for (const S of a) b.set(d(S), S);
3585
3585
  return b;
@@ -3654,13 +3654,13 @@ function at({
3654
3654
  ge,
3655
3655
  {
3656
3656
  value: E,
3657
- onDebouncedChange: I,
3657
+ onDebouncedChange: R,
3658
3658
  placeholder: N === "server" ? `Search (min ${v})…` : "Search options…"
3659
3659
  }
3660
3660
  ) }),
3661
3661
  N === "server" && r && /* @__PURE__ */ e("div", { className: "py-2 px-3 text-gray-500", children: "Loading…" }),
3662
3662
  q.length === 0 && !r ? /* @__PURE__ */ e("div", { className: "py-2 px-3 text-gray-500", children: N === "server" ? E.length < v ? `Type at least ${v} characters to search.` : "No results." : "No options found." }) : q.map((S) => {
3663
- const O = d(S), R = p(S), D = U.some((g) => d(g) === O), f = h !== -1 && U.length >= h && !D;
3663
+ const O = d(S), I = p(S), D = U.some((g) => d(g) === O), f = h !== -1 && U.length >= h && !D;
3664
3664
  return /* @__PURE__ */ e(
3665
3665
  K.Option,
3666
3666
  {
@@ -3670,7 +3670,7 @@ function at({
3670
3670
  f ? " text-gray-400 bg-white cursor-not-allowed" : g ? " bg-gray-200 text-gray-900" : " text-gray-900",
3671
3671
  " relative cursor-default select-none py-2 pl-3 pr-9"
3672
3672
  ),
3673
- children: ({ selected: g, active: w }) => /* @__PURE__ */ n(te, { children: [
3673
+ children: ({ selected: g, active: k }) => /* @__PURE__ */ n(te, { children: [
3674
3674
  /* @__PURE__ */ e(
3675
3675
  "span",
3676
3676
  {
@@ -3678,14 +3678,14 @@ function at({
3678
3678
  g ? "font-semibold" : "font-normal",
3679
3679
  "block truncate"
3680
3680
  ),
3681
- children: R
3681
+ children: I
3682
3682
  }
3683
3683
  ),
3684
3684
  g && /* @__PURE__ */ e(
3685
3685
  "span",
3686
3686
  {
3687
3687
  className: Ge(
3688
- w ? " text-gray-900" : " text-gray-600",
3688
+ k ? " text-gray-900" : " text-gray-600",
3689
3689
  " absolute inset-y-0 right-0 flex items-center pr-4"
3690
3690
  ),
3691
3691
  children: /* @__PURE__ */ e(et, { className: "w-5 h-5", "aria-hidden": "true" })
@@ -3857,7 +3857,7 @@ function ms({
3857
3857
  dropId: y,
3858
3858
  indent: r = 24
3859
3859
  }) {
3860
- const { setNodeRef: v, isOver: d } = dr({ id: y }), { attributes: p, listeners: z, setNodeRef: F, transform: E, isDragging: I } = mr({ id: N }), P = E ? { transform: `translate3d(${Math.round(E.x)}px, ${Math.round(E.y)}px, 0)` } : void 0, [j, U] = B(!1), [Y, q] = B(t.name), $ = () => {
3860
+ const { setNodeRef: v, isOver: d } = dr({ id: y }), { attributes: p, listeners: z, setNodeRef: F, transform: E, isDragging: R } = mr({ id: N }), P = E ? { transform: `translate3d(${Math.round(E.x)}px, ${Math.round(E.y)}px, 0)` } : void 0, [j, U] = B(!1), [Y, q] = B(t.name), $ = () => {
3861
3861
  const b = Y.trim();
3862
3862
  U(!1), b && b !== t.name ? o?.(t, b) : q(t.name);
3863
3863
  }, x = ae(() => /* @__PURE__ */ e(
@@ -3877,7 +3877,7 @@ function ms({
3877
3877
  "div",
3878
3878
  {
3879
3879
  ref: v,
3880
- className: `tv-row ${d ? "tv-drop-over" : ""} ${I ? "dragging" : ""}`,
3880
+ className: `tv-row ${d ? "tv-drop-over" : ""} ${R ? "dragging" : ""}`,
3881
3881
  style: { ...P, paddingLeft: 8 + a * r },
3882
3882
  onClick: (b) => {
3883
3883
  b.target.closest(".tv-toggle") || b.target.tagName === "INPUT" || l?.(t);
@@ -4002,17 +4002,17 @@ function Hl({
4002
4002
  const { roots: z } = ae(() => gs(t) ? fs(t, { rootId: a, getId: i, getName: m }) : bs(
4003
4003
  t.map((f) => ({ ...f })),
4004
4004
  { rootId: a, getId: i, getParent: l, getName: m }
4005
- ), [t, a, i, l, m]), [F, E] = B({}), I = ee((f) => {
4005
+ ), [t, a, i, l, m]), [F, E] = B({}), R = ee((f) => {
4006
4006
  const g = {};
4007
- return (function w(k) {
4008
- k.forEach((T) => {
4009
- g[T.id] = !0, T.children?.length && w(T.children);
4007
+ return (function k(w) {
4008
+ w.forEach((T) => {
4009
+ g[T.id] = !0, T.children?.length && k(T.children);
4010
4010
  });
4011
4011
  })(f), g;
4012
4012
  }, []);
4013
4013
  re.useEffect(() => {
4014
- E(I(z));
4015
- }, [z, I]);
4014
+ E(R(z));
4015
+ }, [z, R]);
4016
4016
  const P = ee(
4017
4017
  (f) => E((g) => ({ ...g, [f]: !g[f] })),
4018
4018
  []
@@ -4023,14 +4023,14 @@ function Hl({
4023
4023
  ), q = fe(null), [$, x] = B(null), b = fe(0), S = () => {
4024
4024
  }, O = ({ delta: f }) => {
4025
4025
  b.current = f?.x ?? 0;
4026
- }, R = ee(
4026
+ }, I = ee(
4027
4027
  ({ active: f, over: g }) => {
4028
- const w = b.current;
4028
+ const k = b.current;
4029
4029
  if (b.current = 0, x(null), !f || !g) return;
4030
- const k = String(f.id).replace(/^drag-/, ""), T = String(g.id).replace(/^drop-/, "");
4031
- if (!k || !T || k === T) return;
4030
+ const w = String(f.id).replace(/^drag-/, ""), T = String(g.id).replace(/^drop-/, "");
4031
+ if (!w || !T || w === T) return;
4032
4032
  let L = T;
4033
- const C = Math.max(0, Math.floor(-w / p));
4033
+ const C = Math.max(0, Math.floor(-k / p));
4034
4034
  if (C > 0) {
4035
4035
  let W = T;
4036
4036
  for (let pe = 0; pe < C; pe++) {
@@ -4047,42 +4047,42 @@ function Hl({
4047
4047
  U(Me(z));
4048
4048
  return;
4049
4049
  }
4050
- const M = Me(j), { newRoots: _, removed: A } = ys(M, k);
4050
+ const M = Me(j), { newRoots: _, removed: A } = ys(M, w);
4051
4051
  if (!A) return;
4052
4052
  const G = xs(_, L, A);
4053
- U(G), r?.({ sourceId: k, destParentId: L, newTree: G });
4053
+ U(G), r?.({ sourceId: w, destParentId: L, newTree: G });
4054
4054
  },
4055
4055
  [j, z, a, d, p, r]
4056
4056
  ), D = ee(
4057
- (f, g = 0) => f.map((w) => /* @__PURE__ */ n(re.Fragment, { children: [
4057
+ (f, g = 0) => f.map((k) => /* @__PURE__ */ n(re.Fragment, { children: [
4058
4058
  /* @__PURE__ */ e(
4059
4059
  ms,
4060
4060
  {
4061
- node: w,
4061
+ node: k,
4062
4062
  depth: g,
4063
- expanded: !!F[w.id],
4064
- onToggle: () => P(w.id),
4063
+ expanded: !!F[k.id],
4064
+ onToggle: () => P(k.id),
4065
4065
  onSelect: o,
4066
4066
  onCreateChild: h,
4067
4067
  onRename: N,
4068
4068
  onDelete: y,
4069
4069
  renderActions: v,
4070
- dragId: `drag-${w.id}`,
4071
- dropId: `drop-${w.id}`,
4070
+ dragId: `drag-${k.id}`,
4071
+ dropId: `drop-${k.id}`,
4072
4072
  indent: p
4073
4073
  }
4074
4074
  ),
4075
- F[w.id] && w.children?.length > 0 ? D(w.children, g + 1) : null
4076
- ] }, w.id)),
4075
+ F[k.id] && k.children?.length > 0 ? D(k.children, g + 1) : null
4076
+ ] }, k.id)),
4077
4077
  [F, p, h, y, N, o, v, P]
4078
4078
  );
4079
4079
  return re.useMemo(() => {
4080
4080
  if (!$) return null;
4081
4081
  const f = String($).replace(/^drag-/, "");
4082
- function g(w) {
4083
- for (const k of w) {
4084
- if (k.id === f) return k;
4085
- const T = k.children?.length ? g(k.children) : null;
4082
+ function g(k) {
4083
+ for (const w of k) {
4084
+ if (w.id === f) return w;
4085
+ const T = w.children?.length ? g(w.children) : null;
4086
4086
  if (T) return T;
4087
4087
  }
4088
4088
  return null;
@@ -4105,7 +4105,7 @@ function Hl({
4105
4105
  sensors: Y,
4106
4106
  onDragStart: S,
4107
4107
  onDragMove: O,
4108
- onDragEnd: R,
4108
+ onDragEnd: I,
4109
4109
  modifiers: [gr],
4110
4110
  children: /* @__PURE__ */ e("div", { ref: q, className: "tv-list", children: D(j, 0) })
4111
4111
  }
@@ -4707,22 +4707,22 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4707
4707
  p.current && clearTimeout(p.current);
4708
4708
  }, []);
4709
4709
  const z = (x) => {
4710
- const b = (R, D) => {
4711
- console.log("[DataTableRenderer] updateFieldValue called with:", { rowIndex: R, value: D, type: typeof D }), r((f) => {
4710
+ const b = (I, D) => {
4711
+ console.log("[DataTableRenderer] updateFieldValue called with:", { rowIndex: I, value: D, type: typeof D }), r((f) => {
4712
4712
  const g = [...f];
4713
- return g[R][x.key] = D, g;
4713
+ return g[I][x.key] = D, g;
4714
4714
  });
4715
- }, S = (R) => i[l.key]?.[R]?.[x.key], O = (R) => {
4716
- const D = S(R);
4715
+ }, S = (I) => i[l.key]?.[I]?.[x.key], O = (I) => {
4716
+ const D = S(I);
4717
4717
  return D ? /* @__PURE__ */ e("div", { className: "text-red-500 text-xs mt-1", children: D }) : null;
4718
4718
  };
4719
4719
  switch (x.fieldtype) {
4720
4720
  case "text":
4721
- return (R, D) => /* @__PURE__ */ n("div", { children: [
4721
+ return (I, D) => /* @__PURE__ */ n("div", { children: [
4722
4722
  /* @__PURE__ */ e(
4723
4723
  X,
4724
4724
  {
4725
- value: R[x.key] || "",
4725
+ value: I[x.key] || "",
4726
4726
  onChange: (f) => b(D, f.target.value),
4727
4727
  placeholder: x.placeholder || `Enter ${x.label}`,
4728
4728
  required: x.required,
@@ -4732,11 +4732,11 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4732
4732
  O(D)
4733
4733
  ] });
4734
4734
  case "textarea":
4735
- return (R, D) => /* @__PURE__ */ n("div", { children: [
4735
+ return (I, D) => /* @__PURE__ */ n("div", { children: [
4736
4736
  /* @__PURE__ */ e(
4737
4737
  fa,
4738
4738
  {
4739
- value: R[x.key] || "",
4739
+ value: I[x.key] || "",
4740
4740
  onChange: (f) => b(D, f.target.value),
4741
4741
  placeholder: x.placeholder || `Enter ${x.label}`,
4742
4742
  required: x.required,
@@ -4747,12 +4747,12 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4747
4747
  O(D)
4748
4748
  ] });
4749
4749
  case "number":
4750
- return (R, D) => /* @__PURE__ */ n("div", { children: [
4750
+ return (I, D) => /* @__PURE__ */ n("div", { children: [
4751
4751
  /* @__PURE__ */ e(
4752
4752
  X,
4753
4753
  {
4754
4754
  type: "number",
4755
- value: R[x.key] || "",
4755
+ value: I[x.key] || "",
4756
4756
  min: x.min,
4757
4757
  max: x.max,
4758
4758
  step: x.step,
@@ -4760,8 +4760,8 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4760
4760
  onBlur: (f) => {
4761
4761
  const g = f.target.value;
4762
4762
  if (g !== "" && g !== null && g !== void 0) {
4763
- const w = Number(g);
4764
- isNaN(w) || (x.min !== void 0 && w < x.min ? (f.target.setCustomValidity(`${x.label} must be at least ${x.min}`), f.target.reportValidity()) : x.max !== void 0 && w > x.max ? (f.target.setCustomValidity(`${x.label} must not exceed ${x.max}`), f.target.reportValidity()) : f.target.setCustomValidity(""));
4763
+ const k = Number(g);
4764
+ isNaN(k) || (x.min !== void 0 && k < x.min ? (f.target.setCustomValidity(`${x.label} must be at least ${x.min}`), f.target.reportValidity()) : x.max !== void 0 && k > x.max ? (f.target.setCustomValidity(`${x.label} must not exceed ${x.max}`), f.target.reportValidity()) : f.target.setCustomValidity(""));
4765
4765
  }
4766
4766
  },
4767
4767
  placeholder: x.placeholder || `Enter ${x.label}`,
@@ -4780,12 +4780,12 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4780
4780
  O(D)
4781
4781
  ] });
4782
4782
  case "email":
4783
- return (R, D) => /* @__PURE__ */ n("div", { children: [
4783
+ return (I, D) => /* @__PURE__ */ n("div", { children: [
4784
4784
  /* @__PURE__ */ e(
4785
4785
  X,
4786
4786
  {
4787
4787
  type: "email",
4788
- value: R[x.key] || "",
4788
+ value: I[x.key] || "",
4789
4789
  onChange: (f) => b(D, f.target.value),
4790
4790
  placeholder: x.placeholder || "Enter email address",
4791
4791
  required: x.required,
@@ -4795,12 +4795,12 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4795
4795
  O(D)
4796
4796
  ] });
4797
4797
  case "url":
4798
- return (R, D) => /* @__PURE__ */ n("div", { children: [
4798
+ return (I, D) => /* @__PURE__ */ n("div", { children: [
4799
4799
  /* @__PURE__ */ e(
4800
4800
  X,
4801
4801
  {
4802
4802
  type: "url",
4803
- value: R[x.key] || "",
4803
+ value: I[x.key] || "",
4804
4804
  onChange: (f) => b(D, f.target.value),
4805
4805
  placeholder: x.placeholder || "Enter URL",
4806
4806
  required: x.required,
@@ -4810,12 +4810,12 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4810
4810
  O(D)
4811
4811
  ] });
4812
4812
  case "password":
4813
- return (R, D) => /* @__PURE__ */ n("div", { children: [
4813
+ return (I, D) => /* @__PURE__ */ n("div", { children: [
4814
4814
  /* @__PURE__ */ e(
4815
4815
  X,
4816
4816
  {
4817
4817
  type: "password",
4818
- value: R[x.key] || "",
4818
+ value: I[x.key] || "",
4819
4819
  onChange: (f) => b(D, f.target.value),
4820
4820
  placeholder: x.placeholder || "Enter password",
4821
4821
  required: x.required,
@@ -4826,11 +4826,11 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4826
4826
  ] });
4827
4827
  case "select":
4828
4828
  case "dropdown":
4829
- return (R, D) => /* @__PURE__ */ n("div", { children: [
4829
+ return (I, D) => /* @__PURE__ */ n("div", { children: [
4830
4830
  /* @__PURE__ */ e(
4831
4831
  ft,
4832
4832
  {
4833
- value: R[x.key] || "",
4833
+ value: I[x.key] || "",
4834
4834
  onChange: (f) => b(D, f),
4835
4835
  options: x.options || [],
4836
4836
  placeholder: x.placeholder || `Select ${x.label}`,
@@ -4841,15 +4841,15 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4841
4841
  O(D)
4842
4842
  ] });
4843
4843
  case "selectDynamic":
4844
- return (R, D) => {
4844
+ return (I, D) => {
4845
4845
  const f = () => {
4846
4846
  if (x.optionsFrom && a) {
4847
- const { config: g, valueField: w, labelField: k } = x.optionsFrom, T = a[g] || [];
4847
+ const { config: g, valueField: k, labelField: w } = x.optionsFrom, T = a[g] || [];
4848
4848
  if (Array.isArray(T))
4849
4849
  return T.map((L) => ({
4850
- id: L[w] || "",
4851
- value: L[w] || "",
4852
- label: L[k] || ""
4850
+ id: L[k] || "",
4851
+ value: L[k] || "",
4852
+ label: L[w] || ""
4853
4853
  }));
4854
4854
  }
4855
4855
  return x.options || [];
@@ -4859,7 +4859,7 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4859
4859
  ft,
4860
4860
  {
4861
4861
  index: D,
4862
- value: R[x.key] || "",
4862
+ value: I[x.key] || "",
4863
4863
  onChange: (g) => b(D, g),
4864
4864
  options: f(),
4865
4865
  placeholder: x.placeholder || `Select ${x.label}`,
@@ -4872,8 +4872,8 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4872
4872
  ] });
4873
4873
  };
4874
4874
  case "multiselect":
4875
- return (R, D) => {
4876
- const f = R[x.key] || [];
4875
+ return (I, D) => {
4876
+ const f = I[x.key] || [];
4877
4877
  return /* @__PURE__ */ e(
4878
4878
  at,
4879
4879
  {
@@ -4887,10 +4887,10 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4887
4887
  };
4888
4888
  case "checkbox":
4889
4889
  case "boolean":
4890
- return (R, D) => /* @__PURE__ */ e(
4890
+ return (I, D) => /* @__PURE__ */ e(
4891
4891
  pt,
4892
4892
  {
4893
- checked: !!R[x.key],
4893
+ checked: !!I[x.key],
4894
4894
  onChange: (f) => b(D, f),
4895
4895
  label: x.placeholder || x.label,
4896
4896
  className: "w-full"
@@ -4898,31 +4898,31 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4898
4898
  );
4899
4899
  case "toggle":
4900
4900
  case "switch":
4901
- return (R, D) => /* @__PURE__ */ e(
4901
+ return (I, D) => /* @__PURE__ */ e(
4902
4902
  ya,
4903
4903
  {
4904
- isOn: !!R[x.key],
4904
+ isOn: !!I[x.key],
4905
4905
  onToggle: (f) => b(D, f),
4906
4906
  label: x.placeholder || x.label,
4907
4907
  className: "w-full"
4908
4908
  }
4909
4909
  );
4910
4910
  case "date":
4911
- return (R, D) => /* @__PURE__ */ e(
4911
+ return (I, D) => /* @__PURE__ */ e(
4912
4912
  ha,
4913
4913
  {
4914
- selectedDate: R[x.key] ? new Date(R[x.key]) : null,
4914
+ selectedDate: I[x.key] ? new Date(I[x.key]) : null,
4915
4915
  onDateChange: (f) => b(D, f ? f.toISOString().split("T")[0] : ""),
4916
4916
  placeholder: x.placeholder || "Select date",
4917
4917
  className: "w-full"
4918
4918
  }
4919
4919
  );
4920
4920
  case "datetime":
4921
- return (R, D) => /* @__PURE__ */ e(
4921
+ return (I, D) => /* @__PURE__ */ e(
4922
4922
  X,
4923
4923
  {
4924
4924
  type: "datetime-local",
4925
- value: R[x.key] || "",
4925
+ value: I[x.key] || "",
4926
4926
  onChange: (f) => b(D, f.target.value),
4927
4927
  placeholder: x.placeholder || "Select date and time",
4928
4928
  required: x.required,
@@ -4930,11 +4930,11 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4930
4930
  }
4931
4931
  );
4932
4932
  case "time":
4933
- return (R, D) => /* @__PURE__ */ e(
4933
+ return (I, D) => /* @__PURE__ */ e(
4934
4934
  X,
4935
4935
  {
4936
4936
  type: "time",
4937
- value: R[x.key] || "",
4937
+ value: I[x.key] || "",
4938
4938
  onChange: (f) => b(D, f.target.value),
4939
4939
  placeholder: x.placeholder || "Select time",
4940
4940
  required: x.required,
@@ -4942,41 +4942,41 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4942
4942
  }
4943
4943
  );
4944
4944
  case "radio":
4945
- return (R, D) => /* @__PURE__ */ e(
4945
+ return (I, D) => /* @__PURE__ */ e(
4946
4946
  pa,
4947
4947
  {
4948
- selectedValue: R[x.key] || "",
4948
+ selectedValue: I[x.key] || "",
4949
4949
  onValueChange: (f) => b(D, f),
4950
4950
  options: x.options || [],
4951
4951
  className: "w-full"
4952
4952
  }
4953
4953
  );
4954
4954
  case "search":
4955
- return (R, D) => /* @__PURE__ */ e(
4955
+ return (I, D) => /* @__PURE__ */ e(
4956
4956
  ge,
4957
4957
  {
4958
- value: R[x.key] || "",
4958
+ value: I[x.key] || "",
4959
4959
  onChange: (f) => b(D, f),
4960
4960
  placeholder: x.placeholder || `Search ${x.label}`,
4961
4961
  className: "w-full"
4962
4962
  }
4963
4963
  );
4964
4964
  case "audience":
4965
- return (R, D) => {
4966
- const f = R[x.key] || { users: [], groups: [], roles: [] }, g = [
4965
+ return (I, D) => {
4966
+ const f = I[x.key] || { users: [], groups: [], roles: [] }, g = [
4967
4967
  ...f.users || [],
4968
4968
  ...f.groups || [],
4969
4969
  ...f.roles || []
4970
4970
  ];
4971
4971
  return /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
4972
- /* @__PURE__ */ e(Ns, { children: g.length > 0 ? g.slice(0, 3).map((w, k) => /* @__PURE__ */ e(
4972
+ /* @__PURE__ */ e(Ns, { children: g.length > 0 ? g.slice(0, 3).map((k, w) => /* @__PURE__ */ e(
4973
4973
  we,
4974
4974
  {
4975
4975
  size: "small",
4976
- name: w.name || w.displayName || w.id,
4977
- src: w.avatarUrl
4976
+ name: k.name || k.displayName || k.id,
4977
+ src: k.avatarUrl
4978
4978
  },
4979
- k
4979
+ w
4980
4980
  )) : null }),
4981
4981
  /* @__PURE__ */ e(
4982
4982
  "button",
@@ -4991,22 +4991,22 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
4991
4991
  ] });
4992
4992
  };
4993
4993
  case "color":
4994
- return (R, D) => /* @__PURE__ */ e(
4994
+ return (I, D) => /* @__PURE__ */ e(
4995
4995
  X,
4996
4996
  {
4997
4997
  type: "color",
4998
- value: R[x.key] || "#000000",
4998
+ value: I[x.key] || "#000000",
4999
4999
  onChange: (f) => b(D, f.target.value),
5000
5000
  className: "w-full h-10"
5001
5001
  }
5002
5002
  );
5003
5003
  case "range":
5004
- return (R, D) => /* @__PURE__ */ n("div", { className: "w-full", children: [
5004
+ return (I, D) => /* @__PURE__ */ n("div", { className: "w-full", children: [
5005
5005
  /* @__PURE__ */ e(
5006
5006
  X,
5007
5007
  {
5008
5008
  type: "range",
5009
- value: R[x.key] || x.min || 0,
5009
+ value: I[x.key] || x.min || 0,
5010
5010
  onChange: (f) => b(D, f.target.value),
5011
5011
  min: x.min || 0,
5012
5012
  max: x.max || 100,
@@ -5014,10 +5014,10 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
5014
5014
  className: "w-full"
5015
5015
  }
5016
5016
  ),
5017
- /* @__PURE__ */ e("span", { className: "text-sm text-gray-500", children: R[x.key] || x.min || 0 })
5017
+ /* @__PURE__ */ e("span", { className: "text-sm text-gray-500", children: I[x.key] || x.min || 0 })
5018
5018
  ] });
5019
5019
  case "file":
5020
- return (R, D) => /* @__PURE__ */ e(
5020
+ return (I, D) => /* @__PURE__ */ e(
5021
5021
  X,
5022
5022
  {
5023
5023
  type: "file",
@@ -5030,21 +5030,21 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
5030
5030
  }
5031
5031
  );
5032
5032
  case "hidden":
5033
- return (R, D) => /* @__PURE__ */ e(
5033
+ return (I, D) => /* @__PURE__ */ e(
5034
5034
  X,
5035
5035
  {
5036
5036
  type: "hidden",
5037
- value: R[x.key] || "",
5037
+ value: I[x.key] || "",
5038
5038
  onChange: (f) => b(D, f.target.value)
5039
5039
  }
5040
5040
  );
5041
5041
  // Default fallback for unknown field types
5042
5042
  default:
5043
- return (R, D) => /* @__PURE__ */ n("div", { children: [
5043
+ return (I, D) => /* @__PURE__ */ n("div", { children: [
5044
5044
  /* @__PURE__ */ e(
5045
5045
  X,
5046
5046
  {
5047
- value: R[x.key] || "",
5047
+ value: I[x.key] || "",
5048
5048
  onChange: (f) => b(D, f.target.value),
5049
5049
  placeholder: x.placeholder || `Enter ${x.label}`,
5050
5050
  required: x.required,
@@ -5074,37 +5074,42 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
5074
5074
  const S = [...b];
5075
5075
  return S.splice(x, 1), S;
5076
5076
  });
5077
- }, []), [I, P] = B(null), j = ee((x, b) => {
5077
+ }, []), [R, P] = B(null), j = ee((x, b) => {
5078
5078
  P(b), x.dataTransfer.effectAllowed = "move", x.dataTransfer.setData("text/html", "");
5079
5079
  }, []), U = ee((x) => {
5080
5080
  x.preventDefault(), x.dataTransfer.dropEffect = "move";
5081
5081
  }, []), Y = ee((x, b) => {
5082
- x.preventDefault(), !(I === null || I === b) && (r((S) => {
5083
- const O = [...S], R = O[I];
5084
- return O.splice(I, 1), O.splice(b, 0, R), O;
5082
+ x.preventDefault(), !(R === null || R === b) && (r((S) => {
5083
+ const O = [...S], I = O[R];
5084
+ return O.splice(R, 1), O.splice(b, 0, I), O;
5085
5085
  }), P(null));
5086
- }, [I]), q = ee(() => {
5086
+ }, [R]), q = ee(() => {
5087
5087
  P(null);
5088
5088
  }, []), $ = ee((x, b) => {
5089
- console.log("[DataTableRenderer] handleAddAudience called with:", { selectedEntities: x, existingShares: b }), r((S) => {
5090
- const O = [...S];
5091
- if (o !== null && h && O[o]) {
5092
- const R = x.pendingInvites || [];
5093
- if (R.length > 0) {
5094
- const D = R.filter((w) => w.type === "User"), f = R.filter((w) => w.type === "Group"), g = R.filter((w) => w.type === "Role");
5095
- O[o][h] = {
5096
- users: [...O[o][h]?.users || [], ...D],
5097
- groups: [...O[o][h]?.groups || [], ...f],
5098
- roles: [...O[o][h]?.roles || [], ...g]
5089
+ console.log("[DataTableRenderer] handleAddAudience called with:", { selectedEntities: x, existingShares: b });
5090
+ const S = x.pendingInvites || [], O = !b || !b.users?.length && !b.groups?.length && !b.roles?.length;
5091
+ if (S.length === 0 && O) {
5092
+ console.log("[DataTableRenderer] Ignoring empty initial call from InviteFlow useEffect");
5093
+ return;
5094
+ }
5095
+ r((I) => {
5096
+ const D = [...I];
5097
+ if (o !== null && h && D[o]) {
5098
+ if (S.length > 0) {
5099
+ const f = S.filter((w) => w.type === "User"), g = S.filter((w) => w.type === "Group"), k = S.filter((w) => w.type === "Role");
5100
+ D[o][h] = {
5101
+ users: [...D[o][h]?.users || [], ...f],
5102
+ groups: [...D[o][h]?.groups || [], ...g],
5103
+ roles: [...D[o][h]?.roles || [], ...k]
5099
5104
  };
5100
- } else b && (O[o][h] = {
5105
+ } else b && !O && (D[o][h] = {
5101
5106
  users: b.users || [],
5102
5107
  groups: b.groups || [],
5103
5108
  roles: b.roles || []
5104
5109
  });
5105
- console.log("[DataTableRenderer] Updated audience data:", O[o][h]);
5110
+ console.log("[DataTableRenderer] Updated audience data:", D[o][h]);
5106
5111
  }
5107
- return O;
5112
+ return D;
5108
5113
  }), console.log("[DataTableRenderer] Closing modal after update"), u(null), N(null);
5109
5114
  }, [o, h]);
5110
5115
  return /* @__PURE__ */ n("div", { children: [
@@ -5138,7 +5143,7 @@ function ws({ item: t, data: a, updateHandler: s, validationErrors: i = {} }) {
5138
5143
  /* @__PURE__ */ e("tbody", { children: y.map((x, b) => /* @__PURE__ */ n(
5139
5144
  "tr",
5140
5145
  {
5141
- className: `hover:bg-gray-50 ${I === b ? "opacity-50" : ""}`,
5146
+ className: `hover:bg-gray-50 ${R === b ? "opacity-50" : ""}`,
5142
5147
  draggable: !0,
5143
5148
  onDragStart: (S) => j(S, b),
5144
5149
  onDragOver: U,
@@ -5204,7 +5209,7 @@ function Ss({
5204
5209
  onShowCancelModal: l,
5205
5210
  onCancel: m
5206
5211
  }) {
5207
- const [o, u] = re.useState(a), [h, N] = re.useState(null), [y, r] = re.useState(null), [v, d] = B(!1), [p, z] = B(!1), [F, E] = B({}), I = `${$e()}/unifyedxappmodulemanagement/api/v1/appmanager/${t}/configuration`, P = I, [j, U] = B(1), Y = () => {
5212
+ const [o, u] = re.useState(a), [h, N] = re.useState(null), [y, r] = re.useState(null), [v, d] = B(!1), [p, z] = B(!1), [F, E] = B({}), R = `${$e()}/unifyedxappmodulemanagement/api/v1/appmanager/${t}/configuration`, P = R, [j, U] = B(1), Y = () => {
5208
5213
  if (!y || !h)
5209
5214
  return console.log("[DynamicConfig] hasUnsavedChanges: false (no data)", { originalData: y, data: h }), !1;
5210
5215
  const f = (T) => {
@@ -5214,22 +5219,22 @@ function Ss({
5214
5219
  return Object.keys(T).sort().forEach((C) => {
5215
5220
  L[C] = f(T[C]);
5216
5221
  }), L;
5217
- }, g = f(y), w = f(h), k = JSON.stringify(g) !== JSON.stringify(w);
5218
- return console.log("[DynamicConfig] hasUnsavedChanges:", k, {
5222
+ }, g = f(y), k = f(h), w = JSON.stringify(g) !== JSON.stringify(k);
5223
+ return console.log("[DynamicConfig] hasUnsavedChanges:", w, {
5219
5224
  originalData: g,
5220
- currentData: w,
5225
+ currentData: k,
5221
5226
  originalRaw: y,
5222
5227
  currentRaw: h
5223
- }), k;
5228
+ }), w;
5224
5229
  }, q = (f) => {
5225
5230
  if (!a || !a.configuration)
5226
5231
  return f;
5227
- const g = {}, w = f?.configuration || {};
5228
- return a.configuration.forEach((k) => {
5229
- if (k.key && k.type === "datatable") {
5230
- const L = (w[k.key] || []).map((C, M) => {
5232
+ const g = {}, k = f?.configuration || {};
5233
+ return a.configuration.forEach((w) => {
5234
+ if (w.key && w.type === "datatable") {
5235
+ const L = (k[w.key] || []).map((C, M) => {
5231
5236
  const _ = { id: C.id || 0 };
5232
- return k.fields && k.fields.forEach((A) => {
5237
+ return w.fields && w.fields.forEach((A) => {
5233
5238
  if (A.fieldtype === "audience") {
5234
5239
  let G = { users: [], groups: [], roles: [] };
5235
5240
  C[A.key] && (Array.isArray(C[A.key]) ? G = { users: [], groups: [], roles: [] } : typeof C[A.key] == "object" && (G = {
@@ -5242,16 +5247,16 @@ function Ss({
5242
5247
  });
5243
5248
  if (L.length === 0) {
5244
5249
  const C = { id: 0 };
5245
- k.fields && k.fields.forEach((M) => {
5250
+ w.fields && w.fields.forEach((M) => {
5246
5251
  M.fieldtype === "audience" ? C[M.key] = { users: [], groups: [], roles: [] } : C[M.key] = M.default || "";
5247
5252
  }), L.push(C);
5248
5253
  }
5249
- g[k.key] = L;
5250
- } else if (k.key) {
5251
- const T = w[k.key] || {};
5252
- k.type === "section" && k.fields && k.fields.forEach((L) => {
5254
+ g[w.key] = L;
5255
+ } else if (w.key) {
5256
+ const T = k[w.key] || {};
5257
+ w.type === "section" && w.fields && w.fields.forEach((L) => {
5253
5258
  L.fieldtype === "managecollectionlist" && L.key && (!T[L.key] || !Array.isArray(T[L.key])) && (T[L.key] = L.initialData || []);
5254
- }), g[k.key] = T;
5259
+ }), g[w.key] = T;
5255
5260
  }
5256
5261
  }), g;
5257
5262
  }, $ = () => {
@@ -5260,15 +5265,15 @@ function Ss({
5260
5265
  a.configuration.forEach((g) => {
5261
5266
  if (g.key)
5262
5267
  if (g.type === "datatable") {
5263
- const w = { id: 0 };
5264
- g.fields && g.fields.forEach((k) => {
5265
- k.fieldtype === "audience" ? w[k.key] = { users: [], groups: [], roles: [] } : (k.fieldtype, w[k.key] = k.default || "");
5266
- }), f[g.key] = [w];
5268
+ const k = { id: 0 };
5269
+ g.fields && g.fields.forEach((w) => {
5270
+ w.fieldtype === "audience" ? k[w.key] = { users: [], groups: [], roles: [] } : (w.fieldtype, k[w.key] = w.default || "");
5271
+ }), f[g.key] = [k];
5267
5272
  } else if (g.type === "section") {
5268
- const w = {};
5269
- g.fields && Array.isArray(g.fields) && g.fields.forEach((k) => {
5270
- k.key && (k.fieldtype === "managecollectionlist" ? w[k.key] = k.initialData || [] : w[k.key] = k.default || "");
5271
- }), f[g.key] = w;
5273
+ const k = {};
5274
+ g.fields && Array.isArray(g.fields) && g.fields.forEach((w) => {
5275
+ w.key && (w.fieldtype === "managecollectionlist" ? k[w.key] = w.initialData || [] : k[w.key] = w.default || "");
5276
+ }), f[g.key] = k;
5272
5277
  } else
5273
5278
  f[g.key] = {};
5274
5279
  }), N(f), r(f);
@@ -5282,20 +5287,20 @@ function Ss({
5282
5287
  const f = async () => {
5283
5288
  try {
5284
5289
  d(!0);
5285
- let g = await Ze(I);
5290
+ let g = await Ze(R);
5286
5291
  if (g) {
5287
- const w = q(g);
5288
- N(w), r(w);
5292
+ const k = q(g);
5293
+ N(k), r(k);
5289
5294
  } else
5290
5295
  $();
5291
5296
  } catch (g) {
5292
5297
  console.error("Error fetching configuration:", g);
5293
- let w = "Failed to load configuration";
5298
+ let k = "Failed to load configuration";
5294
5299
  if (g.response) {
5295
- const k = g.response.status, T = g.response.data?.message || g.response.data?.error;
5296
- k === 400 ? w = T || "Invalid request. Please check the application ID." : k === 401 ? w = "You are not authorized to access this configuration." : k === 403 ? w = "Access denied. You don't have permission to view this configuration." : k === 404 ? w = "Configuration not found. It may not exist yet or the application ID is incorrect." : k >= 500 ? w = T || "Server error. Please try again later." : w = T || `Failed to load configuration (Error ${k})`;
5297
- } else g.request ? w = "Network error. Please check your connection and try again." : w = g.message || "An unexpected error occurred while loading configuration.";
5298
- qe.error(w), $();
5300
+ const w = g.response.status, T = g.response.data?.message || g.response.data?.error;
5301
+ w === 400 ? k = T || "Invalid request. Please check the application ID." : w === 401 ? k = "You are not authorized to access this configuration." : w === 403 ? k = "Access denied. You don't have permission to view this configuration." : w === 404 ? k = "Configuration not found. It may not exist yet or the application ID is incorrect." : w >= 500 ? k = T || "Server error. Please try again later." : k = T || `Failed to load configuration (Error ${w})`;
5302
+ } else g.request ? k = "Network error. Please check your connection and try again." : k = g.message || "An unexpected error occurred while loading configuration.";
5303
+ qe.error(k), $();
5299
5304
  } finally {
5300
5305
  d(!1);
5301
5306
  }
@@ -5303,36 +5308,36 @@ function Ss({
5303
5308
  a && (u(a), t ? f() : $());
5304
5309
  }, [a, j, t, s]);
5305
5310
  const x = (f, g) => {
5306
- console.log(`[DynamicConfig] handleSectionChange called for ${f}:`, g), N((w) => {
5307
- const k = {
5308
- ...w,
5311
+ console.log(`[DynamicConfig] handleSectionChange called for ${f}:`, g), N((k) => {
5312
+ const w = {
5313
+ ...k,
5309
5314
  [f]: g
5310
5315
  };
5311
- return console.log("[DynamicConfig] Updated data state:", k), k;
5312
- }), E((w) => {
5313
- const k = { ...w };
5314
- return k[f] && delete k[f], k;
5316
+ return console.log("[DynamicConfig] Updated data state:", w), w;
5317
+ }), E((k) => {
5318
+ const w = { ...k };
5319
+ return w[f] && delete w[f], w;
5315
5320
  });
5316
5321
  }, b = () => {
5317
5322
  const f = {};
5318
5323
  return !o || !h || o.configuration.forEach((g) => {
5319
5324
  if (g.type === "section")
5320
- g.fields.forEach((w) => {
5321
- const k = h[g.key]?.[w.key];
5322
- if (w.required && (!k || typeof k == "string" && k.trim() === "")) {
5323
- f[g.key] || (f[g.key] = {}), f[g.key][w.key] = `${w.label} is required`;
5325
+ g.fields.forEach((k) => {
5326
+ const w = h[g.key]?.[k.key];
5327
+ if (k.required && (!w || typeof w == "string" && w.trim() === "")) {
5328
+ f[g.key] || (f[g.key] = {}), f[g.key][k.key] = `${k.label} is required`;
5324
5329
  return;
5325
5330
  }
5326
- if (w.fieldtype === "number" && k !== "" && k !== null && k !== void 0) {
5327
- const T = Number(k);
5328
- isNaN(T) ? (f[g.key] || (f[g.key] = {}), f[g.key][w.key] = `${w.label} must be a valid number`) : (w.min !== void 0 && T < w.min && (f[g.key] || (f[g.key] = {}), f[g.key][w.key] = `${w.label} must be at least ${w.min}`), w.max !== void 0 && T > w.max && (f[g.key] || (f[g.key] = {}), f[g.key][w.key] = `${w.label} must not exceed ${w.max}`));
5331
+ if (k.fieldtype === "number" && w !== "" && w !== null && w !== void 0) {
5332
+ const T = Number(w);
5333
+ isNaN(T) ? (f[g.key] || (f[g.key] = {}), f[g.key][k.key] = `${k.label} must be a valid number`) : (k.min !== void 0 && T < k.min && (f[g.key] || (f[g.key] = {}), f[g.key][k.key] = `${k.label} must be at least ${k.min}`), k.max !== void 0 && T > k.max && (f[g.key] || (f[g.key] = {}), f[g.key][k.key] = `${k.label} must not exceed ${k.max}`));
5329
5334
  }
5330
5335
  });
5331
5336
  else if (g.type === "datatable") {
5332
- const w = h[g.key];
5333
- Array.isArray(w) && w.forEach((k, T) => {
5337
+ const k = h[g.key];
5338
+ Array.isArray(k) && k.forEach((w, T) => {
5334
5339
  g.fields.forEach((L) => {
5335
- const C = k[L.key];
5340
+ const C = w[L.key];
5336
5341
  if (L.required && (!C || typeof C == "string" && C.trim() === "")) {
5337
5342
  f[g.key] || (f[g.key] = {}), f[g.key][T] || (f[g.key][T] = {}), f[g.key][T][L.key] = `${L.label} is required`;
5338
5343
  return;
@@ -5353,12 +5358,12 @@ function Ss({
5353
5358
  console.log("[handleSave] Starting save process");
5354
5359
  const f = b();
5355
5360
  if (E(f), S(f)) {
5356
- let w = [];
5357
- Object.keys(f).forEach((k) => {
5358
- typeof f[k] == "object" && Object.keys(f[k]).forEach((T) => {
5359
- typeof f[k][T] == "object" ? Object.keys(f[k][T]).forEach((L) => {
5360
- w.push(`${k} row ${parseInt(T) + 1}: ${f[k][T][L]}`);
5361
- }) : w.push(`${k}: ${f[k][T]}`);
5361
+ let k = [];
5362
+ Object.keys(f).forEach((w) => {
5363
+ typeof f[w] == "object" && Object.keys(f[w]).forEach((T) => {
5364
+ typeof f[w][T] == "object" ? Object.keys(f[w][T]).forEach((L) => {
5365
+ k.push(`${w} row ${parseInt(T) + 1}: ${f[w][T][L]}`);
5366
+ }) : k.push(`${w}: ${f[w][T]}`);
5362
5367
  });
5363
5368
  });
5364
5369
  return;
@@ -5366,12 +5371,12 @@ function Ss({
5366
5371
  (async () => {
5367
5372
  try {
5368
5373
  z(!0);
5369
- const w = {};
5374
+ const k = {};
5370
5375
  h && Object.keys(h).forEach((T) => {
5371
5376
  const L = a?.configuration?.find(
5372
5377
  (C) => C.key === T && C.type === "datatable"
5373
5378
  );
5374
- L && Array.isArray(h[T]) ? w[T] = h[T].map((C) => {
5379
+ L && Array.isArray(h[T]) ? k[T] = h[T].map((C) => {
5375
5380
  const M = { id: C.id || 0 };
5376
5381
  return L.fields && L.fields.forEach((_) => {
5377
5382
  if (_.fieldtype === "audience") {
@@ -5384,22 +5389,22 @@ function Ss({
5384
5389
  } else
5385
5390
  M[_.key] = C[_.key] || "";
5386
5391
  }), M;
5387
- }) : w[T] = h[T];
5388
- }), (!w.appkey || w.appkey === "") && (w.appkey = t);
5389
- let k = await xt(P, w);
5390
- if (k && k.status != "fail") {
5392
+ }) : k[T] = h[T];
5393
+ }), (!k.appkey || k.appkey === "") && (k.appkey = t);
5394
+ let w = await xt(P, k);
5395
+ if (w && w.status != "fail") {
5391
5396
  E({}), r(JSON.parse(JSON.stringify(h)));
5392
- const T = k.message || "Configuration has been saved successfully";
5397
+ const T = w.message || "Configuration has been saved successfully";
5393
5398
  qe.success(T), i && typeof i == "function" && i(h);
5394
5399
  } else
5395
- throw qe.error(k?.message || "Failed to save configuration"), new Error("No response received from server");
5396
- } catch (w) {
5397
- console.error("Error saving configuration:", w), qe.error(w?.message || "Failed to save configuration");
5400
+ throw qe.error(w?.message || "Failed to save configuration"), new Error("No response received from server");
5401
+ } catch (k) {
5402
+ console.error("Error saving configuration:", k), qe.error(k?.message || "Failed to save configuration");
5398
5403
  } finally {
5399
5404
  z(!1);
5400
5405
  }
5401
5406
  })();
5402
- }, R = () => {
5407
+ }, I = () => {
5403
5408
  console.log("[DynamicConfig] handleCancel called"), Y() ? (console.log("[DynamicConfig] Unsaved changes detected - showing modal"), l ? l() : console.warn("[DynamicConfig] onShowCancelModal not provided, cannot show modal")) : (console.log("[DynamicConfig] No unsaved changes - going back directly"), m ? m() : (console.log("[DynamicConfig] Using fallback window.history.back()"), window.history.back()));
5404
5409
  };
5405
5410
  if (!o?.configuration && !a?.configuration)
@@ -5416,10 +5421,10 @@ function Ss({
5416
5421
  children: [
5417
5422
  v && /* @__PURE__ */ e("div", { className: "flex justify-center items-center h-64", children: /* @__PURE__ */ e(ba, { size: "large" }) }),
5418
5423
  !v && D?.map((f, g) => {
5419
- const w = zs(f.type);
5420
- if (w && w !== "UnknownType")
5424
+ const k = zs(f.type);
5425
+ if (k && k !== "UnknownType")
5421
5426
  return /* @__PURE__ */ e(
5422
- w,
5427
+ k,
5423
5428
  {
5424
5429
  item: f,
5425
5430
  data: h,
@@ -5437,7 +5442,7 @@ function Ss({
5437
5442
  le,
5438
5443
  {
5439
5444
  category: "secondary",
5440
- onClick: R,
5445
+ onClick: I,
5441
5446
  label: "Cancel",
5442
5447
  disabled: p,
5443
5448
  type: "button"
@@ -5469,18 +5474,18 @@ const Kl = ({
5469
5474
  configuration: r = []
5470
5475
  } = t, v = ae(() => r.map((b) => {
5471
5476
  if (b.type === "section" && b.fields) {
5472
- const S = [...b.fields], O = S.findIndex((R) => R && R.key === "appkey");
5477
+ const S = [...b.fields], O = S.findIndex((I) => I && I.key === "appkey");
5473
5478
  if (O !== -1) {
5474
- const R = S[O];
5479
+ const I = S[O];
5475
5480
  if (S[O] = {
5476
- ...R,
5481
+ ...I,
5477
5482
  default: a,
5478
5483
  value: a,
5479
5484
  readonly: !0,
5480
5485
  placeholder: a,
5481
5486
  disabled: !1
5482
5487
  }, S.some((f) => f.key === "displayname")) {
5483
- const f = S.findIndex((w) => w.key === "displayname"), g = S[f] || {};
5488
+ const f = S.findIndex((k) => k.key === "displayname"), g = S[f] || {};
5484
5489
  S[f] = {
5485
5490
  ...g,
5486
5491
  default: g.default || g.value || a,
@@ -5520,13 +5525,13 @@ const Kl = ({
5520
5525
  o(!1), b.primary && window.history.back();
5521
5526
  }, []), E = ee((b) => {
5522
5527
  console.log("Configuration changed:", b);
5523
- }, []), I = ee(() => {
5528
+ }, []), R = ee(() => {
5524
5529
  window.history.back();
5525
5530
  }, []), P = (() => {
5526
5531
  if (h.headingKey && Array.isArray(r)) {
5527
- const b = h.headingKey.split("."), S = b[0], O = b[1], R = r.find((D) => D && D.key === S);
5528
- if (R && R.fields) {
5529
- const D = R.fields.find((f) => f && f.key === O);
5532
+ const b = h.headingKey.split("."), S = b[0], O = b[1], I = r.find((D) => D && D.key === S);
5533
+ if (I && I.fields) {
5534
+ const D = I.fields.find((f) => f && f.key === O);
5530
5535
  if (D)
5531
5536
  return D.default ?? D.value ?? h.heading ?? a;
5532
5537
  }
@@ -5567,8 +5572,8 @@ const Kl = ({
5567
5572
  configuration: v
5568
5573
  }), [v]), q = ae(() => [
5569
5574
  { label: "Overview", content: x(U) },
5570
- { label: "Configuration", content: /* @__PURE__ */ e(Ss, { appid: a, configdata: Y, disableApi: s, onSave: E, onShowCancelModal: z, onCancel: I }) }
5571
- ], [a, Y, s, E, z, I, U]);
5575
+ { label: "Configuration", content: /* @__PURE__ */ e(Ss, { appid: a, configdata: Y, disableApi: s, onSave: E, onShowCancelModal: z, onCancel: R }) }
5576
+ ], [a, Y, s, E, z, R, U]);
5572
5577
  function $(b) {
5573
5578
  return b ? b.includes("<svg") ? /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: b } }) : b : "📱";
5574
5579
  }
@@ -5667,7 +5672,7 @@ const Kl = ({
5667
5672
  allowReorder: o = !0,
5668
5673
  initialData: u = null
5669
5674
  }) => {
5670
- const [h, N] = B(null), [y, r] = B(""), [v, d] = B(() => Array.isArray(u) ? u : []), [p, z] = B(null), [F, E] = B(null), [I, P] = B("");
5675
+ const [h, N] = B(null), [y, r] = B(""), [v, d] = B(() => Array.isArray(u) ? u : []), [p, z] = B(null), [F, E] = B(null), [R, P] = B("");
5671
5676
  Z(() => {
5672
5677
  Array.isArray(u) && d(u);
5673
5678
  }, [u]);
@@ -5675,52 +5680,52 @@ const Kl = ({
5675
5680
  l && (N(g._id), r(g.categoryName || ""));
5676
5681
  }, U = () => {
5677
5682
  if (!i || h !== null) return;
5678
- const w = (v.length > 0 ? Math.max(...v.map((k) => typeof k._id == "number" ? k._id : 0)) : 0) + 1;
5679
- d((k) => [
5680
- ...k,
5683
+ const k = (v.length > 0 ? Math.max(...v.map((w) => typeof w._id == "number" ? w._id : 0)) : 0) + 1;
5684
+ d((w) => [
5685
+ ...w,
5681
5686
  {
5682
- _id: w,
5687
+ _id: k,
5683
5688
  categoryName: "",
5684
5689
  links: [],
5685
- order: (k.at(-1)?.order ?? 0) + 1,
5690
+ order: (w.at(-1)?.order ?? 0) + 1,
5686
5691
  protected: !1,
5687
5692
  _class: "com.unifyed.model.Collection"
5688
5693
  }
5689
- ]), N(w), r("");
5694
+ ]), N(k), r("");
5690
5695
  }, Y = () => {
5691
5696
  h != null && (d((g) => {
5692
- const k = !Array.isArray(u) || !u.some((T) => T._id === h) ? g.filter((T) => T._id !== h) : g;
5693
- return a?.(k), k;
5697
+ const w = !Array.isArray(u) || !u.some((T) => T._id === h) ? g.filter((T) => T._id !== h) : g;
5698
+ return a?.(w), w;
5694
5699
  }), N(null), r(""));
5695
5700
  }, q = () => {
5696
5701
  h == null || !y.trim() || (d((g) => {
5697
- const w = g.map((k) => k._id === h ? {
5698
- ...k,
5702
+ const k = g.map((w) => w._id === h ? {
5703
+ ...w,
5699
5704
  categoryName: y.trim()
5700
- } : k);
5701
- return a?.(w), w;
5705
+ } : w);
5706
+ return a?.(k), k;
5702
5707
  }), N(null), r(""));
5703
5708
  }, $ = (g) => {
5704
- m && d((w) => {
5705
- const k = w.filter((T) => T._id !== g._id);
5706
- return a?.(k), k;
5709
+ m && d((k) => {
5710
+ const w = k.filter((T) => T._id !== g._id);
5711
+ return a?.(w), w;
5707
5712
  });
5708
- }, x = (g, w, k) => {
5709
- const T = Number(w), L = Number(k);
5713
+ }, x = (g, k, w) => {
5714
+ const T = Number(k), L = Number(w);
5710
5715
  if (!o || T === L) return g;
5711
5716
  const C = g.findIndex((G) => Number(G._id) === T), M = g.findIndex((G) => Number(G._id) === L);
5712
5717
  if (C === -1 || M === -1) return g;
5713
5718
  const _ = [...g], [A] = _.splice(C, 1);
5714
5719
  return _.splice(M, 0, A), _.map((G, W) => ({ ...G, order: W + 1 }));
5715
- }, b = (g, w) => {
5716
- o && (g.dataTransfer.effectAllowed = "move", g.dataTransfer.setData("text/plain", String(w)), z(Number(w)));
5720
+ }, b = (g, k) => {
5721
+ o && (g.dataTransfer.effectAllowed = "move", g.dataTransfer.setData("text/plain", String(k)), z(Number(k)));
5717
5722
  }, S = (g) => {
5718
5723
  p && g !== F && E(g);
5719
5724
  }, O = (g) => {
5720
5725
  g.preventDefault();
5721
- }, R = (g, w) => {
5726
+ }, I = (g, k) => {
5722
5727
  g.preventDefault();
5723
- const k = g.dataTransfer.getData("text/plain"), T = k === "0" ? 0 : Number(k), L = w === "0" ? 0 : Number(w);
5728
+ const w = g.dataTransfer.getData("text/plain"), T = w === "0" ? 0 : Number(w), L = k === "0" ? 0 : Number(k);
5724
5729
  T === void 0 || L === void 0 || (d((C) => {
5725
5730
  const M = x(C, T, L);
5726
5731
  return a?.(M), M;
@@ -5728,14 +5733,14 @@ const Kl = ({
5728
5733
  }, D = () => {
5729
5734
  z(null), E(null);
5730
5735
  }, f = Array.isArray(v) ? v.filter(
5731
- (g) => g.categoryName?.toLowerCase().includes(I.toLowerCase())
5736
+ (g) => g.categoryName?.toLowerCase().includes(R.toLowerCase())
5732
5737
  ) : [];
5733
5738
  return /* @__PURE__ */ n("div", { className: `manage-collection-list ${t}`, children: [
5734
5739
  /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ n("div", { className: "w-1/2 flex justify-end", children: [
5735
5740
  s && /* @__PURE__ */ e(
5736
5741
  ge,
5737
5742
  {
5738
- value: I,
5743
+ value: R,
5739
5744
  onDebouncedChange: P,
5740
5745
  placeholder: "Search Collection",
5741
5746
  customClass: "mr-4 searchmanagecollection"
@@ -5755,13 +5760,13 @@ const Kl = ({
5755
5760
  )
5756
5761
  ] }) }),
5757
5762
  /* @__PURE__ */ e("div", { className: "mt-5 flex flex-col", children: f.map((g) => {
5758
- const w = h === g._id, k = g?.links?.length ?? 0, T = p === g._id, L = F === g._id && p !== g._id;
5763
+ const k = h === g._id, w = g?.links?.length ?? 0, T = p === g._id, L = F === g._id && p !== g._id;
5759
5764
  return /* @__PURE__ */ e(
5760
5765
  "div",
5761
5766
  {
5762
5767
  onDragEnter: () => S(g._id),
5763
5768
  onDragOver: O,
5764
- onDrop: (C) => R(C, g._id),
5769
+ onDrop: (C) => I(C, g._id),
5765
5770
  onDragEnd: D,
5766
5771
  className: [
5767
5772
  "flex items-center justify-between p-3 border rounded-2xl mb-3",
@@ -5769,7 +5774,7 @@ const Kl = ({
5769
5774
  L ? "ring-2 ring-gray-800/20" : "",
5770
5775
  T ? "opacity-60" : ""
5771
5776
  ].join(" "),
5772
- children: w ? /* @__PURE__ */ n(te, { children: [
5777
+ children: k ? /* @__PURE__ */ n(te, { children: [
5773
5778
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2 flex-1", children: /* @__PURE__ */ e(
5774
5779
  "input",
5775
5780
  {
@@ -5825,7 +5830,7 @@ const Kl = ({
5825
5830
  /* @__PURE__ */ e("span", { children: g.categoryName })
5826
5831
  ] }),
5827
5832
  /* @__PURE__ */ n("div", { className: "flex gap-2 items-center", children: [
5828
- g.protected ? /* @__PURE__ */ e("span", { className: "text-sm text-gray-600 cursor-default", children: g.qlAppName }) : /* @__PURE__ */ e("span", { className: "text-sm text-blue-600 cursor-default", children: `${k} ${k === 1 ? "link" : "links"}` }),
5833
+ g.protected ? /* @__PURE__ */ e("span", { className: "text-sm text-gray-600 cursor-default", children: g.qlAppName }) : /* @__PURE__ */ e("span", { className: "text-sm text-blue-600 cursor-default", children: `${w} ${w === 1 ? "link" : "links"}` }),
5829
5834
  l && /* @__PURE__ */ e(
5830
5835
  "button",
5831
5836
  {
@@ -5838,10 +5843,10 @@ const Kl = ({
5838
5843
  m && /* @__PURE__ */ e(
5839
5844
  "span",
5840
5845
  {
5841
- className: k === 0 && !g.protected ? "cursor-pointer" : "cursor-not-allowed",
5842
- title: k === 0 && !g.protected ? "Delete" : "Cannot delete a collection with linked items",
5843
- onClick: k === 0 ? () => $(g) : null,
5844
- children: /* @__PURE__ */ e(Le, { color: k === 0 ? "#767676" : "#C2C2C2" })
5846
+ className: w === 0 && !g.protected ? "cursor-pointer" : "cursor-not-allowed",
5847
+ title: w === 0 && !g.protected ? "Delete" : "Cannot delete a collection with linked items",
5848
+ onClick: w === 0 ? () => $(g) : null,
5849
+ children: /* @__PURE__ */ e(Le, { color: w === 0 ? "#767676" : "#C2C2C2" })
5845
5850
  }
5846
5851
  )
5847
5852
  ] })
@@ -5945,7 +5950,7 @@ const Bt = () => {
5945
5950
  showAdd: F = !1,
5946
5951
  iSelectedRecords: E = 0,
5947
5952
  // Additional props
5948
- searchPlaceholder: I = "Search...",
5953
+ searchPlaceholder: R = "Search...",
5949
5954
  handleRefreshClick: P = () => {
5950
5955
  },
5951
5956
  handleSearchChange: j = () => {
@@ -5959,7 +5964,7 @@ const Bt = () => {
5959
5964
  searchIconClass: x,
5960
5965
  inputStyle: b
5961
5966
  }) => {
5962
- const S = () => l?.current || i?.current, [O, R] = re.useState(""), D = (t || "export").toString().trim() || "export", f = `${Y || D}.xlsx`, g = `${q || D}.pdf`, w = (L, C, M) => Math.max(C, Math.min(L, M)), k = ee(
5967
+ const S = () => l?.current || i?.current, [O, I] = re.useState(""), D = (t || "export").toString().trim() || "export", f = `${Y || D}.xlsx`, g = `${q || D}.pdf`, k = (L, C, M) => Math.max(C, Math.min(L, M)), w = ee(
5963
5968
  (L) => {
5964
5969
  const C = S();
5965
5970
  if (C?.openColumnChooser) {
@@ -5971,7 +5976,7 @@ const Bt = () => {
5971
5976
  const M = L.currentTarget.getBoundingClientRect(), _ = M.left + window.scrollX, A = M.bottom + window.scrollY;
5972
5977
  let G = _ - 120, W = A - 120;
5973
5978
  const pe = window.innerWidth, Ne = window.innerHeight;
5974
- G = w(G, window.scrollX + 8, window.scrollX + pe - 340), W = w(W, window.scrollY, window.scrollY + Ne - 120), C.openColumnChooser(G, W);
5979
+ G = k(G, window.scrollX + 8, window.scrollX + pe - 340), W = k(W, window.scrollY, window.scrollY + Ne - 120), C.openColumnChooser(G, W);
5975
5980
  } catch (M) {
5976
5981
  console.log("coloumn choose error", M);
5977
5982
  }
@@ -5992,7 +5997,7 @@ const Bt = () => {
5992
5997
  break;
5993
5998
  }
5994
5999
  case "ColumnChooser":
5995
- y && (C ? k(C) : M.openColumnChooser?.());
6000
+ y && (C ? w(C) : M.openColumnChooser?.());
5996
6001
  break;
5997
6002
  case "Print":
5998
6003
  v && M.print?.();
@@ -6008,7 +6013,7 @@ const Bt = () => {
6008
6013
  break;
6009
6014
  }
6010
6015
  },
6011
- [y, v, d, p, z, f, g, P, k]
6016
+ [y, v, d, p, z, f, g, P, w]
6012
6017
  );
6013
6018
  return /* @__PURE__ */ n("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: [
6014
6019
  /* @__PURE__ */ n("div", { className: "flex flex-col", children: [
@@ -6023,10 +6028,10 @@ const Bt = () => {
6023
6028
  h && /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
6024
6029
  ge,
6025
6030
  {
6026
- placeholder: I,
6031
+ placeholder: R,
6027
6032
  value: O,
6028
6033
  onDebouncedChange: (L) => {
6029
- R(L), j(L);
6034
+ I(L), j(L);
6030
6035
  },
6031
6036
  searchIconSize: $ || 16,
6032
6037
  searchIconClass: x || "",
@@ -6128,7 +6133,7 @@ function ai(t) {
6128
6133
  enableSearchApi: z = !1,
6129
6134
  height: F = "600",
6130
6135
  selectionSettings: E,
6131
- enableCheckbox: I = !1,
6136
+ enableCheckbox: R = !1,
6132
6137
  columns: P = [],
6133
6138
  onGridStateChange: j,
6134
6139
  onRowSelected: U,
@@ -6139,13 +6144,13 @@ function ai(t) {
6139
6144
  } = t, b = fe(null), {
6140
6145
  pageSettings: S,
6141
6146
  sortSettings: O,
6142
- ...R
6143
- } = x || {}, [D, f] = re.useState(S?.page || l), [g, w] = re.useState(S?.pageSize || m), [k, T] = re.useState(O?.sortKey || "updatedDate"), [L, C] = re.useState(O?.direction || "Descending"), M = ae(() => {
6147
+ ...I
6148
+ } = x || {}, [D, f] = re.useState(S?.page || l), [g, k] = re.useState(S?.pageSize || m), [w, T] = re.useState(O?.sortKey || "updatedDate"), [L, C] = re.useState(O?.direction || "Descending"), M = ae(() => {
6144
6149
  const V = E || {
6145
6150
  type: "Multiple",
6146
6151
  mode: "Row"
6147
6152
  };
6148
- return I ? {
6153
+ return R ? {
6149
6154
  ...V,
6150
6155
  // These are important for checkbox selection
6151
6156
  enableToggle: !0,
@@ -6154,9 +6159,9 @@ function ai(t) {
6154
6159
  checkboxOnly: !1,
6155
6160
  enableSimpleMultiRowSelection: !0
6156
6161
  } : V;
6157
- }, [E, I]), _ = ae(() => {
6162
+ }, [E, R]), _ = ae(() => {
6158
6163
  const V = [ln];
6159
- return (I || E) && V.push(on), u && V.push(cn), h && V.push(dn), N && V.push(mn), z && V.push(un), v && V.push(hn), d && V.push(pn), p && V.push(gn), r && V.push(bn), y && V.push(fn), V.push(yn), V;
6164
+ return (R || E) && V.push(on), u && V.push(cn), h && V.push(dn), N && V.push(mn), z && V.push(un), v && V.push(hn), d && V.push(pn), p && V.push(gn), r && V.push(bn), y && V.push(fn), V.push(yn), V;
6160
6165
  }, [
6161
6166
  u,
6162
6167
  h,
@@ -6167,7 +6172,7 @@ function ai(t) {
6167
6172
  p,
6168
6173
  r,
6169
6174
  y,
6170
- I,
6175
+ R,
6171
6176
  E
6172
6177
  ]), A = ae(() => {
6173
6178
  const V = () => b.current, ne = (J, ce) => {
@@ -6228,12 +6233,12 @@ function ai(t) {
6228
6233
  }, pe = (V) => {
6229
6234
  setTimeout(() => {
6230
6235
  b?.current?.hideSpinner();
6231
- }, 1e3), V.requestType === "paging" && (f(V.currentPage), w(V.pageSize)), V.requestType === "sorting" && (T(V.columnName || "updatedDate"), C(V.direction)), j?.(W(V), V);
6236
+ }, 1e3), V.requestType === "paging" && (f(V.currentPage), k(V.pageSize)), V.requestType === "sorting" && (T(V.columnName || "updatedDate"), C(V.direction)), j?.(W(V), V);
6232
6237
  }, Ne = (V) => {
6233
6238
  q?.(V?.rowData, V);
6234
6239
  }, Ta = () => {
6235
6240
  const V = [];
6236
- return I && V.push(
6241
+ return R && V.push(
6237
6242
  /* @__PURE__ */ e(
6238
6243
  $t,
6239
6244
  {
@@ -6296,9 +6301,9 @@ function ai(t) {
6296
6301
  pageSizes: S?.pageSizes ?? [10, 20, 40, 60, 80, 100],
6297
6302
  totalCount: s
6298
6303
  }), [D, g, S?.pageSizes, s]), Fa = ae(() => O ?? {
6299
- columns: [{ field: k, direction: G(L) }],
6304
+ columns: [{ field: w, direction: G(L) }],
6300
6305
  allowUnsort: !1
6301
- }, [O, k, L]);
6306
+ }, [O, w, L]);
6302
6307
  return /* @__PURE__ */ n(
6303
6308
  xn,
6304
6309
  {
@@ -6324,7 +6329,7 @@ function ai(t) {
6324
6329
  rowDeselected: Y,
6325
6330
  recordDoubleClick: Ne,
6326
6331
  cssClass: "custom-grid-padding",
6327
- ...R,
6332
+ ...I,
6328
6333
  children: [
6329
6334
  /* @__PURE__ */ e(vn, { children: Ta() }),
6330
6335
  /* @__PURE__ */ e(Nn, { services: _ })
@@ -7050,8 +7055,8 @@ function Ws({
7050
7055
  selectedIndex: u = 0,
7051
7056
  ...h
7052
7057
  }) {
7053
- const [N, y] = B(u), r = de(t), v = me[r], d = Gs[r], p = o[N] || o[0], z = (E, I) => {
7054
- y(I), i?.(E);
7058
+ const [N, y] = B(u), r = de(t), v = me[r], d = Gs[r], p = o[N] || o[0], z = (E, R) => {
7059
+ y(R), i?.(E);
7055
7060
  }, F = r === "lg";
7056
7061
  return /* @__PURE__ */ n(
7057
7062
  oe,
@@ -7071,29 +7076,29 @@ function Ws({
7071
7076
  F ? (
7072
7077
  // Large: Two-column layout
7073
7078
  /* @__PURE__ */ n("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-6", children: [
7074
- /* @__PURE__ */ e("div", { className: "space-y-1", children: o.map((E, I) => /* @__PURE__ */ e(
7079
+ /* @__PURE__ */ e("div", { className: "space-y-1", children: o.map((E, R) => /* @__PURE__ */ e(
7075
7080
  _t,
7076
7081
  {
7077
7082
  ev: E,
7078
7083
  sizeMeta: d,
7079
- isSelected: I === N,
7080
- onClick: (P) => z(P, I)
7084
+ isSelected: R === N,
7085
+ onClick: (P) => z(P, R)
7081
7086
  },
7082
- E._id || E.id || I
7087
+ E._id || E.id || R
7083
7088
  )) }),
7084
7089
  /* @__PURE__ */ e(Ys, { ev: p, sizeMeta: d })
7085
7090
  ] })
7086
7091
  ) : (
7087
7092
  // Small/Medium: Simple list only
7088
- /* @__PURE__ */ e("div", { className: "space-y-1", children: o.map((E, I) => /* @__PURE__ */ e(
7093
+ /* @__PURE__ */ e("div", { className: "space-y-1", children: o.map((E, R) => /* @__PURE__ */ e(
7089
7094
  _t,
7090
7095
  {
7091
7096
  ev: E,
7092
7097
  sizeMeta: d,
7093
- isSelected: I === N,
7094
- onClick: (P) => z(P, I)
7098
+ isSelected: R === N,
7099
+ onClick: (P) => z(P, R)
7095
7100
  },
7096
- E._id || E.id || I
7101
+ E._id || E.id || R
7097
7102
  )) })
7098
7103
  ),
7099
7104
  !F && /* @__PURE__ */ e("div", { className: "mt-4 pt-3 border-t border-zinc-200 dark:border-zinc-800", children: /* @__PURE__ */ e("button", { className: "w-full text-center text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-sm font-medium transition-colors duration-200", children: "View All" }) })
@@ -7272,7 +7277,7 @@ function Qs({
7272
7277
  }, E = (P) => {
7273
7278
  const j = { ...P, starred: !P.starred };
7274
7279
  h?.(j);
7275
- }, I = (P) => {
7280
+ }, R = (P) => {
7276
7281
  const j = { ...P, pinned: !P.pinned };
7277
7282
  N?.(j);
7278
7283
  };
@@ -7297,7 +7302,7 @@ function Qs({
7297
7302
  isSelected: j === r,
7298
7303
  onClick: (U) => F(U, j),
7299
7304
  onStar: E,
7300
- onPin: I
7305
+ onPin: R
7301
7306
  },
7302
7307
  P._id || P.id || j
7303
7308
  )) }),
@@ -7519,8 +7524,8 @@ function al({
7519
7524
  selectedIndex: u = 0,
7520
7525
  ...h
7521
7526
  }) {
7522
- const [N, y] = B(u), r = de(t), v = me[r], d = Ks[r], p = (E, I) => {
7523
- y(I), i?.(E);
7527
+ const [N, y] = B(u), r = de(t), v = me[r], d = Ks[r], p = (E, R) => {
7528
+ y(R), i?.(E);
7524
7529
  }, z = o[N] || o[0], F = d.layout === "split";
7525
7530
  return /* @__PURE__ */ n(
7526
7531
  oe,
@@ -7536,15 +7541,15 @@ function al({
7536
7541
  /* @__PURE__ */ e("div", { className: "flex items-center justify-between mb-4", children: /* @__PURE__ */ e("h3", { className: `font-semibold text-zinc-900 dark:text-zinc-100 ${v.title}`, children: m }) }),
7537
7542
  /* @__PURE__ */ e(tl, { sizeMeta: d }),
7538
7543
  F ? /* @__PURE__ */ n("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-6 min-h-0", children: [
7539
- /* @__PURE__ */ e("div", { className: "space-y-3", children: o.map((E, I) => /* @__PURE__ */ e(
7544
+ /* @__PURE__ */ e("div", { className: "space-y-3", children: o.map((E, R) => /* @__PURE__ */ e(
7540
7545
  Ut,
7541
7546
  {
7542
7547
  contact: E,
7543
7548
  sizeMeta: d,
7544
- isSelected: I === N,
7545
- onClick: (P) => p(P, I)
7549
+ isSelected: R === N,
7550
+ onClick: (P) => p(P, R)
7546
7551
  },
7547
- E._id || E.id || I
7552
+ E._id || E.id || R
7548
7553
  )) }),
7549
7554
  /* @__PURE__ */ e(
7550
7555
  el,
@@ -7555,15 +7560,15 @@ function al({
7555
7560
  )
7556
7561
  ] }) : (
7557
7562
  // Single column layout for small screens
7558
- /* @__PURE__ */ e("div", { className: "space-y-3", children: o.map((E, I) => /* @__PURE__ */ e(
7563
+ /* @__PURE__ */ e("div", { className: "space-y-3", children: o.map((E, R) => /* @__PURE__ */ e(
7559
7564
  Ut,
7560
7565
  {
7561
7566
  contact: E,
7562
7567
  sizeMeta: d,
7563
- isSelected: I === N,
7564
- onClick: (P) => p(P, I)
7568
+ isSelected: R === N,
7569
+ onClick: (P) => p(P, R)
7565
7570
  },
7566
- E._id || E.id || I
7571
+ E._id || E.id || R
7567
7572
  )) })
7568
7573
  ),
7569
7574
  /* @__PURE__ */ e("div", { className: "mt-4 pt-3 border-t border-zinc-200 dark:border-zinc-800", children: /* @__PURE__ */ e("button", { className: "w-full text-center text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-sm font-medium transition-colors duration-200", children: "View All" }) })
@@ -8282,7 +8287,7 @@ function fl({
8282
8287
  ...h
8283
8288
  }) {
8284
8289
  const [N, y] = B(o), r = de(t), v = me[r], d = hl[r], p = (E) => {
8285
- y((I) => I.filter((P) => P.id !== E.id));
8290
+ y((R) => R.filter((P) => P.id !== E.id));
8286
8291
  }, z = N.find((E) => E.type === "banner"), F = N.filter((E) => E.type !== "banner");
8287
8292
  return /* @__PURE__ */ n(
8288
8293
  oe,